@fern-api/java-dynamic-snippets 0.0.6 → 0.0.7

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.
Files changed (41) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +3 -3
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/EndpointSnippetGenerator.cjs +2 -2
  4. package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
  5. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +5 -5
  6. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  7. package/cjs/context/DynamicTypeLiteralMapper.cjs +6 -6
  8. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -1
  9. package/cjs/context/DynamicTypeMapper.cjs +5 -5
  10. package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
  11. package/cjs/context/FilePropertyMapper.cjs +5 -5
  12. package/cjs/context/FilePropertyMapper.cjs.map +1 -1
  13. package/cjs/index.cjs +3 -3
  14. package/cjs/index.cjs.map +1 -1
  15. package/esm/DynamicSnippetsGenerator.js +1 -1
  16. package/esm/EndpointSnippetGenerator.js +1 -1
  17. package/esm/{chunk-2KH7MFRW.js → chunk-4CABHDQV.js} +2 -2
  18. package/esm/{chunk-GESEOQT7.js → chunk-DD37GKIE.js} +2 -2
  19. package/esm/{chunk-OMKG67AN.js → chunk-FT6O7RFS.js} +2 -2
  20. package/esm/{chunk-6CITGEM3.js → chunk-JWUP3MFF.js} +3 -3
  21. package/esm/chunk-JWUP3MFF.js.map +1 -0
  22. package/esm/{chunk-G35HVZPV.js → chunk-PSRNJYSA.js} +2 -2
  23. package/esm/{chunk-L6HHZWHP.js → chunk-RVPVA4ZP.js} +2 -2
  24. package/esm/{chunk-SNGFCNTO.js → chunk-TJKLGKYV.js} +2 -2
  25. package/esm/chunk-V3XTHNV6.js +8 -0
  26. package/esm/chunk-V3XTHNV6.js.map +1 -0
  27. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  28. package/esm/context/DynamicTypeLiteralMapper.js +1 -1
  29. package/esm/context/DynamicTypeMapper.js +1 -1
  30. package/esm/context/FilePropertyMapper.js +1 -1
  31. package/esm/index.js +1 -1
  32. package/package.json +1 -1
  33. package/esm/chunk-6CITGEM3.js.map +0 -1
  34. package/esm/chunk-GTD7VYDZ.js +0 -8
  35. package/esm/chunk-GTD7VYDZ.js.map +0 -1
  36. /package/esm/{chunk-2KH7MFRW.js.map → chunk-4CABHDQV.js.map} +0 -0
  37. /package/esm/{chunk-GESEOQT7.js.map → chunk-DD37GKIE.js.map} +0 -0
  38. /package/esm/{chunk-OMKG67AN.js.map → chunk-FT6O7RFS.js.map} +0 -0
  39. /package/esm/{chunk-G35HVZPV.js.map → chunk-PSRNJYSA.js.map} +0 -0
  40. /package/esm/{chunk-L6HHZWHP.js.map → chunk-RVPVA4ZP.js.map} +0 -0
  41. /package/esm/{chunk-SNGFCNTO.js.map → chunk-TJKLGKYV.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{b as h,d as y,e as u}from"./chunk-GESEOQT7.js";import{a as m,d as n}from"./chunk-6CITGEM3.js";import{f,h as B,i as A}from"./chunk-2U3YQWRZ.js";B();A();var b="com.example.usage",M="Example",L="main",E="args",q="client",S={type:"primitive",value:"STRING"},C=class{constructor({context:e,formatter:t}){f(this,"context");f(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){var i;let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:(i=a.fullStylePackageName)!=null?i:b,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){var i;let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:(i=a.fullStylePackageName)!=null?i:b,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=n.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.newLine(),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),s=this.getStyle(r);switch(s){case y.Concise:return a;case y.Full:return this.buildFullCodeBlock({body:a,options:r});default:m(s)}}constructClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${q} = `),r.writeNode(n.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}buildFullCodeBlock({body:e,options:t}){var i;let r=this.getConfig(t),a=n.class_({name:(i=r.fullStyleClassName)!=null?i:M,access:n.Access.Public}),s=n.parameter({name:E,type:n.Type.array(n.Type.string())});return a.addMethod(n.method({name:L,access:n.Access.Public,static_:!0,parameters:[s],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){var o,p;let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:h.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(u.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let s=new Set;if([...(o=this.context.ir.pathParameters)!=null?o:[],...(p=e.request.pathParameters)!=null?p:[]].forEach(l=>{l.variable!=null&&s.add(l.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let l of this.context.ir.variables)if(s.has(l.id)){let c=l.name.camelCase.unsafeName;r.push({name:c,value:n.TypeLiteral.string(`YOUR_${l.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(u.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let l=this.context.ir.pathParameters.filter(c=>c.variable==null);l.length>0&&r.push(...this.getPathParameters({namedParameters:l,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null){this.context.errors.add({severity:h.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:h.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:n.TypeLiteral.string(e)}}if(t!=null){if(this.context.isSingleEnvironmentID(t)){let a=this.context.getEnvironmentTypeReferenceFromID(t);if(a==null){this.context.errors.add({severity:h.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:n.TypeLiteral.reference(a)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:n.TypeLiteral.reference(n.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(a=>this.context.dynamicTypeLiteralMapper.convert({typeReference:S,value:a}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:m(e)}}addError(e){this.context.errors.add({severity:h.Critical,message:e})}addWarning(e){this.context.errors.add({severity:h.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:n.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:n.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:n.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:n.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let s=this.getRootClientHeaderArg({header:a,value:t.value});s!=null&&r.push({name:this.context.getMethodName(a.name.name),value:s})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.codeblock(q),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}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 i;let r=[];this.context.errors.scope(u.PathParameters);let a=((i=e.pathParameters)!=null?i:[]).filter(o=>o.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(u.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:e,snippet:t});return s!=null&&r.push(s),r}usesOptionalNullable(){var e;return((e=this.context.customConfig)==null?void 0:e["collapse-optional-nullable"])===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){if(t==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():n.TypeLiteral.reference(n.invokeMethod({on:n.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request"}),a=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return a.includes("Optional.empty()")||a.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):n.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:m(e)}}getBytesBodyRequestArg({value:e}){return e==null?n.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:h.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeLiteral.nop()):n.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var l;let r=[],{inlinePathParameters:a,inlineFileProperties:s}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(u.PathParameters);let i=[],o=((l=e.pathParameters)!=null?l:[]).filter(c=>c.variable==null);o.length>0&&i.push(...this.getPathParameters({namedParameters:o,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(u.RequestBody);let p=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...i.map(c=>c.value)),s||r.push(...p.fileFields.map(c=>c.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?i:[],filePropertyInfo:p})),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:a}){var v,P,R,x,F,I;this.context.errors.scope(u.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(v=e.queryParameters)!=null?v:[],values:(P=t.queryParameters)!=null?P:{}}).filter(d=>!this.context.isDirectLiteral(d.typeReference)),p=this.context.sortTypeInstancesByRequiredFirst(i,(R=e.queryParameters)!=null?R:[]).map(d=>({name:this.context.getMethodName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:d.typeReference,value:d.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(u.Headers);let c=this.context.associateByWireValue({parameters:(x=e.headers)!=null?x:[],values:(F=t.headers)!=null?F:{}}).filter(d=>!this.context.isDirectLiteral(d.typeReference)),T=this.context.sortTypeInstancesByRequiredFirst(c,(I=e.headers)!=null?I:[]).map(d=>({name:this.context.getMethodName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:d.typeReference,value:d.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(u.RequestBody);let N=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),n.TypeLiteral.builder({classReference:n.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...T,...p,...N]})}getRequestOptionsArg({request:e,snippet:t}){var p,l,c;let r="headers"in e?(p=e.headers)!=null?p:[]:[];if(r.length===0||Object.keys((l=t.headers)!=null?l:{}).length===0)return;this.context.errors.scope(u.Headers);let a=this.context.associateByWireValue({parameters:r,values:(c=t.headers)!=null?c:{}});if(this.context.errors.unscope(),a.length===0)return;let s=n.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),i=n.invokeMethod({on:s,method:"builder",arguments_:[]});for(let g of a)i=n.invokeMethod({on:i,method:"addHeader",arguments_:[n.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let o=n.invokeMethod({on:i,method:"build",arguments_:[]});return n.TypeLiteral.reference(o)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:m(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(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,as:"request"});default:m(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){var i;let a=this.context.associateByWireValue({parameters:e,values:(i=this.context.getRecord(t))!=null?i:{}}).filter(o=>!this.context.isDirectLiteral(o.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(o=>({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:o.typeReference,value:o.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],a=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{}});for(let i of a)r.push({name:this.context.getMethodName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}()`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getStyle(e){var t,r;return(r=(t=e.style)!=null?t:this.context.options.style)!=null?r:y.Full}getConfig(e){var t,r;return(r=(t=e.config)!=null?t:this.context.options.config)!=null?r:{}}};export{C as a};
2
- //# sourceMappingURL=chunk-G35HVZPV.js.map
1
+ import{b as h,d as y,e as u}from"./chunk-DD37GKIE.js";import{a as m,d as n}from"./chunk-JWUP3MFF.js";import{f,h as B,i as A}from"./chunk-2U3YQWRZ.js";B();A();var b="com.example.usage",M="Example",L="main",E="args",q="client",S={type:"primitive",value:"STRING"},C=class{constructor({context:e,formatter:t}){f(this,"context");f(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){var i;let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:(i=a.fullStylePackageName)!=null?i:b,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){var i;let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:(i=a.fullStylePackageName)!=null?i:b,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=n.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.newLine(),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),s=this.getStyle(r);switch(s){case y.Concise:return a;case y.Full:return this.buildFullCodeBlock({body:a,options:r});default:m(s)}}constructClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${q} = `),r.writeNode(n.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}buildFullCodeBlock({body:e,options:t}){var i;let r=this.getConfig(t),a=n.class_({name:(i=r.fullStyleClassName)!=null?i:M,access:n.Access.Public}),s=n.parameter({name:E,type:n.Type.array(n.Type.string())});return a.addMethod(n.method({name:L,access:n.Access.Public,static_:!0,parameters:[s],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){var o,p;let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:h.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(u.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let s=new Set;if([...(o=this.context.ir.pathParameters)!=null?o:[],...(p=e.request.pathParameters)!=null?p:[]].forEach(l=>{l.variable!=null&&s.add(l.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let l of this.context.ir.variables)if(s.has(l.id)){let c=l.name.camelCase.unsafeName;r.push({name:c,value:n.TypeLiteral.string(`YOUR_${l.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(u.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let l=this.context.ir.pathParameters.filter(c=>c.variable==null);l.length>0&&r.push(...this.getPathParameters({namedParameters:l,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null){this.context.errors.add({severity:h.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:h.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:n.TypeLiteral.string(e)}}if(t!=null){if(this.context.isSingleEnvironmentID(t)){let a=this.context.getEnvironmentTypeReferenceFromID(t);if(a==null){this.context.errors.add({severity:h.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:n.TypeLiteral.reference(a)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:n.TypeLiteral.reference(n.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(a=>this.context.dynamicTypeLiteralMapper.convert({typeReference:S,value:a}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:m(e)}}addError(e){this.context.errors.add({severity:h.Critical,message:e})}addWarning(e){this.context.errors.add({severity:h.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:n.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:n.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:n.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:n.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let s=this.getRootClientHeaderArg({header:a,value:t.value});s!=null&&r.push({name:this.context.getMethodName(a.name.name),value:s})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.codeblock(q),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}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 i;let r=[];this.context.errors.scope(u.PathParameters);let a=((i=e.pathParameters)!=null?i:[]).filter(o=>o.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(u.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:e,snippet:t});return s!=null&&r.push(s),r}usesOptionalNullable(){var e;return((e=this.context.customConfig)==null?void 0:e["collapse-optional-nullable"])===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){if(t==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():n.TypeLiteral.reference(n.invokeMethod({on:n.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request"}),a=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return a.includes("Optional.empty()")||a.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):n.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:m(e)}}getBytesBodyRequestArg({value:e}){return e==null?n.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:h.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeLiteral.nop()):n.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var l;let r=[],{inlinePathParameters:a,inlineFileProperties:s}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(u.PathParameters);let i=[],o=((l=e.pathParameters)!=null?l:[]).filter(c=>c.variable==null);o.length>0&&i.push(...this.getPathParameters({namedParameters:o,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(u.RequestBody);let p=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...i.map(c=>c.value)),s||r.push(...p.fileFields.map(c=>c.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?i:[],filePropertyInfo:p})),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:a}){var v,P,R,x,F,I;this.context.errors.scope(u.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(v=e.queryParameters)!=null?v:[],values:(P=t.queryParameters)!=null?P:{}}).filter(d=>!this.context.isDirectLiteral(d.typeReference)),p=this.context.sortTypeInstancesByRequiredFirst(i,(R=e.queryParameters)!=null?R:[]).map(d=>({name:this.context.getMethodName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:d.typeReference,value:d.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(u.Headers);let c=this.context.associateByWireValue({parameters:(x=e.headers)!=null?x:[],values:(F=t.headers)!=null?F:{}}).filter(d=>!this.context.isDirectLiteral(d.typeReference)),T=this.context.sortTypeInstancesByRequiredFirst(c,(I=e.headers)!=null?I:[]).map(d=>({name:this.context.getMethodName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:d.typeReference,value:d.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(u.RequestBody);let N=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),n.TypeLiteral.builder({classReference:n.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...T,...p,...N]})}getRequestOptionsArg({request:e,snippet:t}){var p,l,c;let r="headers"in e?(p=e.headers)!=null?p:[]:[];if(r.length===0||Object.keys((l=t.headers)!=null?l:{}).length===0)return;this.context.errors.scope(u.Headers);let a=this.context.associateByWireValue({parameters:r,values:(c=t.headers)!=null?c:{}});if(this.context.errors.unscope(),a.length===0)return;let s=n.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),i=n.invokeMethod({on:s,method:"builder",arguments_:[]});for(let g of a)i=n.invokeMethod({on:i,method:"addHeader",arguments_:[n.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let o=n.invokeMethod({on:i,method:"build",arguments_:[]});return n.TypeLiteral.reference(o)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:m(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(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,as:"request"});default:m(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){var i;let a=this.context.associateByWireValue({parameters:e,values:(i=this.context.getRecord(t))!=null?i:{}}).filter(o=>!this.context.isDirectLiteral(o.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(o=>({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:o.typeReference,value:o.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],a=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{}});for(let i of a)r.push({name:this.context.getMethodName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}()`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getStyle(e){var t,r;return(r=(t=e.style)!=null?t:this.context.options.style)!=null?r:y.Full}getConfig(e){var t,r;return(r=(t=e.config)!=null?t:this.context.options.config)!=null?r:{}}};export{C as a};
2
+ //# sourceMappingURL=chunk-PSRNJYSA.js.map
@@ -1,2 +1,2 @@
1
- import{a as r,d as t}from"./chunk-6CITGEM3.js";import{f as a,h as c,i}from"./chunk-2U3YQWRZ.js";c();i();var p=class{constructor({context:e}){a(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return t.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return t.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?this.convertUnknown():this.convertNamed({named:n})}case"optional":case"nullable":return t.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return t.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:r(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return t.Type.reference(t.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:r(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return t.Type.boolean();case"string":return t.Type.string()}}convertUnknown(){return t.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return t.Type.integer();case"UINT":return t.Type.integer();case"LONG":return t.Type.long();case"UINT_64":return t.Type.long();case"FLOAT":return t.Type.float();case"DOUBLE":return t.Type.double();case"BOOLEAN":return t.Type.boolean();case"STRING":return t.Type.string();case"DATE":return t.Type.date();case"DATE_TIME":return t.Type.dateTime();case"UUID":return t.Type.uuid();case"BASE_64":return t.Type.bytes();case"BIG_INTEGER":return t.Type.bigInteger();default:r(e)}}};export{p as a};
2
- //# sourceMappingURL=chunk-L6HHZWHP.js.map
1
+ import{a as r,d as t}from"./chunk-JWUP3MFF.js";import{f as a,h as c,i}from"./chunk-2U3YQWRZ.js";c();i();var p=class{constructor({context:e}){a(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return t.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return t.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?this.convertUnknown():this.convertNamed({named:n})}case"optional":case"nullable":return t.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return t.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:r(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return t.Type.reference(t.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:r(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return t.Type.boolean();case"string":return t.Type.string()}}convertUnknown(){return t.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return t.Type.integer();case"UINT":return t.Type.integer();case"LONG":return t.Type.long();case"UINT_64":return t.Type.long();case"FLOAT":return t.Type.float();case"DOUBLE":return t.Type.double();case"BOOLEAN":return t.Type.boolean();case"STRING":return t.Type.string();case"DATE":return t.Type.date();case"DATE_TIME":return t.Type.dateTime();case"UUID":return t.Type.uuid();case"BASE_64":return t.Type.bytes();case"BIG_INTEGER":return t.Type.bigInteger();default:r(e)}}};export{p as a};
2
+ //# sourceMappingURL=chunk-RVPVA4ZP.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-G35HVZPV.js";import{a as i}from"./chunk-OMKG67AN.js";import{a as o}from"./chunk-GESEOQT7.js";import{f as t,h as r,i as p}from"./chunk-2U3YQWRZ.js";r();p();var s=class extends o{constructor({ir:e,config:n,options:c={}}){super(new i({ir:e,config:n,options:c}));t(this,"formatter")}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}createSnippetGenerator(e){return new a({context:e})}};export{s as a};
2
- //# sourceMappingURL=chunk-SNGFCNTO.js.map
1
+ import{a}from"./chunk-PSRNJYSA.js";import{a as i}from"./chunk-FT6O7RFS.js";import{a as o}from"./chunk-DD37GKIE.js";import{f as t,h as r,i as p}from"./chunk-2U3YQWRZ.js";r();p();var s=class extends o{constructor({ir:e,config:n,options:c={}}){super(new i({ir:e,config:n,options:c}));t(this,"formatter")}async generate(e,n={}){return super.generate(e,n)}generateSync(e,n={}){return super.generateSync(e,n)}createSnippetGenerator(e){return new a({context:e})}};export{s as a};
2
+ //# sourceMappingURL=chunk-TJKLGKYV.js.map
@@ -0,0 +1,8 @@
1
+ import{b as c}from"./chunk-DD37GKIE.js";import{a as l,d as n}from"./chunk-JWUP3MFF.js";import{f as d,h as y,i as m}from"./chunk-2U3YQWRZ.js";y();m();var f=class{constructor({context:e}){d(this,"context");this.context=e}isNopTypeLiteral(e){var r;return((r=e.internalType)==null?void 0:r.type)==="nop"}usesOptionalNullable(){var e;return((e=this.context.customConfig)==null?void 0:e["collapse-optional-nullable"])===!0}wrapInOptionalIfNotNop(e,t=!1){return this.isNopTypeLiteral(e)?e:this.usesOptionalNullable()?this.context.getOptionalNullableOf(e):n.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:c.Critical,message:"Expected non-null value, but got null"}),n.TypeLiteral.nop());if(e.value===void 0)return n.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?n.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():n.TypeLiteral.reference(n.invokeMethod({on:n.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:l(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof t}`}),n.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return n.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((i,o)=>{this.context.errors.scope({index:o});try{if(a){let s=this.convert({typeReference:e.value,value:i,as:r});return this.wrapInOptionalIfNotNop(s,!0)}return this.convert({typeReference:e,value:i,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?n.TypeLiteral.nop():n.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?n.TypeLiteral.nop():n.TypeLiteral.string(r)}default:l(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?n.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof t}`}),n.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:c.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),n.TypeLiteral.nop()):n.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,i])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:i,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:l(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return n.TypeLiteral.nop();let i=a.singleDiscriminatedUnionType;switch(i.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:i.typeId});return o==null?n.TypeLiteral.nop():n.TypeLiteral.reference(n.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convertNamed({named:o,value:a.value})]}))}case"singleProperty":{let o=this.context.getRecord(a.value);if(o==null)return n.TypeLiteral.nop();try{return this.context.errors.scope(i.discriminantValue.wireValue),n.TypeLiteral.reference(n.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[this.convert({typeReference:i.typeReference,value:o["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return n.TypeLiteral.reference(n.invokeMethod({on:r,method:this.context.getPropertyName(i.discriminantValue.name),arguments_:[]}));default:l(i)}}convertObject({object_:e,value:t,as:r}){var o;let a=this.context.associateByWireValue({parameters:e.properties,values:(o=this.context.getRecord(t))!=null?o:{}}),i=r==="request"?a.filter(s=>!this.context.isDirectLiteral(s.typeReference)):a;return n.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:i.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getMethodName(s.name.name),value:this.convert({typeReference:s.typeReference,value:s.value,as:r})}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?n.TypeLiteral.nop():n.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:c.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:c.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?n.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?n.TypeLiteral.reference(n.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):n.TypeLiteral.reference(n.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){var s;let r=[],a=[];for(let p of e.types)try{r.push(JSON.stringify(p));let u=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});return{valueTypeReference:p,typeInstantiation:u}}catch(u){a.push(`Type ${JSON.stringify(p)}: ${u instanceof Error?u.message:String(u)}`);continue}this.context.errors.add({severity:c.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let i=(s=e.declaration.name)!=null?s:"UnknownUnion",o=a.map((p,u)=>` ${u+1}. ${p}`).join(`
2
+ `);throw new Error(`Failed to match undiscriminated union "${i}" for ${typeof t} value.
3
+ Value: ${JSON.stringify(t)}
4
+ Attempted ${r.length} variants:
5
+ ${o}
6
+
7
+ This prevents invalid snippet code generation that would cause formatter errors.`)}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getClassName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:l(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`ListOf${t}`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`MapOf${t}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Optional${t}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Nullable${t}`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`SetOf${t}`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:l(e)}}convertUnknown({value:e}){return n.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r}){var a;switch(e){case"INTEGER":case"UINT":{let i=this.getValueAsNumber({value:t,as:r});return i==null?n.TypeLiteral.nop():n.TypeLiteral.integer(i)}case"LONG":case"UINT_64":{let i=this.getValueAsNumber({value:t,as:r});return i==null?n.TypeLiteral.nop():n.TypeLiteral.long(i)}case"FLOAT":{let i=this.getValueAsNumber({value:t,as:r});return i==null?n.TypeLiteral.nop():n.TypeLiteral.float(i)}case"DOUBLE":{let i=this.getValueAsNumber({value:t,as:r});return i==null?n.TypeLiteral.nop():n.TypeLiteral.double(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:t,as:r});return i==null?n.TypeLiteral.nop():n.TypeLiteral.boolean(i)}case"STRING":{let i=this.context.getValueAsString({value:t});return i==null?n.TypeLiteral.nop():n.TypeLiteral.string(i)}case"DATE":{let i=this.context.getValueAsString({value:t});return i==null?n.TypeLiteral.nop():((a=this.context.customConfig)==null?void 0:a["use-local-date-for-dates"])===!0?n.TypeLiteral.date(i):n.TypeLiteral.string(i)}case"DATE_TIME":{let i=this.context.getValueAsString({value:t});return i==null?n.TypeLiteral.nop():n.TypeLiteral.dateTime(i)}case"UUID":{let i=this.context.getValueAsString({value:t});return i==null?n.TypeLiteral.nop():n.TypeLiteral.uuid(i)}case"BASE_64":{let i=this.context.getValueAsString({value:t});return i==null?n.TypeLiteral.nop():n.TypeLiteral.bytes(i)}case"BIG_INTEGER":{let i=this.context.getValueAsString({value:t});return i==null?n.TypeLiteral.nop():n.TypeLiteral.bigInteger(i)}default:l(e)}}getValueAsNumber({value:e,as:t}){let r=t==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="mapKey"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};export{f as a};
8
+ //# sourceMappingURL=chunk-V3XTHNV6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/DynamicTypeLiteralMapper.ts"],"sourcesContent":["import { Severity } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { java } from \"@fern-api/java-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport declare namespace DynamicTypeLiteralMapper {\n interface Args {\n typeReference: FernIr.dynamic.TypeReference;\n value: unknown;\n as?: ConvertedAs;\n inUndiscriminatedUnion?: boolean;\n }\n\n // Identifies what the type is being converted as, which sometimes influences how\n // the type is instantiated.\n type ConvertedAs = \"mapKey\" | \"mapValue\" | \"request\";\n}\n\nexport class DynamicTypeLiteralMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n private isNopTypeLiteral(value: java.TypeLiteral): boolean {\n const valueWithInternal = value as unknown as { internalType?: { type?: string } };\n return valueWithInternal.internalType?.type === \"nop\";\n }\n\n private usesOptionalNullable(): boolean {\n return this.context.customConfig?.[\"collapse-optional-nullable\"] === true;\n }\n\n private wrapInOptionalIfNotNop(value: java.TypeLiteral, useOf: boolean = false): java.TypeLiteral {\n if (this.isNopTypeLiteral(value)) {\n return value;\n }\n if (this.usesOptionalNullable()) {\n return this.context.getOptionalNullableOf(value);\n }\n return java.TypeLiteral.optional({ value, useOf });\n }\n\n public convert(args: DynamicTypeLiteralMapper.Args): java.TypeLiteral {\n // eslint-disable-next-line eqeqeq\n if (args.value === null) {\n if (this.context.isNullable(args.typeReference)) {\n return this.context.getNullableOfNull();\n }\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Expected non-null value, but got null\"\n });\n return java.TypeLiteral.nop();\n }\n if (args.value === undefined) {\n return java.TypeLiteral.nop();\n }\n switch (args.typeReference.type) {\n case \"list\":\n return this.convertList({ list: args.typeReference.value, value: args.value, as: args.as });\n case \"literal\":\n return this.convertLiteral({ literal: args.typeReference.value, value: args.value });\n case \"map\":\n return this.convertMap({ map: args.typeReference, value: args.value, as: args.as });\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: args.typeReference.value });\n if (named == null) {\n return java.TypeLiteral.nop();\n }\n return this.convertNamed({\n named,\n value: args.value,\n as: args.as,\n inUndiscriminatedUnion: args.inUndiscriminatedUnion\n });\n }\n case \"nullable\":\n case \"optional\": {\n if (\n args.value === undefined ||\n (typeof args.value === \"object\" &&\n args.value !== null &&\n Object.keys(args.value).length === 0 &&\n args.typeReference.value.type === \"named\")\n ) {\n if (this.usesOptionalNullable()) {\n return this.context.getOptionalNullableAbsent();\n } else {\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: java.classReference({\n name: \"Optional\",\n packageName: \"java.util\"\n }),\n method: \"empty\",\n arguments_: []\n })\n );\n }\n }\n\n if (args.typeReference.value.type === \"list\") {\n const listLiteral = this.convertList({ list: args.typeReference.value.value, value: args.value });\n return this.wrapInOptionalIfNotNop(listLiteral, true);\n }\n\n // When using OptionalNullable mode and we have nested optional/nullable,\n // skip wrapping since they collapse into a single OptionalNullable<T>\n if (\n this.usesOptionalNullable() &&\n (args.typeReference.value.type === \"optional\" || args.typeReference.value.type === \"nullable\")\n ) {\n return this.convert({\n typeReference: args.typeReference.value,\n value: args.value,\n as: args.as,\n inUndiscriminatedUnion: args.inUndiscriminatedUnion\n });\n }\n\n const convertedValue = this.convert({\n typeReference: args.typeReference.value,\n value: args.value,\n as: args.as,\n inUndiscriminatedUnion: args.inUndiscriminatedUnion\n });\n // TODO(amckinney): The Java generator produces Map<T, Optional<U>> whenever the value is an optional.\n //\n // This is difficult to use in practice - we should update this to unbox the map values and remove this\n // flag.\n // When in an undiscriminated union, we always use Optional.of() for optional types\n const useOf = args.as === \"mapValue\" || args.inUndiscriminatedUnion === true;\n return this.wrapInOptionalIfNotNop(convertedValue, useOf);\n }\n case \"primitive\":\n return this.convertPrimitive({ primitive: args.typeReference.value, value: args.value, as: args.as });\n case \"set\":\n return this.convertSet({ set: args.typeReference.value, value: args.value, as: args.as });\n case \"unknown\":\n return this.convertUnknown({ value: args.value });\n default:\n assertNever(args.typeReference);\n }\n }\n\n private convertList({\n list,\n value,\n as\n }: {\n list: FernIr.dynamic.TypeReference;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): java.TypeLiteral {\n if (!Array.isArray(value)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected array but got: ${typeof value}`\n });\n return java.TypeLiteral.nop();\n }\n\n const isItemOptional = list.type === \"optional\" || list.type === \"nullable\";\n\n return java.TypeLiteral.list({\n valueType: this.context.dynamicTypeMapper.convert({ typeReference: list }),\n values: value.map((v, index) => {\n this.context.errors.scope({ index });\n try {\n if (isItemOptional) {\n const itemValue = this.convert({ typeReference: list.value, value: v, as });\n return this.wrapInOptionalIfNotNop(itemValue, true);\n }\n return this.convert({ typeReference: list, value: v, as });\n } finally {\n this.context.errors.unscope();\n }\n }),\n isParameter: true // For dynamic snippets, we're generating method parameters\n });\n }\n\n private convertLiteral({\n literal,\n value\n }: {\n literal: FernIr.dynamic.LiteralType;\n value: unknown;\n }): java.TypeLiteral {\n switch (literal.type) {\n case \"boolean\": {\n const bool = this.context.getValueAsBoolean({ value });\n if (bool == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.boolean(bool);\n }\n case \"string\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.string(str);\n }\n default:\n assertNever(literal);\n }\n }\n\n private convertSet({\n set,\n value,\n as\n }: {\n set: FernIr.dynamic.TypeReference;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): java.TypeLiteral {\n if (!Array.isArray(value)) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected array but got: ${typeof value}`\n });\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.set({\n valueType: this.context.dynamicTypeMapper.convert({ typeReference: set }),\n values: value.map((v, index) => {\n this.context.errors.scope({ index });\n try {\n return this.convert({ typeReference: set, value: v, as });\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertMap({\n map,\n value,\n as\n }: {\n map: FernIr.dynamic.MapType;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): java.TypeLiteral {\n if (typeof value !== \"object\" || value == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected object but got: ${value == null ? \"null\" : typeof value}`\n });\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.map({\n keyType: this.context.dynamicTypeMapper.convert({ typeReference: map.key }),\n valueType: this.context.dynamicTypeMapper.convert({ typeReference: map.value }),\n entries: Object.entries(value).map(([key, value]) => {\n this.context.errors.scope(key);\n try {\n return {\n key: this.convert({ typeReference: map.key, value: key, as: \"mapKey\" }),\n value: this.convert({\n typeReference: map.value,\n value,\n as: \"mapValue\"\n })\n };\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertNamed({\n named,\n value,\n as,\n inUndiscriminatedUnion\n }: {\n named: FernIr.dynamic.NamedType;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n inUndiscriminatedUnion?: boolean;\n }): java.TypeLiteral {\n switch (named.type) {\n case \"alias\":\n return this.convert({ typeReference: named.typeReference, value, as, inUndiscriminatedUnion });\n case \"discriminatedUnion\":\n return this.convertDiscriminatedUnion({\n discriminatedUnion: named,\n value\n });\n case \"enum\":\n return this.convertEnum({ enum_: named, value });\n case \"object\":\n return this.convertObject({ object_: named, value, as });\n case \"undiscriminatedUnion\":\n // Don't pass inUndiscriminatedUnion here - we're AT the undiscriminated union level,\n // not within it. The flag should only apply to the variants within the union.\n return this.convertUndiscriminatedUnion({ undiscriminatedUnion: named, value });\n default:\n assertNever(named);\n }\n }\n\n private convertDiscriminatedUnion({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): java.TypeLiteral {\n const classReference = this.context.getJavaClassReferenceFromDeclaration({\n declaration: discriminatedUnion.declaration\n });\n const discriminatedUnionTypeInstance = this.context.resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n });\n if (discriminatedUnionTypeInstance == null) {\n return java.TypeLiteral.nop();\n }\n const unionVariant = discriminatedUnionTypeInstance.singleDiscriminatedUnionType;\n switch (unionVariant.type) {\n case \"samePropertiesAsObject\": {\n const named = this.context.resolveNamedType({\n typeId: unionVariant.typeId\n });\n if (named == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: classReference,\n method: this.context.getPropertyName(unionVariant.discriminantValue.name),\n arguments_: [this.convertNamed({ named, value: discriminatedUnionTypeInstance.value })]\n })\n );\n }\n case \"singleProperty\": {\n const record = this.context.getRecord(discriminatedUnionTypeInstance.value);\n if (record == null) {\n return java.TypeLiteral.nop();\n }\n try {\n this.context.errors.scope(unionVariant.discriminantValue.wireValue);\n // For primitive union variants, the property key is always \"value\"\n const propertyKey = \"value\";\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: classReference,\n method: this.context.getPropertyName(unionVariant.discriminantValue.name),\n arguments_: [\n this.convert({\n typeReference: unionVariant.typeReference,\n value: record[propertyKey]\n })\n ]\n })\n );\n } finally {\n this.context.errors.unscope();\n }\n }\n case \"noProperties\":\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: classReference,\n method: this.context.getPropertyName(unionVariant.discriminantValue.name),\n arguments_: []\n })\n );\n default:\n assertNever(unionVariant);\n }\n }\n\n private convertObject({\n object_,\n value,\n as\n }: {\n object_: FernIr.dynamic.ObjectType;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): java.TypeLiteral {\n const properties = this.context.associateByWireValue({\n parameters: object_.properties,\n values: this.context.getRecord(value) ?? {}\n });\n const filteredProperties =\n as === \"request\"\n ? properties.filter((property) => !this.context.isDirectLiteral(property.typeReference))\n : properties;\n return java.TypeLiteral.builder({\n classReference: this.context.getJavaClassReferenceFromDeclaration({\n declaration: object_.declaration\n }),\n parameters: filteredProperties.map((property) => {\n this.context.errors.scope(property.name.wireValue);\n try {\n return {\n name: this.context.getMethodName(property.name.name),\n value: this.convert({ typeReference: property.typeReference, value: property.value, as })\n };\n } finally {\n this.context.errors.unscope();\n }\n })\n });\n }\n\n private convertEnum({ enum_, value }: { enum_: FernIr.dynamic.EnumType; value: unknown }): java.TypeLiteral {\n const name = this.getEnumValueName({ enum_, value });\n if (name == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.enum_({\n classReference: this.context.getJavaClassReferenceFromDeclaration({\n declaration: enum_.declaration\n }),\n value: name\n });\n }\n\n private getEnumValueName({ enum_, value }: { enum_: FernIr.dynamic.EnumType; value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected enum value string, got: ${typeof value}`\n });\n return undefined;\n }\n const enumValue = enum_.values.find((v) => v.wireValue === value);\n if (enumValue == null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `An enum value named \"${value}\" does not exist in this context`\n });\n return undefined;\n }\n return this.context.getEnumName(enumValue.name);\n }\n\n private convertUndiscriminatedUnion({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): java.TypeLiteral {\n const result = this.findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n });\n if (result == null) {\n return java.TypeLiteral.nop();\n }\n if (this.context.isPrimitive(result.valueTypeReference)) {\n // Primitive types overload the 'of' method rather than\n // defining a separate method from the type.\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: this.context.getJavaClassReferenceFromDeclaration({\n declaration: undiscriminatedUnion.declaration\n }),\n method: \"of\",\n arguments_: [result.typeInstantiation]\n })\n );\n }\n // Use simple 'of' method name for consistency across all union factory methods\n // This matches the Java SDK's generated code pattern\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: this.context.getJavaClassReferenceFromDeclaration({\n declaration: undiscriminatedUnion.declaration\n }),\n method: \"of\",\n arguments_: [result.typeInstantiation]\n })\n );\n }\n\n private findMatchingUndiscriminatedUnionType({\n undiscriminatedUnion,\n value\n }: {\n undiscriminatedUnion: FernIr.dynamic.UndiscriminatedUnionType;\n value: unknown;\n }): { valueTypeReference: FernIr.dynamic.TypeReference; typeInstantiation: java.TypeLiteral } | undefined {\n const attemptedVariants: string[] = [];\n const variantErrors: string[] = [];\n\n for (const typeReference of undiscriminatedUnion.types) {\n try {\n attemptedVariants.push(JSON.stringify(typeReference));\n const typeInstantiation = this.convert({\n typeReference,\n value,\n inUndiscriminatedUnion: true\n });\n\n return { valueTypeReference: typeReference, typeInstantiation };\n } catch (e) {\n variantErrors.push(\n `Type ${JSON.stringify(typeReference)}: ${e instanceof Error ? e.message : String(e)}`\n );\n continue;\n }\n }\n\n this.context.errors.add({\n severity: Severity.Critical,\n message: `None of the types in the undiscriminated union matched the given \"${typeof value}\" value. Tried ${attemptedVariants.length} variants. Errors: ${variantErrors.join(\"; \")}`\n });\n\n // Instead of returning undefined (which causes invalid code generation),\n // throw an error to fail fast with a clear message\n const unionName = undiscriminatedUnion.declaration.name ?? \"UnknownUnion\";\n const detailedErrors = variantErrors.map((error, index) => ` ${index + 1}. ${error}`).join(\"\\n\");\n throw new Error(\n `Failed to match undiscriminated union \"${unionName}\" for ${typeof value} value.\\n` +\n `Value: ${JSON.stringify(value)}\\n` +\n `Attempted ${attemptedVariants.length} variants:\\n${detailedErrors}\\n\\n` +\n `This prevents invalid snippet code generation that would cause formatter errors.`\n );\n }\n\n private getUndiscriminatedUnionFieldName({\n typeReference\n }: {\n typeReference: FernIr.dynamic.TypeReference;\n }): string | undefined {\n switch (typeReference.type) {\n case \"list\":\n return this.getUndiscriminatedUnionFieldNameForList({ list: typeReference });\n case \"literal\":\n return this.getUndiscriminatedUnionFieldNameForLiteral({ literal: typeReference.value });\n case \"map\":\n return this.getUndiscriminatedUnionFieldNameForMap({ map: typeReference });\n case \"named\": {\n const named = this.context.resolveNamedType({ typeId: typeReference.value });\n if (named == null) {\n return undefined;\n }\n return this.context.getClassName(named.declaration.name);\n }\n case \"optional\":\n return this.getUndiscriminatedUnionFieldNameForOptional({ typeReference });\n case \"nullable\":\n return this.getUndiscriminatedUnionFieldNameForNullable({ typeReference });\n case \"primitive\":\n return this.getUndiscriminatedUnionFieldNameForPrimitive({ primitive: typeReference.value });\n case \"set\":\n return this.getUndiscriminatedUnionFieldNameForSet({ set: typeReference });\n case \"unknown\":\n return \"Unknown\";\n default:\n assertNever(typeReference);\n }\n }\n\n private getUndiscriminatedUnionFieldNameForList({\n list\n }: {\n list: FernIr.dynamic.TypeReference.List;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference: list });\n if (fieldName == null) {\n return undefined;\n }\n return `ListOf${fieldName}`;\n }\n\n private getUndiscriminatedUnionFieldNameForMap({ map }: { map: FernIr.dynamic.MapType }): string | undefined {\n const keyFieldName = this.getUndiscriminatedUnionFieldName({ typeReference: map.key });\n if (keyFieldName == null) {\n return undefined;\n }\n const valueFieldName = this.getUndiscriminatedUnionFieldName({ typeReference: map.value });\n if (valueFieldName == null) {\n return undefined;\n }\n return `MapOf${keyFieldName}To${valueFieldName}`;\n }\n\n private getUndiscriminatedUnionFieldNameForOptional({\n typeReference\n }: {\n typeReference: FernIr.dynamic.TypeReference.Optional | FernIr.dynamic.TypeReference.Nullable;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference });\n if (fieldName == null) {\n return undefined;\n }\n return `Optional${fieldName}`;\n }\n\n private getUndiscriminatedUnionFieldNameForNullable({\n typeReference\n }: {\n typeReference: FernIr.dynamic.TypeReference.Optional | FernIr.dynamic.TypeReference.Nullable;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference });\n if (fieldName == null) {\n return undefined;\n }\n return `Nullable${fieldName}`;\n }\n\n private getUndiscriminatedUnionFieldNameForSet({\n set\n }: {\n set: FernIr.dynamic.TypeReference.Set;\n }): string | undefined {\n const fieldName = this.getUndiscriminatedUnionFieldName({ typeReference: set });\n if (fieldName == null) {\n return undefined;\n }\n return `SetOf${fieldName}`;\n }\n\n private getUndiscriminatedUnionFieldNameForLiteral({\n literal: _literal\n }: {\n literal: FernIr.dynamic.LiteralType;\n }): string | undefined {\n // The Java SDK doesn't support literal types here.\n return undefined;\n }\n\n private getUndiscriminatedUnionFieldNameForPrimitive({\n primitive\n }: {\n primitive: FernIr.dynamic.PrimitiveTypeV1;\n }): string {\n switch (primitive) {\n case \"INTEGER\":\n case \"UINT\":\n return \"Integer\";\n case \"LONG\":\n case \"UINT_64\":\n return \"Long\";\n case \"FLOAT\":\n return \"Float\";\n case \"DOUBLE\":\n return \"Double\";\n case \"BOOLEAN\":\n return \"Boolean\";\n case \"BIG_INTEGER\":\n return \"BigInteger\";\n case \"STRING\":\n return \"String\";\n case \"UUID\":\n return \"Uuid\";\n case \"DATE\":\n return \"Date\";\n case \"DATE_TIME\":\n return \"DateTime\";\n case \"BASE_64\":\n return \"Base64\";\n default:\n assertNever(primitive);\n }\n }\n\n private convertUnknown({ value }: { value: unknown }): java.TypeLiteral {\n return java.TypeLiteral.unknown(value);\n }\n\n private convertPrimitive({\n primitive,\n value,\n as\n }: {\n primitive: FernIr.dynamic.PrimitiveTypeV1;\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): java.TypeLiteral {\n switch (primitive) {\n case \"INTEGER\":\n case \"UINT\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.integer(num);\n }\n case \"LONG\":\n case \"UINT_64\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.long(num);\n }\n case \"FLOAT\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.float(num);\n }\n case \"DOUBLE\": {\n const num = this.getValueAsNumber({ value, as });\n if (num == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.double(num);\n }\n case \"BOOLEAN\": {\n const bool = this.getValueAsBoolean({ value, as });\n if (bool == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.boolean(bool);\n }\n case \"STRING\": {\n const str = this.context.getValueAsString({ value });\n if (str == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.string(str);\n }\n case \"DATE\": {\n const date = this.context.getValueAsString({ value });\n if (date == null) {\n return java.TypeLiteral.nop();\n }\n if (this.context.customConfig?.[\"use-local-date-for-dates\"] === true) {\n return java.TypeLiteral.date(date);\n }\n return java.TypeLiteral.string(date);\n }\n case \"DATE_TIME\": {\n const dateTime = this.context.getValueAsString({ value });\n if (dateTime == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.dateTime(dateTime);\n }\n case \"UUID\": {\n const uuid = this.context.getValueAsString({ value });\n if (uuid == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.uuid(uuid);\n }\n case \"BASE_64\": {\n const base64 = this.context.getValueAsString({ value });\n if (base64 == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.bytes(base64);\n }\n case \"BIG_INTEGER\": {\n const bigInt = this.context.getValueAsString({ value });\n if (bigInt == null) {\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.bigInteger(bigInt);\n }\n default:\n assertNever(primitive);\n }\n }\n\n private getValueAsNumber({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): number | undefined {\n const num = as === \"mapKey\" ? (typeof value === \"string\" ? Number(value) : value) : value;\n return this.context.getValueAsNumber({ value: num });\n }\n\n private getValueAsBoolean({\n value,\n as\n }: {\n value: unknown;\n as?: DynamicTypeLiteralMapper.ConvertedAs;\n }): boolean | undefined {\n const bool =\n as === \"mapKey\"\n ? typeof value === \"string\"\n ? value === \"true\"\n : value === \"false\"\n ? false\n : value\n : value;\n return this.context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AMvC,IAAO,UAAY,OAAOX,GAAU,SAAW,OAAOA,CAAK,EAAaA,EACpF,OAAO,KAAK,QAAQ,iBAAiB,CAAE,MAAOkD,CAAI,CAAC,CACvD,CAEQ,kBAAkB,CACtB,MAAAlD,EACA,GAAAW,CACJ,EAGwB,CACpB,IAAMM,EACFN,IAAO,SACD,OAAOX,GAAU,SACbA,IAAU,OACVA,IAAU,QACR,GACAA,EACNA,EACV,OAAO,KAAK,QAAQ,kBAAkB,CAAE,MAAOiB,CAAK,CAAC,CACzD,CACJ","names":["init_process","init_buffer","DynamicTypeLiteralMapper","context","__publicField","value","_a","useOf","java_exports","args","Severity","named","listLiteral","convertedValue","assertNever","list","as","isItemOptional","v","index","itemValue","literal","bool","str","set","map","key","inUndiscriminatedUnion","discriminatedUnion","classReference","discriminatedUnionTypeInstance","unionVariant","record","object_","properties","filteredProperties","property","enum_","name","enumValue","undiscriminatedUnion","result","attemptedVariants","variantErrors","typeReference","typeInstantiation","e","unionName","detailedErrors","error","fieldName","keyFieldName","valueFieldName","_literal","primitive","num","date","dateTime","uuid","base64","bigInt"]}
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-OMKG67AN.js";import"../chunk-GTD7VYDZ.js";import"../chunk-GESEOQT7.js";import"../chunk-L6HHZWHP.js";import"../chunk-2KH7MFRW.js";import"../chunk-6CITGEM3.js";import"../chunk-2U3YQWRZ.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-FT6O7RFS.js";import"../chunk-V3XTHNV6.js";import"../chunk-DD37GKIE.js";import"../chunk-RVPVA4ZP.js";import"../chunk-4CABHDQV.js";import"../chunk-JWUP3MFF.js";import"../chunk-2U3YQWRZ.js";export{a as DynamicSnippetsGeneratorContext};
2
2
  //# sourceMappingURL=DynamicSnippetsGeneratorContext.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-GTD7VYDZ.js";import"../chunk-GESEOQT7.js";import"../chunk-6CITGEM3.js";import"../chunk-2U3YQWRZ.js";export{a as DynamicTypeLiteralMapper};
1
+ import{a}from"../chunk-V3XTHNV6.js";import"../chunk-DD37GKIE.js";import"../chunk-JWUP3MFF.js";import"../chunk-2U3YQWRZ.js";export{a as DynamicTypeLiteralMapper};
2
2
  //# sourceMappingURL=DynamicTypeLiteralMapper.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-L6HHZWHP.js";import"../chunk-6CITGEM3.js";import"../chunk-2U3YQWRZ.js";export{a as DynamicTypeMapper};
1
+ import{a}from"../chunk-RVPVA4ZP.js";import"../chunk-JWUP3MFF.js";import"../chunk-2U3YQWRZ.js";export{a as DynamicTypeMapper};
2
2
  //# sourceMappingURL=DynamicTypeMapper.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-2KH7MFRW.js";import"../chunk-6CITGEM3.js";import"../chunk-2U3YQWRZ.js";export{a as FilePropertyMapper};
1
+ import{a}from"../chunk-4CABHDQV.js";import"../chunk-JWUP3MFF.js";import"../chunk-2U3YQWRZ.js";export{a as FilePropertyMapper};
2
2
  //# sourceMappingURL=FilePropertyMapper.js.map
package/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-N3AIOPEV.js";import{a as r}from"./chunk-SNGFCNTO.js";import"./chunk-G35HVZPV.js";import"./chunk-OMKG67AN.js";import"./chunk-GTD7VYDZ.js";import"./chunk-GESEOQT7.js";import"./chunk-L6HHZWHP.js";import"./chunk-2KH7MFRW.js";import"./chunk-6CITGEM3.js";import{h as e,i as o}from"./chunk-2U3YQWRZ.js";e();o();export{r as DynamicSnippetsGenerator};
1
+ import"./chunk-N3AIOPEV.js";import{a as r}from"./chunk-TJKLGKYV.js";import"./chunk-PSRNJYSA.js";import"./chunk-FT6O7RFS.js";import"./chunk-V3XTHNV6.js";import"./chunk-DD37GKIE.js";import"./chunk-RVPVA4ZP.js";import"./chunk-4CABHDQV.js";import"./chunk-JWUP3MFF.js";import{h as e,i as o}from"./chunk-2U3YQWRZ.js";e();o();export{r as DynamicSnippetsGenerator};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/java-dynamic-snippets",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",