@azure-tools/typespec-ts 0.54.0 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -10
- package/README.md +0 -4
- package/dist/src/context-manager.d.ts +75 -0
- package/dist/src/context-manager.d.ts.map +1 -0
- package/dist/src/context-manager.js +59 -0
- package/dist/src/context-manager.js.map +1 -0
- package/dist/src/framework/declaration.d.ts +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +2 -4
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts.map +1 -1
- 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 +32 -41
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdk-types.d.ts +27 -0
- package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -0
- package/dist/src/framework/hooks/sdk-types.js +158 -0
- package/dist/src/framework/hooks/sdk-types.js.map +1 -0
- package/dist/src/framework/hooks/use-dependencies.d.ts +4 -0
- package/dist/src/framework/hooks/use-dependencies.d.ts.map +1 -0
- package/dist/src/framework/hooks/use-dependencies.js +13 -0
- package/dist/src/framework/hooks/use-dependencies.js.map +1 -0
- package/dist/src/framework/load-static-helpers.d.ts +1 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +17 -31
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.d.ts.map +1 -1
- package/dist/src/framework/reference.js +2 -2
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/sample.js +8 -8
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +111 -100
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +140 -140
- package/dist/src/lib.js.map +1 -1
- package/dist/src/meta-tree.d.ts +7 -0
- package/dist/src/meta-tree.d.ts.map +1 -0
- package/dist/src/meta-tree.js +2 -0
- package/dist/src/meta-tree.js.map +1 -0
- package/dist/src/modular/build-classical-client.d.ts +6 -0
- package/dist/src/modular/build-classical-client.d.ts.map +1 -0
- package/dist/src/modular/build-classical-client.js +345 -0
- package/dist/src/modular/build-classical-client.js.map +1 -0
- package/dist/src/modular/build-classical-operation-groups.d.ts +6 -0
- package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -0
- package/dist/src/modular/build-classical-operation-groups.js +48 -0
- package/dist/src/modular/build-classical-operation-groups.js.map +1 -0
- package/dist/src/modular/build-client-context.d.ts +13 -0
- package/dist/src/modular/build-client-context.d.ts.map +1 -0
- package/dist/src/modular/build-client-context.js +246 -0
- package/dist/src/modular/build-client-context.js.map +1 -0
- package/dist/src/modular/build-modular-options.d.ts +6 -0
- package/dist/src/modular/build-modular-options.d.ts.map +1 -0
- package/dist/src/modular/build-modular-options.js +14 -0
- package/dist/src/modular/build-modular-options.js.map +1 -0
- package/dist/src/modular/build-operations.d.ts +21 -0
- package/dist/src/modular/build-operations.d.ts.map +1 -0
- package/dist/src/modular/build-operations.js +172 -0
- package/dist/src/modular/build-operations.js.map +1 -0
- package/dist/src/modular/build-project-files.d.ts +4 -0
- package/dist/src/modular/build-project-files.d.ts.map +1 -0
- package/dist/src/modular/build-project-files.js +91 -0
- package/dist/src/modular/build-project-files.js.map +1 -0
- package/dist/src/modular/build-restore-poller.d.ts +5 -0
- package/dist/src/modular/build-restore-poller.d.ts.map +1 -0
- package/dist/src/modular/build-restore-poller.js +216 -0
- package/dist/src/modular/build-restore-poller.js.map +1 -0
- package/dist/src/modular/build-root-index.d.ts +13 -0
- package/dist/src/modular/build-root-index.d.ts.map +1 -0
- package/dist/src/modular/build-root-index.js +279 -0
- package/dist/src/modular/build-root-index.js.map +1 -0
- package/dist/src/modular/build-subpath-index.d.ts +16 -0
- package/dist/src/modular/build-subpath-index.d.ts.map +1 -0
- package/dist/src/modular/build-subpath-index.js +119 -0
- package/dist/src/modular/build-subpath-index.js.map +1 -0
- package/dist/src/modular/emit-logger-file.d.ts +3 -0
- package/dist/src/modular/emit-logger-file.d.ts.map +1 -0
- package/dist/src/modular/emit-logger-file.js +18 -0
- package/dist/src/modular/emit-logger-file.js.map +1 -0
- package/dist/src/modular/emit-models-options.d.ts +5 -0
- package/dist/src/modular/emit-models-options.d.ts.map +1 -0
- package/dist/src/modular/emit-models-options.js +35 -0
- package/dist/src/modular/emit-models-options.js.map +1 -0
- package/dist/src/modular/emit-models.d.ts +23 -0
- package/dist/src/modular/emit-models.d.ts.map +1 -0
- package/dist/src/modular/emit-models.js +864 -0
- package/dist/src/modular/emit-models.js.map +1 -0
- package/dist/src/modular/emit-samples.d.ts +7 -0
- package/dist/src/modular/emit-samples.d.ts.map +1 -0
- package/dist/src/modular/emit-samples.js +500 -0
- package/dist/src/modular/emit-samples.js.map +1 -0
- package/dist/src/modular/emit-tests.d.ts +7 -0
- package/dist/src/modular/emit-tests.d.ts.map +1 -0
- package/dist/src/modular/emit-tests.js +155 -0
- package/dist/src/modular/emit-tests.js.map +1 -0
- package/dist/src/modular/external-dependencies.js +54 -54
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts +7 -0
- package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/classical-operation-helpers.js +258 -0
- package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -0
- package/dist/src/modular/helpers/client-helpers.d.ts +34 -0
- package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/client-helpers.js +259 -0
- package/dist/src/modular/helpers/client-helpers.js.map +1 -0
- package/dist/src/modular/helpers/client-option-helpers.d.ts +43 -0
- package/dist/src/modular/helpers/client-option-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/client-option-helpers.js +103 -0
- package/dist/src/modular/helpers/client-option-helpers.js.map +1 -0
- package/dist/src/modular/helpers/docs-helpers.d.ts +3 -0
- package/dist/src/modular/helpers/docs-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/docs-helpers.js +10 -0
- package/dist/src/modular/helpers/docs-helpers.js.map +1 -0
- package/dist/src/modular/helpers/example-value-helpers.d.ts +83 -0
- package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/example-value-helpers.js +639 -0
- package/dist/src/modular/helpers/example-value-helpers.js.map +1 -0
- package/dist/src/modular/helpers/naming-helpers.d.ts +22 -0
- package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/naming-helpers.js +59 -0
- package/dist/src/modular/helpers/naming-helpers.js.map +1 -0
- package/dist/src/modular/helpers/operation-helpers.d.ts +105 -0
- package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/operation-helpers.js +2328 -0
- package/dist/src/modular/helpers/operation-helpers.js.map +1 -0
- package/dist/src/modular/helpers/type-helpers.d.ts +22 -0
- package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/type-helpers.js +94 -0
- package/dist/src/modular/helpers/type-helpers.js.map +1 -0
- package/dist/src/modular/serialization/build-deserializer-function.d.ts +7 -0
- package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -0
- package/dist/src/modular/serialization/build-deserializer-function.js +401 -0
- package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -0
- package/dist/src/modular/serialization/build-serializer-function.d.ts +7 -0
- package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -0
- package/dist/src/modular/serialization/build-serializer-function.js +442 -0
- package/dist/src/modular/serialization/build-serializer-function.js.map +1 -0
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts +44 -0
- package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -0
- package/dist/src/modular/serialization/build-xml-serializer-function.js +729 -0
- package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -0
- package/dist/src/modular/serialization/serialize-utils.d.ts +37 -0
- package/dist/src/modular/serialization/serialize-utils.d.ts.map +1 -0
- package/dist/src/modular/serialization/serialize-utils.js +145 -0
- package/dist/src/modular/serialization/serialize-utils.js.map +1 -0
- package/dist/src/modular/static-helpers-metadata.js +60 -60
- package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -2
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +10 -13
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js +2 -3
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +5 -11
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
- package/dist/src/rlc-common/build-client-definitions.d.ts +6 -0
- package/dist/src/rlc-common/build-client-definitions.d.ts.map +1 -0
- package/dist/src/rlc-common/build-client-definitions.js +157 -0
- package/dist/src/rlc-common/build-client-definitions.js.map +1 -0
- package/dist/src/rlc-common/build-client.d.ts +9 -0
- package/dist/src/rlc-common/build-client.d.ts.map +1 -0
- package/dist/src/rlc-common/build-client.js +391 -0
- package/dist/src/rlc-common/build-client.js.map +1 -0
- package/dist/src/rlc-common/build-index-file.d.ts +6 -0
- package/dist/src/rlc-common/build-index-file.d.ts.map +1 -0
- package/dist/src/rlc-common/build-index-file.js +241 -0
- package/dist/src/rlc-common/build-index-file.js.map +1 -0
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +6 -0
- package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +1 -0
- package/dist/src/rlc-common/build-is-unexpected-helper.js +223 -0
- package/dist/src/rlc-common/build-is-unexpected-helper.js.map +1 -0
- package/dist/src/rlc-common/build-logger.d.ts +6 -0
- package/dist/src/rlc-common/build-logger.d.ts.map +1 -0
- package/dist/src/rlc-common/build-logger.js +31 -0
- package/dist/src/rlc-common/build-logger.js.map +1 -0
- package/dist/src/rlc-common/build-method-shortcuts.d.ts +5 -0
- package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +1 -0
- package/dist/src/rlc-common/build-method-shortcuts.js +54 -0
- package/dist/src/rlc-common/build-method-shortcuts.js.map +1 -0
- package/dist/src/rlc-common/build-object-types.d.ts +29 -0
- package/dist/src/rlc-common/build-object-types.d.ts.map +1 -0
- package/dist/src/rlc-common/build-object-types.js +412 -0
- package/dist/src/rlc-common/build-object-types.js.map +1 -0
- package/dist/src/rlc-common/build-paginate-helper.d.ts +6 -0
- package/dist/src/rlc-common/build-paginate-helper.d.ts.map +1 -0
- package/dist/src/rlc-common/build-paginate-helper.js +27 -0
- package/dist/src/rlc-common/build-paginate-helper.js.map +1 -0
- package/dist/src/rlc-common/build-parameter-types.d.ts +14 -0
- package/dist/src/rlc-common/build-parameter-types.d.ts.map +1 -0
- package/dist/src/rlc-common/build-parameter-types.js +391 -0
- package/dist/src/rlc-common/build-parameter-types.js.map +1 -0
- package/dist/src/rlc-common/build-polling-helper.d.ts +6 -0
- package/dist/src/rlc-common/build-polling-helper.d.ts.map +1 -0
- package/dist/src/rlc-common/build-polling-helper.js +61 -0
- package/dist/src/rlc-common/build-polling-helper.js.map +1 -0
- package/dist/src/rlc-common/build-response-types.d.ts +6 -0
- package/dist/src/rlc-common/build-response-types.d.ts.map +1 -0
- package/dist/src/rlc-common/build-response-types.js +143 -0
- package/dist/src/rlc-common/build-response-types.js.map +1 -0
- package/dist/src/rlc-common/build-samples.d.ts +3 -0
- package/dist/src/rlc-common/build-samples.d.ts.map +1 -0
- package/dist/src/rlc-common/build-samples.js +30 -0
- package/dist/src/rlc-common/build-samples.js.map +1 -0
- package/dist/src/rlc-common/build-schema-type.d.ts +20 -0
- package/dist/src/rlc-common/build-schema-type.d.ts.map +1 -0
- package/dist/src/rlc-common/build-schema-type.js +71 -0
- package/dist/src/rlc-common/build-schema-type.js.map +1 -0
- package/dist/src/rlc-common/build-serialize-helper.d.ts +6 -0
- package/dist/src/rlc-common/build-serialize-helper.d.ts.map +1 -0
- package/dist/src/rlc-common/build-serialize-helper.js +36 -0
- package/dist/src/rlc-common/build-serialize-helper.js.map +1 -0
- package/dist/src/rlc-common/build-top-level-index-file.d.ts +6 -0
- package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +1 -0
- package/dist/src/rlc-common/build-top-level-index-file.js +48 -0
- package/dist/src/rlc-common/build-top-level-index-file.js.map +1 -0
- package/dist/src/rlc-common/helpers/api-version-util.d.ts +17 -0
- package/dist/src/rlc-common/helpers/api-version-util.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/api-version-util.js +43 -0
- package/dist/src/rlc-common/helpers/api-version-util.js.map +1 -0
- package/dist/src/rlc-common/helpers/imports-util.d.ts +18 -0
- package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/imports-util.js +164 -0
- package/dist/src/rlc-common/helpers/imports-util.js.map +1 -0
- package/dist/src/rlc-common/helpers/name-constructors.d.ts +42 -0
- package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/name-constructors.js +61 -0
- package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -0
- package/dist/src/rlc-common/helpers/name-utils.d.ts +37 -0
- package/dist/src/rlc-common/helpers/name-utils.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/name-utils.js +240 -0
- package/dist/src/rlc-common/helpers/name-utils.js.map +1 -0
- package/dist/src/rlc-common/helpers/operation-helpers.d.ts +16 -0
- package/dist/src/rlc-common/helpers/operation-helpers.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/operation-helpers.js +104 -0
- package/dist/src/rlc-common/helpers/operation-helpers.js.map +1 -0
- package/dist/src/rlc-common/helpers/package-util.d.ts +7 -0
- package/dist/src/rlc-common/helpers/package-util.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/package-util.js +10 -0
- package/dist/src/rlc-common/helpers/package-util.js.map +1 -0
- package/dist/src/rlc-common/helpers/path-utils.d.ts +2 -0
- package/dist/src/rlc-common/helpers/path-utils.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/path-utils.js +10 -0
- package/dist/src/rlc-common/helpers/path-utils.js.map +1 -0
- package/dist/src/rlc-common/helpers/schema-helpers.d.ts +10 -0
- package/dist/src/rlc-common/helpers/schema-helpers.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/schema-helpers.js +37 -0
- package/dist/src/rlc-common/helpers/schema-helpers.js.map +1 -0
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +4 -0
- package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/shortcut-methods.js +49 -0
- package/dist/src/rlc-common/helpers/shortcut-methods.js.map +1 -0
- package/dist/src/rlc-common/helpers/type-util.d.ts +32 -0
- package/dist/src/rlc-common/helpers/type-util.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/type-util.js +162 -0
- package/dist/src/rlc-common/helpers/type-util.js.map +1 -0
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts +12 -0
- package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +1 -0
- package/dist/src/rlc-common/helpers/value-generation-util.js +161 -0
- package/dist/src/rlc-common/helpers/value-generation-util.js.map +1 -0
- package/dist/src/rlc-common/index.d.ts +39 -39
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +39 -39
- package/dist/src/rlc-common/index.js.map +1 -1
- 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 +6 -0
- package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js +55 -0
- package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-changelog-file.d.ts +6 -0
- package/dist/src/rlc-common/metadata/build-changelog-file.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-changelog-file.js +25 -0
- package/dist/src/rlc-common/metadata/build-changelog-file.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +6 -0
- package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-es-lint-config.js +79 -0
- package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-license-file.d.ts +5 -0
- package/dist/src/rlc-common/metadata/build-license-file.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-license-file.js +32 -0
- package/dist/src/rlc-common/metadata/build-license-file.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-package-file.d.ts +25 -0
- package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-package-file.js +197 -0
- package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts +11 -0
- package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-readme-file.js +418 -0
- package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts +6 -0
- package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-rollup-config.js +140 -0
- package/dist/src/rlc-common/metadata/build-rollup-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts +6 -0
- package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-sample-env-file.js +15 -0
- package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-test-config.d.ts +16 -0
- package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-test-config.js +54 -0
- package/dist/src/rlc-common/metadata/build-test-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts +61 -0
- package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-ts-config.js +170 -0
- package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-vitest-config.d.ts +6 -0
- package/dist/src/rlc-common/metadata/build-vitest-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-vitest-config.js +26 -0
- package/dist/src/rlc-common/metadata/build-vitest-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts +20 -0
- package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/build-warp-config.js +76 -0
- package/dist/src/rlc-common/metadata/build-warp-config.js.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts +51 -0
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js +121 -0
- package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +242 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +171 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts +8 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js +101 -0
- package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +57 -0
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +53 -0
- package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +64 -0
- package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -0
- package/dist/src/rlc-common/metadata/package-json/package-common.js +180 -0
- package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -0
- package/dist/src/rlc-common/metadata/utils.js +1 -2
- package/dist/src/rlc-common/metadata/utils.js.map +1 -1
- package/dist/src/rlc-common/static/paginate-content.d.ts +2 -0
- package/dist/src/rlc-common/static/paginate-content.d.ts.map +1 -0
- package/dist/src/rlc-common/static/paginate-content.js +345 -0
- package/dist/src/rlc-common/static/paginate-content.js.map +1 -0
- package/dist/src/rlc-common/static/polling-content.d.ts +2 -0
- package/dist/src/rlc-common/static/polling-content.d.ts.map +1 -0
- package/dist/src/rlc-common/static/polling-content.js +225 -0
- package/dist/src/rlc-common/static/polling-content.js.map +1 -0
- package/dist/src/rlc-common/static/sample-template.d.ts +2 -0
- package/dist/src/rlc-common/static/sample-template.d.ts.map +1 -0
- package/dist/src/rlc-common/static/sample-template.js +56 -0
- package/dist/src/rlc-common/static/sample-template.js.map +1 -0
- package/dist/src/rlc-common/static/serialize-helper.d.ts +6 -0
- package/dist/src/rlc-common/static/serialize-helper.d.ts.map +1 -0
- package/dist/src/rlc-common/static/serialize-helper.js +31 -0
- package/dist/src/rlc-common/static/serialize-helper.js.map +1 -0
- package/dist/src/rlc-common/test/build-karma-config.d.ts +6 -0
- package/dist/src/rlc-common/test/build-karma-config.d.ts.map +1 -0
- package/dist/src/rlc-common/test/build-karma-config.js +11 -0
- package/dist/src/rlc-common/test/build-karma-config.js.map +1 -0
- package/dist/src/rlc-common/test/build-recorded-client.d.ts +6 -0
- package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +1 -0
- package/dist/src/rlc-common/test/build-recorded-client.js +17 -0
- package/dist/src/rlc-common/test/build-recorded-client.js.map +1 -0
- package/dist/src/rlc-common/test/build-sample-test.d.ts +6 -0
- package/dist/src/rlc-common/test/build-sample-test.d.ts.map +1 -0
- package/dist/src/rlc-common/test/build-sample-test.js +14 -0
- package/dist/src/rlc-common/test/build-sample-test.js.map +1 -0
- package/dist/src/rlc-common/test/build-snippets.d.ts +6 -0
- package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -0
- package/dist/src/rlc-common/test/build-snippets.js +26 -0
- package/dist/src/rlc-common/test/build-snippets.js.map +1 -0
- package/dist/src/rlc-common/transform-sample-groups.d.ts +9 -0
- package/dist/src/rlc-common/transform-sample-groups.d.ts.map +1 -0
- package/dist/src/rlc-common/transform-sample-groups.js +313 -0
- package/dist/src/rlc-common/transform-sample-groups.js.map +1 -0
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/transform/transform-api-version-info.d.ts +6 -0
- package/dist/src/transform/transform-api-version-info.d.ts.map +1 -0
- package/dist/src/transform/transform-api-version-info.js +78 -0
- package/dist/src/transform/transform-api-version-info.js.map +1 -0
- package/dist/src/transform/transform-helper-function-details.d.ts +5 -0
- package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -0
- package/dist/src/transform/transform-helper-function-details.js +74 -0
- package/dist/src/transform/transform-helper-function-details.js.map +1 -0
- package/dist/src/transform/transform-parameters.d.ts +14 -0
- package/dist/src/transform/transform-parameters.d.ts.map +1 -0
- package/dist/src/transform/transform-parameters.js +201 -0
- package/dist/src/transform/transform-parameters.js.map +1 -0
- package/dist/src/transform/transform-paths.d.ts +5 -0
- package/dist/src/transform/transform-paths.d.ts.map +1 -0
- package/dist/src/transform/transform-paths.js +102 -0
- package/dist/src/transform/transform-paths.js.map +1 -0
- package/dist/src/transform/transform-responses.d.ts +5 -0
- package/dist/src/transform/transform-responses.d.ts.map +1 -0
- package/dist/src/transform/transform-responses.js +171 -0
- package/dist/src/transform/transform-responses.js.map +1 -0
- package/dist/src/transform/transform-schemas.d.ts +4 -0
- package/dist/src/transform/transform-schemas.d.ts.map +1 -0
- package/dist/src/transform/transform-schemas.js +191 -0
- package/dist/src/transform/transform-schemas.js.map +1 -0
- package/dist/src/transform/transform-telemetry-info.d.ts +4 -0
- package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -0
- package/dist/src/transform/transform-telemetry-info.js +22 -0
- package/dist/src/transform/transform-telemetry-info.js.map +1 -0
- package/dist/src/transform/transform.d.ts +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +37 -36
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transfrom-rlc-options.d.ts +14 -0
- package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -0
- package/dist/src/transform/transfrom-rlc-options.js +369 -0
- package/dist/src/transform/transfrom-rlc-options.js.map +1 -0
- package/dist/src/utils/client-utils.d.ts +10 -0
- package/dist/src/utils/client-utils.d.ts.map +1 -0
- package/dist/src/utils/client-utils.js +124 -0
- package/dist/src/utils/client-utils.js.map +1 -0
- package/dist/src/utils/credential-utils.d.ts +15 -0
- package/dist/src/utils/credential-utils.d.ts.map +1 -0
- package/dist/src/utils/credential-utils.js +68 -0
- package/dist/src/utils/credential-utils.js.map +1 -0
- package/dist/src/utils/cross-language-def.d.ts +6 -0
- package/dist/src/utils/cross-language-def.d.ts.map +1 -0
- package/dist/src/utils/cross-language-def.js +59 -0
- package/dist/src/utils/cross-language-def.js.map +1 -0
- package/dist/src/utils/emit-util.d.ts +5 -0
- package/dist/src/utils/emit-util.d.ts.map +1 -0
- package/dist/src/utils/emit-util.js +71 -0
- package/dist/src/utils/emit-util.js.map +1 -0
- package/dist/src/utils/file-system-utils.d.ts +5 -0
- package/dist/src/utils/file-system-utils.d.ts.map +1 -0
- package/dist/src/utils/file-system-utils.js +59 -0
- package/dist/src/utils/file-system-utils.js.map +1 -0
- package/dist/src/utils/import-helper.d.ts +10 -0
- package/dist/src/utils/import-helper.d.ts.map +1 -0
- package/dist/src/utils/import-helper.js +51 -0
- package/dist/src/utils/import-helper.js.map +1 -0
- package/dist/src/utils/interfaces.d.ts +2 -2
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/media-types.d.ts +28 -0
- package/dist/src/utils/media-types.d.ts.map +1 -0
- package/dist/src/utils/media-types.js +124 -0
- package/dist/src/utils/media-types.js.map +1 -0
- package/dist/src/utils/model-utils.d.ts +60 -0
- package/dist/src/utils/model-utils.d.ts.map +1 -0
- package/dist/src/utils/model-utils.js +1480 -0
- package/dist/src/utils/model-utils.js.map +1 -0
- package/dist/src/utils/namespace-utils.d.ts +6 -0
- package/dist/src/utils/namespace-utils.d.ts.map +1 -0
- package/dist/src/utils/namespace-utils.js +69 -0
- package/dist/src/utils/namespace-utils.js.map +1 -0
- package/dist/src/utils/operation-util.d.ts +97 -0
- package/dist/src/utils/operation-util.d.ts.map +1 -0
- package/dist/src/utils/operation-util.js +547 -0
- package/dist/src/utils/operation-util.js.map +1 -0
- package/dist/src/utils/parameter-utils.d.ts +9 -0
- package/dist/src/utils/parameter-utils.d.ts.map +1 -0
- package/dist/src/utils/parameter-utils.js +147 -0
- package/dist/src/utils/parameter-utils.js.map +1 -0
- package/dist/src/utils/resolve-project-root.js +2 -2
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -55
- package/src/context-manager.ts +101 -0
- package/src/framework/declaration.ts +18 -28
- package/src/framework/dependency.ts +1 -2
- package/src/framework/hooks/binder.ts +48 -121
- package/src/framework/hooks/sdk-types.ts +219 -0
- package/src/framework/hooks/use-dependencies.ts +16 -0
- package/src/framework/load-static-helpers.ts +28 -51
- package/src/framework/reference.ts +2 -5
- package/src/framework/sample.ts +9 -9
- package/src/index.ts +149 -189
- package/src/lib.ts +143 -158
- package/src/meta-tree.ts +8 -0
- package/src/modular/build-classical-client.ts +434 -0
- package/src/modular/build-classical-operation-groups.ts +69 -0
- package/src/modular/build-client-context.ts +325 -0
- package/src/modular/build-modular-options.ts +22 -0
- package/src/modular/build-operations.ts +248 -0
- package/src/modular/build-project-files.ts +111 -0
- package/src/modular/build-restore-poller.ts +242 -0
- package/src/modular/build-root-index.ts +407 -0
- package/src/modular/build-subpath-index.ts +152 -0
- package/src/modular/emit-logger-file.ts +23 -0
- package/src/modular/emit-models-options.ts +56 -0
- package/src/modular/emit-models.ts +1096 -0
- package/src/modular/emit-samples.ts +675 -0
- package/src/modular/emit-tests.ts +194 -0
- package/src/modular/external-dependencies.ts +54 -54
- package/src/modular/helpers/classical-operation-helpers.ts +375 -0
- package/src/modular/helpers/client-helpers.ts +362 -0
- package/src/modular/helpers/client-option-helpers.ts +122 -0
- package/src/modular/helpers/example-value-helpers.ts +851 -0
- package/src/modular/helpers/naming-helpers.ts +84 -0
- package/src/modular/helpers/operation-helpers.ts +3035 -0
- package/src/modular/helpers/type-helpers.ts +134 -0
- package/src/modular/serialization/build-deserializer-function.ts +564 -0
- package/src/modular/serialization/build-serializer-function.ts +614 -0
- package/src/modular/serialization/build-xml-serializer-function.ts +951 -0
- package/src/modular/serialization/serialize-utils.ts +217 -0
- package/src/modular/static/rollup.test.config.js +11 -14
- package/src/modular/static/scripts/renameOutput.mjs +2 -2
- package/src/modular/static-helpers-metadata.ts +60 -60
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +5 -10
- package/src/modular/type-expressions/get-model-expression.ts +13 -17
- package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
- package/src/modular/type-expressions/get-type-expression.ts +8 -12
- package/src/modular/type-expressions/get-union-expression.ts +4 -4
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/rlc-common/build-client-definitions.ts +235 -0
- package/src/rlc-common/build-client.ts +490 -0
- package/src/rlc-common/build-index-file.ts +344 -0
- package/src/rlc-common/build-is-unexpected-helper.ts +248 -0
- package/src/rlc-common/build-logger.ts +43 -0
- package/src/rlc-common/build-method-shortcuts.ts +71 -0
- package/src/rlc-common/build-object-types.ts +603 -0
- package/src/rlc-common/build-paginate-helper.ts +31 -0
- package/src/rlc-common/build-parameter-types.ts +554 -0
- package/src/rlc-common/build-polling-helper.ts +83 -0
- package/src/rlc-common/build-response-types.ts +180 -0
- package/src/rlc-common/build-samples.ts +32 -0
- package/src/rlc-common/build-schema-type.ts +89 -0
- package/src/rlc-common/build-serialize-helper.ts +49 -0
- package/src/rlc-common/build-top-level-index-file.ts +58 -0
- package/src/rlc-common/helpers/api-version-util.ts +48 -0
- package/src/rlc-common/helpers/imports-util.ts +184 -0
- package/src/rlc-common/helpers/name-constructors.ts +110 -0
- package/src/rlc-common/helpers/name-utils.ts +296 -0
- package/src/rlc-common/helpers/operation-helpers.ts +138 -0
- package/src/rlc-common/helpers/path-utils.ts +10 -0
- package/src/rlc-common/helpers/schema-helpers.ts +50 -0
- package/src/rlc-common/helpers/shortcut-methods.ts +58 -0
- package/src/rlc-common/helpers/type-util.ts +166 -0
- package/src/rlc-common/helpers/value-generation-util.ts +234 -0
- package/src/rlc-common/index.ts +39 -39
- package/src/rlc-common/interfaces.ts +3 -11
- package/src/rlc-common/metadata/build-api-extractor-config.ts +64 -0
- package/src/rlc-common/metadata/build-changelog-file.ts +29 -0
- package/src/rlc-common/metadata/build-es-lint-config.ts +84 -0
- package/src/rlc-common/metadata/build-license-file.ts +33 -0
- package/src/rlc-common/metadata/build-package-file.ts +242 -0
- package/src/rlc-common/metadata/build-readme-file.ts +515 -0
- package/src/rlc-common/metadata/build-rollup-config.ts +147 -0
- package/src/rlc-common/metadata/build-sample-env-file.ts +21 -0
- package/src/rlc-common/metadata/build-test-config.ts +72 -0
- package/src/rlc-common/metadata/build-ts-config.ts +219 -0
- package/src/rlc-common/metadata/build-vitest-config.ts +30 -0
- package/src/rlc-common/metadata/build-warp-config.ts +91 -0
- package/src/rlc-common/metadata/package-json/azure-package-common.ts +152 -0
- package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +199 -0
- package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +123 -0
- package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +68 -0
- package/src/rlc-common/metadata/package-json/package-common.ts +235 -0
- package/src/rlc-common/test/build-karma-config.ts +12 -0
- package/src/rlc-common/test/build-recorded-client.ts +18 -0
- package/src/rlc-common/test/build-sample-test.ts +15 -0
- package/src/rlc-common/test/build-snippets.ts +29 -0
- package/src/rlc-common/transform-sample-groups.ts +407 -0
- package/src/testing/index.ts +2 -5
- package/src/transform/transform-api-version-info.ts +103 -0
- package/src/transform/transform-helper-function-details.ts +88 -0
- package/src/transform/transform-parameters.ts +321 -0
- package/src/transform/transform-paths.ts +157 -0
- package/src/transform/transform-responses.ts +237 -0
- package/src/transform/transform-schemas.ts +212 -0
- package/src/transform/transform-telemetry-info.ts +33 -0
- package/src/transform/transform.ts +32 -44
- package/src/transform/transfrom-rlc-options.ts +461 -0
- package/src/utils/client-utils.ts +162 -0
- package/src/utils/credential-utils.ts +74 -0
- package/src/utils/cross-language-def.ts +66 -0
- package/src/utils/emit-util.ts +92 -0
- package/src/utils/file-system-utils.ts +69 -0
- package/src/utils/import-helper.ts +59 -0
- package/src/utils/interfaces.ts +2 -2
- package/src/utils/media-types.ts +150 -0
- package/src/utils/model-utils.ts +1727 -0
- package/src/utils/namespace-utils.ts +84 -0
- package/src/utils/operation-util.ts +763 -0
- package/src/utils/parameter-utils.ts +192 -0
- package/src/utils/resolve-project-root.ts +3 -3
- package/static/static-helpers/cloudSettingHelpers.ts +4 -6
- package/static/static-helpers/multipartHelpers.ts +3 -3
- package/static/static-helpers/pagingHelpers.ts +28 -63
- package/static/static-helpers/pollingHelpers.ts +16 -29
- package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
- package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
- package/static/static-helpers/serialization/get-binary-response-browser.mts +3 -1
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
- package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
- package/static/static-helpers/serialization/serialize-record.ts +1 -1
- package/static/static-helpers/serialization/serializers.ts +5 -7
- package/static/static-helpers/serialization/xml-helpers.ts +42 -90
- package/static/static-helpers/simplePollerHelpers.ts +10 -19
- package/static/static-helpers/storageCompatResponse.ts +10 -27
- package/static/static-helpers/urlTemplate.ts +4 -7
- package/static/test-helpers/recordedClient.ts +5 -10
- package/dist/src/contextManager.d.ts +0 -75
- package/dist/src/contextManager.d.ts.map +0 -1
- package/dist/src/contextManager.js +0 -59
- package/dist/src/contextManager.js.map +0 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +0 -26
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +0 -1
- package/dist/src/framework/hooks/sdkTypes.js +0 -161
- package/dist/src/framework/hooks/sdkTypes.js.map +0 -1
- package/dist/src/framework/hooks/useDependencies.d.ts +0 -4
- package/dist/src/framework/hooks/useDependencies.d.ts.map +0 -1
- package/dist/src/framework/hooks/useDependencies.js +0 -13
- package/dist/src/framework/hooks/useDependencies.js.map +0 -1
- package/dist/src/metaTree.d.ts +0 -7
- package/dist/src/metaTree.d.ts.map +0 -1
- package/dist/src/metaTree.js +0 -2
- package/dist/src/metaTree.js.map +0 -1
- package/dist/src/modular/buildClassicalClient.d.ts +0 -6
- package/dist/src/modular/buildClassicalClient.d.ts.map +0 -1
- package/dist/src/modular/buildClassicalClient.js +0 -359
- package/dist/src/modular/buildClassicalClient.js.map +0 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +0 -6
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +0 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +0 -50
- package/dist/src/modular/buildClassicalOperationGroups.js.map +0 -1
- package/dist/src/modular/buildClientContext.d.ts +0 -13
- package/dist/src/modular/buildClientContext.d.ts.map +0 -1
- package/dist/src/modular/buildClientContext.js +0 -253
- package/dist/src/modular/buildClientContext.js.map +0 -1
- package/dist/src/modular/buildModularOptions.d.ts +0 -6
- package/dist/src/modular/buildModularOptions.d.ts.map +0 -1
- package/dist/src/modular/buildModularOptions.js +0 -15
- package/dist/src/modular/buildModularOptions.js.map +0 -1
- package/dist/src/modular/buildOperations.d.ts +0 -21
- package/dist/src/modular/buildOperations.d.ts.map +0 -1
- package/dist/src/modular/buildOperations.js +0 -174
- package/dist/src/modular/buildOperations.js.map +0 -1
- package/dist/src/modular/buildProjectFiles.d.ts +0 -4
- package/dist/src/modular/buildProjectFiles.d.ts.map +0 -1
- package/dist/src/modular/buildProjectFiles.js +0 -94
- package/dist/src/modular/buildProjectFiles.js.map +0 -1
- package/dist/src/modular/buildRestorePoller.d.ts +0 -5
- package/dist/src/modular/buildRestorePoller.d.ts.map +0 -1
- package/dist/src/modular/buildRestorePoller.js +0 -217
- package/dist/src/modular/buildRestorePoller.js.map +0 -1
- package/dist/src/modular/buildRootIndex.d.ts +0 -13
- package/dist/src/modular/buildRootIndex.d.ts.map +0 -1
- package/dist/src/modular/buildRootIndex.js +0 -293
- package/dist/src/modular/buildRootIndex.js.map +0 -1
- package/dist/src/modular/buildSubpathIndex.d.ts +0 -16
- package/dist/src/modular/buildSubpathIndex.d.ts.map +0 -1
- package/dist/src/modular/buildSubpathIndex.js +0 -128
- package/dist/src/modular/buildSubpathIndex.js.map +0 -1
- package/dist/src/modular/emitLoggerFile.d.ts +0 -3
- package/dist/src/modular/emitLoggerFile.d.ts.map +0 -1
- package/dist/src/modular/emitLoggerFile.js +0 -18
- package/dist/src/modular/emitLoggerFile.js.map +0 -1
- package/dist/src/modular/emitModels.d.ts +0 -23
- package/dist/src/modular/emitModels.d.ts.map +0 -1
- package/dist/src/modular/emitModels.js +0 -882
- package/dist/src/modular/emitModels.js.map +0 -1
- package/dist/src/modular/emitModelsOptions.d.ts +0 -5
- package/dist/src/modular/emitModelsOptions.d.ts.map +0 -1
- package/dist/src/modular/emitModelsOptions.js +0 -36
- package/dist/src/modular/emitModelsOptions.js.map +0 -1
- package/dist/src/modular/emitSamples.d.ts +0 -7
- package/dist/src/modular/emitSamples.d.ts.map +0 -1
- package/dist/src/modular/emitSamples.js +0 -508
- package/dist/src/modular/emitSamples.js.map +0 -1
- package/dist/src/modular/emitTests.d.ts +0 -7
- package/dist/src/modular/emitTests.d.ts.map +0 -1
- package/dist/src/modular/emitTests.js +0 -160
- package/dist/src/modular/emitTests.js.map +0 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +0 -7
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +0 -267
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +0 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +0 -34
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/clientHelpers.js +0 -282
- package/dist/src/modular/helpers/clientHelpers.js.map +0 -1
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts +0 -43
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js +0 -103
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +0 -1
- package/dist/src/modular/helpers/docsHelpers.d.ts +0 -3
- package/dist/src/modular/helpers/docsHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/docsHelpers.js +0 -10
- package/dist/src/modular/helpers/docsHelpers.js.map +0 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts +0 -83
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +0 -651
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +0 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +0 -22
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/namingHelpers.js +0 -62
- package/dist/src/modular/helpers/namingHelpers.js.map +0 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +0 -105
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/operationHelpers.js +0 -2412
- package/dist/src/modular/helpers/operationHelpers.js.map +0 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +0 -22
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +0 -1
- package/dist/src/modular/helpers/typeHelpers.js +0 -96
- package/dist/src/modular/helpers/typeHelpers.js.map +0 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +0 -7
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +0 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +0 -410
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +0 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +0 -7
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +0 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +0 -454
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +0 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +0 -44
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +0 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +0 -746
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +0 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts +0 -37
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +0 -1
- package/dist/src/modular/serialization/serializeUtils.js +0 -153
- package/dist/src/modular/serialization/serializeUtils.js.map +0 -1
- package/dist/src/rlc-common/buildClient.d.ts +0 -9
- package/dist/src/rlc-common/buildClient.d.ts.map +0 -1
- package/dist/src/rlc-common/buildClient.js +0 -413
- package/dist/src/rlc-common/buildClient.js.map +0 -1
- package/dist/src/rlc-common/buildClientDefinitions.d.ts +0 -6
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +0 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +0 -174
- package/dist/src/rlc-common/buildClientDefinitions.js.map +0 -1
- package/dist/src/rlc-common/buildIndexFile.d.ts +0 -6
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +0 -1
- package/dist/src/rlc-common/buildIndexFile.js +0 -242
- package/dist/src/rlc-common/buildIndexFile.js.map +0 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts +0 -6
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +0 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +0 -224
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +0 -1
- package/dist/src/rlc-common/buildLogger.d.ts +0 -6
- package/dist/src/rlc-common/buildLogger.d.ts.map +0 -1
- package/dist/src/rlc-common/buildLogger.js +0 -32
- package/dist/src/rlc-common/buildLogger.js.map +0 -1
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts +0 -5
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +0 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +0 -54
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +0 -1
- package/dist/src/rlc-common/buildObjectTypes.d.ts +0 -29
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +0 -1
- package/dist/src/rlc-common/buildObjectTypes.js +0 -451
- package/dist/src/rlc-common/buildObjectTypes.js.map +0 -1
- package/dist/src/rlc-common/buildPaginateHelper.d.ts +0 -6
- package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +0 -1
- package/dist/src/rlc-common/buildPaginateHelper.js +0 -27
- package/dist/src/rlc-common/buildPaginateHelper.js.map +0 -1
- package/dist/src/rlc-common/buildParameterTypes.d.ts +0 -14
- package/dist/src/rlc-common/buildParameterTypes.d.ts.map +0 -1
- package/dist/src/rlc-common/buildParameterTypes.js +0 -381
- package/dist/src/rlc-common/buildParameterTypes.js.map +0 -1
- package/dist/src/rlc-common/buildPollingHelper.d.ts +0 -6
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +0 -1
- package/dist/src/rlc-common/buildPollingHelper.js +0 -62
- package/dist/src/rlc-common/buildPollingHelper.js.map +0 -1
- package/dist/src/rlc-common/buildResponseTypes.d.ts +0 -6
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +0 -1
- package/dist/src/rlc-common/buildResponseTypes.js +0 -147
- package/dist/src/rlc-common/buildResponseTypes.js.map +0 -1
- package/dist/src/rlc-common/buildSamples.d.ts +0 -3
- package/dist/src/rlc-common/buildSamples.d.ts.map +0 -1
- package/dist/src/rlc-common/buildSamples.js +0 -30
- package/dist/src/rlc-common/buildSamples.js.map +0 -1
- package/dist/src/rlc-common/buildSchemaType.d.ts +0 -20
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +0 -1
- package/dist/src/rlc-common/buildSchemaType.js +0 -53
- package/dist/src/rlc-common/buildSchemaType.js.map +0 -1
- package/dist/src/rlc-common/buildSerializeHelper.d.ts +0 -6
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +0 -1
- package/dist/src/rlc-common/buildSerializeHelper.js +0 -36
- package/dist/src/rlc-common/buildSerializeHelper.js.map +0 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts +0 -6
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +0 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +0 -52
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +0 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts +0 -17
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +0 -45
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +0 -1
- package/dist/src/rlc-common/helpers/importsUtil.d.ts +0 -18
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +0 -169
- package/dist/src/rlc-common/helpers/importsUtil.js.map +0 -1
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts +0 -42
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js +0 -63
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +0 -1
- package/dist/src/rlc-common/helpers/nameUtils.d.ts +0 -37
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +0 -246
- package/dist/src/rlc-common/helpers/nameUtils.js.map +0 -1
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts +0 -16
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +0 -119
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +0 -1
- package/dist/src/rlc-common/helpers/packageUtil.d.ts +0 -7
- package/dist/src/rlc-common/helpers/packageUtil.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/packageUtil.js +0 -13
- package/dist/src/rlc-common/helpers/packageUtil.js.map +0 -1
- package/dist/src/rlc-common/helpers/pathUtils.d.ts +0 -2
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/pathUtils.js +0 -12
- package/dist/src/rlc-common/helpers/pathUtils.js.map +0 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts +0 -10
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +0 -41
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +0 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +0 -4
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.js +0 -49
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +0 -1
- package/dist/src/rlc-common/helpers/typeUtil.d.ts +0 -32
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +0 -167
- package/dist/src/rlc-common/helpers/typeUtil.js.map +0 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts +0 -12
- package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts.map +0 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +0 -165
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts +0 -6
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +0 -56
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts +0 -6
- package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +0 -26
- package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts +0 -6
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +0 -82
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts +0 -5
- package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +0 -32
- package/dist/src/rlc-common/metadata/buildLicenseFile.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts +0 -25
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +0 -201
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts +0 -11
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +0 -426
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts +0 -6
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +0 -142
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts +0 -6
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +0 -17
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.d.ts +0 -16
- package/dist/src/rlc-common/metadata/buildTestConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +0 -55
- package/dist/src/rlc-common/metadata/buildTestConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts +0 -61
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +0 -170
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts +0 -6
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +0 -28
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts +0 -20
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +0 -77
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +0 -51
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +0 -121
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts +0 -242
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +0 -176
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts +0 -8
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +0 -102
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts +0 -57
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +0 -53
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts +0 -64
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +0 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +0 -183
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +0 -1
- package/dist/src/rlc-common/static/paginateContent.d.ts +0 -2
- package/dist/src/rlc-common/static/paginateContent.d.ts.map +0 -1
- package/dist/src/rlc-common/static/paginateContent.js +0 -345
- package/dist/src/rlc-common/static/paginateContent.js.map +0 -1
- package/dist/src/rlc-common/static/pollingContent.d.ts +0 -2
- package/dist/src/rlc-common/static/pollingContent.d.ts.map +0 -1
- package/dist/src/rlc-common/static/pollingContent.js +0 -225
- package/dist/src/rlc-common/static/pollingContent.js.map +0 -1
- package/dist/src/rlc-common/static/sampleTemplate.d.ts +0 -2
- package/dist/src/rlc-common/static/sampleTemplate.d.ts.map +0 -1
- package/dist/src/rlc-common/static/sampleTemplate.js +0 -56
- package/dist/src/rlc-common/static/sampleTemplate.js.map +0 -1
- package/dist/src/rlc-common/static/serializeHelper.d.ts +0 -6
- package/dist/src/rlc-common/static/serializeHelper.d.ts.map +0 -1
- package/dist/src/rlc-common/static/serializeHelper.js +0 -31
- package/dist/src/rlc-common/static/serializeHelper.js.map +0 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.d.ts +0 -6
- package/dist/src/rlc-common/test/buildKarmaConfig.d.ts.map +0 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +0 -11
- package/dist/src/rlc-common/test/buildKarmaConfig.js.map +0 -1
- package/dist/src/rlc-common/test/buildRecordedClient.d.ts +0 -6
- package/dist/src/rlc-common/test/buildRecordedClient.d.ts.map +0 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +0 -18
- package/dist/src/rlc-common/test/buildRecordedClient.js.map +0 -1
- package/dist/src/rlc-common/test/buildSampleTest.d.ts +0 -6
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +0 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +0 -15
- package/dist/src/rlc-common/test/buildSampleTest.js.map +0 -1
- package/dist/src/rlc-common/test/buildSnippets.d.ts +0 -6
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +0 -1
- package/dist/src/rlc-common/test/buildSnippets.js +0 -29
- package/dist/src/rlc-common/test/buildSnippets.js.map +0 -1
- package/dist/src/rlc-common/transformSampleGroups.d.ts +0 -9
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +0 -1
- package/dist/src/rlc-common/transformSampleGroups.js +0 -317
- package/dist/src/rlc-common/transformSampleGroups.js.map +0 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +0 -6
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +0 -1
- package/dist/src/transform/transformApiVersionInfo.js +0 -80
- package/dist/src/transform/transformApiVersionInfo.js.map +0 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +0 -5
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +0 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +0 -77
- package/dist/src/transform/transformHelperFunctionDetails.js.map +0 -1
- package/dist/src/transform/transformParameters.d.ts +0 -14
- package/dist/src/transform/transformParameters.d.ts.map +0 -1
- package/dist/src/transform/transformParameters.js +0 -214
- package/dist/src/transform/transformParameters.js.map +0 -1
- package/dist/src/transform/transformPaths.d.ts +0 -5
- package/dist/src/transform/transformPaths.d.ts.map +0 -1
- package/dist/src/transform/transformPaths.js +0 -106
- package/dist/src/transform/transformPaths.js.map +0 -1
- package/dist/src/transform/transformResponses.d.ts +0 -5
- package/dist/src/transform/transformResponses.d.ts.map +0 -1
- package/dist/src/transform/transformResponses.js +0 -175
- package/dist/src/transform/transformResponses.js.map +0 -1
- package/dist/src/transform/transformSchemas.d.ts +0 -4
- package/dist/src/transform/transformSchemas.d.ts.map +0 -1
- package/dist/src/transform/transformSchemas.js +0 -202
- package/dist/src/transform/transformSchemas.js.map +0 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts +0 -4
- package/dist/src/transform/transformTelemetryInfo.d.ts.map +0 -1
- package/dist/src/transform/transformTelemetryInfo.js +0 -22
- package/dist/src/transform/transformTelemetryInfo.js.map +0 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +0 -14
- package/dist/src/transform/transfromRLCOptions.d.ts.map +0 -1
- package/dist/src/transform/transfromRLCOptions.js +0 -380
- package/dist/src/transform/transfromRLCOptions.js.map +0 -1
- package/dist/src/utils/clientUtils.d.ts +0 -10
- package/dist/src/utils/clientUtils.d.ts.map +0 -1
- package/dist/src/utils/clientUtils.js +0 -132
- package/dist/src/utils/clientUtils.js.map +0 -1
- package/dist/src/utils/credentialUtils.d.ts +0 -15
- package/dist/src/utils/credentialUtils.d.ts.map +0 -1
- package/dist/src/utils/credentialUtils.js +0 -69
- package/dist/src/utils/credentialUtils.js.map +0 -1
- package/dist/src/utils/crossLanguageDef.d.ts +0 -6
- package/dist/src/utils/crossLanguageDef.d.ts.map +0 -1
- package/dist/src/utils/crossLanguageDef.js +0 -63
- package/dist/src/utils/crossLanguageDef.js.map +0 -1
- package/dist/src/utils/emitUtil.d.ts +0 -5
- package/dist/src/utils/emitUtil.d.ts.map +0 -1
- package/dist/src/utils/emitUtil.js +0 -73
- package/dist/src/utils/emitUtil.js.map +0 -1
- package/dist/src/utils/fileSystemUtils.d.ts +0 -3
- package/dist/src/utils/fileSystemUtils.d.ts.map +0 -1
- package/dist/src/utils/fileSystemUtils.js +0 -40
- package/dist/src/utils/fileSystemUtils.js.map +0 -1
- package/dist/src/utils/importHelper.d.ts +0 -10
- package/dist/src/utils/importHelper.d.ts.map +0 -1
- package/dist/src/utils/importHelper.js +0 -54
- package/dist/src/utils/importHelper.js.map +0 -1
- package/dist/src/utils/mediaTypes.d.ts +0 -28
- package/dist/src/utils/mediaTypes.d.ts.map +0 -1
- package/dist/src/utils/mediaTypes.js +0 -136
- package/dist/src/utils/mediaTypes.js.map +0 -1
- package/dist/src/utils/modelUtils.d.ts +0 -60
- package/dist/src/utils/modelUtils.d.ts.map +0 -1
- package/dist/src/utils/modelUtils.js +0 -1577
- package/dist/src/utils/modelUtils.js.map +0 -1
- package/dist/src/utils/namespaceUtils.d.ts +0 -6
- package/dist/src/utils/namespaceUtils.d.ts.map +0 -1
- package/dist/src/utils/namespaceUtils.js +0 -70
- package/dist/src/utils/namespaceUtils.js.map +0 -1
- package/dist/src/utils/operationUtil.d.ts +0 -97
- package/dist/src/utils/operationUtil.d.ts.map +0 -1
- package/dist/src/utils/operationUtil.js +0 -568
- package/dist/src/utils/operationUtil.js.map +0 -1
- package/dist/src/utils/parameterUtils.d.ts +0 -9
- package/dist/src/utils/parameterUtils.d.ts.map +0 -1
- package/dist/src/utils/parameterUtils.js +0 -154
- package/dist/src/utils/parameterUtils.js.map +0 -1
- package/src/contextManager.ts +0 -104
- package/src/framework/hooks/sdkTypes.ts +0 -245
- package/src/framework/hooks/useDependencies.ts +0 -18
- package/src/metaTree.ts +0 -8
- package/src/modular/buildClassicalClient.ts +0 -511
- package/src/modular/buildClassicalOperationGroups.ts +0 -94
- package/src/modular/buildClientContext.ts +0 -354
- package/src/modular/buildModularOptions.ts +0 -23
- package/src/modular/buildOperations.ts +0 -275
- package/src/modular/buildProjectFiles.ts +0 -140
- package/src/modular/buildRestorePoller.ts +0 -261
- package/src/modular/buildRootIndex.ts +0 -481
- package/src/modular/buildSubpathIndex.ts +0 -175
- package/src/modular/emitLoggerFile.ts +0 -28
- package/src/modular/emitModels.ts +0 -1211
- package/src/modular/emitModelsOptions.ts +0 -62
- package/src/modular/emitSamples.ts +0 -763
- package/src/modular/emitTests.ts +0 -227
- package/src/modular/helpers/classicalOperationHelpers.ts +0 -428
- package/src/modular/helpers/clientHelpers.ts +0 -409
- package/src/modular/helpers/clientOptionHelpers.ts +0 -129
- package/src/modular/helpers/exampleValueHelpers.ts +0 -967
- package/src/modular/helpers/namingHelpers.ts +0 -100
- package/src/modular/helpers/operationHelpers.ts +0 -3362
- package/src/modular/helpers/typeHelpers.ts +0 -142
- package/src/modular/serialization/buildDeserializerFunction.ts +0 -598
- package/src/modular/serialization/buildSerializerFunction.ts +0 -654
- package/src/modular/serialization/buildXmlSerializerFunction.ts +0 -1030
- package/src/modular/serialization/serializeUtils.ts +0 -227
- package/src/rlc-common/buildClient.ts +0 -561
- package/src/rlc-common/buildClientDefinitions.ts +0 -278
- package/src/rlc-common/buildIndexFile.ts +0 -344
- package/src/rlc-common/buildIsUnexpectedHelper.ts +0 -255
- package/src/rlc-common/buildLogger.ts +0 -43
- package/src/rlc-common/buildMethodShortcuts.ts +0 -83
- package/src/rlc-common/buildObjectTypes.ts +0 -680
- package/src/rlc-common/buildPaginateHelper.ts +0 -34
- package/src/rlc-common/buildParameterTypes.ts +0 -575
- package/src/rlc-common/buildPollingHelper.ts +0 -83
- package/src/rlc-common/buildResponseTypes.ts +0 -203
- package/src/rlc-common/buildSamples.ts +0 -32
- package/src/rlc-common/buildSchemaType.ts +0 -81
- package/src/rlc-common/buildSerializeHelper.ts +0 -49
- package/src/rlc-common/buildTopLevelIndexFile.ts +0 -65
- package/src/rlc-common/helpers/apiVersionUtil.ts +0 -53
- package/src/rlc-common/helpers/importsUtil.ts +0 -187
- package/src/rlc-common/helpers/nameConstructors.ts +0 -144
- package/src/rlc-common/helpers/nameUtils.ts +0 -319
- package/src/rlc-common/helpers/operationHelpers.ts +0 -155
- package/src/rlc-common/helpers/pathUtils.ts +0 -15
- package/src/rlc-common/helpers/schemaHelpers.ts +0 -61
- package/src/rlc-common/helpers/shortcutMethods.ts +0 -67
- package/src/rlc-common/helpers/typeUtil.ts +0 -173
- package/src/rlc-common/helpers/valueGenerationUtil.ts +0 -257
- package/src/rlc-common/metadata/buildApiExtractorConfig.ts +0 -71
- package/src/rlc-common/metadata/buildChangelogFile.ts +0 -29
- package/src/rlc-common/metadata/buildESLintConfig.ts +0 -86
- package/src/rlc-common/metadata/buildLicenseFile.ts +0 -33
- package/src/rlc-common/metadata/buildPackageFile.ts +0 -250
- package/src/rlc-common/metadata/buildReadmeFile.ts +0 -528
- package/src/rlc-common/metadata/buildRollupConfig.ts +0 -150
- package/src/rlc-common/metadata/buildSampleEnvFile.ts +0 -22
- package/src/rlc-common/metadata/buildTestConfig.ts +0 -72
- package/src/rlc-common/metadata/buildTsConfig.ts +0 -222
- package/src/rlc-common/metadata/buildVitestConfig.ts +0 -36
- package/src/rlc-common/metadata/buildWarpConfig.ts +0 -94
- package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +0 -161
- package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +0 -220
- package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +0 -134
- package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +0 -70
- package/src/rlc-common/metadata/packageJson/packageCommon.ts +0 -255
- package/src/rlc-common/test/buildKarmaConfig.ts +0 -12
- package/src/rlc-common/test/buildRecordedClient.ts +0 -18
- package/src/rlc-common/test/buildSampleTest.ts +0 -15
- package/src/rlc-common/test/buildSnippets.ts +0 -35
- package/src/rlc-common/transformSampleGroups.ts +0 -458
- package/src/transform/transformApiVersionInfo.ts +0 -116
- package/src/transform/transformHelperFunctionDetails.ts +0 -100
- package/src/transform/transformParameters.ts +0 -371
- package/src/transform/transformPaths.ts +0 -174
- package/src/transform/transformResponses.ts +0 -244
- package/src/transform/transformSchemas.ts +0 -230
- package/src/transform/transformTelemetryInfo.ts +0 -39
- package/src/transform/transfromRLCOptions.ts +0 -524
- package/src/utils/clientUtils.ts +0 -181
- package/src/utils/credentialUtils.ts +0 -85
- package/src/utils/crossLanguageDef.ts +0 -85
- package/src/utils/emitUtil.ts +0 -98
- package/src/utils/fileSystemUtils.ts +0 -47
- package/src/utils/importHelper.ts +0 -64
- package/src/utils/mediaTypes.ts +0 -171
- package/src/utils/modelUtils.ts +0 -1946
- package/src/utils/namespaceUtils.ts +0 -100
- package/src/utils/operationUtil.ts +0 -855
- package/src/utils/parameterUtils.ts +0 -215
- /package/src/modular/helpers/{docsHelpers.ts → docs-helpers.ts} +0 -0
- /package/src/rlc-common/helpers/{packageUtil.ts → package-util.ts} +0 -0
- /package/src/rlc-common/static/{paginateContent.ts → paginate-content.ts} +0 -0
- /package/src/rlc-common/static/{pollingContent.ts → polling-content.ts} +0 -0
- /package/src/rlc-common/static/{sampleTemplate.ts → sample-template.ts} +0 -0
- /package/src/rlc-common/static/{serializeHelper.ts → serialize-helper.ts} +0 -0
|
@@ -0,0 +1,1480 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { getUnionAsEnum } from "@azure-tools/typespec-azure-core";
|
|
4
|
+
import { getDefaultApiVersion, getWireName, isApiVersion, } from "@azure-tools/typespec-client-generator-core";
|
|
5
|
+
import { NoTarget, getDiscriminator, getDoc, getEffectiveModelType, getEncode, getFormat, getFriendlyName, getLifecycleVisibilityEnum, getMaxLength, getMaxValue, getMinLength, getMinValue, getPattern, getProperty, getPropertyType, getSummary, getVisibilityForClass, isArrayModelType, isNeverType, isNullType, isNumericType, isRecordModelType, isSecret, isStringType, isTemplateDeclaration, isUnknownType, listServices, } from "@typespec/compiler";
|
|
6
|
+
import { Visibility, getHeaderFieldName, getHttpFileModel, getHttpPart, getPathParamName, getQueryParamName, isBody, isStatusCode, } from "@typespec/http";
|
|
7
|
+
import { NameType, SchemaContext, isArraySchema, normalizeName, } from "../rlc-common/index.js";
|
|
8
|
+
import { KnownMediaType, hasMediaType, isMediaTypeMultipartFormData } from "./media-types.js";
|
|
9
|
+
import { reportDiagnostic } from "../lib.js";
|
|
10
|
+
import { getModelNamespaceName } from "./namespace-utils.js";
|
|
11
|
+
export const BINARY_TYPE_UNION = "string | Uint8Array | ReadableStream<Uint8Array> | NodeReadableStream";
|
|
12
|
+
export const BINARY_AND_FILE_TYPE_UNION = `${BINARY_TYPE_UNION} | File`;
|
|
13
|
+
export function getBinaryType(usage) {
|
|
14
|
+
return usage.includes(SchemaContext.Output) ? "Uint8Array" : BINARY_TYPE_UNION;
|
|
15
|
+
}
|
|
16
|
+
export function isByteOrByteUnion(dpgContext, type) {
|
|
17
|
+
const schema = getSchemaForType(dpgContext, type);
|
|
18
|
+
return isBytesType(schema) || isBytesUnion(schema);
|
|
19
|
+
}
|
|
20
|
+
function isBytesType(schema) {
|
|
21
|
+
return schema.type === "string" && (schema.format === "bytes" || schema.format === "binary");
|
|
22
|
+
}
|
|
23
|
+
function isBytesUnion(schema) {
|
|
24
|
+
if (!Array.isArray(schema.enum)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
for (const ele of schema.enum) {
|
|
28
|
+
if (isBytesType(ele)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
function refineByteType(schema) {
|
|
35
|
+
schema.typeName = getBinaryType([SchemaContext.Input, SchemaContext.Exception]);
|
|
36
|
+
schema.outputTypeName = getBinaryType([SchemaContext.Output]);
|
|
37
|
+
return schema;
|
|
38
|
+
}
|
|
39
|
+
export function enrichBinaryTypeInBody(schema) {
|
|
40
|
+
if (isBytesType(schema)) {
|
|
41
|
+
refineByteType(schema);
|
|
42
|
+
}
|
|
43
|
+
else if (isBytesUnion(schema)) {
|
|
44
|
+
const inputType = [];
|
|
45
|
+
for (const item of schema.enum) {
|
|
46
|
+
if (isBytesType(item)) {
|
|
47
|
+
refineByteType(item);
|
|
48
|
+
}
|
|
49
|
+
// ignore the string type for input because we already have it in bytes union
|
|
50
|
+
if (getTypeName(item, [SchemaContext.Input]) !== "string") {
|
|
51
|
+
inputType.push(getTypeName(item, [SchemaContext.Input]));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// refine the input type
|
|
55
|
+
schema.typeName = inputType.join(" | ");
|
|
56
|
+
}
|
|
57
|
+
return schema;
|
|
58
|
+
}
|
|
59
|
+
export function getSchemaForType(dpgContext, typeInput, options) {
|
|
60
|
+
const program = dpgContext.program;
|
|
61
|
+
const { usage } = options ?? {};
|
|
62
|
+
const type = getEffectiveModelFromType(dpgContext, typeInput);
|
|
63
|
+
const builtinType = getSchemaForLiteral(type);
|
|
64
|
+
if (builtinType !== undefined) {
|
|
65
|
+
// add in description elements for types derived from primitive types (SecureString, etc.)
|
|
66
|
+
const doc = getDoc(program, type);
|
|
67
|
+
if (doc) {
|
|
68
|
+
builtinType.description = doc;
|
|
69
|
+
}
|
|
70
|
+
return builtinType;
|
|
71
|
+
}
|
|
72
|
+
if (type.kind === "ModelProperty") {
|
|
73
|
+
return getSchemaForType(dpgContext, type.type, options);
|
|
74
|
+
}
|
|
75
|
+
if (type.kind === "Model") {
|
|
76
|
+
const httpPart = getHttpPart(program, type);
|
|
77
|
+
if (httpPart) {
|
|
78
|
+
const fileModel = getHttpFileModel(program, httpPart.type);
|
|
79
|
+
if (fileModel) {
|
|
80
|
+
const schema = getSchemaForType(dpgContext, fileModel.contents, options);
|
|
81
|
+
return {
|
|
82
|
+
...schema,
|
|
83
|
+
multipartOptions: {
|
|
84
|
+
filenameSchema: {
|
|
85
|
+
required: !fileModel.filename.optional,
|
|
86
|
+
...getSchemaForType(dpgContext, fileModel.filename, options),
|
|
87
|
+
},
|
|
88
|
+
contentTypeSchema: {
|
|
89
|
+
required: !fileModel.contentType.optional,
|
|
90
|
+
...getSchemaForType(dpgContext, fileModel.contentType, options),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// extract body if required
|
|
97
|
+
const body = (httpPart.type.kind === "Model" &&
|
|
98
|
+
[...httpPart.type.properties.values()].find((x) => isBody(program, x))) ||
|
|
99
|
+
httpPart.type;
|
|
100
|
+
return getSchemaForType(dpgContext, body, options);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const schema = getSchemaForModel(dpgContext, type, options);
|
|
104
|
+
if (isAnonymousObjectSchema(schema)) {
|
|
105
|
+
if (Object.keys(schema.properties ?? {}).length === 0) {
|
|
106
|
+
// Handle empty anonymous model as Record
|
|
107
|
+
schema.typeName = schema.type === "object" ? "Record<string, unknown>" : "unknown";
|
|
108
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
109
|
+
schema.outputTypeName = schema.type === "object" ? "Record<string, any>" : "any";
|
|
110
|
+
}
|
|
111
|
+
schema.type = "unknown";
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Handle non-empty anonymous model as inline model
|
|
115
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
116
|
+
schema.outputTypeName = getModelInlineSigniture(schema, {
|
|
117
|
+
usage: [SchemaContext.Output],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
schema.typeName = getModelInlineSigniture(schema, {
|
|
121
|
+
usage: [SchemaContext.Input],
|
|
122
|
+
multipart: options?.isRequestBody && isMediaTypeMultipartFormData(options?.mediaTypes ?? []),
|
|
123
|
+
});
|
|
124
|
+
schema.type = "object";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (!isArrayModelType(type) && !isRecordModelType(type)) {
|
|
128
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
129
|
+
schema.outputTypeName = `${schema.name}Output`;
|
|
130
|
+
}
|
|
131
|
+
schema.typeName = `${schema.name}`;
|
|
132
|
+
}
|
|
133
|
+
schema.usage = usage;
|
|
134
|
+
return schema;
|
|
135
|
+
}
|
|
136
|
+
else if (type.kind === "Union") {
|
|
137
|
+
return getSchemaForUnion(dpgContext, type, options);
|
|
138
|
+
}
|
|
139
|
+
else if (type.kind === "UnionVariant") {
|
|
140
|
+
return getSchemaForUnionVariant(dpgContext, type, options);
|
|
141
|
+
}
|
|
142
|
+
else if (type.kind === "Enum") {
|
|
143
|
+
return getSchemaForEnum(dpgContext, type);
|
|
144
|
+
}
|
|
145
|
+
else if (type.kind === "Scalar") {
|
|
146
|
+
return getSchemaForScalar(dpgContext, type, options);
|
|
147
|
+
}
|
|
148
|
+
else if (type.kind === "EnumMember") {
|
|
149
|
+
return getSchemaForEnumMember(program, type);
|
|
150
|
+
}
|
|
151
|
+
if (isUnknownType(type)) {
|
|
152
|
+
const returnType = { name: "unknown", type: "unknown" };
|
|
153
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
154
|
+
returnType.outputTypeName = "any";
|
|
155
|
+
returnType.typeName = "unknown";
|
|
156
|
+
}
|
|
157
|
+
return returnType;
|
|
158
|
+
}
|
|
159
|
+
if (isNeverType(type)) {
|
|
160
|
+
return { name: "never", type: "never" };
|
|
161
|
+
}
|
|
162
|
+
if (isNullType(type)) {
|
|
163
|
+
return { name: "null", type: "null" };
|
|
164
|
+
}
|
|
165
|
+
if (type.kind === "Intrinsic" && type.name === "void") {
|
|
166
|
+
return { name: "void", type: "void" };
|
|
167
|
+
}
|
|
168
|
+
reportDiagnostic(program, {
|
|
169
|
+
code: "invalid-schema",
|
|
170
|
+
format: {
|
|
171
|
+
type: type.kind,
|
|
172
|
+
property: options?.relevantProperty?.name ?? "",
|
|
173
|
+
},
|
|
174
|
+
target: type,
|
|
175
|
+
});
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
export function getEffectiveModelFromType(context, type) {
|
|
179
|
+
/**
|
|
180
|
+
* If type is an anonymous model, tries to find a named model that has the same
|
|
181
|
+
* set of properties when non-schema properties are excluded.
|
|
182
|
+
*/
|
|
183
|
+
if (type.kind === "Model" && type.name === "") {
|
|
184
|
+
const effective = getEffectiveModelType(context.program, type, (property) => isSchemaProperty(context.program, property));
|
|
185
|
+
if (effective.name) {
|
|
186
|
+
return effective;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return type;
|
|
190
|
+
}
|
|
191
|
+
export function includeDerivedModel(model, needRef = false) {
|
|
192
|
+
return (!needRef &&
|
|
193
|
+
!isTemplateDeclaration(model) &&
|
|
194
|
+
(!model.templateMapper ||
|
|
195
|
+
!model.templateMapper.args ||
|
|
196
|
+
model.templateMapper.args?.length === 0 ||
|
|
197
|
+
model.derivedModels.length > 0));
|
|
198
|
+
}
|
|
199
|
+
function applyEncoding(dpgContext, typespecType, target = {}) {
|
|
200
|
+
const encodeData = getEncode(dpgContext.program, typespecType);
|
|
201
|
+
if (encodeData) {
|
|
202
|
+
const newTarget = { ...target };
|
|
203
|
+
const newType = getSchemaForScalar(dpgContext, encodeData.type);
|
|
204
|
+
newTarget["type"] = newType["type"];
|
|
205
|
+
newTarget["typeName"] = newType["typeName"];
|
|
206
|
+
newTarget["outputTypeName"] = newType["outputTypeName"];
|
|
207
|
+
// If the target already has a format it takes priority. (e.g. int32)
|
|
208
|
+
newTarget["format"] = mergeFormatAndEncoding(newTarget.format, encodeData.encoding, newType["format"]);
|
|
209
|
+
return newTarget;
|
|
210
|
+
}
|
|
211
|
+
return target;
|
|
212
|
+
}
|
|
213
|
+
function mergeFormatAndEncoding(format, encoding, encodeAsFormat) {
|
|
214
|
+
switch (format) {
|
|
215
|
+
case undefined:
|
|
216
|
+
return encodeAsFormat ?? encoding ?? format;
|
|
217
|
+
case "date-time":
|
|
218
|
+
return encoding;
|
|
219
|
+
case "duration":
|
|
220
|
+
default:
|
|
221
|
+
return encodeAsFormat ?? encoding ?? format;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function getSchemaForScalar(dpgContext, scalar, options) {
|
|
225
|
+
let result = {};
|
|
226
|
+
const isStd = dpgContext.program.checker.isStdType(scalar);
|
|
227
|
+
const { relevantProperty, isRequestBody, isParentRequestBody, mediaTypes: contentTypes, } = options ?? {};
|
|
228
|
+
if (isStd) {
|
|
229
|
+
result = getSchemaForStdScalar(dpgContext.program, scalar, {
|
|
230
|
+
relevantProperty,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else if (scalar.baseScalar) {
|
|
234
|
+
result = getSchemaForScalar(dpgContext, scalar.baseScalar);
|
|
235
|
+
}
|
|
236
|
+
if (isBinaryAsRequestBody()) {
|
|
237
|
+
// bytes in the body of application/octet-stream is the raw binary payload/file
|
|
238
|
+
result.typeName = BINARY_TYPE_UNION;
|
|
239
|
+
result.outputTypeName = "Uint8Array";
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
else if (isFormDataBytesInRequestBody()) {
|
|
243
|
+
// bytes inside a multipart part (for now) is assumed to be file
|
|
244
|
+
result.typeName = BINARY_AND_FILE_TYPE_UNION;
|
|
245
|
+
result.outputTypeName = "Uint8Array";
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
// for other cases we would trust the @encode decorator if not present we would treat it as string
|
|
250
|
+
const withDecorators = applyEncoding(dpgContext, scalar, result ? applyIntrinsicDecorators(dpgContext.program, scalar, result) : undefined);
|
|
251
|
+
if (withDecorators.type === "string" && withDecorators.format === "binary") {
|
|
252
|
+
withDecorators.typeName = BINARY_TYPE_UNION;
|
|
253
|
+
withDecorators.outputTypeName = "Uint8Array";
|
|
254
|
+
}
|
|
255
|
+
return withDecorators;
|
|
256
|
+
}
|
|
257
|
+
function isBinaryAsRequestBody() {
|
|
258
|
+
return (hasMediaType(KnownMediaType.Binary, contentTypes) && isRequestBody && isBytesType(result));
|
|
259
|
+
}
|
|
260
|
+
function isFormDataBytesInRequestBody() {
|
|
261
|
+
return (hasMediaType(KnownMediaType.MultipartFormData, contentTypes) &&
|
|
262
|
+
isParentRequestBody &&
|
|
263
|
+
isBytesType(result));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function getSchemaForUnion(dpgContext, union, options) {
|
|
267
|
+
const [asEnum, _] = getUnionAsEnum(union);
|
|
268
|
+
const variants = Array.from(union.variants.values());
|
|
269
|
+
const values = [];
|
|
270
|
+
let namedUnionMember = false;
|
|
271
|
+
if (!(options?.needRef && union.name && !asEnum)) {
|
|
272
|
+
if (asEnum?.open && asEnum.members.size > 0) {
|
|
273
|
+
for (const [_, member] of asEnum.members.entries()) {
|
|
274
|
+
const memberType = getSchemaForType(dpgContext, member.type, {
|
|
275
|
+
...options,
|
|
276
|
+
needRef: options?.needRef ?? false,
|
|
277
|
+
});
|
|
278
|
+
values.push(memberType);
|
|
279
|
+
if (memberType.name) {
|
|
280
|
+
namedUnionMember = true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
for (const variant of variants) {
|
|
286
|
+
// We already know it's not a model type
|
|
287
|
+
const variantType = getSchemaForType(dpgContext, variant.type, {
|
|
288
|
+
...options,
|
|
289
|
+
needRef: isAnonymousModelType(variant.type) ? false : true,
|
|
290
|
+
});
|
|
291
|
+
values.push(variantType);
|
|
292
|
+
if (variantType.typeName) {
|
|
293
|
+
namedUnionMember = true;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const schema = {};
|
|
299
|
+
if (values.length > 0) {
|
|
300
|
+
schema.enum = values;
|
|
301
|
+
const unionAlias = asEnum?.open && asEnum?.kind && !namedUnionMember
|
|
302
|
+
? asEnum.kind + (asEnum.nullable ? " | null" : "")
|
|
303
|
+
: values.map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`).join(" | ");
|
|
304
|
+
const outputUnionAlias = asEnum?.open && asEnum?.kind && !namedUnionMember
|
|
305
|
+
? asEnum.kind + (asEnum.nullable ? " | null" : "")
|
|
306
|
+
: values.map((item) => `${getTypeName(item, [SchemaContext.Output]) ?? item}`).join(" | ");
|
|
307
|
+
schema.alias = unionAlias;
|
|
308
|
+
schema.outputAlias = outputUnionAlias;
|
|
309
|
+
}
|
|
310
|
+
if (!union.expression) {
|
|
311
|
+
const unionName = union.name ? normalizeName(union.name, NameType.Interface) : undefined;
|
|
312
|
+
schema.name = unionName;
|
|
313
|
+
schema.type = "object";
|
|
314
|
+
schema.typeName = unionName;
|
|
315
|
+
schema.outputTypeName = unionName + "Output";
|
|
316
|
+
}
|
|
317
|
+
else if (union.expression && !union.name) {
|
|
318
|
+
schema.type = "union";
|
|
319
|
+
schema.typeName = schema.alias;
|
|
320
|
+
schema.outputTypeName = schema.outputAlias;
|
|
321
|
+
delete schema.alias;
|
|
322
|
+
delete schema.outputAlias;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
schema.type = "union";
|
|
326
|
+
schema.typeName = union.name ?? schema.alias;
|
|
327
|
+
schema.outputTypeName = union.name ? union.name + "Output" : schema.outputAlias;
|
|
328
|
+
delete schema.alias;
|
|
329
|
+
delete schema.outputAlias;
|
|
330
|
+
}
|
|
331
|
+
return schema;
|
|
332
|
+
}
|
|
333
|
+
function getSchemaForUnionVariant(dpgContext, variant, options) {
|
|
334
|
+
return getSchemaForType(dpgContext, variant.type, options);
|
|
335
|
+
}
|
|
336
|
+
// An openapi "string" can be defined in several different ways in typespec
|
|
337
|
+
function isOasString(type) {
|
|
338
|
+
if (type.kind === "String") {
|
|
339
|
+
// A string literal
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
else if (type.kind === "Scalar" && type.name === "string") {
|
|
343
|
+
// string type
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
else if (type.kind === "Union") {
|
|
347
|
+
// A union where all variants are an OasString
|
|
348
|
+
for (const variant of type.variants) {
|
|
349
|
+
if (!isOasString(variant[1].type)) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
else if (type.kind === "UnionVariant") {
|
|
356
|
+
// A union variant where the type is an OasString
|
|
357
|
+
return isOasString(type.type);
|
|
358
|
+
}
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
function isStringLiteral(type) {
|
|
362
|
+
if (type.kind === "Union") {
|
|
363
|
+
// A union where all variants are an OasString
|
|
364
|
+
for (const variant of type.variants) {
|
|
365
|
+
if (!isStringLiteral(variant[1].type)) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
return (type.kind === "String" ||
|
|
372
|
+
(type.kind === "EnumMember" && typeof (type.value ?? type.name) === "string") ||
|
|
373
|
+
(type.kind === "UnionVariant" && type.type.kind === "String"));
|
|
374
|
+
}
|
|
375
|
+
// Return any string literal values for type
|
|
376
|
+
function getStringValues(type) {
|
|
377
|
+
switch (type.kind) {
|
|
378
|
+
case "String":
|
|
379
|
+
return [type.value];
|
|
380
|
+
case "Union":
|
|
381
|
+
return [...type.variants.values()]
|
|
382
|
+
.flatMap((x) => getStringValues(x.type))
|
|
383
|
+
.filter((x) => x !== undefined);
|
|
384
|
+
case "EnumMember":
|
|
385
|
+
return typeof type.value !== "number" ? [type.value ?? type.name] : [];
|
|
386
|
+
case "UnionVariant":
|
|
387
|
+
return getStringValues(type.type);
|
|
388
|
+
default:
|
|
389
|
+
return [];
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function validateDiscriminator(program, discriminator, derivedModels) {
|
|
393
|
+
const { propertyName } = discriminator;
|
|
394
|
+
const retVals = derivedModels.map((t) => {
|
|
395
|
+
const prop = getProperty(t, propertyName);
|
|
396
|
+
if (!prop) {
|
|
397
|
+
reportDiagnostic(program, {
|
|
398
|
+
code: "discriminator",
|
|
399
|
+
messageId: "missing",
|
|
400
|
+
target: t,
|
|
401
|
+
});
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
let retval = true;
|
|
405
|
+
if (!isOasString(prop.type) && prop.type.kind !== "EnumMember" && prop.type.kind !== "Enum") {
|
|
406
|
+
reportDiagnostic(program, {
|
|
407
|
+
code: "discriminator",
|
|
408
|
+
messageId: "type",
|
|
409
|
+
target: prop,
|
|
410
|
+
});
|
|
411
|
+
retval = false;
|
|
412
|
+
}
|
|
413
|
+
if (prop.optional) {
|
|
414
|
+
reportDiagnostic(program, {
|
|
415
|
+
code: "discriminator",
|
|
416
|
+
messageId: "required",
|
|
417
|
+
target: prop,
|
|
418
|
+
});
|
|
419
|
+
retval = false;
|
|
420
|
+
}
|
|
421
|
+
return retval;
|
|
422
|
+
});
|
|
423
|
+
// Map of discriminator value to the model in which it is declared
|
|
424
|
+
const discriminatorValues = new Map();
|
|
425
|
+
for (const t of derivedModels) {
|
|
426
|
+
// Get the discriminator property directly in the child model
|
|
427
|
+
const prop = t.properties?.get(propertyName);
|
|
428
|
+
// Issue warning diagnostic if discriminator property missing or is not a string literal
|
|
429
|
+
if (!prop || !isStringLiteral(prop.type)) {
|
|
430
|
+
reportDiagnostic(program, {
|
|
431
|
+
code: "discriminator-value",
|
|
432
|
+
messageId: "literal",
|
|
433
|
+
target: prop || t,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
if (prop) {
|
|
437
|
+
const vals = getStringValues(prop.type);
|
|
438
|
+
vals.forEach((val) => {
|
|
439
|
+
if (discriminatorValues.has(val)) {
|
|
440
|
+
reportDiagnostic(program, {
|
|
441
|
+
code: "discriminator",
|
|
442
|
+
messageId: "duplicate",
|
|
443
|
+
format: {
|
|
444
|
+
val: val,
|
|
445
|
+
model1: discriminatorValues.get(val),
|
|
446
|
+
model2: t.name,
|
|
447
|
+
},
|
|
448
|
+
target: prop,
|
|
449
|
+
});
|
|
450
|
+
retVals.push(false);
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
discriminatorValues.set(val, t.name);
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return retVals.every((v) => v);
|
|
459
|
+
}
|
|
460
|
+
function getSchemaForModel(dpgContext, model, options) {
|
|
461
|
+
const { usage, needRef, isRequestBody, mediaTypes: contentTypes } = options ?? {};
|
|
462
|
+
if (isArrayModelType(model)) {
|
|
463
|
+
return getSchemaForArrayModel(dpgContext, model, options);
|
|
464
|
+
}
|
|
465
|
+
const program = dpgContext.program;
|
|
466
|
+
const isMultipartBody = isMediaTypeMultipartFormData(contentTypes ?? []);
|
|
467
|
+
const isCoreModel = isAzureCoreErrorType(program, model);
|
|
468
|
+
const modelSchema = {
|
|
469
|
+
name: getModelName(dpgContext, model),
|
|
470
|
+
type: "object",
|
|
471
|
+
isMultipartBody,
|
|
472
|
+
description: getDoc(program, model) ?? "",
|
|
473
|
+
fromCore: isCoreModel,
|
|
474
|
+
};
|
|
475
|
+
// normalized the output name
|
|
476
|
+
modelSchema.name = normalizeName(modelSchema.name, NameType.Interface, true /** shouldGuard */);
|
|
477
|
+
if (model.name === "Record" && isRecordModelType(model)) {
|
|
478
|
+
return getSchemaForRecordModel(dpgContext, model, { usage });
|
|
479
|
+
}
|
|
480
|
+
modelSchema.typeName = modelSchema.name;
|
|
481
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
482
|
+
modelSchema.outputTypeName = modelSchema.name + "Output";
|
|
483
|
+
}
|
|
484
|
+
modelSchema.properties = {};
|
|
485
|
+
// getSchemaOrRef on all children to push them into components.schemas
|
|
486
|
+
const discriminator = getDiscriminator(program, model);
|
|
487
|
+
// should respect needRef for derived models unless there's a discriminator in base model
|
|
488
|
+
const derivedModels = model.derivedModels.filter((dm) => {
|
|
489
|
+
return includeDerivedModel(dm, discriminator ? false : needRef);
|
|
490
|
+
});
|
|
491
|
+
if (derivedModels.length > 0) {
|
|
492
|
+
modelSchema.children = {
|
|
493
|
+
all: [],
|
|
494
|
+
immediate: [],
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
for (const child of derivedModels) {
|
|
498
|
+
const childSchema = getSchemaForType(dpgContext, child, {
|
|
499
|
+
usage,
|
|
500
|
+
needRef: true,
|
|
501
|
+
});
|
|
502
|
+
for (const [name, prop] of child.properties) {
|
|
503
|
+
if (name === discriminator?.propertyName) {
|
|
504
|
+
const propSchema = getSchemaForType(dpgContext, prop.type, {
|
|
505
|
+
usage,
|
|
506
|
+
needRef: !isAnonymousModelType(prop.type),
|
|
507
|
+
relevantProperty: prop,
|
|
508
|
+
});
|
|
509
|
+
childSchema.discriminatorValue = propSchema.type.replace(/"/g, "");
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
modelSchema.children?.all?.push(childSchema);
|
|
514
|
+
modelSchema.children?.immediate?.push(childSchema);
|
|
515
|
+
}
|
|
516
|
+
// Enable option `isPolyParent` and discriminator only when it has valid children
|
|
517
|
+
if (discriminator &&
|
|
518
|
+
modelSchema?.children?.all?.length &&
|
|
519
|
+
modelSchema?.children?.all?.length > 0) {
|
|
520
|
+
if (!validateDiscriminator(program, discriminator, derivedModels)) {
|
|
521
|
+
// appropriate diagnostic is generated in the validate function
|
|
522
|
+
return {};
|
|
523
|
+
}
|
|
524
|
+
const { propertyName } = discriminator;
|
|
525
|
+
modelSchema.discriminator = {
|
|
526
|
+
name: propertyName,
|
|
527
|
+
type: "string",
|
|
528
|
+
description: `Discriminator property for ${model.name}.`,
|
|
529
|
+
};
|
|
530
|
+
modelSchema.discriminatorValue = propertyName;
|
|
531
|
+
modelSchema.isPolyParent = true;
|
|
532
|
+
}
|
|
533
|
+
// applyExternalDocs(model, modelSchema);
|
|
534
|
+
if (needRef) {
|
|
535
|
+
return modelSchema;
|
|
536
|
+
}
|
|
537
|
+
if (isRecordModelType(model)) {
|
|
538
|
+
modelSchema.parents = {
|
|
539
|
+
all: [getSchemaForRecordModel(dpgContext, model, { usage })],
|
|
540
|
+
immediate: [getSchemaForRecordModel(dpgContext, model, { usage })],
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
for (const [propName, prop] of model.properties) {
|
|
544
|
+
const restApiName = getWireName(dpgContext, prop);
|
|
545
|
+
const name = `"${restApiName ?? propName}"`;
|
|
546
|
+
if (!isSchemaProperty(program, prop)) {
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
const propSchema = getSchemaForType(dpgContext, prop.type, {
|
|
550
|
+
usage,
|
|
551
|
+
needRef: isAnonymousModelType(prop.type) ? false : true,
|
|
552
|
+
relevantProperty: prop,
|
|
553
|
+
isParentRequestBody: isRequestBody,
|
|
554
|
+
isRequestBody: false,
|
|
555
|
+
mediaTypes: contentTypes,
|
|
556
|
+
});
|
|
557
|
+
if (propSchema === undefined) {
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
if (!prop.optional) {
|
|
561
|
+
propSchema.required = true;
|
|
562
|
+
}
|
|
563
|
+
const propertyDescription = getFormattedPropertyDoc(program, prop, propSchema);
|
|
564
|
+
propSchema.usage = usage;
|
|
565
|
+
// Use the description from ModelProperty not derived from Model Type
|
|
566
|
+
propSchema.description = propertyDescription;
|
|
567
|
+
modelSchema.properties[name] = propSchema;
|
|
568
|
+
// if this property is a discriminator property, remove it to keep autorest validation happy
|
|
569
|
+
const { propertyName } = getDiscriminator(program, model) || {};
|
|
570
|
+
if (propertyName && name === `"${propertyName}"` && modelSchema.discriminator) {
|
|
571
|
+
modelSchema.discriminator = {
|
|
572
|
+
...modelSchema.discriminator,
|
|
573
|
+
...{
|
|
574
|
+
type: propSchema.typeName ?? propSchema.type,
|
|
575
|
+
typeName: propSchema.typeName,
|
|
576
|
+
outputTypeName: propSchema.outputTypeName,
|
|
577
|
+
},
|
|
578
|
+
};
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
// Apply decorators on the property to the type's schema
|
|
582
|
+
const newPropSchema = applyIntrinsicDecorators(program, prop, propSchema);
|
|
583
|
+
if (newPropSchema === undefined) {
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
// Use the description from ModelProperty not devired from Model Type
|
|
587
|
+
newPropSchema.description = propertyDescription;
|
|
588
|
+
// Should the property be marked as readOnly?
|
|
589
|
+
const vis = getSdkVisibility(program, prop);
|
|
590
|
+
if (vis && vis.includes(Visibility.Read)) {
|
|
591
|
+
const mutability = [];
|
|
592
|
+
if (vis.includes(Visibility.Read)) {
|
|
593
|
+
if (vis.length > 1) {
|
|
594
|
+
mutability.push(SchemaContext.Output);
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
newPropSchema["readOnly"] = true;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (vis.includes(Visibility.Create) || vis.includes(Visibility.Update)) {
|
|
601
|
+
mutability.push(SchemaContext.Input);
|
|
602
|
+
}
|
|
603
|
+
if (mutability.length > 0) {
|
|
604
|
+
newPropSchema["usage"] = mutability;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
modelSchema.properties[name] = newPropSchema;
|
|
608
|
+
}
|
|
609
|
+
if (model.baseModel) {
|
|
610
|
+
if (modelSchema.parents === undefined) {
|
|
611
|
+
modelSchema.parents = {
|
|
612
|
+
all: [],
|
|
613
|
+
immediate: [],
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
modelSchema.parents.all?.push(getSchemaForType(dpgContext, model.baseModel, {
|
|
617
|
+
usage,
|
|
618
|
+
needRef: true,
|
|
619
|
+
}));
|
|
620
|
+
modelSchema.parents.immediate?.push(getSchemaForType(dpgContext, model.baseModel, {
|
|
621
|
+
usage,
|
|
622
|
+
needRef: true,
|
|
623
|
+
}));
|
|
624
|
+
}
|
|
625
|
+
return modelSchema;
|
|
626
|
+
}
|
|
627
|
+
function getSdkVisibility(program, type) {
|
|
628
|
+
const lifecycle = getLifecycleVisibilityEnum(program);
|
|
629
|
+
const visibility = getVisibilityForClass(program, type, lifecycle);
|
|
630
|
+
if (visibility) {
|
|
631
|
+
const result = [];
|
|
632
|
+
if (lifecycle.members.get("Read") && visibility.has(lifecycle.members.get("Read"))) {
|
|
633
|
+
result.push(Visibility.Read);
|
|
634
|
+
}
|
|
635
|
+
if (lifecycle.members.get("Create") && visibility.has(lifecycle.members.get("Create"))) {
|
|
636
|
+
result.push(Visibility.Create);
|
|
637
|
+
}
|
|
638
|
+
if (lifecycle.members.get("Update") && visibility.has(lifecycle.members.get("Update"))) {
|
|
639
|
+
result.push(Visibility.Update);
|
|
640
|
+
}
|
|
641
|
+
if (lifecycle.members.get("Delete") && visibility.has(lifecycle.members.get("Delete"))) {
|
|
642
|
+
result.push(Visibility.Delete);
|
|
643
|
+
}
|
|
644
|
+
if (lifecycle.members.get("Query") && visibility.has(lifecycle.members.get("Query"))) {
|
|
645
|
+
result.push(Visibility.Query);
|
|
646
|
+
}
|
|
647
|
+
return result;
|
|
648
|
+
}
|
|
649
|
+
return undefined;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Return the model name for a given model
|
|
653
|
+
*/
|
|
654
|
+
function getModelName(dpgContext, model) {
|
|
655
|
+
const { program } = dpgContext;
|
|
656
|
+
// 1. check if this is an anonymous model
|
|
657
|
+
if (model.name === "") {
|
|
658
|
+
return "";
|
|
659
|
+
}
|
|
660
|
+
// 2. check if there's a friendly name
|
|
661
|
+
const friendlyName = getFriendlyName(program, model);
|
|
662
|
+
if (friendlyName) {
|
|
663
|
+
return friendlyName;
|
|
664
|
+
}
|
|
665
|
+
// 3. check if this is an Azure Core error model
|
|
666
|
+
const isCoreModel = isAzureCoreErrorType(program, model);
|
|
667
|
+
if (isCoreModel) {
|
|
668
|
+
return model.name;
|
|
669
|
+
}
|
|
670
|
+
// 4. check if this is a model with template arguments
|
|
671
|
+
let name = model.name;
|
|
672
|
+
if (model.templateMapper?.args) {
|
|
673
|
+
// const isPage = getPagedResult(program, model);
|
|
674
|
+
const templateTypeNames = model.templateMapper.args
|
|
675
|
+
.map((arg) => (arg.entityKind === "Indeterminate" ? arg.type : arg))
|
|
676
|
+
.map((arg) => {
|
|
677
|
+
switch (arg.kind) {
|
|
678
|
+
case "Model":
|
|
679
|
+
case "Enum":
|
|
680
|
+
case "Union":
|
|
681
|
+
case "Scalar":
|
|
682
|
+
return arg.name ?? "";
|
|
683
|
+
case "String":
|
|
684
|
+
case "Boolean":
|
|
685
|
+
case "Number":
|
|
686
|
+
return arg.value ?? "";
|
|
687
|
+
default:
|
|
688
|
+
return "";
|
|
689
|
+
}
|
|
690
|
+
})
|
|
691
|
+
.filter((arg) => arg !== "")
|
|
692
|
+
.join(" ");
|
|
693
|
+
name = normalizeName(`${name} ${templateTypeNames}`, NameType.Interface);
|
|
694
|
+
}
|
|
695
|
+
let fullNamespacePrefix = getModelNamespaceName(dpgContext, model.namespace)
|
|
696
|
+
.map((nsName) => {
|
|
697
|
+
return normalizeName(nsName, NameType.Interface);
|
|
698
|
+
})
|
|
699
|
+
.join("");
|
|
700
|
+
if (fullNamespacePrefix.startsWith("AzureResourceManager") ||
|
|
701
|
+
fullNamespacePrefix.startsWith("AzureCore") ||
|
|
702
|
+
fullNamespacePrefix.startsWith("TypeSpecRest") ||
|
|
703
|
+
fullNamespacePrefix.startsWith("TypeSpecHttp")) {
|
|
704
|
+
fullNamespacePrefix = "";
|
|
705
|
+
}
|
|
706
|
+
// 5. check if this model should be namespaced
|
|
707
|
+
return dpgContext.rlcOptions?.enableModelNamespace ? `${fullNamespacePrefix}${name}` : name;
|
|
708
|
+
}
|
|
709
|
+
// Map an typespec type to an OA schema. Returns undefined when the resulting
|
|
710
|
+
// OA schema is just a regular object schema.
|
|
711
|
+
function getSchemaForLiteral(type) {
|
|
712
|
+
switch (type.kind) {
|
|
713
|
+
case "Number":
|
|
714
|
+
return { type: `${type.value}`, isConstant: true };
|
|
715
|
+
case "String":
|
|
716
|
+
return { type: `"${type.value}"`, isConstant: true };
|
|
717
|
+
case "Boolean":
|
|
718
|
+
return { type: `${type.value}`, isConstant: true };
|
|
719
|
+
}
|
|
720
|
+
if (type.kind === undefined) {
|
|
721
|
+
if (typeof type === "string") {
|
|
722
|
+
return { type: `"${type}"` };
|
|
723
|
+
}
|
|
724
|
+
else if (typeof type === "number" || typeof type === "boolean") {
|
|
725
|
+
return { type: `${type}` };
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return undefined;
|
|
729
|
+
}
|
|
730
|
+
function applyIntrinsicDecorators(program, type, target) {
|
|
731
|
+
const newTarget = { ...target };
|
|
732
|
+
const docStr = getDoc(program, type);
|
|
733
|
+
const isString = isStringType(program, getPropertyType(type));
|
|
734
|
+
const isNumeric = isNumericType(program, getPropertyType(type));
|
|
735
|
+
if (isString && !target?.documentation && docStr) {
|
|
736
|
+
newTarget.description = docStr;
|
|
737
|
+
}
|
|
738
|
+
const summaryStr = getSummary(program, type);
|
|
739
|
+
if (isString && !target.summary && summaryStr) {
|
|
740
|
+
newTarget.summary = summaryStr;
|
|
741
|
+
}
|
|
742
|
+
const formatStr = getFormat(program, type);
|
|
743
|
+
if (isString && !target.format && formatStr) {
|
|
744
|
+
newTarget.format = formatStr;
|
|
745
|
+
}
|
|
746
|
+
const pattern = getPattern(program, type);
|
|
747
|
+
if (isString && !target.pattern && pattern) {
|
|
748
|
+
newTarget.pattern = pattern;
|
|
749
|
+
}
|
|
750
|
+
const minLength = getMinLength(program, type);
|
|
751
|
+
if (isString && !target.minLength && minLength !== undefined) {
|
|
752
|
+
newTarget.minLength = minLength;
|
|
753
|
+
}
|
|
754
|
+
const maxLength = getMaxLength(program, type);
|
|
755
|
+
if (isString && !target.maxLength && maxLength !== undefined) {
|
|
756
|
+
newTarget.maxLength = maxLength;
|
|
757
|
+
}
|
|
758
|
+
const minValue = getMinValue(program, type);
|
|
759
|
+
if (isNumeric && !target.minimum && minValue !== undefined) {
|
|
760
|
+
newTarget.minimum = minValue;
|
|
761
|
+
}
|
|
762
|
+
const maxValue = getMaxValue(program, type);
|
|
763
|
+
if (isNumeric && !target.maximum && maxValue !== undefined) {
|
|
764
|
+
newTarget.maximum = maxValue;
|
|
765
|
+
}
|
|
766
|
+
if (isSecret(program, type)) {
|
|
767
|
+
newTarget.format = "password";
|
|
768
|
+
newTarget["x-ms-secret"] = true;
|
|
769
|
+
}
|
|
770
|
+
return newTarget;
|
|
771
|
+
}
|
|
772
|
+
function getSchemaForEnumMember(program, e) {
|
|
773
|
+
const value = e.value ?? e.name;
|
|
774
|
+
const type = enumMemberType(e) === "string" ? `"${value}"` : `${value}`;
|
|
775
|
+
return { type, description: getDoc(program, e), isConstant: true };
|
|
776
|
+
}
|
|
777
|
+
function getSchemaForEnum(dpgContext, e) {
|
|
778
|
+
const values = [];
|
|
779
|
+
const memberValues = Array.from(e.members.values());
|
|
780
|
+
if (memberValues.length === 0) {
|
|
781
|
+
return {};
|
|
782
|
+
}
|
|
783
|
+
const type = enumMemberType(memberValues[0]);
|
|
784
|
+
for (const option of memberValues) {
|
|
785
|
+
if (type !== enumMemberType(option)) {
|
|
786
|
+
reportDiagnostic(dpgContext.program, {
|
|
787
|
+
code: "union-unsupported",
|
|
788
|
+
target: e,
|
|
789
|
+
});
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
values.push(getSchemaForType(dpgContext, option));
|
|
793
|
+
}
|
|
794
|
+
const schema = {
|
|
795
|
+
type: "object",
|
|
796
|
+
name: e.name,
|
|
797
|
+
typeName: normalizeName(e.name, NameType.Interface),
|
|
798
|
+
outputTypeName: normalizeName(e.name, NameType.Interface) + "Output",
|
|
799
|
+
description: getDoc(dpgContext.program, e),
|
|
800
|
+
memberType: type,
|
|
801
|
+
};
|
|
802
|
+
if (values.length > 0) {
|
|
803
|
+
schema.enum = values;
|
|
804
|
+
const unionAlias = values
|
|
805
|
+
.map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`)
|
|
806
|
+
.join(" | ");
|
|
807
|
+
schema.alias = unionAlias;
|
|
808
|
+
schema.outputAlias = unionAlias;
|
|
809
|
+
}
|
|
810
|
+
return schema;
|
|
811
|
+
}
|
|
812
|
+
function enumMemberType(member) {
|
|
813
|
+
const memberValue = member.value;
|
|
814
|
+
if (typeof memberValue === "number") {
|
|
815
|
+
return "number";
|
|
816
|
+
}
|
|
817
|
+
return "string";
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Map TypeSpec intrinsic models to open api definitions
|
|
821
|
+
*/
|
|
822
|
+
function getSchemaForArrayModel(dpgContext, type, options) {
|
|
823
|
+
const { program } = dpgContext;
|
|
824
|
+
const { indexer } = type;
|
|
825
|
+
const { usage, isParentRequestBody, mediaTypes: contentTypes } = options ?? {};
|
|
826
|
+
let schema = {};
|
|
827
|
+
if (!indexer) {
|
|
828
|
+
return schema;
|
|
829
|
+
}
|
|
830
|
+
if (isArrayModelType(type)) {
|
|
831
|
+
schema = {
|
|
832
|
+
type: "array",
|
|
833
|
+
items: getSchemaForType(dpgContext, indexer.value, {
|
|
834
|
+
usage,
|
|
835
|
+
isRequestBody: false,
|
|
836
|
+
mediaTypes: contentTypes,
|
|
837
|
+
// special handling for array in formdata
|
|
838
|
+
isParentRequestBody: hasMediaType(KnownMediaType.MultipartFormData, contentTypes)
|
|
839
|
+
? isParentRequestBody
|
|
840
|
+
: false,
|
|
841
|
+
needRef: !isAnonymousModelType(indexer.value),
|
|
842
|
+
}),
|
|
843
|
+
description: getDoc(program, type),
|
|
844
|
+
};
|
|
845
|
+
if (!program.checker.isStdType(indexer.value) &&
|
|
846
|
+
!isUnknownType(indexer.value) &&
|
|
847
|
+
indexer.value?.kind &&
|
|
848
|
+
schema.items.name &&
|
|
849
|
+
!schema.items.enum) {
|
|
850
|
+
schema.typeName = `Array<${schema.items.name}>`;
|
|
851
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
852
|
+
schema.outputTypeName = `Array<${schema.items.name}Output>`;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
if (schema.items.typeName) {
|
|
857
|
+
if (schema.items.type === "dictionary") {
|
|
858
|
+
schema.typeName = `${schema.items.typeName}[]`;
|
|
859
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
860
|
+
schema.outputTypeName = `(${schema.items.outputTypeName})[]`;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else if (schema.items.type === "union") {
|
|
864
|
+
schema.typeName = `(${schema.items.typeName})[]`;
|
|
865
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
866
|
+
schema.outputTypeName = `(${schema.items.outputTypeName})[]`;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
else if (schema.items.typeName.includes(BINARY_TYPE_UNION) &&
|
|
870
|
+
schema.items.type === "string") {
|
|
871
|
+
schema.typeName = `(${schema.items.typeName})[]`;
|
|
872
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
873
|
+
schema.outputTypeName = `(${schema.items.outputTypeName})[]`;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
else if (isAnonymousObjectSchema(schema.items)) {
|
|
877
|
+
schema.typeName = `${schema.items.typeName}[]`;
|
|
878
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
879
|
+
schema.outputTypeName = `${schema.items.outputTypeName}[]`;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
schema.typeName = schema.items.typeName
|
|
884
|
+
.split("|")
|
|
885
|
+
.map((typeName) => {
|
|
886
|
+
return `${typeName}[]`;
|
|
887
|
+
})
|
|
888
|
+
.join(" | ");
|
|
889
|
+
if (schema.items.outputTypeName && usage && usage.includes(SchemaContext.Output)) {
|
|
890
|
+
schema.outputTypeName = schema.items.outputTypeName
|
|
891
|
+
.split("|")
|
|
892
|
+
.map((typeName) => {
|
|
893
|
+
return `${typeName}[]`;
|
|
894
|
+
})
|
|
895
|
+
.join(" | ");
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
else if (schema.items?.type?.includes("|")) {
|
|
900
|
+
schema.typeName = `(${schema.items.type})[]`;
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
schema.typeName = `${schema.items.type}[]`;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
schema.usage = usage;
|
|
907
|
+
return schema;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
function getSchemaForRecordModel(dpgContext, type, options) {
|
|
911
|
+
const { program } = dpgContext;
|
|
912
|
+
const { indexer } = type;
|
|
913
|
+
const { usage } = options ?? {};
|
|
914
|
+
let schema = {};
|
|
915
|
+
if (!indexer) {
|
|
916
|
+
return schema;
|
|
917
|
+
}
|
|
918
|
+
if (isRecordModelType(type)) {
|
|
919
|
+
const valueType = getSchemaForType(dpgContext, indexer?.value, {
|
|
920
|
+
usage,
|
|
921
|
+
needRef: !isAnonymousModelType(indexer.value),
|
|
922
|
+
});
|
|
923
|
+
schema = {
|
|
924
|
+
type: "dictionary",
|
|
925
|
+
additionalProperties: valueType,
|
|
926
|
+
description: getDoc(program, type),
|
|
927
|
+
};
|
|
928
|
+
if (!program.checker.isStdType(indexer.value) &&
|
|
929
|
+
!isUnknownType(indexer.value) &&
|
|
930
|
+
!isUnionType(indexer.value)) {
|
|
931
|
+
schema.typeName = `Record<string, ${valueType.typeName}>`;
|
|
932
|
+
schema.valueTypeName = valueType.name;
|
|
933
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
934
|
+
schema.outputTypeName = `Record<string, ${valueType.outputTypeName}>`;
|
|
935
|
+
schema.outputValueTypeName = `${valueType.outputTypeName}`;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
else if (isUnknownType(indexer.value)) {
|
|
939
|
+
schema.typeName = `Record<string, ${valueType.typeName ?? valueType.type}>`;
|
|
940
|
+
if (usage && usage.includes(SchemaContext.Output)) {
|
|
941
|
+
schema.outputTypeName = `Record<string, ${valueType.outputTypeName ?? valueType.type}>`;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
schema.typeName = `Record<string, ${getTypeName(valueType, [SchemaContext.Input])}>`;
|
|
946
|
+
schema.outputTypeName = `Record<string, ${getTypeName(valueType, [SchemaContext.Output])}>`;
|
|
947
|
+
}
|
|
948
|
+
schema.usage = usage;
|
|
949
|
+
return schema;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
function isUnionType(type) {
|
|
953
|
+
return type.kind === "Union";
|
|
954
|
+
}
|
|
955
|
+
export function isObjectOrDictType(schema) {
|
|
956
|
+
return ((schema.type === "object" && schema.properties !== undefined) ||
|
|
957
|
+
schema.type === "dictionary");
|
|
958
|
+
}
|
|
959
|
+
export function isArrayType(schema) {
|
|
960
|
+
return schema.type === "array";
|
|
961
|
+
}
|
|
962
|
+
function getSchemaForStdScalar(program, type, options) {
|
|
963
|
+
const { relevantProperty } = options ?? {};
|
|
964
|
+
if (!program.checker.isStdType(type)) {
|
|
965
|
+
return undefined;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* lookup for @encode decorator
|
|
969
|
+
* if absent use typespec type (or default way of serializing that type)
|
|
970
|
+
* if present respect type provided in @encode
|
|
971
|
+
*/
|
|
972
|
+
let format = undefined;
|
|
973
|
+
if (relevantProperty) {
|
|
974
|
+
const encodeData = getEncode(program, relevantProperty);
|
|
975
|
+
if (encodeData && isEncodeTypeEffective(type, encodeData)) {
|
|
976
|
+
type = encodeData.type;
|
|
977
|
+
format = encodeData.encoding;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
const name = type.name;
|
|
981
|
+
const description = getSummary(program, type);
|
|
982
|
+
switch (name) {
|
|
983
|
+
case "bytes":
|
|
984
|
+
return { type: "string", format: "bytes", description };
|
|
985
|
+
case "integer":
|
|
986
|
+
return applyIntrinsicDecorators(program, type, {
|
|
987
|
+
type: "number",
|
|
988
|
+
});
|
|
989
|
+
case "int8":
|
|
990
|
+
return applyIntrinsicDecorators(program, type, {
|
|
991
|
+
type: "number",
|
|
992
|
+
format: "int8",
|
|
993
|
+
});
|
|
994
|
+
case "int16":
|
|
995
|
+
return applyIntrinsicDecorators(program, type, {
|
|
996
|
+
type: "number",
|
|
997
|
+
format: "int16",
|
|
998
|
+
});
|
|
999
|
+
case "int32":
|
|
1000
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1001
|
+
type: "number",
|
|
1002
|
+
format: "int32",
|
|
1003
|
+
});
|
|
1004
|
+
case "int64":
|
|
1005
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1006
|
+
type: "number",
|
|
1007
|
+
format: "int64",
|
|
1008
|
+
});
|
|
1009
|
+
case "safeint":
|
|
1010
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1011
|
+
type: "number",
|
|
1012
|
+
format: "safeint",
|
|
1013
|
+
});
|
|
1014
|
+
case "numeric":
|
|
1015
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1016
|
+
type: "number",
|
|
1017
|
+
});
|
|
1018
|
+
case "uint8":
|
|
1019
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1020
|
+
type: "number",
|
|
1021
|
+
format: "uint8",
|
|
1022
|
+
});
|
|
1023
|
+
case "uint16":
|
|
1024
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1025
|
+
type: "number",
|
|
1026
|
+
format: "uint16",
|
|
1027
|
+
});
|
|
1028
|
+
case "uint32":
|
|
1029
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1030
|
+
type: "number",
|
|
1031
|
+
format: "uint32",
|
|
1032
|
+
});
|
|
1033
|
+
case "uint64":
|
|
1034
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1035
|
+
type: "number",
|
|
1036
|
+
format: "uint64",
|
|
1037
|
+
});
|
|
1038
|
+
case "float64":
|
|
1039
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1040
|
+
type: "number",
|
|
1041
|
+
format: "float64",
|
|
1042
|
+
});
|
|
1043
|
+
case "float32":
|
|
1044
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1045
|
+
type: "number",
|
|
1046
|
+
format: "float32",
|
|
1047
|
+
});
|
|
1048
|
+
case "float":
|
|
1049
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1050
|
+
type: "number",
|
|
1051
|
+
format: "float",
|
|
1052
|
+
});
|
|
1053
|
+
case "decimal":
|
|
1054
|
+
reportDiagnostic(program, {
|
|
1055
|
+
code: "decimal-to-number",
|
|
1056
|
+
format: {
|
|
1057
|
+
propertyName: relevantProperty?.name ?? "",
|
|
1058
|
+
},
|
|
1059
|
+
target: relevantProperty ?? NoTarget,
|
|
1060
|
+
});
|
|
1061
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1062
|
+
type: "number",
|
|
1063
|
+
format: "decimal",
|
|
1064
|
+
description: "decimal",
|
|
1065
|
+
});
|
|
1066
|
+
case "decimal128":
|
|
1067
|
+
reportDiagnostic(program, {
|
|
1068
|
+
code: "decimal-to-number",
|
|
1069
|
+
format: {
|
|
1070
|
+
propertyName: relevantProperty?.name ?? "",
|
|
1071
|
+
},
|
|
1072
|
+
target: relevantProperty ?? NoTarget,
|
|
1073
|
+
});
|
|
1074
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1075
|
+
type: "number",
|
|
1076
|
+
format: "decimal128",
|
|
1077
|
+
description: "decimal128",
|
|
1078
|
+
});
|
|
1079
|
+
case "string":
|
|
1080
|
+
if (format === "binary") {
|
|
1081
|
+
return {
|
|
1082
|
+
type: "string",
|
|
1083
|
+
format: "binary",
|
|
1084
|
+
description,
|
|
1085
|
+
typeName: BINARY_TYPE_UNION,
|
|
1086
|
+
outputTypeName: "Uint8Array",
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
return applyIntrinsicDecorators(program, type, {
|
|
1090
|
+
type: "string",
|
|
1091
|
+
});
|
|
1092
|
+
case "boolean":
|
|
1093
|
+
return { type: "boolean", description };
|
|
1094
|
+
case "plainDate":
|
|
1095
|
+
return {
|
|
1096
|
+
type: "string",
|
|
1097
|
+
format,
|
|
1098
|
+
description,
|
|
1099
|
+
typeName: "string",
|
|
1100
|
+
outputTypeName: "string",
|
|
1101
|
+
};
|
|
1102
|
+
case "utcDateTime":
|
|
1103
|
+
return {
|
|
1104
|
+
type: "string",
|
|
1105
|
+
format,
|
|
1106
|
+
description,
|
|
1107
|
+
typeName: "Date | string",
|
|
1108
|
+
outputTypeName: "string",
|
|
1109
|
+
};
|
|
1110
|
+
case "offsetDateTime":
|
|
1111
|
+
return {
|
|
1112
|
+
type: "string",
|
|
1113
|
+
format: "date-time",
|
|
1114
|
+
description,
|
|
1115
|
+
typeName: "string",
|
|
1116
|
+
outputTypeName: "string",
|
|
1117
|
+
};
|
|
1118
|
+
case "plainTime":
|
|
1119
|
+
return {
|
|
1120
|
+
type: "string",
|
|
1121
|
+
format: "time",
|
|
1122
|
+
description,
|
|
1123
|
+
typeName: "string",
|
|
1124
|
+
outputTypeName: "string",
|
|
1125
|
+
};
|
|
1126
|
+
case "duration":
|
|
1127
|
+
return { type: "string", format, description };
|
|
1128
|
+
case "url":
|
|
1129
|
+
return { type: "string", format: "uri" };
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
function isEncodeTypeEffective(type, encodeData) {
|
|
1133
|
+
if (!encodeData) {
|
|
1134
|
+
return false;
|
|
1135
|
+
}
|
|
1136
|
+
const datetimeTypes = ["plaindate", "utcdatetime", "offsetdatetime", "plaintime"];
|
|
1137
|
+
if (datetimeTypes.includes(type.name.toLowerCase()) && encodeData.type.name === "string") {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
return true;
|
|
1141
|
+
}
|
|
1142
|
+
export function getTypeName(schema, usage) {
|
|
1143
|
+
// TODO: Handle more cases
|
|
1144
|
+
return getPriorityName(schema, usage) ?? schema.type ?? "any";
|
|
1145
|
+
}
|
|
1146
|
+
export function getImportedModelName(schema, usage) {
|
|
1147
|
+
switch (schema.type) {
|
|
1148
|
+
case "array": {
|
|
1149
|
+
const ret = new Set();
|
|
1150
|
+
[schema.items]
|
|
1151
|
+
.filter((i) => !!i)
|
|
1152
|
+
.forEach((i) => getImportedModelName(i, usage).forEach((it) => ret.add(it)));
|
|
1153
|
+
return [...ret];
|
|
1154
|
+
}
|
|
1155
|
+
case "object": {
|
|
1156
|
+
if (isAnonymousObjectSchema(schema)) {
|
|
1157
|
+
const ret = new Set();
|
|
1158
|
+
const properties = schema.properties ?? {};
|
|
1159
|
+
for (const name in properties) {
|
|
1160
|
+
if (!properties[name]) {
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
getImportedModelName(properties[name], usage).forEach((it) => ret.add(it));
|
|
1164
|
+
}
|
|
1165
|
+
return [...ret];
|
|
1166
|
+
}
|
|
1167
|
+
return getPriorityName(schema, usage) ? [getPriorityName(schema, usage)] : [];
|
|
1168
|
+
}
|
|
1169
|
+
case "dictionary": {
|
|
1170
|
+
const ret = new Set();
|
|
1171
|
+
[schema.additionalProperties]
|
|
1172
|
+
.filter((i) => !!i)
|
|
1173
|
+
.forEach((i) => getImportedModelName(i, usage).forEach((it) => ret.add(it)));
|
|
1174
|
+
return [...ret];
|
|
1175
|
+
}
|
|
1176
|
+
case "union": {
|
|
1177
|
+
const ret = new Set();
|
|
1178
|
+
(schema.enum ?? [])
|
|
1179
|
+
.filter((i) => !!i)
|
|
1180
|
+
.forEach((i) => getImportedModelName(i, usage).forEach((it) => ret.add(it)));
|
|
1181
|
+
return [...ret];
|
|
1182
|
+
}
|
|
1183
|
+
default:
|
|
1184
|
+
return [];
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
function getPriorityName(schema, usage) {
|
|
1188
|
+
return usage && usage.includes(SchemaContext.Input) && !usage.includes(SchemaContext.Output)
|
|
1189
|
+
? (schema.typeName ?? schema.name)
|
|
1190
|
+
: (schema.outputTypeName ?? schema.typeName ?? schema.name);
|
|
1191
|
+
}
|
|
1192
|
+
function getEnumStringDescription(type) {
|
|
1193
|
+
if ((type.name === "string" ||
|
|
1194
|
+
type.alias === "string" ||
|
|
1195
|
+
type.name === "number" ||
|
|
1196
|
+
type.alias === "number" ||
|
|
1197
|
+
type.name === "boolean" ||
|
|
1198
|
+
type.alias === "boolean") &&
|
|
1199
|
+
type.enum &&
|
|
1200
|
+
type.enum.length > 0) {
|
|
1201
|
+
return `Possible values: ${type.enum
|
|
1202
|
+
.map((e) => {
|
|
1203
|
+
return e.type;
|
|
1204
|
+
})
|
|
1205
|
+
.join(", ")}`;
|
|
1206
|
+
}
|
|
1207
|
+
return undefined;
|
|
1208
|
+
}
|
|
1209
|
+
function getBinaryDescription(type) {
|
|
1210
|
+
if (type?.typeName?.includes(BINARY_TYPE_UNION)) {
|
|
1211
|
+
return `Value may contain any sequence of octets`;
|
|
1212
|
+
}
|
|
1213
|
+
return undefined;
|
|
1214
|
+
}
|
|
1215
|
+
function getDecimalDescription(type) {
|
|
1216
|
+
if ((type.format === "decimal" || type.format === "decimal128") && type.type === "number") {
|
|
1217
|
+
return `NOTE: This property is represented as a 'number' in JavaScript, but it corresponds to a 'decimal' type in other languages.
|
|
1218
|
+
Due to the inherent limitations of floating-point arithmetic in JavaScript, precision issues may arise when performing arithmetic operations.
|
|
1219
|
+
If your application requires high precision for arithmetic operations or when round-tripping data back to other languages, consider using a library like decimal.js, which provides an arbitrary-precision Decimal type.
|
|
1220
|
+
For simpler cases, where you need to control the number of decimal places for display purposes, you can use the 'toFixed()' method. However, be aware that 'toFixed()' returns a string and may not be suitable for all arithmetic precision requirements.
|
|
1221
|
+
Always be cautious with direct arithmetic operations and consider implementing appropriate rounding strategies to maintain accuracy.
|
|
1222
|
+
`;
|
|
1223
|
+
}
|
|
1224
|
+
return undefined;
|
|
1225
|
+
}
|
|
1226
|
+
export function getFormattedPropertyDoc(program, type, schemaType, sperator = "\n\n") {
|
|
1227
|
+
const propertyDoc = getDoc(program, type);
|
|
1228
|
+
const enhancedDocFromType = getEnumStringDescription(schemaType) ??
|
|
1229
|
+
getDecimalDescription(schemaType) ??
|
|
1230
|
+
getBinaryDescription(schemaType);
|
|
1231
|
+
if (propertyDoc && enhancedDocFromType) {
|
|
1232
|
+
return `${propertyDoc}${sperator}${enhancedDocFromType}`;
|
|
1233
|
+
}
|
|
1234
|
+
return propertyDoc ?? enhancedDocFromType;
|
|
1235
|
+
}
|
|
1236
|
+
export function getBodyType(route) {
|
|
1237
|
+
const bodyModel = route.parameters.body?.type;
|
|
1238
|
+
return bodyModel;
|
|
1239
|
+
}
|
|
1240
|
+
export function getValueTypeValue(value) {
|
|
1241
|
+
switch (value.valueKind) {
|
|
1242
|
+
case "ArrayValue":
|
|
1243
|
+
return value.values.map((x) => getValueTypeValue(x));
|
|
1244
|
+
case "BooleanValue":
|
|
1245
|
+
case "StringValue":
|
|
1246
|
+
case "NullValue":
|
|
1247
|
+
return value.value;
|
|
1248
|
+
case "NumericValue":
|
|
1249
|
+
return value.value.asNumber();
|
|
1250
|
+
case "EnumValue":
|
|
1251
|
+
return value.value.value ?? value.value.name;
|
|
1252
|
+
case "ObjectValue":
|
|
1253
|
+
return Object.fromEntries([...value.properties.keys()].map((x) => [
|
|
1254
|
+
x,
|
|
1255
|
+
getValueTypeValue(value.properties.get(x).value),
|
|
1256
|
+
]));
|
|
1257
|
+
default:
|
|
1258
|
+
// TODO: handle scalar value
|
|
1259
|
+
return undefined;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Predict if the default value exists in param, we would follow the rules:
|
|
1264
|
+
* 1. If we have specific default literal in param
|
|
1265
|
+
* 2. If we take the default api-version value into considerations
|
|
1266
|
+
* @param program
|
|
1267
|
+
* @param dpgContext
|
|
1268
|
+
* @param param The param to predict
|
|
1269
|
+
* @returns
|
|
1270
|
+
*/
|
|
1271
|
+
export function predictDefaultValue(dpgContext, param) {
|
|
1272
|
+
if (!param) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
const program = dpgContext.program;
|
|
1276
|
+
const specificDefault = param.defaultValue ? getValueTypeValue(param.defaultValue) : undefined;
|
|
1277
|
+
if (specificDefault) {
|
|
1278
|
+
if (typeof specificDefault === "object") {
|
|
1279
|
+
reportDiagnostic(program, {
|
|
1280
|
+
code: "default-value-object",
|
|
1281
|
+
format: {
|
|
1282
|
+
propertyName: param.name,
|
|
1283
|
+
},
|
|
1284
|
+
target: param,
|
|
1285
|
+
});
|
|
1286
|
+
return specificDefault.toString();
|
|
1287
|
+
}
|
|
1288
|
+
return specificDefault;
|
|
1289
|
+
}
|
|
1290
|
+
const serviceNamespace = getDefaultService(program, dpgContext.rlcOptions?.isModularLibrary)?.type;
|
|
1291
|
+
if (!serviceNamespace) {
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const defaultApiVersion = getDefaultApiVersionString(dpgContext);
|
|
1295
|
+
if (param && isApiVersion(dpgContext, param) && defaultApiVersion) {
|
|
1296
|
+
return defaultApiVersion;
|
|
1297
|
+
}
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
export function getDefaultService(program, isModularLibrary = true) {
|
|
1301
|
+
const services = listServices(program);
|
|
1302
|
+
if (!services || services.length === 0) {
|
|
1303
|
+
reportDiagnostic(program, {
|
|
1304
|
+
code: "no-service-defined",
|
|
1305
|
+
target: NoTarget,
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
if (services.length > 1 && !isModularLibrary) {
|
|
1309
|
+
reportDiagnostic(program, {
|
|
1310
|
+
code: "more-than-one-service",
|
|
1311
|
+
target: NoTarget,
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
return services[0];
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Return the default api version from the program; undefined if no default
|
|
1318
|
+
*/
|
|
1319
|
+
export function getDefaultApiVersionString(dpgContext) {
|
|
1320
|
+
const program = dpgContext.program;
|
|
1321
|
+
const isModularLibrary = dpgContext.rlcOptions?.isModularLibrary;
|
|
1322
|
+
return getDefaultService(program, isModularLibrary)
|
|
1323
|
+
? getDefaultApiVersion(dpgContext, getDefaultService(program, isModularLibrary).type)?.value
|
|
1324
|
+
: undefined;
|
|
1325
|
+
}
|
|
1326
|
+
export function trimUsage(model) {
|
|
1327
|
+
if (typeof model !== "object") {
|
|
1328
|
+
return model;
|
|
1329
|
+
}
|
|
1330
|
+
const tmpModel = Object.assign({}, model);
|
|
1331
|
+
const tmpModelKeys = Object.keys(tmpModel).filter((item) => {
|
|
1332
|
+
return item !== "usage";
|
|
1333
|
+
});
|
|
1334
|
+
const ordered = tmpModelKeys.sort().reduce((obj, key) => {
|
|
1335
|
+
obj[key] = trimUsage(tmpModel[key]);
|
|
1336
|
+
return obj;
|
|
1337
|
+
}, {});
|
|
1338
|
+
return ordered;
|
|
1339
|
+
}
|
|
1340
|
+
export function isAzureCoreErrorType(program, t) {
|
|
1341
|
+
if (!t || t.kind !== "Model") {
|
|
1342
|
+
return false;
|
|
1343
|
+
}
|
|
1344
|
+
const effective = getEffectiveSchemaType(program, t);
|
|
1345
|
+
if (!["error", "errorresponse", "innererror"].includes(effective.name.toLowerCase())) {
|
|
1346
|
+
return false;
|
|
1347
|
+
}
|
|
1348
|
+
return isAzureCoreFoundationsNamespace(effective);
|
|
1349
|
+
}
|
|
1350
|
+
function isAzureCoreFoundationsNamespace(t, skipFoundation = false) {
|
|
1351
|
+
const namespaces = (skipFoundation ? ".Azure.Core" : ".Azure.Core.Foundations").split(".");
|
|
1352
|
+
while (namespaces.length > 0 &&
|
|
1353
|
+
(t?.kind === "Model" || t?.kind === "Enum" || t?.kind === "Union" || t?.kind === "Namespace") &&
|
|
1354
|
+
t.namespace?.name === namespaces.pop()) {
|
|
1355
|
+
t = t.namespace;
|
|
1356
|
+
}
|
|
1357
|
+
return namespaces.length === 0;
|
|
1358
|
+
}
|
|
1359
|
+
// Check if the schema is an anonymous object
|
|
1360
|
+
export function isAnonymousObjectSchema(schema) {
|
|
1361
|
+
return schema.name === "" && schema.type === "object";
|
|
1362
|
+
}
|
|
1363
|
+
// Check if the type is an anonymous model
|
|
1364
|
+
export function isAnonymousModelType(type) {
|
|
1365
|
+
if (type.kind === "Model") {
|
|
1366
|
+
return type.name === "";
|
|
1367
|
+
}
|
|
1368
|
+
return false;
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* Get the inline signiture of the model
|
|
1372
|
+
* @param schema object schema detail
|
|
1373
|
+
* @param options other optional parameters
|
|
1374
|
+
* @returns
|
|
1375
|
+
*/
|
|
1376
|
+
export function getModelInlineSigniture(schema, options = {}) {
|
|
1377
|
+
if (options.multipart) {
|
|
1378
|
+
return getMultipartInlineSignature(schema, options.importedModels, options.usage);
|
|
1379
|
+
}
|
|
1380
|
+
let schemaSignature = `{`;
|
|
1381
|
+
for (const propName in schema.properties) {
|
|
1382
|
+
const propType = schema.properties[propName];
|
|
1383
|
+
const propTypeName = getTypeName(propType, options.usage);
|
|
1384
|
+
if (!propType || !propTypeName) {
|
|
1385
|
+
continue;
|
|
1386
|
+
}
|
|
1387
|
+
if (options.importedModels) {
|
|
1388
|
+
const importNames = getImportedModelName(propType);
|
|
1389
|
+
if (importNames) {
|
|
1390
|
+
importNames.forEach(options.importedModels.add, options.importedModels);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
const isOptional = propType.required ? "" : "?";
|
|
1394
|
+
schemaSignature += `${propName}${isOptional}: ${propTypeName};`;
|
|
1395
|
+
}
|
|
1396
|
+
schemaSignature += `}`;
|
|
1397
|
+
return schemaSignature;
|
|
1398
|
+
}
|
|
1399
|
+
function getMultipartInlineSignature(schema, importedModels, usage) {
|
|
1400
|
+
const types = Object.entries(schema.properties ?? {})
|
|
1401
|
+
.map(([propertyName, property]) => {
|
|
1402
|
+
let schema;
|
|
1403
|
+
// Flatten arrays for file uploads
|
|
1404
|
+
if (isArraySchema(property) &&
|
|
1405
|
+
property.items &&
|
|
1406
|
+
getTypeName(property.items, usage).includes(BINARY_AND_FILE_TYPE_UNION)) {
|
|
1407
|
+
schema = property.items;
|
|
1408
|
+
}
|
|
1409
|
+
else {
|
|
1410
|
+
schema = property;
|
|
1411
|
+
}
|
|
1412
|
+
const typeName = getTypeName(schema, usage);
|
|
1413
|
+
if (!typeName) {
|
|
1414
|
+
return undefined;
|
|
1415
|
+
}
|
|
1416
|
+
const importNames = getImportedModelName(schema);
|
|
1417
|
+
if (importedModels && importNames) {
|
|
1418
|
+
importNames.forEach(importedModels.add.bind(importedModels));
|
|
1419
|
+
}
|
|
1420
|
+
if (typeName.includes("File")) {
|
|
1421
|
+
return `{ name: ${propertyName}, body: ${typeName}, filename?: string, contentType?: string }`;
|
|
1422
|
+
}
|
|
1423
|
+
else {
|
|
1424
|
+
return `{ name: ${propertyName}, body: ${typeName} }`;
|
|
1425
|
+
}
|
|
1426
|
+
})
|
|
1427
|
+
.filter(Boolean)
|
|
1428
|
+
.join(" | ");
|
|
1429
|
+
return `FormData | Array<${types}>`;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* A "schema property" here is a property that is emitted to OpenAPI schema.
|
|
1433
|
+
*
|
|
1434
|
+
* Headers, parameters, status codes are not schema properties even they are
|
|
1435
|
+
* represented as properties in typespec.
|
|
1436
|
+
*/
|
|
1437
|
+
export function isSchemaProperty(program, property) {
|
|
1438
|
+
const headerInfo = getHeaderFieldName(program, property);
|
|
1439
|
+
const queryInfo = getQueryParamName(program, property);
|
|
1440
|
+
const pathInfo = getPathParamName(program, property);
|
|
1441
|
+
const statusCodeInfo = isStatusCode(program, property);
|
|
1442
|
+
const isNonVisibility = getSdkVisibility(program, property)?.includes(Visibility.None);
|
|
1443
|
+
return !(headerInfo || queryInfo || pathInfo || statusCodeInfo || isNonVisibility);
|
|
1444
|
+
}
|
|
1445
|
+
export function getEffectiveSchemaType(program, type) {
|
|
1446
|
+
// If type is an anonymous model, tries to find a named model that has the same properties
|
|
1447
|
+
let effective = undefined;
|
|
1448
|
+
if (type.kind === "Union") {
|
|
1449
|
+
return type;
|
|
1450
|
+
}
|
|
1451
|
+
else if (type.name === "") {
|
|
1452
|
+
effective = getEffectiveModelType(program, type, (property) => isSchemaProperty(program, property));
|
|
1453
|
+
}
|
|
1454
|
+
if (effective?.name) {
|
|
1455
|
+
return effective;
|
|
1456
|
+
}
|
|
1457
|
+
return type;
|
|
1458
|
+
}
|
|
1459
|
+
export function isBodyRequired(parameter) {
|
|
1460
|
+
return parameter.body?.type && parameter.body?.property?.optional !== true ? true : false;
|
|
1461
|
+
}
|
|
1462
|
+
export function getCollectionFormat(context, param) {
|
|
1463
|
+
const type = param.param;
|
|
1464
|
+
const encode = getEncode(context.program, param.param);
|
|
1465
|
+
if (type.type.kind === "Model" && isArrayModelType(type.type)) {
|
|
1466
|
+
if (param.explode) {
|
|
1467
|
+
return "multi";
|
|
1468
|
+
}
|
|
1469
|
+
switch (encode?.encoding) {
|
|
1470
|
+
case "ArrayEncoding.pipeDelimited":
|
|
1471
|
+
return "pipes";
|
|
1472
|
+
case "ArrayEncoding.spaceDelimited":
|
|
1473
|
+
return "ssv";
|
|
1474
|
+
default:
|
|
1475
|
+
return "csv";
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
//# sourceMappingURL=model-utils.js.map
|