@xyo-network/sdk-protocol 7.2.0 → 7.2.2
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.
|
@@ -1372,894 +1372,7 @@
|
|
|
1372
1372
|
}
|
|
1373
1373
|
};
|
|
1374
1374
|
|
|
1375
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
1376
|
-
var VERSION = "1.9.1";
|
|
1377
|
-
|
|
1378
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
1379
|
-
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
1380
|
-
function _makeCompatibilityCheck(ownVersion) {
|
|
1381
|
-
const acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
|
|
1382
|
-
const rejectedVersions = /* @__PURE__ */ new Set();
|
|
1383
|
-
const myVersionMatch = ownVersion.match(re);
|
|
1384
|
-
if (!myVersionMatch) {
|
|
1385
|
-
return () => false;
|
|
1386
|
-
}
|
|
1387
|
-
const ownVersionParsed = {
|
|
1388
|
-
major: +myVersionMatch[1],
|
|
1389
|
-
minor: +myVersionMatch[2],
|
|
1390
|
-
patch: +myVersionMatch[3],
|
|
1391
|
-
prerelease: myVersionMatch[4]
|
|
1392
|
-
};
|
|
1393
|
-
if (ownVersionParsed.prerelease != null) {
|
|
1394
|
-
return function isExactmatch(globalVersion) {
|
|
1395
|
-
return globalVersion === ownVersion;
|
|
1396
|
-
};
|
|
1397
|
-
}
|
|
1398
|
-
function _reject(v) {
|
|
1399
|
-
rejectedVersions.add(v);
|
|
1400
|
-
return false;
|
|
1401
|
-
}
|
|
1402
|
-
function _accept(v) {
|
|
1403
|
-
acceptedVersions.add(v);
|
|
1404
|
-
return true;
|
|
1405
|
-
}
|
|
1406
|
-
return function isCompatible2(globalVersion) {
|
|
1407
|
-
if (acceptedVersions.has(globalVersion)) {
|
|
1408
|
-
return true;
|
|
1409
|
-
}
|
|
1410
|
-
if (rejectedVersions.has(globalVersion)) {
|
|
1411
|
-
return false;
|
|
1412
|
-
}
|
|
1413
|
-
const globalVersionMatch = globalVersion.match(re);
|
|
1414
|
-
if (!globalVersionMatch) {
|
|
1415
|
-
return _reject(globalVersion);
|
|
1416
|
-
}
|
|
1417
|
-
const globalVersionParsed = {
|
|
1418
|
-
major: +globalVersionMatch[1],
|
|
1419
|
-
minor: +globalVersionMatch[2],
|
|
1420
|
-
patch: +globalVersionMatch[3],
|
|
1421
|
-
prerelease: globalVersionMatch[4]
|
|
1422
|
-
};
|
|
1423
|
-
if (globalVersionParsed.prerelease != null) {
|
|
1424
|
-
return _reject(globalVersion);
|
|
1425
|
-
}
|
|
1426
|
-
if (ownVersionParsed.major !== globalVersionParsed.major) {
|
|
1427
|
-
return _reject(globalVersion);
|
|
1428
|
-
}
|
|
1429
|
-
if (ownVersionParsed.major === 0) {
|
|
1430
|
-
if (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) {
|
|
1431
|
-
return _accept(globalVersion);
|
|
1432
|
-
}
|
|
1433
|
-
return _reject(globalVersion);
|
|
1434
|
-
}
|
|
1435
|
-
if (ownVersionParsed.minor <= globalVersionParsed.minor) {
|
|
1436
|
-
return _accept(globalVersion);
|
|
1437
|
-
}
|
|
1438
|
-
return _reject(globalVersion);
|
|
1439
|
-
};
|
|
1440
|
-
}
|
|
1441
|
-
var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
1442
|
-
|
|
1443
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
1444
|
-
var major = VERSION.split(".")[0];
|
|
1445
|
-
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for(`opentelemetry.js.api.${major}`);
|
|
1446
|
-
var _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
1447
|
-
function registerGlobal(type, instance, diag2, allowOverride = false) {
|
|
1448
|
-
var _a3;
|
|
1449
|
-
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a3 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a3 !== void 0 ? _a3 : {
|
|
1450
|
-
version: VERSION
|
|
1451
|
-
};
|
|
1452
|
-
if (!allowOverride && api[type]) {
|
|
1453
|
-
const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
|
|
1454
|
-
diag2.error(err.stack || err.message);
|
|
1455
|
-
return false;
|
|
1456
|
-
}
|
|
1457
|
-
if (api.version !== VERSION) {
|
|
1458
|
-
const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);
|
|
1459
|
-
diag2.error(err.stack || err.message);
|
|
1460
|
-
return false;
|
|
1461
|
-
}
|
|
1462
|
-
api[type] = instance;
|
|
1463
|
-
diag2.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);
|
|
1464
|
-
return true;
|
|
1465
|
-
}
|
|
1466
|
-
function getGlobal(type) {
|
|
1467
|
-
var _a3, _b;
|
|
1468
|
-
const globalVersion = (_a3 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a3 === void 0 ? void 0 : _a3.version;
|
|
1469
|
-
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
1470
|
-
return;
|
|
1471
|
-
}
|
|
1472
|
-
return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
|
|
1473
|
-
}
|
|
1474
|
-
function unregisterGlobal(type, diag2) {
|
|
1475
|
-
diag2.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);
|
|
1476
|
-
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
1477
|
-
if (api) {
|
|
1478
|
-
delete api[type];
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
1483
|
-
var DiagComponentLogger = class {
|
|
1484
|
-
constructor(props) {
|
|
1485
|
-
this._namespace = props.namespace || "DiagComponentLogger";
|
|
1486
|
-
}
|
|
1487
|
-
debug(...args) {
|
|
1488
|
-
return logProxy("debug", this._namespace, args);
|
|
1489
|
-
}
|
|
1490
|
-
error(...args) {
|
|
1491
|
-
return logProxy("error", this._namespace, args);
|
|
1492
|
-
}
|
|
1493
|
-
info(...args) {
|
|
1494
|
-
return logProxy("info", this._namespace, args);
|
|
1495
|
-
}
|
|
1496
|
-
warn(...args) {
|
|
1497
|
-
return logProxy("warn", this._namespace, args);
|
|
1498
|
-
}
|
|
1499
|
-
verbose(...args) {
|
|
1500
|
-
return logProxy("verbose", this._namespace, args);
|
|
1501
|
-
}
|
|
1502
|
-
};
|
|
1503
|
-
function logProxy(funcName, namespace, args) {
|
|
1504
|
-
const logger = getGlobal("diag");
|
|
1505
|
-
if (!logger) {
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
return logger[funcName](namespace, ...args);
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
1512
|
-
var DiagLogLevel;
|
|
1513
|
-
(function(DiagLogLevel2) {
|
|
1514
|
-
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
|
1515
|
-
DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
|
|
1516
|
-
DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
|
|
1517
|
-
DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
|
|
1518
|
-
DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
|
|
1519
|
-
DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
|
|
1520
|
-
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
|
1521
|
-
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
1522
|
-
|
|
1523
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
1524
|
-
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
1525
|
-
if (maxLevel < DiagLogLevel.NONE) {
|
|
1526
|
-
maxLevel = DiagLogLevel.NONE;
|
|
1527
|
-
} else if (maxLevel > DiagLogLevel.ALL) {
|
|
1528
|
-
maxLevel = DiagLogLevel.ALL;
|
|
1529
|
-
}
|
|
1530
|
-
logger = logger || {};
|
|
1531
|
-
function _filterFunc(funcName, theLevel) {
|
|
1532
|
-
const theFunc = logger[funcName];
|
|
1533
|
-
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
1534
|
-
return theFunc.bind(logger);
|
|
1535
|
-
}
|
|
1536
|
-
return function() {
|
|
1537
|
-
};
|
|
1538
|
-
}
|
|
1539
|
-
return {
|
|
1540
|
-
error: _filterFunc("error", DiagLogLevel.ERROR),
|
|
1541
|
-
warn: _filterFunc("warn", DiagLogLevel.WARN),
|
|
1542
|
-
info: _filterFunc("info", DiagLogLevel.INFO),
|
|
1543
|
-
debug: _filterFunc("debug", DiagLogLevel.DEBUG),
|
|
1544
|
-
verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
1549
|
-
var API_NAME = "diag";
|
|
1550
|
-
var DiagAPI = class _DiagAPI {
|
|
1551
|
-
/** Get the singleton instance of the DiagAPI API */
|
|
1552
|
-
static instance() {
|
|
1553
|
-
if (!this._instance) {
|
|
1554
|
-
this._instance = new _DiagAPI();
|
|
1555
|
-
}
|
|
1556
|
-
return this._instance;
|
|
1557
|
-
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Private internal constructor
|
|
1560
|
-
* @private
|
|
1561
|
-
*/
|
|
1562
|
-
constructor() {
|
|
1563
|
-
function _logProxy(funcName) {
|
|
1564
|
-
return function(...args) {
|
|
1565
|
-
const logger = getGlobal("diag");
|
|
1566
|
-
if (!logger)
|
|
1567
|
-
return;
|
|
1568
|
-
return logger[funcName](...args);
|
|
1569
|
-
};
|
|
1570
|
-
}
|
|
1571
|
-
const self2 = this;
|
|
1572
|
-
const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
|
|
1573
|
-
var _a3, _b, _c;
|
|
1574
|
-
if (logger === self2) {
|
|
1575
|
-
const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
1576
|
-
self2.error((_a3 = err.stack) !== null && _a3 !== void 0 ? _a3 : err.message);
|
|
1577
|
-
return false;
|
|
1578
|
-
}
|
|
1579
|
-
if (typeof optionsOrLogLevel === "number") {
|
|
1580
|
-
optionsOrLogLevel = {
|
|
1581
|
-
logLevel: optionsOrLogLevel
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
const oldLogger = getGlobal("diag");
|
|
1585
|
-
const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
1586
|
-
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
1587
|
-
const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
1588
|
-
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
|
1589
|
-
newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
|
|
1590
|
-
}
|
|
1591
|
-
return registerGlobal("diag", newLogger, self2, true);
|
|
1592
|
-
};
|
|
1593
|
-
self2.setLogger = setLogger;
|
|
1594
|
-
self2.disable = () => {
|
|
1595
|
-
unregisterGlobal(API_NAME, self2);
|
|
1596
|
-
};
|
|
1597
|
-
self2.createComponentLogger = (options) => {
|
|
1598
|
-
return new DiagComponentLogger(options);
|
|
1599
|
-
};
|
|
1600
|
-
self2.verbose = _logProxy("verbose");
|
|
1601
|
-
self2.debug = _logProxy("debug");
|
|
1602
|
-
self2.info = _logProxy("info");
|
|
1603
|
-
self2.warn = _logProxy("warn");
|
|
1604
|
-
self2.error = _logProxy("error");
|
|
1605
|
-
}
|
|
1606
|
-
};
|
|
1607
|
-
|
|
1608
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js
|
|
1609
|
-
var BaggageImpl = class _BaggageImpl {
|
|
1610
|
-
constructor(entries) {
|
|
1611
|
-
this._entries = entries ? new Map(entries) : /* @__PURE__ */ new Map();
|
|
1612
|
-
}
|
|
1613
|
-
getEntry(key) {
|
|
1614
|
-
const entry = this._entries.get(key);
|
|
1615
|
-
if (!entry) {
|
|
1616
|
-
return void 0;
|
|
1617
|
-
}
|
|
1618
|
-
return Object.assign({}, entry);
|
|
1619
|
-
}
|
|
1620
|
-
getAllEntries() {
|
|
1621
|
-
return Array.from(this._entries.entries());
|
|
1622
|
-
}
|
|
1623
|
-
setEntry(key, entry) {
|
|
1624
|
-
const newBaggage = new _BaggageImpl(this._entries);
|
|
1625
|
-
newBaggage._entries.set(key, entry);
|
|
1626
|
-
return newBaggage;
|
|
1627
|
-
}
|
|
1628
|
-
removeEntry(key) {
|
|
1629
|
-
const newBaggage = new _BaggageImpl(this._entries);
|
|
1630
|
-
newBaggage._entries.delete(key);
|
|
1631
|
-
return newBaggage;
|
|
1632
|
-
}
|
|
1633
|
-
removeEntries(...keys) {
|
|
1634
|
-
const newBaggage = new _BaggageImpl(this._entries);
|
|
1635
|
-
for (const key of keys) {
|
|
1636
|
-
newBaggage._entries.delete(key);
|
|
1637
|
-
}
|
|
1638
|
-
return newBaggage;
|
|
1639
|
-
}
|
|
1640
|
-
clear() {
|
|
1641
|
-
return new _BaggageImpl();
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
|
|
1645
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/utils.js
|
|
1646
|
-
var diag = DiagAPI.instance();
|
|
1647
|
-
function createBaggage(entries = {}) {
|
|
1648
|
-
return new BaggageImpl(new Map(Object.entries(entries)));
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
1652
|
-
function createContextKey(description) {
|
|
1653
|
-
return Symbol.for(description);
|
|
1654
|
-
}
|
|
1655
|
-
var BaseContext = class _BaseContext {
|
|
1656
|
-
/**
|
|
1657
|
-
* Construct a new context which inherits values from an optional parent context.
|
|
1658
|
-
*
|
|
1659
|
-
* @param parentContext a context from which to inherit values
|
|
1660
|
-
*/
|
|
1661
|
-
constructor(parentContext) {
|
|
1662
|
-
const self2 = this;
|
|
1663
|
-
self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
1664
|
-
self2.getValue = (key) => self2._currentContext.get(key);
|
|
1665
|
-
self2.setValue = (key, value) => {
|
|
1666
|
-
const context2 = new _BaseContext(self2._currentContext);
|
|
1667
|
-
context2._currentContext.set(key, value);
|
|
1668
|
-
return context2;
|
|
1669
|
-
};
|
|
1670
|
-
self2.deleteValue = (key) => {
|
|
1671
|
-
const context2 = new _BaseContext(self2._currentContext);
|
|
1672
|
-
context2._currentContext.delete(key);
|
|
1673
|
-
return context2;
|
|
1674
|
-
};
|
|
1675
|
-
}
|
|
1676
|
-
};
|
|
1677
|
-
var ROOT_CONTEXT = new BaseContext();
|
|
1678
|
-
|
|
1679
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js
|
|
1680
|
-
var defaultTextMapGetter = {
|
|
1681
|
-
get(carrier, key) {
|
|
1682
|
-
if (carrier == null) {
|
|
1683
|
-
return void 0;
|
|
1684
|
-
}
|
|
1685
|
-
return carrier[key];
|
|
1686
|
-
},
|
|
1687
|
-
keys(carrier) {
|
|
1688
|
-
if (carrier == null) {
|
|
1689
|
-
return [];
|
|
1690
|
-
}
|
|
1691
|
-
return Object.keys(carrier);
|
|
1692
|
-
}
|
|
1693
|
-
};
|
|
1694
|
-
var defaultTextMapSetter = {
|
|
1695
|
-
set(carrier, key, value) {
|
|
1696
|
-
if (carrier == null) {
|
|
1697
|
-
return;
|
|
1698
|
-
}
|
|
1699
|
-
carrier[key] = value;
|
|
1700
|
-
}
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
1704
|
-
var NoopContextManager = class {
|
|
1705
|
-
active() {
|
|
1706
|
-
return ROOT_CONTEXT;
|
|
1707
|
-
}
|
|
1708
|
-
with(_context, fn, thisArg, ...args) {
|
|
1709
|
-
return fn.call(thisArg, ...args);
|
|
1710
|
-
}
|
|
1711
|
-
bind(_context, target) {
|
|
1712
|
-
return target;
|
|
1713
|
-
}
|
|
1714
|
-
enable() {
|
|
1715
|
-
return this;
|
|
1716
|
-
}
|
|
1717
|
-
disable() {
|
|
1718
|
-
return this;
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1721
|
-
|
|
1722
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
1723
|
-
var API_NAME2 = "context";
|
|
1724
|
-
var NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
1725
|
-
var ContextAPI = class _ContextAPI {
|
|
1726
|
-
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
1727
|
-
constructor() {
|
|
1728
|
-
}
|
|
1729
|
-
/** Get the singleton instance of the Context API */
|
|
1730
|
-
static getInstance() {
|
|
1731
|
-
if (!this._instance) {
|
|
1732
|
-
this._instance = new _ContextAPI();
|
|
1733
|
-
}
|
|
1734
|
-
return this._instance;
|
|
1735
|
-
}
|
|
1736
|
-
/**
|
|
1737
|
-
* Set the current context manager.
|
|
1738
|
-
*
|
|
1739
|
-
* @returns true if the context manager was successfully registered, else false
|
|
1740
|
-
*/
|
|
1741
|
-
setGlobalContextManager(contextManager) {
|
|
1742
|
-
return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
|
|
1743
|
-
}
|
|
1744
|
-
/**
|
|
1745
|
-
* Get the currently active context
|
|
1746
|
-
*/
|
|
1747
|
-
active() {
|
|
1748
|
-
return this._getContextManager().active();
|
|
1749
|
-
}
|
|
1750
|
-
/**
|
|
1751
|
-
* Execute a function with an active context
|
|
1752
|
-
*
|
|
1753
|
-
* @param context context to be active during function execution
|
|
1754
|
-
* @param fn function to execute in a context
|
|
1755
|
-
* @param thisArg optional receiver to be used for calling fn
|
|
1756
|
-
* @param args optional arguments forwarded to fn
|
|
1757
|
-
*/
|
|
1758
|
-
with(context2, fn, thisArg, ...args) {
|
|
1759
|
-
return this._getContextManager().with(context2, fn, thisArg, ...args);
|
|
1760
|
-
}
|
|
1761
|
-
/**
|
|
1762
|
-
* Bind a context to a target function or event emitter
|
|
1763
|
-
*
|
|
1764
|
-
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
1765
|
-
* @param target function or event emitter to bind
|
|
1766
|
-
*/
|
|
1767
|
-
bind(context2, target) {
|
|
1768
|
-
return this._getContextManager().bind(context2, target);
|
|
1769
|
-
}
|
|
1770
|
-
_getContextManager() {
|
|
1771
|
-
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
1772
|
-
}
|
|
1773
|
-
/** Disable and remove the global context manager */
|
|
1774
|
-
disable() {
|
|
1775
|
-
this._getContextManager().disable();
|
|
1776
|
-
unregisterGlobal(API_NAME2, DiagAPI.instance());
|
|
1777
|
-
}
|
|
1778
|
-
};
|
|
1779
|
-
|
|
1780
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
1781
|
-
var TraceFlags;
|
|
1782
|
-
(function(TraceFlags2) {
|
|
1783
|
-
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
1784
|
-
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
1785
|
-
})(TraceFlags || (TraceFlags = {}));
|
|
1786
|
-
|
|
1787
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
1788
|
-
var INVALID_SPANID = "0000000000000000";
|
|
1789
|
-
var INVALID_TRACEID = "00000000000000000000000000000000";
|
|
1790
|
-
var INVALID_SPAN_CONTEXT = {
|
|
1791
|
-
traceId: INVALID_TRACEID,
|
|
1792
|
-
spanId: INVALID_SPANID,
|
|
1793
|
-
traceFlags: TraceFlags.NONE
|
|
1794
|
-
};
|
|
1795
|
-
|
|
1796
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
1797
|
-
var NonRecordingSpan = class {
|
|
1798
|
-
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
1799
|
-
this._spanContext = spanContext;
|
|
1800
|
-
}
|
|
1801
|
-
// Returns a SpanContext.
|
|
1802
|
-
spanContext() {
|
|
1803
|
-
return this._spanContext;
|
|
1804
|
-
}
|
|
1805
|
-
// By default does nothing
|
|
1806
|
-
setAttribute(_key, _value) {
|
|
1807
|
-
return this;
|
|
1808
|
-
}
|
|
1809
|
-
// By default does nothing
|
|
1810
|
-
setAttributes(_attributes) {
|
|
1811
|
-
return this;
|
|
1812
|
-
}
|
|
1813
|
-
// By default does nothing
|
|
1814
|
-
addEvent(_name, _attributes) {
|
|
1815
|
-
return this;
|
|
1816
|
-
}
|
|
1817
|
-
addLink(_link) {
|
|
1818
|
-
return this;
|
|
1819
|
-
}
|
|
1820
|
-
addLinks(_links) {
|
|
1821
|
-
return this;
|
|
1822
|
-
}
|
|
1823
|
-
// By default does nothing
|
|
1824
|
-
setStatus(_status) {
|
|
1825
|
-
return this;
|
|
1826
|
-
}
|
|
1827
|
-
// By default does nothing
|
|
1828
|
-
updateName(_name) {
|
|
1829
|
-
return this;
|
|
1830
|
-
}
|
|
1831
|
-
// By default does nothing
|
|
1832
|
-
end(_endTime) {
|
|
1833
|
-
}
|
|
1834
|
-
// isRecording always returns false for NonRecordingSpan.
|
|
1835
|
-
isRecording() {
|
|
1836
|
-
return false;
|
|
1837
|
-
}
|
|
1838
|
-
// By default does nothing
|
|
1839
|
-
recordException(_exception, _time) {
|
|
1840
|
-
}
|
|
1841
|
-
};
|
|
1842
|
-
|
|
1843
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
1844
|
-
var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
1845
|
-
function getSpan(context2) {
|
|
1846
|
-
return context2.getValue(SPAN_KEY) || void 0;
|
|
1847
|
-
}
|
|
1848
|
-
function getActiveSpan() {
|
|
1849
|
-
return getSpan(ContextAPI.getInstance().active());
|
|
1850
|
-
}
|
|
1851
|
-
function setSpan(context2, span) {
|
|
1852
|
-
return context2.setValue(SPAN_KEY, span);
|
|
1853
|
-
}
|
|
1854
|
-
function deleteSpan(context2) {
|
|
1855
|
-
return context2.deleteValue(SPAN_KEY);
|
|
1856
|
-
}
|
|
1857
|
-
function setSpanContext(context2, spanContext) {
|
|
1858
|
-
return setSpan(context2, new NonRecordingSpan(spanContext));
|
|
1859
|
-
}
|
|
1860
|
-
function getSpanContext(context2) {
|
|
1861
|
-
var _a3;
|
|
1862
|
-
return (_a3 = getSpan(context2)) === null || _a3 === void 0 ? void 0 : _a3.spanContext();
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
1866
|
-
var isHex = new Uint8Array([
|
|
1867
|
-
0,
|
|
1868
|
-
0,
|
|
1869
|
-
0,
|
|
1870
|
-
0,
|
|
1871
|
-
0,
|
|
1872
|
-
0,
|
|
1873
|
-
0,
|
|
1874
|
-
0,
|
|
1875
|
-
0,
|
|
1876
|
-
0,
|
|
1877
|
-
0,
|
|
1878
|
-
0,
|
|
1879
|
-
0,
|
|
1880
|
-
0,
|
|
1881
|
-
0,
|
|
1882
|
-
0,
|
|
1883
|
-
0,
|
|
1884
|
-
0,
|
|
1885
|
-
0,
|
|
1886
|
-
0,
|
|
1887
|
-
0,
|
|
1888
|
-
0,
|
|
1889
|
-
0,
|
|
1890
|
-
0,
|
|
1891
|
-
0,
|
|
1892
|
-
0,
|
|
1893
|
-
0,
|
|
1894
|
-
0,
|
|
1895
|
-
0,
|
|
1896
|
-
0,
|
|
1897
|
-
0,
|
|
1898
|
-
0,
|
|
1899
|
-
0,
|
|
1900
|
-
0,
|
|
1901
|
-
0,
|
|
1902
|
-
0,
|
|
1903
|
-
0,
|
|
1904
|
-
0,
|
|
1905
|
-
0,
|
|
1906
|
-
0,
|
|
1907
|
-
0,
|
|
1908
|
-
0,
|
|
1909
|
-
0,
|
|
1910
|
-
0,
|
|
1911
|
-
0,
|
|
1912
|
-
0,
|
|
1913
|
-
0,
|
|
1914
|
-
0,
|
|
1915
|
-
1,
|
|
1916
|
-
1,
|
|
1917
|
-
1,
|
|
1918
|
-
1,
|
|
1919
|
-
1,
|
|
1920
|
-
1,
|
|
1921
|
-
1,
|
|
1922
|
-
1,
|
|
1923
|
-
1,
|
|
1924
|
-
1,
|
|
1925
|
-
0,
|
|
1926
|
-
0,
|
|
1927
|
-
0,
|
|
1928
|
-
0,
|
|
1929
|
-
0,
|
|
1930
|
-
0,
|
|
1931
|
-
0,
|
|
1932
|
-
1,
|
|
1933
|
-
1,
|
|
1934
|
-
1,
|
|
1935
|
-
1,
|
|
1936
|
-
1,
|
|
1937
|
-
1,
|
|
1938
|
-
0,
|
|
1939
|
-
0,
|
|
1940
|
-
0,
|
|
1941
|
-
0,
|
|
1942
|
-
0,
|
|
1943
|
-
0,
|
|
1944
|
-
0,
|
|
1945
|
-
0,
|
|
1946
|
-
0,
|
|
1947
|
-
0,
|
|
1948
|
-
0,
|
|
1949
|
-
0,
|
|
1950
|
-
0,
|
|
1951
|
-
0,
|
|
1952
|
-
0,
|
|
1953
|
-
0,
|
|
1954
|
-
0,
|
|
1955
|
-
0,
|
|
1956
|
-
0,
|
|
1957
|
-
0,
|
|
1958
|
-
0,
|
|
1959
|
-
0,
|
|
1960
|
-
0,
|
|
1961
|
-
0,
|
|
1962
|
-
0,
|
|
1963
|
-
0,
|
|
1964
|
-
1,
|
|
1965
|
-
1,
|
|
1966
|
-
1,
|
|
1967
|
-
1,
|
|
1968
|
-
1,
|
|
1969
|
-
1
|
|
1970
|
-
]);
|
|
1971
|
-
function isValidHex(id, length) {
|
|
1972
|
-
if (typeof id !== "string" || id.length !== length)
|
|
1973
|
-
return false;
|
|
1974
|
-
let r = 0;
|
|
1975
|
-
for (let i = 0; i < id.length; i += 4) {
|
|
1976
|
-
r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
|
|
1977
|
-
}
|
|
1978
|
-
return r === length;
|
|
1979
|
-
}
|
|
1980
|
-
function isValidTraceId(traceId) {
|
|
1981
|
-
return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
|
|
1982
|
-
}
|
|
1983
|
-
function isValidSpanId(spanId) {
|
|
1984
|
-
return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
|
|
1985
|
-
}
|
|
1986
|
-
function isSpanContextValid(spanContext) {
|
|
1987
|
-
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
1988
|
-
}
|
|
1989
|
-
function wrapSpanContext(spanContext) {
|
|
1990
|
-
return new NonRecordingSpan(spanContext);
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
1994
|
-
var contextApi = ContextAPI.getInstance();
|
|
1995
|
-
var NoopTracer = class {
|
|
1996
|
-
// startSpan starts a noop span.
|
|
1997
|
-
startSpan(name, options, context2 = contextApi.active()) {
|
|
1998
|
-
const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
1999
|
-
if (root) {
|
|
2000
|
-
return new NonRecordingSpan();
|
|
2001
|
-
}
|
|
2002
|
-
const parentFromContext = context2 && getSpanContext(context2);
|
|
2003
|
-
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
2004
|
-
return new NonRecordingSpan(parentFromContext);
|
|
2005
|
-
} else {
|
|
2006
|
-
return new NonRecordingSpan();
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
startActiveSpan(name, arg2, arg3, arg4) {
|
|
2010
|
-
let opts;
|
|
2011
|
-
let ctx;
|
|
2012
|
-
let fn;
|
|
2013
|
-
if (arguments.length < 2) {
|
|
2014
|
-
return;
|
|
2015
|
-
} else if (arguments.length === 2) {
|
|
2016
|
-
fn = arg2;
|
|
2017
|
-
} else if (arguments.length === 3) {
|
|
2018
|
-
opts = arg2;
|
|
2019
|
-
fn = arg3;
|
|
2020
|
-
} else {
|
|
2021
|
-
opts = arg2;
|
|
2022
|
-
ctx = arg3;
|
|
2023
|
-
fn = arg4;
|
|
2024
|
-
}
|
|
2025
|
-
const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
2026
|
-
const span = this.startSpan(name, opts, parentContext);
|
|
2027
|
-
const contextWithSpanSet = setSpan(parentContext, span);
|
|
2028
|
-
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
2029
|
-
}
|
|
2030
|
-
};
|
|
2031
|
-
function isSpanContext(spanContext) {
|
|
2032
|
-
return spanContext !== null && typeof spanContext === "object" && "spanId" in spanContext && typeof spanContext["spanId"] === "string" && "traceId" in spanContext && typeof spanContext["traceId"] === "string" && "traceFlags" in spanContext && typeof spanContext["traceFlags"] === "number";
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
2036
|
-
var NOOP_TRACER = new NoopTracer();
|
|
2037
|
-
var ProxyTracer = class {
|
|
2038
|
-
constructor(provider, name, version2, options) {
|
|
2039
|
-
this._provider = provider;
|
|
2040
|
-
this.name = name;
|
|
2041
|
-
this.version = version2;
|
|
2042
|
-
this.options = options;
|
|
2043
|
-
}
|
|
2044
|
-
startSpan(name, options, context2) {
|
|
2045
|
-
return this._getTracer().startSpan(name, options, context2);
|
|
2046
|
-
}
|
|
2047
|
-
startActiveSpan(_name, _options, _context, _fn) {
|
|
2048
|
-
const tracer = this._getTracer();
|
|
2049
|
-
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
|
2050
|
-
}
|
|
2051
|
-
/**
|
|
2052
|
-
* Try to get a tracer from the proxy tracer provider.
|
|
2053
|
-
* If the proxy tracer provider has no delegate, return a noop tracer.
|
|
2054
|
-
*/
|
|
2055
|
-
_getTracer() {
|
|
2056
|
-
if (this._delegate) {
|
|
2057
|
-
return this._delegate;
|
|
2058
|
-
}
|
|
2059
|
-
const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
2060
|
-
if (!tracer) {
|
|
2061
|
-
return NOOP_TRACER;
|
|
2062
|
-
}
|
|
2063
|
-
this._delegate = tracer;
|
|
2064
|
-
return this._delegate;
|
|
2065
|
-
}
|
|
2066
|
-
};
|
|
2067
|
-
|
|
2068
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
2069
|
-
var NoopTracerProvider = class {
|
|
2070
|
-
getTracer(_name, _version, _options) {
|
|
2071
|
-
return new NoopTracer();
|
|
2072
|
-
}
|
|
2073
|
-
};
|
|
2074
|
-
|
|
2075
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
2076
|
-
var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
2077
|
-
var ProxyTracerProvider = class {
|
|
2078
|
-
/**
|
|
2079
|
-
* Get a {@link ProxyTracer}
|
|
2080
|
-
*/
|
|
2081
|
-
getTracer(name, version2, options) {
|
|
2082
|
-
var _a3;
|
|
2083
|
-
return (_a3 = this.getDelegateTracer(name, version2, options)) !== null && _a3 !== void 0 ? _a3 : new ProxyTracer(this, name, version2, options);
|
|
2084
|
-
}
|
|
2085
|
-
getDelegate() {
|
|
2086
|
-
var _a3;
|
|
2087
|
-
return (_a3 = this._delegate) !== null && _a3 !== void 0 ? _a3 : NOOP_TRACER_PROVIDER;
|
|
2088
|
-
}
|
|
2089
|
-
/**
|
|
2090
|
-
* Set the delegate tracer provider
|
|
2091
|
-
*/
|
|
2092
|
-
setDelegate(delegate) {
|
|
2093
|
-
this._delegate = delegate;
|
|
2094
|
-
}
|
|
2095
|
-
getDelegateTracer(name, version2, options) {
|
|
2096
|
-
var _a3;
|
|
2097
|
-
return (_a3 = this._delegate) === null || _a3 === void 0 ? void 0 : _a3.getTracer(name, version2, options);
|
|
2098
|
-
}
|
|
2099
|
-
};
|
|
2100
|
-
|
|
2101
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
2102
|
-
var SpanStatusCode;
|
|
2103
|
-
(function(SpanStatusCode2) {
|
|
2104
|
-
SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
|
|
2105
|
-
SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
|
|
2106
|
-
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
2107
|
-
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
2108
|
-
|
|
2109
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js
|
|
2110
|
-
var context = ContextAPI.getInstance();
|
|
2111
|
-
|
|
2112
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js
|
|
2113
|
-
var NoopTextMapPropagator = class {
|
|
2114
|
-
/** Noop inject function does nothing */
|
|
2115
|
-
inject(_context, _carrier) {
|
|
2116
|
-
}
|
|
2117
|
-
/** Noop extract function does nothing and returns the input context */
|
|
2118
|
-
extract(context2, _carrier) {
|
|
2119
|
-
return context2;
|
|
2120
|
-
}
|
|
2121
|
-
fields() {
|
|
2122
|
-
return [];
|
|
2123
|
-
}
|
|
2124
|
-
};
|
|
2125
|
-
|
|
2126
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js
|
|
2127
|
-
var BAGGAGE_KEY = createContextKey("OpenTelemetry Baggage Key");
|
|
2128
|
-
function getBaggage(context2) {
|
|
2129
|
-
return context2.getValue(BAGGAGE_KEY) || void 0;
|
|
2130
|
-
}
|
|
2131
|
-
function getActiveBaggage() {
|
|
2132
|
-
return getBaggage(ContextAPI.getInstance().active());
|
|
2133
|
-
}
|
|
2134
|
-
function setBaggage(context2, baggage) {
|
|
2135
|
-
return context2.setValue(BAGGAGE_KEY, baggage);
|
|
2136
|
-
}
|
|
2137
|
-
function deleteBaggage(context2) {
|
|
2138
|
-
return context2.deleteValue(BAGGAGE_KEY);
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/propagation.js
|
|
2142
|
-
var API_NAME3 = "propagation";
|
|
2143
|
-
var NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
|
|
2144
|
-
var PropagationAPI = class _PropagationAPI {
|
|
2145
|
-
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
2146
|
-
constructor() {
|
|
2147
|
-
this.createBaggage = createBaggage;
|
|
2148
|
-
this.getBaggage = getBaggage;
|
|
2149
|
-
this.getActiveBaggage = getActiveBaggage;
|
|
2150
|
-
this.setBaggage = setBaggage;
|
|
2151
|
-
this.deleteBaggage = deleteBaggage;
|
|
2152
|
-
}
|
|
2153
|
-
/** Get the singleton instance of the Propagator API */
|
|
2154
|
-
static getInstance() {
|
|
2155
|
-
if (!this._instance) {
|
|
2156
|
-
this._instance = new _PropagationAPI();
|
|
2157
|
-
}
|
|
2158
|
-
return this._instance;
|
|
2159
|
-
}
|
|
2160
|
-
/**
|
|
2161
|
-
* Set the current propagator.
|
|
2162
|
-
*
|
|
2163
|
-
* @returns true if the propagator was successfully registered, else false
|
|
2164
|
-
*/
|
|
2165
|
-
setGlobalPropagator(propagator) {
|
|
2166
|
-
return registerGlobal(API_NAME3, propagator, DiagAPI.instance());
|
|
2167
|
-
}
|
|
2168
|
-
/**
|
|
2169
|
-
* Inject context into a carrier to be propagated inter-process
|
|
2170
|
-
*
|
|
2171
|
-
* @param context Context carrying tracing data to inject
|
|
2172
|
-
* @param carrier carrier to inject context into
|
|
2173
|
-
* @param setter Function used to set values on the carrier
|
|
2174
|
-
*/
|
|
2175
|
-
inject(context2, carrier, setter = defaultTextMapSetter) {
|
|
2176
|
-
return this._getGlobalPropagator().inject(context2, carrier, setter);
|
|
2177
|
-
}
|
|
2178
|
-
/**
|
|
2179
|
-
* Extract context from a carrier
|
|
2180
|
-
*
|
|
2181
|
-
* @param context Context which the newly created context will inherit from
|
|
2182
|
-
* @param carrier Carrier to extract context from
|
|
2183
|
-
* @param getter Function used to extract keys from a carrier
|
|
2184
|
-
*/
|
|
2185
|
-
extract(context2, carrier, getter = defaultTextMapGetter) {
|
|
2186
|
-
return this._getGlobalPropagator().extract(context2, carrier, getter);
|
|
2187
|
-
}
|
|
2188
|
-
/**
|
|
2189
|
-
* Return a list of all fields which may be used by the propagator.
|
|
2190
|
-
*/
|
|
2191
|
-
fields() {
|
|
2192
|
-
return this._getGlobalPropagator().fields();
|
|
2193
|
-
}
|
|
2194
|
-
/** Remove the global propagator */
|
|
2195
|
-
disable() {
|
|
2196
|
-
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
2197
|
-
}
|
|
2198
|
-
_getGlobalPropagator() {
|
|
2199
|
-
return getGlobal(API_NAME3) || NOOP_TEXT_MAP_PROPAGATOR;
|
|
2200
|
-
}
|
|
2201
|
-
};
|
|
2202
|
-
|
|
2203
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/propagation-api.js
|
|
2204
|
-
var propagation = PropagationAPI.getInstance();
|
|
2205
|
-
|
|
2206
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
2207
|
-
var API_NAME4 = "trace";
|
|
2208
|
-
var TraceAPI = class _TraceAPI {
|
|
2209
|
-
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
2210
|
-
constructor() {
|
|
2211
|
-
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
2212
|
-
this.wrapSpanContext = wrapSpanContext;
|
|
2213
|
-
this.isSpanContextValid = isSpanContextValid;
|
|
2214
|
-
this.deleteSpan = deleteSpan;
|
|
2215
|
-
this.getSpan = getSpan;
|
|
2216
|
-
this.getActiveSpan = getActiveSpan;
|
|
2217
|
-
this.getSpanContext = getSpanContext;
|
|
2218
|
-
this.setSpan = setSpan;
|
|
2219
|
-
this.setSpanContext = setSpanContext;
|
|
2220
|
-
}
|
|
2221
|
-
/** Get the singleton instance of the Trace API */
|
|
2222
|
-
static getInstance() {
|
|
2223
|
-
if (!this._instance) {
|
|
2224
|
-
this._instance = new _TraceAPI();
|
|
2225
|
-
}
|
|
2226
|
-
return this._instance;
|
|
2227
|
-
}
|
|
2228
|
-
/**
|
|
2229
|
-
* Set the current global tracer.
|
|
2230
|
-
*
|
|
2231
|
-
* @returns true if the tracer provider was successfully registered, else false
|
|
2232
|
-
*/
|
|
2233
|
-
setGlobalTracerProvider(provider) {
|
|
2234
|
-
const success = registerGlobal(API_NAME4, this._proxyTracerProvider, DiagAPI.instance());
|
|
2235
|
-
if (success) {
|
|
2236
|
-
this._proxyTracerProvider.setDelegate(provider);
|
|
2237
|
-
}
|
|
2238
|
-
return success;
|
|
2239
|
-
}
|
|
2240
|
-
/**
|
|
2241
|
-
* Returns the global tracer provider.
|
|
2242
|
-
*/
|
|
2243
|
-
getTracerProvider() {
|
|
2244
|
-
return getGlobal(API_NAME4) || this._proxyTracerProvider;
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* Returns a tracer from the global tracer provider.
|
|
2248
|
-
*/
|
|
2249
|
-
getTracer(name, version2) {
|
|
2250
|
-
return this.getTracerProvider().getTracer(name, version2);
|
|
2251
|
-
}
|
|
2252
|
-
/** Remove the global tracer provider */
|
|
2253
|
-
disable() {
|
|
2254
|
-
unregisterGlobal(API_NAME4, DiagAPI.instance());
|
|
2255
|
-
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
2256
|
-
}
|
|
2257
|
-
};
|
|
2258
|
-
|
|
2259
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
2260
|
-
var trace = TraceAPI.getInstance();
|
|
2261
|
-
|
|
2262
|
-
// ../../node_modules/.pnpm/@ariestools+sdk@8.1.0_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/browser/index.mjs
|
|
1375
|
+
// ../../node_modules/.pnpm/@ariestools+sdk@8.1.2_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/browser/index.mjs
|
|
2263
1376
|
var __defProp = Object.defineProperty;
|
|
2264
1377
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2265
1378
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -2328,27 +1441,38 @@
|
|
|
2328
1441
|
return { type: "unknown" };
|
|
2329
1442
|
}
|
|
2330
1443
|
var FetchError = class extends Error {
|
|
1444
|
+
/** Cross-realm marker consumed by {@link isFetchError}. */
|
|
2331
1445
|
__fetchErrorMarker = fetchErrorMarker;
|
|
1446
|
+
/** Raw unparseable body text for `parse` failures. */
|
|
2332
1447
|
body;
|
|
1448
|
+
/** Node, undici, or TLS system error code when available. */
|
|
2333
1449
|
code;
|
|
1450
|
+
/** HTTP method associated with the failed request. */
|
|
2334
1451
|
method;
|
|
1452
|
+
/** Parsed response for rejected HTTP-status requests. */
|
|
2335
1453
|
response;
|
|
1454
|
+
/** HTTP status when a response was received. */
|
|
2336
1455
|
status;
|
|
1456
|
+
/** HTTP reason phrase when a response was received. */
|
|
2337
1457
|
statusText;
|
|
1458
|
+
/** Classified reason for the fetch failure. */
|
|
2338
1459
|
type;
|
|
1460
|
+
/** Request URL associated with the failure. */
|
|
2339
1461
|
url;
|
|
2340
|
-
|
|
2341
|
-
|
|
1462
|
+
/** Creates a structured fetch error from a message and request context. */
|
|
1463
|
+
constructor(message, context = {}) {
|
|
1464
|
+
super(message, { cause: context.cause });
|
|
2342
1465
|
this.name = "FetchError";
|
|
2343
|
-
this.type =
|
|
2344
|
-
this.code =
|
|
2345
|
-
this.url =
|
|
2346
|
-
this.method =
|
|
2347
|
-
this.status =
|
|
2348
|
-
this.statusText =
|
|
2349
|
-
this.response =
|
|
2350
|
-
this.body =
|
|
2351
|
-
}
|
|
1466
|
+
this.type = context.type ?? "unknown";
|
|
1467
|
+
this.code = context.code;
|
|
1468
|
+
this.url = context.url;
|
|
1469
|
+
this.method = context.method;
|
|
1470
|
+
this.status = context.status;
|
|
1471
|
+
this.statusText = context.statusText;
|
|
1472
|
+
this.response = context.response;
|
|
1473
|
+
this.body = context.body;
|
|
1474
|
+
}
|
|
1475
|
+
/** Returns a circular-reference-free representation for logs and telemetry. */
|
|
2352
1476
|
toJSON() {
|
|
2353
1477
|
return {
|
|
2354
1478
|
name: this.name,
|
|
@@ -2365,12 +1489,12 @@
|
|
|
2365
1489
|
function isFetchError(value) {
|
|
2366
1490
|
return value instanceof FetchError || typeof value === "object" && value !== null && value.__fetchErrorMarker === fetchErrorMarker;
|
|
2367
1491
|
}
|
|
2368
|
-
function toFetchError(error,
|
|
1492
|
+
function toFetchError(error, context = {}) {
|
|
2369
1493
|
if (isFetchError(error)) return error;
|
|
2370
1494
|
const { type, code } = classifyFetchError(error);
|
|
2371
1495
|
const message = error instanceof Error ? error.message : String(error);
|
|
2372
1496
|
return new FetchError(message, {
|
|
2373
|
-
...
|
|
1497
|
+
...context,
|
|
2374
1498
|
type,
|
|
2375
1499
|
code,
|
|
2376
1500
|
cause: error
|
|
@@ -2402,12 +1526,12 @@
|
|
|
2402
1526
|
throw toFetchError(error, { url: url.toString(), method: init.method });
|
|
2403
1527
|
}
|
|
2404
1528
|
}
|
|
2405
|
-
async function parseJsonResponse(response,
|
|
1529
|
+
async function parseJsonResponse(response, context = {}) {
|
|
2406
1530
|
let text;
|
|
2407
1531
|
try {
|
|
2408
1532
|
text = await response.text();
|
|
2409
1533
|
} catch (error) {
|
|
2410
|
-
throw toFetchError(error,
|
|
1534
|
+
throw toFetchError(error, context);
|
|
2411
1535
|
}
|
|
2412
1536
|
if (text.trim() === "") return null;
|
|
2413
1537
|
try {
|
|
@@ -2415,8 +1539,8 @@
|
|
|
2415
1539
|
} catch (error) {
|
|
2416
1540
|
throw new FetchError("Failed to parse response body as JSON", {
|
|
2417
1541
|
type: "parse",
|
|
2418
|
-
url:
|
|
2419
|
-
method:
|
|
1542
|
+
url: context.url,
|
|
1543
|
+
method: context.method,
|
|
2420
1544
|
status: response.status,
|
|
2421
1545
|
statusText: response.statusText,
|
|
2422
1546
|
body: text,
|
|
@@ -2434,7 +1558,9 @@
|
|
|
2434
1558
|
}
|
|
2435
1559
|
}
|
|
2436
1560
|
var FetchClientError = class extends FetchError {
|
|
1561
|
+
/** Effective request configuration, including the resolved request URL. */
|
|
2437
1562
|
config;
|
|
1563
|
+
/** Creates an HTTP-status error with its response and request configuration. */
|
|
2438
1564
|
constructor(message, response, config2) {
|
|
2439
1565
|
super(message, {
|
|
2440
1566
|
type: "http-status",
|
|
@@ -2472,13 +1598,17 @@
|
|
|
2472
1598
|
return url.href;
|
|
2473
1599
|
}
|
|
2474
1600
|
var FetchClient = class _FetchClient {
|
|
1601
|
+
/** Instance defaults shallow-merged beneath every request configuration. */
|
|
2475
1602
|
defaults;
|
|
1603
|
+
/** Creates a client with reusable request defaults. */
|
|
2476
1604
|
constructor(defaults = {}) {
|
|
2477
1605
|
this.defaults = defaults;
|
|
2478
1606
|
}
|
|
1607
|
+
/** Creates a client with the supplied request defaults. */
|
|
2479
1608
|
static create(config2) {
|
|
2480
1609
|
return new _FetchClient(config2);
|
|
2481
1610
|
}
|
|
1611
|
+
/** Sends a `DELETE` request and parses its response as JSON. */
|
|
2482
1612
|
delete(url, config2) {
|
|
2483
1613
|
return this.request({
|
|
2484
1614
|
...config2,
|
|
@@ -2486,6 +1616,7 @@
|
|
|
2486
1616
|
method: "DELETE"
|
|
2487
1617
|
});
|
|
2488
1618
|
}
|
|
1619
|
+
/** Sends a `GET` request and parses its response as JSON. */
|
|
2489
1620
|
get(url, config2) {
|
|
2490
1621
|
return this.request({
|
|
2491
1622
|
...config2,
|
|
@@ -2493,6 +1624,7 @@
|
|
|
2493
1624
|
method: "GET"
|
|
2494
1625
|
});
|
|
2495
1626
|
}
|
|
1627
|
+
/** Serializes `data`, sends a `PATCH` request, and parses the JSON response. */
|
|
2496
1628
|
patch(url, data, config2) {
|
|
2497
1629
|
return this.request({
|
|
2498
1630
|
...config2,
|
|
@@ -2501,6 +1633,7 @@
|
|
|
2501
1633
|
method: "PATCH"
|
|
2502
1634
|
});
|
|
2503
1635
|
}
|
|
1636
|
+
/** Serializes `data`, sends a `POST` request, and parses the JSON response. */
|
|
2504
1637
|
post(url, data, config2) {
|
|
2505
1638
|
return this.request({
|
|
2506
1639
|
...config2,
|
|
@@ -2509,6 +1642,7 @@
|
|
|
2509
1642
|
method: "POST"
|
|
2510
1643
|
});
|
|
2511
1644
|
}
|
|
1645
|
+
/** Serializes `data`, sends a `PUT` request, and parses the JSON response. */
|
|
2512
1646
|
put(url, data, config2) {
|
|
2513
1647
|
return this.request({
|
|
2514
1648
|
...config2,
|
|
@@ -2517,6 +1651,12 @@
|
|
|
2517
1651
|
method: "PUT"
|
|
2518
1652
|
});
|
|
2519
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Resolves and executes a request using native fetch semantics.
|
|
1656
|
+
* @returns Response metadata and parsed JSON, or `null` for an empty body.
|
|
1657
|
+
* @throws {@link FetchClientError} when `validateStatus` rejects the status.
|
|
1658
|
+
* @throws {@link FetchError} for transport or JSON parsing failures.
|
|
1659
|
+
*/
|
|
2520
1660
|
async request(config2) {
|
|
2521
1661
|
const merged = { ...this.defaults, ...config2 };
|
|
2522
1662
|
const url = buildURL(merged);
|
|
@@ -2550,9 +1690,11 @@
|
|
|
2550
1690
|
}
|
|
2551
1691
|
};
|
|
2552
1692
|
var FetchJsonClient = class _FetchJsonClient extends FetchClient {
|
|
1693
|
+
/** Creates a JSON client with reusable request and compression defaults. */
|
|
2553
1694
|
constructor(config2) {
|
|
2554
1695
|
super(config2);
|
|
2555
1696
|
}
|
|
1697
|
+
/** Creates a JSON client with the supplied defaults. */
|
|
2556
1698
|
static create(config2) {
|
|
2557
1699
|
return new _FetchJsonClient(config2);
|
|
2558
1700
|
}
|
|
@@ -2638,7 +1780,7 @@
|
|
|
2638
1780
|
if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4");
|
|
2639
1781
|
return nibbles;
|
|
2640
1782
|
};
|
|
2641
|
-
var
|
|
1783
|
+
var isHex = (value, config2) => {
|
|
2642
1784
|
if (typeof value !== "string") return false;
|
|
2643
1785
|
const valueCharLength = value.length - (config2?.prefix === true ? 2 : 0);
|
|
2644
1786
|
if (config2?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config2?.bitLength)) return false;
|
|
@@ -2653,7 +1795,7 @@
|
|
|
2653
1795
|
} = config2;
|
|
2654
1796
|
const nibbleBoundary = bitsToNibbles(byteSize);
|
|
2655
1797
|
const unEvened = (value.startsWith("0x") ? value.slice(2) : value).toLowerCase();
|
|
2656
|
-
if (
|
|
1798
|
+
if (isHex(unEvened)) {
|
|
2657
1799
|
const evenCharacters = unEvened.padStart(Math.ceil(unEvened.length / nibbleBoundary) * nibbleBoundary, "0");
|
|
2658
1800
|
const padded = isNumber(bitLength) ? evenCharacters.padStart(bitLength / 4, "0") : evenCharacters;
|
|
2659
1801
|
return (isPrefix ? `0x${padded}` : padded).toLowerCase();
|
|
@@ -2737,14 +1879,14 @@
|
|
|
2737
1879
|
var isEthAddress = (value, config2 = {}) => {
|
|
2738
1880
|
const { bitLength = 160, prefix: isPrefix = true } = config2;
|
|
2739
1881
|
const loweredValue = typeof value === "string" ? value.toLowerCase() : value;
|
|
2740
|
-
return
|
|
1882
|
+
return isHex(loweredValue, { bitLength, prefix: isPrefix });
|
|
2741
1883
|
};
|
|
2742
1884
|
var EthAddressZod = string2().check(
|
|
2743
1885
|
_regex(EthAddressRegEx, { error: "Invalid address format" }),
|
|
2744
1886
|
refine(isEthAddress)
|
|
2745
1887
|
);
|
|
2746
1888
|
var isHash = (value, bitLength = 256) => {
|
|
2747
|
-
return
|
|
1889
|
+
return isHex(value, { bitLength });
|
|
2748
1890
|
};
|
|
2749
1891
|
function asHash(value, assert) {
|
|
2750
1892
|
switch (typeof value) {
|
|
@@ -2782,8 +1924,11 @@
|
|
|
2782
1924
|
var MIN_GC_FREQUENCY = 1e3;
|
|
2783
1925
|
var MIN_HISTORY_INTERVAL = 1e3;
|
|
2784
1926
|
var Base = class _Base {
|
|
1927
|
+
/** Process-wide fallback logger used by instances without an explicit logger. */
|
|
2785
1928
|
static defaultLogger;
|
|
1929
|
+
/** Weak references grouped by runtime class name for diagnostic instance counts. */
|
|
2786
1930
|
static globalInstances = {};
|
|
1931
|
+
/** Recorded instance-count samples grouped by runtime class name. */
|
|
2787
1932
|
static globalInstancesCountHistory = {};
|
|
2788
1933
|
static _historyInterval = DEFAULT_HISTORY_INTERVAL;
|
|
2789
1934
|
static _historyTime = DEFAULT_HISTORY_TIME;
|
|
@@ -2791,46 +1936,69 @@
|
|
|
2791
1936
|
static _lastGC = 0;
|
|
2792
1937
|
static _maxGcFrequency = MAX_GC_FREQUENCY;
|
|
2793
1938
|
_params;
|
|
1939
|
+
/**
|
|
1940
|
+
* Stores the shared services and registers a weak reference for instance
|
|
1941
|
+
* diagnostics.
|
|
1942
|
+
* @param params - Logger and telemetry providers plus subclass parameters.
|
|
1943
|
+
*/
|
|
2794
1944
|
constructor(params) {
|
|
2795
1945
|
this._params = params;
|
|
2796
1946
|
params?.logger?.debug(`Base constructed [${this.constructor.name}]`);
|
|
2797
1947
|
this.recordInstance();
|
|
2798
1948
|
}
|
|
1949
|
+
/** Interval between instance-count samples, in milliseconds. */
|
|
2799
1950
|
static get historyInterval() {
|
|
2800
1951
|
return this._historyInterval;
|
|
2801
1952
|
}
|
|
1953
|
+
/**
|
|
1954
|
+
* Sets the sample interval, clamped to at least one second.
|
|
1955
|
+
* @throws When the requested interval exceeds {@link historyTime}.
|
|
1956
|
+
*/
|
|
2802
1957
|
static set historyInterval(value) {
|
|
2803
1958
|
assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`);
|
|
2804
1959
|
this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL);
|
|
2805
1960
|
}
|
|
1961
|
+
/** Configured retention window for instance-count history, in milliseconds. */
|
|
2806
1962
|
static get historyTime() {
|
|
2807
1963
|
return this._historyTime;
|
|
2808
1964
|
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Applies the requested history-time configuration.
|
|
1967
|
+
* @throws When the requested value is shorter than {@link historyInterval}.
|
|
1968
|
+
*/
|
|
2809
1969
|
static set historyTime(value) {
|
|
2810
1970
|
assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`);
|
|
2811
1971
|
this._historyInterval = value;
|
|
2812
1972
|
}
|
|
1973
|
+
/** Minimum elapsed time between unforced garbage-collection scans. */
|
|
2813
1974
|
static get maxGcFrequency() {
|
|
2814
1975
|
return this._maxGcFrequency;
|
|
2815
1976
|
}
|
|
1977
|
+
/** Sets the scan interval, clamped to at least one second. */
|
|
2816
1978
|
static set maxGcFrequency(value) {
|
|
2817
1979
|
this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY);
|
|
2818
1980
|
}
|
|
1981
|
+
/** Maximum number of samples retained for each runtime class. */
|
|
2819
1982
|
static get maxHistoryDepth() {
|
|
2820
1983
|
return Math.floor(this.historyTime / this.historyInterval);
|
|
2821
1984
|
}
|
|
1985
|
+
/** Explicit instance logger or the process-wide default logger. */
|
|
2822
1986
|
get logger() {
|
|
2823
1987
|
return this.params?.logger ?? _Base.defaultLogger;
|
|
2824
1988
|
}
|
|
1989
|
+
/** Meter created lazily from the configured provider for the runtime class. */
|
|
2825
1990
|
get meter() {
|
|
2826
1991
|
return this.params?.meterProvider?.getMeter(this.constructor.name);
|
|
2827
1992
|
}
|
|
1993
|
+
/** Construction parameters retained by this instance. */
|
|
2828
1994
|
get params() {
|
|
2829
1995
|
return this._params;
|
|
2830
1996
|
}
|
|
1997
|
+
/** Tracer created lazily from the configured provider for the runtime class. */
|
|
2831
1998
|
get tracer() {
|
|
2832
1999
|
return this.params?.traceProvider?.getTracer(this.constructor.name);
|
|
2833
2000
|
}
|
|
2001
|
+
/** Implements forced, frequency-limited, or class-specific cleanup. */
|
|
2834
2002
|
static gc(classNameOrForce = false) {
|
|
2835
2003
|
if (typeof classNameOrForce === "string") {
|
|
2836
2004
|
this.gcClass(classNameOrForce);
|
|
@@ -2840,15 +2008,18 @@
|
|
|
2840
2008
|
}
|
|
2841
2009
|
}
|
|
2842
2010
|
}
|
|
2011
|
+
/** Returns the currently tracked weak-reference count for a runtime class. */
|
|
2843
2012
|
static instanceCount(className) {
|
|
2844
2013
|
return this.globalInstances[className]?.length ?? 0;
|
|
2845
2014
|
}
|
|
2015
|
+
/** Runs eligible cleanup and returns counts for all tracked runtime classes. */
|
|
2846
2016
|
static instanceCounts() {
|
|
2847
2017
|
this.gc();
|
|
2848
2018
|
const result = {};
|
|
2849
2019
|
for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length;
|
|
2850
2020
|
return result;
|
|
2851
2021
|
}
|
|
2022
|
+
/** Starts periodic instance-count sampling, replacing an existing timer. */
|
|
2852
2023
|
static startHistory() {
|
|
2853
2024
|
if (this._historyTimeout !== void 0) {
|
|
2854
2025
|
this.stopHistory();
|
|
@@ -2862,6 +2033,7 @@
|
|
|
2862
2033
|
};
|
|
2863
2034
|
this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
|
|
2864
2035
|
}
|
|
2036
|
+
/** Stops periodic instance-count sampling when it is active. */
|
|
2865
2037
|
static stopHistory() {
|
|
2866
2038
|
if (this._historyTimeout === void 0) {
|
|
2867
2039
|
return;
|
|
@@ -3112,9 +2284,13 @@
|
|
|
3112
2284
|
static anyMap = /* @__PURE__ */ new WeakMap();
|
|
3113
2285
|
static eventsMap = /* @__PURE__ */ new WeakMap();
|
|
3114
2286
|
static isGlobalDebugEnabled = false;
|
|
3115
|
-
|
|
2287
|
+
/** Type-only event map exposed for consumers that need to infer event data. */
|
|
3116
2288
|
eventData = {};
|
|
3117
2289
|
_canEmitMetaEvents = false;
|
|
2290
|
+
/**
|
|
2291
|
+
* Creates isolated named and wildcard listener registries.
|
|
2292
|
+
* @param params - Base services and optional per-instance debug behavior.
|
|
2293
|
+
*/
|
|
3118
2294
|
constructor(params = {}) {
|
|
3119
2295
|
const mutatedParams = { ...params };
|
|
3120
2296
|
if (mutatedParams.debug) {
|
|
@@ -3144,6 +2320,7 @@
|
|
|
3144
2320
|
const env = processGlobal.process?.env;
|
|
3145
2321
|
return env?.DEBUG === "events" || env?.DEBUG === "*" || this.isGlobalDebugEnabled;
|
|
3146
2322
|
}
|
|
2323
|
+
/** Enables or disables process-wide event debug logging. */
|
|
3147
2324
|
static set isDebugEnabled(newValue) {
|
|
3148
2325
|
this.isGlobalDebugEnabled = newValue;
|
|
3149
2326
|
}
|
|
@@ -3421,9 +2598,10 @@
|
|
|
3421
2598
|
}
|
|
3422
2599
|
};
|
|
3423
2600
|
var BaseEmitter = class extends Base {
|
|
3424
|
-
|
|
2601
|
+
/** Type-only event map exposed for consumers that need to infer event data. */
|
|
3425
2602
|
eventData = {};
|
|
3426
2603
|
events;
|
|
2604
|
+
/** Creates an emitter with an isolated listener registry. */
|
|
3427
2605
|
constructor(params) {
|
|
3428
2606
|
super(params);
|
|
3429
2607
|
this.events = new Events();
|
|
@@ -3503,89 +2681,6 @@
|
|
|
3503
2681
|
return this.events.once(eventName, listener);
|
|
3504
2682
|
}
|
|
3505
2683
|
};
|
|
3506
|
-
async function timeBudget(name, logger, func, budget, status = false) {
|
|
3507
|
-
const start = Date.now();
|
|
3508
|
-
const timer = status ? setInterval(() => {
|
|
3509
|
-
const duration22 = Date.now() - start;
|
|
3510
|
-
if (budget > 0 && duration22 > budget) {
|
|
3511
|
-
logger?.warn(`Function [${name}] execution is exceeding budget: ${duration22}ms > ${budget}ms`);
|
|
3512
|
-
}
|
|
3513
|
-
}, Math.max(100, budget)) : void 0;
|
|
3514
|
-
const result = await func();
|
|
3515
|
-
const duration2 = Date.now() - start;
|
|
3516
|
-
if (timer === void 0 && budget > 0 && duration2 > budget) {
|
|
3517
|
-
logger?.warn(`Function [${name}] execution exceeded budget: ${duration2}ms > ${budget}ms`);
|
|
3518
|
-
}
|
|
3519
|
-
if (timer !== void 0) {
|
|
3520
|
-
clearInterval(timer);
|
|
3521
|
-
}
|
|
3522
|
-
return result;
|
|
3523
|
-
}
|
|
3524
|
-
function cloneContextWithoutSpan(activeCtx, configKeys = []) {
|
|
3525
|
-
let newCtx = ROOT_CONTEXT;
|
|
3526
|
-
const baggage = propagation.getBaggage(activeCtx);
|
|
3527
|
-
if (baggage) {
|
|
3528
|
-
newCtx = propagation.setBaggage(newCtx, baggage);
|
|
3529
|
-
}
|
|
3530
|
-
for (const key of configKeys) {
|
|
3531
|
-
const value = activeCtx.getValue(key);
|
|
3532
|
-
if (value !== void 0) {
|
|
3533
|
-
newCtx = newCtx.setValue(key, value);
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3536
|
-
return newCtx;
|
|
3537
|
-
}
|
|
3538
|
-
function spanRoot(name, fn, tracer) {
|
|
3539
|
-
const activeTracer = tracer ?? trace.getTracer(name);
|
|
3540
|
-
if (isDefined(activeTracer)) {
|
|
3541
|
-
const activeContext = context.active();
|
|
3542
|
-
const noSpanContext = cloneContextWithoutSpan(activeContext);
|
|
3543
|
-
const span2 = activeTracer.startSpan(name, {}, noSpanContext);
|
|
3544
|
-
return context.with(trace.setSpan(noSpanContext, span2), () => {
|
|
3545
|
-
try {
|
|
3546
|
-
const result = fn();
|
|
3547
|
-
span2.setStatus({ code: SpanStatusCode.OK });
|
|
3548
|
-
return result;
|
|
3549
|
-
} catch (ex) {
|
|
3550
|
-
const error = ex;
|
|
3551
|
-
span2.recordException(error);
|
|
3552
|
-
span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
3553
|
-
throw ex;
|
|
3554
|
-
} finally {
|
|
3555
|
-
span2.end();
|
|
3556
|
-
}
|
|
3557
|
-
});
|
|
3558
|
-
}
|
|
3559
|
-
return fn();
|
|
3560
|
-
}
|
|
3561
|
-
async function spanRootAsync(name, fn, {
|
|
3562
|
-
timeBudgetLimit,
|
|
3563
|
-
logger,
|
|
3564
|
-
tracer
|
|
3565
|
-
} = {}) {
|
|
3566
|
-
const funcToRun = isDefined(timeBudgetLimit) ? () => timeBudget(name, logger ?? console, fn, timeBudgetLimit) : fn;
|
|
3567
|
-
const activeTracer = tracer ?? trace.getTracer(name);
|
|
3568
|
-
if (isDefined(activeTracer)) {
|
|
3569
|
-
const activeContext = context.active();
|
|
3570
|
-
const noSpanContext = cloneContextWithoutSpan(activeContext);
|
|
3571
|
-
const span2 = activeTracer.startSpan(name, {}, noSpanContext);
|
|
3572
|
-
return await context.with(trace.setSpan(noSpanContext, span2), async () => {
|
|
3573
|
-
try {
|
|
3574
|
-
const result = await funcToRun();
|
|
3575
|
-
span2.setStatus({ code: SpanStatusCode.OK });
|
|
3576
|
-
return result;
|
|
3577
|
-
} catch (ex) {
|
|
3578
|
-
const error = ex;
|
|
3579
|
-
span2.recordException(error);
|
|
3580
|
-
span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
3581
|
-
throw ex;
|
|
3582
|
-
} finally {
|
|
3583
|
-
span2.end();
|
|
3584
|
-
}
|
|
3585
|
-
});
|
|
3586
|
-
}
|
|
3587
|
-
return await funcToRun();
|
|
3588
|
-
}
|
|
3589
2684
|
function creatable() {
|
|
3590
2685
|
return (constructor) => {
|
|
3591
2686
|
constructor;
|
|
@@ -3598,6 +2693,12 @@
|
|
|
3598
2693
|
defaultParams;
|
|
3599
2694
|
/** Labels identifying resources created by this factory. */
|
|
3600
2695
|
labels;
|
|
2696
|
+
/**
|
|
2697
|
+
* Creates a factory with reusable defaults and merged class labels.
|
|
2698
|
+
* @param creatable - Creatable constructor invoked by {@link create}.
|
|
2699
|
+
* @param params - Default parameters overridden by each create call.
|
|
2700
|
+
* @param labels - Labels merged over any static creatable labels.
|
|
2701
|
+
*/
|
|
3601
2702
|
constructor(creatable2, params, labels = {}) {
|
|
3602
2703
|
this.creatable = creatable2;
|
|
3603
2704
|
this.defaultParams = params;
|
|
@@ -3662,6 +2763,12 @@
|
|
|
3662
2763
|
_status = null;
|
|
3663
2764
|
_statusMutex = new Mutex();
|
|
3664
2765
|
_validatedParams;
|
|
2766
|
+
/**
|
|
2767
|
+
* Constructs an instance for the static creation pipeline.
|
|
2768
|
+
* @param key - Private construction token supplied by {@link create}.
|
|
2769
|
+
* @param params - Unvalidated parameters retained until first access.
|
|
2770
|
+
* @throws When called directly instead of through {@link create}.
|
|
2771
|
+
*/
|
|
3665
2772
|
constructor(key, params) {
|
|
3666
2773
|
assertEx(key === AbstractCreatableConstructorKey, () => "AbstractCreatable should not be instantiated directly, use the static create method instead");
|
|
3667
2774
|
super(params);
|
|
@@ -3741,27 +2848,6 @@
|
|
|
3741
2848
|
paramsValidator(params) {
|
|
3742
2849
|
return { ...params, name: params.name };
|
|
3743
2850
|
}
|
|
3744
|
-
/**
|
|
3745
|
-
* Executes a function within a telemetry span.
|
|
3746
|
-
* @param name - The span name
|
|
3747
|
-
* @param fn - The function to execute within the span
|
|
3748
|
-
*/
|
|
3749
|
-
span(name, fn) {
|
|
3750
|
-
return spanRoot(name, fn, this.tracer);
|
|
3751
|
-
}
|
|
3752
|
-
/**
|
|
3753
|
-
* Executes an async function within a telemetry span.
|
|
3754
|
-
* @param name - The span name
|
|
3755
|
-
* @param fn - The async function to execute within the span
|
|
3756
|
-
* @param config - Optional span configuration
|
|
3757
|
-
*/
|
|
3758
|
-
async spanAsync(name, fn, config2 = {}) {
|
|
3759
|
-
return await spanRootAsync(name, fn, {
|
|
3760
|
-
...config2,
|
|
3761
|
-
tracer: config2.tracer ?? this.tracer,
|
|
3762
|
-
logger: config2.logger ?? this.defaultLogger
|
|
3763
|
-
});
|
|
3764
|
-
}
|
|
3765
2851
|
/**
|
|
3766
2852
|
* Starts the instance, transitioning through 'starting' to 'started' status.
|
|
3767
2853
|
* Thread-safe via mutex. Returns true if already started or started successfully.
|
|
@@ -4110,95 +3196,8 @@
|
|
|
4110
3196
|
var asJsonObject = zodAsFactory(JsonObjectZod, "asJsonObject");
|
|
4111
3197
|
var toJsonObject = zodToFactory(JsonObjectZod, "toJsonObject");
|
|
4112
3198
|
var subtle = globalThis.crypto?.subtle;
|
|
4113
|
-
var color = (open, close = 39) => {
|
|
4114
|
-
return (value) => `\x1B[${open}m${value}\x1B[${close}m`;
|
|
4115
|
-
};
|
|
4116
|
-
var logColors = {
|
|
4117
|
-
green: color(32),
|
|
4118
|
-
grey: color(90),
|
|
4119
|
-
magenta: color(35),
|
|
4120
|
-
red: color(31),
|
|
4121
|
-
white: color(37),
|
|
4122
|
-
yellow: color(33)
|
|
4123
|
-
};
|
|
4124
|
-
function spanDurationInMillis(span2) {
|
|
4125
|
-
return span2.duration[0] * 1e3 + span2.duration[1] / 1e6;
|
|
4126
|
-
}
|
|
4127
|
-
var XyConsoleSpanExporterImplementation = class _XyConsoleSpanExporterImplementation {
|
|
4128
|
-
/** Duration thresholds (in ms) that map to increasing log levels. */
|
|
4129
|
-
static durationToLogLevel = [
|
|
4130
|
-
0,
|
|
4131
|
-
1,
|
|
4132
|
-
10,
|
|
4133
|
-
100,
|
|
4134
|
-
1e3
|
|
4135
|
-
];
|
|
4136
|
-
/** Chalk color functions corresponding to each log level. */
|
|
4137
|
-
static logLevelToChalkColor = [
|
|
4138
|
-
logColors.grey,
|
|
4139
|
-
logColors.white,
|
|
4140
|
-
logColors.green,
|
|
4141
|
-
logColors.yellow,
|
|
4142
|
-
logColors.red
|
|
4143
|
-
];
|
|
4144
|
-
logger;
|
|
4145
|
-
_logLevel;
|
|
4146
|
-
constructor(logLevel = 0, logger = console) {
|
|
4147
|
-
this._logLevel = logLevel;
|
|
4148
|
-
this.logger = logger;
|
|
4149
|
-
}
|
|
4150
|
-
/** The minimum log level required for a span to be exported. */
|
|
4151
|
-
get logLevel() {
|
|
4152
|
-
return this._logLevel;
|
|
4153
|
-
}
|
|
4154
|
-
export(spans, resultCallback) {
|
|
4155
|
-
for (const span2 of spans) {
|
|
4156
|
-
const spanLevel = this.spanLevel(span2);
|
|
4157
|
-
if (spanLevel < this.logLevel) {
|
|
4158
|
-
continue;
|
|
4159
|
-
}
|
|
4160
|
-
const duration2 = spanDurationInMillis(span2);
|
|
4161
|
-
this.logger.log(logColors.grey([
|
|
4162
|
-
`Span [${span2.name}]`,
|
|
4163
|
-
this.logColor(spanLevel)(`${duration2}ms`),
|
|
4164
|
-
`TraceId: ${span2.spanContext().traceId}`
|
|
4165
|
-
].join(", ")));
|
|
4166
|
-
}
|
|
4167
|
-
resultCallback?.({ code: 0 });
|
|
4168
|
-
}
|
|
4169
|
-
forceFlush() {
|
|
4170
|
-
return Promise.resolve();
|
|
4171
|
-
}
|
|
4172
|
-
/**
|
|
4173
|
-
* Returns the chalk color function for the given log level.
|
|
4174
|
-
* @param level - The log level index.
|
|
4175
|
-
* @returns A chalk color function.
|
|
4176
|
-
*/
|
|
4177
|
-
logColor(level) {
|
|
4178
|
-
return _XyConsoleSpanExporterImplementation.logLevelToChalkColor[level] ?? logColors.magenta;
|
|
4179
|
-
}
|
|
4180
|
-
shutdown() {
|
|
4181
|
-
return Promise.resolve();
|
|
4182
|
-
}
|
|
4183
|
-
/**
|
|
4184
|
-
* Determines the log level of a span based on its duration.
|
|
4185
|
-
* @param span - The span to evaluate.
|
|
4186
|
-
* @returns The numeric log level (index into durationToLogLevel).
|
|
4187
|
-
*/
|
|
4188
|
-
spanLevel(span2) {
|
|
4189
|
-
let logLevel = 0;
|
|
4190
|
-
const duration2 = spanDurationInMillis(span2);
|
|
4191
|
-
for (let x = _XyConsoleSpanExporterImplementation.durationToLogLevel.length - 1; x >= 0; x--) {
|
|
4192
|
-
if (duration2 > _XyConsoleSpanExporterImplementation.durationToLogLevel[x]) {
|
|
4193
|
-
logLevel = x;
|
|
4194
|
-
break;
|
|
4195
|
-
}
|
|
4196
|
-
}
|
|
4197
|
-
return logLevel;
|
|
4198
|
-
}
|
|
4199
|
-
};
|
|
4200
3199
|
|
|
4201
|
-
// ../../node_modules/.pnpm/@ariestools+threads@8.1.
|
|
3200
|
+
// ../../node_modules/.pnpm/@ariestools+threads@8.1.2_@opentelemetry+api@1.9.1_observable-fns@0.6.1_zod@4.4.3/node_modules/@ariestools/threads/dist/browser/worker/worker.browser.mjs
|
|
4202
3201
|
var DefaultErrorSerializer = {
|
|
4203
3202
|
deserialize: (message) => {
|
|
4204
3203
|
const error = Object.create(Error.prototype);
|
|
@@ -4502,7 +3501,7 @@
|
|
|
4502
3501
|
}
|
|
4503
3502
|
};
|
|
4504
3503
|
var _a2;
|
|
4505
|
-
function
|
|
3504
|
+
function getGlobal() {
|
|
4506
3505
|
if (typeof globalThis !== "undefined")
|
|
4507
3506
|
return globalThis;
|
|
4508
3507
|
if (typeof self !== "undefined")
|
|
@@ -4511,7 +3510,7 @@
|
|
|
4511
3510
|
return window;
|
|
4512
3511
|
return global;
|
|
4513
3512
|
}
|
|
4514
|
-
var globalObject =
|
|
3513
|
+
var globalObject = getGlobal();
|
|
4515
3514
|
var nodeBuffer = (_a2 = globalObject.Buffer) !== null && _a2 !== void 0 ? _a2 : null;
|
|
4516
3515
|
var textEncoder = globalObject.TextEncoder ? new globalObject.TextEncoder() : null;
|
|
4517
3516
|
function hexCharCodesToInt(a, b) {
|