@azure-tools/typespec-ts 0.54.0 → 0.55.0-dev.6

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 (521) hide show
  1. package/README.md +0 -4
  2. package/dist/src/contextManager.d.ts +5 -5
  3. package/dist/src/contextManager.d.ts.map +1 -1
  4. package/dist/src/contextManager.js +3 -3
  5. package/dist/src/contextManager.js.map +1 -1
  6. package/dist/src/framework/declaration.d.ts +1 -1
  7. package/dist/src/framework/declaration.d.ts.map +1 -1
  8. package/dist/src/framework/declaration.js +2 -4
  9. package/dist/src/framework/declaration.js.map +1 -1
  10. package/dist/src/framework/dependency.d.ts.map +1 -1
  11. package/dist/src/framework/hooks/binder.d.ts +1 -1
  12. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  13. package/dist/src/framework/hooks/binder.js +31 -40
  14. package/dist/src/framework/hooks/binder.js.map +1 -1
  15. package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
  16. package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
  17. package/dist/src/framework/hooks/sdkTypes.js +8 -12
  18. package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
  19. package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
  20. package/dist/src/framework/hooks/useDependencies.js +1 -1
  21. package/dist/src/framework/hooks/useDependencies.js.map +1 -1
  22. package/dist/src/framework/load-static-helpers.d.ts +1 -1
  23. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  24. package/dist/src/framework/load-static-helpers.js +17 -31
  25. package/dist/src/framework/load-static-helpers.js.map +1 -1
  26. package/dist/src/framework/reference.d.ts.map +1 -1
  27. package/dist/src/framework/reference.js +2 -2
  28. package/dist/src/framework/reference.js.map +1 -1
  29. package/dist/src/framework/sample.js +8 -8
  30. package/dist/src/framework/sample.js.map +1 -1
  31. package/dist/src/index.d.ts +1 -1
  32. package/dist/src/index.d.ts.map +1 -1
  33. package/dist/src/index.js +103 -92
  34. package/dist/src/index.js.map +1 -1
  35. package/dist/src/lib.d.ts +1 -1
  36. package/dist/src/lib.d.ts.map +1 -1
  37. package/dist/src/lib.js +140 -140
  38. package/dist/src/lib.js.map +1 -1
  39. package/dist/src/metaTree.d.ts +1 -1
  40. package/dist/src/metaTree.d.ts.map +1 -1
  41. package/dist/src/modular/buildClassicalClient.d.ts +1 -1
  42. package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
  43. package/dist/src/modular/buildClassicalClient.js +60 -74
  44. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  45. package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
  46. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
  47. package/dist/src/modular/buildClassicalOperationGroups.js +8 -10
  48. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  49. package/dist/src/modular/buildClientContext.d.ts +2 -2
  50. package/dist/src/modular/buildClientContext.d.ts.map +1 -1
  51. package/dist/src/modular/buildClientContext.js +31 -38
  52. package/dist/src/modular/buildClientContext.js.map +1 -1
  53. package/dist/src/modular/buildModularOptions.d.ts +1 -1
  54. package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
  55. package/dist/src/modular/buildModularOptions.js +5 -6
  56. package/dist/src/modular/buildModularOptions.js.map +1 -1
  57. package/dist/src/modular/buildOperations.d.ts +3 -3
  58. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  59. package/dist/src/modular/buildOperations.js +23 -25
  60. package/dist/src/modular/buildOperations.js.map +1 -1
  61. package/dist/src/modular/buildProjectFiles.d.ts +1 -1
  62. package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
  63. package/dist/src/modular/buildProjectFiles.js +8 -11
  64. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  65. package/dist/src/modular/buildRestorePoller.d.ts +1 -1
  66. package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
  67. package/dist/src/modular/buildRestorePoller.js +12 -13
  68. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  69. package/dist/src/modular/buildRootIndex.d.ts +2 -2
  70. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  71. package/dist/src/modular/buildRootIndex.js +36 -50
  72. package/dist/src/modular/buildRootIndex.js.map +1 -1
  73. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  74. package/dist/src/modular/buildSubpathIndex.js +9 -18
  75. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  76. package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
  77. package/dist/src/modular/emitLoggerFile.js +4 -4
  78. package/dist/src/modular/emitLoggerFile.js.map +1 -1
  79. package/dist/src/modular/emitModels.d.ts +1 -1
  80. package/dist/src/modular/emitModels.d.ts.map +1 -1
  81. package/dist/src/modular/emitModels.js +81 -113
  82. package/dist/src/modular/emitModels.js.map +1 -1
  83. package/dist/src/modular/emitModelsOptions.d.ts +1 -1
  84. package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
  85. package/dist/src/modular/emitModelsOptions.js +7 -8
  86. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  87. package/dist/src/modular/emitSamples.d.ts.map +1 -1
  88. package/dist/src/modular/emitSamples.js +69 -77
  89. package/dist/src/modular/emitSamples.js.map +1 -1
  90. package/dist/src/modular/emitTests.d.ts.map +1 -1
  91. package/dist/src/modular/emitTests.js +13 -18
  92. package/dist/src/modular/emitTests.js.map +1 -1
  93. package/dist/src/modular/external-dependencies.js +54 -54
  94. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
  95. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
  96. package/dist/src/modular/helpers/classicalOperationHelpers.js +59 -68
  97. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  98. package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
  99. package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
  100. package/dist/src/modular/helpers/clientHelpers.js +31 -54
  101. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  102. package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
  103. package/dist/src/modular/helpers/clientOptionHelpers.js +1 -1
  104. package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
  105. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
  106. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
  107. package/dist/src/modular/helpers/exampleValueHelpers.js +72 -84
  108. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
  109. package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
  110. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  111. package/dist/src/modular/helpers/namingHelpers.js +7 -10
  112. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  113. package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
  114. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  115. package/dist/src/modular/helpers/operationHelpers.js +204 -288
  116. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  117. package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
  118. package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
  119. package/dist/src/modular/helpers/typeHelpers.js +4 -6
  120. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  121. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
  122. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  123. package/dist/src/modular/serialization/buildDeserializerFunction.js +58 -67
  124. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  125. package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
  126. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  127. package/dist/src/modular/serialization/buildSerializerFunction.js +65 -75
  128. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  129. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
  130. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
  131. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +73 -90
  132. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
  133. package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
  134. package/dist/src/modular/serialization/serializeUtils.js +25 -33
  135. package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
  136. package/dist/src/modular/static-helpers-metadata.js +60 -60
  137. package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
  138. package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
  139. package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
  140. package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
  141. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -2
  142. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  143. package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
  144. package/dist/src/modular/type-expressions/get-model-expression.js +10 -13
  145. package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
  146. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
  147. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
  148. package/dist/src/modular/type-expressions/get-nullable-expression.js +2 -3
  149. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  150. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  151. package/dist/src/modular/type-expressions/get-type-expression.js +5 -11
  152. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  153. package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
  154. package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
  155. package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
  156. package/dist/src/rlc-common/buildClient.d.ts +1 -1
  157. package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
  158. package/dist/src/rlc-common/buildClient.js +67 -89
  159. package/dist/src/rlc-common/buildClient.js.map +1 -1
  160. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
  161. package/dist/src/rlc-common/buildClientDefinitions.js +28 -45
  162. package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
  163. package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
  164. package/dist/src/rlc-common/buildIndexFile.js +59 -60
  165. package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
  166. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
  167. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +37 -38
  168. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
  169. package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
  170. package/dist/src/rlc-common/buildLogger.js +4 -5
  171. package/dist/src/rlc-common/buildLogger.js.map +1 -1
  172. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
  173. package/dist/src/rlc-common/buildMethodShortcuts.js +4 -4
  174. package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
  175. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
  176. package/dist/src/rlc-common/buildObjectTypes.js +57 -96
  177. package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
  178. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
  179. package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
  180. package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
  181. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
  182. package/dist/src/rlc-common/buildParameterTypes.js +71 -61
  183. package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
  184. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
  185. package/dist/src/rlc-common/buildPollingHelper.js +9 -10
  186. package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
  187. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
  188. package/dist/src/rlc-common/buildResponseTypes.js +23 -27
  189. package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
  190. package/dist/src/rlc-common/buildSamples.d.ts +1 -1
  191. package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
  192. package/dist/src/rlc-common/buildSamples.js +2 -2
  193. package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
  194. package/dist/src/rlc-common/buildSchemaType.js +31 -13
  195. package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
  196. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
  197. package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
  198. package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
  199. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
  200. package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
  201. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
  202. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
  203. package/dist/src/rlc-common/helpers/apiVersionUtil.js +6 -8
  204. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
  205. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
  206. package/dist/src/rlc-common/helpers/importsUtil.js +32 -37
  207. package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
  208. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
  209. package/dist/src/rlc-common/helpers/nameConstructors.js +2 -4
  210. package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
  211. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
  212. package/dist/src/rlc-common/helpers/nameUtils.js +17 -23
  213. package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
  214. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
  215. package/dist/src/rlc-common/helpers/operationHelpers.js +16 -31
  216. package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
  217. package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
  218. package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -1
  219. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
  220. package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
  221. package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
  222. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
  223. package/dist/src/rlc-common/helpers/schemaHelpers.js +3 -7
  224. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
  225. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
  226. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
  227. package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
  228. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
  229. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
  230. package/dist/src/rlc-common/helpers/typeUtil.js +4 -9
  231. package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
  232. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +7 -11
  233. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
  234. package/dist/src/rlc-common/index.d.ts +28 -28
  235. package/dist/src/rlc-common/index.d.ts.map +1 -1
  236. package/dist/src/rlc-common/index.js +28 -28
  237. package/dist/src/rlc-common/index.js.map +1 -1
  238. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  239. package/dist/src/rlc-common/interfaces.js.map +1 -1
  240. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
  241. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +14 -15
  242. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
  243. package/dist/src/rlc-common/metadata/buildChangelogFile.js +2 -3
  244. package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
  245. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
  246. package/dist/src/rlc-common/metadata/buildESLintConfig.js +5 -8
  247. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
  248. package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
  249. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
  250. package/dist/src/rlc-common/metadata/buildPackageFile.js +33 -37
  251. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
  252. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
  253. package/dist/src/rlc-common/metadata/buildReadmeFile.js +31 -39
  254. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
  255. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
  256. package/dist/src/rlc-common/metadata/buildRollupConfig.js +4 -6
  257. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
  258. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
  259. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +3 -5
  260. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
  261. package/dist/src/rlc-common/metadata/buildTestConfig.js +11 -12
  262. package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
  263. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
  264. package/dist/src/rlc-common/metadata/buildTsConfig.js +28 -28
  265. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
  266. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
  267. package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -5
  268. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
  269. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
  270. package/dist/src/rlc-common/metadata/buildWarpConfig.js +4 -5
  271. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
  272. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
  273. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
  274. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +14 -14
  275. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
  276. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
  277. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +24 -29
  278. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
  279. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
  280. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
  281. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
  282. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
  283. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
  284. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
  285. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +28 -31
  286. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
  287. package/dist/src/rlc-common/metadata/utils.js +1 -2
  288. package/dist/src/rlc-common/metadata/utils.js.map +1 -1
  289. package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
  290. package/dist/src/rlc-common/test/buildRecordedClient.js +4 -5
  291. package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
  292. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
  293. package/dist/src/rlc-common/test/buildSampleTest.js +3 -4
  294. package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
  295. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
  296. package/dist/src/rlc-common/test/buildSnippets.js +7 -10
  297. package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
  298. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
  299. package/dist/src/rlc-common/transformSampleGroups.js +41 -45
  300. package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
  301. package/dist/src/testing/index.d.ts.map +1 -1
  302. package/dist/src/testing/index.js +1 -1
  303. package/dist/src/testing/index.js.map +1 -1
  304. package/dist/src/transform/transform.d.ts +1 -1
  305. package/dist/src/transform/transform.d.ts.map +1 -1
  306. package/dist/src/transform/transform.js +28 -27
  307. package/dist/src/transform/transform.js.map +1 -1
  308. package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
  309. package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
  310. package/dist/src/transform/transformApiVersionInfo.js +12 -14
  311. package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
  312. package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
  313. package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
  314. package/dist/src/transform/transformHelperFunctionDetails.js +11 -14
  315. package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
  316. package/dist/src/transform/transformParameters.d.ts +2 -2
  317. package/dist/src/transform/transformParameters.d.ts.map +1 -1
  318. package/dist/src/transform/transformParameters.js +32 -45
  319. package/dist/src/transform/transformParameters.js.map +1 -1
  320. package/dist/src/transform/transformPaths.d.ts +1 -1
  321. package/dist/src/transform/transformPaths.d.ts.map +1 -1
  322. package/dist/src/transform/transformPaths.js +19 -23
  323. package/dist/src/transform/transformPaths.js.map +1 -1
  324. package/dist/src/transform/transformResponses.d.ts +1 -1
  325. package/dist/src/transform/transformResponses.d.ts.map +1 -1
  326. package/dist/src/transform/transformResponses.js +21 -25
  327. package/dist/src/transform/transformResponses.js.map +1 -1
  328. package/dist/src/transform/transformSchemas.d.ts.map +1 -1
  329. package/dist/src/transform/transformSchemas.js +21 -32
  330. package/dist/src/transform/transformSchemas.js.map +1 -1
  331. package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
  332. package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
  333. package/dist/src/transform/transformTelemetryInfo.js +3 -3
  334. package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
  335. package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
  336. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  337. package/dist/src/transform/transfromRLCOptions.js +28 -39
  338. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  339. package/dist/src/utils/clientUtils.d.ts +1 -1
  340. package/dist/src/utils/clientUtils.d.ts.map +1 -1
  341. package/dist/src/utils/clientUtils.js +15 -23
  342. package/dist/src/utils/clientUtils.js.map +1 -1
  343. package/dist/src/utils/credentialUtils.d.ts +1 -1
  344. package/dist/src/utils/credentialUtils.d.ts.map +1 -1
  345. package/dist/src/utils/credentialUtils.js +4 -5
  346. package/dist/src/utils/credentialUtils.js.map +1 -1
  347. package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
  348. package/dist/src/utils/crossLanguageDef.js +11 -15
  349. package/dist/src/utils/crossLanguageDef.js.map +1 -1
  350. package/dist/src/utils/emitUtil.d.ts +1 -1
  351. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  352. package/dist/src/utils/emitUtil.js +5 -7
  353. package/dist/src/utils/emitUtil.js.map +1 -1
  354. package/dist/src/utils/fileSystemUtils.d.ts +2 -0
  355. package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
  356. package/dist/src/utils/fileSystemUtils.js +26 -7
  357. package/dist/src/utils/fileSystemUtils.js.map +1 -1
  358. package/dist/src/utils/importHelper.d.ts.map +1 -1
  359. package/dist/src/utils/importHelper.js +3 -6
  360. package/dist/src/utils/importHelper.js.map +1 -1
  361. package/dist/src/utils/interfaces.d.ts +1 -1
  362. package/dist/src/utils/interfaces.d.ts.map +1 -1
  363. package/dist/src/utils/mediaTypes.d.ts.map +1 -1
  364. package/dist/src/utils/mediaTypes.js +7 -19
  365. package/dist/src/utils/mediaTypes.js.map +1 -1
  366. package/dist/src/utils/modelUtils.d.ts +5 -5
  367. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  368. package/dist/src/utils/modelUtils.js +168 -257
  369. package/dist/src/utils/modelUtils.js.map +1 -1
  370. package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
  371. package/dist/src/utils/namespaceUtils.js +6 -7
  372. package/dist/src/utils/namespaceUtils.js.map +1 -1
  373. package/dist/src/utils/operationUtil.d.ts +1 -1
  374. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  375. package/dist/src/utils/operationUtil.js +60 -81
  376. package/dist/src/utils/operationUtil.js.map +1 -1
  377. package/dist/src/utils/parameterUtils.d.ts +1 -1
  378. package/dist/src/utils/parameterUtils.d.ts.map +1 -1
  379. package/dist/src/utils/parameterUtils.js +26 -33
  380. package/dist/src/utils/parameterUtils.js.map +1 -1
  381. package/dist/src/utils/resolve-project-root.js +2 -2
  382. package/dist/src/utils/resolve-project-root.js.map +1 -1
  383. package/dist/tsconfig.tsbuildinfo +1 -1
  384. package/package.json +38 -45
  385. package/src/contextManager.ts +6 -9
  386. package/src/framework/declaration.ts +18 -28
  387. package/src/framework/dependency.ts +1 -2
  388. package/src/framework/hooks/binder.ts +47 -120
  389. package/src/framework/hooks/sdkTypes.ts +27 -54
  390. package/src/framework/hooks/useDependencies.ts +2 -4
  391. package/src/framework/load-static-helpers.ts +28 -51
  392. package/src/framework/reference.ts +2 -5
  393. package/src/framework/sample.ts +9 -9
  394. package/src/index.ts +145 -185
  395. package/src/lib.ts +143 -158
  396. package/src/metaTree.ts +1 -1
  397. package/src/modular/buildClassicalClient.ts +83 -160
  398. package/src/modular/buildClassicalOperationGroups.ts +14 -39
  399. package/src/modular/buildClientContext.ts +54 -83
  400. package/src/modular/buildModularOptions.ts +4 -5
  401. package/src/modular/buildOperations.ts +46 -73
  402. package/src/modular/buildProjectFiles.ts +18 -47
  403. package/src/modular/buildRestorePoller.ts +27 -46
  404. package/src/modular/buildRootIndex.ts +86 -160
  405. package/src/modular/buildSubpathIndex.ts +35 -58
  406. package/src/modular/emitLoggerFile.ts +4 -9
  407. package/src/modular/emitModels.ts +136 -266
  408. package/src/modular/emitModelsOptions.ts +10 -16
  409. package/src/modular/emitSamples.ts +92 -180
  410. package/src/modular/emitTests.ts +28 -61
  411. package/src/modular/external-dependencies.ts +54 -54
  412. package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
  413. package/src/modular/helpers/clientHelpers.ts +41 -88
  414. package/src/modular/helpers/clientOptionHelpers.ts +4 -11
  415. package/src/modular/helpers/exampleValueHelpers.ts +99 -215
  416. package/src/modular/helpers/namingHelpers.ts +12 -28
  417. package/src/modular/helpers/operationHelpers.ts +430 -757
  418. package/src/modular/helpers/typeHelpers.ts +11 -22
  419. package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
  420. package/src/modular/serialization/buildSerializerFunction.ts +91 -129
  421. package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
  422. package/src/modular/serialization/serializeUtils.ts +12 -22
  423. package/src/modular/static/rollup.test.config.js +11 -14
  424. package/src/modular/static/scripts/renameOutput.mjs +2 -2
  425. package/src/modular/static-helpers-metadata.ts +60 -60
  426. package/src/modular/type-expressions/get-credential-expression.ts +1 -1
  427. package/src/modular/type-expressions/get-enum-expression.ts +5 -10
  428. package/src/modular/type-expressions/get-model-expression.ts +13 -17
  429. package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
  430. package/src/modular/type-expressions/get-type-expression.ts +8 -12
  431. package/src/modular/type-expressions/get-union-expression.ts +4 -4
  432. package/src/modular/type-expressions/utils.ts +1 -1
  433. package/src/rlc-common/buildClient.ts +70 -141
  434. package/src/rlc-common/buildClientDefinitions.ts +44 -87
  435. package/src/rlc-common/buildIndexFile.ts +78 -78
  436. package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
  437. package/src/rlc-common/buildLogger.ts +7 -7
  438. package/src/rlc-common/buildMethodShortcuts.ts +9 -21
  439. package/src/rlc-common/buildObjectTypes.ts +79 -156
  440. package/src/rlc-common/buildPaginateHelper.ts +9 -12
  441. package/src/rlc-common/buildParameterTypes.ts +116 -137
  442. package/src/rlc-common/buildPollingHelper.ts +7 -7
  443. package/src/rlc-common/buildResponseTypes.ts +34 -57
  444. package/src/rlc-common/buildSamples.ts +3 -3
  445. package/src/rlc-common/buildSchemaType.ts +37 -29
  446. package/src/rlc-common/buildSerializeHelper.ts +5 -5
  447. package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
  448. package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
  449. package/src/rlc-common/helpers/importsUtil.ts +27 -30
  450. package/src/rlc-common/helpers/nameConstructors.ts +16 -50
  451. package/src/rlc-common/helpers/nameUtils.ts +19 -42
  452. package/src/rlc-common/helpers/operationHelpers.ts +14 -31
  453. package/src/rlc-common/helpers/pathUtils.ts +2 -7
  454. package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
  455. package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
  456. package/src/rlc-common/helpers/typeUtil.ts +4 -11
  457. package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
  458. package/src/rlc-common/index.ts +28 -28
  459. package/src/rlc-common/interfaces.ts +3 -11
  460. package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
  461. package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
  462. package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
  463. package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
  464. package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
  465. package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
  466. package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
  467. package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
  468. package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
  469. package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
  470. package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
  471. package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
  472. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
  473. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
  474. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
  475. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
  476. package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
  477. package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
  478. package/src/rlc-common/test/buildRecordedClient.ts +3 -3
  479. package/src/rlc-common/test/buildSampleTest.ts +3 -3
  480. package/src/rlc-common/test/buildSnippets.ts +6 -12
  481. package/src/rlc-common/transformSampleGroups.ts +54 -105
  482. package/src/testing/index.ts +2 -5
  483. package/src/transform/transform.ts +22 -34
  484. package/src/transform/transformApiVersionInfo.ts +17 -30
  485. package/src/transform/transformHelperFunctionDetails.ts +14 -26
  486. package/src/transform/transformParameters.ts +55 -105
  487. package/src/transform/transformPaths.ts +26 -43
  488. package/src/transform/transformResponses.ts +26 -33
  489. package/src/transform/transformSchemas.ts +15 -33
  490. package/src/transform/transformTelemetryInfo.ts +8 -14
  491. package/src/transform/transfromRLCOptions.ts +53 -116
  492. package/src/utils/clientUtils.ts +22 -41
  493. package/src/utils/credentialUtils.ts +8 -19
  494. package/src/utils/crossLanguageDef.ts +15 -34
  495. package/src/utils/emitUtil.ts +11 -17
  496. package/src/utils/fileSystemUtils.ts +30 -8
  497. package/src/utils/importHelper.ts +5 -10
  498. package/src/utils/interfaces.ts +1 -1
  499. package/src/utils/mediaTypes.ts +13 -34
  500. package/src/utils/modelUtils.ts +175 -384
  501. package/src/utils/namespaceUtils.ts +8 -24
  502. package/src/utils/operationUtil.ts +98 -190
  503. package/src/utils/parameterUtils.ts +31 -54
  504. package/src/utils/resolve-project-root.ts +3 -3
  505. package/static/static-helpers/cloudSettingHelpers.ts +4 -6
  506. package/static/static-helpers/multipartHelpers.ts +3 -3
  507. package/static/static-helpers/pagingHelpers.ts +28 -63
  508. package/static/static-helpers/pollingHelpers.ts +16 -29
  509. package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
  510. package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
  511. package/static/static-helpers/serialization/get-binary-response-browser.mts +3 -1
  512. package/static/static-helpers/serialization/get-binary-response.ts +2 -2
  513. package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
  514. package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
  515. package/static/static-helpers/serialization/serialize-record.ts +1 -1
  516. package/static/static-helpers/serialization/serializers.ts +4 -7
  517. package/static/static-helpers/serialization/xml-helpers.ts +42 -90
  518. package/static/static-helpers/simplePollerHelpers.ts +10 -19
  519. package/static/static-helpers/storageCompatResponse.ts +10 -27
  520. package/static/static-helpers/urlTemplate.ts +4 -7
  521. package/static/test-helpers/recordedClient.ts +5 -10
@@ -1,27 +1,24 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { NameType, SchemaContext, isArraySchema, normalizeName } from "../rlc-common/index.js";
4
- import { NoTarget, getDiscriminator, getDoc, getEffectiveModelType, getEncode, getFormat, getFriendlyName, getLifecycleVisibilityEnum, getMaxLength, getMaxValue, getMinLength, getMinValue, getPattern, getProperty, getPropertyType, getSummary, getVisibilityForClass, isArrayModelType, isNeverType, isNullType, isNumericType, isRecordModelType, isSecret, isStringType, isTemplateDeclaration, isUnknownType, listServices } from "@typespec/compiler";
5
- import { Visibility, getHeaderFieldName, getHttpFileModel, getHttpPart, getPathParamName, getQueryParamName, isBody, isStatusCode } from "@typespec/http";
6
- import { KnownMediaType, hasMediaType, isMediaTypeMultipartFormData } from "./mediaTypes.js";
7
- import { getDefaultApiVersion, getWireName, isApiVersion } from "@azure-tools/typespec-client-generator-core";
8
3
  import { getUnionAsEnum } from "@azure-tools/typespec-azure-core";
9
- import { getModelNamespaceName } from "./namespaceUtils.js";
4
+ import { getDefaultApiVersion, getWireName, isApiVersion, } from "@azure-tools/typespec-client-generator-core";
5
+ import { NoTarget, getDiscriminator, getDoc, getEffectiveModelType, getEncode, getFormat, getFriendlyName, getLifecycleVisibilityEnum, getMaxLength, getMaxValue, getMinLength, getMinValue, getPattern, getProperty, getPropertyType, getSummary, getVisibilityForClass, isArrayModelType, isNeverType, isNullType, isNumericType, isRecordModelType, isSecret, isStringType, isTemplateDeclaration, isUnknownType, listServices, } from "@typespec/compiler";
6
+ import { Visibility, getHeaderFieldName, getHttpFileModel, getHttpPart, getPathParamName, getQueryParamName, isBody, isStatusCode, } from "@typespec/http";
7
+ import { NameType, SchemaContext, isArraySchema, normalizeName, } from "../rlc-common/index.js";
8
+ import { KnownMediaType, hasMediaType, isMediaTypeMultipartFormData } from "./mediaTypes.js";
10
9
  import { reportDiagnostic } from "../lib.js";
11
- export const BINARY_TYPE_UNION = "string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream";
10
+ import { getModelNamespaceName } from "./namespaceUtils.js";
11
+ export const BINARY_TYPE_UNION = "string | Uint8Array | ReadableStream<Uint8Array> | NodeReadableStream";
12
12
  export const BINARY_AND_FILE_TYPE_UNION = `${BINARY_TYPE_UNION} | File`;
13
13
  export function getBinaryType(usage) {
14
- return usage.includes(SchemaContext.Output)
15
- ? "Uint8Array"
16
- : BINARY_TYPE_UNION;
14
+ return usage.includes(SchemaContext.Output) ? "Uint8Array" : BINARY_TYPE_UNION;
17
15
  }
18
16
  export function isByteOrByteUnion(dpgContext, type) {
19
17
  const schema = getSchemaForType(dpgContext, type);
20
18
  return isBytesType(schema) || isBytesUnion(schema);
21
19
  }
22
20
  function isBytesType(schema) {
23
- return (schema.type === "string" &&
24
- (schema.format === "bytes" || schema.format === "binary"));
21
+ return schema.type === "string" && (schema.format === "bytes" || schema.format === "binary");
25
22
  }
26
23
  function isBytesUnion(schema) {
27
24
  if (!Array.isArray(schema.enum)) {
@@ -35,10 +32,7 @@ function isBytesUnion(schema) {
35
32
  return false;
36
33
  }
37
34
  function refineByteType(schema) {
38
- schema.typeName = getBinaryType([
39
- SchemaContext.Input,
40
- SchemaContext.Exception
41
- ]);
35
+ schema.typeName = getBinaryType([SchemaContext.Input, SchemaContext.Exception]);
42
36
  schema.outputTypeName = getBinaryType([SchemaContext.Output]);
43
37
  return schema;
44
38
  }
@@ -63,9 +57,8 @@ export function enrichBinaryTypeInBody(schema) {
63
57
  return schema;
64
58
  }
65
59
  export function getSchemaForType(dpgContext, typeInput, options) {
66
- var _a, _b, _c, _d;
67
60
  const program = dpgContext.program;
68
- const { usage } = options !== null && options !== void 0 ? options : {};
61
+ const { usage } = options ?? {};
69
62
  const type = getEffectiveModelFromType(dpgContext, typeInput);
70
63
  const builtinType = getSchemaForLiteral(type);
71
64
  if (builtinType !== undefined) {
@@ -90,13 +83,13 @@ export function getSchemaForType(dpgContext, typeInput, options) {
90
83
  multipartOptions: {
91
84
  filenameSchema: {
92
85
  required: !fileModel.filename.optional,
93
- ...getSchemaForType(dpgContext, fileModel.filename, options)
86
+ ...getSchemaForType(dpgContext, fileModel.filename, options),
94
87
  },
95
88
  contentTypeSchema: {
96
89
  required: !fileModel.contentType.optional,
97
- ...getSchemaForType(dpgContext, fileModel.contentType, options)
98
- }
99
- }
90
+ ...getSchemaForType(dpgContext, fileModel.contentType, options),
91
+ },
92
+ },
100
93
  };
101
94
  }
102
95
  else {
@@ -109,13 +102,11 @@ export function getSchemaForType(dpgContext, typeInput, options) {
109
102
  }
110
103
  const schema = getSchemaForModel(dpgContext, type, options);
111
104
  if (isAnonymousObjectSchema(schema)) {
112
- if (Object.keys((_a = schema.properties) !== null && _a !== void 0 ? _a : {}).length === 0) {
105
+ if (Object.keys(schema.properties ?? {}).length === 0) {
113
106
  // Handle empty anonymous model as Record
114
- schema.typeName =
115
- schema.type === "object" ? "Record<string, unknown>" : "unknown";
107
+ schema.typeName = schema.type === "object" ? "Record<string, unknown>" : "unknown";
116
108
  if (usage && usage.includes(SchemaContext.Output)) {
117
- schema.outputTypeName =
118
- schema.type === "object" ? "Record<string, any>" : "any";
109
+ schema.outputTypeName = schema.type === "object" ? "Record<string, any>" : "any";
119
110
  }
120
111
  schema.type = "unknown";
121
112
  }
@@ -123,13 +114,12 @@ export function getSchemaForType(dpgContext, typeInput, options) {
123
114
  // Handle non-empty anonymous model as inline model
124
115
  if (usage && usage.includes(SchemaContext.Output)) {
125
116
  schema.outputTypeName = getModelInlineSigniture(schema, {
126
- usage: [SchemaContext.Output]
117
+ usage: [SchemaContext.Output],
127
118
  });
128
119
  }
129
120
  schema.typeName = getModelInlineSigniture(schema, {
130
121
  usage: [SchemaContext.Input],
131
- multipart: (options === null || options === void 0 ? void 0 : options.isRequestBody) &&
132
- isMediaTypeMultipartFormData((_b = options === null || options === void 0 ? void 0 : options.mediaTypes) !== null && _b !== void 0 ? _b : [])
122
+ multipart: options?.isRequestBody && isMediaTypeMultipartFormData(options?.mediaTypes ?? []),
133
123
  });
134
124
  schema.type = "object";
135
125
  }
@@ -179,9 +169,9 @@ export function getSchemaForType(dpgContext, typeInput, options) {
179
169
  code: "invalid-schema",
180
170
  format: {
181
171
  type: type.kind,
182
- property: (_d = (_c = options === null || options === void 0 ? void 0 : options.relevantProperty) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : ""
172
+ property: options?.relevantProperty?.name ?? "",
183
173
  },
184
- target: type
174
+ target: type,
185
175
  });
186
176
  return undefined;
187
177
  }
@@ -199,12 +189,11 @@ export function getEffectiveModelFromType(context, type) {
199
189
  return type;
200
190
  }
201
191
  export function includeDerivedModel(model, needRef = false) {
202
- var _a;
203
192
  return (!needRef &&
204
193
  !isTemplateDeclaration(model) &&
205
194
  (!model.templateMapper ||
206
195
  !model.templateMapper.args ||
207
- ((_a = model.templateMapper.args) === null || _a === void 0 ? void 0 : _a.length) === 0 ||
196
+ model.templateMapper.args?.length === 0 ||
208
197
  model.derivedModels.length > 0));
209
198
  }
210
199
  function applyEncoding(dpgContext, typespecType, target = {}) {
@@ -222,24 +211,23 @@ function applyEncoding(dpgContext, typespecType, target = {}) {
222
211
  return target;
223
212
  }
224
213
  function mergeFormatAndEncoding(format, encoding, encodeAsFormat) {
225
- var _a, _b;
226
214
  switch (format) {
227
215
  case undefined:
228
- return (_a = encodeAsFormat !== null && encodeAsFormat !== void 0 ? encodeAsFormat : encoding) !== null && _a !== void 0 ? _a : format;
216
+ return encodeAsFormat ?? encoding ?? format;
229
217
  case "date-time":
230
218
  return encoding;
231
219
  case "duration":
232
220
  default:
233
- return (_b = encodeAsFormat !== null && encodeAsFormat !== void 0 ? encodeAsFormat : encoding) !== null && _b !== void 0 ? _b : format;
221
+ return encodeAsFormat ?? encoding ?? format;
234
222
  }
235
223
  }
236
224
  function getSchemaForScalar(dpgContext, scalar, options) {
237
225
  let result = {};
238
226
  const isStd = dpgContext.program.checker.isStdType(scalar);
239
- const { relevantProperty, isRequestBody, isParentRequestBody, mediaTypes: contentTypes } = options !== null && options !== void 0 ? options : {};
227
+ const { relevantProperty, isRequestBody, isParentRequestBody, mediaTypes: contentTypes, } = options ?? {};
240
228
  if (isStd) {
241
229
  result = getSchemaForStdScalar(dpgContext.program, scalar, {
242
- relevantProperty
230
+ relevantProperty,
243
231
  });
244
232
  }
245
233
  else if (scalar.baseScalar) {
@@ -259,20 +247,15 @@ function getSchemaForScalar(dpgContext, scalar, options) {
259
247
  }
260
248
  else {
261
249
  // for other cases we would trust the @encode decorator if not present we would treat it as string
262
- const withDecorators = applyEncoding(dpgContext, scalar, result
263
- ? applyIntrinsicDecorators(dpgContext.program, scalar, result)
264
- : undefined);
265
- if (withDecorators.type === "string" &&
266
- withDecorators.format === "binary") {
250
+ const withDecorators = applyEncoding(dpgContext, scalar, result ? applyIntrinsicDecorators(dpgContext.program, scalar, result) : undefined);
251
+ if (withDecorators.type === "string" && withDecorators.format === "binary") {
267
252
  withDecorators.typeName = BINARY_TYPE_UNION;
268
253
  withDecorators.outputTypeName = "Uint8Array";
269
254
  }
270
255
  return withDecorators;
271
256
  }
272
257
  function isBinaryAsRequestBody() {
273
- return (hasMediaType(KnownMediaType.Binary, contentTypes) &&
274
- isRequestBody &&
275
- isBytesType(result));
258
+ return (hasMediaType(KnownMediaType.Binary, contentTypes) && isRequestBody && isBytesType(result));
276
259
  }
277
260
  function isFormDataBytesInRequestBody() {
278
261
  return (hasMediaType(KnownMediaType.MultipartFormData, contentTypes) &&
@@ -281,17 +264,16 @@ function getSchemaForScalar(dpgContext, scalar, options) {
281
264
  }
282
265
  }
283
266
  function getSchemaForUnion(dpgContext, union, options) {
284
- var _a, _b;
285
267
  const [asEnum, _] = getUnionAsEnum(union);
286
268
  const variants = Array.from(union.variants.values());
287
269
  const values = [];
288
270
  let namedUnionMember = false;
289
- if (!((options === null || options === void 0 ? void 0 : options.needRef) && union.name && !asEnum)) {
290
- if ((asEnum === null || asEnum === void 0 ? void 0 : asEnum.open) && asEnum.members.size > 0) {
271
+ if (!(options?.needRef && union.name && !asEnum)) {
272
+ if (asEnum?.open && asEnum.members.size > 0) {
291
273
  for (const [_, member] of asEnum.members.entries()) {
292
274
  const memberType = getSchemaForType(dpgContext, member.type, {
293
275
  ...options,
294
- needRef: (_a = options === null || options === void 0 ? void 0 : options.needRef) !== null && _a !== void 0 ? _a : false
276
+ needRef: options?.needRef ?? false,
295
277
  });
296
278
  values.push(memberType);
297
279
  if (memberType.name) {
@@ -304,7 +286,7 @@ function getSchemaForUnion(dpgContext, union, options) {
304
286
  // We already know it's not a model type
305
287
  const variantType = getSchemaForType(dpgContext, variant.type, {
306
288
  ...options,
307
- needRef: isAnonymousModelType(variant.type) ? false : true
289
+ needRef: isAnonymousModelType(variant.type) ? false : true,
308
290
  });
309
291
  values.push(variantType);
310
292
  if (variantType.typeName) {
@@ -316,23 +298,17 @@ function getSchemaForUnion(dpgContext, union, options) {
316
298
  const schema = {};
317
299
  if (values.length > 0) {
318
300
  schema.enum = values;
319
- const unionAlias = (asEnum === null || asEnum === void 0 ? void 0 : asEnum.open) && (asEnum === null || asEnum === void 0 ? void 0 : asEnum.kind) && !namedUnionMember
301
+ const unionAlias = asEnum?.open && asEnum?.kind && !namedUnionMember
320
302
  ? asEnum.kind + (asEnum.nullable ? " | null" : "")
321
- : values
322
- .map((item) => { var _a; return `${(_a = getTypeName(item, [SchemaContext.Input])) !== null && _a !== void 0 ? _a : item}`; })
323
- .join(" | ");
324
- const outputUnionAlias = (asEnum === null || asEnum === void 0 ? void 0 : asEnum.open) && (asEnum === null || asEnum === void 0 ? void 0 : asEnum.kind) && !namedUnionMember
303
+ : values.map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`).join(" | ");
304
+ const outputUnionAlias = asEnum?.open && asEnum?.kind && !namedUnionMember
325
305
  ? asEnum.kind + (asEnum.nullable ? " | null" : "")
326
- : values
327
- .map((item) => { var _a; return `${(_a = getTypeName(item, [SchemaContext.Output])) !== null && _a !== void 0 ? _a : item}`; })
328
- .join(" | ");
306
+ : values.map((item) => `${getTypeName(item, [SchemaContext.Output]) ?? item}`).join(" | ");
329
307
  schema.alias = unionAlias;
330
308
  schema.outputAlias = outputUnionAlias;
331
309
  }
332
310
  if (!union.expression) {
333
- const unionName = union.name
334
- ? normalizeName(union.name, NameType.Interface)
335
- : undefined;
311
+ const unionName = union.name ? normalizeName(union.name, NameType.Interface) : undefined;
336
312
  schema.name = unionName;
337
313
  schema.type = "object";
338
314
  schema.typeName = unionName;
@@ -347,10 +323,8 @@ function getSchemaForUnion(dpgContext, union, options) {
347
323
  }
348
324
  else {
349
325
  schema.type = "union";
350
- schema.typeName = (_b = union.name) !== null && _b !== void 0 ? _b : schema.alias;
351
- schema.outputTypeName = union.name
352
- ? union.name + "Output"
353
- : schema.outputAlias;
326
+ schema.typeName = union.name ?? schema.alias;
327
+ schema.outputTypeName = union.name ? union.name + "Output" : schema.outputAlias;
354
328
  delete schema.alias;
355
329
  delete schema.outputAlias;
356
330
  }
@@ -385,7 +359,6 @@ function isOasString(type) {
385
359
  return false;
386
360
  }
387
361
  function isStringLiteral(type) {
388
- var _a;
389
362
  if (type.kind === "Union") {
390
363
  // A union where all variants are an OasString
391
364
  for (const variant of type.variants) {
@@ -396,13 +369,11 @@ function isStringLiteral(type) {
396
369
  return true;
397
370
  }
398
371
  return (type.kind === "String" ||
399
- (type.kind === "EnumMember" &&
400
- typeof ((_a = type.value) !== null && _a !== void 0 ? _a : type.name) === "string") ||
372
+ (type.kind === "EnumMember" && typeof (type.value ?? type.name) === "string") ||
401
373
  (type.kind === "UnionVariant" && type.type.kind === "String"));
402
374
  }
403
375
  // Return any string literal values for type
404
376
  function getStringValues(type) {
405
- var _a;
406
377
  switch (type.kind) {
407
378
  case "String":
408
379
  return [type.value];
@@ -411,7 +382,7 @@ function getStringValues(type) {
411
382
  .flatMap((x) => getStringValues(x.type))
412
383
  .filter((x) => x !== undefined);
413
384
  case "EnumMember":
414
- return typeof type.value !== "number" ? [(_a = type.value) !== null && _a !== void 0 ? _a : type.name] : [];
385
+ return typeof type.value !== "number" ? [type.value ?? type.name] : [];
415
386
  case "UnionVariant":
416
387
  return getStringValues(type.type);
417
388
  default:
@@ -419,7 +390,6 @@ function getStringValues(type) {
419
390
  }
420
391
  }
421
392
  function validateDiscriminator(program, discriminator, derivedModels) {
422
- var _a;
423
393
  const { propertyName } = discriminator;
424
394
  const retVals = derivedModels.map((t) => {
425
395
  const prop = getProperty(t, propertyName);
@@ -427,18 +397,16 @@ function validateDiscriminator(program, discriminator, derivedModels) {
427
397
  reportDiagnostic(program, {
428
398
  code: "discriminator",
429
399
  messageId: "missing",
430
- target: t
400
+ target: t,
431
401
  });
432
402
  return false;
433
403
  }
434
404
  let retval = true;
435
- if (!isOasString(prop.type) &&
436
- prop.type.kind !== "EnumMember" &&
437
- prop.type.kind !== "Enum") {
405
+ if (!isOasString(prop.type) && prop.type.kind !== "EnumMember" && prop.type.kind !== "Enum") {
438
406
  reportDiagnostic(program, {
439
407
  code: "discriminator",
440
408
  messageId: "type",
441
- target: prop
409
+ target: prop,
442
410
  });
443
411
  retval = false;
444
412
  }
@@ -446,7 +414,7 @@ function validateDiscriminator(program, discriminator, derivedModels) {
446
414
  reportDiagnostic(program, {
447
415
  code: "discriminator",
448
416
  messageId: "required",
449
- target: prop
417
+ target: prop,
450
418
  });
451
419
  retval = false;
452
420
  }
@@ -456,13 +424,13 @@ function validateDiscriminator(program, discriminator, derivedModels) {
456
424
  const discriminatorValues = new Map();
457
425
  for (const t of derivedModels) {
458
426
  // Get the discriminator property directly in the child model
459
- const prop = (_a = t.properties) === null || _a === void 0 ? void 0 : _a.get(propertyName);
427
+ const prop = t.properties?.get(propertyName);
460
428
  // Issue warning diagnostic if discriminator property missing or is not a string literal
461
429
  if (!prop || !isStringLiteral(prop.type)) {
462
430
  reportDiagnostic(program, {
463
431
  code: "discriminator-value",
464
432
  messageId: "literal",
465
- target: prop || t
433
+ target: prop || t,
466
434
  });
467
435
  }
468
436
  if (prop) {
@@ -475,9 +443,9 @@ function validateDiscriminator(program, discriminator, derivedModels) {
475
443
  format: {
476
444
  val: val,
477
445
  model1: discriminatorValues.get(val),
478
- model2: t.name
446
+ model2: t.name,
479
447
  },
480
- target: prop
448
+ target: prop,
481
449
  });
482
450
  retVals.push(false);
483
451
  }
@@ -490,20 +458,19 @@ function validateDiscriminator(program, discriminator, derivedModels) {
490
458
  return retVals.every((v) => v);
491
459
  }
492
460
  function getSchemaForModel(dpgContext, model, options) {
493
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
494
- const { usage, needRef, isRequestBody, mediaTypes: contentTypes } = options !== null && options !== void 0 ? options : {};
461
+ const { usage, needRef, isRequestBody, mediaTypes: contentTypes } = options ?? {};
495
462
  if (isArrayModelType(model)) {
496
463
  return getSchemaForArrayModel(dpgContext, model, options);
497
464
  }
498
465
  const program = dpgContext.program;
499
- const isMultipartBody = isMediaTypeMultipartFormData(contentTypes !== null && contentTypes !== void 0 ? contentTypes : []);
466
+ const isMultipartBody = isMediaTypeMultipartFormData(contentTypes ?? []);
500
467
  const isCoreModel = isAzureCoreErrorType(program, model);
501
468
  const modelSchema = {
502
469
  name: getModelName(dpgContext, model),
503
470
  type: "object",
504
471
  isMultipartBody,
505
- description: (_a = getDoc(program, model)) !== null && _a !== void 0 ? _a : "",
506
- fromCore: isCoreModel
472
+ description: getDoc(program, model) ?? "",
473
+ fromCore: isCoreModel,
507
474
  };
508
475
  // normalized the output name
509
476
  modelSchema.name = normalizeName(modelSchema.name, NameType.Interface, true /** shouldGuard */);
@@ -524,32 +491,32 @@ function getSchemaForModel(dpgContext, model, options) {
524
491
  if (derivedModels.length > 0) {
525
492
  modelSchema.children = {
526
493
  all: [],
527
- immediate: []
494
+ immediate: [],
528
495
  };
529
496
  }
530
497
  for (const child of derivedModels) {
531
498
  const childSchema = getSchemaForType(dpgContext, child, {
532
499
  usage,
533
- needRef: true
500
+ needRef: true,
534
501
  });
535
502
  for (const [name, prop] of child.properties) {
536
- if (name === (discriminator === null || discriminator === void 0 ? void 0 : discriminator.propertyName)) {
503
+ if (name === discriminator?.propertyName) {
537
504
  const propSchema = getSchemaForType(dpgContext, prop.type, {
538
505
  usage,
539
506
  needRef: !isAnonymousModelType(prop.type),
540
- relevantProperty: prop
507
+ relevantProperty: prop,
541
508
  });
542
509
  childSchema.discriminatorValue = propSchema.type.replace(/"/g, "");
543
510
  break;
544
511
  }
545
512
  }
546
- (_c = (_b = modelSchema.children) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.push(childSchema);
547
- (_e = (_d = modelSchema.children) === null || _d === void 0 ? void 0 : _d.immediate) === null || _e === void 0 ? void 0 : _e.push(childSchema);
513
+ modelSchema.children?.all?.push(childSchema);
514
+ modelSchema.children?.immediate?.push(childSchema);
548
515
  }
549
516
  // Enable option `isPolyParent` and discriminator only when it has valid children
550
517
  if (discriminator &&
551
- ((_g = (_f = modelSchema === null || modelSchema === void 0 ? void 0 : modelSchema.children) === null || _f === void 0 ? void 0 : _f.all) === null || _g === void 0 ? void 0 : _g.length) &&
552
- ((_j = (_h = modelSchema === null || modelSchema === void 0 ? void 0 : modelSchema.children) === null || _h === void 0 ? void 0 : _h.all) === null || _j === void 0 ? void 0 : _j.length) > 0) {
518
+ modelSchema?.children?.all?.length &&
519
+ modelSchema?.children?.all?.length > 0) {
553
520
  if (!validateDiscriminator(program, discriminator, derivedModels)) {
554
521
  // appropriate diagnostic is generated in the validate function
555
522
  return {};
@@ -558,7 +525,7 @@ function getSchemaForModel(dpgContext, model, options) {
558
525
  modelSchema.discriminator = {
559
526
  name: propertyName,
560
527
  type: "string",
561
- description: `Discriminator property for ${model.name}.`
528
+ description: `Discriminator property for ${model.name}.`,
562
529
  };
563
530
  modelSchema.discriminatorValue = propertyName;
564
531
  modelSchema.isPolyParent = true;
@@ -570,12 +537,12 @@ function getSchemaForModel(dpgContext, model, options) {
570
537
  if (isRecordModelType(model)) {
571
538
  modelSchema.parents = {
572
539
  all: [getSchemaForRecordModel(dpgContext, model, { usage })],
573
- immediate: [getSchemaForRecordModel(dpgContext, model, { usage })]
540
+ immediate: [getSchemaForRecordModel(dpgContext, model, { usage })],
574
541
  };
575
542
  }
576
543
  for (const [propName, prop] of model.properties) {
577
544
  const restApiName = getWireName(dpgContext, prop);
578
- const name = `"${restApiName !== null && restApiName !== void 0 ? restApiName : propName}"`;
545
+ const name = `"${restApiName ?? propName}"`;
579
546
  if (!isSchemaProperty(program, prop)) {
580
547
  continue;
581
548
  }
@@ -585,7 +552,7 @@ function getSchemaForModel(dpgContext, model, options) {
585
552
  relevantProperty: prop,
586
553
  isParentRequestBody: isRequestBody,
587
554
  isRequestBody: false,
588
- mediaTypes: contentTypes
555
+ mediaTypes: contentTypes,
589
556
  });
590
557
  if (propSchema === undefined) {
591
558
  continue;
@@ -600,16 +567,14 @@ function getSchemaForModel(dpgContext, model, options) {
600
567
  modelSchema.properties[name] = propSchema;
601
568
  // if this property is a discriminator property, remove it to keep autorest validation happy
602
569
  const { propertyName } = getDiscriminator(program, model) || {};
603
- if (propertyName &&
604
- name === `"${propertyName}"` &&
605
- modelSchema.discriminator) {
570
+ if (propertyName && name === `"${propertyName}"` && modelSchema.discriminator) {
606
571
  modelSchema.discriminator = {
607
572
  ...modelSchema.discriminator,
608
573
  ...{
609
- type: (_k = propSchema.typeName) !== null && _k !== void 0 ? _k : propSchema.type,
574
+ type: propSchema.typeName ?? propSchema.type,
610
575
  typeName: propSchema.typeName,
611
- outputTypeName: propSchema.outputTypeName
612
- }
576
+ outputTypeName: propSchema.outputTypeName,
577
+ },
613
578
  };
614
579
  continue;
615
580
  }
@@ -645,16 +610,16 @@ function getSchemaForModel(dpgContext, model, options) {
645
610
  if (modelSchema.parents === undefined) {
646
611
  modelSchema.parents = {
647
612
  all: [],
648
- immediate: []
613
+ immediate: [],
649
614
  };
650
615
  }
651
- (_l = modelSchema.parents.all) === null || _l === void 0 ? void 0 : _l.push(getSchemaForType(dpgContext, model.baseModel, {
616
+ modelSchema.parents.all?.push(getSchemaForType(dpgContext, model.baseModel, {
652
617
  usage,
653
- needRef: true
618
+ needRef: true,
654
619
  }));
655
- (_m = modelSchema.parents.immediate) === null || _m === void 0 ? void 0 : _m.push(getSchemaForType(dpgContext, model.baseModel, {
620
+ modelSchema.parents.immediate?.push(getSchemaForType(dpgContext, model.baseModel, {
656
621
  usage,
657
- needRef: true
622
+ needRef: true,
658
623
  }));
659
624
  }
660
625
  return modelSchema;
@@ -664,24 +629,19 @@ function getSdkVisibility(program, type) {
664
629
  const visibility = getVisibilityForClass(program, type, lifecycle);
665
630
  if (visibility) {
666
631
  const result = [];
667
- if (lifecycle.members.get("Read") &&
668
- visibility.has(lifecycle.members.get("Read"))) {
632
+ if (lifecycle.members.get("Read") && visibility.has(lifecycle.members.get("Read"))) {
669
633
  result.push(Visibility.Read);
670
634
  }
671
- if (lifecycle.members.get("Create") &&
672
- visibility.has(lifecycle.members.get("Create"))) {
635
+ if (lifecycle.members.get("Create") && visibility.has(lifecycle.members.get("Create"))) {
673
636
  result.push(Visibility.Create);
674
637
  }
675
- if (lifecycle.members.get("Update") &&
676
- visibility.has(lifecycle.members.get("Update"))) {
638
+ if (lifecycle.members.get("Update") && visibility.has(lifecycle.members.get("Update"))) {
677
639
  result.push(Visibility.Update);
678
640
  }
679
- if (lifecycle.members.get("Delete") &&
680
- visibility.has(lifecycle.members.get("Delete"))) {
641
+ if (lifecycle.members.get("Delete") && visibility.has(lifecycle.members.get("Delete"))) {
681
642
  result.push(Visibility.Delete);
682
643
  }
683
- if (lifecycle.members.get("Query") &&
684
- visibility.has(lifecycle.members.get("Query"))) {
644
+ if (lifecycle.members.get("Query") && visibility.has(lifecycle.members.get("Query"))) {
685
645
  result.push(Visibility.Query);
686
646
  }
687
647
  return result;
@@ -692,7 +652,6 @@ function getSdkVisibility(program, type) {
692
652
  * Return the model name for a given model
693
653
  */
694
654
  function getModelName(dpgContext, model) {
695
- var _a, _b;
696
655
  const { program } = dpgContext;
697
656
  // 1. check if this is an anonymous model
698
657
  if (model.name === "") {
@@ -710,22 +669,21 @@ function getModelName(dpgContext, model) {
710
669
  }
711
670
  // 4. check if this is a model with template arguments
712
671
  let name = model.name;
713
- if ((_a = model.templateMapper) === null || _a === void 0 ? void 0 : _a.args) {
672
+ if (model.templateMapper?.args) {
714
673
  // const isPage = getPagedResult(program, model);
715
674
  const templateTypeNames = model.templateMapper.args
716
675
  .map((arg) => (arg.entityKind === "Indeterminate" ? arg.type : arg))
717
676
  .map((arg) => {
718
- var _a, _b;
719
677
  switch (arg.kind) {
720
678
  case "Model":
721
679
  case "Enum":
722
680
  case "Union":
723
681
  case "Scalar":
724
- return (_a = arg.name) !== null && _a !== void 0 ? _a : "";
682
+ return arg.name ?? "";
725
683
  case "String":
726
684
  case "Boolean":
727
685
  case "Number":
728
- return (_b = arg.value) !== null && _b !== void 0 ? _b : "";
686
+ return arg.value ?? "";
729
687
  default:
730
688
  return "";
731
689
  }
@@ -746,9 +704,7 @@ function getModelName(dpgContext, model) {
746
704
  fullNamespacePrefix = "";
747
705
  }
748
706
  // 5. check if this model should be namespaced
749
- return ((_b = dpgContext.rlcOptions) === null || _b === void 0 ? void 0 : _b.enableModelNamespace)
750
- ? `${fullNamespacePrefix}${name}`
751
- : name;
707
+ return dpgContext.rlcOptions?.enableModelNamespace ? `${fullNamespacePrefix}${name}` : name;
752
708
  }
753
709
  // Map an typespec type to an OA schema. Returns undefined when the resulting
754
710
  // OA schema is just a regular object schema.
@@ -776,7 +732,7 @@ function applyIntrinsicDecorators(program, type, target) {
776
732
  const docStr = getDoc(program, type);
777
733
  const isString = isStringType(program, getPropertyType(type));
778
734
  const isNumeric = isNumericType(program, getPropertyType(type));
779
- if (isString && !(target === null || target === void 0 ? void 0 : target.documentation) && docStr) {
735
+ if (isString && !target?.documentation && docStr) {
780
736
  newTarget.description = docStr;
781
737
  }
782
738
  const summaryStr = getSummary(program, type);
@@ -814,8 +770,7 @@ function applyIntrinsicDecorators(program, type, target) {
814
770
  return newTarget;
815
771
  }
816
772
  function getSchemaForEnumMember(program, e) {
817
- var _a;
818
- const value = (_a = e.value) !== null && _a !== void 0 ? _a : e.name;
773
+ const value = e.value ?? e.name;
819
774
  const type = enumMemberType(e) === "string" ? `"${value}"` : `${value}`;
820
775
  return { type, description: getDoc(program, e), isConstant: true };
821
776
  }
@@ -830,7 +785,7 @@ function getSchemaForEnum(dpgContext, e) {
830
785
  if (type !== enumMemberType(option)) {
831
786
  reportDiagnostic(dpgContext.program, {
832
787
  code: "union-unsupported",
833
- target: e
788
+ target: e,
834
789
  });
835
790
  continue;
836
791
  }
@@ -842,12 +797,12 @@ function getSchemaForEnum(dpgContext, e) {
842
797
  typeName: normalizeName(e.name, NameType.Interface),
843
798
  outputTypeName: normalizeName(e.name, NameType.Interface) + "Output",
844
799
  description: getDoc(dpgContext.program, e),
845
- memberType: type
800
+ memberType: type,
846
801
  };
847
802
  if (values.length > 0) {
848
803
  schema.enum = values;
849
804
  const unionAlias = values
850
- .map((item) => { var _a; return `${(_a = getTypeName(item, [SchemaContext.Input])) !== null && _a !== void 0 ? _a : item}`; })
805
+ .map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`)
851
806
  .join(" | ");
852
807
  schema.alias = unionAlias;
853
808
  schema.outputAlias = unionAlias;
@@ -865,10 +820,9 @@ function enumMemberType(member) {
865
820
  * Map TypeSpec intrinsic models to open api definitions
866
821
  */
867
822
  function getSchemaForArrayModel(dpgContext, type, options) {
868
- var _a, _b, _c;
869
823
  const { program } = dpgContext;
870
824
  const { indexer } = type;
871
- const { usage, isParentRequestBody, mediaTypes: contentTypes } = options !== null && options !== void 0 ? options : {};
825
+ const { usage, isParentRequestBody, mediaTypes: contentTypes } = options ?? {};
872
826
  let schema = {};
873
827
  if (!indexer) {
874
828
  return schema;
@@ -884,13 +838,13 @@ function getSchemaForArrayModel(dpgContext, type, options) {
884
838
  isParentRequestBody: hasMediaType(KnownMediaType.MultipartFormData, contentTypes)
885
839
  ? isParentRequestBody
886
840
  : false,
887
- needRef: !isAnonymousModelType(indexer.value)
841
+ needRef: !isAnonymousModelType(indexer.value),
888
842
  }),
889
- description: getDoc(program, type)
843
+ description: getDoc(program, type),
890
844
  };
891
845
  if (!program.checker.isStdType(indexer.value) &&
892
846
  !isUnknownType(indexer.value) &&
893
- ((_a = indexer.value) === null || _a === void 0 ? void 0 : _a.kind) &&
847
+ indexer.value?.kind &&
894
848
  schema.items.name &&
895
849
  !schema.items.enum) {
896
850
  schema.typeName = `Array<${schema.items.name}>`;
@@ -932,9 +886,7 @@ function getSchemaForArrayModel(dpgContext, type, options) {
932
886
  return `${typeName}[]`;
933
887
  })
934
888
  .join(" | ");
935
- if (schema.items.outputTypeName &&
936
- usage &&
937
- usage.includes(SchemaContext.Output)) {
889
+ if (schema.items.outputTypeName && usage && usage.includes(SchemaContext.Output)) {
938
890
  schema.outputTypeName = schema.items.outputTypeName
939
891
  .split("|")
940
892
  .map((typeName) => {
@@ -944,7 +896,7 @@ function getSchemaForArrayModel(dpgContext, type, options) {
944
896
  }
945
897
  }
946
898
  }
947
- else if ((_c = (_b = schema.items) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.includes("|")) {
899
+ else if (schema.items?.type?.includes("|")) {
948
900
  schema.typeName = `(${schema.items.type})[]`;
949
901
  }
950
902
  else {
@@ -956,23 +908,22 @@ function getSchemaForArrayModel(dpgContext, type, options) {
956
908
  }
957
909
  }
958
910
  function getSchemaForRecordModel(dpgContext, type, options) {
959
- var _a, _b;
960
911
  const { program } = dpgContext;
961
912
  const { indexer } = type;
962
- const { usage } = options !== null && options !== void 0 ? options : {};
913
+ const { usage } = options ?? {};
963
914
  let schema = {};
964
915
  if (!indexer) {
965
916
  return schema;
966
917
  }
967
918
  if (isRecordModelType(type)) {
968
- const valueType = getSchemaForType(dpgContext, indexer === null || indexer === void 0 ? void 0 : indexer.value, {
919
+ const valueType = getSchemaForType(dpgContext, indexer?.value, {
969
920
  usage,
970
- needRef: !isAnonymousModelType(indexer.value)
921
+ needRef: !isAnonymousModelType(indexer.value),
971
922
  });
972
923
  schema = {
973
924
  type: "dictionary",
974
925
  additionalProperties: valueType,
975
- description: getDoc(program, type)
926
+ description: getDoc(program, type),
976
927
  };
977
928
  if (!program.checker.isStdType(indexer.value) &&
978
929
  !isUnknownType(indexer.value) &&
@@ -985,18 +936,14 @@ function getSchemaForRecordModel(dpgContext, type, options) {
985
936
  }
986
937
  }
987
938
  else if (isUnknownType(indexer.value)) {
988
- schema.typeName = `Record<string, ${(_a = valueType.typeName) !== null && _a !== void 0 ? _a : valueType.type}>`;
939
+ schema.typeName = `Record<string, ${valueType.typeName ?? valueType.type}>`;
989
940
  if (usage && usage.includes(SchemaContext.Output)) {
990
- schema.outputTypeName = `Record<string, ${(_b = valueType.outputTypeName) !== null && _b !== void 0 ? _b : valueType.type}>`;
941
+ schema.outputTypeName = `Record<string, ${valueType.outputTypeName ?? valueType.type}>`;
991
942
  }
992
943
  }
993
944
  else {
994
- schema.typeName = `Record<string, ${getTypeName(valueType, [
995
- SchemaContext.Input
996
- ])}>`;
997
- schema.outputTypeName = `Record<string, ${getTypeName(valueType, [
998
- SchemaContext.Output
999
- ])}>`;
945
+ schema.typeName = `Record<string, ${getTypeName(valueType, [SchemaContext.Input])}>`;
946
+ schema.outputTypeName = `Record<string, ${getTypeName(valueType, [SchemaContext.Output])}>`;
1000
947
  }
1001
948
  schema.usage = usage;
1002
949
  return schema;
@@ -1006,16 +953,14 @@ function isUnionType(type) {
1006
953
  return type.kind === "Union";
1007
954
  }
1008
955
  export function isObjectOrDictType(schema) {
1009
- return ((schema.type === "object" &&
1010
- schema.properties !== undefined) ||
956
+ return ((schema.type === "object" && schema.properties !== undefined) ||
1011
957
  schema.type === "dictionary");
1012
958
  }
1013
959
  export function isArrayType(schema) {
1014
960
  return schema.type === "array";
1015
961
  }
1016
962
  function getSchemaForStdScalar(program, type, options) {
1017
- var _a, _b;
1018
- const { relevantProperty } = options !== null && options !== void 0 ? options : {};
963
+ const { relevantProperty } = options ?? {};
1019
964
  if (!program.checker.isStdType(type)) {
1020
965
  return undefined;
1021
966
  }
@@ -1039,97 +984,97 @@ function getSchemaForStdScalar(program, type, options) {
1039
984
  return { type: "string", format: "bytes", description };
1040
985
  case "integer":
1041
986
  return applyIntrinsicDecorators(program, type, {
1042
- type: "number"
987
+ type: "number",
1043
988
  });
1044
989
  case "int8":
1045
990
  return applyIntrinsicDecorators(program, type, {
1046
991
  type: "number",
1047
- format: "int8"
992
+ format: "int8",
1048
993
  });
1049
994
  case "int16":
1050
995
  return applyIntrinsicDecorators(program, type, {
1051
996
  type: "number",
1052
- format: "int16"
997
+ format: "int16",
1053
998
  });
1054
999
  case "int32":
1055
1000
  return applyIntrinsicDecorators(program, type, {
1056
1001
  type: "number",
1057
- format: "int32"
1002
+ format: "int32",
1058
1003
  });
1059
1004
  case "int64":
1060
1005
  return applyIntrinsicDecorators(program, type, {
1061
1006
  type: "number",
1062
- format: "int64"
1007
+ format: "int64",
1063
1008
  });
1064
1009
  case "safeint":
1065
1010
  return applyIntrinsicDecorators(program, type, {
1066
1011
  type: "number",
1067
- format: "safeint"
1012
+ format: "safeint",
1068
1013
  });
1069
1014
  case "numeric":
1070
1015
  return applyIntrinsicDecorators(program, type, {
1071
- type: "number"
1016
+ type: "number",
1072
1017
  });
1073
1018
  case "uint8":
1074
1019
  return applyIntrinsicDecorators(program, type, {
1075
1020
  type: "number",
1076
- format: "uint8"
1021
+ format: "uint8",
1077
1022
  });
1078
1023
  case "uint16":
1079
1024
  return applyIntrinsicDecorators(program, type, {
1080
1025
  type: "number",
1081
- format: "uint16"
1026
+ format: "uint16",
1082
1027
  });
1083
1028
  case "uint32":
1084
1029
  return applyIntrinsicDecorators(program, type, {
1085
1030
  type: "number",
1086
- format: "uint32"
1031
+ format: "uint32",
1087
1032
  });
1088
1033
  case "uint64":
1089
1034
  return applyIntrinsicDecorators(program, type, {
1090
1035
  type: "number",
1091
- format: "uint64"
1036
+ format: "uint64",
1092
1037
  });
1093
1038
  case "float64":
1094
1039
  return applyIntrinsicDecorators(program, type, {
1095
1040
  type: "number",
1096
- format: "float64"
1041
+ format: "float64",
1097
1042
  });
1098
1043
  case "float32":
1099
1044
  return applyIntrinsicDecorators(program, type, {
1100
1045
  type: "number",
1101
- format: "float32"
1046
+ format: "float32",
1102
1047
  });
1103
1048
  case "float":
1104
1049
  return applyIntrinsicDecorators(program, type, {
1105
1050
  type: "number",
1106
- format: "float"
1051
+ format: "float",
1107
1052
  });
1108
1053
  case "decimal":
1109
1054
  reportDiagnostic(program, {
1110
1055
  code: "decimal-to-number",
1111
1056
  format: {
1112
- propertyName: (_a = relevantProperty === null || relevantProperty === void 0 ? void 0 : relevantProperty.name) !== null && _a !== void 0 ? _a : ""
1057
+ propertyName: relevantProperty?.name ?? "",
1113
1058
  },
1114
- target: relevantProperty !== null && relevantProperty !== void 0 ? relevantProperty : NoTarget
1059
+ target: relevantProperty ?? NoTarget,
1115
1060
  });
1116
1061
  return applyIntrinsicDecorators(program, type, {
1117
1062
  type: "number",
1118
1063
  format: "decimal",
1119
- description: "decimal"
1064
+ description: "decimal",
1120
1065
  });
1121
1066
  case "decimal128":
1122
1067
  reportDiagnostic(program, {
1123
1068
  code: "decimal-to-number",
1124
1069
  format: {
1125
- propertyName: (_b = relevantProperty === null || relevantProperty === void 0 ? void 0 : relevantProperty.name) !== null && _b !== void 0 ? _b : ""
1070
+ propertyName: relevantProperty?.name ?? "",
1126
1071
  },
1127
- target: relevantProperty !== null && relevantProperty !== void 0 ? relevantProperty : NoTarget
1072
+ target: relevantProperty ?? NoTarget,
1128
1073
  });
1129
1074
  return applyIntrinsicDecorators(program, type, {
1130
1075
  type: "number",
1131
1076
  format: "decimal128",
1132
- description: "decimal128"
1077
+ description: "decimal128",
1133
1078
  });
1134
1079
  case "string":
1135
1080
  if (format === "binary") {
@@ -1138,11 +1083,11 @@ function getSchemaForStdScalar(program, type, options) {
1138
1083
  format: "binary",
1139
1084
  description,
1140
1085
  typeName: BINARY_TYPE_UNION,
1141
- outputTypeName: "Uint8Array"
1086
+ outputTypeName: "Uint8Array",
1142
1087
  };
1143
1088
  }
1144
1089
  return applyIntrinsicDecorators(program, type, {
1145
- type: "string"
1090
+ type: "string",
1146
1091
  });
1147
1092
  case "boolean":
1148
1093
  return { type: "boolean", description };
@@ -1152,7 +1097,7 @@ function getSchemaForStdScalar(program, type, options) {
1152
1097
  format,
1153
1098
  description,
1154
1099
  typeName: "string",
1155
- outputTypeName: "string"
1100
+ outputTypeName: "string",
1156
1101
  };
1157
1102
  case "utcDateTime":
1158
1103
  return {
@@ -1160,7 +1105,7 @@ function getSchemaForStdScalar(program, type, options) {
1160
1105
  format,
1161
1106
  description,
1162
1107
  typeName: "Date | string",
1163
- outputTypeName: "string"
1108
+ outputTypeName: "string",
1164
1109
  };
1165
1110
  case "offsetDateTime":
1166
1111
  return {
@@ -1168,7 +1113,7 @@ function getSchemaForStdScalar(program, type, options) {
1168
1113
  format: "date-time",
1169
1114
  description,
1170
1115
  typeName: "string",
1171
- outputTypeName: "string"
1116
+ outputTypeName: "string",
1172
1117
  };
1173
1118
  case "plainTime":
1174
1119
  return {
@@ -1176,7 +1121,7 @@ function getSchemaForStdScalar(program, type, options) {
1176
1121
  format: "time",
1177
1122
  description,
1178
1123
  typeName: "string",
1179
- outputTypeName: "string"
1124
+ outputTypeName: "string",
1180
1125
  };
1181
1126
  case "duration":
1182
1127
  return { type: "string", format, description };
@@ -1188,25 +1133,17 @@ function isEncodeTypeEffective(type, encodeData) {
1188
1133
  if (!encodeData) {
1189
1134
  return false;
1190
1135
  }
1191
- const datetimeTypes = [
1192
- "plaindate",
1193
- "utcdatetime",
1194
- "offsetdatetime",
1195
- "plaintime"
1196
- ];
1197
- if (datetimeTypes.includes(type.name.toLowerCase()) &&
1198
- encodeData.type.name === "string") {
1136
+ const datetimeTypes = ["plaindate", "utcdatetime", "offsetdatetime", "plaintime"];
1137
+ if (datetimeTypes.includes(type.name.toLowerCase()) && encodeData.type.name === "string") {
1199
1138
  return false;
1200
1139
  }
1201
1140
  return true;
1202
1141
  }
1203
1142
  export function getTypeName(schema, usage) {
1204
- var _a, _b;
1205
1143
  // TODO: Handle more cases
1206
- return (_b = (_a = getPriorityName(schema, usage)) !== null && _a !== void 0 ? _a : schema.type) !== null && _b !== void 0 ? _b : "any";
1144
+ return getPriorityName(schema, usage) ?? schema.type ?? "any";
1207
1145
  }
1208
1146
  export function getImportedModelName(schema, usage) {
1209
- var _a, _b;
1210
1147
  switch (schema.type) {
1211
1148
  case "array": {
1212
1149
  const ret = new Set();
@@ -1218,7 +1155,7 @@ export function getImportedModelName(schema, usage) {
1218
1155
  case "object": {
1219
1156
  if (isAnonymousObjectSchema(schema)) {
1220
1157
  const ret = new Set();
1221
- const properties = (_a = schema.properties) !== null && _a !== void 0 ? _a : {};
1158
+ const properties = schema.properties ?? {};
1222
1159
  for (const name in properties) {
1223
1160
  if (!properties[name]) {
1224
1161
  continue;
@@ -1227,9 +1164,7 @@ export function getImportedModelName(schema, usage) {
1227
1164
  }
1228
1165
  return [...ret];
1229
1166
  }
1230
- return getPriorityName(schema, usage)
1231
- ? [getPriorityName(schema, usage)]
1232
- : [];
1167
+ return getPriorityName(schema, usage) ? [getPriorityName(schema, usage)] : [];
1233
1168
  }
1234
1169
  case "dictionary": {
1235
1170
  const ret = new Set();
@@ -1240,7 +1175,7 @@ export function getImportedModelName(schema, usage) {
1240
1175
  }
1241
1176
  case "union": {
1242
1177
  const ret = new Set();
1243
- ((_b = schema.enum) !== null && _b !== void 0 ? _b : [])
1178
+ (schema.enum ?? [])
1244
1179
  .filter((i) => !!i)
1245
1180
  .forEach((i) => getImportedModelName(i, usage).forEach((it) => ret.add(it)));
1246
1181
  return [...ret];
@@ -1250,12 +1185,9 @@ export function getImportedModelName(schema, usage) {
1250
1185
  }
1251
1186
  }
1252
1187
  function getPriorityName(schema, usage) {
1253
- var _a, _b, _c;
1254
- return usage &&
1255
- usage.includes(SchemaContext.Input) &&
1256
- !usage.includes(SchemaContext.Output)
1257
- ? ((_a = schema.typeName) !== null && _a !== void 0 ? _a : schema.name)
1258
- : ((_c = (_b = schema.outputTypeName) !== null && _b !== void 0 ? _b : schema.typeName) !== null && _c !== void 0 ? _c : schema.name);
1188
+ return usage && usage.includes(SchemaContext.Input) && !usage.includes(SchemaContext.Output)
1189
+ ? (schema.typeName ?? schema.name)
1190
+ : (schema.outputTypeName ?? schema.typeName ?? schema.name);
1259
1191
  }
1260
1192
  function getEnumStringDescription(type) {
1261
1193
  if ((type.name === "string" ||
@@ -1275,15 +1207,13 @@ function getEnumStringDescription(type) {
1275
1207
  return undefined;
1276
1208
  }
1277
1209
  function getBinaryDescription(type) {
1278
- var _a;
1279
- if ((_a = type === null || type === void 0 ? void 0 : type.typeName) === null || _a === void 0 ? void 0 : _a.includes(BINARY_TYPE_UNION)) {
1210
+ if (type?.typeName?.includes(BINARY_TYPE_UNION)) {
1280
1211
  return `Value may contain any sequence of octets`;
1281
1212
  }
1282
1213
  return undefined;
1283
1214
  }
1284
1215
  function getDecimalDescription(type) {
1285
- if ((type.format === "decimal" || type.format === "decimal128") &&
1286
- type.type === "number") {
1216
+ if ((type.format === "decimal" || type.format === "decimal128") && type.type === "number") {
1287
1217
  return `NOTE: This property is represented as a 'number' in JavaScript, but it corresponds to a 'decimal' type in other languages.
1288
1218
  Due to the inherent limitations of floating-point arithmetic in JavaScript, precision issues may arise when performing arithmetic operations.
1289
1219
  If your application requires high precision for arithmetic operations or when round-tripping data back to other languages, consider using a library like decimal.js, which provides an arbitrary-precision Decimal type.
@@ -1294,21 +1224,20 @@ Always be cautious with direct arithmetic operations and consider implementing a
1294
1224
  return undefined;
1295
1225
  }
1296
1226
  export function getFormattedPropertyDoc(program, type, schemaType, sperator = "\n\n") {
1297
- var _a, _b;
1298
1227
  const propertyDoc = getDoc(program, type);
1299
- const enhancedDocFromType = (_b = (_a = getEnumStringDescription(schemaType)) !== null && _a !== void 0 ? _a : getDecimalDescription(schemaType)) !== null && _b !== void 0 ? _b : getBinaryDescription(schemaType);
1228
+ const enhancedDocFromType = getEnumStringDescription(schemaType) ??
1229
+ getDecimalDescription(schemaType) ??
1230
+ getBinaryDescription(schemaType);
1300
1231
  if (propertyDoc && enhancedDocFromType) {
1301
1232
  return `${propertyDoc}${sperator}${enhancedDocFromType}`;
1302
1233
  }
1303
- return propertyDoc !== null && propertyDoc !== void 0 ? propertyDoc : enhancedDocFromType;
1234
+ return propertyDoc ?? enhancedDocFromType;
1304
1235
  }
1305
1236
  export function getBodyType(route) {
1306
- var _a;
1307
- const bodyModel = (_a = route.parameters.body) === null || _a === void 0 ? void 0 : _a.type;
1237
+ const bodyModel = route.parameters.body?.type;
1308
1238
  return bodyModel;
1309
1239
  }
1310
1240
  export function getValueTypeValue(value) {
1311
- var _a;
1312
1241
  switch (value.valueKind) {
1313
1242
  case "ArrayValue":
1314
1243
  return value.values.map((x) => getValueTypeValue(x));
@@ -1319,11 +1248,11 @@ export function getValueTypeValue(value) {
1319
1248
  case "NumericValue":
1320
1249
  return value.value.asNumber();
1321
1250
  case "EnumValue":
1322
- return (_a = value.value.value) !== null && _a !== void 0 ? _a : value.value.name;
1251
+ return value.value.value ?? value.value.name;
1323
1252
  case "ObjectValue":
1324
1253
  return Object.fromEntries([...value.properties.keys()].map((x) => [
1325
1254
  x,
1326
- getValueTypeValue(value.properties.get(x).value)
1255
+ getValueTypeValue(value.properties.get(x).value),
1327
1256
  ]));
1328
1257
  default:
1329
1258
  // TODO: handle scalar value
@@ -1340,28 +1269,25 @@ export function getValueTypeValue(value) {
1340
1269
  * @returns
1341
1270
  */
1342
1271
  export function predictDefaultValue(dpgContext, param) {
1343
- var _a, _b;
1344
1272
  if (!param) {
1345
1273
  return;
1346
1274
  }
1347
1275
  const program = dpgContext.program;
1348
- const specificDefault = param.defaultValue
1349
- ? getValueTypeValue(param.defaultValue)
1350
- : undefined;
1276
+ const specificDefault = param.defaultValue ? getValueTypeValue(param.defaultValue) : undefined;
1351
1277
  if (specificDefault) {
1352
1278
  if (typeof specificDefault === "object") {
1353
1279
  reportDiagnostic(program, {
1354
1280
  code: "default-value-object",
1355
1281
  format: {
1356
- propertyName: param.name
1282
+ propertyName: param.name,
1357
1283
  },
1358
- target: param
1284
+ target: param,
1359
1285
  });
1360
1286
  return specificDefault.toString();
1361
1287
  }
1362
1288
  return specificDefault;
1363
1289
  }
1364
- const serviceNamespace = (_b = getDefaultService(program, (_a = dpgContext.rlcOptions) === null || _a === void 0 ? void 0 : _a.isModularLibrary)) === null || _b === void 0 ? void 0 : _b.type;
1290
+ const serviceNamespace = getDefaultService(program, dpgContext.rlcOptions?.isModularLibrary)?.type;
1365
1291
  if (!serviceNamespace) {
1366
1292
  return;
1367
1293
  }
@@ -1376,13 +1302,13 @@ export function getDefaultService(program, isModularLibrary = true) {
1376
1302
  if (!services || services.length === 0) {
1377
1303
  reportDiagnostic(program, {
1378
1304
  code: "no-service-defined",
1379
- target: NoTarget
1305
+ target: NoTarget,
1380
1306
  });
1381
1307
  }
1382
1308
  if (services.length > 1 && !isModularLibrary) {
1383
1309
  reportDiagnostic(program, {
1384
1310
  code: "more-than-one-service",
1385
- target: NoTarget
1311
+ target: NoTarget,
1386
1312
  });
1387
1313
  }
1388
1314
  return services[0];
@@ -1391,11 +1317,10 @@ export function getDefaultService(program, isModularLibrary = true) {
1391
1317
  * Return the default api version from the program; undefined if no default
1392
1318
  */
1393
1319
  export function getDefaultApiVersionString(dpgContext) {
1394
- var _a, _b;
1395
1320
  const program = dpgContext.program;
1396
- const isModularLibrary = (_a = dpgContext.rlcOptions) === null || _a === void 0 ? void 0 : _a.isModularLibrary;
1321
+ const isModularLibrary = dpgContext.rlcOptions?.isModularLibrary;
1397
1322
  return getDefaultService(program, isModularLibrary)
1398
- ? (_b = getDefaultApiVersion(dpgContext, getDefaultService(program, isModularLibrary).type)) === null || _b === void 0 ? void 0 : _b.value
1323
+ ? getDefaultApiVersion(dpgContext, getDefaultService(program, isModularLibrary).type)?.value
1399
1324
  : undefined;
1400
1325
  }
1401
1326
  export function trimUsage(model) {
@@ -1423,14 +1348,10 @@ export function isAzureCoreErrorType(program, t) {
1423
1348
  return isAzureCoreFoundationsNamespace(effective);
1424
1349
  }
1425
1350
  function isAzureCoreFoundationsNamespace(t, skipFoundation = false) {
1426
- var _a;
1427
1351
  const namespaces = (skipFoundation ? ".Azure.Core" : ".Azure.Core.Foundations").split(".");
1428
1352
  while (namespaces.length > 0 &&
1429
- ((t === null || t === void 0 ? void 0 : t.kind) === "Model" ||
1430
- (t === null || t === void 0 ? void 0 : t.kind) === "Enum" ||
1431
- (t === null || t === void 0 ? void 0 : t.kind) === "Union" ||
1432
- (t === null || t === void 0 ? void 0 : t.kind) === "Namespace") &&
1433
- ((_a = t.namespace) === null || _a === void 0 ? void 0 : _a.name) === namespaces.pop()) {
1353
+ (t?.kind === "Model" || t?.kind === "Enum" || t?.kind === "Union" || t?.kind === "Namespace") &&
1354
+ t.namespace?.name === namespaces.pop()) {
1434
1355
  t = t.namespace;
1435
1356
  }
1436
1357
  return namespaces.length == 0;
@@ -1476,8 +1397,7 @@ export function getModelInlineSigniture(schema, options = {}) {
1476
1397
  return schemaSignature;
1477
1398
  }
1478
1399
  function getMultipartInlineSignature(schema, importedModels, usage) {
1479
- var _a;
1480
- const types = Object.entries((_a = schema.properties) !== null && _a !== void 0 ? _a : {})
1400
+ const types = Object.entries(schema.properties ?? {})
1481
1401
  .map(([propertyName, property]) => {
1482
1402
  let schema;
1483
1403
  // Flatten arrays for file uploads
@@ -1515,20 +1435,14 @@ function getMultipartInlineSignature(schema, importedModels, usage) {
1515
1435
  * represented as properties in typespec.
1516
1436
  */
1517
1437
  export function isSchemaProperty(program, property) {
1518
- var _a;
1519
1438
  const headerInfo = getHeaderFieldName(program, property);
1520
1439
  const queryInfo = getQueryParamName(program, property);
1521
1440
  const pathInfo = getPathParamName(program, property);
1522
1441
  const statusCodeInfo = isStatusCode(program, property);
1523
- const isNonVisibility = (_a = getSdkVisibility(program, property)) === null || _a === void 0 ? void 0 : _a.includes(Visibility.None);
1524
- return !(headerInfo ||
1525
- queryInfo ||
1526
- pathInfo ||
1527
- statusCodeInfo ||
1528
- isNonVisibility);
1442
+ const isNonVisibility = getSdkVisibility(program, property)?.includes(Visibility.None);
1443
+ return !(headerInfo || queryInfo || pathInfo || statusCodeInfo || isNonVisibility);
1529
1444
  }
1530
1445
  export function getEffectiveSchemaType(program, type) {
1531
- var _a, _b;
1532
1446
  // If type is an anonymous model, tries to find a named model that has the same properties
1533
1447
  let effective = undefined;
1534
1448
  if (type.kind === "Union") {
@@ -1536,8 +1450,8 @@ export function getEffectiveSchemaType(program, type) {
1536
1450
  .map((x) => x.type)
1537
1451
  .filter((t) => !isNullType(t));
1538
1452
  if (nonNullOptions.length === 1 &&
1539
- ((_a = nonNullOptions[0]) === null || _a === void 0 ? void 0 : _a.kind) === "Model" &&
1540
- ((_b = nonNullOptions[0]) === null || _b === void 0 ? void 0 : _b.name) === "") {
1453
+ nonNullOptions[0]?.kind === "Model" &&
1454
+ nonNullOptions[0]?.name === "") {
1541
1455
  effective = getEffectiveModelType(program, nonNullOptions[0]);
1542
1456
  }
1543
1457
  return type;
@@ -1545,16 +1459,13 @@ export function getEffectiveSchemaType(program, type) {
1545
1459
  else if (type.name === "") {
1546
1460
  effective = getEffectiveModelType(program, type, (property) => isSchemaProperty(program, property));
1547
1461
  }
1548
- if (effective === null || effective === void 0 ? void 0 : effective.name) {
1462
+ if (effective?.name) {
1549
1463
  return effective;
1550
1464
  }
1551
1465
  return type;
1552
1466
  }
1553
1467
  export function isBodyRequired(parameter) {
1554
- var _a, _b, _c;
1555
- return ((_a = parameter.body) === null || _a === void 0 ? void 0 : _a.type) && ((_c = (_b = parameter.body) === null || _b === void 0 ? void 0 : _b.property) === null || _c === void 0 ? void 0 : _c.optional) !== true
1556
- ? true
1557
- : false;
1468
+ return parameter.body?.type && parameter.body?.property?.optional !== true ? true : false;
1558
1469
  }
1559
1470
  export function getCollectionFormat(context, param) {
1560
1471
  const type = param.param;
@@ -1563,7 +1474,7 @@ export function getCollectionFormat(context, param) {
1563
1474
  if (param.explode) {
1564
1475
  return "multi";
1565
1476
  }
1566
- switch (encode === null || encode === void 0 ? void 0 : encode.encoding) {
1477
+ switch (encode?.encoding) {
1567
1478
  case "ArrayEncoding.pipeDelimited":
1568
1479
  return "pipes";
1569
1480
  case "ArrayEncoding.spaceDelimited":