@azure-tools/typespec-ts 0.54.2 → 0.55.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -9
- package/README.md +68 -105
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +3 -4
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +2 -3
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdk-types.js +2 -3
- package/dist/src/framework/hooks/sdk-types.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +4 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +26 -34
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/sample.js +1 -1
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +104 -170
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +2 -18
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +30 -124
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modular/build-classical-client.js +2 -2
- package/dist/src/modular/build-classical-client.js.map +1 -1
- package/dist/src/modular/build-client-context.d.ts.map +1 -1
- package/dist/src/modular/build-client-context.js +6 -15
- package/dist/src/modular/build-client-context.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.js +2 -2
- 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 +9 -13
- 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 +4 -4
- package/dist/src/modular/build-subpath-index.js.map +1 -1
- package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
- package/dist/src/modular/emit-logger-file.js +0 -3
- package/dist/src/modular/emit-logger-file.js.map +1 -1
- package/dist/src/modular/emit-models-options.js +2 -2
- package/dist/src/modular/emit-models-options.js.map +1 -1
- package/dist/src/modular/emit-models.d.ts.map +1 -1
- package/dist/src/modular/emit-models.js +7 -22
- 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 +10 -28
- package/dist/src/modular/emit-samples.js.map +1 -1
- package/dist/src/modular/emit-tests.d.ts +2 -1
- package/dist/src/modular/emit-tests.d.ts.map +1 -1
- package/dist/src/modular/emit-tests.js +21 -11
- package/dist/src/modular/emit-tests.js.map +1 -1
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/client-helpers.js +6 -16
- package/dist/src/modular/helpers/client-helpers.js.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts +1 -1
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/example-value-helpers.js +11 -28
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
- package/dist/src/modular/serialization/serialize-utils.js +2 -2
- package/dist/src/modular/serialization/serialize-utils.js.map +1 -1
- package/dist/src/rlc-common/helpers/imports-util.d.ts +3 -4
- package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/imports-util.js +43 -56
- package/dist/src/rlc-common/helpers/imports-util.js.map +1 -1
- package/dist/src/rlc-common/helpers/name-constructors.d.ts +0 -9
- package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/name-constructors.js +1 -17
- package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +0 -18
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +0 -18
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts +2 -20
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js +5 -42
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-es-lint-config.js +3 -41
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-package-file.js +25 -73
- package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-readme-file.js +18 -108
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-sample-env-file.js +1 -2
- package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-test-config.js +1 -4
- package/dist/src/rlc-common/metadata/build-test-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts +2 -2
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-ts-config.js +19 -60
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/build-warp-config.js +0 -3
- package/dist/src/rlc-common/metadata/build-warp-config.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts +1 -38
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js +1 -108
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +0 -39
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +4 -20
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +1 -22
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/package-json/package-common.js +21 -98
- package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
- package/dist/src/rlc-common/static/polling-content.d.ts +1 -1
- package/dist/src/rlc-common/static/polling-content.d.ts.map +1 -1
- package/dist/src/rlc-common/static/polling-content.js +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-recorded-client.js +2 -5
- package/dist/src/rlc-common/test/build-recorded-client.js.map +1 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts +1 -1
- package/dist/src/rlc-common/test/build-sample-test.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-sample-test.js +2 -5
- package/dist/src/rlc-common/test/build-sample-test.js.map +1 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts +1 -1
- package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/build-snippets.js +2 -6
- package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
- package/dist/src/rlc-common/test/template.d.ts +3 -3
- package/dist/src/rlc-common/test/template.d.ts.map +1 -1
- package/dist/src/rlc-common/test/template.js +1 -35
- package/dist/src/rlc-common/test/template.js.map +1 -1
- package/dist/src/transform/transform-helper-function-details.d.ts +2 -2
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
- package/dist/src/transform/transform-helper-function-details.js +1 -9
- package/dist/src/transform/transform-helper-function-details.js.map +1 -1
- package/dist/src/transform/transform-schemas.js +1 -1
- package/dist/src/transform/transform-schemas.js.map +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +9 -16
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts +2 -2
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.js +29 -94
- package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
- package/dist/src/utils/client-utils.d.ts +1 -1
- package/dist/src/utils/client-utils.d.ts.map +1 -1
- package/dist/src/utils/client-utils.js +4 -5
- package/dist/src/utils/client-utils.js.map +1 -1
- package/dist/src/utils/emit-util.d.ts +0 -1
- package/dist/src/utils/emit-util.d.ts.map +1 -1
- package/dist/src/utils/emit-util.js +13 -24
- package/dist/src/utils/emit-util.js.map +1 -1
- package/dist/src/utils/file-system-utils.d.ts +4 -4
- package/dist/src/utils/file-system-utils.d.ts.map +1 -1
- package/dist/src/utils/file-system-utils.js +14 -16
- package/dist/src/utils/file-system-utils.js.map +1 -1
- package/dist/src/utils/import-helper.js +3 -3
- package/dist/src/utils/import-helper.js.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 -11
- package/dist/src/utils/model-utils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.d.ts +6 -4
- package/dist/src/utils/resolve-project-root.d.ts.map +1 -1
- package/dist/src/utils/resolve-project-root.js +11 -18
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -59
- package/src/framework/hooks/binder.ts +4 -5
- package/src/framework/hooks/sdk-types.ts +2 -3
- package/src/framework/load-static-helpers.ts +38 -41
- package/src/framework/sample.ts +1 -1
- package/src/index.ts +126 -204
- package/src/lib.ts +32 -143
- package/src/modular/build-classical-client.ts +2 -2
- package/src/modular/build-client-context.ts +6 -14
- package/src/modular/build-project-files.ts +11 -4
- package/src/modular/build-restore-poller.ts +2 -2
- package/src/modular/build-root-index.ts +9 -13
- package/src/modular/build-subpath-index.ts +4 -4
- package/src/modular/emit-logger-file.ts +0 -3
- package/src/modular/emit-models-options.ts +2 -2
- package/src/modular/emit-models.ts +7 -23
- package/src/modular/emit-samples.ts +10 -26
- package/src/modular/emit-tests.ts +28 -11
- package/src/modular/helpers/client-helpers.ts +7 -17
- package/src/modular/helpers/example-value-helpers.ts +11 -26
- package/src/modular/serialization/serialize-utils.ts +2 -2
- package/src/rlc-common/helpers/imports-util.ts +44 -56
- package/src/rlc-common/helpers/name-constructors.ts +1 -23
- package/src/rlc-common/index.ts +0 -18
- package/src/rlc-common/interfaces.ts +2 -23
- package/src/rlc-common/metadata/build-api-extractor-config.ts +5 -47
- package/src/rlc-common/metadata/build-es-lint-config.ts +3 -42
- package/src/rlc-common/metadata/build-package-file.ts +24 -86
- package/src/rlc-common/metadata/build-readme-file.ts +19 -121
- package/src/rlc-common/metadata/build-sample-env-file.ts +1 -4
- package/src/rlc-common/metadata/build-test-config.ts +1 -6
- package/src/rlc-common/metadata/build-ts-config.ts +30 -72
- package/src/rlc-common/metadata/build-warp-config.ts +0 -4
- package/src/rlc-common/metadata/package-json/azure-package-common.ts +2 -134
- package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +4 -24
- package/src/rlc-common/metadata/package-json/package-common.ts +22 -120
- package/src/rlc-common/static/polling-content.ts +1 -1
- package/src/rlc-common/test/build-recorded-client.ts +2 -5
- package/src/rlc-common/test/build-sample-test.ts +2 -5
- package/src/rlc-common/test/build-snippets.ts +2 -6
- package/src/rlc-common/test/template.ts +1 -35
- package/src/transform/transform-helper-function-details.ts +1 -10
- package/src/transform/transform-schemas.ts +1 -1
- package/src/transform/transform.ts +8 -19
- package/src/transform/transfrom-rlc-options.ts +29 -127
- package/src/utils/client-utils.ts +4 -5
- package/src/utils/emit-util.ts +14 -39
- package/src/utils/file-system-utils.ts +14 -15
- package/src/utils/import-helper.ts +3 -3
- package/src/utils/model-utils.ts +4 -17
- package/src/utils/resolve-project-root.ts +11 -24
- package/dist/src/rlc-common/build-client-definitions.d.ts +0 -6
- package/dist/src/rlc-common/build-client-definitions.d.ts.map +0 -1
- package/dist/src/rlc-common/build-client-definitions.js +0 -157
- package/dist/src/rlc-common/build-client-definitions.js.map +0 -1
- package/dist/src/rlc-common/build-client.d.ts +0 -9
- package/dist/src/rlc-common/build-client.d.ts.map +0 -1
- package/dist/src/rlc-common/build-client.js +0 -391
- package/dist/src/rlc-common/build-client.js.map +0 -1
- package/dist/src/rlc-common/build-index-file.d.ts +0 -6
- package/dist/src/rlc-common/build-index-file.d.ts.map +0 -1
- package/dist/src/rlc-common/build-index-file.js +0 -241
- package/dist/src/rlc-common/build-index-file.js.map +0 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-is-unexpected-helper.js +0 -223
- package/dist/src/rlc-common/build-is-unexpected-helper.js.map +0 -1
- package/dist/src/rlc-common/build-logger.d.ts +0 -6
- package/dist/src/rlc-common/build-logger.d.ts.map +0 -1
- package/dist/src/rlc-common/build-logger.js +0 -31
- package/dist/src/rlc-common/build-logger.js.map +0 -1
- package/dist/src/rlc-common/build-method-shortcuts.d.ts +0 -5
- package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +0 -1
- package/dist/src/rlc-common/build-method-shortcuts.js +0 -54
- package/dist/src/rlc-common/build-method-shortcuts.js.map +0 -1
- package/dist/src/rlc-common/build-object-types.d.ts +0 -29
- package/dist/src/rlc-common/build-object-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-object-types.js +0 -412
- package/dist/src/rlc-common/build-object-types.js.map +0 -1
- package/dist/src/rlc-common/build-paginate-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-paginate-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-paginate-helper.js +0 -27
- package/dist/src/rlc-common/build-paginate-helper.js.map +0 -1
- package/dist/src/rlc-common/build-parameter-types.d.ts +0 -14
- package/dist/src/rlc-common/build-parameter-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-parameter-types.js +0 -391
- package/dist/src/rlc-common/build-parameter-types.js.map +0 -1
- package/dist/src/rlc-common/build-polling-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-polling-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-polling-helper.js +0 -61
- package/dist/src/rlc-common/build-polling-helper.js.map +0 -1
- package/dist/src/rlc-common/build-response-types.d.ts +0 -6
- package/dist/src/rlc-common/build-response-types.d.ts.map +0 -1
- package/dist/src/rlc-common/build-response-types.js +0 -143
- package/dist/src/rlc-common/build-response-types.js.map +0 -1
- package/dist/src/rlc-common/build-samples.d.ts +0 -3
- package/dist/src/rlc-common/build-samples.d.ts.map +0 -1
- package/dist/src/rlc-common/build-samples.js +0 -30
- package/dist/src/rlc-common/build-samples.js.map +0 -1
- package/dist/src/rlc-common/build-schema-type.d.ts +0 -20
- package/dist/src/rlc-common/build-schema-type.d.ts.map +0 -1
- package/dist/src/rlc-common/build-schema-type.js +0 -71
- package/dist/src/rlc-common/build-schema-type.js.map +0 -1
- package/dist/src/rlc-common/build-serialize-helper.d.ts +0 -6
- package/dist/src/rlc-common/build-serialize-helper.d.ts.map +0 -1
- package/dist/src/rlc-common/build-serialize-helper.js +0 -36
- package/dist/src/rlc-common/build-serialize-helper.js.map +0 -1
- package/dist/src/rlc-common/build-top-level-index-file.d.ts +0 -6
- package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +0 -1
- package/dist/src/rlc-common/build-top-level-index-file.js +0 -48
- package/dist/src/rlc-common/build-top-level-index-file.js.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.d.ts +0 -7
- package/dist/src/rlc-common/helpers/package-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/package-util.js +0 -10
- package/dist/src/rlc-common/helpers/package-util.js.map +0 -1
- package/dist/src/rlc-common/helpers/path-utils.d.ts +0 -2
- package/dist/src/rlc-common/helpers/path-utils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/path-utils.js +0 -10
- package/dist/src/rlc-common/helpers/path-utils.js.map +0 -1
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +0 -4
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/shortcut-methods.js +0 -49
- package/dist/src/rlc-common/helpers/shortcut-methods.js.map +0 -1
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts +0 -12
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/value-generation-util.js +0 -161
- package/dist/src/rlc-common/helpers/value-generation-util.js.map +0 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts +0 -6
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/build-rollup-config.js +0 -140
- package/dist/src/rlc-common/metadata/build-rollup-config.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts +0 -8
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js +0 -101
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +0 -57
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +0 -53
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +0 -1
- package/dist/src/rlc-common/transform-sample-groups.d.ts +0 -9
- package/dist/src/rlc-common/transform-sample-groups.d.ts.map +0 -1
- package/dist/src/rlc-common/transform-sample-groups.js +0 -313
- package/dist/src/rlc-common/transform-sample-groups.js.map +0 -1
- package/dist/src/utils/dirname.d.ts +0 -9
- package/dist/src/utils/dirname.d.ts.map +0 -1
- package/dist/src/utils/dirname.js +0 -12
- package/dist/src/utils/dirname.js.map +0 -1
- package/src/rlc-common/build-client-definitions.ts +0 -235
- package/src/rlc-common/build-client.ts +0 -490
- package/src/rlc-common/build-index-file.ts +0 -344
- package/src/rlc-common/build-is-unexpected-helper.ts +0 -248
- package/src/rlc-common/build-logger.ts +0 -43
- package/src/rlc-common/build-method-shortcuts.ts +0 -71
- package/src/rlc-common/build-object-types.ts +0 -603
- package/src/rlc-common/build-paginate-helper.ts +0 -31
- package/src/rlc-common/build-parameter-types.ts +0 -554
- package/src/rlc-common/build-polling-helper.ts +0 -83
- package/src/rlc-common/build-response-types.ts +0 -180
- package/src/rlc-common/build-samples.ts +0 -32
- package/src/rlc-common/build-schema-type.ts +0 -89
- package/src/rlc-common/build-serialize-helper.ts +0 -49
- package/src/rlc-common/build-top-level-index-file.ts +0 -58
- package/src/rlc-common/helpers/package-util.ts +0 -13
- package/src/rlc-common/helpers/path-utils.ts +0 -10
- package/src/rlc-common/helpers/shortcut-methods.ts +0 -58
- package/src/rlc-common/helpers/value-generation-util.ts +0 -234
- package/src/rlc-common/metadata/build-rollup-config.ts +0 -147
- package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +0 -123
- package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +0 -68
- package/src/rlc-common/transform-sample-groups.ts +0 -407
- package/src/utils/dirname.ts +0 -12
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 {
|
|
6
|
+
import { PackageDetails } from "./rlc-common/index.js";
|
|
7
7
|
|
|
8
8
|
export interface EmitterOptions {
|
|
9
9
|
/**
|
|
@@ -13,9 +13,6 @@ export interface EmitterOptions {
|
|
|
13
13
|
* currently affected by this option.
|
|
14
14
|
*/
|
|
15
15
|
"include-headers-in-response"?: boolean;
|
|
16
|
-
"include-shortcuts"?: boolean;
|
|
17
|
-
"multi-client"?: boolean;
|
|
18
|
-
batch?: any[];
|
|
19
16
|
"package-details"?: PackageDetails;
|
|
20
17
|
"add-credentials"?: boolean;
|
|
21
18
|
/** Three possible values:
|
|
@@ -42,19 +39,9 @@ export interface EmitterOptions {
|
|
|
42
39
|
*/
|
|
43
40
|
"generate-test"?: boolean;
|
|
44
41
|
"generate-sample"?: boolean;
|
|
45
|
-
"azure-sdk-for-js"?: boolean;
|
|
46
|
-
"azure-output-directory"?: string;
|
|
47
42
|
"is-typespec-test"?: boolean;
|
|
48
|
-
title?: string;
|
|
49
|
-
"dependency-info"?: DependencyInfo;
|
|
50
|
-
"product-doc-link"?: string;
|
|
51
|
-
"service-info"?: ServiceInfo;
|
|
52
43
|
"azure-arm"?: boolean;
|
|
53
|
-
"source-from"?: "TypeSpec" | "Swagger";
|
|
54
|
-
"is-modular-library"?: boolean;
|
|
55
|
-
"module-kind"?: "esm";
|
|
56
44
|
"enable-operation-group"?: boolean;
|
|
57
|
-
flavor?: PackageFlavor;
|
|
58
45
|
"enable-model-namespace"?: boolean;
|
|
59
46
|
"hierarchy-client"?: boolean;
|
|
60
47
|
"compatibility-mode"?: boolean;
|
|
@@ -63,10 +50,8 @@ export interface EmitterOptions {
|
|
|
63
50
|
"clear-output-folder"?: boolean;
|
|
64
51
|
"ignore-property-name-normalize"?: boolean;
|
|
65
52
|
"compatibility-query-multi-format"?: boolean;
|
|
66
|
-
branded?: boolean;
|
|
67
53
|
"typespec-title-map"?: Record<string, string>;
|
|
68
54
|
"ignore-enum-member-name-normalize"?: boolean;
|
|
69
|
-
"default-value-object"?: boolean;
|
|
70
55
|
//TODO should remove this after finish the release tool test
|
|
71
56
|
"should-use-pnpm-dep"?: boolean;
|
|
72
57
|
"ignore-nullable-on-optional"?: boolean;
|
|
@@ -93,7 +78,6 @@ export interface EmitterOptions {
|
|
|
93
78
|
/**
|
|
94
79
|
* When set to true, generates React Native build targets (tsconfig, warp target,
|
|
95
80
|
* package.json exports). Defaults to `false`.
|
|
96
|
-
* Only applicable when `azure-sdk-for-js` is `true`.
|
|
97
81
|
*/
|
|
98
82
|
"generate-react-native-target"?: boolean;
|
|
99
83
|
}
|
|
@@ -108,24 +92,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
108
92
|
description:
|
|
109
93
|
"This option is used to indicate whether to include response headers in the generated response type. When set to true, the generated response type will include response headers as properties.",
|
|
110
94
|
},
|
|
111
|
-
"include-shortcuts": {
|
|
112
|
-
type: "boolean",
|
|
113
|
-
nullable: true,
|
|
114
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
115
|
-
},
|
|
116
|
-
"multi-client": {
|
|
117
|
-
type: "boolean",
|
|
118
|
-
nullable: true,
|
|
119
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
120
|
-
},
|
|
121
|
-
batch: {
|
|
122
|
-
type: "array",
|
|
123
|
-
nullable: true,
|
|
124
|
-
items: {
|
|
125
|
-
type: "string",
|
|
126
|
-
},
|
|
127
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
128
|
-
},
|
|
129
95
|
"package-details": {
|
|
130
96
|
type: "object",
|
|
131
97
|
additionalProperties: true,
|
|
@@ -145,18 +111,18 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
145
111
|
"add-credentials": {
|
|
146
112
|
type: "boolean",
|
|
147
113
|
nullable: true,
|
|
148
|
-
description:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
114
|
+
description: [
|
|
115
|
+
"We support two types of authentication: Azure Key Credential(AzureKey) and Token credential(AADToken), any other will need to be handled manually.",
|
|
116
|
+
"",
|
|
117
|
+
"There are two ways to set up our credential details",
|
|
118
|
+
"",
|
|
119
|
+
"- To use `@useAuth` decorator in TypeSpec",
|
|
120
|
+
"- To config in yaml file",
|
|
121
|
+
"",
|
|
122
|
+
"Please notice defining in TypeSpec is recommended and also has higher priority than second one.",
|
|
123
|
+
"",
|
|
124
|
+
"To enable credential in `tspconfig.yaml` and we need to provide more details to let codegen know types.",
|
|
125
|
+
].join("\n"),
|
|
160
126
|
},
|
|
161
127
|
"credential-scopes": {
|
|
162
128
|
type: "array",
|
|
@@ -186,20 +152,18 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
186
152
|
"generate-metadata": {
|
|
187
153
|
type: "boolean",
|
|
188
154
|
nullable: true,
|
|
189
|
-
description:
|
|
190
|
-
|
|
191
|
-
`,
|
|
155
|
+
description:
|
|
156
|
+
"Whether to generate metadata files which includes package.json, README.md and tsconfig.json etc. Defaults to `undefined`. If there's not a package.json under package-dir, defaults to `true`. but if you'd like to disable this feature you could set it as `false`.",
|
|
192
157
|
},
|
|
193
158
|
"generate-test": {
|
|
194
159
|
type: "boolean",
|
|
195
160
|
nullable: true,
|
|
196
|
-
description:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
`,
|
|
161
|
+
description: [
|
|
162
|
+
"Whether to generate test files, for basic testing of your generated sdks. Defaults to `undefined`.",
|
|
163
|
+
"other cases:",
|
|
164
|
+
"- If there's a test folder under package-dir. Defaults to `false`.",
|
|
165
|
+
"- If there's not a test folder under package-dir. Defaults to `true`.",
|
|
166
|
+
].join("\n"),
|
|
203
167
|
},
|
|
204
168
|
"generate-sample": {
|
|
205
169
|
type: "boolean",
|
|
@@ -207,70 +171,16 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
207
171
|
description:
|
|
208
172
|
"Whether to generate sample files, for basic samples of your generated sdks. Defaults to `undefined`. Management packages' default to `true`.",
|
|
209
173
|
},
|
|
210
|
-
"azure-sdk-for-js": {
|
|
211
|
-
type: "boolean",
|
|
212
|
-
nullable: true,
|
|
213
|
-
description:
|
|
214
|
-
"This is used to indicate your project is generated in [azure-sdk-for-js](https://github.com/Azure/azure-sdk-for-js) repo or not. If your package is located in that repo we'll leverage `dev-tool` to accelerate our building and testing, however if not we'll remove the dependency for that tool. Defaults to `undefined`. Services with Flavor equal to 'Azure' default to 'true'. ",
|
|
215
|
-
},
|
|
216
|
-
"azure-output-directory": {
|
|
217
|
-
type: "string",
|
|
218
|
-
nullable: true,
|
|
219
|
-
description: "Deprecated option for RLC legacy generation",
|
|
220
|
-
},
|
|
221
174
|
"is-typespec-test": {
|
|
222
175
|
type: "boolean",
|
|
223
176
|
nullable: true,
|
|
224
177
|
description: "Internal option for test",
|
|
225
178
|
},
|
|
226
|
-
title: {
|
|
227
|
-
type: "string",
|
|
228
|
-
nullable: true,
|
|
229
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
230
|
-
},
|
|
231
|
-
"dependency-info": {
|
|
232
|
-
type: "object",
|
|
233
|
-
additionalProperties: true,
|
|
234
|
-
properties: {
|
|
235
|
-
link: { type: "string", nullable: false },
|
|
236
|
-
description: { type: "string", nullable: false },
|
|
237
|
-
},
|
|
238
|
-
required: [],
|
|
239
|
-
nullable: true,
|
|
240
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
241
|
-
},
|
|
242
|
-
"product-doc-link": {
|
|
243
|
-
type: "string",
|
|
244
|
-
nullable: true,
|
|
245
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
246
|
-
},
|
|
247
|
-
"service-info": {
|
|
248
|
-
type: "object",
|
|
249
|
-
additionalProperties: true,
|
|
250
|
-
properties: {
|
|
251
|
-
title: { type: "string", nullable: true },
|
|
252
|
-
description: { type: "string", nullable: true },
|
|
253
|
-
},
|
|
254
|
-
nullable: true,
|
|
255
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
256
|
-
},
|
|
257
179
|
"azure-arm": {
|
|
258
180
|
type: "boolean",
|
|
259
181
|
nullable: true,
|
|
260
182
|
description: "Whether the package is an arm package.",
|
|
261
183
|
},
|
|
262
|
-
"source-from": {
|
|
263
|
-
type: "string",
|
|
264
|
-
nullable: true,
|
|
265
|
-
description: "Internal option, the value is default for TypeSpec generation",
|
|
266
|
-
},
|
|
267
|
-
"is-modular-library": {
|
|
268
|
-
type: "boolean",
|
|
269
|
-
nullable: true,
|
|
270
|
-
default: false,
|
|
271
|
-
description:
|
|
272
|
-
"Whether to generate a Modular library. Defaults to `false`. Arm packages default to `true`.",
|
|
273
|
-
},
|
|
274
184
|
"enable-operation-group": {
|
|
275
185
|
type: "boolean",
|
|
276
186
|
nullable: true,
|
|
@@ -289,23 +199,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
289
199
|
description:
|
|
290
200
|
"An option to organize the client in a hierarchical way as defined by `@clientInitialization`. This is true by default.",
|
|
291
201
|
},
|
|
292
|
-
branded: {
|
|
293
|
-
type: "boolean",
|
|
294
|
-
nullable: true,
|
|
295
|
-
description: "A section of flavor",
|
|
296
|
-
},
|
|
297
|
-
flavor: {
|
|
298
|
-
type: "string",
|
|
299
|
-
nullable: true,
|
|
300
|
-
description: "The flavor of the SDK.",
|
|
301
|
-
},
|
|
302
|
-
"module-kind": {
|
|
303
|
-
type: "string",
|
|
304
|
-
nullable: true,
|
|
305
|
-
enum: ["esm"],
|
|
306
|
-
default: "esm",
|
|
307
|
-
description: "Internal option for test.",
|
|
308
|
-
},
|
|
309
202
|
"compatibility-mode": {
|
|
310
203
|
type: "boolean",
|
|
311
204
|
nullable: true,
|
|
@@ -347,11 +240,6 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
347
240
|
description:
|
|
348
241
|
"Whether to generate the backward-compatible code for query parameter serialization for array types in RLC. Defaults to `false`",
|
|
349
242
|
},
|
|
350
|
-
"default-value-object": {
|
|
351
|
-
type: "boolean",
|
|
352
|
-
nullable: true,
|
|
353
|
-
description: "Deprecated option for RLC legacy generation.",
|
|
354
|
-
},
|
|
355
243
|
"typespec-title-map": {
|
|
356
244
|
type: "object",
|
|
357
245
|
additionalProperties: {
|
|
@@ -359,15 +247,16 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
359
247
|
},
|
|
360
248
|
required: [],
|
|
361
249
|
nullable: true,
|
|
362
|
-
description:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
250
|
+
description: [
|
|
251
|
+
"Only for Modular generation",
|
|
252
|
+
"By default, code generation uses the titles specified in the `@client` and `@service` decorators in TypeSpec to name modular clients. If you need to override these names, you can configure the `typespec-title-map`. The map's keys represent the original client names from TypeSpec, and the values are the desired client names. This configuration supports renaming multiple clients.",
|
|
253
|
+
"",
|
|
254
|
+
"```yaml",
|
|
255
|
+
"typespec-title-map:",
|
|
256
|
+
" AnomalyDetectorClient: AnomalyDetectorRest",
|
|
257
|
+
" AnomalyDetectorClient2: AnomalyDetectorRest2",
|
|
258
|
+
"```",
|
|
259
|
+
].join("\n"),
|
|
371
260
|
},
|
|
372
261
|
"should-use-pnpm-dep": {
|
|
373
262
|
type: "boolean",
|
|
@@ -402,7 +291,7 @@ export const RLCOptionsSchema: JSONSchemaType<EmitterOptions> = {
|
|
|
402
291
|
type: "boolean",
|
|
403
292
|
nullable: true,
|
|
404
293
|
description:
|
|
405
|
-
"When set to true, generates React Native build targets (tsconfig, warp target, package.json exports).
|
|
294
|
+
"When set to true, generates React Native build targets (tsconfig, warp target, package.json exports). Defaults to `false`.",
|
|
406
295
|
},
|
|
407
296
|
},
|
|
408
297
|
required: [],
|
|
@@ -290,8 +290,8 @@ function buildClientOperationGroups(
|
|
|
290
290
|
} else {
|
|
291
291
|
// The `rawGroupName` is used to any places where we need normalized name twice so we need to keep the raw as PascalCase.
|
|
292
292
|
const rawGroupName = normalizeName(prefixes[0] ?? "", NameType.Interface);
|
|
293
|
-
const operationName = `_get${rawGroupName}Operations`;
|
|
294
|
-
const propertyType = `${rawGroupName}Operations`;
|
|
293
|
+
const operationName = `_get${normalizeName(rawGroupName, NameType.OperationGroup)}Operations`;
|
|
294
|
+
const propertyType = `${normalizeName(rawGroupName, NameType.OperationGroup)}Operations`;
|
|
295
295
|
// The `groupName` is used to any places where we don't need normalized name again
|
|
296
296
|
const groupName = normalizeName(rawGroupName, NameType.Property);
|
|
297
297
|
const existProperty = clientClass.getProperties().filter((p) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NameType,
|
|
1
|
+
import { NameType, normalizeName } from "../rlc-common/index.js";
|
|
2
2
|
import {
|
|
3
3
|
buildGetClientCredentialParam,
|
|
4
4
|
buildGetClientEndpointParam,
|
|
@@ -164,13 +164,10 @@ export function buildClientContext(
|
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
// TODO use binder here
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
namedImports: ["logger"],
|
|
172
|
-
});
|
|
173
|
-
}
|
|
167
|
+
clientContextFile.addImportDeclaration({
|
|
168
|
+
moduleSpecifier: "../".repeat(hierarchy.length + 1) + "logger.js",
|
|
169
|
+
namedImports: ["logger"],
|
|
170
|
+
});
|
|
174
171
|
|
|
175
172
|
const factoryFunction = clientContextFile.addFunction({
|
|
176
173
|
docs: getDocsFromDescription(client.doc),
|
|
@@ -241,15 +238,10 @@ export function buildClientContext(
|
|
|
241
238
|
if (!apiVersionInEndpoint && apiVersionParam.clientDefaultValue) {
|
|
242
239
|
apiVersionStatement += `const ${apiVersionParamName} = options.${apiVersionParamName};`;
|
|
243
240
|
}
|
|
244
|
-
} else if (isAzurePackage(emitterOptions)) {
|
|
245
|
-
apiVersionStatement += `
|
|
246
|
-
if (options.apiVersion) {
|
|
247
|
-
logger.warning("This client does not support client api-version, please change it at the operation level");
|
|
248
|
-
}`;
|
|
249
241
|
} else {
|
|
250
242
|
apiVersionStatement += `
|
|
251
243
|
if (options.apiVersion) {
|
|
252
|
-
|
|
244
|
+
logger.warning("This client does not support client api-version, please change it at the operation level");
|
|
253
245
|
}`;
|
|
254
246
|
}
|
|
255
247
|
factoryFunction.addStatements(apiVersionStatement);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NameType } from "../rlc-common/index.js";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { getRelativePathFromDirectory, joinPaths } from "@typespec/compiler";
|
|
4
4
|
import { useContext } from "../context-manager.js";
|
|
5
5
|
import { getClientHierarchyMap, getModularClientOptions } from "../utils/client-utils.js";
|
|
6
6
|
import { SdkContext } from "../utils/interfaces.js";
|
|
@@ -19,7 +19,10 @@ function getSourceRootPrefix(emitterOptions: ModularEmitterOptions, context: Sdk
|
|
|
19
19
|
const rootDir = (context.generationPathDetail?.rootDir ?? "").replace(/\\/g, "/");
|
|
20
20
|
|
|
21
21
|
if (rootDir && sourceRoot.startsWith(rootDir)) {
|
|
22
|
-
const relativePath =
|
|
22
|
+
const relativePath = getRelativePathFromDirectory(rootDir, sourceRoot, false).replace(
|
|
23
|
+
/\\/g,
|
|
24
|
+
"/",
|
|
25
|
+
);
|
|
23
26
|
return `./${relativePath}`;
|
|
24
27
|
}
|
|
25
28
|
|
|
@@ -95,7 +98,7 @@ export function getModuleExports(context: SdkContext, emitterOptions: ModularEmi
|
|
|
95
98
|
function getModelSubpaths(emitterOptions: ModularEmitterOptions) {
|
|
96
99
|
const outputProject = useContext("outputProject");
|
|
97
100
|
const modelFiles = outputProject.getSourceFiles(
|
|
98
|
-
|
|
101
|
+
joinPaths(emitterOptions.modularOptions.sourceRoot.replace(/\\/g, "/"), `models/**/*.ts`),
|
|
99
102
|
);
|
|
100
103
|
const subpath = new Set<string>();
|
|
101
104
|
for (const modelFile of modelFiles) {
|
|
@@ -104,7 +107,11 @@ function getModelSubpaths(emitterOptions: ModularEmitterOptions) {
|
|
|
104
107
|
continue;
|
|
105
108
|
}
|
|
106
109
|
subpath.add(
|
|
107
|
-
|
|
110
|
+
getRelativePathFromDirectory(
|
|
111
|
+
emitterOptions.modularOptions.sourceRoot.replace(/\\/g, "/"),
|
|
112
|
+
filepath,
|
|
113
|
+
false,
|
|
114
|
+
),
|
|
108
115
|
);
|
|
109
116
|
}
|
|
110
117
|
return Array.from(subpath);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import
|
|
2
|
+
import { joinPaths } from "@typespec/compiler";
|
|
3
3
|
import { SourceFile } from "ts-morph";
|
|
4
4
|
import { useContext } from "../context-manager.js";
|
|
5
5
|
import { useDependencies } from "../framework/hooks/use-dependencies.js";
|
|
@@ -32,7 +32,7 @@ export function buildRestorePoller(
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
const srcPath = emitterOptions.modularOptions.sourceRoot;
|
|
35
|
-
const filePath =
|
|
35
|
+
const filePath = joinPaths(
|
|
36
36
|
`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}restorePollerHelpers.ts`,
|
|
37
37
|
);
|
|
38
38
|
const restorePollerFile = project.createSourceFile(filePath, undefined, {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import { NoTarget } from "@typespec/compiler";
|
|
3
|
-
import { join } from "path/posix";
|
|
2
|
+
import { joinPaths, NoTarget } from "@typespec/compiler";
|
|
4
3
|
import { Project, SourceFile } from "ts-morph";
|
|
5
4
|
import { useContext } from "../context-manager.js";
|
|
6
5
|
import { resolveReference } from "../framework/reference.js";
|
|
7
6
|
import { reportDiagnostic } from "../lib.js";
|
|
8
|
-
import {
|
|
7
|
+
import { NameType, normalizeName } from "../rlc-common/index.js";
|
|
9
8
|
import { getModularClientOptions } from "../utils/client-utils.js";
|
|
10
9
|
import { SdkContext } from "../utils/interfaces.js";
|
|
11
10
|
import { getMethodHierarchiesMap } from "../utils/operation-util.js";
|
|
@@ -29,7 +28,7 @@ export function buildRootIndex(
|
|
|
29
28
|
if (!clientMap) {
|
|
30
29
|
// we still need to export the models if no client is provided
|
|
31
30
|
exportModels(emitterOptions, rootIndexFile);
|
|
32
|
-
exportRestErrorTypes(
|
|
31
|
+
exportRestErrorTypes(rootIndexFile);
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
34
|
const project = useContext("outputProject");
|
|
@@ -72,7 +71,7 @@ export function buildRootIndex(
|
|
|
72
71
|
exportPagingTypes(context, rootIndexFile);
|
|
73
72
|
exportFileContentsType(context, rootIndexFile);
|
|
74
73
|
exportAzureCloudTypes(context, rootIndexFile);
|
|
75
|
-
exportRestErrorTypes(
|
|
74
|
+
exportRestErrorTypes(rootIndexFile);
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
function exportModels(
|
|
@@ -106,10 +105,7 @@ function exportAzureCloudTypes(context: SdkContext, rootIndexFile: SourceFile) {
|
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
function exportRestErrorTypes(
|
|
110
|
-
if (!isAzurePackage({ options: context.rlcOptions })) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
108
|
+
function exportRestErrorTypes(rootIndexFile: SourceFile) {
|
|
113
109
|
const existingExports = getExistingExports(rootIndexFile);
|
|
114
110
|
const namedExports = ["RestError", "isRestError"].filter((name) => !existingExports.has(name));
|
|
115
111
|
if (namedExports.length > 0) {
|
|
@@ -298,7 +294,7 @@ function exportModules(
|
|
|
298
294
|
.getDirectories()
|
|
299
295
|
.filter((dir) => {
|
|
300
296
|
const formattedDir = dir.getPath().replace(/\\/g, "/");
|
|
301
|
-
const targetPath =
|
|
297
|
+
const targetPath = joinPaths(srcPath, subfolder, moduleName).replace(/\\/g, "/");
|
|
302
298
|
return formattedDir.startsWith(targetPath);
|
|
303
299
|
})
|
|
304
300
|
.map((dir) => {
|
|
@@ -309,17 +305,17 @@ function exportModules(
|
|
|
309
305
|
.getDirectories()
|
|
310
306
|
.filter((dir) => {
|
|
311
307
|
const formattedDir = dir.getPath().replace(/\\/g, "/");
|
|
312
|
-
const targetPath =
|
|
308
|
+
const targetPath = joinPaths(srcPath, subfolder, moduleName).replace(/\\/g, "/");
|
|
313
309
|
return formattedDir.startsWith(targetPath);
|
|
314
310
|
})
|
|
315
311
|
.map((dir) => {
|
|
316
312
|
return dir.getPath().replace(/\\/g, "/");
|
|
317
313
|
});
|
|
318
314
|
} else {
|
|
319
|
-
folders = [
|
|
315
|
+
folders = [joinPaths(srcPath, subfolder, moduleName).replace(/\\/g, "/")];
|
|
320
316
|
}
|
|
321
317
|
for (const folder of folders) {
|
|
322
|
-
const apiFilePattern =
|
|
318
|
+
const apiFilePattern = joinPaths(folder, "index.ts").replace(/\\/g, "/");
|
|
323
319
|
const modelsFile = project.getSourceFile(apiFilePattern);
|
|
324
320
|
if (!modelsFile) {
|
|
325
321
|
continue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
+
import { joinPaths } from "@typespec/compiler";
|
|
2
3
|
import { ModularEmitterOptions } from "./interfaces.js";
|
|
3
4
|
|
|
4
|
-
import { join } from "path";
|
|
5
5
|
import { Node, SourceFile } from "ts-morph";
|
|
6
6
|
import { useContext } from "../context-manager.js";
|
|
7
7
|
import { getModularClientOptions } from "../utils/client-utils.js";
|
|
@@ -29,7 +29,7 @@ export function buildSubpathIndexFile(
|
|
|
29
29
|
.getDirectories()
|
|
30
30
|
.filter((dir) => {
|
|
31
31
|
const formattedDir = dir.getPath().replace(/\\/g, "/");
|
|
32
|
-
const targetPath =
|
|
32
|
+
const targetPath = joinPaths(srcPath, subfolder, subpath).replace(/\\/g, "/");
|
|
33
33
|
return (
|
|
34
34
|
formattedDir.startsWith(targetPath) && !project.getSourceFile(`${formattedDir}/index.ts`)
|
|
35
35
|
);
|
|
@@ -38,10 +38,10 @@ export function buildSubpathIndexFile(
|
|
|
38
38
|
return dir.getPath().replace(/\\/g, "/");
|
|
39
39
|
});
|
|
40
40
|
} else {
|
|
41
|
-
folders = [
|
|
41
|
+
folders = [joinPaths(srcPath, subfolder, subpath).replace(/\\/g, "/")];
|
|
42
42
|
}
|
|
43
43
|
for (const folder of folders) {
|
|
44
|
-
const apiFilePattern = subpath === "models" ?
|
|
44
|
+
const apiFilePattern = subpath === "models" ? joinPaths(folder, "models.ts") : folder;
|
|
45
45
|
const apiFiles = project.getSourceFiles().filter((file) => {
|
|
46
46
|
if (subpath === "api" && options.recursive) {
|
|
47
47
|
return file.getDirectoryPath().replace(/\\/g, "/") === apiFilePattern.replace(/\\/g, "/");
|
|
@@ -3,9 +3,6 @@ import { ModularEmitterOptions } from "./interfaces.js";
|
|
|
3
3
|
|
|
4
4
|
export function emitLoggerFile(emitterOptions: ModularEmitterOptions, srcPath: string = "src") {
|
|
5
5
|
const project = useContext("outputProject");
|
|
6
|
-
if (emitterOptions.options.flavor !== "azure") {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
6
|
|
|
10
7
|
const sourceFile = project.createSourceFile(`${srcPath}/logger.ts`, "", {
|
|
11
8
|
overwrite: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinPaths } from "@typespec/compiler";
|
|
2
2
|
|
|
3
3
|
import { ModularEmitterOptions } from "./interfaces.js";
|
|
4
4
|
|
|
@@ -25,7 +25,7 @@ export function buildApiOptions(
|
|
|
25
25
|
for (const [prefixKey, operations] of methodMap) {
|
|
26
26
|
const prefixes = prefixKey.split("/");
|
|
27
27
|
const modelOptionsFile = project.createSourceFile(
|
|
28
|
-
|
|
28
|
+
joinPaths(
|
|
29
29
|
emitterOptions.modularOptions.sourceRoot,
|
|
30
30
|
subfolder ?? "",
|
|
31
31
|
`api`,
|
|
@@ -36,16 +36,15 @@ import {
|
|
|
36
36
|
getMultipartFileTypeExpression,
|
|
37
37
|
} from "./type-expressions/get-model-expression.js";
|
|
38
38
|
|
|
39
|
-
import { getNamespaceFullName, NoTarget } from "@typespec/compiler";
|
|
39
|
+
import { getNamespaceFullName, joinPaths, NoTarget } from "@typespec/compiler";
|
|
40
40
|
import { isMetadata, isOrExtendsHttpFile, Visibility } from "@typespec/http";
|
|
41
|
-
import path from "path";
|
|
42
41
|
import { useContext } from "../context-manager.js";
|
|
43
42
|
import { addDeclaration } from "../framework/declaration.js";
|
|
44
43
|
import {
|
|
45
44
|
emitQueue,
|
|
46
45
|
flattenPropertyModelMap,
|
|
47
46
|
getAllOperationsFromClient,
|
|
48
|
-
|
|
47
|
+
pagedModelsUsedInNonPagingOps,
|
|
49
48
|
} from "../framework/hooks/sdk-types.js";
|
|
50
49
|
import { refkey } from "../framework/refkey.js";
|
|
51
50
|
import { reportDiagnostic } from "../lib.js";
|
|
@@ -304,7 +303,7 @@ export function getApiVersionEnum(context: SdkContext) {
|
|
|
304
303
|
}
|
|
305
304
|
|
|
306
305
|
export function getModelsPath(sourceRoot: string, modelNamespace: string[] = []): string {
|
|
307
|
-
return
|
|
306
|
+
return joinPaths(
|
|
308
307
|
...[
|
|
309
308
|
sourceRoot,
|
|
310
309
|
"models",
|
|
@@ -842,7 +841,8 @@ export function normalizeModelName(
|
|
|
842
841
|
}
|
|
843
842
|
const namespacePrefix = context.rlcOptions?.enableModelNamespace ? segments.join("") : "";
|
|
844
843
|
const internalModelPrefix =
|
|
845
|
-
(isPagedResultModel(context, type) && !
|
|
844
|
+
(isPagedResultModel(context, type) && !pagedModelsUsedInNonPagingOps.has(type)) ||
|
|
845
|
+
type.isGeneratedName
|
|
846
846
|
? "_"
|
|
847
847
|
: "";
|
|
848
848
|
return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name, nameType, true)}${unionSuffix}`;
|
|
@@ -932,7 +932,7 @@ export function visitPackageTypes(context: SdkContext) {
|
|
|
932
932
|
const { sdkPackage } = context;
|
|
933
933
|
emitQueue.clear();
|
|
934
934
|
flattenPropertyModelMap.clear();
|
|
935
|
-
|
|
935
|
+
pagedModelsUsedInNonPagingOps.clear();
|
|
936
936
|
// Add all models in the package to the emit queue
|
|
937
937
|
for (const model of sdkPackage.models) {
|
|
938
938
|
visitType(context, model);
|
|
@@ -1015,19 +1015,7 @@ function trackPagedModelInNonPagingMethod(
|
|
|
1015
1015
|
if (method.kind !== "basic" && method.kind !== "lro") return;
|
|
1016
1016
|
const respType = method.response.type;
|
|
1017
1017
|
if (respType && isPagedResultModel(context, respType)) {
|
|
1018
|
-
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* If a paged result model is used as a model property type, mark it so that
|
|
1024
|
-
* normalizeModelName keeps it public (no "_" prefix).
|
|
1025
|
-
*/
|
|
1026
|
-
function trackPagedModelUsedAsProperty(context: SdkContext, type: SdkType): void {
|
|
1027
|
-
// Unwrap array types to check the element type
|
|
1028
|
-
const resolved = type.kind === "array" ? type.valueType : type;
|
|
1029
|
-
if (resolved && isPagedResultModel(context, resolved)) {
|
|
1030
|
-
pagedModelsKeptPublic.add(resolved);
|
|
1018
|
+
pagedModelsUsedInNonPagingOps.add(respType);
|
|
1031
1019
|
}
|
|
1032
1020
|
}
|
|
1033
1021
|
|
|
@@ -1056,10 +1044,6 @@ function visitType(context: SdkContext, type: SdkType | undefined) {
|
|
|
1056
1044
|
if (property.flatten && property.type.kind === "model") {
|
|
1057
1045
|
flattenPropertyModelMap.set(property, type);
|
|
1058
1046
|
}
|
|
1059
|
-
// If a paged result model is used as a model property (not as a paging
|
|
1060
|
-
// operation response), it must stay public (no "_" prefix) because users
|
|
1061
|
-
// interact with it directly through the property.
|
|
1062
|
-
trackPagedModelUsedAsProperty(context, property.type);
|
|
1063
1047
|
}
|
|
1064
1048
|
if (type.discriminatedSubtypes) {
|
|
1065
1049
|
for (const subType of Object.values(type.discriminatedSubtypes)) {
|