attlaz-client 1.31.0 → 1.32.1

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.
@@ -110,21 +110,9 @@ export class Endpoint {
110
110
  action = action.build();
111
111
  }
112
112
  const result = new ObjectResult();
113
+ let requestResponse;
113
114
  try {
114
- let requestResponse = await this.httpClient.request(action, parameters, method, signWithOauthToken);
115
- // TODO: add errors
116
- /**
117
- * Parse errors
118
- */
119
- // TODO: temporary check until we know the API is fully upgraded
120
- if (requestResponse === null || requestResponse === undefined) {
121
- throw new Error('Unable to parse object: response is empty for action `[' + method + '] ' + action + '`');
122
- }
123
- if ((Object.prototype.hasOwnProperty.call(requestResponse, 'data') && !Object.prototype.hasOwnProperty.call(requestResponse, 'id')) && requestResponse.data !== undefined) {
124
- console.error('Response for object "' + action + '" seem to still use old "data" property (this property is only used for collection requests)', { requestResponse });
125
- requestResponse = requestResponse.data;
126
- }
127
- result.setData(this.parseObject(requestResponse, parser));
115
+ requestResponse = await this.httpClient.request(action, parameters, method, signWithOauthToken);
128
116
  }
129
117
  catch (error) {
130
118
  if (error.httpStatus === HttpStatus.HTTP_NOTFOUND) {
@@ -134,6 +122,19 @@ export class Endpoint {
134
122
  throw this.toApiError(error);
135
123
  }
136
124
  }
125
+ // TODO: add errors
126
+ /**
127
+ * Parse errors
128
+ */
129
+ // TODO: temporary check until we know the API is fully upgraded
130
+ if (requestResponse === null || requestResponse === undefined) {
131
+ throw new ApiError('Unable to parse object: response is empty for action `[' + method + '] ' + action + '`', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
132
+ }
133
+ if ((Object.prototype.hasOwnProperty.call(requestResponse, 'data') && !Object.prototype.hasOwnProperty.call(requestResponse, 'id')) && requestResponse.data !== undefined) {
134
+ console.error('Response for object "' + action + '" seem to still use old "data" property (this property is only used for collection requests)', { requestResponse });
135
+ requestResponse = requestResponse.data;
136
+ }
137
+ result.setData(this.parseObject(requestResponse, parser));
137
138
  return result;
138
139
  }
139
140
  toApiError(error) {
@@ -159,6 +160,8 @@ export class Endpoint {
159
160
  }
160
161
  return apiError;
161
162
  }
163
+ // TODO: remove this
164
+ console.log('Not client error', { error });
162
165
  return new ApiError('Unknown Error', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
163
166
  }
164
167
  // public async request<T>(action: string, parameters: any | null = null, method: string = 'GET', signWithOauthToken: boolean = true): Promise<DataResult<T>> {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.31.0";
1
+ export declare const VERSION = "1.32.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.31.0";
1
+ export const VERSION = "1.32.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.31.0",
3
+ "version": "1.32.1",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",