@fern-api/python-dynamic-snippets 0.0.8 → 0.0.9
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 +1 -1
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +7 -1
- package/cjs/EndpointSnippetGenerator.cjs +6 -6
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +12 -4
- package/cjs/index.cjs +1 -1
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.cts +1 -1
- package/esm/DynamicSnippetsGenerator.d.ts +7 -1
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/EndpointSnippetGenerator.d.ts +12 -4
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/chunk-6JNSYN57.js +2 -0
- package/esm/chunk-6JNSYN57.js.map +1 -0
- package/esm/chunk-BZ5ZJPTG.js +2 -0
- package/esm/chunk-BZ5ZJPTG.js.map +1 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/esm/chunk-3ODWLSDW.js +0 -2
- package/esm/chunk-3ODWLSDW.js.map +0 -1
- package/esm/chunk-H7RJMI6N.js +0 -2
- package/esm/chunk-H7RJMI6N.js.map +0 -1
package/cjs/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { DynamicSnippetsGenerator } from './DynamicSnippetsGenerator.cjs';
|
|
2
2
|
import '@fern-api/browser-compatible-base-generator';
|
|
3
3
|
import '@fern-api/dynamic-ir-sdk';
|
|
4
|
-
import './DynamicSnippetsGeneratorContext-4_I0JAlU.cjs';
|
|
5
4
|
import '@fern-api/python-ast';
|
|
5
|
+
import './DynamicSnippetsGeneratorContext-4_I0JAlU.cjs';
|
|
6
6
|
import '@fern-api/python-browser-compatible-base';
|
|
7
7
|
import './EndpointSnippetGenerator.cjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
+
import { python } from '@fern-api/python-ast';
|
|
3
4
|
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-4_I0JAlU.js';
|
|
4
5
|
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
|
|
5
|
-
import '@fern-api/python-ast';
|
|
6
6
|
import '@fern-api/python-browser-compatible-base';
|
|
7
7
|
|
|
8
8
|
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
@@ -13,6 +13,12 @@ declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<
|
|
|
13
13
|
generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
14
14
|
generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
|
|
15
15
|
generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode>;
|
|
16
|
+
/**
|
|
17
|
+
* Generates just the method call AST without the client instantiation.
|
|
18
|
+
* This is useful for wire tests where the client is created separately
|
|
19
|
+
* with test-specific configuration.
|
|
20
|
+
*/
|
|
21
|
+
generateMethodCallSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): python.AstNode;
|
|
16
22
|
protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
|
|
17
23
|
}
|
|
18
24
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-BZ5ZJPTG.js";import"./chunk-6JNSYN57.js";import"./chunk-XX42ILF7.js";import"./chunk-W7SA7MNB.js";import"./chunk-AK6ZQDEA.js";import"./chunk-2FBSEQ3K.js";import"./chunk-YEXRWSXV.js";export{a as DynamicSnippetsGenerator};
|
|
2
2
|
//# sourceMappingURL=DynamicSnippetsGenerator.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
+
import { python } from '@fern-api/python-ast';
|
|
3
4
|
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-4_I0JAlU.js';
|
|
4
|
-
import '@fern-api/python-ast';
|
|
5
5
|
import '@fern-api/python-browser-compatible-base';
|
|
6
6
|
|
|
7
7
|
declare class EndpointSnippetGenerator {
|
|
@@ -17,11 +17,19 @@ declare class EndpointSnippetGenerator {
|
|
|
17
17
|
endpoint: FernIr.dynamic.Endpoint;
|
|
18
18
|
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
19
19
|
}): string;
|
|
20
|
-
generateSnippetAst({ endpoint, request
|
|
20
|
+
generateSnippetAst({ endpoint, request }: {
|
|
21
21
|
endpoint: FernIr.dynamic.Endpoint;
|
|
22
22
|
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
23
|
-
options?: Options;
|
|
24
23
|
}): Promise<AbstractAstNode>;
|
|
24
|
+
/**
|
|
25
|
+
* Generates just the method call AST without the client instantiation.
|
|
26
|
+
* This is useful for wire tests where the client is created separately
|
|
27
|
+
* with test-specific configuration.
|
|
28
|
+
*/
|
|
29
|
+
generateMethodCallSnippetAst({ endpoint, request }: {
|
|
30
|
+
endpoint: FernIr.dynamic.Endpoint;
|
|
31
|
+
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
32
|
+
}): python.AstNode;
|
|
25
33
|
private buildPythonFile;
|
|
26
34
|
private constructClient;
|
|
27
35
|
private getConstructorArgs;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-6JNSYN57.js";import"./chunk-AK6ZQDEA.js";import"./chunk-YEXRWSXV.js";export{a as EndpointSnippetGenerator};
|
|
2
2
|
//# sourceMappingURL=EndpointSnippetGenerator.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as c,d as o}from"./chunk-AK6ZQDEA.js";import{a as I,b as F,e as P,f as R,g as A,h as u,j as a}from"./chunk-YEXRWSXV.js";R();A();var q={type:"primitive",value:"STRING"},E=["example"],x="client",h="request",N=class{constructor({context:e}){P(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return this.buildPythonFile({endpoint:e,snippet:t}).toString()}generateSnippetSync({endpoint:e,request:t}){return this.buildPythonFile({endpoint:e,snippet:t}).toString()}async generateSnippetAst({endpoint:e,request:t}){return this.buildPythonFile({endpoint:e,snippet:t})}generateMethodCallSnippetAst({endpoint:e,request:t}){return this.callMethod({endpoint:e,snippet:t})}buildPythonFile({endpoint:e,snippet:t}){return a.file({path:E,statements:[this.constructClient({endpoint:e,snippet:t}),this.callMethod({endpoint:e,snippet:t})]})}constructClient({endpoint:e,snippet:t}){return a.assign({lhs:a.reference({name:x}),rhs:a.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:e,snippet:t}).map(r=>a.methodArgument({name:r.name,value:r.value})),multiline:!0})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],n=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return n.length>0&&r.push(...n),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:c.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(o.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:t!=null&&this.context.isMultiEnvironmentValues(t)?[{name:"environment",value:r}]:[{name:this.getEnvironmentOptionName({environment:t}),value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:c.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return a.TypeInstantiation.str(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:c.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return a.TypeInstantiation.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?a.TypeInstantiation.reference(a.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(t).map(([r,n])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:q,value:n})})).map(r=>a.methodArgument({name:r.name,value:r.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The Python SDK Generator does not support Inferred auth scheme yet"),[]);default:u(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:c.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:c.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:a.TypeInstantiation.str(t.username)},{name:this.context.getPropertyName(e.password),value:a.TypeInstantiation.str(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:a.TypeInstantiation.str(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),value:a.TypeInstantiation.str(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:a.TypeInstantiation.str(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let n of e){let s=this.getConstructorHeaderArg({header:n,value:t.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!a.TypeInstantiation.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return a.invokeMethod({on:a.reference({name:x}),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}).map(r=>a.methodArgument({name:r.name,value:r.value})),multiline:!0})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:u(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var i,l;let r=[];this.context.errors.scope(o.PathParameters);let n=[...(i=this.context.ir.pathParameters)!=null?i:[],...(l=e.pathParameters)!=null?l:[]],s=new Set;if(e.body!=null){let m=this.getBodyRequestArgs({body:e.body,value:t.requestBody});s=new Set(m.map(p=>p.name))}if(n.length>0){let p=this.getPathParameters({namedParameters:n,snippet:t}).map(d=>s.has(d.name)?F(I({},d),{name:d.name+"_"}):d);r.push(...p)}return this.context.errors.unscope(),this.context.errors.scope(o.RequestBody),e.body!=null&&r.push(...this.getBodyRequestArgs({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArgs({body:e,value:t}){switch(e.type){case"bytes":return[{name:h,value:this.getBytesBodyRequestTypeInstantiation({value:t})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:e.value,value:t});default:u(e)}}getBodyRequestArgsForTypeReference({typeReference:e,value:t}){switch(e.type){case"named":{let r=this.context.resolveNamedType({typeId:e.value});return r==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:e,named:r,value:t})}case"nullable":case"optional":{let r=e.value;if(r.type==="named"){let n=this.context.resolveNamedType({typeId:r.value});if((n==null?void 0:n.type)==="object")return[{name:h,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:r,value:t})}]}return this.getBodyRequestArgsForTypeReference({typeReference:e.value,value:t})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:h,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:t})}];default:u(e)}}getBodyRequestArgsForNamedTypeReference({typeReference:e,named:t,value:r}){var n;switch(t.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:t.typeReference,value:r});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:h,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:r})}];case"object":return this.context.associateByWireValue({parameters:t.properties,values:(n=this.context.getRecord(r))!=null?n:{}}).map(i=>({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)}));default:u(t)}}getBodyRequestArgsForBytes({body:e,value:t}){let r=this.getBytesBodyRequestTypeInstantiation({value:t});return a.TypeInstantiation.isNop(r)?[]:[{name:this.context.getPropertyName(e.bodyKey),value:r}]}getBytesBodyRequestTypeInstantiation({value:e}){return typeof e!="string"?(this.context.errors.add({severity:c.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),a.TypeInstantiation.nop()):a.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],n=this.context.shouldInlinePathParameters();this.context.errors.scope(o.PathParameters);let s=[];e.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let i=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})||r.push(...s),this.context.needsRequestParameter({request:e,inlinePathParameters:n,inlineFileProperties:!0})&&r.push(...this.getInlinedRequestArgs({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})?s:[],filePropertyInfo:i})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArgs({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:n}){var d,g,f,v;this.context.errors.scope(o.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(d=e.queryParameters)!=null?d:[],values:(g=t.queryParameters)!=null?g:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.Headers);let m=this.context.associateByWireValue({parameters:(f=e.headers)!=null?f:[],values:(v=t.headers)!=null?v:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let p=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:n}):[];return this.context.errors.unscope(),[...r,...i,...m,...p]}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:u(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t}){let r=e.bodyType;switch(r.type){case"bytes":return this.getBodyRequestArgsForBytes({body:e,value:t});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:r.value,value:t});default:u(r)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){var s;let r=[],n=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],n=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{},ignoreMissingParameters:!0});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getEnvironmentOptionName({environment:e}){return e!=null?"environment":"base_url"}};export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6JNSYN57.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractAstNode, Scope, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { python } from \"@fern-api/python-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst STRING_TYPE_REFERENCE: FernIr.dynamic.TypeReference = {\n type: \"primitive\",\n value: \"STRING\"\n};\nconst SNIPPET_MODULE_PATH = [\"example\"];\nconst CLIENT_VAR_NAME = \"client\";\nconst REQUEST_BODY_ARG_NAME = \"request\";\n\nexport class EndpointSnippetGenerator {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\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 file = this.buildPythonFile({ endpoint, snippet: request });\n return file.toString();\n }\n\n public generateSnippetSync({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): string {\n const file = this.buildPythonFile({ endpoint, snippet: request });\n return file.toString();\n }\n\n public async generateSnippetAst({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): Promise<AbstractAstNode> {\n return this.buildPythonFile({ endpoint, snippet: request });\n }\n\n /**\n * Generates just the method call AST without the client instantiation.\n * This is useful for wire tests where the client is created separately\n * with test-specific configuration.\n */\n public generateMethodCallSnippetAst({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): python.AstNode {\n return this.callMethod({ endpoint, snippet: request });\n }\n\n private buildPythonFile({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.PythonFile {\n return python.file({\n path: SNIPPET_MODULE_PATH,\n statements: [this.constructClient({ endpoint, snippet }), 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 }): python.AstNode {\n return python.assign({\n lhs: python.reference({ name: CLIENT_VAR_NAME }),\n rhs: python.instantiateClass({\n classReference: this.context.getRootClientClassReference(),\n arguments_: this.getConstructorArgs({ endpoint, snippet }).map((arg) =>\n python.methodArgument({\n name: arg.name,\n value: arg.value\n })\n ),\n multiline: true\n })\n });\n }\n\n private getConstructorArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const fields: python.NamedValue[] = [];\n const environmentArgs = this.getConstructorEnvironmentArgs({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (environmentArgs.length > 0) {\n fields.push(...environmentArgs);\n }\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n fields.push(...this.getConstructorAuthArgs({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Auth with ${endpoint.auth.type} configuration is required for this endpoint`\n });\n }\n }\n\n this.context.errors.scope(Scope.PathParameters);\n if (this.context.ir.pathParameters != null) {\n fields.push(...this.getPathParameters({ namedParameters: this.context.ir.pathParameters, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n fields.push(\n ...this.getConstructorHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n return fields;\n }\n\n private getConstructorEnvironmentArgs({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): python.NamedValue[] {\n const environmentValue = this.getEnvironmentValue({ baseUrl, environment });\n if (environmentValue == null) {\n return [];\n }\n\n if (environment != null && this.context.isMultiEnvironmentValues(environment)) {\n return [\n {\n name: \"environment\",\n value: environmentValue\n }\n ];\n }\n\n return [\n {\n name: this.getEnvironmentOptionName({ environment }),\n value: environmentValue\n }\n ];\n }\n\n private getEnvironmentValue({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): python.TypeInstantiation | undefined {\n if (baseUrl != null && environment != null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Cannot specify both baseUrl and environment options\"\n });\n return undefined;\n }\n if (baseUrl != null) {\n return python.TypeInstantiation.str(baseUrl);\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: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return undefined;\n }\n return python.TypeInstantiation.reference(environmentTypeReference);\n }\n if (this.context.isMultiEnvironmentValues(environment)) {\n if (!this.context.validateMultiEnvironmentUrlValues(environment)) {\n return undefined;\n }\n return python.TypeInstantiation.reference(\n python.instantiateClass({\n classReference: this.context.getEnvironmentClassReference(),\n arguments_: Object.entries(environment)\n .map(([key, value]) => ({\n name: key,\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: STRING_TYPE_REFERENCE,\n value\n })\n }))\n .map((arg) =>\n python.methodArgument({\n name: arg.name,\n value: arg.value\n })\n ),\n multiline: true\n })\n );\n }\n }\n return undefined;\n }\n\n private getConstructorAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): python.NamedValue[] {\n switch (auth.type) {\n case \"basic\":\n if (values.type !== \"basic\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorBasicAuthArg({ auth, values });\n case \"bearer\":\n if (values.type !== \"bearer\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorBearerAuthArgs({ auth, values });\n case \"header\":\n if (values.type !== \"header\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorHeaderAuthArgs({ auth, values });\n case \"oauth\":\n if (values.type !== \"oauth\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorOAuthArgs({ auth, values });\n case \"inferred\":\n if (values.type !== \"inferred\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n this.addWarning(\"The Python SDK Generator does not support Inferred auth scheme yet\");\n return [];\n default:\n assertNever(auth);\n }\n }\n\n private addAuthMismatchError(auth: FernIr.dynamic.Auth, values: FernIr.dynamic.AuthValues): void {\n this.context.errors.add({\n severity: Severity.Critical,\n message: this.context.newAuthMismatchError({ auth, values }).message\n });\n }\n\n private addWarning(message: string): void {\n this.context.errors.add({ severity: Severity.Warning, message });\n }\n\n private getConstructorBasicAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.username),\n value: python.TypeInstantiation.str(values.username)\n },\n {\n name: this.context.getPropertyName(auth.password),\n value: python.TypeInstantiation.str(values.password)\n }\n ];\n }\n\n private getConstructorBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.token),\n value: python.TypeInstantiation.str(values.token)\n }\n ];\n }\n\n private getConstructorHeaderAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.HeaderAuth;\n values: FernIr.dynamic.HeaderAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: auth.header.typeReference,\n value: values.value\n })\n }\n ];\n }\n\n private getConstructorOAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.OAuth;\n values: FernIr.dynamic.OAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.clientId),\n value: python.TypeInstantiation.str(values.clientId)\n },\n {\n name: this.context.getPropertyName(auth.clientSecret),\n value: python.TypeInstantiation.str(values.clientSecret)\n }\n ];\n }\n\n private getConstructorHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): python.NamedValue[] {\n const fields: python.NamedValue[] = [];\n for (const header of headers) {\n const field = this.getConstructorHeaderArg({ header, value: values.value });\n if (field != null) {\n fields.push(field);\n }\n }\n return fields;\n }\n\n private getConstructorHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): python.NamedValue | undefined {\n const typeLiteral = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (python.TypeInstantiation.isNop(typeLiteral)) {\n // Literal header values (e.g. \"X-API-Version\") should not be included in the\n // client constructor.\n return undefined;\n }\n return {\n name: this.context.getPropertyName(header.name.name),\n value: typeLiteral\n };\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.AstNode {\n return python.invokeMethod({\n on: python.reference({ name: CLIENT_VAR_NAME }),\n method: this.getMethod({ endpoint }),\n arguments_: this.getMethodArgs({ endpoint, snippet }).map((arg) =>\n python.methodArgument({\n name: arg.name,\n value: arg.value\n })\n ),\n multiline: true\n });\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n switch (endpoint.request.type) {\n case \"inlined\":\n return this.getMethodArgsForInlinedRequest({ request: endpoint.request, snippet });\n case \"body\":\n return this.getMethodArgsForBodyRequest({ request: endpoint.request, snippet });\n default:\n assertNever(endpoint.request);\n }\n }\n\n private getMethodArgsForBodyRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const args: python.NamedValue[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n\n // Get body property names to check for collisions\n let bodyPropertyNames: Set<string> = new Set();\n if (request.body != null) {\n const bodyArgs = this.getBodyRequestArgs({ body: request.body, value: snippet.requestBody });\n bodyPropertyNames = new Set(bodyArgs.map((arg) => arg.name));\n }\n\n // Add path parameters, adding underscore suffix if they collide with body properties\n if (pathParameters.length > 0) {\n const pathArgs = this.getPathParameters({ namedParameters: pathParameters, snippet });\n const disambiguatedPathArgs = pathArgs.map((arg) => {\n // If this path parameter name collides with a body property, add underscore suffix\n if (bodyPropertyNames.has(arg.name)) {\n return { ...arg, name: arg.name + \"_\" };\n }\n return arg;\n });\n args.push(...disambiguatedPathArgs);\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n if (request.body != null) {\n args.push(...this.getBodyRequestArgs({ body: request.body, value: snippet.requestBody }));\n }\n this.context.errors.unscope();\n\n return args;\n }\n\n private getBodyRequestArgs({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): python.NamedValue[] {\n switch (body.type) {\n case \"bytes\":\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.getBytesBodyRequestTypeInstantiation({ value })\n }\n ];\n case \"typeReference\":\n return this.getBodyRequestArgsForTypeReference({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getBodyRequestArgsForTypeReference({\n typeReference,\n value\n }: {\n typeReference: FernIr.dynamic.TypeReference;\n value: unknown;\n }): python.NamedValue[] {\n switch (typeReference.type) {\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: typeReference.value });\n if (named == null) {\n return [];\n }\n return this.getBodyRequestArgsForNamedTypeReference({ typeReference, named, value });\n }\n case \"nullable\":\n case \"optional\": {\n // Check if the inner type is an object - if so, don't flatten it\n const innerType = typeReference.value;\n if (innerType.type === \"named\") {\n const named = this.context.resolveNamedType({ typeId: innerType.value });\n if (named?.type === \"object\") {\n // Optional objects should NOT be flattened - use as single 'request' parameter\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: innerType,\n value\n })\n }\n ];\n }\n }\n // For non-object types, continue unwrapping\n return this.getBodyRequestArgsForTypeReference({ typeReference: typeReference.value, value });\n }\n case \"list\":\n case \"map\":\n case \"set\":\n case \"literal\":\n case \"primitive\":\n case \"unknown\":\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.context.dynamicTypeLiteralMapper.convert({ typeReference, value })\n }\n ];\n default:\n assertNever(typeReference);\n }\n }\n\n private getBodyRequestArgsForNamedTypeReference({\n typeReference,\n named,\n value\n }: {\n typeReference: FernIr.dynamic.TypeReference;\n named: FernIr.dynamic.NamedType;\n value: unknown;\n }): python.NamedValue[] {\n switch (named.type) {\n case \"alias\":\n return this.getBodyRequestArgsForTypeReference({ typeReference: named.typeReference, value });\n case \"enum\":\n case \"discriminatedUnion\":\n case \"undiscriminatedUnion\":\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.context.dynamicTypeLiteralMapper.convert({ typeReference, value })\n }\n ];\n case \"object\": {\n const bodyProperties = this.context.associateByWireValue({\n parameters: named.properties,\n values: this.context.getRecord(value) ?? {}\n });\n return bodyProperties.map((property) => ({\n name: this.context.getPropertyName(property.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(property)\n }));\n }\n default:\n assertNever(named);\n }\n }\n\n private getBodyRequestArgsForBytes({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): python.NamedValue[] {\n const typeInstantiation = this.getBytesBodyRequestTypeInstantiation({ value });\n if (python.TypeInstantiation.isNop(typeInstantiation)) {\n return [];\n }\n return [\n {\n name: this.context.getPropertyName(body.bodyKey),\n value: typeInstantiation\n }\n ];\n }\n\n private getBytesBodyRequestTypeInstantiation({ value }: { value: unknown }): python.TypeInstantiation {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected bytes value to be a string, got ${typeof value}`\n });\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.bytes(value);\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const args: python.NamedValue[] = [];\n\n const inlinePathParameters = this.context.shouldInlinePathParameters();\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: python.NamedValue[] = [];\n if (request.pathParameters != null) {\n pathParameterFields.push(...this.getPathParameters({ namedParameters: request.pathParameters, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const filePropertyInfo = this.getFilePropertyInfo({ request, snippet });\n this.context.errors.unscope();\n\n if (\n !this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ) {\n args.push(...pathParameterFields);\n }\n\n if (\n this.context.needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties: true\n })\n ) {\n args.push(\n ...this.getInlinedRequestArgs({\n request,\n snippet,\n pathParameterFields: this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ? pathParameterFields\n : [],\n filePropertyInfo\n })\n );\n }\n return args;\n }\n\n private getFilePropertyInfo({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): FilePropertyInfo {\n if (request.body == null || !this.context.isFileUploadRequestBody(request.body)) {\n return {\n fileFields: [],\n bodyPropertyFields: []\n };\n }\n return this.context.filePropertyMapper.getFilePropertyInfo({\n body: request.body,\n value: snippet.requestBody\n });\n }\n\n private getInlinedRequestArgs({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: python.NamedValue[];\n filePropertyInfo: FilePropertyInfo;\n }): python.NamedValue[] {\n this.context.errors.scope(Scope.QueryParameters);\n const queryParameters = this.context.associateQueryParametersByWireValue({\n parameters: request.queryParameters ?? [],\n values: snippet.queryParameters ?? {}\n });\n const queryParameterFields = queryParameters.map((queryParameter) => ({\n name: this.context.getPropertyName(queryParameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(queryParameter)\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n const headers = this.context.associateByWireValue({\n parameters: request.headers ?? [],\n values: snippet.headers ?? {}\n });\n const headerFields = headers.map((header) => ({\n name: this.context.getPropertyName(header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(header)\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const requestBodyFields =\n request.body != null\n ? this.getInlinedRequestBodyObjectFields({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return [...pathParameterFields, ...queryParameterFields, ...headerFields, ...requestBodyFields];\n }\n\n private getInlinedRequestBodyObjectFields({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): python.NamedValue[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyObjectFields({ parameters: body.value, value });\n case \"referenced\":\n return this.getReferencedRequestBodyPropertyTypeInstantiation({ body, value });\n case \"fileUpload\":\n return this.getFileUploadRequestBodyObjectFields({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyObjectFields({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): python.NamedValue[] {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n\n private getReferencedRequestBodyPropertyTypeInstantiation({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): python.NamedValue[] {\n const bodyType = body.bodyType;\n switch (bodyType.type) {\n case \"bytes\":\n return this.getBodyRequestArgsForBytes({ body, value });\n case \"typeReference\":\n return this.getBodyRequestArgsForTypeReference({ typeReference: bodyType.value, value });\n default:\n assertNever(bodyType);\n }\n }\n\n private getInlinedRequestBodyPropertyObjectFields({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): python.NamedValue[] {\n const fields: python.NamedValue[] = [];\n\n const bodyProperties = this.context.associateByWireValue({\n parameters,\n values: this.context.getRecord(value) ?? {}\n });\n for (const parameter of bodyProperties) {\n fields.push({\n name: this.context.getPropertyName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(parameter)\n });\n }\n\n return fields;\n }\n\n private getPathParameters({\n namedParameters,\n snippet\n }: {\n namedParameters: FernIr.dynamic.NamedParameter[];\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const args: python.NamedValue[] = [];\n\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {},\n\n // Path parameters are distributed across the client constructor\n // and the request method, so we ignore missing parameters here.\n ignoreMissingParameters: true\n });\n for (const parameter of pathParameters) {\n args.push({\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 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 private getEnvironmentOptionName({\n environment\n }: {\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): string {\n if (environment != null) {\n return \"environment\";\n }\n return \"base_url\";\n }\n}\n"],"mappings":"iIAA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J,UACX,CACJ","names":["init_process","init_buffer","STRING_TYPE_REFERENCE","SNIPPET_MODULE_PATH","CLIENT_VAR_NAME","REQUEST_BODY_ARG_NAME","EndpointSnippetGenerator","context","__publicField","endpoint","request","snippet","python_exports","arg","fields","environmentArgs","Severity","Scope","baseUrl","environment","environmentValue","environmentTypeReference","key","value","auth","values","assertNever","message","headers","header","field","typeLiteral","_a","_b","args","pathParameters","bodyPropertyNames","bodyArgs","disambiguatedPathArgs","__spreadProps","__spreadValues","body","typeReference","named","innerType","property","typeInstantiation","inlinePathParameters","pathParameterFields","filePropertyInfo","_c","_d","queryParameterFields","queryParameter","headerFields","requestBodyFields","bodyType","parameters","bodyProperties","parameter","namedParameters","val"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-6JNSYN57.js";import{a as i}from"./chunk-XX42ILF7.js";import{a as p}from"./chunk-AK6ZQDEA.js";import{f as r,g as o}from"./chunk-YEXRWSXV.js";r();o();var c=class extends p{constructor({ir:e,config:n}){super(new i({ir:e,config:n}))}async generate(e){return super.generate(e)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e){return super.generateSnippetAst(e)}generateMethodCallSnippetAst(e){let n=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(n.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t;for(let s of n){let d=this.context.clone(),m=this.createSnippetGenerator(d);try{return m.generateMethodCallSnippetAst({endpoint:s,request:e})}catch(S){t=S}}throw t!=null?t:new Error(`Failed to generate method call snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}createSnippetGenerator(e){return new a({context:e})}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BZ5ZJPTG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractAstNode,\n AbstractDynamicSnippetsGenerator,\n FernGeneratorExec\n} from \"@fern-api/browser-compatible-base-generator\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { python } from \"@fern-api/python-ast\";\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { EndpointSnippetGenerator } from \"./EndpointSnippetGenerator\";\n\nexport class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<\n DynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator\n> {\n constructor({\n ir,\n config\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n }) {\n super(new DynamicSnippetsGeneratorContext({ ir, config }));\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 public async generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode> {\n return super.generateSnippetAst(request);\n }\n\n /**\n * Generates just the method call AST without the client instantiation.\n * This is useful for wire tests where the client is created separately\n * with test-specific configuration.\n */\n public generateMethodCallSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): python.AstNode {\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 let lastError: Error | undefined = undefined;\n for (const endpoint of endpoints) {\n const context = this.context.clone() as DynamicSnippetsGeneratorContext;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n return snippetGenerator.generateMethodCallSnippetAst({ endpoint, request });\n } catch (error) {\n lastError = error as Error;\n }\n }\n if (lastError != null) {\n throw lastError;\n }\n throw new Error(\n `Failed to generate method call snippet AST for endpoint: ${request.endpoint.method} ${request.endpoint.path}`\n );\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context });\n }\n}\n"],"mappings":"kKAAAA,IAAAC,IAUO,IAAMC,EAAN,cAAuCC,CAG5C,CACE,YAAY,CACR,GAAAC,EACA,OAAAC,CACJ,EAGG,CACC,MAAM,IAAIC,EAAgC,CAAE,GAAAF,EAAI,OAAAC,CAAO,CAAC,CAAC,CAC7D,CAEA,MAAa,SACTE,EAC+C,CAC/C,OAAO,MAAM,SAASA,CAAO,CACjC,CAEO,aAAaA,EAAwF,CACxG,OAAO,MAAM,aAAaA,CAAO,CACrC,CAEA,MAAa,mBAAmBA,EAA0E,CACtG,OAAO,MAAM,mBAAmBA,CAAO,CAC3C,CAOO,6BAA6BA,EAAgE,CAChG,IAAMC,EAAY,KAAK,QAAQ,+BAA+BD,EAAQ,QAAQ,EAC9E,GAAIC,EAAU,SAAW,EACrB,MAAM,IAAI,MAAM,kCAAkCD,EAAQ,SAAS,MAAM,IAAIA,EAAQ,SAAS,IAAI,GAAG,EAEzG,IAAIE,EACJ,QAAWC,KAAYF,EAAW,CAC9B,IAAMG,EAAU,KAAK,QAAQ,MAAM,EAC7BC,EAAmB,KAAK,uBAAuBD,CAAO,EAC5D,GAAI,CACA,OAAOC,EAAiB,6BAA6B,CAAE,SAAAF,EAAU,QAAAH,CAAQ,CAAC,CAC9E,OAASM,EAAO,CACZJ,EAAYI,CAChB,CACJ,CACA,MAAIJ,GAAa,KACPA,EAEJ,IAAI,MACN,4DAA4DF,EAAQ,SAAS,MAAM,IAAIA,EAAQ,SAAS,IAAI,EAChH,CACJ,CAEU,uBAAuBI,EAAoE,CACjG,OAAO,IAAIG,EAAyB,CAAE,QAAAH,CAAQ,CAAC,CACnD,CACJ","names":["init_process","init_buffer","DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","DynamicSnippetsGeneratorContext","request","endpoints","lastError","endpoint","context","snippetGenerator","error","EndpointSnippetGenerator"]}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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_I0JAlU.js';
|
|
5
4
|
import '@fern-api/python-ast';
|
|
5
|
+
import './DynamicSnippetsGeneratorContext-4_I0JAlU.js';
|
|
6
6
|
import '@fern-api/python-browser-compatible-base';
|
|
7
7
|
import './EndpointSnippetGenerator.js';
|
package/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-BZ5ZJPTG.js";import"./chunk-6JNSYN57.js";import"./chunk-XX42ILF7.js";import"./chunk-W7SA7MNB.js";import"./chunk-AK6ZQDEA.js";import"./chunk-2FBSEQ3K.js";import{f as e,g as r}from"./chunk-YEXRWSXV.js";e();r();export{n as DynamicSnippetsGenerator};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
package/esm/chunk-3ODWLSDW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as c,d as o}from"./chunk-AK6ZQDEA.js";import{a as I,b as F,e as P,f as R,g as x,h as u,j as a}from"./chunk-YEXRWSXV.js";R();x();var q={type:"primitive",value:"STRING"},B=["example"],A="client",h="request",N=class{constructor({context:e}){P(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return this.buildPythonFile({endpoint:e,snippet:t}).toString()}generateSnippetSync({endpoint:e,request:t}){return this.buildPythonFile({endpoint:e,snippet:t}).toString()}async generateSnippetAst({endpoint:e,request:t,options:r}){throw new Error("Unsupported")}buildPythonFile({endpoint:e,snippet:t}){return a.file({path:B,statements:[this.constructClient({endpoint:e,snippet:t}),this.callMethod({endpoint:e,snippet:t})]})}constructClient({endpoint:e,snippet:t}){return a.assign({lhs:a.reference({name:A}),rhs:a.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:e,snippet:t}).map(r=>a.methodArgument({name:r.name,value:r.value})),multiline:!0})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],n=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return n.length>0&&r.push(...n),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:c.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(o.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:t!=null&&this.context.isMultiEnvironmentValues(t)?[{name:"environment",value:r}]:[{name:this.getEnvironmentOptionName({environment:t}),value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:c.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return a.TypeInstantiation.str(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:c.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return a.TypeInstantiation.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?a.TypeInstantiation.reference(a.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(t).map(([r,n])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:q,value:n})})).map(r=>a.methodArgument({name:r.name,value:r.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The Python SDK Generator does not support Inferred auth scheme yet"),[]);default:u(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:c.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:c.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),value:a.TypeInstantiation.str(t.username)},{name:this.context.getPropertyName(e.password),value:a.TypeInstantiation.str(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:a.TypeInstantiation.str(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),value:a.TypeInstantiation.str(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:a.TypeInstantiation.str(t.clientSecret)}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let n of e){let s=this.getConstructorHeaderArg({header:n,value:t.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!a.TypeInstantiation.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return a.invokeMethod({on:a.reference({name:A}),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}).map(r=>a.methodArgument({name:r.name,value:r.value})),multiline:!0})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:u(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var i,l;let r=[];this.context.errors.scope(o.PathParameters);let n=[...(i=this.context.ir.pathParameters)!=null?i:[],...(l=e.pathParameters)!=null?l:[]],s=new Set;if(e.body!=null){let m=this.getBodyRequestArgs({body:e.body,value:t.requestBody});s=new Set(m.map(p=>p.name))}if(n.length>0){let p=this.getPathParameters({namedParameters:n,snippet:t}).map(d=>s.has(d.name)?F(I({},d),{name:d.name+"_"}):d);r.push(...p)}return this.context.errors.unscope(),this.context.errors.scope(o.RequestBody),e.body!=null&&r.push(...this.getBodyRequestArgs({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArgs({body:e,value:t}){switch(e.type){case"bytes":return[{name:h,value:this.getBytesBodyRequestTypeInstantiation({value:t})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:e.value,value:t});default:u(e)}}getBodyRequestArgsForTypeReference({typeReference:e,value:t}){switch(e.type){case"named":{let r=this.context.resolveNamedType({typeId:e.value});return r==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:e,named:r,value:t})}case"nullable":case"optional":{let r=e.value;if(r.type==="named"){let n=this.context.resolveNamedType({typeId:r.value});if((n==null?void 0:n.type)==="object")return[{name:h,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:r,value:t})}]}return this.getBodyRequestArgsForTypeReference({typeReference:e.value,value:t})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:h,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:t})}];default:u(e)}}getBodyRequestArgsForNamedTypeReference({typeReference:e,named:t,value:r}){var n;switch(t.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:t.typeReference,value:r});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:h,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e,value:r})}];case"object":return this.context.associateByWireValue({parameters:t.properties,values:(n=this.context.getRecord(r))!=null?n:{}}).map(i=>({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)}));default:u(t)}}getBodyRequestArgsForBytes({body:e,value:t}){let r=this.getBytesBodyRequestTypeInstantiation({value:t});return a.TypeInstantiation.isNop(r)?[]:[{name:this.context.getPropertyName(e.bodyKey),value:r}]}getBytesBodyRequestTypeInstantiation({value:e}){return typeof e!="string"?(this.context.errors.add({severity:c.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),a.TypeInstantiation.nop()):a.TypeInstantiation.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],n=this.context.shouldInlinePathParameters();this.context.errors.scope(o.PathParameters);let s=[];e.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let i=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})||r.push(...s),this.context.needsRequestParameter({request:e,inlinePathParameters:n,inlineFileProperties:!0})&&r.push(...this.getInlinedRequestArgs({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})?s:[],filePropertyInfo:i})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArgs({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:n}){var d,g,f,v;this.context.errors.scope(o.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(d=e.queryParameters)!=null?d:[],values:(g=t.queryParameters)!=null?g:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.Headers);let m=this.context.associateByWireValue({parameters:(f=e.headers)!=null?f:[],values:(v=t.headers)!=null?v:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(o.RequestBody);let p=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:n}):[];return this.context.errors.unscope(),[...r,...i,...m,...p]}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:u(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:e,value:t}){let r=e.bodyType;switch(r.type){case"bytes":return this.getBodyRequestArgsForBytes({body:e,value:t});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:r.value,value:t});default:u(r)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){var s;let r=[],n=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],n=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{},ignoreMissingParameters:!0});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getEnvironmentOptionName({environment:e}){return e!=null?"environment":"base_url"}};export{N as a};
|
|
2
|
-
//# sourceMappingURL=chunk-3ODWLSDW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractAstNode, Options, Scope, Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { python } from \"@fern-api/python-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst STRING_TYPE_REFERENCE: FernIr.dynamic.TypeReference = {\n type: \"primitive\",\n value: \"STRING\"\n};\nconst SNIPPET_MODULE_PATH = [\"example\"];\nconst CLIENT_VAR_NAME = \"client\";\nconst REQUEST_BODY_ARG_NAME = \"request\";\n\nexport class EndpointSnippetGenerator {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\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 file = this.buildPythonFile({ endpoint, snippet: request });\n return file.toString();\n }\n\n public generateSnippetSync({\n endpoint,\n request\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n }): string {\n const file = this.buildPythonFile({ endpoint, snippet: request });\n return file.toString();\n }\n\n public async generateSnippetAst({\n endpoint,\n request,\n options\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n options?: Options;\n }): Promise<AbstractAstNode> {\n throw new Error(\"Unsupported\");\n }\n\n private buildPythonFile({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.PythonFile {\n return python.file({\n path: SNIPPET_MODULE_PATH,\n statements: [this.constructClient({ endpoint, snippet }), 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 }): python.AstNode {\n return python.assign({\n lhs: python.reference({ name: CLIENT_VAR_NAME }),\n rhs: python.instantiateClass({\n classReference: this.context.getRootClientClassReference(),\n arguments_: this.getConstructorArgs({ endpoint, snippet }).map((arg) =>\n python.methodArgument({\n name: arg.name,\n value: arg.value\n })\n ),\n multiline: true\n })\n });\n }\n\n private getConstructorArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const fields: python.NamedValue[] = [];\n const environmentArgs = this.getConstructorEnvironmentArgs({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (environmentArgs.length > 0) {\n fields.push(...environmentArgs);\n }\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n fields.push(...this.getConstructorAuthArgs({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Auth with ${endpoint.auth.type} configuration is required for this endpoint`\n });\n }\n }\n\n this.context.errors.scope(Scope.PathParameters);\n if (this.context.ir.pathParameters != null) {\n fields.push(...this.getPathParameters({ namedParameters: this.context.ir.pathParameters, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n fields.push(\n ...this.getConstructorHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n return fields;\n }\n\n private getConstructorEnvironmentArgs({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): python.NamedValue[] {\n const environmentValue = this.getEnvironmentValue({ baseUrl, environment });\n if (environmentValue == null) {\n return [];\n }\n\n if (environment != null && this.context.isMultiEnvironmentValues(environment)) {\n return [\n {\n name: \"environment\",\n value: environmentValue\n }\n ];\n }\n\n return [\n {\n name: this.getEnvironmentOptionName({ environment }),\n value: environmentValue\n }\n ];\n }\n\n private getEnvironmentValue({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): python.TypeInstantiation | undefined {\n if (baseUrl != null && environment != null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Cannot specify both baseUrl and environment options\"\n });\n return undefined;\n }\n if (baseUrl != null) {\n return python.TypeInstantiation.str(baseUrl);\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: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return undefined;\n }\n return python.TypeInstantiation.reference(environmentTypeReference);\n }\n if (this.context.isMultiEnvironmentValues(environment)) {\n if (!this.context.validateMultiEnvironmentUrlValues(environment)) {\n return undefined;\n }\n return python.TypeInstantiation.reference(\n python.instantiateClass({\n classReference: this.context.getEnvironmentClassReference(),\n arguments_: Object.entries(environment)\n .map(([key, value]) => ({\n name: key,\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: STRING_TYPE_REFERENCE,\n value\n })\n }))\n .map((arg) =>\n python.methodArgument({\n name: arg.name,\n value: arg.value\n })\n ),\n multiline: true\n })\n );\n }\n }\n return undefined;\n }\n\n private getConstructorAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): python.NamedValue[] {\n switch (auth.type) {\n case \"basic\":\n if (values.type !== \"basic\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorBasicAuthArg({ auth, values });\n case \"bearer\":\n if (values.type !== \"bearer\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorBearerAuthArgs({ auth, values });\n case \"header\":\n if (values.type !== \"header\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorHeaderAuthArgs({ auth, values });\n case \"oauth\":\n if (values.type !== \"oauth\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n return this.getConstructorOAuthArgs({ auth, values });\n case \"inferred\":\n if (values.type !== \"inferred\") {\n this.addAuthMismatchError(auth, values);\n return [];\n }\n this.addWarning(\"The Python SDK Generator does not support Inferred auth scheme yet\");\n return [];\n default:\n assertNever(auth);\n }\n }\n\n private addAuthMismatchError(auth: FernIr.dynamic.Auth, values: FernIr.dynamic.AuthValues): void {\n this.context.errors.add({\n severity: Severity.Critical,\n message: this.context.newAuthMismatchError({ auth, values }).message\n });\n }\n\n private addWarning(message: string): void {\n this.context.errors.add({ severity: Severity.Warning, message });\n }\n\n private getConstructorBasicAuthArg({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.username),\n value: python.TypeInstantiation.str(values.username)\n },\n {\n name: this.context.getPropertyName(auth.password),\n value: python.TypeInstantiation.str(values.password)\n }\n ];\n }\n\n private getConstructorBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.token),\n value: python.TypeInstantiation.str(values.token)\n }\n ];\n }\n\n private getConstructorHeaderAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.HeaderAuth;\n values: FernIr.dynamic.HeaderAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: auth.header.typeReference,\n value: values.value\n })\n }\n ];\n }\n\n private getConstructorOAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.OAuth;\n values: FernIr.dynamic.OAuthValues;\n }): python.NamedValue[] {\n return [\n {\n name: this.context.getPropertyName(auth.clientId),\n value: python.TypeInstantiation.str(values.clientId)\n },\n {\n name: this.context.getPropertyName(auth.clientSecret),\n value: python.TypeInstantiation.str(values.clientSecret)\n }\n ];\n }\n\n private getConstructorHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): python.NamedValue[] {\n const fields: python.NamedValue[] = [];\n for (const header of headers) {\n const field = this.getConstructorHeaderArg({ header, value: values.value });\n if (field != null) {\n fields.push(field);\n }\n }\n return fields;\n }\n\n private getConstructorHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): python.NamedValue | undefined {\n const typeLiteral = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (python.TypeInstantiation.isNop(typeLiteral)) {\n // Literal header values (e.g. \"X-API-Version\") should not be included in the\n // client constructor.\n return undefined;\n }\n return {\n name: this.context.getPropertyName(header.name.name),\n value: typeLiteral\n };\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.AstNode {\n return python.invokeMethod({\n on: python.reference({ name: CLIENT_VAR_NAME }),\n method: this.getMethod({ endpoint }),\n arguments_: this.getMethodArgs({ endpoint, snippet }).map((arg) =>\n python.methodArgument({\n name: arg.name,\n value: arg.value\n })\n ),\n multiline: true\n });\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n switch (endpoint.request.type) {\n case \"inlined\":\n return this.getMethodArgsForInlinedRequest({ request: endpoint.request, snippet });\n case \"body\":\n return this.getMethodArgsForBodyRequest({ request: endpoint.request, snippet });\n default:\n assertNever(endpoint.request);\n }\n }\n\n private getMethodArgsForBodyRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const args: python.NamedValue[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n\n // Get body property names to check for collisions\n let bodyPropertyNames: Set<string> = new Set();\n if (request.body != null) {\n const bodyArgs = this.getBodyRequestArgs({ body: request.body, value: snippet.requestBody });\n bodyPropertyNames = new Set(bodyArgs.map((arg) => arg.name));\n }\n\n // Add path parameters, adding underscore suffix if they collide with body properties\n if (pathParameters.length > 0) {\n const pathArgs = this.getPathParameters({ namedParameters: pathParameters, snippet });\n const disambiguatedPathArgs = pathArgs.map((arg) => {\n // If this path parameter name collides with a body property, add underscore suffix\n if (bodyPropertyNames.has(arg.name)) {\n return { ...arg, name: arg.name + \"_\" };\n }\n return arg;\n });\n args.push(...disambiguatedPathArgs);\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n if (request.body != null) {\n args.push(...this.getBodyRequestArgs({ body: request.body, value: snippet.requestBody }));\n }\n this.context.errors.unscope();\n\n return args;\n }\n\n private getBodyRequestArgs({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): python.NamedValue[] {\n switch (body.type) {\n case \"bytes\":\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.getBytesBodyRequestTypeInstantiation({ value })\n }\n ];\n case \"typeReference\":\n return this.getBodyRequestArgsForTypeReference({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getBodyRequestArgsForTypeReference({\n typeReference,\n value\n }: {\n typeReference: FernIr.dynamic.TypeReference;\n value: unknown;\n }): python.NamedValue[] {\n switch (typeReference.type) {\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: typeReference.value });\n if (named == null) {\n return [];\n }\n return this.getBodyRequestArgsForNamedTypeReference({ typeReference, named, value });\n }\n case \"nullable\":\n case \"optional\": {\n // Check if the inner type is an object - if so, don't flatten it\n const innerType = typeReference.value;\n if (innerType.type === \"named\") {\n const named = this.context.resolveNamedType({ typeId: innerType.value });\n if (named?.type === \"object\") {\n // Optional objects should NOT be flattened - use as single 'request' parameter\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: innerType,\n value\n })\n }\n ];\n }\n }\n // For non-object types, continue unwrapping\n return this.getBodyRequestArgsForTypeReference({ typeReference: typeReference.value, value });\n }\n case \"list\":\n case \"map\":\n case \"set\":\n case \"literal\":\n case \"primitive\":\n case \"unknown\":\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.context.dynamicTypeLiteralMapper.convert({ typeReference, value })\n }\n ];\n default:\n assertNever(typeReference);\n }\n }\n\n private getBodyRequestArgsForNamedTypeReference({\n typeReference,\n named,\n value\n }: {\n typeReference: FernIr.dynamic.TypeReference;\n named: FernIr.dynamic.NamedType;\n value: unknown;\n }): python.NamedValue[] {\n switch (named.type) {\n case \"alias\":\n return this.getBodyRequestArgsForTypeReference({ typeReference: named.typeReference, value });\n case \"enum\":\n case \"discriminatedUnion\":\n case \"undiscriminatedUnion\":\n return [\n {\n name: REQUEST_BODY_ARG_NAME,\n value: this.context.dynamicTypeLiteralMapper.convert({ typeReference, value })\n }\n ];\n case \"object\": {\n const bodyProperties = this.context.associateByWireValue({\n parameters: named.properties,\n values: this.context.getRecord(value) ?? {}\n });\n return bodyProperties.map((property) => ({\n name: this.context.getPropertyName(property.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(property)\n }));\n }\n default:\n assertNever(named);\n }\n }\n\n private getBodyRequestArgsForBytes({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): python.NamedValue[] {\n const typeInstantiation = this.getBytesBodyRequestTypeInstantiation({ value });\n if (python.TypeInstantiation.isNop(typeInstantiation)) {\n return [];\n }\n return [\n {\n name: this.context.getPropertyName(body.bodyKey),\n value: typeInstantiation\n }\n ];\n }\n\n private getBytesBodyRequestTypeInstantiation({ value }: { value: unknown }): python.TypeInstantiation {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected bytes value to be a string, got ${typeof value}`\n });\n return python.TypeInstantiation.nop();\n }\n return python.TypeInstantiation.bytes(value);\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const args: python.NamedValue[] = [];\n\n const inlinePathParameters = this.context.shouldInlinePathParameters();\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: python.NamedValue[] = [];\n if (request.pathParameters != null) {\n pathParameterFields.push(...this.getPathParameters({ namedParameters: request.pathParameters, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const filePropertyInfo = this.getFilePropertyInfo({ request, snippet });\n this.context.errors.unscope();\n\n if (\n !this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ) {\n args.push(...pathParameterFields);\n }\n\n if (\n this.context.needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties: true\n })\n ) {\n args.push(\n ...this.getInlinedRequestArgs({\n request,\n snippet,\n pathParameterFields: this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ? pathParameterFields\n : [],\n filePropertyInfo\n })\n );\n }\n return args;\n }\n\n private getFilePropertyInfo({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): FilePropertyInfo {\n if (request.body == null || !this.context.isFileUploadRequestBody(request.body)) {\n return {\n fileFields: [],\n bodyPropertyFields: []\n };\n }\n return this.context.filePropertyMapper.getFilePropertyInfo({\n body: request.body,\n value: snippet.requestBody\n });\n }\n\n private getInlinedRequestArgs({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: python.NamedValue[];\n filePropertyInfo: FilePropertyInfo;\n }): python.NamedValue[] {\n this.context.errors.scope(Scope.QueryParameters);\n const queryParameters = this.context.associateQueryParametersByWireValue({\n parameters: request.queryParameters ?? [],\n values: snippet.queryParameters ?? {}\n });\n const queryParameterFields = queryParameters.map((queryParameter) => ({\n name: this.context.getPropertyName(queryParameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(queryParameter)\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n const headers = this.context.associateByWireValue({\n parameters: request.headers ?? [],\n values: snippet.headers ?? {}\n });\n const headerFields = headers.map((header) => ({\n name: this.context.getPropertyName(header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(header)\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const requestBodyFields =\n request.body != null\n ? this.getInlinedRequestBodyObjectFields({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return [...pathParameterFields, ...queryParameterFields, ...headerFields, ...requestBodyFields];\n }\n\n private getInlinedRequestBodyObjectFields({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): python.NamedValue[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyObjectFields({ parameters: body.value, value });\n case \"referenced\":\n return this.getReferencedRequestBodyPropertyTypeInstantiation({ body, value });\n case \"fileUpload\":\n return this.getFileUploadRequestBodyObjectFields({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyObjectFields({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): python.NamedValue[] {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n\n private getReferencedRequestBodyPropertyTypeInstantiation({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): python.NamedValue[] {\n const bodyType = body.bodyType;\n switch (bodyType.type) {\n case \"bytes\":\n return this.getBodyRequestArgsForBytes({ body, value });\n case \"typeReference\":\n return this.getBodyRequestArgsForTypeReference({ typeReference: bodyType.value, value });\n default:\n assertNever(bodyType);\n }\n }\n\n private getInlinedRequestBodyPropertyObjectFields({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): python.NamedValue[] {\n const fields: python.NamedValue[] = [];\n\n const bodyProperties = this.context.associateByWireValue({\n parameters,\n values: this.context.getRecord(value) ?? {}\n });\n for (const parameter of bodyProperties) {\n fields.push({\n name: this.context.getPropertyName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(parameter)\n });\n }\n\n return fields;\n }\n\n private getPathParameters({\n namedParameters,\n snippet\n }: {\n namedParameters: FernIr.dynamic.NamedParameter[];\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): python.NamedValue[] {\n const args: python.NamedValue[] = [];\n\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {},\n\n // Path parameters are distributed across the client constructor\n // and the request method, so we ignore missing parameters here.\n ignoreMissingParameters: true\n });\n for (const parameter of pathParameters) {\n args.push({\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 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 private getEnvironmentOptionName({\n environment\n }: {\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): string {\n if (environment != null) {\n return \"environment\";\n }\n return \"base_url\";\n }\n}\n"],"mappings":"iIAAAA,IAAAC,IAQA,IAAMC,EAAsD,CACxD,KAAM,YACN,MAAO,QACX,EACMC,EAAsB,CAAC,SAAS,EAChCC,EAAkB,SAClBC,EAAwB,UAEjBC,EAAN,KAA+B,CAGlC,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEA,MAAa,gBAAgB,CACzB,SAAAE,EACA,QAAAC,CACJ,EAGoB,CAEhB,OADa,KAAK,gBAAgB,CAAE,SAAAD,EAAU,QAASC,CAAQ,CAAC,EACpD,SAAS,CACzB,CAEO,oBAAoB,CACvB,SAAAD,EACA,QAAAC,CACJ,EAGW,CAEP,OADa,KAAK,gBAAgB,CAAE,SAAAD,EAAU,QAASC,CAAQ,CAAC,EACpD,SAAS,CACzB,CAEA,MAAa,mBAAmB,CAC5B,SAAAD,EACA,QAAAC,EACA,QAAAC,CACJ,EAI6B,CACzB,MAAM,IAAI,MAAM,aAAa,CACjC,CAEQ,gBAAgB,CACpB,SAAAF,EACA,QAAAG,CACJ,EAGsB,CAClB,OAAOC,EAAO,KAAK,CACf,KAAMV,EACN,WAAY,CAAC,KAAK,gBAAgB,CAAE,SAAAM,EAAU,QAAAG,CAAQ,CAAC,EAAG,KAAK,WAAW,CAAE,SAAAH,EAAU,QAAAG,CAAQ,CAAC,CAAC,CACpG,CAAC,CACL,CAEQ,gBAAgB,CACpB,SAAAH,EACA,QAAAG,CACJ,EAGmB,CACf,OAAOC,EAAO,OAAO,CACjB,IAAKA,EAAO,U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IAAI,CAAC,GAEpE,KAAK,QAAQ,cAAcA,EAAS,YAAY,IAAI,CAC/D,CAEQ,yBAAyB,CAC7B,YAAAW,CACJ,EAEW,CACP,OAAIA,GAAe,KACR,cAEJ,UACX,CACJ","names":["init_process","init_buffer","STRING_TYPE_REFERENCE","SNIPPET_MODULE_PATH","CLIENT_VAR_NAME","REQUEST_BODY_ARG_NAME","EndpointSnippetGenerator","context","__publicField","endpoint","request","options","snippet","python_exports","arg","fields","environmentArgs","Severity","Scope","baseUrl","environment","environmentValue","environmentTypeReference","key","value","auth","values","assertNever","message","headers","header","field","typeLiteral","_a","_b","args","pathParameters","bodyPropertyNames","bodyArgs","disambiguatedPathArgs","__spreadProps","__spreadValues","body","typeReference","named","innerType","property","typeInstantiation","inlinePathParameters","pathParameterFields","filePropertyInfo","_c","_d","queryParameterFields","queryParameter","headerFields","requestBodyFields","bodyType","parameters","bodyProperties","parameter","namedParameters","val"]}
|
package/esm/chunk-H7RJMI6N.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-3ODWLSDW.js";import{a as p}from"./chunk-XX42ILF7.js";import{a as r}from"./chunk-AK6ZQDEA.js";import{f as n,g as t}from"./chunk-YEXRWSXV.js";n();t();var o=class extends r{constructor({ir:e,config:a}){super(new p({ir:e,config:a}))}async generate(e){return super.generate(e)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new i({context:e})}};export{o as a};
|
|
2
|
-
//# sourceMappingURL=chunk-H7RJMI6N.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractAstNode,\n AbstractDynamicSnippetsGenerator,\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 constructor({\n ir,\n config\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n }) {\n super(new DynamicSnippetsGeneratorContext({ ir, config }));\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 public async generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode> {\n return super.generateSnippetAst(request);\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context });\n }\n}\n"],"mappings":"uKAAAA,IAAAC,IASO,IAAMC,EAAN,cAAuCC,CAG5C,CACE,YAAY,CACR,GAAAC,EACA,OAAAC,CACJ,EAGG,CACC,MAAM,IAAIC,EAAgC,CAAE,GAAAF,EAAI,OAAAC,CAAO,CAAC,CAAC,CAC7D,CAEA,MAAa,SACTE,EAC+C,CAC/C,OAAO,MAAM,SAASA,CAAO,CACjC,CAEO,aAAaA,EAAwF,CACxG,OAAO,MAAM,aAAaA,CAAO,CACrC,CAEA,MAAa,mBAAmBA,EAA0E,CACtG,OAAO,MAAM,mBAAmBA,CAAO,CAC3C,CAEU,uBAAuBC,EAAoE,CACjG,OAAO,IAAIC,EAAyB,CAAE,QAAAD,CAAQ,CAAC,CACnD,CACJ","names":["init_process","init_buffer","DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","DynamicSnippetsGeneratorContext","request","context","EndpointSnippetGenerator"]}
|