@rootintf/protocol-subverseinfo 2.0.1-api.4 → 2.1.1-api.5
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/dist/subverseinfo.cjs.js +568 -234
- package/dist/subverseinfo.d.ts +2 -4
- package/dist/subverseinfo.es.mjs +569 -234
- package/package.json +3 -3
- package/schema/schema_SubverseInfo.json +11 -6
- package/src/subverseinfo.ts +13 -21
- package/src/validate-esm.mjs +1 -1
- package/tests/subverseinfo.spec.mjs +13 -14
package/dist/subverseinfo.es.mjs
CHANGED
|
@@ -85,8 +85,8 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
85
85
|
if (valid0) {
|
|
86
86
|
if (data.subverse_info !== undefined) {
|
|
87
87
|
const _errs9 = errors;
|
|
88
|
-
if ("
|
|
89
|
-
validate19.errors = [{ instancePath: instancePath + "/subverse_info", schemaPath: "definitions#/definitions/_v/const", keyword: "const", params: { allowedValue: "
|
|
88
|
+
if ("5" !== data.subverse_info) {
|
|
89
|
+
validate19.errors = [{ instancePath: instancePath + "/subverse_info", schemaPath: "definitions#/definitions/_v/const", keyword: "const", params: { allowedValue: "5" }, message: "must be equal to constant" }];
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
92
|
var valid0 = _errs9 === errors;
|
|
@@ -108,7 +108,7 @@ function validate21(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
108
108
|
evaluated0.props = undefined;
|
|
109
109
|
} if (evaluated0.dynamicItems) {
|
|
110
110
|
evaluated0.items = undefined;
|
|
111
|
-
} {
|
|
111
|
+
} const _errs2 = errors; if (errors === _errs2) {
|
|
112
112
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
113
113
|
let missing0;
|
|
114
114
|
if (((data.uri === undefined) && (missing0 = "uri")) || ((data.name === undefined) && (missing0 = "name"))) {
|
|
@@ -146,7 +146,7 @@ function validate21(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
146
146
|
validate21.errors = [{ instancePath, schemaPath: "definitions#/definitions/unique-id/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
147
147
|
return false;
|
|
148
148
|
}
|
|
149
|
-
} {
|
|
149
|
+
} if (errors === 0) {
|
|
150
150
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
151
151
|
if (data.favicon !== undefined) {
|
|
152
152
|
const _errs8 = errors;
|
|
@@ -163,25 +163,99 @@ function validate21(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
163
163
|
if (data.hyperport !== undefined) {
|
|
164
164
|
let data3 = data.hyperport;
|
|
165
165
|
const _errs10 = errors;
|
|
166
|
-
|
|
166
|
+
const _errs12 = errors;
|
|
167
|
+
let valid5 = false;
|
|
168
|
+
let passing0 = null;
|
|
169
|
+
const _errs13 = errors;
|
|
170
|
+
if (typeof data3 !== "string") {
|
|
171
|
+
const err0 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
172
|
+
if (vErrors === null) {
|
|
173
|
+
vErrors = [err0];
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
vErrors.push(err0);
|
|
177
|
+
}
|
|
178
|
+
errors++;
|
|
179
|
+
}
|
|
180
|
+
var _valid0 = _errs13 === errors;
|
|
181
|
+
if (_valid0) {
|
|
182
|
+
valid5 = true;
|
|
183
|
+
passing0 = 0;
|
|
184
|
+
}
|
|
185
|
+
const _errs15 = errors;
|
|
186
|
+
if (errors === _errs15) {
|
|
167
187
|
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
168
188
|
let missing1;
|
|
169
189
|
if (((data3.uri === undefined) && (missing1 = "uri")) || ((data3.port === undefined) && (missing1 = "port"))) {
|
|
170
|
-
|
|
171
|
-
|
|
190
|
+
const err1 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf/1/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
|
|
191
|
+
if (vErrors === null) {
|
|
192
|
+
vErrors = [err1];
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
vErrors.push(err1);
|
|
196
|
+
}
|
|
197
|
+
errors++;
|
|
172
198
|
}
|
|
173
199
|
else {
|
|
174
200
|
if (data3.uri !== undefined) {
|
|
175
201
|
if (typeof data3.uri !== "string") {
|
|
176
|
-
|
|
177
|
-
|
|
202
|
+
const err2 = { instancePath: instancePath + "/hyperport/uri", schemaPath: "definitions#/definitions/hyperport/oneOf/1/properties/uri/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
203
|
+
if (vErrors === null) {
|
|
204
|
+
vErrors = [err2];
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
vErrors.push(err2);
|
|
208
|
+
}
|
|
209
|
+
errors++;
|
|
178
210
|
}
|
|
179
211
|
}
|
|
180
212
|
}
|
|
181
213
|
}
|
|
182
214
|
else {
|
|
183
|
-
|
|
184
|
-
|
|
215
|
+
const err3 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
216
|
+
if (vErrors === null) {
|
|
217
|
+
vErrors = [err3];
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
vErrors.push(err3);
|
|
221
|
+
}
|
|
222
|
+
errors++;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
var _valid0 = _errs15 === errors;
|
|
226
|
+
if (_valid0 && valid5) {
|
|
227
|
+
valid5 = false;
|
|
228
|
+
passing0 = [passing0, 1];
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
if (_valid0) {
|
|
232
|
+
valid5 = true;
|
|
233
|
+
passing0 = 1;
|
|
234
|
+
var props0 = {};
|
|
235
|
+
props0.uri = true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (!valid5) {
|
|
239
|
+
const err4 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
|
|
240
|
+
if (vErrors === null) {
|
|
241
|
+
vErrors = [err4];
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
vErrors.push(err4);
|
|
245
|
+
}
|
|
246
|
+
errors++;
|
|
247
|
+
validate21.errors = vErrors;
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
errors = _errs12;
|
|
252
|
+
if (vErrors !== null) {
|
|
253
|
+
if (_errs12) {
|
|
254
|
+
vErrors.length = _errs12;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
vErrors = null;
|
|
258
|
+
}
|
|
185
259
|
}
|
|
186
260
|
}
|
|
187
261
|
var valid3 = _errs10 === errors;
|
|
@@ -192,12 +266,12 @@ function validate21(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
192
266
|
if (valid3) {
|
|
193
267
|
if (data.info !== undefined) {
|
|
194
268
|
let data5 = data.info;
|
|
195
|
-
const
|
|
269
|
+
const _errs19 = errors;
|
|
196
270
|
if (!(data5 && typeof data5 == "object" && !Array.isArray(data5))) {
|
|
197
271
|
validate21.errors = [{ instancePath: instancePath + "/info", schemaPath: "definitions#/definitions/info/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
198
272
|
return false;
|
|
199
273
|
}
|
|
200
|
-
var valid3 =
|
|
274
|
+
var valid3 = _errs19 === errors;
|
|
201
275
|
}
|
|
202
276
|
else {
|
|
203
277
|
var valid3 = true;
|
|
@@ -215,7 +289,7 @@ function validate24(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
215
289
|
evaluated0.props = undefined;
|
|
216
290
|
} if (evaluated0.dynamicItems) {
|
|
217
291
|
evaluated0.items = undefined;
|
|
218
|
-
} {
|
|
292
|
+
} const _errs2 = errors; if (errors === _errs2) {
|
|
219
293
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
220
294
|
let missing0;
|
|
221
295
|
if (((data.uri === undefined) && (missing0 = "uri")) || ((data.name === undefined) && (missing0 = "name"))) {
|
|
@@ -253,7 +327,7 @@ function validate24(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
253
327
|
validate24.errors = [{ instancePath, schemaPath: "definitions#/definitions/unique-id/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
254
328
|
return false;
|
|
255
329
|
}
|
|
256
|
-
} {
|
|
330
|
+
} if (errors === 0) {
|
|
257
331
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
258
332
|
if (data.favicon !== undefined) {
|
|
259
333
|
const _errs8 = errors;
|
|
@@ -270,25 +344,99 @@ function validate24(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
270
344
|
if (data.hyperport !== undefined) {
|
|
271
345
|
let data3 = data.hyperport;
|
|
272
346
|
const _errs10 = errors;
|
|
273
|
-
|
|
347
|
+
const _errs12 = errors;
|
|
348
|
+
let valid5 = false;
|
|
349
|
+
let passing0 = null;
|
|
350
|
+
const _errs13 = errors;
|
|
351
|
+
if (typeof data3 !== "string") {
|
|
352
|
+
const err0 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
353
|
+
if (vErrors === null) {
|
|
354
|
+
vErrors = [err0];
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
vErrors.push(err0);
|
|
358
|
+
}
|
|
359
|
+
errors++;
|
|
360
|
+
}
|
|
361
|
+
var _valid0 = _errs13 === errors;
|
|
362
|
+
if (_valid0) {
|
|
363
|
+
valid5 = true;
|
|
364
|
+
passing0 = 0;
|
|
365
|
+
}
|
|
366
|
+
const _errs15 = errors;
|
|
367
|
+
if (errors === _errs15) {
|
|
274
368
|
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
275
369
|
let missing1;
|
|
276
370
|
if (((data3.uri === undefined) && (missing1 = "uri")) || ((data3.port === undefined) && (missing1 = "port"))) {
|
|
277
|
-
|
|
278
|
-
|
|
371
|
+
const err1 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf/1/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
|
|
372
|
+
if (vErrors === null) {
|
|
373
|
+
vErrors = [err1];
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
vErrors.push(err1);
|
|
377
|
+
}
|
|
378
|
+
errors++;
|
|
279
379
|
}
|
|
280
380
|
else {
|
|
281
381
|
if (data3.uri !== undefined) {
|
|
282
382
|
if (typeof data3.uri !== "string") {
|
|
283
|
-
|
|
284
|
-
|
|
383
|
+
const err2 = { instancePath: instancePath + "/hyperport/uri", schemaPath: "definitions#/definitions/hyperport/oneOf/1/properties/uri/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
384
|
+
if (vErrors === null) {
|
|
385
|
+
vErrors = [err2];
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
vErrors.push(err2);
|
|
389
|
+
}
|
|
390
|
+
errors++;
|
|
285
391
|
}
|
|
286
392
|
}
|
|
287
393
|
}
|
|
288
394
|
}
|
|
289
395
|
else {
|
|
290
|
-
|
|
291
|
-
|
|
396
|
+
const err3 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
397
|
+
if (vErrors === null) {
|
|
398
|
+
vErrors = [err3];
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
vErrors.push(err3);
|
|
402
|
+
}
|
|
403
|
+
errors++;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
var _valid0 = _errs15 === errors;
|
|
407
|
+
if (_valid0 && valid5) {
|
|
408
|
+
valid5 = false;
|
|
409
|
+
passing0 = [passing0, 1];
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
if (_valid0) {
|
|
413
|
+
valid5 = true;
|
|
414
|
+
passing0 = 1;
|
|
415
|
+
var props0 = {};
|
|
416
|
+
props0.uri = true;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (!valid5) {
|
|
420
|
+
const err4 = { instancePath: instancePath + "/hyperport", schemaPath: "definitions#/definitions/hyperport/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
|
|
421
|
+
if (vErrors === null) {
|
|
422
|
+
vErrors = [err4];
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
vErrors.push(err4);
|
|
426
|
+
}
|
|
427
|
+
errors++;
|
|
428
|
+
validate24.errors = vErrors;
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
errors = _errs12;
|
|
433
|
+
if (vErrors !== null) {
|
|
434
|
+
if (_errs12) {
|
|
435
|
+
vErrors.length = _errs12;
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
vErrors = null;
|
|
439
|
+
}
|
|
292
440
|
}
|
|
293
441
|
}
|
|
294
442
|
var valid3 = _errs10 === errors;
|
|
@@ -299,12 +447,12 @@ function validate24(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
299
447
|
if (valid3) {
|
|
300
448
|
if (data.info !== undefined) {
|
|
301
449
|
let data5 = data.info;
|
|
302
|
-
const
|
|
450
|
+
const _errs19 = errors;
|
|
303
451
|
if (!(data5 && typeof data5 == "object" && !Array.isArray(data5))) {
|
|
304
452
|
validate24.errors = [{ instancePath: instancePath + "/info", schemaPath: "definitions#/definitions/info/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
305
453
|
return false;
|
|
306
454
|
}
|
|
307
|
-
var valid3 =
|
|
455
|
+
var valid3 = _errs19 === errors;
|
|
308
456
|
}
|
|
309
457
|
else {
|
|
310
458
|
var valid3 = true;
|
|
@@ -703,8 +851,8 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
703
851
|
if (valid0) {
|
|
704
852
|
if (data.subverse_info !== undefined) {
|
|
705
853
|
const _errs42 = errors;
|
|
706
|
-
if ("
|
|
707
|
-
validate20.errors = [{ instancePath: instancePath + "/subverse_info", schemaPath: "definitions#/definitions/_v/const", keyword: "const", params: { allowedValue: "
|
|
854
|
+
if ("5" !== data.subverse_info) {
|
|
855
|
+
validate20.errors = [{ instancePath: instancePath + "/subverse_info", schemaPath: "definitions#/definitions/_v/const", keyword: "const", params: { allowedValue: "5" }, message: "must be equal to constant" }];
|
|
708
856
|
return false;
|
|
709
857
|
}
|
|
710
858
|
var valid0 = _errs42 === errors;
|
|
@@ -1100,8 +1248,8 @@ function validate27(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1100
1248
|
if (valid0) {
|
|
1101
1249
|
if (data.subverse_info !== undefined) {
|
|
1102
1250
|
const _errs44 = errors;
|
|
1103
|
-
if ("
|
|
1104
|
-
validate27.errors = [{ instancePath: instancePath + "/subverse_info", schemaPath: "definitions#/definitions/_v/const", keyword: "const", params: { allowedValue: "
|
|
1251
|
+
if ("5" !== data.subverse_info) {
|
|
1252
|
+
validate27.errors = [{ instancePath: instancePath + "/subverse_info", schemaPath: "definitions#/definitions/_v/const", keyword: "const", params: { allowedValue: "5" }, message: "must be equal to constant" }];
|
|
1105
1253
|
return false;
|
|
1106
1254
|
}
|
|
1107
1255
|
var valid0 = _errs44 === errors;
|
|
@@ -1119,122 +1267,407 @@ function validate27(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1119
1267
|
} validate27.errors = vErrors; return errors === 0; }
|
|
1120
1268
|
validate27.evaluated = { "props": { "expanse": true, "subverse_info": true }, "dynamicProps": false, "dynamicItems": false };
|
|
1121
1269
|
|
|
1270
|
+
// https://stackoverflow.com/questions/4602141/variable-name-as-a-string-in-javascript
|
|
1122
1271
|
// console.log('OUT', __name({variableName}) );
|
|
1123
|
-
|
|
1124
|
-
|
|
1272
|
+
//-------------------------------------------------------------------------------------------------
|
|
1273
|
+
function l_length_(obj_labels) {
|
|
1274
|
+
if (!obj_labels || typeof obj_labels !== 'object')
|
|
1275
|
+
throw new Error('obj_labels must be an object');
|
|
1276
|
+
const obj_1label = Object.values(obj_labels);
|
|
1277
|
+
if (!obj_1label.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1278
|
+
throw new Error('All values must be finite numbers');
|
|
1279
|
+
const labels = Object.values(obj_labels);
|
|
1280
|
+
if (labels.length === 0)
|
|
1281
|
+
return 1; // Empty object case, start at 1
|
|
1282
|
+
const value_max = Math.max(...labels);
|
|
1283
|
+
if (value_max <= 0)
|
|
1284
|
+
return 1;
|
|
1285
|
+
const bit_highest = Math.floor(Math.log2(value_max));
|
|
1286
|
+
return 1 << (bit_highest + 1);
|
|
1287
|
+
}
|
|
1288
|
+
function l_array_(arr_labels, start = 1) {
|
|
1289
|
+
if (!Array.isArray(arr_labels))
|
|
1290
|
+
throw new Error('arr_labels must be an array');
|
|
1291
|
+
if (!Number.isSafeInteger(start) || start < 0)
|
|
1292
|
+
throw new Error('start must be a safe, non-negative integer');
|
|
1293
|
+
return Object.freeze(arr_labels.reduce((acc, key, index) => {
|
|
1294
|
+
acc[key] = start << index;
|
|
1295
|
+
return acc;
|
|
1296
|
+
}, {}));
|
|
1297
|
+
}
|
|
1298
|
+
function l_concat_(obj_labels, arg) {
|
|
1299
|
+
if (!obj_labels || typeof obj_labels !== 'object')
|
|
1300
|
+
throw new Error('obj_labels must be an object');
|
|
1301
|
+
const obj_1label = Object.values(obj_labels);
|
|
1302
|
+
if (!obj_1label.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1303
|
+
throw new Error('All values must be finite numbers');
|
|
1304
|
+
if (!arg || (typeof arg !== 'object' && !Array.isArray(arg)))
|
|
1305
|
+
throw new Error('arg must be an object or array');
|
|
1306
|
+
if (Array.isArray(arg)) {
|
|
1307
|
+
const len = l_length_(obj_labels);
|
|
1308
|
+
const arr_labels_new = l_array_(arg, len);
|
|
1309
|
+
return l_concat_(obj_labels, arr_labels_new);
|
|
1310
|
+
}
|
|
1311
|
+
const next_pos = l_length_(obj_labels);
|
|
1312
|
+
const arg_entries = Object.entries(arg);
|
|
1313
|
+
const result = Object.create(null);
|
|
1314
|
+
Object.entries(obj_labels).forEach(([k, v]) => {
|
|
1315
|
+
if (k !== '__proto__' && k !== 'constructor')
|
|
1316
|
+
result[k] = v;
|
|
1317
|
+
});
|
|
1318
|
+
let min_arg = Infinity;
|
|
1319
|
+
for (const [, value] of arg_entries) {
|
|
1320
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
1321
|
+
continue; // Skip non-numeric
|
|
1322
|
+
if (value > 0 && value < min_arg)
|
|
1323
|
+
min_arg = value;
|
|
1324
|
+
}
|
|
1325
|
+
// Shift only if min_arg is less than next_pos
|
|
1326
|
+
const shift = min_arg === Infinity || min_arg >= next_pos
|
|
1327
|
+
? 0
|
|
1328
|
+
: Math.floor(Math.log2(next_pos / min_arg));
|
|
1329
|
+
for (const [key, value] of arg_entries) {
|
|
1330
|
+
if (!(key in result)) {
|
|
1331
|
+
result[key] = value === 0 ? 0 : value << shift;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
return Object.freeze(result);
|
|
1335
|
+
}
|
|
1336
|
+
function l_merge_(obj_labels1, obj_labels2) {
|
|
1337
|
+
if (!obj_labels1 || typeof obj_labels1 !== 'object')
|
|
1338
|
+
throw new Error('obj_labels must be an object');
|
|
1339
|
+
const obj_1label1 = Object.values(obj_labels1);
|
|
1340
|
+
if (!obj_1label1.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1341
|
+
throw new Error('All values must be finite numbers');
|
|
1342
|
+
if (!obj_labels2 || typeof obj_labels2 !== 'object')
|
|
1343
|
+
throw new Error('obj_labels must be an object');
|
|
1344
|
+
const obj_1label2 = Object.values(obj_labels2);
|
|
1345
|
+
if (!obj_1label2.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1346
|
+
throw new Error('All values must be finite numbers');
|
|
1347
|
+
const result = Object.create(null);
|
|
1348
|
+
Object.entries(obj_labels1).forEach(([k, v]) => {
|
|
1349
|
+
if (k !== '__proto__' && k !== 'constructor')
|
|
1350
|
+
result[k] = v;
|
|
1351
|
+
});
|
|
1352
|
+
const set_values = new Set(Object.values(obj_labels1)); // Track all used bit values
|
|
1353
|
+
// Find the highest bit position to start shifting from if needed
|
|
1354
|
+
const value_highest = Math.max(0, ...Array.from(set_values));
|
|
1355
|
+
let next_shift = value_highest ? Math.floor(Math.log2(value_highest)) + 1 : 0;
|
|
1356
|
+
// Process second set
|
|
1357
|
+
for (const [key, value] of Object.entries(obj_labels2)) {
|
|
1358
|
+
if (key in result) {
|
|
1359
|
+
// Same key: Values must match
|
|
1360
|
+
if (result[key] !== value) {
|
|
1361
|
+
throw new Error(`Key '${key}' has conflicting values: ${result[key]} (obj_labels1) vs ${value} (obj_labels2)`);
|
|
1362
|
+
}
|
|
1363
|
+
// No action needed if values match, already in result
|
|
1364
|
+
}
|
|
1365
|
+
else {
|
|
1366
|
+
let maxIterations = 1000;
|
|
1367
|
+
// New key: Add if value is unique, otherwise shift
|
|
1368
|
+
let value_new = value;
|
|
1369
|
+
while (set_values.has(value_new) && maxIterations--) {
|
|
1370
|
+
value_new = 1 << next_shift++;
|
|
1371
|
+
}
|
|
1372
|
+
if (maxIterations <= 0)
|
|
1373
|
+
throw new Error('Too many collisions in l_merge_');
|
|
1374
|
+
result[key] = value_new;
|
|
1375
|
+
set_values.add(value_new);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
return Object.freeze(result);
|
|
1379
|
+
}
|
|
1125
1380
|
function l_LL_(obj, x) {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
return Object.freeze(obj_new);
|
|
1381
|
+
if (!obj || typeof obj !== 'object')
|
|
1382
|
+
throw new Error('obj must be an object');
|
|
1383
|
+
if (!Number.isSafeInteger(x) || x < 0)
|
|
1384
|
+
throw new Error('Shift value must be a safe, non-negative integer');
|
|
1385
|
+
const obj_new = {};
|
|
1386
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1387
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
1388
|
+
continue; // Skip non-numeric
|
|
1389
|
+
obj_new[k] = v << x;
|
|
1390
|
+
}
|
|
1391
|
+
return Object.freeze(obj_new);
|
|
1138
1392
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1393
|
+
function l_RR_(obj, x) {
|
|
1394
|
+
if (!obj || typeof obj !== 'object')
|
|
1395
|
+
throw new Error('obj must be an object');
|
|
1396
|
+
if (!Number.isSafeInteger(x) || x < 0)
|
|
1397
|
+
throw new Error('Shift value must be a safe, non-negative integer');
|
|
1398
|
+
const obj_new = {};
|
|
1399
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1400
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
1401
|
+
continue; // Skip non-numeric
|
|
1402
|
+
obj_new[k] = v >> x;
|
|
1403
|
+
}
|
|
1404
|
+
return Object.freeze(obj_new);
|
|
1146
1405
|
}
|
|
1147
|
-
|
|
1148
1406
|
//-------------------------------------------------------------------------------------------------
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1407
|
+
function handler_default_( /* ... */) {
|
|
1408
|
+
// https://stackoverflow.com/questions/18746440/passing-multiple-arguments-to-console-log
|
|
1409
|
+
var args = Array.prototype.slice.call(arguments);
|
|
1410
|
+
console.log.apply(console, args);
|
|
1411
|
+
}
|
|
1412
|
+
function l_toBigInt_(obj_labels, obj, ignore = false) {
|
|
1413
|
+
if (!obj_labels || typeof obj_labels !== 'object')
|
|
1414
|
+
throw new Error('obj_labels must be an object');
|
|
1415
|
+
if (!obj || typeof obj !== 'object')
|
|
1416
|
+
throw new Error('obj must be an object');
|
|
1417
|
+
let bigint_l = BigInt(0);
|
|
1418
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1419
|
+
if ((ignore || v) && obj_labels[k] !== undefined && typeof obj_labels[k] === 'number')
|
|
1420
|
+
bigint_l |= BigInt(obj_labels[k]);
|
|
1421
|
+
// console.log('0b'+ bigInt.toString(2) );
|
|
1422
|
+
}
|
|
1423
|
+
return bigint_l;
|
|
1424
|
+
}
|
|
1425
|
+
function lRef(initial) {
|
|
1426
|
+
if (arguments.length === 0 || initial === undefined) {
|
|
1427
|
+
return undefined;
|
|
1428
|
+
}
|
|
1429
|
+
let value = initial;
|
|
1430
|
+
return {
|
|
1431
|
+
get: () => value,
|
|
1432
|
+
set: (newVal) => { value = newVal; }
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
/*
|
|
1436
|
+
const l_ = {
|
|
1437
|
+
get VALIDATION() { return logr_.lref.get().VALIDATION; }
|
|
1163
1438
|
}
|
|
1164
1439
|
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1440
|
+
function createBitFlags(ref) {
|
|
1441
|
+
// Create a proxy so that any property access computes the current bit
|
|
1442
|
+
return new Proxy({}, {
|
|
1443
|
+
get(target, prop, receiver) {
|
|
1444
|
+
const positions = ref.get(); // get current { VALIDATION: n, ... }
|
|
1445
|
+
const position = positions[prop]; // e.g., positions['VALIDATION']
|
|
1169
1446
|
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1447
|
+
if (position === undefined) {
|
|
1448
|
+
// Optional: warn or return 0 for unknown keys
|
|
1449
|
+
console.warn(`Unknown bitflag key: ${String(prop)}`);
|
|
1450
|
+
return 0;
|
|
1451
|
+
}
|
|
1175
1452
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
return false;
|
|
1453
|
+
return 0b1 << position; // or 1 << position
|
|
1454
|
+
},
|
|
1179
1455
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1456
|
+
// Optional: make Object.keys(l_) show the actual keys
|
|
1457
|
+
ownKeys(target) {
|
|
1458
|
+
return Object.keys(ref.get());
|
|
1459
|
+
},
|
|
1185
1460
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1461
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
1462
|
+
return {
|
|
1463
|
+
enumerable: true,
|
|
1464
|
+
configurable: true,
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1193
1469
|
|
|
1194
|
-
|
|
1195
|
-
set labels(obj) {
|
|
1196
|
-
_obj_labels = obj;
|
|
1197
|
-
_Bint_toggled = BigInt(0);
|
|
1198
|
-
},
|
|
1470
|
+
type BitPositions = Record<string, number>;
|
|
1199
1471
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1472
|
+
function createBitFlags<T extends BitPositions>(ref: { get: () => T }) {
|
|
1473
|
+
return new Proxy({} as { [K in keyof T]: number }, {
|
|
1474
|
+
get(target, prop: string | symbol) {
|
|
1475
|
+
if (typeof prop !== 'string') return undefined;
|
|
1476
|
+
const positions = ref.get();
|
|
1477
|
+
const position = positions[prop as keyof T];
|
|
1478
|
+
if (position === undefined) return 0;
|
|
1479
|
+
return 1 << position;
|
|
1480
|
+
},
|
|
1481
|
+
ownKeys() {
|
|
1482
|
+
return Object.keys(ref.get());
|
|
1483
|
+
},
|
|
1484
|
+
getOwnPropertyDescriptor() {
|
|
1485
|
+
return { enumerable: true, configurable: true };
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
*/
|
|
1490
|
+
function create_Referenced_l_(ref) {
|
|
1491
|
+
return new Proxy({}, {
|
|
1492
|
+
get(target, prop) {
|
|
1493
|
+
if (typeof prop !== 'string')
|
|
1494
|
+
return undefined;
|
|
1495
|
+
// if (prop === 'get') {
|
|
1496
|
+
// return () => {
|
|
1497
|
+
// const positions = ref.get();
|
|
1498
|
+
// const result: Partial<Record<keyof T, number>> = {};
|
|
1499
|
+
// for (const key in positions) {
|
|
1500
|
+
// result[key as keyof T] = positions[key];
|
|
1501
|
+
// }
|
|
1502
|
+
// return result as Record<keyof T, number>;
|
|
1503
|
+
// };
|
|
1504
|
+
// }
|
|
1505
|
+
if (prop === 'get')
|
|
1506
|
+
return () => ref.get();
|
|
1507
|
+
const positions = ref.get();
|
|
1508
|
+
const value = positions[prop];
|
|
1509
|
+
if (value === undefined)
|
|
1510
|
+
return 0;
|
|
1511
|
+
return value;
|
|
1512
|
+
},
|
|
1513
|
+
ownKeys() {
|
|
1514
|
+
return Object.keys(ref.get());
|
|
1515
|
+
},
|
|
1516
|
+
getOwnPropertyDescriptor() {
|
|
1517
|
+
return { enumerable: true, configurable: true };
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
const LOGR = (function () {
|
|
1522
|
+
let _instance; // Private variable to hold the single instance
|
|
1523
|
+
// Module-level state would work - but only when the module is loaded once.
|
|
1524
|
+
// Your bundler is currently bundling @knev/bitlogr into your distribution file,
|
|
1525
|
+
// creating a second copy. The Global Symbol approach would work around this,
|
|
1526
|
+
// but it's treating the symptom, not the cause.
|
|
1527
|
+
const GLOBAL_KEY = Symbol.for('@knev/bitlogr/LOGR');
|
|
1528
|
+
// The real issue is your build configuration bundling dependencies that should remain external.
|
|
1529
|
+
// rollup.config.mjs: external: ['@knev/bitlogr', 'uuid'], // Don't bundle these
|
|
1530
|
+
function _create_instance() {
|
|
1531
|
+
const _id = Math.random();
|
|
1532
|
+
if (globalThis.LOGR_ENABLED ?? true)
|
|
1533
|
+
console.log('creating LOGR instance:', _id);
|
|
1534
|
+
// Private state (replacing constructor properties)
|
|
1535
|
+
let _Bint_toggled = BigInt(0);
|
|
1536
|
+
let _handler_log = handler_default_;
|
|
1537
|
+
function _log_fxn(nr_logged, argsFn /* args */) {
|
|
1538
|
+
// console.log('_log_fxn: ', BigInt(nr_logged), _Bint_toggled, (BigInt(nr_logged) & _Bint_toggled));
|
|
1539
|
+
if ((BigInt(nr_logged) & _Bint_toggled) === BigInt(0))
|
|
1540
|
+
return;
|
|
1541
|
+
const args = argsFn();
|
|
1542
|
+
_handler_log.apply(this, args);
|
|
1543
|
+
}
|
|
1544
|
+
return {
|
|
1545
|
+
_id, // for testing
|
|
1546
|
+
get handler() { return _handler_log; },
|
|
1547
|
+
set handler(fx) {
|
|
1548
|
+
_handler_log = fx;
|
|
1549
|
+
},
|
|
1550
|
+
get toggled() { return _Bint_toggled; },
|
|
1551
|
+
// toggle(obj_labels, obj_toggled) {
|
|
1552
|
+
// _Bint_toggled= l_toBigInt_(obj_labels, obj_toggled);
|
|
1553
|
+
// },
|
|
1554
|
+
toggle(labels, obj_toggled) {
|
|
1555
|
+
const obj_labels = typeof labels?.get === 'function'
|
|
1556
|
+
? labels.get()
|
|
1557
|
+
: labels;
|
|
1558
|
+
// console.log('obj_labels', obj_labels)
|
|
1559
|
+
_Bint_toggled = l_toBigInt_(obj_labels, obj_toggled);
|
|
1560
|
+
},
|
|
1561
|
+
// Core internal log function (exposed only to created loggers)
|
|
1562
|
+
_log_fxn,
|
|
1563
|
+
create(options = {}) {
|
|
1564
|
+
// This constant will be replaced at build time
|
|
1565
|
+
if (!(globalThis.LOGR_ENABLED ?? true)) {
|
|
1566
|
+
return {
|
|
1567
|
+
_obj_labels: undefined, // optional: keep shape compatible if needed
|
|
1568
|
+
log: () => { }, // does nothing
|
|
1569
|
+
raw: () => { }, // does nothing
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
const _logger = {
|
|
1573
|
+
// _lref_labels: (options.arr_labels === undefined) ? undefined : lRef( l_array_(options.arr_labels) ),
|
|
1574
|
+
_lref_labels: (options.labels === undefined)
|
|
1575
|
+
? undefined
|
|
1576
|
+
: lRef(options.labels),
|
|
1577
|
+
get l() {
|
|
1578
|
+
// Always create a fresh proxy pointing to the current labels
|
|
1579
|
+
return create_Referenced_l_({
|
|
1580
|
+
get: () => this._lref_labels?.get() || {}
|
|
1581
|
+
});
|
|
1582
|
+
},
|
|
1583
|
+
get lref() { return this._lref_labels; },
|
|
1584
|
+
set lref(lref_labels_new) {
|
|
1585
|
+
this._lref_labels = lref_labels_new;
|
|
1586
|
+
},
|
|
1587
|
+
log(nr_logged, argsFn) {
|
|
1588
|
+
// This constant will be replaced at build time
|
|
1589
|
+
if (!(globalThis.LOGR_ENABLED ?? true))
|
|
1590
|
+
return;
|
|
1591
|
+
_log_fxn.call(this, nr_logged, argsFn);
|
|
1592
|
+
},
|
|
1593
|
+
// Optional shorthand for common cases
|
|
1594
|
+
raw(...args) {
|
|
1595
|
+
_handler_log.apply(this, args);
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
return _logger;
|
|
1599
|
+
},
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
// Public interface
|
|
1603
|
+
return {
|
|
1604
|
+
get_instance() {
|
|
1605
|
+
if (!(globalThis.LOGR_USE_GLOBAL_KEY ?? true)) {
|
|
1606
|
+
if (!_instance)
|
|
1607
|
+
_instance = _create_instance(); // Lazy initialization
|
|
1608
|
+
return _instance;
|
|
1609
|
+
}
|
|
1610
|
+
if (!globalThis[GLOBAL_KEY])
|
|
1611
|
+
globalThis[GLOBAL_KEY] = _create_instance();
|
|
1612
|
+
return globalThis[GLOBAL_KEY];
|
|
1613
|
+
},
|
|
1614
|
+
// For testing only - reset the singleton
|
|
1615
|
+
_reset_for_testing() {
|
|
1616
|
+
delete globalThis[GLOBAL_KEY];
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
})();
|
|
1205
1620
|
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1621
|
+
var logr_es = /*#__PURE__*/Object.freeze({
|
|
1622
|
+
__proto__: null,
|
|
1623
|
+
LOGR: LOGR,
|
|
1624
|
+
_create_Referenced_l: create_Referenced_l_,
|
|
1625
|
+
lRef: lRef,
|
|
1626
|
+
l_LL: l_LL_,
|
|
1627
|
+
l_RR: l_RR_,
|
|
1628
|
+
l_array: l_array_,
|
|
1629
|
+
l_concat: l_concat_,
|
|
1630
|
+
l_length: l_length_,
|
|
1631
|
+
l_merge: l_merge_
|
|
1632
|
+
});
|
|
1210
1633
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1634
|
+
function getAugmentedNamespace(n) {
|
|
1635
|
+
if (n.__esModule) return n;
|
|
1636
|
+
var f = n.default;
|
|
1637
|
+
if (typeof f == "function") {
|
|
1638
|
+
var a = function a () {
|
|
1639
|
+
if (this instanceof a) {
|
|
1640
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
1641
|
+
}
|
|
1642
|
+
return f.apply(this, arguments);
|
|
1215
1643
|
};
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1644
|
+
a.prototype = f.prototype;
|
|
1645
|
+
} else a = {};
|
|
1646
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
1647
|
+
Object.keys(n).forEach(function (k) {
|
|
1648
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1649
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1650
|
+
enumerable: true,
|
|
1651
|
+
get: function () {
|
|
1652
|
+
return n[k];
|
|
1223
1653
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
})();
|
|
1654
|
+
});
|
|
1655
|
+
});
|
|
1656
|
+
return a;
|
|
1657
|
+
}
|
|
1229
1658
|
|
|
1230
1659
|
var jsonMsg_cjs = {};
|
|
1231
1660
|
|
|
1661
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(logr_es);
|
|
1662
|
+
|
|
1232
1663
|
var hasRequiredJsonMsg_cjs;
|
|
1233
1664
|
|
|
1234
1665
|
function requireJsonMsg_cjs () {
|
|
1235
1666
|
if (hasRequiredJsonMsg_cjs) return jsonMsg_cjs;
|
|
1236
1667
|
hasRequiredJsonMsg_cjs = 1;
|
|
1237
1668
|
|
|
1669
|
+
var bitlogr = require$$0;
|
|
1670
|
+
|
|
1238
1671
|
const schema_Msg = validate18;
|
|
1239
1672
|
function validate18(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate18.evaluated; if (evaluated0.dynamicProps) {
|
|
1240
1673
|
evaluated0.props = undefined;
|
|
@@ -1404,105 +1837,12 @@ function requireJsonMsg_cjs () {
|
|
|
1404
1837
|
return _v4(options);
|
|
1405
1838
|
}
|
|
1406
1839
|
|
|
1407
|
-
// console.log('OUT', __name({variableName}) );
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
1840
|
//-------------------------------------------------------------------------------------------------
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
console.log.apply(console, args);
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1841
|
+
const LOGR_ = bitlogr.LOGR.get_instance();
|
|
1842
|
+
const logr_ = LOGR_.create({ labels: bitlogr.l_array(['VALIDATION']) });
|
|
1843
|
+
const l_ = logr_.l;
|
|
1844
|
+
// console.log('File location:', import.meta.url, '[Implementation]');
|
|
1418
1845
|
//-------------------------------------------------------------------------------------------------
|
|
1419
|
-
|
|
1420
|
-
function l_toBigInt_(obj_labels, obj, ignore= false) {
|
|
1421
|
-
if (! obj_labels || typeof obj_labels !== 'object')
|
|
1422
|
-
throw new Error('obj_labels must be an object');
|
|
1423
|
-
if (! obj || typeof obj !== 'object')
|
|
1424
|
-
throw new Error('obj must be an object');
|
|
1425
|
-
|
|
1426
|
-
let bigInt = BigInt(0);
|
|
1427
|
-
for (const [k,v] of Object.entries(obj)) {
|
|
1428
|
-
if ( ( ignore || v ) && obj_labels[k] !== undefined && typeof obj_labels[k] === 'number')
|
|
1429
|
-
bigInt|= BigInt( obj_labels[k] );
|
|
1430
|
-
// console.log('0b'+ bigInt.toString(2) );
|
|
1431
|
-
}
|
|
1432
|
-
return bigInt;
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
// console.log(l_toBigInt_({},{}))
|
|
1436
|
-
|
|
1437
|
-
const LOGR = (function () {
|
|
1438
|
-
let _instance; // Private variable to hold the single instance
|
|
1439
|
-
|
|
1440
|
-
function _create_instance() {
|
|
1441
|
-
// Private state (replacing constructor properties)
|
|
1442
|
-
let _handler_log = handler_default_;
|
|
1443
|
-
let _obj_labels = undefined;
|
|
1444
|
-
let _Bint_toggled = BigInt(0);
|
|
1445
|
-
|
|
1446
|
-
function _log_fxn(nr_logged, argsFn /* args */) {
|
|
1447
|
-
if ((BigInt(nr_logged) & _Bint_toggled) === BigInt(0))
|
|
1448
|
-
return false;
|
|
1449
|
-
|
|
1450
|
-
const args = argsFn();
|
|
1451
|
-
_handler_log.apply(this, args);
|
|
1452
|
-
// _handler_log.apply(this, args);
|
|
1453
|
-
return true;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
return {
|
|
1457
|
-
set handler(fx) {
|
|
1458
|
-
_handler_log = fx;
|
|
1459
|
-
},
|
|
1460
|
-
get handler() {
|
|
1461
|
-
return _handler_log;
|
|
1462
|
-
},
|
|
1463
|
-
|
|
1464
|
-
get labels() { return _obj_labels; },
|
|
1465
|
-
set labels(obj) {
|
|
1466
|
-
_obj_labels = obj;
|
|
1467
|
-
_Bint_toggled = BigInt(0);
|
|
1468
|
-
},
|
|
1469
|
-
|
|
1470
|
-
// put= function(label, abbrv) {
|
|
1471
|
-
// let name= __name(label);
|
|
1472
|
-
// _labels[name]= label[name];
|
|
1473
|
-
// console.log(_labels);
|
|
1474
|
-
// }
|
|
1475
|
-
|
|
1476
|
-
get toggled() { return _Bint_toggled; },
|
|
1477
|
-
set toggled(obj_toggled) {
|
|
1478
|
-
_Bint_toggled= l_toBigInt_(_obj_labels, obj_toggled);
|
|
1479
|
-
},
|
|
1480
|
-
|
|
1481
|
-
log(nr_logged, argsFn) {
|
|
1482
|
-
|
|
1483
|
-
return _log_fxn.call(this, nr_logged, argsFn); // Pass the thunk
|
|
1484
|
-
}
|
|
1485
|
-
};
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
// Public interface
|
|
1489
|
-
return {
|
|
1490
|
-
get_instance() {
|
|
1491
|
-
if (!_instance) {
|
|
1492
|
-
_instance = _create_instance(); // Lazy initialization
|
|
1493
|
-
}
|
|
1494
|
-
return _instance;
|
|
1495
|
-
}
|
|
1496
|
-
};
|
|
1497
|
-
|
|
1498
|
-
})();
|
|
1499
|
-
|
|
1500
|
-
let LOGR_ = LOGR.get_instance();
|
|
1501
|
-
const log_ = LOGR_.log;
|
|
1502
|
-
const l_ = {
|
|
1503
|
-
VALIDATION: 0b1 << 0,
|
|
1504
|
-
};
|
|
1505
|
-
LOGR_.labels = l_;
|
|
1506
1846
|
// TODO: use RFC3339 "timestamp"? https://ajv.js.org/json-type-definition.html
|
|
1507
1847
|
// "module" pattern to avoid "static" and "#" private : https://stackoverflow.com/a/1479341/298545
|
|
1508
1848
|
var JSON_Msg = (function () {
|
|
@@ -1517,7 +1857,7 @@ function requireJsonMsg_cjs () {
|
|
|
1517
1857
|
validate: function (json) {
|
|
1518
1858
|
const b_valid = schema_Msg(json);
|
|
1519
1859
|
if (!b_valid)
|
|
1520
|
-
|
|
1860
|
+
logr_.log(l_.VALIDATION, () => ['JSON_Msg: validate: ', schema_Msg.errors]);
|
|
1521
1861
|
return b_valid;
|
|
1522
1862
|
},
|
|
1523
1863
|
// TODO: requires a separate ajv module require, and JTD specific schema
|
|
@@ -1539,7 +1879,7 @@ function requireJsonMsg_cjs () {
|
|
|
1539
1879
|
return false;
|
|
1540
1880
|
const b_valid = schema_MsgEffect(json);
|
|
1541
1881
|
if (!b_valid)
|
|
1542
|
-
|
|
1882
|
+
logr_.log(l_.VALIDATION, () => ['JSON_MsgEffect: validate: ', schema_MsgEffect.errors]);
|
|
1543
1883
|
return b_valid;
|
|
1544
1884
|
}
|
|
1545
1885
|
};
|
|
@@ -1566,7 +1906,7 @@ function requireJsonMsg_cjs () {
|
|
|
1566
1906
|
return false;
|
|
1567
1907
|
const b_valid = schema_MsgAckEffect(json);
|
|
1568
1908
|
if (!b_valid)
|
|
1569
|
-
|
|
1909
|
+
logr_.log(l_.VALIDATION, () => ['JSON_MsgAckEffect: validate: ', schema_MsgAckEffect.errors]);
|
|
1570
1910
|
return b_valid;
|
|
1571
1911
|
}
|
|
1572
1912
|
};
|
|
@@ -1575,24 +1915,18 @@ function requireJsonMsg_cjs () {
|
|
|
1575
1915
|
jsonMsg_cjs.JSON_Msg = JSON_Msg;
|
|
1576
1916
|
jsonMsg_cjs.JSON_MsgAck = JSON_MsgAck;
|
|
1577
1917
|
jsonMsg_cjs.JSON_MsgEffect = JSON_MsgEffect;
|
|
1578
|
-
jsonMsg_cjs.
|
|
1918
|
+
jsonMsg_cjs.logr = logr_;
|
|
1579
1919
|
return jsonMsg_cjs;
|
|
1580
1920
|
}
|
|
1581
1921
|
|
|
1582
1922
|
var jsonMsg_cjsExports = requireJsonMsg_cjs();
|
|
1583
1923
|
|
|
1584
|
-
|
|
1585
|
-
const log_ = LOGR_.log;
|
|
1586
|
-
Object.assign(jsonMsg_cjsExports.l, l_LL_(jsonMsg_cjsExports.l, 2)); // VALIDATION : 4
|
|
1587
|
-
const l_ = {
|
|
1588
|
-
VALIDATION: 0b1 << 2, //4
|
|
1589
|
-
};
|
|
1590
|
-
LOGR_.labels = l_;
|
|
1591
|
-
LOGR_.toggled = {
|
|
1592
|
-
// VALIDATION : true
|
|
1593
|
-
};
|
|
1594
|
-
const kstr_VERSION = "4";
|
|
1924
|
+
const kstr_VERSION = "5";
|
|
1595
1925
|
// TODO: use RFC3339 "timestamp"? https://ajv.js.org/json-type-definition.html
|
|
1926
|
+
//-------------------------------------------------------------------------------------------------
|
|
1927
|
+
LOGR.get_instance();
|
|
1928
|
+
const l_ = jsonMsg_cjsExports.logr.l;
|
|
1929
|
+
//-------------------------------------------------------------------------------------------------
|
|
1596
1930
|
// const regex_IOI= new RegExp('\\bquery\\s*\\{\\s*IOI\\s*\\(\\s*pkg\\s*:\\s*"([^"]*)"\\s*\\)\\s*\\{.*heartbeat\\s*\\}\\s*\\}');
|
|
1597
1931
|
var JSON_MsgSubverseInfo_query = (function () {
|
|
1598
1932
|
return {
|
|
@@ -1605,7 +1939,7 @@ var JSON_MsgSubverseInfo_query = (function () {
|
|
|
1605
1939
|
// if (! JSON_Msg.validate(json))
|
|
1606
1940
|
// return false;
|
|
1607
1941
|
if (!schema_SubverseInfo_query(json)) {
|
|
1608
|
-
|
|
1942
|
+
jsonMsg_cjsExports.logr.log(l_.VALIDATION, () => ['schema_SubverseInfo_query_: validate: ', schema_SubverseInfo_query.errors]);
|
|
1609
1943
|
return false;
|
|
1610
1944
|
}
|
|
1611
1945
|
// const str_graphql = json["discovery"]["graphql"];
|
|
@@ -1632,7 +1966,7 @@ var JSON_MsgSubverseInfo_subverse = (function () {
|
|
|
1632
1966
|
if (!JSON_MsgSubverseInfo_query.validate(json_msg._cause))
|
|
1633
1967
|
return false;
|
|
1634
1968
|
if (!schema_SubverseInfo_subverse(json_msg)) {
|
|
1635
|
-
|
|
1969
|
+
jsonMsg_cjsExports.logr.log(l_.VALIDATION, () => ['JSON_SubverseInfo_expanse: validate: ', schema_SubverseInfo_subverse.errors]);
|
|
1636
1970
|
return false;
|
|
1637
1971
|
}
|
|
1638
1972
|
return true;
|
|
@@ -1653,7 +1987,7 @@ var JSON_MsgSubverseInfo_instances = (function () {
|
|
|
1653
1987
|
if (!JSON_MsgSubverseInfo_query.validate(json_msg._cause))
|
|
1654
1988
|
return false;
|
|
1655
1989
|
if (!schema_SubverseInfo_instances(json_msg)) {
|
|
1656
|
-
|
|
1990
|
+
jsonMsg_cjsExports.logr.log(l_.VALIDATION, () => ['JSON_SubverseInfo_instances: validate: ', schema_SubverseInfo_instances.errors]);
|
|
1657
1991
|
return false;
|
|
1658
1992
|
}
|
|
1659
1993
|
return true;
|
|
@@ -1661,4 +1995,5 @@ var JSON_MsgSubverseInfo_instances = (function () {
|
|
|
1661
1995
|
};
|
|
1662
1996
|
})();
|
|
1663
1997
|
|
|
1664
|
-
|
|
1998
|
+
var logr = jsonMsg_cjsExports.logr;
|
|
1999
|
+
export { JSON_MsgSubverseInfo_instances, JSON_MsgSubverseInfo_query, JSON_MsgSubverseInfo_subverse, logr };
|