@syncbridge/builtins 0.4.15 → 0.4.16
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.
- package/components/io-client-base.variables.d.ts +1 -0
- package/components/io-client-base.variables.js +6 -0
- package/components/io-server-base.component.d.ts +25 -0
- package/components/io-server-base.component.js +60 -0
- package/components/io-server-base.variables.d.ts +8 -0
- package/components/io-server-base.variables.js +21 -0
- package/components.d.ts +1 -0
- package/components.js +1 -0
- package/constants.js +1 -1
- package/package.json +5 -5
|
@@ -6,6 +6,12 @@ import { TransmitLogger } from '../classes/transmit-logger.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export class IoClientComponentVariables {
|
|
8
8
|
}
|
|
9
|
+
__decorate([
|
|
10
|
+
DefineVariable({
|
|
11
|
+
label: 'Communication Logs Enabled',
|
|
12
|
+
}),
|
|
13
|
+
__metadata("design:type", Boolean)
|
|
14
|
+
], IoClientComponentVariables.prototype, "communicationLogs_enabled", void 0);
|
|
9
15
|
__decorate([
|
|
10
16
|
DefineVariable({
|
|
11
17
|
label: 'Communication Logs',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { ComponentBase } from '@syncbridge/common';
|
|
3
|
+
import { TransmitLogger } from '../classes/transmit-logger.js';
|
|
4
|
+
import { IoServerComponentVariables } from './io-server-base.variables.js';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class IoServerBaseComponent<TEvents extends IoServerBaseComponent.Events = IoServerBaseComponent.Events> extends ComponentBase<TEvents> {
|
|
9
|
+
readonly protocol: string;
|
|
10
|
+
transmitLogger?: TransmitLogger;
|
|
11
|
+
values: IoServerComponentVariables;
|
|
12
|
+
protected _init(): Promise<void>;
|
|
13
|
+
write(data: string | Buffer): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @namespace
|
|
17
|
+
*/
|
|
18
|
+
export declare namespace IoServerBaseComponent {
|
|
19
|
+
interface Events extends ComponentBase.Events {
|
|
20
|
+
data: [data: Buffer, ...any];
|
|
21
|
+
transmit: [data: Buffer, ...any];
|
|
22
|
+
}
|
|
23
|
+
const Variables: typeof IoServerComponentVariables;
|
|
24
|
+
type Variables = IoServerComponentVariables;
|
|
25
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { Component, ComponentBase } from '@syncbridge/common';
|
|
4
|
+
import { TransmitLogger } from '../classes/transmit-logger.js';
|
|
5
|
+
import { panatesAuthor } from '../constants.js';
|
|
6
|
+
import { IoServerComponentVariables } from './io-server-base.variables.js';
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
let IoServerBaseComponent = class IoServerBaseComponent extends ComponentBase {
|
|
11
|
+
protocol = '';
|
|
12
|
+
transmitLogger;
|
|
13
|
+
async _init() {
|
|
14
|
+
await super._init();
|
|
15
|
+
const { communicationLogs } = this.values;
|
|
16
|
+
const { dataDirectory } = this.processor;
|
|
17
|
+
if (communicationLogs) {
|
|
18
|
+
const transmitLogger = (this.transmitLogger = new TransmitLogger({
|
|
19
|
+
...communicationLogs,
|
|
20
|
+
logDirectory: dataDirectory
|
|
21
|
+
? path.join(dataDirectory, 'comm-logs')
|
|
22
|
+
: undefined,
|
|
23
|
+
name: this.path.replace(/\//g, '-'),
|
|
24
|
+
maxFiles: communicationLogs?.maxFiles,
|
|
25
|
+
maxFileSize: communicationLogs?.maxFileSize,
|
|
26
|
+
}));
|
|
27
|
+
this.on('data', (data, info) => {
|
|
28
|
+
transmitLogger.received(data, info);
|
|
29
|
+
});
|
|
30
|
+
this.on('transmit', (data, info) => {
|
|
31
|
+
transmitLogger.transmitted(data, info);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
+
write(data) {
|
|
37
|
+
throw new Error(`"${this.constructor.name}" component do not support write operations.`);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Component.UseVariables(),
|
|
42
|
+
__metadata("design:type", IoServerComponentVariables)
|
|
43
|
+
], IoServerBaseComponent.prototype, "values", void 0);
|
|
44
|
+
IoServerBaseComponent = __decorate([
|
|
45
|
+
Component({
|
|
46
|
+
abstract: true,
|
|
47
|
+
className: 'IoServer',
|
|
48
|
+
displayName: 'IO Server',
|
|
49
|
+
description: 'Abstract component for IO operations',
|
|
50
|
+
author: panatesAuthor,
|
|
51
|
+
tags: ['io', 'stream'],
|
|
52
|
+
})
|
|
53
|
+
], IoServerBaseComponent);
|
|
54
|
+
export { IoServerBaseComponent };
|
|
55
|
+
/**
|
|
56
|
+
* @namespace
|
|
57
|
+
*/
|
|
58
|
+
(function (IoServerBaseComponent) {
|
|
59
|
+
IoServerBaseComponent.Variables = IoServerComponentVariables;
|
|
60
|
+
})(IoServerBaseComponent || (IoServerBaseComponent = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { DefineVariable } from '@syncbridge/common';
|
|
3
|
+
import { TransmitLogger } from '../classes/transmit-logger.js';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export class IoServerComponentVariables {
|
|
8
|
+
}
|
|
9
|
+
__decorate([
|
|
10
|
+
DefineVariable({
|
|
11
|
+
label: 'Communication Logs Enabled',
|
|
12
|
+
}),
|
|
13
|
+
__metadata("design:type", Boolean)
|
|
14
|
+
], IoServerComponentVariables.prototype, "communicationLogs_enabled", void 0);
|
|
15
|
+
__decorate([
|
|
16
|
+
DefineVariable({
|
|
17
|
+
label: 'Communication Logs',
|
|
18
|
+
description: 'Stores communication logs if enabled',
|
|
19
|
+
}),
|
|
20
|
+
__metadata("design:type", TransmitLogger.Variables)
|
|
21
|
+
], IoServerComponentVariables.prototype, "communicationLogs", void 0);
|
package/components.d.ts
CHANGED
package/components.js
CHANGED
package/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncbridge/builtins",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.16",
|
|
4
4
|
"description": "SyncBridge builtin 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.
|
|
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.
|
|
13
|
-
"@sqb/postgres": "^4.
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"serialport": "^13.0.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@syncbridge/common": "^0.5.
|
|
29
|
+
"@syncbridge/common": "^0.5.11",
|
|
30
30
|
"@sqb/builder": ">=4.19.6 <5",
|
|
31
31
|
"@sqb/connect": ">=4.19.6 <5"
|
|
32
32
|
},
|