@fern-api/typescript-dynamic-snippets 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +6 -6
  2. package/cjs/DynamicSnippetsGenerator.d.cts +4 -2
  3. package/cjs/{DynamicSnippetsGeneratorContext-DFkk3dho.d.cts → DynamicSnippetsGeneratorContext-CmDa2k9n.d.cts} +1 -1
  4. package/cjs/EndpointSnippetGenerator.cjs +6 -6
  5. package/cjs/EndpointSnippetGenerator.d.cts +1 -1
  6. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +11 -11
  7. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  8. package/cjs/context/DynamicTypeLiteralMapper.cjs +6 -6
  9. package/cjs/context/DynamicTypeLiteralMapper.d.cts +1 -1
  10. package/cjs/context/FilePropertyMapper.cjs +15 -15
  11. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  12. package/cjs/index.cjs +18 -18
  13. package/cjs/index.d.cts +2 -1
  14. package/esm/DynamicSnippetsGenerator.d.ts +4 -2
  15. package/esm/DynamicSnippetsGenerator.js +1 -1
  16. package/esm/{DynamicSnippetsGeneratorContext-DFkk3dho.d.ts → DynamicSnippetsGeneratorContext-CmDa2k9n.d.ts} +1 -1
  17. package/esm/EndpointSnippetGenerator.d.ts +1 -1
  18. package/esm/EndpointSnippetGenerator.js +1 -1
  19. package/esm/chunk-3SA25SVX.js +1 -0
  20. package/esm/chunk-D7ZDXIQ6.js +1 -0
  21. package/esm/{chunk-V6G7NZKW.js → chunk-DJQMPRPJ.js} +1 -1
  22. package/esm/chunk-JGNWFXNM.js +1 -0
  23. package/esm/chunk-RL2XA35J.js +27 -0
  24. package/esm/{chunk-25TNFA5L.js → chunk-T2HPPEKP.js} +1 -1
  25. package/esm/{chunk-LX5O4JB7.js → chunk-XC2QAVJY.js} +1 -1
  26. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  27. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  28. package/esm/context/DynamicTypeLiteralMapper.d.ts +1 -1
  29. package/esm/context/DynamicTypeLiteralMapper.js +1 -1
  30. package/esm/context/FilePropertyMapper.d.ts +1 -1
  31. package/esm/context/FilePropertyMapper.js +1 -1
  32. package/esm/index.d.ts +2 -1
  33. package/esm/index.js +10 -10
  34. package/package.json +1 -1
  35. package/esm/chunk-736FTN3M.js +0 -1
  36. package/esm/chunk-CQ55KPJT.js +0 -1
  37. package/esm/chunk-SQLJANKO.js +0 -1
  38. package/esm/chunk-YD6EIACZ.js +0 -27
package/cjs/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
2
2
  import '@fern-api/browser-compatible-base-generator';
3
3
  import '@fern-api/dynamic-ir-sdk';
4
- import './DynamicSnippetsGeneratorContext-DFkk3dho.cjs';
4
+ import './EndpointSnippetGenerator.cjs';
5
+ import './DynamicSnippetsGeneratorContext-CmDa2k9n.cjs';
5
6
  import '@fern-api/typescript-ast';
@@ -1,15 +1,17 @@
1
1
  import { AbstractDynamicSnippetsGenerator, FernGeneratorExec } from '@fern-api/browser-compatible-base-generator';
2
2
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
3
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-DFkk3dho.js';
3
+ import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
4
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-CmDa2k9n.js';
4
5
  import '@fern-api/typescript-ast';
5
6
 
6
- declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, FernIr.dynamic.EndpointSnippetRequest, FernIr.dynamic.EndpointSnippetResponse> {
7
+ declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
7
8
  constructor({ ir, config }: {
8
9
  ir: FernIr.dynamic.DynamicIntermediateRepresentation;
9
10
  config: FernGeneratorExec.GeneratorConfig;
10
11
  });
11
12
  generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
12
13
  generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
14
+ protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
13
15
  }
14
16
 
15
17
  export { DynamicSnippetsGenerator };
@@ -1 +1 @@
1
- import{a}from"./chunk-CQ55KPJT.js";import"./chunk-V6G7NZKW.js";import"./chunk-25TNFA5L.js";import"./chunk-SQLJANKO.js";import"./chunk-736FTN3M.js";import"./chunk-LX5O4JB7.js";import"./chunk-YD6EIACZ.js";export{a as DynamicSnippetsGenerator};
1
+ import{a}from"./chunk-3SA25SVX.js";import"./chunk-DJQMPRPJ.js";import"./chunk-T2HPPEKP.js";import"./chunk-D7ZDXIQ6.js";import"./chunk-JGNWFXNM.js";import"./chunk-XC2QAVJY.js";import"./chunk-RL2XA35J.js";export{a as DynamicSnippetsGenerator};
@@ -28,7 +28,7 @@ declare class DynamicTypeLiteralMapper {
28
28
  private convertObject;
29
29
  private convertEnum;
30
30
  private getEnumValue;
31
- private convertUndicriminatedUnion;
31
+ private convertUndiscriminatedUnion;
32
32
  private findMatchingUndiscriminatedUnionType;
33
33
  private convertUnknown;
34
34
  private convertPrimitive;
@@ -1,5 +1,5 @@
1
1
  import { FernIr } from '@fern-api/dynamic-ir-sdk';
2
- import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-DFkk3dho.js';
2
+ import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-CmDa2k9n.js';
3
3
  import '@fern-api/browser-compatible-base-generator';
4
4
  import '@fern-api/typescript-ast';
5
5
 
@@ -1 +1 @@
1
- import{a}from"./chunk-V6G7NZKW.js";import"./chunk-736FTN3M.js";import"./chunk-YD6EIACZ.js";export{a as EndpointSnippetGenerator};
1
+ import{a}from"./chunk-DJQMPRPJ.js";import"./chunk-JGNWFXNM.js";import"./chunk-RL2XA35J.js";export{a as EndpointSnippetGenerator};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-DJQMPRPJ.js";import{a as i}from"./chunk-T2HPPEKP.js";import{a as t}from"./chunk-JGNWFXNM.js";import{k as n,m as r}from"./chunk-RL2XA35J.js";n();r();var o=class extends t{constructor({ir:e,config:a}){super(new i({ir:e,config:a}))}async generate(e){return super.generate(e)}generateSync(e){return super.generateSync(e)}createSnippetGenerator(e){return new p({context:e})}};export{o as a};
@@ -0,0 +1 @@
1
+ import{b as o}from"./chunk-JGNWFXNM.js";import{j as u,k as p,m as y,n as c,p as r}from"./chunk-RL2XA35J.js";p();y();var v="value",d=class{constructor({context:e}){u(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:o.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 this.convertLiteral({literalType:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?r.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"nullable":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:c(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let n=this.context.getValueAsBoolean({value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.string(n)}default:c(e)}}convertList({list:e,value:t}){return Array.isArray(t)?r.TypeLiteral.array({values:t.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:o.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeLiteral.nop())}convertSet({set:e,value:t}){return Array.isArray(t)?r.TypeLiteral.set({values:t.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:o.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeLiteral.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:o.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),r.TypeLiteral.nop()):r.TypeLiteral.record({entries:Object.entries(t).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:e.key,value:n,as:"key"}),value:this.convert({typeReference:e.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:n}){var i;switch(e.type){case"alias":return(i=this.context.customConfig)!=null&&i.useBrandedStringAliases?r.TypeLiteral.reference(r.codeblock(a=>{a.writeNode(r.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})})),a.write("("),a.writeNode(this.convert({typeReference:e.typeReference,value:t,as:n})),a.write(")")})):this.convert({typeReference:e.typeReference,value:t,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:c(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){var l;let n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(n==null)return r.TypeLiteral.nop();let i=n.singleDiscriminatedUnionType,a=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:n,unionVariant:i});if(a==null)return r.TypeLiteral.nop();if((l=this.context.customConfig)!=null&&l.includeUtilsOnUnionMembers)return r.TypeLiteral.reference(r.codeblock(m=>{m.writeNode(r.invokeMethod({on:r.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})}),method:this.context.getMethodName(i.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:n,unionVariant:i,unionProperties:a})}))}));let s={name:this.context.getPropertyName(e.discriminant.name),value:r.TypeLiteral.string(i.discriminantValue.wireValue)};return r.TypeLiteral.object({fields:[s,...a]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t}){let n=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let i=this.context.resolveNamedType({typeId:t.typeId});if(i==null)return;let a=this.convertNamed({named:i,value:e.value});if(!a.isObject()){this.context.errors.add({severity:o.Critical,message:"Internal error; expected union value to be an object"});return}let s=a.asObjectOrThrow();return[...n,...s.fields]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let i=this.context.getRecord(e.value);return i==null?[...n,{name:v,value:this.convert({typeReference:t.typeReference,value:e.value})}]:[...n,{name:this.context.getPropertyName(t.discriminantValue.name),value:this.convert({typeReference:t.typeReference,value:i[t.discriminantValue.wireValue]})}]}finally{this.context.errors.unscope()}case"noProperties":return n;default:c(t)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:e,unionVariant:t,unionProperties:n}){return t.type==="singleProperty"&&this.context.getRecord(e.value)==null&&n.length===1?[this.convert({typeReference:t.typeReference,value:e.value})]:n.length>0?[r.TypeLiteral.object({fields:n})]:[]}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t}){var i,a;return this.context.associateByWireValue({parameters:(i=t.properties)!=null?i:[],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),value:this.convert(s)}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:t}){var i;let n=this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(t))!=null?i:{}});return r.TypeLiteral.object({fields:n.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getPropertyName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let n=this.getEnumValue({enum_:e,value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.string(n)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:o.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(i=>i.wireValue===t)==null){this.context.errors.add({severity:o.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return n==null?r.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let n of e.types)try{return this.convert({typeReference:n,value:t})}catch(i){continue}this.context.errors.add({severity:o.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e}){return r.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:n}){var i,a;switch(e){case"INTEGER":case"UINT":{let s=this.getValueAsNumber({value:t,as:n});return s==null?r.TypeLiteral.nop():r.TypeLiteral.number(s)}case"LONG":case"UINT_64":{let s=this.getValueAsNumber({value:t,as:n});return s==null?r.TypeLiteral.nop():(i=this.context.customConfig)!=null&&i.useBigInt?r.TypeLiteral.bigint(BigInt(s)):r.TypeLiteral.number(s)}case"FLOAT":case"DOUBLE":{let s=this.getValueAsNumber({value:t});return s==null?r.TypeLiteral.nop():r.TypeLiteral.number(s)}case"BOOLEAN":{let s=this.getValueAsBoolean({value:t,as:n});return s==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(s)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let s=this.context.getValueAsString({value:t});return s==null?r.TypeLiteral.nop():r.TypeLiteral.string(s)}case"DATE_TIME":{let s=this.context.getValueAsString({value:t});return s==null?r.TypeLiteral.nop():r.TypeLiteral.datetime(s)}case"BIG_INTEGER":{let s=this.context.getValueAsString({value:t});return s==null?r.TypeLiteral.nop():(a=this.context.customConfig)!=null&&a.useBigInt?r.TypeLiteral.bigint(BigInt(s)):r.TypeLiteral.string(s)}default:c(e)}}getValueAsNumber({value:e,as:t}){let n=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:e,as:t}){let n=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:n})}};export{d as a};
@@ -1 +1 @@
1
- import{b as c,e as o}from"./chunk-736FTN3M.js";import{j as F,k as v,m as P,n as u,p as n}from"./chunk-YD6EIACZ.js";v();P();var x="client",I="main",b={type:"primitive",value:"STRING"},R=class{constructor({context:e}){F(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}buildCodeBlock({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(n.function_({name:I,async:!0,parameters:[],body:n.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(n.invokeFunction({function_:n.reference({name:I}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return n.variable({name:x,const:!0,initializer:n.instantiateClass({class_:n.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return i.length>0&&r.push(...i),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:c.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(o.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r.length===0?n.TypeLiteral.nop():n.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:c.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return n.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:c.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return n.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?n.TypeLiteral.object({fields:Object.entries(t).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:b,value:i})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:c.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:c.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:c.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});default:u(e)}}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:n.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:n.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:n.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let i of e){let s=this.getConstructorHeaderArg({header:i,value:t.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.reference({name:x}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}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)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];if(this.context.errors.scope(o.PathParameters),e.pathParameters!=null){let i=this.getPathParameters({namedParameters:e.pathParameters,snippet:t});r.push(...i.map(s=>s.value))}return this.context.errors.unscope(),this.context.errors.scope(o.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}){return typeof e!="string"?(this.context.errors.add({severity:c.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeLiteral.nop()):n.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var m,h,p,l;let r=[],{inlinePathParameters:i,inlineFileProperties:s}={inlinePathParameters:(h=(m=this.context.customConfig)==null?void 0:m.inlinePathParameters)!=null?h:!1,inlineFileProperties:(l=(p=this.context.customConfig)==null?void 0:p.inlineFileProperties)!=null?l:!1};this.context.errors.scope(o.PathParameters);let a=[];e.pathParameters!=null&&a.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let g=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})||r.push(...a.map(d=>d.value)),s||r.push(...g.fileFields.map(d=>d.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:i,inlineFileProperties:s})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})?a:[],filePropertyInfo:g})),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:i}){var p,l,d,f;this.context.errors.scope(o.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(p=e.queryParameters)!=null?p:[],values:(l=t.queryParameters)!=null?l:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.Headers);let m=this.context.associateByWireValue({parameters:(d=e.headers)!=null?d:[],values:(f=t.headers)!=null?f:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let h=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),n.TypeLiteral.object({fields:[...r,...a,...m,...h]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:u(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({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)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){var s;let r=[],i=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],i=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};export{R as a};
1
+ import{b as c,d as o}from"./chunk-JGNWFXNM.js";import{j as F,k as v,m as P,n as u,p as n}from"./chunk-RL2XA35J.js";v();P();var x="client",I="main",b={type:"primitive",value:"STRING"},R=class{constructor({context:e}){F(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}buildCodeBlock({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(n.function_({name:I,async:!0,parameters:[],body:n.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(n.invokeFunction({function_:n.reference({name:I}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return n.variable({name:x,const:!0,initializer:n.instantiateClass({class_:n.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return i.length>0&&r.push(...i),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:c.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(o.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r.length===0?n.TypeLiteral.nop():n.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:c.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return n.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:c.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return n.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?n.TypeLiteral.object({fields:Object.entries(t).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:b,value:i})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:c.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:c.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:c.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});default:u(e)}}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:n.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:n.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:n.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let i of e){let s=this.getConstructorHeaderArg({header:i,value:t.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.reference({name:x}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}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)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];if(this.context.errors.scope(o.PathParameters),e.pathParameters!=null){let i=this.getPathParameters({namedParameters:e.pathParameters,snippet:t});r.push(...i.map(s=>s.value))}return this.context.errors.unscope(),this.context.errors.scope(o.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}){return typeof e!="string"?(this.context.errors.add({severity:c.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeLiteral.nop()):n.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var m,h,p,l;let r=[],{inlinePathParameters:i,inlineFileProperties:s}={inlinePathParameters:(h=(m=this.context.customConfig)==null?void 0:m.inlinePathParameters)!=null?h:!1,inlineFileProperties:(l=(p=this.context.customConfig)==null?void 0:p.inlineFileProperties)!=null?l:!1};this.context.errors.scope(o.PathParameters);let a=[];e.pathParameters!=null&&a.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let g=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})||r.push(...a.map(d=>d.value)),s||r.push(...g.fileFields.map(d=>d.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:i,inlineFileProperties:s})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:i})?a:[],filePropertyInfo:g})),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:i}){var p,l,d,f;this.context.errors.scope(o.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(p=e.queryParameters)!=null?p:[],values:(l=t.queryParameters)!=null?l:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.Headers);let m=this.context.associateByWireValue({parameters:(d=e.headers)!=null?d:[],values:(f=t.headers)!=null?f:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let h=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),n.TypeLiteral.object({fields:[...r,...a,...m,...h]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyObjectField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:u(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){var t;return(t=this.context.customConfig)!=null&&t.inlineFileProperties?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({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)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){var s;let r=[],i=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],i=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{}});for(let a of i)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};export{R as a};
@@ -0,0 +1 @@
1
+ import{a as P,b as T,c as S,d as b,j as a,k as p,m as l,n as f,o as E}from"./chunk-RL2XA35J.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(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}"`)}};var R=class{constructor(e){a(this,"context");this.context=e}async generate(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=await u.generateSnippet({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=u.generateSnippetSync({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var s={Critical:"CRITICAL",Warning:"WARNING"},g=class h{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new h;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var v=class{constructor(){a(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}){a(this,"config");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,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 u=e.find(m=>m.name.wireValue===n);if(u==null)throw this.newParameterNotRecognizedError(n);let o=this.isListTypeReference(u.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:u.name,typeReference:u.typeReference,value:o})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,u]of Object.entries(r)){this.errors.scope(i);try{let o=e.find(m=>m.name.wireValue===i);if(o==null){if(t)continue;this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:o.name,typeReference:o.typeReference,value:u})}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:s.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:s.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:s.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:s.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:s.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:s.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let u=e.types[i];if(u==null){this.errors.add({severity:s.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:o}=x,m=b(x,[S(n)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:m}}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:f(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:f(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:s.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:s.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:s.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:s.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:s.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:s.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:f(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:f(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:f(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{R as a,s as b,w as c,A as d};
@@ -0,0 +1,27 @@
1
+ var jt=Object.create;var Q=Object.defineProperty,Vt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptor,zt=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertyNames,tt=Object.getOwnPropertySymbols,Gt=Object.getPrototypeOf,ht=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable;var ft=(e,r,t)=>r in e?Q(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ce=(e,r)=>{for(var t in r||(r={}))ht.call(r,t)&&ft(e,t,r[t]);if(tt)for(var t of tt(r))xt.call(r,t)&&ft(e,t,r[t]);return e},pe=(e,r)=>Vt(e,zt(r));var me=e=>typeof e=="symbol"?e:e+"",we=(e,r)=>{var t={};for(var i in e)ht.call(e,i)&&r.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&tt)for(var i of tt(e))r.indexOf(i)<0&&xt.call(e,i)&&(t[i]=e[i]);return t};var lt=(e,r)=>()=>(e&&(r=e(e=0)),r);var de=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Qt=(e,r)=>{for(var t in r)Q(e,t,{get:r[t],enumerable:!0})},yt=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Ht(r))!ht.call(e,n)&&n!==t&&Q(e,n,{get:()=>r[n],enumerable:!(i=Jt(r,n))||i.enumerable});return e};var xe=(e,r,t)=>(t=e!=null?jt(Gt(e)):{},yt(r||!e||!e.__esModule?Q(t,"default",{value:e,enumerable:!0}):t,e)),ye=e=>yt(Q({},"__esModule",{value:!0}),e);var c=(e,r,t)=>ft(e,typeof r!="symbol"?r+"":r,t);function At(){throw new Error("setTimeout has not been defined")}function Tt(){throw new Error("clearTimeout has not been defined")}function Et(e){if(R===setTimeout)return setTimeout(e,0);if((R===At||!R)&&setTimeout)return R=setTimeout,setTimeout(e,0);try{return R(e,0)}catch(r){try{return R.call(null,e,0)}catch(t){return R.call(this,e,0)}}}function Xt(e){if(_===clearTimeout)return clearTimeout(e);if((_===Tt||!_)&&clearTimeout)return _=clearTimeout,clearTimeout(e);try{return _(e)}catch(r){try{return _.call(null,e)}catch(t){return _.call(this,e)}}}function Zt(){!O||!L||(O=!1,L.length?b=L.concat(b):rt=-1,b.length&&vt())}function vt(){if(!O){var e=Et(Zt);O=!0;for(var r=b.length;r;){for(L=b,b=[];++rt<r;)L&&L[rt].run();rt=-1,r=b.length}L=null,O=!1,Xt(e)}}function qt(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];b.push(new It(e,r)),b.length===1&&!O&&Et(vt)}function It(e,r){this.fun=e,this.array=r}function U(){}function wr(e){throw new Error("process.binding is not supported")}function dr(){return"/"}function xr(e){throw new Error("process.chdir is not supported")}function yr(){return 0}function Ar(e){var r=gr.call($)*.001,t=Math.floor(r),i=Math.floor(r%1*1e9);return e&&(t=t-e[0],i=i-e[1],i<0&&(t--,i+=1e9)),[t,i]}function Er(){var e=new Date,r=e-Tr;return r/1e3}var R,_,b,O,L,rt,Kt,tr,rr,er,ir,nr,or,sr,ar,ur,fr,hr,lr,cr,pr,mr,$,gr,Tr,d,gt,h=lt(()=>{"use strict";R=At,_=Tt;typeof globalThis.setTimeout=="function"&&(R=setTimeout);typeof globalThis.clearTimeout=="function"&&(_=clearTimeout);b=[],O=!1,rt=-1;It.prototype.run=function(){this.fun.apply(null,this.array)};Kt="browser",tr="browser",rr=!0,er={},ir=[],nr="",or={},sr={},ar={};ur=U,fr=U,hr=U,lr=U,cr=U,pr=U,mr=U;$=globalThis.performance||{},gr=$.now||$.mozNow||$.msNow||$.oNow||$.webkitNow||function(){return new Date().getTime()};Tr=new Date;d={nextTick:qt,title:Kt,browser:rr,env:er,argv:ir,version:nr,versions:or,on:ur,addListener:fr,once:hr,off:lr,removeListener:cr,removeAllListeners:pr,emit:mr,binding:wr,cwd:dr,chdir:xr,umask:yr,hrtime:Ar,platform:tr,release:sr,config:ar,uptime:Er},gt={};Object.keys(gt).forEach(e=>{let r=e.split("."),t=d;for(let i=0;i<r.length;i++){let n=r[i];i===r.length-1?t[n]=gt[e]:t=t[n]||(t[n]={})}})});function St(){pt=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,t=e.length;r<t;++r)v[r]=e[r],E[e.charCodeAt(r)]=r;E[45]=62,E[95]=63}function Ir(e){pt||St();var r,t,i,n,o,s,u=e.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=e[u-2]==="="?2:e[u-1]==="="?1:0,s=new vr(u*3/4-o),i=o>0?u-4:u;var f=0;for(r=0,t=0;r<i;r+=4,t+=3)n=E[e.charCodeAt(r)]<<18|E[e.charCodeAt(r+1)]<<12|E[e.charCodeAt(r+2)]<<6|E[e.charCodeAt(r+3)],s[f++]=n>>16&255,s[f++]=n>>8&255,s[f++]=n&255;return o===2?(n=E[e.charCodeAt(r)]<<2|E[e.charCodeAt(r+1)]>>4,s[f++]=n&255):o===1&&(n=E[e.charCodeAt(r)]<<10|E[e.charCodeAt(r+1)]<<4|E[e.charCodeAt(r+2)]>>2,s[f++]=n>>8&255,s[f++]=n&255),s}function Nr(e){return v[e>>18&63]+v[e>>12&63]+v[e>>6&63]+v[e&63]}function br(e,r,t){for(var i,n=[],o=r;o<t;o+=3)i=(e[o]<<16)+(e[o+1]<<8)+e[o+2],n.push(Nr(i));return n.join("")}function Nt(e){pt||St();for(var r,t=e.length,i=t%3,n="",o=[],s=16383,u=0,f=t-i;u<f;u+=s)o.push(br(e,u,u+s>f?f:u+s));return i===1?(r=e[t-1],n+=v[r>>2],n+=v[r<<4&63],n+="=="):i===2&&(r=(e[t-2]<<8)+e[t-1],n+=v[r>>10],n+=v[r>>4&63],n+=v[r<<2&63],n+="="),o.push(n),o.join("")}function et(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(e,r){if(et()<r)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(r),e.__proto__=a.prototype):(e===null&&(e=new a(r)),e.length=r),e}function a(e,r,t){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(e,r,t);if(typeof e=="number"){if(typeof r=="string")throw new Error("If encoding is specified then the first argument must be a string");return mt(this,e)}return Rt(this,e,r,t)}function Rt(e,r,t,i){if(typeof r=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&r instanceof ArrayBuffer?Rr(e,r,t,i):typeof r=="string"?Sr(e,r,t):_r(e,r)}function _t(e){if(typeof e!="number")throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function kr(e,r,t,i){return _t(r),r<=0?k(e,r):t!==void 0?typeof i=="string"?k(e,r).fill(t,i):k(e,r).fill(t):k(e,r)}function mt(e,r){if(_t(r),e=k(e,r<0?0:wt(r)|0),!a.TYPED_ARRAY_SUPPORT)for(var t=0;t<r;++t)e[t]=0;return e}function Sr(e,r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var i=Bt(r,t)|0;e=k(e,i);var n=e.write(r,t);return n!==i&&(e=e.slice(0,n)),e}function ct(e,r){var t=r.length<0?0:wt(r.length)|0;e=k(e,t);for(var i=0;i<t;i+=1)e[i]=r[i]&255;return e}function Rr(e,r,t,i){if(r.byteLength,t<0||r.byteLength<t)throw new RangeError("'offset' is out of bounds");if(r.byteLength<t+(i||0))throw new RangeError("'length' is out of bounds");return t===void 0&&i===void 0?r=new Uint8Array(r):i===void 0?r=new Uint8Array(r,t):r=new Uint8Array(r,t,i),a.TYPED_ARRAY_SUPPORT?(e=r,e.__proto__=a.prototype):e=ct(e,r),e}function _r(e,r){if(I(r)){var t=wt(r.length)|0;return e=k(e,t),e.length===0||r.copy(e,0,0,t),e}if(r){if(typeof ArrayBuffer!="undefined"&&r.buffer instanceof ArrayBuffer||"length"in r)return typeof r.length!="number"||Qr(r.length)?k(e,0):ct(e,r);if(r.type==="Buffer"&&Array.isArray(r.data))return ct(e,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function wt(e){if(e>=et())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et().toString(16)+" bytes");return e|0}function I(e){return!!(e!=null&&e._isBuffer)}function Bt(e,r){if(I(e))return e.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var t=e.length;if(t===0)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return it(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Mt(e).length;default:if(i)return it(e).length;r=(""+r).toLowerCase(),i=!0}}function Br(e,r,t){var i=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return Or(this,r,t);case"utf8":case"utf-8":return Ft(this,r,t);case"ascii":return Dr(this,r,t);case"latin1":case"binary":return $r(this,r,t);case"base64":return Yr(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wr(this,r,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function F(e,r,t){var i=e[r];e[r]=e[t],e[t]=i}function Lt(e,r,t,i,n){if(e.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=n?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(n)return-1;t=e.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof r=="string"&&(r=a.from(r,i)),I(r))return r.length===0?-1:bt(e,r,t,i,n);if(typeof r=="number")return r=r&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):bt(e,[r],t,i,n);throw new TypeError("val must be string, number or Buffer")}function bt(e,r,t,i,n){var o=1,s=e.length,u=r.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,s/=2,u/=2,t/=2}function f(T,D){return o===1?T[D]:T.readUInt16BE(D*o)}var m;if(n){var w=-1;for(m=t;m<s;m++)if(f(e,m)===f(r,w===-1?0:m-w)){if(w===-1&&(w=m),m-w+1===u)return w*o}else w!==-1&&(m-=m-w),w=-1}else for(t+u>s&&(t=s-u),m=t;m>=0;m--){for(var p=!0,y=0;y<u;y++)if(f(e,m+y)!==f(r,y)){p=!1;break}if(p)return m}return-1}function Lr(e,r,t,i){t=Number(t)||0;var n=e.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var u=parseInt(r.substr(s*2,2),16);if(isNaN(u))return s;e[t+s]=u}return s}function Ur(e,r,t,i){return st(it(r,e.length-t),e,t,i)}function Ut(e,r,t,i){return st(Hr(r),e,t,i)}function Fr(e,r,t,i){return Ut(e,r,t,i)}function Cr(e,r,t,i){return st(Mt(r),e,t,i)}function Pr(e,r,t,i){return st(Gr(r,e.length-t),e,t,i)}function Yr(e,r,t){return r===0&&t===e.length?Nt(e):Nt(e.slice(r,t))}function Ft(e,r,t){t=Math.min(e.length,t);for(var i=[],n=r;n<t;){var o=e[n],s=null,u=o>239?4:o>223?3:o>191?2:1;if(n+u<=t){var f,m,w,p;switch(u){case 1:o<128&&(s=o);break;case 2:f=e[n+1],(f&192)===128&&(p=(o&31)<<6|f&63,p>127&&(s=p));break;case 3:f=e[n+1],m=e[n+2],(f&192)===128&&(m&192)===128&&(p=(o&15)<<12|(f&63)<<6|m&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:f=e[n+1],m=e[n+2],w=e[n+3],(f&192)===128&&(m&192)===128&&(w&192)===128&&(p=(o&15)<<18|(f&63)<<12|(m&63)<<6|w&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=u}return Mr(i)}function Mr(e){var r=e.length;if(r<=kt)return String.fromCharCode.apply(String,e);for(var t="",i=0;i<r;)t+=String.fromCharCode.apply(String,e.slice(i,i+=kt));return t}function Dr(e,r,t){var i="";t=Math.min(e.length,t);for(var n=r;n<t;++n)i+=String.fromCharCode(e[n]&127);return i}function $r(e,r,t){var i="";t=Math.min(e.length,t);for(var n=r;n<t;++n)i+=String.fromCharCode(e[n]);return i}function Or(e,r,t){var i=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>i)&&(t=i);for(var n="",o=r;o<t;++o)n+=zr(e[o]);return n}function Wr(e,r,t){for(var i=e.slice(r,t),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}function g(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}function A(e,r,t,i,n,o){if(!I(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>n||r<o)throw new RangeError('"value" argument is out of bounds');if(t+i>e.length)throw new RangeError("Index out of range")}function nt(e,r,t,i){r<0&&(r=65535+r+1);for(var n=0,o=Math.min(e.length-t,2);n<o;++n)e[t+n]=(r&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}function ot(e,r,t,i){r<0&&(r=4294967295+r+1);for(var n=0,o=Math.min(e.length-t,4);n<o;++n)e[t+n]=r>>>(i?n:3-n)*8&255}function Ct(e,r,t,i,n,o){if(t+i>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Pt(e,r,t,i,n){return n||Ct(e,r,t,4,34028234663852886e22,-34028234663852886e22),$t(e,r,t,i,23,4),t+4}function Yt(e,r,t,i,n){return n||Ct(e,r,t,8,17976931348623157e292,-17976931348623157e292),$t(e,r,t,i,52,8),t+8}function Vr(e){if(e=Jr(e).replace(jr,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Jr(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function zr(e){return e<16?"0"+e.toString(16):e.toString(16)}function it(e,r){r=r||1/0;for(var t,i=e.length,n=null,o=[],s=0;s<i;++s){if(t=e.charCodeAt(s),t>55295&&t<57344){if(!n){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(r-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function Hr(e){for(var r=[],t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function Gr(e,r){for(var t,i,n,o=[],s=0;s<e.length&&!((r-=2)<0);++s)t=e.charCodeAt(s),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function Mt(e){return Ir(Vr(e))}function st(e,r,t,i){for(var n=0;n<i&&!(n+t>=r.length||n>=e.length);++n)r[n+t]=e[n];return n}function Qr(e){return e!==e}function Xr(e){return e!=null&&(!!e._isBuffer||Dt(e)||Zr(e))}function Dt(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function Zr(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Dt(e.slice(0,0))}function at(e,r,t,i,n){var o,s,u=n*8-i-1,f=(1<<u)-1,m=f>>1,w=-7,p=t?n-1:0,y=t?-1:1,T=e[r+p];for(p+=y,o=T&(1<<-w)-1,T>>=-w,w+=u;w>0;o=o*256+e[r+p],p+=y,w-=8);for(s=o&(1<<-w)-1,o>>=-w,w+=i;w>0;s=s*256+e[r+p],p+=y,w-=8);if(o===0)o=1-m;else{if(o===f)return s?NaN:(T?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-m}return(T?-1:1)*s*Math.pow(2,o-i)}function $t(e,r,t,i,n,o){var s,u,f,m=o*8-n-1,w=(1<<m)-1,p=w>>1,y=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:o-1,D=i?1:-1,Wt=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,s=w):(s=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+p>=1?r+=y/f:r+=y*Math.pow(2,1-p),r*f>=2&&(s++,f/=2),s+p>=w?(u=0,s=w):s+p>=1?(u=(r*f-1)*Math.pow(2,n),s=s+p):(u=r*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;e[t+T]=u&255,T+=D,u/=256,n-=8);for(s=s<<n|u,m+=n;m>0;e[t+T]=s&255,T+=D,s/=256,m-=8);e[t+T-D]|=Wt*128}var v,E,vr,pt,kt,jr,Ot=lt(()=>{"use strict";h();l();v=[],E=[],vr=typeof Uint8Array!="undefined"?Uint8Array:Array,pt=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(e){return e.__proto__=a.prototype,e};a.from=function(e,r,t){return Rt(null,e,r,t)};a.kMaxLength=et();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(e,r,t){return kr(null,e,r,t)};a.allocUnsafe=function(e){return mt(null,e)};a.allocUnsafeSlow=function(e){return mt(null,e)};a.isBuffer=Xr;a.compare=function(r,t){if(!I(r)||!I(t))throw new TypeError("Arguments must be Buffers");if(r===t)return 0;for(var i=r.length,n=t.length,o=0,s=Math.min(i,n);o<s;++o)if(r[o]!==t[o]){i=r[o],n=t[o];break}return i<n?-1:n<i?1:0};a.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}};a.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return a.alloc(0);var i;if(t===void 0)for(t=0,i=0;i<r.length;++i)t+=r[i].length;var n=a.allocUnsafe(t),o=0;for(i=0;i<r.length;++i){var s=r[i];if(!I(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n};a.byteLength=Bt;a.prototype._isBuffer=!0;a.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 t=0;t<r;t+=2)F(this,t,t+1);return this};a.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 t=0;t<r;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this};a.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 t=0;t<r;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this};a.prototype.toString=function(){var r=this.length|0;return r===0?"":arguments.length===0?Ft(this,0,r):Br.apply(this,arguments)};a.prototype.equals=function(r){if(!I(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:a.compare(this,r)===0};a.prototype.compare=function(r,t,i,n,o){if(!I(r))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),i===void 0&&(i=r?r.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>r.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===r)return 0;for(var s=o-n,u=i-t,f=Math.min(s,u),m=this.slice(n,o),w=r.slice(t,i),p=0;p<f;++p)if(m[p]!==w[p]){s=m[p],u=w[p];break}return s<u?-1:u<s?1:0};a.prototype.includes=function(r,t,i){return this.indexOf(r,t,i)!==-1};a.prototype.indexOf=function(r,t,i){return Lt(this,r,t,i,!0)};a.prototype.lastIndexOf=function(r,t,i){return Lt(this,r,t,i,!1)};a.prototype.write=function(r,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(i)?(i=i|0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-t;if((i===void 0||i>o)&&(i=o),r.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return Lr(this,r,t,i);case"utf8":case"utf-8":return Ur(this,r,t,i);case"ascii":return Ut(this,r,t,i);case"latin1":case"binary":return Fr(this,r,t,i);case"base64":return Cr(this,r,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pr(this,r,t,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};kt=4096;a.prototype.slice=function(r,t){var i=this.length;r=~~r,t=t===void 0?i:~~t,r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<r&&(t=r);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(r,t),n.__proto__=a.prototype;else{var o=t-r;n=new a(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+r]}return n};a.prototype.readUIntLE=function(r,t,i){r=r|0,t=t|0,i||g(r,t,this.length);for(var n=this[r],o=1,s=0;++s<t&&(o*=256);)n+=this[r+s]*o;return n};a.prototype.readUIntBE=function(r,t,i){r=r|0,t=t|0,i||g(r,t,this.length);for(var n=this[r+--t],o=1;t>0&&(o*=256);)n+=this[r+--t]*o;return n};a.prototype.readUInt8=function(r,t){return t||g(r,1,this.length),this[r]};a.prototype.readUInt16LE=function(r,t){return t||g(r,2,this.length),this[r]|this[r+1]<<8};a.prototype.readUInt16BE=function(r,t){return t||g(r,2,this.length),this[r]<<8|this[r+1]};a.prototype.readUInt32LE=function(r,t){return t||g(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};a.prototype.readUInt32BE=function(r,t){return t||g(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};a.prototype.readIntLE=function(r,t,i){r=r|0,t=t|0,i||g(r,t,this.length);for(var n=this[r],o=1,s=0;++s<t&&(o*=256);)n+=this[r+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};a.prototype.readIntBE=function(r,t,i){r=r|0,t=t|0,i||g(r,t,this.length);for(var n=t,o=1,s=this[r+--n];n>0&&(o*=256);)s+=this[r+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};a.prototype.readInt8=function(r,t){return t||g(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};a.prototype.readInt16LE=function(r,t){t||g(r,2,this.length);var i=this[r]|this[r+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(r,t){t||g(r,2,this.length);var i=this[r+1]|this[r]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(r,t){return t||g(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};a.prototype.readInt32BE=function(r,t){return t||g(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};a.prototype.readFloatLE=function(r,t){return t||g(r,4,this.length),at(this,r,!0,23,4)};a.prototype.readFloatBE=function(r,t){return t||g(r,4,this.length),at(this,r,!1,23,4)};a.prototype.readDoubleLE=function(r,t){return t||g(r,8,this.length),at(this,r,!0,52,8)};a.prototype.readDoubleBE=function(r,t){return t||g(r,8,this.length),at(this,r,!1,52,8)};a.prototype.writeUIntLE=function(r,t,i,n){if(r=+r,t=t|0,i=i|0,!n){var o=Math.pow(2,8*i)-1;A(this,r,t,i,o,0)}var s=1,u=0;for(this[t]=r&255;++u<i&&(s*=256);)this[t+u]=r/s&255;return t+i};a.prototype.writeUIntBE=function(r,t,i,n){if(r=+r,t=t|0,i=i|0,!n){var o=Math.pow(2,8*i)-1;A(this,r,t,i,o,0)}var s=i-1,u=1;for(this[t+s]=r&255;--s>=0&&(u*=256);)this[t+s]=r/u&255;return t+i};a.prototype.writeUInt8=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[t]=r&255,t+1};a.prototype.writeUInt16LE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=r&255,this[t+1]=r>>>8):nt(this,r,t,!0),t+2};a.prototype.writeUInt16BE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=r>>>8,this[t+1]=r&255):nt(this,r,t,!1),t+2};a.prototype.writeUInt32LE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255):ot(this,r,t,!0),t+4};a.prototype.writeUInt32BE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255):ot(this,r,t,!1),t+4};a.prototype.writeIntLE=function(r,t,i,n){if(r=+r,t=t|0,!n){var o=Math.pow(2,8*i-1);A(this,r,t,i,o-1,-o)}var s=0,u=1,f=0;for(this[t]=r&255;++s<i&&(u*=256);)r<0&&f===0&&this[t+s-1]!==0&&(f=1),this[t+s]=(r/u>>0)-f&255;return t+i};a.prototype.writeIntBE=function(r,t,i,n){if(r=+r,t=t|0,!n){var o=Math.pow(2,8*i-1);A(this,r,t,i,o-1,-o)}var s=i-1,u=1,f=0;for(this[t+s]=r&255;--s>=0&&(u*=256);)r<0&&f===0&&this[t+s+1]!==0&&(f=1),this[t+s]=(r/u>>0)-f&255;return t+i};a.prototype.writeInt8=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),r<0&&(r=255+r+1),this[t]=r&255,t+1};a.prototype.writeInt16LE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=r&255,this[t+1]=r>>>8):nt(this,r,t,!0),t+2};a.prototype.writeInt16BE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=r>>>8,this[t+1]=r&255):nt(this,r,t,!1),t+2};a.prototype.writeInt32LE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24):ot(this,r,t,!0),t+4};a.prototype.writeInt32BE=function(r,t,i){return r=+r,t=t|0,i||A(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),a.TYPED_ARRAY_SUPPORT?(this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255):ot(this,r,t,!1),t+4};a.prototype.writeFloatLE=function(r,t,i){return Pt(this,r,t,!0,i)};a.prototype.writeFloatBE=function(r,t,i){return Pt(this,r,t,!1,i)};a.prototype.writeDoubleLE=function(r,t,i){return Yt(this,r,t,!0,i)};a.prototype.writeDoubleBE=function(r,t,i){return Yt(this,r,t,!1,i)};a.prototype.copy=function(r,t,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),t>=r.length&&(t=r.length),t||(t=0),n>0&&n<i&&(n=i),n===i||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),r.length-t<n-i&&(n=r.length-t+i);var o=n-i,s;if(this===r&&i<t&&t<n)for(s=o-1;s>=0;--s)r[s+t]=this[s+i];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)r[s+t]=this[s+i];else Uint8Array.prototype.set.call(r,this.subarray(i,i+o),t);return o};a.prototype.fill=function(r,t,i,n){if(typeof r=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),r.length===1){var o=r.charCodeAt(0);o<256&&(r=o)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof r=="number"&&(r=r&255);if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,r||(r=0);var s;if(typeof r=="number")for(s=t;s<i;++s)this[s]=r;else{var u=I(r)?r:it(new a(r,n).toString()),f=u.length;for(s=0;s<i-t;++s)this[s+t]=u[s%f]}return this};jr=/[^+\/0-9A-Za-z-_]/g});var l=lt(()=>{"use strict";Ot()});h();l();function X(e){throw new Error("Unexpected value: "+JSON.stringify(e))}h();l();h();l();function qr(e){return Object.keys(e)}var dt={};Qt(dt,{AstNode:()=>x,ClassInstantiation:()=>G,CodeBlock:()=>W,Comment:()=>B,Function:()=>J,FunctionInvocation:()=>z,MethodInvocation:()=>H,Parameter:()=>V,Reference:()=>M,Type:()=>Y,TypeLiteral:()=>S,Types:()=>Y,Variable:()=>j,Writer:()=>P,codeblock:()=>ne,function_:()=>oe,instantiateClass:()=>se,invokeFunction:()=>ae,invokeMethod:()=>ue,parameter:()=>fe,reference:()=>he,variable:()=>le});h();l();h();l();h();l();h();l();h();l();h();l();var C=class{};h();l();h();l();var N=class extends C{constructor(t){super();c(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):this.value(t)}};var Kr=4,Z=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsNewline",!1)}write(r){let t=r.length>0&&r.endsWith(`
2
+ `),i=t?r.substring(0,r.length-1):r,n=this.getIndentString(),o=i.replaceAll(`
3
+ `,`
4
+ ${n}`);this.isAtStartOfLine()&&(o=n+o),t&&(o+=`
5
+ `),this.writeInternal(o)}writeNoIndent(r){let t=this.indentLevel;this.indentLevel=0,this.write(r),this.indentLevel=t}writeNode(r){r.write(this)}writeNodeOrString(r){if(typeof r=="string"){this.write(r);return}this.writeNode(r)}writeNodeStatement(r){r.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(r){new N(r).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(r,t){new N(r).write(this),this.write(" ("),this.writeNode(t),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(r,t){this.dedent(),this.write("} "),new N(r).write(this),this.write(" ("),this.writeNode(t),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(r){this.dedent(),this.write("} "),new N(r).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(r,t="{",i,n="}"){let o=r.filter(s=>s!==void 0).join(" ");o?this.write(`${o} ${t!=null?t:""}`):this.write(t!=null?t:"");try{this.indent(),i(),this.dedent()}finally{this.write(n!=null?n:"")}}writeLine(r=""){this.write(r),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:r,delimiter:t,writeFunction:i}){if(r.length>0){let n=r[0];n!=null&&i(n);for(let o=1;o<r.length;o++){this.write(t);let s=r[o];s!=null&&i(s)}}}toString(){return this.buffer}writeInternal(r){return r.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=r.endsWith(`
8
+ `)),this.buffer+=r}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Kr)}};h();l();var ut=class{},q=class extends ut{async format(r){return r}formatSync(r){return r}};h();l();h();l();var P=class extends Z{constructor({customConfig:t,formatter:i}){super();c(this,"customConfig");c(this,"formatter");c(this,"imports",{});c(this,"defaultImports",{});c(this,"starImportAliases",{});c(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=i!=null?i:new q}addImport(t){var i,n,o;if(t.importFrom!=null){switch(t.importFrom.type){case"default":{this.validateDefault(t);break}case"named":{this.validateNamed(t);break}case"star":{this.validateStar(t);break}}let s=(o=(i=this.imports)[n=t.importFrom.moduleName])!=null?o:i[n]=[];s.map(f=>f.name).includes(t.name)||s.push(t)}}validateDefault(t){var n,o,s,u;if(((n=t.importFrom)==null?void 0:n.type)!=="default")return;let i=(u=(o=this.defaultImports)[s=t.importFrom.moduleName])!=null?u:o[s]=t;if(i.name!==t.name)throw new Error(`Cannot have multiple default imports for module ${t.importFrom.moduleName}: got ${t.name} but already had ${i.name}`)}validateNamed(t){var s,u,f,m,w;if(((s=t.importFrom)==null?void 0:s.type)!=="named")return;let n=((u=this.imports[t.importFrom.moduleName])!=null?u:[]).filter(p=>{var y;return((y=p.importFrom)==null?void 0:y.type)==="star"});if(n.length>0)throw new Error(`Cannot add named import ${t.name} because non-named imports ${n.map(p=>p.name)} already exist`);let o=[];for(let p of Object.values(this.imports))for(let y of p)((f=y.importFrom)==null?void 0:f.type)==="named"&&y.importFrom.moduleName!==t.importFrom.moduleName&&y.name===t.name&&o.push(y);if(o.length>0)throw new Error(`Cannot add named import from module ${t.importFrom.moduleName} because it is already imported from ${(w=(m=o[0])==null?void 0:m.importFrom)==null?void 0:w.moduleName}`)}validateStar(t){var o,s,u,f,m,w,p;if(((o=t.importFrom)==null?void 0:o.type)!=="star")return;let i=(f=(s=this.starImportAliases)[u=t.importFrom.moduleName])!=null?f:s[u]=t.importFrom.starImportAlias;if(i!==t.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${t.importFrom.starImportAlias} but already have ${i}.`);if(((p=(m=this.starImportAliasesInverse)[w=t.importFrom.starImportAlias])!=null?p:m[w]=t.importFrom.moduleName)!==t.importFrom.moduleName)throw new Error(`Attempted to use alias ${t.importFrom.starImportAlias} for more than one module in the same file`)}};var K=class extends P{constructor({customConfig:r,formatter:t}){super({customConfig:r,formatter:t})}async toStringAsync(){let r=this.getContent();if(this.formatter!=null)try{return this.formatter.format(r)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
9
+ ${r}`)}return r}toString(){let r=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(r)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
10
+ ${r}`)}return r}getContent(){let r=this.stringifyImports();return r.length>0?r+`
11
+ `+this.buffer:this.buffer}stringifyImports(){let r="";for(let[t,i]of Object.entries(this.imports)){let n=this.defaultImports[t],o="",s=i.filter(f=>{var m;return((m=f.importFrom)==null?void 0:m.type)==="named"}),u=this.starImportAliases[t];if(s.length>0||n!=null||u!=null){if(r+="import",n!=null&&(r+=` ${n.name}`),s.length>0){for(let m of s.slice(0,-1))o+=`${m.name}, `;let f=s[s.length-1];f!=null&&(o+=`${f.name}`),n!=null&&(r+=","),r+=` { ${o} }`}u!=null&&((n!=null||s.length>0)&&(r+=", "),r+=` * as ${u}`),r+=` from "${t}";
12
+ `}}return r}};var x=class extends C{async toStringAsync({customConfig:r,formatter:t}){let i=new K({customConfig:r,formatter:t});return this.write(i),await i.toStringAsync()}toString({customConfig:r,formatter:t}){let i=new K({customConfig:r,formatter:t});return this.write(i),i.toString()}};h();l();var W=class extends x{constructor(t){super();c(this,"args");this.args=t}write(t){return new N(this.args).write(t)}};h();l();var Y=class extends x{constructor(t){super();c(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"string":t.write("string");break;case"number":t.write("number");break;case"bigint":t.write("bigint");break;case"boolean":t.write("boolean");break;case"array":this.internalType.valueType.write(t),t.write("[]");break;case"map":t.write("Record<"),this.internalType.keyType.write(t),t.write(", "),this.internalType.valueType.write(t),t.write(">");break;case"object":t.write("{"),t.indent();for(let[i,n]of Object.entries(this.internalType.fields))t.write(`${i}: `),n.write(t),t.writeLine(",");t.dedent(),t.write("}");break;case"enum":t.write("enum");break;case"any":t.write("any");break;case"promise":t.write("Promise<"),this.internalType.value.write(t),t.write(">");break;case"unknown":t.write("unknown");break;case"void":t.write("void");break;case"undefined":t.write("undefined");break;case"null":t.write("null");break;case"never":t.write("never");break;case"nop":break;default:X(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(t){return new this({type:"array",valueType:t})}static object(t){return new this({type:"object",fields:t})}static enum(t){return new this({type:"enum",values:t})}static any(){return new this({type:"any"})}static promise(t){return t.internalType.type==="promise"?t:new this({type:"promise",value:t})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};h();l();var S=class e extends x{constructor(t){super();c(this,"internalType");this.internalType=t}write(t){var o,s;let i=!!((o=t.customConfig)!=null&&o.noSerdeLayer),n=!!((s=t.customConfig)!=null&&s.useBigInt);switch(this.internalType.type){case"array":{this.writeIterable({writer:t,iterable:this.internalType});break}case"blob":{if(i){t.writeNode(e.string(this.internalType.value));return}t.write("new Blob(["),t.writeNode(e.string(this.internalType.value)),t.write("])");break}case"boolean":{t.write(this.internalType.value.toString());break}case"bigint":{if(n){t.write(`BigInt("${this.internalType.value.toString()}")`);return}t.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(i){t.writeNode(e.string(this.internalType.value));return}t.write("new Date("),t.writeNode(e.string(this.internalType.value)),t.write(")");break}case"number":{t.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:t,object:this.internalType});break}case"record":{this.writeRecord({writer:t,record:this.internalType});break}case"reference":{t.writeNode(this.internalType.value);break}case"set":{if(i||this.isSetOfObjects()){t.writeNode(e.array({values:this.internalType.values}));return}t.write("new Set("),this.writeIterable({writer:t,iterable:this.internalType}),t.write(")");break}case"string":{this.internalType.value.includes(`
13
+ `)?this.writeStringWithBackticks({writer:t,value:this.internalType.value}):t.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:t,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:t,value:this.internalType.value});break}case"null":{t.write("null");break}case"nop":break;default:X(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(t=>t.isObject())}writeStringWithBackticks({writer:t,value:i}){t.write("`");let n=i.split(`
14
+ `),o=n[0]+`
15
+ `,s=n.slice(1).join(`
16
+ `);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(s.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:i}){let n=ee({values:i.values});if(n.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let o of n)o.write(t),t.writeLine(",");t.dedent(),t.write("]")}writeRecord({writer:t,record:i}){let n=re({entries:i.entries});if(n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of n)o.key.write(t),t.write(": "),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeObject({writer:t,object:i}){let n=te({fields:i.fields});if(n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of n)t.write(`${o.name}: `),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}static array({values:t}){return new this({type:"array",values:t})}static bigint(t){return new this({type:"bigint",value:t})}static blob(t){return new this({type:"blob",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static datetime(t){return new this({type:"datetime",value:t})}static number(t){return new this({type:"number",value:t})}static object({fields:t}){return new this({type:"object",fields:t})}static record({entries:t}){return new this({type:"record",entries:t})}static reference(t){return new this({type:"reference",value:t})}static set({values:t}){return new this({type:"set",values:t})}static string(t){return new this({type:"string",value:t})}static tuple({values:t}){return new this({type:"tuple",values:t})}static unknown(t){return new this({type:"unknown",value:t})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}writeUnknown({writer:t,value:i}){switch(typeof i){case"boolean":t.write(i.toString());return;case"string":t.write(i.includes('"')?`\`${i}\``:`"${i}"`);return;case"number":t.write(i.toString());return;case"object":if(i==null){t.write("null");return}if(Array.isArray(i)){this.writeUnknownArray({writer:t,value:i});return}this.writeUnknownObject({writer:t,value:i});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof i}`)}}writeUnknownArray({writer:t,value:i}){if(i.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let n of i)t.writeNode(e.unknown(n)),t.writeLine(",");t.dedent(),t.write("]")}writeUnknownObject({writer:t,value:i}){let n=Object.entries(i);if(n.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[o,s]of n)t.write(`${o}: `),t.writeNode(e.unknown(s)),t.writeLine(",");t.dedent(),t.write("}")}};function te({fields:e}){return e.filter(r=>!S.isNop(r.value))}function re({entries:e}){return e.filter(r=>!S.isNop(r.key)&&!S.isNop(r.value))}function ee({values:e}){return e.filter(r=>!S.isNop(r))}h();l();var M=class extends x{constructor({name:t,importFrom:i,memberName:n}){super();c(this,"name");c(this,"importFrom");c(this,"memberName");this.name=t,this.importFrom=i,this.memberName=n}write(t){var o;this.importFrom!=null&&t.addImport(this);let i=((o=this.importFrom)==null?void 0:o.type)==="star"?`${this.importFrom.starImportAlias}.`:"",n=this.memberName!=null?`.${this.memberName}`:"";t.write(`${i}${this.name}${n}`)}};h();l();var j=class extends x{constructor(t){super();c(this,"args");this.args=t}write(t){this.args.export&&t.write("export "),this.args.const?t.write("const "):t.write("let "),t.write(`${this.args.name} = `),t.writeNode(this.args.initializer)}};h();l();h();l();var B=class extends x{constructor({docs:t}={docs:void 0}){super();c(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
17
+ `).forEach(i=>{t.writeLine(` * ${i}`)}),t.writeLine("*/"))}};var V=class extends x{constructor({name:t,type:i,docs:n}){super();c(this,"name");c(this,"type");c(this,"docs");this.name=t,this.type=i,this.docs=n}write(t){this.docs!=null&&t.writeNode(new B({docs:this.docs})),t.write(`${this.name}: `),this.type.write(t)}};h();l();var J=class extends x{constructor({name:t,parameters:i,async:n,body:o,return_:s,docs:u}){super();c(this,"name");c(this,"parameters");c(this,"async");c(this,"body");c(this,"return_");c(this,"docs");this.name=t,this.parameters=i,this.async=n!=null?n:!1,this.body=o,this.return_=s,this.docs=u}write(t){var i;t.writeNode(new B({docs:this.docs})),this.async&&t.write("async "),t.write("function "),t.write(`${this.name}`),this.writeParameters(t),this.return_!=null&&(t.write(": "),t.writeNode(this.async?Y.promise(this.return_):this.return_)),t.writeLine(" {"),t.indent(),(i=this.body)==null||i.write(t),t.dedent(),t.writeNewLineIfLastLineNot(),t.writeLine("}")}writeParameters(t){if(this.parameters.length===0){t.write("()");return}t.indent(),t.writeLine("(");for(let i of this.parameters)t.writeNode(i),t.writeLine(",");t.dedent(),t.write(")")}};h();l();var z=class extends x{constructor({function_:t,arguments_:i}){super();c(this,"function_");c(this,"arguments_");this.function_=t,this.arguments_=i}write(t){t.writeNode(this.function_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(t)}),t.write(")")}};h();l();var H=class extends x{constructor({on:t,method:i,arguments_:n,async:o}){super();c(this,"on");c(this,"method");c(this,"arguments_");c(this,"async");this.on=t,this.method=i,this.arguments_=n,this.async=o}write(t){this.async&&t.write("await "),this.on.write(t),t.write("."),t.write(this.method),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(t)}),t.write(")")}};h();l();var G=class extends x{constructor({class_:t,arguments_:i}){super();c(this,"class_");c(this,"arguments_");this.class_=t,this.arguments_=i}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:i=>i.write(t)}),t.write(")")}};function ne(e){return new W(e)}function oe(e){return new J(e)}function se(e){return new G(e)}function ae(e){return new z(e)}function ue(e){return new H(e)}function fe(e){return new V(e)}function he(e){return new M(e)}function le(e){return new j(e)}h();l();export{ce as a,pe as b,me as c,we as d,lt as e,de as f,Qt as g,xe as h,ye as i,c as j,h as k,a as l,l as m,X as n,qr as o,dt as p};
18
+ /*! Bundled license information:
19
+
20
+ @esbuild-plugins/node-globals-polyfill/Buffer.js:
21
+ (*!
22
+ * The buffer module from node.js, for the browser.
23
+ *
24
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
25
+ * @license MIT
26
+ *)
27
+ */
@@ -1,4 +1,4 @@
1
- import{a as I}from"./chunk-SQLJANKO.js";import{c as S}from"./chunk-736FTN3M.js";import{a as N}from"./chunk-LX5O4JB7.js";import{j as l,k as t,m as o,p as C}from"./chunk-YD6EIACZ.js";t();o();t();o();t();o();t();o();t();o();t();o();t();o();var Oe=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,A=Oe;var Te=typeof self=="object"&&self&&self.Object===Object&&self,ke=A||Te||Function("return this")(),O=ke;var we=O.Symbol,d=we;t();o();var T=Object.prototype,Ee=T.hasOwnProperty,je=T.toString,c=d?d.toStringTag:void 0;function Me(e){var a=Ee.call(e,c),r=e[c];try{e[c]=void 0;var f=!0}catch(i){}var p=je.call(e);return f&&(a?e[c]=r:delete e[c]),p}var k=Me;t();o();var We=Object.prototype,Le=We.toString;function Ue(e){return Le.call(e)}var w=Ue;var Fe="[object Null]",Pe="[object Undefined]",E=d?d.toStringTag:void 0;function ze(e){return e==null?e===void 0?Pe:Fe:E&&E in Object(e)?k(e):w(e)}var j=ze;t();o();function Be(e){return e!=null&&typeof e=="object"}var M=Be;var De="[object Symbol]";function Ge(e){return typeof e=="symbol"||M(e)&&j(e)==De}var W=Ge;t();o();t();o();function Ze(e,a){for(var r=-1,f=e==null?0:e.length,p=Array(f);++r<f;)p[r]=a(e[r],r,e);return p}var L=Ze;t();o();var $e=Array.isArray,U=$e;var qe=1/0,F=d?d.prototype:void 0,P=F?F.toString:void 0;function z(e){if(typeof e=="string")return e;if(U(e))return L(e,z)+"";if(W(e))return P?P.call(e):"";var a=e+"";return a=="0"&&1/e==-qe?"-0":a}var B=z;t();o();function Ve(e){return e==null?"":B(e)}var m=Ve;t();o();t();o();t();o();t();o();t();o();t();o();function He(e,a,r){var f=-1,p=e.length;a<0&&(a=-a>p?0:p+a),r=r>p?p:r,r<0&&(r+=p),p=a>r?0:r-a>>>0,a>>>=0;for(var i=Array(p);++f<p;)i[f]=e[f+a];return i}var D=He;function Je(e,a,r){var f=e.length;return r=r===void 0?f:r,!a&&r>=f?e:D(e,a,r)}var G=Je;t();o();var Ke="\\ud800-\\udfff",Ye="\\u0300-\\u036f",_e="\\ufe20-\\ufe2f",Qe="\\u20d0-\\u20ff",Xe=Ye+_e+Qe,er="\\ufe0e\\ufe0f",rr="\\u200d",tr=RegExp("["+rr+Ke+Xe+er+"]");function or(e){return tr.test(e)}var g=or;t();o();t();o();function ar(e){return e.split("")}var Z=ar;t();o();var $="\\ud800-\\udfff",fr="\\u0300-\\u036f",ur="\\ufe20-\\ufe2f",sr="\\u20d0-\\u20ff",pr=fr+ur+sr,dr="\\ufe0e\\ufe0f",mr="["+$+"]",h="["+pr+"]",y="\\ud83c[\\udffb-\\udfff]",lr="(?:"+h+"|"+y+")",q="[^"+$+"]",V="(?:\\ud83c[\\udde6-\\uddff]){2}",H="[\\ud800-\\udbff][\\udc00-\\udfff]",ir="\\u200d",J=lr+"?",K="["+dr+"]?",nr="(?:"+ir+"(?:"+[q,V,H].join("|")+")"+K+J+")*",xr=K+J+nr,cr="(?:"+[q+h+"?",h,V,H,mr].join("|")+")",gr=RegExp(y+"(?="+y+")|"+cr+xr,"g");function br(e){return e.match(gr)||[]}var Y=br;function hr(e){return g(e)?Y(e):Z(e)}var _=hr;function yr(e){return function(a){a=m(a);var r=g(a)?_(a):void 0,f=r?r[0]:a.charAt(0),p=r?G(r,1).join(""):a.slice(1);return f[e]()+p}}var Q=yr;var Rr=Q("toUpperCase"),n=Rr;function vr(e){return n(m(e).toLowerCase())}var X=vr;t();o();t();o();function Sr(e,a,r,f){var p=-1,i=e==null?0:e.length;for(f&&i&&(r=e[++p]);++p<i;)r=a(r,e[p],p,e);return r}var ee=Sr;t();o();t();o();t();o();function Cr(e){return function(a){return e==null?void 0:e[a]}}var re=Cr;var Ir={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Nr=re(Ir),te=Nr;var Ar=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Or="\\u0300-\\u036f",Tr="\\ufe20-\\ufe2f",kr="\\u20d0-\\u20ff",wr=Or+Tr+kr,Er="["+wr+"]",jr=RegExp(Er,"g");function Mr(e){return e=m(e),e&&e.replace(Ar,te).replace(jr,"")}var oe=Mr;t();o();t();o();var Wr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Lr(e){return e.match(Wr)||[]}var ae=Lr;t();o();var Ur=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Fr(e){return Ur.test(e)}var fe=Fr;t();o();var me="\\ud800-\\udfff",Pr="\\u0300-\\u036f",zr="\\ufe20-\\ufe2f",Br="\\u20d0-\\u20ff",Dr=Pr+zr+Br,le="\\u2700-\\u27bf",ie="a-z\\xdf-\\xf6\\xf8-\\xff",Gr="\\xac\\xb1\\xd7\\xf7",Zr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",$r="\\u2000-\\u206f",qr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Vr="\\ufe0e\\ufe0f",xe=Gr+Zr+$r+qr,ce="['\u2019]",ue="["+xe+"]",Hr="["+Dr+"]",ge="\\d+",Jr="["+le+"]",be="["+ie+"]",he="[^"+me+xe+ge+le+ie+ne+"]",Kr="\\ud83c[\\udffb-\\udfff]",Yr="(?:"+Hr+"|"+Kr+")",_r="[^"+me+"]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",Re="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+ne+"]",Qr="\\u200d",se="(?:"+be+"|"+he+")",Xr="(?:"+x+"|"+he+")",pe="(?:"+ce+"(?:d|ll|m|re|s|t|ve))?",de="(?:"+ce+"(?:D|LL|M|RE|S|T|VE))?",ve=Yr+"?",Se="["+Vr+"]?",et="(?:"+Qr+"(?:"+[_r,ye,Re].join("|")+")"+Se+ve+")*",rt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ot=Se+ve+et,at="(?:"+[Jr,ye,Re].join("|")+")"+ot,ft=RegExp([x+"?"+be+"+"+pe+"(?="+[ue,x,"$"].join("|")+")",Xr+"+"+de+"(?="+[ue,x+se,"$"].join("|")+")",x+"?"+se+"+"+pe,x+"+"+de,tt,rt,ge,at].join("|"),"g");function ut(e){return e.match(ft)||[]}var Ce=ut;function st(e,a,r){return e=m(e),a=r?void 0:a,a===void 0?fe(e)?Ce(e):ae(e):e.match(a)||[]}var Ie=st;var pt="['\u2019]",dt=RegExp(pt,"g");function mt(e){return function(a){return ee(Ie(oe(a).replace(dt,"")),e,"")}}var Ne=mt;var lt=Ne(function(e,a,r){return a=a.toLowerCase(),e+(r?X(a):a)}),b=lt;t();o();t();o();function R({generatorConfig:e,isPackagePrivate:a}){var f;let r=e.output.mode;switch(r.type){case"downloadFiles":return;case"publish":return{packageName:r.registriesV2.npm.packageName,version:r.version,private:a,publishInfo:{registryUrl:r.registriesV2.npm.registryUrl,token:r.registriesV2.npm.token},license:void 0,repoUrl:void 0};case"github":if(r.publishInfo!=null&&r.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${r.publishInfo.type} instead`);return{packageName:r.publishInfo!=null?r.publishInfo.packageName:"",version:r.version,private:a,publishInfo:void 0,repoUrl:r.repoUrl,license:(f=e.license)==null?void 0:f._visit({basic:p=>p.id,custom:p=>`See ${p.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${r}`)}}t();o();function v({organization:e,workspaceName:a,namespaceExport:r}){return r!=null?r:`${n(b(e))}${n(b(a))}`}var Ae=class e extends S{constructor({ir:r,config:f}){var p;super({ir:r,config:f});l(this,"ir");l(this,"customConfig");l(this,"dynamicTypeLiteralMapper");l(this,"filePropertyMapper");l(this,"moduleName");l(this,"namespaceExport");this.ir=r,this.customConfig=f.customConfig!=null?f.customConfig:void 0,this.dynamicTypeLiteralMapper=new I({context:this}),this.filePropertyMapper=new N({context:this}),this.moduleName=it({config:f,customConfig:this.customConfig}),this.namespaceExport=v({organization:f.organization,workspaceName:f.workspaceName,namespaceExport:(p=this.customConfig)==null?void 0:p.namespaceExport})}clone(){return new e({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return`${this.namespaceExport}Client`}getPropertyName(r){var f,p;return(f=this.customConfig)!=null&&f.retainOriginalCasing||(p=this.customConfig)!=null&&p.noSerdeLayer?this.formatOriginalPropertyName(r.originalName):r.camelCase.unsafeName}getMethodName(r){return r.camelCase.unsafeName}getTypeName(r){return r.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(r){let f=this.resolveEnvironmentName(r);if(f!=null)return this.getEnvironmentsTypeReference(f)}getFullyQualifiedReference({declaration:r}){return r.fernFilepath.allParts.length>0?`${r.fernFilepath.allParts.map(f=>f.camelCase.unsafeName).join(".")}.${this.getTypeName(r.name)}`:`${this.getTypeName(r.name)}`}getEnvironmentsTypeReference(r){return C.reference({name:`${this.namespaceExport}Environments`,importFrom:this.getModuleImport(),memberName:this.getTypeName(r)})}formatOriginalPropertyName(r){return r.includes("-")?`"${r}"`:r}};function it({config:e,customConfig:a}){var r,f,p;return(p=(f=R({generatorConfig:e,isPackagePrivate:(r=a==null?void 0:a.private)!=null?r:!1}))==null?void 0:f.packageName)!=null?p:e.organization}export{Ae as a};
1
+ import{a as I}from"./chunk-D7ZDXIQ6.js";import{c as S}from"./chunk-JGNWFXNM.js";import{a as N}from"./chunk-XC2QAVJY.js";import{j as l,k as t,m as o,p as C}from"./chunk-RL2XA35J.js";t();o();t();o();t();o();t();o();t();o();t();o();t();o();var Oe=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,A=Oe;var Te=typeof self=="object"&&self&&self.Object===Object&&self,ke=A||Te||Function("return this")(),O=ke;var we=O.Symbol,d=we;t();o();var T=Object.prototype,Ee=T.hasOwnProperty,je=T.toString,c=d?d.toStringTag:void 0;function Me(e){var a=Ee.call(e,c),r=e[c];try{e[c]=void 0;var f=!0}catch(i){}var p=je.call(e);return f&&(a?e[c]=r:delete e[c]),p}var k=Me;t();o();var We=Object.prototype,Le=We.toString;function Ue(e){return Le.call(e)}var w=Ue;var Fe="[object Null]",Pe="[object Undefined]",E=d?d.toStringTag:void 0;function ze(e){return e==null?e===void 0?Pe:Fe:E&&E in Object(e)?k(e):w(e)}var j=ze;t();o();function Be(e){return e!=null&&typeof e=="object"}var M=Be;var De="[object Symbol]";function Ge(e){return typeof e=="symbol"||M(e)&&j(e)==De}var W=Ge;t();o();t();o();function Ze(e,a){for(var r=-1,f=e==null?0:e.length,p=Array(f);++r<f;)p[r]=a(e[r],r,e);return p}var L=Ze;t();o();var $e=Array.isArray,U=$e;var qe=1/0,F=d?d.prototype:void 0,P=F?F.toString:void 0;function z(e){if(typeof e=="string")return e;if(U(e))return L(e,z)+"";if(W(e))return P?P.call(e):"";var a=e+"";return a=="0"&&1/e==-qe?"-0":a}var B=z;t();o();function Ve(e){return e==null?"":B(e)}var m=Ve;t();o();t();o();t();o();t();o();t();o();t();o();function He(e,a,r){var f=-1,p=e.length;a<0&&(a=-a>p?0:p+a),r=r>p?p:r,r<0&&(r+=p),p=a>r?0:r-a>>>0,a>>>=0;for(var i=Array(p);++f<p;)i[f]=e[f+a];return i}var D=He;function Je(e,a,r){var f=e.length;return r=r===void 0?f:r,!a&&r>=f?e:D(e,a,r)}var G=Je;t();o();var Ke="\\ud800-\\udfff",Ye="\\u0300-\\u036f",_e="\\ufe20-\\ufe2f",Qe="\\u20d0-\\u20ff",Xe=Ye+_e+Qe,er="\\ufe0e\\ufe0f",rr="\\u200d",tr=RegExp("["+rr+Ke+Xe+er+"]");function or(e){return tr.test(e)}var g=or;t();o();t();o();function ar(e){return e.split("")}var Z=ar;t();o();var $="\\ud800-\\udfff",fr="\\u0300-\\u036f",ur="\\ufe20-\\ufe2f",sr="\\u20d0-\\u20ff",pr=fr+ur+sr,dr="\\ufe0e\\ufe0f",mr="["+$+"]",h="["+pr+"]",y="\\ud83c[\\udffb-\\udfff]",lr="(?:"+h+"|"+y+")",q="[^"+$+"]",V="(?:\\ud83c[\\udde6-\\uddff]){2}",H="[\\ud800-\\udbff][\\udc00-\\udfff]",ir="\\u200d",J=lr+"?",K="["+dr+"]?",nr="(?:"+ir+"(?:"+[q,V,H].join("|")+")"+K+J+")*",xr=K+J+nr,cr="(?:"+[q+h+"?",h,V,H,mr].join("|")+")",gr=RegExp(y+"(?="+y+")|"+cr+xr,"g");function br(e){return e.match(gr)||[]}var Y=br;function hr(e){return g(e)?Y(e):Z(e)}var _=hr;function yr(e){return function(a){a=m(a);var r=g(a)?_(a):void 0,f=r?r[0]:a.charAt(0),p=r?G(r,1).join(""):a.slice(1);return f[e]()+p}}var Q=yr;var Rr=Q("toUpperCase"),n=Rr;function vr(e){return n(m(e).toLowerCase())}var X=vr;t();o();t();o();function Sr(e,a,r,f){var p=-1,i=e==null?0:e.length;for(f&&i&&(r=e[++p]);++p<i;)r=a(r,e[p],p,e);return r}var ee=Sr;t();o();t();o();t();o();function Cr(e){return function(a){return e==null?void 0:e[a]}}var re=Cr;var Ir={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Nr=re(Ir),te=Nr;var Ar=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Or="\\u0300-\\u036f",Tr="\\ufe20-\\ufe2f",kr="\\u20d0-\\u20ff",wr=Or+Tr+kr,Er="["+wr+"]",jr=RegExp(Er,"g");function Mr(e){return e=m(e),e&&e.replace(Ar,te).replace(jr,"")}var oe=Mr;t();o();t();o();var Wr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Lr(e){return e.match(Wr)||[]}var ae=Lr;t();o();var Ur=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Fr(e){return Ur.test(e)}var fe=Fr;t();o();var me="\\ud800-\\udfff",Pr="\\u0300-\\u036f",zr="\\ufe20-\\ufe2f",Br="\\u20d0-\\u20ff",Dr=Pr+zr+Br,le="\\u2700-\\u27bf",ie="a-z\\xdf-\\xf6\\xf8-\\xff",Gr="\\xac\\xb1\\xd7\\xf7",Zr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",$r="\\u2000-\\u206f",qr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Vr="\\ufe0e\\ufe0f",xe=Gr+Zr+$r+qr,ce="['\u2019]",ue="["+xe+"]",Hr="["+Dr+"]",ge="\\d+",Jr="["+le+"]",be="["+ie+"]",he="[^"+me+xe+ge+le+ie+ne+"]",Kr="\\ud83c[\\udffb-\\udfff]",Yr="(?:"+Hr+"|"+Kr+")",_r="[^"+me+"]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",Re="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+ne+"]",Qr="\\u200d",se="(?:"+be+"|"+he+")",Xr="(?:"+x+"|"+he+")",pe="(?:"+ce+"(?:d|ll|m|re|s|t|ve))?",de="(?:"+ce+"(?:D|LL|M|RE|S|T|VE))?",ve=Yr+"?",Se="["+Vr+"]?",et="(?:"+Qr+"(?:"+[_r,ye,Re].join("|")+")"+Se+ve+")*",rt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ot=Se+ve+et,at="(?:"+[Jr,ye,Re].join("|")+")"+ot,ft=RegExp([x+"?"+be+"+"+pe+"(?="+[ue,x,"$"].join("|")+")",Xr+"+"+de+"(?="+[ue,x+se,"$"].join("|")+")",x+"?"+se+"+"+pe,x+"+"+de,tt,rt,ge,at].join("|"),"g");function ut(e){return e.match(ft)||[]}var Ce=ut;function st(e,a,r){return e=m(e),a=r?void 0:a,a===void 0?fe(e)?Ce(e):ae(e):e.match(a)||[]}var Ie=st;var pt="['\u2019]",dt=RegExp(pt,"g");function mt(e){return function(a){return ee(Ie(oe(a).replace(dt,"")),e,"")}}var Ne=mt;var lt=Ne(function(e,a,r){return a=a.toLowerCase(),e+(r?X(a):a)}),b=lt;t();o();t();o();function R({generatorConfig:e,isPackagePrivate:a}){var f;let r=e.output.mode;switch(r.type){case"downloadFiles":return;case"publish":return{packageName:r.registriesV2.npm.packageName,version:r.version,private:a,publishInfo:{registryUrl:r.registriesV2.npm.registryUrl,token:r.registriesV2.npm.token},license:void 0,repoUrl:void 0};case"github":if(r.publishInfo!=null&&r.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${r.publishInfo.type} instead`);return{packageName:r.publishInfo!=null?r.publishInfo.packageName:"",version:r.version,private:a,publishInfo:void 0,repoUrl:r.repoUrl,license:(f=e.license)==null?void 0:f._visit({basic:p=>p.id,custom:p=>`See ${p.filename}`,_other:()=>{}})};default:throw new Error(`Encountered unknown output mode: ${r}`)}}t();o();function v({organization:e,workspaceName:a,namespaceExport:r}){return r!=null?r:`${n(b(e))}${n(b(a))}`}var Ae=class e extends S{constructor({ir:r,config:f}){var p;super({ir:r,config:f});l(this,"ir");l(this,"customConfig");l(this,"dynamicTypeLiteralMapper");l(this,"filePropertyMapper");l(this,"moduleName");l(this,"namespaceExport");this.ir=r,this.customConfig=f.customConfig!=null?f.customConfig:void 0,this.dynamicTypeLiteralMapper=new I({context:this}),this.filePropertyMapper=new N({context:this}),this.moduleName=it({config:f,customConfig:this.customConfig}),this.namespaceExport=v({organization:f.organization,workspaceName:f.workspaceName,namespaceExport:(p=this.customConfig)==null?void 0:p.namespaceExport})}clone(){return new e({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return`${this.namespaceExport}Client`}getPropertyName(r){var f,p;return(f=this.customConfig)!=null&&f.retainOriginalCasing||(p=this.customConfig)!=null&&p.noSerdeLayer?this.formatOriginalPropertyName(r.originalName):r.camelCase.unsafeName}getMethodName(r){return r.camelCase.unsafeName}getTypeName(r){return r.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(r){let f=this.resolveEnvironmentName(r);if(f!=null)return this.getEnvironmentsTypeReference(f)}getFullyQualifiedReference({declaration:r}){return r.fernFilepath.allParts.length>0?`${r.fernFilepath.allParts.map(f=>f.camelCase.unsafeName).join(".")}.${this.getTypeName(r.name)}`:`${this.getTypeName(r.name)}`}getEnvironmentsTypeReference(r){return C.reference({name:`${this.namespaceExport}Environment`,importFrom:this.getModuleImport(),memberName:this.getTypeName(r)})}formatOriginalPropertyName(r){return r.includes("-")?`"${r}"`:r}};function it({config:e,customConfig:a}){var r,f,p;return(p=(f=R({generatorConfig:e,isPackagePrivate:(r=a==null?void 0:a.private)!=null?r:!1}))==null?void 0:f.packageName)!=null?p:e.organization}export{Ae as a};
2
2
  /*! Bundled license information:
3
3
 
4
4
  lodash-es/lodash.js:
@@ -1 +1 @@
1
- import{j as l,k as p,m as y,n as s,p as n}from"./chunk-YD6EIACZ.js";p();y();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:s(t)}return e}getSingleFileProperty({property:r,record:o}){let e=this.context.getSingleFileValue({property:r,record:o});return e==null?n.TypeLiteral.nop():n.TypeLiteral.blob(e)}getArrayFileProperty({property:r,record:o}){let e=this.context.getFileArrayValues({property:r,record:o});return e==null?n.TypeLiteral.nop():n.TypeLiteral.array({values:e.map(i=>n.TypeLiteral.blob(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};
1
+ import{j as l,k as p,m as y,n as s,p as n}from"./chunk-RL2XA35J.js";p();y();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:s(t)}return e}getSingleFileProperty({property:r,record:o}){let e=this.context.getSingleFileValue({property:r,record:o});return e==null?n.TypeLiteral.nop():n.TypeLiteral.blob(e)}getArrayFileProperty({property:r,record:o}){let e=this.context.getFileArrayValues({property:r,record:o});return e==null?n.TypeLiteral.nop():n.TypeLiteral.array({values:e.map(i=>n.TypeLiteral.blob(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};
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/browser-compatible-base-generator';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
3
  import '@fern-api/typescript-ast';
4
- export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-DFkk3dho.js';
4
+ export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-CmDa2k9n.js';
@@ -1 +1 @@
1
- import{a}from"../chunk-25TNFA5L.js";import"../chunk-SQLJANKO.js";import"../chunk-736FTN3M.js";import"../chunk-LX5O4JB7.js";import"../chunk-YD6EIACZ.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-T2HPPEKP.js";import"../chunk-D7ZDXIQ6.js";import"../chunk-JGNWFXNM.js";import"../chunk-XC2QAVJY.js";import"../chunk-RL2XA35J.js";export{a as DynamicSnippetsGeneratorContext};
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/typescript-ast';
3
- export { a as DynamicTypeLiteralMapper } from '../DynamicSnippetsGeneratorContext-DFkk3dho.js';
3
+ export { a as DynamicTypeLiteralMapper } from '../DynamicSnippetsGeneratorContext-CmDa2k9n.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1 +1 @@
1
- import{a}from"../chunk-SQLJANKO.js";import"../chunk-736FTN3M.js";import"../chunk-YD6EIACZ.js";export{a as DynamicTypeLiteralMapper};
1
+ import{a}from"../chunk-D7ZDXIQ6.js";import"../chunk-JGNWFXNM.js";import"../chunk-RL2XA35J.js";export{a as DynamicTypeLiteralMapper};
@@ -1,4 +1,4 @@
1
1
  import '@fern-api/dynamic-ir-sdk';
2
2
  import '@fern-api/typescript-ast';
3
- export { F as FilePropertyInfo, b as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-DFkk3dho.js';
3
+ export { F as FilePropertyInfo, b as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-CmDa2k9n.js';
4
4
  import '@fern-api/browser-compatible-base-generator';
@@ -1 +1 @@
1
- import{a}from"../chunk-LX5O4JB7.js";import"../chunk-YD6EIACZ.js";export{a as FilePropertyMapper};
1
+ import{a}from"../chunk-XC2QAVJY.js";import"../chunk-RL2XA35J.js";export{a as FilePropertyMapper};
package/esm/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.js';
2
2
  import '@fern-api/browser-compatible-base-generator';
3
3
  import '@fern-api/dynamic-ir-sdk';
4
- import './DynamicSnippetsGeneratorContext-DFkk3dho.js';
4
+ import './EndpointSnippetGenerator.js';
5
+ import './DynamicSnippetsGeneratorContext-CmDa2k9n.js';
5
6
  import '@fern-api/typescript-ast';