@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
|
@@ -1,152 +1,20 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { PackageCommonInfoConfig
|
|
4
|
+
import { PackageCommonInfoConfig } from "./package-common.js";
|
|
5
5
|
|
|
6
6
|
export interface AzurePackageInfoConfig extends PackageCommonInfoConfig {
|
|
7
7
|
hasLro: boolean;
|
|
8
|
-
specSource: "Swagger" | "TypeSpec";
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Build the common package.json config for an Azure package.
|
|
13
12
|
*/
|
|
14
|
-
export function getAzureCommonPackageInfo(
|
|
13
|
+
export function getAzureCommonPackageInfo(_config: AzurePackageInfoConfig) {
|
|
15
14
|
return {
|
|
16
15
|
keywords: ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
|
|
17
16
|
author: "Microsoft Corporation",
|
|
18
17
|
license: "MIT",
|
|
19
|
-
...getAzureCjsCommonInfo(config),
|
|
20
|
-
...getAzureEsmCommonInfo(config),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Builds the common dependencies for an Azure package.
|
|
26
|
-
*/
|
|
27
|
-
export function getAzurePackageDependencies({
|
|
28
|
-
hasLro,
|
|
29
|
-
specSource,
|
|
30
|
-
dependencies,
|
|
31
|
-
}: AzurePackageInfoConfig) {
|
|
32
|
-
let azureDependencies: Record<string, string> = {
|
|
33
|
-
...dependencies,
|
|
34
|
-
"@azure-rest/core-client": specSource === "Swagger" ? "^1.4.0" : "^2.3.1",
|
|
35
|
-
"@azure/core-auth": "^1.6.0",
|
|
36
|
-
"@azure/core-rest-pipeline": "^1.5.0",
|
|
37
|
-
"@azure/logger": "^1.0.0",
|
|
38
|
-
tslib: "^2.6.2",
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
if (hasLro) {
|
|
42
|
-
azureDependencies = {
|
|
43
|
-
...azureDependencies,
|
|
44
|
-
"@azure/core-lro": "^3.1.0",
|
|
45
|
-
"@azure/abort-controller": "^2.1.2",
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return azureDependencies;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function getAzureCjsCommonInfo({
|
|
53
|
-
withTests,
|
|
54
|
-
withSamples,
|
|
55
|
-
name,
|
|
56
|
-
nameWithoutScope,
|
|
57
|
-
moduleKind,
|
|
58
|
-
}: AzurePackageInfoConfig) {
|
|
59
|
-
if (moduleKind !== "cjs") {
|
|
60
|
-
return {};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
files: [
|
|
65
|
-
"dist/",
|
|
66
|
-
"!dist/**/*.d.*ts.map",
|
|
67
|
-
withTests || withSamples ? "dist-esm/src/" : "dist-esm/",
|
|
68
|
-
`types/${nameWithoutScope ?? name}.d.ts`,
|
|
69
|
-
"README.md",
|
|
70
|
-
"LICENSE",
|
|
71
|
-
],
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getAzureEsmCommonInfo({ moduleKind }: AzurePackageInfoConfig) {
|
|
76
|
-
if (moduleKind !== "esm") {
|
|
77
|
-
return {};
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
18
|
files: ["dist/", "!dist/**/*.d.*ts.map", "README.md", "LICENSE"],
|
|
81
19
|
};
|
|
82
20
|
}
|
|
83
|
-
|
|
84
|
-
function getAzurePackageCjsDevDependencies({ moduleKind, withTests }: AzurePackageInfoConfig) {
|
|
85
|
-
if (moduleKind !== "cjs") {
|
|
86
|
-
return {};
|
|
87
|
-
}
|
|
88
|
-
const testDevDependencies = {
|
|
89
|
-
"@azure-tools/test-credential": "^1.1.0",
|
|
90
|
-
"@azure-tools/test-recorder": "^3.0.0",
|
|
91
|
-
nyc: "^15.1.0",
|
|
92
|
-
mocha: "^11.0.2",
|
|
93
|
-
"@types/mocha": "^10.0.0",
|
|
94
|
-
"@types/chai": "^4.2.8",
|
|
95
|
-
chai: "^4.2.0",
|
|
96
|
-
"karma-chrome-launcher": "^3.0.0",
|
|
97
|
-
"karma-coverage": "^2.0.0",
|
|
98
|
-
"karma-env-preprocessor": "^0.1.1",
|
|
99
|
-
"karma-firefox-launcher": "^2.1.3",
|
|
100
|
-
"karma-junit-reporter": "^2.0.1",
|
|
101
|
-
"karma-mocha-reporter": "^2.2.5",
|
|
102
|
-
"karma-mocha": "^2.0.1",
|
|
103
|
-
"karma-source-map-support": "~1.4.0",
|
|
104
|
-
"karma-sourcemap-loader": "^0.4.0",
|
|
105
|
-
karma: "^6.2.0",
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
...(withTests && testDevDependencies),
|
|
110
|
-
"source-map-support": "^0.5.9",
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function getAzurePackageEsmDevDependencies({ moduleKind, withTests }: AzurePackageInfoConfig) {
|
|
115
|
-
if (moduleKind !== "esm") {
|
|
116
|
-
return {};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let devDependencies: Record<string, string> = {};
|
|
120
|
-
|
|
121
|
-
if (withTests) {
|
|
122
|
-
devDependencies = {
|
|
123
|
-
...devDependencies,
|
|
124
|
-
"@vitest/browser-playwright": "^4.0.6",
|
|
125
|
-
"@vitest/coverage-istanbul": "^4.0.6",
|
|
126
|
-
playwright: "^1.41.2",
|
|
127
|
-
vitest: "^4.0.6",
|
|
128
|
-
"@azure-tools/test-credential": "^2.0.0",
|
|
129
|
-
"@azure-tools/test-recorder": "^4.0.0",
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return devDependencies;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function getAzurePackageDevDependencies(config: AzurePackageInfoConfig) {
|
|
137
|
-
const esmDevDependencies = getAzurePackageEsmDevDependencies(config);
|
|
138
|
-
const cjsDevDependencies = getAzurePackageCjsDevDependencies(config);
|
|
139
|
-
|
|
140
|
-
const testDevDependencies = {
|
|
141
|
-
"@azure/identity": "^4.2.1",
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
dotenv: "^16.0.0",
|
|
146
|
-
...getCommonPackageDevDependencies(config),
|
|
147
|
-
...(config.withTests && testDevDependencies),
|
|
148
|
-
...(config.specSource === "Swagger" && { autorest: "latest" }),
|
|
149
|
-
...esmDevDependencies,
|
|
150
|
-
...cjsDevDependencies,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
@@ -6,7 +6,6 @@ import { getCommonPackageScripts, getPackageCommonInfo } from "./package-common.
|
|
|
6
6
|
|
|
7
7
|
export interface AzureMonorepoInfoConfig extends AzurePackageInfoConfig {
|
|
8
8
|
monorepoPackageDirectory?: string;
|
|
9
|
-
clientFilePaths: string[];
|
|
10
9
|
clientContextPaths?: string[];
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -74,9 +73,6 @@ export function getAzureMonorepoDependencies(config: AzureMonorepoInfoConfig) {
|
|
|
74
73
|
eslint: "catalog:",
|
|
75
74
|
prettier: "catalog:",
|
|
76
75
|
rimraf: "catalog:",
|
|
77
|
-
...(config.specSource === "Swagger" && {
|
|
78
|
-
autorest: "catalog:",
|
|
79
|
-
}),
|
|
80
76
|
...testDeps,
|
|
81
77
|
},
|
|
82
78
|
};
|
|
@@ -129,20 +125,9 @@ function getSampleMetadata({ name, version, withSamples }: AzureMonorepoInfoConf
|
|
|
129
125
|
};
|
|
130
126
|
}
|
|
131
127
|
|
|
132
|
-
function addSwaggerMetadata(metadata: Record<string, any>, specSource: "Swagger" | "TypeSpec") {
|
|
133
|
-
if (specSource !== "Swagger") {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
metadata["constantPaths"].push({
|
|
138
|
-
path: "swagger/README.md",
|
|
139
|
-
prefix: "package-version",
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
128
|
function getAzureMonorepoScripts(config: AzureMonorepoInfoConfig) {
|
|
144
|
-
const esmScripts = getEsmScripts(
|
|
145
|
-
const skipLinting = config.azureArm
|
|
129
|
+
const esmScripts = getEsmScripts();
|
|
130
|
+
const skipLinting = config.azureArm;
|
|
146
131
|
const buildSampleScripts = config.azureArm
|
|
147
132
|
? "tsc -p config/tsconfig.samples.json && dev-tool samples publish -f"
|
|
148
133
|
: "tsc -p config/tsconfig.samples.json";
|
|
@@ -170,11 +155,7 @@ function getAzureMonorepoScripts(config: AzureMonorepoInfoConfig) {
|
|
|
170
155
|
};
|
|
171
156
|
}
|
|
172
157
|
|
|
173
|
-
function getEsmScripts(
|
|
174
|
-
if (moduleKind !== "esm") {
|
|
175
|
-
return {};
|
|
176
|
-
}
|
|
177
|
-
|
|
158
|
+
function getEsmScripts() {
|
|
178
159
|
return {
|
|
179
160
|
build: "npm run clean && dev-tool run build-package && dev-tool run extract-api",
|
|
180
161
|
"test:node": "dev-tool run test:vitest",
|
|
@@ -186,8 +167,7 @@ function getMetadataInfo(config: AzureMonorepoInfoConfig) {
|
|
|
186
167
|
const metadata: Record<string, any> = {
|
|
187
168
|
constantPaths: [],
|
|
188
169
|
};
|
|
189
|
-
const paths = config.
|
|
190
|
-
addSwaggerMetadata(metadata, config.specSource);
|
|
170
|
+
const paths = config.clientContextPaths;
|
|
191
171
|
for (const path of paths ?? []) {
|
|
192
172
|
metadata["constantPaths"].push({
|
|
193
173
|
path: path,
|
|
@@ -6,17 +6,14 @@ export interface PackageCommonInfoConfig {
|
|
|
6
6
|
nameWithoutScope?: string;
|
|
7
7
|
version: string;
|
|
8
8
|
description: string;
|
|
9
|
-
moduleKind: "esm" | "cjs";
|
|
10
9
|
withTests: boolean;
|
|
11
10
|
withSamples: boolean;
|
|
12
11
|
exports?: Record<string, any>;
|
|
13
12
|
dependencies?: Record<string, string>;
|
|
14
13
|
azureArm?: boolean;
|
|
15
|
-
isModularLibrary?: boolean;
|
|
16
|
-
azureSdkForJs?: boolean;
|
|
17
14
|
/**
|
|
18
15
|
* When true, generates React Native build targets (dist/react-native, exports condition).
|
|
19
|
-
* Defaults to false.
|
|
16
|
+
* Defaults to false.
|
|
20
17
|
*/
|
|
21
18
|
generateReactNativeTarget?: boolean;
|
|
22
19
|
}
|
|
@@ -32,7 +29,7 @@ export function getPackageCommonInfo(config: PackageCommonInfoConfig) {
|
|
|
32
29
|
version,
|
|
33
30
|
description,
|
|
34
31
|
engines: {
|
|
35
|
-
node: ">=
|
|
32
|
+
node: ">=22.0.0",
|
|
36
33
|
},
|
|
37
34
|
sideEffects: false,
|
|
38
35
|
autoPublish: false,
|
|
@@ -40,110 +37,34 @@ export function getPackageCommonInfo(config: PackageCommonInfoConfig) {
|
|
|
40
37
|
};
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
export const commonPackageDependencies = {
|
|
44
|
-
tslib: "^2.6.2",
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export function getCommonPackageDevDependencies(config: PackageCommonInfoConfig) {
|
|
48
|
-
return {
|
|
49
|
-
"@types/node": "^20.0.0",
|
|
50
|
-
eslint: "^9.9.0",
|
|
51
|
-
typescript: "~5.8.2",
|
|
52
|
-
...getEsmDevDependencies(config),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getEsmDevDependencies({ moduleKind, azureSdkForJs }: PackageCommonInfoConfig) {
|
|
57
|
-
if (moduleKind !== "esm") {
|
|
58
|
-
return {};
|
|
59
|
-
}
|
|
60
|
-
// Azure monorepo packages use warp (invoked via dev-tool), no tshy needed
|
|
61
|
-
if (azureSdkForJs) {
|
|
62
|
-
return {};
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
tshy: "^2.0.0",
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
40
|
function getEntryPointInformation(config: PackageCommonInfoConfig) {
|
|
70
|
-
|
|
71
|
-
...getCjsEntrypointInformation(config),
|
|
72
|
-
...getEsmEntrypointInformation(config),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function getCjsEntrypointInformation({
|
|
77
|
-
name,
|
|
78
|
-
nameWithoutScope,
|
|
79
|
-
moduleKind,
|
|
80
|
-
withTests,
|
|
81
|
-
withSamples,
|
|
82
|
-
}: PackageCommonInfoConfig) {
|
|
83
|
-
if (moduleKind !== "cjs") {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const types =
|
|
88
|
-
withTests || withSamples
|
|
89
|
-
? `./types/src/${nameWithoutScope ?? name}.d.ts`
|
|
90
|
-
: `./types/${nameWithoutScope ?? name}.d.ts`;
|
|
91
|
-
const main = withTests || withSamples ? "dist/src/index.js" : "dist/index.js";
|
|
92
|
-
return {
|
|
93
|
-
main,
|
|
94
|
-
module: withTests || withSamples ? "./dist-esm/src/index.js" : "./dist-esm/index.js",
|
|
95
|
-
types,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function getEsmEntrypointInformation(config: PackageCommonInfoConfig) {
|
|
100
|
-
if (config.moduleKind !== "esm") {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Azure monorepo packages use warp instead of tshy
|
|
105
|
-
if (config.azureSdkForJs) {
|
|
106
|
-
const result: Record<string, any> = {
|
|
107
|
-
type: "module",
|
|
108
|
-
main: "./dist/commonjs/index.js",
|
|
109
|
-
module: "./dist/esm/index.js",
|
|
110
|
-
types: "./dist/commonjs/index.d.ts",
|
|
111
|
-
browser: "./dist/browser/index.js",
|
|
112
|
-
imports: {
|
|
113
|
-
"#platform/*": {
|
|
114
|
-
browser: "./src/*-browser.mts",
|
|
115
|
-
default: "./src/*.ts",
|
|
116
|
-
} as Record<string, string>,
|
|
117
|
-
},
|
|
118
|
-
exports: resolveWarpExports(config.exports, config.generateReactNativeTarget),
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
if (config.generateReactNativeTarget) {
|
|
122
|
-
result["react-native"] = "./dist/react-native/index.js";
|
|
123
|
-
(result["imports"]["#platform/*"] as Record<string, string>)["react-native"] =
|
|
124
|
-
"./src/*-react-native.mts";
|
|
125
|
-
// Reorder so react-native comes before default
|
|
126
|
-
const importsEntry = result["imports"]["#platform/*"] as Record<string, string>;
|
|
127
|
-
result["imports"]["#platform/*"] = {
|
|
128
|
-
browser: importsEntry["browser"],
|
|
129
|
-
"react-native": importsEntry["react-native"],
|
|
130
|
-
default: importsEntry["default"],
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return result;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Non-monorepo packages use tshy which manages polyfill resolution
|
|
138
|
-
// via esmDialects — do NOT add imports here.
|
|
41
|
+
// Azure monorepo packages use warp.
|
|
139
42
|
const result: Record<string, any> = {
|
|
140
|
-
tshy: getTshyConfig(config),
|
|
141
43
|
type: "module",
|
|
44
|
+
main: "./dist/commonjs/index.js",
|
|
45
|
+
module: "./dist/esm/index.js",
|
|
46
|
+
types: "./dist/commonjs/index.d.ts",
|
|
142
47
|
browser: "./dist/browser/index.js",
|
|
48
|
+
imports: {
|
|
49
|
+
"#platform/*": {
|
|
50
|
+
browser: "./src/*-browser.mts",
|
|
51
|
+
default: "./src/*.ts",
|
|
52
|
+
} as Record<string, string>,
|
|
53
|
+
},
|
|
54
|
+
exports: resolveWarpExports(config.exports, config.generateReactNativeTarget),
|
|
143
55
|
};
|
|
144
56
|
|
|
145
57
|
if (config.generateReactNativeTarget) {
|
|
146
58
|
result["react-native"] = "./dist/react-native/index.js";
|
|
59
|
+
(result["imports"]["#platform/*"] as Record<string, string>)["react-native"] =
|
|
60
|
+
"./src/*-react-native.mts";
|
|
61
|
+
// Reorder so react-native comes before default
|
|
62
|
+
const importsEntry = result["imports"]["#platform/*"] as Record<string, string>;
|
|
63
|
+
result["imports"]["#platform/*"] = {
|
|
64
|
+
browser: importsEntry["browser"],
|
|
65
|
+
"react-native": importsEntry["react-native"],
|
|
66
|
+
default: importsEntry["default"],
|
|
67
|
+
};
|
|
147
68
|
}
|
|
148
69
|
|
|
149
70
|
return result;
|
|
@@ -205,25 +126,6 @@ export function resolveWarpExports(
|
|
|
205
126
|
return exports;
|
|
206
127
|
}
|
|
207
128
|
|
|
208
|
-
export function getTshyConfig(config: PackageCommonInfoConfig) {
|
|
209
|
-
const { exports = {} } = config;
|
|
210
|
-
const esmDialects = config.generateReactNativeTarget ? ["browser", "react-native"] : ["browser"];
|
|
211
|
-
const tshyConfig: Record<string, any> = {
|
|
212
|
-
exports: {
|
|
213
|
-
"./package.json": "./package.json",
|
|
214
|
-
".": "./src/index.ts",
|
|
215
|
-
...exports,
|
|
216
|
-
},
|
|
217
|
-
dialects: ["esm", "commonjs"],
|
|
218
|
-
esmDialects,
|
|
219
|
-
selfLink: false,
|
|
220
|
-
};
|
|
221
|
-
if (config.azureSdkForJs) {
|
|
222
|
-
tshyConfig["project"] = "../../../tsconfig.src.build.json";
|
|
223
|
-
}
|
|
224
|
-
return tshyConfig;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
129
|
export function getCommonPackageScripts() {
|
|
228
130
|
return {
|
|
229
131
|
clean: "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
|
|
@@ -4,15 +4,12 @@ import hbs from "handlebars";
|
|
|
4
4
|
import { RLCModel } from "../interfaces.js";
|
|
5
5
|
import { recordedClientContent } from "./template.js";
|
|
6
6
|
|
|
7
|
-
export function buildRecordedClientFile(
|
|
7
|
+
export function buildRecordedClientFile(_model: RLCModel) {
|
|
8
8
|
const recordedClientFileContents = hbs.compile(recordedClientContent, {
|
|
9
9
|
noEscape: true,
|
|
10
10
|
});
|
|
11
11
|
return {
|
|
12
12
|
path: "test/public/utils/recordedClient.ts",
|
|
13
|
-
content: recordedClientFileContents({
|
|
14
|
-
isEsm: model.options?.moduleKind === "esm",
|
|
15
|
-
isCjs: model.options?.moduleKind === "cjs",
|
|
16
|
-
}),
|
|
13
|
+
content: recordedClientFileContents({}),
|
|
17
14
|
};
|
|
18
15
|
}
|
|
@@ -4,12 +4,9 @@ import hbs from "handlebars";
|
|
|
4
4
|
import { RLCModel } from "../interfaces.js";
|
|
5
5
|
import { sampleTestContent } from "./template.js";
|
|
6
6
|
|
|
7
|
-
export function buildSampleTest(
|
|
7
|
+
export function buildSampleTest(_model: RLCModel) {
|
|
8
8
|
return {
|
|
9
9
|
path: "test/public/sampleTest.spec.ts",
|
|
10
|
-
content: hbs.compile(sampleTestContent, { noEscape: true })({
|
|
11
|
-
isEsm: model.options?.moduleKind === "esm",
|
|
12
|
-
isCjs: model.options?.moduleKind === "cjs",
|
|
13
|
-
}),
|
|
10
|
+
content: hbs.compile(sampleTestContent, { noEscape: true })({}),
|
|
14
11
|
};
|
|
15
12
|
}
|
|
@@ -5,22 +5,18 @@ import { getClientName } from "../helpers/name-constructors.js";
|
|
|
5
5
|
import { RLCModel } from "../interfaces.js";
|
|
6
6
|
import { snippetsContent } from "./template.js";
|
|
7
7
|
|
|
8
|
-
export function buildSnippets(model: RLCModel, clientName?: string
|
|
9
|
-
const azureSdkForJsInfo = azureSdkForJs ? azureSdkForJs : model.options?.azureSdkForJs;
|
|
8
|
+
export function buildSnippets(model: RLCModel, clientName?: string) {
|
|
10
9
|
// to keep the same config for azure scope in buildReadmeFile.ts
|
|
11
10
|
if (
|
|
12
11
|
(model?.options?.packageDetails?.scopeName === "azure" ||
|
|
13
12
|
model?.options?.packageDetails?.scopeName === "azure-rest") &&
|
|
14
|
-
model.options.addCredentials
|
|
15
|
-
azureSdkForJsInfo
|
|
13
|
+
model.options.addCredentials
|
|
16
14
|
) {
|
|
17
15
|
return {
|
|
18
16
|
path: "test/snippets.spec.ts",
|
|
19
17
|
content: hbs.compile(snippetsContent, { noEscape: true })({
|
|
20
18
|
clientClassName: clientName ? clientName : getClientName(model),
|
|
21
19
|
azureArm: model.options?.azureArm,
|
|
22
|
-
azureSdkForJs: azureSdkForJsInfo,
|
|
23
|
-
isModularLibrary: model.options.isModularLibrary,
|
|
24
20
|
hasSubscriptionId: model.options.hasSubscriptionId,
|
|
25
21
|
}),
|
|
26
22
|
};
|
|
@@ -128,18 +128,11 @@ module.exports = function (config) {
|
|
|
128
128
|
|
|
129
129
|
export const recordedClientContent = `
|
|
130
130
|
|
|
131
|
-
{{#if isEsm}}
|
|
132
131
|
import {
|
|
133
132
|
Recorder,
|
|
134
133
|
RecorderStartOptions,
|
|
135
134
|
VitestTestContext,
|
|
136
135
|
} from "@azure-tools/test-recorder";
|
|
137
|
-
{{/if}}
|
|
138
|
-
|
|
139
|
-
{{#if isCjs}}
|
|
140
|
-
import { Context } from "mocha";
|
|
141
|
-
import { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder";
|
|
142
|
-
{{/if}}
|
|
143
136
|
|
|
144
137
|
const replaceableVariables: Record<string, string> = {
|
|
145
138
|
SUBSCRIPTION_ID: "azure_subscription_id"
|
|
@@ -154,25 +147,14 @@ const recorderEnvSetup: RecorderStartOptions = {
|
|
|
154
147
|
* Should be called first in the test suite to make sure environment variables are
|
|
155
148
|
* read before they are being used.
|
|
156
149
|
*/
|
|
157
|
-
{{#if isEsm}}
|
|
158
150
|
export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
|
|
159
151
|
const recorder = new Recorder(context);
|
|
160
152
|
await recorder.start(recorderEnvSetup);
|
|
161
153
|
return recorder;
|
|
162
154
|
}
|
|
163
|
-
{{/if}}
|
|
164
|
-
|
|
165
|
-
{{#if isCjs}}
|
|
166
|
-
export async function createRecorder(context: Context): Promise<Recorder> {
|
|
167
|
-
const recorder = new Recorder(context.currentTest);
|
|
168
|
-
await recorder.start(recorderEnvSetup);
|
|
169
|
-
return recorder;
|
|
170
|
-
}
|
|
171
|
-
{{/if}}
|
|
172
155
|
`;
|
|
173
156
|
|
|
174
157
|
export const sampleTestContent = `
|
|
175
|
-
{{#if isEsm}}
|
|
176
158
|
// import { Recorder } from "@azure-tools/test-recorder";
|
|
177
159
|
// import { createRecorder } from "./utils/recordedClient.js";
|
|
178
160
|
import { assert,
|
|
@@ -181,24 +163,12 @@ import { assert,
|
|
|
181
163
|
it,
|
|
182
164
|
describe
|
|
183
165
|
} from "vitest";
|
|
184
|
-
{{/if}}
|
|
185
|
-
|
|
186
|
-
{{#if isCjs}}
|
|
187
|
-
// import { Recorder } from "@azure-tools/test-recorder";
|
|
188
|
-
import { assert } from "chai";
|
|
189
|
-
// import { createRecorder } from "./utils/recordedClient{{#if isModularLibrary}}.js{{/if}}";
|
|
190
|
-
// import { Context } from "mocha";
|
|
191
|
-
{{/if}}
|
|
192
166
|
|
|
193
167
|
describe("My test", () => {
|
|
194
168
|
// let recorder: Recorder;
|
|
195
169
|
|
|
196
|
-
// beforeEach(async function(
|
|
197
|
-
{{#if isEsm}}
|
|
170
|
+
// beforeEach(async function(ctx) {
|
|
198
171
|
// recorder = await createRecorder(ctx);
|
|
199
|
-
{{else}}
|
|
200
|
-
// recorder = await createRecorder(this);
|
|
201
|
-
{{/if}}
|
|
202
172
|
// });
|
|
203
173
|
|
|
204
174
|
// afterEach(async function() {
|
|
@@ -212,15 +182,12 @@ describe("My test", () => {
|
|
|
212
182
|
`;
|
|
213
183
|
|
|
214
184
|
export const snippetsContent = `
|
|
215
|
-
{{#if isModularLibrary}}
|
|
216
185
|
import { {{ clientClassName }} } from "../src/index.js";
|
|
217
186
|
import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity";
|
|
218
|
-
{{/if}}
|
|
219
187
|
import { setLogLevel } from "@azure/logger";
|
|
220
188
|
import { describe, it } from "vitest";
|
|
221
189
|
|
|
222
190
|
describe("snippets", () => {
|
|
223
|
-
{{#if isModularLibrary}}
|
|
224
191
|
it("ReadmeSampleCreateClient_Node", async () => {
|
|
225
192
|
{{#if azureArm}}
|
|
226
193
|
{{#if hasSubscriptionId}}
|
|
@@ -254,7 +221,6 @@ describe("snippets", () => {
|
|
|
254
221
|
const client = new {{ clientClassName }}("<endpoint>", credential);
|
|
255
222
|
{{/if}}
|
|
256
223
|
});
|
|
257
|
-
{{/if}}
|
|
258
224
|
|
|
259
225
|
it("SetLogLevel", async () => {
|
|
260
226
|
setLogLevel("info");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getHttpOperationWithCache, SdkClient } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import { HelperFunctionDetails
|
|
2
|
+
import { HelperFunctionDetails } from "../rlc-common/index.js";
|
|
3
3
|
import { listOperationsUnderRLCClient } from "../utils/client-utils.js";
|
|
4
4
|
import { SdkContext } from "../utils/interfaces.js";
|
|
5
5
|
import { getCollectionFormat } from "../utils/model-utils.js";
|
|
@@ -13,17 +13,8 @@ import {
|
|
|
13
13
|
export function transformHelperFunctionDetails(
|
|
14
14
|
client: SdkClient,
|
|
15
15
|
dpgContext: SdkContext,
|
|
16
|
-
flavor?: PackageFlavor,
|
|
17
16
|
): HelperFunctionDetails {
|
|
18
17
|
const serializeInfo = extractSpecialSerializeInfo(client, dpgContext);
|
|
19
|
-
// Disable paging and long running for non-Azure clients.
|
|
20
|
-
if (flavor !== "azure") {
|
|
21
|
-
return {
|
|
22
|
-
hasLongRunning: false,
|
|
23
|
-
hasPaging: false,
|
|
24
|
-
...serializeInfo,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
18
|
|
|
28
19
|
const annotationDetails = {
|
|
29
20
|
hasLongRunning: hasPollingOperations(client, dpgContext),
|
|
@@ -78,7 +78,7 @@ export function transformSchemas(client: SdkClient, dpgContext: SdkContext) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
function transformHostParameters() {
|
|
81
|
-
const serviceNs = getDefaultService(program
|
|
81
|
+
const serviceNs = getDefaultService(program)?.type;
|
|
82
82
|
if (serviceNs) {
|
|
83
83
|
const host = getServers(program, serviceNs);
|
|
84
84
|
if (host && host?.[0] && host?.[0]?.parameters) {
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { SdkClient } from "@azure-tools/typespec-client-generator-core";
|
|
5
|
-
import { getDoc } from "@typespec/compiler";
|
|
5
|
+
import { getDoc, joinPaths } from "@typespec/compiler";
|
|
6
6
|
import { getServers } from "@typespec/http";
|
|
7
|
-
import * as path from "path";
|
|
8
7
|
import {
|
|
9
8
|
buildRuntimeImports,
|
|
10
9
|
Imports,
|
|
@@ -19,7 +18,6 @@ import {
|
|
|
19
18
|
RLCOptions,
|
|
20
19
|
Schema,
|
|
21
20
|
SchemaContext,
|
|
22
|
-
transformSampleGroups,
|
|
23
21
|
UrlInfo,
|
|
24
22
|
} from "../rlc-common/index.js";
|
|
25
23
|
import { SdkContext } from "../utils/interfaces.js";
|
|
@@ -47,19 +45,14 @@ export async function transformRLCModel(
|
|
|
47
45
|
const program = dpgContext.program;
|
|
48
46
|
const options: RLCOptions = dpgContext.rlcOptions!;
|
|
49
47
|
const rlcSourceDir = dpgContext.generationPathDetail?.rlcSourcesDir;
|
|
50
|
-
const srcPath =
|
|
48
|
+
const srcPath = joinPaths(
|
|
51
49
|
dpgContext.generationPathDetail?.rlcSourcesDir ?? "",
|
|
52
50
|
options.batch && options.batch.length > 1
|
|
53
51
|
? normalizeName(client.name.replace("Client", ""), NameType.File)
|
|
54
52
|
: "",
|
|
55
53
|
);
|
|
56
54
|
const libraryName = normalizeName(
|
|
57
|
-
options.batch
|
|
58
|
-
? client.name
|
|
59
|
-
: (options?.title ??
|
|
60
|
-
client.name ??
|
|
61
|
-
getDefaultService(program, options.isModularLibrary)?.title ??
|
|
62
|
-
""),
|
|
55
|
+
options.batch ? client.name : (client.name ?? getDefaultService(program)?.title ?? ""),
|
|
63
56
|
NameType.Class,
|
|
64
57
|
);
|
|
65
58
|
const importSet = initInternalImports();
|
|
@@ -73,7 +66,7 @@ export async function transformRLCModel(
|
|
|
73
66
|
importSet,
|
|
74
67
|
urlInfo?.apiVersionInfo,
|
|
75
68
|
);
|
|
76
|
-
const helperDetails = transformHelperFunctionDetails(client, dpgContext
|
|
69
|
+
const helperDetails = transformHelperFunctionDetails(client, dpgContext);
|
|
77
70
|
// Enrich client-level annotation detail
|
|
78
71
|
helperDetails.clientLroOverload = getClientLroOverload(paths);
|
|
79
72
|
|
|
@@ -92,17 +85,13 @@ export async function transformRLCModel(
|
|
|
92
85
|
telemetryOptions,
|
|
93
86
|
importInfo: {
|
|
94
87
|
internalImports: importSet,
|
|
95
|
-
runtimeImports: buildRuntimeImports(
|
|
88
|
+
runtimeImports: buildRuntimeImports(),
|
|
96
89
|
},
|
|
97
90
|
rlcSourceDir,
|
|
98
91
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
);
|
|
103
|
-
options.generateSample =
|
|
104
|
-
(options.generateSample === true || options.generateSample === undefined) &&
|
|
105
|
-
(model.sampleGroups ?? []).length > 0;
|
|
92
|
+
// RLC sample generation has been removed; modular samples are emitted separately,
|
|
93
|
+
// so the RLC model never carries sample groups.
|
|
94
|
+
options.generateSample = false;
|
|
106
95
|
return model;
|
|
107
96
|
}
|
|
108
97
|
|