@fern-api/go-dynamic-snippets 0.0.14 → 0.0.16
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 +18 -10
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
- package/cjs/DynamicSnippetsGenerator.d.cts +7 -5
- package/cjs/{DynamicSnippetsGeneratorContext-lz2pTZw3.d.cts → DynamicSnippetsGeneratorContext-BusKoNq4.d.cts} +12 -2
- package/cjs/EndpointSnippetGenerator.cjs +19 -11
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
- package/cjs/EndpointSnippetGenerator.d.cts +15 -4
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -10
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
- package/cjs/context/DynamicTypeInstantiationMapper.cjs +19 -11
- package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -0
- package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
- package/cjs/context/DynamicTypeMapper.cjs +18 -10
- package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
- package/cjs/context/DynamicTypeMapper.d.cts +1 -1
- package/cjs/context/FilePropertyMapper.cjs +18 -10
- package/cjs/context/FilePropertyMapper.cjs.map +1 -0
- package/cjs/context/FilePropertyMapper.d.cts +1 -1
- package/cjs/index.cjs +24 -28
- package/cjs/index.cjs.map +1 -0
- package/cjs/index.d.cts +2 -1
- package/esm/DynamicSnippetsGenerator.d.ts +7 -5
- package/esm/DynamicSnippetsGenerator.js +2 -1
- package/esm/DynamicSnippetsGenerator.js.map +1 -0
- package/esm/{DynamicSnippetsGeneratorContext-lz2pTZw3.d.ts → DynamicSnippetsGeneratorContext-BusKoNq4.d.ts} +12 -2
- package/esm/EndpointSnippetGenerator.d.ts +15 -4
- package/esm/EndpointSnippetGenerator.js +2 -1
- package/esm/EndpointSnippetGenerator.js.map +1 -0
- package/esm/chunk-2YRGTA73.js +2 -0
- package/esm/chunk-2YRGTA73.js.map +1 -0
- package/esm/chunk-BI26DLZ5.js +2 -0
- package/esm/chunk-BI26DLZ5.js.map +1 -0
- package/esm/chunk-D6NMQKNQ.js +2 -0
- package/esm/chunk-D6NMQKNQ.js.map +1 -0
- package/esm/chunk-FD44EP2P.js +2 -0
- package/esm/chunk-FD44EP2P.js.map +1 -0
- package/esm/chunk-GUJUKQKZ.js +37 -0
- package/esm/chunk-GUJUKQKZ.js.map +1 -0
- package/esm/chunk-Q6YO7G6Y.js +2 -0
- package/esm/chunk-Q6YO7G6Y.js.map +1 -0
- package/esm/chunk-UZEM7EUP.js +2 -0
- package/esm/chunk-UZEM7EUP.js.map +1 -0
- package/esm/chunk-VCNL2JWU.js +2 -0
- package/esm/chunk-VCNL2JWU.js.map +1 -0
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
- package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
- package/esm/context/DynamicTypeInstantiationMapper.js +2 -1
- package/esm/context/DynamicTypeInstantiationMapper.js.map +1 -0
- package/esm/context/DynamicTypeMapper.d.ts +1 -1
- package/esm/context/DynamicTypeMapper.js +2 -1
- package/esm/context/DynamicTypeMapper.js.map +1 -0
- package/esm/context/FilePropertyMapper.d.ts +1 -1
- package/esm/context/FilePropertyMapper.js +2 -1
- package/esm/context/FilePropertyMapper.js.map +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -13
- package/esm/index.js.map +1 -0
- package/package.json +1 -1
- package/esm/chunk-5HP3T45N.js +0 -1
- package/esm/chunk-D3UUM672.js +0 -1
- package/esm/chunk-I3VUX77R.js +0 -1
- package/esm/chunk-J745U74Q.js +0 -1
- package/esm/chunk-SS6XZXHU.js +0 -1
- package/esm/chunk-TUE3DOHS.js +0 -29
- package/esm/chunk-X7QP3WH3.js +0 -1
- package/esm/chunk-YAGEU3HO.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as c,f as i,g as p,h as n,j as e}from"./chunk-GUJUKQKZ.js";i();p();var a=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return e.Type.slice(this.convert({typeReference:t.typeReference.value}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return e.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return r==null?this.convertUnknown():this.convertNamed({named:r})}case"optional":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"nullable":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return e.Type.slice(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:n(t.typeReference)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return e.Type.bool();case"string":return e.Type.string()}}convertNamed({named:t}){let r=e.Type.reference(e.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}));switch(t.type){case"alias":case"enum":return r;case"discriminatedUnion":case"object":case"undiscriminatedUnion":return e.Type.pointer(r);default:n(t)}}convertUnknown(){return e.Type.any()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return e.Type.int();case"UINT":return e.Type.int();case"LONG":return e.Type.int64();case"UINT_64":return e.Type.int64();case"FLOAT":return e.Type.float64();case"DOUBLE":return e.Type.float64();case"BOOLEAN":return e.Type.bool();case"STRING":return e.Type.string();case"DATE":return e.Type.date();case"DATE_TIME":return e.Type.dateTime();case"UUID":return e.Type.uuid();case"BASE_64":return e.Type.bytes();case"BIG_INTEGER":return e.Type.string();default:n(t)}}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-Q6YO7G6Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/DynamicTypeMapper.ts"],"sourcesContent":["import { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { go } from \"@fern-api/go-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport declare namespace DynamicTypeMapper {\n interface Args {\n typeReference: FernIr.dynamic.TypeReference;\n }\n}\n\nexport class DynamicTypeMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public convert(args: DynamicTypeMapper.Args): go.Type {\n switch (args.typeReference.type) {\n case \"list\":\n return go.Type.slice(this.convert({ typeReference: args.typeReference.value }));\n case \"literal\":\n return this.convertLiteral({ literal: args.typeReference.value });\n case \"map\":\n return go.Type.map(\n this.convert({ typeReference: args.typeReference.key }),\n this.convert({ typeReference: args.typeReference.value })\n );\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named == null) {\n return this.convertUnknown();\n }\n return this.convertNamed({ named });\n }\n case \"optional\":\n return go.Type.optional(this.convert({ typeReference: args.typeReference.value }));\n case \"nullable\":\n return go.Type.optional(this.convert({ typeReference: args.typeReference.value }));\n case \"primitive\":\n return this.convertPrimitive({ primitive: args.typeReference.value });\n case \"set\":\n return go.Type.slice(this.convert({ typeReference: args.typeReference }));\n case \"unknown\":\n return this.convertUnknown();\n default:\n assertNever(args.typeReference);\n }\n }\n\n private convertLiteral({ literal }: { literal: FernIr.dynamic.LiteralType }): go.Type {\n switch (literal.type) {\n case \"boolean\":\n return go.Type.bool();\n case \"string\":\n return go.Type.string();\n }\n }\n\n private convertNamed({ named }: { named: FernIr.dynamic.NamedType }): go.Type {\n const goTypeReference = go.Type.reference(\n go.typeReference({\n name: this.context.getTypeName(named.declaration.name),\n importPath: this.context.getImportPath(named.declaration.fernFilepath)\n })\n );\n switch (named.type) {\n case \"alias\":\n case \"enum\":\n return goTypeReference;\n case \"discriminatedUnion\":\n case \"object\":\n case \"undiscriminatedUnion\":\n return go.Type.pointer(goTypeReference);\n default:\n assertNever(named);\n }\n }\n\n private convertUnknown(): go.Type {\n return go.Type.any();\n }\n\n private convertPrimitive({ primitive }: { primitive: FernIr.dynamic.PrimitiveTypeV1 }): go.Type {\n switch (primitive) {\n case \"INTEGER\":\n return go.Type.int();\n case \"UINT\":\n return go.Type.int();\n case \"LONG\":\n return go.Type.int64();\n case \"UINT_64\":\n return go.Type.int64();\n case \"FLOAT\":\n return go.Type.float64();\n case \"DOUBLE\":\n return go.Type.float64();\n case \"BOOLEAN\":\n return go.Type.bool();\n case \"STRING\":\n return go.Type.string();\n case \"DATE\":\n return go.Type.date();\n case \"DATE_TIME\":\n return go.Type.dateTime();\n case \"UUID\":\n return go.Type.uuid();\n case \"BASE_64\":\n return go.Type.bytes();\n case \"BIG_INTEGER\":\n return go.Type.string();\n default:\n assertNever(primitive);\n }\n }\n}\n"],"mappings":"oEAAAA,IAAAC,IAYO,IAAMC,EAAN,KAAwB,CAG3B,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,QAAQE,EAAuC,CAClD,OAAQA,EAAK,cAAc,KAAM,CAC7B,IAAK,OACD,OAAOC,EAAG,KAAK,MAAM,KAAK,QAAQ,CAAE,cAAeD,EAAK,cAAc,KAAM,CAAC,CAAC,EAClF,IAAK,UACD,OAAO,KAAK,eAAe,CAAE,QAASA,EAAK,cAAc,KAAM,CAAC,EACpE,IAAK,MACD,OAAOC,EAAG,KAAK,IACX,KAAK,QAAQ,CAAE,cAAeD,EAAK,cAAc,GAAI,CAAC,EACtD,KAAK,QAAQ,CAAE,cAAeA,EAAK,cAAc,KAAM,CAAC,CAC5D,EACJ,IAAK,QAAS,CACV,IAAME,EAAQ,KAAK,QAAQ,iBAAiB,CAAE,OAAQF,EAAK,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OL,EAAG,KAAK,IAAI,EACvB,IAAK,OACD,OAAOA,EAAG,KAAK,IAAI,EACvB,IAAK,OACD,OAAOA,EAAG,KAAK,MAAM,EACzB,IAAK,UACD,OAAOA,EAAG,KAAK,MAAM,EACzB,IAAK,QACD,OAAOA,EAAG,KAAK,QAAQ,EAC3B,IAAK,SACD,OAAOA,EAAG,KAAK,QAAQ,EAC3B,IAAK,UACD,OAAOA,EAAG,KAAK,KAAK,EACxB,IAAK,SACD,OAAOA,EAAG,KAAK,OAAO,EAC1B,IAAK,OACD,OAAOA,EAAG,KAAK,KAAK,EACxB,IAAK,YACD,OAAOA,EAAG,KAAK,SAAS,EAC5B,IAAK,OACD,OAAOA,EAAG,KAAK,KAAK,EACxB,IAAK,UACD,OAAOA,EAAG,KAAK,MAAM,EACzB,IAAK,cACD,OAAOA,EAAG,KAAK,OAAO,EAC1B,QACIE,EAAYG,CAAS,CAC7B,CACJ,CACJ","names":["init_process","init_buffer","DynamicTypeMapper","context","__publicField","args","go_exports","named","assertNever","literal","goTypeReference","primitive"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u}from"./chunk-FD44EP2P.js";import{c as p}from"./chunk-VCNL2JWU.js";import{a as l}from"./chunk-Q6YO7G6Y.js";import{a as g}from"./chunk-2YRGTA73.js";import{e as r,f as a,g as s,h as c,j as n,k as m}from"./chunk-GUJUKQKZ.js";a();s();var h=class f extends p{constructor({ir:e,config:t}){super({ir:e,config:t});r(this,"ir");r(this,"customConfig");r(this,"dynamicTypeMapper");r(this,"dynamicTypeInstantiationMapper");r(this,"filePropertyMapper");r(this,"rootImportPath");this.ir=e,this.customConfig=t.customConfig!=null?t.customConfig:void 0,this.dynamicTypeMapper=new l({context:this}),this.dynamicTypeInstantiationMapper=new u({context:this}),this.filePropertyMapper=new g({context:this}),this.rootImportPath=m({config:t,customConfig:this.customConfig})}clone(){return new f({ir:this.ir,config:this.config})}isOptional(e){switch(e.type){case"optional":case"map":return!0;case"nullable":case"list":case"set":return this.isOptional(e.value);case"named":case"literal":case"primitive":case"unknown":return!1;default:c(e)}}getMethodName(e){return e.pascalCase.unsafeName}getTestMethodName(e){return e.declaration.fernFilepath.allParts.map(t=>t.pascalCase.unsafeName).join("")+e.declaration.name.pascalCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getImportPath(e){let t=e.packagePath.map(i=>i.pascalCase.unsafeName.toLowerCase());return[this.rootImportPath,...t].join("/")}getImportPathForRequest(e){var t;return(t=this.customConfig)!=null&&t.exportAllRequestsAtRoot?this.rootImportPath:this.getImportPath(e)}getContextTypeReference(){return n.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return n.invokeFunc({func:n.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return n.typeReference({name:"Reader",importPath:"io"})}getTestingTypeReference(){return n.typeReference({name:"T",importPath:"testing"})}getNewStringsReaderFunctionInvocation(e){return n.invokeFunc({func:n.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[n.TypeInstantiation.string(e)]})}getClientConstructorName(){var e,t;return((e=this.customConfig)==null?void 0:e.clientConstructorName)!=null?this.customConfig.clientConstructorName:((t=this.customConfig)==null?void 0:t.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:`New${this.getClientName()}`}getClientName(){var e;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:"Client"}getClientImportPath(){return`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:e}){return n.typeReference({name:e.name.pascalCase.unsafeName,importPath:this.getImportPath(e.fernFilepath)})}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentTypeReference(t)}getEnvironmentTypeReference(e){return n.typeReference({name:`Environments.${this.getTypeName(e)}`,importPath:this.rootImportPath})}static chainMethods(e,...t){if(t.length===0)throw new Error("Must have methods to chain");let i=e;for(let o of t)i=n.invokeMethod({on:i,method:o.method,arguments_:o.arguments_,multiline:o.multiline});return i}};export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-UZEM7EUP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/DynamicSnippetsGeneratorContext.ts"],"sourcesContent":["import {\n AbstractDynamicSnippetsGeneratorContext,\n FernGeneratorExec\n} from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { BaseGoCustomConfigSchema, go, resolveRootImportPath } from \"@fern-api/go-ast\";\n\nimport { DynamicTypeInstantiationMapper } from \"./DynamicTypeInstantiationMapper\";\nimport { DynamicTypeMapper } from \"./DynamicTypeMapper\";\nimport { FilePropertyMapper } from \"./FilePropertyMapper\";\n\nexport class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {\n public ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n public customConfig: BaseGoCustomConfigSchema | undefined;\n public dynamicTypeMapper: DynamicTypeMapper;\n public dynamicTypeInstantiationMapper: DynamicTypeInstantiationMapper;\n public filePropertyMapper: FilePropertyMapper;\n public rootImportPath: string;\n\n constructor({\n ir,\n config\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n }) {\n super({ ir, config });\n this.ir = ir;\n this.customConfig = config.customConfig != null ? (config.customConfig as BaseGoCustomConfigSchema) : undefined;\n this.dynamicTypeMapper = new DynamicTypeMapper({ context: this });\n this.dynamicTypeInstantiationMapper = new DynamicTypeInstantiationMapper({ context: this });\n this.filePropertyMapper = new FilePropertyMapper({ context: this });\n this.rootImportPath = resolveRootImportPath({ config, customConfig: this.customConfig });\n }\n\n public clone(): DynamicSnippetsGeneratorContext {\n return new DynamicSnippetsGeneratorContext({\n ir: this.ir,\n config: this.config\n });\n }\n\n public isOptional(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"optional\":\n case \"map\":\n return true;\n case \"nullable\":\n case \"list\":\n case \"set\":\n return this.isOptional(typeReference.value);\n case \"named\":\n case \"literal\":\n case \"primitive\":\n case \"unknown\":\n return false;\n default:\n assertNever(typeReference);\n }\n }\n\n public getMethodName(name: FernIr.Name): string {\n return name.pascalCase.unsafeName;\n }\n\n public getTestMethodName(endpoint: FernIr.dynamic.Endpoint): string {\n return (\n endpoint.declaration.fernFilepath.allParts.map((name) => name.pascalCase.unsafeName).join(\"\") +\n endpoint.declaration.name.pascalCase.unsafeName\n );\n }\n\n public getTypeName(name: FernIr.Name): string {\n return name.pascalCase.unsafeName;\n }\n\n public getImportPath(fernFilepath: FernIr.dynamic.FernFilepath): string {\n const parts = fernFilepath.packagePath.map((path) => path.pascalCase.unsafeName.toLowerCase());\n return [this.rootImportPath, ...parts].join(\"/\");\n }\n\n public getImportPathForRequest(fernFilepath: FernIr.dynamic.FernFilepath): string {\n if (this.customConfig?.exportAllRequestsAtRoot) {\n return this.rootImportPath;\n }\n return this.getImportPath(fernFilepath);\n }\n\n public getContextTypeReference(): go.TypeReference {\n return go.typeReference({\n name: \"Context\",\n importPath: \"context\"\n });\n }\n\n public getContextTodoFunctionInvocation(): go.FuncInvocation {\n return go.invokeFunc({\n func: go.typeReference({\n name: \"TODO\",\n importPath: \"context\"\n }),\n arguments_: []\n });\n }\n\n public getIoReaderTypeReference(): go.TypeReference {\n return go.typeReference({\n name: \"Reader\",\n importPath: \"io\"\n });\n }\n\n public getTestingTypeReference(): go.TypeReference {\n return go.typeReference({\n name: \"T\",\n importPath: \"testing\"\n });\n }\n\n public getNewStringsReaderFunctionInvocation(s: string): go.FuncInvocation {\n return go.invokeFunc({\n func: go.typeReference({\n name: \"NewReader\",\n importPath: \"strings\"\n }),\n arguments_: [go.TypeInstantiation.string(s)]\n });\n }\n\n public getClientConstructorName(): string {\n if (this.customConfig?.clientConstructorName != null) {\n return this.customConfig.clientConstructorName;\n }\n if (this.customConfig?.exportedClientName != null) {\n return `New${this.customConfig.exportedClientName}`;\n }\n return `New${this.getClientName()}`;\n }\n\n public getClientName(): string {\n if (this.customConfig?.clientName != null) {\n return this.customConfig.clientName;\n }\n return \"Client\";\n }\n\n public getClientImportPath(): string {\n return `${this.rootImportPath}/client`;\n }\n\n public getOptionImportPath(): string {\n return `${this.rootImportPath}/option`;\n }\n\n public getGoTypeReferenceFromDeclaration({\n declaration\n }: {\n declaration: FernIr.dynamic.Declaration;\n }): go.TypeReference {\n return go.typeReference({\n name: declaration.name.pascalCase.unsafeName,\n importPath: this.getImportPath(declaration.fernFilepath)\n });\n }\n\n public getEnvironmentTypeReferenceFromID(environmentID: string): go.TypeReference | undefined {\n const environmentName = this.resolveEnvironmentName(environmentID);\n if (environmentName == null) {\n return undefined;\n }\n return this.getEnvironmentTypeReference(environmentName);\n }\n\n private getEnvironmentTypeReference(name: FernIr.Name): go.TypeReference {\n return go.typeReference({\n name: `Environments.${this.getTypeName(name)}`,\n importPath: this.rootImportPath\n });\n }\n\n public static chainMethods(\n baseFunc: go.FuncInvocation,\n ...methods: Omit<go.MethodInvocation.Args, \"on\">[]\n ): go.MethodInvocation {\n if (methods.length === 0) {\n throw new Error(\"Must have methods to chain\");\n }\n\n let current: go.AstNode = baseFunc;\n for (const method of methods) {\n current = go.invokeMethod({\n on: current,\n method: method.method,\n arguments_: method.arguments_,\n multiline: method.multiline\n });\n }\n return current as go.MethodInvocation;\n }\n}\n"],"mappings":"2OAAAA,IAAAC,IAYO,IAAMC,EAAN,MAAMC,UAAwCC,CAAwC,CAQzF,YAAY,CACR,GAAAC,EACA,OAAAC,CACJ,EAGG,CACC,MAAM,CAAE,GAAAD,EAAI,OAAAC,CAAO,CAAC,EAdxBC,EAAA,KAAO,MACPA,EAAA,KAAO,gBACPA,EAAA,KAAO,qBACPA,EAAA,KAAO,kCACPA,EAAA,KAAO,sBACPA,EAAA,KAAO,kBAUH,KAAK,GAAKF,EACV,KAAK,aAAeC,EAAO,cAAgB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AAqC,CACrE,OAAOM,EAAG,cAAc,CACpB,KAAM,gBAAgB,KAAK,YAAYN,CAAI,CAAC,GAC5C,WAAY,KAAK,cACrB,CAAC,CACL,CAEA,OAAc,aACVY,KACGC,EACgB,CACnB,GAAIA,EAAQ,SAAW,EACnB,MAAM,IAAI,MAAM,4BAA4B,EAGhD,IAAIC,EAAsBF,EAC1B,QAAWG,KAAUF,EACjBC,EAAUR,EAAG,aAAa,CACtB,GAAIQ,EACJ,OAAQC,EAAO,OACf,WAAYA,EAAO,WACnB,UAAWA,EAAO,SACtB,CAAC,EAEL,OAAOD,CACX,CACJ","names":["init_process","init_buffer","DynamicSnippetsGeneratorContext","_DynamicSnippetsGeneratorContext","AbstractDynamicSnippetsGeneratorContext","ir","config","__publicField","DynamicTypeMapper","DynamicTypeInstantiationMapper","FilePropertyMapper","resolveRootImportPath","typeReference","assertNever","name","endpoint","fernFilepath","parts","path","_a","go_exports","s","_b","declaration","environmentID","environmentName","baseFunc","methods","current","method"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as P,b as T,c as S,d as b,e as a,f as p,g as l,h,i as R}from"./chunk-GUJUKQKZ.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var E=class{constructor(e){a(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=await d.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=d.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var o={Critical:"CRITICAL",Warning:"WARNING"},v=class m{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new m;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var g=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r,options:t={}}){a(this,"config");a(this,"options");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new v,this.httpEndpointReferenceParser=new g}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(u=>u.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let d=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:d})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let d=e.find(u=>u.name.wireValue===i);if(d==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:d.name,typeReference:d.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:d}=x,u=b(x,[S(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:u}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:h(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:h(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(R(t.urls));for(let i of R(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${R(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:h(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:h(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:h(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{E as a,o as b,w as c,A as d};
|
|
2
|
+
//# sourceMappingURL=chunk-VCNL2JWU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGenerator.ts","../../../../browser-compatible-base/src/dynamic-snippets/Result.ts","../../../../browser-compatible-base/src/dynamic-snippets/ErrorReporter.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.ts","../../../../../packages/cli/fern-definition/schema/src/index.ts","../../../../../packages/cli/fern-definition/schema/src/utils/HttpEndpointReferenceParser.ts","../../../../browser-compatible-base/src/dynamic-snippets/Scope.ts","../../../../browser-compatible-base/src/dynamic-snippets/index.ts"],"sourcesContent":["import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { AbstractEndpointSnippetGenerator } from \"./AbstractEndpointSnippetGenerator\";\nimport { Options } from \"./Options\";\nimport { Result } from \"./Result\";\n\nexport abstract class AbstractDynamicSnippetsGenerator<\n Context extends AbstractDynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator extends AbstractEndpointSnippetGenerator<Context>\n> {\n public constructor(public readonly context: Context) {}\n\n protected abstract createSnippetGenerator(context: Context): EndpointSnippetGenerator;\n\n public async generate(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = await snippetGenerator.generateSnippet({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n\n public generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): FernIr.dynamic.EndpointSnippetResponse {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = snippetGenerator.generateSnippetSync({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n}\n","import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { ErrorReporter } from \"./ErrorReporter\";\n\nexport class Result {\n public reporter: ErrorReporter | undefined;\n public snippet: string | undefined;\n public err: Error | undefined;\n\n constructor() {\n this.snippet = undefined;\n this.reporter = undefined;\n this.err = undefined;\n }\n\n public update({ context, snippet }: { context: AbstractDynamicSnippetsGeneratorContext; snippet: string }): void {\n if (this.shouldUpdate({ snippet, reporter: context.errors })) {\n this.reporter = context.errors.clone();\n this.snippet = snippet;\n }\n }\n\n public getResponseOrThrow({\n endpoint\n }: {\n endpoint: FernIr.dynamic.EndpointLocation;\n }): FernIr.dynamic.EndpointSnippetResponse {\n if (this.snippet != null && this.reporter != null) {\n return {\n snippet: this.snippet,\n errors: this.reporter.toDynamicSnippetErrors()\n };\n }\n throw this.err ?? new Error(`Failed to generate snippet for endpoint \"${endpoint.method} ${endpoint.path}\"`);\n }\n\n private shouldUpdate({ snippet, reporter }: { snippet: string; reporter: ErrorReporter }): boolean {\n if (this.reporter == null || (this.reporter.size() > 0 && reporter.size() === 0)) {\n return true;\n }\n return snippet.length > (this.snippet?.length ?? 0);\n }\n}\n","export const Severity = {\n Critical: \"CRITICAL\",\n Warning: \"WARNING\"\n} as const;\n\nexport declare namespace ErrorReporter {\n type Path = readonly PathItem[];\n\n type PathItem = string | ArrayPathItem;\n\n type Severity = (typeof Severity)[keyof typeof Severity];\n\n interface ArrayPathItem {\n index: number;\n }\n\n interface Error {\n path?: Path;\n severity: Severity;\n message: string;\n }\n}\n\ninterface Error_ {\n severity: \"CRITICAL\" | \"WARNING\";\n path: string[] | undefined;\n message: string;\n}\n\nexport class ErrorReporter {\n private errors: ErrorReporter.Error[];\n private path: ErrorReporter.PathItem[];\n\n constructor() {\n this.errors = [];\n this.path = [];\n }\n\n public add(err: Omit<ErrorReporter.Error, \"path\">): void {\n this.errors.push({\n ...err,\n path: [...this.path]\n });\n }\n\n public scope(path: ErrorReporter.PathItem): void {\n this.path.push(path);\n }\n\n public unscope(): void {\n this.path.pop();\n }\n\n public getBySeverity(severity: ErrorReporter.Severity): ErrorReporter.Error[] {\n return this.errors.filter((err) => err.severity === severity);\n }\n\n public empty(): boolean {\n return this.errors.length === 0;\n }\n\n public size(): number {\n return this.errors.length;\n }\n\n public clone(): ErrorReporter {\n const clone = new ErrorReporter();\n clone.errors = [...this.errors];\n clone.path = [...this.path];\n return clone;\n }\n\n public reset(): void {\n this.errors = [];\n this.path = [];\n }\n\n public toDynamicSnippetErrors(): Error_[] {\n return this.errors.map((err) => ({\n severity: err.severity,\n path: err.path != null ? this.pathToStringArray(err.path) : undefined,\n message: err.message\n }));\n }\n\n private pathToStringArray(path: ErrorReporter.Path): string[] {\n const result: string[] = [];\n for (const item of path) {\n if (typeof item === \"string\") {\n result.push(item);\n continue;\n }\n result[result.length - 1] += `[${item.index}]`;\n }\n return result;\n }\n}\n","import { assertNever, keys } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { HttpEndpointReferenceParser } from \"@fern-api/fern-definition-schema\";\n\nimport { FernGeneratorExec } from \"../GeneratorNotificationService\";\nimport { DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nimport { ErrorReporter, Severity } from \"./ErrorReporter\";\nimport { Options } from \"./Options\";\nimport { TypeInstance } from \"./TypeInstance\";\n\nexport abstract class AbstractDynamicSnippetsGeneratorContext {\n public config: FernGeneratorExec.GeneratorConfig;\n public options: Options;\n public errors: ErrorReporter;\n\n private _ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n private httpEndpointReferenceParser: HttpEndpointReferenceParser;\n\n constructor({\n ir,\n config,\n options = {}\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n options?: Options;\n }) {\n this._ir = ir;\n this.config = config;\n this.options = options;\n this.errors = new ErrorReporter();\n this.httpEndpointReferenceParser = new HttpEndpointReferenceParser();\n }\n\n public abstract clone(): AbstractDynamicSnippetsGeneratorContext;\n\n public associateQueryParametersByWireValue({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n throw this.newParameterNotRecognizedError(key);\n }\n // If this query parameter supports allow-multiple, the user-provided values\n // must be wrapped in an array.\n const typeInstanceValue =\n this.isListTypeReference(parameter.typeReference) && !Array.isArray(value) ? [value] : value;\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: typeInstanceValue\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n public associateByWireValueOrDefault({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n this.errors.scope(parameter.name.wireValue);\n try {\n let value = values[parameter.name.wireValue];\n\n if (value == null) {\n if (parameter.typeReference.type === \"primitive\" && parameter.typeReference.value === \"STRING\") {\n // synthesize a parameter value for string parameters that are missing data\n value = `<${parameter.name.wireValue}>`;\n } else {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(parameter.name.wireValue).message\n });\n continue;\n }\n }\n\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n\n return instances;\n }\n\n public associateByWireValue({\n parameters,\n values,\n ignoreMissingParameters\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n ignoreMissingParameters?: boolean;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n if (ignoreMissingParameters) {\n // Required for request payloads that include more information than\n // just the target parameters (e.g. union base properties).\n continue;\n }\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(key).message\n });\n continue;\n }\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n /**\n * Similar to `associateByWireValue` but it builds TypeInstance objects by iterating over schema parameters rather\n * than snippet values. Skips non-nullable parameters that are missing from the snippet object.\n */\n public getExampleObjectProperties({\n parameters,\n snippetObject\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n snippetObject: unknown;\n }): TypeInstance[] {\n const objectRecord = (\n typeof snippetObject === \"object\" && snippetObject !== null && !Array.isArray(snippetObject)\n ? snippetObject\n : {}\n ) as Record<string, unknown>;\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n const value = objectRecord[parameter.name.wireValue];\n if (value == null) {\n if (parameter.typeReference.type === \"nullable\") {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: null\n });\n }\n } else {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n }\n }\n return instances;\n }\n\n public getSingleFileValue({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): string | undefined {\n const fileValue = record[property.wireValue];\n if (fileValue == null) {\n return undefined;\n }\n if (typeof fileValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file value to be a string, got ${typeof fileValue}`\n });\n return undefined;\n }\n return fileValue;\n }\n\n public getFileArrayValues({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): string[] | undefined {\n const fileArrayValue = record[property.wireValue];\n if (fileArrayValue == null) {\n return undefined;\n }\n if (!Array.isArray(fileArrayValue)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof fileArrayValue}`\n });\n return undefined;\n }\n const stringValues: string[] = [];\n for (const value of fileArrayValue) {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof value}`\n });\n return undefined;\n }\n stringValues.push(value);\n }\n return stringValues;\n }\n\n public getRecord(value: unknown): Record<string, unknown> | undefined {\n if (typeof value !== \"object\" || Array.isArray(value)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected object with key, value pairs but got: ${\n Array.isArray(value) ? \"array\" : typeof value\n }`\n });\n return undefined;\n }\n if (value == null) {\n return {};\n }\n return value as Record<string, unknown>;\n }\n\n public resolveNamedType({ typeId }: { typeId: FernIr.dynamic.TypeId }): FernIr.dynamic.NamedType | undefined {\n const namedType = this._ir.types[typeId];\n if (namedType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Type identified by \"${typeId}\" could not be found`\n });\n return undefined;\n }\n return namedType;\n }\n\n public resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): DiscriminatedUnionTypeInstance | undefined {\n const record = this.getRecord(value);\n if (record == null) {\n return undefined;\n }\n\n const discriminantFieldName = discriminatedUnion.discriminant.wireValue;\n const discriminantValue = record[discriminantFieldName];\n if (discriminantValue == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(discriminantFieldName).message\n });\n return undefined;\n }\n if (typeof discriminantValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected discriminant value to be a string but got: ${typeof discriminantValue}`\n });\n return undefined;\n }\n\n const singleDiscriminatedUnionType = discriminatedUnion.types[discriminantValue];\n if (singleDiscriminatedUnionType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `No type found for discriminant value \"${discriminantValue}\"`\n });\n return undefined;\n }\n\n // Remove the discriminant from the record so that the value is valid for the type.\n const { [discriminantFieldName]: _, ...filtered } = record;\n\n return {\n singleDiscriminatedUnionType,\n discriminantValue: singleDiscriminatedUnionType.discriminantValue,\n value: filtered\n };\n }\n\n public resolveEndpointOrThrow(rawEndpoint: string): FernIr.dynamic.Endpoint[] {\n const parsedEndpoint = this.httpEndpointReferenceParser.tryParse(rawEndpoint);\n if (parsedEndpoint == null) {\n throw new Error(`Failed to parse endpoint reference \"${rawEndpoint}\"`);\n }\n return this.resolveEndpointLocationOrThrow(parsedEndpoint);\n }\n\n public resolveEndpointLocation(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints: FernIr.dynamic.Endpoint[] = [];\n for (const endpoint of Object.values(this._ir.endpoints)) {\n if (this.parsedEndpointMatches({ endpoint, parsedEndpoint: location })) {\n endpoints.push(endpoint);\n }\n }\n\n return endpoints;\n }\n\n public resolveEndpointLocationOrThrow(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints = this.resolveEndpointLocation(location);\n if (endpoints.length === 0) {\n throw new Error(`Failed to find endpoint identified by \"${location.method} ${location.path}\"`);\n }\n return endpoints;\n }\n\n public needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n inlineFileProperties: boolean;\n }): boolean {\n if (this.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n return true;\n }\n if (request.queryParameters != null && request.queryParameters.length > 0) {\n return true;\n }\n if (request.headers != null && request.headers.length > 0) {\n return true;\n }\n if (request.body != null) {\n return this.includeRequestBodyInWrappedRequest({ body: request.body, inlineFileProperties });\n }\n if (request.metadata?.onlyPathParameters) {\n return false;\n }\n return true;\n }\n\n public includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n }): boolean {\n return inlinePathParameters && (request.metadata?.includePathParameters ?? false);\n }\n\n public isFileUploadRequestBody(\n body: FernIr.dynamic.InlinedRequestBody\n ): body is FernIr.dynamic.InlinedRequestBody.FileUpload {\n switch (body.type) {\n case \"fileUpload\":\n return true;\n case \"properties\":\n case \"referenced\":\n return false;\n default:\n assertNever(body);\n }\n }\n\n public resolveEnvironmentName(environmentID: string): FernIr.Name | undefined {\n if (this._ir.environments == null) {\n return undefined;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n case \"multipleBaseUrls\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n default:\n assertNever(environments);\n }\n }\n\n public isSingleEnvironmentID(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.EnvironmentId {\n return typeof environment === \"string\";\n }\n\n public isMultiEnvironmentValues(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.MultipleEnvironmentUrlValues {\n return typeof environment === \"object\";\n }\n\n public validateMultiEnvironmentUrlValues(\n multiEnvironmentUrlValues: FernIr.dynamic.MultipleEnvironmentUrlValues\n ): boolean {\n if (this._ir.environments == null) {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n case \"multipleBaseUrls\": {\n const firstEnvironment = environments.environments[0];\n if (firstEnvironment == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: \"Multiple environments are not supported; use the baseUrl option instead\"\n });\n return false;\n }\n const expectedKeys = new Set(keys(firstEnvironment.urls));\n for (const key of keys(multiEnvironmentUrlValues)) {\n if (expectedKeys.has(key)) {\n expectedKeys.delete(key);\n }\n }\n if (expectedKeys.size > 0) {\n this.errors.add({\n severity: Severity.Critical,\n message: `The provided environments are invalid; got: [${Object.keys(multiEnvironmentUrlValues).join(\", \")}], expected: [${keys(firstEnvironment.urls).join(\", \")}]`\n });\n return false;\n }\n return true;\n }\n }\n }\n\n public getValueAsNumber({ value }: { value: unknown }): number | undefined {\n if (typeof value !== \"number\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"number\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsBoolean({ value }: { value: unknown }): boolean | undefined {\n if (typeof value !== \"boolean\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"boolean\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsString({ value }: { value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"string\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public isOptional(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return this.isOptional(typeReference.value);\n case \"optional\":\n return true;\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public isNullable(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return true;\n case \"optional\":\n return this.isNullable(typeReference.value);\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public newAuthMismatchError({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): Error {\n return new Error(`Expected auth type ${auth.type}, got ${values.type}`);\n }\n\n public newParameterNotRecognizedError(parameterName: string): Error {\n return new Error(`\"${parameterName}\" is not a recognized parameter for this endpoint`);\n }\n\n public newTypeMismatchError({ expected, value }: { expected: string; value: unknown }): Error {\n return new Error(`Expected ${expected}, got ${typeof value}`);\n }\n\n private includeRequestBodyInWrappedRequest({\n body,\n inlineFileProperties\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n switch (body.type) {\n case \"properties\":\n case \"referenced\":\n return true;\n case \"fileUpload\":\n return this.includeFileUploadBodyInWrappedRequest({ fileUpload: body, inlineFileProperties });\n default:\n assertNever(body);\n }\n }\n\n private includeFileUploadBodyInWrappedRequest({\n fileUpload,\n inlineFileProperties\n }: {\n fileUpload: FernIr.dynamic.FileUploadRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n return (\n this.fileUploadHasBodyProperties({ fileUpload }) ||\n (inlineFileProperties && this.fileUploadHasFileProperties({ fileUpload }))\n );\n }\n\n private fileUploadHasBodyProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return false;\n case \"bodyProperty\":\n return true;\n default:\n assertNever(property);\n }\n });\n }\n\n private fileUploadHasFileProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return true;\n case \"bodyProperty\":\n return false;\n default:\n assertNever(property);\n }\n });\n }\n\n private isListTypeReference(typeReference: FernIr.dynamic.TypeReference): boolean {\n if (typeReference.type === \"optional\") {\n return this.isListTypeReference(typeReference.value);\n }\n return typeReference.type === \"list\" || typeReference.type === \"set\";\n }\n\n private parsedEndpointMatches({\n endpoint,\n parsedEndpoint\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n parsedEndpoint: HttpEndpointReferenceParser.Parsed;\n }): boolean {\n return endpoint.location.method === parsedEndpoint.method && endpoint.location.path === parsedEndpoint.path;\n }\n}\n","export { EXAMPLE_REFERENCE_PREFIX, YAML_SCHEMA_VERSION } from \"./constants\";\nexport { type NodePath, type NodePathItem } from \"./NodePath\";\nexport * as RawSchemas from \"./schemas\";\nexport { type DefinitionFileSchema, type PackageMarkerFileSchema, type RootApiFileSchema } from \"./schemas\";\nexport * from \"./utils/auth\";\nexport * from \"./utils/generics\";\nexport { getRequestBody } from \"./utils/getRequestBody\";\nexport { getResponseBodyType } from \"./utils/getResponseBodyType\";\nexport { HttpEndpointReferenceParser } from \"./utils/HttpEndpointReferenceParser\";\nexport { isInlineRequestBody } from \"./utils/isInlineRequestBody\";\nexport { isOpenApiSourceSchema } from \"./utils/isOpenApiSourceSchema\";\nexport { isRawProtobufSourceSchema } from \"./utils/isRawProtobufSourceSchema\";\nexport { isRawTextType } from \"./utils/isRawTextType\";\nexport { type BytesRequest, parseBytesRequest } from \"./utils/parseBytesRequest\";\nexport { parseFileUploadRequest, type RawFileUploadRequest } from \"./utils/parseFileUploadRequest\";\nexport { parseRawBytesType, type RawBytesType } from \"./utils/parseRawBytesType\";\nexport { parseRawFileType, type RawFileType } from \"./utils/parseRawFileType\";\nexport { parseRawTextType, type RawTextType } from \"./utils/parseRawTextType\";\nexport { RawPrimitiveType } from \"./utils/RawPrimitiveType\";\nexport { recursivelyVisitRawTypeReference } from \"./utils/recursivelyVisitRawTypeReference\";\nexport { visitExampleCodeSampleSchema } from \"./utils/visitExampleCodeSampleSchema\";\nexport { type ExampleResponseSchemaVisitor, visitExampleResponseSchema } from \"./utils/visitExampleResponseSchema\";\nexport { isAnyAuthSchemes, isSingleAuthScheme, type RawApiAuthVisitor, visitRawApiAuth } from \"./utils/visitRawApiAuth\";\nexport {\n type AuthSchemeDeclarationVisitor,\n isHeaderAuthScheme,\n visitRawAuthSchemeDeclaration\n} from \"./utils/visitRawAuthSchemeDeclaration\";\nexport {\n isRawMultipleBaseUrlsEnvironment,\n isRawSingleBaseUrlEnvironment,\n visitRawEnvironmentDeclaration\n} from \"./utils/visitRawEnvironmentDeclaration\";\nexport {\n isVariablePathParameter,\n type PathParameterDeclarationVisitor,\n visitRawPathParameter\n} from \"./utils/visitRawPathParameter\";\nexport {\n isRawAliasDefinition,\n isRawDiscriminatedUnionDefinition,\n isRawEnumDefinition,\n isRawObjectDefinition,\n isRawUndiscriminatedUnionDefinition,\n type RawTypeDeclarationVisitor,\n visitRawTypeDeclaration\n} from \"./utils/visitRawTypeDeclaration\";\nexport { FernContainerRegex, visitRawTypeReference } from \"./utils/visitRawTypeReference\";\n","export declare namespace HttpEndpointReferenceParser {\n interface Parsed {\n path: string;\n method: Method;\n }\n\n type Method = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"HEAD\";\n\n export type ValidationResult = Valid | Invalid;\n\n interface Valid {\n type: \"valid\";\n }\n\n interface Invalid {\n type: \"invalid\";\n }\n}\n\n/**\n * Parses an HTTP endpoint reference like `POST /users/get`\n */\nexport class HttpEndpointReferenceParser {\n //eslint-disable-next-line\n private REFERENCE_REGEX = /^(GET|POST|PUT|DELETE|PATCH|HEAD)\\s(\\/\\S*)$/;\n\n public validate(reference: string): HttpEndpointReferenceParser.ValidationResult {\n const validFormat = this.REFERENCE_REGEX.test(reference);\n if (!validFormat) {\n return { type: \"invalid\" };\n }\n return { type: \"valid\" };\n }\n\n public tryParse(reference: string): HttpEndpointReferenceParser.Parsed | undefined {\n const validationResponse = this.validate(reference);\n if (validationResponse.type === \"invalid\") {\n return undefined;\n }\n const match = reference.match(this.REFERENCE_REGEX);\n if (match == null || match[1] == null || match[2] == null) {\n return undefined;\n }\n return {\n method: match[1] as HttpEndpointReferenceParser.Method,\n path: match[2]\n };\n }\n}\n","export const Scope = {\n PathParameters: \"pathParameters\",\n QueryParameters: \"queryParameters\",\n Headers: \"headers\",\n RequestBody: \"requestBody\"\n} as const;\n\nexport type Scope = (typeof Scope)[keyof typeof Scope];\n","export { AbstractDynamicSnippetsGenerator } from \"./AbstractDynamicSnippetsGenerator\";\nexport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nexport { type DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nexport { ErrorReporter, Severity } from \"./ErrorReporter\";\nexport { type Options, Style } from \"./Options\";\nexport { Result } from \"./Result\";\nexport { Scope } from \"./Scope\";\nexport { type TypeInstance } from \"./TypeInstance\";\nexport { DynamicSnippetsTestRunner } from \"./test-utils/DynamicSnippetsTestRunner\";\n"],"mappings":"2FAKAA,IAAAC,ICAAC,IAAAC,IAAM,IAAOC,EAAP,KAAa,CAKf,aAAA,CAJOC,EAAA,iBACAA,EAAA,gBACAA,EAAA,YAGH,KAAK,QAAU,OACf,KAAK,SAAW,OAChB,KAAK,IAAM,MACf,CAEO,OAAO,CAAE,QAAAC,EAAS,QAAAC,CAAO,EAAyE,CACjG,KAAK,aAAa,CAAE,QAAAA,EAAS,SAAUD,EAAQ,MAAM,CAAE,IACvD,KAAK,SAAWA,EAAQ,OAAO,MAAK,EACpC,KAAK,QAAUC,EAEvB,CAEO,mBAAmB,CACtB,SAAAC,CAAQ,EAGX,CAtBL,IAAAC,EAuBQ,GAAI,KAAK,SAAW,MAAQ,KAAK,UAAY,KACzC,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,SAAS,uBAAsB,GAGpD,MAAMA,EAAA,KAAK,MAAL,KAAAA,EAAY,IAAI,MAAM,4CAA4CD,EAAS,MA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IvB,CACG,OACI,KAAK,4BAA4B,CAAE,WAAAiB,CAAU,CAAE,GAC9CjB,GAAwB,KAAK,4BAA4B,CAAE,WAAAiB,CAAU,CAAE,CAEhF,CAEQ,4BAA4B,CAAE,WAAAA,CAAU,EAAwD,CACpG,OAAOA,EAAW,WAAW,KAAMxC,GAAY,CAC3C,OAAQA,EAAS,KAAM,CACnB,IAAK,OACL,IAAK,YACD,MAAO,GACX,IAAK,eACD,MAAO,GACX,QACI0B,EAAY1B,CAAQ,CAC5B,CACJ,CAAC,CACL,CAEQ,4BAA4B,CAAE,WAAAwC,CAAU,EAAwD,CACpG,OAAOA,EAAW,WAAW,KAAMxC,GAAY,CAC3C,OAAQA,EAAS,KAAM,CACnB,IAAK,OACL,IAAK,YACD,MAAO,GACX,IAAK,eACD,MAAO,GACX,QACI0B,EAAY1B,CAAQ,CAC5B,CACJ,CAAC,CACL,CAEQ,oBAAoBmC,EAA2C,CACnE,OAAIA,EAAc,OAAS,WAChB,KAAK,oBAAoBA,EAAc,KAAK,EAEhDA,EAAc,OAAS,QAAUA,EAAc,OAAS,KACnE,CAEQ,sBAAsB,CAC1B,SAAAf,EACA,eAAAH,CAAc,EAIjB,CACG,OAAOG,EAAS,SAAS,SAAWH,EAAe,QAAUG,EAAS,SAAS,OAASH,EAAe,IAC3G,GG/nBJwB,IAAAC,IAAO,IAAMC,EAAQ,CACjB,eAAgB,iBAChB,gBAAiB,kBACjB,QAAS,UACT,YAAa,eCJjBC,IAAAC","names":["init_process","init_buffer","init_process","init_buffer","Result","__publicField","context","snippet","endpoint","_a","reporter","_b","AbstractDynamicSnippetsGenerator","context","__publicField","request","options","endpoints","result","Result","endpoint","snippetGenerator","snippet","error","init_process","init_buffer","Severity","ErrorReporter","_ErrorReporter","__publicField","err","__spreadProps","__spreadValues","path","severity","clone","result","item","init_process","init_buffer","init_process","init_buffer","init_process","init_buffer","HttpEndpointReferenceParser","__publicField","reference","match","AbstractDynamicSnippetsGeneratorContext","ir","config","options","__publicField","ErrorReporter","HttpEndpointReferenceParser","parameters","values","instances","key","value","parameter","param","typeInstanceValue","Severity","ignoreMissingParameters","snippetObject","objectRecord","property","record","fileValue","fileArrayValue","stringValues","typeId","namedType","discriminatedUnion","discriminantFieldName","discriminantValue","singleDiscriminatedUnionType","_a","_","filtered","__objRest","__restKey","rawEndpoint","parsedEndpoint","location","endpoints","endpoint","request","inlinePathParameters","inlineFileProperties","_b","body","assertNever","environmentID","environments","environment","env","multiEnvironmentUrlValues","firstEnvironment","expectedKeys","keys","typeReference","resolvedType","auth","parameterName","expected","fileUpload","init_process","init_buffer","Scope","init_process","init_buffer"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import '@fern-api/dynamic-ir-sdk';
|
|
3
3
|
import '@fern-api/go-ast';
|
|
4
|
-
export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-
|
|
4
|
+
export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-UZEM7EUP.js";import"../chunk-FD44EP2P.js";import"../chunk-VCNL2JWU.js";import"../chunk-Q6YO7G6Y.js";import"../chunk-2YRGTA73.js";import"../chunk-GUJUKQKZ.js";export{a as DynamicSnippetsGeneratorContext};
|
|
2
|
+
//# sourceMappingURL=DynamicSnippetsGeneratorContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@fern-api/dynamic-ir-sdk';
|
|
2
2
|
import '@fern-api/go-ast';
|
|
3
|
-
export { a as DynamicTypeInstantiationMapper } from '../DynamicSnippetsGeneratorContext-
|
|
3
|
+
export { a as DynamicTypeInstantiationMapper } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
|
|
4
4
|
import '@fern-api/browser-compatible-base-generator';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-FD44EP2P.js";import"../chunk-VCNL2JWU.js";import"../chunk-GUJUKQKZ.js";export{a as DynamicTypeInstantiationMapper};
|
|
2
|
+
//# sourceMappingURL=DynamicTypeInstantiationMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@fern-api/dynamic-ir-sdk';
|
|
2
2
|
import '@fern-api/go-ast';
|
|
3
|
-
export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-
|
|
3
|
+
export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
|
|
4
4
|
import '@fern-api/browser-compatible-base-generator';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-Q6YO7G6Y.js";import"../chunk-GUJUKQKZ.js";export{a as DynamicTypeMapper};
|
|
2
|
+
//# sourceMappingURL=DynamicTypeMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@fern-api/dynamic-ir-sdk';
|
|
2
2
|
import '@fern-api/go-ast';
|
|
3
|
-
export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-
|
|
3
|
+
export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-BusKoNq4.js';
|
|
4
4
|
import '@fern-api/browser-compatible-base-generator';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2YRGTA73.js";import"../chunk-GUJUKQKZ.js";export{a as FilePropertyMapper};
|
|
2
|
+
//# sourceMappingURL=FilePropertyMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.js';
|
|
2
2
|
import '@fern-api/browser-compatible-base-generator';
|
|
3
3
|
import '@fern-api/dynamic-ir-sdk';
|
|
4
|
-
import './DynamicSnippetsGeneratorContext-
|
|
4
|
+
import './DynamicSnippetsGeneratorContext-BusKoNq4.js';
|
|
5
5
|
import '@fern-api/go-ast';
|
|
6
|
+
import './EndpointSnippetGenerator.js';
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import{a as Hi}from"./chunk-YAGEU3HO.js";import"./chunk-X7QP3WH3.js";import"./chunk-5HP3T45N.js";import"./chunk-SS6XZXHU.js";import"./chunk-J745U74Q.js";import"./chunk-D3UUM672.js";import"./chunk-I3VUX77R.js";import{e as ne,f as y,g as ki,h as zi,i as ji,k as o,l as s,m as i}from"./chunk-TUE3DOHS.js";var ht=y((Jl,vt)=>{"use strict";o();i();var Ji="Function.prototype.bind called on incompatible ",Ki=Object.prototype.toString,Qi=Math.max,Yi="[object Function]",gt=function(r,t){for(var n=[],u=0;u<r.length;u+=1)n[u]=r[u];for(var a=0;a<t.length;a+=1)n[a+r.length]=t[a];return n},Xi=function(r,t){for(var n=[],u=t||0,a=0;u<r.length;u+=1,a+=1)n[a]=r[u];return n},Zi=function(e,r){for(var t="",n=0;n<e.length;n+=1)t+=e[n],n+1<e.length&&(t+=r);return t};vt.exports=function(r){var t=this;if(typeof t!="function"||Ki.apply(t)!==Yi)throw new TypeError(Ji+t);for(var n=Xi(arguments,1),u,a=function(){if(this instanceof u){var v=t.apply(this,gt(n,arguments));return Object(v)===v?v:this}return t.apply(r,gt(n,arguments))},f=Qi(0,t.length-n.length),c=[],l=0;l<f;l++)c[l]="$"+l;if(u=Function("binder","return function ("+Zi(c,",")+"){ return binder.apply(this,arguments); }")(a),t.prototype){var m=function(){};m.prototype=t.prototype,u.prototype=new m,m.prototype=null}return u}});var Or=y((Yl,dt)=>{"use strict";o();i();var Vi=ht();dt.exports=Function.prototype.bind||Vi});var St=y((Vl,mt)=>{"use strict";o();i();mt.exports=Error});var wt=y((ts,bt)=>{"use strict";o();i();bt.exports=EvalError});var Ot=y((is,At)=>{"use strict";o();i();At.exports=RangeError});var xt=y((fs,qt)=>{"use strict";o();i();qt.exports=ReferenceError});var oe=y((ps,$t)=>{"use strict";o();i();$t.exports=SyntaxError});var w=y((gs,Et)=>{"use strict";o();i();Et.exports=TypeError});var It=y((ds,Pt)=>{"use strict";o();i();Pt.exports=URIError});var ie=y((bs,Tt)=>{"use strict";o();i();Tt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var u=42;r[t]=u;for(t in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var a=Object.getOwnPropertySymbols(r);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(r,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(r,t);if(f.value!==u||f.enumerable!==!0)return!1}return!0}});var ae=y((Os,Rt)=>{"use strict";o();i();var Ft=typeof Symbol!="undefined"&&Symbol,ra=ie();Rt.exports=function(){return typeof Ft!="function"||typeof Symbol!="function"||typeof Ft("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ra()}});var Dt=y(($s,Nt)=>{"use strict";o();i();var ue={__proto__:null,foo:{}},ea=Object;Nt.exports=function(){return{__proto__:ue}.foo===ue.foo&&!(ue instanceof ea)}});var Bt=y((Is,_t)=>{"use strict";o();i();var ta=Function.prototype.call,na=Object.prototype.hasOwnProperty,oa=Or();_t.exports=oa.call(ta,na)});var E=y((Rs,Lt)=>{"use strict";o();i();var d,ia=St(),aa=wt(),ua=Ot(),fa=xt(),Z=oe(),X=w(),la=It(),Wt=Function,fe=function(e){try{return Wt('"use strict"; return ('+e+").constructor;")()}catch(r){}},G=Object.getOwnPropertyDescriptor;if(G)try{G({},"")}catch(e){G=null}var le=function(){throw new X},sa=G?function(){try{return arguments.callee,le}catch(e){try{return G(arguments,"callee").get}catch(r){return le}}}():le,Q=ae()(),pa=Dt()(),b=Object.getPrototypeOf||(pa?function(e){return e.__proto__}:null),Y={},ca=typeof Uint8Array=="undefined"||!b?d:b(Uint8Array),k={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?d:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?d:ArrayBuffer,"%ArrayIteratorPrototype%":Q&&b?b([][Symbol.iterator]()):d,"%AsyncFromSyncIteratorPrototype%":d,"%AsyncFunction%":Y,"%AsyncGenerator%":Y,"%AsyncGeneratorFunction%":Y,"%AsyncIteratorPrototype%":Y,"%Atomics%":typeof Atomics=="undefined"?d:Atomics,"%BigInt%":typeof BigInt=="undefined"?d:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?d:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?d:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?d:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":ia,"%eval%":eval,"%EvalError%":aa,"%Float32Array%":typeof Float32Array=="undefined"?d:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?d:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?d:FinalizationRegistry,"%Function%":Wt,"%GeneratorFunction%":Y,"%Int8Array%":typeof Int8Array=="undefined"?d:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?d:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?d:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Q&&b?b(b([][Symbol.iterator]())):d,"%JSON%":typeof JSON=="object"?JSON:d,"%Map%":typeof Map=="undefined"?d:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Q||!b?d:b(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?d:Promise,"%Proxy%":typeof Proxy=="undefined"?d:Proxy,"%RangeError%":ua,"%ReferenceError%":fa,"%Reflect%":typeof Reflect=="undefined"?d:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?d:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Q||!b?d:b(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?d:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Q&&b?b(""[Symbol.iterator]()):d,"%Symbol%":Q?Symbol:d,"%SyntaxError%":Z,"%ThrowTypeError%":sa,"%TypedArray%":ca,"%TypeError%":X,"%Uint8Array%":typeof Uint8Array=="undefined"?d:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?d:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?d:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?d:Uint32Array,"%URIError%":la,"%WeakMap%":typeof WeakMap=="undefined"?d:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?d:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?d:WeakSet};if(b)try{null.error}catch(e){Mt=b(b(e)),k["%Error.prototype%"]=Mt}var Mt,ya=function e(r){var t;if(r==="%AsyncFunction%")t=fe("async function () {}");else if(r==="%GeneratorFunction%")t=fe("function* () {}");else if(r==="%AsyncGeneratorFunction%")t=fe("async function* () {}");else if(r==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(r==="%AsyncIteratorPrototype%"){var u=e("%AsyncGenerator%");u&&b&&(t=b(u.prototype))}return k[r]=t,t},Ct={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ar=Or(),qr=Bt(),ga=ar.call(Function.call,Array.prototype.concat),va=ar.call(Function.apply,Array.prototype.splice),Ut=ar.call(Function.call,String.prototype.replace),xr=ar.call(Function.call,String.prototype.slice),ha=ar.call(Function.call,RegExp.prototype.exec),da=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ma=/\\(\\)?/g,Sa=function(r){var t=xr(r,0,1),n=xr(r,-1);if(t==="%"&&n!=="%")throw new Z("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Z("invalid intrinsic syntax, expected opening `%`");var u=[];return Ut(r,da,function(a,f,c,l){u[u.length]=c?Ut(l,ma,"$1"):f||a}),u},ba=function(r,t){var n=r,u;if(qr(Ct,n)&&(u=Ct[n],n="%"+u[0]+"%"),qr(k,n)){var a=k[n];if(a===Y&&(a=ya(n)),typeof a=="undefined"&&!t)throw new X("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:u,name:n,value:a}}throw new Z("intrinsic "+r+" does not exist!")};Lt.exports=function(r,t){if(typeof r!="string"||r.length===0)throw new X("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new X('"allowMissing" argument must be a boolean');if(ha(/^%?[^%]*%?$/,r)===null)throw new Z("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Sa(r),u=n.length>0?n[0]:"",a=ba("%"+u+"%",t),f=a.name,c=a.value,l=!1,m=a.alias;m&&(u=m[0],va(n,ga([0,1],m)));for(var v=1,h=!0;v<n.length;v+=1){var g=n[v],A=xr(g,0,1),x=xr(g,-1);if((A==='"'||A==="'"||A==="`"||x==='"'||x==="'"||x==="`")&&A!==x)throw new Z("property names with quotes must have matching quotes");if((g==="constructor"||!h)&&(l=!0),u+="."+g,f="%"+u+"%",qr(k,f))c=k[f];else if(c!=null){if(!(g in c)){if(!t)throw new X("base intrinsic for "+r+" exists, but the property is not available.");return}if(G&&v+1>=n.length){var S=G(c,g);h=!!S,h&&"get"in S&&!("originalValue"in S.get)?c=S.get:c=c[g]}else h=qr(c,g),c=c[g];h&&!l&&(k[f]=c)}}return c}});var Er=y((_s,Gt)=>{"use strict";o();i();var wa=E(),$r=wa("%Object.defineProperty%",!0)||!1;if($r)try{$r({},"a",{value:1})}catch(e){$r=!1}Gt.exports=$r});var se=y((Cs,kt)=>{"use strict";o();i();var Aa=E(),Pr=Aa("%Object.getOwnPropertyDescriptor%",!0);if(Pr)try{Pr([],"length")}catch(e){Pr=null}kt.exports=Pr});var pe=y((Ls,Ht)=>{"use strict";o();i();var zt=Er(),Oa=oe(),V=w(),jt=se();Ht.exports=function(r,t,n){if(!r||typeof r!="object"&&typeof r!="function")throw new V("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new V("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new V("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new V("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new V("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new V("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,l=!!jt&&jt(r,t);if(zt)zt(r,t,{configurable:f===null&&l?l.configurable:!f,enumerable:u===null&&l?l.enumerable:!u,value:n,writable:a===null&&l?l.writable:!a});else if(c||!u&&!a&&!f)r[t]=n;else throw new Oa("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var ye=y((zs,Kt)=>{"use strict";o();i();var ce=Er(),Jt=function(){return!!ce};Jt.hasArrayLengthDefineBug=function(){if(!ce)return null;try{return ce([],"length",{value:1}).length!==1}catch(r){return!0}};Kt.exports=Jt});var Vt=y((Js,Zt)=>{"use strict";o();i();var qa=E(),Qt=pe(),xa=ye()(),Yt=se(),Xt=w(),$a=qa("%Math.floor%");Zt.exports=function(r,t){if(typeof r!="function")throw new Xt("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||$a(t)!==t)throw new Xt("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],u=!0,a=!0;if("length"in r&&Yt){var f=Yt(r,"length");f&&!f.configurable&&(u=!1),f&&!f.writable&&(a=!1)}return(u||a||!n)&&(xa?Qt(r,"length",t,!0,!0):Qt(r,"length",t)),r}});var Fr=y((Ys,Ir)=>{"use strict";o();i();var ge=Or(),Tr=E(),Ea=Vt(),Pa=w(),tn=Tr("%Function.prototype.apply%"),nn=Tr("%Function.prototype.call%"),on=Tr("%Reflect.apply%",!0)||ge.call(nn,tn),rn=Er(),Ia=Tr("%Math.max%");Ir.exports=function(r){if(typeof r!="function")throw new Pa("a function is required");var t=on(ge,nn,arguments);return Ea(t,1+Ia(0,r.length-(arguments.length-1)),!0)};var en=function(){return on(ge,tn,arguments)};rn?rn(Ir.exports,"apply",{value:en}):Ir.exports.apply=en});var ve=y((Vs,un)=>{"use strict";o();i();var an=Object.prototype.toString;un.exports=function(r){var t=an.call(r),n=t==="[object Arguments]";return n||(n=t!=="[object Array]"&&r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&an.call(r.callee)==="[object Function]"),n}});var hn=y((tp,vn)=>{"use strict";o();i();var gn;Object.keys||(ur=Object.prototype.hasOwnProperty,he=Object.prototype.toString,fn=ve(),de=Object.prototype.propertyIsEnumerable,ln=!de.call({toString:null},"toString"),sn=de.call(function(){},"prototype"),fr=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Rr=function(e){var r=e.constructor;return r&&r.prototype===e},pn={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},cn=function(){if(typeof window=="undefined")return!1;for(var e in window)try{if(!pn["$"+e]&&ur.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{Rr(window[e])}catch(r){return!0}}catch(r){return!0}return!1}(),yn=function(e){if(typeof window=="undefined"||!cn)return Rr(e);try{return Rr(e)}catch(r){return!1}},gn=function(r){var t=r!==null&&typeof r=="object",n=he.call(r)==="[object Function]",u=fn(r),a=t&&he.call(r)==="[object String]",f=[];if(!t&&!n&&!u)throw new TypeError("Object.keys called on a non-object");var c=sn&&n;if(a&&r.length>0&&!ur.call(r,0))for(var l=0;l<r.length;++l)f.push(String(l));if(u&&r.length>0)for(var m=0;m<r.length;++m)f.push(String(m));else for(var v in r)!(c&&v==="prototype")&&ur.call(r,v)&&f.push(String(v));if(ln)for(var h=yn(r),g=0;g<fr.length;++g)!(h&&fr[g]==="constructor")&&ur.call(r,fr[g])&&f.push(fr[g]);return f});var ur,he,fn,de,ln,sn,fr,Rr,pn,cn,yn;vn.exports=gn});var bn=y((ip,Sn)=>{"use strict";o();i();var Ta=Array.prototype.slice,Fa=ve(),dn=Object.keys,Nr=dn?function(r){return dn(r)}:hn(),mn=Object.keys;Nr.shim=function(){if(Object.keys){var r=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);r||(Object.keys=function(n){return Fa(n)?mn(Ta.call(n)):mn(n)})}else Object.keys=Nr;return Object.keys||Nr};Sn.exports=Nr});var lr=y((fp,qn)=>{"use strict";o();i();var Ra=bn(),Na=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Da=Object.prototype.toString,_a=Array.prototype.concat,wn=pe(),Ba=function(e){return typeof e=="function"&&Da.call(e)==="[object Function]"},An=ye()(),Ma=function(e,r,t,n){if(r in e){if(n===!0){if(e[r]===t)return}else if(!Ba(n)||!n())return}An?wn(e,r,t,!0):wn(e,r,t)},On=function(e,r){var t=arguments.length>2?arguments[2]:{},n=Ra(r);Na&&(n=_a.call(n,Object.getOwnPropertySymbols(r)));for(var u=0;u<n.length;u+=1)Ma(e,n[u],r[n[u]],t[n[u]])};On.supportsDescriptors=!!An;qn.exports=On});var P=y((pp,En)=>{"use strict";o();i();var xn=E(),$n=Fr(),Ca=$n(xn("String.prototype.indexOf"));En.exports=function(r,t){var n=xn(r,!!t);return typeof n=="function"&&Ca(r,".prototype.")>-1?$n(n):n}});var Tn=y((gp,In)=>{"use strict";o();i();var Ua=E(),Pn=Ua("%Array%"),Wa=!Pn.isArray&&P()("Object.prototype.toString");In.exports=Pn.isArray||function(r){return Wa(r)==="[object Array]"}});var me=y((dp,Fn)=>{"use strict";o();i();Fn.exports=Tn()});var Nn=y((bp,Rn)=>{"use strict";o();i();var La=E(),Ga=P(),ka=w(),za=me(),ja=La("%Reflect.apply%",!0)||Ga("Function.prototype.apply");Rn.exports=function(r,t){var n=arguments.length>2?arguments[2]:[];if(!za(n))throw new ka("Assertion failed: optional `argumentsList`, if provided, must be a List");return ja(r,t,n)}});function Dn(){throw new Error("setTimeout has not been defined")}function _n(){throw new Error("clearTimeout has not been defined")}function Bn(e){if(M===setTimeout)return setTimeout(e,0);if((M===Dn||!M)&&setTimeout)return M=setTimeout,setTimeout(e,0);try{return M(e,0)}catch(r){try{return M.call(null,e,0)}catch(t){return M.call(this,e,0)}}}function Ha(e){if(C===clearTimeout)return clearTimeout(e);if((C===_n||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(e);try{return C(e)}catch(r){try{return C.call(null,e)}catch(t){return C.call(this,e)}}}function Ja(){!er||!z||(er=!1,z.length?N=z.concat(N):Dr=-1,N.length&&Mn())}function Mn(){if(!er){var e=Bn(Ja);er=!0;for(var r=N.length;r;){for(z=N,N=[];++Dr<r;)z&&z[Dr].run();Dr=-1,r=N.length}z=null,er=!1,Ha(e)}}function Ka(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];N.push(new Cn(e,r)),N.length===1&&!er&&Bn(Mn)}function Cn(e,r){this.fun=e,this.array=r}function j(){}function pu(e){throw new Error("process.binding is not supported")}function cu(){return"/"}function yu(e){throw new Error("process.chdir is not supported")}function gu(){return 0}function hu(e){var r=vu.call(rr)*.001,t=Math.floor(r),n=Math.floor(r%1*1e9);return e&&(t=t-e[0],n=n-e[1],n<0&&(t--,n+=1e9)),[t,n]}function mu(){var e=new Date,r=e-du;return r/1e3}var M,C,N,er,z,Dr,Qa,Ya,Xa,Za,Va,ru,eu,tu,nu,ou,iu,au,uu,fu,lu,su,rr,vu,du,Su,sr,Un=ne(()=>{"use strict";o();i();M=Dn,C=_n;typeof globalThis.setTimeout=="function"&&(M=setTimeout);typeof globalThis.clearTimeout=="function"&&(C=clearTimeout);N=[],er=!1,Dr=-1;Cn.prototype.run=function(){this.fun.apply(null,this.array)};Qa="browser",Ya="browser",Xa=!0,Za={},Va=[],ru="",eu={},tu={},nu={};ou=j,iu=j,au=j,uu=j,fu=j,lu=j,su=j;rr=globalThis.performance||{},vu=rr.now||rr.mozNow||rr.msNow||rr.oNow||rr.webkitNow||function(){return new Date().getTime()};du=new Date;Su={nextTick:Ka,title:Qa,browser:Xa,env:Za,argv:Va,version:ru,versions:eu,on:ou,addListener:iu,once:au,off:uu,removeListener:fu,removeAllListeners:lu,emit:su,binding:pu,cwd:cu,chdir:yu,umask:gu,hrtime:hu,platform:Ya,release:tu,config:nu,uptime:mu},sr=Su});var Se,be,Wn=ne(()=>{"use strict";o();i();typeof Object.create=="function"?Se=function(r,t){r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}:Se=function(r,t){r.super_=t;var n=function(){};n.prototype=t.prototype,r.prototype=new n,r.prototype.constructor=r};be=Se});var Kn={};ki(Kn,{_extend:()=>Ie,debuglog:()=>Ln,default:()=>Iu,deprecate:()=>xe,format:()=>Cr,inherits:()=>be,inspect:()=>T,isArray:()=>$e,isBoolean:()=>Ur,isBuffer:()=>jn,isDate:()=>Mr,isError:()=>cr,isFunction:()=>yr,isNull:()=>gr,isNullOrUndefined:()=>Gn,isNumber:()=>Ee,isObject:()=>H,isPrimitive:()=>zn,isRegExp:()=>pr,isString:()=>vr,isSymbol:()=>kn,isUndefined:()=>I,log:()=>Hn});function Cr(e){if(!vr(e)){for(var r=[],t=0;t<arguments.length;t++)r.push(T(arguments[t]));return r.join(" ")}for(var t=1,n=arguments,u=n.length,a=String(e).replace(bu,function(c){if(c==="%%")return"%";if(t>=u)return c;switch(c){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(l){return"[Circular]"}default:return c}}),f=n[t];t<u;f=n[++t])gr(f)||!H(f)?a+=" "+f:a+=" "+T(f);return a}function xe(e,r){if(I(globalThis.process))return function(){return xe(e,r).apply(this,arguments)};if(sr.noDeprecation===!0)return e;var t=!1;function n(){if(!t){if(sr.throwDeprecation)throw new Error(r);sr.traceDeprecation?console.trace(r):console.error(r),t=!0}return e.apply(this,arguments)}return n}function Ln(e){if(I(we)&&(we=sr.env.NODE_DEBUG||""),e=e.toUpperCase(),!_r[e])if(new RegExp("\\b"+e+"\\b","i").test(we)){var r=0;_r[e]=function(){var t=Cr.apply(null,arguments);console.error("%s %d: %s",e,r,t)}}else _r[e]=function(){};return _r[e]}function T(e,r){var t={seen:[],stylize:Au};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),Ur(r)?t.showHidden=r:r&&Ie(t,r),I(t.showHidden)&&(t.showHidden=!1),I(t.depth)&&(t.depth=2),I(t.colors)&&(t.colors=!1),I(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=wu),Br(t,e,t.depth)}function wu(e,r){var t=T.styles[r];return t?"\x1B["+T.colors[t][0]+"m"+e+"\x1B["+T.colors[t][1]+"m":e}function Au(e,r){return e}function Ou(e){var r={};return e.forEach(function(t,n){r[t]=!0}),r}function Br(e,r,t){if(e.customInspect&&r&&yr(r.inspect)&&r.inspect!==T&&!(r.constructor&&r.constructor.prototype===r)){var n=r.inspect(t,e);return vr(n)||(n=Br(e,n,t)),n}var u=qu(e,r);if(u)return u;var a=Object.keys(r),f=Ou(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),cr(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return Ae(r);if(a.length===0){if(yr(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(pr(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(Mr(r))return e.stylize(Date.prototype.toString.call(r),"date");if(cr(r))return Ae(r)}var l="",m=!1,v=["{","}"];if($e(r)&&(m=!0,v=["[","]"]),yr(r)){var h=r.name?": "+r.name:"";l=" [Function"+h+"]"}if(pr(r)&&(l=" "+RegExp.prototype.toString.call(r)),Mr(r)&&(l=" "+Date.prototype.toUTCString.call(r)),cr(r)&&(l=" "+Ae(r)),a.length===0&&(!m||r.length==0))return v[0]+l+v[1];if(t<0)return pr(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var g;return m?g=xu(e,r,t,f,a):g=a.map(function(A){return qe(e,r,t,f,A,m)}),e.seen.pop(),$u(g,l,v)}function qu(e,r){if(I(r))return e.stylize("undefined","undefined");if(vr(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}if(Ee(r))return e.stylize(""+r,"number");if(Ur(r))return e.stylize(""+r,"boolean");if(gr(r))return e.stylize("null","null")}function Ae(e){return"["+Error.prototype.toString.call(e)+"]"}function xu(e,r,t,n,u){for(var a=[],f=0,c=r.length;f<c;++f)Jn(r,String(f))?a.push(qe(e,r,t,n,String(f),!0)):a.push("");return u.forEach(function(l){l.match(/^\d+$/)||a.push(qe(e,r,t,n,l,!0))}),a}function qe(e,r,t,n,u,a){var f,c,l;if(l=Object.getOwnPropertyDescriptor(r,u)||{value:r[u]},l.get?l.set?c=e.stylize("[Getter/Setter]","special"):c=e.stylize("[Getter]","special"):l.set&&(c=e.stylize("[Setter]","special")),Jn(n,u)||(f="["+u+"]"),c||(e.seen.indexOf(l.value)<0?(gr(t)?c=Br(e,l.value,null):c=Br(e,l.value,t-1),c.indexOf(`
|
|
2
|
-
|
|
3
|
-
`).map(function(m){return" "+m}).join(`
|
|
4
|
-
`).substr(2):c=`
|
|
5
|
-
`+c.split(`
|
|
6
|
-
`).map(function(m){return" "+m}).join(`
|
|
7
|
-
`))):c=e.stylize("[Circular]","special")),I(f)){if(a&&u.match(/^\d+$/))return c;f=JSON.stringify(""+u),f.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(f=f.substr(1,f.length-2),f=e.stylize(f,"name")):(f=f.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),f=e.stylize(f,"string"))}return f+": "+c}function $u(e,r,t){var n=0,u=e.reduce(function(a,f){return n++,f.indexOf(`
|
|
8
|
-
`)>=0&&n++,a+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return u>60?t[0]+(r===""?"":r+`
|
|
9
|
-
`)+" "+e.join(`,
|
|
10
|
-
`)+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function $e(e){return Array.isArray(e)}function Ur(e){return typeof e=="boolean"}function gr(e){return e===null}function Gn(e){return e==null}function Ee(e){return typeof e=="number"}function vr(e){return typeof e=="string"}function kn(e){return typeof e=="symbol"}function I(e){return e===void 0}function pr(e){return H(e)&&Pe(e)==="[object RegExp]"}function H(e){return typeof e=="object"&&e!==null}function Mr(e){return H(e)&&Pe(e)==="[object Date]"}function cr(e){return H(e)&&(Pe(e)==="[object Error]"||e instanceof Error)}function yr(e){return typeof e=="function"}function zn(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}function jn(e){return s.isBuffer(e)}function Pe(e){return Object.prototype.toString.call(e)}function Oe(e){return e<10?"0"+e.toString(10):e.toString(10)}function Pu(){var e=new Date,r=[Oe(e.getHours()),Oe(e.getMinutes()),Oe(e.getSeconds())].join(":");return[e.getDate(),Eu[e.getMonth()],r].join(" ")}function Hn(){console.log("%s - %s",Pu(),Cr.apply(null,arguments))}function Ie(e,r){if(!r||!H(r))return e;for(var t=Object.keys(r),n=t.length;n--;)e[t[n]]=r[t[n]];return e}function Jn(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var bu,_r,we,Eu,Iu,Qn=ne(()=>{"use strict";o();i();Un();Wn();bu=/%[sdj%]/g;_r={};T.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};T.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};Eu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Iu={inherits:be,_extend:Ie,log:Hn,isBuffer:jn,isPrimitive:zn,isFunction:yr,isError:cr,isDate:Mr,isObject:H,isRegExp:pr,isUndefined:I,isSymbol:kn,isString:vr,isNumber:Ee,isNullOrUndefined:Gn,isNull:gr,isBoolean:Ur,isArray:$e,inspect:T,deprecate:xe,format:Cr,debuglog:Ln}});var Yn=y((Np,Wr)=>{"use strict";o();i();var J=(Qn(),ji(Kn));if(J&&J.default){Wr.exports=J.default;for(let e in J)Wr.exports[e]=J[e]}else J&&(Wr.exports=J)});var Zn=y((Bp,Xn)=>{"use strict";o();i();Xn.exports=Yn().inspect});var Sr=y((Up,So)=>{"use strict";o();i();var Ue=typeof Map=="function"&&Map.prototype,Te=Object.getOwnPropertyDescriptor&&Ue?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gr=Ue&&Te&&typeof Te.get=="function"?Te.get:null,Vn=Ue&&Map.prototype.forEach,We=typeof Set=="function"&&Set.prototype,Fe=Object.getOwnPropertyDescriptor&&We?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,kr=We&&Fe&&typeof Fe.get=="function"?Fe.get:null,ro=We&&Set.prototype.forEach,Tu=typeof WeakMap=="function"&&WeakMap.prototype,dr=Tu?WeakMap.prototype.has:null,Fu=typeof WeakSet=="function"&&WeakSet.prototype,mr=Fu?WeakSet.prototype.has:null,Ru=typeof WeakRef=="function"&&WeakRef.prototype,eo=Ru?WeakRef.prototype.deref:null,Nu=Boolean.prototype.valueOf,Du=Object.prototype.toString,_u=Function.prototype.toString,Bu=String.prototype.match,Le=String.prototype.slice,U=String.prototype.replace,Mu=String.prototype.toUpperCase,to=String.prototype.toLowerCase,po=RegExp.prototype.test,no=Array.prototype.concat,F=Array.prototype.join,Cu=Array.prototype.slice,oo=Math.floor,De=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Re=Object.getOwnPropertySymbols,_e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,tr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",O=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===tr||!0)?Symbol.toStringTag:null,co=Object.prototype.propertyIsEnumerable,io=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function ao(e,r){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||po.call(/e/,r))return r;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var n=e<0?-oo(-e):oo(e);if(n!==e){var u=String(n),a=Le.call(r,u.length+1);return U.call(u,t,"$&_")+"."+U.call(U.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return U.call(r,t,"$&_")}var Be=Zn(),uo=Be.custom,fo=vo(uo)?uo:null,yo={__proto__:null,double:'"',single:"'"},Uu={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};So.exports=function e(r,t,n,u){var a=t||{};if(D(a,"quoteStyle")&&!D(yo,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(D(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=D(a,"customInspect")?a.customInspect:!0;if(typeof f!="boolean"&&f!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(D(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(D(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=a.numericSeparator;if(typeof r=="undefined")return"undefined";if(r===null)return"null";if(typeof r=="boolean")return r?"true":"false";if(typeof r=="string")return mo(r,a);if(typeof r=="number"){if(r===0)return 1/0/r>0?"0":"-0";var l=String(r);return c?ao(r,l):l}if(typeof r=="bigint"){var m=String(r)+"n";return c?ao(r,m):m}var v=typeof a.depth=="undefined"?5:a.depth;if(typeof n=="undefined"&&(n=0),n>=v&&v>0&&typeof r=="object")return Me(r)?"[Array]":"[Object]";var h=nf(a,n);if(typeof u=="undefined")u=[];else if(ho(u,r)>=0)return"[Circular]";function g(K,Ar,Gi){if(Ar&&(u=Cu.call(u),u.push(Ar)),Gi){var yt={depth:a.depth};return D(a,"quoteStyle")&&(yt.quoteStyle=a.quoteStyle),e(K,yt,n+1,u)}return e(K,a,n+1,u)}if(typeof r=="function"&&!lo(r)){var A=Ku(r),x=Lr(r,g);return"[Function"+(A?": "+A:" (anonymous)")+"]"+(x.length>0?" { "+F.call(x,", ")+" }":"")}if(vo(r)){var S=tr?U.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):_e.call(r);return typeof r=="object"&&!tr?hr(S):S}if(rf(r)){for(var q="<"+to.call(String(r.nodeName)),$=r.attributes||[],R=0;R<$.length;R++)q+=" "+$[R].name+"="+go(Wu($[R].value),"double",a);return q+=">",r.childNodes&&r.childNodes.length&&(q+="..."),q+="</"+to.call(String(r.nodeName))+">",q}if(Me(r)){if(r.length===0)return"[]";var L=Lr(r,g);return h&&!tf(L)?"["+Ce(L,h)+"]":"[ "+F.call(L,", ")+" ]"}if(Gu(r)){var ir=Lr(r,g);return!("cause"in Error.prototype)&&"cause"in r&&!co.call(r,"cause")?"{ ["+String(r)+"] "+F.call(no.call("[cause]: "+g(r.cause),ir),", ")+" }":ir.length===0?"["+String(r)+"]":"{ ["+String(r)+"] "+F.call(ir,", ")+" }"}if(typeof r=="object"&&f){if(fo&&typeof r[fo]=="function"&&Be)return Be(r,{depth:v-n});if(f!=="symbol"&&typeof r.inspect=="function")return r.inspect()}if(Qu(r)){var wr=[];return Vn&&Vn.call(r,function(K,Ar){wr.push(g(Ar,r,!0)+" => "+g(K,r))}),so("Map",Gr.call(r),wr,h)}if(Zu(r)){var st=[];return ro&&ro.call(r,function(K){st.push(g(K,r))}),so("Set",kr.call(r),st,h)}if(Yu(r))return Ne("WeakMap");if(Vu(r))return Ne("WeakSet");if(Xu(r))return Ne("WeakRef");if(zu(r))return hr(g(Number(r)));if(Hu(r))return hr(g(De.call(r)));if(ju(r))return hr(Nu.call(r));if(ku(r))return hr(g(String(r)));if(typeof window!="undefined"&&r===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&r===globalThis||typeof globalThis!="undefined"&&r===globalThis)return"{ [object globalThis] }";if(!Lu(r)&&!lo(r)){var re=Lr(r,g),pt=io?io(r)===Object.prototype:r instanceof Object||r.constructor===Object,ee=r instanceof Object?"":"null prototype",ct=!pt&&O&&Object(r)===r&&O in r?Le.call(W(r),8,-1):ee?"Object":"",Li=pt||typeof r.constructor!="function"?"":r.constructor.name?r.constructor.name+" ":"",te=Li+(ct||ee?"["+F.call(no.call([],ct||[],ee||[]),": ")+"] ":"");return re.length===0?te+"{}":h?te+"{"+Ce(re,h)+"}":te+"{ "+F.call(re,", ")+" }"}return String(r)};function go(e,r,t){var n=t.quoteStyle||r,u=yo[n];return u+e+u}function Wu(e){return U.call(String(e),/"/g,""")}function Me(e){return W(e)==="[object Array]"&&(!O||!(typeof e=="object"&&O in e))}function Lu(e){return W(e)==="[object Date]"&&(!O||!(typeof e=="object"&&O in e))}function lo(e){return W(e)==="[object RegExp]"&&(!O||!(typeof e=="object"&&O in e))}function Gu(e){return W(e)==="[object Error]"&&(!O||!(typeof e=="object"&&O in e))}function ku(e){return W(e)==="[object String]"&&(!O||!(typeof e=="object"&&O in e))}function zu(e){return W(e)==="[object Number]"&&(!O||!(typeof e=="object"&&O in e))}function ju(e){return W(e)==="[object Boolean]"&&(!O||!(typeof e=="object"&&O in e))}function vo(e){if(tr)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!_e)return!1;try{return _e.call(e),!0}catch(r){}return!1}function Hu(e){if(!e||typeof e!="object"||!De)return!1;try{return De.call(e),!0}catch(r){}return!1}var Ju=Object.prototype.hasOwnProperty||function(e){return e in this};function D(e,r){return Ju.call(e,r)}function W(e){return Du.call(e)}function Ku(e){if(e.name)return e.name;var r=Bu.call(_u.call(e),/^function\s*([\w$]+)/);return r?r[1]:null}function ho(e,r){if(e.indexOf)return e.indexOf(r);for(var t=0,n=e.length;t<n;t++)if(e[t]===r)return t;return-1}function Qu(e){if(!Gr||!e||typeof e!="object")return!1;try{Gr.call(e);try{kr.call(e)}catch(r){return!0}return e instanceof Map}catch(r){}return!1}function Yu(e){if(!dr||!e||typeof e!="object")return!1;try{dr.call(e,dr);try{mr.call(e,mr)}catch(r){return!0}return e instanceof WeakMap}catch(r){}return!1}function Xu(e){if(!eo||!e||typeof e!="object")return!1;try{return eo.call(e),!0}catch(r){}return!1}function Zu(e){if(!kr||!e||typeof e!="object")return!1;try{kr.call(e);try{Gr.call(e)}catch(r){return!0}return e instanceof Set}catch(r){}return!1}function Vu(e){if(!mr||!e||typeof e!="object")return!1;try{mr.call(e,mr);try{dr.call(e,dr)}catch(r){return!0}return e instanceof WeakSet}catch(r){}return!1}function rf(e){return!e||typeof e!="object"?!1:typeof HTMLElement!="undefined"&&e instanceof HTMLElement?!0:typeof e.nodeName=="string"&&typeof e.getAttribute=="function"}function mo(e,r){if(e.length>r.maxStringLength){var t=e.length-r.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return mo(Le.call(e,0,r.maxStringLength),r)+n}var u=Uu[r.quoteStyle||"single"];u.lastIndex=0;var a=U.call(U.call(e,u,"\\$1"),/[\x00-\x1f]/g,ef);return go(a,"single",r)}function ef(e){var r=e.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return t?"\\"+t:"\\x"+(r<16?"0":"")+Mu.call(r.toString(16))}function hr(e){return"Object("+e+")"}function Ne(e){return e+" { ? }"}function so(e,r,t,n){var u=n?Ce(t,n):F.call(t,", ");return e+" ("+r+") {"+u+"}"}function tf(e){for(var r=0;r<e.length;r++)if(ho(e[r],`
|
|
11
|
-
`)>=0)return!1;return!0}function nf(e,r){var t;if(e.indent===" ")t=" ";else if(typeof e.indent=="number"&&e.indent>0)t=F.call(Array(e.indent+1)," ");else return null;return{base:t,prev:F.call(Array(r+1),t)}}function Ce(e,r){if(e.length===0)return"";var t=`
|
|
12
|
-
`+r.prev+r.base;return t+F.call(e,","+t)+`
|
|
13
|
-
`+r.prev}function Lr(e,r){var t=Me(e),n=[];if(t){n.length=e.length;for(var u=0;u<e.length;u++)n[u]=D(e,u)?r(e[u],e):""}var a=typeof Re=="function"?Re(e):[],f;if(tr){f={};for(var c=0;c<a.length;c++)f["$"+a[c]]=a[c]}for(var l in e)D(e,l)&&(t&&String(Number(l))===l&&l<e.length||tr&&f["$"+l]instanceof Symbol||(po.call(/[^\w$]/,l)?n.push(r(l,e)+": "+r(e[l],e)):n.push(l+": "+r(e[l],e))));if(typeof Re=="function")for(var m=0;m<a.length;m++)co.call(e,a[m])&&n.push("["+r(a[m])+"]: "+r(e[a[m]],e));return n}});var zr=y((Gp,bo)=>{"use strict";o();i();bo.exports=function(r){return typeof r=="string"||typeof r=="symbol"}});var Ao=y((jp,wo)=>{"use strict";o();i();var of=w(),af=Sr(),uf=zr();wo.exports=function(r,t){if(!uf(t))throw new of("Assertion failed: IsPropertyKey(P) is not true, got "+af(t));return r[t]}});var $o=y((Kp,xo)=>{"use strict";o();i();var qo=Function.prototype.toString,nr=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ke,jr;if(typeof nr=="function"&&typeof Object.defineProperty=="function")try{ke=Object.defineProperty({},"length",{get:function(){throw jr}}),jr={},nr(function(){throw 42},null,ke)}catch(e){e!==jr&&(nr=null)}else nr=null;var ff=/^\s*class\b/,ze=function(r){try{var t=qo.call(r);return ff.test(t)}catch(n){return!1}},Ge=function(r){try{return ze(r)?!1:(qo.call(r),!0)}catch(t){return!1}},Hr=Object.prototype.toString,lf="[object Object]",sf="[object Function]",pf="[object GeneratorFunction]",cf="[object HTMLAllCollection]",yf="[object HTML document.all class]",gf="[object HTMLCollection]",vf=typeof Symbol=="function"&&!!Symbol.toStringTag,hf=!(0 in[,]),je=function(){return!1};typeof document=="object"&&(Oo=document.all,Hr.call(Oo)===Hr.call(document.all)&&(je=function(r){if((hf||!r)&&(typeof r=="undefined"||typeof r=="object"))try{var t=Hr.call(r);return(t===cf||t===yf||t===gf||t===lf)&&r("")==null}catch(n){}return!1}));var Oo;xo.exports=nr?function(r){if(je(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;try{nr(r,null,ke)}catch(t){if(t!==jr)return!1}return!ze(r)&&Ge(r)}:function(r){if(je(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;if(vf)return Ge(r);if(ze(r))return!1;var t=Hr.call(r);return t!==sf&&t!==pf&&!/^\[object HTML/.test(t)?!1:Ge(r)}});var He=y((Xp,Eo)=>{"use strict";o();i();Eo.exports=$o()});var Fo=y((rc,To)=>{"use strict";o();i();var Po=w(),df=Ao(),mf=He(),Sf=zr(),Io=Sr();To.exports=function(r,t){if(!Sf(t))throw new Po("Assertion failed: IsPropertyKey(P) is not true");var n=df(r,t);if(n!=null){if(!mf(n))throw new Po(Io(t)+" is not a function: "+Io(n));return n}}});var No=y((nc,Ro)=>{"use strict";o();i();var bf=ie();Ro.exports=function(){return bf()&&!!Symbol.toStringTag}});var Ye=y((ac,Mo)=>{"use strict";o();i();var Je=P(),Do=No()(),_o,Bo,Ke,Qe;Do&&(_o=Je("Object.prototype.hasOwnProperty"),Bo=Je("RegExp.prototype.exec"),Ke={},Jr=function(){throw Ke},Qe={toString:Jr,valueOf:Jr},typeof Symbol.toPrimitive=="symbol"&&(Qe[Symbol.toPrimitive]=Jr));var Jr,wf=Je("Object.prototype.toString"),Af=Object.getOwnPropertyDescriptor,Of="[object RegExp]";Mo.exports=Do?function(r){if(!r||typeof r!="object")return!1;var t=Af(r,"lastIndex"),n=t&&_o(t,"value");if(!n)return!1;try{Bo(r,Qe)}catch(u){return u===Ke}}:function(r){return!r||typeof r!="object"&&typeof r!="function"?!1:wf(r)===Of}});var Xe=y((lc,Co)=>{"use strict";o();i();var qf=P(),xf=Ye(),$f=qf("RegExp.prototype.exec"),Ef=w();Co.exports=function(r){if(!xf(r))throw new Ef("`regex` must be a RegExp");return function(n){return $f(r,n)!==null}}});var Wo=y((cc,Uo)=>{"use strict";o();i();Uo.exports=function(r,t){for(var n=0;n<r.length;n+=1)if(!t(r[n],n,r))return!1;return!0}});var Go=y((vc,Lo)=>{"use strict";o();i();Lo.exports=function(r){if(r===null)return"Null";if(typeof r=="undefined")return"Undefined";if(typeof r=="function"||typeof r=="object")return"Object";if(typeof r=="number")return"Number";if(typeof r=="boolean")return"Boolean";if(typeof r=="string")return"String"}});var Ze=y((mc,ko)=>{"use strict";o();i();var Pf=Go();ko.exports=function(r){return typeof r=="symbol"?"Symbol":typeof r=="bigint"?"BigInt":Pf(r)}});var Ho=y((wc,jo)=>{"use strict";o();i();var zo=w(),If=Sr(),Tf=zr(),Ff=Ze();jo.exports=function(r,t){if(Ff(r)!=="Object")throw new zo("Assertion failed: Type(O) is not Object");if(!Tf(t))throw new zo("Assertion failed: IsPropertyKey(P) is not true, got "+If(t));return r[t]}});var Ko=y((qc,Jo)=>{"use strict";o();i();var Rf=E();Jo.exports=Rf("%Math.min%")});var Ve=y((Ec,Qo)=>{"use strict";o();i();Qo.exports=Number.isNaN||function(r){return r!==r}});var Xo=y((Tc,Yo)=>{"use strict";o();i();var Nf=Ve();Yo.exports=function(e){return(typeof e=="number"||typeof e=="bigint")&&!Nf(e)&&e!==1/0&&e!==-1/0}});var Kr=y((Nc,Vo)=>{"use strict";o();i();var Zo=E(),Df=Zo("%Math.abs%"),_f=Zo("%Math.floor%"),Bf=Ve(),Mf=Xo();Vo.exports=function(r){if(typeof r!="number"||Bf(r)||!Mf(r))return!1;var t=Df(r);return _f(t)===t}});var et=y((Bc,ri)=>{"use strict";o();i();var Cf=P(),rt=w(),Uf=Kr(),Wf=Cf("String.prototype.slice");ri.exports=function(r,t,n){if(typeof r!="string")throw new rt("Assertion failed: `string` must be a String");if(typeof t!="string")throw new rt("Assertion failed: `searchValue` must be a String");if(!Uf(n)||n<0)throw new rt("Assertion failed: `fromIndex` must be a non-negative integer");var u=r.length;if(t===""&&n<=u)return n;for(var a=t.length,f=n;f<=u-a;f+=1){var c=Wf(r,f,f+a);if(c===t)return f}return-1}});var Qr=y((Uc,ei)=>{"use strict";o();i();var Lf=w();ei.exports=function(r){if(r==null)throw new Lf(arguments.length>0&&arguments[1]||"Cannot call method on "+r);return r}});var Yr=y((Gc,ti)=>{"use strict";o();i();var Gf=E(),kf=Gf("%String%"),zf=w();ti.exports=function(r){if(typeof r=="symbol")throw new zf("Cannot convert a Symbol value to a string");return kf(r)}});var tt=y((jc,ii)=>{"use strict";o();i();var jf=Qr(),Hf=Yr(),Jf=P(),ni=Jf("String.prototype.replace"),oi=/^\s$/.test("\u180E"),Kf=oi?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,Qf=oi?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;ii.exports=function(){var r=Hf(jf(this));return ni(ni(r,Kf,""),Qf,"")}});var nt=y((Kc,ui)=>{"use strict";o();i();var Yf=tt(),ai="\u200B",or="\u180E";ui.exports=function(){return String.prototype.trim&&ai.trim()===ai&&or.trim()===or&&("_"+or).trim()==="_"+or&&(or+"_").trim()===or+"_"?String.prototype.trim:Yf}});var li=y((Xc,fi)=>{"use strict";o();i();var Xf=lr(),Zf=nt();fi.exports=function(){var r=Zf();return Xf(String.prototype,{trim:r},{trim:function(){return String.prototype.trim!==r}}),r}});var yi=y((ry,ci)=>{"use strict";o();i();var Vf=Fr(),rl=lr(),el=Qr(),tl=tt(),si=nt(),nl=li(),ol=Vf(si()),pi=function(r){return el(r),ol(r)};rl(pi,{getPolyfill:si,implementation:tl,shim:nl});ci.exports=pi});var di=y((ny,hi)=>{"use strict";o();i();var it=E(),ot=it("%Number%"),il=it("%RegExp%"),al=w(),gi=it("%parseInt%"),ul=P(),Xr=Xe(),vi=ul("String.prototype.slice"),fl=Xr(/^0b[01]+$/i),ll=Xr(/^0o[0-7]+$/i),sl=Xr(/^[-+]0x[0-9a-f]+$/i),pl=["\x85","\u200B","\uFFFE"].join(""),cl=new il("["+pl+"]","g"),yl=Xr(cl),gl=yi();hi.exports=function e(r){if(typeof r!="string")throw new al("Assertion failed: `argument` is not a String");if(fl(r))return ot(gi(vi(r,2),2));if(ll(r))return ot(gi(vi(r,2),8));if(yl(r)||sl(r))return NaN;var t=gl(r);return t!==r?e(t):ot(r)}});var bi=y((ay,Si)=>{"use strict";o();i();var vl=w(),mi=Kr(),hl=P(),dl=hl("String.prototype.slice");Si.exports=function(r,t,n){if(typeof r!="string"||!mi(t)||arguments.length>2&&!mi(n))throw new vl("`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers");return dl(r,t,arguments.length>2?n:r.length)}});var Ai=y((ly,wi)=>{"use strict";o();i();wi.exports=function(r){return typeof r=="string"||typeof r=="undefined"}});var qi=y((cy,Oi)=>{"use strict";o();i();var ml=P()("String.prototype.slice");Oi.exports=function(r,t){return r===t?!0:r.length>t.length?!1:ml(t,0,r.length)===r}});var Ii=y((vy,Pi)=>{"use strict";o();i();var _=w(),Ei=Xe(),Sl=Wo(),at=Sr(),bl=Ho(),wl=me(),Al=Ko(),Ol=et(),xi=di(),B=bi(),ql=Yr(),$i=Ze(),xl=Kr(),$l=Ai(),br=qi(),El=Ei(/^\$[0-9]/),Pl=Ei(/^\$[0-9][0-9]/);Pi.exports=function(r,t,n,u,a,f){if(typeof r!="string")throw new _("Assertion failed: `matched` must be a String");if(typeof t!="string")throw new _("Assertion failed: `str` must be a String");if(!xl(n)||n<0)throw new _("Assertion failed: `position` must be a nonnegative integer, got "+at(n));if(!wl(u)||!Sl(u,$l))throw new _("Assertion failed: `captures` must be a possibly-empty List of Strings or `undefined`, got "+at(u));if(typeof a!="undefined"&&$i(a)!=="Object")throw new _("Assertion failed: `namedCaptures` must be `undefined` or an Object");if(typeof f!="string")throw new _("Assertion failed: `replacementTemplate` must be a String");var c=t.length;if(n>c)throw new _("Assertion failed: position > stringLength, got "+at(n));for(var l=f,m="";l!=="";){var v,h,g;if(br("$$",l))v="$$",h="$";else if(br("$`",l))v="$`",h=B(t,0,n);else if(br("$&",l))v="$&",h=r;else if(br("$'",l)){v="$'";var A=r.length,x=n+A;h=B(t,Al(x,c))}else if(El(l)){var S=Pl(l)?2:1,q=B(l,1,1+S),$=xi(q);if($<0||$>99)throw new _("Assertion failed: `index` must be >= 0 and <= 99");var R=u.length;$>R&&S===2&&(S=1,q=B(q,0,1),$=xi(q)),v=B(l,0,1+S),1<=$&&$<=R?(g=u[$-1],typeof g=="undefined"?h="":h=g):h=v}else if(br("$<",l)){var L=Ol(l,">",0);if(L===-1||typeof a=="undefined")v="$<",h=v;else{v=B(l,0,L+1);var ir=B(l,2,L);if($i(a)!=="Object")throw new _("Assertion failed: Type(namedCaptures) is not Object");g=bl(a,ir),typeof g=="undefined"?h="":h=ql(g)}}else v=B(l,0,1),h=v;var wr=v.length;l=B(l,wr),m+=h}return m}});var ft=y((my,Ni)=>{"use strict";o();i();var Ti=Nn(),Il=Fo(),Tl=Ii(),Fl=He(),Rl=Qr(),Zr=Yr(),Fi=et(),Nl=E(),Vr=P(),Dl=ae()(),_l=Ye(),Bl=Nl("%Math.max%"),Ri=w(),Ml=Vr("Array.prototype.push"),ut=Vr("String.prototype.slice"),Cl=Vr("String.prototype.indexOf"),Ul=Vr("String.prototype.replace");Ni.exports=function(r,t){var n=Rl(this),u=_l(r);if(u&&Cl(ut(r,r.source.length+2),"g")===-1)throw new Ri("use .replace for a non-global regex. NOTE: this may be allowed in the future.");if(Dl&&Symbol.replace){if(r!=null){var a=Il(r,Symbol.replace);if(typeof a!="undefined")return Ti(a,r,[n,t])}}else if(u)return Ul(n,r,t);var f=Zr(n),c=Zr(r),l=Fl(t);l||(t=Zr(t));for(var m=c.length,v=Bl(1,m),h=[],g=Fi(f,c,0);g!==-1;)Ml(h,g),g=Fi(f,c,g+v);for(var A=0,x="",S=0;S<h.length;S+=1){var q;if(l)q=Zr(Ti(t,void 0,[c,h[S],f]));else{if(typeof t!="string")throw new Ri("Assertion failed: `replaceValue` should be a string at this point");var $=[];q=Tl(c,f,h[S],$,void 0,t)}var R=ut(f,A,h[S]);x+=R+q,A=h[S]+m}return A<f.length&&(x+=ut(f,A)),x}});var lt=y((wy,Di)=>{"use strict";o();i();var Wl=ft();Di.exports=function(){return String.prototype.replaceAll||Wl}});var Bi=y((qy,_i)=>{"use strict";o();i();var Ll=lr(),Gl=lt();_i.exports=function(){var r=Gl();return Ll(String.prototype,{replaceAll:r},{replaceAll:function(){return String.prototype.replaceAll!==r}}),r}});var Wi=y((Ey,Ui)=>{"use strict";o();i();var kl=Fr(),zl=lr(),Mi=ft(),jl=lt(),Hl=Bi(),Ci=kl(Mi);zl(Ci,{getPolyfill:jl,implementation:Mi,shim:Hl});Ui.exports=Ci});o();i();var Ty=zi(Wi(),1);export{Hi as DynamicSnippetsGenerator};
|
|
1
|
+
import{a as n}from"./chunk-BI26DLZ5.js";import"./chunk-D6NMQKNQ.js";import"./chunk-UZEM7EUP.js";import"./chunk-FD44EP2P.js";import"./chunk-VCNL2JWU.js";import"./chunk-Q6YO7G6Y.js";import"./chunk-2YRGTA73.js";import{f as e,g as r}from"./chunk-GUJUKQKZ.js";e();r();export{n as DynamicSnippetsGenerator};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { DynamicSnippetsGenerator } from \"./DynamicSnippetsGenerator\";\n"],"mappings":"+PAAAA,IAAAC","names":["init_process","init_buffer"]}
|
package/package.json
CHANGED
package/esm/chunk-5HP3T45N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-SS6XZXHU.js";import{c as a}from"./chunk-J745U74Q.js";import{a as m}from"./chunk-D3UUM672.js";import{a as s}from"./chunk-I3VUX77R.js";import{j as r,k as i,m as o,p,q as t}from"./chunk-TUE3DOHS.js";i();o();var u=class f extends a{constructor({ir:e,config:n}){super({ir:e,config:n});r(this,"ir");r(this,"customConfig");r(this,"dynamicTypeMapper");r(this,"dynamicTypeInstantiationMapper");r(this,"filePropertyMapper");r(this,"rootImportPath");this.ir=e,this.customConfig=n.customConfig!=null?n.customConfig:void 0,this.dynamicTypeMapper=new m({context:this}),this.dynamicTypeInstantiationMapper=new c({context:this}),this.filePropertyMapper=new s({context:this}),this.rootImportPath=p({config:n,customConfig:this.customConfig})}clone(){return new f({ir:this.ir,config:this.config})}getMethodName(e){return e.pascalCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getImportPath(e){let n=e.packagePath.map(g=>g.pascalCase.unsafeName.toLowerCase());return[this.rootImportPath,...n].join("/")}getContextTypeReference(){return t.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return t.invokeFunc({func:t.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return t.typeReference({name:"Reader",importPath:"io"})}getNewStringsReaderFunctionInvocation(e){return t.invokeFunc({func:t.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[t.TypeInstantiation.string(e)]})}getClientConstructorName(){var e;return((e=this.customConfig)==null?void 0:e.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:"NewClient"}getClientImportPath(){return`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:e}){return t.typeReference({name:e.name.pascalCase.unsafeName,importPath:this.getImportPath(e.fernFilepath)})}getEnvironmentTypeReferenceFromID(e){let n=this.resolveEnvironmentName(e);if(n!=null)return this.getEnvironmentTypeReference(n)}getEnvironmentTypeReference(e){return t.typeReference({name:`Environments.${this.getTypeName(e)}`,importPath:this.rootImportPath})}};export{u as a};
|
package/esm/chunk-D3UUM672.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as c,k as i,m as p,n,q as e}from"./chunk-TUE3DOHS.js";i();p();var a=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return e.Type.slice(this.convert({typeReference:t.typeReference}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return e.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return r==null?this.convertUnknown():this.convertNamed({named:r})}case"optional":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"nullable":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return e.Type.slice(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:n(t.typeReference)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return e.Type.bool();case"string":return e.Type.string()}}convertNamed({named:t}){let r=e.Type.reference(e.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}));switch(t.type){case"alias":case"enum":return r;case"discriminatedUnion":case"object":case"undiscriminatedUnion":return e.Type.pointer(r);default:n(t)}}convertUnknown(){return e.Type.any()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return e.Type.int();case"UINT":return e.Type.int();case"LONG":return e.Type.int64();case"UINT_64":return e.Type.int64();case"FLOAT":return e.Type.float64();case"DOUBLE":return e.Type.float64();case"BOOLEAN":return e.Type.bool();case"STRING":return e.Type.string();case"DATE":return e.Type.date();case"DATE_TIME":return e.Type.dateTime();case"UUID":return e.Type.uuid();case"BASE_64":return e.Type.bytes();case"BIG_INTEGER":return e.Type.string();default:n(t)}}};export{a};
|
package/esm/chunk-I3VUX77R.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as p,k as s,m as y,n as l,q as n}from"./chunk-TUE3DOHS.js";s();y();var c=class{constructor({context:t}){p(this,"context");this.context=t}getFilePropertyInfo({body:t,value:o}){var a;let e={fileFields:[],bodyPropertyFields:[]},i=(a=this.context.getRecord(o))!=null?a:{};for(let r of t.properties)switch(r.type){case"file":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getSingleFileProperty({property:r,record:i})});break;case"fileArray":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getArrayFileProperty({property:r,record:i})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getTypeName(r.name.name),value:this.getBodyProperty({property:r,record:i})});break;default:l(r)}return e}getSingleFileProperty({property:t,record:o}){let e=this.context.getSingleFileValue({property:t,record:o});return e==null?n.TypeInstantiation.nop():n.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(e))}getArrayFileProperty({property:t,record:o}){let e=this.context.getFileArrayValues({property:t,record:o});return e==null?n.TypeInstantiation.nop():n.TypeInstantiation.slice({valueType:n.Type.reference(this.context.getIoReaderTypeReference()),values:e.map(i=>n.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:t,record:o}){let e=o[t.name.wireValue];return e==null?n.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:e})}};export{c as a};
|
package/esm/chunk-J745U74Q.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as P,b as T,c as b,d as A,j as o,k as a,m as p,n as f,o as g}from"./chunk-TUE3DOHS.js";a();p();var E=class{constructor(e){o(this,"context");this.context=e}};a();p();var n={Critical:"CRITICAL",Warning:"WARNING"},y=class h{constructor(){o(this,"errors");o(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new h;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};a();p();a();p();a();p();var v=class{constructor(){o(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var R=class{constructor({ir:e,config:r}){o(this,"config");o(this,"errors");o(this,"_ir");o(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.errors=new y,this.httpEndpointReferenceParser=new v}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let l=e.find(m=>m.name.wireValue===i);if(l==null)throw this.newParameterNotRecognizedError(i);let c=this.isListTypeReference(l.typeReference)&&!Array.isArray(s)?[s]:s;t.push({name:l.name,typeReference:l.typeReference,value:c})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let i=[];for(let[s,l]of Object.entries(r)){this.errors.scope(s);try{let c=e.find(m=>m.name.wireValue===s);if(c==null){if(t)continue;this.errors.add({severity:n.Critical,message:this.newParameterNotRecognizedError(s).message});continue}i.push({name:c.name,typeReference:c.typeReference,value:l})}finally{this.errors.unscope()}}return i}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:n.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:n.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let i=[];for(let s of t){if(typeof s!="string"){this.errors.add({severity:n.Critical,message:`Expected file array value to be an array of strings, got ${typeof s}`});return}i.push(s)}return i}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:n.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:n.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let i=e.discriminant.wireValue,s=t[i];if(s==null){this.errors.add({severity:n.Critical,message:this.newParameterNotRecognizedError(i).message});return}if(typeof s!="string"){this.errors.add({severity:n.Critical,message:`Expected discriminant value to be a string but got: ${typeof s}`});return}let l=e.types[s];if(l==null){this.errors.add({severity:n.Critical,message:`No type found for discriminant value "${s}"`});return}let x=t,{[i]:c}=x,m=A(x,[b(i)]);return{singleDiscriminatedUnionType:l,discriminantValue:l.discriminantValue,value:m}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocationOrThrow(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var i;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((i=e.metadata)!=null&&i.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,i;return r&&((i=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?i:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:f(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(i=>i.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(i=>i.id===e);return t==null?void 0:t.name}default:f(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:n.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:n.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:n.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let i=new Set(g(t.urls));for(let s of g(e))i.has(s)&&i.delete(s);return i.size>0?(this.errors.add({severity:n.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${g(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:n.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:n.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:n.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:f(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:f(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:f(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};a();p();var w=class{constructor(){o(this,"reporter");o(this,"snippet");o(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}};a();p();var S={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};a();p();export{E as a,n as b,R as c,w as d,S as e};
|
package/esm/chunk-SS6XZXHU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as c}from"./chunk-J745U74Q.js";import{j as p,k as l,m as d,n as s,q as i}from"./chunk-TUE3DOHS.js";l();d();var y=class{constructor({context:e}){p(this,"context");this.context=e}convert(e){if(e.value===null&&!this.context.isNullable(e.typeReference)&&this.context.errors.add({severity:c.Critical,message:"Expected non-null value, but got null"}),e.value==null)return i.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return i.TypeInstantiation.nop();case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?i.TypeInstantiation.nop():this.convertNamed({named:n,value:e.value,as:e.as})}case"nullable":return i.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"optional":return i.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertList({list:e.typeReference.value,value:e.value});case"unknown":return this.convertUnknown({value:e.value});default:s(e.typeReference)}}convertList({list:e,value:n}){return Array.isArray(n)?i.TypeInstantiation.slice({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:n.map((r,t)=>{this.context.errors.scope({index:t});try{return this.convert({typeReference:e,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof n}`}),i.TypeInstantiation.nop())}convertMap({map:e,value:n}){return typeof n!="object"||n==null?(this.context.errors.add({severity:c.Critical,message:`Expected object but got: ${n==null?"null":typeof n}`}),i.TypeInstantiation.nop()):i.TypeInstantiation.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(n).map(([r,t])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:e.key,value:r,as:"key"}),value:this.convert({typeReference:e.value,value:t})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:n,as:r}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:n,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:n});case"enum":return this.convertEnum({enum_:e,value:n});case"object":return this.convertObject({object_:e,value:n});case"undiscriminatedUnion":return this.convertUndicriminatedUnion({undicriminatedUnion:e,value:n});default:s(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:n}){let r=this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),t=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:n});if(t==null)return i.TypeInstantiation.nop();let a=t.singleDiscriminatedUnionType,o=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:a});switch(a.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:a.typeId});return u==null?i.TypeInstantiation.nop():i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(a.discriminantValue.name),value:this.convertNamed({named:u,value:t.value})},...o]})}case"singleProperty":{let u=this.context.getRecord(t.value);if(u==null)return i.TypeInstantiation.nop();try{return this.context.errors.scope(a.discriminantValue.wireValue),i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(a.discriminantValue.name),value:this.convert({typeReference:a.typeReference,value:u[a.discriminantValue.wireValue]})},...o]})}finally{this.context.errors.unscope()}}case"noProperties":return i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(t.discriminantValue.name),value:i.TypeInstantiation.string(a.discriminantValue.wireValue)},...o]});default:s(a)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:n}){var t,a;return this.context.associateByWireValue({parameters:(t=n.properties)!=null?t:[],values:(a=this.context.getRecord(e.value))!=null?a:{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getTypeName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:n}){var t;let r=this.context.associateByWireValue({parameters:e.properties,values:(t=this.context.getRecord(n))!=null?t:{}});return i.TypeInstantiation.structPointer({typeReference:i.typeReference({name:this.context.getTypeName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:r.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getTypeName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:n}){let r=this.getEnumValueName({enum_:e,value:n});return r==null?i.TypeInstantiation.nop():i.TypeInstantiation.enum(i.typeReference({name:r,importPath:this.context.getImportPath(e.declaration.fernFilepath)}))}getEnumValueName({enum_:e,value:n}){if(typeof n!="string"){this.context.errors.add({severity:c.Critical,message:`Expected enum value string, got: ${typeof n}`});return}let r=e.values.find(t=>t.wireValue===n);if(r==null){this.context.errors.add({severity:c.Critical,message:`An enum value named "${n}" does not exist in this context`});return}return`${this.context.getTypeName(e.declaration.name)}${this.context.getTypeName(r.name)}`}convertUndicriminatedUnion({undicriminatedUnion:e,value:n}){let r=this.findMatchingUndiscriminatedUnionType({undicriminatedUnion:e,value:n});if(r==null)return i.TypeInstantiation.nop();let t=this.getUndiscriminatedUnionFieldName({typeReference:r.valueTypeReference});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.structPointer({typeReference:this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),fields:[{name:t,value:r.typeInstantiation}]})}findMatchingUndiscriminatedUnionType({undicriminatedUnion:e,value:n}){for(let r of e.types)try{let t=this.convert({typeReference:r,value:n});return{valueTypeReference:r,typeInstantiation:t}}catch(t){continue}this.context.errors.add({severity:c.Critical,message:`None of the types in the undicriminated union matched the given "${typeof n}" value`})}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let n=this.context.resolveNamedType({typeId:e.value});return n==null?void 0:this.context.getTypeName(n.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:s(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}List`}getUndiscriminatedUnionFieldNameForMap({map:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(n==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`${n}${r}Map`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}Optional`}getUndiscriminatedUnionFieldNameForSet({set:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}Set`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){switch(e.type){case"boolean":return e.value?"TrueLiteral":"FalseLiteral";case"string":return`${e.value}StringLiteral`;default:s(e)}}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:s(e)}}convertUnknown({value:e}){return i.TypeInstantiation.any(e)}convertPrimitive({primitive:e,value:n,as:r}){switch(e){case"INTEGER":case"UINT":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.int(t)}case"LONG":case"UINT_64":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.int64(t)}case"FLOAT":case"DOUBLE":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.float64(t)}case"BOOLEAN":{let t=this.getValueAsBoolean({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.bool(t)}case"STRING":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.string(t)}case"DATE":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.date(t)}case"DATE_TIME":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.dateTime(t)}case"UUID":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.uuid(t)}case"BASE_64":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.bytes(t)}case"BIG_INTEGER":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.string(t)}default:s(e)}}getValueAsNumber({value:e,as:n}){let r=n==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:n}){let r=n==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};export{y as a};
|