@fern-api/csharp-dynamic-snippets 0.0.6 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DynamicSnippetsGenerator.cjs +13 -13
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
- package/cjs/{DynamicSnippetsGeneratorContext-DhvOZIoP.d.cts → DynamicSnippetsGeneratorContext-Dz9RlVgp.d.cts} +6 -0
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +1 -1
- package/cjs/context/DynamicLiteralMapper.cjs +1 -1
- package/cjs/context/DynamicLiteralMapper.d.cts +1 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +1 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
- package/cjs/context/DynamicTypeMapper.d.cts +1 -1
- package/cjs/context/FilePropertyMapper.d.cts +1 -1
- package/cjs/index.cjs +13 -13
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.cts +1 -1
- package/esm/DynamicSnippetsGenerator.d.ts +1 -1
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/{DynamicSnippetsGeneratorContext-DhvOZIoP.d.ts → DynamicSnippetsGeneratorContext-Dz9RlVgp.d.ts} +6 -0
- package/esm/EndpointSnippetGenerator.d.ts +1 -1
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/{chunk-TOOGWICF.js → chunk-3AKTWPYH.js} +2 -2
- package/esm/{chunk-A53BGSGD.js → chunk-4A2AR7IK.js} +2 -2
- package/esm/{chunk-WP3GAWOR.js → chunk-54PJL32I.js} +2 -2
- package/esm/{chunk-LWJEMG53.js → chunk-BHXOAZDW.js} +2 -2
- package/esm/{chunk-TVSKLWL4.js → chunk-JXSLTUG5.js} +2 -2
- package/esm/{chunk-ZEEJAJ4K.js → chunk-ONI3ZPJV.js} +2 -2
- package/esm/{chunk-QALVTPA5.js → chunk-RHB5YSP4.js} +2 -2
- package/esm/{chunk-QALVTPA5.js.map → chunk-RHB5YSP4.js.map} +1 -1
- package/esm/{chunk-PRAGN765.js → chunk-VBCDESX3.js} +2 -2
- package/esm/{chunk-PRAGN765.js.map → chunk-VBCDESX3.js.map} +1 -1
- package/esm/context/DynamicLiteralMapper.d.ts +1 -1
- package/esm/context/DynamicLiteralMapper.js +1 -1
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
- package/esm/context/DynamicTypeMapper.d.ts +1 -1
- package/esm/context/DynamicTypeMapper.js +1 -1
- package/esm/context/FilePropertyMapper.d.ts +1 -1
- package/esm/context/FilePropertyMapper.js +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- /package/esm/{chunk-TOOGWICF.js.map → chunk-3AKTWPYH.js.map} +0 -0
- /package/esm/{chunk-A53BGSGD.js.map → chunk-4A2AR7IK.js.map} +0 -0
- /package/esm/{chunk-WP3GAWOR.js.map → chunk-54PJL32I.js.map} +0 -0
- /package/esm/{chunk-LWJEMG53.js.map → chunk-BHXOAZDW.js.map} +0 -0
- /package/esm/{chunk-TVSKLWL4.js.map → chunk-JXSLTUG5.js.map} +0 -0
- /package/esm/{chunk-ZEEJAJ4K.js.map → chunk-ONI3ZPJV.js.map} +0 -0
package/cjs/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ export { Config } from './Config.cjs';
|
|
|
2
2
|
export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
|
|
3
3
|
import '@fern-api/browser-compatible-base-generator';
|
|
4
4
|
import '@fern-api/dynamic-ir-sdk';
|
|
5
|
-
import './DynamicSnippetsGeneratorContext-
|
|
5
|
+
import './DynamicSnippetsGeneratorContext-Dz9RlVgp.cjs';
|
|
6
6
|
import '@fern-api/csharp-codegen/lib/ast';
|
|
7
7
|
import '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
8
8
|
import '@fern-api/csharp-codegen/lib/context/model-navigator';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
3
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-Dz9RlVgp.js';
|
|
4
4
|
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
|
|
5
5
|
import '@fern-api/csharp-codegen/lib/ast';
|
|
6
6
|
import '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-4A2AR7IK.js";import"./chunk-ONI3ZPJV.js";import"./chunk-3AKTWPYH.js";import"./chunk-BHXOAZDW.js";import"./chunk-VBCDESX3.js";import"./chunk-JXSLTUG5.js";import"./chunk-54PJL32I.js";import"./chunk-RHB5YSP4.js";export{a as DynamicSnippetsGenerator};
|
|
2
2
|
//# sourceMappingURL=DynamicSnippetsGenerator.js.map
|
|
@@ -131,6 +131,12 @@ declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGen
|
|
|
131
131
|
extraDependencies: Record<string, string>;
|
|
132
132
|
pascalCaseEnvironments: boolean;
|
|
133
133
|
explicitNamespaces: boolean;
|
|
134
|
+
outputPath: {
|
|
135
|
+
library: string;
|
|
136
|
+
test: string;
|
|
137
|
+
solution: string;
|
|
138
|
+
other: string;
|
|
139
|
+
};
|
|
134
140
|
};
|
|
135
141
|
get constants(): {
|
|
136
142
|
folders: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Options } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { WithGeneration, ast } from '@fern-api/csharp-codegen';
|
|
3
3
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
4
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-
|
|
4
|
+
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-Dz9RlVgp.js';
|
|
5
5
|
import '@fern-api/csharp-codegen/lib/ast';
|
|
6
6
|
import '@fern-api/csharp-codegen/lib/ast/types/Type';
|
|
7
7
|
import '@fern-api/csharp-codegen/lib/context/model-navigator';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-ONI3ZPJV.js";import"./chunk-VBCDESX3.js";import"./chunk-RHB5YSP4.js";export{a as EndpointSnippetGenerator};
|
|
2
2
|
//# sourceMappingURL=EndpointSnippetGenerator.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-BHXOAZDW.js";import{c as a}from"./chunk-VBCDESX3.js";import{a as p}from"./chunk-JXSLTUG5.js";import{a as m}from"./chunk-54PJL32I.js";import{e as r,j as o}from"./chunk-RHB5YSP4.js";var l=class g extends a{constructor({ir:e,config:t,options:n,generation:i}){super({ir:e,config:t,options:n});r(this,"ir");r(this,"dynamicTypeMapper");r(this,"dynamicLiteralMapper");r(this,"filePropertyMapper");r(this,"generation");this.ir=e,this.generation=i!=null?i:new o(e,t.workspaceName,t.customConfig!=null?t.customConfig:{},t),this.dynamicTypeMapper=new p({context:this}),this.dynamicLiteralMapper=new c({context:this}),this.filePropertyMapper=new m({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new g({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(e){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(e)}],multiline:!0}))}getMemoryStreamForString(e){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(e)]})]})}getClassName(e){return e.pascalCase.safeName}getParameterName(e){return e.camelCase.safeName}getPropertyName(e){return e.pascalCase.safeName}getMethodName(e){return`${e.pascalCase.safeName}Async`}getNamespace(e,t){let n=this.getNamespaceSegments(e);return n=t!=null?[...n,t]:n,[this.namespaces.root,...n].join(".")}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentClassReferenceForEnumName(t)}getEnvironmentClassReferenceForEnumName(e){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(e)}`,namespace:this.namespaces.root})}getNamespaceSegments(e){return(this.settings.explicitNamespaces?e.allParts:e.packagePath).map(n=>n.pascalCase.safeName)}precalculate(e){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((t,n)=>t[0].length-n[0].length).forEach(([t,n])=>{this.dynamicTypeMapper.convertToClassReference(n)});for(let[t,n]of e.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${t}`),namespace:"Usage"}),n.endpoint){let i=this.resolveEndpointLocation(n.endpoint);for(let s of i)switch(s.request.type){case"inlined":this.csharp.classReference({origin:s.request.declaration.name,namespace:this.getNamespace(s.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClient,this.csharp.freezeClassReferences()}};export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3AKTWPYH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-ONI3ZPJV.js";import{a as r}from"./chunk-3AKTWPYH.js";import{a as t}from"./chunk-VBCDESX3.js";var i=class extends t{constructor({ir:e,config:n,options:o={}}){super(new r({ir:e,config:n,options:o}))}precalculate(e){this.context.precalculate(e)}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new p({context:e})}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4A2AR7IK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as s,f as l,h as n,k as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as s,f as l,h as n,k as c}from"./chunk-RHB5YSP4.js";var p=class extends c{constructor({context:a}){super(a.generation);s(this,"context");this.context=a}getFilePropertyInfo({body:a,value:i}){var o;let t={fileFields:[],bodyPropertyFields:[]},r=(o=this.context.getRecord(i))!=null?o:{};for(let e of a.properties)switch(e.type){case"file":n.Record.missingKey(r,e.wireValue)&&(r[e.wireValue]="[bytes]"),t.fileFields.push({name:this.context.getPropertyName(e.name),value:this.getSingleFileProperty({property:e,record:r})});break;case"fileArray":n.Record.missingKey(r,e.wireValue)&&(r[e.wireValue]=["[bytes]"]),t.fileFields.push({name:this.context.getPropertyName(e.name),value:this.getArrayFileProperty({property:e,record:r})});break;case"bodyProperty":if(n.Record.missingKey(r,e.name.wireValue))switch(e.typeReference.type){case"optional":break;case"primitive":{switch(e.typeReference.value.toLowerCase()){case"integer":{r[e.name.wireValue]=123;break}case"string":{r[e.name.wireValue]="[string]";break}case"boolean":{r[e.name.wireValue]=!0;break}case"double":{r[e.name.wireValue]=123.456;break}case"float":{r[e.name.wireValue]=123.456;break}case"long":{r[e.name.wireValue]=123456789;break}case"uint":{r[e.name.wireValue]=123;break}case"uint64":{r[e.name.wireValue]=12345;break}case"date":{r[e.name.wireValue]=new Date(2021,1,1);break}case"datetime":{r[e.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{r[e.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{r[e.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{r[e.name.wireValue]="12345678901234567890";break}}break}default:break}t.bodyPropertyFields.push({name:this.context.getPropertyName(e.name.name),value:this.getBodyProperty({property:e,record:r})});break;default:l(e)}return t}getSingleFileProperty({property:a,record:i}){let t=this.context.getSingleFileValue({property:a,record:i});return t==null?this.csharp.Literal.nop():this.context.getFileParameterForString(t)}getArrayFileProperty({property:a,record:i}){let t=this.context.getFileArrayValues({property:a,record:i});return t==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:t.map(r=>this.context.getFileParameterForString(r))})}getBodyProperty({property:a,record:i}){let t=i[a.name.wireValue];return t==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:a.typeReference,value:t})}};export{p as a};
|
|
2
|
+
//# sourceMappingURL=chunk-54PJL32I.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a}from"./chunk-PRAGN765.js";import{e as u,f as c,k as p}from"./chunk-QALVTPA5.js";var h=class extends p{constructor({context:e}){super(e.generation);u(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:a.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(e.value===void 0&&!e.fallbackToDefault)return this.csharp.Literal.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,fallbackToDefault:e.fallbackToDefault});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,fallbackToDefault:e.fallbackToDefault});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?this.csharp.Literal.nop():this.convertNamed({named:r,value:e.value,as:e.as,fallbackToDefault:e.fallbackToDefault})}case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,fallbackToDefault:e.fallbackToDefault});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,fallbackToDefault:e.fallbackToDefault});case"unknown":return this.convertUnknown({value:e.value,fallbackToDefault:e.fallbackToDefault});default:c(e.typeReference)}}convertList({list:e,value:r,fallbackToDefault:i}){return Array.isArray(r)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:r.map((t,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:t})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof r}`}),this.csharp.Literal.nop())}convertLiteral({literal:e,value:r,fallbackToDefault:i}){switch(e.type){case"boolean":{let t=this.context.getValueAsBoolean({value:r});return t==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(t)}case"string":{let t=this.context.getValueAsString({value:r});return t==null?i?this.Primitive.string.getDeterminsticDefault(i):this.csharp.Literal.nop():this.csharp.Literal.string(t)}default:c(e)}}convertSet({set:e,value:r,fallbackToDefault:i}){return Array.isArray(r)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:r.map((t,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:t})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof r}`}),this.csharp.Literal.nop())}convertMap({map:e,value:r,fallbackToDefault:i}){return typeof r!="object"||r==null?(this.context.errors.add({severity:a.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:e.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:e.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(r).map(([t,n])=>{this.context.errors.scope(t);try{return{key:this.convert({typeReference:e.key,value:t,as:"key"}),value:this.convert({typeReference:e.value,value:n})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:r,as:i,fallbackToDefault:t}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:r,as:i,fallbackToDefault:t});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:e,value:r,fallbackToDefault:t}):this.convertUnknown({value:r,fallbackToDefault:t});case"enum":return this.getEnumValue(e,r);case"object":return this.convertObject({object_:e,value:r,fallbackToDefault:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r,fallbackToDefault:t});default:c(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:r,fallbackToDefault:i}){let t=this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r});if(n==null)return this.csharp.Literal.nop();let s=n.singleDiscriminatedUnionType,o=this.getBaseProperties({discriminatedUnionTypeInstance:n,singleDiscriminatedUnionType:s});switch(s.type){case"samePropertiesAsObject":{let l=this.context.resolveNamedType({typeId:s.typeId});return l==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.convertNamed({named:l,value:n.value})]})}case"singleProperty":{if(this.context.getRecord(n.value)==null)return this.csharp.Literal.nop();try{let m=["Value","Type"].includes(s.discriminantValue.name.pascalCase.safeName)?`${s.discriminantValue.name.pascalCase.safeName}Inner`:s.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(s.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:m,enclosingType:t}),arguments_:[this.convert({typeReference:s.typeReference,value:s.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:n.discriminantValue,enclosingType:t}),arguments_:[]})]});default:c(s)}}getBaseProperties({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:r}){var t,n;return this.context.associateByWireValue({parameters:(t=r.properties)!=null?t:[],values:(n=this.context.getRecord(e.value))!=null?n:{},ignoreMissingParameters:!0}).map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),assignment:this.convert(s)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:e,arguments_:r,baseProperties:i}){let t=this.csharp.instantiateClass({classReference:e,arguments_:r,multiline:!0});return i.length===0?this.csharp.Literal.reference(t):this.csharp.Literal.reference(this.csharp.codeblock(n=>{n.write(t," "),n.pushScope();for(let s of i)n.write(s.name," = ",s.assignment,",");n.popScope(!1)}))}getEnumValue(e,r){if(typeof r!="string")return this.context.errors.add({severity:a.Critical,message:`Expected enum value string, got: ${typeof r}`}),this.csharp.Literal.nop();let i=e.values.find(s=>s.wireValue===r);if(i==null)return this.context.errors.add({severity:a.Critical,message:`An enum value named "${r}" does not exist in this context`}),this.csharp.Literal.nop();let t=this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),n=t.registerField(this.model.getPropertyNameFor(i),i);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:t,value:n}))}convertObject({object_:e,value:r,fallbackToDefault:i}){var n;let t=this.context.associateByWireValue({parameters:e.properties,values:(n=this.context.getRecord(r))!=null?n:{}});return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:t.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getClassName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r,fallbackToDefault:i}){let t=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r});return t==null?this.csharp.Literal.nop():t.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r}){for(let i of e.types)try{let t=this.convert({typeReference:i,value:r});return{valueTypeReference:i,typeLiteral:t}}catch(t){continue}this.context.errors.add({severity:a.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof r}" value`})}convertUnknown({value:e,fallbackToDefault:r}){return this.csharp.Literal.unknown(e)}convertPrimitive({primitive:e,value:r,as:i,fallbackToDefault:t}){switch(e){case"INTEGER":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.integer.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.integer(n)}case"LONG":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.long.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.long(n)}case"UINT":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.uint.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.uint(n)}case"UINT_64":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.ulong.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.ulong(n)}case"FLOAT":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.float.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.float(n)}case"DOUBLE":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.double.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.double(n)}case"BOOLEAN":{let n=this.getValueAsBoolean({value:r,as:i});return n==null?t?this.Primitive.boolean.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.boolean(n)}case"STRING":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"DATE":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Value.dateOnly.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.date(n)}case"DATE_TIME":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Value.dateTime.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.datetime(n)}case"UUID":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"BASE_64":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"BIG_INTEGER":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}default:c(e)}}getValueAsNumber({value:e,as:r}){let i=r==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:e,as:r}){let i=r==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:i})}};export{h as a};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as a}from"./chunk-VBCDESX3.js";import{e as u,f as c,k as p}from"./chunk-RHB5YSP4.js";var h=class extends p{constructor({context:e}){super(e.generation);u(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:a.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(e.value===void 0&&!e.fallbackToDefault)return this.csharp.Literal.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,fallbackToDefault:e.fallbackToDefault});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,fallbackToDefault:e.fallbackToDefault});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?this.csharp.Literal.nop():this.convertNamed({named:r,value:e.value,as:e.as,fallbackToDefault:e.fallbackToDefault})}case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,fallbackToDefault:e.fallbackToDefault});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,fallbackToDefault:e.fallbackToDefault});case"unknown":return this.convertUnknown({value:e.value,fallbackToDefault:e.fallbackToDefault});default:c(e.typeReference)}}convertList({list:e,value:r,fallbackToDefault:i}){return Array.isArray(r)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:r.map((t,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:t})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof r}`}),this.csharp.Literal.nop())}convertLiteral({literal:e,value:r,fallbackToDefault:i}){switch(e.type){case"boolean":{let t=this.context.getValueAsBoolean({value:r});return t==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(t)}case"string":{let t=this.context.getValueAsString({value:r});return t==null?i?this.Primitive.string.getDeterminsticDefault(i):this.csharp.Literal.nop():this.csharp.Literal.string(t)}default:c(e)}}convertSet({set:e,value:r,fallbackToDefault:i}){return Array.isArray(r)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,unboxOptionals:!0}),values:r.map((t,n)=>{this.context.errors.scope({index:n});try{return this.convert({typeReference:e,value:t})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof r}`}),this.csharp.Literal.nop())}convertMap({map:e,value:r,fallbackToDefault:i}){return typeof r!="object"||r==null?(this.context.errors.add({severity:a.Critical,message:`Expected object but got: ${r==null?"null":typeof r}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:e.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:e.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(r).map(([t,n])=>{this.context.errors.scope(t);try{return{key:this.convert({typeReference:e.key,value:t,as:"key"}),value:this.convert({typeReference:e.value,value:n})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:r,as:i,fallbackToDefault:t}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:r,as:i,fallbackToDefault:t});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:e,value:r,fallbackToDefault:t}):this.convertUnknown({value:r,fallbackToDefault:t});case"enum":return this.getEnumValue(e,r);case"object":return this.convertObject({object_:e,value:r,fallbackToDefault:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r,fallbackToDefault:t});default:c(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:r,fallbackToDefault:i}){let t=this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),n=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r});if(n==null)return this.csharp.Literal.nop();let s=n.singleDiscriminatedUnionType,o=this.getBaseProperties({discriminatedUnionTypeInstance:n,singleDiscriminatedUnionType:s});switch(s.type){case"samePropertiesAsObject":{let l=this.context.resolveNamedType({typeId:s.typeId});return l==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.convertNamed({named:l,value:n.value})]})}case"singleProperty":{if(this.context.getRecord(n.value)==null)return this.csharp.Literal.nop();try{let m=["Value","Type"].includes(s.discriminantValue.name.pascalCase.safeName)?`${s.discriminantValue.name.pascalCase.safeName}Inner`:s.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(s.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:m,enclosingType:t}),arguments_:[this.convert({typeReference:s.typeReference,value:s.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:t,baseProperties:o,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:n.discriminantValue,enclosingType:t}),arguments_:[]})]});default:c(s)}}getBaseProperties({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:r}){var t,n;return this.context.associateByWireValue({parameters:(t=r.properties)!=null?t:[],values:(n=this.context.getRecord(e.value))!=null?n:{},ignoreMissingParameters:!0}).map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),assignment:this.convert(s)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:e,arguments_:r,baseProperties:i}){let t=this.csharp.instantiateClass({classReference:e,arguments_:r,multiline:!0});return i.length===0?this.csharp.Literal.reference(t):this.csharp.Literal.reference(this.csharp.codeblock(n=>{n.write(t," "),n.pushScope();for(let s of i)n.write(s.name," = ",s.assignment,",");n.popScope(!1)}))}getEnumValue(e,r){if(typeof r!="string")return this.context.errors.add({severity:a.Critical,message:`Expected enum value string, got: ${typeof r}`}),this.csharp.Literal.nop();let i=e.values.find(s=>s.wireValue===r);if(i==null)return this.context.errors.add({severity:a.Critical,message:`An enum value named "${r}" does not exist in this context`}),this.csharp.Literal.nop();let t=this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),n=t.registerField(this.model.getPropertyNameFor(i),i);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:t,value:n}))}convertObject({object_:e,value:r,fallbackToDefault:i}){var n;let t=this.context.associateByWireValue({parameters:e.properties,values:(n=this.context.getRecord(r))!=null?n:{}});return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:t.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getClassName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:r,fallbackToDefault:i}){let t=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r});return t==null?this.csharp.Literal.nop():t.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:r}){for(let i of e.types)try{let t=this.convert({typeReference:i,value:r});return{valueTypeReference:i,typeLiteral:t}}catch(t){continue}this.context.errors.add({severity:a.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof r}" value`})}convertUnknown({value:e,fallbackToDefault:r}){return this.csharp.Literal.unknown(e)}convertPrimitive({primitive:e,value:r,as:i,fallbackToDefault:t}){switch(e){case"INTEGER":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.integer.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.integer(n)}case"LONG":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.long.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.long(n)}case"UINT":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.uint.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.uint(n)}case"UINT_64":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.ulong.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.ulong(n)}case"FLOAT":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.float.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.float(n)}case"DOUBLE":{let n=this.getValueAsNumber({value:r,as:i});return n==null?t?this.Primitive.double.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.double(n)}case"BOOLEAN":{let n=this.getValueAsBoolean({value:r,as:i});return n==null?t?this.Primitive.boolean.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.boolean(n)}case"STRING":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"DATE":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Value.dateOnly.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.date(n)}case"DATE_TIME":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Value.dateTime.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.datetime(n)}case"UUID":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"BASE_64":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}case"BIG_INTEGER":{let n=this.context.getValueAsString({value:r});return n==null?t?this.Primitive.string.getDeterminsticDefault(t):this.csharp.Literal.nop():this.csharp.Literal.string(n)}default:c(e)}}getValueAsNumber({value:e,as:r}){let i=r==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:e,as:r}){let i=r==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:i})}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BHXOAZDW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as i,f as r,k as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as i,f as r,k as n}from"./chunk-RHB5YSP4.js";var s=class extends n{constructor({context:e}){super(e.generation);i(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":{let t=this.convert({typeReference:e.typeReference.value});return e.unboxOptionals?t.asNonOptional():t.asOptional()}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:r(e.typeReference)}}convertToClassReference(e){return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)})}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"object":return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.OneOf.OneOf(e.types.map(t=>this.convert({typeReference:t})));default:r(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:r(e)}}};export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JXSLTUG5.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l,d as R,e as i}from"./chunk-PRAGN765.js";import{a as b,b as v,e as w,f as m,h as A,i as F,k as E}from"./chunk-QALVTPA5.js";var Te=typeof global=="object"&&global&&global.Object===Object&&global,k=Te;var Me=typeof self=="object"&&self&&self.Object===Object&&self,Ue=k||Me||Function("return this")(),T=Ue;var We=T.Symbol,d=We;var M=Object.prototype,je=M.hasOwnProperty,De=M.toString,h=d?d.toStringTag:void 0;function Ve(r){var s=je.call(r,h),e=r[h];try{r[h]=void 0;var t=!0}catch(o){}var a=De.call(r);return t&&(s?r[h]=e:delete r[h]),a}var U=Ve;var ze=Object.prototype,He=ze.toString;function Ge(r){return He.call(r)}var W=Ge;var Ze="[object Null]",Je="[object Undefined]",j=d?d.toStringTag:void 0;function Ke(r){return r==null?r===void 0?Je:Ze:j&&j in Object(r)?U(r):W(r)}var D=Ke;function _e(r){return r!=null&&typeof r=="object"}var V=_e;var $e="[object Symbol]";function Ye(r){return typeof r=="symbol"||V(r)&&D(r)==$e}var z=Ye;function Qe(r,s){for(var e=-1,t=r==null?0:r.length,a=Array(t);++e<t;)a[e]=s(r[e],e,r);return a}var H=Qe;var Xe=Array.isArray,G=Xe;var et=1/0,Z=d?d.prototype:void 0,J=Z?Z.toString:void 0;function K(r){if(typeof r=="string")return r;if(G(r))return H(r,K)+"";if(z(r))return J?J.call(r):"";var s=r+"";return s=="0"&&1/r==-et?"-0":s}var _=K;function tt(r){return r==null?"":_(r)}var p=tt;function rt(r,s,e){var t=-1,a=r.length;s<0&&(s=-s>a?0:a+s),e=e>a?a:e,e<0&&(e+=a),a=s>e?0:e-s>>>0,s>>>=0;for(var o=Array(a);++t<a;)o[t]=r[t+s];return o}var $=rt;function at(r,s,e){var t=r.length;return e=e===void 0?t:e,!s&&e>=t?r:$(r,s,e)}var Y=at;var ot="\\ud800-\\udfff",st="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",ft="\\u20d0-\\u20ff",ut=st+nt+ft,it="\\ufe0e\\ufe0f",dt="\\u200d",lt=RegExp("["+dt+ot+ut+it+"]");function pt(r){return lt.test(r)}var I=pt;function mt(r){return r.split("")}var Q=mt;var X="\\ud800-\\udfff",ct="\\u0300-\\u036f",xt="\\ufe20-\\ufe2f",ht="\\u20d0-\\u20ff",gt=ct+xt+ht,yt="\\ufe0e\\ufe0f",bt="["+X+"]",S="["+gt+"]",P="\\ud83c[\\udffb-\\udfff]",vt="(?:"+S+"|"+P+")",ee="[^"+X+"]",te="(?:\\ud83c[\\udde6-\\uddff]){2}",re="[\\ud800-\\udbff][\\udc00-\\udfff]",Rt="\\u200d",ae=vt+"?",oe="["+yt+"]?",At="(?:"+Rt+"(?:"+[ee,te,re].join("|")+")"+oe+ae+")*",It=oe+ae+At,Ct="(?:"+[ee+S+"?",S,te,re,bt].join("|")+")",Ft=RegExp(P+"(?="+P+")|"+Ct+It,"g");function St(r){return r.match(Ft)||[]}var se=St;function Pt(r){return I(r)?se(r):Q(r)}var ne=Pt;function Bt(r){return function(s){s=p(s);var e=I(s)?ne(s):void 0,t=e?e[0]:s.charAt(0),a=e?Y(e,1).join(""):s.slice(1);return t[r]()+a}}var fe=Bt;var Lt=fe("toUpperCase"),g=Lt;function Ot(r){return g(p(r).toLowerCase())}var ue=Ot;function Nt(r,s,e,t){var a=-1,o=r==null?0:r.length;for(t&&o&&(e=r[++a]);++a<o;)e=s(e,r[a],a,r);return e}var ie=Nt;function qt(r){return function(s){return r==null?void 0:r[s]}}var de=qt;var wt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Et=de(wt),le=Et;var kt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tt="\\u0300-\\u036f",Mt="\\ufe20-\\ufe2f",Ut="\\u20d0-\\u20ff",Wt=Tt+Mt+Ut,jt="["+Wt+"]",Dt=RegExp(jt,"g");function Vt(r){return r=p(r),r&&r.replace(kt,le).replace(Dt,"")}var pe=Vt;var zt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ht(r){return r.match(zt)||[]}var me=Ht;var Gt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Zt(r){return Gt.test(r)}var ce=Zt;var be="\\ud800-\\udfff",Jt="\\u0300-\\u036f",Kt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",$t=Jt+Kt+_t,ve="\\u2700-\\u27bf",Re="a-z\\xdf-\\xf6\\xf8-\\xff",Yt="\\xac\\xb1\\xd7\\xf7",Qt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Xt="\\u2000-\\u206f",er=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ae="A-Z\\xc0-\\xd6\\xd8-\\xde",tr="\\ufe0e\\ufe0f",Ie=Yt+Qt+Xt+er,Ce="['\u2019]",xe="["+Ie+"]",rr="["+$t+"]",Fe="\\d+",ar="["+ve+"]",Se="["+Re+"]",Pe="[^"+be+Ie+Fe+ve+Re+Ae+"]",or="\\ud83c[\\udffb-\\udfff]",sr="(?:"+rr+"|"+or+")",nr="[^"+be+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+Ae+"]",fr="\\u200d",he="(?:"+Se+"|"+Pe+")",ur="(?:"+x+"|"+Pe+")",ge="(?:"+Ce+"(?:d|ll|m|re|s|t|ve))?",ye="(?:"+Ce+"(?:D|LL|M|RE|S|T|VE))?",Oe=sr+"?",Ne="["+tr+"]?",ir="(?:"+fr+"(?:"+[nr,Be,Le].join("|")+")"+Ne+Oe+")*",dr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",lr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pr=Ne+Oe+ir,mr="(?:"+[ar,Be,Le].join("|")+")"+pr,cr=RegExp([x+"?"+Se+"+"+ge+"(?="+[xe,x,"$"].join("|")+")",ur+"+"+ye+"(?="+[xe,x+he,"$"].join("|")+")",x+"?"+he+"+"+ge,x+"+"+ye,lr,dr,Fe,mr].join("|"),"g");function xr(r){return r.match(cr)||[]}var qe=xr;function hr(r,s,e){return r=p(r),s=e?void 0:s,s===void 0?ce(r)?qe(r):me(r):r.match(s)||[]}var we=hr;var gr="['\u2019]",yr=RegExp(gr,"g");function br(r){return function(s){return ie(we(pe(s).replace(yr,"")),r,"")}}var Ee=br;var vr=Ee(function(r,s,e){return s=s.toLowerCase(),r+(e?ue(s):s)}),B=vr;var ke=class extends E{constructor({context:e}){super(e.generation);w(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}async generateSnippetAst({endpoint:e,request:t,options:a}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:a}){var f;if(e.examples&&!((f=e.examples)!=null&&f.find(u=>A.DynamicIR.EndpointExample(t)&&u.id===t.id)))throw new Error("Endpoint does not have an example that matches the snippet");let o=this.csharp.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),n=this.getStyle(a);switch(n){case R.Concise:return o;case R.Full:return this.buildFullCodeBlock({body:o,options:a});default:m(n)}}buildFullCodeBlock({body:e,options:t}){var n;let a=this.getConfig(t),o=this.csharp.class_({name:(n=a.fullStyleClassName)!=null?n:"Example",namespace:"Usage",access:F.Access.Public});return o.addNamespaceReference(this.Types.RootClient.namespace),o.addMethod({name:"Do",access:F.Access.Public,isAsync:!0,parameters:[],body:e}),o}constructClient({endpoint:e,snippet:t}){return this.csharp.codeblock(a=>{a.write("var client = "),a.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){var n,f;let a=((n=e.response)==null?void 0:n.type)==="streaming"||((f=e.response)==null?void 0:f.type)==="streamParameter",o=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:a});return a?this.csharp.codeblock(u=>{u.write("await foreach (var item in "),u.writeNode(o),u.writeLine(")"),u.pushScope(),u.writeLine("/* consume each item */"),u.popScope()}):o}getConstructorArgs({endpoint:e,snippet:t}){let a=[];e.auth!=null&&(t.auth!=null?a.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:l.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let o=[],n=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});n.length>0&&o.push(...n),this.context.errors.scope(i.Headers);let f=[];return this.context.ir.headers!=null&&t.headers!=null&&f.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),o.length===0?[...a,...f]:[...a,...f,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:o.map(u=>({name:u.name,assignment:u.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let a=this.getBaseUrlArg({baseUrl:e,environment:t});return A.Literal.nop(a)?[]:[{name:this.getBaseUrlOptionName(),assignment:a}]}getBaseUrlArg({baseUrl:e,environment:t}){var a;if(e!=null&&t!=null)return this.context.errors.add({severity:l.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(e!=null)return((a=this.context.ir.environments)==null?void 0:a.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:l.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let o=this.context.getEnvironmentTypeReferenceFromID(t);return o==null?(this.context.errors.add({severity:l.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(t).map(([o,n])=>({name:g(B(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:n})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArg({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getConstructorHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getConstructorOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The C# SDK Generator does not support Inferred auth scheme yet"),[];default:m(e)}}addError(e){this.context.errors.add({severity:l.Critical,message:e})}addWarning(e){this.context.errors.add({severity:l.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getParameterName(e.username),assignment:this.csharp.Literal.string(t.username)},{name:this.context.getParameterName(e.password),assignment:this.csharp.Literal.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.token),assignment:this.csharp.Literal.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value,fallbackToDefault:e.header.name.wireValue})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.clientId),assignment:this.csharp.Literal.string(t.clientId)},{name:this.context.getParameterName(e.clientSecret),assignment:this.csharp.Literal.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let a=[];for(let o of e){let n=this.getConstructorHeaderArg({header:o,value:t.value});n!=null&&a.push({name:this.context.getParameterName(o.name.name),assignment:n})}return a}getConstructorHeaderArg({header:e,value:t}){let a=this.context.dynamicLiteralMapper.convert({typeReference:e.typeReference,value:t,fallbackToDefault:e.name.wireValue});if(!A.Literal.nop(a))return a}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:m(e.request)}}getMethodArgsForInlinedRequest({request:e,snippet:t}){var u,y;let a=[];this.context.errors.scope(i.PathParameters);let o=[],n=[...(u=this.context.ir.pathParameters)!=null?u:[],...(y=e.pathParameters)!=null?y:[]];n.length>0&&o.push(...this.getPathParameters({namedParameters:n,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let f=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})||a.push(...o.map(C=>C.value)),a.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})?o:[],filePropertyInfo:f})),a}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:a,filePropertyInfo:o}){var L,O,N,q;this.context.errors.scope(i.QueryParameters);let f=this.context.associateQueryParametersByWireValue({parameters:(L=e.queryParameters)!=null?L:[],values:(O=t.queryParameters)!=null?O:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(c)}));this.context.errors.unscope(),this.context.errors.scope(i.Headers);let y=this.context.associateByWireValue({parameters:(N=e.headers)!=null?N:[],values:(q=t.headers)!=null?q:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},c),{fallbackToDefault:c.name.wireValue}))}));this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let C=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:o}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:[...a,...f,...y,...C]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:a});default:m(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var n;let a=[],o=this.context.associateByWireValue({parameters:e,values:(n=this.context.getRecord(t))!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var n,f;let a=[];this.context.errors.scope(i.PathParameters);let o=[...(n=this.context.ir.pathParameters)!=null?n:[],...(f=e.pathParameters)!=null?f:[]];return o.length>0&&a.push(...this.getPathParameters({namedParameters:o,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody),e.body!=null&&a.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),a}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return e.value.type==="optional"&&t==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getBytesBodyRequestArg({value:e}){let t=this.context.getValueAsString({value:e});return t==null&&(this.context.errors.add({severity:l.Critical,message:"The bytes request body must be provided in string format"}),t="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(t))}getRootClientConstructorInvocation(e){return this.csharp.instantiateClass({classReference:this.Types.RootClient,arguments_:e,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:e,snippet:t}){var n;let a=[],o=this.context.associateByWireValueOrDefault({parameters:e,values:(n=t.pathParameters)!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getClassName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getBaseUrlOptionName(){var e;return((e=this.context.ir.environments)==null?void 0:e.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(e){var t,a;return(a=(t=e.style)!=null?t:this.context.options.style)!=null?a:R.Full}getConfig(e){var t,a;return(a=(t=e.config)!=null?t:this.context.options.config)!=null?a:{}}};export{ke as a};
|
|
1
|
+
import{b as l,d as R,e as i}from"./chunk-VBCDESX3.js";import{a as b,b as v,e as w,f as m,h as A,i as F,k as E}from"./chunk-RHB5YSP4.js";var Te=typeof global=="object"&&global&&global.Object===Object&&global,k=Te;var Me=typeof self=="object"&&self&&self.Object===Object&&self,Ue=k||Me||Function("return this")(),T=Ue;var We=T.Symbol,d=We;var M=Object.prototype,je=M.hasOwnProperty,De=M.toString,h=d?d.toStringTag:void 0;function Ve(r){var s=je.call(r,h),e=r[h];try{r[h]=void 0;var t=!0}catch(o){}var a=De.call(r);return t&&(s?r[h]=e:delete r[h]),a}var U=Ve;var ze=Object.prototype,He=ze.toString;function Ge(r){return He.call(r)}var W=Ge;var Ze="[object Null]",Je="[object Undefined]",j=d?d.toStringTag:void 0;function Ke(r){return r==null?r===void 0?Je:Ze:j&&j in Object(r)?U(r):W(r)}var D=Ke;function _e(r){return r!=null&&typeof r=="object"}var V=_e;var $e="[object Symbol]";function Ye(r){return typeof r=="symbol"||V(r)&&D(r)==$e}var z=Ye;function Qe(r,s){for(var e=-1,t=r==null?0:r.length,a=Array(t);++e<t;)a[e]=s(r[e],e,r);return a}var H=Qe;var Xe=Array.isArray,G=Xe;var et=1/0,Z=d?d.prototype:void 0,J=Z?Z.toString:void 0;function K(r){if(typeof r=="string")return r;if(G(r))return H(r,K)+"";if(z(r))return J?J.call(r):"";var s=r+"";return s=="0"&&1/r==-et?"-0":s}var _=K;function tt(r){return r==null?"":_(r)}var p=tt;function rt(r,s,e){var t=-1,a=r.length;s<0&&(s=-s>a?0:a+s),e=e>a?a:e,e<0&&(e+=a),a=s>e?0:e-s>>>0,s>>>=0;for(var o=Array(a);++t<a;)o[t]=r[t+s];return o}var $=rt;function at(r,s,e){var t=r.length;return e=e===void 0?t:e,!s&&e>=t?r:$(r,s,e)}var Y=at;var ot="\\ud800-\\udfff",st="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",ft="\\u20d0-\\u20ff",ut=st+nt+ft,it="\\ufe0e\\ufe0f",dt="\\u200d",lt=RegExp("["+dt+ot+ut+it+"]");function pt(r){return lt.test(r)}var I=pt;function mt(r){return r.split("")}var Q=mt;var X="\\ud800-\\udfff",ct="\\u0300-\\u036f",xt="\\ufe20-\\ufe2f",ht="\\u20d0-\\u20ff",gt=ct+xt+ht,yt="\\ufe0e\\ufe0f",bt="["+X+"]",S="["+gt+"]",P="\\ud83c[\\udffb-\\udfff]",vt="(?:"+S+"|"+P+")",ee="[^"+X+"]",te="(?:\\ud83c[\\udde6-\\uddff]){2}",re="[\\ud800-\\udbff][\\udc00-\\udfff]",Rt="\\u200d",ae=vt+"?",oe="["+yt+"]?",At="(?:"+Rt+"(?:"+[ee,te,re].join("|")+")"+oe+ae+")*",It=oe+ae+At,Ct="(?:"+[ee+S+"?",S,te,re,bt].join("|")+")",Ft=RegExp(P+"(?="+P+")|"+Ct+It,"g");function St(r){return r.match(Ft)||[]}var se=St;function Pt(r){return I(r)?se(r):Q(r)}var ne=Pt;function Bt(r){return function(s){s=p(s);var e=I(s)?ne(s):void 0,t=e?e[0]:s.charAt(0),a=e?Y(e,1).join(""):s.slice(1);return t[r]()+a}}var fe=Bt;var Lt=fe("toUpperCase"),g=Lt;function Ot(r){return g(p(r).toLowerCase())}var ue=Ot;function Nt(r,s,e,t){var a=-1,o=r==null?0:r.length;for(t&&o&&(e=r[++a]);++a<o;)e=s(e,r[a],a,r);return e}var ie=Nt;function qt(r){return function(s){return r==null?void 0:r[s]}}var de=qt;var wt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Et=de(wt),le=Et;var kt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Tt="\\u0300-\\u036f",Mt="\\ufe20-\\ufe2f",Ut="\\u20d0-\\u20ff",Wt=Tt+Mt+Ut,jt="["+Wt+"]",Dt=RegExp(jt,"g");function Vt(r){return r=p(r),r&&r.replace(kt,le).replace(Dt,"")}var pe=Vt;var zt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ht(r){return r.match(zt)||[]}var me=Ht;var Gt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Zt(r){return Gt.test(r)}var ce=Zt;var be="\\ud800-\\udfff",Jt="\\u0300-\\u036f",Kt="\\ufe20-\\ufe2f",_t="\\u20d0-\\u20ff",$t=Jt+Kt+_t,ve="\\u2700-\\u27bf",Re="a-z\\xdf-\\xf6\\xf8-\\xff",Yt="\\xac\\xb1\\xd7\\xf7",Qt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Xt="\\u2000-\\u206f",er=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ae="A-Z\\xc0-\\xd6\\xd8-\\xde",tr="\\ufe0e\\ufe0f",Ie=Yt+Qt+Xt+er,Ce="['\u2019]",xe="["+Ie+"]",rr="["+$t+"]",Fe="\\d+",ar="["+ve+"]",Se="["+Re+"]",Pe="[^"+be+Ie+Fe+ve+Re+Ae+"]",or="\\ud83c[\\udffb-\\udfff]",sr="(?:"+rr+"|"+or+")",nr="[^"+be+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+Ae+"]",fr="\\u200d",he="(?:"+Se+"|"+Pe+")",ur="(?:"+x+"|"+Pe+")",ge="(?:"+Ce+"(?:d|ll|m|re|s|t|ve))?",ye="(?:"+Ce+"(?:D|LL|M|RE|S|T|VE))?",Oe=sr+"?",Ne="["+tr+"]?",ir="(?:"+fr+"(?:"+[nr,Be,Le].join("|")+")"+Ne+Oe+")*",dr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",lr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",pr=Ne+Oe+ir,mr="(?:"+[ar,Be,Le].join("|")+")"+pr,cr=RegExp([x+"?"+Se+"+"+ge+"(?="+[xe,x,"$"].join("|")+")",ur+"+"+ye+"(?="+[xe,x+he,"$"].join("|")+")",x+"?"+he+"+"+ge,x+"+"+ye,lr,dr,Fe,mr].join("|"),"g");function xr(r){return r.match(cr)||[]}var qe=xr;function hr(r,s,e){return r=p(r),s=e?void 0:s,s===void 0?ce(r)?qe(r):me(r):r.match(s)||[]}var we=hr;var gr="['\u2019]",yr=RegExp(gr,"g");function br(r){return function(s){return ie(we(pe(s).replace(yr,"")),r,"")}}var Ee=br;var vr=Ee(function(r,s,e){return s=s.toLowerCase(),r+(e?ue(s):s)}),B=vr;var ke=class extends E{constructor({context:e}){super(e.generation);w(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:e,request:t,options:a}){return this.buildCodeBlock({endpoint:e,snippet:t,options:a}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}async generateSnippetAst({endpoint:e,request:t,options:a}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:a}){var f;if(e.examples&&!((f=e.examples)!=null&&f.find(u=>A.DynamicIR.EndpointExample(t)&&u.id===t.id)))throw new Error("Endpoint does not have an example that matches the snippet");let o=this.csharp.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),n=this.getStyle(a);switch(n){case R.Concise:return o;case R.Full:return this.buildFullCodeBlock({body:o,options:a});default:m(n)}}buildFullCodeBlock({body:e,options:t}){var n;let a=this.getConfig(t),o=this.csharp.class_({name:(n=a.fullStyleClassName)!=null?n:"Example",namespace:"Usage",access:F.Access.Public});return o.addNamespaceReference(this.Types.RootClient.namespace),o.addMethod({name:"Do",access:F.Access.Public,isAsync:!0,parameters:[],body:e}),o}constructClient({endpoint:e,snippet:t}){return this.csharp.codeblock(a=>{a.write("var client = "),a.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){var n,f;let a=((n=e.response)==null?void 0:n.type)==="streaming"||((f=e.response)==null?void 0:f.type)==="streamParameter",o=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:a});return a?this.csharp.codeblock(u=>{u.write("await foreach (var item in "),u.writeNode(o),u.writeLine(")"),u.pushScope(),u.writeLine("/* consume each item */"),u.popScope()}):o}getConstructorArgs({endpoint:e,snippet:t}){let a=[];e.auth!=null&&(t.auth!=null?a.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:l.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let o=[],n=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});n.length>0&&o.push(...n),this.context.errors.scope(i.Headers);let f=[];return this.context.ir.headers!=null&&t.headers!=null&&f.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),o.length===0?[...a,...f]:[...a,...f,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:o.map(u=>({name:u.name,assignment:u.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let a=this.getBaseUrlArg({baseUrl:e,environment:t});return A.Literal.nop(a)?[]:[{name:this.getBaseUrlOptionName(),assignment:a}]}getBaseUrlArg({baseUrl:e,environment:t}){var a;if(e!=null&&t!=null)return this.context.errors.add({severity:l.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(e!=null)return((a=this.context.ir.environments)==null?void 0:a.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:l.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let o=this.context.getEnvironmentTypeReferenceFromID(t);return o==null?(this.context.errors.add({severity:l.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(t).map(([o,n])=>({name:g(B(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:n})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArg({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getConstructorHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getConstructorOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The C# SDK Generator does not support Inferred auth scheme yet"),[];default:m(e)}}addError(e){this.context.errors.add({severity:l.Critical,message:e})}addWarning(e){this.context.errors.add({severity:l.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getParameterName(e.username),assignment:this.csharp.Literal.string(t.username)},{name:this.context.getParameterName(e.password),assignment:this.csharp.Literal.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.token),assignment:this.csharp.Literal.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value,fallbackToDefault:e.header.name.wireValue})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getParameterName(e.clientId),assignment:this.csharp.Literal.string(t.clientId)},{name:this.context.getParameterName(e.clientSecret),assignment:this.csharp.Literal.string(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let a=[];for(let o of e){let n=this.getConstructorHeaderArg({header:o,value:t.value});n!=null&&a.push({name:this.context.getParameterName(o.name.name),assignment:n})}return a}getConstructorHeaderArg({header:e,value:t}){let a=this.context.dynamicLiteralMapper.convert({typeReference:e.typeReference,value:t,fallbackToDefault:e.name.wireValue});if(!A.Literal.nop(a))return a}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:m(e.request)}}getMethodArgsForInlinedRequest({request:e,snippet:t}){var u,y;let a=[];this.context.errors.scope(i.PathParameters);let o=[],n=[...(u=this.context.ir.pathParameters)!=null?u:[],...(y=e.pathParameters)!=null?y:[]];n.length>0&&o.push(...this.getPathParameters({namedParameters:n,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let f=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})||a.push(...o.map(C=>C.value)),a.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:this.settings.shouldInlinePathParameters})?o:[],filePropertyInfo:f})),a}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:a,filePropertyInfo:o}){var L,O,N,q;this.context.errors.scope(i.QueryParameters);let f=this.context.associateQueryParametersByWireValue({parameters:(L=e.queryParameters)!=null?L:[],values:(O=t.queryParameters)!=null?O:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(c)}));this.context.errors.unscope(),this.context.errors.scope(i.Headers);let y=this.context.associateByWireValue({parameters:(N=e.headers)!=null?N:[],values:(q=t.headers)!=null?q:{}}).map(c=>({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},c),{fallbackToDefault:c.name.wireValue}))}));this.context.errors.unscope(),this.context.errors.scope(i.RequestBody);let C=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:o}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}),fields:[...a,...f,...y,...C]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:a});default:m(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var n;let a=[],o=this.context.associateByWireValue({parameters:e,values:(n=this.context.getRecord(t))!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var n,f;let a=[];this.context.errors.scope(i.PathParameters);let o=[...(n=this.context.ir.pathParameters)!=null?n:[],...(f=e.pathParameters)!=null?f:[]];return o.length>0&&a.push(...this.getPathParameters({namedParameters:o,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(i.RequestBody),e.body!=null&&a.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),a}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return e.value.type==="optional"&&t==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:e.value,value:t,fallbackToDefault:JSON.stringify(e.value)});default:m(e)}}getBytesBodyRequestArg({value:e}){let t=this.context.getValueAsString({value:e});return t==null&&(this.context.errors.add({severity:l.Critical,message:"The bytes request body must be provided in string format"}),t="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(t))}getRootClientConstructorInvocation(e){return this.csharp.instantiateClass({classReference:this.Types.RootClient,arguments_:e,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:e,snippet:t}){var n;let a=[],o=this.context.associateByWireValueOrDefault({parameters:e,values:(n=t.pathParameters)!=null?n:{}});for(let f of o)a.push({name:this.context.getPropertyName(f.name.name),value:this.context.dynamicLiteralMapper.convert(v(b({},f),{fallbackToDefault:f.name.wireValue}))});return a}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getClassName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getBaseUrlOptionName(){var e;return((e=this.context.ir.environments)==null?void 0:e.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(e){var t,a;return(a=(t=e.style)!=null?t:this.context.options.style)!=null?a:R.Full}getConfig(e){var t,a;return(a=(t=e.config)!=null?t:this.context.options.config)!=null?a:{}}};export{ke as a};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lodash-es/lodash.js:
|
|
@@ -12,4 +12,4 @@ lodash-es/lodash.js:
|
|
|
12
12
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
13
13
|
*)
|
|
14
14
|
*/
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-ONI3ZPJV.js.map
|
|
@@ -29,5 +29,5 @@ ${tn(this).map(r=>` ${r.fn} - ${r.path}:${r.position}`).join(`
|
|
|
29
29
|
`),this.hasSameAccess(this.init)||r.write(`${this.init} `),r.writeTextStatement("init"),r.writeNoIndent(`#else
|
|
30
30
|
`),r.writeTextStatement("set"),r.writeNoIndent(`#endif
|
|
31
31
|
`)):(this.hasSameAccess(this.init)||r.write(`${this.init} `),(f=this.accessors)!=null&&f.init?(r.write("init"),r.write(" => "),this.accessors.init(r),r.writeTextStatement("")):r.write("init; "))),this.set&&(this.hasSameAccess(this.set)||r.write(`${this.set} `),(p=this.accessors)!=null&&p.set?(r.write("set"),r.write(" => "),this.accessors.set(r),r.writeTextStatement("")):r.write("set; ")),r.write("}")),this.initializer!=null?(u?r.write(" => "):r.write(" = "),this.initializer.write(r),r.writeLine(";")):!this.skipDefaultInitializer&&!i&&n?T.Type(this.type)&&this.type.writeEmptyCollectionInitializer(r):!this.get&&!this.init&&r.writeLine(";")}hasSameAccess(r){return r===!0||r===this.access}};var Le;(function(e){e[e.INSTANCE=0]="INSTANCE",e[e.STATIC=1]="STATIC"})(Le||(Le={}));var Tr=class e extends _r{constructor({name:r,isAsync:i,override:n,access:u,return_:l,body:f,noBody:p,bodyType:y,summary:h,doc:P,type:E,classReference:M,parameters:Q,typeParameters:Z,annotations:K,codeExample:k,interfaceReference:ee,origin:Ue,enclosingType:I},$){super({enclosingType:I},Ue,$);a(this,"name");a(this,"isAsync");a(this,"access");a(this,"return");a(this,"noBody");a(this,"body");a(this,"bodyType");a(this,"summary");a(this,"doc");a(this,"type");a(this,"reference");a(this,"override");a(this,"parameters");a(this,"typeParameters");a(this,"annotations");a(this,"interfaceReference");this.name=r,this.isAsync=i!=null?i:!1,this.override=n!=null?n:!1,this.access=u,this.return=l,this.noBody=p!=null?p:!1,this.body=f,this.bodyType=y!=null?y:e.BodyType.Statement,this.summary=h,this.doc=this.csharp.xmlDocBlockOf(P!=null?P:{summary:h,codeExample:k}),this.type=E!=null?E:Le.INSTANCE,this.reference=M,this.parameters=Q!=null?Q:[],this.typeParameters=Z!=null?Z:[],this.annotations=(K!=null?K:[]).map(d=>d instanceof he?this.csharp.annotation({reference:d}):d),this.interfaceReference=ee}get isAsyncEnumerable(){return T.AsyncEnumerable(this.return)}addParameter(r){return r instanceof xe||(r=new xe(r,this.generation)),this.parameters.push(r),r}write(r){var i,n;if(r.writeNode(this.doc),this.annotations.forEach(u=>{u.write(r)}),r.writeNewLineIfLastLineNot(),this.access&&r.write(`${this.access} `),this.type===Le.STATIC&&r.write("static "),this.isAsync&&r.write("async "),this.override&&r.write("override "),this.return==null?this.isAsync?(r.writeNode(this.System.Threading.Tasks.Task()),r.write(" ")):r.write("void "):(this.isAsync&&!this.isAsyncEnumerable?r.writeNode(this.System.Threading.Tasks.Task(this.return)):this.return.write(r),r.write(" ")),this.interfaceReference&&r.write(`${this.interfaceReference.name}.`),r.write(this.name),this.typeParameters.length>0&&(r.write("<"),this.typeParameters.forEach((u,l)=>{u.write(r),l<this.typeParameters.length-1&&r.write(", ")}),r.write(">")),r.write("("),this.parameters.forEach((u,l)=>{u.write(r),l<this.parameters.length-1&&r.write(", ")}),r.write(")"),this.noBody)r.writeLine(";");else switch(this.bodyType){case e.BodyType.Statement:r.write(" "),r.pushScope(),(i=this.body)==null||i.write(r),r.popScope();break;case e.BodyType.Expression:r.write(" => "),(n=this.body)==null||n.write(r),r.writeSemicolonIfLastCharacterIsNot();break;default:Ln(this.bodyType)}}getParameters(){return this.parameters}};(function(e){e.BodyType={Statement:"statement",Expression:"expression"}})(Tr||(Tr={}));var Hi=class extends Pe{constructor({name:r,namespace:i,access:n,partial:u,interfaceReferences:l,enclosingType:f,origin:p},y){super(p,y);a(this,"access");a(this,"partial");a(this,"reference");a(this,"interfaceReferences");a(this,"fields",[]);a(this,"methods",[]);r=r||(p?this.model.getClassNameFor(p):Es("Class/Interface name or origin is required")),this.reference=f?this.csharp.classReference({name:r,enclosingType:f}):this.csharp.classReference({name:r,namespace:i||Es("Class/Interface: Namespace or enclosingType is required ")}),this.access=n,this.partial=u!=null?u:!1,this.interfaceReferences=l!=null?l:[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}get enclosingType(){return this.reference.enclosingType}get isNested(){return this.enclosingType!=null}explicit(r){return this.origin?this.model.explicit(T.Provenance(this.origin)?this.origin.node:this.origin,r):Es(`Cannot create explicit named member '${r}' on '${this.name}' because the class is not bound to an origin.`)}getField(r){return this.fields.find(i=>{var n;return((n=this.model.provenance(i.origin))==null?void 0:n.jsonPath)===r.jsonPath})}addField(r){r.enclosingType=this.reference;let i=new $i(r,this.generation);return this.fields.push(i),i}addMethod(r){r.enclosingType=this.reference;let i=new Tr(r,this.generation);return this.methods.push(i),i}get multipartMethodName(){return"AddJsonPart"}get multipartMethodNameForCollection(){return"AddJsonParts"}get isOptional(){return!1}get isCollection(){return!1}get isReferenceType(){}asOptional(){return new Be(this,this.generation)}asNonOptional(){return this}get defaultValue(){return this.csharp.Literal.null()}get fullyQualifiedName(){return this.reference.fullyQualifiedName}};var Ne=class Ne extends Hi{constructor({name:r,namespace:i,access:n,static_:u,abstract_:l,sealed:f,partial:p,readonly:y,parentClassReference:h,interfaceReferences:P,enclosingType:E,type:M,summary:Q,doc:Z,annotations:K,primaryConstructor:k,origin:ee},Ue){super({name:r,namespace:i,access:n,partial:p,interfaceReferences:P,enclosingType:E,origin:ee},Ue);a(this,"static_");a(this,"abstract_");a(this,"sealed");a(this,"readonly");a(this,"parentClassReference");a(this,"type");a(this,"summary");a(this,"doc");a(this,"annotations",[]);a(this,"primaryConstructor");a(this,"namespaceReferences",[]);a(this,"constructors",[]);a(this,"operators",[]);a(this,"nestedClasses",[]);a(this,"nestedInterfaces",[]);this.static_=u!=null?u:!1,this.abstract_=l!=null?l:!1,this.sealed=f!=null?f:!1,this.readonly=y!=null?y:!1,this.type=M!=null?M:Ne.ClassType.Class,this.summary=Q,this.doc=this.csharp.xmlDocBlockOf(Z!=null?Z:{summary:Q}),this.parentClassReference=h,this.annotations=(K!=null?K:[]).map(I=>I instanceof he?this.csharp.annotation({reference:I}):I),this.primaryConstructor=k}addConstructor(r){let i=new Ne.Constructor(r,this.generation);return this.constructors.push(i),i}addNestedClass(r){if(r instanceof Ne||(r.enclosingType=this.reference,r=new Ne(r,this.generation)),!r.isNested)throw new Error(`Set the enclosingType of the class ${this.name} to add the nested class ${r.name}.`);return this.nestedClasses.push(r),r}addNestedClasses(r){r.forEach(i=>{i instanceof Ne?this.addNestedClass(i):this.addNestedClass(i)})}addAnnotation(r){return r instanceof hr||(r=new hr(r,this.generation)),this.annotations.push(r),r}addOperator(r){this.operators.push(r)}addOperators(r){r.forEach(i=>this.addOperator(i))}write(r){if(this.namespaceReferences.forEach(i=>{r.addNamespace(i)}),this.isNested||(r.writeLine(`namespace ${this.namespace};`),r.newLine()),r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),r.writeNewLineIfLastLineNot(),r.write(`${this.access}`),this.static_&&r.write(" static"),this.abstract_&&r.write(" abstract"),this.sealed&&r.write(" sealed"),this.readonly&&r.write(" readonly"),this.partial&&r.write(" partial"),r.write(` ${this.type}`),r.write(` ${this.name}`),this.primaryConstructor!=null&&this.primaryConstructor.parameters.length>0){let i=this.primaryConstructor;r.write("("),i.parameters.forEach((n,u)=>{u>0&&r.write(","),n.write(r)}),r.write(")")}if(this.parentClassReference!=null||this.interfaceReferences.length>0){if(r.write(" : "),this.parentClassReference!=null&&(this.parentClassReference.write(r),this.interfaceReferences.length>0&&r.write(", ")),this.primaryConstructor!=null&&this.primaryConstructor.superClassArguments.length>0){let i=this.primaryConstructor;r.write("("),this.primaryConstructor.superClassArguments.forEach((n,u)=>{n.write(r),u<i.superClassArguments.length-1&&r.write(", ")}),r.write(")")}this.interfaceReferences.forEach((i,n)=>{i.write(r),n<this.interfaceReferences.length-1&&r.write(", ")})}if(!this.hasBody()){r.write(";");return}r.writeNewLineIfLastLineNot(),r.pushScope(),this.writeConsts(r),this.writeFieldFields(r),this.writeConstructors(r),this.writeProperties(r),this.writeMethods(r),this.writeOperators(r),this.writeNestedClasses(r),this.writeNestedInterfaces(r),r.popScope()}hasBody(){return this.fields.length>0||this.constructors.length>0||this.nestedClasses.length>0||this.nestedInterfaces.length>0||this.methods.length>0||this.operators.length>0}writeConstructors(r){this.constructors.forEach(i=>{r.writeNode(this.csharp.xmlDocBlockOf(i.doc)),r.write(`${i.access} ${this.name} (`),i.parameters.forEach((n,u)=>{n.write(r),u<i.parameters.length-1&&r.write(", ")}),r.write(")"),i.baseConstructorCall!=null&&(r.write(" : "),i.baseConstructorCall.write(r)),r.pushScope(),i.body.write(r),r.popScope(),r.newLine()})}writeFields({writer:r,fields:i}){i.forEach((n,u)=>{n.write(r),r.writeNewLineIfLastLineNot(),u<this.fields.length-1&&r.newLine()})}writeConsts(r){this.writeFields({writer:r,fields:this.getFields().sort(Gi).sort(qs).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(Gi).sort(qs).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(Gi).sort(qs).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(Gi).sort(Kv).sort(Gv).forEach(i=>{i.write(r),r.writeNewLineIfLastLineNot(),r.newLine()})}writeOperators(r){this.operators.forEach(i=>{this.writeOperator({writer:r,operator:i}),r.newLine()})}writeNestedClasses(r){this.nestedClasses.sort(Gi).forEach((i,n)=>{i.write(r),r.writeNewLineIfLastLineNot(),n<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(Gi).forEach((i,n)=>{i.write(r),r.writeNewLineIfLastLineNot(),n<this.fields.length-1&&r.newLine()})}fieldConstFilter(){return r=>r.isConst}fieldFieldFilter(){return r=>r.isField}fieldPropertyFilter(){return r=>r.isProperty}getFields(){return this.fields}get isReferenceType(){return this.type===Ne.ClassType.Class||this.type===Ne.ClassType.Record}writeOperator({writer:r,operator:i}){var n;if(r.write("public static "),i.type===Ne.CastOperator.Type.Explicit||i.type===Ne.CastOperator.Type.Implicit){r.write(`${i.type} `),r.write("operator ");let u=(n=i.to)!=null?n:this.reference;r.writeNode(u),r.write("("),i.parameter.write(r)}else{let u=i;u.return.write(r),r.write(" operator "),r.write(`${i.type}(`),u.parameters.forEach((l,f)=>{l.write(r),f<u.parameters.length-1&&r.write(", ")})}i.useExpressionBody?(r.write(") => "),r.writeNodeStatement(i.body)):(r.write(") {"),r.writeNode(i.body),r.writeLine("}"))}addNamespaceReference(r){this.namespaceReferences.push(r)}};a(Ne,"ClassType",{Class:"class",Record:"record",Struct:"struct",RecordStruct:"record struct"}),a(Ne,"Access",Y);var ur=Ne;(function(e){class t{constructor({doc:n,body:u,parameters:l,access:f,baseConstructorCall:p},y){a(this,"generation");a(this,"doc");a(this,"body");a(this,"parameters");a(this,"access");a(this,"baseConstructorCall");this.generation=y,this.parameters=l!=null?l:[],this.access=f!=null?f:Y.Public,this.doc=n,this.body=new Mr({},this.generation),u!=null&&this.body.append(u),this.baseConstructorCall=p}addParameter(n){let u=new xe(n,this.generation);return this.parameters.push(u),u}}e.Constructor=t;let r;(function(i){i.Type={Implicit:"implicit",Explicit:"explicit"}})(r=e.CastOperator||(e.CastOperator={}))})(ur||(ur={}));function XO(e){switch(e){case void 0:return 0;case Y.Private:return 1;case Y.Protected:return 2;case Y.Internal:return 3;case Y.Public:return 4}}function Gi(e,t){return XO(e.access)-XO(t.access)}function qs(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function Gv(e,t){return e.type===Le.STATIC&&t.type!==Le.STATIC?-1:e.type!==Le.STATIC&&t.type===Le.STATIC?1:0}function Kv(e,t){return e.name==="FromProto"||e.name==="ToProto"?t.name==="Equals"||t.name==="ToString"?-1:1:t.name==="FromProto"||t.name==="ToProto"?e.name==="Equals"||e.name==="ToString"?1:-1:e.name==="ToString"?1:t.name==="ToString"?-1:e.name==="Equals"?t.name==="ToString"?-1:1:t.name==="Equals"?e.name==="ToString"?1:-1:0}var Ki=class extends Pe{constructor({name:r,namespace:i,access:n,annotations:u,origin:l},f){super(l,f);a(this,"access");a(this,"reference");a(this,"annotations");a(this,"fields",[]);this.reference=this.csharp.classReference({name:r,namespace:i,origin:l}),this.access=n,this.annotations=u!=null?u:[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}getNamespace(){return this.namespace}addMember(r){this.fields.push({name:r.name,value:this.csharp.annotation({reference:this.System.Runtime.Serialization.EnumMember,argument:this.csharp.codeblock(i=>{i.write("Value = "),i.writeNode(this.csharp.string_({string:r.value}))})})})}write(r){r.writeLine(`namespace ${this.namespace};`),r.newLine();for(let i of this.annotations)i.write(r);r.writeNewLineIfLastLineNot(),r.write(`${this.access} `),r.write("enum "),r.writeLine(`${this.name}`),r.pushScope(),this.fields.forEach((i,n)=>{i.value.write(r),r.write(i.name),n<this.fields.length-1&&(r.writeLine(","),r.newLine())}),r.writeNewLineIfLastLineNot(),r.popScope()}};var Ji=class extends Hi{constructor({name:t,namespace:r,access:i,partial:n,interfaceReferences:u,enclosingType:l,origin:f},p){super({name:t,namespace:r,access:i,partial:n,interfaceReferences:u,enclosingType:l,origin:f},p)}write(t){this.isNested||(t.writeLine(`namespace ${this.namespace};`),t.newLine()),t.write(`${this.access} `),this.partial&&t.write("partial "),t.write("interface "),t.writeLine(`${this.name}`),this.interfaceReferences.length>0&&(t.write(" : "),this.interfaceReferences.forEach((r,i)=>{r.write(t),i<this.interfaceReferences.length-1&&t.write(", ")})),t.pushScope();for(let r of this.fields)r.write(t),t.writeLine("");t.dedent(),t.indent();for(let r of this.methods)r.write(t),t.writeLine("");t.popScope()}};var zi=class extends Pe{constructor({name:r,namespace:i,parentClassReference:n,origin:u},l){super(u,l);a(this,"reference");a(this,"parentClassReference");a(this,"testMethods",[]);this.reference=this.csharp.classReference({name:r,namespace:i,origin:u}),this.parentClassReference=n}get name(){return this.reference.name}get namespace(){return this.reference.namespace}write(r){r.writeNode(this.getClass())}getClass(){let r=new ur({access:Y.Public,name:this.name,namespace:this.namespace,annotations:[this.NUnit.Framework.TestFixture],parentClassReference:this.parentClassReference,origin:this.origin},this.generation);for(let i of this.testMethods)r.addMethod({access:Y.Public,isAsync:i.isAsync,name:i.name,parameters:[],body:i.body,annotations:[this.NUnit.Framework.Test]});return r}addTestMethod(r){this.testMethods.push(r)}};import{join as In}from"path";import{fail as Qi}from"assert";var Rs={System:["AccessViolationException","Action","Activator","AggregateException","AppContext","AppDomain","AppDomainSetup","AppDomainUnloadedException","ApplicationException","ApplicationId","ArgIterator","ArgumentException","ArgumentNullException","ArgumentOutOfRangeException","ArithmeticException","Array","ArrayTypeMismatchException","AssemblyLoadEventArgs","AssemblyLoadEventHandler","AsyncCallback","Attribute","AttributeTargets","AttributeUsageAttribute","BadImageFormatException","Base64FormattingOptions","BitConverter","Boolean","Buffer","Byte","CannotUnloadAppDomainException","Char","CharEnumerator","CLSCompliantAttribute","Console","ConsoleCancelEventArgs","ConsoleCancelEventHandler","ConsoleColor","ConsoleKey","ConsoleKeyInfo","ConsoleModifiers","ConsoleSpecialKey","ContextBoundObject","ContextMarshalException","ContextStaticAttribute","Convert","CultureAwareComparer","DataMisalignedException","DateOnly","DateTime","DateTimeKind","DateTimeOffset","DayOfWeek","DBNull","Decimal","Delegate","DivideByZeroException","DllNotFoundException","Double","DuplicateWaitObjectException","EntryPointNotFoundException","Enum","Environment","EnvironmentVariableTarget","EventArgs","EventHandler","Exception","ExecutionEngineException","FieldAccessException","FlagsAttribute","FormatException","FormattableString","GC","GCCollectionMode","GCGenerationInfo","GCKind","GCMemoryInfo","GCNotificationStatus","Guid","Half","HashCode","IAsyncDisposable","IAsyncResult","ICloneable","IComparable","IConvertible","ICustomFormatter","IDisposable","IFormatProvider","IFormattable","Index","IndexOutOfRangeException","InsufficientExecutionStackException","InsufficientMemoryException","Int128","Int16","Int32","Int64","IntPtr","InvalidCastException","InvalidOperationException","InvalidProgramException","InvalidTimeZoneException","ISpanFormattable","IUtf8SpanFormattable","LoaderOptimization","LoaderOptimizationAttribute","LocalDataStoreSlot","MarshalByRefObject","Math","MathF","MemberAccessException","MemoryExtensions","MethodAccessException","MidpointRounding","MissingFieldException","MissingMemberException","MissingMethodException","ModuleHandle","MTAThreadAttribute","MulticastDelegate","MulticastNotSupportedException","NonSerializedAttribute","NotFiniteNumberException","NotImplementedException","NotSupportedException","Nullable","NullReferenceException","Object","ObjectDisposedException","ObsoleteAttribute","OperatingSystem","OperationCanceledException","OrdinalComparer","OutOfMemoryException","OverflowException","ParamArrayAttribute","PlatformID","PlatformNotSupportedException","Random","Range","RankException","ResolveEventArgs","ResolveEventHandler","RuntimeArgumentHandle","RuntimeFieldHandle","RuntimeMethodHandle","RuntimeTypeHandle","SByte","SerializableAttribute","Single","StackOverflowException","STAThreadAttribute","String","StringComparer","StringComparison","StringNormalizationExtensions","StringSplitOptions","SystemException","ThreadStaticAttribute","TimeOnly","TimeoutException","TimeProvider","TimeSpan","TimeZone","TimeZoneInfo","TimeZoneNotFoundException","Tuple","TupleExtensions","Type","TypeAccessException","TypeCode","TypedReference","TypeInitializationException","TypeLoadException","TypeUnloadedException","UInt128","UInt16","UInt32","UInt64","UIntPtr","UnauthorizedAccessException","UnhandledExceptionEventArgs","UnhandledExceptionEventHandler","UnitySerializationHolder","ValueTuple","ValueType","Version","Void","WeakReference","Buffers","Collections","ComponentModel","Diagnostics","Globalization","IO","Linq","Net","Numerics","Reflection","Resources","Runtime","Security","Text","Threading"],"System.Collections.Generic":["ByteEqualityComparer","CollectionExtensions","IEnumerable","KeyNotFoundException","KeyValuePair","NonRandomizedStringEqualityComparer","ReferenceEqualityComparer"],"System.IO":["BinaryReader","BinaryWriter","BufferedStream","Directory","DirectoryInfo","DirectoryNotFoundException","EndOfStreamException","EnumerationOptions","File","FileAccess","FileAttributes","FileInfo","FileLoadException","FileMode","FileNotFoundException","FileOptions","FileShare","FileStream","FileStreamOptions","FileSystemInfo","HandleInheritability","InvalidDataException","IOException","MatchCasing","MatchType","MemoryStream","Path","PathTooLongException","RandomAccess","SearchOption","SeekOrigin","Stream","StreamReader","StreamWriter","StringReader","StringWriter","TextReader","TextWriter","UnixFileMode","UnmanagedMemoryAccessor","UnmanagedMemoryStream","System.IO.Enumeration"],"System.Linq":["Enumerable"],"System.Net.Http":["HttpClient","HttpMethod"],"System.Threading":["AbandonedMutexException","ApartmentState","AsyncFlowControl","AutoResetEvent","CancellationToken","CancellationTokenRegistration","CancellationTokenSource","CompressedStack","ContextCallback","EventResetMode","EventWaitHandle","ExecutionContext","Interlocked","IOCompletionCallback","IThreadPoolWorkItem","ITimer","LazyInitializer","LazyThreadSafetyMode","Lock","LockRecursionException","LockRecursionPolicy","ManualResetEvent","ManualResetEventSlim","Monitor","Mutex","NativeOverlapped","Overlapped","ParameterizedThreadStart","PeriodicTimer","PreAllocatedOverlapped","ReaderWriterLockSlim","RegisteredWaitHandle","Semaphore","SemaphoreFullException","SemaphoreSlim","SendOrPostCallback","SpinLock","SpinWait","SynchronizationContext","SynchronizationLockException","Thread","ThreadAbortException","ThreadExceptionEventArgs","ThreadExceptionEventHandler","ThreadInterruptedException","ThreadPool","ThreadPoolBoundHandle","ThreadPriority","ThreadStart","ThreadStartException","ThreadState","ThreadStateException","Timeout","Timer","TimerCallback","Volatile","WaitCallback","WaitHandle","WaitHandleCannotBeOpenedException","WaitHandleExtensions","WaitOrTimerCallback","Tasks"],"System.Threading.Tasks":["ConcurrentExclusiveSchedulerPair","ConfigureAwaitOptions","Task","TaskAsyncEnumerableExtensions","TaskCanceledException","TaskCompletionSource","TaskContinuationOptions","TaskCreationOptions","TaskExtensions","TaskFactory","TaskScheduler","TaskSchedulerException","TaskStatus","TaskToAsyncResult","UnobservedTaskExceptionEventArgs","ValueTask","Sources"]};var Jv=new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while"]);var zv=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),Qv=new Set(["async","await"]),Xv=new Set(["yield"]),Yv=new Set(["var","dynamic"]),Zv=new Set(["using","alias"]);var kv=new Set(["required","scoped","unmanaged","managed"]),eT=new Set(["when","and","or","not"]),tT=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),rT=new Set([...Jv,...zv,...Qv,...Xv,...Yv,...Zv,...kv,...eT]),En=class{constructor(t,r,i){a(this,"registry");a(this,"name");a(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=i}};var qn=class{constructor(t){a(this,"scope");a(this,"byName",new Map);a(this,"byPath",new Map);a(this,"redirections",new Map);this.scope=t}[Symbol.iterator](){return this.byName.values()}has(t){return this.byName.has(t)}getByJsonPath(t){return this.byPath.get(t)}getByName(t){return this.byName.get(t)}getRedirectedName(t){return this.redirections.get(t)}set(t){this.byName.has(t.name)&&Qi(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists`),t.jsonPath&&this.byPath.has(t.jsonPath)&&Qi(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists by jsonPath`),this.byName.set(t.name,t),t.jsonPath&&this.byPath.set(t.jsonPath,t)}redirect(t,r){this.redirections.has(t)&&Qi(`redirect: ${t} in ${this.scope.fullyQualifiedName} already has a redirect`),this.redirections.set(t,r)}},As=class extends En{constructor(r,i,n,u){super(r,i);a(this,"namespace");a(this,"fullyQualifiedName");a(this,"fields");a(this,"methods");this.namespace=n,this.fullyQualifiedName=u,this.fields=new qn(this),this.methods=new qn(this)}isKeyword(r){return rT.has(r)}isBuiltinMemberName(r){return tT.has(r)}isTypeName(r){return this.name===r}isField(r){return this.fields.has(r)}isMethod(r){return this.methods.has(r)}isMember(r){return this.isField(r)||this.isMethod(r)}nameBlocked(r){if(this.isKeyword(r))return"keyword";if(this.isBuiltinMemberName(r))return"builtin";if(this.isTypeName(r))return"typeName";if(this.isField(r))return"field";if(this.isMethod(r))return"method"}getAlternativeName(r){let i=`${r}_`,n=2;for(;this.nameBlocked(i);)i=`${r}_${n}`,n++;return i}getFieldByJsonPath(r){return r!==void 0?this.fields.getByJsonPath(r):void 0}getFieldByName(r){return this.fields.getByName(r)}getRedirectedFieldName(r){return this.fields.getRedirectedName(r)}registerField(r,i,n){let u=this.registry.model.jsonPath(i);if(u){let p=this.fields.getByJsonPath(u);if(p)return p.name}let l=this.fields.getByName(r);if(l&&u===l.jsonPath)return r;switch(this.nameBlocked(r)){case"field":i&&T.Provenance(i)&&i.explicit||Qi(`Field ${r} already exists - attempting to add a duplicate field with the same name that is not an explicitly named property`);break;case"keyword":case"builtin":case"typeName":case"method":break;default:return this.fields.set(new Rn(this.registry,r,this,u,n)),this.registry.setFieldNameShortcut(u,r),r}let f=this.getAlternativeName(r);return this.fields.set(new Rn(this.registry,f,this,u,n)),this.fields.redirect(r,f),this.registry.setFieldNameShortcut(u,f),f}getFieldName(r,i){var f;let n=(f=this.getFieldByJsonPath(this.registry.model.jsonPath(r)))==null?void 0:f.name;if(n)return n;if(T.Provenance(r)){let p=this.getRedirectedFieldName(i);if(p)return p;let y=this.getFieldByName(i);if(y){let h=this.registry.model.provenance(y.jsonPath);return h!=null&&h.explicit?i:`${i}_`}return i}let u=this.getFieldByName(i);if(u){let p=this.registry.model.provenance(u.jsonPath);return p!=null&&p.explicit?i:u.name}let l=this.getRedirectedFieldName(i);if(l)return l;this.isMethod(i)}},Cs=class extends En{constructor(r,i,n,u){super(r,i,u);a(this,"scope");this.scope=n}},Rn=class extends Cs{constructor(r,i,n,u,l){super(r,i,n,u);a(this,"field");this.field=l}};var Xi=class e{constructor(t){a(this,"generation");a(this,"classReferenceByJsonPath",new Map);a(this,"typeRegistry",new Map);a(this,"namespaceRegistry",new Map);a(this,"typeNames",new Map);a(this,"namespaceNames",new Map);a(this,"implicitNamespaces",new Set);a(this,"shortcuts",new Map);a(this,"knownBuiltInIdentifiers",new Set(["Text","Json","Xml","Security","Collections","Data","Diagnostics","Globalization","Math","Reflection","Runtime","Security","Serialization","Threading","Xml"]));this.generation=t,this.initializeBuiltIns()}get csharp(){return this.generation.csharp}get model(){return this.generation.model}initializeBuiltIns(){for(let[t,r]of Object.entries(Rs))t.split(".").forEach(i=>this.knownBuiltInIdentifiers.add(i)),r.forEach(i=>this.knownBuiltInIdentifiers.add(i));for(let[t,r]of Object.entries(Rs)){for(let n of r)this.typeNames.set(n,new Set([t]));let i=t.split(".")[0];i&&this.typeNames.set(i,new Set([t]))}this.typeNames.set("System",new Set(["System"])),this.typeNames.set("NUnit",new Set(["NUnit"])),this.typeNames.set("OneOf",new Set(["OneOf"]))}setFieldNameShortcut(t,r){if(t){let i=this.shortcuts.get(t);i&&i!==r&&Qi(`BAD_BAD_BAD setFieldNameShortcut: ${t} already has a name: ${i} - while setting to ${r} - if this is happening, then you could be getting back the wrong name later!`),this.shortcuts.set(t,r)}}getFieldNameByOrigin(t){var r;return this.shortcuts.get((r=this.model.jsonPath(t))!=null?r:">ignore<")}isKnownBuiltInIdentifier(t){return!t||typeof t!="string"?!1:this.knownBuiltInIdentifiers.has(t)}isKnownNamespace(t){return!t||typeof t!="string"?!1:this.namespaceRegistry.has(t)}isRegisteredTypeName(t){return this.typeRegistry.has(t)}isAmbiguousTypeName(t){var r,i;return t?((i=(r=this.typeNames.get(t))==null?void 0:r.size)!=null?i:0)>1:!1}isAmbiguousNamespaceName(t){var r,i;return t?((i=(r=this.namespaceNames.get(t))==null?void 0:r.size)!=null?i:0)>1:!1}static fullyQualifiedNameOf(t){return t.enclosingType?`${t.namespace}.${t.enclosingType.name}.${t.name}`:`${t.namespace}.${t.name}`}registerNamespace(t,r){this.namespaceRegistry.has(t)&&this.namespaceRegistry.get(t)!==r||this.namespaceRegistry.set(t,r)}trackType(t,r){var p;let{name:i,namespace:n,enclosingType:u,fullyQualifiedName:l,origin:f}=t;if(f){let y=(p=this.model.jsonPath(f))!=null?p:Qi(`JsonPath not found for origin: ${JSON.stringify(f).substring(0,100)}`);this.classReferenceByJsonPath.set(y,t)}if(r&&r!==l&&!this.typeRegistry.has(r)&&this.typeRegistry.set(r,t),!this.typeRegistry.has(l)){this.typeRegistry.set(l,t);for(let y of this.allNamespacesOf(n))this.registerNamespace(y,y);u||this.trackTypeName(i,n);for(let y of[this.generation.namespaces.root,...this.implicitNamespaces])if(n.startsWith(y)){let h=n.split(".")[y.split(".").length];h&&this.trackTypeName(h,n)}}return t}addImplicitNamespace(t){this.implicitNamespaces.add(t)}isNamespaceImplicit(t){return this.implicitNamespaces.has(t)}get implicitlyImportedNamespaces(){return[...this.implicitNamespaces]}trackTypeName(t,r){var u,l;this.typeNames.has(t)?(u=this.typeNames.get(t))==null||u.add(r):this.typeNames.set(t,new Set([r]));let i=r.split("."),n="";for(let f of i)this.namespaceNames.has(f)?(l=this.namespaceNames.get(f))==null||l.add(n):this.namespaceNames.set(f,new Set([n])),n=n?`${n}.${f}`:f}allNamespacesOf(t){if(!t||typeof t!="string")return new Set;let r="",i=new Set;for(let n of t.split("."))n.trim()&&(r=r?`${r}.${n}`:`${n}`,i.add(r));return i}registerClassReference(t,r){var Q,Z;let{name:i,namespace:n,enclosingType:u,origin:l}=t,f=this.model.jsonPath(l),p=(Q=f?this.classReferenceByJsonPath.get(f):void 0)!=null?Q:this.typeRegistry.get(r),y=this.model.jsonPath(p==null?void 0:p.origin),h=y&&f?y===f?"match":"mismatch":"no origin";if(p&&h!=="mismatch")return new he({name:p.name,namespace:p.namespace,enclosingType:p.enclosingType,fullyQualifiedName:p.fullyQualifiedName,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,origin:(Z=p.origin)!=null?Z:l,isCollection:p.isCollection,isReferenceType:p.isReferenceType,multipartMethodName:p.multipartMethodName,multipartMethodNameForCollection:p.multipartMethodNameForCollection},p.scope,this.generation);let P=!1,E=this.resolveNamespace(n);E!==n&&(n=E,P=!0);let M;e:for(;;){M=e.fullyQualifiedNameOf({name:i,namespace:n,enclosingType:u});let K="",k=n.split(".");for(let ee=0;ee<k.length;ee++)if(K=K?`${K}.${k[ee]}`:`${k[ee]}`,this.typeRegistry.has(K)){k[ee]=`${k[ee]}_`,n=k.join("."),P=!0;continue e}if(P&&this.registerNamespace(t.namespace,n),h==="mismatch"&&(p==null?void 0:p.name)===i){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(M)){i=`${i}_`,P=!0;continue e}break}return this.trackType(new he({name:i,namespace:n,enclosingType:u,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,fullyQualifiedName:M,origin:l,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new As(this,i,n,M),this.generation),r)}resolveNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=t.split(".");for(let n=i.length-1;n>=0;n--){let u=i.slice(0,n).join(".");if(this.namespaceRegistry.has(u)){let l=this.namespaceRegistry.get(u);if(l!==void 0){let f=i.slice(n).join("."),p=`${l}.${f}`;return this.registerNamespace(t,p),p}}}return t}canonicalizeNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=!1,n=t;e:for(;;){let u="",l=n.split(".");for(let f=0;f<l.length;f++)if(u=u?`${u}.${l[f]}`:`${l[f]}`,this.typeRegistry.has(u)){l[f]=`${l[f]}_`,n=l.join("."),i=!0;continue e}break}return i&&this.registerNamespace(t,n),n}};import{fail as iT}from"assert";var An=class{constructor(t){a(this,"generation");a(this,"frozen",!1);a(this,"extraClassReferences",new Map);a(this,"InstantiatedPrimitive",{string:t=>new le({type:"string",value:t},this.generation),boolean:t=>new le({type:"boolean",value:t},this.generation),integer:t=>new le({type:"integer",value:t},this.generation),long:t=>new le({type:"long",value:t},this.generation),uint:t=>new le({type:"uint",value:t},this.generation),ulong:t=>new le({type:"ulong",value:t},this.generation),float:t=>new le({type:"float",value:t},this.generation),double:t=>new le({type:"double",value:t},this.generation),date:t=>new le({type:"date",value:t},this.generation),dateTime:(t,r=!0)=>new le({type:"dateTime",value:t,parse:r},this.generation),uuid:t=>new le({type:"uuid",value:t},this.generation),null:()=>new le({type:"null"},this.generation)});a(this,"Literal",{class_:({reference:t,fields:r})=>new q.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:i})=>new q.Dictionary(t,r,i,this.generation),list:({valueType:t,values:r})=>new q.List(t,r,this.generation),set:({valueType:t,values:r})=>new q.Set(t,r,this.generation),boolean:t=>new q.Boolean(t,this.generation),float:t=>new q.Float(t,this.generation),date:t=>new q.Date(t,this.generation),datetime:t=>new q.DateTime(t,this.generation),decimal:t=>new q.Decimal(t,this.generation),double:t=>new q.Double(t,this.generation),integer:t=>new q.Integer(t,this.generation),long:t=>new q.Long(t,this.generation),uint:t=>new q.Uint(t,this.generation),ulong:t=>new q.Ulong(t,this.generation),reference:t=>new q.Reference(t,this.generation),string:t=>new q.String(t,this.generation),null:()=>new q.Null(this.generation),nop:()=>new q.Nop(this.generation),unknown:t=>new q.Unknown(t,this.generation)});a(this,"VALID_READ_ONLY_MEMORY_TYPES",new Set(["int","long","uint","ulong","string","bool","float","double"]));this.generation=t}get model(){return this.generation.model}classReference(t){return this.classReferenceInternal(t)}classReferenceInternal(t){if(!t.name&&"origin"in t&&t.origin&&(t.name=this.model.getClassNameFor(t.origin)),t.enclosingType){if(t.namespace)throw new Error("ClassReference: Both enclosingType and namespace cannot be provided");t.namespace=t.enclosingType.namespace}let r=Xi.fullyQualifiedNameOf(t);if(this.frozen&&!this.generation.registry.isRegisteredTypeName(r)){let i=this.extraClassReferences.get(r);i||(i=new Set,this.extraClassReferences.set(r,i)),i.add(`${r} -
|
|
32
|
-
${en()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){var l;let i=this.model.getPropertyNameFor(r),n=(l=this.model.origin(r))!=null?l:iT(`Origin not found for property: ${JSON.stringify(r).substring(0,100)}`),u=t.getFieldName(n,i);return u||i}class_(t){let r=t;return"reference"in t&&(r=yr(yr({},t.reference),t)),new ur(r,this.generation)}testClass(t){return new zi(t,this.generation)}annotation(t){return new hr(t,this.generation)}instantiateClass(t){return new Ei(t,this.generation)}invokeMethod(t){return new Ci(t,this.generation)}codeblock(t){return new Sr(t,this.generation)}code(){return new Mr({},this.generation)}anonymousFunction(t){return new Li(t)}parameter(t){return new xe(t,this.generation)}interface_(t){return new Ji(t,this.generation)}enum_(t){return new Ki(t,this.generation)}dictionary(t){return new qi(t,this.generation)}list(t){return new Ai(t,this.generation)}readOnlyMemory(t){return new Bi(t,this.generation)}set(t){return new Di(t,this.generation)}switch_(t){return new Vi(t,this.generation)}ternary(t){return new Wi(t,this.generation)}and(t){return new xi(t,this.generation)}or(t){return new Ui(t,this.generation)}enumInstantiation(t){return new Ri(t,this.generation)}string_(t){return new Ii(t,this.generation)}xmlDocBlock(t){return new vr(t,this.generation)}xmlDocBlockOf(t){return t instanceof vr?t:new vr(t,this.generation)}validateReadOnlyMemoryTypes(){for(let t of this.generation.settings.readOnlyMemoryTypes)if(!this.VALID_READ_ONLY_MEMORY_TYPES.has(t))throw new Error(`Type "${t}" is not a valid 'read-only-memory-types' custom config option; expected one of ${JSON.stringify(this.VALID_READ_ONLY_MEMORY_TYPES)}.`)}};function N(e){let t={},r={};for(let[i,n]of Object.entries(e))n.length===0?Object.defineProperty(r,i,{get(){return i in t||(t[i]=n()),t[i]},enumerable:!0,configurable:!0}):r[i]=n;return r}var Bs=class{constructor(t){a(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};var Cn=class{constructor(t){a(this,"generation");a(this,"System",N({Action:t=>this.csharp.classReference({name:"Action",namespace:"System",generics:t||void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),Func:(t,r)=>this.csharp.classReference({name:"Func",namespace:"System",generics:t?r?[...t,r]:t:r?[r]:void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),DateOnly:()=>this.csharp.classReference({name:"DateOnly",namespace:"System"}),DateTime:()=>this.csharp.classReference({name:"DateTime",namespace:"System"}),Enum:()=>this.csharp.classReference({name:"Enum",namespace:"System"}),Exception:()=>this.csharp.classReference({name:"Exception",namespace:"System"}),ReadOnlyMemory:t=>this.csharp.classReference({name:"ReadOnlyMemory",namespace:"System",generics:[t]}),Serializable:()=>this.csharp.classReference({name:"Serializable",namespace:"System"}),String:()=>this.csharp.classReference({name:"String",namespace:"System"}),Type:()=>this.csharp.classReference({name:"Type",namespace:"System",isReferenceType:!0,multipartMethodName:null,multipartMethodNameForCollection:null,fullyQualified:!0}),TimeSpan:()=>this.csharp.classReference({name:"TimeSpan",namespace:"System"}),Uri:()=>this.csharp.classReference({name:"Uri",namespace:"System"}),UriBuilder:()=>this.csharp.classReference({name:"UriBuilder",namespace:"System"}),Runtime:()=>N({Serialization:()=>N({EnumMember:()=>this.csharp.classReference({name:"EnumMember",namespace:"System.Runtime.Serialization"})})}),Collections:()=>N({Generic:()=>N({IAsyncEnumerable:t=>this.csharp.classReference({name:"IAsyncEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),IEnumerable:t=>this.csharp.classReference({name:"IEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),KeyValuePair:(t,r)=>this.csharp.classReference({name:"KeyValuePair",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0}),List:t=>this.csharp.classReference({name:"List",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),HashSet:t=>this.csharp.classReference({name:"HashSet",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),Dictionary:(t,r)=>this.csharp.classReference({name:"Dictionary",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0,isCollection:!0}),IDictionary:(t,r)=>this.csharp.classReference({name:"IDictionary",namespace:"System.Collections.Generic",generics:[t,r]})}),Linq:()=>N({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>N({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>N({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>N({Http:()=>N({HttpClient:()=>this.csharp.classReference({name:"HttpClient",namespace:"System.Net.Http"}),HttpMethod:()=>this.csharp.classReference({name:"HttpMethod",namespace:"System.Net.Http"}),HttpResponseHeaders:()=>this.csharp.classReference({name:"HttpResponseHeaders",namespace:"System.Net.Http.Headers"})}),ServerSentEvents:()=>N({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>N({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>N({MemoryStream:()=>this.csharp.classReference({name:"MemoryStream",namespace:"System.IO"}),Stream:()=>this.csharp.classReference({name:"Stream",namespace:"System.IO"}),StreamReader:()=>this.csharp.classReference({name:"StreamReader",namespace:"System.IO"})}),Text:()=>N({Encoding:()=>this.csharp.classReference({name:"Encoding",namespace:"System.Text"}),Encoding_UTF8:()=>this.csharp.classReference({name:"UTF8",enclosingType:this.csharp.classReference({name:"Encoding",namespace:"System.Text"})}),Json:()=>N({JsonElement:()=>this.csharp.classReference({name:"JsonElement",namespace:"System.Text.Json"}),JsonDocument:()=>this.csharp.classReference({name:"JsonDocument",namespace:"System.Text.Json"}),JsonException:()=>this.csharp.classReference({name:"JsonException",namespace:"System.Text.Json"}),Utf8JsonReader:()=>this.csharp.classReference({name:"Utf8JsonReader",namespace:"System.Text.Json"}),JsonSerializerOptions:()=>this.csharp.classReference({name:"JsonSerializerOptions",namespace:"System.Text.Json"}),JsonSerializer:()=>this.csharp.classReference({name:"JsonSerializer",namespace:"System.Text.Json"}),Utf8JsonWriter:()=>this.csharp.classReference({name:"Utf8JsonWriter",namespace:"System.Text.Json"}),Nodes:()=>N({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>N({IJsonOnDeserialized:()=>this.csharp.classReference({name:"IJsonOnDeserialized",namespace:"System.Text.Json.Serialization"}),IJsonOnSerializing:()=>this.csharp.classReference({name:"IJsonOnSerializing",namespace:"System.Text.Json.Serialization"}),JsonOnDeserializedAttribute:()=>this.csharp.classReference({name:"JsonOnDeserializedAttribute",namespace:"System.Text.Json.Serialization"}),JsonExtensionData:()=>this.csharp.classReference({name:"JsonExtensionData",namespace:"System.Text.Json.Serialization"}),JsonConverter:t=>this.csharp.classReference({name:"JsonConverter",namespace:"System.Text.Json.Serialization",generics:t?[t]:void 0}),JsonIgnore:()=>this.csharp.classReference({name:"JsonIgnore",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyName",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>N({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>N({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})})}));a(this,"NUnit",N({Framework:()=>N({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"})})}));a(this,"OneOf",N({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));a(this,"Google",N({Protobuf:()=>N({WellKnownTypes:()=>N({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));a(this,"WireMock",N({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));a(this,"Grpc",N({Core:()=>N({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};import{fail as Bn}from"assert";function YO(e){return e.split(".").filter(t=>!["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"].includes(t)).join(".")}var Dn=class{constructor(t,r){a(this,"generation");a(this,"indexByObject",new Map);a(this,"indexByPath",new Map);a(this,"explicitByObject",new Map);a(this,"explicitByPath",new Map);a(this,"root");a(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let n=YO(i!=null&&i.jsonPath?`${i.jsonPath}.${r}`:r);if(this.indexByPath.has(n)){i||Bn(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);for(let[l,f]of Object.entries(t))typeof f=="object"&&f!==null&&this.createIndex(f,l,i);return i}let u={jsonPath:n,name:r,node:t,parent:i};this.indexByObject.set(t,u),this.indexByPath.set(n,u);for(let[l,f]of Object.entries(t))typeof f=="object"&&f!==null&&this.createIndex(f,l,u);return u}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){var l;let i=(l=this.provenance(t))!=null?l:Bn(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),n=Yi(yr({},i),{jsonPath:YO(`${i.jsonPath}+${r}`),name:r,node:i.node,parent:i,explicit:!0}),u=this.explicitByObject.get(i.node);return u?u.add(n):this.explicitByObject.set(i.node,new Set([n])),this.explicitByPath.set(n.jsonPath,n),n}provenance(t){var r,i;if(t!==void 0)return T.string(t)?(r=this.explicitByPath.get(t))!=null?r:this.indexByPath.get(t):T.Provenance(t)?(i=this.explicitByPath.get(t.jsonPath))!=null?i:this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r!=null&&r.explicit?r:r==null?void 0:r.node}irNode(t){var r;return(r=this.provenance(t))==null?void 0:r.node}jsonPath(t){var r;return(r=this.provenance(t))==null?void 0:r.jsonPath}getEnumValueName(t,r){let i=T.IR.ExampleEnumType(r)?r.value.name:r.name,n=t.values.find(u=>this.nameEquals(u.name.name,i));return n?this.getPropertyNameFor(n):Bn(`Unexpected - can't find enum value ${i} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(T.Provenance(t))return t.name;if("name"in t){if(T.IR.NameAndWireValue(t.name))return t.name.name.pascalCase.safeName;if(T.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(T.Provenance(t))return t.name;if("name"in t){if(T.IR.TypeDeclaration(t)||T.IR.NameAndWireValue(t.name))return t.name.name.pascalCase.safeName;if(T.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return t.camelCase.safeName===r.camelCase.safeName}dereferenceType(t){let r=T.string(t)?t:T.IR.NamedType(t)||T.IR.DeclaredTypeName(t)?t.typeId:T.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(T.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};Bn(`dereferenceType: typeId ${r} not resolved.`)}};var Ds=class{constructor(t,r,i,n,u={makeRelativeFilePath:l=>l,makeAbsoluteFilePath:l=>l,getNamespaceForTypeId:l=>"",getDirectoryForTypeId:l=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:l=>[]}){a(this,"intermediateRepresentation");a(this,"apiName");a(this,"customConfig");a(this,"generatorConfig");a(this,"support");a(this,"ir");a(this,"dir");a(this,"csharp",new An(this));a(this,"registry",new Xi(this));a(this,"model");a(this,"extern",new Cn(this));a(this,"settings",N({namespace:()=>{var t;return(t=this.customConfig.namespace)!=null?t:vn(Tn(`${this.generatorConfig.organization}_${this.apiName}`))},readOnlyMemoryTypes:()=>{var t;return(t=this.customConfig["read-only-memory-types"])!=null?t:[]},simplifyObjectDictionaries:()=>{var t;return(t=this.customConfig["simplify-object-dictionaries"])!=null?t:!1},useFullyQualifiedNamespaces:()=>{var t;return(t=this.customConfig["experimental-fully-qualified-namespaces"])!=null?t:!1},useDotnetFormat:()=>{var t;return(t=this.customConfig["experimental-dotnet-format"])!=null?t:!1},enableWebsockets:()=>{var t;return(t=this.customConfig["experimental-enable-websockets"])!=null?t:!1},enableReadonlyConstants:()=>{var t;return(t=this.customConfig["experimental-readonly-constants"])!=null?t:!1},temporaryWebsocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},baseApiExceptionClassName:()=>{var t;return(t=this.customConfig["base-api-exception-class-name"])!=null?t:""},baseExceptionClassName:()=>{var t;return(t=this.customConfig["base-exception-class-name"])!=null?t:""},shouldGeneratedDiscriminatedUnions:()=>{var t;return(t=this.customConfig["use-discriminated-unions"])!=null?t:!0},exportedClientClassName:()=>{var t;return(t=this.customConfig["exported-client-class-name"])!=null?t:""},clientClassName:()=>{var t;return(t=this.customConfig["client-class-name"])!=null?t:""},rootNamespaceForCoreClasses:()=>{var t;return(t=this.customConfig["root-namespace-for-core-classes"])!=null?t:!0},packageId:()=>{var t;return(t=this.customConfig["package-id"])!=null?t:""},isForwardCompatibleEnumsEnabled:()=>{var t,r;return(r=(t=this.customConfig["enable-forward-compatible-enums"])!=null?t:this.customConfig["experimental-enable-forward-compatible-enums"])!=null?r:!0},websocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},generateNewAdditionalProperties:()=>{var t,r;return(r=(t=this.customConfig["additional-properties"])!=null?t:this.customConfig["experimental-additional-properties"])!=null?r:!0},customPagerName:()=>{var t;return(t=this.customConfig["custom-pager-name"])!=null?t:""},environmentClassName:()=>{var t;return(t=this.customConfig["environment-class-name"])!=null?t:""},generateErrorTypes:()=>{var t;return(t=this.customConfig["generate-error-types"])!=null?t:!0},shouldInlinePathParameters:()=>{var t;return(t=this.customConfig["inline-path-parameters"])!=null?t:!0},includeExceptionHandler:()=>{var t;return(t=this.customConfig["include-exception-handler"])!=null?t:!1},shouldGenerateMockServerTests:()=>{var t;return(t=this.customConfig["generate-mock-server-tests"])!=null?t:!0},rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?Y.Internal:Y.Public,extraDependencies:()=>{var t;return(t=this.customConfig["extra-dependencies"])!=null?t:{}},pascalCaseEnvironments:()=>{var t;return(t=this.customConfig["pascal-case-environments"])!=null?t:!0},explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0}));a(this,"constants",{folders:N({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(In(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(In(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(In(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(In(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:N({indent:()=>" "}),defaults:N({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});a(this,"namespaces",N({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,asyncCore:()=>`${this.namespaces.core}.Async`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));a(this,"names",{classes:N({baseApiException:()=>this.settings.baseApiExceptionClassName||`${this.names.project.clientPrefix}ApiException`,baseException:()=>this.settings.baseExceptionClassName||`${this.names.project.clientPrefix}Exception`,rootClient:()=>this.settings.clientClassName||`${this.names.project.clientPrefix}Client`,rootClientForSnippets:()=>this.settings.exportedClientClassName||this.names.classes.rootClient,customPager:()=>this.settings.customPagerName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}Pager`,environment:()=>this.settings.environmentClassName||`${this.names.project.clientPrefix}Environment`}),project:N({client:()=>vn(Tn(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||this.namespaces.root}),files:N({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:N({mockOauth:()=>"MockOAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync"}),variables:N({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:N({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});a(this,"Types",N({Arbitrary:t=>new D.AribitraryType(t,this),HttpMethodExtensions:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HttpMethodExtensions")}),FormRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("FormRequest")}),ClientOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("ClientOptions"),namespace:this.namespaces.publicCoreClasses}),RawClient:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("RawClient")}),RequestOptions:()=>this.csharp.classReference({namespace:this.namespaces.publicCoreClasses,origin:this.model.staticExplicit("RequestOptions")}),RequestOptionsInterface:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("IRequestOptions")}),JsonRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("JsonRequest")}),Version:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("Version")}),ValueConvert:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("ValueConvert")}),FileParameter:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("FileParameter"),multipartMethodName:"AddFileParameterPart",multipartMethodNameForCollection:"AddFileParameterParts",isReferenceType:!0}),Headers:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Headers")}),HeaderValue:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HeaderValue")}),RootClient:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClient),namespace:this.namespaces.root}),RootClientForSnippets:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClientForSnippets),namespace:this.namespaces.root}),BaseApiException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseApiException),namespace:this.namespaces.publicCoreClasses}),BaseException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseException),namespace:this.namespaces.publicCoreClasses}),ExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit("IExceptionInterceptor"),namespace:this.namespaces.core}),ExceptionHandler:()=>this.csharp.classReference({origin:this.model.staticExplicit("ExceptionHandler"),namespace:this.namespaces.core}),ProtoAnyMapper:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoAnyMapper"),namespace:this.namespaces.core}),Constants:()=>this.csharp.classReference({origin:this.model.staticExplicit("Constants"),namespace:this.namespaces.core}),EnumSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("EnumSerializer"),namespace:this.namespaces.core}),DateTimeSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("DateTimeSerializer"),namespace:this.namespaces.core}),JsonUtils:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonUtils"),namespace:this.namespaces.core}),CustomPagerFactory:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Factory`),namespace:this.namespaces.core}),CustomPagerContext:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Context`),namespace:this.namespaces.core}),Environments:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.environment),namespace:this.namespaces.publicCoreClasses}),TestClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("TestClient"),namespace:this.namespaces.test}),BaseMockServerTest:()=>this.csharp.classReference({origin:this.model.staticExplicit("BaseMockServerTest"),namespace:this.namespaces.mockServerTest}),IdempotentRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("IdempotentRequestOptions"),namespace:this.namespaces.publicCoreClasses}),IdempotentRequestOptionsInterface:()=>this.csharp.classReference({origin:this.model.staticExplicit("IIdempotentRequestOptions"),namespace:this.namespaces.core}),IStringEnum:()=>this.csharp.classReference({origin:this.model.staticExplicit("IStringEnum"),namespace:this.namespaces.core}),AsyncApiOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApiOptions"),namespace:`${this.namespaces.asyncCore}.Models`}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.asyncCore}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),namespace:this.namespaces.core}),ProtoConverter:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoConverter"),namespace:this.namespaces.core}),RawGrpcClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("RawGrpcClient"),namespace:this.namespaces.core}),Extensions:()=>this.csharp.classReference({origin:this.model.staticExplicit("Extensions"),namespace:this.namespaces.core}),GrpcRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcRequestOptions"),namespace:this.namespaces.root}),GrpcChannelOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcChannelOptions"),namespace:"Grpc.Net.Client"}),StringEnum:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnum"),namespace:this.namespaces.core,generics:t?[t]:void 0}),AsyncApi:t=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApi"),namespace:this.namespaces.asyncCore,generics:[t]}),AsyncEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:`${this.namespaces.asyncCore}.Events`,generics:[t]}),StringEnumSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnumSerializer"),namespace:this.namespaces.core,generics:[t]}),CustomPagerClass:t=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.customPager),namespace:this.namespaces.core,generics:[t]}),Pager:t=>this.csharp.classReference({origin:this.model.staticExplicit("Pager"),namespace:this.namespaces.core,generics:[t]}),OffsetPager:({requestType:t,requestOptionsType:r,responseType:i,offsetType:n,stepType:u,itemType:l})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,n,u,l]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:n,itemType:u})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,n,u]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));a(this,"Primitive",N({string:()=>new D.String(this),boolean:()=>new D.Boolean(this),integer:()=>new D.Integer(this),long:()=>new D.Long(this),uint:()=>new D.Uint(this),ulong:()=>new D.ULong(this),float:()=>new D.Float(this),double:()=>new D.Double(this),object:()=>new D.Object(this)}));a(this,"Value",N({binary:()=>new Te.Binary(this),dateOnly:()=>new Te.DateOnly(this),dateTime:()=>new Te.DateTime(this),uuid:()=>new Te.Uuid(this),stringEnum:t=>new Te.StringEnum(t,this)}));a(this,"Collection",N({array:t=>new ae.Array(t,this),listType:t=>new ae.ListType(t,this),list:t=>new ae.List(t,this),set:t=>new ae.Set(t,this),map:(t,r,i)=>new ae.Map(t,r,this,i),idictionary:(t,r,i)=>new ae.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new ae.KeyValuePair(t,r,this)}));a(this,"format",N({private:t=>`_${dn.camelCase(t)}`}));a(this,"initializers",N({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=i,this.generatorConfig=n,this.support=u,this.model=new Dn(t,this),this.ir=T.IR.IntermediateRepresentation(t)?t:{},this.dir=T.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}};export{yr as a,Yi as b,nT as c,sT as d,a as e,Ln as f,oP as g,T as h,Nn as i,Ds as j,Bs as k};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
${en()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){var l;let i=this.model.getPropertyNameFor(r),n=(l=this.model.origin(r))!=null?l:iT(`Origin not found for property: ${JSON.stringify(r).substring(0,100)}`),u=t.getFieldName(n,i);return u||i}class_(t){let r=t;return"reference"in t&&(r=yr(yr({},t.reference),t)),new ur(r,this.generation)}testClass(t){return new zi(t,this.generation)}annotation(t){return new hr(t,this.generation)}instantiateClass(t){return new Ei(t,this.generation)}invokeMethod(t){return new Ci(t,this.generation)}codeblock(t){return new Sr(t,this.generation)}code(){return new Mr({},this.generation)}anonymousFunction(t){return new Li(t)}parameter(t){return new xe(t,this.generation)}interface_(t){return new Ji(t,this.generation)}enum_(t){return new Ki(t,this.generation)}dictionary(t){return new qi(t,this.generation)}list(t){return new Ai(t,this.generation)}readOnlyMemory(t){return new Bi(t,this.generation)}set(t){return new Di(t,this.generation)}switch_(t){return new Vi(t,this.generation)}ternary(t){return new Wi(t,this.generation)}and(t){return new xi(t,this.generation)}or(t){return new Ui(t,this.generation)}enumInstantiation(t){return new Ri(t,this.generation)}string_(t){return new Ii(t,this.generation)}xmlDocBlock(t){return new vr(t,this.generation)}xmlDocBlockOf(t){return t instanceof vr?t:new vr(t,this.generation)}validateReadOnlyMemoryTypes(){for(let t of this.generation.settings.readOnlyMemoryTypes)if(!this.VALID_READ_ONLY_MEMORY_TYPES.has(t))throw new Error(`Type "${t}" is not a valid 'read-only-memory-types' custom config option; expected one of ${JSON.stringify(this.VALID_READ_ONLY_MEMORY_TYPES)}.`)}};function N(e){let t={},r={};for(let[i,n]of Object.entries(e))n.length===0?Object.defineProperty(r,i,{get(){return i in t||(t[i]=n()),t[i]},enumerable:!0,configurable:!0}):r[i]=n;return r}var Bs=class{constructor(t){a(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};var Cn=class{constructor(t){a(this,"generation");a(this,"System",N({Action:t=>this.csharp.classReference({name:"Action",namespace:"System",generics:t||void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),Func:(t,r)=>this.csharp.classReference({name:"Func",namespace:"System",generics:t?r?[...t,r]:t:r?[r]:void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),DateOnly:()=>this.csharp.classReference({name:"DateOnly",namespace:"System"}),DateTime:()=>this.csharp.classReference({name:"DateTime",namespace:"System"}),Enum:()=>this.csharp.classReference({name:"Enum",namespace:"System"}),Exception:()=>this.csharp.classReference({name:"Exception",namespace:"System"}),ReadOnlyMemory:t=>this.csharp.classReference({name:"ReadOnlyMemory",namespace:"System",generics:[t]}),Serializable:()=>this.csharp.classReference({name:"Serializable",namespace:"System"}),String:()=>this.csharp.classReference({name:"String",namespace:"System"}),Type:()=>this.csharp.classReference({name:"Type",namespace:"System",isReferenceType:!0,multipartMethodName:null,multipartMethodNameForCollection:null,fullyQualified:!0}),TimeSpan:()=>this.csharp.classReference({name:"TimeSpan",namespace:"System"}),Uri:()=>this.csharp.classReference({name:"Uri",namespace:"System"}),UriBuilder:()=>this.csharp.classReference({name:"UriBuilder",namespace:"System"}),Runtime:()=>N({Serialization:()=>N({EnumMember:()=>this.csharp.classReference({name:"EnumMember",namespace:"System.Runtime.Serialization"})})}),Collections:()=>N({Generic:()=>N({IAsyncEnumerable:t=>this.csharp.classReference({name:"IAsyncEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),IEnumerable:t=>this.csharp.classReference({name:"IEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),KeyValuePair:(t,r)=>this.csharp.classReference({name:"KeyValuePair",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0}),List:t=>this.csharp.classReference({name:"List",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),HashSet:t=>this.csharp.classReference({name:"HashSet",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),Dictionary:(t,r)=>this.csharp.classReference({name:"Dictionary",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0,isCollection:!0}),IDictionary:(t,r)=>this.csharp.classReference({name:"IDictionary",namespace:"System.Collections.Generic",generics:[t,r]})}),Linq:()=>N({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>N({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>N({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>N({Http:()=>N({HttpClient:()=>this.csharp.classReference({name:"HttpClient",namespace:"System.Net.Http"}),HttpMethod:()=>this.csharp.classReference({name:"HttpMethod",namespace:"System.Net.Http"}),HttpResponseHeaders:()=>this.csharp.classReference({name:"HttpResponseHeaders",namespace:"System.Net.Http.Headers"})}),ServerSentEvents:()=>N({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>N({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>N({MemoryStream:()=>this.csharp.classReference({name:"MemoryStream",namespace:"System.IO"}),Stream:()=>this.csharp.classReference({name:"Stream",namespace:"System.IO"}),StreamReader:()=>this.csharp.classReference({name:"StreamReader",namespace:"System.IO"})}),Text:()=>N({Encoding:()=>this.csharp.classReference({name:"Encoding",namespace:"System.Text"}),Encoding_UTF8:()=>this.csharp.classReference({name:"UTF8",enclosingType:this.csharp.classReference({name:"Encoding",namespace:"System.Text"})}),Json:()=>N({JsonElement:()=>this.csharp.classReference({name:"JsonElement",namespace:"System.Text.Json"}),JsonDocument:()=>this.csharp.classReference({name:"JsonDocument",namespace:"System.Text.Json"}),JsonException:()=>this.csharp.classReference({name:"JsonException",namespace:"System.Text.Json"}),Utf8JsonReader:()=>this.csharp.classReference({name:"Utf8JsonReader",namespace:"System.Text.Json"}),JsonSerializerOptions:()=>this.csharp.classReference({name:"JsonSerializerOptions",namespace:"System.Text.Json"}),JsonSerializer:()=>this.csharp.classReference({name:"JsonSerializer",namespace:"System.Text.Json"}),Utf8JsonWriter:()=>this.csharp.classReference({name:"Utf8JsonWriter",namespace:"System.Text.Json"}),Nodes:()=>N({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>N({IJsonOnDeserialized:()=>this.csharp.classReference({name:"IJsonOnDeserialized",namespace:"System.Text.Json.Serialization"}),IJsonOnSerializing:()=>this.csharp.classReference({name:"IJsonOnSerializing",namespace:"System.Text.Json.Serialization"}),JsonOnDeserializedAttribute:()=>this.csharp.classReference({name:"JsonOnDeserializedAttribute",namespace:"System.Text.Json.Serialization"}),JsonExtensionData:()=>this.csharp.classReference({name:"JsonExtensionData",namespace:"System.Text.Json.Serialization"}),JsonConverter:t=>this.csharp.classReference({name:"JsonConverter",namespace:"System.Text.Json.Serialization",generics:t?[t]:void 0}),JsonIgnore:()=>this.csharp.classReference({name:"JsonIgnore",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyName",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>N({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>N({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})})}));a(this,"NUnit",N({Framework:()=>N({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"})})}));a(this,"OneOf",N({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));a(this,"Google",N({Protobuf:()=>N({WellKnownTypes:()=>N({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));a(this,"WireMock",N({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));a(this,"Grpc",N({Core:()=>N({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};import{fail as Bn}from"assert";function YO(e){return e.split(".").filter(t=>!["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"].includes(t)).join(".")}var Dn=class{constructor(t,r){a(this,"generation");a(this,"indexByObject",new Map);a(this,"indexByPath",new Map);a(this,"explicitByObject",new Map);a(this,"explicitByPath",new Map);a(this,"root");a(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let n=YO(i!=null&&i.jsonPath?`${i.jsonPath}.${r}`:r);if(this.indexByPath.has(n)){i||Bn(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);for(let[l,f]of Object.entries(t))typeof f=="object"&&f!==null&&this.createIndex(f,l,i);return i}let u={jsonPath:n,name:r,node:t,parent:i};this.indexByObject.set(t,u),this.indexByPath.set(n,u);for(let[l,f]of Object.entries(t))typeof f=="object"&&f!==null&&this.createIndex(f,l,u);return u}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){var l;let i=(l=this.provenance(t))!=null?l:Bn(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),n=Yi(yr({},i),{jsonPath:YO(`${i.jsonPath}+${r}`),name:r,node:i.node,parent:i,explicit:!0}),u=this.explicitByObject.get(i.node);return u?u.add(n):this.explicitByObject.set(i.node,new Set([n])),this.explicitByPath.set(n.jsonPath,n),n}provenance(t){var r,i;if(t!==void 0)return T.string(t)?(r=this.explicitByPath.get(t))!=null?r:this.indexByPath.get(t):T.Provenance(t)?(i=this.explicitByPath.get(t.jsonPath))!=null?i:this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r!=null&&r.explicit?r:r==null?void 0:r.node}irNode(t){var r;return(r=this.provenance(t))==null?void 0:r.node}jsonPath(t){var r;return(r=this.provenance(t))==null?void 0:r.jsonPath}getEnumValueName(t,r){let i=T.IR.ExampleEnumType(r)?r.value.name:r.name,n=t.values.find(u=>this.nameEquals(u.name.name,i));return n?this.getPropertyNameFor(n):Bn(`Unexpected - can't find enum value ${i} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(T.Provenance(t))return t.name;if("name"in t){if(T.IR.NameAndWireValue(t.name))return t.name.name.pascalCase.safeName;if(T.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(T.Provenance(t))return t.name;if("name"in t){if(T.IR.TypeDeclaration(t)||T.IR.NameAndWireValue(t.name))return t.name.name.pascalCase.safeName;if(T.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return t.camelCase.safeName===r.camelCase.safeName}dereferenceType(t){let r=T.string(t)?t:T.IR.NamedType(t)||T.IR.DeclaredTypeName(t)?t.typeId:T.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(T.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};Bn(`dereferenceType: typeId ${r} not resolved.`)}};var Ds=class{constructor(t,r,i,n,u={makeRelativeFilePath:l=>l,makeAbsoluteFilePath:l=>l,getNamespaceForTypeId:l=>"",getDirectoryForTypeId:l=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:l=>[]}){a(this,"intermediateRepresentation");a(this,"apiName");a(this,"customConfig");a(this,"generatorConfig");a(this,"support");a(this,"ir");a(this,"dir");a(this,"csharp",new An(this));a(this,"registry",new Xi(this));a(this,"model");a(this,"extern",new Cn(this));a(this,"settings",N({namespace:()=>{var t;return(t=this.customConfig.namespace)!=null?t:vn(Tn(`${this.generatorConfig.organization}_${this.apiName}`))},readOnlyMemoryTypes:()=>{var t;return(t=this.customConfig["read-only-memory-types"])!=null?t:[]},simplifyObjectDictionaries:()=>{var t;return(t=this.customConfig["simplify-object-dictionaries"])!=null?t:!1},useFullyQualifiedNamespaces:()=>{var t;return(t=this.customConfig["experimental-fully-qualified-namespaces"])!=null?t:!1},useDotnetFormat:()=>{var t;return(t=this.customConfig["experimental-dotnet-format"])!=null?t:!1},enableWebsockets:()=>{var t;return(t=this.customConfig["experimental-enable-websockets"])!=null?t:!1},enableReadonlyConstants:()=>{var t;return(t=this.customConfig["experimental-readonly-constants"])!=null?t:!1},temporaryWebsocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},baseApiExceptionClassName:()=>{var t;return(t=this.customConfig["base-api-exception-class-name"])!=null?t:""},baseExceptionClassName:()=>{var t;return(t=this.customConfig["base-exception-class-name"])!=null?t:""},shouldGeneratedDiscriminatedUnions:()=>{var t;return(t=this.customConfig["use-discriminated-unions"])!=null?t:!0},exportedClientClassName:()=>{var t;return(t=this.customConfig["exported-client-class-name"])!=null?t:""},clientClassName:()=>{var t;return(t=this.customConfig["client-class-name"])!=null?t:""},rootNamespaceForCoreClasses:()=>{var t;return(t=this.customConfig["root-namespace-for-core-classes"])!=null?t:!0},packageId:()=>{var t;return(t=this.customConfig["package-id"])!=null?t:""},isForwardCompatibleEnumsEnabled:()=>{var t,r;return(r=(t=this.customConfig["enable-forward-compatible-enums"])!=null?t:this.customConfig["experimental-enable-forward-compatible-enums"])!=null?r:!0},websocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},generateNewAdditionalProperties:()=>{var t,r;return(r=(t=this.customConfig["additional-properties"])!=null?t:this.customConfig["experimental-additional-properties"])!=null?r:!0},customPagerName:()=>{var t;return(t=this.customConfig["custom-pager-name"])!=null?t:""},environmentClassName:()=>{var t;return(t=this.customConfig["environment-class-name"])!=null?t:""},generateErrorTypes:()=>{var t;return(t=this.customConfig["generate-error-types"])!=null?t:!0},shouldInlinePathParameters:()=>{var t;return(t=this.customConfig["inline-path-parameters"])!=null?t:!0},includeExceptionHandler:()=>{var t;return(t=this.customConfig["include-exception-handler"])!=null?t:!1},shouldGenerateMockServerTests:()=>{var t,r;return(r=(t=this.customConfig["generate-mock-server-tests"])!=null?t:this.customConfig["enable-wire-tests"])!=null?r:!0},rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?Y.Internal:Y.Public,extraDependencies:()=>{var t;return(t=this.customConfig["extra-dependencies"])!=null?t:{}},pascalCaseEnvironments:()=>{var t;return(t=this.customConfig["pascal-case-environments"])!=null?t:!0},explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,outputPath:()=>{var r,i,n,u;let t=this.customConfig["output-path"];return t==null?{library:"src",test:"src",solution:".",other:"."}:typeof t=="string"?{library:t,test:t,solution:".",other:"."}:{library:(r=t.library)!=null?r:"src",test:(i=t.test)!=null?i:"src",solution:(n=t.solution)!=null?n:".",other:(u=t.other)!=null?u:"."}}}));a(this,"constants",{folders:N({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(In(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(In(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(In(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(In(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:N({indent:()=>" "}),defaults:N({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});a(this,"namespaces",N({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,asyncCore:()=>`${this.namespaces.core}.Async`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));a(this,"names",{classes:N({baseApiException:()=>this.settings.baseApiExceptionClassName||`${this.names.project.clientPrefix}ApiException`,baseException:()=>this.settings.baseExceptionClassName||`${this.names.project.clientPrefix}Exception`,rootClient:()=>this.settings.clientClassName||`${this.names.project.clientPrefix}Client`,rootClientForSnippets:()=>this.settings.exportedClientClassName||this.names.classes.rootClient,customPager:()=>this.settings.customPagerName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}Pager`,environment:()=>this.settings.environmentClassName||`${this.names.project.clientPrefix}Environment`}),project:N({client:()=>vn(Tn(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||this.namespaces.root}),files:N({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:N({mockOauth:()=>"MockOAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync"}),variables:N({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:N({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});a(this,"Types",N({Arbitrary:t=>new D.AribitraryType(t,this),HttpMethodExtensions:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HttpMethodExtensions")}),FormRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("FormRequest")}),ClientOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("ClientOptions"),namespace:this.namespaces.publicCoreClasses}),RawClient:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("RawClient")}),RequestOptions:()=>this.csharp.classReference({namespace:this.namespaces.publicCoreClasses,origin:this.model.staticExplicit("RequestOptions")}),RequestOptionsInterface:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("IRequestOptions")}),JsonRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("JsonRequest")}),Version:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("Version")}),ValueConvert:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("ValueConvert")}),FileParameter:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("FileParameter"),multipartMethodName:"AddFileParameterPart",multipartMethodNameForCollection:"AddFileParameterParts",isReferenceType:!0}),Headers:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Headers")}),HeaderValue:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HeaderValue")}),RootClient:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClient),namespace:this.namespaces.root}),RootClientForSnippets:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClientForSnippets),namespace:this.namespaces.root}),BaseApiException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseApiException),namespace:this.namespaces.publicCoreClasses}),BaseException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseException),namespace:this.namespaces.publicCoreClasses}),ExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit("IExceptionInterceptor"),namespace:this.namespaces.core}),ExceptionHandler:()=>this.csharp.classReference({origin:this.model.staticExplicit("ExceptionHandler"),namespace:this.namespaces.core}),ProtoAnyMapper:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoAnyMapper"),namespace:this.namespaces.core}),Constants:()=>this.csharp.classReference({origin:this.model.staticExplicit("Constants"),namespace:this.namespaces.core}),EnumSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("EnumSerializer"),namespace:this.namespaces.core}),DateTimeSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("DateTimeSerializer"),namespace:this.namespaces.core}),JsonUtils:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonUtils"),namespace:this.namespaces.core}),CustomPagerFactory:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Factory`),namespace:this.namespaces.core}),CustomPagerContext:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Context`),namespace:this.namespaces.core}),Environments:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.environment),namespace:this.namespaces.publicCoreClasses}),TestClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("TestClient"),namespace:this.namespaces.test}),BaseMockServerTest:()=>this.csharp.classReference({origin:this.model.staticExplicit("BaseMockServerTest"),namespace:this.namespaces.mockServerTest}),IdempotentRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("IdempotentRequestOptions"),namespace:this.namespaces.publicCoreClasses}),IdempotentRequestOptionsInterface:()=>this.csharp.classReference({origin:this.model.staticExplicit("IIdempotentRequestOptions"),namespace:this.namespaces.core}),IStringEnum:()=>this.csharp.classReference({origin:this.model.staticExplicit("IStringEnum"),namespace:this.namespaces.core}),AsyncApiOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApiOptions"),namespace:`${this.namespaces.asyncCore}.Models`}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.asyncCore}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),namespace:this.namespaces.core}),ProtoConverter:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoConverter"),namespace:this.namespaces.core}),RawGrpcClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("RawGrpcClient"),namespace:this.namespaces.core}),Extensions:()=>this.csharp.classReference({origin:this.model.staticExplicit("Extensions"),namespace:this.namespaces.core}),GrpcRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcRequestOptions"),namespace:this.namespaces.root}),GrpcChannelOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcChannelOptions"),namespace:"Grpc.Net.Client"}),StringEnum:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnum"),namespace:this.namespaces.core,generics:t?[t]:void 0}),AsyncApi:t=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApi"),namespace:this.namespaces.asyncCore,generics:[t]}),AsyncEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:`${this.namespaces.asyncCore}.Events`,generics:[t]}),StringEnumSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnumSerializer"),namespace:this.namespaces.core,generics:[t]}),CustomPagerClass:t=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.customPager),namespace:this.namespaces.core,generics:[t]}),Pager:t=>this.csharp.classReference({origin:this.model.staticExplicit("Pager"),namespace:this.namespaces.core,generics:[t]}),OffsetPager:({requestType:t,requestOptionsType:r,responseType:i,offsetType:n,stepType:u,itemType:l})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,n,u,l]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:n,itemType:u})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,n,u]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));a(this,"Primitive",N({string:()=>new D.String(this),boolean:()=>new D.Boolean(this),integer:()=>new D.Integer(this),long:()=>new D.Long(this),uint:()=>new D.Uint(this),ulong:()=>new D.ULong(this),float:()=>new D.Float(this),double:()=>new D.Double(this),object:()=>new D.Object(this)}));a(this,"Value",N({binary:()=>new Te.Binary(this),dateOnly:()=>new Te.DateOnly(this),dateTime:()=>new Te.DateTime(this),uuid:()=>new Te.Uuid(this),stringEnum:t=>new Te.StringEnum(t,this)}));a(this,"Collection",N({array:t=>new ae.Array(t,this),listType:t=>new ae.ListType(t,this),list:t=>new ae.List(t,this),set:t=>new ae.Set(t,this),map:(t,r,i)=>new ae.Map(t,r,this,i),idictionary:(t,r,i)=>new ae.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new ae.KeyValuePair(t,r,this)}));a(this,"format",N({private:t=>`_${dn.camelCase(t)}`}));a(this,"initializers",N({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=i,this.generatorConfig=n,this.support=u,this.model=new Dn(t,this),this.ir=T.IR.IntermediateRepresentation(t)?t:{},this.dir=T.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}};export{yr as a,Yi as b,nT as c,sT as d,a as e,Ln as f,oP as g,T as h,Nn as i,Ds as j,Bs as k};
|
|
33
|
+
//# sourceMappingURL=chunk-RHB5YSP4.js.map
|