@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
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
SdkHttpParameter,
|
|
3
3
|
SdkModelPropertyType,
|
|
4
4
|
SdkServiceResponseHeader,
|
|
5
|
-
SdkType
|
|
5
|
+
SdkType,
|
|
6
6
|
} from "@azure-tools/typespec-client-generator-core";
|
|
7
|
+
import { NameType, normalizeName } from "../../rlc-common/index.js";
|
|
8
|
+
import { SdkContext } from "../../utils/interfaces.js";
|
|
7
9
|
import { getCredentialExpression } from "./get-credential-expression.js";
|
|
8
10
|
import { getEnumExpression } from "./get-enum-expression.js";
|
|
9
11
|
import { getModelExpression } from "./get-model-expression.js";
|
|
10
|
-
import { getUnionExpression } from "./get-union-expression.js";
|
|
11
|
-
import { NameType, normalizeName } from "../../rlc-common/index.js";
|
|
12
|
-
import { SdkContext } from "../../utils/interfaces.js";
|
|
13
12
|
import { getNullableExpression } from "./get-nullable-expression.js";
|
|
13
|
+
import { getUnionExpression } from "./get-union-expression.js";
|
|
14
14
|
|
|
15
15
|
export interface EmitTypeOptions {
|
|
16
16
|
emitInline?: boolean;
|
|
@@ -19,7 +19,7 @@ export interface EmitTypeOptions {
|
|
|
19
19
|
|
|
20
20
|
export function normalizeModelPropertyName(
|
|
21
21
|
context: SdkContext,
|
|
22
|
-
property: SdkModelPropertyType | SdkHttpParameter | SdkServiceResponseHeader
|
|
22
|
+
property: SdkModelPropertyType | SdkHttpParameter | SdkServiceResponseHeader,
|
|
23
23
|
): string {
|
|
24
24
|
const normalizedPropName = normalizeName(property.name, NameType.Property);
|
|
25
25
|
return context.rlcOptions?.ignorePropertyNameNormalize
|
|
@@ -30,7 +30,7 @@ export function normalizeModelPropertyName(
|
|
|
30
30
|
export function getTypeExpression(
|
|
31
31
|
context: SdkContext,
|
|
32
32
|
type: SdkType,
|
|
33
|
-
options?: EmitTypeOptions
|
|
33
|
+
options?: EmitTypeOptions,
|
|
34
34
|
): string {
|
|
35
35
|
switch (type.kind) {
|
|
36
36
|
case "array": {
|
|
@@ -40,9 +40,7 @@ export function getTypeExpression(
|
|
|
40
40
|
case "enum":
|
|
41
41
|
return getEnumExpression(context, type);
|
|
42
42
|
case "unknown":
|
|
43
|
-
return context.rlcOptions?.treatUnknownAsRecord
|
|
44
|
-
? "Record<string, unknown>"
|
|
45
|
-
: "any";
|
|
43
|
+
return context.rlcOptions?.treatUnknownAsRecord ? "Record<string, unknown>" : "any";
|
|
46
44
|
case "boolean":
|
|
47
45
|
return "boolean";
|
|
48
46
|
case "decimal":
|
|
@@ -98,9 +96,7 @@ export function getTypeExpression(
|
|
|
98
96
|
case "offsetDateTime":
|
|
99
97
|
return "string";
|
|
100
98
|
case "tuple": {
|
|
101
|
-
const types = type.valueTypes
|
|
102
|
-
.map((v) => getTypeExpression(context, v, options))
|
|
103
|
-
.join(", ");
|
|
99
|
+
const types = type.valueTypes.map((v) => getTypeExpression(context, v, options)).join(", ");
|
|
104
100
|
return `[${types}]`;
|
|
105
101
|
}
|
|
106
102
|
case "union":
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { SdkUnionType } from "@azure-tools/typespec-client-generator-core";
|
|
2
2
|
import { resolveReference } from "../../framework/reference.js";
|
|
3
|
-
import { getTypeExpression, EmitTypeOptions } from "./get-type-expression.js";
|
|
4
|
-
import { shouldEmitInline } from "./utils.js";
|
|
5
3
|
import { SdkContext } from "../../utils/interfaces.js";
|
|
4
|
+
import { EmitTypeOptions, getTypeExpression } from "./get-type-expression.js";
|
|
5
|
+
import { shouldEmitInline } from "./utils.js";
|
|
6
6
|
|
|
7
7
|
export function getUnionExpression(
|
|
8
8
|
context: SdkContext,
|
|
9
9
|
type: SdkUnionType,
|
|
10
|
-
options: EmitTypeOptions = {}
|
|
10
|
+
options: EmitTypeOptions = {},
|
|
11
11
|
): string {
|
|
12
12
|
if (shouldEmitInline(type, options)) {
|
|
13
13
|
const variantTypes = new Set(
|
|
14
|
-
type.variantTypes.map((v) => `${getTypeExpression(context, v, options)}`)
|
|
14
|
+
type.variantTypes.map((v) => `${getTypeExpression(context, v, options)}`),
|
|
15
15
|
);
|
|
16
16
|
return `(${[...variantTypes].join(" | ")})`;
|
|
17
17
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import * as path from "path";
|
|
4
5
|
import {
|
|
5
6
|
InterfaceDeclarationStructure,
|
|
6
7
|
OptionalKind,
|
|
@@ -9,28 +10,21 @@ import {
|
|
|
9
10
|
StructureKind,
|
|
10
11
|
VariableDeclarationKind,
|
|
11
12
|
VariableStatementStructure,
|
|
12
|
-
WriterFunction
|
|
13
|
+
WriterFunction,
|
|
13
14
|
} from "ts-morph";
|
|
14
|
-
import * as path from "path";
|
|
15
|
-
import { NameType, normalizeName } from "./helpers/nameUtils.js";
|
|
16
15
|
import { buildMethodShortcutImplementation } from "./buildMethodShortcuts.js";
|
|
17
|
-
import { RLCModel, File, PathParameter } from "./interfaces.js";
|
|
18
|
-
import {
|
|
19
|
-
getClientName,
|
|
20
|
-
getImportModuleName
|
|
21
|
-
} from "./helpers/nameConstructors.js";
|
|
22
16
|
import { getImportSpecifier } from "./helpers/importsUtil.js";
|
|
17
|
+
import { getClientName, getImportModuleName } from "./helpers/nameConstructors.js";
|
|
18
|
+
import { NameType, normalizeName } from "./helpers/nameUtils.js";
|
|
23
19
|
import { isAzurePackage } from "./helpers/packageUtil.js";
|
|
20
|
+
import { File, PathParameter, RLCModel } from "./interfaces.js";
|
|
24
21
|
|
|
25
22
|
function getClientOptionsInterface(
|
|
26
23
|
model: RLCModel,
|
|
27
24
|
clientName: string,
|
|
28
|
-
optionalUrlParameters?: PathParameter[]
|
|
25
|
+
optionalUrlParameters?: PathParameter[],
|
|
29
26
|
): OptionalKind<InterfaceDeclarationStructure> | undefined {
|
|
30
|
-
if (
|
|
31
|
-
(!optionalUrlParameters || optionalUrlParameters.length === 0) &&
|
|
32
|
-
!model.apiVersionInfo
|
|
33
|
-
) {
|
|
27
|
+
if ((!optionalUrlParameters || optionalUrlParameters.length === 0) && !model.apiVersionInfo) {
|
|
34
28
|
return undefined;
|
|
35
29
|
}
|
|
36
30
|
|
|
@@ -40,9 +34,7 @@ function getClientOptionsInterface(
|
|
|
40
34
|
name: param.name,
|
|
41
35
|
type: param.type,
|
|
42
36
|
hasQuestionToken: true,
|
|
43
|
-
docs: [
|
|
44
|
-
param.description ?? "client level optional parameter " + param.name
|
|
45
|
-
]
|
|
37
|
+
docs: [param.description ?? "client level optional parameter " + param.name],
|
|
46
38
|
};
|
|
47
39
|
}) ?? [];
|
|
48
40
|
|
|
@@ -55,7 +47,7 @@ function getClientOptionsInterface(
|
|
|
55
47
|
name: "apiVersion",
|
|
56
48
|
type: "string",
|
|
57
49
|
hasQuestionToken: true,
|
|
58
|
-
docs: ["The api version option of the client"]
|
|
50
|
+
docs: ["The api version option of the client"],
|
|
59
51
|
});
|
|
60
52
|
}
|
|
61
53
|
return {
|
|
@@ -63,7 +55,7 @@ function getClientOptionsInterface(
|
|
|
63
55
|
extends: ["ClientOptions"],
|
|
64
56
|
isExported: true,
|
|
65
57
|
properties,
|
|
66
|
-
docs: ["The optional parameters for the client"]
|
|
58
|
+
docs: ["The optional parameters for the client"],
|
|
67
59
|
};
|
|
68
60
|
}
|
|
69
61
|
|
|
@@ -73,7 +65,7 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
73
65
|
const project = new Project();
|
|
74
66
|
const filePath = path.join(srcPath, `${name}.ts`);
|
|
75
67
|
const clientFile = project.createSourceFile(filePath, undefined, {
|
|
76
|
-
overwrite: true
|
|
68
|
+
overwrite: true,
|
|
77
69
|
});
|
|
78
70
|
|
|
79
71
|
// Get all paths
|
|
@@ -82,18 +74,18 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
82
74
|
normalizeUrlInfo(model);
|
|
83
75
|
const urlParameters = model?.urlInfo?.urlParameters?.filter(
|
|
84
76
|
// Do not include parameters with constant values in the signature, these should go in the options bag
|
|
85
|
-
(p) => p.value === undefined
|
|
77
|
+
(p) => p.value === undefined,
|
|
86
78
|
);
|
|
87
79
|
|
|
88
80
|
const optionalUrlParameters = model?.urlInfo?.urlParameters?.filter(
|
|
89
81
|
// Do not include parameters with constant values in the signature, these should go in the options bag
|
|
90
|
-
(p) => Boolean(p.value)
|
|
82
|
+
(p) => Boolean(p.value),
|
|
91
83
|
);
|
|
92
84
|
|
|
93
85
|
const clientOptionsInterface = getClientOptionsInterface(
|
|
94
86
|
model,
|
|
95
87
|
clientInterfaceName,
|
|
96
|
-
optionalUrlParameters
|
|
88
|
+
optionalUrlParameters,
|
|
97
89
|
);
|
|
98
90
|
|
|
99
91
|
if (clientOptionsInterface) {
|
|
@@ -109,7 +101,7 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
109
101
|
credentialScopes,
|
|
110
102
|
credentialKeyHeaderName,
|
|
111
103
|
customHttpAuthHeaderName,
|
|
112
|
-
customHttpAuthSharedKeyPrefix
|
|
104
|
+
customHttpAuthSharedKeyPrefix,
|
|
113
105
|
} = model.options;
|
|
114
106
|
const credentialTypes = credentialScopes ? ["TokenCredential"] : [];
|
|
115
107
|
|
|
@@ -120,33 +112,23 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
120
112
|
const commonClientParams = [
|
|
121
113
|
...(urlParameters ?? []),
|
|
122
114
|
...(addCredentials === false ||
|
|
123
|
-
!isSecurityInfoDefined(
|
|
124
|
-
credentialScopes,
|
|
125
|
-
credentialKeyHeaderName,
|
|
126
|
-
customHttpAuthHeaderName
|
|
127
|
-
)
|
|
115
|
+
!isSecurityInfoDefined(credentialScopes, credentialKeyHeaderName, customHttpAuthHeaderName)
|
|
128
116
|
? []
|
|
129
117
|
: [
|
|
130
118
|
{
|
|
131
119
|
name: "credentials",
|
|
132
120
|
type: credentialTypes.join(" | "),
|
|
133
|
-
description: `uniquely identify client credential
|
|
134
|
-
}
|
|
135
|
-
])
|
|
121
|
+
description: `uniquely identify client credential`,
|
|
122
|
+
},
|
|
123
|
+
]),
|
|
136
124
|
];
|
|
137
125
|
|
|
138
126
|
let apiVersionStatement: string = "";
|
|
139
127
|
// Set the default api-version when we have a default AND its position is query
|
|
140
|
-
if (
|
|
141
|
-
model.apiVersionInfo?.isCrossedVersion === false &&
|
|
142
|
-
!!model.apiVersionInfo?.defaultValue
|
|
143
|
-
) {
|
|
128
|
+
if (model.apiVersionInfo?.isCrossedVersion === false && !!model.apiVersionInfo?.defaultValue) {
|
|
144
129
|
apiVersionStatement = `
|
|
145
130
|
apiVersion = "${model.apiVersionInfo?.defaultValue}"`;
|
|
146
|
-
} else if (
|
|
147
|
-
model.apiVersionInfo?.isCrossedVersion === false &&
|
|
148
|
-
!model.apiVersionInfo.required
|
|
149
|
-
) {
|
|
131
|
+
} else if (model.apiVersionInfo?.isCrossedVersion === false && !model.apiVersionInfo.required) {
|
|
150
132
|
apiVersionStatement = `
|
|
151
133
|
apiVersion`;
|
|
152
134
|
}
|
|
@@ -154,14 +136,11 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
154
136
|
const allClientParams = [
|
|
155
137
|
...commonClientParams,
|
|
156
138
|
{
|
|
157
|
-
name:
|
|
158
|
-
apiVersionStatement === ""
|
|
159
|
-
? "options"
|
|
160
|
-
: `{${apiVersionStatement}, ...options}`,
|
|
139
|
+
name: apiVersionStatement === "" ? "options" : `{${apiVersionStatement}, ...options}`,
|
|
161
140
|
documentName: "options",
|
|
162
141
|
type: `${clientOptionsInterface?.name ?? "ClientOptions"} = {}`,
|
|
163
|
-
description: "the parameter for all optional parameters"
|
|
164
|
-
}
|
|
142
|
+
description: "the parameter for all optional parameters",
|
|
143
|
+
},
|
|
165
144
|
];
|
|
166
145
|
const functionStatement = {
|
|
167
146
|
isExported: true,
|
|
@@ -177,14 +156,14 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
177
156
|
param.description ?? "The parameter " + param.name
|
|
178
157
|
}`;
|
|
179
158
|
})
|
|
180
|
-
.join("\n")
|
|
181
|
-
}
|
|
159
|
+
.join("\n"),
|
|
160
|
+
},
|
|
182
161
|
],
|
|
183
162
|
returnType: clientInterfaceName,
|
|
184
163
|
isDefaultExport: false,
|
|
185
164
|
statements: getClientFactoryBody(model, clientInterfaceName, {
|
|
186
|
-
isMultipleCredential: credentialTypes.length > 1
|
|
187
|
-
})
|
|
165
|
+
isMultipleCredential: credentialTypes.length > 1,
|
|
166
|
+
}),
|
|
188
167
|
};
|
|
189
168
|
|
|
190
169
|
if (!multiClient || !batch || batch.length === 1) {
|
|
@@ -197,31 +176,21 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
197
176
|
paths.pop();
|
|
198
177
|
}
|
|
199
178
|
const parentPath =
|
|
200
|
-
paths.lastIndexOf("src") > -1
|
|
201
|
-
? paths.length - 1 - paths.lastIndexOf("src")
|
|
202
|
-
: 0;
|
|
179
|
+
paths.lastIndexOf("src") > -1 ? paths.length - 1 - paths.lastIndexOf("src") : 0;
|
|
203
180
|
|
|
204
|
-
const loggerPath = `${
|
|
205
|
-
parentPath > 0 ? "../".repeat(parentPath) : "./"
|
|
206
|
-
}logger`;
|
|
181
|
+
const loggerPath = `${parentPath > 0 ? "../".repeat(parentPath) : "./"}logger`;
|
|
207
182
|
clientFile.addImportDeclarations([
|
|
208
183
|
{
|
|
209
184
|
isTypeOnly: true,
|
|
210
185
|
namedImports: ["ClientOptions"],
|
|
211
|
-
moduleSpecifier: getImportSpecifier(
|
|
212
|
-
|
|
213
|
-
model.importInfo.runtimeImports
|
|
214
|
-
)
|
|
215
|
-
}
|
|
186
|
+
moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
|
|
187
|
+
},
|
|
216
188
|
]);
|
|
217
189
|
clientFile.addImportDeclarations([
|
|
218
190
|
{
|
|
219
191
|
namedImports: ["getClient"],
|
|
220
|
-
moduleSpecifier: getImportSpecifier(
|
|
221
|
-
|
|
222
|
-
model.importInfo.runtimeImports
|
|
223
|
-
)
|
|
224
|
-
}
|
|
192
|
+
moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
|
|
193
|
+
},
|
|
225
194
|
]);
|
|
226
195
|
if (isAzurePackage(model)) {
|
|
227
196
|
clientFile.addImportDeclarations([
|
|
@@ -230,11 +199,11 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
230
199
|
moduleSpecifier: getImportModuleName(
|
|
231
200
|
{
|
|
232
201
|
cjsName: loggerPath,
|
|
233
|
-
esModulesName: `${loggerPath}.js
|
|
202
|
+
esModulesName: `${loggerPath}.js`,
|
|
234
203
|
},
|
|
235
|
-
model
|
|
236
|
-
)
|
|
237
|
-
}
|
|
204
|
+
model,
|
|
205
|
+
),
|
|
206
|
+
},
|
|
238
207
|
]);
|
|
239
208
|
}
|
|
240
209
|
|
|
@@ -245,31 +214,21 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
245
214
|
credentialTypes.includes("KeyCredential");
|
|
246
215
|
if (
|
|
247
216
|
addCredentials &&
|
|
248
|
-
isSecurityInfoDefined(
|
|
249
|
-
credentialScopes,
|
|
250
|
-
credentialKeyHeaderName,
|
|
251
|
-
customHttpAuthHeaderName
|
|
252
|
-
)
|
|
217
|
+
isSecurityInfoDefined(credentialScopes, credentialKeyHeaderName, customHttpAuthHeaderName)
|
|
253
218
|
) {
|
|
254
219
|
clientFile.addImportDeclarations([
|
|
255
220
|
{
|
|
256
221
|
isTypeOnly: true,
|
|
257
222
|
namedImports: credentialTypes,
|
|
258
|
-
moduleSpecifier: getImportSpecifier(
|
|
259
|
-
|
|
260
|
-
model.importInfo.runtimeImports
|
|
261
|
-
)
|
|
262
|
-
}
|
|
223
|
+
moduleSpecifier: getImportSpecifier("coreAuth", model.importInfo.runtimeImports),
|
|
224
|
+
},
|
|
263
225
|
]);
|
|
264
226
|
if (includeKeyCredentialHelper) {
|
|
265
227
|
clientFile.addImportDeclarations([
|
|
266
228
|
{
|
|
267
229
|
namedImports: ["isKeyCredential"],
|
|
268
|
-
moduleSpecifier: getImportSpecifier(
|
|
269
|
-
|
|
270
|
-
model.importInfo.runtimeImports
|
|
271
|
-
)
|
|
272
|
-
}
|
|
230
|
+
moduleSpecifier: getImportSpecifier("coreAuth", model.importInfo.runtimeImports),
|
|
231
|
+
},
|
|
273
232
|
]);
|
|
274
233
|
}
|
|
275
234
|
}
|
|
@@ -280,30 +239,25 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
280
239
|
moduleSpecifier: getImportModuleName(
|
|
281
240
|
{
|
|
282
241
|
cjsName: "./clientDefinitions",
|
|
283
|
-
esModulesName: "./clientDefinitions.js"
|
|
242
|
+
esModulesName: "./clientDefinitions.js",
|
|
284
243
|
},
|
|
285
|
-
model
|
|
286
|
-
)
|
|
287
|
-
}
|
|
244
|
+
model,
|
|
245
|
+
),
|
|
246
|
+
},
|
|
288
247
|
]);
|
|
289
|
-
if (
|
|
290
|
-
(model.importInfo.internalImports?.rlcClientFactory?.importsSet?.size ??
|
|
291
|
-
0) > 0
|
|
292
|
-
) {
|
|
248
|
+
if ((model.importInfo.internalImports?.rlcClientFactory?.importsSet?.size ?? 0) > 0) {
|
|
293
249
|
clientFile.addImportDeclarations([
|
|
294
250
|
{
|
|
295
251
|
isTypeOnly: true,
|
|
296
|
-
namedImports: Array.from(
|
|
297
|
-
model.importInfo.internalImports.rlcClientFactory.importsSet!
|
|
298
|
-
),
|
|
252
|
+
namedImports: Array.from(model.importInfo.internalImports.rlcClientFactory.importsSet!),
|
|
299
253
|
moduleSpecifier: getImportModuleName(
|
|
300
254
|
{
|
|
301
255
|
cjsName: `./models`,
|
|
302
|
-
esModulesName: `./models.js
|
|
256
|
+
esModulesName: `./models.js`,
|
|
303
257
|
},
|
|
304
|
-
model
|
|
305
|
-
)
|
|
306
|
-
}
|
|
258
|
+
model,
|
|
259
|
+
),
|
|
260
|
+
},
|
|
307
261
|
]);
|
|
308
262
|
}
|
|
309
263
|
return { path: filePath, content: clientFile.getFullText() };
|
|
@@ -312,11 +266,9 @@ export function buildClient(model: RLCModel): File | undefined {
|
|
|
312
266
|
function isSecurityInfoDefined(
|
|
313
267
|
credentialScopes?: string[],
|
|
314
268
|
credentialKeyHeaderName?: string,
|
|
315
|
-
customHttpAuthHeaderName?: string
|
|
269
|
+
customHttpAuthHeaderName?: string,
|
|
316
270
|
) {
|
|
317
|
-
return
|
|
318
|
-
credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName
|
|
319
|
-
);
|
|
271
|
+
return credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName;
|
|
320
272
|
}
|
|
321
273
|
|
|
322
274
|
interface GetClientFactoryOptions {
|
|
@@ -326,14 +278,13 @@ interface GetClientFactoryOptions {
|
|
|
326
278
|
export function getClientFactoryBody(
|
|
327
279
|
model: RLCModel,
|
|
328
280
|
clientTypeName: string,
|
|
329
|
-
options: GetClientFactoryOptions = { isMultipleCredential: false }
|
|
281
|
+
options: GetClientFactoryOptions = { isMultipleCredential: false },
|
|
330
282
|
): string | WriterFunction | (string | WriterFunction | StatementStructures)[] {
|
|
331
283
|
if (!model.options || !model.options.packageDetails || !model.urlInfo) {
|
|
332
284
|
return "";
|
|
333
285
|
}
|
|
334
286
|
const { includeShortcuts, packageDetails, addCredentials } = model.options;
|
|
335
|
-
let clientPackageName =
|
|
336
|
-
packageDetails!.nameWithoutScope ?? packageDetails?.name ?? "";
|
|
287
|
+
let clientPackageName = packageDetails!.nameWithoutScope ?? packageDetails?.name ?? "";
|
|
337
288
|
const packageVersion = packageDetails.version;
|
|
338
289
|
const { endpoint, urlParameters } = model.urlInfo;
|
|
339
290
|
|
|
@@ -344,11 +295,8 @@ export function getClientFactoryBody(
|
|
|
344
295
|
continue;
|
|
345
296
|
}
|
|
346
297
|
if (param.value) {
|
|
347
|
-
const value =
|
|
348
|
-
|
|
349
|
-
optionalUrlParameters.push(
|
|
350
|
-
`const ${param.name} = options.${param.name} ?? ${value};`
|
|
351
|
-
);
|
|
298
|
+
const value = typeof param.value === "string" ? `"${param.value}"` : param.value;
|
|
299
|
+
optionalUrlParameters.push(`const ${param.name} = options.${param.name} ?? ${value};`);
|
|
352
300
|
}
|
|
353
301
|
}
|
|
354
302
|
|
|
@@ -356,10 +304,7 @@ export function getClientFactoryBody(
|
|
|
356
304
|
if (urlParameters && endpoint) {
|
|
357
305
|
let parsedEndpoint = endpoint;
|
|
358
306
|
urlParameters.forEach((urlParameter) => {
|
|
359
|
-
parsedEndpoint = parsedEndpoint.replace(
|
|
360
|
-
`{${urlParameter.name}}`,
|
|
361
|
-
`\${${urlParameter.name}}`
|
|
362
|
-
);
|
|
307
|
+
parsedEndpoint = parsedEndpoint.replace(`{${urlParameter.name}}`, `\${${urlParameter.name}}`);
|
|
363
308
|
});
|
|
364
309
|
endpointUrl = `options.endpoint ?? \`${parsedEndpoint}\``;
|
|
365
310
|
} else {
|
|
@@ -371,17 +316,13 @@ export function getClientFactoryBody(
|
|
|
371
316
|
}
|
|
372
317
|
|
|
373
318
|
const userAgentInfoStatement =
|
|
374
|
-
"const userAgentInfo = `azsdk-js-" +
|
|
375
|
-
clientPackageName +
|
|
376
|
-
"/" +
|
|
377
|
-
packageVersion +
|
|
378
|
-
"`;";
|
|
319
|
+
"const userAgentInfo = `azsdk-js-" + clientPackageName + "/" + packageVersion + "`;";
|
|
379
320
|
const userAgentPrefix =
|
|
380
321
|
"options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`: `${userAgentInfo}`;";
|
|
381
322
|
const userAgentStatement: VariableStatementStructure = {
|
|
382
323
|
kind: StructureKind.VariableStatement,
|
|
383
324
|
declarationKind: VariableDeclarationKind.Const,
|
|
384
|
-
declarations: [{ name: "userAgentPrefix", initializer: userAgentPrefix }]
|
|
325
|
+
declarations: [{ name: "userAgentPrefix", initializer: userAgentPrefix }],
|
|
385
326
|
};
|
|
386
327
|
|
|
387
328
|
const customHeaderOptions = model.telemetryOptions?.customRequestIdHeaderName
|
|
@@ -396,17 +337,14 @@ export function getClientFactoryBody(
|
|
|
396
337
|
const endpointUrlStatement: VariableStatementStructure = {
|
|
397
338
|
kind: StructureKind.VariableStatement,
|
|
398
339
|
declarationKind: VariableDeclarationKind.Const,
|
|
399
|
-
declarations: [{ name: "endpointUrl", initializer: endpointUrl }]
|
|
340
|
+
declarations: [{ name: "endpointUrl", initializer: endpointUrl }],
|
|
400
341
|
};
|
|
401
342
|
|
|
402
343
|
const { credentialScopes, credentialKeyHeaderName } = model.options;
|
|
403
344
|
const scopesString = credentialScopes
|
|
404
|
-
? credentialScopes.map((cs) => `"${cs}"`).join(", ") ||
|
|
405
|
-
"`${endpointUrl}/.default`"
|
|
406
|
-
: "";
|
|
407
|
-
const scopes = scopesString
|
|
408
|
-
? `scopes: options.credentials?.scopes ?? [${scopesString}],`
|
|
345
|
+
? credentialScopes.map((cs) => `"${cs}"`).join(", ") || "`${endpointUrl}/.default`"
|
|
409
346
|
: "";
|
|
347
|
+
const scopes = scopesString ? `scopes: options.credentials?.scopes ?? [${scopesString}],` : "";
|
|
410
348
|
|
|
411
349
|
const apiKeyHeaderName = credentialKeyHeaderName
|
|
412
350
|
? `apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "${credentialKeyHeaderName}",`
|
|
@@ -436,8 +374,7 @@ export function getClientFactoryBody(
|
|
|
436
374
|
endpointUrl, ${credentialsOptions ? "credentials," : ""} options
|
|
437
375
|
) as ${clientTypeName};
|
|
438
376
|
`;
|
|
439
|
-
const { customHttpAuthHeaderName, customHttpAuthSharedKeyPrefix } =
|
|
440
|
-
model.options;
|
|
377
|
+
const { customHttpAuthHeaderName, customHttpAuthSharedKeyPrefix } = model.options;
|
|
441
378
|
let customHttpAuthStatement = "";
|
|
442
379
|
if (customHttpAuthHeaderName && customHttpAuthSharedKeyPrefix) {
|
|
443
380
|
if (options.isMultipleCredential) {
|
|
@@ -463,10 +400,7 @@ export function getClientFactoryBody(
|
|
|
463
400
|
}
|
|
464
401
|
|
|
465
402
|
let apiVersionPolicyStatement = `client.pipeline.removePolicy({ name: "ApiVersionPolicy" });`;
|
|
466
|
-
if (
|
|
467
|
-
isAzurePackage(model) &&
|
|
468
|
-
model.apiVersionInfo?.isCrossedVersion !== false
|
|
469
|
-
) {
|
|
403
|
+
if (isAzurePackage(model) && model.apiVersionInfo?.isCrossedVersion !== false) {
|
|
470
404
|
apiVersionPolicyStatement += `
|
|
471
405
|
if (options.apiVersion) {
|
|
472
406
|
logger.warning("This client does not support client api-version, please change it at the operation level");
|
|
@@ -505,9 +439,7 @@ export function getClientFactoryBody(
|
|
|
505
439
|
let returnStatement = `return client;`;
|
|
506
440
|
|
|
507
441
|
if (includeShortcuts) {
|
|
508
|
-
const shortcutImplementations = buildMethodShortcutImplementation(
|
|
509
|
-
model.paths
|
|
510
|
-
);
|
|
442
|
+
const shortcutImplementations = buildMethodShortcutImplementation(model.paths);
|
|
511
443
|
const shortcutBody = Object.keys(shortcutImplementations).map((key) => {
|
|
512
444
|
// If the operation group has an empty name, it means its operations are client
|
|
513
445
|
// level operations so we need to spread the definitions. Otherwise they are
|
|
@@ -529,7 +461,7 @@ export function getClientFactoryBody(
|
|
|
529
461
|
getClient,
|
|
530
462
|
apiVersionPolicyStatement,
|
|
531
463
|
customHttpAuthStatement,
|
|
532
|
-
returnStatement
|
|
464
|
+
returnStatement,
|
|
533
465
|
];
|
|
534
466
|
}
|
|
535
467
|
|
|
@@ -551,10 +483,7 @@ function normalizeUrlInfo(model: RLCModel) {
|
|
|
551
483
|
const normalizedName = normalizeName(name, NameType.Parameter);
|
|
552
484
|
if (name !== normalizedName) {
|
|
553
485
|
urlParameter.name = normalizedName;
|
|
554
|
-
parsedEndpoint = parsedEndpoint.replace(
|
|
555
|
-
`{${name}}`,
|
|
556
|
-
`{${normalizedName}}`
|
|
557
|
-
);
|
|
486
|
+
parsedEndpoint = parsedEndpoint.replace(`{${name}}`, `{${normalizedName}}`);
|
|
558
487
|
}
|
|
559
488
|
});
|
|
560
489
|
model.urlInfo.endpoint = parsedEndpoint;
|