@fern-api/ruby-dynamic-snippets 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-DC7MOL5X.js";import"../chunk-WLYQ7USA.js";import"../chunk-RKBBW5DU.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-55CMLIMK.js";import"../chunk-BFNNFVSX.js";import"../chunk-SFFHNMMU.js";export{a as DynamicSnippetsGeneratorContext};
2
2
  //# sourceMappingURL=DynamicSnippetsGeneratorContext.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-WLYQ7USA.js";import"../chunk-RKBBW5DU.js";export{a as DynamicTypeLiteralMapper};
1
+ import{a}from"../chunk-BFNNFVSX.js";import"../chunk-SFFHNMMU.js";export{a as DynamicTypeLiteralMapper};
2
2
  //# sourceMappingURL=DynamicToLiteralMapper.js.map
package/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-NOLMTKNR.js";import"./chunk-HW2BPM3B.js";import"./chunk-DC7MOL5X.js";import"./chunk-WLYQ7USA.js";import{b as e,c as r}from"./chunk-RKBBW5DU.js";e();r();export{n as DynamicSnippetsGenerator};
1
+ import{a as n}from"./chunk-SBHABCSD.js";import"./chunk-M3XXD3D4.js";import"./chunk-55CMLIMK.js";import"./chunk-BFNNFVSX.js";import{b as e,c as r}from"./chunk-SFFHNMMU.js";e();r();export{n as DynamicSnippetsGenerator};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/ruby-dynamic-snippets",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",
@@ -1,2 +0,0 @@
1
- import{a as u,b as c,c as m,d as o,f as d,h as n}from"./chunk-RKBBW5DU.js";c();m();var y="client",l=class{constructor({context:e,formatter:t}){u(this,"context");u(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t}){var a;return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:(a=this.context.customConfig)!=null?a:{},formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t}){var a;return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:(a=this.context.customConfig)!=null?a:{},formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),r.newLine(),r.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})}constructClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.addRequire(this.context.getRootModuleName().toLowerCase());let a=this.context.getRootClientClassReference(),s=this.getRootClientBuilderArgs({endpoint:e,snippet:t});r.write(`${y} = `),r.writeNode(n.instantiateClass({classReference:a,arguments_:s}))})}getRootClientBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null)return this.context.errors.add({severity:"CRITICAL",message:"Cannot specify both baseUrl and environment options"}),[];if(e!=null)return[n.keywordArgument({name:"base_url",value:n.TypeLiteral.string(e)})];if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);return r==null?(this.context.errors.add({severity:"CRITICAL",message:`Environment ID ${t} not found`}),[]):[n.keywordArgument({name:"environment",value:r})]}if(this.context.isMultiEnvironmentValues(t))return this.context.errors.add({severity:"CRITICAL",message:"Multi-environment values are not supported in Ruby snippets yet"}),[]}return[]}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("Ruby SDK does not support inferred auth yet"),[];default:o(e)}}addError(e){this.context.errors.add({severity:d.Critical,message:e})}addWarning(e){this.context.errors.add({severity:d.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[n.keywordArgument({name:e.username.snakeCase.safeName,value:n.TypeLiteral.string(t.username)}),n.keywordArgument({name:e.password.snakeCase.safeName,value:n.TypeLiteral.string(t.password)})]}getRootClientBearerAuthArgs({auth:e,values:t}){return[n.keywordArgument({name:e.token.snakeCase.safeName,value:n.TypeLiteral.string(t.token)})]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[n.keywordArgument({name:e.header.name.name.snakeCase.safeName,value:n.TypeLiteral.string(t.value)})]}getRootClientOAuthArgs({auth:e,values:t}){return[n.keywordArgument({name:e.clientId.snakeCase.safeName,value:n.TypeLiteral.string(t.clientId)}),n.keywordArgument({name:e.clientSecret.snakeCase.safeName,value:n.TypeLiteral.string(t.clientSecret)})]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let s=t[a.name.name.originalName];s!=null&&typeof s=="string"&&r.push(n.keywordArgument({name:a.name.name.snakeCase.safeName,value:n.TypeLiteral.string(s)}))}return r}getRootClientBuilderArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:"WARNING",message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&r.push(...a),this.context.errors.scope("Headers"),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r}callMethod({endpoint:e,snippet:t}){let r={on:n.codeblock(y),method:this.getMethod({endpoint:e}),arguments_:[]};switch(e.request.type){case"inlined":r.keywordArguments=this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});break;case"body":r.arguments_=this.getMethodArgsForBodyRequest({request:e.request,snippet:t});break;default:o(e.request)}return n.invokeMethod(r)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[];if(r.push(...this.getNamedParameterArgs({kind:"PathParameters",namedParameters:e.pathParameters,values:t.pathParameters})),r.push(...this.getNamedParameterArgs({kind:"QueryParameters",namedParameters:e.queryParameters,values:t.queryParameters})),r.push(...this.getNamedParameterArgs({kind:"Headers",namedParameters:e.headers,values:t.headers})),e.body!=null)switch(e.body.type){case"properties":r.push(...this.getMethodArgsForPropertiesRequest({request:e.body,snippet:t}));break;case"referenced":case"fileUpload":break;default:o(e.body)}return r}getNamedParameterArgs({kind:e,namedParameters:t,values:r}){let a=[];if(this.context.errors.scope(e),t!=null){let s=this.context.associateByWireValue({parameters:t,values:r!=null?r:{},ignoreMissingParameters:!0});for(let i of s)a.push(n.keywordArgument({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)}))}return this.context.errors.unscope(),a}getMethodArgsForPropertiesRequest({request:e,snippet:t}){var s;let r=[],a=this.context.associateByWireValue({parameters:e.value,values:(s=this.context.getRecord(t.requestBody))!=null?s:{}});for(let i of a)r.push(n.keywordArgument({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)}));return r}getMethodArgsForBodyRequest({request:e,snippet:t}){var a;let r=[];if(this.context.errors.scope("PathParameters"),e.pathParameters!=null){let s=this.context.associateByWireValue({parameters:e.pathParameters,values:(a=t.pathParameters)!=null?a:{},ignoreMissingParameters:!0});for(let i of s)r.push(n.positionalArgument({value:this.context.dynamicTypeLiteralMapper.convert(i)}))}if(this.context.errors.unscope(),e.body!=null)switch(e.body.type){case"bytes":this.context.errors.add({severity:"CRITICAL",message:"Bytes request body is not supported in Ruby snippets yet"});break;case"typeReference":r.push(n.positionalArgument({value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.body.value,value:this.context.getRecord(t.requestBody)})}));break;default:o(e.body)}return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};export{l as a};
2
- //# sourceMappingURL=chunk-HW2BPM3B.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractFormatter, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { ruby } from \"@fern-api/ruby-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\n\nconst CLIENT_VAR_NAME = \"client\";\n\nexport class EndpointSnippetGenerator {\n private context: DynamicSnippetsGeneratorContext;\n private formatter: AbstractFormatter | undefined;\n\n constructor({ context, formatter }: { context: DynamicSnippetsGeneratorContext; formatter?: AbstractFormatter }) {\n this.context = context;\n this.formatter = formatter;\n }\n\n public async generateSnippet({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): Promise<string> {\n const code = this.buildCodeBlock({ endpoint, snippet: request });\n return await code.toStringAsync({\n customConfig: this.context.customConfig ?? {},\n formatter: this.formatter\n });\n }\n\n public generateSnippetSync({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): string {\n const code = this.buildCodeBlock({ endpoint, snippet: request });\n return code.toString({\n customConfig: this.context.customConfig ?? {},\n formatter: this.formatter\n });\n }\n\n private buildCodeBlock({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.AstNode {\n // In Ruby, concise and full styles are the same\n return ruby.codeblock((writer) => {\n writer.writeNodeStatement(this.constructClient({ endpoint, snippet }));\n writer.newLine();\n writer.writeNodeStatement(this.callMethod({ endpoint, snippet }));\n });\n }\n\n private constructClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.AstNode {\n return ruby.codeblock((writer) => {\n writer.addRequire(this.context.getRootModuleName().toLowerCase());\n\n const clientClassRef = this.context.getRootClientClassReference();\n const builderArgs = this.getRootClientBuilderArgs({ endpoint, snippet });\n\n writer.write(`${CLIENT_VAR_NAME} = `);\n writer.writeNode(\n ruby.instantiateClass({\n classReference: clientClassRef,\n arguments_: builderArgs\n })\n );\n });\n }\n\n // Helper for base URL/environment argument\n private getRootClientBaseUrlArg({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): ruby.KeywordArgument[] {\n if (baseUrl != null && environment != null) {\n this.context.errors.add({\n severity: \"CRITICAL\",\n message: \"Cannot specify both baseUrl and environment options\"\n });\n return [];\n }\n if (baseUrl != null) {\n return [\n ruby.keywordArgument({\n name: \"base_url\",\n value: ruby.TypeLiteral.string(baseUrl)\n })\n ];\n }\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const environmentTypeReference = this.context.getEnvironmentTypeReferenceFromID(environment);\n if (environmentTypeReference == null) {\n this.context.errors.add({\n severity: \"CRITICAL\",\n message: `Environment ID ${environment} not found`\n });\n return [];\n }\n\n return [\n ruby.keywordArgument({\n name: \"environment\",\n value: environmentTypeReference\n })\n ];\n }\n if (this.context.isMultiEnvironmentValues(environment)) {\n this.context.errors.add({\n severity: \"CRITICAL\",\n message: \"Multi-environment values are not supported in Ruby snippets yet\"\n });\n return [];\n }\n }\n return [];\n }\n\n // Helper for auth arguments\n private getRootClientAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): ruby.KeywordArgument[] {\n if (values.type !== auth.type) {\n this.addError(this.context.newAuthMismatchError({ auth, values }).message);\n return [];\n }\n\n switch (auth.type) {\n case \"basic\":\n return values.type === \"basic\" ? this.getRootClientBasicAuthArgs({ auth, values }) : [];\n case \"bearer\":\n return values.type === \"bearer\" ? this.getRootClientBearerAuthArgs({ auth, values }) : [];\n case \"header\":\n return values.type === \"header\" ? this.getRootClientHeaderAuthArgs({ auth, values }) : [];\n case \"oauth\":\n return values.type === \"oauth\" ? this.getRootClientOAuthArgs({ auth, values }) : [];\n case \"inferred\":\n this.addWarning(\"Ruby SDK does not support inferred auth yet\");\n return [];\n default:\n assertNever(auth);\n }\n }\n\n private addError(message: string): void {\n this.context.errors.add({ severity: Severity.Critical, message });\n }\n\n private addWarning(message: string): void {\n this.context.errors.add({ severity: Severity.Warning, message });\n }\n\n private getRootClientBasicAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): ruby.KeywordArgument[] {\n return [\n ruby.keywordArgument({\n name: auth.username.snakeCase.safeName,\n value: ruby.TypeLiteral.string(values.username)\n }),\n ruby.keywordArgument({\n name: auth.password.snakeCase.safeName,\n value: ruby.TypeLiteral.string(values.password)\n })\n ];\n }\n\n private getRootClientBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): ruby.KeywordArgument[] {\n return [\n ruby.keywordArgument({\n name: auth.token.snakeCase.safeName,\n value: ruby.TypeLiteral.string(values.token)\n })\n ];\n }\n\n private getRootClientHeaderAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.HeaderAuth;\n values: FernIr.dynamic.HeaderAuthValues;\n }): ruby.KeywordArgument[] {\n return [\n ruby.keywordArgument({\n name: auth.header.name.name.snakeCase.safeName,\n value: ruby.TypeLiteral.string(values.value as string)\n })\n ];\n }\n\n private getRootClientOAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.OAuth;\n values: FernIr.dynamic.OAuthValues;\n }): ruby.KeywordArgument[] {\n // OAuth client credentials\n return [\n ruby.keywordArgument({\n name: auth.clientId.snakeCase.safeName,\n value: ruby.TypeLiteral.string(values.clientId)\n }),\n ruby.keywordArgument({\n name: auth.clientSecret.snakeCase.safeName,\n value: ruby.TypeLiteral.string(values.clientSecret)\n })\n ];\n }\n\n // Helper for headers\n private getRootClientHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): ruby.KeywordArgument[] {\n const args: ruby.KeywordArgument[] = [];\n for (const header of headers) {\n const value = values[header.name.name.originalName];\n if (value != null && typeof value === \"string\") {\n args.push(\n ruby.keywordArgument({\n name: header.name.name.snakeCase.safeName,\n value: ruby.TypeLiteral.string(value)\n })\n );\n }\n }\n return args;\n }\n\n // Main builder\n private getRootClientBuilderArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.KeywordArgument[] {\n const builderArgs: ruby.KeywordArgument[] = [];\n\n // Auth\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n builderArgs.push(...this.getRootClientAuthArgs({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n this.context.errors.add({\n severity: \"WARNING\",\n message: `Auth with ${endpoint.auth.type} configuration is required for this endpoint`\n });\n }\n }\n\n // Base URL / Environment\n const baseUrlArgs = this.getRootClientBaseUrlArg({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (baseUrlArgs.length > 0) {\n builderArgs.push(...baseUrlArgs);\n }\n\n // Headers\n this.context.errors.scope(\"Headers\");\n if (this.context.ir.headers != null && snippet.headers != null) {\n builderArgs.push(\n ...this.getRootClientHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n\n return builderArgs;\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.MethodInvocation {\n const invokeMethodArgs: ruby.MethodInvocation.Args = {\n on: ruby.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: []\n };\n\n switch (endpoint.request.type) {\n case \"inlined\":\n invokeMethodArgs.keywordArguments = this.getMethodArgsForInlinedRequest({\n request: endpoint.request,\n snippet\n });\n break;\n case \"body\":\n invokeMethodArgs.arguments_ = this.getMethodArgsForBodyRequest({\n request: endpoint.request,\n snippet\n });\n break;\n default:\n assertNever(endpoint.request);\n }\n\n return ruby.invokeMethod(invokeMethodArgs);\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.KeywordArgument[] {\n const args: ruby.KeywordArgument[] = [];\n\n args.push(\n ...this.getNamedParameterArgs({\n kind: \"PathParameters\",\n namedParameters: request.pathParameters,\n values: snippet.pathParameters\n })\n );\n args.push(\n ...this.getNamedParameterArgs({\n kind: \"QueryParameters\",\n namedParameters: request.queryParameters,\n values: snippet.queryParameters\n })\n );\n args.push(\n ...this.getNamedParameterArgs({\n kind: \"Headers\",\n namedParameters: request.headers,\n values: snippet.headers\n })\n );\n\n // Handle request.body if present\n if (request.body != null) {\n switch (request.body.type) {\n case \"properties\":\n args.push(...this.getMethodArgsForPropertiesRequest({ request: request.body, snippet }));\n break;\n case \"referenced\":\n case \"fileUpload\":\n // Not implemented for Ruby snippets yet\n break;\n default:\n assertNever(request.body);\n }\n }\n\n return args;\n }\n\n private getNamedParameterArgs({\n kind,\n namedParameters,\n values\n }: {\n kind: \"PathParameters\" | \"QueryParameters\" | \"Headers\";\n namedParameters: FernIr.dynamic.NamedParameter[] | undefined;\n values: Record<string, unknown> | undefined;\n }): ruby.KeywordArgument[] {\n const args: ruby.KeywordArgument[] = [];\n this.context.errors.scope(kind);\n if (namedParameters != null) {\n const associated = this.context.associateByWireValue({\n parameters: namedParameters,\n values: values ?? {},\n ignoreMissingParameters: true\n });\n for (const parameter of associated) {\n args.push(\n ruby.keywordArgument({\n name: this.context.getPropertyName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(parameter)\n })\n );\n }\n }\n this.context.errors.unscope();\n return args;\n }\n\n private getMethodArgsForPropertiesRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequestBody.Properties;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.KeywordArgument[] {\n const args: ruby.KeywordArgument[] = [];\n\n const bodyProperties = this.context.associateByWireValue({\n parameters: request.value,\n values: this.context.getRecord(snippet.requestBody) ?? {}\n });\n for (const parameter of bodyProperties) {\n args.push(\n ruby.keywordArgument({\n name: this.context.getPropertyName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(parameter)\n })\n );\n }\n return args;\n }\n\n private getMethodArgsForBodyRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): ruby.AstNode[] {\n const args: ruby.AstNode[] = [];\n\n // Add path parameters as positional arguments\n this.context.errors.scope(\"PathParameters\");\n if (request.pathParameters != null) {\n const associated = this.context.associateByWireValue({\n parameters: request.pathParameters,\n values: snippet.pathParameters ?? {},\n ignoreMissingParameters: true\n });\n for (const parameter of associated) {\n args.push(\n ruby.positionalArgument({\n value: this.context.dynamicTypeLiteralMapper.convert(parameter)\n })\n );\n }\n }\n this.context.errors.unscope();\n\n // Add body as a positional argument\n if (request.body != null) {\n switch (request.body.type) {\n case \"bytes\":\n // Not supported in Ruby snippets yet\n this.context.errors.add({\n severity: \"CRITICAL\",\n message: \"Bytes request body is not supported in Ruby snippets yet\"\n });\n break;\n case \"typeReference\":\n args.push(\n ruby.positionalArgument({\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: request.body.value,\n value: this.context.getRecord(snippet.requestBody)\n })\n })\n );\n break;\n default:\n assertNever(request.body);\n }\n }\n\n return args;\n }\n\n private getMethod({ endpoint }: { endpoint: FernIr.dynamic.Endpoint }): string {\n if (endpoint.declaration.fernFilepath.allParts.length > 0) {\n return `${endpoint.declaration.fernFilepath.allParts\n .map((val) => `${this.context.getMethodName(val)}`)\n .join(\".\")}.${this.context.getMethodName(endpoint.declaration.name)}`;\n }\n return this.context.getMethodName(endpoint.declaration.name);\n }\n}\n"],"mappings":"2EAAAA,IAAAC,IAOA,IAAMC,EAAkB,SAEXC,EAAN,KAA+B,CAIlC,YAAY,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAgF,CAHjHC,EAAA,KAAQ,WACRA,EAAA,KAAQ,aAGJ,KAAK,QAAUF,EACf,KAAK,UAAYC,CACrB,CAEA,MAAa,gBAAgB,CACzB,SAAAE,EACA,QAAAC,CACJ,EAGoB,CAxBxB,IAAAC,EA0BQ,OAAO,MADM,KAAK,eAAe,CAAE,SAAAF,EAAU,QAASC,CAAQ,CAAC,EAC7C,cAAc,CAC5B,cAAcC,EAAA,KAAK,QAAQ,eAAb,KAAAA,EAA6B,CAAC,EAC5C,UAAW,KAAK,SACpB,CAAC,CACL,CAEO,oBAAoB,CACvB,SAAAF,EACA,QAAAC,CACJ,EAGW,CAtCf,IAAAC,EAwCQ,OADa,KAAK,eAAe,CAAE,SAAAF,EAAU,QAASC,CAAQ,CAAC,EACnD,SAAS,CACjB,cAAcC,EAAA,KAAK,QAAQ,eAAb,KAAAA,EAA6B,CAAC,EAC5C,UAAW,KAAK,SACpB,CAAC,CACL,CAEQ,eAAe,CACnB,SAAAF,EACA,QAAAG,CACJ,EAGiB,CAEb,OAAOC,EAAK,UAAWC,GAAW,CAC9BA,EAAO,mBAAmB,KAAK,gBAAgB,CAAE,SAAAL,EAAU,QAAAG,CAAQ,CAAC,CAAC,EACrEE,EAAO,QAAQ,EACfA,EAAO,mBAAmB,KAAK,WAAW,CAAE,SAAAL,EAAU,QAAAG,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,IAAI,CAAC,GAEpE,KAAK,QAAQ,cAAcA,EAAS,YAAY,IAAI,CAC/D,CACJ","names":["init_process","init_buffer","CLIENT_VAR_NAME","EndpointSnippetGenerator","context","formatter","__publicField","endpoint","request","_a","snippet","ruby_exports","writer","clientClassRef","builderArgs","baseUrl","environment","environmentTypeReference","auth","values","assertNever","message","Severity","headers","args","header","value","baseUrlArgs","invokeMethodArgs","kind","namedParameters","associated","parameter","bodyProperties","val"]}
@@ -1,2 +0,0 @@
1
- import{a as i}from"./chunk-HW2BPM3B.js";import{a as p}from"./chunk-DC7MOL5X.js";import{a as r,b as t,c as n,e as o}from"./chunk-RKBBW5DU.js";t();n();var a=class extends o{constructor({ir:e,config:m,formatter:c}){super(new p({ir:e,config:m}));r(this,"formatter");this.formatter=c}async generate(e){return super.generate(e)}generateSync(e){return super.generateSync(e)}createSnippetGenerator(e){return new i({context:e,formatter:this.formatter})}};export{a};
2
- //# sourceMappingURL=chunk-NOLMTKNR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractDynamicSnippetsGenerator,\n AbstractFormatter,\n FernGeneratorExec\n} from \"@fern-api/browser-compatible-base-generator\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { EndpointSnippetGenerator } from \"./EndpointSnippetGenerator\";\n\nexport class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<\n DynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator\n> {\n private formatter: AbstractFormatter | undefined;\n\n constructor({\n ir,\n config,\n formatter\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n formatter?: AbstractFormatter;\n }) {\n super(new DynamicSnippetsGeneratorContext({ ir, config }));\n this.formatter = formatter;\n }\n\n public async generate(\n request: FernIr.dynamic.EndpointSnippetRequest\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n return super.generate(request);\n }\n\n public generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse {\n return super.generateSync(request);\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context, formatter: this.formatter });\n }\n}\n"],"mappings":"6IAAAA,IAAAC,IASO,IAAMC,EAAN,cAAuCC,CAG5C,CAGE,YAAY,CACR,GAAAC,EACA,OAAAC,EACA,UAAAC,CACJ,EAIG,CACC,MAAM,IAAIC,EAAgC,CAAE,GAAAH,EAAI,OAAAC,CAAO,CAAC,CAAC,EAX7DG,EAAA,KAAQ,aAYJ,KAAK,UAAYF,CACrB,CAEA,MAAa,SACTG,EAC+C,CAC/C,OAAO,MAAM,SAASA,CAAO,CACjC,CAEO,aAAaA,EAAwF,CACxG,OAAO,MAAM,aAAaA,CAAO,CACrC,CAEU,uBAAuBC,EAAoE,CACjG,OAAO,IAAIC,EAAyB,CAAE,QAAAD,EAAS,UAAW,KAAK,SAAU,CAAC,CAC9E,CACJ","names":["init_process","init_buffer","DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","formatter","DynamicSnippetsGeneratorContext","__publicField","request","context","EndpointSnippetGenerator"]}