@azure-tools/typespec-ts 0.56.0-dev.9 → 0.56.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +31 -15
- package/dist/src/context-manager.d.ts +23 -6
- package/dist/src/context-manager.d.ts.map +1 -1
- package/dist/src/context-manager.js +22 -0
- package/dist/src/context-manager.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 -1
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +2 -5
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +2 -29
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +12 -3
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +13 -0
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/hooks/use-dependencies.d.ts +1 -1
- package/dist/src/framework/hooks/use-dependencies.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +2 -2
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +1 -13
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/source-file-batch.d.ts +1 -1
- package/dist/src/framework/source-file-batch.d.ts.map +1 -1
- package/dist/src/framework/source-file-batch.js +1 -1
- package/dist/src/framework/source-file-batch.js.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +24 -19
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces.d.ts +0 -1
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/lib.d.ts +18 -4
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +22 -6
- package/dist/src/lib.js.map +1 -1
- package/dist/src/meta-tree.d.ts +2 -2
- package/dist/src/meta-tree.d.ts.map +1 -1
- package/dist/src/metadata/build-api-extractor-config.d.ts +1 -1
- package/dist/src/metadata/build-api-extractor-config.d.ts.map +1 -1
- package/dist/src/metadata/build-changelog-file.d.ts +1 -1
- package/dist/src/metadata/build-changelog-file.d.ts.map +1 -1
- package/dist/src/metadata/build-es-lint-config.d.ts +1 -1
- package/dist/src/metadata/build-es-lint-config.d.ts.map +1 -1
- package/dist/src/metadata/build-package-file.d.ts +3 -5
- package/dist/src/metadata/build-package-file.d.ts.map +1 -1
- package/dist/src/metadata/build-package-file.js +10 -45
- package/dist/src/metadata/build-package-file.js.map +1 -1
- package/dist/src/metadata/build-readme-file.d.ts +1 -1
- package/dist/src/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/metadata/build-readme-file.js +3 -3
- package/dist/src/metadata/build-readme-file.js.map +1 -1
- package/dist/src/metadata/build-sample-env-file.d.ts +1 -1
- package/dist/src/metadata/build-sample-env-file.d.ts.map +1 -1
- package/dist/src/metadata/build-test-config.d.ts +1 -1
- package/dist/src/metadata/build-test-config.d.ts.map +1 -1
- package/dist/src/metadata/build-ts-config.d.ts +11 -5
- package/dist/src/metadata/build-ts-config.d.ts.map +1 -1
- package/dist/src/metadata/build-ts-config.js +36 -8
- package/dist/src/metadata/build-ts-config.js.map +1 -1
- package/dist/src/metadata/build-vitest-config.d.ts +1 -1
- package/dist/src/metadata/build-vitest-config.d.ts.map +1 -1
- package/dist/src/metadata/build-warp-config.d.ts +1 -3
- package/dist/src/metadata/build-warp-config.d.ts.map +1 -1
- package/dist/src/metadata/build-warp-config.js +0 -2
- package/dist/src/metadata/build-warp-config.js.map +1 -1
- package/dist/src/metadata/package-json/azure-package-common.d.ts +1 -1
- package/dist/src/metadata/package-json/azure-package-common.d.ts.map +1 -1
- package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts +1 -2
- package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
- package/dist/src/metadata/package-json/build-azure-monorepo-package.js +2 -16
- package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
- package/dist/src/metadata/package-json/package-common.d.ts.map +1 -1
- package/dist/src/metadata/package-json/package-common.js +0 -15
- package/dist/src/metadata/package-json/package-common.js.map +1 -1
- package/dist/src/metadata/test/build-recorded-client.d.ts +1 -1
- package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -1
- package/dist/src/metadata/test/build-sample-test.d.ts +1 -1
- package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -1
- package/dist/src/metadata/test/build-snippets.d.ts +1 -1
- package/dist/src/metadata/test/build-snippets.d.ts.map +1 -1
- package/dist/src/metadata/utils.d.ts +1 -1
- package/dist/src/metadata/utils.d.ts.map +1 -1
- package/dist/src/modular/build-classical-client.d.ts +3 -3
- package/dist/src/modular/build-classical-client.d.ts.map +1 -1
- package/dist/src/modular/build-classical-client.js +3 -3
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.d.ts +3 -3
- package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.js +1 -0
- package/dist/src/modular/build-classical-operation-groups.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts +3 -3
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +1 -0
- package/dist/src/modular/build-client-context.js.map +1 -1
- package/dist/src/modular/build-modular-options.d.ts +2 -2
- package/dist/src/modular/build-modular-options.d.ts.map +1 -1
- package/dist/src/modular/build-operations.d.ts +5 -5
- package/dist/src/modular/build-operations.d.ts.map +1 -1
- package/dist/src/modular/build-operations.js +7 -4
- package/dist/src/modular/build-operations.js.map +1 -1
- package/dist/src/modular/build-project-files.d.ts +2 -2
- package/dist/src/modular/build-project-files.d.ts.map +1 -1
- package/dist/src/modular/build-restore-poller.d.ts +3 -3
- package/dist/src/modular/build-restore-poller.d.ts.map +1 -1
- package/dist/src/modular/build-restore-poller.js +1 -0
- package/dist/src/modular/build-restore-poller.js.map +1 -1
- package/dist/src/modular/build-root-index.d.ts +3 -3
- package/dist/src/modular/build-root-index.d.ts.map +1 -1
- package/dist/src/modular/build-root-index.js +4 -3
- package/dist/src/modular/build-root-index.js.map +1 -1
- package/dist/src/modular/build-subpath-index.d.ts +2 -2
- package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
- package/dist/src/modular/build-subpath-index.js +1 -1
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-logger-file.d.ts +1 -1
- package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
- package/dist/src/modular/emit-models-options.d.ts +3 -3
- package/dist/src/modular/emit-models-options.d.ts.map +1 -1
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts +3 -3
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +1 -1
- package/dist/src/modular/emit-models.js.map +1 -1
- package/dist/src/modular/emit-samples.d.ts +1 -1
- package/dist/src/modular/emit-samples.d.ts.map +1 -1
- package/dist/src/modular/emit-samples.js +1 -1
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts +1 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +1 -0
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/external-dependencies.d.ts +1 -1
- package/dist/src/modular/external-dependencies.d.ts.map +1 -1
- package/dist/src/modular/external-dependencies.js +10 -0
- package/dist/src/modular/external-dependencies.js.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts +3 -3
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.js +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts +11 -6
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +38 -17
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/client-option-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/client-option-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts +3 -3
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +1 -0
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.d.ts +7 -4
- package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.js +44 -5
- package/dist/src/modular/helpers/naming-helpers.js.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.d.ts +7 -7
- package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.js +32 -30
- package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/type-helpers.d.ts +3 -3
- package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -1
- package/dist/src/modular/interfaces.d.ts +1 -1
- package/dist/src/modular/interfaces.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.d.ts +4 -4
- package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.d.ts +4 -4
- package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts +4 -4
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -1
- package/dist/src/modular/serialization/serialize-utils.d.ts +1 -1
- package/dist/src/modular/serialization/serialize-utils.d.ts.map +1 -1
- package/dist/src/modular/static-helpers-metadata.d.ts +0 -12
- package/dist/src/modular/static-helpers-metadata.d.ts.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +0 -12
- package/dist/src/modular/static-helpers-metadata.js.map +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +3 -3
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts +2 -2
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +3 -3
- 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/modular/type-expressions/utils.d.ts +1 -1
- package/dist/src/modular/type-expressions/utils.d.ts.map +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts +3 -3
- package/dist/src/transform/transform-api-version-info.d.ts.map +1 -1
- package/dist/src/transform/transform-api-version-info.js +1 -1
- package/dist/src/transform/transform-api-version-info.js.map +1 -1
- package/dist/src/transform/transform-client-options.d.ts +4 -4
- package/dist/src/transform/transform-client-options.d.ts.map +1 -1
- package/dist/src/transform/transform-client-options.js +1 -3
- package/dist/src/transform/transform-client-options.js.map +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts +3 -3
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +1 -1
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-parameters.d.ts +4 -4
- package/dist/src/transform/transform-parameters.d.ts.map +1 -1
- package/dist/src/transform/transform-parameters.js.map +1 -1
- package/dist/src/transform/transform-paths.d.ts +3 -3
- package/dist/src/transform/transform-paths.d.ts.map +1 -1
- package/dist/src/transform/transform-paths.js +1 -1
- package/dist/src/transform/transform-paths.js.map +1 -1
- package/dist/src/transform/transform-responses.d.ts +3 -3
- package/dist/src/transform/transform-responses.d.ts.map +1 -1
- package/dist/src/transform/transform-responses.js +1 -1
- package/dist/src/transform/transform-responses.js.map +1 -1
- package/dist/src/transform/transform-schemas.d.ts +2 -2
- package/dist/src/transform/transform-schemas.d.ts.map +1 -1
- package/dist/src/transform/transform-schemas.js +2 -2
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform-telemetry-info.d.ts +2 -2
- package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -1
- package/dist/src/transform/transform.d.ts +3 -3
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/utils/api-version-util.d.ts +1 -1
- package/dist/src/utils/api-version-util.d.ts.map +1 -1
- package/dist/src/utils/client-utils.d.ts +4 -4
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/credential-utils.d.ts +3 -3
- package/dist/src/utils/credential-utils.d.ts.map +1 -1
- package/dist/src/utils/credential-utils.js.map +1 -1
- package/dist/src/utils/cross-language-def.d.ts +1 -1
- package/dist/src/utils/cross-language-def.d.ts.map +1 -1
- package/dist/src/utils/emit-util.d.ts +2 -2
- package/dist/src/utils/emit-util.d.ts.map +1 -1
- package/dist/src/utils/emit-util.js +2 -2
- package/dist/src/utils/emit-util.js.map +1 -1
- package/dist/src/utils/file-system-utils.d.ts +1 -1
- package/dist/src/utils/file-system-utils.d.ts.map +1 -1
- package/dist/src/utils/file-system-utils.js.map +1 -1
- package/dist/src/utils/import-helper.js +1 -0
- package/dist/src/utils/import-helper.js.map +1 -1
- package/dist/src/utils/imports-util.d.ts +1 -1
- package/dist/src/utils/imports-util.d.ts.map +1 -1
- package/dist/src/utils/imports-util.js +2 -1
- package/dist/src/utils/imports-util.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +3 -3
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/interfaces.js +2 -1
- package/dist/src/utils/interfaces.js.map +1 -1
- package/dist/src/utils/model-utils.d.ts +4 -4
- package/dist/src/utils/model-utils.d.ts.map +1 -1
- package/dist/src/utils/name-constructors.d.ts +1 -1
- package/dist/src/utils/name-constructors.d.ts.map +1 -1
- package/dist/src/utils/namespace-utils.d.ts +2 -2
- package/dist/src/utils/namespace-utils.d.ts.map +1 -1
- package/dist/src/utils/namespace-utils.js +1 -1
- package/dist/src/utils/namespace-utils.js.map +1 -1
- package/dist/src/utils/operation-helpers.d.ts +2 -2
- package/dist/src/utils/operation-helpers.d.ts.map +1 -1
- package/dist/src/utils/operation-helpers.js.map +1 -1
- package/dist/src/utils/operation-util.d.ts +5 -5
- package/dist/src/utils/operation-util.d.ts.map +1 -1
- package/dist/src/utils/operation-util.js +1 -1
- package/dist/src/utils/operation-util.js.map +1 -1
- package/dist/src/utils/parameter-utils.d.ts +3 -3
- package/dist/src/utils/parameter-utils.d.ts.map +1 -1
- package/dist/src/utils/parameter-utils.js.map +1 -1
- package/dist/src/utils/schema-helpers.d.ts +1 -1
- package/dist/src/utils/schema-helpers.d.ts.map +1 -1
- package/dist/src/utils/schema-helpers.js +1 -1
- package/dist/src/utils/schema-helpers.js.map +1 -1
- package/dist/src/utils/type-util.d.ts +1 -1
- package/dist/src/utils/type-util.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -38
- package/src/context-manager.ts +29 -6
- package/src/framework/declaration.ts +7 -6
- package/src/framework/hooks/binder.ts +5 -33
- package/src/framework/hooks/sdk-types.ts +22 -8
- package/src/framework/hooks/use-dependencies.ts +1 -1
- package/src/framework/load-static-helpers.ts +3 -18
- package/src/framework/reference.ts +2 -2
- package/src/framework/sample.ts +2 -2
- package/src/framework/source-file-batch.ts +2 -2
- package/src/index.ts +34 -29
- package/src/interfaces.ts +0 -1
- package/src/lib.ts +43 -11
- package/src/meta-tree.ts +2 -2
- package/src/metadata/build-api-extractor-config.ts +1 -1
- package/src/metadata/build-changelog-file.ts +1 -1
- package/src/metadata/build-es-lint-config.ts +1 -1
- package/src/metadata/build-package-file.ts +11 -49
- package/src/metadata/build-readme-file.ts +4 -4
- package/src/metadata/build-sample-env-file.ts +1 -1
- package/src/metadata/build-test-config.ts +1 -1
- package/src/metadata/build-ts-config.ts +38 -9
- package/src/metadata/build-vitest-config.ts +1 -1
- package/src/metadata/build-warp-config.ts +1 -3
- package/src/metadata/package-json/azure-package-common.ts +1 -1
- package/src/metadata/package-json/build-azure-monorepo-package.ts +3 -20
- package/src/metadata/package-json/package-common.ts +0 -15
- package/src/metadata/test/build-recorded-client.ts +1 -1
- package/src/metadata/test/build-sample-test.ts +1 -1
- package/src/metadata/test/build-snippets.ts +1 -1
- package/src/metadata/utils.ts +1 -1
- package/src/modular/build-classical-client.ts +8 -12
- package/src/modular/build-classical-operation-groups.ts +6 -3
- package/src/modular/build-client-context.ts +3 -3
- package/src/modular/build-modular-options.ts +2 -2
- package/src/modular/build-operations.ts +12 -9
- package/src/modular/build-project-files.ts +2 -2
- package/src/modular/build-restore-poller.ts +6 -3
- package/src/modular/build-root-index.ts +9 -10
- package/src/modular/build-subpath-index.ts +5 -2
- package/src/modular/emit-logger-file.ts +1 -1
- package/src/modular/emit-models-options.ts +6 -3
- package/src/modular/emit-models.ts +23 -33
- package/src/modular/emit-samples.ts +11 -11
- package/src/modular/emit-tests.ts +3 -3
- package/src/modular/external-dependencies.ts +11 -1
- package/src/modular/helpers/classical-operation-helpers.ts +10 -7
- package/src/modular/helpers/client-helpers.ts +52 -32
- package/src/modular/helpers/client-option-helpers.ts +1 -1
- package/src/modular/helpers/example-value-helpers.ts +9 -9
- package/src/modular/helpers/naming-helpers.ts +55 -7
- package/src/modular/helpers/operation-helpers.ts +56 -54
- package/src/modular/helpers/type-helpers.ts +3 -3
- package/src/modular/interfaces.ts +1 -1
- package/src/modular/serialization/build-deserializer-function.ts +9 -9
- package/src/modular/serialization/build-serializer-function.ts +9 -9
- package/src/modular/serialization/build-xml-serializer-function.ts +7 -7
- package/src/modular/serialization/serialize-utils.ts +1 -1
- package/src/modular/static-helpers-metadata.ts +0 -13
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +3 -3
- package/src/modular/type-expressions/get-model-expression.ts +3 -3
- package/src/modular/type-expressions/get-nullable-expression.ts +3 -3
- package/src/modular/type-expressions/get-type-expression.ts +2 -2
- package/src/modular/type-expressions/get-union-expression.ts +3 -3
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/transform/transform-api-version-info.ts +8 -3
- package/src/transform/transform-client-options.ts +5 -7
- package/src/transform/transform-helper-function-details.ts +6 -3
- package/src/transform/transform-parameters.ts +15 -11
- package/src/transform/transform-paths.ts +10 -4
- package/src/transform/transform-responses.ts +11 -8
- package/src/transform/transform-schemas.ts +7 -4
- package/src/transform/transform-telemetry-info.ts +3 -3
- package/src/transform/transform.ts +11 -11
- package/src/utils/api-version-util.ts +1 -1
- package/src/utils/client-utils.ts +8 -8
- package/src/utils/credential-utils.ts +3 -3
- package/src/utils/cross-language-def.ts +1 -1
- package/src/utils/emit-util.ts +9 -3
- package/src/utils/file-system-utils.ts +1 -1
- package/src/utils/imports-util.ts +2 -2
- package/src/utils/interfaces.ts +3 -3
- package/src/utils/model-utils.ts +23 -23
- package/src/utils/name-constructors.ts +1 -1
- package/src/utils/namespace-utils.ts +8 -2
- package/src/utils/operation-helpers.ts +11 -7
- package/src/utils/operation-util.ts +23 -16
- package/src/utils/parameter-utils.ts +4 -4
- package/src/utils/schema-helpers.ts +7 -1
- package/src/utils/type-util.ts +1 -1
- package/static/static-helpers/multipartHelpers.ts +2 -6
- package/static/static-helpers/platform-types-browser.mts +0 -5
- package/static/static-helpers/platform-types-react-native.mts +0 -5
- package/static/static-helpers/platform-types.ts +0 -7
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +0 -22
- package/static/static-helpers/serialization/get-binary-stream-response-react-native.mts +0 -1
- package/static/static-helpers/serialization/get-binary-stream-response.ts +0 -22
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InterfaceDeclarationStructure, SourceFile, StructureKind } from "ts-morph";
|
|
1
|
+
import { type InterfaceDeclarationStructure, SourceFile, StructureKind } from "ts-morph";
|
|
2
2
|
import {
|
|
3
3
|
getDeserializeExceptionHeadersPrivateFunction,
|
|
4
4
|
getDeserializeHeadersPrivateFunction,
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
isLroAndPagingOperation,
|
|
11
11
|
isLroOnlyOperation,
|
|
12
12
|
} from "./helpers/operation-helpers.js";
|
|
13
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
13
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import type {
|
|
16
16
|
SdkClientType,
|
|
17
17
|
SdkMethodParameter,
|
|
18
18
|
SdkServiceOperation,
|
|
@@ -23,16 +23,16 @@ import { useDependencies } from "../framework/hooks/use-dependencies.js";
|
|
|
23
23
|
import { resolveReference } from "../framework/reference.js";
|
|
24
24
|
import { refkey } from "../framework/refkey.js";
|
|
25
25
|
import { getClientModuleInfo, isMultiEndpointClient } from "../utils/client-utils.js";
|
|
26
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
26
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
27
27
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
28
28
|
import {
|
|
29
29
|
getMethodHierarchiesMap,
|
|
30
30
|
hasDualFormatSupport,
|
|
31
|
-
ServiceOperation,
|
|
31
|
+
type ServiceOperation,
|
|
32
32
|
} from "../utils/operation-util.js";
|
|
33
33
|
import { getDocsFromDescription } from "./helpers/docs-helpers.js";
|
|
34
34
|
import { getOperationName } from "./helpers/naming-helpers.js";
|
|
35
|
-
import { OperationPathAndDeserDetails } from "./interfaces.js";
|
|
35
|
+
import type { OperationPathAndDeserDetails } from "./interfaces.js";
|
|
36
36
|
import { getTypeExpression } from "./type-expressions/get-type-expression.js";
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -83,10 +83,13 @@ export function buildOperationFiles(
|
|
|
83
83
|
prefixes,
|
|
84
84
|
op,
|
|
85
85
|
]);
|
|
86
|
-
const deserializeHeadersDeclaration = getDeserializeHeadersPrivateFunction(dpgContext,
|
|
86
|
+
const deserializeHeadersDeclaration = getDeserializeHeadersPrivateFunction(dpgContext, [
|
|
87
|
+
prefixes,
|
|
88
|
+
op,
|
|
89
|
+
]);
|
|
87
90
|
const deserializeExceptionHeadersDeclaration = getDeserializeExceptionHeadersPrivateFunction(
|
|
88
91
|
dpgContext,
|
|
89
|
-
op,
|
|
92
|
+
[prefixes, op],
|
|
90
93
|
);
|
|
91
94
|
const functionsToAdd = [sendOperationDeclaration, deserializeOperationDeclaration];
|
|
92
95
|
if (deserializeHeadersDeclaration) {
|
|
@@ -224,7 +227,7 @@ export function buildLroDeserDetailMap(
|
|
|
224
227
|
map.set(
|
|
225
228
|
`./api/${operationFileName}.js`,
|
|
226
229
|
lroOperations.map((o) => {
|
|
227
|
-
const { name } = getOperationName(o);
|
|
230
|
+
const { name } = getOperationName(o, context, prefixes);
|
|
228
231
|
const deserName = `_${name}Deserialize`;
|
|
229
232
|
let renamedDeserName = undefined;
|
|
230
233
|
if (existingNames.has(deserName)) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getRelativePathFromDirectory, joinPaths } from "@typespec/compiler";
|
|
2
2
|
import { useContext } from "../context-manager.js";
|
|
3
3
|
import { getClientHierarchyMap, getClientModuleInfo } from "../utils/client-utils.js";
|
|
4
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
4
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
5
5
|
import { NameType } from "../utils/name-utils.js";
|
|
6
6
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
7
7
|
import { getClassicalLayerPrefix } from "./helpers/naming-helpers.js";
|
|
8
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
8
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Computes the relative path prefix (e.g. `./src` or `./src/generated`) from
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SdkClientType,
|
|
3
|
+
SdkServiceOperation,
|
|
4
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
2
5
|
import { joinPaths } from "@typespec/compiler";
|
|
3
6
|
import { SourceFile } from "ts-morph";
|
|
4
7
|
import { useContext } from "../context-manager.js";
|
|
5
8
|
import { useDependencies } from "../framework/hooks/use-dependencies.js";
|
|
6
9
|
import { resolveReference } from "../framework/reference.js";
|
|
7
10
|
import { getClientModuleInfo } from "../utils/client-utils.js";
|
|
8
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
11
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
9
12
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
10
13
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
11
14
|
import { buildLroDeserDetailMap } from "./build-operations.js";
|
|
12
15
|
import { AzurePollingDependencies } from "./external-dependencies.js";
|
|
13
16
|
import { getClassicalClientName } from "./helpers/naming-helpers.js";
|
|
14
17
|
import { isLroOnlyOperation } from "./helpers/operation-helpers.js";
|
|
15
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
18
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
16
19
|
import { PollingHelpers } from "./static-helpers-metadata.js";
|
|
17
20
|
|
|
18
21
|
export function buildRestorePoller(
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SdkClientType,
|
|
3
|
+
SdkServiceOperation,
|
|
4
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
2
5
|
import { joinPaths, NoTarget } from "@typespec/compiler";
|
|
3
6
|
import { Project, SourceFile, StructureKind } from "ts-morph";
|
|
4
7
|
import { useContext } from "../context-manager.js";
|
|
@@ -12,19 +15,15 @@ import {
|
|
|
12
15
|
} from "../framework/source-file-batch.js";
|
|
13
16
|
import { reportDiagnostic } from "../lib.js";
|
|
14
17
|
import { getClientModuleInfo } from "../utils/client-utils.js";
|
|
15
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
18
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
16
19
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
17
20
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
18
21
|
import { partitionAndEmitExports } from "./build-subpath-index.js";
|
|
22
|
+
import { AzureCoreDependencies } from "./external-dependencies.js";
|
|
19
23
|
import { getClassicalClientName } from "./helpers/naming-helpers.js";
|
|
20
24
|
import { isLroOnlyOperation } from "./helpers/operation-helpers.js";
|
|
21
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
22
|
-
import {
|
|
23
|
-
CloudSettingHelpers,
|
|
24
|
-
MultipartHelpers,
|
|
25
|
-
PagingHelpers,
|
|
26
|
-
PlatformTypeHelpers,
|
|
27
|
-
} from "./static-helpers-metadata.js";
|
|
25
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
26
|
+
import { CloudSettingHelpers, MultipartHelpers, PagingHelpers } from "./static-helpers-metadata.js";
|
|
28
27
|
|
|
29
28
|
export function buildRootIndex(
|
|
30
29
|
context: SdkContext,
|
|
@@ -179,7 +178,7 @@ function exportFileContentsType(context: SdkContext, rootIndexFile: SourceFile)
|
|
|
179
178
|
rootIndexFile,
|
|
180
179
|
[
|
|
181
180
|
resolveReference(MultipartHelpers.FileContents),
|
|
182
|
-
resolveReference(
|
|
181
|
+
resolveReference(AzureCoreDependencies["NodeReadableStream"]),
|
|
183
182
|
],
|
|
184
183
|
true,
|
|
185
184
|
);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SdkClientType,
|
|
3
|
+
SdkServiceOperation,
|
|
4
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
2
5
|
import { joinPaths } from "@typespec/compiler";
|
|
3
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
6
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
4
7
|
|
|
5
8
|
import { Node, SourceFile, StructureKind } from "ts-morph";
|
|
6
9
|
import { useContext } from "../context-manager.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "../context-manager.js";
|
|
2
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
2
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
3
3
|
|
|
4
4
|
export function emitLoggerFile(emitterOptions: ModularEmitterOptions, srcPath: string = "src") {
|
|
5
5
|
const project = useContext("outputProject");
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { joinPaths } from "@typespec/compiler";
|
|
2
2
|
|
|
3
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
3
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
|
+
SdkClientType,
|
|
7
|
+
SdkServiceOperation,
|
|
8
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
6
9
|
import { useContext } from "../context-manager.js";
|
|
7
10
|
import { getClientModuleInfo } from "../utils/client-utils.js";
|
|
8
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
11
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
9
12
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
10
13
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
11
14
|
import { buildOperationOptions } from "./build-operations.js";
|
|
@@ -2,31 +2,31 @@ import {
|
|
|
2
2
|
isPagedResultModel,
|
|
3
3
|
isReadOnly,
|
|
4
4
|
listAllServiceNamespaces,
|
|
5
|
-
SdkArrayType,
|
|
6
|
-
SdkClientType,
|
|
7
|
-
SdkDictionaryType,
|
|
8
|
-
SdkEnumType,
|
|
9
|
-
SdkEnumValueType,
|
|
10
|
-
SdkHttpOperation,
|
|
11
|
-
SdkMethod,
|
|
12
|
-
SdkModelPropertyType,
|
|
13
|
-
SdkModelType,
|
|
14
|
-
SdkNullableType,
|
|
15
|
-
SdkServiceMethod,
|
|
16
|
-
SdkServiceOperation,
|
|
17
|
-
SdkType,
|
|
18
|
-
SdkUnionType,
|
|
5
|
+
type SdkArrayType,
|
|
6
|
+
type SdkClientType,
|
|
7
|
+
type SdkDictionaryType,
|
|
8
|
+
type SdkEnumType,
|
|
9
|
+
type SdkEnumValueType,
|
|
10
|
+
type SdkHttpOperation,
|
|
11
|
+
type SdkMethod,
|
|
12
|
+
type SdkModelPropertyType,
|
|
13
|
+
type SdkModelType,
|
|
14
|
+
type SdkNullableType,
|
|
15
|
+
type SdkServiceMethod,
|
|
16
|
+
type SdkServiceOperation,
|
|
17
|
+
type SdkType,
|
|
18
|
+
type SdkUnionType,
|
|
19
19
|
UsageFlags,
|
|
20
20
|
} from "@azure-tools/typespec-client-generator-core";
|
|
21
21
|
import {
|
|
22
|
-
EnumDeclarationStructure,
|
|
23
|
-
EnumMemberStructure,
|
|
24
|
-
InterfaceDeclarationStructure,
|
|
25
|
-
OptionalKind,
|
|
26
|
-
PropertySignatureStructure,
|
|
22
|
+
type EnumDeclarationStructure,
|
|
23
|
+
type EnumMemberStructure,
|
|
24
|
+
type InterfaceDeclarationStructure,
|
|
25
|
+
type OptionalKind,
|
|
26
|
+
type PropertySignatureStructure,
|
|
27
27
|
SourceFile,
|
|
28
28
|
StructureKind,
|
|
29
|
-
TypeAliasDeclarationStructure,
|
|
29
|
+
type TypeAliasDeclarationStructure,
|
|
30
30
|
} from "ts-morph";
|
|
31
31
|
// import { isKey } from "@typespec/compiler";
|
|
32
32
|
import {
|
|
@@ -49,7 +49,7 @@ import { refkey } from "../framework/refkey.js";
|
|
|
49
49
|
import { beginSourceFileBatch, flushSourceFileBatch } from "../framework/source-file-batch.js";
|
|
50
50
|
import { reportDiagnostic } from "../lib.js";
|
|
51
51
|
import { getClientHierarchyMap } from "../utils/client-utils.js";
|
|
52
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
52
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
53
53
|
import { isAzureCoreErrorType } from "../utils/model-utils.js";
|
|
54
54
|
import { fixLeadingNumber, NameType, normalizeName } from "../utils/name-utils.js";
|
|
55
55
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
@@ -95,12 +95,7 @@ type InterfaceStructure = OptionalKind<InterfaceDeclarationStructure> & {
|
|
|
95
95
|
function isGenerableType(
|
|
96
96
|
type: SdkType,
|
|
97
97
|
): type is
|
|
98
|
-
|
|
|
99
|
-
| SdkEnumType
|
|
100
|
-
| SdkUnionType
|
|
101
|
-
| SdkDictionaryType
|
|
102
|
-
| SdkArrayType
|
|
103
|
-
| SdkNullableType {
|
|
98
|
+
SdkModelType | SdkEnumType | SdkUnionType | SdkDictionaryType | SdkArrayType | SdkNullableType {
|
|
104
99
|
return (
|
|
105
100
|
type.kind === "model" ||
|
|
106
101
|
type.kind === "enum" ||
|
|
@@ -808,12 +803,7 @@ export function getAdditionalPropertiesName(context: SdkContext, model: SdkModel
|
|
|
808
803
|
export function normalizeModelName(
|
|
809
804
|
context: SdkContext,
|
|
810
805
|
type:
|
|
811
|
-
|
|
|
812
|
-
| SdkEnumType
|
|
813
|
-
| SdkUnionType
|
|
814
|
-
| SdkArrayType
|
|
815
|
-
| SdkDictionaryType
|
|
816
|
-
| SdkNullableType,
|
|
806
|
+
SdkModelType | SdkEnumType | SdkUnionType | SdkArrayType | SdkDictionaryType | SdkNullableType,
|
|
817
807
|
nameType: NameType = NameType.Interface,
|
|
818
808
|
skipPolymorphicUnionSuffix = false,
|
|
819
809
|
rawModelName?: boolean,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isReadOnly,
|
|
3
|
-
SdkClientInitializationType,
|
|
4
|
-
SdkClientType,
|
|
5
|
-
SdkExampleValue,
|
|
6
|
-
SdkHttpOperationExample,
|
|
7
|
-
SdkHttpParameterExampleValue,
|
|
8
|
-
SdkModelPropertyType,
|
|
9
|
-
SdkServiceOperation,
|
|
3
|
+
type SdkClientInitializationType,
|
|
4
|
+
type SdkClientType,
|
|
5
|
+
type SdkExampleValue,
|
|
6
|
+
type SdkHttpOperationExample,
|
|
7
|
+
type SdkHttpParameterExampleValue,
|
|
8
|
+
type SdkModelPropertyType,
|
|
9
|
+
type SdkServiceOperation,
|
|
10
10
|
} from "@azure-tools/typespec-client-generator-core";
|
|
11
11
|
import { joinPaths, NoTarget } from "@typespec/compiler";
|
|
12
|
-
import { FunctionDeclarationStructure, SourceFile, StructureKind } from "ts-morph";
|
|
12
|
+
import { type FunctionDeclarationStructure, SourceFile, StructureKind } from "ts-morph";
|
|
13
13
|
import { useContext } from "../context-manager.js";
|
|
14
14
|
import { resolveReference } from "../framework/reference.js";
|
|
15
15
|
import { reportDiagnostic } from "../index.js";
|
|
16
16
|
import { AzureIdentityDependencies } from "../modular/external-dependencies.js";
|
|
17
17
|
import { getSubscriptionId } from "../transform/transform-client-options.js";
|
|
18
18
|
import { hasKeyCredential, hasTokenCredential } from "../utils/credential-utils.js";
|
|
19
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
19
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
20
20
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
21
21
|
import {
|
|
22
22
|
getMethodHierarchiesMap,
|
|
23
23
|
isTenantLevelOperation,
|
|
24
|
-
ServiceOperation,
|
|
24
|
+
type ServiceOperation,
|
|
25
25
|
} from "../utils/operation-util.js";
|
|
26
26
|
import {
|
|
27
27
|
getClientParameterName,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import { getClassicalClientName } from "./helpers/naming-helpers.js";
|
|
33
33
|
import { getOperationFunction } from "./helpers/operation-helpers.js";
|
|
34
34
|
import { buildPropertyNameMapper, isSpreadBodyParameter } from "./helpers/type-helpers.js";
|
|
35
|
-
import { ModelOverrideOptions } from "./serialization/serialize-utils.js";
|
|
35
|
+
import type { ModelOverrideOptions } from "./serialization/serialize-utils.js";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Interfaces for samples generations
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type CompilerHost, joinPaths } from "@typespec/compiler";
|
|
2
2
|
import { SourceFile } from "ts-morph";
|
|
3
3
|
import { resolveReference } from "../framework/reference.js";
|
|
4
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
4
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
5
5
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
6
|
-
import { ServiceOperation } from "../utils/operation-util.js";
|
|
6
|
+
import type { ServiceOperation } from "../utils/operation-util.js";
|
|
7
7
|
import { AzureTestDependencies } from "./external-dependencies.js";
|
|
8
8
|
import {
|
|
9
9
|
buildParameterValueMap,
|
|
10
|
-
ClientEmitOptions,
|
|
10
|
+
type ClientEmitOptions,
|
|
11
11
|
createSourceFile,
|
|
12
12
|
generateMethodCall,
|
|
13
13
|
generateResponseAssertions,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoreDependencies } from "../framework/dependency.js";
|
|
1
|
+
import type { CoreDependencies } from "../framework/dependency.js";
|
|
2
2
|
|
|
3
3
|
export const DefaultCoreDependencies: CoreDependencies = {
|
|
4
4
|
Client: {
|
|
@@ -207,6 +207,16 @@ export const AzureCoreDependencies: CoreDependencies = {
|
|
|
207
207
|
name: "ErrorResponse",
|
|
208
208
|
module: "@azure-rest/core-client",
|
|
209
209
|
},
|
|
210
|
+
getBinaryStreamResponse: {
|
|
211
|
+
kind: "externalDependency",
|
|
212
|
+
module: "@azure-rest/core-client",
|
|
213
|
+
name: "getBinaryStreamResponse",
|
|
214
|
+
},
|
|
215
|
+
NodeReadableStream: {
|
|
216
|
+
kind: "externalDependency",
|
|
217
|
+
module: "@azure/core-rest-pipeline",
|
|
218
|
+
name: "NodeReadableStream",
|
|
219
|
+
},
|
|
210
220
|
};
|
|
211
221
|
|
|
212
222
|
export const AzureIdentityDependencies = {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SdkClientType,
|
|
3
|
+
SdkServiceOperation,
|
|
4
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
2
5
|
import {
|
|
3
|
-
FunctionDeclarationStructure,
|
|
4
|
-
InterfaceDeclarationStructure,
|
|
5
|
-
OptionalKind,
|
|
6
|
-
PropertySignatureStructure,
|
|
6
|
+
type FunctionDeclarationStructure,
|
|
7
|
+
type InterfaceDeclarationStructure,
|
|
8
|
+
type OptionalKind,
|
|
9
|
+
type PropertySignatureStructure,
|
|
7
10
|
SourceFile,
|
|
8
11
|
StructureKind,
|
|
9
12
|
} from "ts-morph";
|
|
@@ -11,9 +14,9 @@ import { addDeclaration } from "../../framework/declaration.js";
|
|
|
11
14
|
import { resolveReference } from "../../framework/reference.js";
|
|
12
15
|
import { refkey } from "../../framework/refkey.js";
|
|
13
16
|
import { getClientModuleInfo } from "../../utils/client-utils.js";
|
|
14
|
-
import { SdkContext } from "../../utils/interfaces.js";
|
|
17
|
+
import type { SdkContext } from "../../utils/interfaces.js";
|
|
15
18
|
import { NameType, normalizeName } from "../../utils/name-utils.js";
|
|
16
|
-
import { ServiceOperation } from "../../utils/operation-util.js";
|
|
19
|
+
import type { ServiceOperation } from "../../utils/operation-util.js";
|
|
17
20
|
import { AzurePollingDependencies } from "../external-dependencies.js";
|
|
18
21
|
import { PagingHelpers, SimplePollerHelpers } from "../static-helpers-metadata.js";
|
|
19
22
|
import { getClassicalLayerPrefix } from "./naming-helpers.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
SdkClientType,
|
|
3
3
|
SdkCredentialParameter,
|
|
4
4
|
SdkEndpointParameter,
|
|
@@ -6,11 +6,16 @@ import {
|
|
|
6
6
|
SdkMethodParameter,
|
|
7
7
|
SdkServiceOperation,
|
|
8
8
|
} from "@azure-tools/typespec-client-generator-core";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
Node,
|
|
11
|
+
type OptionalKind,
|
|
12
|
+
type ParameterDeclarationStructure,
|
|
13
|
+
StatementedNode,
|
|
14
|
+
} from "ts-morph";
|
|
15
|
+
import type { ModularEmitterOptions } from "../interfaces.js";
|
|
11
16
|
|
|
12
17
|
import { resolveReference } from "../../framework/reference.js";
|
|
13
|
-
import { SdkContext } from "../../utils/interfaces.js";
|
|
18
|
+
import type { SdkContext } from "../../utils/interfaces.js";
|
|
14
19
|
import { NameType, normalizeName } from "../../utils/name-utils.js";
|
|
15
20
|
import { CloudSettingHelpers } from "../static-helpers-metadata.js";
|
|
16
21
|
import { getTypeExpression } from "../type-expressions/get-type-expression.js";
|
|
@@ -27,10 +32,7 @@ interface ClientParameterOptions {
|
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
type SdkParameter =
|
|
30
|
-
|
|
|
31
|
-
| SdkEndpointParameter
|
|
32
|
-
| SdkCredentialParameter
|
|
33
|
-
| SdkHttpParameter;
|
|
35
|
+
SdkMethodParameter | SdkEndpointParameter | SdkCredentialParameter | SdkHttpParameter;
|
|
34
36
|
|
|
35
37
|
export function hasDefaultValue(p: SdkParameter) {
|
|
36
38
|
if (p.clientDefaultValue || p.__raw?.defaultValue || p.type.kind === "constant") {
|
|
@@ -236,12 +238,12 @@ export function buildGetClientEndpointParam(
|
|
|
236
238
|
* @returns - an expression representing the options to be passed in to getClient
|
|
237
239
|
*/
|
|
238
240
|
export function buildGetClientOptionsParam(
|
|
239
|
-
context: StatementedNode,
|
|
241
|
+
context: StatementedNode & Node,
|
|
240
242
|
emitterOptions: ModularEmitterOptions,
|
|
241
243
|
endpointParam: string,
|
|
242
244
|
apiVersionParamName?: string,
|
|
243
245
|
): string {
|
|
244
|
-
const userAgentOptions = buildUserAgentOptions(context, emitterOptions
|
|
246
|
+
const userAgentOptions = buildUserAgentOptions(context, emitterOptions);
|
|
245
247
|
const loggingOptions = buildLoggingOptions();
|
|
246
248
|
const credentials = buildCredentials(emitterOptions, endpointParam);
|
|
247
249
|
|
|
@@ -313,37 +315,55 @@ function buildLoggingOptions(): string | undefined {
|
|
|
313
315
|
return `{ logger: options.loggingOptions?.logger ?? logger.info }`;
|
|
314
316
|
}
|
|
315
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Builds the `userAgentOptions` for the generated client, producing a telemetry
|
|
320
|
+
* prefix of the form `[<application_id> ]azsdk-js-<package>/<version>` per the Azure
|
|
321
|
+
* Core telemetry policy: https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy
|
|
322
|
+
*/
|
|
316
323
|
export function buildUserAgentOptions(
|
|
317
|
-
context: StatementedNode,
|
|
324
|
+
context: StatementedNode & Node,
|
|
318
325
|
emitterOptions: ModularEmitterOptions,
|
|
319
|
-
sdkUserAgentPrefix: string,
|
|
320
326
|
): string {
|
|
321
327
|
const userAgentStatements = [];
|
|
322
328
|
const prefixFromOptions = "const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;";
|
|
323
329
|
userAgentStatements.push(prefixFromOptions);
|
|
324
330
|
|
|
331
|
+
const packageName = emitterOptions.options.packageDetails?.name;
|
|
325
332
|
const clientPackageName =
|
|
326
|
-
emitterOptions.options.packageDetails?.nameWithoutScope ??
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
333
|
+
emitterOptions.options.packageDetails?.nameWithoutScope ?? packageName ?? "";
|
|
334
|
+
|
|
335
|
+
// The version is read from the generated package.json at runtime rather than
|
|
336
|
+
// hardcoded here: once the package is generated, its version is owned by
|
|
337
|
+
// package.json. We import it via the package's own "./package.json" export so
|
|
338
|
+
// the specifier is identical in `src` and the built `dist` output.
|
|
339
|
+
let userAgentInfoStatement = "";
|
|
340
|
+
if (clientPackageName && packageName) {
|
|
341
|
+
const packageJsonModule = `${packageName}/package.json`;
|
|
342
|
+
const sourceFile = context.getSourceFile();
|
|
343
|
+
const hasPackageJsonImport = sourceFile
|
|
344
|
+
.getImportDeclarations()
|
|
345
|
+
.some((declaration) => declaration.getModuleSpecifierValue() === packageJsonModule);
|
|
346
|
+
if (!hasPackageJsonImport) {
|
|
347
|
+
sourceFile.addImportDeclaration({
|
|
348
|
+
defaultImport: "pkgJson",
|
|
349
|
+
moduleSpecifier: packageJsonModule,
|
|
350
|
+
attributes: [{ name: "type", value: "json" }],
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
userAgentInfoStatement =
|
|
354
|
+
"const userAgentInfo = `azsdk-js-" + clientPackageName + "/${pkgJson.version}`;";
|
|
338
355
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
356
|
+
|
|
357
|
+
if (!userAgentInfoStatement) {
|
|
358
|
+
// Without package name/version we cannot build a meaningful telemetry token,
|
|
359
|
+
// so we leave the user agent untouched (the caller's userAgentOptions still flow
|
|
360
|
+
// through `...options`) and let core-rest-pipeline defaults apply.
|
|
361
|
+
return "";
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
userAgentStatements.push(userAgentInfoStatement);
|
|
365
|
+
const userAgentPrefix =
|
|
366
|
+
"const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} ${userAgentInfo}` : `${userAgentInfo}`;";
|
|
347
367
|
userAgentStatements.push(userAgentPrefix);
|
|
348
368
|
|
|
349
369
|
context.addStatements(userAgentStatements.join("\n"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DecoratedType, SdkModelType } from "@azure-tools/typespec-client-generator-core";
|
|
1
|
+
import type { DecoratedType, SdkModelType } from "@azure-tools/typespec-client-generator-core";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a header-to-property mapping from @clientOption("header", ...).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isReadOnly,
|
|
3
|
-
SdkClientInitializationType,
|
|
4
|
-
SdkClientType,
|
|
5
|
-
SdkExampleValue,
|
|
6
|
-
SdkHttpOperationExample,
|
|
7
|
-
SdkHttpParameterExampleValue,
|
|
8
|
-
SdkModelPropertyType,
|
|
9
|
-
SdkServiceOperation,
|
|
3
|
+
type SdkClientInitializationType,
|
|
4
|
+
type SdkClientType,
|
|
5
|
+
type SdkExampleValue,
|
|
6
|
+
type SdkHttpOperationExample,
|
|
7
|
+
type SdkHttpParameterExampleValue,
|
|
8
|
+
type SdkModelPropertyType,
|
|
9
|
+
type SdkServiceOperation,
|
|
10
10
|
} from "@azure-tools/typespec-client-generator-core";
|
|
11
11
|
import { joinPaths } from "@typespec/compiler";
|
|
12
12
|
import { SourceFile } from "ts-morph";
|
|
@@ -14,9 +14,9 @@ import { useContext } from "../../context-manager.js";
|
|
|
14
14
|
import { resolveReference } from "../../framework/reference.js";
|
|
15
15
|
import { getSubscriptionId } from "../../transform/transform-client-options.js";
|
|
16
16
|
import { hasKeyCredential, hasTokenCredential } from "../../utils/credential-utils.js";
|
|
17
|
-
import { SdkContext } from "../../utils/interfaces.js";
|
|
17
|
+
import type { SdkContext } from "../../utils/interfaces.js";
|
|
18
18
|
import { NameType, normalizeName } from "../../utils/name-utils.js";
|
|
19
|
-
import { getMethodHierarchiesMap, ServiceOperation } from "../../utils/operation-util.js";
|
|
19
|
+
import { getMethodHierarchiesMap, type ServiceOperation } from "../../utils/operation-util.js";
|
|
20
20
|
import { AzureIdentityDependencies, AzureTestDependencies } from "../external-dependencies.js";
|
|
21
21
|
import { getClientParametersDeclaration } from "./client-helpers.js";
|
|
22
22
|
import { getClassicalClientName } from "./naming-helpers.js";
|