attlaz-client 1.13.20 → 1.13.22

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.
@@ -13,5 +13,8 @@ export declare class HttpClient {
13
13
  static HTTP_TIMEOUT: number;
14
14
  static request(request: HttpClientRequest): Promise<HttpClientResponse>;
15
15
  private static getContentType;
16
- private static formatContentType;
16
+ static formatContentType(input: string): {
17
+ type: string;
18
+ options: string | null;
19
+ };
17
20
  }
@@ -1,3 +1,4 @@
1
+ import { HttpClient } from './HttpClient.js';
1
2
  export class HttpClientResponse {
2
3
  status;
3
4
  statusText;
@@ -18,9 +19,7 @@ export class HttpClientResponse {
18
19
  if (contentType === null || contentType === undefined) {
19
20
  return null;
20
21
  }
21
- if (contentType.includes('application/json')) {
22
- return 'json';
23
- }
24
- throw new Error('Unknown content type `' + contentType + '`');
22
+ const parsedContentType = HttpClient.formatContentType(contentType);
23
+ return parsedContentType.type;
25
24
  }
26
25
  }
@@ -26,7 +26,9 @@ export class Flow extends MetaDataAware {
26
26
  flow.parallelLimit = Utils.parseInt(rawFlow.parallel_limit);
27
27
  flow.codeSource = rawFlow.code_source;
28
28
  flow.runCommand = rawFlow.run_command;
29
- flow.metadata = DataValueCollection.fromObject(rawFlow.metadata);
29
+ if (Object.prototype.hasOwnProperty.call(rawFlow, 'metadata')) {
30
+ flow.metadata = DataValueCollection.fromObject(rawFlow.metadata);
31
+ }
30
32
  return flow;
31
33
  }
32
34
  }
@@ -26,7 +26,9 @@ export class FlowRun extends MetaDataAware {
26
26
  flowRun.deployId = rawFlowRun.deploy;
27
27
  flowRun.logLevelCount = rawFlowRun.log_level_count;
28
28
  flowRun.logsPurged = Utils.isTrue(rawFlowRun.logs_purged);
29
- flowRun.metadata = DataValueCollection.fromObject(rawFlowRun.metadata);
29
+ if (Object.prototype.hasOwnProperty.call(rawFlowRun, 'metadata')) {
30
+ flowRun.metadata = DataValueCollection.fromObject(rawFlowRun.metadata);
31
+ }
30
32
  return flowRun;
31
33
  }
32
34
  }
@@ -24,7 +24,9 @@ export class Channel extends MetaDataAware {
24
24
  const channel = new Channel(rawChannel.id, rawChannel.owner, rawChannel.label, type, rawChannel.data);
25
25
  channel.state = State.fromString(rawChannel.state);
26
26
  channel.private = Utils.isTrue(rawChannel.private);
27
- channel.metadata = DataValueCollection.fromObject(rawChannel.metadata);
27
+ if (Object.prototype.hasOwnProperty.call(rawChannel, 'metadata')) {
28
+ channel.metadata = DataValueCollection.fromObject(rawChannel.metadata);
29
+ }
28
30
  return channel;
29
31
  }
30
32
  }
@@ -24,7 +24,9 @@ export class Subscriber extends MetaDataAware {
24
24
  static parseRaw(rawSubscriber) {
25
25
  const subscriber = new Subscriber(rawSubscriber.id, rawSubscriber.event_types, rawSubscriber.project_environment, rawSubscriber.flow, rawSubscriber.flow_run, rawSubscriber.channels, rawSubscriber.log_level_threshold);
26
26
  subscriber.state = State.fromString(rawSubscriber.state);
27
- subscriber.metadata = DataValueCollection.fromObject(rawSubscriber.metadata);
27
+ if (Object.prototype.hasOwnProperty.call(rawSubscriber, 'metadata')) {
28
+ subscriber.metadata = DataValueCollection.fromObject(rawSubscriber.metadata);
29
+ }
28
30
  return subscriber;
29
31
  }
30
32
  getLogLevelThreshold() {
@@ -24,7 +24,9 @@ export class Trigger extends MetaDataAware {
24
24
  const trigger = new Trigger(rawTrigger.id, rawTrigger.type, rawTrigger.project_environment, flowId, parsedData);
25
25
  trigger.arguments = rawTrigger.arguments;
26
26
  trigger.state = State.fromString(rawTrigger.state);
27
- trigger.metadata = DataValueCollection.fromObject(rawTrigger.metadata);
27
+ if (Object.prototype.hasOwnProperty.call(rawTrigger, 'metadata')) {
28
+ trigger.metadata = DataValueCollection.fromObject(rawTrigger.metadata);
29
+ }
28
30
  return trigger;
29
31
  }
30
32
  getData() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.13.20",
3
+ "version": "1.13.22",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",