@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,144 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { RLCModel } from "../interfaces.js";
|
|
5
|
+
import { NameType, normalizeName } from "./nameUtils.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get the response type name by baseName or operatioName & statusCode
|
|
9
|
+
* @param baseResponseName
|
|
10
|
+
*/
|
|
11
|
+
export function getResponseTypeName(baseResponseName: string): string;
|
|
12
|
+
export function getResponseTypeName(
|
|
13
|
+
operationGroup: string,
|
|
14
|
+
operationName: string,
|
|
15
|
+
statusCode: string
|
|
16
|
+
): string;
|
|
17
|
+
export function getResponseTypeName(
|
|
18
|
+
baseNameOrOperationGroup: string,
|
|
19
|
+
operationName?: string,
|
|
20
|
+
statusCode?: string
|
|
21
|
+
): string {
|
|
22
|
+
if (operationName) {
|
|
23
|
+
baseNameOrOperationGroup = getResponseBaseName(
|
|
24
|
+
baseNameOrOperationGroup,
|
|
25
|
+
operationName!,
|
|
26
|
+
statusCode || ""
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return normalizeName(
|
|
30
|
+
`${baseNameOrOperationGroup}Response`,
|
|
31
|
+
NameType.Interface
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getLroLogicalResponseName(
|
|
36
|
+
operationGroup: string,
|
|
37
|
+
operationName: string
|
|
38
|
+
) {
|
|
39
|
+
return normalizeName(
|
|
40
|
+
`${operationGroup}_${operationName}_Logical_Response`,
|
|
41
|
+
NameType.Interface
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The prefix of all response types
|
|
47
|
+
* @param operationGroup operation group name e.g string_PutEmpty
|
|
48
|
+
* @param operationName operation name D e.g string_PutEmpty
|
|
49
|
+
* @param statusCode 2XX, 4XX, 5XX, default etc.
|
|
50
|
+
* @returns normolized base name e.g StringPutEmpty200
|
|
51
|
+
*/
|
|
52
|
+
export function getResponseBaseName(
|
|
53
|
+
operationGroup: string,
|
|
54
|
+
operationName: string,
|
|
55
|
+
statusCode: string
|
|
56
|
+
) {
|
|
57
|
+
return normalizeName(
|
|
58
|
+
`${operationGroup}_${normalizeName(
|
|
59
|
+
operationName,
|
|
60
|
+
NameType.Interface,
|
|
61
|
+
true
|
|
62
|
+
)}_${statusCode}`,
|
|
63
|
+
NameType.Interface
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The prefix of all parameter relevant types
|
|
69
|
+
* @param operationName is composed with operationGroup and operationID e.g string_PutEmpty
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
export function getParameterBaseName(
|
|
73
|
+
operationGroup: string,
|
|
74
|
+
operationName: string
|
|
75
|
+
) {
|
|
76
|
+
return normalizeName(
|
|
77
|
+
`${operationGroup}_${operationName}`,
|
|
78
|
+
NameType.Interface
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get the top-layer parameter name
|
|
84
|
+
* @param operationGroup operation group name
|
|
85
|
+
* @param operationName is composed with operationGroup and operationID e.g string_PutEmpty
|
|
86
|
+
* @returns top-layer parameter name e.g StringPutEmptParameters
|
|
87
|
+
*/
|
|
88
|
+
export function getParameterTypeName(baseName: string): string;
|
|
89
|
+
export function getParameterTypeName(
|
|
90
|
+
operationGroup: string,
|
|
91
|
+
operationName: string
|
|
92
|
+
): string;
|
|
93
|
+
export function getParameterTypeName(
|
|
94
|
+
baseNameOrOperationGroup: string,
|
|
95
|
+
operationName?: string
|
|
96
|
+
) {
|
|
97
|
+
if (operationName) {
|
|
98
|
+
baseNameOrOperationGroup = getParameterBaseName(
|
|
99
|
+
baseNameOrOperationGroup,
|
|
100
|
+
operationName!
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return normalizeName(
|
|
105
|
+
`${baseNameOrOperationGroup}_Parameters`,
|
|
106
|
+
NameType.Interface
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ModuleName {
|
|
111
|
+
esModulesName: string;
|
|
112
|
+
cjsName: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* This is a helper function that gets the right import module depending on the type of
|
|
116
|
+
* library being generated
|
|
117
|
+
*/
|
|
118
|
+
export function getImportModuleName(name: ModuleName, codeModel: RLCModel) {
|
|
119
|
+
if (codeModel.options?.moduleKind === "cjs") {
|
|
120
|
+
return name.cjsName;
|
|
121
|
+
}
|
|
122
|
+
return name.esModulesName;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function getClientName(model: RLCModel) {
|
|
126
|
+
const clientName = model.libraryName;
|
|
127
|
+
const clientInterfaceName = model.options?.isModularLibrary
|
|
128
|
+
? model.libraryName
|
|
129
|
+
: clientName.endsWith("Client")
|
|
130
|
+
? `${clientName}`
|
|
131
|
+
: `${clientName}Client`;
|
|
132
|
+
|
|
133
|
+
return clientInterfaceName;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function getMultipartPartTypeName(schemaName: string, partName: string) {
|
|
137
|
+
const name = normalizeName(partName, NameType.Interface);
|
|
138
|
+
const bodyParamName = normalizeName(schemaName, NameType.Interface);
|
|
139
|
+
|
|
140
|
+
return normalizeName(
|
|
141
|
+
`${bodyParamName}_${name}_PartDescriptor`,
|
|
142
|
+
NameType.Interface
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
export interface NormalizeNameOption {
|
|
5
|
+
shouldGuard?: boolean;
|
|
6
|
+
customReservedNames?: ReservedName[];
|
|
7
|
+
casingOverride?: CasingConvention;
|
|
8
|
+
numberPrefixOverride?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ReservedName {
|
|
12
|
+
name: string;
|
|
13
|
+
reservedFor: NameType[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum NameType {
|
|
17
|
+
Class,
|
|
18
|
+
File,
|
|
19
|
+
Interface,
|
|
20
|
+
Property,
|
|
21
|
+
Parameter,
|
|
22
|
+
Operation,
|
|
23
|
+
OperationGroup,
|
|
24
|
+
Method,
|
|
25
|
+
EnumMemberName
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Newable = [NameType.Class, NameType.Interface, NameType.OperationGroup];
|
|
29
|
+
|
|
30
|
+
export const ReservedModelNames: ReservedName[] = [
|
|
31
|
+
{ name: "any", reservedFor: [NameType.Parameter] },
|
|
32
|
+
{ name: "as", reservedFor: [NameType.Parameter] },
|
|
33
|
+
{ name: "assert", reservedFor: [NameType.Parameter] },
|
|
34
|
+
{ name: "async", reservedFor: [NameType.Parameter] },
|
|
35
|
+
{ name: "await", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
36
|
+
{ name: "boolean", reservedFor: [NameType.Parameter, ...Newable] },
|
|
37
|
+
{ name: "break", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
38
|
+
{ name: "case", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
39
|
+
{ name: "catch", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
40
|
+
{ name: "class", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
41
|
+
{ name: "const", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
42
|
+
{ name: "constructor", reservedFor: [NameType.Parameter] },
|
|
43
|
+
{ name: "continue", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
44
|
+
{ name: "date", reservedFor: [NameType.Parameter, ...Newable] },
|
|
45
|
+
{ name: "debugger", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
46
|
+
{ name: "declare", reservedFor: [NameType.Parameter] },
|
|
47
|
+
{ name: "default", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
48
|
+
{
|
|
49
|
+
name: "delete",
|
|
50
|
+
reservedFor: [NameType.Parameter, NameType.Operation, NameType.Method]
|
|
51
|
+
},
|
|
52
|
+
{ name: "do", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
53
|
+
{ name: "else", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
54
|
+
{ name: "enum", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
55
|
+
{ name: "error", reservedFor: [NameType.Parameter, ...Newable] },
|
|
56
|
+
{
|
|
57
|
+
name: "export",
|
|
58
|
+
reservedFor: [NameType.Parameter, NameType.Operation, NameType.Method]
|
|
59
|
+
},
|
|
60
|
+
{ name: "extends", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
61
|
+
{ name: "false", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
62
|
+
{ name: "finally", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
63
|
+
{ name: "for", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
64
|
+
{ name: "from", reservedFor: [NameType.Parameter] },
|
|
65
|
+
{
|
|
66
|
+
name: "function",
|
|
67
|
+
reservedFor: [NameType.Parameter, ...Newable, NameType.Method]
|
|
68
|
+
},
|
|
69
|
+
{ name: "get", reservedFor: [NameType.Parameter] },
|
|
70
|
+
{ name: "if", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
71
|
+
{ name: "implements", reservedFor: [NameType.Parameter] },
|
|
72
|
+
{ name: "import", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
73
|
+
{ name: "in", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
74
|
+
{ name: "instanceof", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
75
|
+
{ name: "interface", reservedFor: [NameType.Parameter] },
|
|
76
|
+
{ name: "let", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
77
|
+
{ name: "module", reservedFor: [NameType.Parameter] },
|
|
78
|
+
{ name: "new", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
79
|
+
{ name: "null", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
80
|
+
{ name: "number", reservedFor: [NameType.Parameter, ...Newable] },
|
|
81
|
+
{ name: "of", reservedFor: [NameType.Parameter] },
|
|
82
|
+
{ name: "package", reservedFor: [NameType.Parameter] },
|
|
83
|
+
{ name: "private", reservedFor: [NameType.Parameter] },
|
|
84
|
+
{ name: "protected", reservedFor: [NameType.Parameter] },
|
|
85
|
+
{
|
|
86
|
+
name: "public",
|
|
87
|
+
reservedFor: [NameType.Parameter, NameType.Operation, NameType.Method]
|
|
88
|
+
},
|
|
89
|
+
{ name: "requestoptions", reservedFor: [NameType.Parameter] },
|
|
90
|
+
{ name: "require", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
91
|
+
{ name: "return", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
92
|
+
{ name: "set", reservedFor: [NameType.Parameter, ...Newable] },
|
|
93
|
+
{ name: "static", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
94
|
+
{ name: "string", reservedFor: [NameType.Parameter, ...Newable] },
|
|
95
|
+
{ name: "super", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
96
|
+
{ name: "switch", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
97
|
+
{ name: "symbol", reservedFor: [NameType.Parameter, ...Newable] },
|
|
98
|
+
{ name: "this", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
99
|
+
{ name: "throw", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
100
|
+
{ name: "true", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
101
|
+
{ name: "try", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
102
|
+
{ name: "type", reservedFor: [NameType.Parameter] },
|
|
103
|
+
{ name: "typeof", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
104
|
+
{ name: "var", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
105
|
+
{ name: "void", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
106
|
+
{ name: "while", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
107
|
+
{ name: "with", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
108
|
+
{ name: "yield", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
109
|
+
{ name: "arguments", reservedFor: [NameType.Parameter, NameType.Method] },
|
|
110
|
+
{ name: "global", reservedFor: [...Newable] },
|
|
111
|
+
// reserve client for codegen
|
|
112
|
+
{ name: "client", reservedFor: [NameType.Parameter] },
|
|
113
|
+
{ name: "endpoint", reservedFor: [NameType.Parameter] },
|
|
114
|
+
{ name: "apiVersion", reservedFor: [NameType.Parameter] }
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
export enum CasingConvention {
|
|
118
|
+
Pascal,
|
|
119
|
+
Camel
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function guardReservedNames(
|
|
123
|
+
name: string,
|
|
124
|
+
nameType: NameType,
|
|
125
|
+
customReservedNames: ReservedName[] = []
|
|
126
|
+
): string {
|
|
127
|
+
const [prefix, suffix] = getAffix(nameType);
|
|
128
|
+
return [...ReservedModelNames, ...customReservedNames]
|
|
129
|
+
.filter((r) => r.reservedFor.includes(nameType))
|
|
130
|
+
.find((r) => r.name === name.toLowerCase())
|
|
131
|
+
? `${prefix}${name}${suffix}`
|
|
132
|
+
: name;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function getAffix(nameType?: NameType): [string, string] {
|
|
136
|
+
switch (nameType) {
|
|
137
|
+
case NameType.File:
|
|
138
|
+
case NameType.Operation:
|
|
139
|
+
return ["", ""];
|
|
140
|
+
case NameType.Property:
|
|
141
|
+
return ["", "Property"];
|
|
142
|
+
case NameType.OperationGroup:
|
|
143
|
+
return ["", "Operations"];
|
|
144
|
+
case NameType.Parameter:
|
|
145
|
+
return ["", "Param"];
|
|
146
|
+
case NameType.Method:
|
|
147
|
+
return ["$", ""];
|
|
148
|
+
case NameType.Class:
|
|
149
|
+
case NameType.Interface:
|
|
150
|
+
default:
|
|
151
|
+
return ["", "Model"];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function normalizeName(
|
|
156
|
+
name: string,
|
|
157
|
+
nameType: NameType,
|
|
158
|
+
shouldGuard?: boolean,
|
|
159
|
+
customReservedNames?: ReservedName[],
|
|
160
|
+
casingOverride?: CasingConvention,
|
|
161
|
+
oriName?: string
|
|
162
|
+
): string;
|
|
163
|
+
export function normalizeName(
|
|
164
|
+
name: string,
|
|
165
|
+
nameType: NameType,
|
|
166
|
+
options?: NormalizeNameOption
|
|
167
|
+
): string;
|
|
168
|
+
export function normalizeName(
|
|
169
|
+
name: string,
|
|
170
|
+
nameType: NameType,
|
|
171
|
+
optionsOrShouldGuard?: NormalizeNameOption | boolean,
|
|
172
|
+
optionalCustomReservedNames?: ReservedName[],
|
|
173
|
+
optionalCasingOverride?: CasingConvention,
|
|
174
|
+
oriName?: string
|
|
175
|
+
): string {
|
|
176
|
+
let shouldGuard: boolean | undefined,
|
|
177
|
+
customReservedNames: ReservedName[],
|
|
178
|
+
casingOverride: CasingConvention | undefined,
|
|
179
|
+
numberPrefixOverride: string | undefined;
|
|
180
|
+
if (typeof optionsOrShouldGuard === "boolean") {
|
|
181
|
+
shouldGuard = optionsOrShouldGuard;
|
|
182
|
+
customReservedNames = optionalCustomReservedNames ?? [];
|
|
183
|
+
casingOverride = optionalCasingOverride;
|
|
184
|
+
} else {
|
|
185
|
+
shouldGuard = optionsOrShouldGuard?.shouldGuard;
|
|
186
|
+
customReservedNames = optionsOrShouldGuard?.customReservedNames ?? [];
|
|
187
|
+
casingOverride = optionsOrShouldGuard?.casingOverride;
|
|
188
|
+
numberPrefixOverride = optionsOrShouldGuard?.numberPrefixOverride;
|
|
189
|
+
}
|
|
190
|
+
if ((oriName ?? name).startsWith("$DO_NOT_NORMALIZE$")) {
|
|
191
|
+
return (oriName ?? name).replace("$DO_NOT_NORMALIZE$", "");
|
|
192
|
+
}
|
|
193
|
+
const casingConvention = casingOverride ?? getCasingConvention(nameType);
|
|
194
|
+
const parts = deconstruct(name);
|
|
195
|
+
if (parts.length === 0) {
|
|
196
|
+
return name;
|
|
197
|
+
}
|
|
198
|
+
const [firstPart, ...otherParts] = parts;
|
|
199
|
+
const normalizedFirstPart = toCasing(firstPart ?? "", casingConvention, true);
|
|
200
|
+
const normalizedParts = (otherParts || [])
|
|
201
|
+
.map((part) => toCasing(part, CasingConvention.Pascal))
|
|
202
|
+
.join("");
|
|
203
|
+
|
|
204
|
+
const normalized = `${normalizedFirstPart}${normalizedParts}`;
|
|
205
|
+
const result = shouldGuard
|
|
206
|
+
? guardReservedNames(normalized, nameType, customReservedNames)
|
|
207
|
+
: normalized;
|
|
208
|
+
return fixLeadingNumber(result, nameType, numberPrefixOverride);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function fixLeadingNumber(
|
|
212
|
+
name: string,
|
|
213
|
+
nameType: NameType,
|
|
214
|
+
prefix: string = "_"
|
|
215
|
+
): string {
|
|
216
|
+
const casingConvention = getCasingConvention(nameType);
|
|
217
|
+
if (!name || !name.match(/^[-.]?\d/)) {
|
|
218
|
+
return name;
|
|
219
|
+
}
|
|
220
|
+
return `${toCasing(prefix, casingConvention)}${name}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function isFullyUpperCase(
|
|
224
|
+
identifier: string,
|
|
225
|
+
maxUppercasePreserve: number = 3
|
|
226
|
+
) {
|
|
227
|
+
const len = identifier.length;
|
|
228
|
+
if (len > 1) {
|
|
229
|
+
if (
|
|
230
|
+
len <= maxUppercasePreserve &&
|
|
231
|
+
identifier === identifier.toUpperCase()
|
|
232
|
+
) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (len <= maxUppercasePreserve + 1 && identifier.endsWith("s")) {
|
|
237
|
+
const i = identifier.substring(0, len - 1);
|
|
238
|
+
if (i.toUpperCase() === i) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function deconstruct(identifier: string): Array<string> {
|
|
247
|
+
return `${identifier}`
|
|
248
|
+
.replace(/([a-z]+)([A-Z])/g, "$1 $2") // Add a space in between camelCase words(e.g. fooBar => foo Bar)
|
|
249
|
+
.replace(/(\d+)/g, " $1 ") // Adds a space after numbers(e.g. foo123Bar => foo123 bar)
|
|
250
|
+
.replace(/_/g, " ") // Replace underscores with spaces
|
|
251
|
+
.replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, "$1$2« $3$4") // Add a space after a plural upper cased word(e.g. MBsFoo => MBs Foo)
|
|
252
|
+
.replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, "$1 $2$3") // Add a space between an upper case word(2 char+) and the last captial case.(e.g. SQLConnection -> SQL Connection)
|
|
253
|
+
.replace(/«/g, "s")
|
|
254
|
+
.trim()
|
|
255
|
+
.split(/[\W|_]+/)
|
|
256
|
+
.map((each) => (isFullyUpperCase(each) ? each : each.toLowerCase()))
|
|
257
|
+
.filter((part) => !!part);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function getModelsName(title: string): string {
|
|
261
|
+
const spaceRemovedTitle = title.replace(/ /g, "");
|
|
262
|
+
return `${spaceRemovedTitle.replace("Client", "")}Models`;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function getMappersName(title: string): string {
|
|
266
|
+
const spaceRemovedTitle = title.replace(/ /g, "");
|
|
267
|
+
return `${spaceRemovedTitle.replace("Client", "")}Mappers`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function getCasingConvention(nameType: NameType) {
|
|
271
|
+
switch (nameType) {
|
|
272
|
+
case NameType.Class:
|
|
273
|
+
case NameType.Interface:
|
|
274
|
+
case NameType.OperationGroup:
|
|
275
|
+
case NameType.EnumMemberName:
|
|
276
|
+
return CasingConvention.Pascal;
|
|
277
|
+
case NameType.File:
|
|
278
|
+
case NameType.Property:
|
|
279
|
+
case NameType.Operation:
|
|
280
|
+
case NameType.Parameter:
|
|
281
|
+
case NameType.Method:
|
|
282
|
+
return CasingConvention.Camel;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function toCasing(
|
|
287
|
+
str: string,
|
|
288
|
+
casing: CasingConvention,
|
|
289
|
+
keepConsistent = false
|
|
290
|
+
): string {
|
|
291
|
+
const firstChar =
|
|
292
|
+
casing === CasingConvention.Pascal
|
|
293
|
+
? str.charAt(0).toUpperCase()
|
|
294
|
+
: str.charAt(0).toLowerCase();
|
|
295
|
+
const allLowerCases =
|
|
296
|
+
casing !== CasingConvention.Pascal &&
|
|
297
|
+
keepConsistent &&
|
|
298
|
+
str.toUpperCase() === str;
|
|
299
|
+
return allLowerCases ? str.toLowerCase() : `${firstChar}${str.substring(1)}`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function pascalCase(str: string) {
|
|
303
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export function camelCase(
|
|
307
|
+
str: string,
|
|
308
|
+
options: { uppercaseThreshold?: number } = {}
|
|
309
|
+
) {
|
|
310
|
+
const { uppercaseThreshold = 4 } = options;
|
|
311
|
+
const thresholdRegex = new RegExp(
|
|
312
|
+
`^(?<![A-Z])[A-Z]{1,${uppercaseThreshold}}(?![A-Z])`
|
|
313
|
+
);
|
|
314
|
+
if (!thresholdRegex.test(str)) {
|
|
315
|
+
return str;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
319
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
MethodSignatureStructure,
|
|
6
|
+
OptionalKind,
|
|
7
|
+
ParameterDeclarationStructure
|
|
8
|
+
} from "ts-morph";
|
|
9
|
+
import {
|
|
10
|
+
Methods,
|
|
11
|
+
ObjectSchema,
|
|
12
|
+
ParameterMetadata,
|
|
13
|
+
PathParameter,
|
|
14
|
+
RLCModel,
|
|
15
|
+
Schema,
|
|
16
|
+
SchemaContext
|
|
17
|
+
} from "../interfaces.js";
|
|
18
|
+
import { NameType, normalizeName, pascalCase } from "./nameUtils.js";
|
|
19
|
+
import { isObjectSchema } from "./schemaHelpers.js";
|
|
20
|
+
|
|
21
|
+
export function buildMethodDefinitions(
|
|
22
|
+
methods: Methods,
|
|
23
|
+
pathParams: PathParameter[] = []
|
|
24
|
+
): OptionalKind<MethodSignatureStructure>[] {
|
|
25
|
+
const methodDefinitions: OptionalKind<MethodSignatureStructure>[] = [];
|
|
26
|
+
for (const key of Object.keys(methods)) {
|
|
27
|
+
const verbMethods = methods[key];
|
|
28
|
+
if (!verbMethods) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
for (const method of verbMethods) {
|
|
32
|
+
const description = method.description;
|
|
33
|
+
const areAllOptional = method.hasOptionalOptions;
|
|
34
|
+
|
|
35
|
+
methodDefinitions.push({
|
|
36
|
+
name: key,
|
|
37
|
+
...(description && { docs: [{ description }] }),
|
|
38
|
+
parameters: [
|
|
39
|
+
...getPathParamDefinitions(pathParams),
|
|
40
|
+
{
|
|
41
|
+
name: "options",
|
|
42
|
+
hasQuestionToken: areAllOptional,
|
|
43
|
+
type: pascalCase(method.optionsName)
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
returnType: `StreamableMethod<${method.returnType}>`
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return methodDefinitions;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function getPathParamDefinitions(
|
|
55
|
+
pathParams: PathParameter[]
|
|
56
|
+
): OptionalKind<ParameterDeclarationStructure>[] {
|
|
57
|
+
return pathParams.map(({ name, type, description }) => {
|
|
58
|
+
return {
|
|
59
|
+
name: normalizeName(name, NameType.Parameter),
|
|
60
|
+
type,
|
|
61
|
+
description
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function hasPagingOperations(model: RLCModel) {
|
|
67
|
+
return Boolean(model.helperDetails?.hasPaging);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function hasPollingOperations(model: RLCModel) {
|
|
71
|
+
return Boolean(model.helperDetails?.hasLongRunning);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function hasMultiCollection(model: RLCModel) {
|
|
75
|
+
return Boolean(model.helperDetails?.hasMultiCollection);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function hasPipeCollection(model: RLCModel) {
|
|
79
|
+
return Boolean(model.helperDetails?.hasPipeCollection);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function hasSsvCollection(model: RLCModel) {
|
|
83
|
+
return Boolean(model.helperDetails?.hasSsvCollection);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function hasTsvCollection(model: RLCModel) {
|
|
87
|
+
return Boolean(model.helperDetails?.hasTsvCollection);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function hasCsvCollection(model: RLCModel) {
|
|
91
|
+
return Boolean(model.helperDetails?.hasCsvCollection);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function hasUnexpectedHelper(model: RLCModel) {
|
|
95
|
+
const pathDictionary = model.paths;
|
|
96
|
+
for (const details of Object.values(pathDictionary)) {
|
|
97
|
+
for (const methodDetails of Object.values(details.methods)) {
|
|
98
|
+
const firstMethod = methodDetails[0];
|
|
99
|
+
if (!firstMethod) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const successTypes = firstMethod.responseTypes.success;
|
|
103
|
+
const errorTypes = firstMethod.responseTypes.error;
|
|
104
|
+
|
|
105
|
+
if (successTypes.length > 0 && errorTypes.length > 0 && !!errorTypes[0]) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function hasInputModels(model: RLCModel) {
|
|
114
|
+
return hasSchemaContextObject(model, [SchemaContext.Input]);
|
|
115
|
+
}
|
|
116
|
+
export function hasOutputModels(model: RLCModel) {
|
|
117
|
+
return hasSchemaContextObject(model, [
|
|
118
|
+
SchemaContext.Output,
|
|
119
|
+
SchemaContext.Exception
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function hasSchemaContextObject(model: RLCModel, schemaUsage: SchemaContext[]) {
|
|
124
|
+
const objectSchemas: ObjectSchema[] = (model.schemas ?? []).filter(
|
|
125
|
+
(o) =>
|
|
126
|
+
isObjectSchema(o) &&
|
|
127
|
+
(o as ObjectSchema).usage?.some((u) => schemaUsage.includes(u))
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return objectSchemas.length > 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function getGeneratedWrapperTypes(
|
|
134
|
+
params: ParameterMetadata[] | PathParameter[]
|
|
135
|
+
): Schema[] {
|
|
136
|
+
const wrapperTypes = params
|
|
137
|
+
.map((qp) =>
|
|
138
|
+
isParameterMetadata(qp) ? qp.param.wrapperType : qp.wrapperType
|
|
139
|
+
)
|
|
140
|
+
.filter((v) => v !== undefined);
|
|
141
|
+
const wrapperFromObjects = wrapperTypes.filter(
|
|
142
|
+
(wrap) => wrap.type === "object"
|
|
143
|
+
);
|
|
144
|
+
const wrapperFromUnions = wrapperTypes
|
|
145
|
+
.filter((wrap) => wrap.type === "union")
|
|
146
|
+
.flatMap((wrapperType) => wrapperType?.enum ?? [])
|
|
147
|
+
.filter((v) => v.type === "object");
|
|
148
|
+
return [...wrapperFromUnions, ...wrapperFromObjects];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function isParameterMetadata(
|
|
152
|
+
param: ParameterMetadata | PathParameter
|
|
153
|
+
): param is ParameterMetadata {
|
|
154
|
+
return (param as any).param !== undefined;
|
|
155
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RLCModel, RLCOptions } from "../interfaces.js";
|
|
2
|
+
|
|
3
|
+
export function isAzurePackage(model: { options?: RLCOptions }): boolean {
|
|
4
|
+
return Boolean(model.options?.flavor === "azure");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isAzureMonorepoPackage(model: RLCModel): boolean {
|
|
8
|
+
return Boolean(model.options?.azureSdkForJs) && isAzurePackage(model);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isAzureStandalonePackage(model: RLCModel): boolean {
|
|
12
|
+
return isAzurePackage(model) && !model.options?.azureSdkForJs;
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
|
|
3
|
+
export function getRelativePartFromSrcPath(
|
|
4
|
+
srcPath: string,
|
|
5
|
+
isModularLibrary: boolean = false
|
|
6
|
+
) {
|
|
7
|
+
const sep = srcPath.includes(path.sep + "src") ? path.sep : "/";
|
|
8
|
+
let relativePart = srcPath.substring(srcPath.indexOf(sep + "src") + 4);
|
|
9
|
+
if (isModularLibrary) {
|
|
10
|
+
relativePart = relativePart.substring(srcPath.indexOf(sep + "rest"), +5);
|
|
11
|
+
}
|
|
12
|
+
return relativePart.startsWith(sep)
|
|
13
|
+
? relativePart.substring(1)
|
|
14
|
+
: relativePart;
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ArraySchema,
|
|
6
|
+
ObjectSchema,
|
|
7
|
+
RLCModel,
|
|
8
|
+
Schema,
|
|
9
|
+
SchemaContext
|
|
10
|
+
} from "../interfaces.js";
|
|
11
|
+
|
|
12
|
+
export interface IsDictionaryOptions {
|
|
13
|
+
filterEmpty?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function isArraySchema(schema: Schema): schema is ArraySchema {
|
|
17
|
+
return (
|
|
18
|
+
schema.type === "array" || typeof (schema as any).items !== "undefined"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function isDictionarySchema(
|
|
23
|
+
schema: Schema,
|
|
24
|
+
options: IsDictionaryOptions = {}
|
|
25
|
+
) {
|
|
26
|
+
if (schema.type === "dictionary") {
|
|
27
|
+
if (!options.filterEmpty || (options.filterEmpty && !schema.typeName)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isObjectSchema(schema: Schema): schema is ObjectSchema {
|
|
35
|
+
if (schema.type === "object") {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isConstantSchema(schema: Schema) {
|
|
42
|
+
if (schema.type === "constant") {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function buildSchemaObjectMap(model: RLCModel) {
|
|
49
|
+
// include interfaces
|
|
50
|
+
const map = new Map<string, Schema>();
|
|
51
|
+
const allSchemas = (model.schemas ?? []).filter(
|
|
52
|
+
(o) =>
|
|
53
|
+
isObjectSchema(o) &&
|
|
54
|
+
(o as ObjectSchema).usage?.some((u) => [SchemaContext.Input].includes(u))
|
|
55
|
+
);
|
|
56
|
+
allSchemas.forEach((o) => {
|
|
57
|
+
map.set(o.name, o);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return map;
|
|
61
|
+
}
|