@rootintf/protocol-subverseinfo 2.0.1-api.4 → 2.0.3-api.4
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 +393 -205
- package/dist/subverseinfo.d.ts +2 -4
- package/dist/subverseinfo.es.mjs +394 -205
- package/package.json +3 -3
- package/src/subverseinfo.ts +15 -20
- package/tests/subverseinfo.spec.mjs +7 -5
package/dist/subverseinfo.cjs.js
CHANGED
|
@@ -1121,122 +1121,407 @@ function validate27(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1121
1121
|
} validate27.errors = vErrors; return errors === 0; }
|
|
1122
1122
|
validate27.evaluated = { "props": { "expanse": true, "subverse_info": true }, "dynamicProps": false, "dynamicItems": false };
|
|
1123
1123
|
|
|
1124
|
+
// https://stackoverflow.com/questions/4602141/variable-name-as-a-string-in-javascript
|
|
1124
1125
|
// console.log('OUT', __name({variableName}) );
|
|
1125
|
-
|
|
1126
|
-
|
|
1126
|
+
//-------------------------------------------------------------------------------------------------
|
|
1127
|
+
function l_length_(obj_labels) {
|
|
1128
|
+
if (!obj_labels || typeof obj_labels !== 'object')
|
|
1129
|
+
throw new Error('obj_labels must be an object');
|
|
1130
|
+
const obj_1label = Object.values(obj_labels);
|
|
1131
|
+
if (!obj_1label.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1132
|
+
throw new Error('All values must be finite numbers');
|
|
1133
|
+
const labels = Object.values(obj_labels);
|
|
1134
|
+
if (labels.length === 0)
|
|
1135
|
+
return 1; // Empty object case, start at 1
|
|
1136
|
+
const value_max = Math.max(...labels);
|
|
1137
|
+
if (value_max <= 0)
|
|
1138
|
+
return 1;
|
|
1139
|
+
const bit_highest = Math.floor(Math.log2(value_max));
|
|
1140
|
+
return 1 << (bit_highest + 1);
|
|
1141
|
+
}
|
|
1142
|
+
function l_array_(arr_labels, start = 1) {
|
|
1143
|
+
if (!Array.isArray(arr_labels))
|
|
1144
|
+
throw new Error('arr_labels must be an array');
|
|
1145
|
+
if (!Number.isSafeInteger(start) || start < 0)
|
|
1146
|
+
throw new Error('start must be a safe, non-negative integer');
|
|
1147
|
+
return Object.freeze(arr_labels.reduce((acc, key, index) => {
|
|
1148
|
+
acc[key] = start << index;
|
|
1149
|
+
return acc;
|
|
1150
|
+
}, {}));
|
|
1151
|
+
}
|
|
1152
|
+
function l_concat_(obj_labels, arg) {
|
|
1153
|
+
if (!obj_labels || typeof obj_labels !== 'object')
|
|
1154
|
+
throw new Error('obj_labels must be an object');
|
|
1155
|
+
const obj_1label = Object.values(obj_labels);
|
|
1156
|
+
if (!obj_1label.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1157
|
+
throw new Error('All values must be finite numbers');
|
|
1158
|
+
if (!arg || (typeof arg !== 'object' && !Array.isArray(arg)))
|
|
1159
|
+
throw new Error('arg must be an object or array');
|
|
1160
|
+
if (Array.isArray(arg)) {
|
|
1161
|
+
const len = l_length_(obj_labels);
|
|
1162
|
+
const arr_labels_new = l_array_(arg, len);
|
|
1163
|
+
return l_concat_(obj_labels, arr_labels_new);
|
|
1164
|
+
}
|
|
1165
|
+
const next_pos = l_length_(obj_labels);
|
|
1166
|
+
const arg_entries = Object.entries(arg);
|
|
1167
|
+
const result = Object.create(null);
|
|
1168
|
+
Object.entries(obj_labels).forEach(([k, v]) => {
|
|
1169
|
+
if (k !== '__proto__' && k !== 'constructor')
|
|
1170
|
+
result[k] = v;
|
|
1171
|
+
});
|
|
1172
|
+
let min_arg = Infinity;
|
|
1173
|
+
for (const [, value] of arg_entries) {
|
|
1174
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
1175
|
+
continue; // Skip non-numeric
|
|
1176
|
+
if (value > 0 && value < min_arg)
|
|
1177
|
+
min_arg = value;
|
|
1178
|
+
}
|
|
1179
|
+
// Shift only if min_arg is less than next_pos
|
|
1180
|
+
const shift = min_arg === Infinity || min_arg >= next_pos
|
|
1181
|
+
? 0
|
|
1182
|
+
: Math.floor(Math.log2(next_pos / min_arg));
|
|
1183
|
+
for (const [key, value] of arg_entries) {
|
|
1184
|
+
if (!(key in result)) {
|
|
1185
|
+
result[key] = value === 0 ? 0 : value << shift;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return Object.freeze(result);
|
|
1189
|
+
}
|
|
1190
|
+
function l_merge_(obj_labels1, obj_labels2) {
|
|
1191
|
+
if (!obj_labels1 || typeof obj_labels1 !== 'object')
|
|
1192
|
+
throw new Error('obj_labels must be an object');
|
|
1193
|
+
const obj_1label1 = Object.values(obj_labels1);
|
|
1194
|
+
if (!obj_1label1.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1195
|
+
throw new Error('All values must be finite numbers');
|
|
1196
|
+
if (!obj_labels2 || typeof obj_labels2 !== 'object')
|
|
1197
|
+
throw new Error('obj_labels must be an object');
|
|
1198
|
+
const obj_1label2 = Object.values(obj_labels2);
|
|
1199
|
+
if (!obj_1label2.every(v => typeof v === 'number' && Number.isFinite(v)))
|
|
1200
|
+
throw new Error('All values must be finite numbers');
|
|
1201
|
+
const result = Object.create(null);
|
|
1202
|
+
Object.entries(obj_labels1).forEach(([k, v]) => {
|
|
1203
|
+
if (k !== '__proto__' && k !== 'constructor')
|
|
1204
|
+
result[k] = v;
|
|
1205
|
+
});
|
|
1206
|
+
const set_values = new Set(Object.values(obj_labels1)); // Track all used bit values
|
|
1207
|
+
// Find the highest bit position to start shifting from if needed
|
|
1208
|
+
const value_highest = Math.max(0, ...Array.from(set_values));
|
|
1209
|
+
let next_shift = value_highest ? Math.floor(Math.log2(value_highest)) + 1 : 0;
|
|
1210
|
+
// Process second set
|
|
1211
|
+
for (const [key, value] of Object.entries(obj_labels2)) {
|
|
1212
|
+
if (key in result) {
|
|
1213
|
+
// Same key: Values must match
|
|
1214
|
+
if (result[key] !== value) {
|
|
1215
|
+
throw new Error(`Key '${key}' has conflicting values: ${result[key]} (obj_labels1) vs ${value} (obj_labels2)`);
|
|
1216
|
+
}
|
|
1217
|
+
// No action needed if values match, already in result
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
let maxIterations = 1000;
|
|
1221
|
+
// New key: Add if value is unique, otherwise shift
|
|
1222
|
+
let value_new = value;
|
|
1223
|
+
while (set_values.has(value_new) && maxIterations--) {
|
|
1224
|
+
value_new = 1 << next_shift++;
|
|
1225
|
+
}
|
|
1226
|
+
if (maxIterations <= 0)
|
|
1227
|
+
throw new Error('Too many collisions in l_merge_');
|
|
1228
|
+
result[key] = value_new;
|
|
1229
|
+
set_values.add(value_new);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return Object.freeze(result);
|
|
1233
|
+
}
|
|
1127
1234
|
function l_LL_(obj, x) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
return Object.freeze(obj_new);
|
|
1235
|
+
if (!obj || typeof obj !== 'object')
|
|
1236
|
+
throw new Error('obj must be an object');
|
|
1237
|
+
if (!Number.isSafeInteger(x) || x < 0)
|
|
1238
|
+
throw new Error('Shift value must be a safe, non-negative integer');
|
|
1239
|
+
const obj_new = {};
|
|
1240
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1241
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
1242
|
+
continue; // Skip non-numeric
|
|
1243
|
+
obj_new[k] = v << x;
|
|
1244
|
+
}
|
|
1245
|
+
return Object.freeze(obj_new);
|
|
1140
1246
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1247
|
+
function l_RR_(obj, x) {
|
|
1248
|
+
if (!obj || typeof obj !== 'object')
|
|
1249
|
+
throw new Error('obj must be an object');
|
|
1250
|
+
if (!Number.isSafeInteger(x) || x < 0)
|
|
1251
|
+
throw new Error('Shift value must be a safe, non-negative integer');
|
|
1252
|
+
const obj_new = {};
|
|
1253
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1254
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
1255
|
+
continue; // Skip non-numeric
|
|
1256
|
+
obj_new[k] = v >> x;
|
|
1257
|
+
}
|
|
1258
|
+
return Object.freeze(obj_new);
|
|
1148
1259
|
}
|
|
1149
|
-
|
|
1150
1260
|
//-------------------------------------------------------------------------------------------------
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1261
|
+
function handler_default_( /* ... */) {
|
|
1262
|
+
// https://stackoverflow.com/questions/18746440/passing-multiple-arguments-to-console-log
|
|
1263
|
+
var args = Array.prototype.slice.call(arguments);
|
|
1264
|
+
console.log.apply(console, args);
|
|
1265
|
+
}
|
|
1266
|
+
function l_toBigInt_(obj_labels, obj, ignore = false) {
|
|
1267
|
+
if (!obj_labels || typeof obj_labels !== 'object')
|
|
1268
|
+
throw new Error('obj_labels must be an object');
|
|
1269
|
+
if (!obj || typeof obj !== 'object')
|
|
1270
|
+
throw new Error('obj must be an object');
|
|
1271
|
+
let bigint_l = BigInt(0);
|
|
1272
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
1273
|
+
if ((ignore || v) && obj_labels[k] !== undefined && typeof obj_labels[k] === 'number')
|
|
1274
|
+
bigint_l |= BigInt(obj_labels[k]);
|
|
1275
|
+
// console.log('0b'+ bigInt.toString(2) );
|
|
1276
|
+
}
|
|
1277
|
+
return bigint_l;
|
|
1278
|
+
}
|
|
1279
|
+
function lRef(initial) {
|
|
1280
|
+
if (arguments.length === 0 || initial === undefined) {
|
|
1281
|
+
return undefined;
|
|
1282
|
+
}
|
|
1283
|
+
let value = initial;
|
|
1284
|
+
return {
|
|
1285
|
+
get: () => value,
|
|
1286
|
+
set: (newVal) => { value = newVal; }
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
/*
|
|
1290
|
+
const l_ = {
|
|
1291
|
+
get VALIDATION() { return logr_.lref.get().VALIDATION; }
|
|
1165
1292
|
}
|
|
1166
1293
|
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1294
|
+
function createBitFlags(ref) {
|
|
1295
|
+
// Create a proxy so that any property access computes the current bit
|
|
1296
|
+
return new Proxy({}, {
|
|
1297
|
+
get(target, prop, receiver) {
|
|
1298
|
+
const positions = ref.get(); // get current { VALIDATION: n, ... }
|
|
1299
|
+
const position = positions[prop]; // e.g., positions['VALIDATION']
|
|
1171
1300
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1301
|
+
if (position === undefined) {
|
|
1302
|
+
// Optional: warn or return 0 for unknown keys
|
|
1303
|
+
console.warn(`Unknown bitflag key: ${String(prop)}`);
|
|
1304
|
+
return 0;
|
|
1305
|
+
}
|
|
1177
1306
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
return false;
|
|
1307
|
+
return 0b1 << position; // or 1 << position
|
|
1308
|
+
},
|
|
1181
1309
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
}
|
|
1310
|
+
// Optional: make Object.keys(l_) show the actual keys
|
|
1311
|
+
ownKeys(target) {
|
|
1312
|
+
return Object.keys(ref.get());
|
|
1313
|
+
},
|
|
1187
1314
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1315
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
1316
|
+
return {
|
|
1317
|
+
enumerable: true,
|
|
1318
|
+
configurable: true,
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1195
1323
|
|
|
1196
|
-
|
|
1197
|
-
set labels(obj) {
|
|
1198
|
-
_obj_labels = obj;
|
|
1199
|
-
_Bint_toggled = BigInt(0);
|
|
1200
|
-
},
|
|
1324
|
+
type BitPositions = Record<string, number>;
|
|
1201
1325
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1326
|
+
function createBitFlags<T extends BitPositions>(ref: { get: () => T }) {
|
|
1327
|
+
return new Proxy({} as { [K in keyof T]: number }, {
|
|
1328
|
+
get(target, prop: string | symbol) {
|
|
1329
|
+
if (typeof prop !== 'string') return undefined;
|
|
1330
|
+
const positions = ref.get();
|
|
1331
|
+
const position = positions[prop as keyof T];
|
|
1332
|
+
if (position === undefined) return 0;
|
|
1333
|
+
return 1 << position;
|
|
1334
|
+
},
|
|
1335
|
+
ownKeys() {
|
|
1336
|
+
return Object.keys(ref.get());
|
|
1337
|
+
},
|
|
1338
|
+
getOwnPropertyDescriptor() {
|
|
1339
|
+
return { enumerable: true, configurable: true };
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
*/
|
|
1344
|
+
function create_Referenced_l_(ref) {
|
|
1345
|
+
return new Proxy({}, {
|
|
1346
|
+
get(target, prop) {
|
|
1347
|
+
if (typeof prop !== 'string')
|
|
1348
|
+
return undefined;
|
|
1349
|
+
// if (prop === 'get') {
|
|
1350
|
+
// return () => {
|
|
1351
|
+
// const positions = ref.get();
|
|
1352
|
+
// const result: Partial<Record<keyof T, number>> = {};
|
|
1353
|
+
// for (const key in positions) {
|
|
1354
|
+
// result[key as keyof T] = positions[key];
|
|
1355
|
+
// }
|
|
1356
|
+
// return result as Record<keyof T, number>;
|
|
1357
|
+
// };
|
|
1358
|
+
// }
|
|
1359
|
+
if (prop === 'get')
|
|
1360
|
+
return () => ref.get();
|
|
1361
|
+
const positions = ref.get();
|
|
1362
|
+
const value = positions[prop];
|
|
1363
|
+
if (value === undefined)
|
|
1364
|
+
return 0;
|
|
1365
|
+
return value;
|
|
1366
|
+
},
|
|
1367
|
+
ownKeys() {
|
|
1368
|
+
return Object.keys(ref.get());
|
|
1369
|
+
},
|
|
1370
|
+
getOwnPropertyDescriptor() {
|
|
1371
|
+
return { enumerable: true, configurable: true };
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
const LOGR = (function () {
|
|
1376
|
+
let _instance; // Private variable to hold the single instance
|
|
1377
|
+
// Module-level state would work - but only when the module is loaded once.
|
|
1378
|
+
// Your bundler is currently bundling @knev/bitlogr into your distribution file,
|
|
1379
|
+
// creating a second copy. The Global Symbol approach would work around this,
|
|
1380
|
+
// but it's treating the symptom, not the cause.
|
|
1381
|
+
const GLOBAL_KEY = Symbol.for('@knev/bitlogr/LOGR');
|
|
1382
|
+
// The real issue is your build configuration bundling dependencies that should remain external.
|
|
1383
|
+
// rollup.config.mjs: external: ['@knev/bitlogr', 'uuid'], // Don't bundle these
|
|
1384
|
+
function _create_instance() {
|
|
1385
|
+
const _id = Math.random();
|
|
1386
|
+
if (globalThis.LOGR_ENABLED ?? true)
|
|
1387
|
+
console.log('creating LOGR instance:', _id);
|
|
1388
|
+
// Private state (replacing constructor properties)
|
|
1389
|
+
let _Bint_toggled = BigInt(0);
|
|
1390
|
+
let _handler_log = handler_default_;
|
|
1391
|
+
function _log_fxn(nr_logged, argsFn /* args */) {
|
|
1392
|
+
// console.log('_log_fxn: ', BigInt(nr_logged), _Bint_toggled, (BigInt(nr_logged) & _Bint_toggled));
|
|
1393
|
+
if ((BigInt(nr_logged) & _Bint_toggled) === BigInt(0))
|
|
1394
|
+
return;
|
|
1395
|
+
const args = argsFn();
|
|
1396
|
+
_handler_log.apply(this, args);
|
|
1397
|
+
}
|
|
1398
|
+
return {
|
|
1399
|
+
_id, // for testing
|
|
1400
|
+
get handler() { return _handler_log; },
|
|
1401
|
+
set handler(fx) {
|
|
1402
|
+
_handler_log = fx;
|
|
1403
|
+
},
|
|
1404
|
+
get toggled() { return _Bint_toggled; },
|
|
1405
|
+
// toggle(obj_labels, obj_toggled) {
|
|
1406
|
+
// _Bint_toggled= l_toBigInt_(obj_labels, obj_toggled);
|
|
1407
|
+
// },
|
|
1408
|
+
toggle(labels, obj_toggled) {
|
|
1409
|
+
const obj_labels = typeof labels?.get === 'function'
|
|
1410
|
+
? labels.get()
|
|
1411
|
+
: labels;
|
|
1412
|
+
// console.log('obj_labels', obj_labels)
|
|
1413
|
+
_Bint_toggled = l_toBigInt_(obj_labels, obj_toggled);
|
|
1414
|
+
},
|
|
1415
|
+
// Core internal log function (exposed only to created loggers)
|
|
1416
|
+
_log_fxn,
|
|
1417
|
+
create(options = {}) {
|
|
1418
|
+
// This constant will be replaced at build time
|
|
1419
|
+
if (!(globalThis.LOGR_ENABLED ?? true)) {
|
|
1420
|
+
return {
|
|
1421
|
+
_obj_labels: undefined, // optional: keep shape compatible if needed
|
|
1422
|
+
log: () => { }, // does nothing
|
|
1423
|
+
raw: () => { }, // does nothing
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
const _logger = {
|
|
1427
|
+
// _lref_labels: (options.arr_labels === undefined) ? undefined : lRef( l_array_(options.arr_labels) ),
|
|
1428
|
+
_lref_labels: (options.labels === undefined)
|
|
1429
|
+
? undefined
|
|
1430
|
+
: lRef(options.labels),
|
|
1431
|
+
get l() {
|
|
1432
|
+
// Always create a fresh proxy pointing to the current labels
|
|
1433
|
+
return create_Referenced_l_({
|
|
1434
|
+
get: () => this._lref_labels?.get() || {}
|
|
1435
|
+
});
|
|
1436
|
+
},
|
|
1437
|
+
get lref() { return this._lref_labels; },
|
|
1438
|
+
set lref(lref_labels_new) {
|
|
1439
|
+
this._lref_labels = lref_labels_new;
|
|
1440
|
+
},
|
|
1441
|
+
log(nr_logged, argsFn) {
|
|
1442
|
+
// This constant will be replaced at build time
|
|
1443
|
+
if (!(globalThis.LOGR_ENABLED ?? true))
|
|
1444
|
+
return;
|
|
1445
|
+
_log_fxn.call(this, nr_logged, argsFn);
|
|
1446
|
+
},
|
|
1447
|
+
// Optional shorthand for common cases
|
|
1448
|
+
raw(...args) {
|
|
1449
|
+
_handler_log.apply(this, args);
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
return _logger;
|
|
1453
|
+
},
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
// Public interface
|
|
1457
|
+
return {
|
|
1458
|
+
get_instance() {
|
|
1459
|
+
if (!(globalThis.LOGR_USE_GLOBAL_KEY ?? true)) {
|
|
1460
|
+
if (!_instance)
|
|
1461
|
+
_instance = _create_instance(); // Lazy initialization
|
|
1462
|
+
return _instance;
|
|
1463
|
+
}
|
|
1464
|
+
if (!globalThis[GLOBAL_KEY])
|
|
1465
|
+
globalThis[GLOBAL_KEY] = _create_instance();
|
|
1466
|
+
return globalThis[GLOBAL_KEY];
|
|
1467
|
+
},
|
|
1468
|
+
// For testing only - reset the singleton
|
|
1469
|
+
_reset_for_testing() {
|
|
1470
|
+
delete globalThis[GLOBAL_KEY];
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
})();
|
|
1207
1474
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1475
|
+
var logr_es = /*#__PURE__*/Object.freeze({
|
|
1476
|
+
__proto__: null,
|
|
1477
|
+
LOGR: LOGR,
|
|
1478
|
+
_create_Referenced_l: create_Referenced_l_,
|
|
1479
|
+
lRef: lRef,
|
|
1480
|
+
l_LL: l_LL_,
|
|
1481
|
+
l_RR: l_RR_,
|
|
1482
|
+
l_array: l_array_,
|
|
1483
|
+
l_concat: l_concat_,
|
|
1484
|
+
l_length: l_length_,
|
|
1485
|
+
l_merge: l_merge_
|
|
1486
|
+
});
|
|
1212
1487
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1488
|
+
function getAugmentedNamespace(n) {
|
|
1489
|
+
if (n.__esModule) return n;
|
|
1490
|
+
var f = n.default;
|
|
1491
|
+
if (typeof f == "function") {
|
|
1492
|
+
var a = function a () {
|
|
1493
|
+
if (this instanceof a) {
|
|
1494
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
1495
|
+
}
|
|
1496
|
+
return f.apply(this, arguments);
|
|
1217
1497
|
};
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1498
|
+
a.prototype = f.prototype;
|
|
1499
|
+
} else a = {};
|
|
1500
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
1501
|
+
Object.keys(n).forEach(function (k) {
|
|
1502
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1503
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1504
|
+
enumerable: true,
|
|
1505
|
+
get: function () {
|
|
1506
|
+
return n[k];
|
|
1225
1507
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
})();
|
|
1508
|
+
});
|
|
1509
|
+
});
|
|
1510
|
+
return a;
|
|
1511
|
+
}
|
|
1231
1512
|
|
|
1232
1513
|
var jsonMsg_cjs = {};
|
|
1233
1514
|
|
|
1515
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(logr_es);
|
|
1516
|
+
|
|
1234
1517
|
var hasRequiredJsonMsg_cjs;
|
|
1235
1518
|
|
|
1236
1519
|
function requireJsonMsg_cjs () {
|
|
1237
1520
|
if (hasRequiredJsonMsg_cjs) return jsonMsg_cjs;
|
|
1238
1521
|
hasRequiredJsonMsg_cjs = 1;
|
|
1239
1522
|
|
|
1523
|
+
var bitlogr = require$$0;
|
|
1524
|
+
|
|
1240
1525
|
const schema_Msg = validate18;
|
|
1241
1526
|
function validate18(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate18.evaluated; if (evaluated0.dynamicProps) {
|
|
1242
1527
|
evaluated0.props = undefined;
|
|
@@ -1406,105 +1691,12 @@ function requireJsonMsg_cjs () {
|
|
|
1406
1691
|
return _v4(options);
|
|
1407
1692
|
}
|
|
1408
1693
|
|
|
1409
|
-
// console.log('OUT', __name({variableName}) );
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
1694
|
//-------------------------------------------------------------------------------------------------
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
console.log.apply(console, args);
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1695
|
+
const LOGR_ = bitlogr.LOGR.get_instance();
|
|
1696
|
+
const logr_ = LOGR_.create({ labels: bitlogr.l_array(['VALIDATION', 'DROPS', 'HANDLERS']) });
|
|
1697
|
+
const l_ = logr_.l;
|
|
1698
|
+
// console.log('File location:', import.meta.url, '[Implementation]');
|
|
1420
1699
|
//-------------------------------------------------------------------------------------------------
|
|
1421
|
-
|
|
1422
|
-
function l_toBigInt_(obj_labels, obj, ignore= false) {
|
|
1423
|
-
if (! obj_labels || typeof obj_labels !== 'object')
|
|
1424
|
-
throw new Error('obj_labels must be an object');
|
|
1425
|
-
if (! obj || typeof obj !== 'object')
|
|
1426
|
-
throw new Error('obj must be an object');
|
|
1427
|
-
|
|
1428
|
-
let bigInt = BigInt(0);
|
|
1429
|
-
for (const [k,v] of Object.entries(obj)) {
|
|
1430
|
-
if ( ( ignore || v ) && obj_labels[k] !== undefined && typeof obj_labels[k] === 'number')
|
|
1431
|
-
bigInt|= BigInt( obj_labels[k] );
|
|
1432
|
-
// console.log('0b'+ bigInt.toString(2) );
|
|
1433
|
-
}
|
|
1434
|
-
return bigInt;
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
// console.log(l_toBigInt_({},{}))
|
|
1438
|
-
|
|
1439
|
-
const LOGR = (function () {
|
|
1440
|
-
let _instance; // Private variable to hold the single instance
|
|
1441
|
-
|
|
1442
|
-
function _create_instance() {
|
|
1443
|
-
// Private state (replacing constructor properties)
|
|
1444
|
-
let _handler_log = handler_default_;
|
|
1445
|
-
let _obj_labels = undefined;
|
|
1446
|
-
let _Bint_toggled = BigInt(0);
|
|
1447
|
-
|
|
1448
|
-
function _log_fxn(nr_logged, argsFn /* args */) {
|
|
1449
|
-
if ((BigInt(nr_logged) & _Bint_toggled) === BigInt(0))
|
|
1450
|
-
return false;
|
|
1451
|
-
|
|
1452
|
-
const args = argsFn();
|
|
1453
|
-
_handler_log.apply(this, args);
|
|
1454
|
-
// _handler_log.apply(this, args);
|
|
1455
|
-
return true;
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
return {
|
|
1459
|
-
set handler(fx) {
|
|
1460
|
-
_handler_log = fx;
|
|
1461
|
-
},
|
|
1462
|
-
get handler() {
|
|
1463
|
-
return _handler_log;
|
|
1464
|
-
},
|
|
1465
|
-
|
|
1466
|
-
get labels() { return _obj_labels; },
|
|
1467
|
-
set labels(obj) {
|
|
1468
|
-
_obj_labels = obj;
|
|
1469
|
-
_Bint_toggled = BigInt(0);
|
|
1470
|
-
},
|
|
1471
|
-
|
|
1472
|
-
// put= function(label, abbrv) {
|
|
1473
|
-
// let name= __name(label);
|
|
1474
|
-
// _labels[name]= label[name];
|
|
1475
|
-
// console.log(_labels);
|
|
1476
|
-
// }
|
|
1477
|
-
|
|
1478
|
-
get toggled() { return _Bint_toggled; },
|
|
1479
|
-
set toggled(obj_toggled) {
|
|
1480
|
-
_Bint_toggled= l_toBigInt_(_obj_labels, obj_toggled);
|
|
1481
|
-
},
|
|
1482
|
-
|
|
1483
|
-
log(nr_logged, argsFn) {
|
|
1484
|
-
|
|
1485
|
-
return _log_fxn.call(this, nr_logged, argsFn); // Pass the thunk
|
|
1486
|
-
}
|
|
1487
|
-
};
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
// Public interface
|
|
1491
|
-
return {
|
|
1492
|
-
get_instance() {
|
|
1493
|
-
if (!_instance) {
|
|
1494
|
-
_instance = _create_instance(); // Lazy initialization
|
|
1495
|
-
}
|
|
1496
|
-
return _instance;
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
|
-
})();
|
|
1501
|
-
|
|
1502
|
-
let LOGR_ = LOGR.get_instance();
|
|
1503
|
-
const log_ = LOGR_.log;
|
|
1504
|
-
const l_ = {
|
|
1505
|
-
VALIDATION: 0b1 << 0,
|
|
1506
|
-
};
|
|
1507
|
-
LOGR_.labels = l_;
|
|
1508
1700
|
// TODO: use RFC3339 "timestamp"? https://ajv.js.org/json-type-definition.html
|
|
1509
1701
|
// "module" pattern to avoid "static" and "#" private : https://stackoverflow.com/a/1479341/298545
|
|
1510
1702
|
var JSON_Msg = (function () {
|
|
@@ -1519,7 +1711,7 @@ function requireJsonMsg_cjs () {
|
|
|
1519
1711
|
validate: function (json) {
|
|
1520
1712
|
const b_valid = schema_Msg(json);
|
|
1521
1713
|
if (!b_valid)
|
|
1522
|
-
|
|
1714
|
+
logr_.log(l_.VALIDATION, () => ['JSON_Msg: validate: ', schema_Msg.errors]);
|
|
1523
1715
|
return b_valid;
|
|
1524
1716
|
},
|
|
1525
1717
|
// TODO: requires a separate ajv module require, and JTD specific schema
|
|
@@ -1541,7 +1733,7 @@ function requireJsonMsg_cjs () {
|
|
|
1541
1733
|
return false;
|
|
1542
1734
|
const b_valid = schema_MsgEffect(json);
|
|
1543
1735
|
if (!b_valid)
|
|
1544
|
-
|
|
1736
|
+
logr_.log(l_.VALIDATION, () => ['JSON_MsgEffect: validate: ', schema_MsgEffect.errors]);
|
|
1545
1737
|
return b_valid;
|
|
1546
1738
|
}
|
|
1547
1739
|
};
|
|
@@ -1568,7 +1760,7 @@ function requireJsonMsg_cjs () {
|
|
|
1568
1760
|
return false;
|
|
1569
1761
|
const b_valid = schema_MsgAckEffect(json);
|
|
1570
1762
|
if (!b_valid)
|
|
1571
|
-
|
|
1763
|
+
logr_.log(l_.VALIDATION, () => ['JSON_MsgAckEffect: validate: ', schema_MsgAckEffect.errors]);
|
|
1572
1764
|
return b_valid;
|
|
1573
1765
|
}
|
|
1574
1766
|
};
|
|
@@ -1577,24 +1769,20 @@ function requireJsonMsg_cjs () {
|
|
|
1577
1769
|
jsonMsg_cjs.JSON_Msg = JSON_Msg;
|
|
1578
1770
|
jsonMsg_cjs.JSON_MsgAck = JSON_MsgAck;
|
|
1579
1771
|
jsonMsg_cjs.JSON_MsgEffect = JSON_MsgEffect;
|
|
1580
|
-
jsonMsg_cjs.
|
|
1772
|
+
jsonMsg_cjs.logr = logr_;
|
|
1581
1773
|
return jsonMsg_cjs;
|
|
1582
1774
|
}
|
|
1583
1775
|
|
|
1584
1776
|
var jsonMsg_cjsExports = requireJsonMsg_cjs();
|
|
1585
1777
|
|
|
1586
|
-
let LOGR_ = LOGR.get_instance();
|
|
1587
|
-
const log_ = LOGR_.log;
|
|
1588
|
-
Object.assign(jsonMsg_cjsExports.l, l_LL_(jsonMsg_cjsExports.l, 2)); // VALIDATION : 4
|
|
1589
|
-
const l_ = {
|
|
1590
|
-
VALIDATION: 0b1 << 2, //4
|
|
1591
|
-
};
|
|
1592
|
-
LOGR_.labels = l_;
|
|
1593
|
-
LOGR_.toggled = {
|
|
1594
|
-
// VALIDATION : true
|
|
1595
|
-
};
|
|
1596
1778
|
const kstr_VERSION = "4";
|
|
1597
1779
|
// TODO: use RFC3339 "timestamp"? https://ajv.js.org/json-type-definition.html
|
|
1780
|
+
//-------------------------------------------------------------------------------------------------
|
|
1781
|
+
LOGR.get_instance();
|
|
1782
|
+
const obj_labels_shift_ = l_LL_(jsonMsg_cjsExports.logr.lref.get(), 2); // VALIDATION : 4
|
|
1783
|
+
jsonMsg_cjsExports.logr.lref.set(obj_labels_shift_);
|
|
1784
|
+
const l_ = jsonMsg_cjsExports.logr.l;
|
|
1785
|
+
//-------------------------------------------------------------------------------------------------
|
|
1598
1786
|
// const regex_IOI= new RegExp('\\bquery\\s*\\{\\s*IOI\\s*\\(\\s*pkg\\s*:\\s*"([^"]*)"\\s*\\)\\s*\\{.*heartbeat\\s*\\}\\s*\\}');
|
|
1599
1787
|
var JSON_MsgSubverseInfo_query = (function () {
|
|
1600
1788
|
return {
|
|
@@ -1607,7 +1795,7 @@ var JSON_MsgSubverseInfo_query = (function () {
|
|
|
1607
1795
|
// if (! JSON_Msg.validate(json))
|
|
1608
1796
|
// return false;
|
|
1609
1797
|
if (!schema_SubverseInfo_query(json)) {
|
|
1610
|
-
|
|
1798
|
+
jsonMsg_cjsExports.logr.log(l_.VALIDATION, () => ['schema_SubverseInfo_query_: validate: ', schema_SubverseInfo_query.errors]);
|
|
1611
1799
|
return false;
|
|
1612
1800
|
}
|
|
1613
1801
|
// const str_graphql = json["discovery"]["graphql"];
|
|
@@ -1634,7 +1822,7 @@ var JSON_MsgSubverseInfo_subverse = (function () {
|
|
|
1634
1822
|
if (!JSON_MsgSubverseInfo_query.validate(json_msg._cause))
|
|
1635
1823
|
return false;
|
|
1636
1824
|
if (!schema_SubverseInfo_subverse(json_msg)) {
|
|
1637
|
-
|
|
1825
|
+
jsonMsg_cjsExports.logr.log(l_.VALIDATION, () => ['JSON_SubverseInfo_expanse: validate: ', schema_SubverseInfo_subverse.errors]);
|
|
1638
1826
|
return false;
|
|
1639
1827
|
}
|
|
1640
1828
|
return true;
|
|
@@ -1655,7 +1843,7 @@ var JSON_MsgSubverseInfo_instances = (function () {
|
|
|
1655
1843
|
if (!JSON_MsgSubverseInfo_query.validate(json_msg._cause))
|
|
1656
1844
|
return false;
|
|
1657
1845
|
if (!schema_SubverseInfo_instances(json_msg)) {
|
|
1658
|
-
|
|
1846
|
+
jsonMsg_cjsExports.logr.log(l_.VALIDATION, () => ['JSON_SubverseInfo_instances: validate: ', schema_SubverseInfo_instances.errors]);
|
|
1659
1847
|
return false;
|
|
1660
1848
|
}
|
|
1661
1849
|
return true;
|
|
@@ -1666,4 +1854,4 @@ var JSON_MsgSubverseInfo_instances = (function () {
|
|
|
1666
1854
|
exports.JSON_MsgSubverseInfo_instances = JSON_MsgSubverseInfo_instances;
|
|
1667
1855
|
exports.JSON_MsgSubverseInfo_query = JSON_MsgSubverseInfo_query;
|
|
1668
1856
|
exports.JSON_MsgSubverseInfo_subverse = JSON_MsgSubverseInfo_subverse;
|
|
1669
|
-
exports.
|
|
1857
|
+
exports.logr = jsonMsg_cjsExports.logr;
|