@azure-tools/typespec-ts 0.56.0-dev.0 → 0.56.0-dev.2
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 -7
- package/dist/src/context-manager.d.ts +2 -2
- package/dist/src/context-manager.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +1 -1
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +63 -60
- package/dist/src/index.js.map +1 -1
- package/dist/src/{rlc-common/interfaces.d.ts → interfaces.d.ts} +12 -13
- package/dist/src/interfaces.d.ts.map +1 -0
- package/dist/src/interfaces.js.map +1 -0
- package/dist/src/lib.d.ts +2 -3
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -7
- 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 +2 -2
- 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/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.js +1 -1
- 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/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.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.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 +1 -1
- package/dist/src/metadata/test/build-snippets.js.map +1 -0
- package/dist/src/metadata/test/template.d.ts.map +1 -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 +5 -5
- package/dist/src/modular/build-root-index.js.map +1 -1
- package/dist/src/modular/build-subpath-index.js +2 -2
- 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 +8 -8
- 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 +17 -17
- 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 -11
- 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 +2 -2
- package/src/context-manager.ts +2 -2
- package/src/framework/hooks/sdk-types.ts +1 -1
- package/src/index.ts +81 -101
- package/src/{rlc-common/interfaces.ts → interfaces.ts} +14 -15
- package/src/lib.ts +3 -10
- 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 +8 -8
- 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/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.ts +1 -1
- package/src/{rlc-common → metadata}/test/build-recorded-client.ts +2 -2
- package/src/{rlc-common → metadata}/test/build-sample-test.ts +2 -2
- package/src/{rlc-common → metadata}/test/build-snippets.ts +3 -3
- 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 +5 -5
- package/src/modular/build-subpath-index.ts +2 -2
- package/src/modular/emit-models-options.ts +3 -3
- package/src/modular/emit-models.ts +8 -8
- 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 +17 -17
- 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 -20
- 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.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.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.map +0 -1
- 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/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/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}/test/build-recorded-client.js +0 -0
- /package/dist/src/{rlc-common → metadata}/test/build-sample-test.js +0 -0
- /package/dist/src/{rlc-common → metadata}/test/template.d.ts +0 -0
- /package/dist/src/{rlc-common → metadata}/test/template.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/package-common.ts +0 -0
- /package/src/{rlc-common → metadata}/test/template.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.56.0-dev.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.56.0-dev.2",
|
|
4
|
+
"description": "A TypeSpec emitter for TypeScript",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
package/src/context-manager.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Project, SourceFile } from "ts-morph";
|
|
|
4
4
|
import { ExternalDependencies } from "./framework/dependency.js";
|
|
5
5
|
import { Binder } from "./framework/hooks/binder.js";
|
|
6
6
|
import { SdkTypeContext } from "./framework/hooks/sdk-types.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ClientTypeMetaTree } from "./meta-tree.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Contexts Object Guidelines
|
|
@@ -20,7 +20,7 @@ import { RlcMetaTree } from "./meta-tree.js";
|
|
|
20
20
|
* Remember, adding too many contexts can lead to complex dependencies and harder-to-maintain code. Always evaluate if the context is truly necessary or if there are better alternatives such as localized state management or passing props for simpler scenarios.
|
|
21
21
|
*/
|
|
22
22
|
type Contexts = {
|
|
23
|
-
|
|
23
|
+
clientTypeMetaTree: ClientTypeMetaTree; // Context for client type metadata.
|
|
24
24
|
outputProject: Project; // The TS-Morph root project context for code generation.
|
|
25
25
|
symbolMap: Map<string, SourceFile>; // Mapping of symbols to their corresponding source files.
|
|
26
26
|
sdkTypes: SdkTypeContext;
|
|
@@ -14,8 +14,8 @@ import { reportDiagnostic } from "../../lib.js";
|
|
|
14
14
|
import { visitPackageTypes } from "../../modular/emit-models.js";
|
|
15
15
|
import { getAllAncestors, getAllProperties } from "../../modular/helpers/operation-helpers.js";
|
|
16
16
|
import { normalizeModelPropertyName } from "../../modular/type-expressions/get-type-expression.js";
|
|
17
|
-
import { NameType, normalizeName } from "../../rlc-common/index.js";
|
|
18
17
|
import { SdkContext } from "../../utils/interfaces.js";
|
|
18
|
+
import { NameType, normalizeName } from "../../utils/name-utils.js";
|
|
19
19
|
|
|
20
20
|
export const emitQueue: Set<SdkType> = new Set<SdkType>();
|
|
21
21
|
export const flattenPropertyModelMap: Map<SdkModelPropertyType, SdkModelType> = new Map<
|
package/src/index.ts
CHANGED
|
@@ -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";
|
|
@@ -76,7 +45,35 @@ import { Project } from "ts-morph";
|
|
|
76
45
|
import { provideBinder } from "./framework/hooks/binder.js";
|
|
77
46
|
import { provideSdkTypes } 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",
|
|
@@ -205,7 +192,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
205
192
|
const generationPathDetail: GenerationDirDetail = await calculateGenerationDir();
|
|
206
193
|
dpgContext.generationPathDetail = generationPathDetail;
|
|
207
194
|
dpgContext.allServiceNamespaces = listAllServiceNamespaces(dpgContext);
|
|
208
|
-
const options:
|
|
195
|
+
const options: ClientOptions = transformClientOptions(emitterOptions, dpgContext);
|
|
209
196
|
emitterOptions["generate-sample"] = options.generateSample;
|
|
210
197
|
// clear output folder if needed
|
|
211
198
|
if (options.clearOutputFolder) {
|
|
@@ -219,7 +206,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
219
206
|
options.generateTest =
|
|
220
207
|
options.generateTest === true ||
|
|
221
208
|
(options.generateTest === undefined && (!hasTestFolder || options.azureArm));
|
|
222
|
-
dpgContext.
|
|
209
|
+
dpgContext.emitterOptions = options;
|
|
223
210
|
}
|
|
224
211
|
|
|
225
212
|
async function calculateGenerationDir(): Promise<GenerationDirDetail> {
|
|
@@ -236,18 +223,12 @@ export async function $onEmit(context: EmitContext) {
|
|
|
236
223
|
return {
|
|
237
224
|
rootDir: projectRoot,
|
|
238
225
|
metadataDir: projectRoot,
|
|
239
|
-
|
|
240
|
-
modularSourcesDir: sourcesRoot,
|
|
226
|
+
sourcesDir: sourcesRoot,
|
|
241
227
|
};
|
|
242
228
|
}
|
|
243
229
|
|
|
244
230
|
async function clearSrcFolder() {
|
|
245
|
-
await emptyDir(
|
|
246
|
-
host,
|
|
247
|
-
dpgContext.generationPathDetail?.modularSourcesDir ??
|
|
248
|
-
dpgContext.generationPathDetail?.rlcSourcesDir ??
|
|
249
|
-
"",
|
|
250
|
-
);
|
|
231
|
+
await emptyDir(host, dpgContext.generationPathDetail?.sourcesDir ?? "");
|
|
251
232
|
}
|
|
252
233
|
|
|
253
234
|
async function clearSamplesDevFolder() {
|
|
@@ -262,32 +243,30 @@ export async function $onEmit(context: EmitContext) {
|
|
|
262
243
|
}
|
|
263
244
|
}
|
|
264
245
|
|
|
265
|
-
async function
|
|
266
|
-
const
|
|
246
|
+
async function buildClientCodeModels(): Promise<ClientModel[]> {
|
|
247
|
+
const models: ClientModel[] = [];
|
|
248
|
+
const clients = getClients(dpgContext);
|
|
267
249
|
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));
|
|
250
|
+
models.push(await transformClientModel(client, dpgContext));
|
|
273
251
|
}
|
|
252
|
+
return models;
|
|
274
253
|
}
|
|
275
254
|
|
|
276
|
-
async function
|
|
277
|
-
const
|
|
255
|
+
async function generateSources() {
|
|
256
|
+
const sourcesRoot = dpgContext.generationPathDetail?.sourcesDir ?? "src";
|
|
278
257
|
const project = useContext("outputProject");
|
|
279
|
-
modularEmitterOptions = transformModularEmitterOptions(dpgContext,
|
|
258
|
+
modularEmitterOptions = transformModularEmitterOptions(dpgContext, sourcesRoot, {
|
|
280
259
|
casing: "camel",
|
|
281
260
|
});
|
|
282
261
|
|
|
283
|
-
emitLoggerFile(modularEmitterOptions,
|
|
262
|
+
emitLoggerFile(modularEmitterOptions, sourcesRoot);
|
|
284
263
|
|
|
285
|
-
const rootIndexFile = project.createSourceFile(`${
|
|
264
|
+
const rootIndexFile = project.createSourceFile(`${sourcesRoot}/index.ts`, "", {
|
|
286
265
|
overwrite: true,
|
|
287
266
|
});
|
|
288
267
|
|
|
289
|
-
emitTypes(dpgContext, { sourceRoot:
|
|
290
|
-
emitNonModelResponseTypes(dpgContext, { sourceRoot:
|
|
268
|
+
emitTypes(dpgContext, { sourceRoot: sourcesRoot });
|
|
269
|
+
emitNonModelResponseTypes(dpgContext, { sourceRoot: sourcesRoot });
|
|
291
270
|
buildSubpathIndexFile(modularEmitterOptions, "models", undefined, {
|
|
292
271
|
recursive: true,
|
|
293
272
|
});
|
|
@@ -302,7 +281,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
302
281
|
buildOperationFiles(dpgContext, subClient, modularEmitterOptions);
|
|
303
282
|
buildClientContext(dpgContext, subClient, modularEmitterOptions);
|
|
304
283
|
buildRestorePoller(dpgContext, subClient, modularEmitterOptions);
|
|
305
|
-
if (dpgContext.
|
|
284
|
+
if (dpgContext.emitterOptions?.hierarchyClient) {
|
|
306
285
|
buildSubpathIndexFile(modularEmitterOptions, "api", subClient, {
|
|
307
286
|
exportIndex: false,
|
|
308
287
|
recursive: true,
|
|
@@ -320,24 +299,24 @@ export async function $onEmit(context: EmitContext) {
|
|
|
320
299
|
exportIndex: true,
|
|
321
300
|
interfaceOnly: true,
|
|
322
301
|
});
|
|
323
|
-
const { subfolder } =
|
|
302
|
+
const { subfolder } = getClientModuleInfo(subClient);
|
|
324
303
|
// Generate index file for clients with subfolders (multi-client scenarios and nested clients)
|
|
325
304
|
if (subfolder) {
|
|
326
305
|
buildSubClientIndexFile(dpgContext, subClient, modularEmitterOptions);
|
|
327
306
|
}
|
|
328
307
|
buildRootIndex(dpgContext, modularEmitterOptions, rootIndexFile, subClient);
|
|
329
308
|
}
|
|
330
|
-
//
|
|
309
|
+
// Sample generation is enabled only when the modular generator actually emits
|
|
310
|
+
// samples. Reset the baseline here, then re-enable it below if any are emitted.
|
|
311
|
+
dpgContext.emitterOptions!.generateSample = false;
|
|
331
312
|
if (emitterOptions["generate-sample"] === true) {
|
|
332
313
|
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
314
|
if (samples.length > 0) {
|
|
336
|
-
dpgContext.
|
|
315
|
+
dpgContext.emitterOptions!.generateSample = true;
|
|
337
316
|
}
|
|
338
317
|
}
|
|
339
318
|
|
|
340
|
-
binder.resolveAllReferences(
|
|
319
|
+
binder.resolveAllReferences(sourcesRoot, dpgContext.generationPathDetail?.rootDir);
|
|
341
320
|
if (program.compilerOptions.noEmit || program.hasError()) {
|
|
342
321
|
return;
|
|
343
322
|
}
|
|
@@ -382,17 +361,18 @@ export async function $onEmit(context: EmitContext) {
|
|
|
382
361
|
|
|
383
362
|
async function generateMetadataAndTest(context: SdkContext) {
|
|
384
363
|
const project = useContext("outputProject");
|
|
385
|
-
|
|
364
|
+
const clientCodeModels = await buildClientCodeModels();
|
|
365
|
+
if (clientCodeModels.length === 0 || !clientCodeModels[0]) {
|
|
386
366
|
return;
|
|
387
367
|
}
|
|
388
|
-
const
|
|
389
|
-
const option = dpgContext.
|
|
368
|
+
const clientModel: ClientModel = clientCodeModels[0];
|
|
369
|
+
const option = dpgContext.emitterOptions!;
|
|
390
370
|
// When generateMetadata is explicitly false and the sources are generated
|
|
391
371
|
// into a path ending with "generated" (e.g. src/generated), this package
|
|
392
372
|
// has a manual convenience layer. Skip all metadata/test file generation
|
|
393
373
|
// to avoid unexpected modifications to files like package.json, README.md,
|
|
394
374
|
// warp.config.yml, and snippets.spec.ts. metadata.json is still updated.
|
|
395
|
-
const sourcesDir = dpgContext.generationPathDetail?.
|
|
375
|
+
const sourcesDir = dpgContext.generationPathDetail?.sourcesDir ?? "";
|
|
396
376
|
const hasManualConvenienceLayer = getBaseFileName(sourcesDir) === "generated";
|
|
397
377
|
// Generate metadata
|
|
398
378
|
const existingPackageFilePath = joinPaths(
|
|
@@ -426,7 +406,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
426
406
|
|
|
427
407
|
//TODO Need consider multi-client cases
|
|
428
408
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
429
|
-
|
|
409
|
+
clientModel.libraryName = subClient.name;
|
|
430
410
|
}
|
|
431
411
|
|
|
432
412
|
if (shouldGenerateMetadata) {
|
|
@@ -496,7 +476,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
496
476
|
await emitContentByBuilder(
|
|
497
477
|
program,
|
|
498
478
|
commonBuilders,
|
|
499
|
-
|
|
479
|
+
clientModel,
|
|
500
480
|
dpgContext.generationPathDetail?.metadataDir,
|
|
501
481
|
);
|
|
502
482
|
|
|
@@ -525,8 +505,8 @@ export async function $onEmit(context: EmitContext) {
|
|
|
525
505
|
}),
|
|
526
506
|
};
|
|
527
507
|
|
|
528
|
-
// Always update package.json (adds #platform/* imports)
|
|
529
|
-
//
|
|
508
|
+
// Always update package.json (adds #platform/* imports) along with
|
|
509
|
+
// exports, clientContextPaths and LRO deps.
|
|
530
510
|
{
|
|
531
511
|
// Read package.json content via host and pass parsed object
|
|
532
512
|
const pkgSourceFile = await host.readFile(existingPackageFilePath);
|
|
@@ -536,30 +516,30 @@ export async function $onEmit(context: EmitContext) {
|
|
|
536
516
|
} catch {
|
|
537
517
|
packageInfo = {};
|
|
538
518
|
}
|
|
539
|
-
updateBuilders.push((model:
|
|
519
|
+
updateBuilders.push((model: ClientModel) =>
|
|
540
520
|
updatePackageFile(model, packageInfo, modularPackageInfo),
|
|
541
521
|
);
|
|
542
522
|
}
|
|
543
523
|
|
|
544
524
|
// Update warp.config.yml for Azure monorepo packages
|
|
545
|
-
updateBuilders.push((model:
|
|
525
|
+
updateBuilders.push((model: ClientModel) => buildWarpConfig(model, modularPackageInfo));
|
|
546
526
|
|
|
547
527
|
// If the client name changed, regenerate the README and snippets completely;
|
|
548
528
|
// otherwise update only the API reference link in-place.
|
|
549
529
|
if (hasReadmeFile) {
|
|
550
530
|
const readmeSourceFile = await host.readFile(existingReadmeFilePath);
|
|
551
531
|
const existingReadmeContent = readmeSourceFile.text;
|
|
552
|
-
const clientNameChanged = hasClientNameChanged(
|
|
532
|
+
const clientNameChanged = hasClientNameChanged(clientModel, existingReadmeContent);
|
|
553
533
|
updateBuilders.push(
|
|
554
534
|
clientNameChanged
|
|
555
535
|
? buildReadmeFile
|
|
556
|
-
: (model:
|
|
536
|
+
: (model: ClientModel) => updateReadmeFile(model, existingReadmeContent),
|
|
557
537
|
);
|
|
558
538
|
|
|
559
539
|
// Regenerate snippets.spec.ts only when the client name changed
|
|
560
540
|
if (clientNameChanged) {
|
|
561
541
|
for (const subClient of dpgContext.sdkPackage.clients) {
|
|
562
|
-
updateBuilders.push((model:
|
|
542
|
+
updateBuilders.push((model: ClientModel) =>
|
|
563
543
|
buildSnippets(model, getClassicalClientName(subClient)),
|
|
564
544
|
);
|
|
565
545
|
}
|
|
@@ -570,14 +550,14 @@ export async function $onEmit(context: EmitContext) {
|
|
|
570
550
|
await emitContentByBuilder(
|
|
571
551
|
program,
|
|
572
552
|
updateBuilders,
|
|
573
|
-
|
|
553
|
+
clientModel,
|
|
574
554
|
dpgContext.generationPathDetail?.metadataDir,
|
|
575
555
|
);
|
|
576
556
|
}
|
|
577
557
|
await emitContentByBuilder(
|
|
578
558
|
program,
|
|
579
559
|
buildMetadataJson,
|
|
580
|
-
|
|
560
|
+
clientModel,
|
|
581
561
|
dpgContext.generationPathDetail?.metadataDir,
|
|
582
562
|
);
|
|
583
563
|
|
|
@@ -586,7 +566,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
586
566
|
await emitContentByBuilder(
|
|
587
567
|
program,
|
|
588
568
|
[buildRecordedClientFile, buildSampleTest],
|
|
589
|
-
|
|
569
|
+
clientModel,
|
|
590
570
|
dpgContext.generationPathDetail?.metadataDir,
|
|
591
571
|
);
|
|
592
572
|
}
|
|
@@ -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
|
*/
|
|
@@ -234,7 +234,6 @@ export interface RLCOptions {
|
|
|
234
234
|
clearOutputFolder?: boolean;
|
|
235
235
|
ignorePropertyNameNormalize?: boolean;
|
|
236
236
|
ignoreEnumMemberNameNormalize?: boolean;
|
|
237
|
-
compatibilityQueryMultiFormat?: boolean;
|
|
238
237
|
typespecTitleMap?: Record<string, string>;
|
|
239
238
|
hasSubscriptionId?: boolean;
|
|
240
239
|
compatibilityLro?: boolean;
|
|
@@ -357,8 +356,8 @@ export interface ParameterMetadatas {
|
|
|
357
356
|
export interface ParameterBodyMetadata {
|
|
358
357
|
/**
|
|
359
358
|
* In case of formData we'd get multiple properties in body marked as partialBody
|
|
360
|
-
* If yes,
|
|
361
|
-
* usually false in typespec source because
|
|
359
|
+
* If yes, the emitter would prepare the whole part shape;
|
|
360
|
+
* usually false in typespec source because the emitter doesn't have to prepare the whole part shape
|
|
362
361
|
*/
|
|
363
362
|
isPartialBody?: boolean;
|
|
364
363
|
body?: ParameterBodySchema[];
|
|
@@ -398,7 +397,7 @@ export type ResponseHeaderSchema = Schema;
|
|
|
398
397
|
export type ResponseBodySchema = Schema;
|
|
399
398
|
|
|
400
399
|
export type ContentBuilder = {
|
|
401
|
-
(model:
|
|
400
|
+
(model: ClientModel): File | File[] | undefined;
|
|
402
401
|
};
|
|
403
402
|
|
|
404
403
|
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
|
/**
|
|
@@ -49,7 +49,6 @@ export interface EmitterOptions {
|
|
|
49
49
|
"experimental-extensible-enums"?: boolean;
|
|
50
50
|
"clear-output-folder"?: boolean;
|
|
51
51
|
"ignore-property-name-normalize"?: boolean;
|
|
52
|
-
"compatibility-query-multi-format"?: boolean;
|
|
53
52
|
"typespec-title-map"?: Record<string, string>;
|
|
54
53
|
"ignore-enum-member-name-normalize"?: boolean;
|
|
55
54
|
//TODO should remove this after finish the release tool test
|
|
@@ -82,7 +81,7 @@ export interface EmitterOptions {
|
|
|
82
81
|
"generate-react-native-target"?: boolean;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
export const
|
|
84
|
+
export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
86
85
|
type: "object",
|
|
87
86
|
additionalProperties: true,
|
|
88
87
|
properties: {
|
|
@@ -234,12 +233,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
234
233
|
description:
|
|
235
234
|
"The emitter has a normalization logic for enum member key, to ignore this normalization, you can set this option to true",
|
|
236
235
|
},
|
|
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
236
|
"typespec-title-map": {
|
|
244
237
|
type: "object",
|
|
245
238
|
additionalProperties: {
|
|
@@ -561,7 +554,7 @@ const libDef = {
|
|
|
561
554
|
},
|
|
562
555
|
},
|
|
563
556
|
emitter: {
|
|
564
|
-
options:
|
|
557
|
+
options: EmitterOptionsSchema,
|
|
565
558
|
},
|
|
566
559
|
} as const;
|
|
567
560
|
|
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
|
|