@azure-tools/typespec-ts 0.11.0 → 0.12.0-alpha.20230501.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +265 -152
- package/.rush/temp/shrinkwrap-deps.json +58 -54
- package/CHANGELOG.md +4 -0
- package/CONTRIBUTING.md +5 -2
- package/README.md +3 -3
- package/dist/src/casingUtils.d.ts +4 -0
- package/dist/src/casingUtils.d.ts.map +1 -0
- package/dist/src/casingUtils.js +39 -0
- package/dist/src/casingUtils.js.map +1 -0
- package/dist/src/emitUtil.js +7 -1
- package/dist/src/emitUtil.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +41 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modelUtils.d.ts +22 -1
- package/dist/src/modelUtils.d.ts.map +1 -1
- package/dist/src/modelUtils.js +105 -13
- package/dist/src/modelUtils.js.map +1 -1
- package/dist/src/modular/buildApiIndex.d.ts +3 -0
- package/dist/src/modular/buildApiIndex.d.ts.map +1 -0
- package/dist/src/modular/buildApiIndex.js +12 -0
- package/dist/src/modular/buildApiIndex.js.map +1 -0
- package/dist/src/modular/buildClassicalClient.d.ts +4 -0
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -0
- package/dist/src/modular/buildClassicalClient.js +112 -0
- package/dist/src/modular/buildClassicalClient.js.map +1 -0
- package/dist/src/modular/buildClientContext.d.ts +7 -0
- package/dist/src/modular/buildClientContext.d.ts.map +1 -0
- package/dist/src/modular/buildClientContext.js +72 -0
- package/dist/src/modular/buildClientContext.js.map +1 -0
- package/dist/src/modular/buildCodeModel.d.ts +14 -0
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -0
- package/dist/src/modular/buildCodeModel.js +1110 -0
- package/dist/src/modular/buildCodeModel.js.map +1 -0
- package/dist/src/modular/buildOperations.d.ts +13 -0
- package/dist/src/modular/buildOperations.d.ts.map +1 -0
- package/dist/src/modular/buildOperations.js +70 -0
- package/dist/src/modular/buildOperations.js.map +1 -0
- package/dist/src/modular/buildProjectFiles.d.ts +5 -0
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -0
- package/dist/src/modular/buildProjectFiles.js +182 -0
- package/dist/src/modular/buildProjectFiles.js.map +1 -0
- package/dist/src/modular/buildRootIndex.d.ts +4 -0
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -0
- package/dist/src/modular/buildRootIndex.js +66 -0
- package/dist/src/modular/buildRootIndex.js.map +1 -0
- package/dist/src/modular/buildSharedTypes.d.ts +6 -0
- package/dist/src/modular/buildSharedTypes.d.ts.map +1 -0
- package/dist/src/modular/buildSharedTypes.js +33 -0
- package/dist/src/modular/buildSharedTypes.js.map +1 -0
- package/dist/src/modular/emitModels.d.ts +7 -0
- package/dist/src/modular/emitModels.d.ts.map +1 -0
- package/dist/src/modular/emitModels.js +63 -0
- package/dist/src/modular/emitModels.js.map +1 -0
- package/dist/src/modular/helpers/clientHelpers.d.ts +4 -0
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/clientHelpers.js +31 -0
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -0
- package/dist/src/modular/helpers/credentialHelpers.d.ts +7 -0
- package/dist/src/modular/helpers/credentialHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/credentialHelpers.js +32 -0
- package/dist/src/modular/helpers/credentialHelpers.js.map +1 -0
- package/dist/src/modular/helpers/namingHelpers.d.ts +3 -0
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/namingHelpers.js +4 -0
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -0
- package/dist/src/modular/helpers/operationHelpers.d.ts +8 -0
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/operationHelpers.js +274 -0
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -0
- package/dist/src/modular/helpers/parameterHelpers.d.ts +3 -0
- package/dist/src/modular/helpers/parameterHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/parameterHelpers.js +16 -0
- package/dist/src/modular/helpers/parameterHelpers.js.map +1 -0
- package/dist/src/modular/helpers/typeHelpers.d.ts +16 -0
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/typeHelpers.js +92 -0
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -0
- package/dist/src/modular/interfaces.d.ts +10 -0
- package/dist/src/modular/interfaces.d.ts.map +1 -0
- package/dist/src/modular/interfaces.js +2 -0
- package/dist/src/modular/interfaces.js.map +1 -0
- package/dist/src/modular/modularCodeModel.d.ts +121 -0
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -0
- package/dist/src/modular/modularCodeModel.js +2 -0
- package/dist/src/modular/modularCodeModel.js.map +1 -0
- package/dist/src/operationUtil.d.ts +30 -4
- package/dist/src/operationUtil.d.ts.map +1 -1
- package/dist/src/operationUtil.js +77 -18
- package/dist/src/operationUtil.js.map +1 -1
- package/dist/src/transform/transform.d.ts +4 -6
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +17 -58
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +5 -0
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -0
- package/dist/src/transform/transformApiVersionInfo.js +64 -0
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -0
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +6 -0
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -0
- package/dist/src/transform/{transformAnnotationDetails.js → transformHelperFunctionDetails.js} +2 -2
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -0
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +20 -7
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +2 -2
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +15 -7
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +2 -2
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +23 -2
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts +2 -2
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +10 -22
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +2 -2
- package/dist/src/transform/transfromRLCOptions.js +1 -1
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -19
- package/src/casingUtils.ts +48 -0
- package/src/emitUtil.ts +9 -4
- package/src/index.ts +53 -10
- package/src/lib.ts +2 -1
- package/src/modelUtils.ts +137 -14
- package/src/modular/buildApiIndex.ts +13 -0
- package/src/modular/buildClassicalClient.ts +147 -0
- package/src/modular/buildClientContext.ts +104 -0
- package/src/modular/buildCodeModel.ts +1449 -0
- package/src/modular/buildOperations.ts +95 -0
- package/src/modular/buildProjectFiles.ts +219 -0
- package/src/modular/buildRootIndex.ts +94 -0
- package/src/modular/buildSharedTypes.ts +40 -0
- package/src/modular/emitModels.ts +72 -0
- package/src/modular/helpers/clientHelpers.ts +38 -0
- package/src/modular/helpers/credentialHelpers.ts +40 -0
- package/src/modular/helpers/namingHelpers.ts +5 -0
- package/src/modular/helpers/operationHelpers.ts +418 -0
- package/src/modular/helpers/parameterHelpers.ts +17 -0
- package/src/modular/helpers/typeHelpers.ts +106 -0
- package/src/modular/interfaces.ts +10 -0
- package/src/modular/modularCodeModel.ts +151 -0
- package/src/modular/static/karma.conf.cjs +120 -0
- package/src/modular/static/rollup.test.config.js +67 -0
- package/src/modular/static/scripts/renameOutput.mjs +17 -0
- package/src/operationUtil.ts +119 -31
- package/src/transform/transform.ts +33 -96
- package/src/transform/transformApiVersionInfo.ts +108 -0
- package/src/transform/{transformAnnotationDetails.ts → transformHelperFunctionDetails.ts} +11 -11
- package/src/transform/transformParameters.ts +30 -14
- package/src/transform/transformPaths.ts +29 -19
- package/src/transform/transformResponses.ts +50 -8
- package/src/transform/transformSchemas.ts +20 -28
- package/src/transform/transfromRLCOptions.ts +3 -3
- package/test/commands/cadl-ranch-list.ts +53 -20
- package/test/commands/gen-cadl-ranch.ts +6 -2
- package/test/commands/run.ts +3 -13
- package/test/integration/arrayItemTypes.spec.ts +6 -3
- package/test/integration/azurecore.spec.ts +130 -0
- package/test/integration/collectionFormat.spec.ts +118 -0
- package/test/integration/dictionary.spec.ts +6 -2
- package/test/integration/extensibleEnums.spec.ts +8 -8
- package/test/integration/fixedEnums.spec.ts +7 -7
- package/test/integration/generated/arrays/itemTypes/src/clientDefinitions.ts +33 -18
- package/test/integration/generated/arrays/itemTypes/src/parameters.ts +8 -0
- package/test/integration/generated/arrays/itemTypes/src/responses.ts +11 -0
- package/test/integration/generated/arrays/itemTypes/tspconfig.yaml +5 -2
- package/test/integration/generated/authentication/apiKey/package.json +2 -2
- package/test/integration/generated/authentication/apiKey/tspconfig.yaml +5 -2
- package/test/integration/generated/authentication/oauth2/tspconfig.yaml +5 -2
- package/test/integration/generated/authentication/union/tspconfig.yaml +5 -2
- package/test/integration/generated/{resiliency/devDriven → azure/core}/README.md +7 -7
- package/test/integration/generated/{lro/lroBasic → azure/core}/api-extractor.json +1 -1
- package/test/integration/generated/{resiliency/devDriven → azure/core}/package.json +6 -6
- package/test/integration/generated/azure/core/src/azureCoreClient.ts +31 -0
- package/test/integration/generated/azure/core/src/clientDefinitions.ts +108 -0
- package/test/integration/generated/{resiliency/devDriven → azure/core}/src/index.ts +4 -3
- package/test/integration/generated/azure/core/src/isUnexpected.ts +178 -0
- package/test/integration/generated/azure/core/src/models.ts +18 -0
- package/test/integration/generated/azure/core/src/outputModels.ts +32 -0
- package/test/integration/generated/{resiliency/devDriven → azure/core}/src/paginateHelper.ts +55 -5
- package/test/integration/generated/azure/core/src/parameters.ts +68 -0
- package/test/integration/generated/azure/core/src/responses.ts +158 -0
- package/test/integration/generated/azure/core/src/serializeHelper.ts +16 -0
- package/test/integration/generated/azure/core/tspconfig.yaml +15 -0
- package/test/integration/generated/azure/core-traits/README.md +56 -0
- package/test/integration/generated/azure/core-traits/api-extractor.json +18 -0
- package/test/integration/generated/azure/core-traits/package.json +80 -0
- package/test/integration/generated/azure/core-traits/src/azureCoreTraitsClient.ts +31 -0
- package/test/integration/generated/azure/core-traits/src/clientDefinitions.ts +22 -0
- package/test/integration/generated/azure/core-traits/src/index.ts +13 -0
- package/test/integration/generated/{resiliency/devDriven → azure/core-traits}/src/isUnexpected.ts +6 -26
- package/test/integration/generated/azure/core-traits/src/outputModels.ts +10 -0
- package/test/integration/generated/azure/core-traits/src/parameters.ts +26 -0
- package/test/integration/generated/azure/core-traits/src/responses.ts +32 -0
- package/test/integration/generated/azure/core-traits/tspconfig.yaml +15 -0
- package/test/integration/generated/dictionary/package.json +2 -2
- package/test/integration/generated/dictionary/src/clientDefinitions.ts +35 -20
- package/test/integration/generated/dictionary/src/parameters.ts +8 -0
- package/test/integration/generated/dictionary/src/responses.ts +11 -0
- package/test/integration/generated/dictionary/tspconfig.yaml +5 -2
- package/test/integration/generated/enums/extensible/README.md +3 -3
- package/test/integration/generated/enums/extensible/package.json +2 -2
- package/test/integration/generated/enums/extensible/src/clientDefinitions.ts +5 -5
- package/test/integration/generated/enums/extensible/src/index.ts +3 -3
- package/test/integration/generated/enums/extensible/src/{enumsExtensible.ts → typeEnumExtensible.ts} +4 -4
- package/test/integration/generated/enums/extensible/tspconfig.yaml +5 -2
- package/test/integration/generated/enums/fixed/README.md +3 -3
- package/test/integration/generated/enums/fixed/package.json +2 -2
- package/test/integration/generated/enums/fixed/src/clientDefinitions.ts +5 -5
- package/test/integration/generated/enums/fixed/src/index.ts +3 -3
- package/test/integration/generated/enums/fixed/src/{enumsFixed.ts → typeEnumFixed.ts} +4 -4
- package/test/integration/generated/enums/fixed/tspconfig.yaml +5 -2
- package/test/integration/generated/hello/package.json +2 -2
- package/test/integration/generated/hello/tspconfig.yaml +5 -2
- package/test/integration/generated/internal/src/clientDefinitions.ts +27 -0
- package/test/integration/generated/internal/src/index.ts +13 -0
- package/test/integration/generated/{lro/lroBasic/src/azureLro.ts → internal/src/internalClient.ts} +5 -5
- package/test/integration/generated/internal/src/models.ts +8 -0
- package/test/integration/generated/internal/src/outputModels.ts +13 -0
- package/test/integration/generated/internal/src/parameters.ts +21 -0
- package/test/integration/generated/internal/src/responses.ts +20 -0
- package/test/integration/generated/internal/tspconfig.yaml +14 -0
- package/test/integration/generated/lro/lroCore/.eslintrc.json +11 -0
- package/test/integration/generated/lro/lroCore/README.md +56 -0
- package/test/integration/generated/{resiliency/devDriven → lro/lroCore}/api-extractor.json +1 -1
- package/test/integration/generated/lro/{lroBasic → lroCore}/package.json +6 -6
- package/test/integration/generated/lro/lroCore/rollup.config.js +118 -0
- package/test/integration/generated/lro/lroCore/src/clientDefinitions.ts +54 -0
- package/test/integration/generated/lro/lroCore/src/index.ts +15 -0
- package/test/integration/generated/lro/lroCore/src/isUnexpected.ts +135 -0
- package/test/integration/generated/lro/lroCore/src/models.ts +8 -0
- package/test/integration/generated/lro/lroCore/src/outputModels.ts +50 -0
- package/test/integration/generated/lro/lroCore/src/parameters.ts +25 -0
- package/test/integration/generated/lro/{lroBasic → lroCore}/src/pollingHelper.ts +38 -0
- package/test/integration/generated/lro/lroCore/src/responses.ts +109 -0
- package/test/integration/generated/lro/lroCore/src/specsAzureCoreLroStandard.ts +31 -0
- package/test/integration/generated/lro/lroCore/tsconfig.json +25 -0
- package/test/integration/generated/lro/lroCore/tspconfig.yaml +14 -0
- package/test/integration/generated/lro/lroRPC/.eslintrc.json +11 -0
- package/test/integration/generated/lro/{lroBasic → lroRPC}/README.md +7 -7
- package/test/integration/generated/lro/lroRPC/api-extractor.json +18 -0
- package/test/integration/generated/lro/lroRPC/package.json +82 -0
- package/test/integration/generated/lro/lroRPC/rollup.config.js +118 -0
- package/test/integration/generated/lro/lroRPC/src/clientDefinitions.ts +79 -0
- package/test/integration/generated/lro/lroRPC/src/index.ts +15 -0
- package/test/integration/generated/lro/lroRPC/src/isUnexpected.ts +153 -0
- package/test/integration/generated/lro/lroRPC/src/models.ts +8 -0
- package/test/integration/generated/lro/lroRPC/src/outputModels.ts +40 -0
- package/test/integration/generated/lro/lroRPC/src/parameters.ts +20 -0
- package/test/integration/generated/lro/lroRPC/src/pollingHelper.ts +127 -0
- package/test/integration/generated/lro/lroRPC/src/responses.ts +124 -0
- package/test/integration/generated/lro/lroRPC/src/specsAzureCoreLroRpc.ts +31 -0
- package/test/integration/generated/lro/lroRPC/tsconfig.json +25 -0
- package/test/integration/generated/lro/lroRPC/tspconfig.yaml +14 -0
- package/test/integration/generated/models/inheritance/README.md +3 -3
- package/test/integration/generated/models/inheritance/package.json +2 -2
- package/test/integration/generated/models/inheritance/src/clientDefinitions.ts +13 -11
- package/test/integration/generated/models/inheritance/src/index.ts +3 -3
- package/test/integration/generated/models/inheritance/src/{modelsInheritance.ts → typeModelInheritance.ts} +4 -4
- package/test/integration/generated/models/inheritance/tspconfig.yaml +5 -2
- package/test/integration/generated/models/propertyNullable/.eslintrc.json +11 -0
- package/test/integration/generated/models/propertyNullable/README.md +56 -0
- package/test/integration/generated/models/propertyNullable/api-extractor.json +18 -0
- package/test/integration/generated/models/propertyNullable/package.json +80 -0
- package/test/integration/generated/models/propertyNullable/rollup.config.js +118 -0
- package/test/integration/generated/models/propertyNullable/src/clientDefinitions.ts +227 -0
- package/test/integration/generated/models/propertyNullable/src/index.ts +13 -0
- package/test/integration/generated/models/propertyNullable/src/models.ts +56 -0
- package/test/integration/generated/models/propertyNullable/src/outputModels.ts +56 -0
- package/test/integration/generated/models/propertyNullable/src/parameters.ts +197 -0
- package/test/integration/generated/models/propertyNullable/src/responses.ts +144 -0
- package/test/integration/generated/{resiliency/devDriven/src/resiliencyDevDriven.ts → models/propertyNullable/src/typePropertyNullable.ts} +5 -5
- package/test/integration/generated/models/propertyNullable/tsconfig.json +25 -0
- package/test/integration/generated/models/propertyNullable/tspconfig.yaml +14 -0
- package/test/integration/generated/models/propertyOptional/README.md +3 -3
- package/test/integration/generated/models/propertyOptional/package.json +2 -2
- package/test/integration/generated/models/propertyOptional/src/clientDefinitions.ts +47 -47
- package/test/integration/generated/models/propertyOptional/src/index.ts +3 -3
- package/test/integration/generated/models/propertyOptional/src/parameters.ts +7 -6
- package/test/integration/generated/models/propertyOptional/src/responses.ts +4 -4
- package/test/integration/generated/models/propertyOptional/src/{modelsPropertyOptional.ts → typePropertyOptional.ts} +4 -4
- package/test/integration/generated/models/propertyOptional/tspconfig.yaml +5 -2
- package/test/integration/generated/models/propertyTypes/README.md +3 -3
- package/test/integration/generated/models/propertyTypes/package.json +2 -2
- package/test/integration/generated/models/propertyTypes/src/clientDefinitions.ts +55 -47
- package/test/integration/generated/models/propertyTypes/src/index.ts +3 -3
- package/test/integration/generated/models/propertyTypes/src/parameters.ts +8 -6
- package/test/integration/generated/models/propertyTypes/src/responses.ts +4 -4
- package/test/integration/generated/models/propertyTypes/src/{modelsPropertyTypes.ts → typePropertyValueTypes.ts} +4 -4
- package/test/integration/generated/models/propertyTypes/tspconfig.yaml +5 -2
- package/test/integration/generated/models/usage/README.md +3 -3
- package/test/integration/generated/models/usage/package.json +2 -2
- package/test/integration/generated/models/usage/src/clientDefinitions.ts +7 -7
- package/test/integration/generated/models/usage/src/index.ts +3 -3
- package/test/integration/generated/models/usage/src/{modelsUsage.ts → typeModelUsage.ts} +4 -4
- package/test/integration/generated/models/usage/tspconfig.yaml +5 -2
- package/test/integration/generated/models/visibility/README.md +3 -3
- package/test/integration/generated/models/visibility/package.json +2 -2
- package/test/integration/generated/models/visibility/src/clientDefinitions.ts +3 -3
- package/test/integration/generated/models/visibility/src/index.ts +3 -3
- package/test/integration/generated/models/visibility/src/{modelsVisibilityAutomatic.ts → typeModelVisibility.ts} +4 -4
- package/test/integration/generated/models/visibility/tspconfig.yaml +5 -2
- package/test/integration/generated/parameters/collection-format/src/clientDefinitions.ts +63 -0
- package/test/integration/generated/parameters/collection-format/src/collectionFormatClient.ts +31 -0
- package/test/integration/generated/parameters/collection-format/src/index.ts +12 -0
- package/test/integration/generated/parameters/collection-format/src/parameters.ts +71 -0
- package/test/integration/generated/parameters/collection-format/src/responses.ts +34 -0
- package/test/integration/generated/parameters/collection-format/src/serializeHelper.ts +28 -0
- package/test/integration/generated/parameters/collection-format/tspconfig.yaml +14 -0
- package/test/integration/generated/parameters/spread/src/clientDefinitions.ts +61 -0
- package/test/integration/generated/{lro/lroBasic → parameters/spread}/src/index.ts +4 -4
- package/test/integration/generated/parameters/spread/src/models.ts +7 -0
- package/test/integration/generated/parameters/spread/src/parameters.ts +61 -0
- package/test/integration/generated/parameters/spread/src/parametersSpread.ts +31 -0
- package/test/integration/generated/parameters/spread/src/responses.ts +25 -0
- package/test/integration/generated/parameters/spread/tspconfig.yaml +12 -0
- package/test/integration/generated/projection/src/clientDefinitions.ts +71 -0
- package/test/integration/generated/projection/src/index.ts +12 -0
- package/test/integration/generated/projection/src/models.ts +22 -0
- package/test/integration/generated/projection/src/parameters.ts +48 -0
- package/test/integration/generated/projection/src/projectionClient.ts +31 -0
- package/test/integration/generated/projection/src/responses.ts +34 -0
- package/test/integration/generated/projection/tspconfig.yaml +14 -0
- package/test/integration/generated/resiliency/srvDriven1/README.md +4 -4
- package/test/integration/generated/resiliency/srvDriven1/package.json +2 -2
- package/test/integration/generated/resiliency/srvDriven1/src/clientDefinitions.ts +25 -49
- package/test/integration/generated/resiliency/srvDriven1/src/index.ts +3 -5
- package/test/integration/generated/resiliency/srvDriven1/src/parameters.ts +11 -32
- package/test/integration/generated/resiliency/srvDriven1/src/responses.ts +9 -24
- package/test/integration/generated/resiliency/srvDriven1/src/serviceDrivenOldClient.ts +39 -0
- package/test/integration/generated/resiliency/srvDriven1/tspconfig.yaml +6 -2
- package/test/integration/generated/resiliency/srvDriven2/README.md +13 -4
- package/test/integration/generated/resiliency/srvDriven2/package.json +2 -2
- package/test/integration/generated/resiliency/srvDriven2/src/clientDefinitions.ts +32 -68
- package/test/integration/generated/resiliency/srvDriven2/src/index.ts +3 -5
- package/test/integration/generated/resiliency/srvDriven2/src/parameters.ts +19 -42
- package/test/integration/generated/resiliency/srvDriven2/src/responses.ts +10 -31
- package/test/integration/generated/resiliency/srvDriven2/src/serviceDrivenNewClient.ts +39 -0
- package/test/integration/generated/resiliency/srvDriven2/tspconfig.yaml +6 -2
- package/test/integration/generated/server/path/multiple/src/clientDefinitions.ts +35 -0
- package/test/integration/generated/server/path/multiple/src/index.ts +11 -0
- package/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts +39 -0
- package/test/integration/generated/server/path/multiple/src/parameters.ts +7 -0
- package/test/integration/generated/server/path/multiple/src/responses.ts +14 -0
- package/test/integration/generated/server/path/multiple/tspconfig.yaml +14 -0
- package/test/integration/generated/server/path/single/src/clientDefinitions.ts +19 -0
- package/test/integration/generated/server/path/single/src/index.ts +11 -0
- package/test/integration/generated/server/path/single/src/parameters.ts +6 -0
- package/test/integration/generated/server/path/single/src/responses.ts +9 -0
- package/test/integration/generated/server/path/single/src/singleParamInServerPathClient.ts +34 -0
- package/test/integration/generated/server/path/single/tspconfig.yaml +14 -0
- package/test/integration/generated/specialWords/tspconfig.yaml +5 -2
- package/test/integration/generated/unions/src/clientDefinitions.ts +8 -8
- package/test/integration/generated/unions/tspconfig.yaml +5 -2
- package/test/integration/internal.spec.ts +43 -0
- package/test/integration/lroCore.spec.ts +89 -0
- package/test/integration/modelInheritance.spec.ts +13 -13
- package/test/integration/modelPropertyNullable.spec.ts +115 -0
- package/test/integration/modelPropertyOptional.spec.ts +32 -32
- package/test/integration/modelPropertyType.spec.ts +6 -6
- package/test/integration/modelUsage.spec.ts +7 -7
- package/test/integration/projection.spec.ts +102 -0
- package/test/integration/resiliencyDpgCustomization.spec.ts +69 -35
- package/test/integration/server.spec.ts +59 -0
- package/test/integration/spreadParameters.spec.ts +82 -0
- package/test/integration/unions.spec.ts +4 -4
- package/test/unit/apiVersion.spec.ts +388 -0
- package/test/unit/clientFactoryGenerator.spec.ts +0 -131
- package/test/unit/modelsGenerator.spec.ts +2 -2
- package/test/unit/parametersGenerator.spec.ts +1 -1
- package/test/unit/responsesGenerator.spec.ts +1 -1
- package/test/unit/util/emitUtil.ts +6 -5
- package/test/unit/util/testUtil.ts +3 -3
- package/dist/src/transform/transformAnnotationDetails.d.ts +0 -6
- package/dist/src/transform/transformAnnotationDetails.d.ts.map +0 -1
- package/dist/src/transform/transformAnnotationDetails.js.map +0 -1
- package/dist/src/transform/transformApiVersionParam.d.ts +0 -5
- package/dist/src/transform/transformApiVersionParam.d.ts.map +0 -1
- package/dist/src/transform/transformApiVersionParam.js +0 -76
- package/dist/src/transform/transformApiVersionParam.js.map +0 -1
- package/src/transform/transformApiVersionParam.ts +0 -104
- package/test/integration/generated/lro/lroBasic/src/clientDefinitions.ts +0 -37
- package/test/integration/generated/lro/lroBasic/src/parameters.ts +0 -8
- package/test/integration/generated/lro/lroBasic/src/responses.ts +0 -22
- package/test/integration/generated/lro/lroBasic/tspconfig.yaml +0 -11
- package/test/integration/generated/resiliency/devDriven/src/clientDefinitions.ts +0 -75
- package/test/integration/generated/resiliency/devDriven/src/models.ts +0 -8
- package/test/integration/generated/resiliency/devDriven/src/outputModels.ts +0 -25
- package/test/integration/generated/resiliency/devDriven/src/parameters.ts +0 -17
- package/test/integration/generated/resiliency/devDriven/src/responses.ts +0 -62
- package/test/integration/generated/resiliency/devDriven/tspconfig.yaml +0 -11
- package/test/integration/generated/resiliency/srvDriven1/src/models.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven1/src/outputModels.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven1/src/resiliencyServiceDriven1.ts +0 -31
- package/test/integration/generated/resiliency/srvDriven2/src/models.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven2/src/outputModels.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven2/src/resiliencyServiceDriven2.ts +0 -31
- package/test/integration/helloWorld.spec.ts +0 -20
- package/test/integration/lroBasic.spec.ts +0 -25
- /package/test/integration/generated/{resiliency/devDriven → azure/core}/.eslintrc.json +0 -0
- /package/test/integration/generated/{resiliency/devDriven → azure/core}/rollup.config.js +0 -0
- /package/test/integration/generated/{resiliency/devDriven → azure/core}/tsconfig.json +0 -0
- /package/test/integration/generated/{lro/lroBasic → azure/core-traits}/.eslintrc.json +0 -0
- /package/test/integration/generated/{lro/lroBasic → azure/core-traits}/rollup.config.js +0 -0
- /package/test/integration/generated/{lro/lroBasic → azure/core-traits}/tsconfig.json +0 -0
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
ModelValuePutParameters,
|
|
23
23
|
RecursiveModelValueGetParameters,
|
|
24
24
|
RecursiveModelValuePutParameters,
|
|
25
|
+
NullableFloatValueGetParameters,
|
|
26
|
+
NullableFloatValuePutParameters,
|
|
25
27
|
} from "./parameters";
|
|
26
28
|
import {
|
|
27
29
|
Int32ValueGet200Response,
|
|
@@ -44,6 +46,8 @@ import {
|
|
|
44
46
|
ModelValuePut204Response,
|
|
45
47
|
RecursiveModelValueGet200Response,
|
|
46
48
|
RecursiveModelValuePut204Response,
|
|
49
|
+
NullableFloatValueGet200Response,
|
|
50
|
+
NullableFloatValuePut204Response,
|
|
47
51
|
} from "./responses";
|
|
48
52
|
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
49
53
|
|
|
@@ -137,27 +141,38 @@ export interface RecursiveModelValueGet {
|
|
|
137
141
|
): StreamableMethod<RecursiveModelValuePut204Response>;
|
|
138
142
|
}
|
|
139
143
|
|
|
144
|
+
export interface NullableFloatValueGet {
|
|
145
|
+
get(
|
|
146
|
+
options?: NullableFloatValueGetParameters
|
|
147
|
+
): StreamableMethod<NullableFloatValueGet200Response>;
|
|
148
|
+
put(
|
|
149
|
+
options: NullableFloatValuePutParameters
|
|
150
|
+
): StreamableMethod<NullableFloatValuePut204Response>;
|
|
151
|
+
}
|
|
152
|
+
|
|
140
153
|
export interface Routes {
|
|
141
|
-
/** Resource for '/dictionary/int32' has methods for the following verbs: get, put */
|
|
142
|
-
(path: "/dictionary/int32"): Int32ValueGet;
|
|
143
|
-
/** Resource for '/dictionary/int64' has methods for the following verbs: get, put */
|
|
144
|
-
(path: "/dictionary/int64"): Int64ValueGet;
|
|
145
|
-
/** Resource for '/dictionary/boolean' has methods for the following verbs: get, put */
|
|
146
|
-
(path: "/dictionary/boolean"): BooleanValueGet;
|
|
147
|
-
/** Resource for '/dictionary/string' has methods for the following verbs: get, put */
|
|
148
|
-
(path: "/dictionary/string"): StringValueGet;
|
|
149
|
-
/** Resource for '/dictionary/float32' has methods for the following verbs: get, put */
|
|
150
|
-
(path: "/dictionary/float32"): Float32ValueGet;
|
|
151
|
-
/** Resource for '/dictionary/datetime' has methods for the following verbs: get, put */
|
|
152
|
-
(path: "/dictionary/datetime"): DatetimeValueGet;
|
|
153
|
-
/** Resource for '/dictionary/duration' has methods for the following verbs: get, put */
|
|
154
|
-
(path: "/dictionary/duration"): DurationValueGet;
|
|
155
|
-
/** Resource for '/dictionary/unknown' has methods for the following verbs: get, put */
|
|
156
|
-
(path: "/dictionary/unknown"): UnknownValueGet;
|
|
157
|
-
/** Resource for '/dictionary/model' has methods for the following verbs: get, put */
|
|
158
|
-
(path: "/dictionary/model"): ModelValueGet;
|
|
159
|
-
/** Resource for '/dictionary/model/recursive' has methods for the following verbs: get, put */
|
|
160
|
-
(path: "/dictionary/model/recursive"): RecursiveModelValueGet;
|
|
154
|
+
/** Resource for '/type/dictionary/int32' has methods for the following verbs: get, put */
|
|
155
|
+
(path: "/type/dictionary/int32"): Int32ValueGet;
|
|
156
|
+
/** Resource for '/type/dictionary/int64' has methods for the following verbs: get, put */
|
|
157
|
+
(path: "/type/dictionary/int64"): Int64ValueGet;
|
|
158
|
+
/** Resource for '/type/dictionary/boolean' has methods for the following verbs: get, put */
|
|
159
|
+
(path: "/type/dictionary/boolean"): BooleanValueGet;
|
|
160
|
+
/** Resource for '/type/dictionary/string' has methods for the following verbs: get, put */
|
|
161
|
+
(path: "/type/dictionary/string"): StringValueGet;
|
|
162
|
+
/** Resource for '/type/dictionary/float32' has methods for the following verbs: get, put */
|
|
163
|
+
(path: "/type/dictionary/float32"): Float32ValueGet;
|
|
164
|
+
/** Resource for '/type/dictionary/datetime' has methods for the following verbs: get, put */
|
|
165
|
+
(path: "/type/dictionary/datetime"): DatetimeValueGet;
|
|
166
|
+
/** Resource for '/type/dictionary/duration' has methods for the following verbs: get, put */
|
|
167
|
+
(path: "/type/dictionary/duration"): DurationValueGet;
|
|
168
|
+
/** Resource for '/type/dictionary/unknown' has methods for the following verbs: get, put */
|
|
169
|
+
(path: "/type/dictionary/unknown"): UnknownValueGet;
|
|
170
|
+
/** Resource for '/type/dictionary/model' has methods for the following verbs: get, put */
|
|
171
|
+
(path: "/type/dictionary/model"): ModelValueGet;
|
|
172
|
+
/** Resource for '/type/dictionary/model/recursive' has methods for the following verbs: get, put */
|
|
173
|
+
(path: "/type/dictionary/model/recursive"): RecursiveModelValueGet;
|
|
174
|
+
/** Resource for '/type/dictionary/nullable-float' has methods for the following verbs: get, put */
|
|
175
|
+
(path: "/type/dictionary/nullable-float"): NullableFloatValueGet;
|
|
161
176
|
}
|
|
162
177
|
|
|
163
178
|
export type DictClient = Client & {
|
|
@@ -84,3 +84,11 @@ export interface RecursiveModelValuePutBodyParam {
|
|
|
84
84
|
|
|
85
85
|
export type RecursiveModelValuePutParameters = RecursiveModelValuePutBodyParam &
|
|
86
86
|
RequestParameters;
|
|
87
|
+
export type NullableFloatValueGetParameters = RequestParameters;
|
|
88
|
+
|
|
89
|
+
export interface NullableFloatValuePutBodyParam {
|
|
90
|
+
body: Record<string, number | null>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type NullableFloatValuePutParameters = NullableFloatValuePutBodyParam &
|
|
94
|
+
RequestParameters;
|
|
@@ -113,3 +113,14 @@ export interface RecursiveModelValueGet200Response extends HttpResponse {
|
|
|
113
113
|
export interface RecursiveModelValuePut204Response extends HttpResponse {
|
|
114
114
|
status: "204";
|
|
115
115
|
}
|
|
116
|
+
|
|
117
|
+
/** The request has succeeded. */
|
|
118
|
+
export interface NullableFloatValueGet200Response extends HttpResponse {
|
|
119
|
+
status: "200";
|
|
120
|
+
body: Record<string, number | null>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** There is no content to send for this request, but the headers may be useful. */
|
|
124
|
+
export interface NullableFloatValuePut204Response extends HttpResponse {
|
|
125
|
+
status: "204";
|
|
126
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
"
|
|
1
|
+
emit:
|
|
2
|
+
- "@azure-tools/typespec-ts"
|
|
3
|
+
options:
|
|
4
|
+
"@azure-tools/typespec-ts":
|
|
5
|
+
"emitter-output-dir": "{project-root}"
|
|
3
6
|
generateMetadata: true
|
|
4
7
|
generateTest: false
|
|
5
8
|
addCredentials: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TypeEnumExtensible REST client library for JavaScript
|
|
2
2
|
|
|
3
3
|
Extensible Enums Test Service
|
|
4
4
|
|
|
@@ -20,13 +20,13 @@ Key links:
|
|
|
20
20
|
|
|
21
21
|
### Install the `@msinternal/extensible-enums` package
|
|
22
22
|
|
|
23
|
-
Install the
|
|
23
|
+
Install the TypeEnumExtensible REST client REST client library for JavaScript with `npm`:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
npm install @msinternal/extensible-enums
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### Create and authenticate a `
|
|
29
|
+
### Create and authenticate a `TypeEnumExtensibleClient`
|
|
30
30
|
|
|
31
31
|
To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
|
|
32
32
|
provide an instance of the desired credential type obtained from the
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"autoPublish": false,
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@azure/core-auth": "^1.3.0",
|
|
55
|
-
"@azure-rest/core-client": "^1.1.
|
|
55
|
+
"@azure-rest/core-client": "^1.1.2",
|
|
56
56
|
"@azure/core-rest-pipeline": "^1.8.0",
|
|
57
57
|
"@azure/logger": "^1.0.0",
|
|
58
58
|
"tslib": "^2.2.0"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prettier": "^2.5.1",
|
|
68
68
|
"rimraf": "^3.0.0",
|
|
69
69
|
"source-map-support": "^0.5.9",
|
|
70
|
-
"typescript": "~
|
|
70
|
+
"typescript": "~5.0.0",
|
|
71
71
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
72
72
|
"@rollup/plugin-json": "^6.0.0",
|
|
73
73
|
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
@@ -34,12 +34,12 @@ export interface GetUnknownValue {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface Routes {
|
|
37
|
-
/** Resource for '/
|
|
38
|
-
(path: "/
|
|
39
|
-
/** Resource for '/
|
|
40
|
-
(path: "/
|
|
37
|
+
/** Resource for '/type/enum/extensible/string/known-value' has methods for the following verbs: get, put */
|
|
38
|
+
(path: "/type/enum/extensible/string/known-value"): GetKnownValue;
|
|
39
|
+
/** Resource for '/type/enum/extensible/string/unknown-value' has methods for the following verbs: get, put */
|
|
40
|
+
(path: "/type/enum/extensible/string/unknown-value"): GetUnknownValue;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type TypeEnumExtensibleClient = Client & {
|
|
44
44
|
path: Routes;
|
|
45
45
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import TypeEnumExtensible from "./typeEnumExtensible";
|
|
5
5
|
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./typeEnumExtensible";
|
|
7
7
|
export * from "./parameters";
|
|
8
8
|
export * from "./responses";
|
|
9
9
|
export * from "./clientDefinitions";
|
|
10
10
|
|
|
11
|
-
export default
|
|
11
|
+
export default TypeEnumExtensible;
|
package/test/integration/generated/enums/extensible/src/{enumsExtensible.ts → typeEnumExtensible.ts}
RENAMED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
|
|
4
4
|
import { getClient, ClientOptions } from "@azure-rest/core-client";
|
|
5
|
-
import {
|
|
5
|
+
import { TypeEnumExtensibleClient } from "./clientDefinitions";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Initialize a new instance of `
|
|
8
|
+
* Initialize a new instance of `TypeEnumExtensibleClient`
|
|
9
9
|
* @param options type: ClientOptions, the parameter for all optional parameters
|
|
10
10
|
*/
|
|
11
11
|
export default function createClient(
|
|
12
12
|
options: ClientOptions = {}
|
|
13
|
-
):
|
|
13
|
+
): TypeEnumExtensibleClient {
|
|
14
14
|
const baseUrl = options.baseUrl ?? `http://localhost:3000`;
|
|
15
15
|
options.apiVersion = options.apiVersion ?? "1.0.0";
|
|
16
16
|
const userAgentInfo = `azsdk-js-extensible-enums-rest/1.0.0`;
|
|
@@ -25,7 +25,7 @@ export default function createClient(
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const client = getClient(baseUrl, options) as
|
|
28
|
+
const client = getClient(baseUrl, options) as TypeEnumExtensibleClient;
|
|
29
29
|
|
|
30
30
|
return client;
|
|
31
31
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
"
|
|
1
|
+
emit:
|
|
2
|
+
- "@azure-tools/typespec-ts"
|
|
3
|
+
options:
|
|
4
|
+
"@azure-tools/typespec-ts":
|
|
5
|
+
"emitter-output-dir": "{project-root}"
|
|
3
6
|
generateMetadata: true
|
|
4
7
|
generateTest: false
|
|
5
8
|
addCredentials: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TypeEnumFixed REST client library for JavaScript
|
|
2
2
|
|
|
3
3
|
Fixed Enums Test Service
|
|
4
4
|
|
|
@@ -20,13 +20,13 @@ Key links:
|
|
|
20
20
|
|
|
21
21
|
### Install the `@msinternal/extensible-fixed` package
|
|
22
22
|
|
|
23
|
-
Install the
|
|
23
|
+
Install the TypeEnumFixed REST client REST client library for JavaScript with `npm`:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
npm install @msinternal/extensible-fixed
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### Create and authenticate a `
|
|
29
|
+
### Create and authenticate a `TypeEnumFixedClient`
|
|
30
30
|
|
|
31
31
|
To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
|
|
32
32
|
provide an instance of the desired credential type obtained from the
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"autoPublish": false,
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@azure/core-auth": "^1.3.0",
|
|
55
|
-
"@azure-rest/core-client": "^1.1.
|
|
55
|
+
"@azure-rest/core-client": "^1.1.2",
|
|
56
56
|
"@azure/core-rest-pipeline": "^1.8.0",
|
|
57
57
|
"@azure/logger": "^1.0.0",
|
|
58
58
|
"tslib": "^2.2.0"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prettier": "^2.5.1",
|
|
68
68
|
"rimraf": "^3.0.0",
|
|
69
69
|
"source-map-support": "^0.5.9",
|
|
70
|
-
"typescript": "~
|
|
70
|
+
"typescript": "~5.0.0",
|
|
71
71
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
72
72
|
"@rollup/plugin-json": "^6.0.0",
|
|
73
73
|
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
@@ -32,12 +32,12 @@ export interface PutUnknownValue {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface Routes {
|
|
35
|
-
/** Resource for '/
|
|
36
|
-
(path: "/
|
|
37
|
-
/** Resource for '/
|
|
38
|
-
(path: "/
|
|
35
|
+
/** Resource for '/type/enum/fixed/string/known-value' has methods for the following verbs: get, put */
|
|
36
|
+
(path: "/type/enum/fixed/string/known-value"): GetKnownValue;
|
|
37
|
+
/** Resource for '/type/enum/fixed/string/unknown-value' has methods for the following verbs: put */
|
|
38
|
+
(path: "/type/enum/fixed/string/unknown-value"): PutUnknownValue;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export type
|
|
41
|
+
export type TypeEnumFixedClient = Client & {
|
|
42
42
|
path: Routes;
|
|
43
43
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import TypeEnumFixed from "./typeEnumFixed";
|
|
5
5
|
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./typeEnumFixed";
|
|
7
7
|
export * from "./parameters";
|
|
8
8
|
export * from "./responses";
|
|
9
9
|
export * from "./clientDefinitions";
|
|
10
10
|
|
|
11
|
-
export default
|
|
11
|
+
export default TypeEnumFixed;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
|
|
4
4
|
import { getClient, ClientOptions } from "@azure-rest/core-client";
|
|
5
|
-
import {
|
|
5
|
+
import { TypeEnumFixedClient } from "./clientDefinitions";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Initialize a new instance of `
|
|
8
|
+
* Initialize a new instance of `TypeEnumFixedClient`
|
|
9
9
|
* @param options type: ClientOptions, the parameter for all optional parameters
|
|
10
10
|
*/
|
|
11
11
|
export default function createClient(
|
|
12
12
|
options: ClientOptions = {}
|
|
13
|
-
):
|
|
13
|
+
): TypeEnumFixedClient {
|
|
14
14
|
const baseUrl = options.baseUrl ?? `http://localhost:3000`;
|
|
15
15
|
options.apiVersion = options.apiVersion ?? "1.0.0";
|
|
16
16
|
const userAgentInfo = `azsdk-js-extensible-fixed-rest/1.0.0`;
|
|
@@ -25,7 +25,7 @@ export default function createClient(
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const client = getClient(baseUrl, options) as
|
|
28
|
+
const client = getClient(baseUrl, options) as TypeEnumFixedClient;
|
|
29
29
|
|
|
30
30
|
return client;
|
|
31
31
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
"
|
|
1
|
+
emit:
|
|
2
|
+
- "@azure-tools/typespec-ts"
|
|
3
|
+
options:
|
|
4
|
+
"@azure-tools/typespec-ts":
|
|
5
|
+
"emitter-output-dir": "{project-root}"
|
|
3
6
|
generateMetadata: true
|
|
4
7
|
generateTest: false
|
|
5
8
|
addCredentials: false
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"autoPublish": false,
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@azure/core-auth": "^1.3.0",
|
|
55
|
-
"@azure-rest/core-client": "^1.1.
|
|
55
|
+
"@azure-rest/core-client": "^1.1.2",
|
|
56
56
|
"@azure/core-rest-pipeline": "^1.8.0",
|
|
57
57
|
"@azure/logger": "^1.0.0",
|
|
58
58
|
"tslib": "^2.2.0"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prettier": "^2.5.1",
|
|
68
68
|
"rimraf": "^3.0.0",
|
|
69
69
|
"source-map-support": "^0.5.9",
|
|
70
|
-
"typescript": "~
|
|
70
|
+
"typescript": "~5.0.0",
|
|
71
71
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
72
72
|
"@rollup/plugin-json": "^6.0.0",
|
|
73
73
|
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
"
|
|
1
|
+
emit:
|
|
2
|
+
- "@azure-tools/typespec-ts"
|
|
3
|
+
options:
|
|
4
|
+
"@azure-tools/typespec-ts":
|
|
5
|
+
"emitter-output-dir": "{project-root}"
|
|
3
6
|
generateMetadata: true
|
|
4
7
|
generateTest: false
|
|
5
8
|
addCredentials: false
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
|
|
4
|
+
import { GetInternalParameters, PostInternalParameters } from "./parameters";
|
|
5
|
+
import { GetInternal200Response, PostInternal200Response } from "./responses";
|
|
6
|
+
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
7
|
+
|
|
8
|
+
export interface GetInternal {
|
|
9
|
+
get(options: GetInternalParameters): StreamableMethod<GetInternal200Response>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface PostInternal {
|
|
13
|
+
post(
|
|
14
|
+
options: PostInternalParameters
|
|
15
|
+
): StreamableMethod<PostInternal200Response>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Routes {
|
|
19
|
+
/** Resource for '/azure/client-generator-core/internal/getInternal' has methods for the following verbs: get */
|
|
20
|
+
(path: "/azure/client-generator-core/internal/getInternal"): GetInternal;
|
|
21
|
+
/** Resource for '/azure/client-generator-core/internal/postInternal' has methods for the following verbs: post */
|
|
22
|
+
(path: "/azure/client-generator-core/internal/postInternal"): PostInternal;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type InternalClient = Client & {
|
|
26
|
+
path: Routes;
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
|
|
4
|
+
import InternalClient from "./internalClient";
|
|
5
|
+
|
|
6
|
+
export * from "./internalClient";
|
|
7
|
+
export * from "./parameters";
|
|
8
|
+
export * from "./responses";
|
|
9
|
+
export * from "./clientDefinitions";
|
|
10
|
+
export * from "./models";
|
|
11
|
+
export * from "./outputModels";
|
|
12
|
+
|
|
13
|
+
export default InternalClient;
|
package/test/integration/generated/{lro/lroBasic/src/azureLro.ts → internal/src/internalClient.ts}
RENAMED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
|
|
4
4
|
import { getClient, ClientOptions } from "@azure-rest/core-client";
|
|
5
|
-
import {
|
|
5
|
+
import { InternalClient } from "./clientDefinitions";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Initialize a new instance of `
|
|
8
|
+
* Initialize a new instance of `InternalClient`
|
|
9
9
|
* @param options type: ClientOptions, the parameter for all optional parameters
|
|
10
10
|
*/
|
|
11
11
|
export default function createClient(
|
|
12
12
|
options: ClientOptions = {}
|
|
13
|
-
):
|
|
13
|
+
): InternalClient {
|
|
14
14
|
const baseUrl = options.baseUrl ?? `http://localhost:3000`;
|
|
15
15
|
options.apiVersion = options.apiVersion ?? "1.0.0";
|
|
16
|
-
const userAgentInfo = `azsdk-js-
|
|
16
|
+
const userAgentInfo = `azsdk-js-internal-rest/1.0.0-beta.1`;
|
|
17
17
|
const userAgentPrefix =
|
|
18
18
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
19
19
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
@@ -25,7 +25,7 @@ export default function createClient(
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const client = getClient(baseUrl, options) as
|
|
28
|
+
const client = getClient(baseUrl, options) as InternalClient;
|
|
29
29
|
|
|
30
30
|
return client;
|
|
31
31
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
|
|
4
|
+
/** This is an internal model. */
|
|
5
|
+
export interface InternalModelOutput {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** This is a non-internal model only used by internal operation. */
|
|
10
|
+
export interface ModelOnlyUsedByInternalOperationOutput {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
|
|
4
|
+
import { RequestParameters } from "@azure-rest/core-client";
|
|
5
|
+
import { ModelOnlyUsedByInternalOperation } from "./models";
|
|
6
|
+
|
|
7
|
+
export interface GetInternalQueryParamProperties {
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface GetInternalQueryParam {
|
|
12
|
+
queryParameters: GetInternalQueryParamProperties;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GetInternalParameters = GetInternalQueryParam & RequestParameters;
|
|
16
|
+
|
|
17
|
+
export interface PostInternalBodyParam {
|
|
18
|
+
body: ModelOnlyUsedByInternalOperation;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type PostInternalParameters = PostInternalBodyParam & RequestParameters;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
|
|
4
|
+
import { HttpResponse } from "@azure-rest/core-client";
|
|
5
|
+
import {
|
|
6
|
+
InternalModelOutput,
|
|
7
|
+
ModelOnlyUsedByInternalOperationOutput,
|
|
8
|
+
} from "./outputModels";
|
|
9
|
+
|
|
10
|
+
/** The request has succeeded. */
|
|
11
|
+
export interface GetInternal200Response extends HttpResponse {
|
|
12
|
+
status: "200";
|
|
13
|
+
body: InternalModelOutput;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The request has succeeded. */
|
|
17
|
+
export interface PostInternal200Response extends HttpResponse {
|
|
18
|
+
status: "200";
|
|
19
|
+
body: ModelOnlyUsedByInternalOperationOutput;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
emit:
|
|
2
|
+
- "@azure-tools/typespec-ts"
|
|
3
|
+
options:
|
|
4
|
+
"@azure-tools/typespec-ts":
|
|
5
|
+
"emitter-output-dir": "{project-root}"
|
|
6
|
+
generateMetadata: false
|
|
7
|
+
generateTest: false
|
|
8
|
+
addCredentials: false
|
|
9
|
+
azureSdkForJs: false
|
|
10
|
+
isCadlTest: true
|
|
11
|
+
title: InternalClient
|
|
12
|
+
packageDetails:
|
|
13
|
+
name: "@msinternal/internal"
|
|
14
|
+
description: "Internal Test Service"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": ["@azure/azure-sdk"],
|
|
3
|
+
"extends": ["plugin:@azure/azure-sdk/azure-sdk-base"],
|
|
4
|
+
"rules": {
|
|
5
|
+
"@azure/azure-sdk/ts-modules-only-named": "warn",
|
|
6
|
+
"@azure/azure-sdk/ts-apiextractor-json-types": "warn",
|
|
7
|
+
"@azure/azure-sdk/ts-package-json-types": "warn",
|
|
8
|
+
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
|
|
9
|
+
"tsdoc/syntax": "warn"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# SpecsAzureCoreLroStandard REST client library for JavaScript
|
|
2
|
+
|
|
3
|
+
Illustrates bodies templated with Azure Core with long-running operation
|
|
4
|
+
|
|
5
|
+
**Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
|
|
6
|
+
|
|
7
|
+
Key links:
|
|
8
|
+
|
|
9
|
+
- [Package (NPM)](https://www.npmjs.com/package/@msinternal/lro-core)
|
|
10
|
+
|
|
11
|
+
## Getting started
|
|
12
|
+
|
|
13
|
+
### Currently supported environments
|
|
14
|
+
|
|
15
|
+
- LTS versions of Node.js
|
|
16
|
+
|
|
17
|
+
### Prerequisites
|
|
18
|
+
|
|
19
|
+
- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
|
|
20
|
+
|
|
21
|
+
### Install the `@msinternal/lro-core` package
|
|
22
|
+
|
|
23
|
+
Install the SpecsAzureCoreLroStandard REST client REST client library for JavaScript with `npm`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @msinternal/lro-core
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Create and authenticate a `SpecsAzureCoreLroStandardClient`
|
|
30
|
+
|
|
31
|
+
To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
|
|
32
|
+
provide an instance of the desired credential type obtained from the
|
|
33
|
+
[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
|
|
34
|
+
|
|
35
|
+
To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
|
|
36
|
+
|
|
37
|
+
After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use.
|
|
38
|
+
As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
|
|
39
|
+
can be used to authenticate the client.
|
|
40
|
+
|
|
41
|
+
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
|
|
42
|
+
AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
|
|
43
|
+
|
|
44
|
+
## Troubleshooting
|
|
45
|
+
|
|
46
|
+
### Logging
|
|
47
|
+
|
|
48
|
+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
const { setLogLevel } = require("@azure/logger");
|
|
52
|
+
|
|
53
|
+
setLogLevel("info");
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|