@syncbridge/common 1.1.3 → 2.0.0
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/app-factory.d.ts +29 -0
- package/{processor-factory.js → app-factory.js} +64 -44
- package/app-factory.js.map +1 -0
- package/classes/{processor-base.d.ts → app-base.d.ts} +3 -3
- package/classes/app-base.js +11 -0
- package/classes/app-base.js.map +1 -0
- package/classes/base-element.d.ts +3 -0
- package/classes/base-element.js +2 -0
- package/classes/base-element.js.map +1 -1
- package/classes/component-base.d.ts +6 -6
- package/classes/component-base.js +2 -2
- package/classes/component-base.js.map +1 -1
- package/classes/log-channel-writer.d.ts +32 -0
- package/classes/log-channel-writer.js +97 -0
- package/classes/log-channel-writer.js.map +1 -0
- package/classes/runnable.d.ts +6 -0
- package/classes/runnable.js +22 -0
- package/classes/runnable.js.map +1 -1
- package/constants.d.ts +1 -1
- package/constants.js +1 -1
- package/decorators/app-events.decorator.d.ts +5 -0
- package/decorators/{processor-events.decorator.js → app-events.decorator.js} +1 -1
- package/decorators/app-events.decorator.js.map +1 -0
- package/decorators/app.decorator.d.ts +29 -0
- package/decorators/{processor.decorator.js → app.decorator.js} +25 -19
- package/decorators/app.decorator.js.map +1 -0
- package/decorators/component.decorator.js +13 -5
- package/decorators/component.decorator.js.map +1 -1
- package/decorators/define-variable.decorator.d.ts +6 -1
- package/decorators/define-variable.decorator.js +5 -1
- package/decorators/define-variable.decorator.js.map +1 -1
- package/decorators/log-channel.decorator.d.ts +97 -0
- package/decorators/log-channel.decorator.js +34 -0
- package/decorators/log-channel.decorator.js.map +1 -0
- package/decorators/use-component.decorator.d.ts +2 -2
- package/decorators/use-component.decorator.js +1 -1
- package/decorators/use-component.decorator.js.map +1 -1
- package/decorators/use-variables.decorator.d.ts +2 -2
- package/host-link/host-identity.d.ts +53 -0
- package/host-link/host-identity.js +140 -0
- package/host-link/host-identity.js.map +1 -0
- package/host-link/host-link.d.ts +43 -0
- package/host-link/host-link.js +54 -0
- package/host-link/host-link.js.map +1 -0
- package/host-link/host-packages.d.ts +25 -0
- package/host-link/host-packages.js +10 -0
- package/host-link/host-packages.js.map +1 -0
- package/host-link/host-workers.d.ts +75 -0
- package/host-link/host-workers.js +29 -0
- package/host-link/host-workers.js.map +1 -0
- package/host-link/multiplexer.d.ts +115 -0
- package/host-link/multiplexer.js +289 -0
- package/host-link/multiplexer.js.map +1 -0
- package/host-link/sealed-box.d.ts +21 -0
- package/host-link/sealed-box.js +104 -0
- package/host-link/sealed-box.js.map +1 -0
- package/index.d.ts +16 -3
- package/index.js +16 -3
- package/index.js.map +1 -1
- package/models/enums/enum-source.enum.d.ts +11 -0
- package/models/enums/enum-source.enum.js +22 -0
- package/models/enums/enum-source.enum.js.map +1 -0
- package/models/enums/log-channel-kind.d.ts +7 -0
- package/models/enums/log-channel-kind.js +14 -0
- package/models/enums/log-channel-kind.js.map +1 -0
- package/models/enums/service-status.d.ts +5 -1
- package/models/enums/service-status.js +4 -0
- package/models/enums/service-status.js.map +1 -1
- package/models/enums/worker-permission.enum.d.ts +16 -0
- package/models/enums/worker-permission.enum.js +28 -0
- package/models/enums/worker-permission.enum.js.map +1 -0
- package/models/index.d.ts +6 -1
- package/models/index.js +6 -1
- package/models/index.js.map +1 -1
- package/models/metadata/app-metadata.d.ts +6 -0
- package/models/metadata/{processor-metadata.js → app-metadata.js} +7 -7
- package/models/metadata/app-metadata.js.map +1 -0
- package/models/metadata/element-component-metadata.d.ts +2 -0
- package/models/metadata/element-component-metadata.js +10 -2
- package/models/metadata/element-component-metadata.js.map +1 -1
- package/models/metadata/element-metadata.d.ts +8 -0
- package/models/metadata/element-metadata.js +40 -0
- package/models/metadata/element-metadata.js.map +1 -1
- package/models/metadata/log-channel-metadata.d.ts +23 -0
- package/models/metadata/log-channel-metadata.js +73 -0
- package/models/metadata/log-channel-metadata.js.map +1 -0
- package/models/metadata/plugin-metadata.d.ts +15 -0
- package/models/metadata/plugin-metadata.js +66 -0
- package/models/metadata/plugin-metadata.js.map +1 -0
- package/models/metadata/variable-metadata.d.ts +3 -0
- package/models/metadata/variable-metadata.js +15 -1
- package/models/metadata/variable-metadata.js.map +1 -1
- package/models/profile/log-options.d.ts +17 -0
- package/models/profile/log-options.js +58 -1
- package/models/profile/log-options.js.map +1 -1
- package/models/profile/profile.d.ts +2 -2
- package/models/profile/profile.js +9 -9
- package/models/profile/profile.js.map +1 -1
- package/package.json +2 -2
- package/registry/docs-sidebar.d.ts +59 -0
- package/registry/docs-sidebar.js +170 -0
- package/registry/docs-sidebar.js.map +1 -0
- package/registry/extension-package.d.ts +40 -15
- package/registry/extension-package.js +59 -20
- package/registry/extension-package.js.map +1 -1
- package/registry/extension-registry.d.ts +16 -16
- package/registry/extension-registry.js +59 -44
- package/registry/extension-registry.js.map +1 -1
- package/registry/module-catalog.d.ts +31 -0
- package/registry/module-catalog.js +89 -0
- package/registry/module-catalog.js.map +1 -0
- package/registry/package-docs.d.ts +98 -0
- package/registry/package-docs.js +160 -0
- package/registry/package-docs.js.map +1 -0
- package/registry/package-manifest.d.ts +52 -24
- package/registry/package-manifest.js +53 -21
- package/registry/package-manifest.js.map +1 -1
- package/utils/decode-profile.d.ts +18 -2
- package/utils/decode-profile.js +65 -9
- package/utils/decode-profile.js.map +1 -1
- package/utils/encrypt-helpers.d.ts +7 -0
- package/utils/encrypt-helpers.js +12 -5
- package/utils/encrypt-helpers.js.map +1 -1
- package/utils/materialize-metadata.d.ts +3 -3
- package/utils/materialize-metadata.js +16 -12
- package/utils/materialize-metadata.js.map +1 -1
- package/utils/normalize-metadata.d.ts +23 -4
- package/utils/normalize-metadata.js +52 -6
- package/utils/normalize-metadata.js.map +1 -1
- package/utils/type-guards.d.ts +2 -2
- package/utils/type-guards.js +4 -4
- package/utils/type-guards.js.map +1 -1
- package/utils/worker-permissions.d.ts +25 -0
- package/utils/worker-permissions.js +60 -0
- package/utils/worker-permissions.js.map +1 -0
- package/classes/processor-base.js +0 -11
- package/classes/processor-base.js.map +0 -1
- package/decorators/processor-events.decorator.d.ts +0 -5
- package/decorators/processor-events.decorator.js.map +0 -1
- package/decorators/processor.decorator.d.ts +0 -29
- package/decorators/processor.decorator.js.map +0 -1
- package/models/metadata/processor-metadata.d.ts +0 -6
- package/models/metadata/processor-metadata.js.map +0 -1
- package/processor-factory.d.ts +0 -26
- package/processor-factory.js.map +0 -1
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { Duplex } from 'node:stream';
|
|
4
|
+
/*
|
|
5
|
+
* A frame: [type: u8][stream id: u32][payload]. The link (a WebSocket's
|
|
6
|
+
* binary messages) keeps the frames whole and in order.
|
|
7
|
+
*/
|
|
8
|
+
const FrameType = {
|
|
9
|
+
/** Opens a stream; payload: its meta, JSON */
|
|
10
|
+
OPEN: 1,
|
|
11
|
+
DATA: 2,
|
|
12
|
+
/** Lets the peer send that many more bytes on the stream; payload: u32 */
|
|
13
|
+
CREDIT: 3,
|
|
14
|
+
/** The sender writes no more on the stream */
|
|
15
|
+
END: 4,
|
|
16
|
+
/** The stream is gone, both ways; payload: why, utf8 */
|
|
17
|
+
RESET: 5,
|
|
18
|
+
/** A message of the link itself, on no stream (id 0); payload: JSON */
|
|
19
|
+
CONTROL: 6,
|
|
20
|
+
};
|
|
21
|
+
const HEADER_SIZE = 5;
|
|
22
|
+
/** A DATA frame's payload at most: big writes are cut */
|
|
23
|
+
const MAX_DATA = 32 * 1024;
|
|
24
|
+
/** Bytes a stream's sender may have sent the receiver has not taken */
|
|
25
|
+
const WINDOW = 256 * 1024;
|
|
26
|
+
/**
|
|
27
|
+
* Streams over one link: each a Duplex, with its own flow control - a
|
|
28
|
+
* sender sends no more than its receiver has room for, so a slow stream
|
|
29
|
+
* holds back itself, not the link or the others.
|
|
30
|
+
*/
|
|
31
|
+
export class Multiplexer extends EventEmitter {
|
|
32
|
+
options;
|
|
33
|
+
_streams = new Map();
|
|
34
|
+
_nextId;
|
|
35
|
+
_closed = false;
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super();
|
|
38
|
+
this.options = options;
|
|
39
|
+
this._nextId = options.side === 'console' ? 1 : 2;
|
|
40
|
+
}
|
|
41
|
+
get closed() {
|
|
42
|
+
return this._closed;
|
|
43
|
+
}
|
|
44
|
+
/** Opens a stream to the peer, with what it is for */
|
|
45
|
+
open(meta = {}) {
|
|
46
|
+
if (this._closed)
|
|
47
|
+
throw new Error('The link is closed');
|
|
48
|
+
const id = this._nextId;
|
|
49
|
+
this._nextId += 2;
|
|
50
|
+
const stream = new MuxStream(this, id);
|
|
51
|
+
this._streams.set(id, stream);
|
|
52
|
+
this._send(FrameType.OPEN, id, Buffer.from(JSON.stringify(meta)));
|
|
53
|
+
return stream;
|
|
54
|
+
}
|
|
55
|
+
/** Sends a message of the link itself */
|
|
56
|
+
control(message) {
|
|
57
|
+
if (this._closed)
|
|
58
|
+
return;
|
|
59
|
+
this._send(FrameType.CONTROL, 0, Buffer.from(JSON.stringify(message)));
|
|
60
|
+
}
|
|
61
|
+
/** Takes a frame the link received */
|
|
62
|
+
receive(frame) {
|
|
63
|
+
if (this._closed || frame.length < HEADER_SIZE)
|
|
64
|
+
return;
|
|
65
|
+
const type = frame.readUInt8(0);
|
|
66
|
+
const id = frame.readUInt32BE(1);
|
|
67
|
+
const payload = frame.subarray(HEADER_SIZE);
|
|
68
|
+
if (type === FrameType.CONTROL) {
|
|
69
|
+
const message = parseJson(payload);
|
|
70
|
+
if (message)
|
|
71
|
+
this.emit('control', message);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (type === FrameType.OPEN) {
|
|
75
|
+
if (this._streams.has(id) || id % 2 === this._nextId % 2) {
|
|
76
|
+
this._send(FrameType.RESET, id, Buffer.from('Bad stream id'));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const stream = new MuxStream(this, id);
|
|
80
|
+
this._streams.set(id, stream);
|
|
81
|
+
this.emit('stream', stream, parseJson(payload) || {});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const stream = this._streams.get(id);
|
|
85
|
+
if (!stream)
|
|
86
|
+
return;
|
|
87
|
+
switch (type) {
|
|
88
|
+
case FrameType.DATA:
|
|
89
|
+
stream._receiveData(Buffer.from(payload));
|
|
90
|
+
break;
|
|
91
|
+
case FrameType.CREDIT:
|
|
92
|
+
if (payload.length >= 4)
|
|
93
|
+
stream._receiveCredit(payload.readUInt32BE(0));
|
|
94
|
+
break;
|
|
95
|
+
case FrameType.END:
|
|
96
|
+
stream._receiveEnd();
|
|
97
|
+
break;
|
|
98
|
+
case FrameType.RESET:
|
|
99
|
+
stream._receiveReset(payload.toString('utf8'));
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** The link is gone: its streams too */
|
|
104
|
+
close(reason = 'The link closed') {
|
|
105
|
+
if (this._closed)
|
|
106
|
+
return;
|
|
107
|
+
this._closed = true;
|
|
108
|
+
for (const stream of [...this._streams.values()])
|
|
109
|
+
stream._receiveReset(reason);
|
|
110
|
+
this._streams.clear();
|
|
111
|
+
}
|
|
112
|
+
/** @internal */
|
|
113
|
+
_send(type, id, payload) {
|
|
114
|
+
if (this._closed)
|
|
115
|
+
return;
|
|
116
|
+
const frame = Buffer.allocUnsafe(HEADER_SIZE + (payload?.length || 0));
|
|
117
|
+
frame.writeUInt8(type, 0);
|
|
118
|
+
frame.writeUInt32BE(id, 1);
|
|
119
|
+
if (payload)
|
|
120
|
+
payload.copy(frame, HEADER_SIZE);
|
|
121
|
+
this.options.send(frame);
|
|
122
|
+
}
|
|
123
|
+
/** @internal */
|
|
124
|
+
_sendCredit(id, bytes) {
|
|
125
|
+
const payload = Buffer.allocUnsafe(4);
|
|
126
|
+
payload.writeUInt32BE(bytes, 0);
|
|
127
|
+
this._send(FrameType.CREDIT, id, payload);
|
|
128
|
+
}
|
|
129
|
+
/** @internal */
|
|
130
|
+
_sendData(id, data) {
|
|
131
|
+
this._send(FrameType.DATA, id, data);
|
|
132
|
+
}
|
|
133
|
+
/** @internal */
|
|
134
|
+
_sendEnd(id) {
|
|
135
|
+
this._send(FrameType.END, id);
|
|
136
|
+
}
|
|
137
|
+
/** @internal */
|
|
138
|
+
_sendReset(id, reason) {
|
|
139
|
+
this._send(FrameType.RESET, id, Buffer.from(reason));
|
|
140
|
+
}
|
|
141
|
+
/** @internal */
|
|
142
|
+
_forget(id) {
|
|
143
|
+
this._streams.delete(id);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A stream of a Multiplexer. It passes for a socket where a Node HTTP
|
|
148
|
+
* server or client takes one: it has what they call on a socket.
|
|
149
|
+
*/
|
|
150
|
+
export class MuxStream extends Duplex {
|
|
151
|
+
_mux;
|
|
152
|
+
id;
|
|
153
|
+
/** Bytes it may send: what the peer has room for */
|
|
154
|
+
_credit = WINDOW;
|
|
155
|
+
/** Bytes taken in but not yet given back as credit: the reader is slow */
|
|
156
|
+
_owed = 0;
|
|
157
|
+
/** A write waiting for credit */
|
|
158
|
+
_pending;
|
|
159
|
+
_ended = false;
|
|
160
|
+
_peerEnded = false;
|
|
161
|
+
_timeout;
|
|
162
|
+
_timeoutMs = 0;
|
|
163
|
+
/** Where it comes from, for a server's request: the link */
|
|
164
|
+
remoteAddress = 'tunnel';
|
|
165
|
+
remotePort = 0;
|
|
166
|
+
constructor(_mux, id) {
|
|
167
|
+
super({ allowHalfOpen: true });
|
|
168
|
+
this._mux = _mux;
|
|
169
|
+
this.id = id;
|
|
170
|
+
}
|
|
171
|
+
/* What an HTTP server or client calls on a socket */
|
|
172
|
+
setTimeout(ms, callback) {
|
|
173
|
+
this._timeoutMs = ms;
|
|
174
|
+
if (callback)
|
|
175
|
+
this.once('timeout', callback);
|
|
176
|
+
this._touch();
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
179
|
+
setNoDelay() {
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
setKeepAlive() {
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
ref() {
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
unref() {
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
address() {
|
|
192
|
+
return {};
|
|
193
|
+
}
|
|
194
|
+
/** @internal */
|
|
195
|
+
_receiveData(data) {
|
|
196
|
+
this._touch();
|
|
197
|
+
if (this.destroyed)
|
|
198
|
+
return;
|
|
199
|
+
if (this.push(data))
|
|
200
|
+
this._mux._sendCredit(this.id, data.length);
|
|
201
|
+
else
|
|
202
|
+
this._owed += data.length;
|
|
203
|
+
}
|
|
204
|
+
/** @internal */
|
|
205
|
+
_receiveCredit(bytes) {
|
|
206
|
+
this._credit += bytes;
|
|
207
|
+
const pending = this._pending;
|
|
208
|
+
if (pending) {
|
|
209
|
+
this._pending = undefined;
|
|
210
|
+
this._write(pending.data, 'binary', pending.callback);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/** @internal */
|
|
214
|
+
_receiveEnd() {
|
|
215
|
+
this._peerEnded = true;
|
|
216
|
+
this.push(null);
|
|
217
|
+
this._settle();
|
|
218
|
+
}
|
|
219
|
+
/** @internal */
|
|
220
|
+
_receiveReset(reason) {
|
|
221
|
+
this._peerEnded = true;
|
|
222
|
+
this._ended = true;
|
|
223
|
+
/* An error to who listens for one: else it is closed, not thrown */
|
|
224
|
+
this.destroy(this.listenerCount('error') ? new Error(reason) : undefined);
|
|
225
|
+
}
|
|
226
|
+
_read() {
|
|
227
|
+
/* The reader has room again: what it was owed, the peer may send */
|
|
228
|
+
if (this._owed) {
|
|
229
|
+
const owed = this._owed;
|
|
230
|
+
this._owed = 0;
|
|
231
|
+
this._mux._sendCredit(this.id, owed);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
_write(chunk, _encoding, callback) {
|
|
235
|
+
this._touch();
|
|
236
|
+
let data = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
237
|
+
while (data.length) {
|
|
238
|
+
if (this._credit <= 0) {
|
|
239
|
+
this._pending = { data, callback };
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const size = Math.min(data.length, MAX_DATA, this._credit);
|
|
243
|
+
this._mux._sendData(this.id, data.subarray(0, size));
|
|
244
|
+
this._credit -= size;
|
|
245
|
+
data = data.subarray(size);
|
|
246
|
+
}
|
|
247
|
+
callback();
|
|
248
|
+
}
|
|
249
|
+
_final(callback) {
|
|
250
|
+
this._ended = true;
|
|
251
|
+
this._mux._sendEnd(this.id);
|
|
252
|
+
callback();
|
|
253
|
+
this._settle();
|
|
254
|
+
}
|
|
255
|
+
_destroy(error, callback) {
|
|
256
|
+
clearTimeout(this._timeout);
|
|
257
|
+
if (!this._ended || !this._peerEnded)
|
|
258
|
+
this._mux._sendReset(this.id, error?.message || 'Closed');
|
|
259
|
+
this._ended = this._peerEnded = true;
|
|
260
|
+
this._mux._forget(this.id);
|
|
261
|
+
const pending = this._pending;
|
|
262
|
+
this._pending = undefined;
|
|
263
|
+
pending?.callback(error || new Error('Closed'));
|
|
264
|
+
callback(error);
|
|
265
|
+
}
|
|
266
|
+
/** Done both ways: it is let go */
|
|
267
|
+
_settle() {
|
|
268
|
+
if (this._ended && this._peerEnded) {
|
|
269
|
+
clearTimeout(this._timeout);
|
|
270
|
+
this._mux._forget(this.id);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** Activity: the idle timeout starts over */
|
|
274
|
+
_touch() {
|
|
275
|
+
clearTimeout(this._timeout);
|
|
276
|
+
if (this._timeoutMs > 0 && !this.destroyed)
|
|
277
|
+
this._timeout = setTimeout(() => this.emit('timeout'), this._timeoutMs).unref();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function parseJson(payload) {
|
|
281
|
+
try {
|
|
282
|
+
const value = JSON.parse(payload.toString('utf8'));
|
|
283
|
+
return value && typeof value === 'object' ? value : undefined;
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=multiplexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplexer.js","sourceRoot":"","sources":["../../src/host-link/multiplexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,MAAM,SAAS,GAAG;IAChB,8CAA8C;IAC9C,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,0EAA0E;IAC1E,MAAM,EAAE,CAAC;IACT,8CAA8C;IAC9C,GAAG,EAAE,CAAC;IACN,wDAAwD;IACxD,KAAK,EAAE,CAAC;IACR,uEAAuE;IACvE,OAAO,EAAE,CAAC;CACF,CAAC;AAGX,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,yDAAyD;AACzD,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC;AAC3B,uEAAuE;AACvE,MAAM,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;AAqB1B;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAgC;IAK1C;IAJX,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;IACxC,OAAO,CAAS;IAChB,OAAO,GAAG,KAAK,CAAC;IAE1B,YAAqB,OAA4B;QAC/C,KAAK,EAAE,CAAC;QADW,YAAO,GAAP,OAAO,CAAqB;QAE/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,sDAAsD;IACtD,IAAI,CAAC,O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IAAI,CAAC,IAAI,CAAC,SAAS;YACxC,IAAI,CAAC,QAAQ,GAAG,UAAU,CACxB,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAC1B,IAAI,CAAC,UAAU,CAChB,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;CACF;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A key pair a host's values are sealed for: its public key told */
|
|
2
|
+
export declare function generateSealKeys(): {
|
|
3
|
+
publicKey: string;
|
|
4
|
+
privateKey: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A key pair to seal for drawn from a secret, the same each time: one kept
|
|
8
|
+
* by none but drawn when needed - Console's own, from the key it is given
|
|
9
|
+
*/
|
|
10
|
+
export declare function sealKeysOf(secret: string): {
|
|
11
|
+
publicKey: string;
|
|
12
|
+
privateKey: string;
|
|
13
|
+
};
|
|
14
|
+
/** A public key to seal for, as sent: an X25519 key's SPKI, base64; undefined if not */
|
|
15
|
+
export declare function readSealPublicKey(value: string): Buffer | undefined;
|
|
16
|
+
/** A value sealed for the host whose public key is given */
|
|
17
|
+
export declare function sealFor(publicKey: string, value: string): string;
|
|
18
|
+
/** Whether a value is one sealed */
|
|
19
|
+
export declare const isSealed: (value: string) => boolean;
|
|
20
|
+
/** A sealed value opened, by the private key it was sealed for */
|
|
21
|
+
export declare function openSealed(privateKey: string, sealed: string): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createCipheriv, createDecipheriv, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes, } from 'node:crypto';
|
|
2
|
+
/*
|
|
3
|
+
* A value sealed for one host: only its private key opens it. Its key pair
|
|
4
|
+
* for this (X25519) is apart from its identity's (Ed25519, signing): made
|
|
5
|
+
* on the host when it pairs, its public key told to Console. A value is
|
|
6
|
+
* sealed with a key of its own each time (ephemeral X25519), the shared
|
|
7
|
+
* secret drawn out by HKDF-SHA256, the value enciphered by AES-256-GCM -
|
|
8
|
+
* what Console sends a host, its workers' secrets, never plain on the way.
|
|
9
|
+
*/
|
|
10
|
+
/** A sealed value's first part: its kind and version */
|
|
11
|
+
const SEALED_PREFIX = 'sbseal1.';
|
|
12
|
+
const INFO = Buffer.from('syncbridge sealed box v1');
|
|
13
|
+
const SPKI = { format: 'der', type: 'spki' };
|
|
14
|
+
/** A key pair a host's values are sealed for: its public key told */
|
|
15
|
+
export function generateSealKeys() {
|
|
16
|
+
const { publicKey, privateKey } = generateKeyPairSync('x25519');
|
|
17
|
+
return {
|
|
18
|
+
publicKey: publicKey.export(SPKI).toString('base64'),
|
|
19
|
+
privateKey: privateKey.export({ type: 'pkcs8', format: 'pem' }).toString(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/* An X25519 private key's PKCS#8 DER, but for its 32 bytes */
|
|
23
|
+
const X25519_PKCS8 = Buffer.from('302e020100300506032b656e04220420', 'hex');
|
|
24
|
+
/**
|
|
25
|
+
* A key pair to seal for drawn from a secret, the same each time: one kept
|
|
26
|
+
* by none but drawn when needed - Console's own, from the key it is given
|
|
27
|
+
*/
|
|
28
|
+
export function sealKeysOf(secret) {
|
|
29
|
+
const seed = Buffer.from(hkdfSync('sha256', secret, Buffer.alloc(0), Buffer.from('syncbridge seal key v1'), 32));
|
|
30
|
+
const privateKey = createPrivateKey({
|
|
31
|
+
key: Buffer.concat([X25519_PKCS8, seed]),
|
|
32
|
+
format: 'der',
|
|
33
|
+
type: 'pkcs8',
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
publicKey: createPublicKey(privateKey).export(SPKI).toString('base64'),
|
|
37
|
+
privateKey: privateKey.export({ type: 'pkcs8', format: 'pem' }).toString(),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** A public key to seal for, as sent: an X25519 key's SPKI, base64; undefined if not */
|
|
41
|
+
export function readSealPublicKey(value) {
|
|
42
|
+
try {
|
|
43
|
+
const der = Buffer.from(String(value), 'base64');
|
|
44
|
+
const key = createPublicKey({ key: der, ...SPKI });
|
|
45
|
+
return key.asymmetricKeyType === 'x25519' ? der : undefined;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** The key a sealed value is enciphered with: both public keys bound in */
|
|
52
|
+
function sealKey(shared, ephemeral, recipient) {
|
|
53
|
+
return Buffer.from(hkdfSync('sha256', shared, Buffer.concat([ephemeral, recipient]), INFO, 32));
|
|
54
|
+
}
|
|
55
|
+
/** A value sealed for the host whose public key is given */
|
|
56
|
+
export function sealFor(publicKey, value) {
|
|
57
|
+
const recipientDer = readSealPublicKey(publicKey);
|
|
58
|
+
if (!recipientDer)
|
|
59
|
+
throw new TypeError('Not a key to seal for');
|
|
60
|
+
const recipient = createPublicKey({ key: recipientDer, ...SPKI });
|
|
61
|
+
const ephemeral = generateKeyPairSync('x25519');
|
|
62
|
+
const ephemeralDer = ephemeral.publicKey.export(SPKI);
|
|
63
|
+
const key = sealKey(diffieHellman({ privateKey: ephemeral.privateKey, publicKey: recipient }), ephemeralDer, recipientDer);
|
|
64
|
+
const iv = randomBytes(12);
|
|
65
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
66
|
+
const enciphered = Buffer.concat([
|
|
67
|
+
cipher.update(value, 'utf8'),
|
|
68
|
+
cipher.final(),
|
|
69
|
+
]);
|
|
70
|
+
return (SEALED_PREFIX +
|
|
71
|
+
Buffer.concat([
|
|
72
|
+
Buffer.from([ephemeralDer.length]),
|
|
73
|
+
ephemeralDer,
|
|
74
|
+
iv,
|
|
75
|
+
cipher.getAuthTag(),
|
|
76
|
+
enciphered,
|
|
77
|
+
]).toString('base64'));
|
|
78
|
+
}
|
|
79
|
+
/** Whether a value is one sealed */
|
|
80
|
+
export const isSealed = (value) => value.startsWith(SEALED_PREFIX);
|
|
81
|
+
/** A sealed value opened, by the private key it was sealed for */
|
|
82
|
+
export function openSealed(privateKey, sealed) {
|
|
83
|
+
if (!isSealed(sealed))
|
|
84
|
+
throw new TypeError('Not a sealed value');
|
|
85
|
+
const data = Buffer.from(sealed.slice(SEALED_PREFIX.length), 'base64');
|
|
86
|
+
const length = data[0];
|
|
87
|
+
const ephemeralDer = data.subarray(1, 1 + length);
|
|
88
|
+
const iv = data.subarray(1 + length, 13 + length);
|
|
89
|
+
const tag = data.subarray(13 + length, 29 + length);
|
|
90
|
+
const enciphered = data.subarray(29 + length);
|
|
91
|
+
const own = createPrivateKey(privateKey);
|
|
92
|
+
const ownDer = createPublicKey(own).export(SPKI);
|
|
93
|
+
const key = sealKey(diffieHellman({
|
|
94
|
+
privateKey: own,
|
|
95
|
+
publicKey: createPublicKey({ key: ephemeralDer, ...SPKI }),
|
|
96
|
+
}), ephemeralDer, ownDer);
|
|
97
|
+
const decipher = createDecipheriv('aes-256-gcm', key, iv);
|
|
98
|
+
decipher.setAuthTag(tag);
|
|
99
|
+
return Buffer.concat([
|
|
100
|
+
decipher.update(enciphered),
|
|
101
|
+
decipher.final(),
|
|
102
|
+
]).toString('utf8');
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=sealed-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sealed-box.js","sourceRoot":"","sources":["../../src/host-link/sealed-box.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBA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YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;IAClD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,OAAO,CACjB,aAAa,CAAC;QACZ,UAAU,EAAE,GAAG;QACf,SAAS,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAC;KAC3D,CAAC,EACF,YAAY,EACZ,MAAM,CACP,CAAC;IACF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1D,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;QAC3B,QAAQ,CAAC,KAAK,EAAE;KACjB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
|
+
export * from './app-factory.js';
|
|
2
|
+
export * from './classes/app-base.js';
|
|
1
3
|
export * from './classes/base-element.js';
|
|
2
4
|
export * from './classes/component-base.js';
|
|
3
5
|
export * from './classes/console-logger.js';
|
|
4
6
|
export * from './classes/frame-stream.js';
|
|
5
|
-
export * from './classes/
|
|
7
|
+
export * from './classes/log-channel-writer.js';
|
|
6
8
|
export * from './classes/runnable.js';
|
|
7
9
|
export * from './classes/sb-error.js';
|
|
8
10
|
export * from './classes/stack-executor.js';
|
|
9
11
|
export * from './constants.js';
|
|
12
|
+
export * from './decorators/app.decorator.js';
|
|
10
13
|
export * from './decorators/component.decorator.js';
|
|
11
14
|
export * from './decorators/define-variable.decorator.js';
|
|
12
|
-
export * from './decorators/
|
|
15
|
+
export * from './decorators/log-channel.decorator.js';
|
|
16
|
+
export * from './host-link/host-identity.js';
|
|
17
|
+
export * from './host-link/host-link.js';
|
|
18
|
+
export * from './host-link/host-packages.js';
|
|
19
|
+
export * from './host-link/host-workers.js';
|
|
20
|
+
export * from './host-link/multiplexer.js';
|
|
21
|
+
export * from './host-link/sealed-box.js';
|
|
13
22
|
export * from './interfaces/index.js';
|
|
14
23
|
export * from './models/index.js';
|
|
15
24
|
export * as models from './models/index.js';
|
|
16
25
|
export * from './models-document.js';
|
|
17
|
-
export * from './
|
|
26
|
+
export * from './registry/docs-sidebar.js';
|
|
18
27
|
export * from './registry/extension-package.js';
|
|
19
28
|
export * from './registry/extension-registry.js';
|
|
29
|
+
export * from './registry/module-catalog.js';
|
|
30
|
+
export * from './registry/package-docs.js';
|
|
20
31
|
export * from './registry/package-manifest.js';
|
|
21
32
|
export * from './utils/decode-profile.js';
|
|
33
|
+
export { SECRET_PREFIX, secretDecryptor, secretEncryptor, } from './utils/encrypt-helpers.js';
|
|
22
34
|
export * from './utils/materialize-metadata.js';
|
|
23
35
|
export * from './utils/normalize-metadata.js';
|
|
24
36
|
export * from './utils/registry-names.js';
|
|
25
37
|
export * from './utils/type-guards.js';
|
|
26
38
|
export * from './utils/uri-to-id.js';
|
|
39
|
+
export * from './utils/worker-permissions.js';
|
package/index.js
CHANGED
|
@@ -1,27 +1,40 @@
|
|
|
1
|
+
export * from './app-factory.js';
|
|
2
|
+
export * from './classes/app-base.js';
|
|
1
3
|
export * from './classes/base-element.js';
|
|
2
4
|
export * from './classes/component-base.js';
|
|
3
5
|
export * from './classes/console-logger.js';
|
|
4
6
|
export * from './classes/frame-stream.js';
|
|
5
|
-
export * from './classes/
|
|
7
|
+
export * from './classes/log-channel-writer.js';
|
|
6
8
|
export * from './classes/runnable.js';
|
|
7
9
|
export * from './classes/sb-error.js';
|
|
8
10
|
export * from './classes/stack-executor.js';
|
|
9
11
|
export * from './constants.js';
|
|
12
|
+
export * from './decorators/app.decorator.js';
|
|
10
13
|
export * from './decorators/component.decorator.js';
|
|
11
14
|
export * from './decorators/define-variable.decorator.js';
|
|
12
|
-
export * from './decorators/
|
|
15
|
+
export * from './decorators/log-channel.decorator.js';
|
|
16
|
+
export * from './host-link/host-identity.js';
|
|
17
|
+
export * from './host-link/host-link.js';
|
|
18
|
+
export * from './host-link/host-packages.js';
|
|
19
|
+
export * from './host-link/host-workers.js';
|
|
20
|
+
export * from './host-link/multiplexer.js';
|
|
21
|
+
export * from './host-link/sealed-box.js';
|
|
13
22
|
export * from './interfaces/index.js';
|
|
14
23
|
export * from './models/index.js';
|
|
15
24
|
export * as models from './models/index.js';
|
|
16
25
|
export * from './models-document.js';
|
|
17
|
-
export * from './
|
|
26
|
+
export * from './registry/docs-sidebar.js';
|
|
18
27
|
export * from './registry/extension-package.js';
|
|
19
28
|
export * from './registry/extension-registry.js';
|
|
29
|
+
export * from './registry/module-catalog.js';
|
|
30
|
+
export * from './registry/package-docs.js';
|
|
20
31
|
export * from './registry/package-manifest.js';
|
|
21
32
|
export * from './utils/decode-profile.js';
|
|
33
|
+
export { SECRET_PREFIX, secretDecryptor, secretEncryptor, } from './utils/encrypt-helpers.js';
|
|
22
34
|
export * from './utils/materialize-metadata.js';
|
|
23
35
|
export * from './utils/normalize-metadata.js';
|
|
24
36
|
export * from './utils/registry-names.js';
|
|
25
37
|
export * from './utils/type-guards.js';
|
|
26
38
|
export * from './utils/uri-to-id.js';
|
|
39
|
+
export * from './utils/worker-permissions.js';
|
|
27
40
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an enum variable's values come from when they depend on the server
|
|
3
|
+
* it runs on: filled in by SyncBridge as the list is asked for - never at
|
|
4
|
+
* a module's import, nor when its package is built
|
|
5
|
+
*/
|
|
6
|
+
export declare enum EnumSource {
|
|
7
|
+
/** The serial ports of the server, by their paths */
|
|
8
|
+
SerialPorts = "serial-ports",
|
|
9
|
+
/** The server's IPv4 addresses, its loopback's apart */
|
|
10
|
+
NetworkAddresses = "network-addresses"
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EnumType } from '@opra/common';
|
|
2
|
+
/**
|
|
3
|
+
* Where an enum variable's values come from when they depend on the server
|
|
4
|
+
* it runs on: filled in by SyncBridge as the list is asked for - never at
|
|
5
|
+
* a module's import, nor when its package is built
|
|
6
|
+
*/
|
|
7
|
+
export var EnumSource;
|
|
8
|
+
(function (EnumSource) {
|
|
9
|
+
/** The serial ports of the server, by their paths */
|
|
10
|
+
EnumSource["SerialPorts"] = "serial-ports";
|
|
11
|
+
/** The server's IPv4 addresses, its loopback's apart */
|
|
12
|
+
EnumSource["NetworkAddresses"] = "network-addresses";
|
|
13
|
+
})(EnumSource || (EnumSource = {}));
|
|
14
|
+
EnumType(EnumSource, {
|
|
15
|
+
name: 'EnumSource',
|
|
16
|
+
description: "Where an enum variable's values come from, filled in by SyncBridge as the list is asked for",
|
|
17
|
+
meanings: {
|
|
18
|
+
SerialPorts: 'The serial ports of the server, by their paths',
|
|
19
|
+
NetworkAddresses: "The server's IPv4 addresses, its loopback's apart",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=enum-source.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum-source.enum.js","sourceRoot":"","sources":["../../../src/models/enums/enum-source.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,qDAAqD;IACrD,0CAA4B,CAAA;IAC5B,wDAAwD;IACxD,oDAAsC,CAAA;AACxC,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAED,QAAQ,CAAC,UAAU,EAAE;IACnB,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,6FAA6F;IAC/F,QAAQ,EAAE;QACR,WAAW,EAAE,gDAAgD;QAC7D,gBAAgB,EAAE,mDAAmD;KACtE;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnumType } from '@opra/common';
|
|
2
|
+
/** How a log channel's records are shown */
|
|
3
|
+
export var LogChannelKind;
|
|
4
|
+
(function (LogChannelKind) {
|
|
5
|
+
/** Level and message, as the console */
|
|
6
|
+
LogChannelKind["text"] = "text";
|
|
7
|
+
/** Direction and raw data, as device communication */
|
|
8
|
+
LogChannelKind["transmit"] = "transmit";
|
|
9
|
+
})(LogChannelKind || (LogChannelKind = {}));
|
|
10
|
+
EnumType(LogChannelKind, {
|
|
11
|
+
name: 'LogChannelKind',
|
|
12
|
+
description: "How a log channel's records are shown",
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=log-channel-kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-channel-kind.js","sourceRoot":"","sources":["../../../src/models/enums/log-channel-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,4CAA4C;AAC5C,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,wCAAwC;IACxC,+BAAa,CAAA;IACb,sDAAsD;IACtD,uCAAqB,CAAA;AACvB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED,QAAQ,CAAC,cAAc,EAAE;IACvB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAC"}
|
|
@@ -4,5 +4,9 @@ export declare enum ServiceStatus {
|
|
|
4
4
|
started = "started",
|
|
5
5
|
unhealthy = "unhealthy",
|
|
6
6
|
stopping = "stopping",
|
|
7
|
-
invalid = "invalid"
|
|
7
|
+
invalid = "invalid",
|
|
8
|
+
/** Its packages are not installed for its configuration; init installs them */
|
|
9
|
+
needsInit = "needs-init",
|
|
10
|
+
/** Its packages are being installed */
|
|
11
|
+
initializing = "initializing"
|
|
8
12
|
}
|
|
@@ -7,6 +7,10 @@ export var ServiceStatus;
|
|
|
7
7
|
ServiceStatus["unhealthy"] = "unhealthy";
|
|
8
8
|
ServiceStatus["stopping"] = "stopping";
|
|
9
9
|
ServiceStatus["invalid"] = "invalid";
|
|
10
|
+
/** Its packages are not installed for its configuration; init installs them */
|
|
11
|
+
ServiceStatus["needsInit"] = "needs-init";
|
|
12
|
+
/** Its packages are being installed */
|
|
13
|
+
ServiceStatus["initializing"] = "initializing";
|
|
10
14
|
})(ServiceStatus || (ServiceStatus = {}));
|
|
11
15
|
EnumType(ServiceStatus, {
|
|
12
16
|
name: 'ServiceStatus',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-status.js","sourceRoot":"","sources":["../../../src/models/enums/service-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"service-status.js","sourceRoot":"","sources":["../../../src/models/enums/service-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;IACnB,+EAA+E;IAC/E,yCAAwB,CAAA;IACxB,uCAAuC;IACvC,8CAA6B,CAAA;AAC/B,CAAC,EAXW,aAAa,KAAb,aAAa,QAWxB;AAED,QAAQ,CAAC,aAAa,EAAE;IACtB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,uBAAuB;CACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What of the server a worker reaches beyond its own directory, as an app
|
|
3
|
+
* or a component declares it needs: its worker given it - its user in the
|
|
4
|
+
* device's group - and told in the UI. Not declared, none.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum WorkerPermission {
|
|
7
|
+
/** The serial ports: its user in their group (dialout) */
|
|
8
|
+
SerialPorts = "serial-ports",
|
|
9
|
+
/**
|
|
10
|
+
* Native addons (.node): a module with one - serialport, oracledb - is
|
|
11
|
+
* outside Node's permission model, so it is given it by name alone
|
|
12
|
+
*/
|
|
13
|
+
NativeCode = "native-code",
|
|
14
|
+
/** Starting other programs: outside Node's permission model too */
|
|
15
|
+
ChildProcesses = "child-processes"
|
|
16
|
+
}
|