@azure-tools/typespec-ts 0.54.0 → 0.55.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -10
- package/README.md +0 -4
- package/dist/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.js +3 -3
- package/dist/src/contextManager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +2 -4
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +31 -40
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +8 -12
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
- package/dist/src/framework/hooks/useDependencies.js +1 -1
- package/dist/src/framework/hooks/useDependencies.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +1 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +17 -31
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.d.ts.map +1 -1
- package/dist/src/framework/reference.js +2 -2
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/sample.js +8 -8
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +103 -92
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +140 -140
- package/dist/src/lib.js.map +1 -1
- package/dist/src/metaTree.d.ts +1 -1
- package/dist/src/metaTree.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +60 -74
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +8 -10
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts +2 -2
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +31 -38
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildModularOptions.d.ts +1 -1
- package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
- package/dist/src/modular/buildModularOptions.js +5 -6
- package/dist/src/modular/buildModularOptions.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +3 -3
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +23 -25
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +8 -11
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +12 -13
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts +2 -2
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +36 -50
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +9 -18
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
- package/dist/src/modular/emitLoggerFile.js +4 -4
- package/dist/src/modular/emitLoggerFile.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +81 -113
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +7 -8
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.d.ts.map +1 -1
- package/dist/src/modular/emitSamples.js +69 -77
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.d.ts.map +1 -1
- package/dist/src/modular/emitTests.js +13 -18
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/external-dependencies.js +54 -54
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +59 -68
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +31 -54
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +72 -84
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +7 -10
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +204 -288
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +4 -6
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +58 -67
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +65 -75
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +73 -90
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.js +25 -33
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +60 -60
- package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -2
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +10 -13
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js +2 -3
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +5 -11
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
- package/dist/src/rlc-common/buildClient.d.ts +1 -1
- package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClient.js +67 -89
- package/dist/src/rlc-common/buildClient.js.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +28 -45
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.js +59 -60
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +37 -38
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
- package/dist/src/rlc-common/buildLogger.js +4 -5
- package/dist/src/rlc-common/buildLogger.js.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +4 -4
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.js +57 -96
- package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
- package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.js +71 -61
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.js +9 -10
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.js +23 -27
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSamples.js +2 -2
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSchemaType.js +31 -13
- package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
- package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +6 -8
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +32 -37
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js +2 -4
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +17 -23
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +16 -31
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
- package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
- package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +3 -7
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +4 -9
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +7 -11
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +28 -28
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +28 -28
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +14 -15
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +5 -8
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +33 -37
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +31 -39
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +4 -6
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +3 -5
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +11 -12
- package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +28 -28
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -5
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +4 -5
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +14 -14
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +24 -29
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +28 -31
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/utils.js +1 -2
- package/dist/src/rlc-common/metadata/utils.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +4 -5
- package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +3 -4
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.js +7 -10
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.js +41 -45
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/transform/transform.d.ts +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +28 -27
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +12 -14
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +11 -14
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +32 -45
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +19 -23
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +1 -1
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +21 -25
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +21 -32
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.js +3 -3
- package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +28 -39
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.d.ts +1 -1
- package/dist/src/utils/clientUtils.d.ts.map +1 -1
- package/dist/src/utils/clientUtils.js +15 -23
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.d.ts +1 -1
- package/dist/src/utils/credentialUtils.d.ts.map +1 -1
- package/dist/src/utils/credentialUtils.js +4 -5
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +11 -15
- package/dist/src/utils/crossLanguageDef.js.map +1 -1
- package/dist/src/utils/emitUtil.d.ts +1 -1
- package/dist/src/utils/emitUtil.d.ts.map +1 -1
- package/dist/src/utils/emitUtil.js +5 -7
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts +2 -0
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +26 -7
- package/dist/src/utils/fileSystemUtils.js.map +1 -1
- package/dist/src/utils/importHelper.d.ts.map +1 -1
- package/dist/src/utils/importHelper.js +3 -6
- package/dist/src/utils/importHelper.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +1 -1
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.js +7 -19
- package/dist/src/utils/mediaTypes.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts +5 -5
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +168 -257
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
- package/dist/src/utils/namespaceUtils.js +6 -7
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +60 -81
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/src/utils/parameterUtils.d.ts +1 -1
- package/dist/src/utils/parameterUtils.d.ts.map +1 -1
- package/dist/src/utils/parameterUtils.js +26 -33
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.js +2 -2
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -45
- package/src/contextManager.ts +6 -9
- package/src/framework/declaration.ts +18 -28
- package/src/framework/dependency.ts +1 -2
- package/src/framework/hooks/binder.ts +47 -120
- package/src/framework/hooks/sdkTypes.ts +27 -54
- package/src/framework/hooks/useDependencies.ts +2 -4
- package/src/framework/load-static-helpers.ts +28 -51
- package/src/framework/reference.ts +2 -5
- package/src/framework/sample.ts +9 -9
- package/src/index.ts +145 -185
- package/src/lib.ts +143 -158
- package/src/metaTree.ts +1 -1
- package/src/modular/buildClassicalClient.ts +83 -160
- package/src/modular/buildClassicalOperationGroups.ts +14 -39
- package/src/modular/buildClientContext.ts +54 -83
- package/src/modular/buildModularOptions.ts +4 -5
- package/src/modular/buildOperations.ts +46 -73
- package/src/modular/buildProjectFiles.ts +18 -47
- package/src/modular/buildRestorePoller.ts +27 -46
- package/src/modular/buildRootIndex.ts +86 -160
- package/src/modular/buildSubpathIndex.ts +35 -58
- package/src/modular/emitLoggerFile.ts +4 -9
- package/src/modular/emitModels.ts +136 -266
- package/src/modular/emitModelsOptions.ts +10 -16
- package/src/modular/emitSamples.ts +92 -180
- package/src/modular/emitTests.ts +28 -61
- package/src/modular/external-dependencies.ts +54 -54
- package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
- package/src/modular/helpers/clientHelpers.ts +41 -88
- package/src/modular/helpers/clientOptionHelpers.ts +4 -11
- package/src/modular/helpers/exampleValueHelpers.ts +99 -215
- package/src/modular/helpers/namingHelpers.ts +12 -28
- package/src/modular/helpers/operationHelpers.ts +430 -757
- package/src/modular/helpers/typeHelpers.ts +11 -22
- package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
- package/src/modular/serialization/buildSerializerFunction.ts +91 -129
- package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
- package/src/modular/serialization/serializeUtils.ts +12 -22
- package/src/modular/static/rollup.test.config.js +11 -14
- package/src/modular/static/scripts/renameOutput.mjs +2 -2
- package/src/modular/static-helpers-metadata.ts +60 -60
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +5 -10
- package/src/modular/type-expressions/get-model-expression.ts +13 -17
- package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
- package/src/modular/type-expressions/get-type-expression.ts +8 -12
- package/src/modular/type-expressions/get-union-expression.ts +4 -4
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/rlc-common/buildClient.ts +70 -141
- package/src/rlc-common/buildClientDefinitions.ts +44 -87
- package/src/rlc-common/buildIndexFile.ts +78 -78
- package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
- package/src/rlc-common/buildLogger.ts +7 -7
- package/src/rlc-common/buildMethodShortcuts.ts +9 -21
- package/src/rlc-common/buildObjectTypes.ts +79 -156
- package/src/rlc-common/buildPaginateHelper.ts +9 -12
- package/src/rlc-common/buildParameterTypes.ts +116 -137
- package/src/rlc-common/buildPollingHelper.ts +7 -7
- package/src/rlc-common/buildResponseTypes.ts +34 -57
- package/src/rlc-common/buildSamples.ts +3 -3
- package/src/rlc-common/buildSchemaType.ts +37 -29
- package/src/rlc-common/buildSerializeHelper.ts +5 -5
- package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
- package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
- package/src/rlc-common/helpers/importsUtil.ts +27 -30
- package/src/rlc-common/helpers/nameConstructors.ts +16 -50
- package/src/rlc-common/helpers/nameUtils.ts +19 -42
- package/src/rlc-common/helpers/operationHelpers.ts +14 -31
- package/src/rlc-common/helpers/pathUtils.ts +2 -7
- package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
- package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
- package/src/rlc-common/helpers/typeUtil.ts +4 -11
- package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
- package/src/rlc-common/index.ts +28 -28
- package/src/rlc-common/interfaces.ts +3 -11
- package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
- package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
- package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
- package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
- package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
- package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
- package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
- package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
- package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
- package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
- package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
- package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
- package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
- package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
- package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
- package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
- package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
- package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
- package/src/rlc-common/test/buildRecordedClient.ts +3 -3
- package/src/rlc-common/test/buildSampleTest.ts +3 -3
- package/src/rlc-common/test/buildSnippets.ts +6 -12
- package/src/rlc-common/transformSampleGroups.ts +54 -105
- package/src/testing/index.ts +2 -5
- package/src/transform/transform.ts +22 -34
- package/src/transform/transformApiVersionInfo.ts +17 -30
- package/src/transform/transformHelperFunctionDetails.ts +14 -26
- package/src/transform/transformParameters.ts +55 -105
- package/src/transform/transformPaths.ts +26 -43
- package/src/transform/transformResponses.ts +26 -33
- package/src/transform/transformSchemas.ts +15 -33
- package/src/transform/transformTelemetryInfo.ts +8 -14
- package/src/transform/transfromRLCOptions.ts +53 -116
- package/src/utils/clientUtils.ts +22 -41
- package/src/utils/credentialUtils.ts +8 -19
- package/src/utils/crossLanguageDef.ts +15 -34
- package/src/utils/emitUtil.ts +11 -17
- package/src/utils/fileSystemUtils.ts +30 -8
- package/src/utils/importHelper.ts +5 -10
- package/src/utils/interfaces.ts +1 -1
- package/src/utils/mediaTypes.ts +13 -34
- package/src/utils/modelUtils.ts +175 -384
- package/src/utils/namespaceUtils.ts +8 -24
- package/src/utils/operationUtil.ts +98 -190
- package/src/utils/parameterUtils.ts +31 -54
- package/src/utils/resolve-project-root.ts +3 -3
- package/static/static-helpers/cloudSettingHelpers.ts +4 -6
- package/static/static-helpers/multipartHelpers.ts +3 -3
- package/static/static-helpers/pagingHelpers.ts +28 -63
- package/static/static-helpers/pollingHelpers.ts +16 -29
- package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
- package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
- package/static/static-helpers/serialization/get-binary-response-browser.mts +3 -1
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
- package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
- package/static/static-helpers/serialization/serialize-record.ts +1 -1
- package/static/static-helpers/serialization/serializers.ts +4 -7
- package/static/static-helpers/serialization/xml-helpers.ts +42 -90
- package/static/static-helpers/simplePollerHelpers.ts +10 -19
- package/static/static-helpers/storageCompatResponse.ts +10 -27
- package/static/static-helpers/urlTemplate.ts +4 -7
- package/static/test-helpers/recordedClient.ts +5 -10
|
@@ -7,9 +7,7 @@ import { NodeReadableStream } from "../platform-types.js";
|
|
|
7
7
|
* Error handling is left to the caller so that generated deserializers can apply
|
|
8
8
|
* operation-specific error deserialization (per-status-code details, exception headers, etc.).
|
|
9
9
|
*/
|
|
10
|
-
export async function getBinaryStreamResponse(
|
|
11
|
-
streamableMethod: StreamableMethod
|
|
12
|
-
): Promise<
|
|
10
|
+
export async function getBinaryStreamResponse(streamableMethod: StreamableMethod): Promise<
|
|
13
11
|
HttpResponse & {
|
|
14
12
|
blobBody?: Promise<Blob>;
|
|
15
13
|
readableStreamBody?: NodeReadableStream;
|
|
@@ -19,6 +17,6 @@ export async function getBinaryStreamResponse(
|
|
|
19
17
|
return {
|
|
20
18
|
...response,
|
|
21
19
|
blobBody: undefined,
|
|
22
|
-
readableStreamBody: response.body
|
|
20
|
+
readableStreamBody: response.body,
|
|
23
21
|
};
|
|
24
22
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { EncodingType, uint8ArrayToString } from "@typespec/ts-http-runtime";
|
|
2
2
|
export const serializeRecord = withNullChecks(
|
|
3
|
-
(
|
|
4
|
-
item: Record<string, any>,
|
|
5
|
-
serializer?: (item: any) => any
|
|
6
|
-
): Record<string, any> => {
|
|
3
|
+
(item: Record<string, any>, serializer?: (item: any) => any): Record<string, any> => {
|
|
7
4
|
return Object.keys(item).reduce((acc, key) => {
|
|
8
5
|
if (isPassthroughElement(item[key])) {
|
|
9
6
|
acc[key] = item[key] as any;
|
|
@@ -18,7 +15,7 @@ export const serializeRecord = withNullChecks(
|
|
|
18
15
|
}
|
|
19
16
|
return acc;
|
|
20
17
|
}, {});
|
|
21
|
-
}
|
|
18
|
+
},
|
|
22
19
|
);
|
|
23
20
|
|
|
24
21
|
export const serializePassthrough = withNullChecks(<T>(item: T): T => item);
|
|
@@ -31,7 +28,7 @@ export const serializeArray = withNullChecks(
|
|
|
31
28
|
}
|
|
32
29
|
return serializer(item);
|
|
33
30
|
});
|
|
34
|
-
}
|
|
31
|
+
},
|
|
35
32
|
);
|
|
36
33
|
|
|
37
34
|
export const serializeUtcDateTime = withNullChecks((date: Date): string => {
|
|
@@ -42,7 +39,7 @@ export const serializeUtcDateTime = withNullChecks((date: Date): string => {
|
|
|
42
39
|
export const serializeBytes = withNullChecks(
|
|
43
40
|
(bytes: Uint8Array, encoding: EncodingType): string => {
|
|
44
41
|
return uint8ArrayToString(bytes, encoding);
|
|
45
|
-
}
|
|
42
|
+
},
|
|
46
43
|
);
|
|
47
44
|
|
|
48
45
|
export function withNullChecks(fn: (input: any, ...args: any) => unknown) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import { stringToUint8Array, uint8ArrayToString } from "@azure/core-util";
|
|
4
5
|
import { XMLBuilder, XMLParser, XmlBuilderOptions } from "fast-xml-parser";
|
|
5
|
-
import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* XML serialization options for a property or model
|
|
@@ -86,13 +86,7 @@ export interface XmlAdditionalPropertiesConfig {
|
|
|
86
86
|
/**
|
|
87
87
|
* Result of XML serialization - either a primitive value or structured XML object
|
|
88
88
|
*/
|
|
89
|
-
export type XmlSerializedValue =
|
|
90
|
-
| string
|
|
91
|
-
| number
|
|
92
|
-
| boolean
|
|
93
|
-
| null
|
|
94
|
-
| undefined
|
|
95
|
-
| XmlSerializedObject;
|
|
89
|
+
export type XmlSerializedValue = string | number | boolean | null | undefined | XmlSerializedObject;
|
|
96
90
|
|
|
97
91
|
export interface XmlSerializedObject {
|
|
98
92
|
[key: string]: XmlSerializedValue | XmlSerializedValue[];
|
|
@@ -106,16 +100,11 @@ const defaultParserOptions = {
|
|
|
106
100
|
parseTagValue: false,
|
|
107
101
|
parseAttributeValue: false,
|
|
108
102
|
trimValues: false, // Preserve whitespace in text content
|
|
109
|
-
isArray: (
|
|
110
|
-
_name: string,
|
|
111
|
-
_jpath: string | unknown,
|
|
112
|
-
isLeafNode: boolean,
|
|
113
|
-
isAttribute: boolean
|
|
114
|
-
) => {
|
|
103
|
+
isArray: (_name: string, _jpath: string | unknown, isLeafNode: boolean, isAttribute: boolean) => {
|
|
115
104
|
// Don't auto-detect arrays for attributes or leaf nodes by default
|
|
116
105
|
// Let the metadata drive array detection
|
|
117
106
|
return !isAttribute && !isLeafNode;
|
|
118
|
-
}
|
|
107
|
+
},
|
|
119
108
|
};
|
|
120
109
|
|
|
121
110
|
const defaultBuilderOptions: Partial<XmlBuilderOptions> = {
|
|
@@ -123,16 +112,13 @@ const defaultBuilderOptions: Partial<XmlBuilderOptions> = {
|
|
|
123
112
|
attributeNamePrefix: "@_",
|
|
124
113
|
textNodeName: "#text",
|
|
125
114
|
format: false,
|
|
126
|
-
suppressEmptyNode: true
|
|
115
|
+
suppressEmptyNode: true,
|
|
127
116
|
};
|
|
128
117
|
|
|
129
118
|
/**
|
|
130
119
|
* Creates an XML element name with optional namespace prefix
|
|
131
120
|
*/
|
|
132
|
-
function getElementName(
|
|
133
|
-
name: string,
|
|
134
|
-
ns?: { namespace: string; prefix: string }
|
|
135
|
-
): string {
|
|
121
|
+
function getElementName(name: string, ns?: { namespace: string; prefix: string }): string {
|
|
136
122
|
if (ns?.prefix) {
|
|
137
123
|
return `${ns.prefix}:${name}`;
|
|
138
124
|
}
|
|
@@ -142,9 +128,7 @@ function getElementName(
|
|
|
142
128
|
/**
|
|
143
129
|
* Creates namespace declaration attributes for the root element
|
|
144
130
|
*/
|
|
145
|
-
function createNamespaceDeclarations(
|
|
146
|
-
namespaces: Map<string, string>
|
|
147
|
-
): Record<string, string> {
|
|
131
|
+
function createNamespaceDeclarations(namespaces: Map<string, string>): Record<string, string> {
|
|
148
132
|
const declarations: Record<string, string> = {};
|
|
149
133
|
for (const [prefix, namespace] of namespaces) {
|
|
150
134
|
if (prefix) {
|
|
@@ -161,7 +145,7 @@ function createNamespaceDeclarations(
|
|
|
161
145
|
*/
|
|
162
146
|
function collectNamespaces(
|
|
163
147
|
properties: XmlPropertyMetadata[],
|
|
164
|
-
rootNs?: { namespace: string; prefix: string }
|
|
148
|
+
rootNs?: { namespace: string; prefix: string },
|
|
165
149
|
): Map<string, string> {
|
|
166
150
|
const namespaces = new Map<string, string>();
|
|
167
151
|
|
|
@@ -174,10 +158,7 @@ function collectNamespaces(
|
|
|
174
158
|
namespaces.set(prop.xmlOptions.ns.prefix, prop.xmlOptions.ns.namespace);
|
|
175
159
|
}
|
|
176
160
|
if (prop.xmlOptions.itemsNs) {
|
|
177
|
-
namespaces.set(
|
|
178
|
-
prop.xmlOptions.itemsNs.prefix,
|
|
179
|
-
prop.xmlOptions.itemsNs.namespace
|
|
180
|
-
);
|
|
161
|
+
namespaces.set(prop.xmlOptions.itemsNs.prefix, prop.xmlOptions.itemsNs.namespace);
|
|
181
162
|
}
|
|
182
163
|
}
|
|
183
164
|
|
|
@@ -191,7 +172,7 @@ function serializePrimitiveValue(
|
|
|
191
172
|
value: any,
|
|
192
173
|
type?: "array" | "object" | "primitive" | "date" | "bytes" | "dict",
|
|
193
174
|
dateEncoding?: "rfc3339" | "rfc7231" | "unixTimestamp",
|
|
194
|
-
bytesEncoding?: "base64" | "base64url"
|
|
175
|
+
bytesEncoding?: "base64" | "base64url",
|
|
195
176
|
): string | number | boolean {
|
|
196
177
|
if (value === null || value === undefined) {
|
|
197
178
|
return "";
|
|
@@ -225,12 +206,12 @@ function serializePrimitiveValue(
|
|
|
225
206
|
*/
|
|
226
207
|
function serializeArrayProperty(
|
|
227
208
|
value: any[],
|
|
228
|
-
metadata: XmlPropertyMetadata
|
|
209
|
+
metadata: XmlPropertyMetadata,
|
|
229
210
|
): XmlSerializedObject | XmlSerializedValue[] {
|
|
230
211
|
const { xmlOptions, serializer } = metadata;
|
|
231
212
|
const itemName = getElementName(
|
|
232
213
|
xmlOptions.itemsName || xmlOptions.name,
|
|
233
|
-
xmlOptions.itemsNs || xmlOptions.ns
|
|
214
|
+
xmlOptions.itemsNs || xmlOptions.ns,
|
|
234
215
|
);
|
|
235
216
|
|
|
236
217
|
const serializedItems = value.map((item) => {
|
|
@@ -241,7 +222,7 @@ function serializeArrayProperty(
|
|
|
241
222
|
item,
|
|
242
223
|
metadata.itemType ?? metadata.type,
|
|
243
224
|
metadata.dateEncoding,
|
|
244
|
-
metadata.bytesEncoding
|
|
225
|
+
metadata.bytesEncoding,
|
|
245
226
|
);
|
|
246
227
|
});
|
|
247
228
|
|
|
@@ -253,8 +234,8 @@ function serializeArrayProperty(
|
|
|
253
234
|
const wrapperName = getElementName(xmlOptions.name, xmlOptions.ns);
|
|
254
235
|
return {
|
|
255
236
|
[wrapperName]: {
|
|
256
|
-
[itemName]: serializedItems
|
|
257
|
-
}
|
|
237
|
+
[itemName]: serializedItems,
|
|
238
|
+
},
|
|
258
239
|
} as XmlSerializedObject;
|
|
259
240
|
}
|
|
260
241
|
}
|
|
@@ -267,7 +248,7 @@ export function serializeModelToXml(
|
|
|
267
248
|
properties: XmlPropertyMetadata[],
|
|
268
249
|
rootName: string,
|
|
269
250
|
rootNs?: { namespace: string; prefix: string },
|
|
270
|
-
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig
|
|
251
|
+
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig,
|
|
271
252
|
): XmlSerializedObject {
|
|
272
253
|
if (item === null || item === undefined) {
|
|
273
254
|
return {};
|
|
@@ -300,7 +281,7 @@ export function serializeModelToXml(
|
|
|
300
281
|
value,
|
|
301
282
|
type,
|
|
302
283
|
prop.dateEncoding,
|
|
303
|
-
prop.bytesEncoding
|
|
284
|
+
prop.bytesEncoding,
|
|
304
285
|
);
|
|
305
286
|
} else if (type === "dict" && value !== null && typeof value === "object") {
|
|
306
287
|
// Serialize dictionary - each key-value pair becomes an element
|
|
@@ -316,7 +297,7 @@ export function serializeModelToXml(
|
|
|
316
297
|
// For unwrapped arrays, add each item as a separate element
|
|
317
298
|
const itemName = getElementName(
|
|
318
299
|
xmlOptions.itemsName || xmlOptions.name,
|
|
319
|
-
xmlOptions.itemsNs || xmlOptions.ns
|
|
300
|
+
xmlOptions.itemsNs || xmlOptions.ns,
|
|
320
301
|
);
|
|
321
302
|
result[itemName] = arrayResult as XmlSerializedValue[];
|
|
322
303
|
} else {
|
|
@@ -327,19 +308,14 @@ export function serializeModelToXml(
|
|
|
327
308
|
result[elementName] = serializer(value);
|
|
328
309
|
} else if (xmlOptions.unwrapped && !Array.isArray(value)) {
|
|
329
310
|
// Unwrapped primitive - this becomes the text content of the parent element
|
|
330
|
-
result["#text"] = serializePrimitiveValue(
|
|
331
|
-
value,
|
|
332
|
-
type,
|
|
333
|
-
prop.dateEncoding,
|
|
334
|
-
prop.bytesEncoding
|
|
335
|
-
);
|
|
311
|
+
result["#text"] = serializePrimitiveValue(value, type, prop.dateEncoding, prop.bytesEncoding);
|
|
336
312
|
} else {
|
|
337
313
|
// Serialize primitive
|
|
338
314
|
result[elementName] = serializePrimitiveValue(
|
|
339
315
|
value,
|
|
340
316
|
type,
|
|
341
317
|
prop.dateEncoding,
|
|
342
|
-
prop.bytesEncoding
|
|
318
|
+
prop.bytesEncoding,
|
|
343
319
|
);
|
|
344
320
|
}
|
|
345
321
|
}
|
|
@@ -362,7 +338,7 @@ export function serializeModelToXml(
|
|
|
362
338
|
// Wrap in root element
|
|
363
339
|
const rootElementName = getElementName(rootName, rootNs);
|
|
364
340
|
return {
|
|
365
|
-
[rootElementName]: result
|
|
341
|
+
[rootElementName]: result,
|
|
366
342
|
};
|
|
367
343
|
}
|
|
368
344
|
|
|
@@ -371,11 +347,11 @@ export function serializeModelToXml(
|
|
|
371
347
|
*/
|
|
372
348
|
export function xmlObjectToString(
|
|
373
349
|
xmlObject: XmlSerializedObject,
|
|
374
|
-
options?: Partial<XmlBuilderOptions
|
|
350
|
+
options?: Partial<XmlBuilderOptions>,
|
|
375
351
|
): string {
|
|
376
352
|
const builder = new XMLBuilder({
|
|
377
353
|
...defaultBuilderOptions,
|
|
378
|
-
...options
|
|
354
|
+
...options,
|
|
379
355
|
});
|
|
380
356
|
|
|
381
357
|
const xmlData: string = builder.build(xmlObject);
|
|
@@ -394,14 +370,14 @@ export function serializeToXml(
|
|
|
394
370
|
rootName: string,
|
|
395
371
|
rootNs?: { namespace: string; prefix: string },
|
|
396
372
|
options?: Partial<XmlBuilderOptions>,
|
|
397
|
-
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig
|
|
373
|
+
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig,
|
|
398
374
|
): string {
|
|
399
375
|
const xmlObject = serializeModelToXml(
|
|
400
376
|
item,
|
|
401
377
|
properties,
|
|
402
378
|
rootName,
|
|
403
379
|
rootNs,
|
|
404
|
-
additionalPropertiesConfig
|
|
380
|
+
additionalPropertiesConfig,
|
|
405
381
|
);
|
|
406
382
|
return xmlObjectToString(xmlObject, options);
|
|
407
383
|
}
|
|
@@ -411,11 +387,11 @@ export function serializeToXml(
|
|
|
411
387
|
*/
|
|
412
388
|
export function parseXmlString(
|
|
413
389
|
xmlString: string,
|
|
414
|
-
options?: Partial<typeof defaultParserOptions
|
|
390
|
+
options?: Partial<typeof defaultParserOptions>,
|
|
415
391
|
): any {
|
|
416
392
|
const parser = new XMLParser({
|
|
417
393
|
...defaultParserOptions,
|
|
418
|
-
...options
|
|
394
|
+
...options,
|
|
419
395
|
});
|
|
420
396
|
|
|
421
397
|
return parser.parse(xmlString);
|
|
@@ -429,7 +405,7 @@ function deserializePrimitiveValue(
|
|
|
429
405
|
type?: "array" | "object" | "primitive" | "date" | "bytes" | "dict",
|
|
430
406
|
dateEncoding?: "rfc3339" | "rfc7231" | "unixTimestamp",
|
|
431
407
|
bytesEncoding?: "base64" | "base64url",
|
|
432
|
-
primitiveSubtype?: "string" | "number" | "boolean"
|
|
408
|
+
primitiveSubtype?: "string" | "number" | "boolean",
|
|
433
409
|
): any {
|
|
434
410
|
if (value === null || value === undefined) {
|
|
435
411
|
return undefined;
|
|
@@ -498,10 +474,7 @@ function getElementValue(obj: any, xmlOptions: XmlSerializationOptions): any {
|
|
|
498
474
|
/**
|
|
499
475
|
* Deserializes an array from XML
|
|
500
476
|
*/
|
|
501
|
-
function deserializeArrayProperty(
|
|
502
|
-
obj: any,
|
|
503
|
-
metadata: XmlPropertyDeserializeMetadata
|
|
504
|
-
): any[] {
|
|
477
|
+
function deserializeArrayProperty(obj: any, metadata: XmlPropertyDeserializeMetadata): any[] {
|
|
505
478
|
const { xmlOptions, deserializer, type, dateEncoding } = metadata;
|
|
506
479
|
|
|
507
480
|
let arrayData: any;
|
|
@@ -510,7 +483,7 @@ function deserializeArrayProperty(
|
|
|
510
483
|
// Items are direct children
|
|
511
484
|
const itemName = getElementName(
|
|
512
485
|
xmlOptions.itemsName || xmlOptions.name,
|
|
513
|
-
xmlOptions.itemsNs || xmlOptions.ns
|
|
486
|
+
xmlOptions.itemsNs || xmlOptions.ns,
|
|
514
487
|
);
|
|
515
488
|
arrayData = obj[itemName] ?? obj[xmlOptions.itemsName || xmlOptions.name];
|
|
516
489
|
} else {
|
|
@@ -525,14 +498,8 @@ function deserializeArrayProperty(
|
|
|
525
498
|
// Unwrap single-element array if the parser wrapped it
|
|
526
499
|
wrapper = unwrapSingleElementArray(wrapper);
|
|
527
500
|
|
|
528
|
-
const itemName = getElementName(
|
|
529
|
-
|
|
530
|
-
xmlOptions.itemsNs
|
|
531
|
-
);
|
|
532
|
-
arrayData =
|
|
533
|
-
wrapper[itemName] ??
|
|
534
|
-
wrapper[xmlOptions.itemsName || xmlOptions.name] ??
|
|
535
|
-
wrapper;
|
|
501
|
+
const itemName = getElementName(xmlOptions.itemsName || xmlOptions.name, xmlOptions.itemsNs);
|
|
502
|
+
arrayData = wrapper[itemName] ?? wrapper[xmlOptions.itemsName || xmlOptions.name] ?? wrapper;
|
|
536
503
|
}
|
|
537
504
|
|
|
538
505
|
if (!arrayData) {
|
|
@@ -553,7 +520,7 @@ function deserializeArrayProperty(
|
|
|
553
520
|
metadata.itemType ?? type,
|
|
554
521
|
dateEncoding,
|
|
555
522
|
metadata.bytesEncoding,
|
|
556
|
-
metadata.primitiveSubtype
|
|
523
|
+
metadata.primitiveSubtype,
|
|
557
524
|
);
|
|
558
525
|
});
|
|
559
526
|
}
|
|
@@ -566,7 +533,7 @@ export function deserializeXmlToModel<T = Record<string, any>>(
|
|
|
566
533
|
properties: XmlPropertyDeserializeMetadata[],
|
|
567
534
|
rootName: string,
|
|
568
535
|
rootNs?: { namespace: string; prefix: string },
|
|
569
|
-
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig
|
|
536
|
+
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig,
|
|
570
537
|
): T {
|
|
571
538
|
if (!xmlObject) {
|
|
572
539
|
return {} as T;
|
|
@@ -577,11 +544,7 @@ export function deserializeXmlToModel<T = Record<string, any>>(
|
|
|
577
544
|
let content = xmlObject[rootElementName] ?? xmlObject[rootName] ?? xmlObject;
|
|
578
545
|
content = unwrapSingleElementArray(content);
|
|
579
546
|
|
|
580
|
-
return deserializeXmlObject<T>(
|
|
581
|
-
content,
|
|
582
|
-
properties,
|
|
583
|
-
additionalPropertiesConfig
|
|
584
|
-
);
|
|
547
|
+
return deserializeXmlObject<T>(content, properties, additionalPropertiesConfig);
|
|
585
548
|
}
|
|
586
549
|
|
|
587
550
|
/**
|
|
@@ -593,7 +556,7 @@ export function deserializeFromXml<T = Record<string, any>>(
|
|
|
593
556
|
rootName: string,
|
|
594
557
|
rootNs?: { namespace: string; prefix: string },
|
|
595
558
|
parserOptions?: Partial<typeof defaultParserOptions>,
|
|
596
|
-
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig
|
|
559
|
+
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig,
|
|
597
560
|
): T {
|
|
598
561
|
if (!xmlString) {
|
|
599
562
|
return {} as T;
|
|
@@ -604,7 +567,7 @@ export function deserializeFromXml<T = Record<string, any>>(
|
|
|
604
567
|
properties,
|
|
605
568
|
rootName,
|
|
606
569
|
rootNs,
|
|
607
|
-
additionalPropertiesConfig
|
|
570
|
+
additionalPropertiesConfig,
|
|
608
571
|
);
|
|
609
572
|
}
|
|
610
573
|
|
|
@@ -618,7 +581,7 @@ export function deserializeFromXml<T = Record<string, any>>(
|
|
|
618
581
|
export function deserializeXmlObject<T = Record<string, any>>(
|
|
619
582
|
xmlObject: Record<string, unknown>,
|
|
620
583
|
properties: XmlPropertyDeserializeMetadata[],
|
|
621
|
-
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig
|
|
584
|
+
additionalPropertiesConfig?: XmlAdditionalPropertiesConfig,
|
|
622
585
|
): T {
|
|
623
586
|
if (!xmlObject) {
|
|
624
587
|
return {} as T;
|
|
@@ -630,14 +593,7 @@ export function deserializeXmlObject<T = Record<string, any>>(
|
|
|
630
593
|
const result: Record<string, any> = {};
|
|
631
594
|
|
|
632
595
|
for (const prop of properties) {
|
|
633
|
-
const {
|
|
634
|
-
propertyName,
|
|
635
|
-
xmlOptions,
|
|
636
|
-
deserializer,
|
|
637
|
-
type,
|
|
638
|
-
dateEncoding,
|
|
639
|
-
primitiveSubtype
|
|
640
|
-
} = prop;
|
|
596
|
+
const { propertyName, xmlOptions, deserializer, type, dateEncoding, primitiveSubtype } = prop;
|
|
641
597
|
|
|
642
598
|
if (type === "array" || xmlOptions.itemsName) {
|
|
643
599
|
// Deserialize array
|
|
@@ -664,7 +620,7 @@ export function deserializeXmlObject<T = Record<string, any>>(
|
|
|
664
620
|
type,
|
|
665
621
|
dateEncoding,
|
|
666
622
|
prop.bytesEncoding,
|
|
667
|
-
primitiveSubtype
|
|
623
|
+
primitiveSubtype,
|
|
668
624
|
);
|
|
669
625
|
}
|
|
670
626
|
} else {
|
|
@@ -692,7 +648,7 @@ export function deserializeXmlObject<T = Record<string, any>>(
|
|
|
692
648
|
type,
|
|
693
649
|
dateEncoding,
|
|
694
650
|
prop.bytesEncoding,
|
|
695
|
-
primitiveSubtype
|
|
651
|
+
primitiveSubtype,
|
|
696
652
|
);
|
|
697
653
|
}
|
|
698
654
|
}
|
|
@@ -700,11 +656,7 @@ export function deserializeXmlObject<T = Record<string, any>>(
|
|
|
700
656
|
|
|
701
657
|
// Collect undeclared XML elements into additionalProperties
|
|
702
658
|
if (additionalPropertiesConfig) {
|
|
703
|
-
const {
|
|
704
|
-
propertyName,
|
|
705
|
-
excludeNames,
|
|
706
|
-
deserializer: apDeserializer
|
|
707
|
-
} = additionalPropertiesConfig;
|
|
659
|
+
const { propertyName, excludeNames, deserializer: apDeserializer } = additionalPropertiesConfig;
|
|
708
660
|
const additionalProps: Record<string, any> = {};
|
|
709
661
|
const excludeSet = new Set(excludeNames);
|
|
710
662
|
for (const [key, val] of Object.entries(content)) {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { PollerLike, OperationState, CancelOnProgress } from "@azure/core-lro";
|
|
2
1
|
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
|
+
import { CancelOnProgress, OperationState, PollerLike } from "@azure/core-lro";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A simple poller that can be used to poll a long running operation.
|
|
6
6
|
*/
|
|
7
|
-
export interface SimplePollerLike<
|
|
8
|
-
TState extends OperationState<TResult>,
|
|
9
|
-
TResult
|
|
10
|
-
> {
|
|
7
|
+
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
|
|
11
8
|
/**
|
|
12
9
|
* Returns true if the poller has finished polling.
|
|
13
10
|
*/
|
|
@@ -31,9 +28,7 @@ export interface SimplePollerLike<
|
|
|
31
28
|
/**
|
|
32
29
|
* Returns a promise that will resolve once the underlying operation is completed.
|
|
33
30
|
*/
|
|
34
|
-
pollUntilDone(pollOptions?: {
|
|
35
|
-
abortSignal?: AbortSignalLike;
|
|
36
|
-
}): Promise<TResult>;
|
|
31
|
+
pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;
|
|
37
32
|
/**
|
|
38
33
|
* Invokes the provided callback after each polling is completed,
|
|
39
34
|
* sending the current state of the poller's operation.
|
|
@@ -78,21 +73,19 @@ export interface SimplePollerLike<
|
|
|
78
73
|
* @returns SimplePollerLike
|
|
79
74
|
*/
|
|
80
75
|
export function getSimplePoller<TResult>(
|
|
81
|
-
poller: PollerLike<OperationState<TResult>, TResult
|
|
76
|
+
poller: PollerLike<OperationState<TResult>, TResult>,
|
|
82
77
|
): SimplePollerLike<OperationState<TResult>, TResult> {
|
|
83
78
|
const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {
|
|
84
79
|
isDone() {
|
|
85
80
|
return poller.isDone;
|
|
86
81
|
},
|
|
87
82
|
isStopped() {
|
|
88
|
-
throw new Error(
|
|
89
|
-
"isStopped is deprecated. Use abortSignal status to track this instead."
|
|
90
|
-
);
|
|
83
|
+
throw new Error("isStopped is deprecated. Use abortSignal status to track this instead.");
|
|
91
84
|
},
|
|
92
85
|
getOperationState() {
|
|
93
86
|
if (!poller.operationState) {
|
|
94
87
|
throw new Error(
|
|
95
|
-
"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."
|
|
88
|
+
"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().",
|
|
96
89
|
);
|
|
97
90
|
}
|
|
98
91
|
return poller.operationState;
|
|
@@ -103,23 +96,21 @@ export function getSimplePoller<TResult>(
|
|
|
103
96
|
toString() {
|
|
104
97
|
if (!poller.operationState) {
|
|
105
98
|
throw new Error(
|
|
106
|
-
"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."
|
|
99
|
+
"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().",
|
|
107
100
|
);
|
|
108
101
|
}
|
|
109
102
|
return JSON.stringify({
|
|
110
|
-
state: poller.operationState
|
|
103
|
+
state: poller.operationState,
|
|
111
104
|
});
|
|
112
105
|
},
|
|
113
106
|
stopPolling() {
|
|
114
|
-
throw new Error(
|
|
115
|
-
"stopPolling is deprecated. Use abortSignal to stop polling instead."
|
|
116
|
-
);
|
|
107
|
+
throw new Error("stopPolling is deprecated. Use abortSignal to stop polling instead.");
|
|
117
108
|
},
|
|
118
109
|
onProgress: poller.onProgress,
|
|
119
110
|
poll: poller.poll,
|
|
120
111
|
pollUntilDone: poller.pollUntilDone,
|
|
121
112
|
serialize: poller.serialize,
|
|
122
|
-
submitted: poller.submitted
|
|
113
|
+
submitted: poller.submitted,
|
|
123
114
|
};
|
|
124
115
|
return simplePoller;
|
|
125
116
|
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import type {
|
|
5
|
-
FullOperationResponse,
|
|
6
|
-
RawResponseCallback
|
|
7
|
-
} from "@azure-rest/core-client";
|
|
4
|
+
import type { FullOperationResponse, RawResponseCallback } from "@azure-rest/core-client";
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* Response metadata providing access to raw HTTP response details.
|
|
11
8
|
* Available when the `enable-storage-compat` emitter option is enabled.
|
|
12
9
|
*/
|
|
13
|
-
export interface StorageCompatResponseInfo<
|
|
14
|
-
TBody = unknown,
|
|
15
|
-
THeaders = Record<string, unknown>
|
|
16
|
-
> {
|
|
10
|
+
export interface StorageCompatResponseInfo<TBody = unknown, THeaders = Record<string, unknown>> {
|
|
17
11
|
_response: {
|
|
18
12
|
/** The raw FullOperationResponse from the HTTP pipeline. */
|
|
19
13
|
rawResponse: FullOperationResponse;
|
|
@@ -30,9 +24,7 @@ export interface StorageCompatResponseInfo<
|
|
|
30
24
|
* @param originalOnResponse - The user's original onResponse callback, if any.
|
|
31
25
|
* @returns An object with the onResponse callback and a getter for the captured response.
|
|
32
26
|
*/
|
|
33
|
-
export function createStorageCompatOnResponse(
|
|
34
|
-
originalOnResponse?: RawResponseCallback
|
|
35
|
-
): {
|
|
27
|
+
export function createStorageCompatOnResponse(originalOnResponse?: RawResponseCallback): {
|
|
36
28
|
onResponse: RawResponseCallback;
|
|
37
29
|
getRawResponse: () => FullOperationResponse | undefined;
|
|
38
30
|
} {
|
|
@@ -42,7 +34,7 @@ export function createStorageCompatOnResponse(
|
|
|
42
34
|
captured = rawResponse;
|
|
43
35
|
originalOnResponse?.(rawResponse, error);
|
|
44
36
|
},
|
|
45
|
-
getRawResponse: () => captured
|
|
37
|
+
getRawResponse: () => captured,
|
|
46
38
|
};
|
|
47
39
|
}
|
|
48
40
|
|
|
@@ -54,10 +46,7 @@ export function createStorageCompatOnResponse(
|
|
|
54
46
|
* Headers and body properties are spread at the top level of the result,
|
|
55
47
|
* in addition to being available under `_response.parsedHeaders` / `_response.parsedBody`.
|
|
56
48
|
*/
|
|
57
|
-
type StorageCompatResult<TBody, THeaders> = TBody extends
|
|
58
|
-
| undefined
|
|
59
|
-
| void
|
|
60
|
-
| null
|
|
49
|
+
type StorageCompatResult<TBody, THeaders> = TBody extends undefined | void | null
|
|
61
50
|
? THeaders & StorageCompatResponseInfo<TBody, THeaders>
|
|
62
51
|
: THeaders & TBody & StorageCompatResponseInfo<TBody, THeaders>;
|
|
63
52
|
|
|
@@ -68,23 +57,17 @@ type StorageCompatResult<TBody, THeaders> = TBody extends
|
|
|
68
57
|
* @param parsedHeaders - The deserialized response headers.
|
|
69
58
|
* @returns The parsedBody augmented with a `_response` property.
|
|
70
59
|
*/
|
|
71
|
-
export function addStorageCompatResponse<
|
|
72
|
-
TBody,
|
|
73
|
-
THeaders = Record<string, unknown>
|
|
74
|
-
>(
|
|
60
|
+
export function addStorageCompatResponse<TBody, THeaders = Record<string, unknown>>(
|
|
75
61
|
rawResponse: FullOperationResponse,
|
|
76
62
|
parsedBody: TBody,
|
|
77
|
-
parsedHeaders: THeaders
|
|
63
|
+
parsedHeaders: THeaders,
|
|
78
64
|
): StorageCompatResult<TBody, THeaders> {
|
|
79
|
-
const base =
|
|
80
|
-
parsedBody !== undefined && parsedBody !== null
|
|
81
|
-
? parsedBody
|
|
82
|
-
: ({} as TBody);
|
|
65
|
+
const base = parsedBody !== undefined && parsedBody !== null ? parsedBody : ({} as TBody);
|
|
83
66
|
return Object.assign(base as any, parsedHeaders, {
|
|
84
67
|
_response: {
|
|
85
68
|
rawResponse,
|
|
86
69
|
parsedBody,
|
|
87
|
-
parsedHeaders
|
|
88
|
-
}
|
|
70
|
+
parsedHeaders,
|
|
71
|
+
},
|
|
89
72
|
});
|
|
90
73
|
}
|
|
@@ -34,7 +34,7 @@ function encodeReservedComponent(str: string): string {
|
|
|
34
34
|
function encodeRFC3986URIComponent(str: string): string {
|
|
35
35
|
return encodeURIComponent(str).replace(
|
|
36
36
|
/[!'()*]/g,
|
|
37
|
-
(c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}
|
|
37
|
+
(c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -43,10 +43,7 @@ function isDefined(val: any): boolean {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function getNamedAndIfEmpty(op?: string): [boolean, string] {
|
|
46
|
-
return [
|
|
47
|
-
!!op && [";", "?", "&"].includes(op),
|
|
48
|
-
!!op && ["?", "&"].includes(op) ? "=" : ""
|
|
49
|
-
];
|
|
46
|
+
return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""];
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
function getFirstOrSep(op?: string, isFirst = false): string {
|
|
@@ -175,7 +172,7 @@ function getVarValue(option: ValueOptions): string | undefined {
|
|
|
175
172
|
export function expandUrlTemplate(
|
|
176
173
|
template: string,
|
|
177
174
|
context: Record<string, any>,
|
|
178
|
-
option?: UrlTemplateOptions
|
|
175
|
+
option?: UrlTemplateOptions,
|
|
179
176
|
): string {
|
|
180
177
|
const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => {
|
|
181
178
|
if (!expr) {
|
|
@@ -199,7 +196,7 @@ export function expandUrlTemplate(
|
|
|
199
196
|
varValue: context[varMatch[1]],
|
|
200
197
|
varName: varMatch[1],
|
|
201
198
|
modifier: varMatch[2] || varMatch[3],
|
|
202
|
-
reserved: option?.allowReserved
|
|
199
|
+
reserved: option?.allowReserved,
|
|
203
200
|
});
|
|
204
201
|
if (varValue) {
|
|
205
202
|
innerResult.push(varValue);
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
RecorderStartOptions,
|
|
3
|
-
VitestTestContext
|
|
4
|
-
} from "@azure-tools/test-recorder";
|
|
1
|
+
import type { RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder";
|
|
5
2
|
import { Recorder } from "@azure-tools/test-recorder";
|
|
6
3
|
|
|
7
4
|
const replaceableVariables: Record<string, string> = {
|
|
8
|
-
SUBSCRIPTION_ID: "azure_subscription_id"
|
|
5
|
+
SUBSCRIPTION_ID: "azure_subscription_id",
|
|
9
6
|
};
|
|
10
7
|
|
|
11
8
|
const recorderEnvSetup: RecorderStartOptions = {
|
|
12
9
|
envSetupForPlayback: replaceableVariables,
|
|
13
10
|
removeCentralSanitizers: [
|
|
14
11
|
"AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section
|
|
15
|
-
"AZSDK3430" // .id in the body is not a secret and is listed below in the beforeEach section
|
|
16
|
-
]
|
|
12
|
+
"AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section
|
|
13
|
+
],
|
|
17
14
|
};
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -21,9 +18,7 @@ const recorderEnvSetup: RecorderStartOptions = {
|
|
|
21
18
|
* Should be called first in the test suite to make sure environment variables are
|
|
22
19
|
* read before they are being used.
|
|
23
20
|
*/
|
|
24
|
-
export async function createRecorder(
|
|
25
|
-
context: VitestTestContext
|
|
26
|
-
): Promise<Recorder> {
|
|
21
|
+
export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
|
|
27
22
|
const recorder = new Recorder(context);
|
|
28
23
|
await recorder.start(recorderEnvSetup);
|
|
29
24
|
return recorder;
|