@kwirthmagnify/kwirth-plugin-echo 0.1.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.
Files changed (3) hide show
  1. package/back.js +1296 -0
  2. package/front.js +275 -0
  3. package/package.json +8 -0
package/back.js ADDED
@@ -0,0 +1,1296 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // node_modules/@kwirthmagnify/kwirth-common-back/dist/IChannel.js
34
+ var require_IChannel = __commonJS({
35
+ "node_modules/@kwirthmagnify/kwirth-common-back/dist/IChannel.js"(exports2) {
36
+ "use strict";
37
+ Object.defineProperty(exports2, "__esModule", { value: true });
38
+ }
39
+ });
40
+
41
+ // node_modules/@kwirthmagnify/kwirth-common-back/dist/IProvider.js
42
+ var require_IProvider = __commonJS({
43
+ "node_modules/@kwirthmagnify/kwirth-common-back/dist/IProvider.js"(exports2) {
44
+ "use strict";
45
+ Object.defineProperty(exports2, "__esModule", { value: true });
46
+ }
47
+ });
48
+
49
+ // node_modules/@kwirthmagnify/kwirth-common-back/dist/ISender.js
50
+ var require_ISender = __commonJS({
51
+ "node_modules/@kwirthmagnify/kwirth-common-back/dist/ISender.js"(exports2) {
52
+ "use strict";
53
+ Object.defineProperty(exports2, "__esModule", { value: true });
54
+ }
55
+ });
56
+
57
+ // node_modules/@kwirthmagnify/kwirth-common/dist/Channel.js
58
+ var require_Channel = __commonJS({
59
+ "node_modules/@kwirthmagnify/kwirth-common/dist/Channel.js"(exports2) {
60
+ "use strict";
61
+ Object.defineProperty(exports2, "__esModule", { value: true });
62
+ exports2.EClusterType = exports2.ClusterTypeEnum = void 0;
63
+ var ClusterTypeEnum;
64
+ (function(ClusterTypeEnum2) {
65
+ ClusterTypeEnum2["KUBERNETES"] = "kubernetes";
66
+ ClusterTypeEnum2["DOCKER"] = "docker";
67
+ })(ClusterTypeEnum || (exports2.ClusterTypeEnum = ClusterTypeEnum = {}));
68
+ var EClusterType2;
69
+ (function(EClusterType3) {
70
+ EClusterType3["KUBERNETES"] = "kubernetes";
71
+ EClusterType3["DOCKER"] = "docker";
72
+ })(EClusterType2 || (exports2.EClusterType = EClusterType2 = {}));
73
+ }
74
+ });
75
+
76
+ // node_modules/@kwirthmagnify/kwirth-common/dist/Sender.js
77
+ var require_Sender = __commonJS({
78
+ "node_modules/@kwirthmagnify/kwirth-common/dist/Sender.js"(exports2) {
79
+ "use strict";
80
+ Object.defineProperty(exports2, "__esModule", { value: true });
81
+ }
82
+ });
83
+
84
+ // node_modules/@kwirthmagnify/kwirth-common/dist/InstanceMessage.js
85
+ var require_InstanceMessage = __commonJS({
86
+ "node_modules/@kwirthmagnify/kwirth-common/dist/InstanceMessage.js"(exports2) {
87
+ "use strict";
88
+ Object.defineProperty(exports2, "__esModule", { value: true });
89
+ exports2.EInstanceMessageFlow = exports2.InstanceMessageFlowEnum = exports2.EInstanceMessageAction = exports2.InstanceMessageActionEnum = exports2.EInstanceMessageType = exports2.InstanceMessageTypeEnum = exports2.EInstanceMessageChannel = exports2.InstanceMessageChannelEnum = void 0;
90
+ var InstanceMessageChannelEnum;
91
+ (function(InstanceMessageChannelEnum2) {
92
+ InstanceMessageChannelEnum2["NONE"] = "none";
93
+ InstanceMessageChannelEnum2["LOG"] = "log";
94
+ InstanceMessageChannelEnum2["METRICS"] = "metrics";
95
+ InstanceMessageChannelEnum2["AUDIT"] = "audit";
96
+ InstanceMessageChannelEnum2["OPS"] = "ops";
97
+ InstanceMessageChannelEnum2["ALERT"] = "alert";
98
+ InstanceMessageChannelEnum2["TRIVY"] = "trivy";
99
+ })(InstanceMessageChannelEnum || (exports2.InstanceMessageChannelEnum = InstanceMessageChannelEnum = {}));
100
+ var EInstanceMessageChannel;
101
+ (function(EInstanceMessageChannel2) {
102
+ EInstanceMessageChannel2["NONE"] = "none";
103
+ EInstanceMessageChannel2["LOG"] = "log";
104
+ EInstanceMessageChannel2["METRICS"] = "metrics";
105
+ EInstanceMessageChannel2["AUDIT"] = "audit";
106
+ EInstanceMessageChannel2["OPS"] = "ops";
107
+ EInstanceMessageChannel2["ALERT"] = "alert";
108
+ EInstanceMessageChannel2["TRIVY"] = "trivy";
109
+ EInstanceMessageChannel2["MAGNIFY"] = "magnify";
110
+ })(EInstanceMessageChannel || (exports2.EInstanceMessageChannel = EInstanceMessageChannel = {}));
111
+ var InstanceMessageTypeEnum;
112
+ (function(InstanceMessageTypeEnum2) {
113
+ InstanceMessageTypeEnum2["DATA"] = "data";
114
+ InstanceMessageTypeEnum2["SIGNAL"] = "signal";
115
+ })(InstanceMessageTypeEnum || (exports2.InstanceMessageTypeEnum = InstanceMessageTypeEnum = {}));
116
+ var EInstanceMessageType2;
117
+ (function(EInstanceMessageType3) {
118
+ EInstanceMessageType3["DATA"] = "data";
119
+ EInstanceMessageType3["SIGNAL"] = "signal";
120
+ })(EInstanceMessageType2 || (exports2.EInstanceMessageType = EInstanceMessageType2 = {}));
121
+ var InstanceMessageActionEnum;
122
+ (function(InstanceMessageActionEnum2) {
123
+ InstanceMessageActionEnum2["NONE"] = "none";
124
+ InstanceMessageActionEnum2["ROUTE"] = "route";
125
+ InstanceMessageActionEnum2["START"] = "start";
126
+ InstanceMessageActionEnum2["STOP"] = "stop";
127
+ InstanceMessageActionEnum2["PAUSE"] = "pause";
128
+ InstanceMessageActionEnum2["CONTINUE"] = "continue";
129
+ InstanceMessageActionEnum2["MODIFY"] = "modify";
130
+ InstanceMessageActionEnum2["PING"] = "ping";
131
+ InstanceMessageActionEnum2["RECONNECT"] = "reconnect";
132
+ InstanceMessageActionEnum2["COMMAND"] = "command";
133
+ InstanceMessageActionEnum2["WEBSOCKET"] = "websocket";
134
+ })(InstanceMessageActionEnum || (exports2.InstanceMessageActionEnum = InstanceMessageActionEnum = {}));
135
+ var EInstanceMessageAction2;
136
+ (function(EInstanceMessageAction3) {
137
+ EInstanceMessageAction3["NONE"] = "none";
138
+ EInstanceMessageAction3["RI"] = "ri";
139
+ EInstanceMessageAction3["ROUTE"] = "route";
140
+ EInstanceMessageAction3["START"] = "start";
141
+ EInstanceMessageAction3["STOP"] = "stop";
142
+ EInstanceMessageAction3["PAUSE"] = "pause";
143
+ EInstanceMessageAction3["CONTINUE"] = "continue";
144
+ EInstanceMessageAction3["MODIFY"] = "modify";
145
+ EInstanceMessageAction3["PING"] = "ping";
146
+ EInstanceMessageAction3["RECONNECT"] = "reconnect";
147
+ EInstanceMessageAction3["COMMAND"] = "command";
148
+ EInstanceMessageAction3["WEBSOCKET"] = "websocket";
149
+ })(EInstanceMessageAction2 || (exports2.EInstanceMessageAction = EInstanceMessageAction2 = {}));
150
+ var InstanceMessageFlowEnum;
151
+ (function(InstanceMessageFlowEnum2) {
152
+ InstanceMessageFlowEnum2["IMMEDIATE"] = "immediate";
153
+ InstanceMessageFlowEnum2["REQUEST"] = "request";
154
+ InstanceMessageFlowEnum2["RESPONSE"] = "response";
155
+ InstanceMessageFlowEnum2["UNSOLICITED"] = "unsolicited";
156
+ })(InstanceMessageFlowEnum || (exports2.InstanceMessageFlowEnum = InstanceMessageFlowEnum = {}));
157
+ var EInstanceMessageFlow2;
158
+ (function(EInstanceMessageFlow3) {
159
+ EInstanceMessageFlow3["IMMEDIATE"] = "immediate";
160
+ EInstanceMessageFlow3["REQUEST"] = "request";
161
+ EInstanceMessageFlow3["RESPONSE"] = "response";
162
+ EInstanceMessageFlow3["UNSOLICITED"] = "unsolicited";
163
+ })(EInstanceMessageFlow2 || (exports2.EInstanceMessageFlow = EInstanceMessageFlow2 = {}));
164
+ }
165
+ });
166
+
167
+ // node_modules/@kwirthmagnify/kwirth-common/dist/InstanceConfig.js
168
+ var require_InstanceConfig = __commonJS({
169
+ "node_modules/@kwirthmagnify/kwirth-common/dist/InstanceConfig.js"(exports2) {
170
+ "use strict";
171
+ Object.defineProperty(exports2, "__esModule", { value: true });
172
+ exports2.EInstanceConfigScope = exports2.EInstanceConfigView = exports2.EInstanceConfigObject = exports2.InstanceConfigScopeEnum = exports2.InstanceConfigViewEnum = exports2.InstanceConfigObjectEnum = void 0;
173
+ var InstanceConfigObjectEnum;
174
+ (function(InstanceConfigObjectEnum2) {
175
+ InstanceConfigObjectEnum2["PODS"] = "pods";
176
+ InstanceConfigObjectEnum2["EVENTS"] = "events";
177
+ })(InstanceConfigObjectEnum || (exports2.InstanceConfigObjectEnum = InstanceConfigObjectEnum = {}));
178
+ var InstanceConfigViewEnum;
179
+ (function(InstanceConfigViewEnum2) {
180
+ InstanceConfigViewEnum2["NONE"] = "none";
181
+ InstanceConfigViewEnum2["CLUSTER"] = "cluster";
182
+ InstanceConfigViewEnum2["NAMESPACE"] = "namespace";
183
+ InstanceConfigViewEnum2["GROUP"] = "group";
184
+ InstanceConfigViewEnum2["POD"] = "pod";
185
+ InstanceConfigViewEnum2["CONTAINER"] = "container";
186
+ })(InstanceConfigViewEnum || (exports2.InstanceConfigViewEnum = InstanceConfigViewEnum = {}));
187
+ var InstanceConfigScopeEnum;
188
+ (function(InstanceConfigScopeEnum2) {
189
+ InstanceConfigScopeEnum2["NONE"] = "none";
190
+ InstanceConfigScopeEnum2["API"] = "api";
191
+ InstanceConfigScopeEnum2["CLUSTER"] = "cluster";
192
+ InstanceConfigScopeEnum2["FILTER"] = "filter";
193
+ InstanceConfigScopeEnum2["VIEW"] = "view";
194
+ InstanceConfigScopeEnum2["SNAPSHOT"] = "snapshot";
195
+ InstanceConfigScopeEnum2["STREAM"] = "stream";
196
+ InstanceConfigScopeEnum2["CREATE"] = "create";
197
+ InstanceConfigScopeEnum2["SUBSCRIBE"] = "subscribe";
198
+ InstanceConfigScopeEnum2["GET"] = "get";
199
+ InstanceConfigScopeEnum2["EXECUTE"] = "execute";
200
+ InstanceConfigScopeEnum2["RESTART"] = "restart";
201
+ InstanceConfigScopeEnum2["WORKLOAD"] = "workload";
202
+ InstanceConfigScopeEnum2["KUBERNETES"] = "kubernetes";
203
+ })(InstanceConfigScopeEnum || (exports2.InstanceConfigScopeEnum = InstanceConfigScopeEnum = {}));
204
+ var EInstanceConfigObject;
205
+ (function(EInstanceConfigObject2) {
206
+ EInstanceConfigObject2["PODS"] = "pods";
207
+ EInstanceConfigObject2["EVENTS"] = "events";
208
+ })(EInstanceConfigObject || (exports2.EInstanceConfigObject = EInstanceConfigObject = {}));
209
+ var EInstanceConfigView;
210
+ (function(EInstanceConfigView2) {
211
+ EInstanceConfigView2["NONE"] = "none";
212
+ EInstanceConfigView2["CLUSTER"] = "cluster";
213
+ EInstanceConfigView2["NAMESPACE"] = "namespace";
214
+ EInstanceConfigView2["GROUP"] = "group";
215
+ EInstanceConfigView2["POD"] = "pod";
216
+ EInstanceConfigView2["CONTAINER"] = "container";
217
+ })(EInstanceConfigView || (exports2.EInstanceConfigView = EInstanceConfigView = {}));
218
+ var EInstanceConfigScope;
219
+ (function(EInstanceConfigScope2) {
220
+ EInstanceConfigScope2["NONE"] = "none";
221
+ EInstanceConfigScope2["API"] = "api";
222
+ EInstanceConfigScope2["CLUSTER"] = "cluster";
223
+ EInstanceConfigScope2["FILTER"] = "filter";
224
+ EInstanceConfigScope2["VIEW"] = "view";
225
+ EInstanceConfigScope2["SNAPSHOT"] = "snapshot";
226
+ EInstanceConfigScope2["STREAM"] = "stream";
227
+ EInstanceConfigScope2["CREATE"] = "create";
228
+ EInstanceConfigScope2["SUBSCRIBE"] = "subscribe";
229
+ EInstanceConfigScope2["GET"] = "get";
230
+ EInstanceConfigScope2["EXECUTE"] = "execute";
231
+ EInstanceConfigScope2["RESTART"] = "restart";
232
+ EInstanceConfigScope2["WORKLOAD"] = "workload";
233
+ EInstanceConfigScope2["KUBERNETES"] = "kubernetes";
234
+ })(EInstanceConfigScope || (exports2.EInstanceConfigScope = EInstanceConfigScope = {}));
235
+ }
236
+ });
237
+
238
+ // node_modules/@kwirthmagnify/kwirth-common/dist/RouteMessage.js
239
+ var require_RouteMessage = __commonJS({
240
+ "node_modules/@kwirthmagnify/kwirth-common/dist/RouteMessage.js"(exports2) {
241
+ "use strict";
242
+ Object.defineProperty(exports2, "__esModule", { value: true });
243
+ }
244
+ });
245
+
246
+ // node_modules/@kwirthmagnify/kwirth-common/dist/SignalMessage.js
247
+ var require_SignalMessage = __commonJS({
248
+ "node_modules/@kwirthmagnify/kwirth-common/dist/SignalMessage.js"(exports2) {
249
+ "use strict";
250
+ Object.defineProperty(exports2, "__esModule", { value: true });
251
+ exports2.ESignalMessageEvent = exports2.ESignalMessageLevel = exports2.SignalMessageEventEnum = exports2.SignalMessageLevelEnum = void 0;
252
+ var SignalMessageLevelEnum;
253
+ (function(SignalMessageLevelEnum2) {
254
+ SignalMessageLevelEnum2["INFO"] = "info";
255
+ SignalMessageLevelEnum2["WARNING"] = "warning";
256
+ SignalMessageLevelEnum2["ERROR"] = "error";
257
+ })(SignalMessageLevelEnum || (exports2.SignalMessageLevelEnum = SignalMessageLevelEnum = {}));
258
+ var SignalMessageEventEnum;
259
+ (function(SignalMessageEventEnum2) {
260
+ SignalMessageEventEnum2["ADD"] = "add";
261
+ SignalMessageEventEnum2["DELETE"] = "delete";
262
+ SignalMessageEventEnum2["OTHER"] = "other";
263
+ })(SignalMessageEventEnum || (exports2.SignalMessageEventEnum = SignalMessageEventEnum = {}));
264
+ var ESignalMessageLevel2;
265
+ (function(ESignalMessageLevel3) {
266
+ ESignalMessageLevel3["INFO"] = "info";
267
+ ESignalMessageLevel3["WARNING"] = "warning";
268
+ ESignalMessageLevel3["ERROR"] = "error";
269
+ })(ESignalMessageLevel2 || (exports2.ESignalMessageLevel = ESignalMessageLevel2 = {}));
270
+ var ESignalMessageEvent;
271
+ (function(ESignalMessageEvent2) {
272
+ ESignalMessageEvent2["ADD"] = "add";
273
+ ESignalMessageEvent2["DELETE"] = "delete";
274
+ ESignalMessageEvent2["OTHER"] = "other";
275
+ })(ESignalMessageEvent || (exports2.ESignalMessageEvent = ESignalMessageEvent = {}));
276
+ }
277
+ });
278
+
279
+ // node_modules/@kwirthmagnify/kwirth-common/dist/ApiKey.js
280
+ var require_ApiKey = __commonJS({
281
+ "node_modules/@kwirthmagnify/kwirth-common/dist/ApiKey.js"(exports2) {
282
+ "use strict";
283
+ Object.defineProperty(exports2, "__esModule", { value: true });
284
+ }
285
+ });
286
+
287
+ // node_modules/uuid/dist/cjs/max.js
288
+ var require_max = __commonJS({
289
+ "node_modules/uuid/dist/cjs/max.js"(exports2) {
290
+ "use strict";
291
+ Object.defineProperty(exports2, "__esModule", { value: true });
292
+ exports2.default = "ffffffff-ffff-ffff-ffff-ffffffffffff";
293
+ }
294
+ });
295
+
296
+ // node_modules/uuid/dist/cjs/nil.js
297
+ var require_nil = __commonJS({
298
+ "node_modules/uuid/dist/cjs/nil.js"(exports2) {
299
+ "use strict";
300
+ Object.defineProperty(exports2, "__esModule", { value: true });
301
+ exports2.default = "00000000-0000-0000-0000-000000000000";
302
+ }
303
+ });
304
+
305
+ // node_modules/uuid/dist/cjs/regex.js
306
+ var require_regex = __commonJS({
307
+ "node_modules/uuid/dist/cjs/regex.js"(exports2) {
308
+ "use strict";
309
+ Object.defineProperty(exports2, "__esModule", { value: true });
310
+ exports2.default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
311
+ }
312
+ });
313
+
314
+ // node_modules/uuid/dist/cjs/validate.js
315
+ var require_validate = __commonJS({
316
+ "node_modules/uuid/dist/cjs/validate.js"(exports2) {
317
+ "use strict";
318
+ Object.defineProperty(exports2, "__esModule", { value: true });
319
+ var regex_js_1 = require_regex();
320
+ function validate(uuid) {
321
+ return typeof uuid === "string" && regex_js_1.default.test(uuid);
322
+ }
323
+ exports2.default = validate;
324
+ }
325
+ });
326
+
327
+ // node_modules/uuid/dist/cjs/parse.js
328
+ var require_parse = __commonJS({
329
+ "node_modules/uuid/dist/cjs/parse.js"(exports2) {
330
+ "use strict";
331
+ Object.defineProperty(exports2, "__esModule", { value: true });
332
+ var validate_js_1 = require_validate();
333
+ function parse(uuid) {
334
+ if (!(0, validate_js_1.default)(uuid)) {
335
+ throw TypeError("Invalid UUID");
336
+ }
337
+ let v;
338
+ return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
339
+ }
340
+ exports2.default = parse;
341
+ }
342
+ });
343
+
344
+ // node_modules/uuid/dist/cjs/stringify.js
345
+ var require_stringify = __commonJS({
346
+ "node_modules/uuid/dist/cjs/stringify.js"(exports2) {
347
+ "use strict";
348
+ Object.defineProperty(exports2, "__esModule", { value: true });
349
+ exports2.unsafeStringify = void 0;
350
+ var validate_js_1 = require_validate();
351
+ var byteToHex = [];
352
+ for (let i = 0; i < 256; ++i) {
353
+ byteToHex.push((i + 256).toString(16).slice(1));
354
+ }
355
+ function unsafeStringify(arr, offset = 0) {
356
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
357
+ }
358
+ exports2.unsafeStringify = unsafeStringify;
359
+ function stringify(arr, offset = 0) {
360
+ const uuid = unsafeStringify(arr, offset);
361
+ if (!(0, validate_js_1.default)(uuid)) {
362
+ throw TypeError("Stringified UUID is invalid");
363
+ }
364
+ return uuid;
365
+ }
366
+ exports2.default = stringify;
367
+ }
368
+ });
369
+
370
+ // node_modules/uuid/dist/cjs/rng.js
371
+ var require_rng = __commonJS({
372
+ "node_modules/uuid/dist/cjs/rng.js"(exports2) {
373
+ "use strict";
374
+ Object.defineProperty(exports2, "__esModule", { value: true });
375
+ var crypto_1 = require("crypto");
376
+ var rnds8Pool = new Uint8Array(256);
377
+ var poolPtr = rnds8Pool.length;
378
+ function rng() {
379
+ if (poolPtr > rnds8Pool.length - 16) {
380
+ (0, crypto_1.randomFillSync)(rnds8Pool);
381
+ poolPtr = 0;
382
+ }
383
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
384
+ }
385
+ exports2.default = rng;
386
+ }
387
+ });
388
+
389
+ // node_modules/uuid/dist/cjs/v1.js
390
+ var require_v1 = __commonJS({
391
+ "node_modules/uuid/dist/cjs/v1.js"(exports2) {
392
+ "use strict";
393
+ Object.defineProperty(exports2, "__esModule", { value: true });
394
+ exports2.updateV1State = void 0;
395
+ var rng_js_1 = require_rng();
396
+ var stringify_js_1 = require_stringify();
397
+ var _state = {};
398
+ function v1(options, buf, offset) {
399
+ let bytes;
400
+ const isV6 = options?._v6 ?? false;
401
+ if (options) {
402
+ const optionsKeys = Object.keys(options);
403
+ if (optionsKeys.length === 1 && optionsKeys[0] === "_v6") {
404
+ options = void 0;
405
+ }
406
+ }
407
+ if (options) {
408
+ bytes = v1Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1.default)(), options.msecs, options.nsecs, options.clockseq, options.node, buf, offset);
409
+ } else {
410
+ const now = Date.now();
411
+ const rnds = (0, rng_js_1.default)();
412
+ updateV1State(_state, now, rnds);
413
+ bytes = v1Bytes(rnds, _state.msecs, _state.nsecs, isV6 ? void 0 : _state.clockseq, isV6 ? void 0 : _state.node, buf, offset);
414
+ }
415
+ return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
416
+ }
417
+ function updateV1State(state, now, rnds) {
418
+ state.msecs ??= -Infinity;
419
+ state.nsecs ??= 0;
420
+ if (now === state.msecs) {
421
+ state.nsecs++;
422
+ if (state.nsecs >= 1e4) {
423
+ state.node = void 0;
424
+ state.nsecs = 0;
425
+ }
426
+ } else if (now > state.msecs) {
427
+ state.nsecs = 0;
428
+ } else if (now < state.msecs) {
429
+ state.node = void 0;
430
+ }
431
+ if (!state.node) {
432
+ state.node = rnds.slice(10, 16);
433
+ state.node[0] |= 1;
434
+ state.clockseq = (rnds[8] << 8 | rnds[9]) & 16383;
435
+ }
436
+ state.msecs = now;
437
+ return state;
438
+ }
439
+ exports2.updateV1State = updateV1State;
440
+ function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
441
+ if (rnds.length < 16) {
442
+ throw new Error("Random bytes length must be >= 16");
443
+ }
444
+ if (!buf) {
445
+ buf = new Uint8Array(16);
446
+ offset = 0;
447
+ } else {
448
+ if (offset < 0 || offset + 16 > buf.length) {
449
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
450
+ }
451
+ }
452
+ msecs ??= Date.now();
453
+ nsecs ??= 0;
454
+ clockseq ??= (rnds[8] << 8 | rnds[9]) & 16383;
455
+ node ??= rnds.slice(10, 16);
456
+ msecs += 122192928e5;
457
+ const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
458
+ buf[offset++] = tl >>> 24 & 255;
459
+ buf[offset++] = tl >>> 16 & 255;
460
+ buf[offset++] = tl >>> 8 & 255;
461
+ buf[offset++] = tl & 255;
462
+ const tmh = msecs / 4294967296 * 1e4 & 268435455;
463
+ buf[offset++] = tmh >>> 8 & 255;
464
+ buf[offset++] = tmh & 255;
465
+ buf[offset++] = tmh >>> 24 & 15 | 16;
466
+ buf[offset++] = tmh >>> 16 & 255;
467
+ buf[offset++] = clockseq >>> 8 | 128;
468
+ buf[offset++] = clockseq & 255;
469
+ for (let n = 0; n < 6; ++n) {
470
+ buf[offset++] = node[n];
471
+ }
472
+ return buf;
473
+ }
474
+ exports2.default = v1;
475
+ }
476
+ });
477
+
478
+ // node_modules/uuid/dist/cjs/v1ToV6.js
479
+ var require_v1ToV6 = __commonJS({
480
+ "node_modules/uuid/dist/cjs/v1ToV6.js"(exports2) {
481
+ "use strict";
482
+ Object.defineProperty(exports2, "__esModule", { value: true });
483
+ var parse_js_1 = require_parse();
484
+ var stringify_js_1 = require_stringify();
485
+ function v1ToV6(uuid) {
486
+ const v1Bytes = typeof uuid === "string" ? (0, parse_js_1.default)(uuid) : uuid;
487
+ const v6Bytes = _v1ToV6(v1Bytes);
488
+ return typeof uuid === "string" ? (0, stringify_js_1.unsafeStringify)(v6Bytes) : v6Bytes;
489
+ }
490
+ exports2.default = v1ToV6;
491
+ function _v1ToV6(v1Bytes) {
492
+ return Uint8Array.of((v1Bytes[6] & 15) << 4 | v1Bytes[7] >> 4 & 15, (v1Bytes[7] & 15) << 4 | (v1Bytes[4] & 240) >> 4, (v1Bytes[4] & 15) << 4 | (v1Bytes[5] & 240) >> 4, (v1Bytes[5] & 15) << 4 | (v1Bytes[0] & 240) >> 4, (v1Bytes[0] & 15) << 4 | (v1Bytes[1] & 240) >> 4, (v1Bytes[1] & 15) << 4 | (v1Bytes[2] & 240) >> 4, 96 | v1Bytes[2] & 15, v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
493
+ }
494
+ }
495
+ });
496
+
497
+ // node_modules/uuid/dist/cjs/md5.js
498
+ var require_md5 = __commonJS({
499
+ "node_modules/uuid/dist/cjs/md5.js"(exports2) {
500
+ "use strict";
501
+ Object.defineProperty(exports2, "__esModule", { value: true });
502
+ var crypto_1 = require("crypto");
503
+ function md5(bytes) {
504
+ if (Array.isArray(bytes)) {
505
+ bytes = Buffer.from(bytes);
506
+ } else if (typeof bytes === "string") {
507
+ bytes = Buffer.from(bytes, "utf8");
508
+ }
509
+ return (0, crypto_1.createHash)("md5").update(bytes).digest();
510
+ }
511
+ exports2.default = md5;
512
+ }
513
+ });
514
+
515
+ // node_modules/uuid/dist/cjs/v35.js
516
+ var require_v35 = __commonJS({
517
+ "node_modules/uuid/dist/cjs/v35.js"(exports2) {
518
+ "use strict";
519
+ Object.defineProperty(exports2, "__esModule", { value: true });
520
+ exports2.URL = exports2.DNS = exports2.stringToBytes = void 0;
521
+ var parse_js_1 = require_parse();
522
+ var stringify_js_1 = require_stringify();
523
+ function stringToBytes(str) {
524
+ str = unescape(encodeURIComponent(str));
525
+ const bytes = new Uint8Array(str.length);
526
+ for (let i = 0; i < str.length; ++i) {
527
+ bytes[i] = str.charCodeAt(i);
528
+ }
529
+ return bytes;
530
+ }
531
+ exports2.stringToBytes = stringToBytes;
532
+ exports2.DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
533
+ exports2.URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
534
+ function v35(version, hash, value, namespace, buf, offset) {
535
+ const valueBytes = typeof value === "string" ? stringToBytes(value) : value;
536
+ const namespaceBytes = typeof namespace === "string" ? (0, parse_js_1.default)(namespace) : namespace;
537
+ if (typeof namespace === "string") {
538
+ namespace = (0, parse_js_1.default)(namespace);
539
+ }
540
+ if (namespace?.length !== 16) {
541
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
542
+ }
543
+ let bytes = new Uint8Array(16 + valueBytes.length);
544
+ bytes.set(namespaceBytes);
545
+ bytes.set(valueBytes, namespaceBytes.length);
546
+ bytes = hash(bytes);
547
+ bytes[6] = bytes[6] & 15 | version;
548
+ bytes[8] = bytes[8] & 63 | 128;
549
+ if (buf) {
550
+ offset = offset || 0;
551
+ if (offset < 0 || offset + 16 > buf.length) {
552
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
553
+ }
554
+ for (let i = 0; i < 16; ++i) {
555
+ buf[offset + i] = bytes[i];
556
+ }
557
+ return buf;
558
+ }
559
+ return (0, stringify_js_1.unsafeStringify)(bytes);
560
+ }
561
+ exports2.default = v35;
562
+ }
563
+ });
564
+
565
+ // node_modules/uuid/dist/cjs/v3.js
566
+ var require_v3 = __commonJS({
567
+ "node_modules/uuid/dist/cjs/v3.js"(exports2) {
568
+ "use strict";
569
+ Object.defineProperty(exports2, "__esModule", { value: true });
570
+ exports2.URL = exports2.DNS = void 0;
571
+ var md5_js_1 = require_md5();
572
+ var v35_js_1 = require_v35();
573
+ var v35_js_2 = require_v35();
574
+ Object.defineProperty(exports2, "DNS", { enumerable: true, get: function() {
575
+ return v35_js_2.DNS;
576
+ } });
577
+ Object.defineProperty(exports2, "URL", { enumerable: true, get: function() {
578
+ return v35_js_2.URL;
579
+ } });
580
+ function v3(value, namespace, buf, offset) {
581
+ return (0, v35_js_1.default)(48, md5_js_1.default, value, namespace, buf, offset);
582
+ }
583
+ v3.DNS = v35_js_1.DNS;
584
+ v3.URL = v35_js_1.URL;
585
+ exports2.default = v3;
586
+ }
587
+ });
588
+
589
+ // node_modules/uuid/dist/cjs/native.js
590
+ var require_native = __commonJS({
591
+ "node_modules/uuid/dist/cjs/native.js"(exports2) {
592
+ "use strict";
593
+ Object.defineProperty(exports2, "__esModule", { value: true });
594
+ var crypto_1 = require("crypto");
595
+ exports2.default = { randomUUID: crypto_1.randomUUID };
596
+ }
597
+ });
598
+
599
+ // node_modules/uuid/dist/cjs/v4.js
600
+ var require_v4 = __commonJS({
601
+ "node_modules/uuid/dist/cjs/v4.js"(exports2) {
602
+ "use strict";
603
+ Object.defineProperty(exports2, "__esModule", { value: true });
604
+ var native_js_1 = require_native();
605
+ var rng_js_1 = require_rng();
606
+ var stringify_js_1 = require_stringify();
607
+ function v4(options, buf, offset) {
608
+ if (native_js_1.default.randomUUID && !buf && !options) {
609
+ return native_js_1.default.randomUUID();
610
+ }
611
+ options = options || {};
612
+ const rnds = options.random ?? options.rng?.() ?? (0, rng_js_1.default)();
613
+ if (rnds.length < 16) {
614
+ throw new Error("Random bytes length must be >= 16");
615
+ }
616
+ rnds[6] = rnds[6] & 15 | 64;
617
+ rnds[8] = rnds[8] & 63 | 128;
618
+ if (buf) {
619
+ offset = offset || 0;
620
+ if (offset < 0 || offset + 16 > buf.length) {
621
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
622
+ }
623
+ for (let i = 0; i < 16; ++i) {
624
+ buf[offset + i] = rnds[i];
625
+ }
626
+ return buf;
627
+ }
628
+ return (0, stringify_js_1.unsafeStringify)(rnds);
629
+ }
630
+ exports2.default = v4;
631
+ }
632
+ });
633
+
634
+ // node_modules/uuid/dist/cjs/sha1.js
635
+ var require_sha1 = __commonJS({
636
+ "node_modules/uuid/dist/cjs/sha1.js"(exports2) {
637
+ "use strict";
638
+ Object.defineProperty(exports2, "__esModule", { value: true });
639
+ var crypto_1 = require("crypto");
640
+ function sha1(bytes) {
641
+ if (Array.isArray(bytes)) {
642
+ bytes = Buffer.from(bytes);
643
+ } else if (typeof bytes === "string") {
644
+ bytes = Buffer.from(bytes, "utf8");
645
+ }
646
+ return (0, crypto_1.createHash)("sha1").update(bytes).digest();
647
+ }
648
+ exports2.default = sha1;
649
+ }
650
+ });
651
+
652
+ // node_modules/uuid/dist/cjs/v5.js
653
+ var require_v5 = __commonJS({
654
+ "node_modules/uuid/dist/cjs/v5.js"(exports2) {
655
+ "use strict";
656
+ Object.defineProperty(exports2, "__esModule", { value: true });
657
+ exports2.URL = exports2.DNS = void 0;
658
+ var sha1_js_1 = require_sha1();
659
+ var v35_js_1 = require_v35();
660
+ var v35_js_2 = require_v35();
661
+ Object.defineProperty(exports2, "DNS", { enumerable: true, get: function() {
662
+ return v35_js_2.DNS;
663
+ } });
664
+ Object.defineProperty(exports2, "URL", { enumerable: true, get: function() {
665
+ return v35_js_2.URL;
666
+ } });
667
+ function v5(value, namespace, buf, offset) {
668
+ return (0, v35_js_1.default)(80, sha1_js_1.default, value, namespace, buf, offset);
669
+ }
670
+ v5.DNS = v35_js_1.DNS;
671
+ v5.URL = v35_js_1.URL;
672
+ exports2.default = v5;
673
+ }
674
+ });
675
+
676
+ // node_modules/uuid/dist/cjs/v6.js
677
+ var require_v6 = __commonJS({
678
+ "node_modules/uuid/dist/cjs/v6.js"(exports2) {
679
+ "use strict";
680
+ Object.defineProperty(exports2, "__esModule", { value: true });
681
+ var stringify_js_1 = require_stringify();
682
+ var v1_js_1 = require_v1();
683
+ var v1ToV6_js_1 = require_v1ToV6();
684
+ function v6(options, buf, offset) {
685
+ options ??= {};
686
+ offset ??= 0;
687
+ let bytes = (0, v1_js_1.default)({ ...options, _v6: true }, new Uint8Array(16));
688
+ bytes = (0, v1ToV6_js_1.default)(bytes);
689
+ if (buf) {
690
+ if (offset < 0 || offset + 16 > buf.length) {
691
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
692
+ }
693
+ for (let i = 0; i < 16; i++) {
694
+ buf[offset + i] = bytes[i];
695
+ }
696
+ return buf;
697
+ }
698
+ return (0, stringify_js_1.unsafeStringify)(bytes);
699
+ }
700
+ exports2.default = v6;
701
+ }
702
+ });
703
+
704
+ // node_modules/uuid/dist/cjs/v6ToV1.js
705
+ var require_v6ToV1 = __commonJS({
706
+ "node_modules/uuid/dist/cjs/v6ToV1.js"(exports2) {
707
+ "use strict";
708
+ Object.defineProperty(exports2, "__esModule", { value: true });
709
+ var parse_js_1 = require_parse();
710
+ var stringify_js_1 = require_stringify();
711
+ function v6ToV1(uuid) {
712
+ const v6Bytes = typeof uuid === "string" ? (0, parse_js_1.default)(uuid) : uuid;
713
+ const v1Bytes = _v6ToV1(v6Bytes);
714
+ return typeof uuid === "string" ? (0, stringify_js_1.unsafeStringify)(v1Bytes) : v1Bytes;
715
+ }
716
+ exports2.default = v6ToV1;
717
+ function _v6ToV1(v6Bytes) {
718
+ return Uint8Array.of((v6Bytes[3] & 15) << 4 | v6Bytes[4] >> 4 & 15, (v6Bytes[4] & 15) << 4 | (v6Bytes[5] & 240) >> 4, (v6Bytes[5] & 15) << 4 | v6Bytes[6] & 15, v6Bytes[7], (v6Bytes[1] & 15) << 4 | (v6Bytes[2] & 240) >> 4, (v6Bytes[2] & 15) << 4 | (v6Bytes[3] & 240) >> 4, 16 | (v6Bytes[0] & 240) >> 4, (v6Bytes[0] & 15) << 4 | (v6Bytes[1] & 240) >> 4, v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
719
+ }
720
+ }
721
+ });
722
+
723
+ // node_modules/uuid/dist/cjs/v7.js
724
+ var require_v7 = __commonJS({
725
+ "node_modules/uuid/dist/cjs/v7.js"(exports2) {
726
+ "use strict";
727
+ Object.defineProperty(exports2, "__esModule", { value: true });
728
+ exports2.updateV7State = void 0;
729
+ var rng_js_1 = require_rng();
730
+ var stringify_js_1 = require_stringify();
731
+ var _state = {};
732
+ function v7(options, buf, offset) {
733
+ let bytes;
734
+ if (options) {
735
+ bytes = v7Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1.default)(), options.msecs, options.seq, buf, offset);
736
+ } else {
737
+ const now = Date.now();
738
+ const rnds = (0, rng_js_1.default)();
739
+ updateV7State(_state, now, rnds);
740
+ bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
741
+ }
742
+ return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
743
+ }
744
+ function updateV7State(state, now, rnds) {
745
+ state.msecs ??= -Infinity;
746
+ state.seq ??= 0;
747
+ if (now > state.msecs) {
748
+ state.seq = rnds[6] << 23 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
749
+ state.msecs = now;
750
+ } else {
751
+ state.seq = state.seq + 1 | 0;
752
+ if (state.seq === 0) {
753
+ state.msecs++;
754
+ }
755
+ }
756
+ return state;
757
+ }
758
+ exports2.updateV7State = updateV7State;
759
+ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
760
+ if (rnds.length < 16) {
761
+ throw new Error("Random bytes length must be >= 16");
762
+ }
763
+ if (!buf) {
764
+ buf = new Uint8Array(16);
765
+ offset = 0;
766
+ } else {
767
+ if (offset < 0 || offset + 16 > buf.length) {
768
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
769
+ }
770
+ }
771
+ msecs ??= Date.now();
772
+ seq ??= rnds[6] * 127 << 24 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
773
+ buf[offset++] = msecs / 1099511627776 & 255;
774
+ buf[offset++] = msecs / 4294967296 & 255;
775
+ buf[offset++] = msecs / 16777216 & 255;
776
+ buf[offset++] = msecs / 65536 & 255;
777
+ buf[offset++] = msecs / 256 & 255;
778
+ buf[offset++] = msecs & 255;
779
+ buf[offset++] = 112 | seq >>> 28 & 15;
780
+ buf[offset++] = seq >>> 20 & 255;
781
+ buf[offset++] = 128 | seq >>> 14 & 63;
782
+ buf[offset++] = seq >>> 6 & 255;
783
+ buf[offset++] = seq << 2 & 255 | rnds[10] & 3;
784
+ buf[offset++] = rnds[11];
785
+ buf[offset++] = rnds[12];
786
+ buf[offset++] = rnds[13];
787
+ buf[offset++] = rnds[14];
788
+ buf[offset++] = rnds[15];
789
+ return buf;
790
+ }
791
+ exports2.default = v7;
792
+ }
793
+ });
794
+
795
+ // node_modules/uuid/dist/cjs/version.js
796
+ var require_version = __commonJS({
797
+ "node_modules/uuid/dist/cjs/version.js"(exports2) {
798
+ "use strict";
799
+ Object.defineProperty(exports2, "__esModule", { value: true });
800
+ var validate_js_1 = require_validate();
801
+ function version(uuid) {
802
+ if (!(0, validate_js_1.default)(uuid)) {
803
+ throw TypeError("Invalid UUID");
804
+ }
805
+ return parseInt(uuid.slice(14, 15), 16);
806
+ }
807
+ exports2.default = version;
808
+ }
809
+ });
810
+
811
+ // node_modules/uuid/dist/cjs/index.js
812
+ var require_cjs = __commonJS({
813
+ "node_modules/uuid/dist/cjs/index.js"(exports2) {
814
+ "use strict";
815
+ Object.defineProperty(exports2, "__esModule", { value: true });
816
+ exports2.version = exports2.validate = exports2.v7 = exports2.v6ToV1 = exports2.v6 = exports2.v5 = exports2.v4 = exports2.v3 = exports2.v1ToV6 = exports2.v1 = exports2.stringify = exports2.parse = exports2.NIL = exports2.MAX = void 0;
817
+ var max_js_1 = require_max();
818
+ Object.defineProperty(exports2, "MAX", { enumerable: true, get: function() {
819
+ return max_js_1.default;
820
+ } });
821
+ var nil_js_1 = require_nil();
822
+ Object.defineProperty(exports2, "NIL", { enumerable: true, get: function() {
823
+ return nil_js_1.default;
824
+ } });
825
+ var parse_js_1 = require_parse();
826
+ Object.defineProperty(exports2, "parse", { enumerable: true, get: function() {
827
+ return parse_js_1.default;
828
+ } });
829
+ var stringify_js_1 = require_stringify();
830
+ Object.defineProperty(exports2, "stringify", { enumerable: true, get: function() {
831
+ return stringify_js_1.default;
832
+ } });
833
+ var v1_js_1 = require_v1();
834
+ Object.defineProperty(exports2, "v1", { enumerable: true, get: function() {
835
+ return v1_js_1.default;
836
+ } });
837
+ var v1ToV6_js_1 = require_v1ToV6();
838
+ Object.defineProperty(exports2, "v1ToV6", { enumerable: true, get: function() {
839
+ return v1ToV6_js_1.default;
840
+ } });
841
+ var v3_js_1 = require_v3();
842
+ Object.defineProperty(exports2, "v3", { enumerable: true, get: function() {
843
+ return v3_js_1.default;
844
+ } });
845
+ var v4_js_1 = require_v4();
846
+ Object.defineProperty(exports2, "v4", { enumerable: true, get: function() {
847
+ return v4_js_1.default;
848
+ } });
849
+ var v5_js_1 = require_v5();
850
+ Object.defineProperty(exports2, "v5", { enumerable: true, get: function() {
851
+ return v5_js_1.default;
852
+ } });
853
+ var v6_js_1 = require_v6();
854
+ Object.defineProperty(exports2, "v6", { enumerable: true, get: function() {
855
+ return v6_js_1.default;
856
+ } });
857
+ var v6ToV1_js_1 = require_v6ToV1();
858
+ Object.defineProperty(exports2, "v6ToV1", { enumerable: true, get: function() {
859
+ return v6ToV1_js_1.default;
860
+ } });
861
+ var v7_js_1 = require_v7();
862
+ Object.defineProperty(exports2, "v7", { enumerable: true, get: function() {
863
+ return v7_js_1.default;
864
+ } });
865
+ var validate_js_1 = require_validate();
866
+ Object.defineProperty(exports2, "validate", { enumerable: true, get: function() {
867
+ return validate_js_1.default;
868
+ } });
869
+ var version_js_1 = require_version();
870
+ Object.defineProperty(exports2, "version", { enumerable: true, get: function() {
871
+ return version_js_1.default;
872
+ } });
873
+ }
874
+ });
875
+
876
+ // node_modules/@kwirthmagnify/kwirth-common/dist/AccessKey.js
877
+ var require_AccessKey = __commonJS({
878
+ "node_modules/@kwirthmagnify/kwirth-common/dist/AccessKey.js"(exports2) {
879
+ "use strict";
880
+ Object.defineProperty(exports2, "__esModule", { value: true });
881
+ exports2.AccessKey = void 0;
882
+ exports2.accessKeyBuild = accessKeyBuild;
883
+ exports2.accessKeyCreate = accessKeyCreate;
884
+ exports2.accessKeyDeserialize = accessKeyDeserialize2;
885
+ exports2.accessKeySerialize = accessKeySerialize;
886
+ exports2.parseResource = parseResource;
887
+ exports2.parseResources = parseResources;
888
+ exports2.buildResource = buildResource;
889
+ var uuid_1 = require_cjs();
890
+ var AccessKey2 = class {
891
+ constructor() {
892
+ this.id = "";
893
+ this.type = "volatile";
894
+ this.resources = "";
895
+ }
896
+ };
897
+ exports2.AccessKey = AccessKey2;
898
+ function accessKeyCreate(type, resources) {
899
+ let accessKey = new AccessKey2();
900
+ accessKey.id = (0, uuid_1.v4)();
901
+ accessKey.type = type;
902
+ accessKey.resources = resources;
903
+ return accessKey;
904
+ }
905
+ function accessKeyBuild(id, type, resources) {
906
+ let accessKey = new AccessKey2();
907
+ accessKey.id = id;
908
+ accessKey.type = type;
909
+ accessKey.resources = resources;
910
+ return accessKey;
911
+ }
912
+ function accessKeySerialize(accessKey) {
913
+ return `${accessKey.id}|${accessKey.type}|${accessKey.resources}`;
914
+ }
915
+ function accessKeyDeserialize2(key) {
916
+ var parts = key.split("|");
917
+ return accessKeyBuild(parts[0], parts[1], parts[2]);
918
+ }
919
+ function parseResource(key) {
920
+ var parts = key.split(":");
921
+ return {
922
+ scopes: parts[0],
923
+ namespaces: parts[1],
924
+ groups: parts[2],
925
+ pods: parts[3],
926
+ containers: parts[4]
927
+ };
928
+ }
929
+ function parseResources(key) {
930
+ if (!key)
931
+ return [];
932
+ let ress = key.split(";");
933
+ let result = [];
934
+ for (var res of ress) {
935
+ result.push(parseResource(res));
936
+ }
937
+ return result;
938
+ }
939
+ function buildResource(scopes, namespaces, groups, pods, containers) {
940
+ return `${scopes.join(",")}:${namespaces.join(",")}:${groups.join(",")}:${pods.join(",")}:${containers.join(",")}`;
941
+ }
942
+ }
943
+ });
944
+
945
+ // node_modules/@kwirthmagnify/kwirth-common/dist/Global.js
946
+ var require_Global = __commonJS({
947
+ "node_modules/@kwirthmagnify/kwirth-common/dist/Global.js"(exports2) {
948
+ "use strict";
949
+ Object.defineProperty(exports2, "__esModule", { value: true });
950
+ }
951
+ });
952
+
953
+ // node_modules/@kwirthmagnify/kwirth-common/dist/Version.js
954
+ var require_Version = __commonJS({
955
+ "node_modules/@kwirthmagnify/kwirth-common/dist/Version.js"(exports2) {
956
+ "use strict";
957
+ Object.defineProperty(exports2, "__esModule", { value: true });
958
+ exports2.versionGreaterThan = exports2.versionGreatOrEqualThan = void 0;
959
+ var versionGreatOrEqualThan = (version1, version2) => {
960
+ return versionGreaterThan(version1, version2) || version1 === version2;
961
+ };
962
+ exports2.versionGreatOrEqualThan = versionGreatOrEqualThan;
963
+ var versionGreaterThan = (version1, version2) => {
964
+ const v1 = version1.split(".").map(Number);
965
+ const v2 = version2.split(".").map(Number);
966
+ for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
967
+ const num1 = v1[i] || 0;
968
+ const num2 = v2[i] || 0;
969
+ if (num1 > num2)
970
+ return true;
971
+ else if (num1 < num2)
972
+ return false;
973
+ }
974
+ return false;
975
+ };
976
+ exports2.versionGreaterThan = versionGreaterThan;
977
+ }
978
+ });
979
+
980
+ // node_modules/@kwirthmagnify/kwirth-common/dist/FrontChannel.js
981
+ var require_FrontChannel = __commonJS({
982
+ "node_modules/@kwirthmagnify/kwirth-common/dist/FrontChannel.js"(exports2) {
983
+ "use strict";
984
+ Object.defineProperty(exports2, "__esModule", { value: true });
985
+ exports2.EChannelRefreshAction = exports2.ENotifyLevel = void 0;
986
+ var ENotifyLevel;
987
+ (function(ENotifyLevel2) {
988
+ ENotifyLevel2["INFO"] = "info";
989
+ ENotifyLevel2["ERROR"] = "error";
990
+ ENotifyLevel2["WARNING"] = "warning";
991
+ ENotifyLevel2["SUCCESS"] = "success";
992
+ })(ENotifyLevel || (exports2.ENotifyLevel = ENotifyLevel = {}));
993
+ var EChannelRefreshAction;
994
+ (function(EChannelRefreshAction2) {
995
+ EChannelRefreshAction2[EChannelRefreshAction2["NONE"] = 0] = "NONE";
996
+ EChannelRefreshAction2[EChannelRefreshAction2["REFRESH"] = 1] = "REFRESH";
997
+ EChannelRefreshAction2[EChannelRefreshAction2["STOP"] = 2] = "STOP";
998
+ })(EChannelRefreshAction || (exports2.EChannelRefreshAction = EChannelRefreshAction = {}));
999
+ }
1000
+ });
1001
+
1002
+ // node_modules/@kwirthmagnify/kwirth-common/dist/index.js
1003
+ var require_dist = __commonJS({
1004
+ "node_modules/@kwirthmagnify/kwirth-common/dist/index.js"(exports2) {
1005
+ "use strict";
1006
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
1007
+ if (k2 === void 0) k2 = k;
1008
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1009
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1010
+ desc = { enumerable: true, get: function() {
1011
+ return m[k];
1012
+ } };
1013
+ }
1014
+ Object.defineProperty(o, k2, desc);
1015
+ }) : (function(o, m, k, k2) {
1016
+ if (k2 === void 0) k2 = k;
1017
+ o[k2] = m[k];
1018
+ }));
1019
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
1020
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
1021
+ };
1022
+ Object.defineProperty(exports2, "__esModule", { value: true });
1023
+ __exportStar(require_Channel(), exports2);
1024
+ __exportStar(require_Sender(), exports2);
1025
+ __exportStar(require_InstanceMessage(), exports2);
1026
+ __exportStar(require_InstanceConfig(), exports2);
1027
+ __exportStar(require_RouteMessage(), exports2);
1028
+ __exportStar(require_SignalMessage(), exports2);
1029
+ __exportStar(require_ApiKey(), exports2);
1030
+ __exportStar(require_AccessKey(), exports2);
1031
+ __exportStar(require_Global(), exports2);
1032
+ __exportStar(require_Version(), exports2);
1033
+ __exportStar(require_FrontChannel(), exports2);
1034
+ }
1035
+ });
1036
+
1037
+ // node_modules/@kwirthmagnify/kwirth-common-back/dist/index.js
1038
+ var require_dist2 = __commonJS({
1039
+ "node_modules/@kwirthmagnify/kwirth-common-back/dist/index.js"(exports2) {
1040
+ "use strict";
1041
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
1042
+ if (k2 === void 0) k2 = k;
1043
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1044
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1045
+ desc = { enumerable: true, get: function() {
1046
+ return m[k];
1047
+ } };
1048
+ }
1049
+ Object.defineProperty(o, k2, desc);
1050
+ }) : (function(o, m, k, k2) {
1051
+ if (k2 === void 0) k2 = k;
1052
+ o[k2] = m[k];
1053
+ }));
1054
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
1055
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
1056
+ };
1057
+ Object.defineProperty(exports2, "__esModule", { value: true });
1058
+ __exportStar(require_IChannel(), exports2);
1059
+ __exportStar(require_IProvider(), exports2);
1060
+ __exportStar(require_ISender(), exports2);
1061
+ __exportStar(require_dist(), exports2);
1062
+ }
1063
+ });
1064
+
1065
+ // src/back/index.ts
1066
+ var index_exports = {};
1067
+ __export(index_exports, {
1068
+ default: () => index_default
1069
+ });
1070
+ module.exports = __toCommonJS(index_exports);
1071
+ var import_kwirth_common_back = __toESM(require_dist2(), 1);
1072
+ var EchoChannel = class {
1073
+ constructor(clusterInfo, backChannelObject) {
1074
+ this.channelId = "echo";
1075
+ this.requirements = { storage: false, providers: ["otel"] };
1076
+ this.webSockets = [];
1077
+ this.getChannelData = () => ({
1078
+ id: "echo",
1079
+ routable: false,
1080
+ pauseable: true,
1081
+ modifiable: false,
1082
+ reconnectable: true,
1083
+ metrics: false,
1084
+ sources: [import_kwirth_common_back.EClusterType.KUBERNETES, import_kwirth_common_back.EClusterType.DOCKER],
1085
+ endpoints: [],
1086
+ websocket: false,
1087
+ cluster: false,
1088
+ resourced: true
1089
+ });
1090
+ this.getChannelScopeLevel = (scope) => ["", "none", "cluster"].indexOf(scope);
1091
+ this.startChannel = async () => {
1092
+ const otelProvider = this.clusterInfo.providers?.find((p) => p.id === "otel");
1093
+ if (otelProvider) {
1094
+ await otelProvider.addSubscriber(this, {
1095
+ spaces: [{ name: "echo", signals: ["traces", "metrics", "logs"] }]
1096
+ });
1097
+ }
1098
+ };
1099
+ this.containsAsset = (webSocket, podNamespace, podName, containerName) => {
1100
+ const socket = this.webSockets.find((s) => s.ws === webSocket);
1101
+ if (socket) return socket.instances.some((i) => i.assets.some((a) => a.podNamespace === podNamespace && a.podName === podName && a.containerName === containerName));
1102
+ return false;
1103
+ };
1104
+ this.containsInstance = (instanceId) => this.webSockets.some((socket) => socket.instances.some((i) => i.instanceId === instanceId));
1105
+ this.processCommand = async (webSocket, instanceMessage) => {
1106
+ if (instanceMessage.flow === import_kwirth_common_back.EInstanceMessageFlow.IMMEDIATE) return false;
1107
+ const instance = this.getInstance(webSocket, instanceMessage.instance);
1108
+ if (!instance) {
1109
+ this.sendSignalMessage(webSocket, instanceMessage.action, import_kwirth_common_back.EInstanceMessageFlow.RESPONSE, import_kwirth_common_back.ESignalMessageLevel.ERROR, instanceMessage.instance, "Instance not found");
1110
+ return false;
1111
+ }
1112
+ return true;
1113
+ };
1114
+ this.addObject = async (webSocket, instanceConfig, podNamespace, podName, containerName) => {
1115
+ let socket = this.webSockets.find((s) => s.ws === webSocket);
1116
+ if (!socket) {
1117
+ const len = this.webSockets.push({ ws: webSocket, lastRefresh: Date.now(), instances: [] });
1118
+ socket = this.webSockets[len - 1];
1119
+ }
1120
+ let instance = socket.instances.find((i) => i.instanceId === instanceConfig.instance);
1121
+ if (!instance) {
1122
+ instance = {
1123
+ accessKey: (0, import_kwirth_common_back.accessKeyDeserialize)(instanceConfig.accessKey),
1124
+ instanceId: instanceConfig.instance,
1125
+ configData: instanceConfig.data,
1126
+ paused: false,
1127
+ assets: []
1128
+ };
1129
+ socket.instances.push(instance);
1130
+ const sid = instanceConfig.data?.senderId;
1131
+ const scn = instanceConfig.data?.senderConfigName;
1132
+ if (sid && scn) this.backChannelObject.senders?.send(sid, scn, { body: "Echo started for instance " + instanceConfig.instance, subject: "Info" });
1133
+ let senders = this.backChannelObject.senders?.listSenders();
1134
+ if (senders) {
1135
+ for (let s of senders) {
1136
+ this.sendSignalMessage(webSocket, import_kwirth_common_back.EInstanceMessageAction.NONE, import_kwirth_common_back.EInstanceMessageFlow.RESPONSE, import_kwirth_common_back.ESignalMessageLevel.INFO, instanceConfig.instance, JSON.stringify(s));
1137
+ }
1138
+ }
1139
+ }
1140
+ const asset = { podNamespace, podName, containerName };
1141
+ asset.interval = setInterval(
1142
+ (ws, i, a) => this.sendData(ws, i, a),
1143
+ instance.configData.interval * 1e3,
1144
+ webSocket,
1145
+ instance,
1146
+ asset
1147
+ );
1148
+ instance.assets.push(asset);
1149
+ return true;
1150
+ };
1151
+ this.deleteObject = async (webSocket, instanceConfig, podNamespace, podName, containerName) => {
1152
+ const instance = this.getInstance(webSocket, instanceConfig.instance);
1153
+ if (instance) {
1154
+ const matchesPod = (a) => a.podNamespace === podNamespace && a.podName === podName;
1155
+ const toRemove = instance.assets.filter((a) => matchesPod(a) && (containerName === "" || a.containerName === containerName));
1156
+ for (const asset of toRemove) {
1157
+ if (asset.interval) clearInterval(asset.interval);
1158
+ }
1159
+ instance.assets = instance.assets.filter((a) => !(matchesPod(a) && (containerName === "" || a.containerName === containerName)));
1160
+ }
1161
+ return true;
1162
+ };
1163
+ this.pauseContinueInstance = (webSocket, instanceConfig, action) => {
1164
+ const instance = this.getInstance(webSocket, instanceConfig.instance);
1165
+ if (instance) {
1166
+ if (action === import_kwirth_common_back.EInstanceMessageAction.PAUSE) instance.paused = true;
1167
+ if (action === import_kwirth_common_back.EInstanceMessageAction.CONTINUE) instance.paused = false;
1168
+ } else {
1169
+ this.sendSignalMessage(webSocket, import_kwirth_common_back.EInstanceMessageAction.PAUSE, import_kwirth_common_back.EInstanceMessageFlow.RESPONSE, import_kwirth_common_back.ESignalMessageLevel.ERROR, instanceConfig.instance, "Echo instance not found");
1170
+ }
1171
+ };
1172
+ this.modifyInstance = (_webSocket, _instanceConfig) => {
1173
+ };
1174
+ this.stopInstance = (webSocket, instanceConfig) => {
1175
+ const instance = this.getInstance(webSocket, instanceConfig.instance);
1176
+ if (instance) {
1177
+ this.removeInstance(webSocket, instanceConfig.instance);
1178
+ this.sendSignalMessage(webSocket, import_kwirth_common_back.EInstanceMessageAction.STOP, import_kwirth_common_back.EInstanceMessageFlow.RESPONSE, import_kwirth_common_back.ESignalMessageLevel.INFO, instanceConfig.instance, "Echo instance stopped");
1179
+ } else {
1180
+ this.sendSignalMessage(webSocket, import_kwirth_common_back.EInstanceMessageAction.STOP, import_kwirth_common_back.EInstanceMessageFlow.RESPONSE, import_kwirth_common_back.ESignalMessageLevel.ERROR, instanceConfig.instance, "Echo instance not found");
1181
+ }
1182
+ };
1183
+ this.removeInstance = (webSocket, instanceId) => {
1184
+ const socket = this.webSockets.find((s) => s.ws === webSocket);
1185
+ if (socket) {
1186
+ const pos = socket.instances.findIndex((i) => i.instanceId === instanceId);
1187
+ if (pos >= 0) {
1188
+ for (const asset of socket.instances[pos].assets) clearInterval(asset.interval);
1189
+ socket.instances.splice(pos, 1);
1190
+ }
1191
+ }
1192
+ };
1193
+ this.containsConnection = (webSocket) => Boolean(this.webSockets.find((s) => s.ws === webSocket));
1194
+ this.removeConnection = (webSocket) => {
1195
+ const socket = this.webSockets.find((s) => s.ws === webSocket);
1196
+ if (socket) {
1197
+ for (const instance of socket.instances) {
1198
+ for (const asset of instance.assets) clearInterval(asset.interval);
1199
+ }
1200
+ const pos = this.webSockets.findIndex((s) => s.ws === webSocket);
1201
+ this.webSockets.splice(pos, 1);
1202
+ }
1203
+ };
1204
+ this.refreshConnection = (webSocket) => {
1205
+ const socket = this.webSockets.find((s) => s.ws === webSocket);
1206
+ if (socket) {
1207
+ socket.lastRefresh = Date.now();
1208
+ return true;
1209
+ }
1210
+ return false;
1211
+ };
1212
+ this.updateConnection = (newWebSocket, instanceId) => {
1213
+ for (const entry of this.webSockets) {
1214
+ if (entry.instances.find((i) => i.instanceId === instanceId)) {
1215
+ entry.ws = newWebSocket;
1216
+ for (const instance of entry.instances) {
1217
+ for (const asset of instance.assets) {
1218
+ clearInterval(asset.interval);
1219
+ asset.interval = setInterval(
1220
+ (ws, i, a) => this.sendData(ws, i, a),
1221
+ instance.configData.interval * 1e3,
1222
+ newWebSocket,
1223
+ instance,
1224
+ asset
1225
+ );
1226
+ }
1227
+ }
1228
+ return true;
1229
+ }
1230
+ }
1231
+ return false;
1232
+ };
1233
+ this.sendData = (ws, instance, asset) => {
1234
+ if (instance.paused) return;
1235
+ const msg = {
1236
+ msgtype: "echomessageresponse",
1237
+ channel: "echo",
1238
+ action: import_kwirth_common_back.EInstanceMessageAction.NONE,
1239
+ flow: import_kwirth_common_back.EInstanceMessageFlow.UNSOLICITED,
1240
+ type: import_kwirth_common_back.EInstanceMessageType.DATA,
1241
+ instance: instance.instanceId,
1242
+ text: `${/* @__PURE__ */ new Date()} ${asset.podNamespace}/${asset.podName}/${asset.containerName}`
1243
+ };
1244
+ ws.send(JSON.stringify(msg));
1245
+ };
1246
+ this.sendSignalMessage = (ws, action, flow, level, instanceId, text) => {
1247
+ const resp = { action, flow, channel: "echo", instance: instanceId, type: import_kwirth_common_back.EInstanceMessageType.SIGNAL, text, level };
1248
+ ws.send(JSON.stringify(resp));
1249
+ };
1250
+ this.clusterInfo = clusterInfo;
1251
+ this.backChannelObject = backChannelObject;
1252
+ }
1253
+ processProviderEvent(_providerId, obj) {
1254
+ const event = obj?.last?.event;
1255
+ if (!event) return;
1256
+ for (const socket of this.webSockets) {
1257
+ for (const instance of socket.instances) {
1258
+ if (instance.paused) continue;
1259
+ const msg = {
1260
+ msgtype: "echomessageresponse",
1261
+ channel: "echo",
1262
+ action: import_kwirth_common_back.EInstanceMessageAction.NONE,
1263
+ flow: import_kwirth_common_back.EInstanceMessageFlow.UNSOLICITED,
1264
+ type: import_kwirth_common_back.EInstanceMessageType.DATA,
1265
+ instance: instance.instanceId,
1266
+ text: JSON.stringify(event)
1267
+ };
1268
+ socket.ws.send(JSON.stringify(msg));
1269
+ }
1270
+ }
1271
+ }
1272
+ endpointRequest(_endpoint, _req, _res, _accessKey) {
1273
+ }
1274
+ websocketRequest(newWebSocket, instanceId, instanceConfig) {
1275
+ let socket = this.webSockets.find((s) => s.ws === newWebSocket);
1276
+ if (!socket) {
1277
+ const len = this.webSockets.push({ ws: newWebSocket, lastRefresh: Date.now(), instances: [] });
1278
+ socket = this.webSockets[len - 1];
1279
+ }
1280
+ if (!socket.instances.find((i) => i.instanceId === instanceId)) {
1281
+ socket.instances.push({
1282
+ accessKey: (0, import_kwirth_common_back.accessKeyDeserialize)(instanceConfig.accessKey),
1283
+ instanceId,
1284
+ configData: instanceConfig.data,
1285
+ paused: false,
1286
+ assets: []
1287
+ });
1288
+ }
1289
+ }
1290
+ getInstance(webSocket, instanceId) {
1291
+ const socket = this.webSockets.find((entry) => entry.ws === webSocket);
1292
+ if (socket) return socket.instances.find((i) => i.instanceId === instanceId);
1293
+ return void 0;
1294
+ }
1295
+ };
1296
+ var index_default = EchoChannel;