@azure-tools/typespec-ts 0.54.0-dev.6 → 0.54.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +2 -4
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +12 -20
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +8 -11
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
- package/dist/src/framework/hooks/useDependencies.js +1 -1
- package/dist/src/framework/hooks/useDependencies.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +1 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +12 -25
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.d.ts.map +1 -1
- package/dist/src/framework/reference.js +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/sample.js +8 -8
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +47 -48
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +140 -140
- package/dist/src/lib.js.map +1 -1
- package/dist/src/metaTree.d.ts +1 -1
- package/dist/src/metaTree.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +49 -62
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +4 -7
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts +2 -2
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +30 -36
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildModularOptions.d.ts +1 -1
- package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
- package/dist/src/modular/buildModularOptions.js +2 -2
- package/dist/src/modular/buildModularOptions.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +3 -3
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +22 -23
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +7 -9
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +11 -11
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts +2 -2
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +30 -39
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +9 -17
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
- package/dist/src/modular/emitLoggerFile.js +2 -2
- package/dist/src/modular/emitLoggerFile.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +54 -72
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +6 -7
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.d.ts.map +1 -1
- package/dist/src/modular/emitSamples.js +40 -52
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.d.ts.map +1 -1
- package/dist/src/modular/emitTests.js +9 -12
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/external-dependencies.js +54 -54
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +27 -36
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +20 -38
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +39 -58
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +4 -5
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +136 -196
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +1 -1
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +50 -56
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +52 -59
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +43 -51
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.js +4 -11
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +60 -60
- package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +7 -9
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +4 -8
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
- package/dist/src/rlc-common/buildClient.d.ts +1 -1
- package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClient.js +48 -66
- package/dist/src/rlc-common/buildClient.js.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +24 -42
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.js +57 -57
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +32 -35
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
- package/dist/src/rlc-common/buildLogger.js +3 -3
- package/dist/src/rlc-common/buildLogger.js.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +3 -3
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.js +29 -46
- package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
- package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.js +42 -50
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.js +5 -5
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.js +19 -22
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSamples.js +2 -2
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSchemaType.js +9 -13
- package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
- package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +2 -3
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +23 -25
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +8 -13
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +8 -12
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
- package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +1 -2
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +3 -4
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +28 -28
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +28 -28
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +13 -13
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -5
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +16 -16
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +10 -18
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +8 -8
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +23 -21
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -2
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +13 -13
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +22 -26
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +26 -29
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +3 -3
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +2 -2
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.js +4 -6
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.js +19 -23
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/transform/transform.d.ts +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +10 -11
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +8 -10
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +9 -11
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +22 -28
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +11 -12
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +1 -1
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +12 -12
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +9 -15
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.js +3 -3
- package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +14 -26
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.d.ts +1 -1
- package/dist/src/utils/clientUtils.d.ts.map +1 -1
- package/dist/src/utils/clientUtils.js +11 -14
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.d.ts +1 -1
- package/dist/src/utils/credentialUtils.d.ts.map +1 -1
- package/dist/src/utils/credentialUtils.js +3 -3
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +8 -12
- package/dist/src/utils/crossLanguageDef.js.map +1 -1
- package/dist/src/utils/emitUtil.d.ts +1 -1
- package/dist/src/utils/emitUtil.d.ts.map +1 -1
- package/dist/src/utils/emitUtil.js +4 -6
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +2 -2
- package/dist/src/utils/fileSystemUtils.js.map +1 -1
- package/dist/src/utils/importHelper.d.ts.map +1 -1
- package/dist/src/utils/importHelper.js +2 -4
- package/dist/src/utils/importHelper.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +1 -1
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.js +7 -19
- package/dist/src/utils/mediaTypes.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts +2 -2
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +107 -170
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
- package/dist/src/utils/namespaceUtils.js +2 -2
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +29 -42
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/src/utils/parameterUtils.d.ts +1 -1
- package/dist/src/utils/parameterUtils.d.ts.map +1 -1
- package/dist/src/utils/parameterUtils.js +19 -22
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.js +2 -2
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
- package/src/contextManager.ts +6 -9
- package/src/framework/declaration.ts +18 -28
- package/src/framework/dependency.ts +1 -2
- package/src/framework/hooks/binder.ts +47 -120
- package/src/framework/hooks/sdkTypes.ts +27 -54
- package/src/framework/hooks/useDependencies.ts +2 -4
- package/src/framework/load-static-helpers.ts +28 -51
- package/src/framework/reference.ts +2 -5
- package/src/framework/sample.ts +9 -9
- package/src/index.ts +111 -180
- package/src/lib.ts +143 -158
- package/src/metaTree.ts +1 -1
- package/src/modular/buildClassicalClient.ts +83 -160
- package/src/modular/buildClassicalOperationGroups.ts +14 -39
- package/src/modular/buildClientContext.ts +54 -83
- package/src/modular/buildModularOptions.ts +4 -5
- package/src/modular/buildOperations.ts +46 -73
- package/src/modular/buildProjectFiles.ts +18 -47
- package/src/modular/buildRestorePoller.ts +27 -46
- package/src/modular/buildRootIndex.ts +86 -159
- package/src/modular/buildSubpathIndex.ts +35 -58
- package/src/modular/emitLoggerFile.ts +4 -9
- package/src/modular/emitModels.ts +136 -266
- package/src/modular/emitModelsOptions.ts +10 -16
- package/src/modular/emitSamples.ts +91 -177
- package/src/modular/emitTests.ts +28 -61
- package/src/modular/external-dependencies.ts +54 -54
- package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
- package/src/modular/helpers/clientHelpers.ts +41 -88
- package/src/modular/helpers/clientOptionHelpers.ts +4 -11
- package/src/modular/helpers/exampleValueHelpers.ts +97 -209
- package/src/modular/helpers/namingHelpers.ts +12 -28
- package/src/modular/helpers/operationHelpers.ts +430 -757
- package/src/modular/helpers/typeHelpers.ts +11 -22
- package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
- package/src/modular/serialization/buildSerializerFunction.ts +91 -129
- package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
- package/src/modular/serialization/serializeUtils.ts +12 -21
- package/src/modular/static/rollup.test.config.js +11 -14
- package/src/modular/static/scripts/renameOutput.mjs +2 -2
- package/src/modular/static-helpers-metadata.ts +60 -60
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +5 -10
- package/src/modular/type-expressions/get-model-expression.ts +13 -17
- package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
- package/src/modular/type-expressions/get-type-expression.ts +8 -12
- package/src/modular/type-expressions/get-union-expression.ts +4 -4
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/rlc-common/buildClient.ts +70 -141
- package/src/rlc-common/buildClientDefinitions.ts +43 -87
- package/src/rlc-common/buildIndexFile.ts +78 -78
- package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
- package/src/rlc-common/buildLogger.ts +7 -7
- package/src/rlc-common/buildMethodShortcuts.ts +9 -21
- package/src/rlc-common/buildObjectTypes.ts +78 -155
- package/src/rlc-common/buildPaginateHelper.ts +9 -12
- package/src/rlc-common/buildParameterTypes.ts +92 -137
- package/src/rlc-common/buildPollingHelper.ts +7 -7
- package/src/rlc-common/buildResponseTypes.ts +34 -57
- package/src/rlc-common/buildSamples.ts +3 -3
- package/src/rlc-common/buildSchemaType.ts +12 -29
- package/src/rlc-common/buildSerializeHelper.ts +5 -5
- package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
- package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
- package/src/rlc-common/helpers/importsUtil.ts +27 -30
- package/src/rlc-common/helpers/nameConstructors.ts +16 -50
- package/src/rlc-common/helpers/nameUtils.ts +19 -42
- package/src/rlc-common/helpers/operationHelpers.ts +14 -31
- package/src/rlc-common/helpers/pathUtils.ts +2 -7
- package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
- package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
- package/src/rlc-common/helpers/typeUtil.ts +4 -11
- package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
- package/src/rlc-common/index.ts +28 -28
- package/src/rlc-common/interfaces.ts +3 -11
- package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
- package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
- package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
- package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
- package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
- package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
- package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
- package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
- package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
- package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
- package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
- package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
- package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
- package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
- package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
- package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
- package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
- package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
- package/src/rlc-common/test/buildRecordedClient.ts +3 -3
- package/src/rlc-common/test/buildSampleTest.ts +3 -3
- package/src/rlc-common/test/buildSnippets.ts +6 -12
- package/src/rlc-common/transformSampleGroups.ts +54 -105
- package/src/testing/index.ts +2 -5
- package/src/transform/transform.ts +22 -34
- package/src/transform/transformApiVersionInfo.ts +17 -30
- package/src/transform/transformHelperFunctionDetails.ts +14 -26
- package/src/transform/transformParameters.ts +55 -105
- package/src/transform/transformPaths.ts +26 -43
- package/src/transform/transformResponses.ts +26 -33
- package/src/transform/transformSchemas.ts +15 -33
- package/src/transform/transformTelemetryInfo.ts +8 -14
- package/src/transform/transfromRLCOptions.ts +53 -115
- package/src/utils/clientUtils.ts +22 -41
- package/src/utils/credentialUtils.ts +8 -19
- package/src/utils/crossLanguageDef.ts +15 -34
- package/src/utils/emitUtil.ts +11 -17
- package/src/utils/fileSystemUtils.ts +4 -6
- package/src/utils/importHelper.ts +5 -10
- package/src/utils/interfaces.ts +1 -1
- package/src/utils/mediaTypes.ts +13 -34
- package/src/utils/modelUtils.ts +174 -383
- package/src/utils/namespaceUtils.ts +8 -24
- package/src/utils/operationUtil.ts +98 -190
- package/src/utils/parameterUtils.ts +31 -54
- package/src/utils/resolve-project-root.ts +3 -3
- package/static/static-helpers/cloudSettingHelpers.ts +4 -6
- package/static/static-helpers/multipartHelpers.ts +3 -3
- package/static/static-helpers/pagingHelpers.ts +28 -63
- package/static/static-helpers/pollingHelpers.ts +15 -28
- package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
- package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
- package/static/static-helpers/serialization/serialize-record.ts +1 -1
- package/static/static-helpers/serialization/serializers.ts +4 -7
- package/static/static-helpers/serialization/xml-helpers.ts +41 -89
- package/static/static-helpers/simplePollerHelpers.ts +9 -18
- package/static/static-helpers/storageCompatResponse.ts +10 -27
- package/static/static-helpers/urlTemplate.ts +4 -7
- package/static/test-helpers/recordedClient.ts +5 -10
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getClientOptions, isHttpMetadata, isReadOnly, } from "@azure-tools/typespec-client-generator-core";
|
|
2
2
|
import { NoTarget } from "@typespec/compiler";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { AzurePollingDependencies } from "../external-dependencies.js";
|
|
10
|
-
import { NameType, normalizeName } from "../../rlc-common/index.js";
|
|
11
|
-
import { buildModelDeserializer, buildPropertyDeserializer } from "../serialization/buildDeserializerFunction.js";
|
|
12
|
-
import { buildModelSerializer, buildPropertySerializer } from "../serialization/buildSerializerFunction.js";
|
|
13
|
-
import { buildXmlModelSerializer, buildXmlModelDeserializer, hasXmlSerialization } from "../serialization/buildXmlSerializerFunction.js";
|
|
3
|
+
import { isHeader, isMetadata } from "@typespec/http";
|
|
4
|
+
import { StructureKind, } from "ts-morph";
|
|
5
|
+
import { useContext } from "../../contextManager.js";
|
|
6
|
+
import { useSdkTypes } from "../../framework/hooks/sdkTypes.js";
|
|
7
|
+
import { useDependencies } from "../../framework/hooks/useDependencies.js";
|
|
8
|
+
import { resolveReference } from "../../framework/reference.js";
|
|
14
9
|
import { refkey } from "../../framework/refkey.js";
|
|
15
10
|
import { reportDiagnostic } from "../../lib.js";
|
|
16
|
-
import {
|
|
17
|
-
import { useDependencies } from "../../framework/hooks/useDependencies.js";
|
|
18
|
-
import { useSdkTypes } from "../../framework/hooks/sdkTypes.js";
|
|
11
|
+
import { NameType, normalizeName } from "../../rlc-common/index.js";
|
|
19
12
|
import { isAzureCoreErrorType } from "../../utils/modelUtils.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
13
|
+
import { getCollectionFormatFromArrayEncoding, getCollectionFormatHelper, getCollectionFormatParseHelper, hasCollectionFormatInfo, hasDualFormatSupport, isBinaryPayload, isMultipartPayload, isXmlPayload, KnownCollectionFormat, } from "../../utils/operationUtil.js";
|
|
14
|
+
import { AzurePollingDependencies } from "../external-dependencies.js";
|
|
15
|
+
import { buildModelDeserializer, buildPropertyDeserializer, } from "../serialization/buildDeserializerFunction.js";
|
|
16
|
+
import { buildModelSerializer, buildPropertySerializer, } from "../serialization/buildSerializerFunction.js";
|
|
17
|
+
import { buildXmlModelDeserializer, buildXmlModelSerializer, hasXmlSerialization, } from "../serialization/buildXmlSerializerFunction.js";
|
|
18
|
+
import { getPropertyWithOverrides, isNormalUnion, isSpecialHandledUnion, } from "../serialization/serializeUtils.js";
|
|
19
|
+
import { PagingHelpers, PlatformTypeHelpers, PollingHelpers, SerializationHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers, } from "../static-helpers-metadata.js";
|
|
26
20
|
import { isExtensibleEnum } from "../type-expressions/get-enum-expression.js";
|
|
27
21
|
import { emitInlineModel } from "../type-expressions/get-model-expression.js";
|
|
22
|
+
import { getTypeExpression, normalizeModelPropertyName, } from "../type-expressions/get-type-expression.js";
|
|
23
|
+
import { getClientParameterName } from "./clientHelpers.js";
|
|
24
|
+
import { getHeaderClientOptions, getRestErrorCodeHeader } from "./clientOptionHelpers.js";
|
|
25
|
+
import { getDocsFromDescription, getFixmeForMultilineDocs } from "./docsHelpers.js";
|
|
26
|
+
import { generateLocallyUniqueName, getClassicalLayerPrefix, getOperationName, } from "./namingHelpers.js";
|
|
27
|
+
import { getNullableValidType, isSpreadBodyParameter, isTypeNullable } from "./typeHelpers.js";
|
|
28
28
|
/**
|
|
29
29
|
* Checks whether a header should be skipped during serialization/deserialization.
|
|
30
30
|
* A header is skipped when it has the "headerCollectionPrefix" client option set,
|
|
@@ -43,7 +43,7 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
|
|
|
43
43
|
isExported: true,
|
|
44
44
|
name: `_${name}Send`,
|
|
45
45
|
parameters,
|
|
46
|
-
returnType: resolveReference(dependencies.StreamableMethod)
|
|
46
|
+
returnType: resolveReference(dependencies.StreamableMethod),
|
|
47
47
|
};
|
|
48
48
|
const operationPath = operation.operation.path;
|
|
49
49
|
const operationMethod = operation.operation.verb.toLowerCase();
|
|
@@ -52,15 +52,13 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
|
|
|
52
52
|
let pathStr = `"${operationPath}"`;
|
|
53
53
|
const urlTemplateParams = [
|
|
54
54
|
...getPathParameters(operation),
|
|
55
|
-
...getQueryParameters(dpgContext, operation)
|
|
55
|
+
...getQueryParameters(dpgContext, operation),
|
|
56
56
|
];
|
|
57
57
|
if (urlTemplateParams.length > 0) {
|
|
58
58
|
// Generate a unique local variable name that doesn't conflict with parameter names
|
|
59
59
|
const paramNames = new Set(parameters.map((p) => p.name));
|
|
60
60
|
const pathVarName = generateLocallyUniqueName("path", paramNames);
|
|
61
|
-
const includeRootSlash = client
|
|
62
|
-
? getClientOptions(client, "includeRootSlash") !== false
|
|
63
|
-
: true;
|
|
61
|
+
const includeRootSlash = client ? getClientOptions(client, "includeRootSlash") !== false : true;
|
|
64
62
|
const uriTemplate = includeRootSlash
|
|
65
63
|
? operation.operation.uriTemplate
|
|
66
64
|
: operation.operation.uriTemplate.replace(/^\//, "");
|
|
@@ -74,7 +72,7 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
|
|
|
74
72
|
statements.push(`return context.path(${pathStr}).${operationMethod}({...${resolveReference(dependencies.operationOptionsToRequestParameters)}(${optionalParamName}), ${getHeaderAndBodyParameters(dpgContext, operation, optionalParamName)}});`);
|
|
75
73
|
return {
|
|
76
74
|
...functionStatement,
|
|
77
|
-
statements
|
|
75
|
+
statements,
|
|
78
76
|
};
|
|
79
77
|
}
|
|
80
78
|
export function getDeserializePrivateFunction(context, method) {
|
|
@@ -100,7 +98,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
100
98
|
// For LRO-only operations with non-model final result, wrap in a response type alias
|
|
101
99
|
returnType = {
|
|
102
100
|
name: getOperationResponseTypeName(method),
|
|
103
|
-
type: resolveReference(refkey(operation, "response"))
|
|
101
|
+
type: resolveReference(refkey(operation, "response")),
|
|
104
102
|
};
|
|
105
103
|
}
|
|
106
104
|
else {
|
|
@@ -112,14 +110,14 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
112
110
|
// instead of just the array element type
|
|
113
111
|
returnType = {
|
|
114
112
|
name: restResponse.name ?? "",
|
|
115
|
-
type: getTypeExpression(context, restResponse.type)
|
|
113
|
+
type: getTypeExpression(context, restResponse.type),
|
|
116
114
|
};
|
|
117
115
|
}
|
|
118
116
|
else if (shouldWrap) {
|
|
119
117
|
// Use the wrapper response type name (resolved via binder for cross-file imports)
|
|
120
118
|
returnType = {
|
|
121
119
|
name: getOperationResponseTypeName(method),
|
|
122
|
-
type: resolveReference(refkey(operation, "response"))
|
|
120
|
+
type: resolveReference(refkey(operation, "response")),
|
|
123
121
|
};
|
|
124
122
|
}
|
|
125
123
|
else if (response.type) {
|
|
@@ -128,7 +126,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
128
126
|
const baseType = getTypeExpression(context, response.type);
|
|
129
127
|
returnType = {
|
|
130
128
|
name: response.name ?? "",
|
|
131
|
-
type: response.optional ? `${baseType} | undefined` : baseType
|
|
129
|
+
type: response.optional ? `${baseType} | undefined` : baseType,
|
|
132
130
|
};
|
|
133
131
|
}
|
|
134
132
|
else if (isHeadAsBooleanOperation(operation)) {
|
|
@@ -144,15 +142,15 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
144
142
|
const parameters = [
|
|
145
143
|
{
|
|
146
144
|
name: resultParamName,
|
|
147
|
-
type: resultParamType
|
|
148
|
-
}
|
|
145
|
+
type: resultParamType,
|
|
146
|
+
},
|
|
149
147
|
];
|
|
150
148
|
const functionStatement = {
|
|
151
149
|
isAsync: true,
|
|
152
150
|
isExported: true,
|
|
153
151
|
name: `_${name}Deserialize`,
|
|
154
152
|
parameters,
|
|
155
|
-
returnType: `Promise<${returnType.type}
|
|
153
|
+
returnType: `Promise<${returnType.type}>`,
|
|
156
154
|
};
|
|
157
155
|
const statements = [];
|
|
158
156
|
const createRestErrorReference = resolveReference(dependencies.createRestError);
|
|
@@ -192,9 +190,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
192
190
|
const isXml = isXmlPayload(contentTypes);
|
|
193
191
|
const isDualFormat = hasDualFormatSupport(contentTypes);
|
|
194
192
|
const isMultipart = isMultipartPayload(contentTypes);
|
|
195
|
-
const useXmlDeserialization = isXml &&
|
|
196
|
-
deserializedType.kind === "model" &&
|
|
197
|
-
hasXmlSerialization(deserializedType);
|
|
193
|
+
const useXmlDeserialization = isXml && deserializedType.kind === "model" && hasXmlSerialization(deserializedType);
|
|
198
194
|
// Workaround for multipart response: cast return value as any due to lack of multipart response handling in core
|
|
199
195
|
const multipartCastSuffix = isMultipart ? " as any" : "";
|
|
200
196
|
// For dual-format responses, check content-type header at runtime
|
|
@@ -208,11 +204,11 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
208
204
|
}
|
|
209
205
|
const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
|
|
210
206
|
nameOnly: true,
|
|
211
|
-
skipDiscriminatedUnionSuffix: false
|
|
207
|
+
skipDiscriminatedUnionSuffix: false,
|
|
212
208
|
});
|
|
213
209
|
const jsonDeserializerName = buildModelDeserializer(context, deserializedType, {
|
|
214
210
|
nameOnly: true,
|
|
215
|
-
skipDiscriminatedUnionSuffix: false
|
|
211
|
+
skipDiscriminatedUnionSuffix: false,
|
|
216
212
|
});
|
|
217
213
|
if (xmlDeserializerName && jsonDeserializerName) {
|
|
218
214
|
const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
|
|
@@ -226,7 +222,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
226
222
|
// Fall back to JSON deserializer
|
|
227
223
|
const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
|
|
228
224
|
nameOnly: true,
|
|
229
|
-
skipDiscriminatedUnionSuffix: false
|
|
225
|
+
skipDiscriminatedUnionSuffix: false,
|
|
230
226
|
});
|
|
231
227
|
if (deserializeFunctionName) {
|
|
232
228
|
statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
|
|
@@ -242,7 +238,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
242
238
|
}
|
|
243
239
|
const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
|
|
244
240
|
nameOnly: true,
|
|
245
|
-
skipDiscriminatedUnionSuffix: false
|
|
241
|
+
skipDiscriminatedUnionSuffix: false,
|
|
246
242
|
});
|
|
247
243
|
if (xmlDeserializerName) {
|
|
248
244
|
statements.push(`return ${xmlDeserializerName}(${deserializedRoot})`);
|
|
@@ -251,7 +247,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
251
247
|
// Fall back to JSON deserializer if XML deserializer is not available
|
|
252
248
|
const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
|
|
253
249
|
nameOnly: true,
|
|
254
|
-
skipDiscriminatedUnionSuffix: false
|
|
250
|
+
skipDiscriminatedUnionSuffix: false,
|
|
255
251
|
});
|
|
256
252
|
if (deserializeFunctionName) {
|
|
257
253
|
statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
|
|
@@ -265,7 +261,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
265
261
|
// JSON response (default) - also handles multipart responses
|
|
266
262
|
const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
|
|
267
263
|
nameOnly: true,
|
|
268
|
-
skipDiscriminatedUnionSuffix: false
|
|
264
|
+
skipDiscriminatedUnionSuffix: false,
|
|
269
265
|
});
|
|
270
266
|
// Handle wrap-non-model-return for non-LRO, non-paging and LRO-only operations
|
|
271
267
|
if (shouldWrap) {
|
|
@@ -288,7 +284,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
288
284
|
}
|
|
289
285
|
return {
|
|
290
286
|
...functionStatement,
|
|
291
|
-
statements
|
|
287
|
+
statements,
|
|
292
288
|
};
|
|
293
289
|
}
|
|
294
290
|
if (deserializeFunctionName) {
|
|
@@ -327,7 +323,7 @@ export function getDeserializePrivateFunction(context, method) {
|
|
|
327
323
|
}
|
|
328
324
|
return {
|
|
329
325
|
...functionStatement,
|
|
330
|
-
statements
|
|
326
|
+
statements,
|
|
331
327
|
};
|
|
332
328
|
}
|
|
333
329
|
/**
|
|
@@ -340,8 +336,7 @@ export function getDeserializeHeadersPrivateFunction(context, operation) {
|
|
|
340
336
|
const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
|
|
341
337
|
const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
|
|
342
338
|
// Only generate if headers exist and a relevant feature is enabled
|
|
343
|
-
if (responseHeaders.length === 0 ||
|
|
344
|
-
(!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
|
|
339
|
+
if (responseHeaders.length === 0 || (!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
|
|
345
340
|
return undefined;
|
|
346
341
|
}
|
|
347
342
|
const { name } = getOperationName(operation);
|
|
@@ -350,8 +345,8 @@ export function getDeserializeHeadersPrivateFunction(context, operation) {
|
|
|
350
345
|
const parameters = [
|
|
351
346
|
{
|
|
352
347
|
name: "result",
|
|
353
|
-
type: PathUncheckedResponseReference
|
|
354
|
-
}
|
|
348
|
+
type: PathUncheckedResponseReference,
|
|
349
|
+
},
|
|
355
350
|
];
|
|
356
351
|
const returnType = buildHeaderOnlyResponseType(context, responseHeaders);
|
|
357
352
|
const functionStatement = {
|
|
@@ -359,13 +354,13 @@ export function getDeserializeHeadersPrivateFunction(context, operation) {
|
|
|
359
354
|
isExported: true,
|
|
360
355
|
name: `_${name}DeserializeHeaders`,
|
|
361
356
|
parameters,
|
|
362
|
-
returnType
|
|
357
|
+
returnType,
|
|
363
358
|
};
|
|
364
359
|
const statements = [];
|
|
365
360
|
statements.push(`return ${buildHeaderOnlyResponseValue(context, responseHeaders)};`);
|
|
366
361
|
return {
|
|
367
362
|
...functionStatement,
|
|
368
|
-
statements
|
|
363
|
+
statements,
|
|
369
364
|
};
|
|
370
365
|
}
|
|
371
366
|
function getExceptionDetails(context, operation) {
|
|
@@ -380,10 +375,9 @@ function getExceptionDetails(context, operation) {
|
|
|
380
375
|
const statusCode = exception.statusCodes;
|
|
381
376
|
const deserializeFunctionName = buildModelDeserializer(context, exception.type, {
|
|
382
377
|
nameOnly: true,
|
|
383
|
-
skipDiscriminatedUnionSuffix: false
|
|
378
|
+
skipDiscriminatedUnionSuffix: false,
|
|
384
379
|
});
|
|
385
|
-
if (!deserializeFunctionName ||
|
|
386
|
-
typeof deserializeFunctionName !== "string") {
|
|
380
|
+
if (!deserializeFunctionName || typeof deserializeFunctionName !== "string") {
|
|
387
381
|
continue;
|
|
388
382
|
}
|
|
389
383
|
// Check if the exception type has XML serialization support
|
|
@@ -396,16 +390,14 @@ function getExceptionDetails(context, operation) {
|
|
|
396
390
|
if (exception.type.kind === "model" && (typeHasXml || exceptionIsXml)) {
|
|
397
391
|
const xmlName = buildXmlModelDeserializer(context, exception.type, {
|
|
398
392
|
nameOnly: true,
|
|
399
|
-
skipDiscriminatedUnionSuffix: false
|
|
393
|
+
skipDiscriminatedUnionSuffix: false,
|
|
400
394
|
});
|
|
401
395
|
if (typeof xmlName === "string") {
|
|
402
396
|
xmlDeserializerName = xmlName;
|
|
403
397
|
}
|
|
404
398
|
}
|
|
405
399
|
// XML-only when all content types are XML (no JSON support)
|
|
406
|
-
const isXmlOnly = xmlDeserializerName !== undefined &&
|
|
407
|
-
exceptionIsXml &&
|
|
408
|
-
!exceptionIsDualFormat;
|
|
400
|
+
const isXmlOnly = xmlDeserializerName !== undefined && exceptionIsXml && !exceptionIsDualFormat;
|
|
409
401
|
if (statusCode === "*") {
|
|
410
402
|
defaultDeserializer = deserializeFunctionName;
|
|
411
403
|
defaultXmlDeserializer = xmlDeserializerName;
|
|
@@ -416,7 +408,7 @@ function getExceptionDetails(context, operation) {
|
|
|
416
408
|
start: statusCode,
|
|
417
409
|
deserializer: deserializeFunctionName,
|
|
418
410
|
xmlDeserializer: xmlDeserializerName,
|
|
419
|
-
isXmlOnly
|
|
411
|
+
isXmlOnly,
|
|
420
412
|
});
|
|
421
413
|
}
|
|
422
414
|
else {
|
|
@@ -425,7 +417,7 @@ function getExceptionDetails(context, operation) {
|
|
|
425
417
|
end: statusCode.end,
|
|
426
418
|
deserializer: deserializeFunctionName,
|
|
427
419
|
xmlDeserializer: xmlDeserializerName,
|
|
428
|
-
isXmlOnly
|
|
420
|
+
isXmlOnly,
|
|
429
421
|
});
|
|
430
422
|
}
|
|
431
423
|
}
|
|
@@ -433,7 +425,7 @@ function getExceptionDetails(context, operation) {
|
|
|
433
425
|
customized,
|
|
434
426
|
defaultDeserializer,
|
|
435
427
|
defaultXmlDeserializer,
|
|
436
|
-
defaultIsXmlOnly
|
|
428
|
+
defaultIsXmlOnly,
|
|
437
429
|
};
|
|
438
430
|
}
|
|
439
431
|
/**
|
|
@@ -472,8 +464,8 @@ export function getDeserializeExceptionHeadersPrivateFunction(context, operation
|
|
|
472
464
|
const parameters = [
|
|
473
465
|
{
|
|
474
466
|
name: "result",
|
|
475
|
-
type: PathUncheckedResponseReference
|
|
476
|
-
}
|
|
467
|
+
type: PathUncheckedResponseReference,
|
|
468
|
+
},
|
|
477
469
|
];
|
|
478
470
|
const returnType = buildHeaderOnlyResponseType(context, exceptionHeaders);
|
|
479
471
|
const functionStatement = {
|
|
@@ -481,13 +473,13 @@ export function getDeserializeExceptionHeadersPrivateFunction(context, operation
|
|
|
481
473
|
isExported: true,
|
|
482
474
|
name: `_${name}DeserializeExceptionHeaders`,
|
|
483
475
|
parameters,
|
|
484
|
-
returnType
|
|
476
|
+
returnType,
|
|
485
477
|
};
|
|
486
478
|
const statements = [];
|
|
487
479
|
statements.push(`return ${buildHeaderOnlyResponseValue(context, exceptionHeaders)};`);
|
|
488
480
|
return {
|
|
489
481
|
...functionStatement,
|
|
490
|
-
statements
|
|
482
|
+
statements,
|
|
491
483
|
};
|
|
492
484
|
}
|
|
493
485
|
function getExceptionDeserializeExpr(exception) {
|
|
@@ -515,11 +507,7 @@ function getExceptionThrowStatement(context, operation) {
|
|
|
515
507
|
const clientOptionHeadersCall = buildClientOptionHeadersCall(operation.operation.exceptions);
|
|
516
508
|
// Build @clientOption("restErrorCodeHeader", ...) code to set error.code from a header
|
|
517
509
|
const restErrorCodeAssignment = buildRestErrorCodeAssignment(operation.operation.exceptions);
|
|
518
|
-
const allHeaderCalls = [
|
|
519
|
-
exceptionHeadersCall,
|
|
520
|
-
clientOptionHeadersCall,
|
|
521
|
-
restErrorCodeAssignment
|
|
522
|
-
]
|
|
510
|
+
const allHeaderCalls = [exceptionHeadersCall, clientOptionHeadersCall, restErrorCodeAssignment]
|
|
523
511
|
.filter(Boolean)
|
|
524
512
|
.join("\n");
|
|
525
513
|
// Check if any exception has XML deserialization support that requires runtime content-type check
|
|
@@ -635,7 +623,8 @@ if (restErrorCodeValue !== undefined) { error.code = restErrorCodeValue; }`;
|
|
|
635
623
|
return undefined;
|
|
636
624
|
}
|
|
637
625
|
function getOptionalParamsName(parameters) {
|
|
638
|
-
return (parameters.filter((p) => p.type?.toString().endsWith("operationOptions__"))[0]?.name ??
|
|
626
|
+
return (parameters.filter((p) => p.type?.toString().endsWith("operationOptions__"))[0]?.name ??
|
|
627
|
+
"options");
|
|
639
628
|
}
|
|
640
629
|
function getOperationSignatureParameters(context, method, clientType) {
|
|
641
630
|
const operation = method[1];
|
|
@@ -650,14 +639,12 @@ function getOperationSignatureParameters(context, method, clientType) {
|
|
|
650
639
|
param.methodParameterSegments[0]?.[0] === p);
|
|
651
640
|
})[0]?.kind !== "cookie" &&
|
|
652
641
|
!p.optional &&
|
|
653
|
-
!(p.isGeneratedName &&
|
|
654
|
-
|
|
655
|
-
getClientOptions(p, "headerCollectionPrefix") === undefined // skip headers with collection prefix
|
|
656
|
-
)
|
|
642
|
+
!(p.isGeneratedName && (p.name === "contentType" || p.name === "accept")) && // skip tcgc generated contentType and accept header parameter
|
|
643
|
+
getClientOptions(p, "headerCollectionPrefix") === undefined)
|
|
657
644
|
.map((p) => {
|
|
658
645
|
return {
|
|
659
646
|
name: p.name,
|
|
660
|
-
type: getTypeExpression(context, p.type)
|
|
647
|
+
type: getTypeExpression(context, p.type),
|
|
661
648
|
};
|
|
662
649
|
})
|
|
663
650
|
.forEach((p) => {
|
|
@@ -669,7 +656,7 @@ function getOperationSignatureParameters(context, method, clientType) {
|
|
|
669
656
|
const optionsParam = {
|
|
670
657
|
name: parameters.has("options") ? "optionalParams" : "options",
|
|
671
658
|
type: optionsType,
|
|
672
|
-
initializer: "{ requestOptions: {} }"
|
|
659
|
+
initializer: "{ requestOptions: {} }",
|
|
673
660
|
};
|
|
674
661
|
const finalParameters = [contextParam, ...parameters.values(), optionsParam];
|
|
675
662
|
return finalParameters;
|
|
@@ -713,30 +700,26 @@ export function getOperationFunction(context, method, clientType) {
|
|
|
713
700
|
// Use the wrapper response type name (resolved via binder for cross-file imports)
|
|
714
701
|
returnType = {
|
|
715
702
|
name: getOperationResponseTypeName(method),
|
|
716
|
-
type: resolveReference(refkey(operation, "response"))
|
|
703
|
+
type: resolveReference(refkey(operation, "response")),
|
|
717
704
|
};
|
|
718
705
|
bodyType = returnType.type;
|
|
719
706
|
}
|
|
720
707
|
else if (response.type) {
|
|
721
708
|
const type = response.type;
|
|
722
709
|
// If feature flag enabled, we'll append the response headers to the operation response type.
|
|
723
|
-
if (type.kind === "model" &&
|
|
724
|
-
responseHeaders.length > 0 &&
|
|
725
|
-
isResponseHeadersEnabled) {
|
|
710
|
+
if (type.kind === "model" && responseHeaders.length > 0 && isResponseHeadersEnabled) {
|
|
726
711
|
// Build a composite type that includes both model and additional header properties
|
|
727
712
|
const baseCompositeType = buildCompositeResponseType(context, type, responseHeaders);
|
|
728
713
|
returnType = {
|
|
729
714
|
name: type.name ?? "",
|
|
730
|
-
type: response.optional
|
|
731
|
-
? `${baseCompositeType} | undefined`
|
|
732
|
-
: baseCompositeType
|
|
715
|
+
type: response.optional ? `${baseCompositeType} | undefined` : baseCompositeType,
|
|
733
716
|
};
|
|
734
717
|
}
|
|
735
718
|
else {
|
|
736
719
|
const baseType = getTypeExpression(context, type);
|
|
737
720
|
returnType = {
|
|
738
721
|
name: type.name ?? "",
|
|
739
|
-
type: response.optional ? `${baseType} | undefined` : baseType
|
|
722
|
+
type: response.optional ? `${baseType} | undefined` : baseType,
|
|
740
723
|
};
|
|
741
724
|
}
|
|
742
725
|
}
|
|
@@ -744,7 +727,7 @@ export function getOperationFunction(context, method, clientType) {
|
|
|
744
727
|
// Here we handle returning headers when the operation return type is void
|
|
745
728
|
returnType = {
|
|
746
729
|
name: "",
|
|
747
|
-
type: `${buildHeaderOnlyResponseType(context, responseHeaders)}
|
|
730
|
+
type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`,
|
|
748
731
|
};
|
|
749
732
|
}
|
|
750
733
|
else if (isHeadAsBooleanOperation(operation)) {
|
|
@@ -782,16 +765,13 @@ export function getOperationFunction(context, method, clientType) {
|
|
|
782
765
|
const { name, fixme = [] } = getOperationName(operation, context);
|
|
783
766
|
const functionStatement = {
|
|
784
767
|
kind: StructureKind.Function,
|
|
785
|
-
docs: [
|
|
786
|
-
...getDocsFromDescription(operation.doc),
|
|
787
|
-
...getFixmeForMultilineDocs(fixme)
|
|
788
|
-
],
|
|
768
|
+
docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
|
|
789
769
|
isAsync: true,
|
|
790
770
|
isExported: true,
|
|
791
771
|
name,
|
|
792
772
|
propertyName: normalizeName(operation.name, NameType.Property),
|
|
793
773
|
parameters,
|
|
794
|
-
returnType: `Promise<${finalReturnType}
|
|
774
|
+
returnType: `Promise<${finalReturnType}>`,
|
|
795
775
|
};
|
|
796
776
|
const statements = [];
|
|
797
777
|
// Generate unique local variable names that don't conflict with parameter names
|
|
@@ -864,7 +844,7 @@ export function getOperationFunction(context, method, clientType) {
|
|
|
864
844
|
}
|
|
865
845
|
return {
|
|
866
846
|
...functionStatement,
|
|
867
|
-
statements
|
|
847
|
+
statements,
|
|
868
848
|
};
|
|
869
849
|
}
|
|
870
850
|
function getLroOnlyOperationFunction(context, method, clientType, optionalParamName = "options") {
|
|
@@ -886,10 +866,7 @@ function getLroOnlyOperationFunction(context, method, clientType, optionalParamN
|
|
|
886
866
|
: returnType.type;
|
|
887
867
|
const functionStatement = {
|
|
888
868
|
kind: StructureKind.Function,
|
|
889
|
-
docs: [
|
|
890
|
-
...getDocsFromDescription(operation.doc),
|
|
891
|
-
...getFixmeForMultilineDocs(fixme)
|
|
892
|
-
],
|
|
869
|
+
docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
|
|
893
870
|
isAsync: false,
|
|
894
871
|
isExported: true,
|
|
895
872
|
name,
|
|
@@ -897,20 +874,17 @@ function getLroOnlyOperationFunction(context, method, clientType, optionalParamN
|
|
|
897
874
|
isLro: true,
|
|
898
875
|
lroFinalReturnType: effectiveReturnTypeName,
|
|
899
876
|
parameters,
|
|
900
|
-
returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}
|
|
877
|
+
returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>`,
|
|
901
878
|
};
|
|
902
879
|
const getLongRunningPollerReference = resolveReference(PollingHelpers.GetLongRunningPoller);
|
|
903
|
-
const lroMetadata = operation.kind === "lro" || operation.kind === "lropaging"
|
|
904
|
-
? operation.lroMetadata
|
|
905
|
-
: undefined;
|
|
880
|
+
const lroMetadata = operation.kind === "lro" || operation.kind === "lropaging" ? operation.lroMetadata : undefined;
|
|
906
881
|
const allowedFinalLocation = [
|
|
907
882
|
"azure-async-operation",
|
|
908
883
|
"location",
|
|
909
884
|
"original-uri",
|
|
910
|
-
"operation-location"
|
|
885
|
+
"operation-location",
|
|
911
886
|
];
|
|
912
|
-
const resourceLocationConfig = lroMetadata?.finalStateVia &&
|
|
913
|
-
allowedFinalLocation.includes(lroMetadata?.finalStateVia)
|
|
887
|
+
const resourceLocationConfig = lroMetadata?.finalStateVia && allowedFinalLocation.includes(lroMetadata?.finalStateVia)
|
|
914
888
|
? `resourceLocationConfig: "${lroMetadata?.finalStateVia}",`
|
|
915
889
|
: "";
|
|
916
890
|
const apiVersion = getApiVersionExpression(context, operation);
|
|
@@ -920,16 +894,14 @@ function getLroOnlyOperationFunction(context, method, clientType, optionalParamN
|
|
|
920
894
|
return ${getLongRunningPollerReference}(context, _${name}Deserialize, ${getExpectedStatuses(operation)}, {
|
|
921
895
|
updateIntervalInMs: ${optionalParamName}?.updateIntervalInMs,
|
|
922
896
|
abortSignal: ${optionalParamName}?.abortSignal,
|
|
923
|
-
getInitialResponse: () => _${name}Send(${parameters
|
|
924
|
-
.map((p) => p.name)
|
|
925
|
-
.join(", ")}),
|
|
897
|
+
getInitialResponse: () => _${name}Send(${parameters.map((p) => p.name).join(", ")}),
|
|
926
898
|
${resourceLocationConfig}
|
|
927
899
|
${apiVersion ? `apiVersion: ${apiVersion}` : ""}
|
|
928
900
|
}) as ${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>;
|
|
929
901
|
`);
|
|
930
902
|
return {
|
|
931
903
|
...functionStatement,
|
|
932
|
-
statements
|
|
904
|
+
statements,
|
|
933
905
|
};
|
|
934
906
|
}
|
|
935
907
|
function getLroAndPagingOperationFunction(context, method, clientType, optionalParamName = "options") {
|
|
@@ -947,14 +919,14 @@ function getLroAndPagingOperationFunction(context, method, clientType, optionalP
|
|
|
947
919
|
`nextLinkName: "${operation.pagingMetadata.nextLinkSegments.map((p) => p.name).join(".")}"`,
|
|
948
920
|
operation.pagingMetadata.nextLinkVerb !== "GET" &&
|
|
949
921
|
`nextLinkMethod: "${operation.pagingMetadata.nextLinkVerb}"`,
|
|
950
|
-
apiVersion && `apiVersion: ${apiVersion}
|
|
922
|
+
apiVersion && `apiVersion: ${apiVersion}`,
|
|
951
923
|
].filter(Boolean);
|
|
952
924
|
// Build LRO resource location config
|
|
953
925
|
const allowedLocations = [
|
|
954
926
|
"azure-async-operation",
|
|
955
927
|
"location",
|
|
956
928
|
"original-uri",
|
|
957
|
-
"operation-location"
|
|
929
|
+
"operation-location",
|
|
958
930
|
];
|
|
959
931
|
const resourceLocationConfig = operation.lroMetadata?.finalStateVia &&
|
|
960
932
|
allowedLocations.includes(operation.lroMetadata.finalStateVia)
|
|
@@ -967,17 +939,14 @@ function getLroAndPagingOperationFunction(context, method, clientType, optionalP
|
|
|
967
939
|
getLroPoller: resolveReference(PollingHelpers.GetLongRunningPoller),
|
|
968
940
|
pollerLike: resolveReference(AzurePollingDependencies.PollerLike),
|
|
969
941
|
operationState: resolveReference(AzurePollingDependencies.OperationState),
|
|
970
|
-
pathResponse: resolveReference(useDependencies().PathUncheckedResponse)
|
|
942
|
+
pathResponse: resolveReference(useDependencies().PathUncheckedResponse),
|
|
971
943
|
};
|
|
972
944
|
const expectedStatuses = getExpectedStatuses(operation);
|
|
973
945
|
const paramList = parameters.map((p) => p.name).join(", ");
|
|
974
946
|
const pagingOptionsStr = pagingOptions.length > 0 ? `,\n {${pagingOptions.join(", ")}}` : "";
|
|
975
947
|
return {
|
|
976
948
|
kind: StructureKind.Function,
|
|
977
|
-
docs: [
|
|
978
|
-
...getDocsFromDescription(operation.doc),
|
|
979
|
-
...getFixmeForMultilineDocs(fixme)
|
|
980
|
-
],
|
|
949
|
+
docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
|
|
981
950
|
isAsync: false,
|
|
982
951
|
isExported: true,
|
|
983
952
|
isLroPaging: true,
|
|
@@ -1004,8 +973,8 @@ function getLroAndPagingOperationFunction(context, method, clientType, optionalP
|
|
|
1004
973
|
_${name}Deserialize,
|
|
1005
974
|
${expectedStatuses}${pagingOptionsStr}
|
|
1006
975
|
);
|
|
1007
|
-
|
|
1008
|
-
]
|
|
976
|
+
`,
|
|
977
|
+
],
|
|
1009
978
|
};
|
|
1010
979
|
}
|
|
1011
980
|
function buildLroReturnType(context, operation) {
|
|
@@ -1014,7 +983,7 @@ function buildLroReturnType(context, operation) {
|
|
|
1014
983
|
const type = metadata.finalResponse.result;
|
|
1015
984
|
return {
|
|
1016
985
|
name: type.name,
|
|
1017
|
-
type: getTypeExpression(context, type)
|
|
986
|
+
type: getTypeExpression(context, type),
|
|
1018
987
|
};
|
|
1019
988
|
}
|
|
1020
989
|
return { name: "", type: "void" };
|
|
@@ -1023,7 +992,7 @@ function buildLroPagingReturnType(context, operation) {
|
|
|
1023
992
|
if (operation.response.type?.kind === "array") {
|
|
1024
993
|
return {
|
|
1025
994
|
name: operation.response.type.valueType.name ?? "",
|
|
1026
|
-
type: getTypeExpression(context, operation.response.type.valueType)
|
|
995
|
+
type: getTypeExpression(context, operation.response.type.valueType),
|
|
1027
996
|
};
|
|
1028
997
|
}
|
|
1029
998
|
return { name: "", type: "void" };
|
|
@@ -1039,7 +1008,7 @@ function getPagingOnlyOperationFunction(context, method, clientType) {
|
|
|
1039
1008
|
const type = response.type;
|
|
1040
1009
|
returnType = {
|
|
1041
1010
|
name: type.valueType.name ?? "",
|
|
1042
|
-
type: getTypeExpression(context, type.valueType)
|
|
1011
|
+
type: getTypeExpression(context, type.valueType),
|
|
1043
1012
|
};
|
|
1044
1013
|
}
|
|
1045
1014
|
const { name, fixme = [] } = getOperationName(operation, context);
|
|
@@ -1047,16 +1016,13 @@ function getPagingOnlyOperationFunction(context, method, clientType) {
|
|
|
1047
1016
|
const buildPagedAsyncIteratorReference = resolveReference(PagingHelpers.BuildPagedAsyncIterator);
|
|
1048
1017
|
const functionStatement = {
|
|
1049
1018
|
kind: StructureKind.Function,
|
|
1050
|
-
docs: [
|
|
1051
|
-
...getDocsFromDescription(operation.doc),
|
|
1052
|
-
...getFixmeForMultilineDocs(fixme)
|
|
1053
|
-
],
|
|
1019
|
+
docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
|
|
1054
1020
|
isAsync: false,
|
|
1055
1021
|
isExported: true,
|
|
1056
1022
|
name,
|
|
1057
1023
|
propertyName: normalizeName(operation.name, NameType.Property),
|
|
1058
1024
|
parameters,
|
|
1059
|
-
returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}
|
|
1025
|
+
returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}>`,
|
|
1060
1026
|
};
|
|
1061
1027
|
const statements = [];
|
|
1062
1028
|
const options = [];
|
|
@@ -1096,7 +1062,7 @@ function getPagingOnlyOperationFunction(context, method, clientType) {
|
|
|
1096
1062
|
);`);
|
|
1097
1063
|
return {
|
|
1098
1064
|
...functionStatement,
|
|
1099
|
-
statements
|
|
1065
|
+
statements,
|
|
1100
1066
|
};
|
|
1101
1067
|
}
|
|
1102
1068
|
export function getOperationOptionsName(method, includeGroupName = false) {
|
|
@@ -1121,7 +1087,7 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
|
|
|
1121
1087
|
const contentTypeParameter = operation.operation.parameters.find(isContentType);
|
|
1122
1088
|
const parametersImplementation = {
|
|
1123
1089
|
header: [],
|
|
1124
|
-
body: []
|
|
1090
|
+
body: [],
|
|
1125
1091
|
};
|
|
1126
1092
|
for (const param of operationParameters) {
|
|
1127
1093
|
if (param.kind === "header") {
|
|
@@ -1136,13 +1102,12 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
|
|
|
1136
1102
|
continue;
|
|
1137
1103
|
}
|
|
1138
1104
|
// Check if this parameter still exists in the corresponding method params (after override)
|
|
1139
|
-
if (param.methodParameterSegments &&
|
|
1140
|
-
param.methodParameterSegments.length > 0) {
|
|
1105
|
+
if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
|
|
1141
1106
|
const paramAccessor = getParamAccessor(param, optionalParamName);
|
|
1142
1107
|
parametersImplementation[param.kind].push({
|
|
1143
1108
|
paramMap: getParameterMap(dpgContext, param, paramAccessor),
|
|
1144
1109
|
param,
|
|
1145
|
-
paramAccessor
|
|
1110
|
+
paramAccessor,
|
|
1146
1111
|
});
|
|
1147
1112
|
}
|
|
1148
1113
|
}
|
|
@@ -1156,8 +1121,7 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
|
|
|
1156
1121
|
.map((i) => buildHeaderParameter(dpgContext.program, i.paramMap, i.param, i.paramAccessor))
|
|
1157
1122
|
.join(",\n")}, ...${optionalParamName}.requestOptions?.headers },`;
|
|
1158
1123
|
}
|
|
1159
|
-
if (operation.operation.bodyParam === undefined &&
|
|
1160
|
-
parametersImplementation.body.length) {
|
|
1124
|
+
if (operation.operation.bodyParam === undefined && parametersImplementation.body.length) {
|
|
1161
1125
|
paramStr = `${paramStr}\nbody: {${parametersImplementation.body
|
|
1162
1126
|
.map((i) => i.paramMap)
|
|
1163
1127
|
.join(",\n")}}`;
|
|
@@ -1173,7 +1137,7 @@ function buildHeaderParameter(program, paramMap, param, paramAccessor) {
|
|
|
1173
1137
|
if (!effectiveOptional && isTypeNullable(param.type) === true) {
|
|
1174
1138
|
reportDiagnostic(program, {
|
|
1175
1139
|
code: "nullable-required-header",
|
|
1176
|
-
target: NoTarget
|
|
1140
|
+
target: NoTarget,
|
|
1177
1141
|
});
|
|
1178
1142
|
return paramMap;
|
|
1179
1143
|
}
|
|
@@ -1188,9 +1152,7 @@ function buildHeaderParameter(program, paramMap, param, paramAccessor) {
|
|
|
1188
1152
|
if (isTypeNullable(param.type) === true) {
|
|
1189
1153
|
conditions.push(`${paramAccessor} !== null`);
|
|
1190
1154
|
}
|
|
1191
|
-
return conditions.length > 0
|
|
1192
|
-
? `...(${conditions.join(" && ")} ? {${paramMap}} : {})`
|
|
1193
|
-
: paramMap;
|
|
1155
|
+
return conditions.length > 0 ? `...(${conditions.join(" && ")} ? {${paramMap}} : {})` : paramMap;
|
|
1194
1156
|
}
|
|
1195
1157
|
function buildBodyParameter(context, bodyParameter, optionalParamName = "options") {
|
|
1196
1158
|
if (!bodyParameter || !bodyParameter.type) {
|
|
@@ -1207,14 +1169,14 @@ function buildBodyParameter(context, bodyParameter, optionalParamName = "options
|
|
|
1207
1169
|
// Use XML serializer
|
|
1208
1170
|
serializerFunctionName = buildXmlModelSerializer(context, bodyType, {
|
|
1209
1171
|
nameOnly: true,
|
|
1210
|
-
skipDiscriminatedUnionSuffix: false
|
|
1172
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1211
1173
|
});
|
|
1212
1174
|
}
|
|
1213
1175
|
else {
|
|
1214
1176
|
// Use JSON serializer (default)
|
|
1215
1177
|
serializerFunctionName = buildModelSerializer(context, bodyType, {
|
|
1216
1178
|
nameOnly: true,
|
|
1217
|
-
skipDiscriminatedUnionSuffix: false
|
|
1179
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1218
1180
|
});
|
|
1219
1181
|
}
|
|
1220
1182
|
let bodyNameExpression = getParamAccessor(bodyParameter, optionalParamName);
|
|
@@ -1236,16 +1198,14 @@ function buildBodyParameter(context, bodyParameter, optionalParamName = "options
|
|
|
1236
1198
|
? `!${bodyNameExpression}? ${bodyNameExpression}:`
|
|
1237
1199
|
: "";
|
|
1238
1200
|
// For dual-format operations, check the contentType option at runtime
|
|
1239
|
-
if (isDualFormat &&
|
|
1240
|
-
bodyType.kind === "model" &&
|
|
1241
|
-
hasXmlSerialization(bodyType)) {
|
|
1201
|
+
if (isDualFormat && bodyType.kind === "model" && hasXmlSerialization(bodyType)) {
|
|
1242
1202
|
const xmlSerializerName = buildXmlModelSerializer(context, bodyType, {
|
|
1243
1203
|
nameOnly: true,
|
|
1244
|
-
skipDiscriminatedUnionSuffix: false
|
|
1204
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1245
1205
|
});
|
|
1246
1206
|
const jsonSerializerName = buildModelSerializer(context, bodyType, {
|
|
1247
1207
|
nameOnly: true,
|
|
1248
|
-
skipDiscriminatedUnionSuffix: false
|
|
1208
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1249
1209
|
});
|
|
1250
1210
|
if (xmlSerializerName && jsonSerializerName) {
|
|
1251
1211
|
const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
|
|
@@ -1276,9 +1236,7 @@ function getEncodingFormat(type) {
|
|
|
1276
1236
|
*/
|
|
1277
1237
|
export function getParameterMap(context, param, paramAccessor) {
|
|
1278
1238
|
// Use lowercase for header names since HTTP headers are case-insensitive
|
|
1279
|
-
const serializedName = param.kind === "header"
|
|
1280
|
-
? getHeaderSerializedName(param)
|
|
1281
|
-
: getPropertySerializedName(param);
|
|
1239
|
+
const serializedName = param.kind === "header" ? getHeaderSerializedName(param) : getPropertySerializedName(param);
|
|
1282
1240
|
if (isConstant(param.type) && !isOptional(param)) {
|
|
1283
1241
|
return `"${serializedName}": ${getConstantValue(param.type)}`;
|
|
1284
1242
|
}
|
|
@@ -1304,9 +1262,9 @@ export function getParameterMap(context, param, paramAccessor) {
|
|
|
1304
1262
|
code: "unsupported-parameter-type",
|
|
1305
1263
|
format: {
|
|
1306
1264
|
paramName: param.name,
|
|
1307
|
-
paramKind: param.kind
|
|
1265
|
+
paramKind: param.kind,
|
|
1308
1266
|
},
|
|
1309
|
-
target: param.__raw || NoTarget
|
|
1267
|
+
target: param.__raw || NoTarget,
|
|
1310
1268
|
});
|
|
1311
1269
|
// Return a fallback value to allow the emitter to continue
|
|
1312
1270
|
return `"${param.name}": undefined`;
|
|
@@ -1316,8 +1274,7 @@ function getCollectionFormatForParam(context, param, paramAccessor, serializedNa
|
|
|
1316
1274
|
return `"${serializedName}": ${serializeRequestValue(context, param.type, paramAccessor, !param.optional, format, serializedName, true)}`;
|
|
1317
1275
|
}
|
|
1318
1276
|
function isContentType(param) {
|
|
1319
|
-
return
|
|
1320
|
-
param.serializedName.toLowerCase() === "content-type");
|
|
1277
|
+
return param.kind === "header" && param.serializedName.toLowerCase() === "content-type";
|
|
1321
1278
|
}
|
|
1322
1279
|
function getContentTypeValue(param, optionalParamName = "options") {
|
|
1323
1280
|
const defaultValue = param.clientDefaultValue;
|
|
@@ -1437,22 +1394,21 @@ function getQueryParameters(dpgContext, operation) {
|
|
|
1437
1394
|
}
|
|
1438
1395
|
const operationParameters = operation.operation.parameters.filter((p) => !isContentType(p));
|
|
1439
1396
|
const parametersImplementation = {
|
|
1440
|
-
query: []
|
|
1397
|
+
query: [],
|
|
1441
1398
|
};
|
|
1442
1399
|
for (const param of operationParameters) {
|
|
1443
1400
|
if (param.kind === "query") {
|
|
1444
1401
|
// Check if this parameter still exists in the corresponding method params (after override)
|
|
1445
|
-
if (param.methodParameterSegments &&
|
|
1446
|
-
param.methodParameterSegments.length > 0) {
|
|
1402
|
+
if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
|
|
1447
1403
|
const paramAccessor = getParamAccessor(param);
|
|
1448
1404
|
parametersImplementation[param.kind].push({
|
|
1449
1405
|
paramMap: getParameterMap(dpgContext, {
|
|
1450
1406
|
...param,
|
|
1451
1407
|
// TODO: remember to remove this hack once compiler gives us a name
|
|
1452
1408
|
// https://github.com/microsoft/typespec/issues/6743
|
|
1453
|
-
serializedName: getUriTemplateQueryParamName(param.serializedName)
|
|
1409
|
+
serializedName: getUriTemplateQueryParamName(param.serializedName),
|
|
1454
1410
|
}, paramAccessor),
|
|
1455
|
-
param
|
|
1411
|
+
param,
|
|
1456
1412
|
});
|
|
1457
1413
|
}
|
|
1458
1414
|
}
|
|
@@ -1482,9 +1438,7 @@ function getParamAccessor(param, optionalParamName = "options") {
|
|
|
1482
1438
|
const methodParamExpr = getMethodParamExpr(param, optionalParamName);
|
|
1483
1439
|
const clientPrefix = "context.";
|
|
1484
1440
|
if (methodParamExpr) {
|
|
1485
|
-
return param.onClient
|
|
1486
|
-
? `${clientPrefix}${methodParamExpr}`
|
|
1487
|
-
: methodParamExpr;
|
|
1441
|
+
return param.onClient ? `${clientPrefix}${methodParamExpr}` : methodParamExpr;
|
|
1488
1442
|
}
|
|
1489
1443
|
if (param.onClient) {
|
|
1490
1444
|
return `${clientPrefix}${getClientParameterName(param)}`;
|
|
@@ -1563,15 +1517,14 @@ function getEncodeForModelProperty(context, property) {
|
|
|
1563
1517
|
code: "un-supported-array-encoding",
|
|
1564
1518
|
format: {
|
|
1565
1519
|
arrayName: property.name,
|
|
1566
|
-
arrayType: property.type.valueType.kind
|
|
1520
|
+
arrayType: property.type.valueType.kind,
|
|
1567
1521
|
},
|
|
1568
|
-
target: NoTarget
|
|
1522
|
+
target: NoTarget,
|
|
1569
1523
|
});
|
|
1570
1524
|
return getEncodeForType(property.type);
|
|
1571
1525
|
}
|
|
1572
1526
|
const collectionFormat = getCollectionFormatFromArrayEncoding(property.encode);
|
|
1573
|
-
if (collectionFormat &&
|
|
1574
|
-
hasCollectionFormatInfo(property.kind, collectionFormat)) {
|
|
1527
|
+
if (collectionFormat && hasCollectionFormatInfo(property.kind, collectionFormat)) {
|
|
1575
1528
|
return collectionFormat;
|
|
1576
1529
|
}
|
|
1577
1530
|
}
|
|
@@ -1587,8 +1540,7 @@ function isStringEncodableArrayValueType(valueType) {
|
|
|
1587
1540
|
return true;
|
|
1588
1541
|
}
|
|
1589
1542
|
// String-based enum type
|
|
1590
|
-
if (valueType.kind === "enum" &&
|
|
1591
|
-
valueType.valueType.kind === "string") {
|
|
1543
|
+
if (valueType.kind === "enum" && valueType.valueType.kind === "string") {
|
|
1592
1544
|
return true;
|
|
1593
1545
|
}
|
|
1594
1546
|
return false;
|
|
@@ -1596,14 +1548,12 @@ function isStringEncodableArrayValueType(valueType) {
|
|
|
1596
1548
|
function getSerializationExpressionForFlatten(context, property, propertyPath) {
|
|
1597
1549
|
const serializeFunctionName = buildPropertySerializer(context, property, {
|
|
1598
1550
|
nameOnly: true,
|
|
1599
|
-
skipDiscriminatedUnionSuffix: false
|
|
1551
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1600
1552
|
});
|
|
1601
1553
|
if (!serializeFunctionName) {
|
|
1602
1554
|
return property.optional ? `undefined` : `{}`;
|
|
1603
1555
|
}
|
|
1604
|
-
const validProps = getAllProperties(context, property.type, getAllAncestors(property.type)).filter((p) => p.kind === "property" &&
|
|
1605
|
-
!isReadOnly(p) &&
|
|
1606
|
-
!isMetadata(context.program, p.__raw));
|
|
1556
|
+
const validProps = getAllProperties(context, property.type, getAllAncestors(property.type)).filter((p) => p.kind === "property" && !isReadOnly(p) && !isMetadata(context.program, p.__raw));
|
|
1607
1557
|
const optionalPrefix = property.optional
|
|
1608
1558
|
? `${resolveReference(SerializationHelpers.areAllPropsUndefined)}(${propertyPath}, [${validProps
|
|
1609
1559
|
.map((p) => `"${p.name}"`)
|
|
@@ -1621,7 +1571,7 @@ export function getSerializationExpression(context, property, propertyPath, enab
|
|
|
1621
1571
|
const propertyFullName = getPropertyFullName(context, property, propertyPathWithDot);
|
|
1622
1572
|
const serializeFunctionName = buildModelSerializer(context, getNullableValidType(property.type), {
|
|
1623
1573
|
nameOnly: true,
|
|
1624
|
-
skipDiscriminatedUnionSuffix: false
|
|
1574
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1625
1575
|
});
|
|
1626
1576
|
// Apply clientDefaultValue for model properties that have one
|
|
1627
1577
|
const defaultValueSuffix = hasEffectiveClientDefaultValue(property)
|
|
@@ -1655,7 +1605,7 @@ export function getRequestModelProperties(context, modelPropertyType, propertyPa
|
|
|
1655
1605
|
const property = getPropertyWithOverrides(prop, overrides);
|
|
1656
1606
|
props.push([
|
|
1657
1607
|
getPropertySerializedName(property),
|
|
1658
|
-
getSerializationExpression(context, property, propertyPath, enableFlatten)
|
|
1608
|
+
getSerializationExpression(context, property, propertyPath, enableFlatten),
|
|
1659
1609
|
]);
|
|
1660
1610
|
}
|
|
1661
1611
|
return props;
|
|
@@ -1696,19 +1646,17 @@ export function getResponseMapping(context, type, propertyPath = "result.body",
|
|
|
1696
1646
|
const dot = propertyPath.endsWith("?") ? "." : "";
|
|
1697
1647
|
const serializedName = getPropertySerializedName(property);
|
|
1698
1648
|
const restValue = `${propertyPath ? `${propertyPath}${dot}` : `${dot}`}["${serializedName}"]`;
|
|
1699
|
-
const nullOrUndefinedPrefix = property.optional || isTypeNullable(property.type)
|
|
1700
|
-
? `!${restValue}? ${restValue}: `
|
|
1701
|
-
: "";
|
|
1649
|
+
const nullOrUndefinedPrefix = property.optional || isTypeNullable(property.type) ? `!${restValue}? ${restValue}: ` : "";
|
|
1702
1650
|
const flattenContext = useContext("sdkTypes").flattenProperties.get(property);
|
|
1703
1651
|
const isSupportedFlatten = flattenContext && enableFlatten;
|
|
1704
1652
|
const deserializeFunctionName = isSupportedFlatten
|
|
1705
1653
|
? buildPropertyDeserializer(context, property, {
|
|
1706
1654
|
nameOnly: true,
|
|
1707
|
-
skipDiscriminatedUnionSuffix: false
|
|
1655
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1708
1656
|
})
|
|
1709
1657
|
: buildModelDeserializer(context, getNullableValidType(property.type), {
|
|
1710
1658
|
nameOnly: true,
|
|
1711
|
-
skipDiscriminatedUnionSuffix: false
|
|
1659
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1712
1660
|
});
|
|
1713
1661
|
const propertyName = normalizeModelPropertyName(context, property);
|
|
1714
1662
|
if (deserializeFunctionName) {
|
|
@@ -1755,12 +1703,10 @@ export function serializeRequestValue(context, type, clientValue, required, form
|
|
|
1755
1703
|
case "array": {
|
|
1756
1704
|
if (type.valueType) {
|
|
1757
1705
|
const prefix = nullOrUndefinedPrefix + clientValue;
|
|
1758
|
-
const elementNullOrUndefinedPrefix = isTypeNullable(type.valueType) || getOptionalForType(type.valueType)
|
|
1759
|
-
? "!p ? p : "
|
|
1760
|
-
: "";
|
|
1706
|
+
const elementNullOrUndefinedPrefix = isTypeNullable(type.valueType) || getOptionalForType(type.valueType) ? "!p ? p : " : "";
|
|
1761
1707
|
const serializeFunctionName = buildModelSerializer(context, getNullableValidType(type.valueType), {
|
|
1762
1708
|
nameOnly: true,
|
|
1763
|
-
skipDiscriminatedUnionSuffix: false
|
|
1709
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1764
1710
|
});
|
|
1765
1711
|
if (serializeFunctionName) {
|
|
1766
1712
|
return `${prefix}.map((p: any) => { return ${elementNullOrUndefinedPrefix}${serializeFunctionName}(p)})`;
|
|
@@ -1799,7 +1745,7 @@ export function serializeRequestValue(context, type, clientValue, required, form
|
|
|
1799
1745
|
}
|
|
1800
1746
|
else if (isSpecialHandledUnion({
|
|
1801
1747
|
...type,
|
|
1802
|
-
isNonExhaustive: context.rlcOptions?.experimentalExtensibleEnums ?? false
|
|
1748
|
+
isNonExhaustive: context.rlcOptions?.experimentalExtensibleEnums ?? false,
|
|
1803
1749
|
})) {
|
|
1804
1750
|
const sdkType = getSdkType(type.__raw);
|
|
1805
1751
|
const serializerRefkey = refkey(sdkType, "serializer");
|
|
@@ -1863,7 +1809,7 @@ export function deserializeResponseHeadersValue(context, type, restValue, requir
|
|
|
1863
1809
|
const deserializeFunctionName = type
|
|
1864
1810
|
? buildModelDeserializer(context, getNullableValidType(type), {
|
|
1865
1811
|
nameOnly: true,
|
|
1866
|
-
skipDiscriminatedUnionSuffix: false
|
|
1812
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1867
1813
|
})
|
|
1868
1814
|
: undefined;
|
|
1869
1815
|
if (deserializeFunctionName) {
|
|
@@ -1910,14 +1856,13 @@ export function deserializeResponseValue(context, type, restValue, required, for
|
|
|
1910
1856
|
const deserializeFunctionName = type.valueType
|
|
1911
1857
|
? buildModelDeserializer(context, getNullableValidType(type.valueType), {
|
|
1912
1858
|
nameOnly: true,
|
|
1913
|
-
skipDiscriminatedUnionSuffix: false
|
|
1859
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1914
1860
|
})
|
|
1915
1861
|
: undefined;
|
|
1916
1862
|
if (deserializeFunctionName) {
|
|
1917
1863
|
return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${varName})})`;
|
|
1918
1864
|
}
|
|
1919
|
-
else if (type.valueType &&
|
|
1920
|
-
isAzureCoreErrorType(context.program, type.valueType.__raw)) {
|
|
1865
|
+
else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
|
|
1921
1866
|
return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${varName}})`;
|
|
1922
1867
|
}
|
|
1923
1868
|
else if (type.valueType) {
|
|
@@ -1928,8 +1873,7 @@ export function deserializeResponseValue(context, type, restValue, required, for
|
|
|
1928
1873
|
const optionalPrefixForString = isTypeNullable(type) || getOptionalForType(type) || !required
|
|
1929
1874
|
? `${restValue} === null || ${restValue} === undefined ? ${restValue}: `
|
|
1930
1875
|
: "";
|
|
1931
|
-
if (type.valueType.kind === "enum" &&
|
|
1932
|
-
!isExtensibleEnum(context, type.valueType)) {
|
|
1876
|
+
if (type.valueType.kind === "enum" && !isExtensibleEnum(context, type.valueType)) {
|
|
1933
1877
|
// Special handling for non-extensible enums to cast the result to the correct type
|
|
1934
1878
|
return `${optionalPrefixForString}${parseHelper}(${restValue}) as ${getTypeExpression(context, type)}`;
|
|
1935
1879
|
}
|
|
@@ -1955,14 +1899,13 @@ export function deserializeResponseValue(context, type, restValue, required, for
|
|
|
1955
1899
|
const deserializeFunctionName = type.valueType
|
|
1956
1900
|
? buildModelDeserializer(context, getNullableValidType(type.valueType), {
|
|
1957
1901
|
nameOnly: true,
|
|
1958
|
-
skipDiscriminatedUnionSuffix: false
|
|
1902
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1959
1903
|
})
|
|
1960
1904
|
: undefined;
|
|
1961
1905
|
if (deserializeFunctionName) {
|
|
1962
1906
|
return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${valueVar})]))`;
|
|
1963
1907
|
}
|
|
1964
|
-
else if (type.valueType &&
|
|
1965
|
-
isAzureCoreErrorType(context.program, type.valueType.__raw)) {
|
|
1908
|
+
else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
|
|
1966
1909
|
return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${valueVar}]))`;
|
|
1967
1910
|
}
|
|
1968
1911
|
else if (type.valueType) {
|
|
@@ -1987,7 +1930,7 @@ export function deserializeResponseValue(context, type, restValue, required, for
|
|
|
1987
1930
|
const deserializeFunctionName = type
|
|
1988
1931
|
? buildModelDeserializer(context, getNullableValidType(type), {
|
|
1989
1932
|
nameOnly: true,
|
|
1990
|
-
skipDiscriminatedUnionSuffix: false
|
|
1933
|
+
skipDiscriminatedUnionSuffix: false,
|
|
1991
1934
|
})
|
|
1992
1935
|
: undefined;
|
|
1993
1936
|
if (deserializeFunctionName) {
|
|
@@ -2102,9 +2045,7 @@ export function getPropertySerializationPrefix(context, property, propertyPath)
|
|
|
2102
2045
|
export function getPropertyFullName(context, property, propertyPath) {
|
|
2103
2046
|
const normalizedPropertyName = propertyPath === ""
|
|
2104
2047
|
? normalizeName(property.name, NameType.Parameter, true)
|
|
2105
|
-
: normalizeModelPropertyName(context, property)
|
|
2106
|
-
.replace(/^"/g, "")
|
|
2107
|
-
.replace(/"$/g, "");
|
|
2048
|
+
: normalizeModelPropertyName(context, property).replace(/^"/g, "").replace(/"$/g, "");
|
|
2108
2049
|
let fullName = normalizedPropertyName;
|
|
2109
2050
|
if (propertyPath === "" && property.optional) {
|
|
2110
2051
|
fullName = `options?.${normalizedPropertyName}`;
|
|
@@ -2325,7 +2266,7 @@ export function checkWrapNonModelReturn(context, operation) {
|
|
|
2325
2266
|
}
|
|
2326
2267
|
return {
|
|
2327
2268
|
shouldWrap: isWrappableType(context, lroResultType),
|
|
2328
|
-
isBinary: false
|
|
2269
|
+
isBinary: false,
|
|
2329
2270
|
};
|
|
2330
2271
|
}
|
|
2331
2272
|
const { type } = operation.response;
|
|
@@ -2339,8 +2280,7 @@ export function checkWrapNonModelReturn(context, operation) {
|
|
|
2339
2280
|
const contentTypes = operation.operation.responses[0]?.contentTypes ?? [];
|
|
2340
2281
|
// bytes with binary content type → binary wrap (isBinary=true)
|
|
2341
2282
|
// HLC: bytes → binary payload → separate binary handling
|
|
2342
|
-
if (type.__raw &&
|
|
2343
|
-
isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))) {
|
|
2283
|
+
if (type.__raw && isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))) {
|
|
2344
2284
|
return { shouldWrap: true, isBinary: true };
|
|
2345
2285
|
}
|
|
2346
2286
|
return { shouldWrap: isWrappableType(context, type), isBinary: false };
|
|
@@ -2382,7 +2322,7 @@ export function buildNonModelResponseTypeDeclaration(context, method, isBinary)
|
|
|
2382
2322
|
name: typeName,
|
|
2383
2323
|
type: typeBody,
|
|
2384
2324
|
isExported: true,
|
|
2385
|
-
leadingTrivia: "\n"
|
|
2325
|
+
leadingTrivia: "\n",
|
|
2386
2326
|
};
|
|
2387
2327
|
}
|
|
2388
2328
|
//# sourceMappingURL=operationHelpers.js.map
|