rest-client-sdk
Advanced tools
Comparing version 5.0.0-rc.8 to 5.0.0
# Changelog | ||
## 5.0.0-rc.8 | ||
## 5.0.0 | ||
- export (and implement) `RestClientSdkInterface` and `TokenStorageInterface` | ||
- export `TokenGeneratorInterface` and `AsyncStorageInterface` | ||
- Fix wrong parameter with `grant_type` in `generateToken` | ||
This release is a migration to TypeScript, but the API stay the same. The only breaking changes are more fixed bugs that might be breaking in really improbable case. | ||
## 5.0.0-rc.7 | ||
### Changed | ||
- `config.authorizationType` is in fact optional (default to "Bearer"), so update the types accordingly | ||
- Update typescript-eslint and fix eslint issues | ||
- [BREAKING] TokenGenerator's `refreshToken` method signature changed from `refreshToken(accessToken, parameters)` to `refreshToken(accessToken)`. | ||
If you did extend the `AbstractToken` generator, you shouldn't relly on the second parameter. | ||
As a matter of fact, the auto-refreshed token in `AbstractClient` did not send any parameters either, so it should not have been working before ! | ||
Accordingly The `refreshToken` method of `TokenStorage` signature changed from `refreshToken(parameters)` to `refreshToken()` | ||
- [Might Break] all pseudo-private methods and attributes (starting with `_`) are unavailable and are now really private (or protected). | ||
- `_storeAccessToken` should be replace by a `ProvidedTokenGenerator` | ||
- [Might Break] `ClassMetadata`, `Attribute` and `Relation` attributes are now `readonly`. You can not change them after initialization. | ||
- [Might Break] `AbstractTokenGenerator` is now abstract. It should not have been used directly anyway. It implies that the method that previously did thrown errors are not callable (`generateToken`, `refreshToken` and `checkTokenGeneratorConfig`). They should not have been called. They don't exist in JS land anymore. | ||
- [Might Break] `canAutogenerateToken` has been removed from the token storages and replaced by a `autogenerateToken()` method (it's not real POO, but I did not manage to deal with instance of for now) | ||
- [Might Break] AbstractClient.\_refreshTokenAndRefetch does not take the response as a first argument (it wan unused). The method was supposed to be private be the way. | ||
- Make `SerializerInterace` and `Serializer` input and output understandable | ||
## 5.0.0-rc.6 | ||
### Added | ||
### Changed | ||
- export (and implement) `RestClientSdkInterface` and `TokenStorageInterface` | ||
- export `TokenGeneratorInterface` and `AsyncStorageInterface` | ||
- Improve JSDoc | ||
## 5.0.0-rc.5 | ||
### Changed | ||
- Simplify configuration for TypeScript (serializer, AbstractClient, etc.) | ||
## 5.0.0-rc.1 | ||
### Changed | ||
- [BREAKING] TokenGenerator's `refreshToken` method signature changed from `refreshToken(accessToken, parameters)` to `refreshToken(accessToken)`. | ||
If you did extend the `AbstractToken` generator, you shouldn't relly on the second parameter. | ||
As a matter of fact, the auto-refreshed token in `AbstractClient` did not send any parameters either, so it should not have been working before ! | ||
- [BREAKING] Accordingly The `refreshToken` method of `TokenStorage` signature changed from `refreshToken(parameters)` to `refreshToken()` | ||
- Migrate codebase to TypeScript. It should not change anything to users, exept a more robust code for TypeScript users. Some small undocumented cases might break: | ||
- [Might Break] `ClassMetadata`, `Attribute` and `Relation` attributes are now `readonly`. You can not change them after initialization. | ||
- [Might Break] `AbstractTokenGenerator` is now abstract. It should not have been used directly anyway. It implies that the method that previously did thrown errors are not callable (`generateToken`, `refreshToken` and `checkTokenGeneratorConfig`). They should not have been called. | ||
- `canAutogenerateToken` has been removed from the token storages and replaced by a `autogenerateToken()` method (it's not real POO, but I did not manage to deal with instance of for now) | ||
- [Might Break] AbstractClient.\_refreshTokenAndRefetch does not take the response as a first argument (it wan unused). The method was supposed to be private be the way. | ||
## 4.1.4 | ||
@@ -44,0 +28,0 @@ |
@@ -67,9 +67,9 @@ import URI from 'urijs'; | ||
authorizedFetch(input: string | URI, requestParams?: {}): Promise<Response>; | ||
_generateUrlFromParams(queryParam: Record<string, unknown>, pathParameters?: Record<string, unknown>, id?: null | string | number): URI; | ||
_fetchWithToken(input: string, requestParams?: {}): Promise<Response>; | ||
_refreshTokenAndRefetch(input: string, requestParams?: RequestInit): Promise<Response>; | ||
_manageUnauthorized(response: Response, input: string, requestParams?: {}): Promise<Response>; | ||
_doFetch(accessToken: null | string, input: string, requestParams: RequestInit): Promise<Response>; | ||
_getEntityIdentifier(object: Record<string, unknown>): null | string | number; | ||
private _generateUrlFromParams; | ||
private _fetchWithToken; | ||
private _refreshTokenAndRefetch; | ||
private _manageUnauthorized; | ||
private _doFetch; | ||
private _getEntityIdentifier; | ||
} | ||
export default AbstractClient; |
@@ -9,4 +9,4 @@ import TokenGeneratorInterface from './TokenGeneratorInterface'; | ||
abstract checkTokenGeneratorConfig(config: C): void; | ||
_manageOauthError(response: Response): Promise<never>; | ||
convertMapToFormData(parameters: { | ||
protected _manageOauthError(response: Response): Promise<never>; | ||
protected convertMapToFormData(parameters: { | ||
[key: string]: undefined | string | Blob; | ||
@@ -13,0 +13,0 @@ }): FormData; |
@@ -17,3 +17,3 @@ import TokenGeneratorInterface from './TokenGenerator/TokenGeneratorInterface'; | ||
logout(): Promise<void>; | ||
_addExpiresAtToResponseData(responseData: T, callTimestamp: number): T & HasExpiresAt; | ||
private _addExpiresAtToResponseData; | ||
generateToken(parameters: unknown): Promise<T & HasExpiresAt>; | ||
@@ -26,4 +26,4 @@ refreshToken(): Promise<T & HasExpiresAt>; | ||
getCurrentTokenExpiresIn(): Promise<number | null>; | ||
_storeAccessToken(responseData: T): Promise<unknown>; | ||
private _storeAccessToken; | ||
} | ||
export default TokenStorage; |
import Mapping from './Mapping'; | ||
import ClassMetadata from './Mapping/ClassMetadata'; | ||
import Attribute from './Mapping/Attribute'; | ||
declare type Id = string | number; | ||
@@ -14,7 +13,7 @@ declare type StringKeyObject = Record<string, any>; | ||
getDirtyData(newSerializedModel: Record<string, unknown>, oldSerializedModel: Record<string, unknown>, classMetadata: ClassMetadata): StringKeyObject; | ||
_getDirtyFieldsForAttribute(dirtyFieldsParam: StringKeyObject, key: string, attribute: Attribute, oldValue: Record<string, unknown>, newValue: Record<string, unknown>): StringKeyObject; | ||
_getDirtyFieldsForManyToOne(dirtyFieldsParam: StringKeyObject, key: string, oldValue: Record<string, unknown>, newValue: Record<string, unknown>, relationMetadata: ClassMetadata, idSerializedKey: string): StringKeyObject; | ||
_getDirtyFieldsForOneToMany(dirtyFieldsParam: StringKeyObject, key: string, idSerializedKey: string, relationMetadata: ClassMetadata, oldValue: any[], newValue: any[]): StringKeyObject; | ||
_getDirtyFields(newSerializedModel: StringKeyObject, oldSerializedModel: StringKeyObject, classMetadata: ClassMetadata): StringKeyObject; | ||
private _getDirtyFieldsForAttribute; | ||
private _getDirtyFieldsForManyToOne; | ||
private _getDirtyFieldsForOneToMany; | ||
private _getDirtyFields; | ||
} | ||
export default UnitOfWork; |
{ | ||
"name": "rest-client-sdk", | ||
"version": "5.0.0-rc.8", | ||
"version": "5.0.0", | ||
"description": "Rest Client SDK for API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -309,3 +309,3 @@ import URI from 'urijs'; | ||
_generateUrlFromParams( | ||
private _generateUrlFromParams( | ||
queryParam: Record<string, unknown>, | ||
@@ -344,3 +344,6 @@ pathParameters: Record<string, unknown> = {}, | ||
_fetchWithToken(input: string, requestParams = {}): Promise<Response> { | ||
private _fetchWithToken( | ||
input: string, | ||
requestParams = {} | ||
): Promise<Response> { | ||
if (!input) { | ||
@@ -373,3 +376,3 @@ throw new Error('input is empty'); | ||
_refreshTokenAndRefetch( | ||
private _refreshTokenAndRefetch( | ||
input: string, | ||
@@ -391,3 +394,3 @@ requestParams: RequestInit = {} | ||
_manageUnauthorized( | ||
private _manageUnauthorized( | ||
response: Response, | ||
@@ -429,3 +432,3 @@ input: string, | ||
_doFetch( | ||
private _doFetch( | ||
accessToken: null | string, | ||
@@ -480,3 +483,3 @@ input: string, | ||
_getEntityIdentifier( | ||
private _getEntityIdentifier( | ||
object: Record<string, unknown> | ||
@@ -483,0 +486,0 @@ ): null | string | number { |
@@ -28,3 +28,3 @@ /* eslint no-unused-vars: 0 */ | ||
_manageOauthError(response: Response): Promise<never> { | ||
protected _manageOauthError(response: Response): Promise<never> { | ||
return response | ||
@@ -56,3 +56,3 @@ .json() | ||
convertMapToFormData(parameters: { | ||
protected convertMapToFormData(parameters: { | ||
[key: string]: undefined | string | Blob; | ||
@@ -59,0 +59,0 @@ }): FormData { |
@@ -75,3 +75,3 @@ /* eslint-disable camelcase */ | ||
_addExpiresAtToResponseData( | ||
private _addExpiresAtToResponseData( | ||
responseData: T, | ||
@@ -158,3 +158,3 @@ callTimestamp: number | ||
_storeAccessToken(responseData: T): Promise<unknown> { | ||
private _storeAccessToken(responseData: T): Promise<unknown> { | ||
return this.#asyncStorage.setItem( | ||
@@ -161,0 +161,0 @@ this.accessTokenKey, |
@@ -136,3 +136,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
_getDirtyFieldsForAttribute( | ||
private _getDirtyFieldsForAttribute( | ||
dirtyFieldsParam: StringKeyObject, | ||
@@ -157,3 +157,3 @@ key: string, | ||
_getDirtyFieldsForManyToOne( | ||
private _getDirtyFieldsForManyToOne( | ||
dirtyFieldsParam: StringKeyObject, | ||
@@ -193,3 +193,3 @@ key: string, | ||
_getDirtyFieldsForOneToMany( | ||
private _getDirtyFieldsForOneToMany( | ||
dirtyFieldsParam: StringKeyObject, | ||
@@ -276,3 +276,3 @@ key: string, | ||
_getDirtyFields( | ||
private _getDirtyFields( | ||
newSerializedModel: StringKeyObject, | ||
@@ -279,0 +279,0 @@ oldSerializedModel: StringKeyObject, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6831
0
524924