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