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