attlaz-client 1.9.16 → 1.9.18

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.
@@ -2,7 +2,7 @@ export declare class CodeSourceAccount {
2
2
  id: string;
3
3
  key: string;
4
4
  name: string;
5
- user: string;
5
+ userId: string;
6
6
  type: string;
7
7
  access_token: string;
8
8
  refresh_token: string;
@@ -7,7 +7,7 @@ class CodeSourceAccount {
7
7
  sourcesAccount.id = rawSourcesAccount.id;
8
8
  sourcesAccount.key = rawSourcesAccount.key;
9
9
  sourcesAccount.name = rawSourcesAccount.name;
10
- sourcesAccount.user = rawSourcesAccount.userId;
10
+ sourcesAccount.userId = rawSourcesAccount.user;
11
11
  sourcesAccount.type = rawSourcesAccount.type;
12
12
  sourcesAccount.access_token = rawSourcesAccount.access_token;
13
13
  sourcesAccount.refresh_token = rawSourcesAccount.refresh_token;
@@ -10,4 +10,5 @@ export declare abstract class Endpoint {
10
10
  requestCollection<T>(action: string, parameters: Parameters | undefined, parser: (input: any) => T, method?: string, signWithOauthToken?: boolean): Promise<CollectionResult<T>>;
11
11
  requestObject<T>(action: string, parameters: Parameters | undefined, parser: (input: any) => T, method?: string, signWithOauthToken?: boolean): Promise<ObjectResult<T>>;
12
12
  parseCollection<T>(rawData: object[], parser: (input: any) => T): T[];
13
+ private parseObject;
13
14
  }
@@ -96,7 +96,7 @@ class Endpoint {
96
96
  console.error('Response for object "' + action + '" seem to still use old "data" property', { requestResponse });
97
97
  requestResponse = requestResponse.data;
98
98
  }
99
- result.setData(parser(requestResponse));
99
+ result.setData(this.parseObject(requestResponse, parser));
100
100
  }
101
101
  catch (error) {
102
102
  if (error.code === HttpClient_1.HttpClient.HTTP_NOTFOUND) {
@@ -120,13 +120,15 @@ class Endpoint {
120
120
  throw new Error('Invalid data');
121
121
  }
122
122
  for (const rawDataEntry of rawData) {
123
- // TODO: is it interesting to keep this, or only in develop mode?
124
- const wrappedData = ObjectWrapper_1.ObjectWrapper.wrap(rawDataEntry);
125
- const parsedData = parser(wrappedData);
126
- // const parsedData:T = parser(rawDataEntry);
127
- data.push(parsedData);
123
+ data.push(this.parseObject(rawDataEntry, parser));
128
124
  }
129
125
  return data;
130
126
  }
127
+ parseObject(rawObject, parser) {
128
+ // TODO: is it interesting to keep this wrapper, or only in develop mode?
129
+ const wrappedData = ObjectWrapper_1.ObjectWrapper.wrap(rawObject);
130
+ const parsedData = parser(wrappedData);
131
+ return parsedData;
132
+ }
131
133
  }
132
134
  exports.Endpoint = Endpoint;
@@ -9,7 +9,7 @@ const FlowSummary_1 = require("../Model/Flow/FlowSummary");
9
9
  class FlowEndpoint extends Endpoint_1.Endpoint {
10
10
  async getByProject(projectId) {
11
11
  try {
12
- let url = '/project/' + projectId + '/flows';
12
+ let url = '/projects/' + projectId + '/flows';
13
13
  const result = await this.requestCollection(url, null, Flow_1.Flow.parse);
14
14
  return result;
15
15
  }
@@ -115,7 +115,7 @@ class LogEndpoint extends Endpoint_1.Endpoint {
115
115
  const parser = (raw) => {
116
116
  return new LogStream_1.LogStream(new LogStreamId_1.LogStreamId(raw['id']['id']), raw['name']);
117
117
  };
118
- const result = await this.requestCollection('project/' + projectId + '/logstreams', null, parser);
118
+ const result = await this.requestCollection('projects/' + projectId + '/logstreams', null, parser);
119
119
  return result;
120
120
  }
121
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.9.16",
3
+ "version": "1.9.18",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",