node-consul-service 1.0.80 → 1.0.83
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/consul/httpStreamCaller.d.ts +10 -0
- package/dist/index.cjs.js +875 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +875 -7
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6,7 +6,9 @@ import require$$4 from 'https';
|
|
|
6
6
|
import require$$0$1 from 'url';
|
|
7
7
|
import require$$6, { promises } from 'fs';
|
|
8
8
|
import crypto from 'crypto';
|
|
9
|
-
import require$$4$
|
|
9
|
+
import require$$4$2 from 'assert';
|
|
10
|
+
import require$$0$2 from 'tty';
|
|
11
|
+
import require$$4$1 from 'net';
|
|
10
12
|
import zlib from 'zlib';
|
|
11
13
|
import { EventEmitter } from 'events';
|
|
12
14
|
|
|
@@ -15533,6 +15535,857 @@ var proxyFromEnv = /*@__PURE__*/getDefaultExportFromCjs(proxyFromEnvExports);
|
|
|
15533
15535
|
|
|
15534
15536
|
var followRedirects$1 = {exports: {}};
|
|
15535
15537
|
|
|
15538
|
+
var src = {exports: {}};
|
|
15539
|
+
|
|
15540
|
+
var browser = {exports: {}};
|
|
15541
|
+
|
|
15542
|
+
var debug = {exports: {}};
|
|
15543
|
+
|
|
15544
|
+
/**
|
|
15545
|
+
* Helpers.
|
|
15546
|
+
*/
|
|
15547
|
+
|
|
15548
|
+
var ms;
|
|
15549
|
+
var hasRequiredMs;
|
|
15550
|
+
|
|
15551
|
+
function requireMs () {
|
|
15552
|
+
if (hasRequiredMs) return ms;
|
|
15553
|
+
hasRequiredMs = 1;
|
|
15554
|
+
var s = 1000;
|
|
15555
|
+
var m = s * 60;
|
|
15556
|
+
var h = m * 60;
|
|
15557
|
+
var d = h * 24;
|
|
15558
|
+
var y = d * 365.25;
|
|
15559
|
+
|
|
15560
|
+
/**
|
|
15561
|
+
* Parse or format the given `val`.
|
|
15562
|
+
*
|
|
15563
|
+
* Options:
|
|
15564
|
+
*
|
|
15565
|
+
* - `long` verbose formatting [false]
|
|
15566
|
+
*
|
|
15567
|
+
* @param {String|Number} val
|
|
15568
|
+
* @param {Object} [options]
|
|
15569
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
15570
|
+
* @return {String|Number}
|
|
15571
|
+
* @api public
|
|
15572
|
+
*/
|
|
15573
|
+
|
|
15574
|
+
ms = function(val, options) {
|
|
15575
|
+
options = options || {};
|
|
15576
|
+
var type = typeof val;
|
|
15577
|
+
if (type === 'string' && val.length > 0) {
|
|
15578
|
+
return parse(val);
|
|
15579
|
+
} else if (type === 'number' && isNaN(val) === false) {
|
|
15580
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
15581
|
+
}
|
|
15582
|
+
throw new Error(
|
|
15583
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
15584
|
+
JSON.stringify(val)
|
|
15585
|
+
);
|
|
15586
|
+
};
|
|
15587
|
+
|
|
15588
|
+
/**
|
|
15589
|
+
* Parse the given `str` and return milliseconds.
|
|
15590
|
+
*
|
|
15591
|
+
* @param {String} str
|
|
15592
|
+
* @return {Number}
|
|
15593
|
+
* @api private
|
|
15594
|
+
*/
|
|
15595
|
+
|
|
15596
|
+
function parse(str) {
|
|
15597
|
+
str = String(str);
|
|
15598
|
+
if (str.length > 100) {
|
|
15599
|
+
return;
|
|
15600
|
+
}
|
|
15601
|
+
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
|
15602
|
+
str
|
|
15603
|
+
);
|
|
15604
|
+
if (!match) {
|
|
15605
|
+
return;
|
|
15606
|
+
}
|
|
15607
|
+
var n = parseFloat(match[1]);
|
|
15608
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
15609
|
+
switch (type) {
|
|
15610
|
+
case 'years':
|
|
15611
|
+
case 'year':
|
|
15612
|
+
case 'yrs':
|
|
15613
|
+
case 'yr':
|
|
15614
|
+
case 'y':
|
|
15615
|
+
return n * y;
|
|
15616
|
+
case 'days':
|
|
15617
|
+
case 'day':
|
|
15618
|
+
case 'd':
|
|
15619
|
+
return n * d;
|
|
15620
|
+
case 'hours':
|
|
15621
|
+
case 'hour':
|
|
15622
|
+
case 'hrs':
|
|
15623
|
+
case 'hr':
|
|
15624
|
+
case 'h':
|
|
15625
|
+
return n * h;
|
|
15626
|
+
case 'minutes':
|
|
15627
|
+
case 'minute':
|
|
15628
|
+
case 'mins':
|
|
15629
|
+
case 'min':
|
|
15630
|
+
case 'm':
|
|
15631
|
+
return n * m;
|
|
15632
|
+
case 'seconds':
|
|
15633
|
+
case 'second':
|
|
15634
|
+
case 'secs':
|
|
15635
|
+
case 'sec':
|
|
15636
|
+
case 's':
|
|
15637
|
+
return n * s;
|
|
15638
|
+
case 'milliseconds':
|
|
15639
|
+
case 'millisecond':
|
|
15640
|
+
case 'msecs':
|
|
15641
|
+
case 'msec':
|
|
15642
|
+
case 'ms':
|
|
15643
|
+
return n;
|
|
15644
|
+
default:
|
|
15645
|
+
return undefined;
|
|
15646
|
+
}
|
|
15647
|
+
}
|
|
15648
|
+
|
|
15649
|
+
/**
|
|
15650
|
+
* Short format for `ms`.
|
|
15651
|
+
*
|
|
15652
|
+
* @param {Number} ms
|
|
15653
|
+
* @return {String}
|
|
15654
|
+
* @api private
|
|
15655
|
+
*/
|
|
15656
|
+
|
|
15657
|
+
function fmtShort(ms) {
|
|
15658
|
+
if (ms >= d) {
|
|
15659
|
+
return Math.round(ms / d) + 'd';
|
|
15660
|
+
}
|
|
15661
|
+
if (ms >= h) {
|
|
15662
|
+
return Math.round(ms / h) + 'h';
|
|
15663
|
+
}
|
|
15664
|
+
if (ms >= m) {
|
|
15665
|
+
return Math.round(ms / m) + 'm';
|
|
15666
|
+
}
|
|
15667
|
+
if (ms >= s) {
|
|
15668
|
+
return Math.round(ms / s) + 's';
|
|
15669
|
+
}
|
|
15670
|
+
return ms + 'ms';
|
|
15671
|
+
}
|
|
15672
|
+
|
|
15673
|
+
/**
|
|
15674
|
+
* Long format for `ms`.
|
|
15675
|
+
*
|
|
15676
|
+
* @param {Number} ms
|
|
15677
|
+
* @return {String}
|
|
15678
|
+
* @api private
|
|
15679
|
+
*/
|
|
15680
|
+
|
|
15681
|
+
function fmtLong(ms) {
|
|
15682
|
+
return plural(ms, d, 'day') ||
|
|
15683
|
+
plural(ms, h, 'hour') ||
|
|
15684
|
+
plural(ms, m, 'minute') ||
|
|
15685
|
+
plural(ms, s, 'second') ||
|
|
15686
|
+
ms + ' ms';
|
|
15687
|
+
}
|
|
15688
|
+
|
|
15689
|
+
/**
|
|
15690
|
+
* Pluralization helper.
|
|
15691
|
+
*/
|
|
15692
|
+
|
|
15693
|
+
function plural(ms, n, name) {
|
|
15694
|
+
if (ms < n) {
|
|
15695
|
+
return;
|
|
15696
|
+
}
|
|
15697
|
+
if (ms < n * 1.5) {
|
|
15698
|
+
return Math.floor(ms / n) + ' ' + name;
|
|
15699
|
+
}
|
|
15700
|
+
return Math.ceil(ms / n) + ' ' + name + 's';
|
|
15701
|
+
}
|
|
15702
|
+
return ms;
|
|
15703
|
+
}
|
|
15704
|
+
|
|
15705
|
+
var hasRequiredDebug$1;
|
|
15706
|
+
|
|
15707
|
+
function requireDebug$1 () {
|
|
15708
|
+
if (hasRequiredDebug$1) return debug.exports;
|
|
15709
|
+
hasRequiredDebug$1 = 1;
|
|
15710
|
+
(function (module, exports) {
|
|
15711
|
+
/**
|
|
15712
|
+
* This is the common logic for both the Node.js and web browser
|
|
15713
|
+
* implementations of `debug()`.
|
|
15714
|
+
*
|
|
15715
|
+
* Expose `debug()` as the module.
|
|
15716
|
+
*/
|
|
15717
|
+
|
|
15718
|
+
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
|
15719
|
+
exports.coerce = coerce;
|
|
15720
|
+
exports.disable = disable;
|
|
15721
|
+
exports.enable = enable;
|
|
15722
|
+
exports.enabled = enabled;
|
|
15723
|
+
exports.humanize = requireMs();
|
|
15724
|
+
|
|
15725
|
+
/**
|
|
15726
|
+
* The currently active debug mode names, and names to skip.
|
|
15727
|
+
*/
|
|
15728
|
+
|
|
15729
|
+
exports.names = [];
|
|
15730
|
+
exports.skips = [];
|
|
15731
|
+
|
|
15732
|
+
/**
|
|
15733
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
15734
|
+
*
|
|
15735
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
15736
|
+
*/
|
|
15737
|
+
|
|
15738
|
+
exports.formatters = {};
|
|
15739
|
+
|
|
15740
|
+
/**
|
|
15741
|
+
* Previous log timestamp.
|
|
15742
|
+
*/
|
|
15743
|
+
|
|
15744
|
+
var prevTime;
|
|
15745
|
+
|
|
15746
|
+
/**
|
|
15747
|
+
* Select a color.
|
|
15748
|
+
* @param {String} namespace
|
|
15749
|
+
* @return {Number}
|
|
15750
|
+
* @api private
|
|
15751
|
+
*/
|
|
15752
|
+
|
|
15753
|
+
function selectColor(namespace) {
|
|
15754
|
+
var hash = 0, i;
|
|
15755
|
+
|
|
15756
|
+
for (i in namespace) {
|
|
15757
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
15758
|
+
hash |= 0; // Convert to 32bit integer
|
|
15759
|
+
}
|
|
15760
|
+
|
|
15761
|
+
return exports.colors[Math.abs(hash) % exports.colors.length];
|
|
15762
|
+
}
|
|
15763
|
+
|
|
15764
|
+
/**
|
|
15765
|
+
* Create a debugger with the given `namespace`.
|
|
15766
|
+
*
|
|
15767
|
+
* @param {String} namespace
|
|
15768
|
+
* @return {Function}
|
|
15769
|
+
* @api public
|
|
15770
|
+
*/
|
|
15771
|
+
|
|
15772
|
+
function createDebug(namespace) {
|
|
15773
|
+
|
|
15774
|
+
function debug() {
|
|
15775
|
+
// disabled?
|
|
15776
|
+
if (!debug.enabled) return;
|
|
15777
|
+
|
|
15778
|
+
var self = debug;
|
|
15779
|
+
|
|
15780
|
+
// set `diff` timestamp
|
|
15781
|
+
var curr = +new Date();
|
|
15782
|
+
var ms = curr - (prevTime || curr);
|
|
15783
|
+
self.diff = ms;
|
|
15784
|
+
self.prev = prevTime;
|
|
15785
|
+
self.curr = curr;
|
|
15786
|
+
prevTime = curr;
|
|
15787
|
+
|
|
15788
|
+
// turn the `arguments` into a proper Array
|
|
15789
|
+
var args = new Array(arguments.length);
|
|
15790
|
+
for (var i = 0; i < args.length; i++) {
|
|
15791
|
+
args[i] = arguments[i];
|
|
15792
|
+
}
|
|
15793
|
+
|
|
15794
|
+
args[0] = exports.coerce(args[0]);
|
|
15795
|
+
|
|
15796
|
+
if ('string' !== typeof args[0]) {
|
|
15797
|
+
// anything else let's inspect with %O
|
|
15798
|
+
args.unshift('%O');
|
|
15799
|
+
}
|
|
15800
|
+
|
|
15801
|
+
// apply any `formatters` transformations
|
|
15802
|
+
var index = 0;
|
|
15803
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
15804
|
+
// if we encounter an escaped % then don't increase the array index
|
|
15805
|
+
if (match === '%%') return match;
|
|
15806
|
+
index++;
|
|
15807
|
+
var formatter = exports.formatters[format];
|
|
15808
|
+
if ('function' === typeof formatter) {
|
|
15809
|
+
var val = args[index];
|
|
15810
|
+
match = formatter.call(self, val);
|
|
15811
|
+
|
|
15812
|
+
// now we need to remove `args[index]` since it's inlined in the `format`
|
|
15813
|
+
args.splice(index, 1);
|
|
15814
|
+
index--;
|
|
15815
|
+
}
|
|
15816
|
+
return match;
|
|
15817
|
+
});
|
|
15818
|
+
|
|
15819
|
+
// apply env-specific formatting (colors, etc.)
|
|
15820
|
+
exports.formatArgs.call(self, args);
|
|
15821
|
+
|
|
15822
|
+
var logFn = debug.log || exports.log || console.log.bind(console);
|
|
15823
|
+
logFn.apply(self, args);
|
|
15824
|
+
}
|
|
15825
|
+
|
|
15826
|
+
debug.namespace = namespace;
|
|
15827
|
+
debug.enabled = exports.enabled(namespace);
|
|
15828
|
+
debug.useColors = exports.useColors();
|
|
15829
|
+
debug.color = selectColor(namespace);
|
|
15830
|
+
|
|
15831
|
+
// env-specific initialization logic for debug instances
|
|
15832
|
+
if ('function' === typeof exports.init) {
|
|
15833
|
+
exports.init(debug);
|
|
15834
|
+
}
|
|
15835
|
+
|
|
15836
|
+
return debug;
|
|
15837
|
+
}
|
|
15838
|
+
|
|
15839
|
+
/**
|
|
15840
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
15841
|
+
* separated by a colon and wildcards.
|
|
15842
|
+
*
|
|
15843
|
+
* @param {String} namespaces
|
|
15844
|
+
* @api public
|
|
15845
|
+
*/
|
|
15846
|
+
|
|
15847
|
+
function enable(namespaces) {
|
|
15848
|
+
exports.save(namespaces);
|
|
15849
|
+
|
|
15850
|
+
exports.names = [];
|
|
15851
|
+
exports.skips = [];
|
|
15852
|
+
|
|
15853
|
+
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
15854
|
+
var len = split.length;
|
|
15855
|
+
|
|
15856
|
+
for (var i = 0; i < len; i++) {
|
|
15857
|
+
if (!split[i]) continue; // ignore empty strings
|
|
15858
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
15859
|
+
if (namespaces[0] === '-') {
|
|
15860
|
+
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
15861
|
+
} else {
|
|
15862
|
+
exports.names.push(new RegExp('^' + namespaces + '$'));
|
|
15863
|
+
}
|
|
15864
|
+
}
|
|
15865
|
+
}
|
|
15866
|
+
|
|
15867
|
+
/**
|
|
15868
|
+
* Disable debug output.
|
|
15869
|
+
*
|
|
15870
|
+
* @api public
|
|
15871
|
+
*/
|
|
15872
|
+
|
|
15873
|
+
function disable() {
|
|
15874
|
+
exports.enable('');
|
|
15875
|
+
}
|
|
15876
|
+
|
|
15877
|
+
/**
|
|
15878
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
15879
|
+
*
|
|
15880
|
+
* @param {String} name
|
|
15881
|
+
* @return {Boolean}
|
|
15882
|
+
* @api public
|
|
15883
|
+
*/
|
|
15884
|
+
|
|
15885
|
+
function enabled(name) {
|
|
15886
|
+
var i, len;
|
|
15887
|
+
for (i = 0, len = exports.skips.length; i < len; i++) {
|
|
15888
|
+
if (exports.skips[i].test(name)) {
|
|
15889
|
+
return false;
|
|
15890
|
+
}
|
|
15891
|
+
}
|
|
15892
|
+
for (i = 0, len = exports.names.length; i < len; i++) {
|
|
15893
|
+
if (exports.names[i].test(name)) {
|
|
15894
|
+
return true;
|
|
15895
|
+
}
|
|
15896
|
+
}
|
|
15897
|
+
return false;
|
|
15898
|
+
}
|
|
15899
|
+
|
|
15900
|
+
/**
|
|
15901
|
+
* Coerce `val`.
|
|
15902
|
+
*
|
|
15903
|
+
* @param {Mixed} val
|
|
15904
|
+
* @return {Mixed}
|
|
15905
|
+
* @api private
|
|
15906
|
+
*/
|
|
15907
|
+
|
|
15908
|
+
function coerce(val) {
|
|
15909
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
15910
|
+
return val;
|
|
15911
|
+
}
|
|
15912
|
+
} (debug, debug.exports));
|
|
15913
|
+
return debug.exports;
|
|
15914
|
+
}
|
|
15915
|
+
|
|
15916
|
+
/**
|
|
15917
|
+
* This is the web browser implementation of `debug()`.
|
|
15918
|
+
*
|
|
15919
|
+
* Expose `debug()` as the module.
|
|
15920
|
+
*/
|
|
15921
|
+
|
|
15922
|
+
var hasRequiredBrowser;
|
|
15923
|
+
|
|
15924
|
+
function requireBrowser () {
|
|
15925
|
+
if (hasRequiredBrowser) return browser.exports;
|
|
15926
|
+
hasRequiredBrowser = 1;
|
|
15927
|
+
(function (module, exports) {
|
|
15928
|
+
exports = module.exports = requireDebug$1();
|
|
15929
|
+
exports.log = log;
|
|
15930
|
+
exports.formatArgs = formatArgs;
|
|
15931
|
+
exports.save = save;
|
|
15932
|
+
exports.load = load;
|
|
15933
|
+
exports.useColors = useColors;
|
|
15934
|
+
exports.storage = 'undefined' != typeof chrome
|
|
15935
|
+
&& 'undefined' != typeof chrome.storage
|
|
15936
|
+
? chrome.storage.local
|
|
15937
|
+
: localstorage();
|
|
15938
|
+
|
|
15939
|
+
/**
|
|
15940
|
+
* Colors.
|
|
15941
|
+
*/
|
|
15942
|
+
|
|
15943
|
+
exports.colors = [
|
|
15944
|
+
'lightseagreen',
|
|
15945
|
+
'forestgreen',
|
|
15946
|
+
'goldenrod',
|
|
15947
|
+
'dodgerblue',
|
|
15948
|
+
'darkorchid',
|
|
15949
|
+
'crimson'
|
|
15950
|
+
];
|
|
15951
|
+
|
|
15952
|
+
/**
|
|
15953
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
15954
|
+
* and the Firebug extension (any Firefox version) are known
|
|
15955
|
+
* to support "%c" CSS customizations.
|
|
15956
|
+
*
|
|
15957
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
15958
|
+
*/
|
|
15959
|
+
|
|
15960
|
+
function useColors() {
|
|
15961
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
15962
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
15963
|
+
// explicitly
|
|
15964
|
+
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
|
15965
|
+
return true;
|
|
15966
|
+
}
|
|
15967
|
+
|
|
15968
|
+
// is webkit? http://stackoverflow.com/a/16459606/376773
|
|
15969
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
15970
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
15971
|
+
// is firebug? http://stackoverflow.com/a/398120/376773
|
|
15972
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
15973
|
+
// is firefox >= v31?
|
|
15974
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
15975
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
15976
|
+
// double check webkit in userAgent just in case we are in a worker
|
|
15977
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
15978
|
+
}
|
|
15979
|
+
|
|
15980
|
+
/**
|
|
15981
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
15982
|
+
*/
|
|
15983
|
+
|
|
15984
|
+
exports.formatters.j = function(v) {
|
|
15985
|
+
try {
|
|
15986
|
+
return JSON.stringify(v);
|
|
15987
|
+
} catch (err) {
|
|
15988
|
+
return '[UnexpectedJSONParseError]: ' + err.message;
|
|
15989
|
+
}
|
|
15990
|
+
};
|
|
15991
|
+
|
|
15992
|
+
|
|
15993
|
+
/**
|
|
15994
|
+
* Colorize log arguments if enabled.
|
|
15995
|
+
*
|
|
15996
|
+
* @api public
|
|
15997
|
+
*/
|
|
15998
|
+
|
|
15999
|
+
function formatArgs(args) {
|
|
16000
|
+
var useColors = this.useColors;
|
|
16001
|
+
|
|
16002
|
+
args[0] = (useColors ? '%c' : '')
|
|
16003
|
+
+ this.namespace
|
|
16004
|
+
+ (useColors ? ' %c' : ' ')
|
|
16005
|
+
+ args[0]
|
|
16006
|
+
+ (useColors ? '%c ' : ' ')
|
|
16007
|
+
+ '+' + exports.humanize(this.diff);
|
|
16008
|
+
|
|
16009
|
+
if (!useColors) return;
|
|
16010
|
+
|
|
16011
|
+
var c = 'color: ' + this.color;
|
|
16012
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
16013
|
+
|
|
16014
|
+
// the final "%c" is somewhat tricky, because there could be other
|
|
16015
|
+
// arguments passed either before or after the %c, so we need to
|
|
16016
|
+
// figure out the correct index to insert the CSS into
|
|
16017
|
+
var index = 0;
|
|
16018
|
+
var lastC = 0;
|
|
16019
|
+
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
16020
|
+
if ('%%' === match) return;
|
|
16021
|
+
index++;
|
|
16022
|
+
if ('%c' === match) {
|
|
16023
|
+
// we only are interested in the *last* %c
|
|
16024
|
+
// (the user may have provided their own)
|
|
16025
|
+
lastC = index;
|
|
16026
|
+
}
|
|
16027
|
+
});
|
|
16028
|
+
|
|
16029
|
+
args.splice(lastC, 0, c);
|
|
16030
|
+
}
|
|
16031
|
+
|
|
16032
|
+
/**
|
|
16033
|
+
* Invokes `console.log()` when available.
|
|
16034
|
+
* No-op when `console.log` is not a "function".
|
|
16035
|
+
*
|
|
16036
|
+
* @api public
|
|
16037
|
+
*/
|
|
16038
|
+
|
|
16039
|
+
function log() {
|
|
16040
|
+
// this hackery is required for IE8/9, where
|
|
16041
|
+
// the `console.log` function doesn't have 'apply'
|
|
16042
|
+
return 'object' === typeof console
|
|
16043
|
+
&& console.log
|
|
16044
|
+
&& Function.prototype.apply.call(console.log, console, arguments);
|
|
16045
|
+
}
|
|
16046
|
+
|
|
16047
|
+
/**
|
|
16048
|
+
* Save `namespaces`.
|
|
16049
|
+
*
|
|
16050
|
+
* @param {String} namespaces
|
|
16051
|
+
* @api private
|
|
16052
|
+
*/
|
|
16053
|
+
|
|
16054
|
+
function save(namespaces) {
|
|
16055
|
+
try {
|
|
16056
|
+
if (null == namespaces) {
|
|
16057
|
+
exports.storage.removeItem('debug');
|
|
16058
|
+
} else {
|
|
16059
|
+
exports.storage.debug = namespaces;
|
|
16060
|
+
}
|
|
16061
|
+
} catch(e) {}
|
|
16062
|
+
}
|
|
16063
|
+
|
|
16064
|
+
/**
|
|
16065
|
+
* Load `namespaces`.
|
|
16066
|
+
*
|
|
16067
|
+
* @return {String} returns the previously persisted debug modes
|
|
16068
|
+
* @api private
|
|
16069
|
+
*/
|
|
16070
|
+
|
|
16071
|
+
function load() {
|
|
16072
|
+
var r;
|
|
16073
|
+
try {
|
|
16074
|
+
r = exports.storage.debug;
|
|
16075
|
+
} catch(e) {}
|
|
16076
|
+
|
|
16077
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
16078
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
16079
|
+
r = process.env.DEBUG;
|
|
16080
|
+
}
|
|
16081
|
+
|
|
16082
|
+
return r;
|
|
16083
|
+
}
|
|
16084
|
+
|
|
16085
|
+
/**
|
|
16086
|
+
* Enable namespaces listed in `localStorage.debug` initially.
|
|
16087
|
+
*/
|
|
16088
|
+
|
|
16089
|
+
exports.enable(load());
|
|
16090
|
+
|
|
16091
|
+
/**
|
|
16092
|
+
* Localstorage attempts to return the localstorage.
|
|
16093
|
+
*
|
|
16094
|
+
* This is necessary because safari throws
|
|
16095
|
+
* when a user disables cookies/localstorage
|
|
16096
|
+
* and you attempt to access it.
|
|
16097
|
+
*
|
|
16098
|
+
* @return {LocalStorage}
|
|
16099
|
+
* @api private
|
|
16100
|
+
*/
|
|
16101
|
+
|
|
16102
|
+
function localstorage() {
|
|
16103
|
+
try {
|
|
16104
|
+
return window.localStorage;
|
|
16105
|
+
} catch (e) {}
|
|
16106
|
+
}
|
|
16107
|
+
} (browser, browser.exports));
|
|
16108
|
+
return browser.exports;
|
|
16109
|
+
}
|
|
16110
|
+
|
|
16111
|
+
var node = {exports: {}};
|
|
16112
|
+
|
|
16113
|
+
/**
|
|
16114
|
+
* Module dependencies.
|
|
16115
|
+
*/
|
|
16116
|
+
|
|
16117
|
+
var hasRequiredNode;
|
|
16118
|
+
|
|
16119
|
+
function requireNode () {
|
|
16120
|
+
if (hasRequiredNode) return node.exports;
|
|
16121
|
+
hasRequiredNode = 1;
|
|
16122
|
+
(function (module, exports) {
|
|
16123
|
+
var tty = require$$0$2;
|
|
16124
|
+
var util = require$$1;
|
|
16125
|
+
|
|
16126
|
+
/**
|
|
16127
|
+
* This is the Node.js implementation of `debug()`.
|
|
16128
|
+
*
|
|
16129
|
+
* Expose `debug()` as the module.
|
|
16130
|
+
*/
|
|
16131
|
+
|
|
16132
|
+
exports = module.exports = requireDebug$1();
|
|
16133
|
+
exports.init = init;
|
|
16134
|
+
exports.log = log;
|
|
16135
|
+
exports.formatArgs = formatArgs;
|
|
16136
|
+
exports.save = save;
|
|
16137
|
+
exports.load = load;
|
|
16138
|
+
exports.useColors = useColors;
|
|
16139
|
+
|
|
16140
|
+
/**
|
|
16141
|
+
* Colors.
|
|
16142
|
+
*/
|
|
16143
|
+
|
|
16144
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
16145
|
+
|
|
16146
|
+
/**
|
|
16147
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
16148
|
+
*
|
|
16149
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
16150
|
+
*/
|
|
16151
|
+
|
|
16152
|
+
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
|
16153
|
+
return /^debug_/i.test(key);
|
|
16154
|
+
}).reduce(function (obj, key) {
|
|
16155
|
+
// camel-case
|
|
16156
|
+
var prop = key
|
|
16157
|
+
.substring(6)
|
|
16158
|
+
.toLowerCase()
|
|
16159
|
+
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
|
16160
|
+
|
|
16161
|
+
// coerce string value into JS value
|
|
16162
|
+
var val = process.env[key];
|
|
16163
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
16164
|
+
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
16165
|
+
else if (val === 'null') val = null;
|
|
16166
|
+
else val = Number(val);
|
|
16167
|
+
|
|
16168
|
+
obj[prop] = val;
|
|
16169
|
+
return obj;
|
|
16170
|
+
}, {});
|
|
16171
|
+
|
|
16172
|
+
/**
|
|
16173
|
+
* The file descriptor to write the `debug()` calls to.
|
|
16174
|
+
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
|
16175
|
+
*
|
|
16176
|
+
* $ DEBUG_FD=3 node script.js 3>debug.log
|
|
16177
|
+
*/
|
|
16178
|
+
|
|
16179
|
+
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
|
16180
|
+
|
|
16181
|
+
if (1 !== fd && 2 !== fd) {
|
|
16182
|
+
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')();
|
|
16183
|
+
}
|
|
16184
|
+
|
|
16185
|
+
var stream = 1 === fd ? process.stdout :
|
|
16186
|
+
2 === fd ? process.stderr :
|
|
16187
|
+
createWritableStdioStream(fd);
|
|
16188
|
+
|
|
16189
|
+
/**
|
|
16190
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
16191
|
+
*/
|
|
16192
|
+
|
|
16193
|
+
function useColors() {
|
|
16194
|
+
return 'colors' in exports.inspectOpts
|
|
16195
|
+
? Boolean(exports.inspectOpts.colors)
|
|
16196
|
+
: tty.isatty(fd);
|
|
16197
|
+
}
|
|
16198
|
+
|
|
16199
|
+
/**
|
|
16200
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
16201
|
+
*/
|
|
16202
|
+
|
|
16203
|
+
exports.formatters.o = function(v) {
|
|
16204
|
+
this.inspectOpts.colors = this.useColors;
|
|
16205
|
+
return util.inspect(v, this.inspectOpts)
|
|
16206
|
+
.split('\n').map(function(str) {
|
|
16207
|
+
return str.trim()
|
|
16208
|
+
}).join(' ');
|
|
16209
|
+
};
|
|
16210
|
+
|
|
16211
|
+
/**
|
|
16212
|
+
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
|
16213
|
+
*/
|
|
16214
|
+
|
|
16215
|
+
exports.formatters.O = function(v) {
|
|
16216
|
+
this.inspectOpts.colors = this.useColors;
|
|
16217
|
+
return util.inspect(v, this.inspectOpts);
|
|
16218
|
+
};
|
|
16219
|
+
|
|
16220
|
+
/**
|
|
16221
|
+
* Adds ANSI color escape codes if enabled.
|
|
16222
|
+
*
|
|
16223
|
+
* @api public
|
|
16224
|
+
*/
|
|
16225
|
+
|
|
16226
|
+
function formatArgs(args) {
|
|
16227
|
+
var name = this.namespace;
|
|
16228
|
+
var useColors = this.useColors;
|
|
16229
|
+
|
|
16230
|
+
if (useColors) {
|
|
16231
|
+
var c = this.color;
|
|
16232
|
+
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
|
16233
|
+
|
|
16234
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
16235
|
+
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
|
16236
|
+
} else {
|
|
16237
|
+
args[0] = new Date().toUTCString()
|
|
16238
|
+
+ ' ' + name + ' ' + args[0];
|
|
16239
|
+
}
|
|
16240
|
+
}
|
|
16241
|
+
|
|
16242
|
+
/**
|
|
16243
|
+
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
|
16244
|
+
*/
|
|
16245
|
+
|
|
16246
|
+
function log() {
|
|
16247
|
+
return stream.write(util.format.apply(util, arguments) + '\n');
|
|
16248
|
+
}
|
|
16249
|
+
|
|
16250
|
+
/**
|
|
16251
|
+
* Save `namespaces`.
|
|
16252
|
+
*
|
|
16253
|
+
* @param {String} namespaces
|
|
16254
|
+
* @api private
|
|
16255
|
+
*/
|
|
16256
|
+
|
|
16257
|
+
function save(namespaces) {
|
|
16258
|
+
if (null == namespaces) {
|
|
16259
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
|
16260
|
+
// string 'null' or 'undefined'. Just delete instead.
|
|
16261
|
+
delete process.env.DEBUG;
|
|
16262
|
+
} else {
|
|
16263
|
+
process.env.DEBUG = namespaces;
|
|
16264
|
+
}
|
|
16265
|
+
}
|
|
16266
|
+
|
|
16267
|
+
/**
|
|
16268
|
+
* Load `namespaces`.
|
|
16269
|
+
*
|
|
16270
|
+
* @return {String} returns the previously persisted debug modes
|
|
16271
|
+
* @api private
|
|
16272
|
+
*/
|
|
16273
|
+
|
|
16274
|
+
function load() {
|
|
16275
|
+
return process.env.DEBUG;
|
|
16276
|
+
}
|
|
16277
|
+
|
|
16278
|
+
/**
|
|
16279
|
+
* Copied from `node/src/node.js`.
|
|
16280
|
+
*
|
|
16281
|
+
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
|
16282
|
+
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
|
16283
|
+
*/
|
|
16284
|
+
|
|
16285
|
+
function createWritableStdioStream (fd) {
|
|
16286
|
+
var stream;
|
|
16287
|
+
var tty_wrap = process.binding('tty_wrap');
|
|
16288
|
+
|
|
16289
|
+
// Note stream._type is used for test-module-load-list.js
|
|
16290
|
+
|
|
16291
|
+
switch (tty_wrap.guessHandleType(fd)) {
|
|
16292
|
+
case 'TTY':
|
|
16293
|
+
stream = new tty.WriteStream(fd);
|
|
16294
|
+
stream._type = 'tty';
|
|
16295
|
+
|
|
16296
|
+
// Hack to have stream not keep the event loop alive.
|
|
16297
|
+
// See https://github.com/joyent/node/issues/1726
|
|
16298
|
+
if (stream._handle && stream._handle.unref) {
|
|
16299
|
+
stream._handle.unref();
|
|
16300
|
+
}
|
|
16301
|
+
break;
|
|
16302
|
+
|
|
16303
|
+
case 'FILE':
|
|
16304
|
+
var fs = require$$6;
|
|
16305
|
+
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
|
16306
|
+
stream._type = 'fs';
|
|
16307
|
+
break;
|
|
16308
|
+
|
|
16309
|
+
case 'PIPE':
|
|
16310
|
+
case 'TCP':
|
|
16311
|
+
var net = require$$4$1;
|
|
16312
|
+
stream = new net.Socket({
|
|
16313
|
+
fd: fd,
|
|
16314
|
+
readable: false,
|
|
16315
|
+
writable: true
|
|
16316
|
+
});
|
|
16317
|
+
|
|
16318
|
+
// FIXME Should probably have an option in net.Socket to create a
|
|
16319
|
+
// stream from an existing fd which is writable only. But for now
|
|
16320
|
+
// we'll just add this hack and set the `readable` member to false.
|
|
16321
|
+
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
|
16322
|
+
stream.readable = false;
|
|
16323
|
+
stream.read = null;
|
|
16324
|
+
stream._type = 'pipe';
|
|
16325
|
+
|
|
16326
|
+
// FIXME Hack to have stream not keep the event loop alive.
|
|
16327
|
+
// See https://github.com/joyent/node/issues/1726
|
|
16328
|
+
if (stream._handle && stream._handle.unref) {
|
|
16329
|
+
stream._handle.unref();
|
|
16330
|
+
}
|
|
16331
|
+
break;
|
|
16332
|
+
|
|
16333
|
+
default:
|
|
16334
|
+
// Probably an error on in uv_guess_handle()
|
|
16335
|
+
throw new Error('Implement me. Unknown stream file type!');
|
|
16336
|
+
}
|
|
16337
|
+
|
|
16338
|
+
// For supporting legacy API we put the FD here.
|
|
16339
|
+
stream.fd = fd;
|
|
16340
|
+
|
|
16341
|
+
stream._isStdio = true;
|
|
16342
|
+
|
|
16343
|
+
return stream;
|
|
16344
|
+
}
|
|
16345
|
+
|
|
16346
|
+
/**
|
|
16347
|
+
* Init logic for `debug` instances.
|
|
16348
|
+
*
|
|
16349
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
16350
|
+
* differently for a particular `debug` instance.
|
|
16351
|
+
*/
|
|
16352
|
+
|
|
16353
|
+
function init (debug) {
|
|
16354
|
+
debug.inspectOpts = {};
|
|
16355
|
+
|
|
16356
|
+
var keys = Object.keys(exports.inspectOpts);
|
|
16357
|
+
for (var i = 0; i < keys.length; i++) {
|
|
16358
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
16359
|
+
}
|
|
16360
|
+
}
|
|
16361
|
+
|
|
16362
|
+
/**
|
|
16363
|
+
* Enable namespaces listed in `process.env.DEBUG` initially.
|
|
16364
|
+
*/
|
|
16365
|
+
|
|
16366
|
+
exports.enable(load());
|
|
16367
|
+
} (node, node.exports));
|
|
16368
|
+
return node.exports;
|
|
16369
|
+
}
|
|
16370
|
+
|
|
16371
|
+
/**
|
|
16372
|
+
* Detect Electron renderer process, which is node, but we should
|
|
16373
|
+
* treat as a browser.
|
|
16374
|
+
*/
|
|
16375
|
+
|
|
16376
|
+
var hasRequiredSrc;
|
|
16377
|
+
|
|
16378
|
+
function requireSrc () {
|
|
16379
|
+
if (hasRequiredSrc) return src.exports;
|
|
16380
|
+
hasRequiredSrc = 1;
|
|
16381
|
+
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
|
16382
|
+
src.exports = requireBrowser();
|
|
16383
|
+
} else {
|
|
16384
|
+
src.exports = requireNode();
|
|
16385
|
+
}
|
|
16386
|
+
return src.exports;
|
|
16387
|
+
}
|
|
16388
|
+
|
|
15536
16389
|
var debug_1;
|
|
15537
16390
|
var hasRequiredDebug;
|
|
15538
16391
|
|
|
@@ -15545,7 +16398,7 @@ function requireDebug () {
|
|
|
15545
16398
|
if (!debug) {
|
|
15546
16399
|
try {
|
|
15547
16400
|
/* eslint global-require: off */
|
|
15548
|
-
debug =
|
|
16401
|
+
debug = requireSrc()("follow-redirects");
|
|
15549
16402
|
}
|
|
15550
16403
|
catch (error) { /* */ }
|
|
15551
16404
|
if (typeof debug !== "function") {
|
|
@@ -15567,7 +16420,7 @@ function requireFollowRedirects () {
|
|
|
15567
16420
|
var http = require$$3;
|
|
15568
16421
|
var https = require$$4;
|
|
15569
16422
|
var Writable = stream.Writable;
|
|
15570
|
-
var assert = require$$4$
|
|
16423
|
+
var assert = require$$4$2;
|
|
15571
16424
|
var debug = requireDebug();
|
|
15572
16425
|
|
|
15573
16426
|
// Preventive platform detection
|
|
@@ -19005,7 +19858,7 @@ async function registerService(options) {
|
|
|
19005
19858
|
});
|
|
19006
19859
|
}
|
|
19007
19860
|
|
|
19008
|
-
const BASE_LOG_DIR$2 = '/home/qumra/
|
|
19861
|
+
const BASE_LOG_DIR$2 = '/home/qumra/logs/pm2';
|
|
19009
19862
|
// اسم السيرفس الحالي اللي بيعمل الـ discovery
|
|
19010
19863
|
const CURRENT_SERVICE$2 = process.env.SERVICE_NAME || 'unknown-service';
|
|
19011
19864
|
async function ensureLogDir$2(dir) {
|
|
@@ -19117,7 +19970,7 @@ async function getServiceUrl(serviceName) {
|
|
|
19117
19970
|
return url;
|
|
19118
19971
|
}
|
|
19119
19972
|
|
|
19120
|
-
const BASE_LOG_DIR$1 = '/home/qumra/
|
|
19973
|
+
const BASE_LOG_DIR$1 = '/home/qumra/logs/pm2';
|
|
19121
19974
|
const CURRENT_SERVICE$1 = process.env.SERVICE_NAME || 'unknown-service';
|
|
19122
19975
|
async function ensureLogDir$1(dir) {
|
|
19123
19976
|
await promises.mkdir(dir, { recursive: true });
|
|
@@ -19151,7 +20004,7 @@ async function appendCallLog(targetService, url, method, status, elapsedMs, erro
|
|
|
19151
20004
|
}
|
|
19152
20005
|
}
|
|
19153
20006
|
|
|
19154
|
-
const BASE_LOG_DIR = '/home/qumra/
|
|
20007
|
+
const BASE_LOG_DIR = '/home/qumra/logs/pm2';
|
|
19155
20008
|
const CURRENT_SERVICE = process.env.SERVICE_NAME || 'unknown-service';
|
|
19156
20009
|
const THRESHOLD = Number(process.env.SLOW_CALL_THRESHOLD || 200); // الافتراضي 200ms
|
|
19157
20010
|
async function ensureLogDir(dir) {
|
|
@@ -19215,6 +20068,21 @@ async function callService(serviceName, options = {}) {
|
|
|
19215
20068
|
}
|
|
19216
20069
|
}
|
|
19217
20070
|
|
|
20071
|
+
async function callStreamService(serviceName, options = {}) {
|
|
20072
|
+
const { method = 'GET', path = '/', data, headers, params, } = options;
|
|
20073
|
+
const instance = await getRandomServiceInstance(serviceName);
|
|
20074
|
+
const url = `http://${instance.address}:${instance.port}${path}`;
|
|
20075
|
+
return axios.request({
|
|
20076
|
+
url,
|
|
20077
|
+
method,
|
|
20078
|
+
data,
|
|
20079
|
+
headers,
|
|
20080
|
+
params,
|
|
20081
|
+
responseType: 'stream',
|
|
20082
|
+
timeout: 0, // مهم جدًا
|
|
20083
|
+
});
|
|
20084
|
+
}
|
|
20085
|
+
|
|
19218
20086
|
// 🛠 أدوات التعامل مع المسارات
|
|
19219
20087
|
function getValueByPath(obj, path) {
|
|
19220
20088
|
return path.split(".").reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], obj);
|
|
@@ -19373,5 +20241,5 @@ async function dataLink(data, schema) {
|
|
|
19373
20241
|
return isArray ? result : result[0];
|
|
19374
20242
|
}
|
|
19375
20243
|
|
|
19376
|
-
export { callService, dataLink, getAtlasClient, getRandomServiceInstance, getServiceInstances, getServiceUrl, initClient, listServices, registerService, toBoolean };
|
|
20244
|
+
export { callService, callStreamService, dataLink, getAtlasClient, getRandomServiceInstance, getServiceInstances, getServiceUrl, initClient, listServices, registerService, toBoolean };
|
|
19377
20245
|
//# sourceMappingURL=index.esm.js.map
|