@syncbridge/net 0.4.15 → 0.4.17

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.
@@ -66,6 +66,8 @@ let TcpClientComponent = class TcpClientComponent extends IoClientBaseComponent
66
66
  this._stopping = false;
67
67
  this.logger?.info(`TCP socket connecting to ${colors.cyan(this._client.host + ':' + this._client.port)}`);
68
68
  this._client.connect();
69
+ if (!this._client.connected)
70
+ this.setStatus(ServiceStatus.unhealthy);
69
71
  }
70
72
  async _stop() {
71
73
  this._stopping = true;
@@ -27,5 +27,6 @@ export declare class TcpClientVariables extends IoClientBaseComponent.Variables
27
27
  keepAlive: boolean;
28
28
  connectTimeout: number;
29
29
  reconnect: TcpClientReconnectVariables;
30
+ tls_enabled: boolean;
30
31
  tls: TcpClientTlsVariables;
31
32
  }
@@ -95,6 +95,7 @@ __decorate([
95
95
  label: 'Host',
96
96
  description: 'Hostname or IP address to be connected to',
97
97
  required: true,
98
+ index: 100,
98
99
  }),
99
100
  __metadata("design:type", String)
100
101
  ], TcpClientVariables.prototype, "host", void 0);
@@ -105,6 +106,7 @@ __decorate([
105
106
  required: true,
106
107
  minValue: 1,
107
108
  maxValue: 65535,
109
+ index: 101,
108
110
  }),
109
111
  __metadata("design:type", Number)
110
112
  ], TcpClientVariables.prototype, "port", void 0);
@@ -113,6 +115,7 @@ __decorate([
113
115
  label: 'Keep alive',
114
116
  description: 'Enables keep-alive on the TCP socket',
115
117
  default: false,
118
+ index: 102,
116
119
  }),
117
120
  __metadata("design:type", Boolean)
118
121
  ], TcpClientVariables.prototype, "keepAlive", void 0);
@@ -121,6 +124,7 @@ __decorate([
121
124
  label: 'Connect timeout',
122
125
  description: 'Connection timeout in milliseconds',
123
126
  default: 10000,
127
+ index: 103,
124
128
  }),
125
129
  __metadata("design:type", Number)
126
130
  ], TcpClientVariables.prototype, "connectTimeout", void 0);
@@ -131,6 +135,12 @@ __decorate([
131
135
  }),
132
136
  __metadata("design:type", TcpClientReconnectVariables)
133
137
  ], TcpClientVariables.prototype, "reconnect", void 0);
138
+ __decorate([
139
+ DefineVariable({
140
+ label: 'TLS Enabled',
141
+ }),
142
+ __metadata("design:type", Boolean)
143
+ ], TcpClientVariables.prototype, "tls_enabled", void 0);
134
144
  __decorate([
135
145
  DefineVariable({
136
146
  label: 'TLS',
@@ -1,11 +1,10 @@
1
- import { IoClientBaseComponent } from '@syncbridge/builtins';
2
- import { ComponentBase } from '@syncbridge/common';
1
+ import { IoClientBaseComponent, IoServerBaseComponent } from '@syncbridge/builtins';
3
2
  import { TcpServerTlsVariables, TcpServerVariables } from './tcp-server.variables.js';
4
3
  /**
5
4
  * TcpServer component
6
5
  * todo
7
6
  */
8
- export declare class TcpServerComponent<TEvents extends TcpServerComponent.Events = TcpServerComponent.Events> extends ComponentBase<TEvents> {
7
+ export declare class TcpServerComponent<TEvents extends TcpServerComponent.Events = TcpServerComponent.Events> extends IoServerBaseComponent<TEvents> {
9
8
  values: TcpServerVariables;
10
9
  protected _start(abortSignal: AbortSignal): Promise<void>;
11
10
  protected _stop(): Promise<void>;
@@ -1,11 +1,12 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import { Component, ComponentBase } from '@syncbridge/common';
2
+ import { IoServerBaseComponent, } from '@syncbridge/builtins';
3
+ import { Component } from '@syncbridge/common';
3
4
  import { TcpServerTlsVariables, TcpServerVariables, } from './tcp-server.variables.js';
4
5
  /**
5
6
  * TcpServer component
6
7
  * todo
7
8
  */
8
- let TcpServerComponent = class TcpServerComponent extends ComponentBase {
9
+ let TcpServerComponent = class TcpServerComponent extends IoServerBaseComponent {
9
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
11
  async _start(abortSignal) { }
11
12
  async _stop() { }
@@ -1,4 +1,4 @@
1
- import { TransmitLogger } from '@syncbridge/builtins';
1
+ import { IoServerBaseComponent } from '@syncbridge/builtins';
2
2
  import { TcpClientTlsVariables } from './tcp-client.variables.js';
3
3
  /**
4
4
  * TLS variables
@@ -9,8 +9,8 @@ export declare class TcpServerTlsVariables extends TcpClientTlsVariables {
9
9
  /**
10
10
  * Variables
11
11
  */
12
- export declare class TcpServerVariables {
12
+ export declare class TcpServerVariables extends IoServerBaseComponent.Variables {
13
13
  port: number;
14
+ tls_enabled: boolean;
14
15
  tls: TcpServerTlsVariables;
15
- communicationLogs?: TransmitLogger.Variables;
16
16
  }
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import { TransmitLogger } from '@syncbridge/builtins';
2
+ import { IoServerBaseComponent } from '@syncbridge/builtins';
3
3
  import { DefineVariable } from '@syncbridge/common';
4
4
  import { TcpClientTlsVariables } from './tcp-client.variables.js';
5
5
  /**
@@ -18,7 +18,7 @@ __decorate([
18
18
  /**
19
19
  * Variables
20
20
  */
21
- export class TcpServerVariables {
21
+ export class TcpServerVariables extends IoServerBaseComponent.Variables {
22
22
  }
23
23
  __decorate([
24
24
  DefineVariable({
@@ -27,9 +27,17 @@ __decorate([
27
27
  required: true,
28
28
  minValue: 1,
29
29
  maxValue: 65535,
30
+ index: 100,
30
31
  }),
31
32
  __metadata("design:type", Number)
32
33
  ], TcpServerVariables.prototype, "port", void 0);
34
+ __decorate([
35
+ DefineVariable({
36
+ label: 'TLS Enabled',
37
+ description: 'Whether to use TLS for the connection',
38
+ }),
39
+ __metadata("design:type", Boolean)
40
+ ], TcpServerVariables.prototype, "tls_enabled", void 0);
33
41
  __decorate([
34
42
  DefineVariable({
35
43
  label: 'TLS',
@@ -37,10 +45,3 @@ __decorate([
37
45
  }),
38
46
  __metadata("design:type", TcpServerTlsVariables)
39
47
  ], TcpServerVariables.prototype, "tls", void 0);
40
- __decorate([
41
- DefineVariable({
42
- label: 'Communication Logs',
43
- description: 'Stores communication logs if enabled',
44
- }),
45
- __metadata("design:type", TransmitLogger.Variables)
46
- ], TcpServerVariables.prototype, "communicationLogs", void 0);
@@ -39,15 +39,6 @@ let UdpClientComponent = class UdpClientComponent extends IoClientBaseComponent
39
39
  this.socket.on('message', (msg, info) => {
40
40
  if (info.address === '127.0.0.1')
41
41
  return;
42
- // todo logger
43
- // this.logger.debug(
44
- // `Data received from ${colors.cyan(info.address + ':' + info.port)} (${msg.length} bytes)`,
45
- // {
46
- // host: info.address,
47
- // port: info.port,
48
- // size: msg.length,
49
- // },
50
- // );
51
42
  const info2 = {
52
43
  ...info,
53
44
  toString() {
@@ -3,8 +3,8 @@ import { IoClientBaseComponent } from '@syncbridge/builtins';
3
3
  * Variables
4
4
  */
5
5
  export declare class UdpClientVariables extends IoClientBaseComponent.Variables {
6
- port?: number;
7
6
  host?: string;
7
+ port?: number;
8
8
  bindInterface?: string;
9
9
  }
10
10
  export declare function getInterfaceAddresses(): string[];
@@ -7,28 +7,31 @@ import { DefineVariable, VariableType } from '@syncbridge/common';
7
7
  */
8
8
  export class UdpClientVariables extends IoClientBaseComponent.Variables {
9
9
  }
10
+ __decorate([
11
+ DefineVariable({
12
+ label: 'Host',
13
+ description: 'Hostname or IP address which udp messages will send to',
14
+ index: 100,
15
+ }),
16
+ __metadata("design:type", String)
17
+ ], UdpClientVariables.prototype, "host", void 0);
10
18
  __decorate([
11
19
  DefineVariable({
12
20
  label: 'Port',
13
21
  description: 'Port number of target listener',
14
22
  minValue: 1,
15
23
  maxValue: 65535,
24
+ index: 101,
16
25
  }),
17
26
  __metadata("design:type", Number)
18
27
  ], UdpClientVariables.prototype, "port", void 0);
19
- __decorate([
20
- DefineVariable({
21
- label: 'Host',
22
- description: 'Hostname or IP address which udp messages will send to',
23
- }),
24
- __metadata("design:type", String)
25
- ], UdpClientVariables.prototype, "host", void 0);
26
28
  __decorate([
27
29
  DefineVariable({
28
30
  label: 'Bind Interface',
29
31
  description: 'Interface address to bind to. If not specified, will bind to all available addresses',
30
32
  type: VariableType.Enum,
31
33
  enumValues: getInterfaceAddresses(),
34
+ index: 102,
32
35
  }),
33
36
  __metadata("design:type", String)
34
37
  ], UdpClientVariables.prototype, "bindInterface", void 0);
@@ -14,6 +14,7 @@ __decorate([
14
14
  required: true,
15
15
  minValue: 1,
16
16
  maxValue: 65535,
17
+ index: 100,
17
18
  }),
18
19
  __metadata("design:type", Number)
19
20
  ], UdpListenerVariables.prototype, "port", void 0);
@@ -21,6 +22,7 @@ __decorate([
21
22
  DefineVariable({
22
23
  label: 'Broadcast',
23
24
  description: "Sets the SO_BROADCAST socket option. When set to true, UDP packets may be sent to a local interface's broadcast address.",
25
+ index: 101,
24
26
  }),
25
27
  __metadata("design:type", Boolean)
26
28
  ], UdpListenerVariables.prototype, "broadcast", void 0);
@@ -30,6 +32,7 @@ __decorate([
30
32
  description: 'Multicast groups to be joined',
31
33
  type: VariableType.String,
32
34
  isArray: true,
35
+ index: 102,
33
36
  }),
34
37
  __metadata("design:type", Array)
35
38
  ], UdpListenerVariables.prototype, "multicastGroups", void 0);
@@ -39,6 +42,7 @@ __decorate([
39
42
  description: 'Interface address to bind to. If not specified, will bind to all available addresses',
40
43
  type: VariableType.Enum,
41
44
  enumValues: getInterfaceAddresses(),
45
+ index: 103,
42
46
  }),
43
47
  __metadata("design:type", String)
44
48
  ], UdpListenerVariables.prototype, "bindInterface", void 0);
@@ -48,6 +52,7 @@ __decorate([
48
52
  description: 'Interface address to bind for multicast packages',
49
53
  type: VariableType.Enum,
50
54
  enumValues: getInterfaceAddresses(),
55
+ index: 104,
51
56
  }),
52
57
  __metadata("design:type", String)
53
58
  ], UdpListenerVariables.prototype, "multicastInterface", void 0);
package/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = '0.4.15';
1
+ export const version = '0.4.17';
2
2
  export const noOp = () => undefined;
3
3
  export const panatesAuthor = {
4
4
  name: 'Panates Technology AS',
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@syncbridge/net",
3
- "version": "0.4.15",
3
+ "version": "0.4.17",
4
4
  "description": "SyncBridge builtin net (socket) extensions",
5
5
  "author": "Panates Inc",
6
6
  "license": "UNLICENSED",
7
7
  "dependencies": {
8
8
  "@ngrok/ngrok": "^1.7.0",
9
- "@pinggy/pinggy": "^0.3.3",
9
+ "@pinggy/pinggy": "^0.3.5",
10
10
  "@serialport/bindings-interface": "^1.2.2",
11
11
  "@sqb/connect": "^4.19.6",
12
- "@sqb/oracle": "^4.21.1",
13
- "@sqb/postgres": "^4.21.1",
12
+ "@sqb/oracle": "^4.22.0",
13
+ "@sqb/postgres": "^4.22.0",
14
14
  "ansi-colors": "^4.1.3",
15
15
  "backoff": "^2.5.0",
16
16
  "date-fns": "^4.1.0",
@@ -27,8 +27,8 @@
27
27
  "serialport": "^13.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@syncbridge/common": "^0.5.9",
31
- "@syncbridge/builtins": "^0.4.15",
30
+ "@syncbridge/common": "^0.5.11",
31
+ "@syncbridge/builtins": "^0.4.17",
32
32
  "@sqb/builder": ">=4.19.6 <5",
33
33
  "@sqb/connect": ">=4.19.6 <5"
34
34
  },