@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,255 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { RLCModel } from "./interfaces.js";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
import {
|
|
7
|
+
FunctionDeclarationOverloadStructure,
|
|
8
|
+
OptionalKind,
|
|
9
|
+
Project,
|
|
10
|
+
VariableDeclarationKind
|
|
11
|
+
} from "ts-morph";
|
|
12
|
+
import { hasUnexpectedHelper } from "./helpers/operationHelpers.js";
|
|
13
|
+
import { getImportModuleName } from "./helpers/nameConstructors.js";
|
|
14
|
+
export function buildIsUnexpectedHelper(model: RLCModel) {
|
|
15
|
+
if (!hasUnexpectedHelper(model)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const project = new Project();
|
|
19
|
+
const srcPath = model.srcPath;
|
|
20
|
+
const filePath = path.join(srcPath, `isUnexpected.ts`);
|
|
21
|
+
const isErrorHelper = project.createSourceFile(filePath, undefined, {
|
|
22
|
+
overwrite: true
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
let map: Record<string, string[]> = {};
|
|
26
|
+
const allResponseTypes: Set<string> = new Set();
|
|
27
|
+
const allErrorTypes: Set<string> = new Set();
|
|
28
|
+
const overloads: OptionalKind<FunctionDeclarationOverloadStructure>[] = [];
|
|
29
|
+
const pathDictionary = model.paths;
|
|
30
|
+
|
|
31
|
+
for (const [path, details] of Object.entries(pathDictionary)) {
|
|
32
|
+
for (const [methodName, methodDetails] of Object.entries(details.methods)) {
|
|
33
|
+
const originalMethod = methodName.toUpperCase();
|
|
34
|
+
const operation = `${originalMethod} ${path}`;
|
|
35
|
+
const successCodeSet = new Set<string>(map["operation"] ?? []);
|
|
36
|
+
for (const detail of methodDetails) {
|
|
37
|
+
detail.successStatus.forEach(successCodeSet.add, successCodeSet);
|
|
38
|
+
// LROs may call the same path but with GET
|
|
39
|
+
// to get the operation status.
|
|
40
|
+
if (
|
|
41
|
+
detail.operationHelperDetail?.lroDetails?.isLongRunning &&
|
|
42
|
+
originalMethod !== "GET"
|
|
43
|
+
) {
|
|
44
|
+
const operation = `GET ${path}`;
|
|
45
|
+
const logicalSuccessCodes = detail.operationHelperDetail?.lroDetails
|
|
46
|
+
?.logicalResponseTypes?.success
|
|
47
|
+
? ["200"]
|
|
48
|
+
: [];
|
|
49
|
+
const initialSuccessCodes =
|
|
50
|
+
(pathDictionary[path]?.methods["get"] &&
|
|
51
|
+
pathDictionary[path]?.methods["get"]?.[0]?.successStatus) ??
|
|
52
|
+
detail.successStatus;
|
|
53
|
+
map = {
|
|
54
|
+
...map,
|
|
55
|
+
...{
|
|
56
|
+
[operation]: Array.from(
|
|
57
|
+
new Set(logicalSuccessCodes.concat(initialSuccessCodes))
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const successTypes = [...detail.responseTypes.success];
|
|
64
|
+
const errorTypes = [...detail.responseTypes.error];
|
|
65
|
+
|
|
66
|
+
if (
|
|
67
|
+
model.helperDetails?.clientLroOverload &&
|
|
68
|
+
detail.operationHelperDetail?.lroDetails?.logicalResponseTypes
|
|
69
|
+
?.success
|
|
70
|
+
) {
|
|
71
|
+
successTypes.push(
|
|
72
|
+
...(detail.operationHelperDetail.lroDetails.logicalResponseTypes
|
|
73
|
+
.success ?? [])
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!successTypes.length || !errorTypes.length || !errorTypes[0]) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
successTypes.forEach((t) => allResponseTypes.add(t));
|
|
82
|
+
errorTypes.forEach((t) => {
|
|
83
|
+
allResponseTypes.add(t);
|
|
84
|
+
allErrorTypes.add(t);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
overloads.push({
|
|
88
|
+
isExported: true,
|
|
89
|
+
parameters: [
|
|
90
|
+
{
|
|
91
|
+
name: "response",
|
|
92
|
+
type: [...successTypes, ...errorTypes].join(" | ")
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
returnType: `response is ${errorTypes[0]}`
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
map = { ...map, ...{ [operation]: Array.from(successCodeSet) } };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
isErrorHelper.addImportDeclaration({
|
|
102
|
+
isTypeOnly: true,
|
|
103
|
+
namedImports: [...allResponseTypes],
|
|
104
|
+
moduleSpecifier: getImportModuleName(
|
|
105
|
+
{
|
|
106
|
+
cjsName: `./responses`,
|
|
107
|
+
esModulesName: `./responses.js`
|
|
108
|
+
},
|
|
109
|
+
model
|
|
110
|
+
)
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
isErrorHelper.addVariableStatement({
|
|
114
|
+
declarations: [
|
|
115
|
+
{
|
|
116
|
+
name: "responseMap",
|
|
117
|
+
initializer: JSON.stringify(map),
|
|
118
|
+
type: "Record<string, string[]>"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
declarationKind: VariableDeclarationKind.Const
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
if (allErrorTypes.size) {
|
|
125
|
+
isErrorHelper.addFunction({
|
|
126
|
+
overloads,
|
|
127
|
+
isExported: true,
|
|
128
|
+
name: "isUnexpected",
|
|
129
|
+
parameters: [
|
|
130
|
+
{
|
|
131
|
+
name: "response",
|
|
132
|
+
type: [...allResponseTypes].join(" | ")
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
returnType: `response is ${[...allErrorTypes].join(" | ")}`,
|
|
136
|
+
statements: [
|
|
137
|
+
`
|
|
138
|
+
const lroOriginal = response.headers["x-ms-original-url"];
|
|
139
|
+
const url = new URL(lroOriginal ?? response.request.url);
|
|
140
|
+
const method = response.request.method;
|
|
141
|
+
let pathDetails = responseMap[\`\${method} \${url.pathname}\`];
|
|
142
|
+
if (!pathDetails) {
|
|
143
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
144
|
+
}
|
|
145
|
+
return !pathDetails.includes(response.status);
|
|
146
|
+
`
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
isErrorHelper.addFunction({
|
|
150
|
+
isExported: false,
|
|
151
|
+
name: "getParametrizedPathSuccess",
|
|
152
|
+
parameters: [
|
|
153
|
+
{
|
|
154
|
+
name: "method",
|
|
155
|
+
type: "string"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "path",
|
|
159
|
+
type: "string"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
returnType: `string[]`,
|
|
163
|
+
statements: [
|
|
164
|
+
`
|
|
165
|
+
const pathParts = path.split("/");
|
|
166
|
+
|
|
167
|
+
// Traverse list to match the longest candidate
|
|
168
|
+
// matchedLen: the length of candidate path
|
|
169
|
+
// matchedValue: the matched status code array
|
|
170
|
+
let matchedLen = -1,
|
|
171
|
+
matchedValue: string[] = [];
|
|
172
|
+
|
|
173
|
+
// Iterate the responseMap to find a match
|
|
174
|
+
for (const [key, value] of Object.entries(responseMap)) {
|
|
175
|
+
// Extracting the path from the map key which is in format
|
|
176
|
+
// GET /path/foo
|
|
177
|
+
if (!key.startsWith(method)) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const candidatePath = getPathFromMapKey(key);
|
|
181
|
+
// Get each part of the url path
|
|
182
|
+
const candidateParts = candidatePath.split("/");
|
|
183
|
+
|
|
184
|
+
// track if we have found a match to return the values found.
|
|
185
|
+
let found = true;
|
|
186
|
+
for (
|
|
187
|
+
let i = candidateParts.length - 1, j = pathParts.length - 1;
|
|
188
|
+
i >= 1 && j >= 1;
|
|
189
|
+
i--, j--
|
|
190
|
+
) {
|
|
191
|
+
if (
|
|
192
|
+
candidateParts[i]?.startsWith("{") &&
|
|
193
|
+
candidateParts[i]?.indexOf("}") !== -1
|
|
194
|
+
) {
|
|
195
|
+
const start = candidateParts[i]!.indexOf("}") + 1,
|
|
196
|
+
end = candidateParts[i]?.length;
|
|
197
|
+
// If the current part of the candidate is a "template" part
|
|
198
|
+
// Try to use the suffix of pattern to match the path
|
|
199
|
+
// {guid} ==> $
|
|
200
|
+
// {guid}:export ==> :export$
|
|
201
|
+
const isMatched = new RegExp(
|
|
202
|
+
\`\${candidateParts[i]?.slice(start, end)}\`
|
|
203
|
+
).test(pathParts[j] || '');
|
|
204
|
+
|
|
205
|
+
if (!isMatched) {
|
|
206
|
+
found = false;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// If the candidate part is not a template and
|
|
213
|
+
// the parts don't match mark the candidate as not found
|
|
214
|
+
// to move on with the next candidate path.
|
|
215
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
216
|
+
found = false;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// We finished evaluating the current candidate parts
|
|
222
|
+
// Update the matched value if and only if we found the longer pattern
|
|
223
|
+
if (found && candidatePath.length > matchedLen) {
|
|
224
|
+
matchedLen = candidatePath.length;
|
|
225
|
+
matchedValue = value;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return matchedValue;
|
|
230
|
+
`
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
isErrorHelper.addFunction({
|
|
235
|
+
isExported: false,
|
|
236
|
+
name: "getPathFromMapKey",
|
|
237
|
+
parameters: [
|
|
238
|
+
{
|
|
239
|
+
name: "mapKey",
|
|
240
|
+
type: "string"
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
returnType: `string`,
|
|
244
|
+
statements: [
|
|
245
|
+
`const pathStart = mapKey.indexOf("/");
|
|
246
|
+
return mapKey.slice(pathStart);`
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
path: filePath,
|
|
253
|
+
content: isErrorHelper.getFullText()
|
|
254
|
+
};
|
|
255
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { RLCModel } from "./interfaces.js";
|
|
5
|
+
import { Project } from "ts-morph";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
|
|
8
|
+
export function buildLogger(model: RLCModel) {
|
|
9
|
+
if (!model.options) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
// Disable logger for non-Azure packages
|
|
13
|
+
if (model.options.flavor !== "azure") {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const project = new Project();
|
|
17
|
+
const { srcPath, rlcSourceDir } = model;
|
|
18
|
+
const { packageDetails } = model.options;
|
|
19
|
+
const filePath = path.join(
|
|
20
|
+
model.options.sourceFrom == "Swagger"
|
|
21
|
+
? srcPath.substring(
|
|
22
|
+
0,
|
|
23
|
+
srcPath.includes("generated") && !srcPath.includes("src")
|
|
24
|
+
? srcPath.lastIndexOf("generated") + 10
|
|
25
|
+
: srcPath.lastIndexOf("src") + 4
|
|
26
|
+
)
|
|
27
|
+
: rlcSourceDir!,
|
|
28
|
+
`logger.ts`
|
|
29
|
+
);
|
|
30
|
+
const loggerFile = project.createSourceFile("logger.ts", undefined, {
|
|
31
|
+
overwrite: true
|
|
32
|
+
});
|
|
33
|
+
loggerFile.addImportDeclaration({
|
|
34
|
+
namedImports: ["createClientLogger"],
|
|
35
|
+
moduleSpecifier: `@azure/logger`
|
|
36
|
+
});
|
|
37
|
+
loggerFile.addStatements(
|
|
38
|
+
`export const logger = createClientLogger("${
|
|
39
|
+
packageDetails!.nameWithoutScope ?? packageDetails?.name ?? ""
|
|
40
|
+
}")`
|
|
41
|
+
);
|
|
42
|
+
return { path: filePath, content: loggerFile.getFullText() };
|
|
43
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
CasingConvention,
|
|
6
|
+
NameType,
|
|
7
|
+
normalizeName,
|
|
8
|
+
ReservedName
|
|
9
|
+
} from "./helpers/nameUtils.js";
|
|
10
|
+
import { Paths, PathParameter, PathMetadata } from "./interfaces.js";
|
|
11
|
+
|
|
12
|
+
export const REST_CLIENT_RESERVED: ReservedName[] = [
|
|
13
|
+
{ name: "path", reservedFor: [NameType.Property, NameType.OperationGroup] },
|
|
14
|
+
{
|
|
15
|
+
name: "pathUnchecked",
|
|
16
|
+
reservedFor: [NameType.Property, NameType.OperationGroup]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "pipeline",
|
|
20
|
+
reservedFor: [NameType.Property, NameType.OperationGroup]
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export function buildMethodShortcutImplementation(paths: Paths) {
|
|
25
|
+
const keys: Record<string, string[]> = {};
|
|
26
|
+
for (const path of Object.keys(paths)) {
|
|
27
|
+
const pathMetadata = paths[path];
|
|
28
|
+
if (!pathMetadata) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const groupName = normalizeName(
|
|
32
|
+
pathMetadata.operationGroupName,
|
|
33
|
+
NameType.OperationGroup,
|
|
34
|
+
true,
|
|
35
|
+
REST_CLIENT_RESERVED,
|
|
36
|
+
CasingConvention.Camel
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (keys[groupName]) {
|
|
40
|
+
keys[groupName].push(...buildOperationDeclarations(path, pathMetadata));
|
|
41
|
+
} else {
|
|
42
|
+
keys[groupName] = buildOperationDeclarations(path, pathMetadata);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return keys;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function buildOperationDeclarations(path: string, pathMetadata: PathMetadata) {
|
|
49
|
+
let ops: string[] = [];
|
|
50
|
+
for (const method of Object.keys(pathMetadata.methods)) {
|
|
51
|
+
const methodOps = pathMetadata.methods[method];
|
|
52
|
+
if (!methodOps) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
for (const op of methodOps) {
|
|
56
|
+
const pathParams = pathMetadata?.pathParameters;
|
|
57
|
+
const name = normalizeName(op.operationName, NameType.Property);
|
|
58
|
+
const methodDefinitions = generateOperationDeclaration(
|
|
59
|
+
path,
|
|
60
|
+
name,
|
|
61
|
+
method,
|
|
62
|
+
pathParams
|
|
63
|
+
);
|
|
64
|
+
ops = [...ops, methodDefinitions];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return ops;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function generateOperationDeclaration(
|
|
72
|
+
path: string,
|
|
73
|
+
operationName: string,
|
|
74
|
+
method: string,
|
|
75
|
+
pathParams: PathParameter[] = []
|
|
76
|
+
): string {
|
|
77
|
+
const pathParamNames = `${
|
|
78
|
+
pathParams.length > 0 ? `${pathParams.map((p) => p.name)},` : ""
|
|
79
|
+
}`;
|
|
80
|
+
return `"${operationName}": (${pathParamNames} options) => {
|
|
81
|
+
return client.path("${path}", ${pathParamNames}).${method}(options);
|
|
82
|
+
}`;
|
|
83
|
+
}
|