@azure-tools/typespec-ts 0.56.0-dev.1 → 0.56.0-dev.11
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/README.md +1 -13
- package/dist/src/context-manager.d.ts +19 -2
- package/dist/src/context-manager.d.ts.map +1 -1
- package/dist/src/context-manager.js +21 -0
- package/dist/src/context-manager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +6 -20
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +9 -0
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +14 -1
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/source-file-batch.d.ts +35 -0
- package/dist/src/framework/source-file-batch.d.ts.map +1 -0
- package/dist/src/framework/source-file-batch.js +128 -0
- package/dist/src/framework/source-file-batch.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +73 -62
- package/dist/src/index.js.map +1 -1
- package/dist/src/{rlc-common/interfaces.d.ts → interfaces.d.ts} +12 -14
- package/dist/src/interfaces.d.ts.map +1 -0
- package/dist/src/interfaces.js.map +1 -0
- package/dist/src/lib.d.ts +2 -4
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -12
- package/dist/src/lib.js.map +1 -1
- package/dist/src/meta-tree.d.ts +4 -4
- package/dist/src/meta-tree.d.ts.map +1 -1
- package/dist/src/metadata/build-api-extractor-config.d.ts +6 -0
- package/dist/src/metadata/build-api-extractor-config.d.ts.map +1 -0
- package/dist/src/metadata/build-api-extractor-config.js.map +1 -0
- package/dist/src/metadata/build-changelog-file.d.ts +6 -0
- package/dist/src/metadata/build-changelog-file.d.ts.map +1 -0
- package/dist/src/metadata/build-changelog-file.js.map +1 -0
- package/dist/src/metadata/build-es-lint-config.d.ts +6 -0
- package/dist/src/metadata/build-es-lint-config.d.ts.map +1 -0
- package/dist/src/metadata/build-es-lint-config.js.map +1 -0
- package/dist/src/metadata/build-license-file.d.ts.map +1 -0
- package/dist/src/metadata/build-license-file.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-package-file.d.ts +3 -3
- package/dist/src/metadata/build-package-file.d.ts.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-package-file.js +1 -1
- package/dist/src/metadata/build-package-file.js.map +1 -0
- package/dist/src/metadata/build-readme-file.d.ts +11 -0
- package/dist/src/metadata/build-readme-file.d.ts.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-readme-file.js +16 -69
- package/dist/src/metadata/build-readme-file.js.map +1 -0
- package/dist/src/metadata/build-sample-env-file.d.ts +6 -0
- package/dist/src/metadata/build-sample-env-file.d.ts.map +1 -0
- package/dist/src/metadata/build-sample-env-file.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-test-config.d.ts +3 -3
- package/dist/src/metadata/build-test-config.d.ts.map +1 -0
- package/dist/src/metadata/build-test-config.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.d.ts +3 -3
- package/dist/src/metadata/build-ts-config.d.ts.map +1 -0
- package/dist/src/metadata/build-ts-config.js.map +1 -0
- package/dist/src/metadata/build-vitest-config.d.ts +6 -0
- package/dist/src/metadata/build-vitest-config.d.ts.map +1 -0
- package/dist/src/metadata/build-vitest-config.js.map +1 -0
- package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.d.ts +2 -2
- package/dist/src/metadata/build-warp-config.d.ts.map +1 -0
- package/dist/src/metadata/build-warp-config.js.map +1 -0
- package/dist/src/metadata/package-json/azure-package-common.d.ts.map +1 -0
- package/dist/src/metadata/package-json/azure-package-common.js.map +1 -0
- package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -0
- package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -0
- package/dist/src/metadata/package-json/package-common.d.ts.map +1 -0
- package/dist/src/metadata/package-json/package-common.js.map +1 -0
- package/dist/src/metadata/render-template.d.ts +24 -0
- package/dist/src/metadata/render-template.d.ts.map +1 -0
- package/dist/src/metadata/render-template.js +148 -0
- package/dist/src/metadata/render-template.js.map +1 -0
- package/dist/src/metadata/test/build-recorded-client.d.ts +6 -0
- package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -0
- package/dist/src/metadata/test/build-recorded-client.js +8 -0
- package/dist/src/metadata/test/build-recorded-client.js.map +1 -0
- package/dist/src/metadata/test/build-sample-test.d.ts +6 -0
- package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -0
- package/dist/src/metadata/test/build-sample-test.js +8 -0
- package/dist/src/metadata/test/build-sample-test.js.map +1 -0
- package/dist/src/metadata/test/build-snippets.d.ts +6 -0
- package/dist/src/metadata/test/build-snippets.d.ts.map +1 -0
- package/dist/src/{rlc-common → metadata}/test/build-snippets.js +3 -5
- package/dist/src/metadata/test/build-snippets.js.map +1 -0
- package/dist/src/metadata/test/template.d.ts +4 -0
- package/dist/src/metadata/test/template.d.ts.map +1 -0
- package/dist/src/metadata/test/template.js +100 -0
- package/dist/src/metadata/test/template.js.map +1 -0
- package/dist/src/metadata/utils.d.ts +3 -0
- package/dist/src/metadata/utils.d.ts.map +1 -0
- package/dist/src/metadata/utils.js.map +1 -0
- package/dist/src/modular/build-classical-client.d.ts.map +1 -1
- package/dist/src/modular/build-classical-client.js +9 -9
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -1
- package/dist/src/modular/build-classical-operation-groups.js +3 -3
- package/dist/src/modular/build-classical-operation-groups.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +7 -7
- package/dist/src/modular/build-client-context.js.map +1 -1
- package/dist/src/modular/build-modular-options.js +3 -3
- package/dist/src/modular/build-modular-options.js.map +1 -1
- package/dist/src/modular/build-operations.d.ts.map +1 -1
- package/dist/src/modular/build-operations.js +6 -6
- package/dist/src/modular/build-operations.js.map +1 -1
- package/dist/src/modular/build-project-files.d.ts.map +1 -1
- package/dist/src/modular/build-project-files.js +4 -4
- package/dist/src/modular/build-project-files.js.map +1 -1
- package/dist/src/modular/build-restore-poller.d.ts.map +1 -1
- package/dist/src/modular/build-restore-poller.js +3 -3
- package/dist/src/modular/build-restore-poller.js.map +1 -1
- package/dist/src/modular/build-root-index.d.ts.map +1 -1
- package/dist/src/modular/build-root-index.js +42 -14
- package/dist/src/modular/build-root-index.js.map +1 -1
- package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
- package/dist/src/modular/build-subpath-index.js +17 -4
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-models-options.d.ts.map +1 -1
- package/dist/src/modular/emit-models-options.js +3 -3
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts +1 -1
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +32 -25
- package/dist/src/modular/emit-models.js.map +1 -1
- package/dist/src/modular/emit-samples.d.ts.map +1 -1
- package/dist/src/modular/emit-samples.js +5 -5
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +1 -1
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classical-operation-helpers.js +11 -11
- package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +3 -3
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +2 -2
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/naming-helpers.js +2 -2
- package/dist/src/modular/helpers/naming-helpers.js.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.d.ts +4 -4
- package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.js +25 -26
- package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
- package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/type-helpers.js +1 -1
- package/dist/src/modular/helpers/type-helpers.js.map +1 -1
- package/dist/src/modular/interfaces.d.ts +4 -4
- package/dist/src/modular/interfaces.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-deserializer-function.js +2 -2
- package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-serializer-function.js +2 -2
- package/dist/src/modular/serialization/build-serializer-function.js.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.js +1 -1
- package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js +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.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +3 -3
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts.map +1 -1
- package/dist/src/transform/transform-api-version-info.js +4 -3
- package/dist/src/transform/transform-api-version-info.js.map +1 -1
- package/dist/src/transform/{transfrom-rlc-options.d.ts → transform-client-options.d.ts} +3 -3
- package/dist/src/transform/transform-client-options.d.ts.map +1 -0
- package/dist/src/transform/{transfrom-rlc-options.js → transform-client-options.js} +9 -13
- package/dist/src/transform/transform-client-options.js.map +1 -0
- package/dist/src/transform/transform-helper-function-details.d.ts +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +4 -4
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-parameters.d.ts +1 -1
- package/dist/src/transform/transform-parameters.d.ts.map +1 -1
- package/dist/src/transform/transform-parameters.js +11 -11
- package/dist/src/transform/transform-parameters.js.map +1 -1
- package/dist/src/transform/transform-paths.d.ts +1 -1
- package/dist/src/transform/transform-paths.d.ts.map +1 -1
- package/dist/src/transform/transform-paths.js +5 -4
- package/dist/src/transform/transform-paths.js.map +1 -1
- package/dist/src/transform/transform-responses.d.ts +1 -1
- package/dist/src/transform/transform-responses.d.ts.map +1 -1
- package/dist/src/transform/transform-responses.js +19 -18
- package/dist/src/transform/transform-responses.js.map +1 -1
- package/dist/src/transform/transform-schemas.js +5 -5
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform-telemetry-info.d.ts +1 -1
- package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -1
- package/dist/src/transform/transform-telemetry-info.js +2 -2
- package/dist/src/transform/transform-telemetry-info.js.map +1 -1
- package/dist/src/transform/transform.d.ts +2 -2
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +9 -10
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/utils/api-version-util.d.ts.map +1 -0
- package/dist/src/utils/api-version-util.js.map +1 -0
- package/dist/src/utils/client-utils.d.ts +5 -5
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/client-utils.js +10 -10
- package/dist/src/utils/client-utils.js.map +1 -1
- package/dist/src/utils/cross-language-def.d.ts.map +1 -1
- package/dist/src/utils/cross-language-def.js +3 -3
- package/dist/src/utils/cross-language-def.js.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/imports-util.d.ts.map +1 -0
- package/dist/src/{rlc-common/helpers → utils}/imports-util.js +6 -6
- package/dist/src/utils/imports-util.js.map +1 -0
- package/dist/src/utils/interfaces.d.ts +3 -4
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/model-utils.d.ts +1 -1
- package/dist/src/utils/model-utils.d.ts.map +1 -1
- package/dist/src/utils/model-utils.js +4 -2
- package/dist/src/utils/model-utils.js.map +1 -1
- package/dist/src/{rlc-common/helpers → utils}/name-constructors.d.ts +2 -2
- package/dist/src/utils/name-constructors.d.ts.map +1 -0
- package/dist/src/utils/name-constructors.js.map +1 -0
- package/dist/src/utils/name-utils.d.ts.map +1 -0
- package/dist/src/utils/name-utils.js.map +1 -0
- package/dist/src/utils/namespace-utils.js +4 -4
- package/dist/src/utils/namespace-utils.js.map +1 -1
- package/dist/src/utils/operation-helpers.d.ts +16 -0
- package/dist/src/utils/operation-helpers.d.ts.map +1 -0
- package/dist/src/utils/operation-helpers.js.map +1 -0
- package/dist/src/utils/operation-util.d.ts +2 -2
- package/dist/src/utils/operation-util.d.ts.map +1 -1
- package/dist/src/utils/operation-util.js +17 -18
- package/dist/src/utils/operation-util.js.map +1 -1
- package/dist/src/utils/parameter-utils.d.ts +1 -1
- package/dist/src/utils/parameter-utils.d.ts.map +1 -1
- package/dist/src/utils/parameter-utils.js +2 -4
- package/dist/src/utils/parameter-utils.js.map +1 -1
- package/dist/src/{rlc-common/helpers → utils}/schema-helpers.d.ts +2 -2
- package/dist/src/utils/schema-helpers.d.ts.map +1 -0
- package/dist/src/utils/schema-helpers.js.map +1 -0
- package/dist/src/utils/type-util.d.ts.map +1 -0
- package/dist/src/utils/type-util.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -24
- package/src/context-manager.ts +25 -2
- package/src/framework/declaration.ts +8 -20
- package/src/framework/hooks/sdk-types.ts +15 -1
- package/src/framework/source-file-batch.ts +140 -0
- package/src/index.ts +92 -103
- package/src/{rlc-common/interfaces.ts → interfaces.ts} +14 -16
- package/src/lib.ts +3 -16
- package/src/meta-tree.ts +4 -4
- package/src/{rlc-common/metadata → metadata}/build-api-extractor-config.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-changelog-file.ts +3 -3
- package/src/{rlc-common/metadata → metadata}/build-es-lint-config.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-package-file.ts +6 -6
- package/src/{rlc-common/metadata → metadata}/build-readme-file.ts +25 -99
- package/src/{rlc-common/metadata → metadata}/build-sample-env-file.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-test-config.ts +4 -4
- package/src/{rlc-common/metadata → metadata}/build-ts-config.ts +3 -3
- package/src/{rlc-common/metadata → metadata}/build-vitest-config.ts +2 -2
- package/src/{rlc-common/metadata → metadata}/build-warp-config.ts +2 -2
- package/src/metadata/render-template.ts +202 -0
- package/src/metadata/test/build-recorded-client.ts +9 -0
- package/src/metadata/test/build-sample-test.ts +9 -0
- package/src/{rlc-common → metadata}/test/build-snippets.ts +5 -7
- package/src/metadata/test/template.ts +101 -0
- package/src/{rlc-common/metadata → metadata}/utils.ts +2 -2
- package/src/modular/build-classical-client.ts +9 -9
- package/src/modular/build-classical-operation-groups.ts +3 -3
- package/src/modular/build-client-context.ts +7 -7
- package/src/modular/build-modular-options.ts +3 -3
- package/src/modular/build-operations.ts +6 -6
- package/src/modular/build-project-files.ts +4 -5
- package/src/modular/build-restore-poller.ts +3 -3
- package/src/modular/build-root-index.ts +57 -19
- package/src/modular/build-subpath-index.ts +26 -5
- package/src/modular/emit-models-options.ts +3 -3
- package/src/modular/emit-models.ts +32 -26
- package/src/modular/emit-samples.ts +5 -5
- package/src/modular/emit-tests.ts +1 -1
- package/src/modular/helpers/classical-operation-helpers.ts +11 -11
- package/src/modular/helpers/client-helpers.ts +3 -3
- package/src/modular/helpers/example-value-helpers.ts +2 -2
- package/src/modular/helpers/naming-helpers.ts +2 -2
- package/src/modular/helpers/operation-helpers.ts +27 -27
- package/src/modular/helpers/type-helpers.ts +1 -1
- package/src/modular/interfaces.ts +4 -4
- package/src/modular/serialization/build-deserializer-function.ts +2 -2
- package/src/modular/serialization/build-serializer-function.ts +2 -2
- package/src/modular/serialization/build-xml-serializer-function.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +1 -1
- package/src/modular/type-expressions/get-nullable-expression.ts +1 -1
- package/src/modular/type-expressions/get-type-expression.ts +3 -3
- package/src/transform/transform-api-version-info.ts +4 -10
- package/src/transform/{transfrom-rlc-options.ts → transform-client-options.ts} +12 -22
- package/src/transform/transform-helper-function-details.ts +5 -5
- package/src/transform/transform-parameters.ts +12 -12
- package/src/transform/transform-paths.ts +5 -12
- package/src/transform/transform-responses.ts +19 -19
- package/src/transform/transform-schemas.ts +5 -5
- package/src/transform/transform-telemetry-info.ts +3 -3
- package/src/transform/transform.ts +13 -18
- package/src/utils/client-utils.ts +11 -11
- package/src/utils/cross-language-def.ts +3 -3
- package/src/utils/emit-util.ts +3 -3
- package/src/{rlc-common/helpers → utils}/imports-util.ts +6 -6
- package/src/utils/interfaces.ts +3 -4
- package/src/utils/model-utils.ts +7 -8
- package/src/{rlc-common/helpers → utils}/name-constructors.ts +2 -2
- package/src/utils/namespace-utils.ts +4 -4
- package/src/{rlc-common/helpers → utils}/operation-helpers.ts +12 -12
- package/src/utils/operation-util.ts +19 -33
- package/src/utils/parameter-utils.ts +2 -4
- package/src/{rlc-common/helpers → utils}/schema-helpers.ts +2 -2
- package/dist/src/rlc-common/helpers/api-version-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/api-version-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/imports-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/imports-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/name-constructors.js.map +0 -1
- package/dist/src/rlc-common/helpers/name-utils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/name-utils.js.map +0 -1
- package/dist/src/rlc-common/helpers/operation-helpers.d.ts +0 -16
- package/dist/src/rlc-common/helpers/operation-helpers.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/operation-helpers.js.map +0 -1
- package/dist/src/rlc-common/helpers/schema-helpers.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/schema-helpers.js.map +0 -1
- package/dist/src/rlc-common/helpers/type-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/type-util.js.map +0 -1
- package/dist/src/rlc-common/index.d.ts +0 -23
- package/dist/src/rlc-common/index.d.ts.map +0 -1
- package/dist/src/rlc-common/index.js +0 -25
- package/dist/src/rlc-common/index.js.map +0 -1
- package/dist/src/rlc-common/interfaces.d.ts.map +0 -1
- package/dist/src/rlc-common/interfaces.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-changelog-file.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-changelog-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-changelog-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-license-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-license-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-package-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +0 -11
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-test-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-vitest-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-vitest-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-vitest-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-warp-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.js.map +0 -1
- package/dist/src/rlc-common/metadata/utils.d.ts +0 -3
- package/dist/src/rlc-common/metadata/utils.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/utils.js.map +0 -1
- package/dist/src/rlc-common/static/paginate-content.d.ts +0 -2
- package/dist/src/rlc-common/static/paginate-content.d.ts.map +0 -1
- package/dist/src/rlc-common/static/paginate-content.js +0 -345
- package/dist/src/rlc-common/static/paginate-content.js.map +0 -1
- package/dist/src/rlc-common/static/polling-content.d.ts +0 -2
- package/dist/src/rlc-common/static/polling-content.d.ts.map +0 -1
- package/dist/src/rlc-common/static/polling-content.js +0 -225
- package/dist/src/rlc-common/static/polling-content.js.map +0 -1
- package/dist/src/rlc-common/static/sample-template.d.ts +0 -2
- package/dist/src/rlc-common/static/sample-template.d.ts.map +0 -1
- package/dist/src/rlc-common/static/sample-template.js +0 -56
- package/dist/src/rlc-common/static/sample-template.js.map +0 -1
- package/dist/src/rlc-common/static/serialize-helper.d.ts +0 -6
- package/dist/src/rlc-common/static/serialize-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/static/serialize-helper.js +0 -31
- package/dist/src/rlc-common/static/serialize-helper.js.map +0 -1
- package/dist/src/rlc-common/test/build-karma-config.d.ts +0 -6
- package/dist/src/rlc-common/test/build-karma-config.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-karma-config.js +0 -11
- package/dist/src/rlc-common/test/build-karma-config.js.map +0 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts +0 -6
- package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-recorded-client.js +0 -14
- package/dist/src/rlc-common/test/build-recorded-client.js.map +0 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts +0 -6
- package/dist/src/rlc-common/test/build-sample-test.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-sample-test.js +0 -11
- package/dist/src/rlc-common/test/build-sample-test.js.map +0 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts +0 -6
- package/dist/src/rlc-common/test/build-snippets.d.ts.map +0 -1
- package/dist/src/rlc-common/test/build-snippets.js.map +0 -1
- package/dist/src/rlc-common/test/template.d.ts +0 -5
- package/dist/src/rlc-common/test/template.d.ts.map +0 -1
- package/dist/src/rlc-common/test/template.js +0 -227
- package/dist/src/rlc-common/test/template.js.map +0 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +0 -1
- package/dist/src/transform/transfrom-rlc-options.js.map +0 -1
- package/src/rlc-common/index.ts +0 -25
- package/src/rlc-common/static/paginate-content.ts +0 -345
- package/src/rlc-common/static/polling-content.ts +0 -225
- package/src/rlc-common/static/sample-template.ts +0 -56
- package/src/rlc-common/static/serialize-helper.ts +0 -34
- package/src/rlc-common/test/build-karma-config.ts +0 -12
- package/src/rlc-common/test/build-recorded-client.ts +0 -15
- package/src/rlc-common/test/build-sample-test.ts +0 -12
- package/src/rlc-common/test/template.ts +0 -229
- /package/dist/src/{rlc-common/interfaces.js → interfaces.js} +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-api-extractor-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-changelog-file.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-es-lint-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-sample-env-file.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-test-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-vitest-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.d.ts +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.js +0 -0
- /package/dist/src/{rlc-common/metadata → metadata}/utils.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/api-version-util.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/api-version-util.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/imports-util.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/name-constructors.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/name-utils.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/name-utils.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/operation-helpers.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/schema-helpers.js +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/type-util.d.ts +0 -0
- /package/dist/src/{rlc-common/helpers → utils}/type-util.js +0 -0
- /package/src/{rlc-common/metadata → metadata}/build-license-file.ts +0 -0
- /package/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.ts +0 -0
- /package/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.ts +0 -0
- /package/src/{rlc-common/metadata → metadata}/package-json/package-common.ts +0 -0
- /package/src/{rlc-common/helpers → utils}/api-version-util.ts +0 -0
- /package/src/{rlc-common/helpers → utils}/name-utils.ts +0 -0
- /package/src/{rlc-common/helpers → utils}/type-util.ts +0 -0
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
resolvePath,
|
|
11
11
|
type CompilerHost,
|
|
12
12
|
} from "@typespec/compiler";
|
|
13
|
-
import { provideContext, useContext } from "./context-manager.js";
|
|
13
|
+
import { clearContexts, provideContext, useContext } from "./context-manager.js";
|
|
14
14
|
import { buildRootIndex, buildSubClientIndexFile } from "./modular/build-root-index.js";
|
|
15
15
|
import {
|
|
16
16
|
AzureCoreDependencies,
|
|
@@ -31,37 +31,6 @@ import {
|
|
|
31
31
|
UrlTemplateHelpers,
|
|
32
32
|
XmlHelpers,
|
|
33
33
|
} from "./modular/static-helpers-metadata.js";
|
|
34
|
-
import {
|
|
35
|
-
RLCModel,
|
|
36
|
-
RLCOptions,
|
|
37
|
-
buildApiExtractorConfig,
|
|
38
|
-
buildChangelogFile,
|
|
39
|
-
buildEsLintConfig,
|
|
40
|
-
buildLicenseFile,
|
|
41
|
-
buildPackageFile,
|
|
42
|
-
buildReadmeFile,
|
|
43
|
-
buildRecordedClientFile,
|
|
44
|
-
buildSampleEnvFile,
|
|
45
|
-
buildSampleTest,
|
|
46
|
-
buildSnippets,
|
|
47
|
-
buildTestBrowserTsConfig,
|
|
48
|
-
buildTestNodeTsConfig,
|
|
49
|
-
buildTsConfig,
|
|
50
|
-
buildTsLintConfig,
|
|
51
|
-
buildTsSampleConfig,
|
|
52
|
-
buildTsSnippetsConfig,
|
|
53
|
-
buildTsSrcBrowserConfig,
|
|
54
|
-
buildTsSrcCjsConfig,
|
|
55
|
-
buildTsSrcEsmConfig,
|
|
56
|
-
buildTsSrcReactNativeConfig,
|
|
57
|
-
buildVitestConfig,
|
|
58
|
-
buildWarpConfig,
|
|
59
|
-
getClientName,
|
|
60
|
-
hasClientNameChanged,
|
|
61
|
-
hasUnexpectedHelper,
|
|
62
|
-
updatePackageFile,
|
|
63
|
-
updateReadmeFile,
|
|
64
|
-
} from "./rlc-common/index.js";
|
|
65
34
|
import { emitContentByBuilder } from "./utils/emit-util.js";
|
|
66
35
|
import { clearDirectory, emptyDir, pathExists } from "./utils/file-system-utils.js";
|
|
67
36
|
import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
|
|
@@ -74,9 +43,37 @@ import {
|
|
|
74
43
|
} from "@azure-tools/typespec-client-generator-core";
|
|
75
44
|
import { Project } from "ts-morph";
|
|
76
45
|
import { provideBinder } from "./framework/hooks/binder.js";
|
|
77
|
-
import { provideSdkTypes } from "./framework/hooks/sdk-types.js";
|
|
46
|
+
import { provideSdkTypes, resetSdkTypesState } from "./framework/hooks/sdk-types.js";
|
|
78
47
|
import { loadStaticHelpers } from "./framework/load-static-helpers.js";
|
|
48
|
+
import { ClientModel, ClientOptions } from "./interfaces.js";
|
|
79
49
|
import { EmitterOptions } from "./lib.js";
|
|
50
|
+
import { buildApiExtractorConfig } from "./metadata/build-api-extractor-config.js";
|
|
51
|
+
import { buildChangelogFile } from "./metadata/build-changelog-file.js";
|
|
52
|
+
import { buildEsLintConfig } from "./metadata/build-es-lint-config.js";
|
|
53
|
+
import { buildLicenseFile } from "./metadata/build-license-file.js";
|
|
54
|
+
import { buildPackageFile, updatePackageFile } from "./metadata/build-package-file.js";
|
|
55
|
+
import {
|
|
56
|
+
buildReadmeFile,
|
|
57
|
+
hasClientNameChanged,
|
|
58
|
+
updateReadmeFile,
|
|
59
|
+
} from "./metadata/build-readme-file.js";
|
|
60
|
+
import { buildSampleEnvFile } from "./metadata/build-sample-env-file.js";
|
|
61
|
+
import { buildTestBrowserTsConfig, buildTestNodeTsConfig } from "./metadata/build-test-config.js";
|
|
62
|
+
import {
|
|
63
|
+
buildTsConfig,
|
|
64
|
+
buildTsLintConfig,
|
|
65
|
+
buildTsSampleConfig,
|
|
66
|
+
buildTsSnippetsConfig,
|
|
67
|
+
buildTsSrcBrowserConfig,
|
|
68
|
+
buildTsSrcCjsConfig,
|
|
69
|
+
buildTsSrcEsmConfig,
|
|
70
|
+
buildTsSrcReactNativeConfig,
|
|
71
|
+
} from "./metadata/build-ts-config.js";
|
|
72
|
+
import { buildVitestConfig } from "./metadata/build-vitest-config.js";
|
|
73
|
+
import { buildWarpConfig } from "./metadata/build-warp-config.js";
|
|
74
|
+
import { buildRecordedClientFile } from "./metadata/test/build-recorded-client.js";
|
|
75
|
+
import { buildSampleTest } from "./metadata/test/build-sample-test.js";
|
|
76
|
+
import { buildSnippets } from "./metadata/test/build-snippets.js";
|
|
80
77
|
import { buildClassicalClient } from "./modular/build-classical-client.js";
|
|
81
78
|
import { buildClassicOperationFiles } from "./modular/build-classical-operation-groups.js";
|
|
82
79
|
import { buildClientContext, getClientContextPath } from "./modular/build-client-context.js";
|
|
@@ -93,13 +90,9 @@ import { emitTests } from "./modular/emit-tests.js";
|
|
|
93
90
|
import { getClassicalClientName } from "./modular/helpers/naming-helpers.js";
|
|
94
91
|
import { ModularEmitterOptions } from "./modular/interfaces.js";
|
|
95
92
|
import { packageUsesXmlSerialization } from "./modular/serialization/build-xml-serializer-function.js";
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
getClientHierarchyMap,
|
|
100
|
-
getModularClientOptions,
|
|
101
|
-
getRLCClients,
|
|
102
|
-
} from "./utils/client-utils.js";
|
|
93
|
+
import { transformClientOptions } from "./transform/transform-client-options.js";
|
|
94
|
+
import { transformClientModel } from "./transform/transform.js";
|
|
95
|
+
import { getClientHierarchyMap, getClientModuleInfo, getClients } from "./utils/client-utils.js";
|
|
103
96
|
import { generateCrossLanguageDefinitionFile } from "./utils/cross-language-def.js";
|
|
104
97
|
|
|
105
98
|
export * from "./lib.js";
|
|
@@ -128,11 +121,9 @@ export async function $onEmit(context: EmitContext) {
|
|
|
128
121
|
|
|
129
122
|
// Enrich the dpg context with path detail and common options
|
|
130
123
|
await enrichDpgContext();
|
|
131
|
-
const
|
|
124
|
+
const resolvedEmitterOptions = dpgContext.emitterOptions ?? {};
|
|
132
125
|
|
|
133
|
-
|
|
134
|
-
const serviceNameToRlcModelsMap: Map<string, RLCModel> = new Map<string, RLCModel>();
|
|
135
|
-
provideContext("rlcMetaTree", new Map());
|
|
126
|
+
provideContext("clientTypeMetaTree", new Map());
|
|
136
127
|
provideContext("symbolMap", new Map());
|
|
137
128
|
provideContext("outputProject", outputProject);
|
|
138
129
|
provideContext("emitContext", {
|
|
@@ -151,13 +142,13 @@ export async function $onEmit(context: EmitContext) {
|
|
|
151
142
|
...PlatformTypeHelpers,
|
|
152
143
|
...CloudSettingHelpers,
|
|
153
144
|
...XmlHelpers,
|
|
154
|
-
...(
|
|
155
|
-
...(
|
|
145
|
+
...(resolvedEmitterOptions.generateTest ? CreateRecorderHelpers : {}),
|
|
146
|
+
...(resolvedEmitterOptions.enableStorageCompat ? StorageCompatHelpers : {}),
|
|
156
147
|
},
|
|
157
148
|
{
|
|
158
|
-
sourcesDir: dpgContext.generationPathDetail?.
|
|
149
|
+
sourcesDir: dpgContext.generationPathDetail?.sourcesDir,
|
|
159
150
|
rootDir: dpgContext.generationPathDetail?.rootDir,
|
|
160
|
-
options:
|
|
151
|
+
options: resolvedEmitterOptions,
|
|
161
152
|
program,
|
|
162
153
|
host,
|
|
163
154
|
packageRoot: emitterPackageRoot,
|
|
@@ -178,20 +169,16 @@ export async function $onEmit(context: EmitContext) {
|
|
|
178
169
|
});
|
|
179
170
|
provideSdkTypes(dpgContext);
|
|
180
171
|
|
|
181
|
-
const rlcCodeModels: RLCModel[] = [];
|
|
182
172
|
let modularEmitterOptions: ModularEmitterOptions;
|
|
183
173
|
// 1. Clear sources folder
|
|
184
174
|
await clearSrcFolder();
|
|
185
|
-
// 2.
|
|
186
|
-
// TODO: skip this step in modular once modular generator is sufficiently decoupled
|
|
187
|
-
await buildRLCCodeModels();
|
|
188
|
-
// 3. Clear samples-dev folder if generateSample is true
|
|
175
|
+
// 2. Clear samples-dev folder if generateSample is true
|
|
189
176
|
await clearSamplesDevFolder();
|
|
190
177
|
|
|
191
|
-
//
|
|
192
|
-
await
|
|
178
|
+
// 3. Generate sources
|
|
179
|
+
await generateSources();
|
|
193
180
|
|
|
194
|
-
//
|
|
181
|
+
// 4. Generate metadata and test files
|
|
195
182
|
function getTypespecTsVersion(context: EmitContext): string | undefined {
|
|
196
183
|
const emitterMetadata = context.program.emitters.find(
|
|
197
184
|
(emitter) => emitter.metadata.name === "@azure-tools/typespec-ts",
|
|
@@ -201,11 +188,20 @@ export async function $onEmit(context: EmitContext) {
|
|
|
201
188
|
|
|
202
189
|
await generateMetadataAndTest(dpgContext);
|
|
203
190
|
|
|
191
|
+
// Release the emitter's process-wide singleton state now that this emit has
|
|
192
|
+
// finished writing output. Without this, the context manager keeps the whole
|
|
193
|
+
// previous program graph (compiler `EmitContext`/`Program`, TCGC `SdkContext`,
|
|
194
|
+
// ts-morph `Project`, binder, …) reachable until the next emit overwrites it.
|
|
195
|
+
// Clearing here lets it be collected between emits, which matters for hosts
|
|
196
|
+
// that run many emits in one process (test suites, benchmarks, watch mode).
|
|
197
|
+
clearContexts();
|
|
198
|
+
resetSdkTypesState();
|
|
199
|
+
|
|
204
200
|
async function enrichDpgContext() {
|
|
205
201
|
const generationPathDetail: GenerationDirDetail = await calculateGenerationDir();
|
|
206
202
|
dpgContext.generationPathDetail = generationPathDetail;
|
|
207
203
|
dpgContext.allServiceNamespaces = listAllServiceNamespaces(dpgContext);
|
|
208
|
-
const options:
|
|
204
|
+
const options: ClientOptions = transformClientOptions(emitterOptions, dpgContext);
|
|
209
205
|
emitterOptions["generate-sample"] = options.generateSample;
|
|
210
206
|
// clear output folder if needed
|
|
211
207
|
if (options.clearOutputFolder) {
|
|
@@ -219,7 +215,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
219
215
|
options.generateTest =
|
|
220
216
|
options.generateTest === true ||
|
|
221
217
|
(options.generateTest === undefined && (!hasTestFolder || options.azureArm));
|
|
222
|
-
dpgContext.
|
|
218
|
+
dpgContext.emitterOptions = options;
|
|
223
219
|
}
|
|
224
220
|
|
|
225
221
|
async function calculateGenerationDir(): Promise<GenerationDirDetail> {
|
|
@@ -236,18 +232,12 @@ export async function $onEmit(context: EmitContext) {
|
|
|
236
232
|
return {
|
|
237
233
|
rootDir: projectRoot,
|
|
238
234
|
metadataDir: projectRoot,
|
|
239
|
-
|
|
240
|
-
modularSourcesDir: sourcesRoot,
|
|
235
|
+
sourcesDir: sourcesRoot,
|
|
241
236
|
};
|
|
242
237
|
}
|
|
243
238
|
|
|
244
239
|
async function clearSrcFolder() {
|
|
245
|
-
await emptyDir(
|
|
246
|
-
host,
|
|
247
|
-
dpgContext.generationPathDetail?.modularSourcesDir ??
|
|
248
|
-
dpgContext.generationPathDetail?.rlcSourcesDir ??
|
|
249
|
-
"",
|
|
250
|
-
);
|
|
240
|
+
await emptyDir(host, dpgContext.generationPathDetail?.sourcesDir ?? "");
|
|
251
241
|
}
|
|
252
242
|
|
|
253
243
|
async function clearSamplesDevFolder() {
|
|
@@ -262,32 +252,30 @@ export async function $onEmit(context: EmitContext) {
|
|
|
262
252
|
}
|
|
263
253
|
}
|
|
264
254
|
|
|
265
|
-
async function
|
|
266
|
-
const
|
|
255
|
+
async function buildClientCodeModels(): Promise<ClientModel[]> {
|
|
256
|
+
const models: ClientModel[] = [];
|
|
257
|
+
const clients = getClients(dpgContext);
|
|
267
258
|
for (const client of clients) {
|
|
268
|
-
|
|
269
|
-
rlcCodeModels.push(rlcModels);
|
|
270
|
-
const serviceName = client.services[0]?.name ?? "Unknown";
|
|
271
|
-
serviceNameToRlcModelsMap.set(serviceName, rlcModels);
|
|
272
|
-
needUnexpectedHelper.set(getClientName(rlcModels), hasUnexpectedHelper(rlcModels));
|
|
259
|
+
models.push(await transformClientModel(client, dpgContext));
|
|
273
260
|
}
|
|
261
|
+
return models;
|
|
274
262
|
}
|
|
275
263
|
|
|
276
|
-
async function
|
|
277
|
-
const
|
|
264
|
+
async function generateSources() {
|
|
265
|
+
const sourcesRoot = dpgContext.generationPathDetail?.sourcesDir ?? "src";
|
|
278
266
|
const project = useContext("outputProject");
|
|
279
|
-
modularEmitterOptions = transformModularEmitterOptions(dpgContext,
|
|
267
|
+
modularEmitterOptions = transformModularEmitterOptions(dpgContext, sourcesRoot, {
|
|
280
268
|
casing: "camel",
|
|
281
269
|
});
|
|
282
270
|
|
|
283
|
-
emitLoggerFile(modularEmitterOptions,
|
|
271
|
+
emitLoggerFile(modularEmitterOptions, sourcesRoot);
|
|
284
272
|
|
|
285
|
-
const rootIndexFile = project.createSourceFile(`${
|
|
273
|
+
const rootIndexFile = project.createSourceFile(`${sourcesRoot}/index.ts`, "", {
|
|
286
274
|
overwrite: true,
|
|
287
275
|
});
|
|
288
276
|
|
|
289
|
-
emitTypes(dpgContext, { sourceRoot:
|
|
290
|
-
emitNonModelResponseTypes(dpgContext, { sourceRoot:
|
|
277
|
+
emitTypes(dpgContext, { sourceRoot: sourcesRoot });
|
|
278
|
+
emitNonModelResponseTypes(dpgContext, { sourceRoot: sourcesRoot });
|
|
291
279
|
buildSubpathIndexFile(modularEmitterOptions, "models", undefined, {
|
|
292
280
|
recursive: true,
|
|
293
281
|
});
|
|
@@ -302,7 +290,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
302
290
|
buildOperationFiles(dpgContext, subClient, modularEmitterOptions);
|
|
303
291
|
buildClientContext(dpgContext, subClient, modularEmitterOptions);
|
|
304
292
|
buildRestorePoller(dpgContext, subClient, modularEmitterOptions);
|
|
305
|
-
if (dpgContext.
|
|
293
|
+
if (dpgContext.emitterOptions?.hierarchyClient) {
|
|
306
294
|
buildSubpathIndexFile(modularEmitterOptions, "api", subClient, {
|
|
307
295
|
exportIndex: false,
|
|
308
296
|
recursive: true,
|
|
@@ -320,24 +308,24 @@ export async function $onEmit(context: EmitContext) {
|
|
|
320
308
|
exportIndex: true,
|
|
321
309
|
interfaceOnly: true,
|
|
322
310
|
});
|
|
323
|
-
const { subfolder } =
|
|
311
|
+
const { subfolder } = getClientModuleInfo(subClient);
|
|
324
312
|
// Generate index file for clients with subfolders (multi-client scenarios and nested clients)
|
|
325
313
|
if (subfolder) {
|
|
326
314
|
buildSubClientIndexFile(dpgContext, subClient, modularEmitterOptions);
|
|
327
315
|
}
|
|
328
316
|
buildRootIndex(dpgContext, modularEmitterOptions, rootIndexFile, subClient);
|
|
329
317
|
}
|
|
330
|
-
//
|
|
318
|
+
// Sample generation is enabled only when the modular generator actually emits
|
|
319
|
+
// samples. Reset the baseline here, then re-enable it below if any are emitted.
|
|
320
|
+
dpgContext.emitterOptions!.generateSample = false;
|
|
331
321
|
if (emitterOptions["generate-sample"] === true) {
|
|
332
322
|
const samples = emitSamples(dpgContext);
|
|
333
|
-
// Refine the rlc sample generation logic
|
|
334
|
-
// TODO: remember to remove this out when RLC is splitted from Modular
|
|
335
323
|
if (samples.length > 0) {
|
|
336
|
-
dpgContext.
|
|
324
|
+
dpgContext.emitterOptions!.generateSample = true;
|
|
337
325
|
}
|
|
338
326
|
}
|
|
339
327
|
|
|
340
|
-
binder.resolveAllReferences(
|
|
328
|
+
binder.resolveAllReferences(sourcesRoot, dpgContext.generationPathDetail?.rootDir);
|
|
341
329
|
if (program.compilerOptions.noEmit || program.hasError()) {
|
|
342
330
|
return;
|
|
343
331
|
}
|
|
@@ -382,17 +370,18 @@ export async function $onEmit(context: EmitContext) {
|
|
|
382
370
|
|
|
383
371
|
async function generateMetadataAndTest(context: SdkContext) {
|
|
384
372
|
const project = useContext("outputProject");
|
|
385
|
-
|
|
373
|
+
const clientCodeModels = await buildClientCodeModels();
|
|
374
|
+
if (clientCodeModels.length === 0 || !clientCodeModels[0]) {
|
|
386
375
|
return;
|
|
387
376
|
}
|
|
388
|
-
const
|
|
389
|
-
const option = dpgContext.
|
|
377
|
+
const clientModel: ClientModel = clientCodeModels[0];
|
|
378
|
+
const option = dpgContext.emitterOptions!;
|
|
390
379
|
// When generateMetadata is explicitly false and the sources are generated
|
|
391
380
|
// into a path ending with "generated" (e.g. src/generated), this package
|
|
392
381
|
// has a manual convenience layer. Skip all metadata/test file generation
|
|
393
382
|
// to avoid unexpected modifications to files like package.json, README.md,
|
|
394
383
|
// warp.config.yml, and snippets.spec.ts. metadata.json is still updated.
|
|
395
|
-
const sourcesDir = dpgContext.generationPathDetail?.
|
|
384
|
+
const sourcesDir = dpgContext.generationPathDetail?.sourcesDir ?? "";
|
|
396
385
|
const hasManualConvenienceLayer = getBaseFileName(sourcesDir) === "generated";
|
|
397
386
|
// Generate metadata
|
|
398
387
|
const existingPackageFilePath = joinPaths(
|
|
@@ -426,7 +415,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
426
415
|
|
|
427
416
|
//TODO Need consider multi-client cases
|
|
428
417
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
429
|
-
|
|
418
|
+
clientModel.libraryName = subClient.name;
|
|
430
419
|
}
|
|
431
420
|
|
|
432
421
|
if (shouldGenerateMetadata) {
|
|
@@ -496,7 +485,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
496
485
|
await emitContentByBuilder(
|
|
497
486
|
program,
|
|
498
487
|
commonBuilders,
|
|
499
|
-
|
|
488
|
+
clientModel,
|
|
500
489
|
dpgContext.generationPathDetail?.metadataDir,
|
|
501
490
|
);
|
|
502
491
|
|
|
@@ -525,8 +514,8 @@ export async function $onEmit(context: EmitContext) {
|
|
|
525
514
|
}),
|
|
526
515
|
};
|
|
527
516
|
|
|
528
|
-
// Always update package.json (adds #platform/* imports)
|
|
529
|
-
//
|
|
517
|
+
// Always update package.json (adds #platform/* imports) along with
|
|
518
|
+
// exports, clientContextPaths and LRO deps.
|
|
530
519
|
{
|
|
531
520
|
// Read package.json content via host and pass parsed object
|
|
532
521
|
const pkgSourceFile = await host.readFile(existingPackageFilePath);
|
|
@@ -536,30 +525,30 @@ export async function $onEmit(context: EmitContext) {
|
|
|
536
525
|
} catch {
|
|
537
526
|
packageInfo = {};
|
|
538
527
|
}
|
|
539
|
-
updateBuilders.push((model:
|
|
528
|
+
updateBuilders.push((model: ClientModel) =>
|
|
540
529
|
updatePackageFile(model, packageInfo, modularPackageInfo),
|
|
541
530
|
);
|
|
542
531
|
}
|
|
543
532
|
|
|
544
533
|
// Update warp.config.yml for Azure monorepo packages
|
|
545
|
-
updateBuilders.push((model:
|
|
534
|
+
updateBuilders.push((model: ClientModel) => buildWarpConfig(model, modularPackageInfo));
|
|
546
535
|
|
|
547
536
|
// If the client name changed, regenerate the README and snippets completely;
|
|
548
537
|
// otherwise update only the API reference link in-place.
|
|
549
538
|
if (hasReadmeFile) {
|
|
550
539
|
const readmeSourceFile = await host.readFile(existingReadmeFilePath);
|
|
551
540
|
const existingReadmeContent = readmeSourceFile.text;
|
|
552
|
-
const clientNameChanged = hasClientNameChanged(
|
|
541
|
+
const clientNameChanged = hasClientNameChanged(clientModel, existingReadmeContent);
|
|
553
542
|
updateBuilders.push(
|
|
554
543
|
clientNameChanged
|
|
555
544
|
? buildReadmeFile
|
|
556
|
-
: (model:
|
|
545
|
+
: (model: ClientModel) => updateReadmeFile(model, existingReadmeContent),
|
|
557
546
|
);
|
|
558
547
|
|
|
559
548
|
// Regenerate snippets.spec.ts only when the client name changed
|
|
560
549
|
if (clientNameChanged) {
|
|
561
550
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
562
|
-
updateBuilders.push((model:
|
|
551
|
+
updateBuilders.push((model: ClientModel) =>
|
|
563
552
|
buildSnippets(model, getClassicalClientName(subClient)),
|
|
564
553
|
);
|
|
565
554
|
}
|
|
@@ -570,14 +559,14 @@ export async function $onEmit(context: EmitContext) {
|
|
|
570
559
|
await emitContentByBuilder(
|
|
571
560
|
program,
|
|
572
561
|
updateBuilders,
|
|
573
|
-
|
|
562
|
+
clientModel,
|
|
574
563
|
dpgContext.generationPathDetail?.metadataDir,
|
|
575
564
|
);
|
|
576
565
|
}
|
|
577
566
|
await emitContentByBuilder(
|
|
578
567
|
program,
|
|
579
568
|
buildMetadataJson,
|
|
580
|
-
|
|
569
|
+
clientModel,
|
|
581
570
|
dpgContext.generationPathDetail?.metadataDir,
|
|
582
571
|
);
|
|
583
572
|
|
|
@@ -586,7 +575,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
586
575
|
await emitContentByBuilder(
|
|
587
576
|
program,
|
|
588
577
|
[buildRecordedClientFile, buildSampleTest],
|
|
589
|
-
|
|
578
|
+
clientModel,
|
|
590
579
|
dpgContext.generationPathDetail?.metadataDir,
|
|
591
580
|
);
|
|
592
581
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
export interface
|
|
3
|
+
export interface ClientModel {
|
|
4
4
|
libraryName: string;
|
|
5
5
|
srcPath: string;
|
|
6
6
|
paths: Paths;
|
|
7
7
|
importInfo: ImportInfo;
|
|
8
|
-
options?:
|
|
8
|
+
options?: ClientOptions;
|
|
9
9
|
schemas: Schema[];
|
|
10
10
|
apiVersionInfo?: ApiVersionInfo;
|
|
11
11
|
parameters?: OperationParameter[];
|
|
@@ -13,8 +13,8 @@ export interface RLCModel {
|
|
|
13
13
|
helperDetails?: HelperFunctionDetails;
|
|
14
14
|
urlInfo?: UrlInfo;
|
|
15
15
|
telemetryOptions?: TelemetryInfo;
|
|
16
|
-
sampleGroups?:
|
|
17
|
-
|
|
16
|
+
sampleGroups?: SampleGroup[];
|
|
17
|
+
sourceDir?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface ImportInfo {
|
|
@@ -28,10 +28,10 @@ export type ImportType =
|
|
|
28
28
|
/**inner models' imports for parameter and response */
|
|
29
29
|
| "parameter"
|
|
30
30
|
| "response"
|
|
31
|
-
| "
|
|
31
|
+
| "index"
|
|
32
32
|
| "modularModel"
|
|
33
|
-
| "
|
|
34
|
-
| "
|
|
33
|
+
| "clientFactory"
|
|
34
|
+
| "clientDefinition"
|
|
35
35
|
/**common third party imports */
|
|
36
36
|
| "restClient"
|
|
37
37
|
| "coreAuth"
|
|
@@ -60,18 +60,18 @@ export interface ImportMetadata {
|
|
|
60
60
|
/**
|
|
61
61
|
* A group of samples in operation_id level and they are used to generate in a sample file
|
|
62
62
|
*/
|
|
63
|
-
export interface
|
|
63
|
+
export interface SampleGroup {
|
|
64
64
|
filename: string;
|
|
65
65
|
clientPackageName: string;
|
|
66
66
|
defaultFactoryName: string;
|
|
67
|
-
samples:
|
|
67
|
+
samples: SampleDetail[];
|
|
68
68
|
importedTypes?: string[];
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* An independent sample detail and it will be wrapped as a func
|
|
73
73
|
*/
|
|
74
|
-
export interface
|
|
74
|
+
export interface SampleDetail {
|
|
75
75
|
/**
|
|
76
76
|
* metadata for comments
|
|
77
77
|
*/
|
|
@@ -190,7 +190,7 @@ export interface OperationLroDetail {
|
|
|
190
190
|
precedence?: number;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
export interface
|
|
193
|
+
export interface ClientOptions {
|
|
194
194
|
/**
|
|
195
195
|
* Whether to include response headers in the generated response types. If true, the generated response types will include headers as properties.
|
|
196
196
|
*/
|
|
@@ -223,7 +223,6 @@ export interface RLCOptions {
|
|
|
223
223
|
generateTest?: boolean;
|
|
224
224
|
generateSample?: boolean;
|
|
225
225
|
azureOutputDirectory?: string;
|
|
226
|
-
isTypeSpecTest?: boolean;
|
|
227
226
|
serviceInfo?: ServiceInfo;
|
|
228
227
|
azureArm?: boolean;
|
|
229
228
|
enableOperationGroup?: boolean;
|
|
@@ -234,7 +233,6 @@ export interface RLCOptions {
|
|
|
234
233
|
clearOutputFolder?: boolean;
|
|
235
234
|
ignorePropertyNameNormalize?: boolean;
|
|
236
235
|
ignoreEnumMemberNameNormalize?: boolean;
|
|
237
|
-
compatibilityQueryMultiFormat?: boolean;
|
|
238
236
|
typespecTitleMap?: Record<string, string>;
|
|
239
237
|
hasSubscriptionId?: boolean;
|
|
240
238
|
compatibilityLro?: boolean;
|
|
@@ -357,8 +355,8 @@ export interface ParameterMetadatas {
|
|
|
357
355
|
export interface ParameterBodyMetadata {
|
|
358
356
|
/**
|
|
359
357
|
* In case of formData we'd get multiple properties in body marked as partialBody
|
|
360
|
-
* If yes,
|
|
361
|
-
* usually false in typespec source because
|
|
358
|
+
* If yes, the emitter would prepare the whole part shape;
|
|
359
|
+
* usually false in typespec source because the emitter doesn't have to prepare the whole part shape
|
|
362
360
|
*/
|
|
363
361
|
isPartialBody?: boolean;
|
|
364
362
|
body?: ParameterBodySchema[];
|
|
@@ -398,7 +396,7 @@ export type ResponseHeaderSchema = Schema;
|
|
|
398
396
|
export type ResponseBodySchema = Schema;
|
|
399
397
|
|
|
400
398
|
export type ContentBuilder = {
|
|
401
|
-
(model:
|
|
399
|
+
(model: ClientModel): File | File[] | undefined;
|
|
402
400
|
};
|
|
403
401
|
|
|
404
402
|
export type SampleParameterPosition = "client" | "path" | "method";
|
package/src/lib.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { createTypeSpecLibrary, JSONSchemaType, paramMessage } from "@typespec/compiler";
|
|
5
5
|
import { Options } from "prettier";
|
|
6
|
-
import { PackageDetails } from "./
|
|
6
|
+
import { PackageDetails } from "./interfaces.js";
|
|
7
7
|
|
|
8
8
|
export interface EmitterOptions {
|
|
9
9
|
/**
|
|
@@ -39,7 +39,6 @@ export interface EmitterOptions {
|
|
|
39
39
|
*/
|
|
40
40
|
"generate-test"?: boolean;
|
|
41
41
|
"generate-sample"?: boolean;
|
|
42
|
-
"is-typespec-test"?: boolean;
|
|
43
42
|
"azure-arm"?: boolean;
|
|
44
43
|
"enable-operation-group"?: boolean;
|
|
45
44
|
"enable-model-namespace"?: boolean;
|
|
@@ -49,7 +48,6 @@ export interface EmitterOptions {
|
|
|
49
48
|
"experimental-extensible-enums"?: boolean;
|
|
50
49
|
"clear-output-folder"?: boolean;
|
|
51
50
|
"ignore-property-name-normalize"?: boolean;
|
|
52
|
-
"compatibility-query-multi-format"?: boolean;
|
|
53
51
|
"typespec-title-map"?: Record<string, string>;
|
|
54
52
|
"ignore-enum-member-name-normalize"?: boolean;
|
|
55
53
|
//TODO should remove this after finish the release tool test
|
|
@@ -82,7 +80,7 @@ export interface EmitterOptions {
|
|
|
82
80
|
"generate-react-native-target"?: boolean;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
export const
|
|
83
|
+
export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
86
84
|
type: "object",
|
|
87
85
|
additionalProperties: true,
|
|
88
86
|
properties: {
|
|
@@ -171,11 +169,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
171
169
|
description:
|
|
172
170
|
"Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.",
|
|
173
171
|
},
|
|
174
|
-
"is-typespec-test": {
|
|
175
|
-
type: "boolean",
|
|
176
|
-
nullable: true,
|
|
177
|
-
description: "Internal option for test",
|
|
178
|
-
},
|
|
179
172
|
"azure-arm": {
|
|
180
173
|
type: "boolean",
|
|
181
174
|
nullable: true,
|
|
@@ -234,12 +227,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
234
227
|
description:
|
|
235
228
|
"The emitter has a normalization logic for enum member key, to ignore this normalization, you can set this option to true",
|
|
236
229
|
},
|
|
237
|
-
"compatibility-query-multi-format": {
|
|
238
|
-
type: "boolean",
|
|
239
|
-
nullable: true,
|
|
240
|
-
description:
|
|
241
|
-
"Whether to generate the backward-compatible code for query parameter serialization for array types in RLC. Defaults to `false`",
|
|
242
|
-
},
|
|
243
230
|
"typespec-title-map": {
|
|
244
231
|
type: "object",
|
|
245
232
|
additionalProperties: {
|
|
@@ -561,7 +548,7 @@ const libDef = {
|
|
|
561
548
|
},
|
|
562
549
|
},
|
|
563
550
|
emitter: {
|
|
564
|
-
options:
|
|
551
|
+
options: EmitterOptionsSchema,
|
|
565
552
|
},
|
|
566
553
|
} as const;
|
|
567
554
|
|
package/src/meta-tree.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Type } from "@typespec/compiler";
|
|
2
|
-
import { Schema
|
|
2
|
+
import { Schema } from "./interfaces.js";
|
|
3
3
|
|
|
4
|
-
export interface
|
|
5
|
-
|
|
4
|
+
export interface ClientTypeMetadata {
|
|
5
|
+
clientType: Schema;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type ClientTypeMetaTree = Map<Type, ClientTypeMetadata>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import {
|
|
5
|
+
import { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
|
-
export function buildApiExtractorConfig(_model:
|
|
7
|
+
export function buildApiExtractorConfig(_model: ClientModel) {
|
|
8
8
|
const project = new Project({ useInMemoryFileSystem: true });
|
|
9
9
|
|
|
10
10
|
const config = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ClientModel } from "../interfaces.js";
|
|
5
5
|
|
|
6
|
-
function getPackageVersion(model:
|
|
6
|
+
function getPackageVersion(model: ClientModel): string {
|
|
7
7
|
return model.options?.packageDetails?.version ?? "1.0.0-beta.1";
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function buildChangelogFile(model:
|
|
10
|
+
export function buildChangelogFile(model: ClientModel) {
|
|
11
11
|
const version = getPackageVersion(model);
|
|
12
12
|
const content = `# Release History
|
|
13
13
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { Project } from "ts-morph";
|
|
5
|
-
import {
|
|
5
|
+
import { ClientModel } from "../interfaces.js";
|
|
6
6
|
|
|
7
7
|
const esLintConfigEsmAzureSdk = `import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ export default [
|
|
|
31
31
|
];
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
-
export function buildEsLintConfig(_model:
|
|
34
|
+
export function buildEsLintConfig(_model: ClientModel) {
|
|
35
35
|
const project = new Project({ useInMemoryFileSystem: true });
|
|
36
36
|
const filePath = "eslint.config.mjs";
|
|
37
37
|
|