@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,407 +0,0 @@
|
|
|
1
|
-
import { getClientName } from "./helpers/name-constructors.js";
|
|
2
|
-
import { NameType, camelCase, normalizeName } from "./helpers/name-utils.js";
|
|
3
|
-
import { isAzurePackage } from "./helpers/package-util.js";
|
|
4
|
-
import { buildSchemaObjectMap } from "./helpers/schema-helpers.js";
|
|
5
|
-
import { generateParameterTypeValue } from "./helpers/value-generation-util.js";
|
|
6
|
-
import {
|
|
7
|
-
OperationMethod,
|
|
8
|
-
OperationParameter,
|
|
9
|
-
PathMetadata,
|
|
10
|
-
Paths,
|
|
11
|
-
RLCModel,
|
|
12
|
-
RLCSampleDetail,
|
|
13
|
-
RLCSampleGroup,
|
|
14
|
-
SampleParameter,
|
|
15
|
-
SampleParameters,
|
|
16
|
-
Schema,
|
|
17
|
-
} from "./interfaces.js";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Transform the sample data based RLC detail e.g path, operations & schemas
|
|
21
|
-
* @param model RLC detail
|
|
22
|
-
* @param allowMockValue allow to mock value if not exist, currently we always generate mock value
|
|
23
|
-
* @returns Generated sample data or undefined if not support to generate
|
|
24
|
-
*/
|
|
25
|
-
export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
26
|
-
if (model.options?.multiClient || model.options?.isModularLibrary) {
|
|
27
|
-
// Not support to generate if multiple clients
|
|
28
|
-
// Not support to generate if modular libraries
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if ((model.sampleGroups && model.sampleGroups.length > 0) || !allowMockValue) {
|
|
32
|
-
// Skip to transform if already has sample data
|
|
33
|
-
// Skip to transform if not allow to mock value
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const rlcSampleGroups: RLCSampleGroup[] = [];
|
|
37
|
-
// Get all paths
|
|
38
|
-
const paths: Paths = model.paths;
|
|
39
|
-
const clientName = getClientName(model);
|
|
40
|
-
const clientInterfaceName = clientName.endsWith("Client")
|
|
41
|
-
? `${clientName}`
|
|
42
|
-
: `${clientName}Client`;
|
|
43
|
-
const defaultFactoryName = normalizeName(
|
|
44
|
-
camelCase(`create ${clientInterfaceName}`),
|
|
45
|
-
NameType.Method,
|
|
46
|
-
);
|
|
47
|
-
const packageName = model.options?.packageDetails?.name ?? "";
|
|
48
|
-
const methodParameterMap = buildMethodParamMap(model);
|
|
49
|
-
const schemaObjectMap = buildSchemaObjectMap(model);
|
|
50
|
-
for (const path in paths) {
|
|
51
|
-
const pathDetails = paths[path];
|
|
52
|
-
if (!pathDetails) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const methods = pathDetails.methods;
|
|
56
|
-
for (const method in methods) {
|
|
57
|
-
const importedDict: Record<string, Set<string>> = {};
|
|
58
|
-
const methodArray = methods[method];
|
|
59
|
-
if (!methodArray || methodArray.length === 0) {
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
const detail = methodArray[0];
|
|
63
|
-
if (!detail) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const operatonConcante = getOperationConcate(
|
|
67
|
-
detail.operationName,
|
|
68
|
-
pathDetails.operationGroupName,
|
|
69
|
-
model.options?.sourceFrom,
|
|
70
|
-
);
|
|
71
|
-
const operationPrefix = normalizeName(
|
|
72
|
-
camelCase(transformSpecialLetterToSpace(operatonConcante)),
|
|
73
|
-
NameType.Operation,
|
|
74
|
-
);
|
|
75
|
-
const sampleGroup: RLCSampleGroup = {
|
|
76
|
-
filename: `${operationPrefix}Sample`,
|
|
77
|
-
defaultFactoryName,
|
|
78
|
-
clientPackageName: packageName,
|
|
79
|
-
samples: [],
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// initialize the sample
|
|
83
|
-
const sample: RLCSampleDetail = {
|
|
84
|
-
description: `call operation ${detail.operationName}`,
|
|
85
|
-
name: `${operationPrefix}Sample`,
|
|
86
|
-
path,
|
|
87
|
-
defaultFactoryName,
|
|
88
|
-
clientParamAssignments: [],
|
|
89
|
-
pathParamAssignments: [],
|
|
90
|
-
methodParamAssignments: [],
|
|
91
|
-
clientParamNames: "",
|
|
92
|
-
pathParamNames: "",
|
|
93
|
-
methodParamNames: "",
|
|
94
|
-
method,
|
|
95
|
-
isLRO: detail.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
96
|
-
isPaging: detail.operationHelperDetail?.isPaging ?? false,
|
|
97
|
-
useLegacyLro: false,
|
|
98
|
-
};
|
|
99
|
-
// client-level, path-level and method-level parameter preparation
|
|
100
|
-
const parameters: SampleParameters = {
|
|
101
|
-
client: convertClientLevelParameters(model, importedDict, schemaObjectMap),
|
|
102
|
-
path: convertPathLevelParameters(pathDetails, path, schemaObjectMap),
|
|
103
|
-
method: convertMethodLevelParameters(
|
|
104
|
-
methodArray,
|
|
105
|
-
schemaObjectMap,
|
|
106
|
-
methodParameterMap.get(operatonConcante),
|
|
107
|
-
),
|
|
108
|
-
};
|
|
109
|
-
// enrich parameter details
|
|
110
|
-
enrichParameterInSample(sample, parameters);
|
|
111
|
-
// enrich LRO and pagination info
|
|
112
|
-
enrichLROAndPagingInSample(detail, importedDict, packageName);
|
|
113
|
-
sampleGroup.samples.push(sample);
|
|
114
|
-
rlcSampleGroups.push(sampleGroup);
|
|
115
|
-
enrichImportedString(sampleGroup, importedDict, defaultFactoryName, packageName);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return rlcSampleGroups;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function enrichLROAndPagingInSample(
|
|
122
|
-
operation: OperationMethod,
|
|
123
|
-
importedDict: Record<string, Set<string>>,
|
|
124
|
-
packageName: string,
|
|
125
|
-
) {
|
|
126
|
-
const isLRO = operation.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
127
|
-
isPaging = operation.operationHelperDetail?.isPaging ?? false;
|
|
128
|
-
if (isPaging) {
|
|
129
|
-
if (isLRO) {
|
|
130
|
-
// TODO: report warning this is not supported
|
|
131
|
-
}
|
|
132
|
-
addValueInImportedDict(packageName, "paginate", importedDict);
|
|
133
|
-
} else if (isLRO) {
|
|
134
|
-
addValueInImportedDict(packageName, "getLongRunningPoller", importedDict);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function transformSpecialLetterToSpace(str: string) {
|
|
139
|
-
if (!str) {
|
|
140
|
-
return str;
|
|
141
|
-
}
|
|
142
|
-
return str
|
|
143
|
-
.replace(/_/g, " ")
|
|
144
|
-
.replace(/\//g, " Or ")
|
|
145
|
-
.replace(/,|\.|\(|\)/g, " ")
|
|
146
|
-
.replace("'s ", " ");
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function enrichImportedString(
|
|
150
|
-
sampleGroup: RLCSampleGroup,
|
|
151
|
-
importedDict: Record<string, Set<string>>,
|
|
152
|
-
defaultFactoryName: string,
|
|
153
|
-
packageName: string,
|
|
154
|
-
) {
|
|
155
|
-
const importedTypes: string[] = [];
|
|
156
|
-
if (!importedDict[packageName] || importedDict[packageName].size === 0) {
|
|
157
|
-
importedTypes.push(`import ${defaultFactoryName} from "${packageName}";`);
|
|
158
|
-
}
|
|
159
|
-
for (const key in importedDict) {
|
|
160
|
-
const importedSet = importedDict[key];
|
|
161
|
-
if (!importedSet) {
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
const values = Array.from(importedSet).join(", ");
|
|
165
|
-
const hasDefaultFactory = key === packageName ? `${defaultFactoryName},` : "";
|
|
166
|
-
importedTypes.push(`import ${hasDefaultFactory} { ${values} } from "${key}";`);
|
|
167
|
-
}
|
|
168
|
-
sampleGroup.importedTypes = importedTypes;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function enrichParameterInSample(sample: RLCSampleDetail, parameters: SampleParameters) {
|
|
172
|
-
sample.clientParamAssignments = getAssignmentStrArray(parameters.client);
|
|
173
|
-
sample.clientParamNames = getContactParameterNames(parameters.client);
|
|
174
|
-
sample.pathParamAssignments = getAssignmentStrArray(parameters.path);
|
|
175
|
-
sample.pathParamNames = getContactParameterNames(parameters.path);
|
|
176
|
-
// Directly apply the inline option value as method parameter
|
|
177
|
-
sample.methodParamNames = parameters.method.length > 0 ? (parameters.method[0]?.value ?? "") : "";
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function getAssignmentStrArray(parameters: SampleParameter[]) {
|
|
181
|
-
return parameters.filter((p) => !!p.assignment).map((p) => p.assignment!);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function getContactParameterNames(parameters: SampleParameter[]) {
|
|
185
|
-
return parameters
|
|
186
|
-
.filter((p) => p.name != null)
|
|
187
|
-
.map((p) => p.name!)
|
|
188
|
-
.join(",");
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function convertClientLevelParameters(
|
|
192
|
-
model: RLCModel,
|
|
193
|
-
importedDict: Record<string, Set<string>>,
|
|
194
|
-
schemaMap: Map<string, Schema>,
|
|
195
|
-
): SampleParameter[] {
|
|
196
|
-
if (!model.options) {
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
const clientParams: SampleParameter[] = [];
|
|
200
|
-
const urlParameters = model?.urlInfo?.urlParameters?.filter(
|
|
201
|
-
// Do not include parameters with constant values in the signature, these should go in the options bag
|
|
202
|
-
(p) => p.value === undefined,
|
|
203
|
-
);
|
|
204
|
-
const {
|
|
205
|
-
addCredentials,
|
|
206
|
-
credentialScopes,
|
|
207
|
-
credentialKeyHeaderName,
|
|
208
|
-
customHttpAuthHeaderName,
|
|
209
|
-
flavor,
|
|
210
|
-
} = model.options;
|
|
211
|
-
const hasUrlParameter = !!urlParameters,
|
|
212
|
-
hasCredentials =
|
|
213
|
-
addCredentials && (credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName);
|
|
214
|
-
|
|
215
|
-
if (hasUrlParameter) {
|
|
216
|
-
// convert the host parameters in url
|
|
217
|
-
const clientParamAssignments = urlParameters.map((urlParameter) => {
|
|
218
|
-
const urlValue = generateParameterTypeValue(urlParameter.type, urlParameter.name, schemaMap);
|
|
219
|
-
const normalizedName = normalizeName(urlParameter.name, NameType.Parameter);
|
|
220
|
-
return {
|
|
221
|
-
name: normalizedName,
|
|
222
|
-
assignment: `const ${normalizedName} = ` + urlValue + `;`,
|
|
223
|
-
};
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
clientParams.push(...clientParamAssignments);
|
|
227
|
-
}
|
|
228
|
-
if (hasCredentials) {
|
|
229
|
-
// Currently only support token credential
|
|
230
|
-
const apiKeyCredentialPackage = isAzurePackage(model)
|
|
231
|
-
? "@azure/core-auth"
|
|
232
|
-
: "@typespec/ts-http-runtime";
|
|
233
|
-
const tokenCredentialPackage = isAzurePackage(model)
|
|
234
|
-
? "@azure/identity"
|
|
235
|
-
: "@typespec/ts-http-runtime";
|
|
236
|
-
if (credentialKeyHeaderName && isAzurePackage(model)) {
|
|
237
|
-
clientParams.push({
|
|
238
|
-
name: "credential",
|
|
239
|
-
assignment: `const credential = new AzureKeyCredential("{Your API key}");`,
|
|
240
|
-
});
|
|
241
|
-
addValueInImportedDict(apiKeyCredentialPackage, "AzureKeyCredential", importedDict);
|
|
242
|
-
} else if ((credentialKeyHeaderName && flavor !== "azure") || customHttpAuthHeaderName) {
|
|
243
|
-
clientParams.push({
|
|
244
|
-
name: "credential",
|
|
245
|
-
assignment: `const credential = { key: "{Your API key}"};`,
|
|
246
|
-
});
|
|
247
|
-
} else if (isAzurePackage(model)) {
|
|
248
|
-
clientParams.push({
|
|
249
|
-
name: "credential",
|
|
250
|
-
assignment: "const credential = new DefaultAzureCredential();",
|
|
251
|
-
});
|
|
252
|
-
addValueInImportedDict(tokenCredentialPackage, "DefaultAzureCredential", importedDict);
|
|
253
|
-
} else {
|
|
254
|
-
clientParams.push({
|
|
255
|
-
name: "credential",
|
|
256
|
-
assignment: `const credential = {getToken: () => Promise.resolve({ token: "{Your token}", expiresOnTimestamp: 0 })};`,
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return clientParams;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function convertPathLevelParameters(
|
|
264
|
-
pathDetail: PathMetadata,
|
|
265
|
-
path: string,
|
|
266
|
-
schemaMap: Map<string, Schema>,
|
|
267
|
-
): SampleParameter[] {
|
|
268
|
-
const pathItself = {
|
|
269
|
-
name: `"${path}"`,
|
|
270
|
-
};
|
|
271
|
-
const pathParams = (pathDetail || []).pathParameters.map((p) => {
|
|
272
|
-
const pathParam: SampleParameter = {
|
|
273
|
-
name: normalizeName(p.name, NameType.Parameter),
|
|
274
|
-
};
|
|
275
|
-
const value = generateParameterTypeValue(p.type, p.name, schemaMap);
|
|
276
|
-
pathParam.assignment = `const ${pathParam.name} =` + value + `;`;
|
|
277
|
-
return pathParam;
|
|
278
|
-
});
|
|
279
|
-
return [pathItself].concat(pathParams);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function convertMethodLevelParameters(
|
|
283
|
-
methods: OperationMethod[],
|
|
284
|
-
schemaMap: Map<string, Schema>,
|
|
285
|
-
operationParameter?: OperationParameter,
|
|
286
|
-
): SampleParameter[] {
|
|
287
|
-
if (
|
|
288
|
-
!methods ||
|
|
289
|
-
methods.length === 0 ||
|
|
290
|
-
!operationParameter ||
|
|
291
|
-
operationParameter.parameters.length === 0
|
|
292
|
-
) {
|
|
293
|
-
return [];
|
|
294
|
-
}
|
|
295
|
-
const rawMethodParams = operationParameter.parameters;
|
|
296
|
-
const method = methods[0];
|
|
297
|
-
const requestParameter = rawMethodParams[0];
|
|
298
|
-
if (!method || !requestParameter) {
|
|
299
|
-
return [];
|
|
300
|
-
}
|
|
301
|
-
const hasInputParams = !!rawMethodParams && rawMethodParams.length > 0,
|
|
302
|
-
requireParam = !method.hasOptionalOptions;
|
|
303
|
-
if (!hasInputParams && !requireParam) {
|
|
304
|
-
return [];
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const allSideAssignments = [],
|
|
308
|
-
querySideAssignments: string[] = [],
|
|
309
|
-
headerSideAssignments: string[] = [];
|
|
310
|
-
if (
|
|
311
|
-
!!requestParameter.body &&
|
|
312
|
-
requestParameter.body &&
|
|
313
|
-
requestParameter.body.body &&
|
|
314
|
-
requestParameter.body.body?.length > 0
|
|
315
|
-
) {
|
|
316
|
-
const body = requestParameter.body.body[0];
|
|
317
|
-
if (body) {
|
|
318
|
-
const bodyTypeName = body.typeName ?? body.type;
|
|
319
|
-
if (bodyTypeName !== "string" && body.oriSchema) {
|
|
320
|
-
schemaMap.set(bodyTypeName, body.oriSchema);
|
|
321
|
-
}
|
|
322
|
-
allSideAssignments.push(
|
|
323
|
-
` body: ` + generateParameterTypeValue(bodyTypeName, "body", schemaMap),
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
requestParameter.parameters
|
|
329
|
-
?.filter((p) => p.type === "query")
|
|
330
|
-
.forEach((p) => {
|
|
331
|
-
const name = `${p.name}`;
|
|
332
|
-
querySideAssignments.push(
|
|
333
|
-
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap),
|
|
334
|
-
);
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
if (querySideAssignments.length > 0) {
|
|
338
|
-
allSideAssignments.push(` queryParameters: { ` + querySideAssignments.join(", ") + `}`);
|
|
339
|
-
}
|
|
340
|
-
requestParameter.parameters
|
|
341
|
-
?.filter((p) => p.type === "header")
|
|
342
|
-
.filter((p) => p.name.toLowerCase() !== "contenttype")
|
|
343
|
-
.forEach((p) => {
|
|
344
|
-
const name = `${p.name}`;
|
|
345
|
-
headerSideAssignments.push(
|
|
346
|
-
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap),
|
|
347
|
-
);
|
|
348
|
-
});
|
|
349
|
-
if (headerSideAssignments.length > 0) {
|
|
350
|
-
allSideAssignments.push(` headers: { ` + headerSideAssignments.join(", ") + `}`);
|
|
351
|
-
}
|
|
352
|
-
const contentType = requestParameter.parameters
|
|
353
|
-
?.filter((p) => p.type === "header")
|
|
354
|
-
.filter((p) => p.name.toLowerCase() === "contenttype");
|
|
355
|
-
const firstContentType = contentType?.[0];
|
|
356
|
-
if (firstContentType) {
|
|
357
|
-
allSideAssignments.push(
|
|
358
|
-
` ${firstContentType.name}: ` +
|
|
359
|
-
generateParameterTypeValue(firstContentType.param.type, firstContentType.name, schemaMap),
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
let value: string;
|
|
363
|
-
if (allSideAssignments.length > 0) {
|
|
364
|
-
value = `{ ` + allSideAssignments.join(", ") + `}`;
|
|
365
|
-
} else {
|
|
366
|
-
return [];
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const optionParam: SampleParameter = {
|
|
370
|
-
name: "options",
|
|
371
|
-
assignment: `const options =` + value + `;`,
|
|
372
|
-
value,
|
|
373
|
-
};
|
|
374
|
-
return [optionParam];
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function addValueInImportedDict(
|
|
378
|
-
key: string,
|
|
379
|
-
val: string,
|
|
380
|
-
importedDict: Record<string, Set<string>>,
|
|
381
|
-
) {
|
|
382
|
-
if (!importedDict[key]) {
|
|
383
|
-
importedDict[key] = new Set<string>();
|
|
384
|
-
}
|
|
385
|
-
importedDict[key].add(val);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function buildMethodParamMap(model: RLCModel): Map<string, OperationParameter> {
|
|
389
|
-
const map = new Map<string, OperationParameter>();
|
|
390
|
-
(model.parameters ?? []).forEach((p) => {
|
|
391
|
-
const operatonConcante = getOperationConcate(
|
|
392
|
-
p.operationName,
|
|
393
|
-
p.operationGroup,
|
|
394
|
-
model.options?.sourceFrom,
|
|
395
|
-
);
|
|
396
|
-
map.set(operatonConcante, p);
|
|
397
|
-
});
|
|
398
|
-
return map;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
function getOperationConcate(opName: string, opGroup: string, sourceFrom?: string) {
|
|
402
|
-
return sourceFrom === "Swagger"
|
|
403
|
-
? opGroup === "" || opGroup === "Client"
|
|
404
|
-
? opName
|
|
405
|
-
: `${opGroup}${opName}`
|
|
406
|
-
: `${opGroup}_${opName}`;
|
|
407
|
-
}
|
package/src/utils/dirname.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param metaUrl usually import.meta.url
|
|
7
|
-
*/
|
|
8
|
-
export function getDirname(metaUrl: string) {
|
|
9
|
-
const __filename = fileURLToPath(metaUrl);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
return { __dirname, __filename };
|
|
12
|
-
}
|