attlaz-client 1.13.38 → 1.13.40

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.
@@ -9,7 +9,9 @@ export declare class Channel extends MetaDataAware implements StateAware {
9
9
  type: ChannelType;
10
10
  data: any;
11
11
  state: State;
12
- private: boolean;
12
+ workspaces: string[];
13
+ isPrivate: boolean;
14
+ singleUse: boolean;
13
15
  constructor(id: string, ownerId: string, label: string, type: ChannelType, data: any);
14
16
  static parse(rawChannel: any): Channel;
15
17
  }
@@ -10,7 +10,9 @@ export class Channel extends MetaDataAware {
10
10
  type;
11
11
  data;
12
12
  state = State.Active;
13
- private = false;
13
+ workspaces = [];
14
+ isPrivate = false;
15
+ singleUse = false;
14
16
  constructor(id, ownerId, label, type, data) {
15
17
  super();
16
18
  this.id = id;
@@ -23,7 +25,9 @@ export class Channel extends MetaDataAware {
23
25
  const type = ChannelType.fromString(rawChannel.type);
24
26
  const channel = new Channel(rawChannel.id, rawChannel.owner, rawChannel.label, type, rawChannel.data);
25
27
  channel.state = State.fromString(rawChannel.state);
26
- channel.private = Utils.isTrue(rawChannel.private);
28
+ channel.isPrivate = Utils.isTrue(rawChannel.is_private);
29
+ channel.singleUse = Utils.isTrue(rawChannel.single_use);
30
+ channel.workspaces = rawChannel.workspaces;
27
31
  if (Object.prototype.hasOwnProperty.call(rawChannel, 'metadata')) {
28
32
  channel.metadata = DataValueCollection.fromObject(rawChannel.metadata);
29
33
  }
@@ -8,11 +8,10 @@ export declare class Subscriber extends MetaDataAware implements StateAware {
8
8
  eventTypes: EventType[];
9
9
  projectEnvironmentId: string;
10
10
  flowId: string;
11
- flowRunId: string;
12
11
  channelIds: string[];
13
12
  logLevelThreshold: LogLevel;
14
13
  state: State;
15
- constructor(id: string, eventTypes: EventType[], projectEnvironmentId: string, flowId: string, flowRunId: string, channelIds: string[], logLevelThreshold?: LogLevel);
14
+ constructor(id: string, eventTypes: EventType[], projectEnvironmentId: string, flowId: string, channelIds: string[], logLevelThreshold?: LogLevel);
16
15
  static parseRaw(rawSubscriber: any): Subscriber;
17
16
  getLogLevelThreshold(): LogLevel;
18
17
  hasLogLevelThreshold(): boolean;
@@ -7,22 +7,22 @@ export class Subscriber extends MetaDataAware {
7
7
  eventTypes;
8
8
  projectEnvironmentId;
9
9
  flowId;
10
- flowRunId;
10
+ // public flowRunId: string;
11
11
  channelIds;
12
12
  logLevelThreshold;
13
13
  state = State.Active;
14
- constructor(id, eventTypes, projectEnvironmentId, flowId, flowRunId, channelIds, logLevelThreshold = LogLevel.Debug) {
14
+ constructor(id, eventTypes, projectEnvironmentId, flowId, channelIds, logLevelThreshold = LogLevel.Debug) {
15
15
  super();
16
16
  this.id = id;
17
17
  this.eventTypes = eventTypes;
18
18
  this.projectEnvironmentId = projectEnvironmentId;
19
19
  this.flowId = flowId;
20
- this.flowRunId = flowRunId;
20
+ // this.flowRunId = flowRunId;
21
21
  this.channelIds = channelIds;
22
22
  this.logLevelThreshold = logLevelThreshold;
23
23
  }
24
24
  static parseRaw(rawSubscriber) {
25
- const subscriber = new Subscriber(rawSubscriber.id, rawSubscriber.event_types, rawSubscriber.project_environment, rawSubscriber.flow, rawSubscriber.flow_run, rawSubscriber.channels, rawSubscriber.log_level_threshold);
25
+ const subscriber = new Subscriber(rawSubscriber.id, rawSubscriber.event_types, rawSubscriber.project_environment, rawSubscriber.flow, rawSubscriber.channels, rawSubscriber.log_level_threshold);
26
26
  subscriber.state = State.fromString(rawSubscriber.state);
27
27
  if (Object.prototype.hasOwnProperty.call(rawSubscriber, 'metadata')) {
28
28
  subscriber.metadata = DataValueCollection.fromObject(rawSubscriber.metadata);
@@ -6,11 +6,6 @@ export class ChannelEndpoint extends Endpoint {
6
6
  async getById(channelId) {
7
7
  try {
8
8
  const result = await this.requestObject('/channels/' + channelId + '', null, Channel.parse);
9
- // if (Utils.isNullOrUndefined(result)) {
10
- //
11
- // } else {
12
- // result.setData(Channel.parse(result.getData()));
13
- // }
14
9
  return result.getData();
15
10
  }
16
11
  catch (ex) {
@@ -1,10 +1,27 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
+ export type BlockedIp = {
3
+ ip: string;
4
+ from: Date;
5
+ to: Date;
6
+ reason: string;
7
+ };
8
+ export type FlaggedIp = {
9
+ ip: string;
10
+ date: Date;
11
+ reason: string;
12
+ };
13
+ export type IpRule = {
14
+ ip: string;
15
+ action: string;
16
+ description: string;
17
+ };
18
+ export type FirewallInfo = {
19
+ blockedIps: BlockedIp[];
20
+ flaggedIps: FlaggedIp[];
21
+ ipRules: IpRule[];
22
+ };
2
23
  export declare class FirewallEndpoint extends Endpoint {
3
- getInformation(): Promise<{
4
- blocked_ips: any[];
5
- flagged_ips: any[];
6
- ip_rules: [];
7
- } | null>;
24
+ getInformation(): Promise<FirewallInfo | null>;
8
25
  createIpRule(ip: string, action: string, description?: string): Promise<boolean>;
9
26
  unblockIP(ip: string): Promise<boolean>;
10
27
  }
@@ -1,14 +1,27 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
+ import { Utils } from '../Utils.js';
2
3
  export class FirewallEndpoint extends Endpoint {
3
4
  async getInformation() {
4
5
  const cmd = '/system/firewall/';
5
6
  try {
6
7
  const parser = (raw) => {
7
8
  const info = {
8
- blocked_ips: raw.blocked_ips,
9
- flagged_ips: raw.flagged_ips,
10
- ip_rules: raw.ip_rules,
9
+ blockedIps: [],
10
+ flaggedIps: [],
11
+ ipRules: [],
11
12
  };
13
+ for (const blockedIp of raw.blocked_ips) {
14
+ blockedIp.from = Utils.parseRawDate(blockedIp.from);
15
+ blockedIp.to = Utils.parseRawDate(blockedIp.to);
16
+ info.blockedIps.push(blockedIp);
17
+ }
18
+ for (const flaggedIp of raw.flagged_ips) {
19
+ flaggedIp.date = Utils.parseRawDate(flaggedIp.date);
20
+ info.flaggedIps.push(flaggedIp);
21
+ }
22
+ for (const ipRule of raw.ip_rules) {
23
+ info.ipRules.push(ipRule);
24
+ }
12
25
  return info;
13
26
  };
14
27
  const result = await this.requestObject(cmd, null, parser, 'GET');
@@ -25,7 +38,9 @@ export class FirewallEndpoint extends Endpoint {
25
38
  const cmd = '/system/firewall/ip_rules';
26
39
  try {
27
40
  const parser = (raw) => raw.success;
28
- const result = await this.requestObject(cmd, { ip, action, description }, parser, 'PUT');
41
+ const result = await this.requestObject(cmd, {
42
+ ip, action, description,
43
+ }, parser, 'PUT');
29
44
  const re = result.getData();
30
45
  if (re === null) {
31
46
  console.log('createIPRule wrong result', { result, parsed: re });
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.13.37";
1
+ export declare const VERSION = "1.13.39";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.13.37";
1
+ export const VERSION = "1.13.39";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.13.38",
3
+ "version": "1.13.40",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",