@azure-tools/typespec-ts 0.53.3 → 0.54.0
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 +11 -0
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +102 -44
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +1 -1
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/load-static-helpers.js +1 -1
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -10
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +0 -5
- 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.js +1 -1
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.js +1 -1
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildOperations.js +1 -1
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +1 -1
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +1 -1
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.js +1 -1
- package/dist/src/modular/buildRootIndex.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 +1 -1
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +1 -1
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.js +1 -1
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.js +1 -1
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +1 -1
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +1 -1
- 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 +1 -1
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +53 -34
- package/dist/src/modular/helpers/operationHelpers.js.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/interfaces.d.ts +1 -1
- package/dist/src/modular/interfaces.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/rlc-common/buildClient.d.ts +9 -0
- package/dist/src/rlc-common/buildClient.d.ts.map +1 -0
- package/dist/src/rlc-common/buildClient.js +413 -0
- package/dist/src/rlc-common/buildClient.js.map +1 -0
- package/dist/src/rlc-common/buildClientDefinitions.d.ts +6 -0
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -0
- package/dist/src/rlc-common/buildClientDefinitions.js +174 -0
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -0
- package/dist/src/rlc-common/buildIndexFile.d.ts +6 -0
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -0
- package/dist/src/rlc-common/buildIndexFile.js +242 -0
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -0
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts +6 -0
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -0
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +224 -0
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -0
- package/dist/src/rlc-common/buildLogger.d.ts +6 -0
- package/dist/src/rlc-common/buildLogger.d.ts.map +1 -0
- package/dist/src/rlc-common/buildLogger.js +32 -0
- package/dist/src/rlc-common/buildLogger.js.map +1 -0
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts +5 -0
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -0
- package/dist/src/rlc-common/buildMethodShortcuts.js +54 -0
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -0
- package/dist/src/rlc-common/buildObjectTypes.d.ts +29 -0
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -0
- package/dist/src/rlc-common/buildObjectTypes.js +451 -0
- package/dist/src/rlc-common/buildObjectTypes.js.map +1 -0
- package/dist/src/rlc-common/buildPaginateHelper.d.ts +6 -0
- package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -0
- package/dist/src/rlc-common/buildPaginateHelper.js +27 -0
- package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -0
- package/dist/src/rlc-common/buildParameterTypes.d.ts +14 -0
- package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -0
- package/dist/src/rlc-common/buildParameterTypes.js +381 -0
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -0
- package/dist/src/rlc-common/buildPollingHelper.d.ts +6 -0
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -0
- package/dist/src/rlc-common/buildPollingHelper.js +62 -0
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -0
- package/dist/src/rlc-common/buildResponseTypes.d.ts +6 -0
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -0
- package/dist/src/rlc-common/buildResponseTypes.js +147 -0
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -0
- package/dist/src/rlc-common/buildSamples.d.ts +3 -0
- package/dist/src/rlc-common/buildSamples.d.ts.map +1 -0
- package/dist/src/rlc-common/buildSamples.js +30 -0
- package/dist/src/rlc-common/buildSamples.js.map +1 -0
- package/dist/src/rlc-common/buildSchemaType.d.ts +20 -0
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -0
- package/dist/src/rlc-common/buildSchemaType.js +53 -0
- package/dist/src/rlc-common/buildSchemaType.js.map +1 -0
- package/dist/src/rlc-common/buildSerializeHelper.d.ts +6 -0
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -0
- package/dist/src/rlc-common/buildSerializeHelper.js +36 -0
- package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -0
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts +6 -0
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -0
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +52 -0
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -0
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts +17 -0
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +45 -0
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -0
- package/dist/src/rlc-common/helpers/importsUtil.d.ts +18 -0
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/importsUtil.js +169 -0
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -0
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts +42 -0
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/nameConstructors.js +63 -0
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -0
- package/dist/src/rlc-common/helpers/nameUtils.d.ts +37 -0
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/nameUtils.js +246 -0
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -0
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts +16 -0
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/operationHelpers.js +119 -0
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -0
- package/dist/src/rlc-common/helpers/packageUtil.d.ts +7 -0
- package/dist/src/rlc-common/helpers/packageUtil.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/packageUtil.js +13 -0
- package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -0
- package/dist/src/rlc-common/helpers/pathUtils.d.ts +2 -0
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/pathUtils.js +12 -0
- package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -0
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts +10 -0
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/schemaHelpers.js +41 -0
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -0
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +4 -0
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/shortcutMethods.js +49 -0
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -0
- package/dist/src/rlc-common/helpers/typeUtil.d.ts +32 -0
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/typeUtil.js +167 -0
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -0
- package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts +12 -0
- package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +165 -0
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -0
- package/dist/src/rlc-common/index.d.ts +41 -0
- package/dist/src/rlc-common/index.d.ts.map +1 -0
- package/dist/src/rlc-common/index.js +43 -0
- package/dist/src/rlc-common/index.js.map +1 -0
- package/dist/src/rlc-common/interfaces.d.ts +369 -0
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -0
- package/dist/src/rlc-common/interfaces.js +11 -0
- package/dist/src/rlc-common/interfaces.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts +6 -0
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +56 -0
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts +6 -0
- package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +26 -0
- package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts +6 -0
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +82 -0
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts +5 -0
- package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +32 -0
- package/dist/src/rlc-common/metadata/buildLicenseFile.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts +25 -0
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildPackageFile.js +201 -0
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts +11 -0
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +426 -0
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts +6 -0
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +142 -0
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts +6 -0
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +17 -0
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildTestConfig.d.ts +16 -0
- package/dist/src/rlc-common/metadata/buildTestConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildTestConfig.js +55 -0
- package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts +61 -0
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildTsConfig.js +170 -0
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts +6 -0
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +28 -0
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts +20 -0
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +77 -0
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +51 -0
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +121 -0
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts +242 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +176 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts +8 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +102 -0
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts +57 -0
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +53 -0
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts +64 -0
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +183 -0
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -0
- package/dist/src/rlc-common/metadata/utils.d.ts +3 -0
- package/dist/src/rlc-common/metadata/utils.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/utils.js +7 -0
- package/dist/src/rlc-common/metadata/utils.js.map +1 -0
- package/dist/src/rlc-common/static/paginateContent.d.ts +2 -0
- package/dist/src/rlc-common/static/paginateContent.d.ts.map +1 -0
- package/dist/src/rlc-common/static/paginateContent.js +345 -0
- package/dist/src/rlc-common/static/paginateContent.js.map +1 -0
- package/dist/src/rlc-common/static/pollingContent.d.ts +2 -0
- package/dist/src/rlc-common/static/pollingContent.d.ts.map +1 -0
- package/dist/src/rlc-common/static/pollingContent.js +225 -0
- package/dist/src/rlc-common/static/pollingContent.js.map +1 -0
- package/dist/src/rlc-common/static/sampleTemplate.d.ts +2 -0
- package/dist/src/rlc-common/static/sampleTemplate.d.ts.map +1 -0
- package/dist/src/rlc-common/static/sampleTemplate.js +56 -0
- package/dist/src/rlc-common/static/sampleTemplate.js.map +1 -0
- package/dist/src/rlc-common/static/serializeHelper.d.ts +6 -0
- package/dist/src/rlc-common/static/serializeHelper.d.ts.map +1 -0
- package/dist/src/rlc-common/static/serializeHelper.js +31 -0
- package/dist/src/rlc-common/static/serializeHelper.js.map +1 -0
- package/dist/src/rlc-common/test/buildKarmaConfig.d.ts +6 -0
- package/dist/src/rlc-common/test/buildKarmaConfig.d.ts.map +1 -0
- package/dist/src/rlc-common/test/buildKarmaConfig.js +11 -0
- package/dist/src/rlc-common/test/buildKarmaConfig.js.map +1 -0
- package/dist/src/rlc-common/test/buildRecordedClient.d.ts +6 -0
- package/dist/src/rlc-common/test/buildRecordedClient.d.ts.map +1 -0
- package/dist/src/rlc-common/test/buildRecordedClient.js +18 -0
- package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -0
- package/dist/src/rlc-common/test/buildSampleTest.d.ts +6 -0
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -0
- package/dist/src/rlc-common/test/buildSampleTest.js +15 -0
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -0
- package/dist/src/rlc-common/test/buildSnippets.d.ts +6 -0
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -0
- package/dist/src/rlc-common/test/buildSnippets.js +29 -0
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -0
- package/dist/src/rlc-common/test/template.d.ts +5 -0
- package/dist/src/rlc-common/test/template.d.ts.map +1 -0
- package/dist/src/rlc-common/test/template.js +261 -0
- package/dist/src/rlc-common/test/template.js.map +1 -0
- package/dist/src/rlc-common/transformSampleGroups.d.ts +9 -0
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -0
- package/dist/src/rlc-common/transformSampleGroups.js +317 -0
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -0
- 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 +1 -1
- 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 +1 -1
- 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/transformParameters.d.ts +1 -1
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.js +1 -1
- 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/transfromRLCOptions.d.ts +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +1 -3
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.js +1 -1
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +1 -1
- 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 +1 -1
- package/dist/src/utils/emitUtil.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/modelUtils.d.ts +1 -1
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +1 -1
- package/dist/src/utils/modelUtils.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 +1 -1
- 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 +1 -1
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/framework/hooks/binder.ts +142 -51
- package/src/framework/hooks/sdkTypes.ts +1 -1
- package/src/framework/load-static-helpers.ts +1 -1
- package/src/index.ts +5 -1
- package/src/lib.ts +1 -16
- package/src/metaTree.ts +1 -1
- package/src/modular/buildClassicalClient.ts +1 -1
- package/src/modular/buildClassicalOperationGroups.ts +1 -1
- package/src/modular/buildClientContext.ts +1 -1
- package/src/modular/buildOperations.ts +1 -1
- package/src/modular/buildProjectFiles.ts +1 -1
- package/src/modular/buildRestorePoller.ts +1 -1
- package/src/modular/buildRootIndex.ts +1 -1
- package/src/modular/emitModels.ts +1 -1
- package/src/modular/emitModelsOptions.ts +1 -1
- package/src/modular/emitSamples.ts +1 -1
- package/src/modular/emitTests.ts +1 -1
- package/src/modular/helpers/classicalOperationHelpers.ts +1 -1
- package/src/modular/helpers/clientHelpers.ts +1 -1
- package/src/modular/helpers/exampleValueHelpers.ts +1 -1
- package/src/modular/helpers/namingHelpers.ts +1 -1
- package/src/modular/helpers/operationHelpers.ts +65 -42
- package/src/modular/helpers/typeHelpers.ts +1 -1
- package/src/modular/interfaces.ts +1 -1
- package/src/modular/serialization/buildDeserializerFunction.ts +1 -1
- package/src/modular/serialization/buildSerializerFunction.ts +1 -1
- package/src/modular/serialization/buildXmlSerializerFunction.ts +1 -1
- package/src/modular/type-expressions/get-type-expression.ts +1 -1
- package/src/rlc-common/buildClient.ts +561 -0
- package/src/rlc-common/buildClientDefinitions.ts +278 -0
- package/src/rlc-common/buildIndexFile.ts +344 -0
- package/src/rlc-common/buildIsUnexpectedHelper.ts +255 -0
- package/src/rlc-common/buildLogger.ts +43 -0
- package/src/rlc-common/buildMethodShortcuts.ts +83 -0
- package/src/rlc-common/buildObjectTypes.ts +680 -0
- package/src/rlc-common/buildPaginateHelper.ts +34 -0
- package/src/rlc-common/buildParameterTypes.ts +575 -0
- package/src/rlc-common/buildPollingHelper.ts +83 -0
- package/src/rlc-common/buildResponseTypes.ts +203 -0
- package/src/rlc-common/buildSamples.ts +32 -0
- package/src/rlc-common/buildSchemaType.ts +81 -0
- package/src/rlc-common/buildSerializeHelper.ts +49 -0
- package/src/rlc-common/buildTopLevelIndexFile.ts +65 -0
- package/src/rlc-common/helpers/apiVersionUtil.ts +53 -0
- package/src/rlc-common/helpers/importsUtil.ts +187 -0
- package/src/rlc-common/helpers/nameConstructors.ts +144 -0
- package/src/rlc-common/helpers/nameUtils.ts +319 -0
- package/src/rlc-common/helpers/operationHelpers.ts +155 -0
- package/src/rlc-common/helpers/packageUtil.ts +13 -0
- package/src/rlc-common/helpers/pathUtils.ts +15 -0
- package/src/rlc-common/helpers/schemaHelpers.ts +61 -0
- package/src/rlc-common/helpers/shortcutMethods.ts +67 -0
- package/src/rlc-common/helpers/typeUtil.ts +173 -0
- package/src/rlc-common/helpers/valueGenerationUtil.ts +257 -0
- package/src/rlc-common/index.ts +43 -0
- package/src/rlc-common/interfaces.ts +441 -0
- package/src/rlc-common/metadata/buildApiExtractorConfig.ts +71 -0
- package/src/rlc-common/metadata/buildChangelogFile.ts +29 -0
- package/src/rlc-common/metadata/buildESLintConfig.ts +86 -0
- package/src/rlc-common/metadata/buildLicenseFile.ts +33 -0
- package/src/rlc-common/metadata/buildPackageFile.ts +250 -0
- package/src/rlc-common/metadata/buildReadmeFile.ts +528 -0
- package/src/rlc-common/metadata/buildRollupConfig.ts +150 -0
- package/src/rlc-common/metadata/buildSampleEnvFile.ts +22 -0
- package/src/rlc-common/metadata/buildTestConfig.ts +72 -0
- package/src/rlc-common/metadata/buildTsConfig.ts +222 -0
- package/src/rlc-common/metadata/buildVitestConfig.ts +36 -0
- package/src/rlc-common/metadata/buildWarpConfig.ts +94 -0
- package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +161 -0
- package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +220 -0
- package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +134 -0
- package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +70 -0
- package/src/rlc-common/metadata/packageJson/packageCommon.ts +255 -0
- package/src/rlc-common/metadata/utils.ts +8 -0
- package/src/rlc-common/static/paginateContent.ts +345 -0
- package/src/rlc-common/static/pollingContent.ts +225 -0
- package/src/rlc-common/static/sampleTemplate.ts +56 -0
- package/src/rlc-common/static/serializeHelper.ts +34 -0
- package/src/rlc-common/test/buildKarmaConfig.ts +12 -0
- package/src/rlc-common/test/buildRecordedClient.ts +18 -0
- package/src/rlc-common/test/buildSampleTest.ts +15 -0
- package/src/rlc-common/test/buildSnippets.ts +35 -0
- package/src/rlc-common/test/template.ts +263 -0
- package/src/rlc-common/transformSampleGroups.ts +458 -0
- package/src/transform/transform.ts +1 -1
- package/src/transform/transformApiVersionInfo.ts +1 -1
- package/src/transform/transformHelperFunctionDetails.ts +1 -1
- package/src/transform/transformParameters.ts +1 -1
- package/src/transform/transformPaths.ts +1 -1
- package/src/transform/transformResponses.ts +1 -1
- package/src/transform/transformSchemas.ts +1 -1
- package/src/transform/transformTelemetryInfo.ts +1 -1
- package/src/transform/transfromRLCOptions.ts +1 -3
- package/src/utils/clientUtils.ts +1 -1
- package/src/utils/crossLanguageDef.ts +1 -1
- package/src/utils/emitUtil.ts +1 -1
- package/src/utils/interfaces.ts +1 -1
- package/src/utils/modelUtils.ts +1 -1
- package/src/utils/operationUtil.ts +1 -1
- package/src/utils/parameterUtils.ts +1 -1
- package/LICENSE +0 -21
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { generateParameterTypeValue } from "./helpers/valueGenerationUtil.js";
|
|
2
|
+
import { getClientName } from "./helpers/nameConstructors.js";
|
|
3
|
+
import { normalizeName, NameType, camelCase } from "./helpers/nameUtils.js";
|
|
4
|
+
import { buildSchemaObjectMap } from "./helpers/schemaHelpers.js";
|
|
5
|
+
import {
|
|
6
|
+
RLCModel,
|
|
7
|
+
RLCSampleGroup,
|
|
8
|
+
Paths,
|
|
9
|
+
OperationMethod,
|
|
10
|
+
RLCSampleDetail,
|
|
11
|
+
SampleParameters,
|
|
12
|
+
SampleParameter,
|
|
13
|
+
Schema,
|
|
14
|
+
PathMetadata,
|
|
15
|
+
OperationParameter
|
|
16
|
+
} from "./interfaces.js";
|
|
17
|
+
import { isAzurePackage } from "./helpers/packageUtil.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Transform the sample data based RLC detail e.g path, operations & schemas
|
|
21
|
+
* @param model RLC detail
|
|
22
|
+
* @param allowMockValue allow to mock value if not exist, currently we always generate mock value
|
|
23
|
+
* @returns Generated sample data or undefined if not support to generate
|
|
24
|
+
*/
|
|
25
|
+
export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
26
|
+
if (model.options?.multiClient || model.options?.isModularLibrary) {
|
|
27
|
+
// Not support to generate if multiple clients
|
|
28
|
+
// Not support to generate if modular libraries
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (
|
|
32
|
+
(model.sampleGroups && model.sampleGroups.length > 0) ||
|
|
33
|
+
!allowMockValue
|
|
34
|
+
) {
|
|
35
|
+
// Skip to transform if already has sample data
|
|
36
|
+
// Skip to transform if not allow to mock value
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const rlcSampleGroups: RLCSampleGroup[] = [];
|
|
40
|
+
// Get all paths
|
|
41
|
+
const paths: Paths = model.paths;
|
|
42
|
+
const clientName = getClientName(model);
|
|
43
|
+
const clientInterfaceName = clientName.endsWith("Client")
|
|
44
|
+
? `${clientName}`
|
|
45
|
+
: `${clientName}Client`;
|
|
46
|
+
const defaultFactoryName = normalizeName(
|
|
47
|
+
camelCase(`create ${clientInterfaceName}`),
|
|
48
|
+
NameType.Method
|
|
49
|
+
);
|
|
50
|
+
const packageName = model.options?.packageDetails?.name ?? "";
|
|
51
|
+
const methodParameterMap = buildMethodParamMap(model);
|
|
52
|
+
const schemaObjectMap = buildSchemaObjectMap(model);
|
|
53
|
+
for (const path in paths) {
|
|
54
|
+
const pathDetails = paths[path];
|
|
55
|
+
if (!pathDetails) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const methods = pathDetails.methods;
|
|
59
|
+
for (const method in methods) {
|
|
60
|
+
const importedDict: Record<string, Set<string>> = {};
|
|
61
|
+
const methodArray = methods[method];
|
|
62
|
+
if (!methodArray || methodArray.length === 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const detail = methodArray[0];
|
|
66
|
+
if (!detail) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const operatonConcante = getOperationConcate(
|
|
70
|
+
detail.operationName,
|
|
71
|
+
pathDetails.operationGroupName,
|
|
72
|
+
model.options?.sourceFrom
|
|
73
|
+
);
|
|
74
|
+
const operationPrefix = normalizeName(
|
|
75
|
+
camelCase(transformSpecialLetterToSpace(operatonConcante)),
|
|
76
|
+
NameType.Operation
|
|
77
|
+
);
|
|
78
|
+
const sampleGroup: RLCSampleGroup = {
|
|
79
|
+
filename: `${operationPrefix}Sample`,
|
|
80
|
+
defaultFactoryName,
|
|
81
|
+
clientPackageName: packageName,
|
|
82
|
+
samples: []
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// initialize the sample
|
|
86
|
+
const sample: RLCSampleDetail = {
|
|
87
|
+
description: `call operation ${detail.operationName}`,
|
|
88
|
+
name: `${operationPrefix}Sample`,
|
|
89
|
+
path,
|
|
90
|
+
defaultFactoryName,
|
|
91
|
+
clientParamAssignments: [],
|
|
92
|
+
pathParamAssignments: [],
|
|
93
|
+
methodParamAssignments: [],
|
|
94
|
+
clientParamNames: "",
|
|
95
|
+
pathParamNames: "",
|
|
96
|
+
methodParamNames: "",
|
|
97
|
+
method,
|
|
98
|
+
isLRO: detail.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
99
|
+
isPaging: detail.operationHelperDetail?.isPaging ?? false,
|
|
100
|
+
useLegacyLro: false
|
|
101
|
+
};
|
|
102
|
+
// client-level, path-level and method-level parameter preparation
|
|
103
|
+
const parameters: SampleParameters = {
|
|
104
|
+
client: convertClientLevelParameters(
|
|
105
|
+
model,
|
|
106
|
+
importedDict,
|
|
107
|
+
schemaObjectMap
|
|
108
|
+
),
|
|
109
|
+
path: convertPathLevelParameters(pathDetails, path, schemaObjectMap),
|
|
110
|
+
method: convertMethodLevelParameters(
|
|
111
|
+
methodArray,
|
|
112
|
+
schemaObjectMap,
|
|
113
|
+
methodParameterMap.get(operatonConcante)
|
|
114
|
+
)
|
|
115
|
+
};
|
|
116
|
+
// enrich parameter details
|
|
117
|
+
enrichParameterInSample(sample, parameters);
|
|
118
|
+
// enrich LRO and pagination info
|
|
119
|
+
enrichLROAndPagingInSample(detail, importedDict, packageName);
|
|
120
|
+
sampleGroup.samples.push(sample);
|
|
121
|
+
rlcSampleGroups.push(sampleGroup);
|
|
122
|
+
enrichImportedString(
|
|
123
|
+
sampleGroup,
|
|
124
|
+
importedDict,
|
|
125
|
+
defaultFactoryName,
|
|
126
|
+
packageName
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return rlcSampleGroups;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function enrichLROAndPagingInSample(
|
|
134
|
+
operation: OperationMethod,
|
|
135
|
+
importedDict: Record<string, Set<string>>,
|
|
136
|
+
packageName: string
|
|
137
|
+
) {
|
|
138
|
+
const isLRO =
|
|
139
|
+
operation.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
140
|
+
isPaging = operation.operationHelperDetail?.isPaging ?? false;
|
|
141
|
+
if (isPaging) {
|
|
142
|
+
if (isLRO) {
|
|
143
|
+
// TODO: report warning this is not supported
|
|
144
|
+
}
|
|
145
|
+
addValueInImportedDict(packageName, "paginate", importedDict);
|
|
146
|
+
} else if (isLRO) {
|
|
147
|
+
addValueInImportedDict(packageName, "getLongRunningPoller", importedDict);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function transformSpecialLetterToSpace(str: string) {
|
|
152
|
+
if (!str) {
|
|
153
|
+
return str;
|
|
154
|
+
}
|
|
155
|
+
return str
|
|
156
|
+
.replace(/_/g, " ")
|
|
157
|
+
.replace(/\//g, " Or ")
|
|
158
|
+
.replace(/,|\.|\(|\)/g, " ")
|
|
159
|
+
.replace("'s ", " ");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function enrichImportedString(
|
|
163
|
+
sampleGroup: RLCSampleGroup,
|
|
164
|
+
importedDict: Record<string, Set<string>>,
|
|
165
|
+
defaultFactoryName: string,
|
|
166
|
+
packageName: string
|
|
167
|
+
) {
|
|
168
|
+
const importedTypes: string[] = [];
|
|
169
|
+
if (!importedDict[packageName] || importedDict[packageName].size === 0) {
|
|
170
|
+
importedTypes.push(`import ${defaultFactoryName} from "${packageName}";`);
|
|
171
|
+
}
|
|
172
|
+
for (const key in importedDict) {
|
|
173
|
+
const importedSet = importedDict[key];
|
|
174
|
+
if (!importedSet) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const values = Array.from(importedSet).join(", ");
|
|
178
|
+
const hasDefaultFactory =
|
|
179
|
+
key === packageName ? `${defaultFactoryName},` : "";
|
|
180
|
+
importedTypes.push(
|
|
181
|
+
`import ${hasDefaultFactory} { ${values} } from "${key}";`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
sampleGroup.importedTypes = importedTypes;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function enrichParameterInSample(
|
|
188
|
+
sample: RLCSampleDetail,
|
|
189
|
+
parameters: SampleParameters
|
|
190
|
+
) {
|
|
191
|
+
sample.clientParamAssignments = getAssignmentStrArray(parameters.client);
|
|
192
|
+
sample.clientParamNames = getContactParameterNames(parameters.client);
|
|
193
|
+
sample.pathParamAssignments = getAssignmentStrArray(parameters.path);
|
|
194
|
+
sample.pathParamNames = getContactParameterNames(parameters.path);
|
|
195
|
+
// Directly apply the inline option value as method parameter
|
|
196
|
+
sample.methodParamNames =
|
|
197
|
+
parameters.method.length > 0 ? (parameters.method[0]?.value ?? "") : "";
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function getAssignmentStrArray(parameters: SampleParameter[]) {
|
|
201
|
+
return parameters.filter((p) => !!p.assignment).map((p) => p.assignment!);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function getContactParameterNames(parameters: SampleParameter[]) {
|
|
205
|
+
return parameters
|
|
206
|
+
.filter((p) => p.name != null)
|
|
207
|
+
.map((p) => p.name!)
|
|
208
|
+
.join(",");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function convertClientLevelParameters(
|
|
212
|
+
model: RLCModel,
|
|
213
|
+
importedDict: Record<string, Set<string>>,
|
|
214
|
+
schemaMap: Map<string, Schema>
|
|
215
|
+
): SampleParameter[] {
|
|
216
|
+
if (!model.options) {
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
const clientParams: SampleParameter[] = [];
|
|
220
|
+
const urlParameters = model?.urlInfo?.urlParameters?.filter(
|
|
221
|
+
// Do not include parameters with constant values in the signature, these should go in the options bag
|
|
222
|
+
(p) => p.value === undefined
|
|
223
|
+
);
|
|
224
|
+
const {
|
|
225
|
+
addCredentials,
|
|
226
|
+
credentialScopes,
|
|
227
|
+
credentialKeyHeaderName,
|
|
228
|
+
customHttpAuthHeaderName,
|
|
229
|
+
flavor
|
|
230
|
+
} = model.options;
|
|
231
|
+
const hasUrlParameter = !!urlParameters,
|
|
232
|
+
hasCredentials =
|
|
233
|
+
addCredentials &&
|
|
234
|
+
(credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName);
|
|
235
|
+
|
|
236
|
+
if (hasUrlParameter) {
|
|
237
|
+
// convert the host parameters in url
|
|
238
|
+
const clientParamAssignments = urlParameters.map((urlParameter) => {
|
|
239
|
+
const urlValue = generateParameterTypeValue(
|
|
240
|
+
urlParameter.type,
|
|
241
|
+
urlParameter.name,
|
|
242
|
+
schemaMap
|
|
243
|
+
);
|
|
244
|
+
const normalizedName = normalizeName(
|
|
245
|
+
urlParameter.name,
|
|
246
|
+
NameType.Parameter
|
|
247
|
+
);
|
|
248
|
+
return {
|
|
249
|
+
name: normalizedName,
|
|
250
|
+
assignment: `const ${normalizedName} = ` + urlValue + `;`
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
clientParams.push(...clientParamAssignments);
|
|
255
|
+
}
|
|
256
|
+
if (hasCredentials) {
|
|
257
|
+
// Currently only support token credential
|
|
258
|
+
const apiKeyCredentialPackage = isAzurePackage(model)
|
|
259
|
+
? "@azure/core-auth"
|
|
260
|
+
: "@typespec/ts-http-runtime";
|
|
261
|
+
const tokenCredentialPackage = isAzurePackage(model)
|
|
262
|
+
? "@azure/identity"
|
|
263
|
+
: "@typespec/ts-http-runtime";
|
|
264
|
+
if (credentialKeyHeaderName && isAzurePackage(model)) {
|
|
265
|
+
clientParams.push({
|
|
266
|
+
name: "credential",
|
|
267
|
+
assignment: `const credential = new AzureKeyCredential("{Your API key}");`
|
|
268
|
+
});
|
|
269
|
+
addValueInImportedDict(
|
|
270
|
+
apiKeyCredentialPackage,
|
|
271
|
+
"AzureKeyCredential",
|
|
272
|
+
importedDict
|
|
273
|
+
);
|
|
274
|
+
} else if (
|
|
275
|
+
(credentialKeyHeaderName && flavor !== "azure") ||
|
|
276
|
+
customHttpAuthHeaderName
|
|
277
|
+
) {
|
|
278
|
+
clientParams.push({
|
|
279
|
+
name: "credential",
|
|
280
|
+
assignment: `const credential = { key: "{Your API key}"};`
|
|
281
|
+
});
|
|
282
|
+
} else if (isAzurePackage(model)) {
|
|
283
|
+
clientParams.push({
|
|
284
|
+
name: "credential",
|
|
285
|
+
assignment: "const credential = new DefaultAzureCredential();"
|
|
286
|
+
});
|
|
287
|
+
addValueInImportedDict(
|
|
288
|
+
tokenCredentialPackage,
|
|
289
|
+
"DefaultAzureCredential",
|
|
290
|
+
importedDict
|
|
291
|
+
);
|
|
292
|
+
} else {
|
|
293
|
+
clientParams.push({
|
|
294
|
+
name: "credential",
|
|
295
|
+
assignment: `const credential = {getToken: () => Promise.resolve({ token: "{Your token}", expiresOnTimestamp: 0 })};`
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return clientParams;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function convertPathLevelParameters(
|
|
303
|
+
pathDetail: PathMetadata,
|
|
304
|
+
path: string,
|
|
305
|
+
schemaMap: Map<string, Schema>
|
|
306
|
+
): SampleParameter[] {
|
|
307
|
+
const pathItself = {
|
|
308
|
+
name: `"${path}"`
|
|
309
|
+
};
|
|
310
|
+
const pathParams = (pathDetail || []).pathParameters.map((p) => {
|
|
311
|
+
const pathParam: SampleParameter = {
|
|
312
|
+
name: normalizeName(p.name, NameType.Parameter)
|
|
313
|
+
};
|
|
314
|
+
const value = generateParameterTypeValue(p.type, p.name, schemaMap);
|
|
315
|
+
pathParam.assignment = `const ${pathParam.name} =` + value + `;`;
|
|
316
|
+
return pathParam;
|
|
317
|
+
});
|
|
318
|
+
return [pathItself].concat(pathParams);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function convertMethodLevelParameters(
|
|
322
|
+
methods: OperationMethod[],
|
|
323
|
+
schemaMap: Map<string, Schema>,
|
|
324
|
+
operationParameter?: OperationParameter
|
|
325
|
+
): SampleParameter[] {
|
|
326
|
+
if (
|
|
327
|
+
!methods ||
|
|
328
|
+
methods.length === 0 ||
|
|
329
|
+
!operationParameter ||
|
|
330
|
+
operationParameter.parameters.length === 0
|
|
331
|
+
) {
|
|
332
|
+
return [];
|
|
333
|
+
}
|
|
334
|
+
const rawMethodParams = operationParameter.parameters;
|
|
335
|
+
const method = methods[0];
|
|
336
|
+
const requestParameter = rawMethodParams[0];
|
|
337
|
+
if (!method || !requestParameter) {
|
|
338
|
+
return [];
|
|
339
|
+
}
|
|
340
|
+
const hasInputParams = !!rawMethodParams && rawMethodParams.length > 0,
|
|
341
|
+
requireParam = !method.hasOptionalOptions;
|
|
342
|
+
if (!hasInputParams && !requireParam) {
|
|
343
|
+
return [];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const allSideAssignments = [],
|
|
347
|
+
querySideAssignments: string[] = [],
|
|
348
|
+
headerSideAssignments: string[] = [];
|
|
349
|
+
if (
|
|
350
|
+
!!requestParameter.body &&
|
|
351
|
+
requestParameter.body &&
|
|
352
|
+
requestParameter.body.body &&
|
|
353
|
+
requestParameter.body.body?.length > 0
|
|
354
|
+
) {
|
|
355
|
+
const body = requestParameter.body.body[0];
|
|
356
|
+
if (body) {
|
|
357
|
+
const bodyTypeName = body.typeName ?? body.type;
|
|
358
|
+
if (bodyTypeName !== "string" && body.oriSchema) {
|
|
359
|
+
schemaMap.set(bodyTypeName, body.oriSchema);
|
|
360
|
+
}
|
|
361
|
+
allSideAssignments.push(
|
|
362
|
+
` body: ` + generateParameterTypeValue(bodyTypeName, "body", schemaMap)
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
requestParameter.parameters
|
|
368
|
+
?.filter((p) => p.type === "query")
|
|
369
|
+
.forEach((p) => {
|
|
370
|
+
const name = `${p.name}`;
|
|
371
|
+
querySideAssignments.push(
|
|
372
|
+
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap)
|
|
373
|
+
);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
if (querySideAssignments.length > 0) {
|
|
377
|
+
allSideAssignments.push(
|
|
378
|
+
` queryParameters: { ` + querySideAssignments.join(", ") + `}`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
requestParameter.parameters
|
|
382
|
+
?.filter((p) => p.type === "header")
|
|
383
|
+
.filter((p) => p.name.toLowerCase() !== "contenttype")
|
|
384
|
+
.forEach((p) => {
|
|
385
|
+
const name = `${p.name}`;
|
|
386
|
+
headerSideAssignments.push(
|
|
387
|
+
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap)
|
|
388
|
+
);
|
|
389
|
+
});
|
|
390
|
+
if (headerSideAssignments.length > 0) {
|
|
391
|
+
allSideAssignments.push(
|
|
392
|
+
` headers: { ` + headerSideAssignments.join(", ") + `}`
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
const contentType = requestParameter.parameters
|
|
396
|
+
?.filter((p) => p.type === "header")
|
|
397
|
+
.filter((p) => p.name.toLowerCase() === "contenttype");
|
|
398
|
+
const firstContentType = contentType?.[0];
|
|
399
|
+
if (firstContentType) {
|
|
400
|
+
allSideAssignments.push(
|
|
401
|
+
` ${firstContentType.name}: ` +
|
|
402
|
+
generateParameterTypeValue(
|
|
403
|
+
firstContentType.param.type,
|
|
404
|
+
firstContentType.name,
|
|
405
|
+
schemaMap
|
|
406
|
+
)
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
let value: string = `{}`;
|
|
410
|
+
if (allSideAssignments.length > 0) {
|
|
411
|
+
value = `{ ` + allSideAssignments.join(", ") + `}`;
|
|
412
|
+
} else {
|
|
413
|
+
return [];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const optionParam: SampleParameter = {
|
|
417
|
+
name: "options",
|
|
418
|
+
assignment: `const options =` + value + `;`,
|
|
419
|
+
value
|
|
420
|
+
};
|
|
421
|
+
return [optionParam];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function addValueInImportedDict(
|
|
425
|
+
key: string,
|
|
426
|
+
val: string,
|
|
427
|
+
importedDict: Record<string, Set<string>>
|
|
428
|
+
) {
|
|
429
|
+
if (!importedDict[key]) {
|
|
430
|
+
importedDict[key] = new Set<string>();
|
|
431
|
+
}
|
|
432
|
+
importedDict[key].add(val);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function buildMethodParamMap(model: RLCModel): Map<string, OperationParameter> {
|
|
436
|
+
const map = new Map<string, OperationParameter>();
|
|
437
|
+
(model.parameters ?? []).forEach((p) => {
|
|
438
|
+
const operatonConcante = getOperationConcate(
|
|
439
|
+
p.operationName,
|
|
440
|
+
p.operationGroup,
|
|
441
|
+
model.options?.sourceFrom
|
|
442
|
+
);
|
|
443
|
+
map.set(operatonConcante, p);
|
|
444
|
+
});
|
|
445
|
+
return map;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getOperationConcate(
|
|
449
|
+
opName: string,
|
|
450
|
+
opGroup: string,
|
|
451
|
+
sourceFrom?: string
|
|
452
|
+
) {
|
|
453
|
+
return sourceFrom === "Swagger"
|
|
454
|
+
? opGroup === "" || opGroup === "Client"
|
|
455
|
+
? opName
|
|
456
|
+
: `${opGroup}${opName}`
|
|
457
|
+
: `${opGroup}_${opName}`;
|
|
458
|
+
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
SchemaContext,
|
|
18
18
|
transformSampleGroups,
|
|
19
19
|
UrlInfo
|
|
20
|
-
} from "
|
|
20
|
+
} from "../rlc-common/index.js";
|
|
21
21
|
import { SdkClient } from "@azure-tools/typespec-client-generator-core";
|
|
22
22
|
import { getDoc } from "@typespec/compiler";
|
|
23
23
|
import { getServers } from "@typespec/http";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
trimUsage
|
|
18
18
|
} from "../utils/modelUtils.js";
|
|
19
19
|
|
|
20
|
-
import { SchemaContext } from "
|
|
20
|
+
import { SchemaContext } from "../rlc-common/index.js";
|
|
21
21
|
import { SdkContext } from "../utils/interfaces.js";
|
|
22
22
|
import { useContext } from "../contextManager.js";
|
|
23
23
|
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
PackageFlavor,
|
|
7
7
|
RLCOptions,
|
|
8
8
|
ServiceInfo
|
|
9
|
-
} from "
|
|
9
|
+
} from "../rlc-common/index.js";
|
|
10
10
|
import { getHttpOperationWithCache } from "@azure-tools/typespec-client-generator-core";
|
|
11
11
|
import { getDoc, NoTarget, Program } from "@typespec/compiler";
|
|
12
12
|
import { getAuthentication } from "@typespec/http";
|
|
@@ -95,7 +95,6 @@ function extractRLCOptions(
|
|
|
95
95
|
const enableStorageCompat = emitterOptions["enable-storage-compat"] === true;
|
|
96
96
|
const treatUnknownAsRecord =
|
|
97
97
|
emitterOptions["treat-unknown-as-record"] === true;
|
|
98
|
-
const headAsBoolean = emitterOptions["head-as-boolean"] === true;
|
|
99
98
|
const typespecTitleMap = emitterOptions["typespec-title-map"];
|
|
100
99
|
const generateReactNativeTarget =
|
|
101
100
|
emitterOptions["generate-react-native-target"] === true;
|
|
@@ -145,7 +144,6 @@ function extractRLCOptions(
|
|
|
145
144
|
isMultiService,
|
|
146
145
|
enableStorageCompat,
|
|
147
146
|
treatUnknownAsRecord,
|
|
148
|
-
headAsBoolean,
|
|
149
147
|
generateReactNativeTarget
|
|
150
148
|
};
|
|
151
149
|
}
|
package/src/utils/clientUtils.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "@typespec/compiler";
|
|
17
17
|
import { SdkContext } from "./interfaces.js";
|
|
18
18
|
import { ModularClientOptions } from "../modular/interfaces.js";
|
|
19
|
-
import { NameType, normalizeName } from "
|
|
19
|
+
import { NameType, normalizeName } from "../rlc-common/index.js";
|
|
20
20
|
|
|
21
21
|
export function getRLCClients(
|
|
22
22
|
dpgContext: SdkContext,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { SdkContext } from "./interfaces.js";
|
|
5
5
|
import { transformModularEmitterOptions } from "../modular/buildModularOptions.js";
|
|
6
6
|
import { getMethodHierarchiesMap } from "./operationUtil.js";
|
|
7
|
-
import { NameType, normalizeName } from "
|
|
7
|
+
import { NameType, normalizeName } from "../rlc-common/index.js";
|
|
8
8
|
import { UsageFlags } from "@azure-tools/typespec-client-generator-core";
|
|
9
9
|
|
|
10
10
|
export function generateCrossLanguageDefinitionFile(dpgContext: SdkContext): {
|
package/src/utils/emitUtil.ts
CHANGED
package/src/utils/interfaces.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RLCOptions, SchemaContext } from "
|
|
1
|
+
import { RLCOptions, SchemaContext } from "../rlc-common/index.js";
|
|
2
2
|
import { SdkContext as TCGCSdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
3
3
|
import { ModelProperty, Namespace } from "@typespec/compiler";
|
|
4
4
|
import { KnownMediaType } from "./mediaTypes.js";
|
package/src/utils/modelUtils.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
normalizeName,
|
|
4
4
|
Schema,
|
|
5
5
|
SchemaContext
|
|
6
|
-
} from "
|
|
6
|
+
} from "../rlc-common/index.js";
|
|
7
7
|
import { HttpOperationParameter } from "@typespec/http";
|
|
8
8
|
import { getTypeName, isArrayType, isObjectOrDictType } from "./modelUtils.js";
|
|
9
9
|
import { SdkContext } from "./interfaces.js";
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE
|