@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
package/src/lib.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { createTypeSpecLibrary, JSONSchemaType, paramMessage } from "@typespec/compiler";
|
|
5
|
-
import { Options } from "prettier";
|
|
6
|
-
import { PackageDetails } from "./interfaces.js";
|
|
4
|
+
import { createTypeSpecLibrary, type JSONSchemaType, paramMessage } from "@typespec/compiler";
|
|
5
|
+
import type { Options } from "prettier";
|
|
6
|
+
import type { PackageDetails } from "./interfaces.js";
|
|
7
7
|
|
|
8
8
|
export interface EmitterOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Use this flag if you would like to generate the sdk only for a specific version.
|
|
11
|
+
* Also accepts values `latest` and `all`, or a map from service namespace full name to version for multi-service packages.
|
|
12
|
+
*/
|
|
13
|
+
"api-version"?: string | Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Specifies the directory where the emitter will look for example files.
|
|
16
|
+
* Defaults to an `examples` directory located at the project root.
|
|
17
|
+
*/
|
|
18
|
+
"examples-dir"?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the namespace you want to override for namespaces set in the spec.
|
|
21
|
+
* With this config, all namespace for the spec types will default to it.
|
|
22
|
+
*/
|
|
23
|
+
namespace?: string;
|
|
9
24
|
/**
|
|
10
25
|
* Indicates whether to include response headers in the generated response type for modular operations.
|
|
11
26
|
* When set to true, modular operation responses with model or void bodies will have their headers
|
|
@@ -50,8 +65,6 @@ export interface EmitterOptions {
|
|
|
50
65
|
"ignore-property-name-normalize"?: boolean;
|
|
51
66
|
"typespec-title-map"?: Record<string, string>;
|
|
52
67
|
"ignore-enum-member-name-normalize"?: boolean;
|
|
53
|
-
//TODO should remove this after finish the release tool test
|
|
54
|
-
"should-use-pnpm-dep"?: boolean;
|
|
55
68
|
"ignore-nullable-on-optional"?: boolean;
|
|
56
69
|
/**
|
|
57
70
|
* When set to true (default for Azure services), non-model return types (arrays, scalars, enums,
|
|
@@ -84,6 +97,31 @@ export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
84
97
|
type: "object",
|
|
85
98
|
additionalProperties: true,
|
|
86
99
|
properties: {
|
|
100
|
+
"api-version": {
|
|
101
|
+
oneOf: [
|
|
102
|
+
{ type: "string", nullable: true },
|
|
103
|
+
{
|
|
104
|
+
type: "object",
|
|
105
|
+
additionalProperties: { type: "string" },
|
|
106
|
+
required: [],
|
|
107
|
+
nullable: true,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
description:
|
|
111
|
+
"Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values `latest` and `all`. For multi-service packages, provide a map from each service namespace's full name to its desired version; services not listed default to their latest version.",
|
|
112
|
+
} as any,
|
|
113
|
+
"examples-dir": {
|
|
114
|
+
type: "string",
|
|
115
|
+
nullable: true,
|
|
116
|
+
description:
|
|
117
|
+
"Specifies the directory where the emitter will look for example files. If the flag isn't set, the emitter defaults to using an `examples` directory located at the project root.",
|
|
118
|
+
},
|
|
119
|
+
namespace: {
|
|
120
|
+
type: "string",
|
|
121
|
+
nullable: true,
|
|
122
|
+
description:
|
|
123
|
+
"Specifies the namespace you want to override for namespaces set in the spec. With this config, all namespace for the spec types will default to it.",
|
|
124
|
+
},
|
|
87
125
|
"include-headers-in-response": {
|
|
88
126
|
type: "boolean",
|
|
89
127
|
nullable: true,
|
|
@@ -99,7 +137,6 @@ export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
99
137
|
nameWithoutScope: { type: "string", nullable: true },
|
|
100
138
|
description: { type: "string", nullable: true },
|
|
101
139
|
version: { type: "string", nullable: true },
|
|
102
|
-
isVersionUserProvided: { type: "boolean", nullable: true },
|
|
103
140
|
},
|
|
104
141
|
required: ["name"],
|
|
105
142
|
nullable: true,
|
|
@@ -245,11 +282,6 @@ export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
245
282
|
"```",
|
|
246
283
|
].join("\n"),
|
|
247
284
|
},
|
|
248
|
-
"should-use-pnpm-dep": {
|
|
249
|
-
type: "boolean",
|
|
250
|
-
nullable: true,
|
|
251
|
-
description: "Internal option for test.",
|
|
252
|
-
},
|
|
253
285
|
"ignore-nullable-on-optional": {
|
|
254
286
|
type: "boolean",
|
|
255
287
|
nullable: true,
|
package/src/meta-tree.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import { ClientModel } from "../interfaces.js";
|
|
5
|
+
import type { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
7
|
export function buildApiExtractorConfig(_model: ClientModel) {
|
|
8
8
|
const project = new Project({ useInMemoryFileSystem: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
|
|
6
6
|
function getPackageVersion(model: ClientModel): string {
|
|
7
7
|
return model.options?.packageDetails?.version ?? "1.0.0-beta.1";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import { ClientModel } from "../interfaces.js";
|
|
5
|
+
import type { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
7
|
const esLintConfigEsmAzureSdk = `import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
|
|
8
8
|
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project, SourceFile } from "ts-morph";
|
|
5
|
-
import { ClientModel } from "../interfaces.js";
|
|
5
|
+
import type { ClientModel } from "../interfaces.js";
|
|
6
6
|
import { hasPollingOperations } from "../utils/operation-helpers.js";
|
|
7
7
|
import { buildAzureMonorepoPackage } from "./package-json/build-azure-monorepo-package.js";
|
|
8
|
-
import { PackageCommonInfoConfig, resolveWarpExports } from "./package-json/package-common.js";
|
|
8
|
+
import { type PackageCommonInfoConfig, resolveWarpExports } from "./package-json/package-common.js";
|
|
9
9
|
import { getPackageName } from "./utils.js";
|
|
10
10
|
|
|
11
11
|
interface PackageFileOptions {
|
|
12
12
|
exports?: Record<string, any>;
|
|
13
13
|
dependencies?: Record<string, string>;
|
|
14
|
-
clientContextPaths?: string[];
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export function buildPackageFile(
|
|
18
17
|
model: ClientModel,
|
|
19
|
-
{ exports, dependencies
|
|
18
|
+
{ exports, dependencies }: PackageFileOptions = {},
|
|
20
19
|
) {
|
|
21
20
|
const config: PackageCommonInfoConfig = {
|
|
22
21
|
description: getDescription(model),
|
|
@@ -35,7 +34,6 @@ export function buildPackageFile(
|
|
|
35
34
|
hasLro: hasPollingOperations(model),
|
|
36
35
|
monorepoPackageDirectory: model.options?.azureOutputDirectory,
|
|
37
36
|
dependencies,
|
|
38
|
-
clientContextPaths,
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
const packageInfo: Record<string, any> = buildAzureMonorepoPackage(extendedConfig);
|
|
@@ -63,17 +61,15 @@ export function buildPackageFile(
|
|
|
63
61
|
* - Adds LRO dependencies (`@azure/core-lro`, `@azure/abort-controller`) when the package has
|
|
64
62
|
* polling operations (for non-monorepo Azure packages).
|
|
65
63
|
* - Updates exports (tshy or warp) when `exports` is provided.
|
|
66
|
-
* - Updates `//metadata.constantPaths` when `clientContextPaths` is provided.
|
|
67
64
|
*/
|
|
68
65
|
export function updatePackageFile(
|
|
69
66
|
model: ClientModel,
|
|
70
67
|
existingFilePathOrContent: string | Record<string, any>,
|
|
71
|
-
{ exports
|
|
68
|
+
{ exports }: PackageFileOptions = {},
|
|
72
69
|
) {
|
|
73
70
|
const hasLro = hasPollingOperations(model);
|
|
74
71
|
const needsLroUpdate = hasLro;
|
|
75
72
|
const needsExportsUpdate = exports;
|
|
76
|
-
const needsConstantPathsUpdate = clientContextPaths && clientContextPaths.length > 0;
|
|
77
73
|
|
|
78
74
|
let packageInfo;
|
|
79
75
|
if (typeof existingFilePathOrContent === "string") {
|
|
@@ -99,30 +95,6 @@ export function updatePackageFile(
|
|
|
99
95
|
needsCoreClientUpdate = true;
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
// Ensure warp packages have #platform/* imports for polyfill resolution.
|
|
103
|
-
// The `react-native` condition is only added when explicitly opted in via
|
|
104
|
-
// `generateReactNativeTarget`, matching the fresh-generation path in
|
|
105
|
-
// `getEsmEntrypointInformation` (packageCommon.ts).
|
|
106
|
-
const platformImports: Record<string, string> = {
|
|
107
|
-
browser: "./src/*-browser.mts",
|
|
108
|
-
default: "./src/*.ts",
|
|
109
|
-
};
|
|
110
|
-
if (model.options?.generateReactNativeTarget) {
|
|
111
|
-
// Insert `react-native` before `default` so Node's conditional
|
|
112
|
-
// resolution order matches the fresh-generation output.
|
|
113
|
-
packageInfo.imports = {
|
|
114
|
-
"#platform/*": {
|
|
115
|
-
browser: platformImports["browser"],
|
|
116
|
-
"react-native": "./src/*-react-native.mts",
|
|
117
|
-
default: platformImports["default"],
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
} else {
|
|
121
|
-
packageInfo.imports = {
|
|
122
|
-
"#platform/*": platformImports,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
98
|
// Update exports (warp: resolved exports in package.json)
|
|
127
99
|
if (needsExportsUpdate) {
|
|
128
100
|
packageInfo.exports = resolveWarpExports(exports, model.options?.generateReactNativeTarget);
|
|
@@ -131,9 +103,6 @@ export function updatePackageFile(
|
|
|
131
103
|
// Update Core Client dependency
|
|
132
104
|
if (needsCoreClientUpdate) {
|
|
133
105
|
delete deps["@azure/core-client"];
|
|
134
|
-
if (!("@azure-rest/core-client" in deps)) {
|
|
135
|
-
deps["@azure-rest/core-client"] = "^2.3.1";
|
|
136
|
-
}
|
|
137
106
|
packageInfo.dependencies = deps;
|
|
138
107
|
}
|
|
139
108
|
|
|
@@ -146,20 +115,13 @@ export function updatePackageFile(
|
|
|
146
115
|
};
|
|
147
116
|
}
|
|
148
117
|
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// Add new userAgentInfo entries from clientContextPaths
|
|
157
|
-
const newUserAgentPaths = clientContextPaths!.map((path) => ({
|
|
158
|
-
path: path,
|
|
159
|
-
prefix: "userAgentInfo",
|
|
160
|
-
}));
|
|
161
|
-
metadata.constantPaths = [...nonUserAgentPaths, ...newUserAgentPaths];
|
|
162
|
-
}
|
|
118
|
+
// Always update @azure/core-rest-pipeline and @azure-rest/core-client to the latest
|
|
119
|
+
// versions because our imports rely on APIs from those latest package versions.
|
|
120
|
+
packageInfo.dependencies = {
|
|
121
|
+
...packageInfo.dependencies,
|
|
122
|
+
"@azure/core-rest-pipeline": "^1.24.0",
|
|
123
|
+
"@azure-rest/core-client": "^2.7.0",
|
|
124
|
+
};
|
|
163
125
|
|
|
164
126
|
return {
|
|
165
127
|
path: "package.json",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
import { getClientName } from "../utils/name-constructors.js";
|
|
6
6
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
7
7
|
import { renderTemplate } from "./render-template.js";
|
|
@@ -276,13 +276,13 @@ function createMetadata(model: ClientModel): Metadata | undefined {
|
|
|
276
276
|
const clientClassName = getClientName(model);
|
|
277
277
|
const serviceName = getServiceName(model);
|
|
278
278
|
let apiRefUrlQueryParameter: string = "";
|
|
279
|
-
if (!packageDetails?.
|
|
279
|
+
if (!packageDetails?.version && model.apiVersionInfo?.defaultValue) {
|
|
280
280
|
if (model.apiVersionInfo?.defaultValue?.toLowerCase().includes("preview")) {
|
|
281
281
|
apiRefUrlQueryParameter = "?view=azure-node-preview";
|
|
282
282
|
}
|
|
283
283
|
} else {
|
|
284
|
-
|
|
285
|
-
if (
|
|
284
|
+
const packageVersion = packageDetails.version ?? "1.0.0-beta.1";
|
|
285
|
+
if (packageVersion.includes("beta")) {
|
|
286
286
|
apiRefUrlQueryParameter = "?view=azure-node-preview";
|
|
287
287
|
}
|
|
288
288
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
import { getPackageName } from "./utils.js";
|
|
6
6
|
|
|
7
7
|
function shouldGenerateTestConfig(model: ClientModel): boolean {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import { ClientModel } from "../interfaces.js";
|
|
5
|
+
import type { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Builds the root tsconfig.json.
|
|
@@ -52,16 +52,36 @@ export function buildTsConfig(model: ClientModel) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Derives the tsconfig `include` list from the warp `exports` map so every
|
|
57
|
+
* exported client entry point is compiled and emitted to `dist`; if they drift
|
|
58
|
+
* out of sync, warp fails the build with `DIST_MISSING`. Root index is the fallback.
|
|
59
|
+
*/
|
|
60
|
+
export function getSrcIncludePaths(exports?: Record<string, string>): string[] {
|
|
61
|
+
const includes = new Set<string>(["../src/index.ts"]);
|
|
62
|
+
if (exports) {
|
|
63
|
+
for (const value of Object.values(exports)) {
|
|
64
|
+
if (typeof value === "string" && value.endsWith(".ts")) {
|
|
65
|
+
includes.add(value.replace(/^\.\//, "../"));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return Array.from(includes);
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
/**
|
|
56
73
|
* Builds config/tsconfig.src.esm.json — extends eng/tsconfigs/src.esm.json
|
|
57
74
|
*/
|
|
58
|
-
export function buildTsSrcEsmConfig() {
|
|
75
|
+
export function buildTsSrcEsmConfig(exports?: Record<string, string>) {
|
|
59
76
|
return {
|
|
60
77
|
path: "config/tsconfig.src.esm.json",
|
|
61
78
|
content: JSON.stringify(
|
|
62
79
|
{
|
|
63
80
|
extends: "../../../../eng/tsconfigs/src.esm.json",
|
|
64
|
-
|
|
81
|
+
compilerOptions: {
|
|
82
|
+
resolveJsonModule: true,
|
|
83
|
+
},
|
|
84
|
+
include: getSrcIncludePaths(exports),
|
|
65
85
|
},
|
|
66
86
|
null,
|
|
67
87
|
2,
|
|
@@ -72,13 +92,16 @@ export function buildTsSrcEsmConfig() {
|
|
|
72
92
|
/**
|
|
73
93
|
* Builds config/tsconfig.src.browser.json — extends eng/tsconfigs/src.browser.json
|
|
74
94
|
*/
|
|
75
|
-
export function buildTsSrcBrowserConfig() {
|
|
95
|
+
export function buildTsSrcBrowserConfig(exports?: Record<string, string>) {
|
|
76
96
|
return {
|
|
77
97
|
path: "config/tsconfig.src.browser.json",
|
|
78
98
|
content: JSON.stringify(
|
|
79
99
|
{
|
|
80
100
|
extends: "../../../../eng/tsconfigs/src.browser.json",
|
|
81
|
-
|
|
101
|
+
compilerOptions: {
|
|
102
|
+
resolveJsonModule: true,
|
|
103
|
+
},
|
|
104
|
+
include: getSrcIncludePaths(exports),
|
|
82
105
|
},
|
|
83
106
|
null,
|
|
84
107
|
2,
|
|
@@ -89,13 +112,16 @@ export function buildTsSrcBrowserConfig() {
|
|
|
89
112
|
/**
|
|
90
113
|
* Builds config/tsconfig.src.react-native.json — extends eng/tsconfigs/src.react-native.json
|
|
91
114
|
*/
|
|
92
|
-
export function buildTsSrcReactNativeConfig() {
|
|
115
|
+
export function buildTsSrcReactNativeConfig(exports?: Record<string, string>) {
|
|
93
116
|
return {
|
|
94
117
|
path: "config/tsconfig.src.react-native.json",
|
|
95
118
|
content: JSON.stringify(
|
|
96
119
|
{
|
|
97
120
|
extends: "../../../../eng/tsconfigs/src.react-native.json",
|
|
98
|
-
|
|
121
|
+
compilerOptions: {
|
|
122
|
+
resolveJsonModule: true,
|
|
123
|
+
},
|
|
124
|
+
include: getSrcIncludePaths(exports),
|
|
99
125
|
},
|
|
100
126
|
null,
|
|
101
127
|
2,
|
|
@@ -106,13 +132,16 @@ export function buildTsSrcReactNativeConfig() {
|
|
|
106
132
|
/**
|
|
107
133
|
* Builds config/tsconfig.src.cjs.json — extends eng/tsconfigs/src.cjs.json
|
|
108
134
|
*/
|
|
109
|
-
export function buildTsSrcCjsConfig() {
|
|
135
|
+
export function buildTsSrcCjsConfig(exports?: Record<string, string>) {
|
|
110
136
|
return {
|
|
111
137
|
path: "config/tsconfig.src.cjs.json",
|
|
112
138
|
content: JSON.stringify(
|
|
113
139
|
{
|
|
114
140
|
extends: "../../../../eng/tsconfigs/src.cjs.json",
|
|
115
|
-
|
|
141
|
+
compilerOptions: {
|
|
142
|
+
resolveJsonModule: true,
|
|
143
|
+
},
|
|
144
|
+
include: getSrcIncludePaths(exports),
|
|
116
145
|
},
|
|
117
146
|
null,
|
|
118
147
|
2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
|
|
6
6
|
const nodeConfig = `import viteConfig from "../../../vitest.shared.config.ts";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
|
|
6
6
|
export interface WarpConfigOptions {
|
|
7
7
|
/** Source-level exports, e.g. { ".": "./src/index.ts", "./models": "./src/models/index.ts" } */
|
|
@@ -61,8 +61,6 @@ targets:
|
|
|
61
61
|
* Builds a self-contained warp.config.yml file.
|
|
62
62
|
*
|
|
63
63
|
* Emits a full inline config with all exports and targets.
|
|
64
|
-
* Polyfill resolution (browser/react-native file substitution) is handled
|
|
65
|
-
* via package.json `imports` subpath imports (#platform/*).
|
|
66
64
|
*
|
|
67
65
|
* By default, react-native target is NOT included. Set `generateReactNativeTarget: true`
|
|
68
66
|
* in options to include it.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { PackageCommonInfoConfig } from "./package-common.js";
|
|
4
|
+
import type { PackageCommonInfoConfig } from "./package-common.js";
|
|
5
5
|
|
|
6
6
|
export interface AzurePackageInfoConfig extends PackageCommonInfoConfig {
|
|
7
7
|
hasLro: boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { AzurePackageInfoConfig, getAzureCommonPackageInfo } from "./azure-package-common.js";
|
|
4
|
+
import { type AzurePackageInfoConfig, getAzureCommonPackageInfo } from "./azure-package-common.js";
|
|
5
5
|
import { getCommonPackageScripts, getPackageCommonInfo } from "./package-common.js";
|
|
6
6
|
|
|
7
7
|
export interface AzureMonorepoInfoConfig extends AzurePackageInfoConfig {
|
|
8
8
|
monorepoPackageDirectory?: string;
|
|
9
|
-
clientContextPaths?: string[];
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -32,7 +31,7 @@ export function getAzureMonorepoDependencies(config: AzureMonorepoInfoConfig) {
|
|
|
32
31
|
// revert this change after sdk repo update.
|
|
33
32
|
const runtimeDeps = {
|
|
34
33
|
...dependencies,
|
|
35
|
-
"@azure-rest/core-client": "^2.
|
|
34
|
+
"@azure-rest/core-client": "^2.7.0",
|
|
36
35
|
...(hasLro && {
|
|
37
36
|
"@azure/abort-controller": "^2.1.2",
|
|
38
37
|
}),
|
|
@@ -40,7 +39,7 @@ export function getAzureMonorepoDependencies(config: AzureMonorepoInfoConfig) {
|
|
|
40
39
|
...(hasLro && {
|
|
41
40
|
"@azure/core-lro": "^3.1.0",
|
|
42
41
|
}),
|
|
43
|
-
"@azure/core-rest-pipeline": "^1.
|
|
42
|
+
"@azure/core-rest-pipeline": "^1.24.0",
|
|
44
43
|
"@azure/core-util": "^1.12.0",
|
|
45
44
|
"@azure/logger": "^1.2.0",
|
|
46
45
|
tslib: "catalog:",
|
|
@@ -101,7 +100,6 @@ export function getAzureMonorepoPackageInfo(config: AzureMonorepoInfoConfig): Re
|
|
|
101
100
|
homepage: `https://github.com/Azure/azure-sdk-for-js/tree/main/${config.monorepoPackageDirectory}/README.md`,
|
|
102
101
|
}),
|
|
103
102
|
prettier: "@azure/eslint-plugin-azure-sdk/prettier.json",
|
|
104
|
-
"//metadata": getMetadataInfo(config),
|
|
105
103
|
};
|
|
106
104
|
}
|
|
107
105
|
|
|
@@ -162,18 +160,3 @@ function getEsmScripts() {
|
|
|
162
160
|
test: "tsc -b --noEmit && npm run test:node && npm run test:browser",
|
|
163
161
|
};
|
|
164
162
|
}
|
|
165
|
-
|
|
166
|
-
function getMetadataInfo(config: AzureMonorepoInfoConfig) {
|
|
167
|
-
const metadata: Record<string, any> = {
|
|
168
|
-
constantPaths: [],
|
|
169
|
-
};
|
|
170
|
-
const paths = config.clientContextPaths;
|
|
171
|
-
for (const path of paths ?? []) {
|
|
172
|
-
metadata["constantPaths"].push({
|
|
173
|
-
path: path,
|
|
174
|
-
prefix: "userAgentInfo",
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return metadata;
|
|
179
|
-
}
|
|
@@ -45,26 +45,11 @@ function getEntryPointInformation(config: PackageCommonInfoConfig) {
|
|
|
45
45
|
module: "./dist/esm/index.js",
|
|
46
46
|
types: "./dist/commonjs/index.d.ts",
|
|
47
47
|
browser: "./dist/browser/index.js",
|
|
48
|
-
imports: {
|
|
49
|
-
"#platform/*": {
|
|
50
|
-
browser: "./src/*-browser.mts",
|
|
51
|
-
default: "./src/*.ts",
|
|
52
|
-
} as Record<string, string>,
|
|
53
|
-
},
|
|
54
48
|
exports: resolveWarpExports(config.exports, config.generateReactNativeTarget),
|
|
55
49
|
};
|
|
56
50
|
|
|
57
51
|
if (config.generateReactNativeTarget) {
|
|
58
52
|
result["react-native"] = "./dist/react-native/index.js";
|
|
59
|
-
(result["imports"]["#platform/*"] as Record<string, string>)["react-native"] =
|
|
60
|
-
"./src/*-react-native.mts";
|
|
61
|
-
// Reorder so react-native comes before default
|
|
62
|
-
const importsEntry = result["imports"]["#platform/*"] as Record<string, string>;
|
|
63
|
-
result["imports"]["#platform/*"] = {
|
|
64
|
-
browser: importsEntry["browser"],
|
|
65
|
-
"react-native": importsEntry["react-native"],
|
|
66
|
-
default: importsEntry["default"],
|
|
67
|
-
};
|
|
68
53
|
}
|
|
69
54
|
|
|
70
55
|
return result;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientModel } from "../../interfaces.js";
|
|
1
|
+
import type { ClientModel } from "../../interfaces.js";
|
|
2
2
|
import { getClientName } from "../../utils/name-constructors.js";
|
|
3
3
|
import { renderTemplate } from "../render-template.js";
|
|
4
4
|
import { snippetsContent } from "./template.js";
|
package/src/metadata/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { ClientModel } from "../interfaces.js";
|
|
4
|
+
import type { ClientModel } from "../interfaces.js";
|
|
5
5
|
|
|
6
6
|
export function getPackageName(model: ClientModel): string {
|
|
7
7
|
return model.options?.packageDetails?.name ?? model.libraryName;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClassDeclaration,
|
|
3
|
-
MethodDeclarationStructure,
|
|
3
|
+
type MethodDeclarationStructure,
|
|
4
4
|
Scope,
|
|
5
5
|
SourceFile,
|
|
6
6
|
StructureKind,
|
|
7
7
|
} from "ts-morph";
|
|
8
|
-
import {
|
|
8
|
+
import { getClientParametersDeclaration } from "./helpers/client-helpers.js";
|
|
9
9
|
import { getClassicalClientName, getClientName } from "./helpers/naming-helpers.js";
|
|
10
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
10
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
InitializedByFlags,
|
|
14
|
-
SdkClientType,
|
|
15
|
-
SdkServiceMethod,
|
|
16
|
-
SdkServiceOperation,
|
|
14
|
+
type SdkClientType,
|
|
15
|
+
type SdkServiceMethod,
|
|
16
|
+
type SdkServiceOperation,
|
|
17
17
|
} from "@azure-tools/typespec-client-generator-core";
|
|
18
18
|
import { useContext } from "../context-manager.js";
|
|
19
19
|
import { useDependencies } from "../framework/hooks/use-dependencies.js";
|
|
20
20
|
import { resolveReference } from "../framework/reference.js";
|
|
21
21
|
import { refkey } from "../framework/refkey.js";
|
|
22
22
|
import { getClientModuleInfo, isMultiEndpointClient } from "../utils/client-utils.js";
|
|
23
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
23
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
24
24
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
25
25
|
import { getMethodHierarchiesMap, isTenantLevelOperation } from "../utils/operation-util.js";
|
|
26
26
|
import { AzurePollingDependencies } from "./external-dependencies.js";
|
|
@@ -127,11 +127,7 @@ export function buildClassicalClient(
|
|
|
127
127
|
.map((p) => p.name)
|
|
128
128
|
.map((x) => {
|
|
129
129
|
if (x === "options") {
|
|
130
|
-
return `
|
|
131
|
-
constructor,
|
|
132
|
-
emitterOptions,
|
|
133
|
-
"azsdk-js-client",
|
|
134
|
-
)}}`;
|
|
130
|
+
return `options`;
|
|
135
131
|
} else if (x.toLowerCase() === "subscriptionid" && shouldSubscriptionIdOptional) {
|
|
136
132
|
return `subscriptionId ?? ""`;
|
|
137
133
|
} else {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
SdkClientType,
|
|
3
|
+
SdkServiceOperation,
|
|
4
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
2
5
|
import { SourceFile } from "ts-morph";
|
|
3
6
|
import { useContext } from "../context-manager.js";
|
|
4
7
|
import { getClientModuleInfo } from "../utils/client-utils.js";
|
|
5
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
8
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
6
9
|
import { NameType } from "../utils/name-utils.js";
|
|
7
10
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
8
11
|
import { getClassicalOperation } from "./helpers/classical-operation-helpers.js";
|
|
9
12
|
import { getClassicalLayerPrefix } from "./helpers/naming-helpers.js";
|
|
10
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
13
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
11
14
|
|
|
12
15
|
export function buildClassicOperationFiles(
|
|
13
16
|
dpgContext: SdkContext,
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
getClientParameters,
|
|
7
7
|
getClientParametersDeclaration,
|
|
8
8
|
} from "./helpers/client-helpers.js";
|
|
9
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
9
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import type {
|
|
12
12
|
SdkClientType,
|
|
13
13
|
SdkCredentialParameter,
|
|
14
14
|
SdkEndpointParameter,
|
|
@@ -24,7 +24,7 @@ import { resolveReference } from "../framework/reference.js";
|
|
|
24
24
|
import { refkey } from "../framework/refkey.js";
|
|
25
25
|
import { reportDiagnostic } from "../lib.js";
|
|
26
26
|
import { getClientModuleInfo } from "../utils/client-utils.js";
|
|
27
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
27
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
28
28
|
import { NameType, normalizeName } from "../utils/name-utils.js";
|
|
29
29
|
import { buildEnumTypes, getApiVersionEnum } from "./emit-models.js";
|
|
30
30
|
import { getDocsFromDescription } from "./helpers/docs-helpers.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
2
|
-
import { ModularEmitterOptions } from "./interfaces.js";
|
|
1
|
+
import type { SdkContext } from "../utils/interfaces.js";
|
|
2
|
+
import type { ModularEmitterOptions } from "./interfaces.js";
|
|
3
3
|
|
|
4
4
|
let CASING: "camel" | "snake" = "snake";
|
|
5
5
|
|