@ama-sdk/core
TypeScript icon, indicating that this package has built-in type declarations

11.1.2 • Public • Published

@ama-sdk Core

Stable Version Bundle Size

This package contains all the plugins, helpers and object definitions to dialog with an API following the ama-sdk architecture.

Please refer to the ama-sdk-schematics package for getting started with an API based on ama-sdk.

Available plugins

Available API Client

The API Clients are mandatory to the SDK to indicate the service that should be used by the SDK to process the calls. A list of API Clients are provided by this package:

API Client Import Description
ApiFetchClient @ama-sdk/core Default API Client based on the browser FetchApi
ApiBeaconClient @ama-sdk/core API Client based on the browser BeaconApi, it is processing synchronous call
ApiAngularClient @ama-sdk/core/clients/api-angular-client API Client using the HttpClient exposed by the @angular/common package

Logs

In order to ease the logging in the ama-sdk plugins, it is possible to connect to third-party logging services. This can be achieved by adding a Logger implementation to the options of an API client.

For example, in the Otter showcase application, we could add a ConsoleLogger (from @o3r/core) as a parameter to the ApiFetchClient:

const logger = new ConsoleLogger();
function petApiFactory() {
  const apiConfig: ApiClient = new ApiFetchClient(
    {
      basePath: 'https://petstore3.swagger.io/api/v3',
      requestPlugins: [new SessionIdRequest()],
      fetchPlugins: [],
      logger
    }
  );
  return new PetApi(apiConfig);
}

Note: Adding a third-party logging service is optional. If undefined, the fallback is the console logger.

CLI

This package also comes with CLI scripts that can facilitate the upgrade and publication of an SDK. Use --help on each command for more information

Script Description
amasdk-clear-index Remove the index files that are no longer necessary after the deletion of the associated model
amasdk-files-pack Prepare the dist folder for publication
amasdk-update-spec-from-npm Update the OpenAPI spec from an NPM package

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @ama-sdk/core

Weekly Downloads

16,421

Version

11.1.2

License

BSD-3-Clause

Unpacked Size

1.85 MB

Total Files

657

Last publish

Collaborators

  • mrednic-1a
  • nicohoffmann
  • vscaiceanu-1a
  • jbourgeois-1a
  • kpanot