Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updated typescript to 4.7.x - Updated other packages to corresponding latest version - AlApiClient renamed to AlXHRAdapter for accuracy - AlDefaultClient renamed to AlRootClient (again, for accuracy) - Added @ServiceClient decorator and AlBaseServiceClient, allowing JIT service instantiation and better tree shaking - Updated AIMSClient and SubscriptionsClient to use new client model - Retired some obsolete content Client Architecture: Previously, our API Client architecture has consisted of declaring the client class and then immediately instantiating it as a global variable. In practice, this means that clients a) cannot be tree shaken or bundled outside of the main bundle, and b) every client must by compiled and instantiated before application bootstrap. This is dumb. The new model uses a decorator to identify classes that represent a client. The decorator stores the class's constructor and some default settings for it into a dictionary, which can be used to instantiate the client on-demand. For example: ``` @ServiceClient( { service_name: "gestalt", service_stack: AlLocation.GestaltAPI, version: 1 } ) export class AlsGestalt extends AlBaseServiceClient { ... } ``` Or ``` @ServiceClient( { service_name: "iris", version: 'v3', residencyAware: true } ) export class AlsIris extends AlBaseServiceClient { ... } ``` These classes do not need to be instantiated until they are actually needed. Additional, the properties provided to the ServiceClient decorator as used as defaults, and the AlBaseServiceClient provides convenience `get`, `put`, `post`, `delete`, and `request` methods to facilitate extremely minimal implementations. Nomenclature: Client classes should begin with an "Als" prefix, and be stored with a .service-client.ts extension.
- Loading branch information