@azure-tools/typespec-ts 0.54.0 → 0.55.0-dev.1
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/CHANGELOG.md +25 -10
- package/README.md +0 -4
- package/dist/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.js +3 -3
- 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 +31 -40
- 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 -12
- 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 +17 -31
- 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 +2 -2
- 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 +103 -92
- 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 +60 -74
- 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 +8 -10
- 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 +31 -38
- 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 +5 -6
- 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 +23 -25
- 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 +8 -11
- 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 +12 -13
- 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 +36 -50
- 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 -18
- 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 +4 -4
- 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 +81 -113
- 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 +7 -8
- 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 +69 -77
- 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 +13 -18
- 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 +59 -68
- 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 +31 -54
- 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 +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 +72 -84
- 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 +7 -10
- 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 +204 -288
- 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 +4 -6
- 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 +58 -67
- 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 +65 -75
- 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 +73 -90
- 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 +25 -33
- 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 -2
- 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 +10 -13
- 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 +2 -3
- 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 +5 -11
- 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 +67 -89
- 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 +28 -45
- 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 +59 -60
- 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 +37 -38
- 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 +4 -5
- 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 +4 -4
- 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 +57 -96
- 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 +71 -61
- 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 +9 -10
- 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 +23 -27
- 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 +31 -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 +6 -8
- 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 +32 -37
- 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 +2 -4
- 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 +17 -23
- 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 +16 -31
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
- package/dist/src/rlc-common/helpers/packageUtil.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 +3 -7
- 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 +4 -9
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +7 -11
- 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 +14 -15
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +5 -8
- 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 +33 -37
- 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 +31 -39
- 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 +4 -6
- 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 +3 -5
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +11 -12
- package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +28 -28
- 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 -5
- 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 +4 -5
- 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 +14 -14
- 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 +24 -29
- 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 +28 -31
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/utils.js +1 -2
- package/dist/src/rlc-common/metadata/utils.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +4 -5
- package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +3 -4
- 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 +7 -10
- 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 +41 -45
- 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 +28 -27
- 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 +12 -14
- 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 +11 -14
- 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 +32 -45
- 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 +19 -23
- 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 +21 -25
- 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 +21 -32
- 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 +28 -39
- 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 +15 -23
- 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 +4 -5
- 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 +11 -15
- 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 +5 -7
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts +2 -0
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +26 -7
- 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 +3 -6
- 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 +5 -5
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +168 -257
- 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 +6 -7
- 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 +60 -81
- 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 +26 -33
- 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 +38 -45
- 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 +145 -185
- 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 -160
- 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 +92 -180
- 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 +99 -215
- 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 -22
- 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 +44 -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 +79 -156
- package/src/rlc-common/buildPaginateHelper.ts +9 -12
- package/src/rlc-common/buildParameterTypes.ts +116 -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 +37 -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 -116
- 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 +30 -8
- 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 +175 -384
- 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 +16 -29
- 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-browser.mts +3 -1
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
- 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 +42 -90
- package/static/static-helpers/simplePollerHelpers.ts +10 -19
- 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,22 +1,19 @@
|
|
|
1
|
+
import { getHttpOperationWithCache, SdkClient } from "@azure-tools/typespec-client-generator-core";
|
|
1
2
|
import { HelperFunctionDetails, PackageFlavor } from "../rlc-common/index.js";
|
|
2
|
-
import {
|
|
3
|
-
getHttpOperationWithCache,
|
|
4
|
-
SdkClient
|
|
5
|
-
} from "@azure-tools/typespec-client-generator-core";
|
|
3
|
+
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
6
4
|
import { SdkContext } from "../utils/interfaces.js";
|
|
5
|
+
import { getCollectionFormat } from "../utils/modelUtils.js";
|
|
7
6
|
import {
|
|
8
7
|
extractPageDetails,
|
|
9
8
|
getSpecialSerializeInfo,
|
|
10
9
|
hasPagingOperations,
|
|
11
|
-
hasPollingOperations
|
|
10
|
+
hasPollingOperations,
|
|
12
11
|
} from "../utils/operationUtil.js";
|
|
13
|
-
import { getCollectionFormat } from "../utils/modelUtils.js";
|
|
14
|
-
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
15
12
|
|
|
16
13
|
export function transformHelperFunctionDetails(
|
|
17
14
|
client: SdkClient,
|
|
18
15
|
dpgContext: SdkContext,
|
|
19
|
-
flavor?: PackageFlavor
|
|
16
|
+
flavor?: PackageFlavor,
|
|
20
17
|
): HelperFunctionDetails {
|
|
21
18
|
const serializeInfo = extractSpecialSerializeInfo(client, dpgContext);
|
|
22
19
|
// Disable paging and long running for non-Azure clients.
|
|
@@ -24,18 +21,18 @@ export function transformHelperFunctionDetails(
|
|
|
24
21
|
return {
|
|
25
22
|
hasLongRunning: false,
|
|
26
23
|
hasPaging: false,
|
|
27
|
-
...serializeInfo
|
|
24
|
+
...serializeInfo,
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
const annotationDetails = {
|
|
32
|
-
hasLongRunning: hasPollingOperations(client, dpgContext)
|
|
29
|
+
hasLongRunning: hasPollingOperations(client, dpgContext),
|
|
33
30
|
};
|
|
34
31
|
const details = extractClientPageDetails(client, dpgContext);
|
|
35
32
|
return {
|
|
36
33
|
...(details ?? {}),
|
|
37
34
|
...annotationDetails,
|
|
38
|
-
...serializeInfo
|
|
35
|
+
...serializeInfo,
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
38
|
|
|
@@ -65,36 +62,27 @@ function extractClientPageDetails(client: SdkClient, dpgContext: SdkContext) {
|
|
|
65
62
|
pageDetails: {
|
|
66
63
|
itemNames: [...itemNames],
|
|
67
64
|
nextLinkNames: [...nextLinks],
|
|
68
|
-
isComplexPaging: nextLinks.size > 1 || itemNames.size > 1
|
|
69
|
-
}
|
|
65
|
+
isComplexPaging: nextLinks.size > 1 || itemNames.size > 1,
|
|
66
|
+
},
|
|
70
67
|
};
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
function extractSpecialSerializeInfo(
|
|
74
|
-
client: SdkClient,
|
|
75
|
-
dpgContext: SdkContext
|
|
76
|
-
) {
|
|
70
|
+
function extractSpecialSerializeInfo(client: SdkClient, dpgContext: SdkContext) {
|
|
77
71
|
let hasMultiCollection = false;
|
|
78
72
|
let hasCsvCollection = false;
|
|
79
73
|
for (const op of listOperationsUnderRLCClient(client)) {
|
|
80
74
|
const route = getHttpOperationWithCache(dpgContext, op);
|
|
81
75
|
route.parameters.parameters.forEach((parameter) => {
|
|
82
76
|
const format = getCollectionFormat(dpgContext, parameter as any);
|
|
83
|
-
const serializeInfo = getSpecialSerializeInfo(
|
|
84
|
-
dpgContext,
|
|
85
|
-
parameter.type,
|
|
86
|
-
format!
|
|
87
|
-
);
|
|
77
|
+
const serializeInfo = getSpecialSerializeInfo(dpgContext, parameter.type, format!);
|
|
88
78
|
hasMultiCollection = hasMultiCollection
|
|
89
79
|
? hasMultiCollection
|
|
90
80
|
: serializeInfo.hasMultiCollection;
|
|
91
|
-
hasCsvCollection = hasCsvCollection
|
|
92
|
-
? hasCsvCollection
|
|
93
|
-
: serializeInfo.hasCsvCollection;
|
|
81
|
+
hasCsvCollection = hasCsvCollection ? hasCsvCollection : serializeInfo.hasCsvCollection;
|
|
94
82
|
});
|
|
95
83
|
}
|
|
96
84
|
return {
|
|
97
85
|
hasMultiCollection,
|
|
98
|
-
hasCsvCollection
|
|
86
|
+
hasCsvCollection,
|
|
99
87
|
};
|
|
100
88
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
SdkClient,
|
|
6
|
+
getHttpOperationWithCache,
|
|
7
|
+
isApiVersion,
|
|
8
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
9
|
+
import { NoTarget, Type, isVoidType } from "@typespec/compiler";
|
|
10
|
+
import { HttpOperation, HttpOperationParameter, HttpOperationParameters } from "@typespec/http";
|
|
11
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
12
|
import {
|
|
5
13
|
ApiVersionInfo,
|
|
6
14
|
Imports,
|
|
@@ -9,25 +17,16 @@ import {
|
|
|
9
17
|
ParameterBodyMetadata,
|
|
10
18
|
ParameterMetadata,
|
|
11
19
|
Schema,
|
|
12
|
-
SchemaContext
|
|
20
|
+
SchemaContext,
|
|
13
21
|
} from "../rlc-common/index.js";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
HttpOperationParameter,
|
|
17
|
-
HttpOperationParameters
|
|
18
|
-
} from "@typespec/http";
|
|
22
|
+
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
23
|
+
import { SdkContext } from "../utils/interfaces.js";
|
|
19
24
|
import {
|
|
20
25
|
KnownMediaType,
|
|
21
26
|
extractMediaTypes,
|
|
22
27
|
hasMediaType,
|
|
23
|
-
isMediaTypeJsonMergePatch
|
|
28
|
+
isMediaTypeJsonMergePatch,
|
|
24
29
|
} from "../utils/mediaTypes.js";
|
|
25
|
-
import {
|
|
26
|
-
SdkClient,
|
|
27
|
-
getHttpOperationWithCache,
|
|
28
|
-
isApiVersion
|
|
29
|
-
} from "@azure-tools/typespec-client-generator-core";
|
|
30
|
-
import { NoTarget, Type, isVoidType } from "@typespec/compiler";
|
|
31
30
|
import {
|
|
32
31
|
getBodyType,
|
|
33
32
|
getCollectionFormat,
|
|
@@ -36,17 +35,14 @@ import {
|
|
|
36
35
|
getSchemaForType,
|
|
37
36
|
getTypeName,
|
|
38
37
|
isArrayType,
|
|
39
|
-
isBodyRequired
|
|
38
|
+
isBodyRequired,
|
|
40
39
|
} from "../utils/modelUtils.js";
|
|
41
40
|
import {
|
|
42
41
|
getOperationGroupName,
|
|
43
42
|
getOperationName,
|
|
44
|
-
getSpecialSerializeInfo
|
|
43
|
+
getSpecialSerializeInfo,
|
|
45
44
|
} from "../utils/operationUtil.js";
|
|
46
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
47
45
|
import { getParameterSerializationInfo } from "../utils/parameterUtils.js";
|
|
48
|
-
import { reportDiagnostic } from "../lib.js";
|
|
49
|
-
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
50
46
|
|
|
51
47
|
interface ParameterTransformationOptions {
|
|
52
48
|
apiVersionInfo?: ApiVersionInfo;
|
|
@@ -59,7 +55,7 @@ export function transformToParameterTypes(
|
|
|
59
55
|
client: SdkClient,
|
|
60
56
|
dpgContext: SdkContext,
|
|
61
57
|
importDetails: Imports,
|
|
62
|
-
apiVersionInfo?: ApiVersionInfo
|
|
58
|
+
apiVersionInfo?: ApiVersionInfo,
|
|
63
59
|
): OperationParameter[] {
|
|
64
60
|
const rlcParameters: OperationParameter[] = [];
|
|
65
61
|
const outputImportedSet = new Set<string>();
|
|
@@ -80,30 +76,22 @@ export function transformToParameterTypes(
|
|
|
80
76
|
const rlcParameter: OperationParameter = {
|
|
81
77
|
operationGroup: getOperationGroupName(dpgContext, route),
|
|
82
78
|
operationName: getOperationName(dpgContext, route.operation),
|
|
83
|
-
parameters: []
|
|
79
|
+
parameters: [],
|
|
84
80
|
};
|
|
85
81
|
const options = {
|
|
86
82
|
apiVersionInfo,
|
|
87
83
|
operationGroupName: rlcParameter.operationGroup,
|
|
88
84
|
operationName: rlcParameter.operationName,
|
|
89
|
-
importModels: outputImportedSet
|
|
85
|
+
importModels: outputImportedSet,
|
|
90
86
|
};
|
|
91
87
|
// transform query param
|
|
92
|
-
const queryParams = transformQueryParameters(
|
|
93
|
-
dpgContext,
|
|
94
|
-
parameters,
|
|
95
|
-
options
|
|
96
|
-
);
|
|
88
|
+
const queryParams = transformQueryParameters(dpgContext, parameters, options);
|
|
97
89
|
// transform path param
|
|
98
90
|
const pathParams = transformPathParameters(dpgContext, parameters, options);
|
|
99
91
|
// TODO: support cookie parameters, https://github.com/Azure/autorest.typescript/issues/2898
|
|
100
92
|
transformCookieParameters(dpgContext, parameters);
|
|
101
93
|
// transform header param including content-type
|
|
102
|
-
const headerParams = transformHeaderParameters(
|
|
103
|
-
dpgContext,
|
|
104
|
-
parameters,
|
|
105
|
-
options
|
|
106
|
-
);
|
|
94
|
+
const headerParams = transformHeaderParameters(dpgContext, parameters, options);
|
|
107
95
|
// transform body
|
|
108
96
|
const bodyType = getBodyType(route);
|
|
109
97
|
let bodyParameter = undefined;
|
|
@@ -113,12 +101,12 @@ export function transformToParameterTypes(
|
|
|
113
101
|
parameters,
|
|
114
102
|
headerParams,
|
|
115
103
|
outputImportedSet,
|
|
116
|
-
bodyType
|
|
104
|
+
bodyType,
|
|
117
105
|
);
|
|
118
106
|
}
|
|
119
107
|
rlcParameter.parameters.push({
|
|
120
108
|
parameters: [...queryParams, ...pathParams, ...headerParams],
|
|
121
|
-
body: bodyParameter
|
|
109
|
+
body: bodyParameter,
|
|
122
110
|
});
|
|
123
111
|
rlcParameters.push(rlcParameter);
|
|
124
112
|
}
|
|
@@ -129,7 +117,7 @@ function getParameterMetadata(
|
|
|
129
117
|
dpgContext: SdkContext,
|
|
130
118
|
paramType: "query" | "path" | "header",
|
|
131
119
|
parameter: HttpOperationParameter,
|
|
132
|
-
options: ParameterTransformationOptions
|
|
120
|
+
options: ParameterTransformationOptions,
|
|
133
121
|
): ParameterMetadata {
|
|
134
122
|
const program = dpgContext.program;
|
|
135
123
|
const importedModels = options.importModels ?? new Set<string>();
|
|
@@ -137,23 +125,18 @@ function getParameterMetadata(
|
|
|
137
125
|
const schema = getSchemaForType(dpgContext, parameter.param.type, {
|
|
138
126
|
usage: schemaContext,
|
|
139
127
|
needRef: false,
|
|
140
|
-
relevantProperty: parameter.param
|
|
128
|
+
relevantProperty: parameter.param,
|
|
141
129
|
}) as Schema;
|
|
142
130
|
const name = getParameterName(parameter.name);
|
|
143
|
-
let description =
|
|
144
|
-
getFormattedPropertyDoc(program, parameter.param, schema) ?? "";
|
|
131
|
+
let description = getFormattedPropertyDoc(program, parameter.param, schema) ?? "";
|
|
145
132
|
const format = getCollectionFormat(dpgContext, parameter as any);
|
|
146
133
|
if (isArrayType(schema) && format) {
|
|
147
|
-
const serializeInfo = getSpecialSerializeInfo(
|
|
148
|
-
dpgContext,
|
|
149
|
-
parameter.type,
|
|
150
|
-
format
|
|
151
|
-
);
|
|
134
|
+
const serializeInfo = getSpecialSerializeInfo(dpgContext, parameter.type, format);
|
|
152
135
|
if (serializeInfo.hasMultiCollection || serializeInfo.hasCsvCollection) {
|
|
153
136
|
description += `${description ? "\n" : ""}This parameter could be formatted as ${serializeInfo.collectionInfo.join(
|
|
154
|
-
", "
|
|
137
|
+
", ",
|
|
155
138
|
)} collection string, we provide ${serializeInfo.descriptions.join(
|
|
156
|
-
", "
|
|
139
|
+
", ",
|
|
157
140
|
)} from serializeHelper.ts to help${
|
|
158
141
|
serializeInfo.hasMultiCollection
|
|
159
142
|
? ", you will probably need to set skipUrlEncoding as true when sending the request"
|
|
@@ -165,16 +148,13 @@ function getParameterMetadata(
|
|
|
165
148
|
}
|
|
166
149
|
}
|
|
167
150
|
|
|
168
|
-
getImportedModelName(schema, schemaContext)?.forEach(
|
|
169
|
-
importedModels.add,
|
|
170
|
-
importedModels
|
|
171
|
-
);
|
|
151
|
+
getImportedModelName(schema, schemaContext)?.forEach(importedModels.add, importedModels);
|
|
172
152
|
const serializationType = getParameterSerializationInfo(
|
|
173
153
|
dpgContext,
|
|
174
154
|
parameter,
|
|
175
155
|
schema,
|
|
176
156
|
options.operationGroupName,
|
|
177
|
-
options.operationName
|
|
157
|
+
options.operationName,
|
|
178
158
|
);
|
|
179
159
|
return {
|
|
180
160
|
type: paramType,
|
|
@@ -185,8 +165,8 @@ function getParameterMetadata(
|
|
|
185
165
|
typeName: serializationType.typeName,
|
|
186
166
|
required: !parameter.param.optional,
|
|
187
167
|
description,
|
|
188
|
-
wrapperType: serializationType.wrapperType
|
|
189
|
-
}
|
|
168
|
+
wrapperType: serializationType.wrapperType,
|
|
169
|
+
},
|
|
190
170
|
};
|
|
191
171
|
}
|
|
192
172
|
|
|
@@ -197,10 +177,7 @@ function getParameterName(name: string) {
|
|
|
197
177
|
return `"${name}"`;
|
|
198
178
|
}
|
|
199
179
|
|
|
200
|
-
function transformCookieParameters(
|
|
201
|
-
dpgContext: SdkContext,
|
|
202
|
-
parameters: HttpOperationParameters
|
|
203
|
-
) {
|
|
180
|
+
function transformCookieParameters(dpgContext: SdkContext, parameters: HttpOperationParameters) {
|
|
204
181
|
// TODO: support cookie parameters, https://github.com/Azure/autorest.typescript/issues/2898
|
|
205
182
|
parameters.parameters
|
|
206
183
|
.filter((p) => p.type === "cookie")
|
|
@@ -209,9 +186,9 @@ function transformCookieParameters(
|
|
|
209
186
|
code: "parameter-type-not-supported",
|
|
210
187
|
format: {
|
|
211
188
|
paramName: p.name,
|
|
212
|
-
paramType: p.type
|
|
189
|
+
paramType: p.type,
|
|
213
190
|
},
|
|
214
|
-
target: NoTarget
|
|
191
|
+
target: NoTarget,
|
|
215
192
|
});
|
|
216
193
|
});
|
|
217
194
|
}
|
|
@@ -219,22 +196,17 @@ function transformCookieParameters(
|
|
|
219
196
|
function transformQueryParameters(
|
|
220
197
|
dpgContext: SdkContext,
|
|
221
198
|
parameters: HttpOperationParameters,
|
|
222
|
-
options: ParameterTransformationOptions
|
|
199
|
+
options: ParameterTransformationOptions,
|
|
223
200
|
): ParameterMetadata[] {
|
|
224
201
|
const queryParameters = parameters.parameters.filter(
|
|
225
202
|
(p) =>
|
|
226
203
|
p.type === "query" &&
|
|
227
|
-
!(
|
|
228
|
-
isApiVersion(dpgContext, p.param) &&
|
|
229
|
-
options.apiVersionInfo?.definedPosition === "query"
|
|
230
|
-
)
|
|
204
|
+
!(isApiVersion(dpgContext, p.param) && options.apiVersionInfo?.definedPosition === "query"),
|
|
231
205
|
);
|
|
232
206
|
if (!queryParameters.length) {
|
|
233
207
|
return [];
|
|
234
208
|
}
|
|
235
|
-
return queryParameters.map((qp) =>
|
|
236
|
-
getParameterMetadata(dpgContext, "query", qp, options)
|
|
237
|
-
);
|
|
209
|
+
return queryParameters.map((qp) => getParameterMetadata(dpgContext, "query", qp, options));
|
|
238
210
|
}
|
|
239
211
|
|
|
240
212
|
/**
|
|
@@ -244,7 +216,7 @@ function transformQueryParameters(
|
|
|
244
216
|
function transformPathParameters(
|
|
245
217
|
dpgContext: SdkContext,
|
|
246
218
|
parameters: HttpOperationParameters,
|
|
247
|
-
options: ParameterTransformationOptions
|
|
219
|
+
options: ParameterTransformationOptions,
|
|
248
220
|
) {
|
|
249
221
|
// build wrapper path parameters
|
|
250
222
|
const pathParameters = parameters.parameters.filter((p) => p.type === "path");
|
|
@@ -261,17 +233,13 @@ function transformPathParameters(
|
|
|
261
233
|
export function transformHeaderParameters(
|
|
262
234
|
dpgContext: SdkContext,
|
|
263
235
|
parameters: HttpOperationParameters,
|
|
264
|
-
options: ParameterTransformationOptions
|
|
236
|
+
options: ParameterTransformationOptions,
|
|
265
237
|
): ParameterMetadata[] {
|
|
266
|
-
const headerParameters = parameters.parameters.filter(
|
|
267
|
-
(p) => p.type === "header"
|
|
268
|
-
);
|
|
238
|
+
const headerParameters = parameters.parameters.filter((p) => p.type === "header");
|
|
269
239
|
if (!headerParameters.length) {
|
|
270
240
|
return [];
|
|
271
241
|
}
|
|
272
|
-
return headerParameters.map((qp) =>
|
|
273
|
-
getParameterMetadata(dpgContext, "header", qp, options)
|
|
274
|
-
);
|
|
242
|
+
return headerParameters.map((qp) => getParameterMetadata(dpgContext, "header", qp, options));
|
|
275
243
|
}
|
|
276
244
|
|
|
277
245
|
function transformBodyParameters(
|
|
@@ -279,20 +247,13 @@ function transformBodyParameters(
|
|
|
279
247
|
parameters: HttpOperationParameters,
|
|
280
248
|
headers: ParameterMetadata[],
|
|
281
249
|
importedModels: Set<string>,
|
|
282
|
-
inputBodyType?: Type
|
|
250
|
+
inputBodyType?: Type,
|
|
283
251
|
): ParameterBodyMetadata | undefined {
|
|
284
|
-
const bodyType =
|
|
285
|
-
parameters.body && inputBodyType ? inputBodyType : parameters.body?.type;
|
|
252
|
+
const bodyType = parameters.body && inputBodyType ? inputBodyType : parameters.body?.type;
|
|
286
253
|
if (!bodyType || isVoidType(bodyType)) {
|
|
287
254
|
return;
|
|
288
255
|
}
|
|
289
|
-
return transformRequestBody(
|
|
290
|
-
dpgContext,
|
|
291
|
-
bodyType,
|
|
292
|
-
parameters,
|
|
293
|
-
importedModels,
|
|
294
|
-
headers
|
|
295
|
-
);
|
|
256
|
+
return transformRequestBody(dpgContext, bodyType, parameters, importedModels, headers);
|
|
296
257
|
}
|
|
297
258
|
|
|
298
259
|
function transformRequestBody(
|
|
@@ -300,13 +261,13 @@ function transformRequestBody(
|
|
|
300
261
|
bodyType: Type,
|
|
301
262
|
parameters: HttpOperationParameters,
|
|
302
263
|
importedModels: Set<string>,
|
|
303
|
-
headers: ParameterMetadata[]
|
|
264
|
+
headers: ParameterMetadata[],
|
|
304
265
|
) {
|
|
305
266
|
const contentTypes = extractMediaTypes(parameters.body?.contentTypes ?? []);
|
|
306
267
|
const schema = getSchemaForType(dpgContext, bodyType, {
|
|
307
268
|
mediaTypes: contentTypes,
|
|
308
269
|
isRequestBody: true,
|
|
309
|
-
usage: [SchemaContext.Input, SchemaContext.Exception]
|
|
270
|
+
usage: [SchemaContext.Input, SchemaContext.Exception],
|
|
310
271
|
});
|
|
311
272
|
|
|
312
273
|
const descriptions = getBodyDescriptions(dpgContext, schema, parameters);
|
|
@@ -323,33 +284,26 @@ function transformRequestBody(
|
|
|
323
284
|
required: isBodyRequired(parameters),
|
|
324
285
|
description: descriptions.join("\n\n"),
|
|
325
286
|
isMultipartBody:
|
|
326
|
-
hasMediaType(KnownMediaType.MultipartFormData, contentTypes) &&
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
]
|
|
287
|
+
hasMediaType(KnownMediaType.MultipartFormData, contentTypes) && contentTypes.length === 1,
|
|
288
|
+
oriSchema: schema,
|
|
289
|
+
},
|
|
290
|
+
],
|
|
331
291
|
};
|
|
332
292
|
}
|
|
333
293
|
|
|
334
294
|
function getRequestBodyType(
|
|
335
295
|
bodySchema: Schema,
|
|
336
296
|
importedModels: Set<string>,
|
|
337
|
-
headers?: ParameterMetadata[]
|
|
297
|
+
headers?: ParameterMetadata[],
|
|
338
298
|
) {
|
|
339
299
|
const schemaUsage = [SchemaContext.Input, SchemaContext.Exception];
|
|
340
300
|
const importedNames = getImportedModelName(bodySchema, schemaUsage) ?? [];
|
|
341
301
|
importedNames.forEach(importedModels.add, importedModels);
|
|
342
302
|
|
|
343
303
|
let typeName = getTypeName(bodySchema, schemaUsage);
|
|
344
|
-
const contentTypes = headers
|
|
345
|
-
?.filter((h) => h.name === "contentType")
|
|
346
|
-
.map((h) => h.param.type);
|
|
304
|
+
const contentTypes = headers?.filter((h) => h.name === "contentType").map((h) => h.param.type);
|
|
347
305
|
const hasMergeAndPatchType = isMediaTypeJsonMergePatch(contentTypes ?? []);
|
|
348
|
-
if (
|
|
349
|
-
hasMergeAndPatchType &&
|
|
350
|
-
Boolean(bodySchema.name) &&
|
|
351
|
-
(bodySchema as ObjectSchema).properties
|
|
352
|
-
) {
|
|
306
|
+
if (hasMergeAndPatchType && Boolean(bodySchema.name) && (bodySchema as ObjectSchema).properties) {
|
|
353
307
|
typeName = `${typeName}ResourceMergeAndPatch`;
|
|
354
308
|
}
|
|
355
309
|
return typeName;
|
|
@@ -358,14 +312,10 @@ function getRequestBodyType(
|
|
|
358
312
|
function getBodyDescriptions(
|
|
359
313
|
dpgContext: SdkContext,
|
|
360
314
|
bodySchema: Schema,
|
|
361
|
-
parameters: HttpOperationParameters
|
|
315
|
+
parameters: HttpOperationParameters,
|
|
362
316
|
) {
|
|
363
317
|
const description = parameters.body?.property
|
|
364
|
-
? getFormattedPropertyDoc(
|
|
365
|
-
dpgContext.program,
|
|
366
|
-
parameters.body.property,
|
|
367
|
-
bodySchema
|
|
368
|
-
)
|
|
318
|
+
? getFormattedPropertyDoc(dpgContext.program, parameters.body.property, bodySchema)
|
|
369
319
|
: "";
|
|
370
320
|
return description ? [description] : [];
|
|
371
321
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
SdkClient,
|
|
6
|
+
getHttpOperationWithCache,
|
|
7
|
+
isApiVersion,
|
|
8
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
4
9
|
import { HttpOperation, HttpOperationParameters } from "@typespec/http";
|
|
5
10
|
import {
|
|
6
11
|
Imports,
|
|
@@ -9,13 +14,9 @@ import {
|
|
|
9
14
|
Paths,
|
|
10
15
|
SchemaContext,
|
|
11
16
|
getParameterTypeName,
|
|
12
|
-
getResponseTypeName
|
|
17
|
+
getResponseTypeName,
|
|
13
18
|
} from "../rlc-common/index.js";
|
|
14
|
-
import {
|
|
15
|
-
SdkClient,
|
|
16
|
-
getHttpOperationWithCache,
|
|
17
|
-
isApiVersion
|
|
18
|
-
} from "@azure-tools/typespec-client-generator-core";
|
|
19
|
+
import { getImportedModelName, getSchemaForType, isBodyRequired } from "../utils/modelUtils.js";
|
|
19
20
|
import {
|
|
20
21
|
extractOperationLroDetail,
|
|
21
22
|
getOperationGroupName,
|
|
@@ -24,23 +25,18 @@ import {
|
|
|
24
25
|
getOperationStatuscode,
|
|
25
26
|
getOperationSuccessStatus,
|
|
26
27
|
isPagingOperation,
|
|
27
|
-
sortedOperationResponses
|
|
28
|
+
sortedOperationResponses,
|
|
28
29
|
} from "../utils/operationUtil.js";
|
|
29
|
-
import {
|
|
30
|
-
getImportedModelName,
|
|
31
|
-
getSchemaForType,
|
|
32
|
-
isBodyRequired
|
|
33
|
-
} from "../utils/modelUtils.js";
|
|
34
30
|
|
|
35
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
36
31
|
import { getDoc } from "@typespec/compiler";
|
|
37
|
-
import { getParameterSerializationInfo } from "../utils/parameterUtils.js";
|
|
38
32
|
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
33
|
+
import { SdkContext } from "../utils/interfaces.js";
|
|
34
|
+
import { getParameterSerializationInfo } from "../utils/parameterUtils.js";
|
|
39
35
|
|
|
40
36
|
export function transformPaths(
|
|
41
37
|
client: SdkClient,
|
|
42
38
|
dpgContext: SdkContext,
|
|
43
|
-
importDetails: Imports
|
|
39
|
+
importDetails: Imports,
|
|
44
40
|
): Paths {
|
|
45
41
|
const pathParamsImportedSet = new Set<string>();
|
|
46
42
|
const paths: Paths = {};
|
|
@@ -64,7 +60,7 @@ function transformOperation(
|
|
|
64
60
|
dpgContext: SdkContext,
|
|
65
61
|
route: HttpOperation,
|
|
66
62
|
paths: Paths,
|
|
67
|
-
importSet: Set<string
|
|
63
|
+
importSet: Set<string>,
|
|
68
64
|
) {
|
|
69
65
|
const program = dpgContext.program;
|
|
70
66
|
const respNames = [];
|
|
@@ -73,7 +69,7 @@ function transformOperation(
|
|
|
73
69
|
const respName = getResponseTypeName(
|
|
74
70
|
operationGroupName,
|
|
75
71
|
getOperationName(dpgContext, route.operation),
|
|
76
|
-
getOperationStatuscode(resp)
|
|
72
|
+
getOperationStatuscode(resp),
|
|
77
73
|
);
|
|
78
74
|
respNames.push(respName);
|
|
79
75
|
}
|
|
@@ -83,35 +79,25 @@ function transformOperation(
|
|
|
83
79
|
hasOptionalOptions: !hasRequiredOptions(dpgContext, route.parameters),
|
|
84
80
|
optionsName: getParameterTypeName(
|
|
85
81
|
operationGroupName,
|
|
86
|
-
getOperationName(dpgContext, route.operation)
|
|
82
|
+
getOperationName(dpgContext, route.operation),
|
|
87
83
|
),
|
|
88
84
|
responseTypes,
|
|
89
85
|
returnType: respNames.join(" | "),
|
|
90
86
|
successStatus: getOperationSuccessStatus(route),
|
|
91
87
|
operationName: getOperationName(dpgContext, route.operation),
|
|
92
88
|
operationHelperDetail: {
|
|
93
|
-
lroDetails: extractOperationLroDetail(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
responseTypes,
|
|
97
|
-
operationGroupName
|
|
98
|
-
),
|
|
99
|
-
isPaging: isPagingOperation(dpgContext, route)
|
|
100
|
-
}
|
|
89
|
+
lroDetails: extractOperationLroDetail(dpgContext, route, responseTypes, operationGroupName),
|
|
90
|
+
isPaging: isPagingOperation(dpgContext, route),
|
|
91
|
+
},
|
|
101
92
|
};
|
|
102
|
-
if (
|
|
103
|
-
paths[route.path] !== undefined &&
|
|
104
|
-
!paths[route.path]?.methods[route.verb]
|
|
105
|
-
) {
|
|
93
|
+
if (paths[route.path] !== undefined && !paths[route.path]?.methods[route.verb]) {
|
|
106
94
|
(paths[route.path] as PathMetadata).methods[route.verb] = [method];
|
|
107
95
|
} else if (paths[route.path]?.methods[route.verb]) {
|
|
108
96
|
paths[route.path]?.methods[route.verb]?.push(method);
|
|
109
97
|
} else {
|
|
110
98
|
paths[route.path] = {
|
|
111
99
|
description: getDoc(program, route.operation) ?? "",
|
|
112
|
-
name: escapeCoreName(
|
|
113
|
-
getOperationName(dpgContext, route.operation) || "Client"
|
|
114
|
-
),
|
|
100
|
+
name: escapeCoreName(getOperationName(dpgContext, route.operation) || "Client"),
|
|
115
101
|
pathParameters: route.parameters.parameters
|
|
116
102
|
.filter((p) => p.type === "path")
|
|
117
103
|
.map((p) => {
|
|
@@ -119,14 +105,14 @@ function transformOperation(
|
|
|
119
105
|
const options = {
|
|
120
106
|
usage: schemaUsage,
|
|
121
107
|
needRef: false,
|
|
122
|
-
relevantProperty: p.param
|
|
108
|
+
relevantProperty: p.param,
|
|
123
109
|
};
|
|
124
110
|
const schema = p.param.sourceProperty
|
|
125
111
|
? getSchemaForType(
|
|
126
112
|
dpgContext,
|
|
127
113
|
p.param.sourceProperty?.type,
|
|
128
114
|
|
|
129
|
-
options
|
|
115
|
+
options,
|
|
130
116
|
)
|
|
131
117
|
: getSchemaForType(dpgContext, p.param.type, options);
|
|
132
118
|
const importedNames = getImportedModelName(schema, schemaUsage) ?? [];
|
|
@@ -136,19 +122,19 @@ function transformOperation(
|
|
|
136
122
|
p,
|
|
137
123
|
schema,
|
|
138
124
|
operationGroupName,
|
|
139
|
-
method.operationName
|
|
125
|
+
method.operationName,
|
|
140
126
|
);
|
|
141
127
|
return {
|
|
142
128
|
name: p.name,
|
|
143
129
|
type: serializationType.typeName,
|
|
144
130
|
description: getDoc(program, p.param) ?? "",
|
|
145
|
-
wrapperType: serializationType.wrapperType
|
|
131
|
+
wrapperType: serializationType.wrapperType,
|
|
146
132
|
};
|
|
147
133
|
}),
|
|
148
134
|
operationGroupName: getOperationGroupName(dpgContext, route),
|
|
149
135
|
methods: {
|
|
150
|
-
[route.verb]: [method]
|
|
151
|
-
}
|
|
136
|
+
[route.verb]: [method],
|
|
137
|
+
},
|
|
152
138
|
};
|
|
153
139
|
}
|
|
154
140
|
}
|
|
@@ -159,10 +145,7 @@ function escapeCoreName(name: string) {
|
|
|
159
145
|
}
|
|
160
146
|
return name;
|
|
161
147
|
}
|
|
162
|
-
function hasRequiredOptions(
|
|
163
|
-
dpgContext: SdkContext,
|
|
164
|
-
routeParameters: HttpOperationParameters
|
|
165
|
-
) {
|
|
148
|
+
function hasRequiredOptions(dpgContext: SdkContext, routeParameters: HttpOperationParameters) {
|
|
166
149
|
const isRequiredBodyParam = isBodyRequired(routeParameters);
|
|
167
150
|
|
|
168
151
|
const containsRequiredNonBodyParam = routeParameters.parameters
|