azure-sdk-for-js/sdk/core/core-client
Jeremy Meng cf8d25ff5e
Fix compiler errors in tests and samples (#31649)
After moving to ESM/tshy, we no longer build tests/samples. This PR
enables running "typecheck" as an optional rush bulk command, and fixes
some of the errors found.

The known errors reported on files from vite/vitest/chai are ignored.

The update-snippets dev-tool command throws error of reading undefined
in some cases, adding a null check fixes it.

Snippets are updated as well after snippets.spec.ts files are fixed.
2024-11-06 13:31:08 -08:00
..
.vscode [core-client] Fix serializer issue with nested polymorphics. (#19455) 2021-12-22 22:13:01 +00:00
config [EngSys] Enable Rush build cache for for common packages (#27409) 2023-10-19 14:22:44 -07:00
review [eslint-plugin] add rule "@typescript-eslint/consistent-type-imports": "warn" 2024-10-30 15:48:52 +00:00
src [eslint-plugin] add rule "@typescript-eslint/consistent-type-imports": "warn" 2024-10-30 15:48:52 +00:00
test Fix compiler errors in tests and samples (#31649) 2024-11-06 13:31:08 -08:00
CHANGELOG.md Post release automated changes for core releases (#29269) 2024-04-11 13:46:11 -04:00
LICENSE [core-client] Create package for AutoRest specific code (#9620) 2020-06-23 15:30:15 -07:00
README.md [doc][core-client] fix broken link (#28621) 2024-02-21 12:40:32 -08:00
api-extractor.json [core] Upgrade to ES-Modules for core (#26238) 2024-02-20 17:42:23 +00:00
package.json [EngSys] use vendored version of `mkdirp` and `rimraf` from dev-tool 2024-10-23 17:53:07 +00:00
tsconfig.browser.config.json [core] Add README snippets for core (#31204) 2024-09-25 09:35:12 -04:00
tsconfig.json [core] Add README snippets for core (#31204) 2024-09-25 09:35:12 -04:00
tsdoc.json replace @ignore with @hidden (#12963) 2021-01-05 04:17:33 +00:00
vitest.browser.config.ts [core] Add README snippets for core (#31204) 2024-09-25 09:35:12 -04:00
vitest.config.ts [core] Add README snippets for core (#31204) 2024-09-25 09:35:12 -04:00

README.md

Azure Core Service client library for JavaScript

This library is primarily intended to be used in code generated by AutoRest and autorest.typescript.

Getting started

Currently supported environments

See our support policy for more details.

Installation

This package is primarily used in generated code and not meant to be consumed directly by end users.

Key concepts

ServiceClient

This is the common base class for generated clients. It provides the methods sendOperationRequest and sendRequest.

sendRequest simply makes an HTTP request using a Pipeline (see @azure/core-rest-pipeline for details.)

sendOperationRequest is used by generated code to make a request using an OperationSpec and OperationArguments. An OperationSpec is a translation of request requirements from the OpenAPI/Swagger file that describes the service.

createClientPipeline

This method is used to create a Pipeline instance that is customized with extra policies that perform serialization and deserialization. The bulk of the work is in converting requests into the right HTTP message that a service expects and then converting the HTTP response payload into the response shape described by the service's OpenAPI specification file.

Mappers / createSerializer

Mappers are used to encode and decode data into HTTP headers and bodies. They describe all request and response fields. They are referenced by OperationSpecs.

The method createSerializer creates a Serializer that is used to do the bulk of the work transforming data when making a request or processing a response. Given a corpus of Mappers and the appropriate OperationSpec it can manufacture an HTTP request object from a user provided input or convert an HTTP response object into a user-friendly form.

Next steps

You can build and run the tests locally by executing rushx test. Explore the test folder to see advanced usage and behavior of the public classes.

Learn more about AutoRest and the autorest.typescript extension for generating a compatible client on top of this package.

Troubleshooting

If you run into issues while using this library, please feel free to file an issue.

Contributing

If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.

Impressions