@fern-api/go-dynamic-snippets 0.0.18 → 0.0.19

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 (61) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +6 -6
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/{DynamicSnippetsGeneratorContext-D8VcLYKk.d.cts → DynamicSnippetsGeneratorContext-X0Mtg6YW.d.cts} +1 -0
  5. package/cjs/EndpointSnippetGenerator.cjs +4 -4
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
  7. package/cjs/EndpointSnippetGenerator.d.cts +1 -1
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +8 -8
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeInstantiationMapper.cjs +1 -1
  12. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -1
  13. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +4 -4
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -1
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +7 -7
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -1
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +7 -7
  21. package/cjs/index.cjs.map +1 -1
  22. package/cjs/index.d.cts +1 -1
  23. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  24. package/esm/DynamicSnippetsGenerator.js +1 -1
  25. package/esm/{DynamicSnippetsGeneratorContext-D8VcLYKk.d.ts → DynamicSnippetsGeneratorContext-X0Mtg6YW.d.ts} +1 -0
  26. package/esm/EndpointSnippetGenerator.d.ts +1 -1
  27. package/esm/EndpointSnippetGenerator.js +1 -1
  28. package/esm/{chunk-ZNTXZ3YV.js → chunk-5X6DU53C.js} +2 -2
  29. package/esm/{chunk-3Z2URLHB.js → chunk-EUHLPBOB.js} +2 -2
  30. package/esm/chunk-FVPD7ODP.js +2 -0
  31. package/esm/chunk-FVPD7ODP.js.map +1 -0
  32. package/esm/{chunk-MYN2HZVH.js → chunk-KGXOPYBU.js} +2 -2
  33. package/esm/chunk-NY6N4HP7.js +2 -0
  34. package/esm/chunk-NY6N4HP7.js.map +1 -0
  35. package/esm/{chunk-TXVHHFW3.js → chunk-S5R5YTLQ.js} +2 -2
  36. package/esm/chunk-T2DJJZPN.js +2 -0
  37. package/esm/chunk-T2DJJZPN.js.map +1 -0
  38. package/esm/{chunk-JHIUGKJ4.js → chunk-VY2BNRW5.js} +9 -9
  39. package/esm/chunk-VY2BNRW5.js.map +1 -0
  40. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  41. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  42. package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
  43. package/esm/context/DynamicTypeInstantiationMapper.js +1 -1
  44. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  45. package/esm/context/DynamicTypeMapper.js +1 -1
  46. package/esm/context/FilePropertyMapper.d.ts +1 -1
  47. package/esm/context/FilePropertyMapper.js +1 -1
  48. package/esm/index.d.ts +1 -1
  49. package/esm/index.js +1 -1
  50. package/package.json +1 -1
  51. package/esm/chunk-B2A7QNZM.js +0 -2
  52. package/esm/chunk-B2A7QNZM.js.map +0 -1
  53. package/esm/chunk-DVDVP26D.js +0 -2
  54. package/esm/chunk-DVDVP26D.js.map +0 -1
  55. package/esm/chunk-JHIUGKJ4.js.map +0 -1
  56. package/esm/chunk-SVPRIX53.js +0 -2
  57. package/esm/chunk-SVPRIX53.js.map +0 -1
  58. /package/esm/{chunk-ZNTXZ3YV.js.map → chunk-5X6DU53C.js.map} +0 -0
  59. /package/esm/{chunk-3Z2URLHB.js.map → chunk-EUHLPBOB.js.map} +0 -0
  60. /package/esm/{chunk-MYN2HZVH.js.map → chunk-KGXOPYBU.js.map} +0 -0
  61. /package/esm/{chunk-TXVHHFW3.js.map → chunk-S5R5YTLQ.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{e as p,f as s,g as y,h as l,j as o}from"./chunk-JHIUGKJ4.js";s();y();var c=class{constructor({context:t}){p(this,"context");this.context=t}getFilePropertyInfo({body:t,value:n}){var a;let e={fileFields:[],bodyPropertyFields:[]},i=(a=this.context.getRecord(n))!=null?a:{};for(let r of t.properties)switch(r.type){case"file":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getSingleFileProperty({property:r,record:i})});break;case"fileArray":e.fileFields.push({name:this.context.getTypeName(r.name),value:this.getArrayFileProperty({property:r,record:i})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getTypeName(r.name.name),value:this.getBodyProperty({property:r,record:i})});break;default:l(r)}return e}getSingleFileProperty({property:t,record:n}){let e=this.context.getSingleFileValue({property:t,record:n})||"";return o.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(e))}getArrayFileProperty({property:t,record:n}){let e=this.context.getFileArrayValues({property:t,record:n});return e==null?o.TypeInstantiation.nop():o.TypeInstantiation.slice({valueType:o.Type.reference(this.context.getIoReaderTypeReference()),values:e.map(i=>o.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(i)))})}getBodyProperty({property:t,record:n}){let e=n[t.name.wireValue];return e==null?o.TypeInstantiation.nop():this.context.dynamicTypeInstantiationMapper.convert({typeReference:t.typeReference,value:e})}};export{c as a};
2
- //# sourceMappingURL=chunk-SVPRIX53.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/FilePropertyMapper.ts"],"sourcesContent":["import { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { go } from \"@fern-api/go-ast\";\n\nimport { DynamicSnippetsGeneratorContext } from \"./DynamicSnippetsGeneratorContext\";\n\nexport interface FilePropertyInfo {\n fileFields: go.StructField[];\n bodyPropertyFields: go.StructField[];\n}\n\nexport class FilePropertyMapper {\n private context: DynamicSnippetsGeneratorContext;\n\n constructor({ context }: { context: DynamicSnippetsGeneratorContext }) {\n this.context = context;\n }\n\n public getFilePropertyInfo({\n body,\n value\n }: {\n body: FernIr.dynamic.FileUploadRequestBody;\n value: unknown;\n }): FilePropertyInfo {\n const result: FilePropertyInfo = {\n fileFields: [],\n bodyPropertyFields: []\n };\n const record = this.context.getRecord(value) ?? {};\n for (const property of body.properties) {\n switch (property.type) {\n case \"file\":\n result.fileFields.push({\n name: this.context.getTypeName(property.name),\n value: this.getSingleFileProperty({ property, record })\n });\n break;\n case \"fileArray\":\n result.fileFields.push({\n name: this.context.getTypeName(property.name),\n value: this.getArrayFileProperty({ property, record })\n });\n break;\n case \"bodyProperty\":\n result.bodyPropertyFields.push({\n name: this.context.getTypeName(property.name.name),\n value: this.getBodyProperty({ property, record })\n });\n break;\n default:\n assertNever(property);\n }\n }\n return result;\n }\n\n private getSingleFileProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): go.TypeInstantiation {\n // fix(williammcadams): always return a string reader even if no example was provided\n const fileValue = this.context.getSingleFileValue({ property, record }) || \"\";\n return go.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(fileValue));\n }\n\n private getArrayFileProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): go.TypeInstantiation {\n const fileValues = this.context.getFileArrayValues({ property, record });\n if (fileValues == null) {\n return go.TypeInstantiation.nop();\n }\n return go.TypeInstantiation.slice({\n valueType: go.Type.reference(this.context.getIoReaderTypeReference()),\n values: fileValues.map((value) =>\n go.TypeInstantiation.reference(this.context.getNewStringsReaderFunctionInvocation(value))\n )\n });\n }\n\n private getBodyProperty({\n property,\n record\n }: {\n property: FernIr.dynamic.NamedParameter;\n record: Record<string, unknown>;\n }): go.TypeInstantiation {\n const bodyPropertyValue = record[property.name.wireValue];\n if (bodyPropertyValue == null) {\n return go.TypeInstantiation.nop();\n }\n return this.context.dynamicTypeInstantiationMapper.convert({\n typeReference: property.typeReference,\n value: bodyPropertyValue\n });\n }\n}\n"],"mappings":"oEAAAA,IAAAC,IAWO,IAAMC,EAAN,KAAyB,CAG5B,YAAY,CAAE,QAAAC,CAAQ,EAAiD,CAFvEC,EAAA,KAAQ,WAGJ,KAAK,QAAUD,CACnB,CAEO,oBAAoB,CACvB,KAAAE,EACA,MAAAC,CACJ,EAGqB,CAxBzB,IAAAC,EAyBQ,IAAMC,EAA2B,CAC7B,WAAY,CAAC,EACb,mBAAoB,CAAC,CACzB,EACMC,GAASF,EAAA,KAAK,QAAQ,UAAUD,CAAK,IAA5B,KAAAC,EAAiC,CAAC,EACjD,QAAWG,KAAYL,EAAK,WACxB,OAAQK,EAAS,KAAM,CACnB,IAAK,OACDF,EAAO,WAAW,KAAK,CACnB,KAAM,KAAK,QAAQ,YAAYE,EAAS,IAAI,EAC5C,MAAO,KAAK,sBAAsB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CAC1D,CAAC,EACD,MACJ,IAAK,YACDD,EAAO,WAAW,KAAK,CACnB,KAAM,KAAK,QAAQ,YAAYE,EAAS,IAAI,EAC5C,MAAO,KAAK,qBAAqB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CACzD,CAAC,EACD,MACJ,IAAK,eACDD,EAAO,mBAAmB,KAAK,CAC3B,KAAM,KAAK,QAAQ,YAAYE,EAAS,KAAK,IAAI,EACjD,MAAO,KAAK,gBAAgB,CAAE,SAAAA,EAAU,OAAAD,CAAO,CAAC,CACpD,CAAC,EACD,MACJ,QACIE,EAAYD,CAAQ,CAC5B,CAEJ,OAAOF,CACX,CAEQ,sBAAsB,CAC1B,SAAAE,EACA,OAAAD,CACJ,EAGyB,CAErB,IAAMG,EAAY,KAAK,QAAQ,mBAAmB,CAAE,SAAAF,EAAU,OAAAD,CAAO,CAAC,GAAK,GAC3E,OAAOI,EAAG,kBAAkB,UAAU,KAAK,QAAQ,sCAAsCD,CAAS,CAAC,CACvG,CAEQ,qBAAqB,CACzB,SAAAF,EACA,OAAAD,CACJ,EAGyB,CACrB,IAAMK,EAAa,KAAK,QAAQ,mBAAmB,CAAE,SAAAJ,EAAU,OAAAD,CAAO,CAAC,EACvE,OAAIK,GAAc,KACPD,EAAG,kBAAkB,IAAI,EAE7BA,EAAG,kBAAkB,MAAM,CAC9B,UAAWA,EAAG,KAAK,UAAU,KAAK,QAAQ,yBAAyB,CAAC,EACpE,OAAQC,EAAW,IAAKR,GACpBO,EAAG,kBAAkB,UAAU,KAAK,QAAQ,sCAAsCP,CAAK,CAAC,CAC5F,CACJ,CAAC,CACL,CAEQ,gBAAgB,CACpB,SAAAI,EACA,OAAAD,CACJ,EAGyB,CACrB,IAAMM,EAAoBN,EAAOC,EAAS,KAAK,SAAS,EACxD,OAAIK,GAAqB,KACdF,EAAG,kBAAkB,IAAI,EAE7B,KAAK,QAAQ,+BAA+B,QAAQ,CACvD,cAAeH,EAAS,cACxB,MAAOK,CACX,CAAC,CACL,CACJ","names":["init_process","init_buffer","FilePropertyMapper","context","__publicField","body","value","_a","result","record","property","assertNever","fileValue","go_exports","fileValues","bodyPropertyValue"]}