@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,180 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
import {
|
|
6
|
-
InterfaceDeclarationStructure,
|
|
7
|
-
OptionalKind,
|
|
8
|
-
Project,
|
|
9
|
-
PropertySignatureStructure,
|
|
10
|
-
StructureKind,
|
|
11
|
-
} from "ts-morph";
|
|
12
|
-
import { getImportSpecifier } from "./helpers/imports-util.js";
|
|
13
|
-
import {
|
|
14
|
-
getImportModuleName,
|
|
15
|
-
getResponseBaseName,
|
|
16
|
-
getResponseTypeName,
|
|
17
|
-
} from "./helpers/name-constructors.js";
|
|
18
|
-
import { ResponseHeaderSchema, ResponseMetadata, RLCModel } from "./interfaces.js";
|
|
19
|
-
|
|
20
|
-
let hasErrorResponse = false;
|
|
21
|
-
export function buildResponseTypes(model: RLCModel) {
|
|
22
|
-
const project = new Project();
|
|
23
|
-
const srcPath = model.srcPath;
|
|
24
|
-
const filePath = path.join(srcPath, `responses.ts`);
|
|
25
|
-
hasErrorResponse = false;
|
|
26
|
-
const responsesFile = project.createSourceFile(filePath, undefined, {
|
|
27
|
-
overwrite: true,
|
|
28
|
-
});
|
|
29
|
-
// Set used to track down which models need to be imported
|
|
30
|
-
// Track if we need to import RawHttpHeaders
|
|
31
|
-
let hasHeaders = false;
|
|
32
|
-
if (!model.responses) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
for (const operationResponse of model.responses) {
|
|
36
|
-
for (const response of operationResponse.responses) {
|
|
37
|
-
// Building the response type base name
|
|
38
|
-
const baseResponseName = getResponseBaseName(
|
|
39
|
-
operationResponse.operationGroup,
|
|
40
|
-
operationResponse.operationName,
|
|
41
|
-
response.statusCode,
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
// Build the response header
|
|
45
|
-
const headersInterface: InterfaceDeclarationStructure | undefined =
|
|
46
|
-
getResponseHeaderInterfaceDefinition(response, baseResponseName);
|
|
47
|
-
if (headersInterface) {
|
|
48
|
-
hasHeaders = true;
|
|
49
|
-
responsesFile.addInterface(headersInterface);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Get the information to build the Response Interface
|
|
53
|
-
const responseTypeName = response.predefinedName ?? getResponseTypeName(baseResponseName);
|
|
54
|
-
const responseProperties = getResponseInterfaceProperties(response, headersInterface?.name);
|
|
55
|
-
|
|
56
|
-
const responseInterfaceDefinition: OptionalKind<InterfaceDeclarationStructure> = {
|
|
57
|
-
name: responseTypeName,
|
|
58
|
-
properties: responseProperties,
|
|
59
|
-
isExported: true,
|
|
60
|
-
extends: ["HttpResponse"],
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// Only add a description if one was provided in the Swagger
|
|
64
|
-
// otherwise skip to avoid having empty TSDoc lines
|
|
65
|
-
if (response.description) {
|
|
66
|
-
responseInterfaceDefinition.docs = [{ description: response.description }];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Add the response interface to the responses file
|
|
70
|
-
responsesFile.addInterface(responseInterfaceDefinition);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (hasHeaders) {
|
|
75
|
-
responsesFile.addImportDeclarations([
|
|
76
|
-
{
|
|
77
|
-
isTypeOnly: true,
|
|
78
|
-
namedImports: ["RawHttpHeaders"],
|
|
79
|
-
moduleSpecifier: getImportSpecifier("restPipeline", model.importInfo.runtimeImports),
|
|
80
|
-
},
|
|
81
|
-
]);
|
|
82
|
-
}
|
|
83
|
-
const namedImports = ["HttpResponse"];
|
|
84
|
-
if (hasErrorResponse) {
|
|
85
|
-
namedImports.push("ErrorResponse");
|
|
86
|
-
}
|
|
87
|
-
responsesFile.addImportDeclarations([
|
|
88
|
-
{
|
|
89
|
-
isTypeOnly: true,
|
|
90
|
-
namedImports,
|
|
91
|
-
moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
|
|
92
|
-
},
|
|
93
|
-
]);
|
|
94
|
-
|
|
95
|
-
if ((model.importInfo.internalImports.response?.importsSet?.size ?? 0) > 0) {
|
|
96
|
-
const modelNamedImports = Array.from(
|
|
97
|
-
model.importInfo.internalImports.response!.importsSet!,
|
|
98
|
-
).filter((modelName) => {
|
|
99
|
-
return !(modelName === "ErrorResponseOutput" && hasErrorResponse);
|
|
100
|
-
});
|
|
101
|
-
responsesFile.addImportDeclarations([
|
|
102
|
-
{
|
|
103
|
-
isTypeOnly: true,
|
|
104
|
-
namedImports: modelNamedImports,
|
|
105
|
-
moduleSpecifier: getImportModuleName(
|
|
106
|
-
{
|
|
107
|
-
cjsName: `./outputModels`,
|
|
108
|
-
esModulesName: `./outputModels.js`,
|
|
109
|
-
},
|
|
110
|
-
model,
|
|
111
|
-
),
|
|
112
|
-
},
|
|
113
|
-
]);
|
|
114
|
-
}
|
|
115
|
-
return { path: filePath, content: responsesFile.getFullText() };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function getResponseHeaderInterfaceDefinition(
|
|
119
|
-
response: ResponseMetadata,
|
|
120
|
-
baseName: string,
|
|
121
|
-
): undefined | InterfaceDeclarationStructure {
|
|
122
|
-
// Check if there are any required headers
|
|
123
|
-
if (!response.headers) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const headersInterfaceName = `${baseName}Headers`;
|
|
127
|
-
return {
|
|
128
|
-
kind: StructureKind.Interface,
|
|
129
|
-
isExported: true,
|
|
130
|
-
name: headersInterfaceName,
|
|
131
|
-
properties: response?.headers.map((h: ResponseHeaderSchema) => {
|
|
132
|
-
const description = h.description;
|
|
133
|
-
return {
|
|
134
|
-
name: h.name,
|
|
135
|
-
...(description && { docs: [{ description }] }),
|
|
136
|
-
type: h.type,
|
|
137
|
-
hasQuestionToken: !h.required,
|
|
138
|
-
};
|
|
139
|
-
}),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Gets the properties that need to be part of the response interface
|
|
145
|
-
*/
|
|
146
|
-
function getResponseInterfaceProperties(response: ResponseMetadata, headersInterfaceName?: string) {
|
|
147
|
-
const statusCode = response.statusCode;
|
|
148
|
-
const responseProperties: PropertySignatureStructure[] = [
|
|
149
|
-
{
|
|
150
|
-
name: "status",
|
|
151
|
-
type: statusCode === "default" ? `string` : `"${statusCode}"`,
|
|
152
|
-
kind: StructureKind.PropertySignature,
|
|
153
|
-
},
|
|
154
|
-
];
|
|
155
|
-
|
|
156
|
-
if (response.body) {
|
|
157
|
-
const description = response.body.description;
|
|
158
|
-
let type = response.body.type;
|
|
159
|
-
if (response.body.type === "ErrorResponseOutput" && response.body.fromCore) {
|
|
160
|
-
type = "ErrorResponse";
|
|
161
|
-
hasErrorResponse = true;
|
|
162
|
-
}
|
|
163
|
-
responseProperties.push({
|
|
164
|
-
name: "body",
|
|
165
|
-
type,
|
|
166
|
-
kind: StructureKind.PropertySignature,
|
|
167
|
-
...(description && { docs: [{ description }] }),
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (headersInterfaceName) {
|
|
172
|
-
responseProperties.push({
|
|
173
|
-
name: "headers",
|
|
174
|
-
type: `RawHttpHeaders & ${headersInterfaceName}`,
|
|
175
|
-
kind: StructureKind.PropertySignature,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return responseProperties;
|
|
180
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { File as RLCFile, RLCModel, RLCSampleGroup } from "./interfaces.js";
|
|
5
|
-
import { sampleTemplate } from "./static/sample-template.js";
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
-
// @ts-ignore: to fix the handlebars issue
|
|
8
|
-
import hbs from "handlebars";
|
|
9
|
-
import * as path from "path";
|
|
10
|
-
|
|
11
|
-
// Build sample files for the model based on the sample groups
|
|
12
|
-
export function buildSamples(model: RLCModel) {
|
|
13
|
-
if (!model.options || !model.options.packageDetails) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const sampleGroups: RLCSampleGroup[] | undefined = model.sampleGroups;
|
|
17
|
-
if (!sampleGroups || sampleGroups.length === 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const sampleFiles: RLCFile[] = [];
|
|
21
|
-
for (const sampleGroup of sampleGroups) {
|
|
22
|
-
const sampleGroupFileContents = hbs.compile(sampleTemplate, {
|
|
23
|
-
noEscape: true,
|
|
24
|
-
});
|
|
25
|
-
const filePath = path.join("samples-dev", `${sampleGroup.filename}.ts`);
|
|
26
|
-
sampleFiles.push({
|
|
27
|
-
path: filePath,
|
|
28
|
-
content: sampleGroupFileContents(sampleGroup),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return sampleFiles;
|
|
32
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
import { Project } from "ts-morph";
|
|
6
|
-
import {
|
|
7
|
-
buildObjectAliases,
|
|
8
|
-
buildObjectInterfaces,
|
|
9
|
-
buildPolymorphicAliases,
|
|
10
|
-
} from "./build-object-types.js";
|
|
11
|
-
import { getImportSpecifier } from "./helpers/imports-util.js";
|
|
12
|
-
import { getImportModuleName } from "./helpers/name-constructors.js";
|
|
13
|
-
import { RLCModel, SchemaContext } from "./interfaces.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generates types to represent schema definitions in the swagger
|
|
17
|
-
*/
|
|
18
|
-
export function buildSchemaTypes(model: RLCModel) {
|
|
19
|
-
const { srcPath } = model;
|
|
20
|
-
const project = new Project();
|
|
21
|
-
let filePath = path.join(srcPath, `models.ts`);
|
|
22
|
-
const inputModelFile = generateModelFiles(model, project, filePath, [SchemaContext.Input]);
|
|
23
|
-
filePath = path.join(srcPath, `outputModels.ts`);
|
|
24
|
-
const outputModelFile = generateModelFiles(model, project, filePath, [
|
|
25
|
-
SchemaContext.Output,
|
|
26
|
-
SchemaContext.Exception,
|
|
27
|
-
]);
|
|
28
|
-
return { inputModelFile, outputModelFile };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function generateModelFiles(
|
|
32
|
-
model: RLCModel,
|
|
33
|
-
project: Project,
|
|
34
|
-
filePath: string,
|
|
35
|
-
schemaContext: SchemaContext[],
|
|
36
|
-
) {
|
|
37
|
-
// Track models that need to be imported
|
|
38
|
-
const importedModels = new Set<string>();
|
|
39
|
-
const objectsDefinitions = buildObjectInterfaces(model, importedModels, schemaContext);
|
|
40
|
-
|
|
41
|
-
const objectTypeAliases = buildPolymorphicAliases(model, schemaContext);
|
|
42
|
-
|
|
43
|
-
const objectAliases = buildObjectAliases(model, importedModels, schemaContext);
|
|
44
|
-
|
|
45
|
-
if (objectTypeAliases.length || objectsDefinitions.length || objectAliases.length) {
|
|
46
|
-
const modelsFile = project.createSourceFile(filePath, undefined, {
|
|
47
|
-
overwrite: true,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
modelsFile.addInterfaces(objectsDefinitions);
|
|
51
|
-
modelsFile.addTypeAliases(objectTypeAliases);
|
|
52
|
-
modelsFile.addTypeAliases(objectAliases);
|
|
53
|
-
if (importedModels.size > 0) {
|
|
54
|
-
modelsFile.addImportDeclarations([
|
|
55
|
-
{
|
|
56
|
-
isTypeOnly: true,
|
|
57
|
-
namedImports: [...Array.from(importedModels || [])],
|
|
58
|
-
moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
|
|
59
|
-
},
|
|
60
|
-
]);
|
|
61
|
-
}
|
|
62
|
-
// Add NodeReadableStream import if binary types are used in models.
|
|
63
|
-
// platform-types.ts is generated directly under src/ (no static-helpers/
|
|
64
|
-
// subdirectory) to match the RLC design where all output lives in src/.
|
|
65
|
-
// The platform-types static helper resolves NodeReadableStream to
|
|
66
|
-
// NodeJS.ReadableStream on Node and `never` on browser/react-native, so the
|
|
67
|
-
// union arm drops out naturally in non-Node builds.
|
|
68
|
-
if (modelsFile.getFullText().includes("NodeReadableStream")) {
|
|
69
|
-
const platformTypesModuleSpecifier = model.options?.azureSdkForJs
|
|
70
|
-
? "#platform/platform-types"
|
|
71
|
-
: getImportModuleName(
|
|
72
|
-
{
|
|
73
|
-
cjsName: `./platform-types`,
|
|
74
|
-
esModulesName: `./platform-types.js`,
|
|
75
|
-
},
|
|
76
|
-
model,
|
|
77
|
-
);
|
|
78
|
-
modelsFile.addImportDeclarations([
|
|
79
|
-
{
|
|
80
|
-
isTypeOnly: true,
|
|
81
|
-
namedImports: ["NodeReadableStream"],
|
|
82
|
-
moduleSpecifier: platformTypesModuleSpecifier,
|
|
83
|
-
},
|
|
84
|
-
]);
|
|
85
|
-
}
|
|
86
|
-
return { path: filePath, content: modelsFile.getFullText() };
|
|
87
|
-
}
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
import { RLCModel } from "./interfaces.js";
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
-
// @ts-ignore: to fix the handlebars issue
|
|
5
|
-
import hbs from "handlebars";
|
|
6
|
-
import {
|
|
7
|
-
hasCsvCollection,
|
|
8
|
-
hasMultiCollection,
|
|
9
|
-
hasPipeCollection,
|
|
10
|
-
hasSsvCollection,
|
|
11
|
-
hasTsvCollection,
|
|
12
|
-
} from "./helpers/operation-helpers.js";
|
|
13
|
-
import {
|
|
14
|
-
buildCsvCollectionContent,
|
|
15
|
-
buildMultiCollectionContent,
|
|
16
|
-
buildPipeCollectionContent,
|
|
17
|
-
buildSsvCollectionContent,
|
|
18
|
-
buildTsvCollectionContent,
|
|
19
|
-
} from "./static/serialize-helper.js";
|
|
20
|
-
|
|
21
|
-
export function buildSerializeHelper(model: RLCModel) {
|
|
22
|
-
let serializeHelperContent = "";
|
|
23
|
-
if (hasMultiCollection(model)) {
|
|
24
|
-
serializeHelperContent += "\n" + buildMultiCollectionContent;
|
|
25
|
-
}
|
|
26
|
-
if (hasPipeCollection(model)) {
|
|
27
|
-
serializeHelperContent += "\n" + buildPipeCollectionContent;
|
|
28
|
-
}
|
|
29
|
-
if (hasSsvCollection(model)) {
|
|
30
|
-
serializeHelperContent += "\n" + buildSsvCollectionContent;
|
|
31
|
-
}
|
|
32
|
-
if (hasTsvCollection(model)) {
|
|
33
|
-
serializeHelperContent += "\n" + buildTsvCollectionContent;
|
|
34
|
-
}
|
|
35
|
-
if (hasCsvCollection(model)) {
|
|
36
|
-
serializeHelperContent += "\n" + buildCsvCollectionContent;
|
|
37
|
-
}
|
|
38
|
-
if (serializeHelperContent !== "") {
|
|
39
|
-
const readmeFileContents = hbs.compile(serializeHelperContent, {
|
|
40
|
-
noEscape: true,
|
|
41
|
-
});
|
|
42
|
-
const { srcPath } = model;
|
|
43
|
-
return {
|
|
44
|
-
path: path.join(srcPath, "serializeHelper.ts"),
|
|
45
|
-
content: readmeFileContents({}),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
import { Project } from "ts-morph";
|
|
6
|
-
import { getImportModuleName } from "./helpers/name-constructors.js";
|
|
7
|
-
import { NameType, normalizeName } from "./helpers/name-utils.js";
|
|
8
|
-
import { getRelativePartFromSrcPath } from "./helpers/path-utils.js";
|
|
9
|
-
import { RLCModel } from "./interfaces.js";
|
|
10
|
-
|
|
11
|
-
const batchOutputFolder: [string, string, string][] = [];
|
|
12
|
-
|
|
13
|
-
export function buildTopLevelIndex(model: RLCModel) {
|
|
14
|
-
if (!model.options) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const project = new Project();
|
|
18
|
-
const { srcPath } = model;
|
|
19
|
-
const { multiClient } = model.options;
|
|
20
|
-
const batch = model.options.batch;
|
|
21
|
-
if (srcPath) {
|
|
22
|
-
const clientName = model.libraryName;
|
|
23
|
-
const moduleName = normalizeName(clientName, NameType.File);
|
|
24
|
-
const relativePath = "./" + getRelativePartFromSrcPath(srcPath, model.options.isModularLibrary);
|
|
25
|
-
batchOutputFolder.push([relativePath, clientName, moduleName]);
|
|
26
|
-
}
|
|
27
|
-
if (multiClient && batch && batch.length > 1 && batchOutputFolder.length === batch.length) {
|
|
28
|
-
const indexFile = project.createSourceFile("index.ts", undefined, {
|
|
29
|
-
overwrite: true,
|
|
30
|
-
});
|
|
31
|
-
const allModules: string[] = [];
|
|
32
|
-
batchOutputFolder.forEach((item) => {
|
|
33
|
-
indexFile.addImportDeclaration({
|
|
34
|
-
isTypeOnly: true,
|
|
35
|
-
namespaceImport: item[1],
|
|
36
|
-
moduleSpecifier: getImportModuleName(
|
|
37
|
-
{
|
|
38
|
-
cjsName: `${item[0]}`,
|
|
39
|
-
esModulesName: `${item[0]}/index.js`,
|
|
40
|
-
},
|
|
41
|
-
model,
|
|
42
|
-
),
|
|
43
|
-
});
|
|
44
|
-
allModules.push(item[1]);
|
|
45
|
-
});
|
|
46
|
-
indexFile.addExportDeclaration({
|
|
47
|
-
namedExports: [...allModules],
|
|
48
|
-
});
|
|
49
|
-
const content = indexFile.getFullText();
|
|
50
|
-
const filePath = path.join(
|
|
51
|
-
srcPath.substring(0, srcPath.lastIndexOf("src") + 4),
|
|
52
|
-
model.options.isModularLibrary ? "rest" : "",
|
|
53
|
-
`index.ts`,
|
|
54
|
-
);
|
|
55
|
-
return { path: filePath, content };
|
|
56
|
-
}
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RLCModel, RLCOptions } from "../interfaces.js";
|
|
2
|
-
|
|
3
|
-
export function isAzurePackage(model: { options?: RLCOptions }): boolean {
|
|
4
|
-
return Boolean(model.options?.flavor === "azure");
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function isAzureMonorepoPackage(model: RLCModel): boolean {
|
|
8
|
-
return Boolean(model.options?.azureSdkForJs) && isAzurePackage(model);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function isAzureStandalonePackage(model: RLCModel): boolean {
|
|
12
|
-
return isAzurePackage(model) && !model.options?.azureSdkForJs;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
|
|
3
|
-
export function getRelativePartFromSrcPath(srcPath: string, isModularLibrary: boolean = false) {
|
|
4
|
-
const sep = srcPath.includes(path.sep + "src") ? path.sep : "/";
|
|
5
|
-
let relativePart = srcPath.substring(srcPath.indexOf(sep + "src") + 4);
|
|
6
|
-
if (isModularLibrary) {
|
|
7
|
-
relativePart = relativePart.substring(srcPath.indexOf(sep + "rest"), +5);
|
|
8
|
-
}
|
|
9
|
-
return relativePart.startsWith(sep) ? relativePart.substring(1) : relativePart;
|
|
10
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { InterfaceDeclarationStructure, MethodSignatureStructure, OptionalKind } from "ts-morph";
|
|
5
|
-
import { PathMetadata, Paths } from "../interfaces.js";
|
|
6
|
-
import { NameType, normalizeName } from "./name-utils.js";
|
|
7
|
-
import { buildMethodDefinitions } from "./operation-helpers.js";
|
|
8
|
-
|
|
9
|
-
export function generateMethodShortcuts(
|
|
10
|
-
paths: Paths,
|
|
11
|
-
): OptionalKind<InterfaceDeclarationStructure>[] {
|
|
12
|
-
const keys: Record<string, OptionalKind<MethodSignatureStructure>[]> = {};
|
|
13
|
-
for (const path in paths) {
|
|
14
|
-
const pathMetadata = paths[path];
|
|
15
|
-
if (!pathMetadata) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
const groupName = pathMetadata.operationGroupName;
|
|
19
|
-
const definitions = buildOperationDefinitions(pathMetadata);
|
|
20
|
-
if (!keys[groupName]) {
|
|
21
|
-
keys[groupName] = definitions;
|
|
22
|
-
} else {
|
|
23
|
-
keys[groupName] = [...keys[groupName], ...definitions];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const interfaces: OptionalKind<InterfaceDeclarationStructure>[] = [];
|
|
28
|
-
|
|
29
|
-
for (const interfaceName in keys) {
|
|
30
|
-
const methods = keys[interfaceName];
|
|
31
|
-
interfaces.push({
|
|
32
|
-
name: `${interfaceName}Operations`,
|
|
33
|
-
methods: methods,
|
|
34
|
-
isExported: true,
|
|
35
|
-
docs: [`Contains operations for ${interfaceName} operations`],
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return interfaces;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function buildOperationDefinitions(path: PathMetadata): OptionalKind<MethodSignatureStructure>[] {
|
|
43
|
-
let ops: OptionalKind<MethodSignatureStructure>[] = [];
|
|
44
|
-
|
|
45
|
-
for (const verb in path.methods) {
|
|
46
|
-
const methods = path.methods[verb];
|
|
47
|
-
if (!methods) {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
for (const method of methods) {
|
|
51
|
-
const name = normalizeName(method.operationName, NameType.Property);
|
|
52
|
-
const pathParams = path.pathParameters;
|
|
53
|
-
const methodDefinitions = buildMethodDefinitions({ [name]: [method] }, pathParams);
|
|
54
|
-
ops = [...ops, ...methodDefinitions];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return ops;
|
|
58
|
-
}
|