@fern-api/php-dynamic-snippets 0.0.12 → 0.0.14
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 +9 -9
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +2 -2
- package/cjs/EndpointSnippetGenerator.cjs +8 -8
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +15 -2
- package/cjs/index.cjs +9 -9
- package/cjs/index.cjs.map +1 -1
- package/esm/DynamicSnippetsGenerator.d.ts +2 -2
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/EndpointSnippetGenerator.d.ts +15 -2
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/chunk-EIFVUIK7.js +2 -0
- package/esm/chunk-EIFVUIK7.js.map +1 -0
- package/esm/chunk-VYTKQRKI.js +4 -0
- package/esm/chunk-VYTKQRKI.js.map +1 -0
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/esm/chunk-H5RDFV37.js +0 -2
- package/esm/chunk-H5RDFV37.js.map +0 -1
- package/esm/chunk-SVA2HM4U.js +0 -4
- package/esm/chunk-SVA2HM4U.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
1
|
+
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, Options, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
3
|
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-CwkDTYOI.js';
|
|
4
4
|
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.js';
|
|
@@ -11,7 +11,7 @@ declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<
|
|
|
11
11
|
});
|
|
12
12
|
generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
13
13
|
generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
|
|
14
|
-
generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode>;
|
|
14
|
+
generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest, options?: Options): Promise<AbstractAstNode>;
|
|
15
15
|
protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-EIFVUIK7.js";import"./chunk-VYTKQRKI.js";import"./chunk-E5GKCY37.js";import"./chunk-WWRNGEPJ.js";import"./chunk-RC5VUNGI.js";import"./chunk-3QAUV5WT.js";import"./chunk-PYHFKEW4.js";export{a as DynamicSnippetsGenerator};
|
|
2
2
|
//# sourceMappingURL=DynamicSnippetsGenerator.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
1
|
+
import { Options, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
2
|
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
3
|
import { php } from '@fern-api/php-codegen';
|
|
4
4
|
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-CwkDTYOI.js';
|
|
@@ -16,16 +16,29 @@ declare class EndpointSnippetGenerator {
|
|
|
16
16
|
endpoint: FernIr.dynamic.Endpoint;
|
|
17
17
|
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
18
18
|
}): string;
|
|
19
|
-
generateSnippetAst({ endpoint, request }: {
|
|
19
|
+
generateSnippetAst({ endpoint, request, options }: {
|
|
20
20
|
endpoint: FernIr.dynamic.Endpoint;
|
|
21
21
|
request: FernIr.dynamic.EndpointSnippetRequest;
|
|
22
|
+
options?: Options;
|
|
22
23
|
}): Promise<AbstractAstNode>;
|
|
23
24
|
buildCodeBlock({ endpoint, snippet }: {
|
|
24
25
|
endpoint: FernIr.dynamic.Endpoint;
|
|
25
26
|
snippet: FernIr.dynamic.EndpointSnippetRequest;
|
|
26
27
|
}): php.AstNode;
|
|
28
|
+
buildCodeBlockWithoutClient({ endpoint, snippet }: {
|
|
29
|
+
endpoint: FernIr.dynamic.Endpoint;
|
|
30
|
+
snippet: FernIr.dynamic.EndpointSnippetRequest;
|
|
31
|
+
}): php.AstNode;
|
|
27
32
|
private constructClient;
|
|
28
33
|
private callMethod;
|
|
34
|
+
private callMethodOnExistingClient;
|
|
35
|
+
/**
|
|
36
|
+
* Builds request options from snippet headers for per-request options.
|
|
37
|
+
* This is used when generating snippets for existing clients (e.g., wire tests)
|
|
38
|
+
* where headers should be passed as method call options rather than client constructor options.
|
|
39
|
+
* Only includes headers that are NOT already mapped to the request directly (i.e., not defined in the IR).
|
|
40
|
+
*/
|
|
41
|
+
private getRequestOptions;
|
|
29
42
|
private getConstructorArgs;
|
|
30
43
|
private getConstructorAuthArgs;
|
|
31
44
|
private addError;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-VYTKQRKI.js";import"./chunk-RC5VUNGI.js";import"./chunk-PYHFKEW4.js";export{a as EndpointSnippetGenerator};
|
|
2
2
|
//# sourceMappingURL=EndpointSnippetGenerator.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o}from"./chunk-VYTKQRKI.js";import{a as i}from"./chunk-E5GKCY37.js";import{a as p}from"./chunk-RC5VUNGI.js";import{f as t,g as r}from"./chunk-PYHFKEW4.js";t();r();var a=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,n){return await super.generateSnippetAst(e,n)}createSnippetGenerator(e){return new o({context:e})}};export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-EIFVUIK7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractAstNode,\n AbstractDynamicSnippetsGenerator,\n FernGeneratorExec,\n Options\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(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options?: Options\n ): Promise<AbstractAstNode> {\n return await super.generateSnippetAst(request, options);\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context });\n }\n}\n"],"mappings":"uKAAAA,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,mBACTA,EACAC,EACwB,CACxB,OAAO,MAAM,MAAM,mBAAmBD,EAASC,CAAO,CAC1D,CAEU,uBAAuBC,EAAoE,CACjG,OAAO,IAAIC,EAAyB,CAAE,QAAAD,CAAQ,CAAC,CACnD,CACJ","names":["init_process","init_buffer","DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","DynamicSnippetsGeneratorContext","request","options","context","EndpointSnippetGenerator"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{b as l,d as p}from"./chunk-RC5VUNGI.js";import{e as F,f as I,g as x,h as m,l as i}from"./chunk-PYHFKEW4.js";I();x();var A="$client",f="Example",C=`<?php
|
|
2
|
+
|
|
3
|
+
`,P=class{constructor({context:e}){F(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return C+await r.toStringAsync({namespace:f,rootNamespace:f,customConfig:(n=this.context.customConfig)!=null?n:{}})}generateSnippetSync({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return C+r.toString({namespace:f,rootNamespace:f,customConfig:(n=this.context.customConfig)!=null?n:{}})}async generateSnippetAst({endpoint:e,request:t,options:r}){return r!=null&&r.skipClientInstantiation?this.buildCodeBlockWithoutClient({endpoint:e,snippet:t}):this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return i.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),r.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})}buildCodeBlockWithoutClient({endpoint:e,snippet:t}){return i.codeblock(r=>{r.writeNodeStatement(this.callMethodOnExistingClient({endpoint:e,snippet:t}))})}constructClient({endpoint:e,snippet:t}){return i.codeblock(r=>{r.write(`${A} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return i.invokeMethod({on:i.codeblock(A),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),multiline:!0})}callMethodOnExistingClient({endpoint:e,snippet:t}){let r=this.getMethodArgs({endpoint:e,snippet:t}),n=this.getRequestOptions({endpoint:e,snippet:t});return i.TypeLiteral.isNop(n)||r.push(n),i.invokeMethod({on:i.codeblock("$this->client"),method:this.getMethod({endpoint:e}),arguments_:r,multiline:!0})}getRequestOptions({endpoint:e,snippet:t}){var o;let r=(o=t.headers)!=null?o:{},n=Object.entries(r);if(n.length===0)return i.TypeLiteral.nop();let s=new Set;if(this.context.ir.headers!=null)for(let c of this.context.ir.headers)s.add(c.name.wireValue.toLowerCase());if(e.request.type==="inlined"&&e.request.headers!=null)for(let c of e.request.headers)s.add(c.name.wireValue.toLowerCase());let a=n.filter(([c])=>!s.has(c.toLowerCase()));return a.length===0?i.TypeLiteral.nop():i.TypeLiteral.map({entries:[{key:i.TypeLiteral.string("headers"),value:i.TypeLiteral.map({entries:a.map(([c,u])=>({key:i.TypeLiteral.string(c),value:i.TypeLiteral.string(String(u))}))})}]})}getConstructorArgs({endpoint:e,snippet:t}){var c;let r=[];if(e.auth!=null)if(t.auth!=null)r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth}));else if(e.auth.type==="inferred"){let u={type:"inferred"};r.push(...this.getConstructorInferredAuthArgs({auth:e.auth,values:u}))}else this.context.errors.add({severity:l.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`});let n=((c=this.context.ir.environments)==null?void 0:c.environments.type)==="multipleBaseUrls",s=this.getConstructorEnvironmentArg({environment:t.environment,hasMultiUrlEnvironments:n}),a=[];if(!n){let u=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});u.length>0&&a.push(...u)}this.context.errors.scope(p.Headers),this.context.ir.headers!=null&&t.headers!=null&&a.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=[...r];return s!=null&&o.push(s),a.length>0&&o.push({name:"options",assignment:i.TypeLiteral.map({entries:a.map(u=>({key:i.TypeLiteral.string(u.name),value:u.value}))})}),o}getConstructorAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getConstructorHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getConstructorOAuthArgs({auth:e,values:t}):[];case"inferred":return t.type==="inferred"?this.getConstructorInferredAuthArgs({auth:e,values:t}):[];default:m(e)}}addError(e){this.context.errors.add({severity:l.Critical,message:e})}addWarning(e){this.context.errors.add({severity:l.Warning,message:e})}getConstructorBasicAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),assignment:i.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),assignment:i.TypeLiteral.string(t.password)}]}getConstructorEnvironmentArg({environment:e,hasMultiUrlEnvironments:t}){if(!t)return;let r=this.context.getEnvironmentsClassReference();if(e!=null){if(this.context.isSingleEnvironmentID(e)){let s=this.context.resolveEnvironmentName(e);if(s==null){this.addWarning(`Environment "${e}" was not found`);return}let a=this.context.getClassName(s);return{name:"environment",assignment:i.TypeLiteral.reference(i.codeblock(o=>{o.writeNode(r),o.write("::"),o.write(a),o.write("()")}))}}if(this.context.isMultiEnvironmentValues(e)){let s=this.resolveMultiEnvironmentName(e);if(s==null){this.addWarning("Invalid multi url environment");return}return s.type==="named"?{name:"environment",assignment:i.TypeLiteral.reference(i.codeblock(a=>{a.writeNode(r),a.write("::"),a.write(s.name),a.write("()")}))}:{name:"environment",assignment:i.TypeLiteral.reference(i.codeblock(a=>{a.writeNode(r),a.write("::custom(");let o=Object.entries(s.urls);o.forEach(([c,u],d)=>{a.write(`${c}: '${u}'`),d<o.length-1&&a.write(", ")}),a.write(")")}))}}}let n=this.getDefaultEnvironmentName();if(n!=null)return{name:"environment",assignment:i.TypeLiteral.reference(i.codeblock(s=>{s.writeNode(r),s.write("::"),s.write(n),s.write("()")}))}}getDefaultEnvironmentName(){var n;if(((n=this.context.ir.environments)==null?void 0:n.environments.type)!=="multipleBaseUrls")return;let e=this.context.ir.environments.environments;if(e.type!=="multipleBaseUrls")return;let t=e.environments;if(t.length===0)return;for(let s of t){let a=this.context.getClassName(s.name);if(a==="Production")return a}let r=t[0];if(r!=null)return this.context.getClassName(r.name)}resolveMultiEnvironmentName(e){let t=Object.keys(e);if(t.length===0||!this.context.validateMultiEnvironmentUrlValues(e))return;let r=t[0];if(r==null)return;let n=e[r];if(n==null)return;let s=this.context.resolveEnvironmentName(n);if(s!=null&&t.every(c=>{let u=e[c];return u==null?!1:this.context.resolveEnvironmentName(u)!=null&&u===n}))return{type:"named",name:this.context.getClassName(s)};let a={};for(let o of t){let c=e[o];if(c==null)continue;let u=this.getBaseUrlPropertyName(o);a[u]=c}if(Object.keys(a).length>0)return{type:"custom",urls:a}}getBaseUrlPropertyName(e){var n;if(((n=this.context.ir.environments)==null?void 0:n.environments.type)!=="multipleBaseUrls")return e;let t=this.context.ir.environments.environments;if(t.type!=="multipleBaseUrls")return e;let r=t.baseUrls.find(s=>s.id===e);return r==null?e:r.name.camelCase.safeName}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});return i.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null)return this.context.errors.add({severity:l.Critical,message:"Cannot specify both baseUrl and environment options"}),i.TypeLiteral.nop();if(e!=null)return i.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let n=this.context.getEnvironmentClassAccessFromID(t);return n==null?(this.context.errors.add({severity:l.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),i.TypeLiteral.nop()):i.TypeLiteral.reference(i.codeblock(s=>{s.writeNode(n),s.write("->value")}))}if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls")return i.TypeLiteral.nop()}return i.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),assignment:i.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),assignment:i.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),assignment:i.TypeLiteral.string(t.clientSecret)}]}getConstructorInferredAuthArgs({auth:e,values:t}){return[]}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({name:this.context.getPropertyName(n.name.name),value:s})}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!i.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:m(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var s,a;let r=[];this.context.errors.scope(p.PathParameters);let n=[...(s=this.context.ir.pathParameters)!=null?s:[],...(a=e.pathParameters)!=null?a:[]];return n.length>0&&r.push(...this.getPathParameters({namedParameters:n,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:m(e)}}getBytesBodyRequestArg({value:e}){return this.context.errors.add({severity:l.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),i.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:e,snippet:t}){var c,u,d,h;let r=[],n=(u=(c=this.context.customConfig)==null?void 0:c.inlinePathParameters)!=null?u:!1;this.context.errors.scope(p.PathParameters);let s=[],a=[...(d=this.context.ir.pathParameters)!=null?d:[],...(h=e.pathParameters)!=null?h:[]];a.length>0&&s.push(...this.getPathParameters({namedParameters:a,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let o=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})||r.push(...s.map(g=>g.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:n,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})?s:[],filePropertyInfo:o})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:n}){var d,h,g,v;this.context.errors.scope(p.QueryParameters);let a=this.context.associateQueryParametersByWireValue({parameters:(d=e.queryParameters)!=null?d:[],values:(h=t.queryParameters)!=null?h:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(p.Headers);let c=this.context.associateByWireValue({parameters:(g=e.headers)!=null?g:[],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(p.RequestBody);let u=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:n}):[];return this.context.errors.unscope(),i.TypeLiteral.class_({reference:i.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getRequestNamespace(e.declaration.fernFilepath)}),fields:[...r,...a,...c,...u]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:m(e)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:m(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var s;let r=[],n=this.context.associateByWireValue({parameters:e,values:(s=this.context.getRecord(t))!=null?s:{}});for(let a of n)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],n=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{}});for(let a of n)r.push({name:this.context.getPropertyName(a.name.name),value:this.context.dynamicTypeLiteralMapper.convert(a)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getPropertyName(t)).join("->")}->${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientClassInstantiation(e){return i.instantiateClass({classReference:i.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:e,multiline:!0})}};export{P as a};
|
|
4
|
+
//# sourceMappingURL=chunk-VYTKQRKI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractAstNode, NamedArgument, 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 { php } from \"@fern-api/php-codegen\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst CLIENT_VAR_NAME = \"$client\";\nconst SNIPPET_NAMESPACE = \"Example\";\nconst PHP_PREFIX = \"<?php\\n\\n\";\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 code = this.buildCodeBlock({ endpoint, snippet: request });\n return (\n PHP_PREFIX +\n (await code.toStringAsync({\n namespace: SNIPPET_NAMESPACE,\n rootNamespace: SNIPPET_NAMESPACE,\n customConfig: this.context.customConfig ?? {}\n }))\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 (\n PHP_PREFIX +\n code.toString({\n namespace: SNIPPET_NAMESPACE,\n rootNamespace: SNIPPET_NAMESPACE,\n customConfig: this.context.customConfig ?? {}\n })\n );\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 if (options?.skipClientInstantiation) {\n return this.buildCodeBlockWithoutClient({ endpoint, snippet: request });\n }\n return this.buildCodeBlock({ endpoint, snippet: request });\n }\n\n public buildCodeBlock({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.AstNode {\n return php.codeblock((writer) => {\n writer.writeNodeStatement(this.constructClient({ endpoint, snippet }));\n writer.writeNodeStatement(this.callMethod({ endpoint, snippet }));\n });\n }\n\n public buildCodeBlockWithoutClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.AstNode {\n return php.codeblock((writer) => {\n // Skip client instantiation - assume client is already available as $this->client\n writer.writeNodeStatement(this.callMethodOnExistingClient({ endpoint, snippet }));\n });\n }\n\n private constructClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.CodeBlock {\n return php.codeblock((writer) => {\n writer.write(`${CLIENT_VAR_NAME} = `);\n writer.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({ endpoint, snippet })));\n });\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.MethodInvocation {\n return php.invokeMethod({\n on: php.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: this.getMethodArgs({ endpoint, snippet }),\n multiline: true\n });\n }\n\n private callMethodOnExistingClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.MethodInvocation {\n const args = this.getMethodArgs({ endpoint, snippet });\n const requestOptions = this.getRequestOptions({ endpoint, snippet });\n if (!php.TypeLiteral.isNop(requestOptions)) {\n args.push(requestOptions);\n }\n return php.invokeMethod({\n on: php.codeblock(\"$this->client\"),\n method: this.getMethod({ endpoint }),\n arguments_: args,\n multiline: true\n });\n }\n\n /**\n * Builds request options from snippet headers for per-request options.\n * This is used when generating snippets for existing clients (e.g., wire tests)\n * where headers should be passed as method call options rather than client constructor options.\n * Only includes headers that are NOT already mapped to the request directly (i.e., not defined in the IR).\n */\n private getRequestOptions({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.TypeLiteral {\n const headers = snippet.headers ?? {};\n const entries = Object.entries(headers);\n if (entries.length === 0) {\n return php.TypeLiteral.nop();\n }\n\n // Build a set of header names that are already mapped to the request directly\n const mappedHeaderNames = new Set<string>();\n\n // Add global headers from IR\n if (this.context.ir.headers != null) {\n for (const header of this.context.ir.headers) {\n mappedHeaderNames.add(header.name.wireValue.toLowerCase());\n }\n }\n\n // Add endpoint-level headers from inlined request\n if (endpoint.request.type === \"inlined\" && endpoint.request.headers != null) {\n for (const header of endpoint.request.headers) {\n mappedHeaderNames.add(header.name.wireValue.toLowerCase());\n }\n }\n\n // Filter out headers that are already mapped to the request\n const unmappedEntries = entries.filter(([name]) => !mappedHeaderNames.has(name.toLowerCase()));\n if (unmappedEntries.length === 0) {\n return php.TypeLiteral.nop();\n }\n\n return php.TypeLiteral.map({\n entries: [\n {\n key: php.TypeLiteral.string(\"headers\"),\n value: php.TypeLiteral.map({\n entries: unmappedEntries.map(([name, value]) => ({\n key: php.TypeLiteral.string(name),\n value: php.TypeLiteral.string(String(value))\n }))\n })\n }\n ]\n });\n }\n\n private getConstructorArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): NamedArgument[] {\n const authArgs: NamedArgument[] = [];\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n authArgs.push(...this.getConstructorAuthArgs({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n // Provide default auth values for endpoints that require authentication\n if (endpoint.auth.type === \"inferred\") {\n // For inferred auth, provide default test values\n const defaultInferredAuthValues: FernIr.dynamic.InferredAuthValues = {\n type: \"inferred\"\n };\n authArgs.push(\n ...this.getConstructorInferredAuthArgs({\n auth: endpoint.auth,\n values: defaultInferredAuthValues\n })\n );\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\n const hasMultiUrlEnvironments = this.context.ir.environments?.environments.type === \"multipleBaseUrls\";\n const environmentArg = this.getConstructorEnvironmentArg({\n environment: snippet.environment,\n hasMultiUrlEnvironments\n });\n\n const optionArgs: php.ConstructorField[] = [];\n\n if (!hasMultiUrlEnvironments) {\n const baseUrlArgs = this.getConstructorBaseUrlArgs({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (baseUrlArgs.length > 0) {\n optionArgs.push(...baseUrlArgs);\n }\n }\n\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n optionArgs.push(\n ...this.getConstructorHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n\n const args: NamedArgument[] = [...authArgs];\n\n if (environmentArg != null) {\n args.push(environmentArg);\n }\n\n if (optionArgs.length > 0) {\n args.push({\n name: \"options\",\n assignment: php.TypeLiteral.map({\n entries: optionArgs.map((arg) => ({\n key: php.TypeLiteral.string(arg.name),\n value: arg.value\n }))\n })\n });\n }\n\n return args;\n }\n\n private getConstructorAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): NamedArgument[] {\n if (values.type !== auth.type) {\n this.addError(this.context.newAuthMismatchError({ auth, values }).message);\n return [];\n }\n switch (auth.type) {\n case \"basic\":\n return values.type === \"basic\" ? this.getConstructorBasicAuthArgs({ auth, values }) : [];\n case \"bearer\":\n return values.type === \"bearer\" ? this.getConstructorBearerAuthArgs({ auth, values }) : [];\n case \"header\":\n return values.type === \"header\" ? this.getConstructorHeaderAuthArgs({ auth, values }) : [];\n case \"oauth\":\n return values.type === \"oauth\" ? this.getConstructorOAuthArgs({ auth, values }) : [];\n case \"inferred\":\n return values.type === \"inferred\" ? this.getConstructorInferredAuthArgs({ auth, values }) : [];\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 getConstructorBasicAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.username),\n assignment: php.TypeLiteral.string(values.username)\n },\n {\n name: this.context.getPropertyName(auth.password),\n assignment: php.TypeLiteral.string(values.password)\n }\n ];\n }\n\n private getConstructorEnvironmentArg({\n environment,\n hasMultiUrlEnvironments\n }: {\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n hasMultiUrlEnvironments: boolean;\n }): NamedArgument | undefined {\n if (!hasMultiUrlEnvironments) {\n return undefined;\n }\n\n const environmentClassRef = this.context.getEnvironmentsClassReference();\n\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const environmentName = this.context.resolveEnvironmentName(environment);\n if (environmentName == null) {\n this.addWarning(`Environment \"${environment}\" was not found`);\n return undefined;\n }\n const className = this.context.getClassName(environmentName);\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::`);\n writer.write(className);\n writer.write(`()`);\n })\n )\n };\n }\n\n if (this.context.isMultiEnvironmentValues(environment)) {\n const result = this.resolveMultiEnvironmentName(environment);\n if (result == null) {\n this.addWarning(\"Invalid multi url environment\");\n return undefined;\n }\n if (result.type === \"named\") {\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::`);\n writer.write(result.name);\n writer.write(`()`);\n })\n )\n };\n } else {\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::custom(`);\n const entries = Object.entries(result.urls);\n entries.forEach(([paramName, url], index) => {\n writer.write(`${paramName}: '${url}'`);\n if (index < entries.length - 1) {\n writer.write(`, `);\n }\n });\n writer.write(`)`);\n })\n )\n };\n }\n }\n }\n\n const defaultName = this.getDefaultEnvironmentName();\n if (defaultName == null) {\n return undefined;\n }\n\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::`);\n writer.write(defaultName);\n writer.write(`()`);\n })\n )\n };\n }\n\n private getDefaultEnvironmentName(): string | undefined {\n if (this.context.ir.environments?.environments.type !== \"multipleBaseUrls\") {\n return undefined;\n }\n\n const environmentsConfig = this.context.ir.environments.environments;\n if (environmentsConfig.type !== \"multipleBaseUrls\") {\n return undefined;\n }\n\n const environments = environmentsConfig.environments;\n if (environments.length === 0) {\n return undefined;\n }\n\n for (const env of environments) {\n const className = this.context.getClassName(env.name);\n if (className === \"Production\") {\n return className;\n }\n }\n\n const firstEnv = environments[0];\n if (firstEnv == null) {\n return undefined;\n }\n return this.context.getClassName(firstEnv.name);\n }\n\n private resolveMultiEnvironmentName(\n environment: FernIr.dynamic.MultipleEnvironmentUrlValues\n ): { type: \"named\"; name: string } | { type: \"custom\"; urls: Record<string, string> } | undefined {\n const baseUrlIds = Object.keys(environment);\n if (baseUrlIds.length === 0) {\n return undefined;\n }\n\n // Validate that all required base URLs are provided\n if (!this.context.validateMultiEnvironmentUrlValues(environment)) {\n return undefined;\n }\n\n const firstBaseUrlId = baseUrlIds[0];\n if (firstBaseUrlId == null) {\n return undefined;\n }\n\n const firstBaseUrlValue = environment[firstBaseUrlId];\n if (firstBaseUrlValue == null) {\n return undefined;\n }\n\n // Check if the first value is a valid environment ID (not just any string)\n const firstEnvironmentName = this.context.resolveEnvironmentName(firstBaseUrlValue);\n if (firstEnvironmentName != null) {\n // Check if all values point to the same environment\n const allSameEnvironment = baseUrlIds.every((baseUrlId) => {\n const value = environment[baseUrlId];\n if (value == null) {\n return false;\n }\n const envName = this.context.resolveEnvironmentName(value);\n return envName != null && value === firstBaseUrlValue;\n });\n\n if (allSameEnvironment) {\n return { type: \"named\", name: this.context.getClassName(firstEnvironmentName) };\n }\n }\n\n // Treat all values as custom URLs\n const urls: Record<string, string> = {};\n for (const baseUrlId of baseUrlIds) {\n const value = environment[baseUrlId];\n if (value == null) {\n continue;\n }\n const paramName = this.getBaseUrlPropertyName(baseUrlId);\n urls[paramName] = value;\n }\n\n if (Object.keys(urls).length > 0) {\n return { type: \"custom\", urls };\n }\n\n return undefined;\n }\n\n private getBaseUrlPropertyName(baseUrlId: string): string {\n if (this.context.ir.environments?.environments.type !== \"multipleBaseUrls\") {\n return baseUrlId;\n }\n\n const environmentsConfig = this.context.ir.environments.environments;\n if (environmentsConfig.type !== \"multipleBaseUrls\") {\n return baseUrlId;\n }\n\n const baseUrl = environmentsConfig.baseUrls.find((url) => url.id === baseUrlId);\n if (baseUrl == null) {\n return baseUrlId;\n }\n\n return baseUrl.name.camelCase.safeName;\n }\n\n private getConstructorBaseUrlArgs({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): php.ConstructorField[] {\n const baseUrlArg = this.getBaseUrlArg({ baseUrl, environment });\n if (php.TypeLiteral.isNop(baseUrlArg)) {\n return [];\n }\n return [\n {\n name: \"baseUrl\",\n value: baseUrlArg\n }\n ];\n }\n\n private getBaseUrlArg({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): php.TypeLiteral {\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 php.TypeLiteral.nop();\n }\n if (baseUrl != null) {\n return php.TypeLiteral.string(baseUrl);\n }\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const classReference = this.context.getEnvironmentClassAccessFromID(environment);\n if (classReference == null) {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return php.TypeLiteral.nop();\n }\n return php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(classReference);\n writer.write(\"->value\");\n })\n );\n }\n if (this.context.ir.environments?.environments.type === \"multipleBaseUrls\") {\n return php.TypeLiteral.nop();\n }\n }\n return php.TypeLiteral.nop();\n }\n\n private getConstructorBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.token),\n assignment: php.TypeLiteral.string(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 }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.header.name.name),\n assignment: 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 }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.clientId),\n assignment: php.TypeLiteral.string(values.clientId)\n },\n {\n name: this.context.getPropertyName(auth.clientSecret),\n assignment: php.TypeLiteral.string(values.clientSecret)\n }\n ];\n }\n\n private getConstructorInferredAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.InferredAuth;\n values: FernIr.dynamic.InferredAuthValues;\n }): NamedArgument[] {\n // For now, return empty array to avoid the RangeError issue\n // The inferred auth parameters should be extracted from the normal IR,\n // not the dynamic IR which doesn't contain the detailed endpoint information\n return [];\n }\n\n private getConstructorHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): php.ConstructorField[] {\n const args: php.ConstructorField[] = [];\n for (const header of headers) {\n const arg = this.getConstructorHeaderArg({ header, value: values.value });\n if (arg != null) {\n args.push({\n name: this.context.getPropertyName(header.name.name),\n value: arg\n });\n }\n }\n return args;\n }\n\n private getConstructorHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): php.TypeLiteral | undefined {\n const typeLiteral = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (php.TypeLiteral.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 typeLiteral;\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.TypeLiteral[] {\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 }): php.TypeLiteral[] {\n const args: php.TypeLiteral[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n args.push(\n ...this.getPathParameters({ namedParameters: pathParameters, snippet }).map((field) => field.value)\n );\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n if (request.body != null) {\n args.push(this.getBodyRequestArg({ body: request.body, value: snippet.requestBody }));\n }\n this.context.errors.unscope();\n\n return args;\n }\n\n private getBodyRequestArg({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): php.TypeLiteral {\n switch (body.type) {\n case \"bytes\": {\n return this.getBytesBodyRequestArg({ value });\n }\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getBytesBodyRequestArg({ value }: { value: unknown }): php.TypeLiteral {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"The PHP SDK doesn't support bytes requests yet\"\n });\n return php.TypeLiteral.nop();\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.TypeLiteral[] {\n const args: php.TypeLiteral[] = [];\n\n const inlinePathParameters = this.context.customConfig?.inlinePathParameters ?? false;\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: php.ConstructorField[] = [];\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n pathParameterFields.push(...this.getPathParameters({ namedParameters: 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 (!this.context.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n args.push(...pathParameterFields.map((field) => field.value));\n }\n\n if (\n this.context.needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties: true // The PHP SDK requires inlineFileProperties.\n })\n ) {\n args.push(\n this.getInlinedRequestArg({\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 getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: php.ConstructorField[];\n filePropertyInfo: FilePropertyInfo;\n }): php.TypeLiteral {\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.getInlinedRequestBodyConstructorFields({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return php.TypeLiteral.class_({\n reference: php.classReference({\n name: this.context.getClassName(request.declaration.name),\n namespace: this.context.getRequestNamespace(request.declaration.fernFilepath)\n }),\n fields: [...pathParameterFields, ...queryParameterFields, ...headerFields, ...requestBodyFields]\n });\n }\n\n private getInlinedRequestBodyConstructorFields({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): php.ConstructorField[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyConstructorFields({ parameters: body.value, value });\n case \"referenced\":\n return [this.getReferencedRequestBodyPropertyConstructorField({ body, value })];\n case \"fileUpload\":\n return this.getFileUploadRequestBodyConstructorFields({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyConstructorFields({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): php.ConstructorField[] {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n\n private getReferencedRequestBodyPropertyConstructorField({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): php.ConstructorField {\n return {\n name: this.context.getPropertyName(body.bodyKey),\n value: this.getReferencedRequestBodyPropertyTypeLiteral({ body: body.bodyType, value })\n };\n }\n\n private getReferencedRequestBodyPropertyTypeLiteral({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): php.TypeLiteral {\n switch (body.type) {\n case \"bytes\":\n return this.getBytesBodyRequestArg({ value });\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getInlinedRequestBodyPropertyConstructorFields({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): php.ConstructorField[] {\n const fields: php.ConstructorField[] = [];\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 }): php.ConstructorField[] {\n const args: php.ConstructorField[] = [];\n\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {}\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.getPropertyName(val))\n .join(\"->\")}->${this.context.getMethodName(endpoint.declaration.name)}`;\n }\n return this.context.getMethodName(endpoint.declaration.name);\n }\n\n private getRootClientClassInstantiation(arguments_: NamedArgument[]): php.ClassInstantiation {\n return php.instantiateClass({\n classReference: php.classReference({\n name: this.context.getRootClientClassName(),\n namespace: this.context.rootNamespace\n }),\n arguments_,\n multiline: true\n });\n }\n}\n"],"mappings":"mHAAAA,IAAAC,IAQA,IAAMC,EAAkB,UAClBC,EAAoB,UACpBC,EAAa;AAAA;AAAA,EAENC,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,CAzBxB,IAAAC,EA0BQ,IAAMC,EAAO,KAAK,eAAe,CAAE,SAAAH,EAAU,QAASC,CAAQ,CAAC,EAC/D,OACIL,EACC,MAAMO,EAAK,cAAc,CACtB,UAAWR,EACX,cAAeA,EACf,cAAcO,EAAA,KAAK,QAAQ,eAAb,KAAAA,EAA6B,CAAC,CAChD,CAAC,CAET,CAEO,oBAA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AAS,CAClE,CAAC,EAGL,OAAO7D,CACX,CAEQ,UAAU,CAAE,SAAAR,CAAS,EAAkD,CAC3E,OAAIA,EAAS,YAAY,aAAa,SAAS,OAAS,EAC7C,GAAGA,EAAS,YAAY,aAAa,SACvC,IAAKuE,GAAQ,KAAK,QAAQ,gBAAgBA,CAAG,CAAC,EAC9C,KAAK,IAAI,CAAC,KAAK,KAAK,QAAQ,cAAcvE,EAAS,YAAY,IAAI,CAAC,GAEtE,KAAK,QAAQ,cAAcA,EAAS,YAAY,IAAI,CAC/D,CAEQ,gCAAgCwE,EAAqD,CACzF,OAAOlE,EAAI,iBAAiB,CACxB,eAAgBA,EAAI,eAAe,CAC/B,KAAM,KAAK,QAAQ,uBAAuB,EAC1C,UAAW,KAAK,QAAQ,aAC5B,CAAC,EACD,WAAAkE,EACA,UAAW,EACf,CAAC,CACL,CACJ","names":["init_process","init_buffer","CLIENT_VAR_NAME","SNIPPET_NAMESPACE","PHP_PREFIX","EndpointSnippetGenerator","context","__publicField","endpoint","request","_a","code","options","snippet","php_exports","writer","args","requestOptions","headers","entries","mappedHeaderNames","header","unmappedEntries","name","value","authArgs","defaultInferredAuthValues","Severity","hasMultiUrlEnvironments","environmentArg","optionArgs","baseUrlArgs","Scope","arg","auth","values","assertNever","message","environment","environmentClassRef","environmentName","className","result","paramName","url","index","defaultName","environmentsConfig","environments","env","firstEnv","baseUrlIds","firstBaseUrlId","firstBaseUrlValue","firstEnvironmentName","baseUrlId","urls","baseUrl","baseUrlArg","classReference","typeLiteral","_b","pathParameters","field","body","_c","_d","inlinePathParameters","pathParameterFields","filePropertyInfo","queryParameterFields","queryParameter","headerFields","requestBodyFields","parameters","fields","bodyProperties","parameter","namedParameters","val","arguments_"]}
|
package/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-EIFVUIK7.js";import{a as n}from"./chunk-VYTKQRKI.js";import"./chunk-E5GKCY37.js";import"./chunk-WWRNGEPJ.js";import"./chunk-RC5VUNGI.js";import"./chunk-3QAUV5WT.js";import{f as e,g as r}from"./chunk-PYHFKEW4.js";e();r();export{o as DynamicSnippetsGenerator,n as EndpointSnippetGenerator};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
package/esm/chunk-H5RDFV37.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-SVA2HM4U.js";import{a as p}from"./chunk-E5GKCY37.js";import{a as r}from"./chunk-RC5VUNGI.js";import{f as n,g as t}from"./chunk-PYHFKEW4.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-H5RDFV37.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"]}
|
package/esm/chunk-SVA2HM4U.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{b as l,d as p}from"./chunk-RC5VUNGI.js";import{e as F,f as x,g as I,h as m,l as a}from"./chunk-PYHFKEW4.js";x();I();var P="$client",f="Example",A=`<?php
|
|
2
|
-
|
|
3
|
-
`,C=class{constructor({context:e}){F(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){var s;let r=this.buildCodeBlock({endpoint:e,snippet:t});return A+await r.toStringAsync({namespace:f,rootNamespace:f,customConfig:(s=this.context.customConfig)!=null?s:{}})}generateSnippetSync({endpoint:e,request:t}){var s;let r=this.buildCodeBlock({endpoint:e,snippet:t});return A+r.toString({namespace:f,rootNamespace:f,customConfig:(s=this.context.customConfig)!=null?s:{}})}async generateSnippetAst({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return a.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),r.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})}constructClient({endpoint:e,snippet:t}){return a.codeblock(r=>{r.write(`${P} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return a.invokeMethod({on:a.codeblock(P),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),multiline:!0})}getConstructorArgs({endpoint:e,snippet:t}){var u;let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:l.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let s=((u=this.context.ir.environments)==null?void 0:u.environments.type)==="multipleBaseUrls",n=this.getConstructorEnvironmentArg({environment:t.environment,hasMultiUrlEnvironments:s}),i=[];if(!s){let c=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});c.length>0&&i.push(...c)}this.context.errors.scope(p.Headers),this.context.ir.headers!=null&&t.headers!=null&&i.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=[...r];return n!=null&&o.push(n),i.length>0&&o.push({name:"options",assignment:a.TypeLiteral.map({entries:i.map(c=>({key:a.TypeLiteral.string(c.name),value:c.value}))})}),o}getConstructorAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getConstructorBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getConstructorBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getConstructorHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getConstructorOAuthArgs({auth:e,values:t}):[];case"inferred":return t.type==="inferred"?this.getConstructorInferredAuthArgs({auth:e,values:t}):[];default:m(e)}}addError(e){this.context.errors.add({severity:l.Critical,message:e})}addWarning(e){this.context.errors.add({severity:l.Warning,message:e})}getConstructorBasicAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),assignment:a.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),assignment:a.TypeLiteral.string(t.password)}]}getConstructorEnvironmentArg({environment:e,hasMultiUrlEnvironments:t}){if(!t)return;let r=this.context.getEnvironmentsClassReference();if(e!=null){if(this.context.isSingleEnvironmentID(e)){let n=this.context.resolveEnvironmentName(e);if(n==null){this.addWarning(`Environment "${e}" was not found`);return}let i=this.context.getClassName(n);return{name:"environment",assignment:a.TypeLiteral.reference(a.codeblock(o=>{o.writeNode(r),o.write("::"),o.write(i),o.write("()")}))}}if(this.context.isMultiEnvironmentValues(e)){let n=this.resolveMultiEnvironmentName(e);if(n==null){this.addWarning("Invalid multi url environment");return}return n.type==="named"?{name:"environment",assignment:a.TypeLiteral.reference(a.codeblock(i=>{i.writeNode(r),i.write("::"),i.write(n.name),i.write("()")}))}:{name:"environment",assignment:a.TypeLiteral.reference(a.codeblock(i=>{i.writeNode(r),i.write("::custom(");let o=Object.entries(n.urls);o.forEach(([u,c],d)=>{i.write(`${u}: '${c}'`),d<o.length-1&&i.write(", ")}),i.write(")")}))}}}let s=this.getDefaultEnvironmentName();if(s!=null)return{name:"environment",assignment:a.TypeLiteral.reference(a.codeblock(n=>{n.writeNode(r),n.write("::"),n.write(s),n.write("()")}))}}getDefaultEnvironmentName(){var s;if(((s=this.context.ir.environments)==null?void 0:s.environments.type)!=="multipleBaseUrls")return;let e=this.context.ir.environments.environments;if(e.type!=="multipleBaseUrls")return;let t=e.environments;if(t.length===0)return;for(let n of t){let i=this.context.getClassName(n.name);if(i==="Production")return i}let r=t[0];if(r!=null)return this.context.getClassName(r.name)}resolveMultiEnvironmentName(e){let t=Object.keys(e);if(t.length===0||!this.context.validateMultiEnvironmentUrlValues(e))return;let r=t[0];if(r==null)return;let s=e[r];if(s==null)return;let n=this.context.resolveEnvironmentName(s);if(n!=null&&t.every(u=>{let c=e[u];return c==null?!1:this.context.resolveEnvironmentName(c)!=null&&c===s}))return{type:"named",name:this.context.getClassName(n)};let i={};for(let o of t){let u=e[o];if(u==null)continue;let c=this.getBaseUrlPropertyName(o);i[c]=u}if(Object.keys(i).length>0)return{type:"custom",urls:i}}getBaseUrlPropertyName(e){var s;if(((s=this.context.ir.environments)==null?void 0:s.environments.type)!=="multipleBaseUrls")return e;let t=this.context.ir.environments.environments;if(t.type!=="multipleBaseUrls")return e;let r=t.baseUrls.find(n=>n.id===e);return r==null?e:r.name.camelCase.safeName}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});return a.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null)return this.context.errors.add({severity:l.Critical,message:"Cannot specify both baseUrl and environment options"}),a.TypeLiteral.nop();if(e!=null)return a.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let s=this.context.getEnvironmentClassAccessFromID(t);return s==null?(this.context.errors.add({severity:l.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),a.TypeLiteral.nop()):a.TypeLiteral.reference(a.codeblock(n=>{n.writeNode(s),n.write("->value")}))}if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls")return a.TypeLiteral.nop()}return a.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),assignment:a.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorOAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.clientId),assignment:a.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),assignment:a.TypeLiteral.string(t.clientSecret)}]}getConstructorInferredAuthArgs({auth:e,values:t}){return[]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let s of e){let n=this.getConstructorHeaderArg({header:s,value:t.value});n!=null&&r.push({name:this.context.getPropertyName(s.name.name),value:n})}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!a.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:m(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var n,i;let r=[];this.context.errors.scope(p.PathParameters);let s=[...(n=this.context.ir.pathParameters)!=null?n:[],...(i=e.pathParameters)!=null?i:[]];return s.length>0&&r.push(...this.getPathParameters({namedParameters:s,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:m(e)}}getBytesBodyRequestArg({value:e}){return this.context.errors.add({severity:l.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),a.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:e,snippet:t}){var u,c,d,h;let r=[],s=(c=(u=this.context.customConfig)==null?void 0:u.inlinePathParameters)!=null?c:!1;this.context.errors.scope(p.PathParameters);let n=[],i=[...(d=this.context.ir.pathParameters)!=null?d:[],...(h=e.pathParameters)!=null?h:[]];i.length>0&&n.push(...this.getPathParameters({namedParameters:i,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let o=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:s})||r.push(...n.map(g=>g.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:s,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:s})?n:[],filePropertyInfo:o})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:s}){var d,h,g,v;this.context.errors.scope(p.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(d=e.queryParameters)!=null?d:[],values:(h=t.queryParameters)!=null?h:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(p.Headers);let u=this.context.associateByWireValue({parameters:(g=e.headers)!=null?g:[],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(p.RequestBody);let c=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:s}):[];return this.context.errors.unscope(),a.TypeLiteral.class_({reference:a.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getRequestNamespace(e.declaration.fernFilepath)}),fields:[...r,...i,...u,...c]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:m(e)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:m(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var n;let r=[],s=this.context.associateByWireValue({parameters:e,values:(n=this.context.getRecord(t))!=null?n:{}});for(let i of s)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getPathParameters({namedParameters:e,snippet:t}){var n;let r=[],s=this.context.associateByWireValue({parameters:e,values:(n=t.pathParameters)!=null?n:{}});for(let i of s)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.getPropertyName(t)).join("->")}->${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientClassInstantiation(e){return a.instantiateClass({classReference:a.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:e,multiline:!0})}};export{C as a};
|
|
4
|
-
//# sourceMappingURL=chunk-SVA2HM4U.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractAstNode, NamedArgument, 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 { php } from \"@fern-api/php-codegen\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst CLIENT_VAR_NAME = \"$client\";\nconst SNIPPET_NAMESPACE = \"Example\";\nconst PHP_PREFIX = \"<?php\\n\\n\";\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 code = this.buildCodeBlock({ endpoint, snippet: request });\n return (\n PHP_PREFIX +\n (await code.toStringAsync({\n namespace: SNIPPET_NAMESPACE,\n rootNamespace: SNIPPET_NAMESPACE,\n customConfig: this.context.customConfig ?? {}\n }))\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 (\n PHP_PREFIX +\n code.toString({\n namespace: SNIPPET_NAMESPACE,\n rootNamespace: SNIPPET_NAMESPACE,\n customConfig: this.context.customConfig ?? {}\n })\n );\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.buildCodeBlock({ endpoint, snippet: request });\n }\n\n public buildCodeBlock({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.AstNode {\n return php.codeblock((writer) => {\n writer.writeNodeStatement(this.constructClient({ endpoint, snippet }));\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 }): php.CodeBlock {\n return php.codeblock((writer) => {\n writer.write(`${CLIENT_VAR_NAME} = `);\n writer.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({ endpoint, snippet })));\n });\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.MethodInvocation {\n return php.invokeMethod({\n on: php.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: this.getMethodArgs({ endpoint, snippet }),\n multiline: true\n });\n }\n\n private getConstructorArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): NamedArgument[] {\n const authArgs: NamedArgument[] = [];\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n authArgs.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 const hasMultiUrlEnvironments = this.context.ir.environments?.environments.type === \"multipleBaseUrls\";\n const environmentArg = this.getConstructorEnvironmentArg({\n environment: snippet.environment,\n hasMultiUrlEnvironments\n });\n\n const optionArgs: php.ConstructorField[] = [];\n\n if (!hasMultiUrlEnvironments) {\n const baseUrlArgs = this.getConstructorBaseUrlArgs({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (baseUrlArgs.length > 0) {\n optionArgs.push(...baseUrlArgs);\n }\n }\n\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n optionArgs.push(\n ...this.getConstructorHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n\n const args: NamedArgument[] = [...authArgs];\n\n if (environmentArg != null) {\n args.push(environmentArg);\n }\n\n if (optionArgs.length > 0) {\n args.push({\n name: \"options\",\n assignment: php.TypeLiteral.map({\n entries: optionArgs.map((arg) => ({\n key: php.TypeLiteral.string(arg.name),\n value: arg.value\n }))\n })\n });\n }\n\n return args;\n }\n\n private getConstructorAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): NamedArgument[] {\n if (values.type !== auth.type) {\n this.addError(this.context.newAuthMismatchError({ auth, values }).message);\n return [];\n }\n switch (auth.type) {\n case \"basic\":\n return values.type === \"basic\" ? this.getConstructorBasicAuthArgs({ auth, values }) : [];\n case \"bearer\":\n return values.type === \"bearer\" ? this.getConstructorBearerAuthArgs({ auth, values }) : [];\n case \"header\":\n return values.type === \"header\" ? this.getConstructorHeaderAuthArgs({ auth, values }) : [];\n case \"oauth\":\n return values.type === \"oauth\" ? this.getConstructorOAuthArgs({ auth, values }) : [];\n case \"inferred\":\n return values.type === \"inferred\" ? this.getConstructorInferredAuthArgs({ auth, values }) : [];\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 getConstructorBasicAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.username),\n assignment: php.TypeLiteral.string(values.username)\n },\n {\n name: this.context.getPropertyName(auth.password),\n assignment: php.TypeLiteral.string(values.password)\n }\n ];\n }\n\n private getConstructorEnvironmentArg({\n environment,\n hasMultiUrlEnvironments\n }: {\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n hasMultiUrlEnvironments: boolean;\n }): NamedArgument | undefined {\n if (!hasMultiUrlEnvironments) {\n return undefined;\n }\n\n const environmentClassRef = this.context.getEnvironmentsClassReference();\n\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const environmentName = this.context.resolveEnvironmentName(environment);\n if (environmentName == null) {\n this.addWarning(`Environment \"${environment}\" was not found`);\n return undefined;\n }\n const className = this.context.getClassName(environmentName);\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::`);\n writer.write(className);\n writer.write(`()`);\n })\n )\n };\n }\n\n if (this.context.isMultiEnvironmentValues(environment)) {\n const result = this.resolveMultiEnvironmentName(environment);\n if (result == null) {\n this.addWarning(\"Invalid multi url environment\");\n return undefined;\n }\n if (result.type === \"named\") {\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::`);\n writer.write(result.name);\n writer.write(`()`);\n })\n )\n };\n } else {\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::custom(`);\n const entries = Object.entries(result.urls);\n entries.forEach(([paramName, url], index) => {\n writer.write(`${paramName}: '${url}'`);\n if (index < entries.length - 1) {\n writer.write(`, `);\n }\n });\n writer.write(`)`);\n })\n )\n };\n }\n }\n }\n\n const defaultName = this.getDefaultEnvironmentName();\n if (defaultName == null) {\n return undefined;\n }\n\n return {\n name: \"environment\",\n assignment: php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(environmentClassRef);\n writer.write(`::`);\n writer.write(defaultName);\n writer.write(`()`);\n })\n )\n };\n }\n\n private getDefaultEnvironmentName(): string | undefined {\n if (this.context.ir.environments?.environments.type !== \"multipleBaseUrls\") {\n return undefined;\n }\n\n const environmentsConfig = this.context.ir.environments.environments;\n if (environmentsConfig.type !== \"multipleBaseUrls\") {\n return undefined;\n }\n\n const environments = environmentsConfig.environments;\n if (environments.length === 0) {\n return undefined;\n }\n\n for (const env of environments) {\n const className = this.context.getClassName(env.name);\n if (className === \"Production\") {\n return className;\n }\n }\n\n const firstEnv = environments[0];\n if (firstEnv == null) {\n return undefined;\n }\n return this.context.getClassName(firstEnv.name);\n }\n\n private resolveMultiEnvironmentName(\n environment: FernIr.dynamic.MultipleEnvironmentUrlValues\n ): { type: \"named\"; name: string } | { type: \"custom\"; urls: Record<string, string> } | undefined {\n const baseUrlIds = Object.keys(environment);\n if (baseUrlIds.length === 0) {\n return undefined;\n }\n\n // Validate that all required base URLs are provided\n if (!this.context.validateMultiEnvironmentUrlValues(environment)) {\n return undefined;\n }\n\n const firstBaseUrlId = baseUrlIds[0];\n if (firstBaseUrlId == null) {\n return undefined;\n }\n\n const firstBaseUrlValue = environment[firstBaseUrlId];\n if (firstBaseUrlValue == null) {\n return undefined;\n }\n\n // Check if the first value is a valid environment ID (not just any string)\n const firstEnvironmentName = this.context.resolveEnvironmentName(firstBaseUrlValue);\n if (firstEnvironmentName != null) {\n // Check if all values point to the same environment\n const allSameEnvironment = baseUrlIds.every((baseUrlId) => {\n const value = environment[baseUrlId];\n if (value == null) {\n return false;\n }\n const envName = this.context.resolveEnvironmentName(value);\n return envName != null && value === firstBaseUrlValue;\n });\n\n if (allSameEnvironment) {\n return { type: \"named\", name: this.context.getClassName(firstEnvironmentName) };\n }\n }\n\n // Treat all values as custom URLs\n const urls: Record<string, string> = {};\n for (const baseUrlId of baseUrlIds) {\n const value = environment[baseUrlId];\n if (value == null) {\n continue;\n }\n const paramName = this.getBaseUrlPropertyName(baseUrlId);\n urls[paramName] = value;\n }\n\n if (Object.keys(urls).length > 0) {\n return { type: \"custom\", urls };\n }\n\n return undefined;\n }\n\n private getBaseUrlPropertyName(baseUrlId: string): string {\n if (this.context.ir.environments?.environments.type !== \"multipleBaseUrls\") {\n return baseUrlId;\n }\n\n const environmentsConfig = this.context.ir.environments.environments;\n if (environmentsConfig.type !== \"multipleBaseUrls\") {\n return baseUrlId;\n }\n\n const baseUrl = environmentsConfig.baseUrls.find((url) => url.id === baseUrlId);\n if (baseUrl == null) {\n return baseUrlId;\n }\n\n return baseUrl.name.camelCase.safeName;\n }\n\n private getConstructorBaseUrlArgs({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): php.ConstructorField[] {\n const baseUrlArg = this.getBaseUrlArg({ baseUrl, environment });\n if (php.TypeLiteral.isNop(baseUrlArg)) {\n return [];\n }\n return [\n {\n name: \"baseUrl\",\n value: baseUrlArg\n }\n ];\n }\n\n private getBaseUrlArg({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): php.TypeLiteral {\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 php.TypeLiteral.nop();\n }\n if (baseUrl != null) {\n return php.TypeLiteral.string(baseUrl);\n }\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const classReference = this.context.getEnvironmentClassAccessFromID(environment);\n if (classReference == null) {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return php.TypeLiteral.nop();\n }\n return php.TypeLiteral.reference(\n php.codeblock((writer) => {\n writer.writeNode(classReference);\n writer.write(\"->value\");\n })\n );\n }\n if (this.context.ir.environments?.environments.type === \"multipleBaseUrls\") {\n return php.TypeLiteral.nop();\n }\n }\n return php.TypeLiteral.nop();\n }\n\n private getConstructorBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.token),\n assignment: php.TypeLiteral.string(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 }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.header.name.name),\n assignment: 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 }): NamedArgument[] {\n return [\n {\n name: this.context.getPropertyName(auth.clientId),\n assignment: php.TypeLiteral.string(values.clientId)\n },\n {\n name: this.context.getPropertyName(auth.clientSecret),\n assignment: php.TypeLiteral.string(values.clientSecret)\n }\n ];\n }\n\n private getConstructorInferredAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.InferredAuth;\n values: FernIr.dynamic.InferredAuthValues;\n }): NamedArgument[] {\n // Inferred auth doesn't require any constructor arguments from the user.\n // The SDK automatically handles token retrieval via the InferredAuthProvider.\n return [];\n }\n\n private getConstructorHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): php.ConstructorField[] {\n const args: php.ConstructorField[] = [];\n for (const header of headers) {\n const arg = this.getConstructorHeaderArg({ header, value: values.value });\n if (arg != null) {\n args.push({\n name: this.context.getPropertyName(header.name.name),\n value: arg\n });\n }\n }\n return args;\n }\n\n private getConstructorHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): php.TypeLiteral | undefined {\n const typeLiteral = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (php.TypeLiteral.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 typeLiteral;\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.TypeLiteral[] {\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 }): php.TypeLiteral[] {\n const args: php.TypeLiteral[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n args.push(\n ...this.getPathParameters({ namedParameters: pathParameters, snippet }).map((field) => field.value)\n );\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n if (request.body != null) {\n args.push(this.getBodyRequestArg({ body: request.body, value: snippet.requestBody }));\n }\n this.context.errors.unscope();\n\n return args;\n }\n\n private getBodyRequestArg({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): php.TypeLiteral {\n switch (body.type) {\n case \"bytes\": {\n return this.getBytesBodyRequestArg({ value });\n }\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getBytesBodyRequestArg({ value }: { value: unknown }): php.TypeLiteral {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"The PHP SDK doesn't support bytes requests yet\"\n });\n return php.TypeLiteral.nop();\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): php.TypeLiteral[] {\n const args: php.TypeLiteral[] = [];\n\n const inlinePathParameters = this.context.customConfig?.inlinePathParameters ?? false;\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: php.ConstructorField[] = [];\n const pathParameters = [...(this.context.ir.pathParameters ?? []), ...(request.pathParameters ?? [])];\n if (pathParameters.length > 0) {\n pathParameterFields.push(...this.getPathParameters({ namedParameters: 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 (!this.context.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n args.push(...pathParameterFields.map((field) => field.value));\n }\n\n if (\n this.context.needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties: true // The PHP SDK requires inlineFileProperties.\n })\n ) {\n args.push(\n this.getInlinedRequestArg({\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 getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: php.ConstructorField[];\n filePropertyInfo: FilePropertyInfo;\n }): php.TypeLiteral {\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.getInlinedRequestBodyConstructorFields({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return php.TypeLiteral.class_({\n reference: php.classReference({\n name: this.context.getClassName(request.declaration.name),\n namespace: this.context.getRequestNamespace(request.declaration.fernFilepath)\n }),\n fields: [...pathParameterFields, ...queryParameterFields, ...headerFields, ...requestBodyFields]\n });\n }\n\n private getInlinedRequestBodyConstructorFields({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): php.ConstructorField[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyConstructorFields({ parameters: body.value, value });\n case \"referenced\":\n return [this.getReferencedRequestBodyPropertyConstructorField({ body, value })];\n case \"fileUpload\":\n return this.getFileUploadRequestBodyConstructorFields({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyConstructorFields({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): php.ConstructorField[] {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n\n private getReferencedRequestBodyPropertyConstructorField({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): php.ConstructorField {\n return {\n name: this.context.getPropertyName(body.bodyKey),\n value: this.getReferencedRequestBodyPropertyTypeLiteral({ body: body.bodyType, value })\n };\n }\n\n private getReferencedRequestBodyPropertyTypeLiteral({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): php.TypeLiteral {\n switch (body.type) {\n case \"bytes\":\n return this.getBytesBodyRequestArg({ value });\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({ typeReference: body.value, value });\n default:\n assertNever(body);\n }\n }\n\n private getInlinedRequestBodyPropertyConstructorFields({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): php.ConstructorField[] {\n const fields: php.ConstructorField[] = [];\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 }): php.ConstructorField[] {\n const args: php.ConstructorField[] = [];\n\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {}\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.getPropertyName(val))\n .join(\"->\")}->${this.context.getMethodName(endpoint.declaration.name)}`;\n }\n return this.context.getMethodName(endpoint.declaration.name);\n }\n\n private getRootClientClassInstantiation(arguments_: NamedArgument[]): php.ClassInstantiation {\n return php.instantiateClass({\n classReference: php.classReference({\n name: this.context.getRootClientClassName(),\n namespace: this.context.rootNamespace\n }),\n arguments_,\n multiline: true\n });\n }\n}\n"],"mappings":"mHAAAA,IAAAC,IAQA,IAAMC,EAAkB,UAClBC,EAAoB,UACpBC,EAAa;AAAA;AAAA,EAENC,EAAN,KAA+B,CAGlC,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,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iBAAiB,CACxB,eAAgBA,EAAI,eAAe,CAC/B,KAAM,KAAK,QAAQ,uBAAuB,EAC1C,UAAW,KAAK,QAAQ,aAC5B,CAAC,EACD,WAAA6D,EACA,UAAW,EACf,CAAC,CACL,CACJ","names":["init_process","init_buffer","CLIENT_VAR_NAME","SNIPPET_NAMESPACE","PHP_PREFIX","EndpointSnippetGenerator","context","__publicField","endpoint","request","_a","code","snippet","php_exports","writer","authArgs","Severity","hasMultiUrlEnvironments","environmentArg","optionArgs","baseUrlArgs","Scope","args","arg","auth","values","assertNever","message","environment","environmentClassRef","environmentName","className","result","entries","paramName","url","index","defaultName","environmentsConfig","environments","env","firstEnv","baseUrlIds","firstBaseUrlId","firstBaseUrlValue","firstEnvironmentName","baseUrlId","value","urls","baseUrl","baseUrlArg","classReference","headers","header","typeLiteral","_b","pathParameters","field","body","_c","_d","inlinePathParameters","pathParameterFields","filePropertyInfo","queryParameterFields","queryParameter","headerFields","requestBodyFields","parameters","fields","bodyProperties","parameter","namedParameters","val","arguments_"]}
|