glitch-javascript-sdk 0.6.1 → 0.6.3
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/cjs/index.js +1337 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Posts.d.ts +21 -0
- package/dist/esm/api/SocialPosts.d.ts +31 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1560 -44
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/SocialPostsRoute.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +1 -1
- package/dist/index.d.ts +52 -1
- package/package.json +1 -1
- package/src/api/Posts.ts +77 -22
- package/src/api/SocialPosts.ts +46 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +3 -0
- package/src/routes/SocialPostsRoute.ts +14 -0
- package/src/util/Requests.ts +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -8,6 +8,8 @@ var require$$4 = require('https');
|
|
|
8
8
|
var require$$0$1 = require('url');
|
|
9
9
|
var require$$6 = require('fs');
|
|
10
10
|
var require$$4$1 = require('assert');
|
|
11
|
+
var require$$0$3 = require('tty');
|
|
12
|
+
var require$$0$2 = require('os');
|
|
11
13
|
var zlib = require('zlib');
|
|
12
14
|
var EventEmitter = require('events');
|
|
13
15
|
|
|
@@ -67,6 +69,44 @@ var __assign = function() {
|
|
|
67
69
|
return __assign.apply(this, arguments);
|
|
68
70
|
};
|
|
69
71
|
|
|
72
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
73
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
74
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
75
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
76
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
77
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
78
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function __generator(thisArg, body) {
|
|
83
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
84
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
85
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
86
|
+
function step(op) {
|
|
87
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
88
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
89
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
90
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
91
|
+
switch (op[0]) {
|
|
92
|
+
case 0: case 1: t = op; break;
|
|
93
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
94
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
95
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
96
|
+
default:
|
|
97
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
98
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
99
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
100
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
101
|
+
if (t[2]) _.ops.pop();
|
|
102
|
+
_.trys.pop(); continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
106
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
70
110
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
71
111
|
var e = new Error(message);
|
|
72
112
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -14251,13 +14291,1197 @@ var getProxyForUrl_1 = getProxyForUrl;
|
|
|
14251
14291
|
|
|
14252
14292
|
var followRedirects$1 = {exports: {}};
|
|
14253
14293
|
|
|
14294
|
+
var src = {exports: {}};
|
|
14295
|
+
|
|
14296
|
+
var browser = {exports: {}};
|
|
14297
|
+
|
|
14298
|
+
/**
|
|
14299
|
+
* Helpers.
|
|
14300
|
+
*/
|
|
14301
|
+
|
|
14302
|
+
var ms;
|
|
14303
|
+
var hasRequiredMs;
|
|
14304
|
+
|
|
14305
|
+
function requireMs () {
|
|
14306
|
+
if (hasRequiredMs) return ms;
|
|
14307
|
+
hasRequiredMs = 1;
|
|
14308
|
+
var s = 1000;
|
|
14309
|
+
var m = s * 60;
|
|
14310
|
+
var h = m * 60;
|
|
14311
|
+
var d = h * 24;
|
|
14312
|
+
var w = d * 7;
|
|
14313
|
+
var y = d * 365.25;
|
|
14314
|
+
|
|
14315
|
+
/**
|
|
14316
|
+
* Parse or format the given `val`.
|
|
14317
|
+
*
|
|
14318
|
+
* Options:
|
|
14319
|
+
*
|
|
14320
|
+
* - `long` verbose formatting [false]
|
|
14321
|
+
*
|
|
14322
|
+
* @param {String|Number} val
|
|
14323
|
+
* @param {Object} [options]
|
|
14324
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
14325
|
+
* @return {String|Number}
|
|
14326
|
+
* @api public
|
|
14327
|
+
*/
|
|
14328
|
+
|
|
14329
|
+
ms = function(val, options) {
|
|
14330
|
+
options = options || {};
|
|
14331
|
+
var type = typeof val;
|
|
14332
|
+
if (type === 'string' && val.length > 0) {
|
|
14333
|
+
return parse(val);
|
|
14334
|
+
} else if (type === 'number' && isFinite(val)) {
|
|
14335
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
14336
|
+
}
|
|
14337
|
+
throw new Error(
|
|
14338
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
14339
|
+
JSON.stringify(val)
|
|
14340
|
+
);
|
|
14341
|
+
};
|
|
14342
|
+
|
|
14343
|
+
/**
|
|
14344
|
+
* Parse the given `str` and return milliseconds.
|
|
14345
|
+
*
|
|
14346
|
+
* @param {String} str
|
|
14347
|
+
* @return {Number}
|
|
14348
|
+
* @api private
|
|
14349
|
+
*/
|
|
14350
|
+
|
|
14351
|
+
function parse(str) {
|
|
14352
|
+
str = String(str);
|
|
14353
|
+
if (str.length > 100) {
|
|
14354
|
+
return;
|
|
14355
|
+
}
|
|
14356
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
14357
|
+
str
|
|
14358
|
+
);
|
|
14359
|
+
if (!match) {
|
|
14360
|
+
return;
|
|
14361
|
+
}
|
|
14362
|
+
var n = parseFloat(match[1]);
|
|
14363
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
14364
|
+
switch (type) {
|
|
14365
|
+
case 'years':
|
|
14366
|
+
case 'year':
|
|
14367
|
+
case 'yrs':
|
|
14368
|
+
case 'yr':
|
|
14369
|
+
case 'y':
|
|
14370
|
+
return n * y;
|
|
14371
|
+
case 'weeks':
|
|
14372
|
+
case 'week':
|
|
14373
|
+
case 'w':
|
|
14374
|
+
return n * w;
|
|
14375
|
+
case 'days':
|
|
14376
|
+
case 'day':
|
|
14377
|
+
case 'd':
|
|
14378
|
+
return n * d;
|
|
14379
|
+
case 'hours':
|
|
14380
|
+
case 'hour':
|
|
14381
|
+
case 'hrs':
|
|
14382
|
+
case 'hr':
|
|
14383
|
+
case 'h':
|
|
14384
|
+
return n * h;
|
|
14385
|
+
case 'minutes':
|
|
14386
|
+
case 'minute':
|
|
14387
|
+
case 'mins':
|
|
14388
|
+
case 'min':
|
|
14389
|
+
case 'm':
|
|
14390
|
+
return n * m;
|
|
14391
|
+
case 'seconds':
|
|
14392
|
+
case 'second':
|
|
14393
|
+
case 'secs':
|
|
14394
|
+
case 'sec':
|
|
14395
|
+
case 's':
|
|
14396
|
+
return n * s;
|
|
14397
|
+
case 'milliseconds':
|
|
14398
|
+
case 'millisecond':
|
|
14399
|
+
case 'msecs':
|
|
14400
|
+
case 'msec':
|
|
14401
|
+
case 'ms':
|
|
14402
|
+
return n;
|
|
14403
|
+
default:
|
|
14404
|
+
return undefined;
|
|
14405
|
+
}
|
|
14406
|
+
}
|
|
14407
|
+
|
|
14408
|
+
/**
|
|
14409
|
+
* Short format for `ms`.
|
|
14410
|
+
*
|
|
14411
|
+
* @param {Number} ms
|
|
14412
|
+
* @return {String}
|
|
14413
|
+
* @api private
|
|
14414
|
+
*/
|
|
14415
|
+
|
|
14416
|
+
function fmtShort(ms) {
|
|
14417
|
+
var msAbs = Math.abs(ms);
|
|
14418
|
+
if (msAbs >= d) {
|
|
14419
|
+
return Math.round(ms / d) + 'd';
|
|
14420
|
+
}
|
|
14421
|
+
if (msAbs >= h) {
|
|
14422
|
+
return Math.round(ms / h) + 'h';
|
|
14423
|
+
}
|
|
14424
|
+
if (msAbs >= m) {
|
|
14425
|
+
return Math.round(ms / m) + 'm';
|
|
14426
|
+
}
|
|
14427
|
+
if (msAbs >= s) {
|
|
14428
|
+
return Math.round(ms / s) + 's';
|
|
14429
|
+
}
|
|
14430
|
+
return ms + 'ms';
|
|
14431
|
+
}
|
|
14432
|
+
|
|
14433
|
+
/**
|
|
14434
|
+
* Long format for `ms`.
|
|
14435
|
+
*
|
|
14436
|
+
* @param {Number} ms
|
|
14437
|
+
* @return {String}
|
|
14438
|
+
* @api private
|
|
14439
|
+
*/
|
|
14440
|
+
|
|
14441
|
+
function fmtLong(ms) {
|
|
14442
|
+
var msAbs = Math.abs(ms);
|
|
14443
|
+
if (msAbs >= d) {
|
|
14444
|
+
return plural(ms, msAbs, d, 'day');
|
|
14445
|
+
}
|
|
14446
|
+
if (msAbs >= h) {
|
|
14447
|
+
return plural(ms, msAbs, h, 'hour');
|
|
14448
|
+
}
|
|
14449
|
+
if (msAbs >= m) {
|
|
14450
|
+
return plural(ms, msAbs, m, 'minute');
|
|
14451
|
+
}
|
|
14452
|
+
if (msAbs >= s) {
|
|
14453
|
+
return plural(ms, msAbs, s, 'second');
|
|
14454
|
+
}
|
|
14455
|
+
return ms + ' ms';
|
|
14456
|
+
}
|
|
14457
|
+
|
|
14458
|
+
/**
|
|
14459
|
+
* Pluralization helper.
|
|
14460
|
+
*/
|
|
14461
|
+
|
|
14462
|
+
function plural(ms, msAbs, n, name) {
|
|
14463
|
+
var isPlural = msAbs >= n * 1.5;
|
|
14464
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
14465
|
+
}
|
|
14466
|
+
return ms;
|
|
14467
|
+
}
|
|
14468
|
+
|
|
14469
|
+
var common;
|
|
14470
|
+
var hasRequiredCommon;
|
|
14471
|
+
|
|
14472
|
+
function requireCommon () {
|
|
14473
|
+
if (hasRequiredCommon) return common;
|
|
14474
|
+
hasRequiredCommon = 1;
|
|
14475
|
+
/**
|
|
14476
|
+
* This is the common logic for both the Node.js and web browser
|
|
14477
|
+
* implementations of `debug()`.
|
|
14478
|
+
*/
|
|
14479
|
+
|
|
14480
|
+
function setup(env) {
|
|
14481
|
+
createDebug.debug = createDebug;
|
|
14482
|
+
createDebug.default = createDebug;
|
|
14483
|
+
createDebug.coerce = coerce;
|
|
14484
|
+
createDebug.disable = disable;
|
|
14485
|
+
createDebug.enable = enable;
|
|
14486
|
+
createDebug.enabled = enabled;
|
|
14487
|
+
createDebug.humanize = requireMs();
|
|
14488
|
+
createDebug.destroy = destroy;
|
|
14489
|
+
|
|
14490
|
+
Object.keys(env).forEach(key => {
|
|
14491
|
+
createDebug[key] = env[key];
|
|
14492
|
+
});
|
|
14493
|
+
|
|
14494
|
+
/**
|
|
14495
|
+
* The currently active debug mode names, and names to skip.
|
|
14496
|
+
*/
|
|
14497
|
+
|
|
14498
|
+
createDebug.names = [];
|
|
14499
|
+
createDebug.skips = [];
|
|
14500
|
+
|
|
14501
|
+
/**
|
|
14502
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
14503
|
+
*
|
|
14504
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
14505
|
+
*/
|
|
14506
|
+
createDebug.formatters = {};
|
|
14507
|
+
|
|
14508
|
+
/**
|
|
14509
|
+
* Selects a color for a debug namespace
|
|
14510
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
14511
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
14512
|
+
* @api private
|
|
14513
|
+
*/
|
|
14514
|
+
function selectColor(namespace) {
|
|
14515
|
+
let hash = 0;
|
|
14516
|
+
|
|
14517
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
14518
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
14519
|
+
hash |= 0; // Convert to 32bit integer
|
|
14520
|
+
}
|
|
14521
|
+
|
|
14522
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
14523
|
+
}
|
|
14524
|
+
createDebug.selectColor = selectColor;
|
|
14525
|
+
|
|
14526
|
+
/**
|
|
14527
|
+
* Create a debugger with the given `namespace`.
|
|
14528
|
+
*
|
|
14529
|
+
* @param {String} namespace
|
|
14530
|
+
* @return {Function}
|
|
14531
|
+
* @api public
|
|
14532
|
+
*/
|
|
14533
|
+
function createDebug(namespace) {
|
|
14534
|
+
let prevTime;
|
|
14535
|
+
let enableOverride = null;
|
|
14536
|
+
let namespacesCache;
|
|
14537
|
+
let enabledCache;
|
|
14538
|
+
|
|
14539
|
+
function debug(...args) {
|
|
14540
|
+
// Disabled?
|
|
14541
|
+
if (!debug.enabled) {
|
|
14542
|
+
return;
|
|
14543
|
+
}
|
|
14544
|
+
|
|
14545
|
+
const self = debug;
|
|
14546
|
+
|
|
14547
|
+
// Set `diff` timestamp
|
|
14548
|
+
const curr = Number(new Date());
|
|
14549
|
+
const ms = curr - (prevTime || curr);
|
|
14550
|
+
self.diff = ms;
|
|
14551
|
+
self.prev = prevTime;
|
|
14552
|
+
self.curr = curr;
|
|
14553
|
+
prevTime = curr;
|
|
14554
|
+
|
|
14555
|
+
args[0] = createDebug.coerce(args[0]);
|
|
14556
|
+
|
|
14557
|
+
if (typeof args[0] !== 'string') {
|
|
14558
|
+
// Anything else let's inspect with %O
|
|
14559
|
+
args.unshift('%O');
|
|
14560
|
+
}
|
|
14561
|
+
|
|
14562
|
+
// Apply any `formatters` transformations
|
|
14563
|
+
let index = 0;
|
|
14564
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
14565
|
+
// If we encounter an escaped % then don't increase the array index
|
|
14566
|
+
if (match === '%%') {
|
|
14567
|
+
return '%';
|
|
14568
|
+
}
|
|
14569
|
+
index++;
|
|
14570
|
+
const formatter = createDebug.formatters[format];
|
|
14571
|
+
if (typeof formatter === 'function') {
|
|
14572
|
+
const val = args[index];
|
|
14573
|
+
match = formatter.call(self, val);
|
|
14574
|
+
|
|
14575
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
14576
|
+
args.splice(index, 1);
|
|
14577
|
+
index--;
|
|
14578
|
+
}
|
|
14579
|
+
return match;
|
|
14580
|
+
});
|
|
14581
|
+
|
|
14582
|
+
// Apply env-specific formatting (colors, etc.)
|
|
14583
|
+
createDebug.formatArgs.call(self, args);
|
|
14584
|
+
|
|
14585
|
+
const logFn = self.log || createDebug.log;
|
|
14586
|
+
logFn.apply(self, args);
|
|
14587
|
+
}
|
|
14588
|
+
|
|
14589
|
+
debug.namespace = namespace;
|
|
14590
|
+
debug.useColors = createDebug.useColors();
|
|
14591
|
+
debug.color = createDebug.selectColor(namespace);
|
|
14592
|
+
debug.extend = extend;
|
|
14593
|
+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
14594
|
+
|
|
14595
|
+
Object.defineProperty(debug, 'enabled', {
|
|
14596
|
+
enumerable: true,
|
|
14597
|
+
configurable: false,
|
|
14598
|
+
get: () => {
|
|
14599
|
+
if (enableOverride !== null) {
|
|
14600
|
+
return enableOverride;
|
|
14601
|
+
}
|
|
14602
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
14603
|
+
namespacesCache = createDebug.namespaces;
|
|
14604
|
+
enabledCache = createDebug.enabled(namespace);
|
|
14605
|
+
}
|
|
14606
|
+
|
|
14607
|
+
return enabledCache;
|
|
14608
|
+
},
|
|
14609
|
+
set: v => {
|
|
14610
|
+
enableOverride = v;
|
|
14611
|
+
}
|
|
14612
|
+
});
|
|
14613
|
+
|
|
14614
|
+
// Env-specific initialization logic for debug instances
|
|
14615
|
+
if (typeof createDebug.init === 'function') {
|
|
14616
|
+
createDebug.init(debug);
|
|
14617
|
+
}
|
|
14618
|
+
|
|
14619
|
+
return debug;
|
|
14620
|
+
}
|
|
14621
|
+
|
|
14622
|
+
function extend(namespace, delimiter) {
|
|
14623
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
14624
|
+
newDebug.log = this.log;
|
|
14625
|
+
return newDebug;
|
|
14626
|
+
}
|
|
14627
|
+
|
|
14628
|
+
/**
|
|
14629
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
14630
|
+
* separated by a colon and wildcards.
|
|
14631
|
+
*
|
|
14632
|
+
* @param {String} namespaces
|
|
14633
|
+
* @api public
|
|
14634
|
+
*/
|
|
14635
|
+
function enable(namespaces) {
|
|
14636
|
+
createDebug.save(namespaces);
|
|
14637
|
+
createDebug.namespaces = namespaces;
|
|
14638
|
+
|
|
14639
|
+
createDebug.names = [];
|
|
14640
|
+
createDebug.skips = [];
|
|
14641
|
+
|
|
14642
|
+
let i;
|
|
14643
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
14644
|
+
const len = split.length;
|
|
14645
|
+
|
|
14646
|
+
for (i = 0; i < len; i++) {
|
|
14647
|
+
if (!split[i]) {
|
|
14648
|
+
// ignore empty strings
|
|
14649
|
+
continue;
|
|
14650
|
+
}
|
|
14651
|
+
|
|
14652
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
14653
|
+
|
|
14654
|
+
if (namespaces[0] === '-') {
|
|
14655
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
14656
|
+
} else {
|
|
14657
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
14658
|
+
}
|
|
14659
|
+
}
|
|
14660
|
+
}
|
|
14661
|
+
|
|
14662
|
+
/**
|
|
14663
|
+
* Disable debug output.
|
|
14664
|
+
*
|
|
14665
|
+
* @return {String} namespaces
|
|
14666
|
+
* @api public
|
|
14667
|
+
*/
|
|
14668
|
+
function disable() {
|
|
14669
|
+
const namespaces = [
|
|
14670
|
+
...createDebug.names.map(toNamespace),
|
|
14671
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
14672
|
+
].join(',');
|
|
14673
|
+
createDebug.enable('');
|
|
14674
|
+
return namespaces;
|
|
14675
|
+
}
|
|
14676
|
+
|
|
14677
|
+
/**
|
|
14678
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
14679
|
+
*
|
|
14680
|
+
* @param {String} name
|
|
14681
|
+
* @return {Boolean}
|
|
14682
|
+
* @api public
|
|
14683
|
+
*/
|
|
14684
|
+
function enabled(name) {
|
|
14685
|
+
if (name[name.length - 1] === '*') {
|
|
14686
|
+
return true;
|
|
14687
|
+
}
|
|
14688
|
+
|
|
14689
|
+
let i;
|
|
14690
|
+
let len;
|
|
14691
|
+
|
|
14692
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
14693
|
+
if (createDebug.skips[i].test(name)) {
|
|
14694
|
+
return false;
|
|
14695
|
+
}
|
|
14696
|
+
}
|
|
14697
|
+
|
|
14698
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
14699
|
+
if (createDebug.names[i].test(name)) {
|
|
14700
|
+
return true;
|
|
14701
|
+
}
|
|
14702
|
+
}
|
|
14703
|
+
|
|
14704
|
+
return false;
|
|
14705
|
+
}
|
|
14706
|
+
|
|
14707
|
+
/**
|
|
14708
|
+
* Convert regexp to namespace
|
|
14709
|
+
*
|
|
14710
|
+
* @param {RegExp} regxep
|
|
14711
|
+
* @return {String} namespace
|
|
14712
|
+
* @api private
|
|
14713
|
+
*/
|
|
14714
|
+
function toNamespace(regexp) {
|
|
14715
|
+
return regexp.toString()
|
|
14716
|
+
.substring(2, regexp.toString().length - 2)
|
|
14717
|
+
.replace(/\.\*\?$/, '*');
|
|
14718
|
+
}
|
|
14719
|
+
|
|
14720
|
+
/**
|
|
14721
|
+
* Coerce `val`.
|
|
14722
|
+
*
|
|
14723
|
+
* @param {Mixed} val
|
|
14724
|
+
* @return {Mixed}
|
|
14725
|
+
* @api private
|
|
14726
|
+
*/
|
|
14727
|
+
function coerce(val) {
|
|
14728
|
+
if (val instanceof Error) {
|
|
14729
|
+
return val.stack || val.message;
|
|
14730
|
+
}
|
|
14731
|
+
return val;
|
|
14732
|
+
}
|
|
14733
|
+
|
|
14734
|
+
/**
|
|
14735
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
14736
|
+
* XXX It WILL be removed in the next major release.
|
|
14737
|
+
*/
|
|
14738
|
+
function destroy() {
|
|
14739
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
14740
|
+
}
|
|
14741
|
+
|
|
14742
|
+
createDebug.enable(createDebug.load());
|
|
14743
|
+
|
|
14744
|
+
return createDebug;
|
|
14745
|
+
}
|
|
14746
|
+
|
|
14747
|
+
common = setup;
|
|
14748
|
+
return common;
|
|
14749
|
+
}
|
|
14750
|
+
|
|
14751
|
+
/* eslint-env browser */
|
|
14752
|
+
|
|
14753
|
+
var hasRequiredBrowser;
|
|
14754
|
+
|
|
14755
|
+
function requireBrowser () {
|
|
14756
|
+
if (hasRequiredBrowser) return browser.exports;
|
|
14757
|
+
hasRequiredBrowser = 1;
|
|
14758
|
+
(function (module, exports) {
|
|
14759
|
+
/**
|
|
14760
|
+
* This is the web browser implementation of `debug()`.
|
|
14761
|
+
*/
|
|
14762
|
+
|
|
14763
|
+
exports.formatArgs = formatArgs;
|
|
14764
|
+
exports.save = save;
|
|
14765
|
+
exports.load = load;
|
|
14766
|
+
exports.useColors = useColors;
|
|
14767
|
+
exports.storage = localstorage();
|
|
14768
|
+
exports.destroy = (() => {
|
|
14769
|
+
let warned = false;
|
|
14770
|
+
|
|
14771
|
+
return () => {
|
|
14772
|
+
if (!warned) {
|
|
14773
|
+
warned = true;
|
|
14774
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
14775
|
+
}
|
|
14776
|
+
};
|
|
14777
|
+
})();
|
|
14778
|
+
|
|
14779
|
+
/**
|
|
14780
|
+
* Colors.
|
|
14781
|
+
*/
|
|
14782
|
+
|
|
14783
|
+
exports.colors = [
|
|
14784
|
+
'#0000CC',
|
|
14785
|
+
'#0000FF',
|
|
14786
|
+
'#0033CC',
|
|
14787
|
+
'#0033FF',
|
|
14788
|
+
'#0066CC',
|
|
14789
|
+
'#0066FF',
|
|
14790
|
+
'#0099CC',
|
|
14791
|
+
'#0099FF',
|
|
14792
|
+
'#00CC00',
|
|
14793
|
+
'#00CC33',
|
|
14794
|
+
'#00CC66',
|
|
14795
|
+
'#00CC99',
|
|
14796
|
+
'#00CCCC',
|
|
14797
|
+
'#00CCFF',
|
|
14798
|
+
'#3300CC',
|
|
14799
|
+
'#3300FF',
|
|
14800
|
+
'#3333CC',
|
|
14801
|
+
'#3333FF',
|
|
14802
|
+
'#3366CC',
|
|
14803
|
+
'#3366FF',
|
|
14804
|
+
'#3399CC',
|
|
14805
|
+
'#3399FF',
|
|
14806
|
+
'#33CC00',
|
|
14807
|
+
'#33CC33',
|
|
14808
|
+
'#33CC66',
|
|
14809
|
+
'#33CC99',
|
|
14810
|
+
'#33CCCC',
|
|
14811
|
+
'#33CCFF',
|
|
14812
|
+
'#6600CC',
|
|
14813
|
+
'#6600FF',
|
|
14814
|
+
'#6633CC',
|
|
14815
|
+
'#6633FF',
|
|
14816
|
+
'#66CC00',
|
|
14817
|
+
'#66CC33',
|
|
14818
|
+
'#9900CC',
|
|
14819
|
+
'#9900FF',
|
|
14820
|
+
'#9933CC',
|
|
14821
|
+
'#9933FF',
|
|
14822
|
+
'#99CC00',
|
|
14823
|
+
'#99CC33',
|
|
14824
|
+
'#CC0000',
|
|
14825
|
+
'#CC0033',
|
|
14826
|
+
'#CC0066',
|
|
14827
|
+
'#CC0099',
|
|
14828
|
+
'#CC00CC',
|
|
14829
|
+
'#CC00FF',
|
|
14830
|
+
'#CC3300',
|
|
14831
|
+
'#CC3333',
|
|
14832
|
+
'#CC3366',
|
|
14833
|
+
'#CC3399',
|
|
14834
|
+
'#CC33CC',
|
|
14835
|
+
'#CC33FF',
|
|
14836
|
+
'#CC6600',
|
|
14837
|
+
'#CC6633',
|
|
14838
|
+
'#CC9900',
|
|
14839
|
+
'#CC9933',
|
|
14840
|
+
'#CCCC00',
|
|
14841
|
+
'#CCCC33',
|
|
14842
|
+
'#FF0000',
|
|
14843
|
+
'#FF0033',
|
|
14844
|
+
'#FF0066',
|
|
14845
|
+
'#FF0099',
|
|
14846
|
+
'#FF00CC',
|
|
14847
|
+
'#FF00FF',
|
|
14848
|
+
'#FF3300',
|
|
14849
|
+
'#FF3333',
|
|
14850
|
+
'#FF3366',
|
|
14851
|
+
'#FF3399',
|
|
14852
|
+
'#FF33CC',
|
|
14853
|
+
'#FF33FF',
|
|
14854
|
+
'#FF6600',
|
|
14855
|
+
'#FF6633',
|
|
14856
|
+
'#FF9900',
|
|
14857
|
+
'#FF9933',
|
|
14858
|
+
'#FFCC00',
|
|
14859
|
+
'#FFCC33'
|
|
14860
|
+
];
|
|
14861
|
+
|
|
14862
|
+
/**
|
|
14863
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
14864
|
+
* and the Firebug extension (any Firefox version) are known
|
|
14865
|
+
* to support "%c" CSS customizations.
|
|
14866
|
+
*
|
|
14867
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
14868
|
+
*/
|
|
14869
|
+
|
|
14870
|
+
// eslint-disable-next-line complexity
|
|
14871
|
+
function useColors() {
|
|
14872
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
14873
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
14874
|
+
// explicitly
|
|
14875
|
+
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
14876
|
+
return true;
|
|
14877
|
+
}
|
|
14878
|
+
|
|
14879
|
+
// Internet Explorer and Edge do not support colors.
|
|
14880
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
14881
|
+
return false;
|
|
14882
|
+
}
|
|
14883
|
+
|
|
14884
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
14885
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
14886
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
14887
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
14888
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
14889
|
+
// Is firefox >= v31?
|
|
14890
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
14891
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
14892
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
14893
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
14894
|
+
}
|
|
14895
|
+
|
|
14896
|
+
/**
|
|
14897
|
+
* Colorize log arguments if enabled.
|
|
14898
|
+
*
|
|
14899
|
+
* @api public
|
|
14900
|
+
*/
|
|
14901
|
+
|
|
14902
|
+
function formatArgs(args) {
|
|
14903
|
+
args[0] = (this.useColors ? '%c' : '') +
|
|
14904
|
+
this.namespace +
|
|
14905
|
+
(this.useColors ? ' %c' : ' ') +
|
|
14906
|
+
args[0] +
|
|
14907
|
+
(this.useColors ? '%c ' : ' ') +
|
|
14908
|
+
'+' + module.exports.humanize(this.diff);
|
|
14909
|
+
|
|
14910
|
+
if (!this.useColors) {
|
|
14911
|
+
return;
|
|
14912
|
+
}
|
|
14913
|
+
|
|
14914
|
+
const c = 'color: ' + this.color;
|
|
14915
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
14916
|
+
|
|
14917
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
14918
|
+
// arguments passed either before or after the %c, so we need to
|
|
14919
|
+
// figure out the correct index to insert the CSS into
|
|
14920
|
+
let index = 0;
|
|
14921
|
+
let lastC = 0;
|
|
14922
|
+
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
14923
|
+
if (match === '%%') {
|
|
14924
|
+
return;
|
|
14925
|
+
}
|
|
14926
|
+
index++;
|
|
14927
|
+
if (match === '%c') {
|
|
14928
|
+
// We only are interested in the *last* %c
|
|
14929
|
+
// (the user may have provided their own)
|
|
14930
|
+
lastC = index;
|
|
14931
|
+
}
|
|
14932
|
+
});
|
|
14933
|
+
|
|
14934
|
+
args.splice(lastC, 0, c);
|
|
14935
|
+
}
|
|
14936
|
+
|
|
14937
|
+
/**
|
|
14938
|
+
* Invokes `console.debug()` when available.
|
|
14939
|
+
* No-op when `console.debug` is not a "function".
|
|
14940
|
+
* If `console.debug` is not available, falls back
|
|
14941
|
+
* to `console.log`.
|
|
14942
|
+
*
|
|
14943
|
+
* @api public
|
|
14944
|
+
*/
|
|
14945
|
+
exports.log = console.debug || console.log || (() => {});
|
|
14946
|
+
|
|
14947
|
+
/**
|
|
14948
|
+
* Save `namespaces`.
|
|
14949
|
+
*
|
|
14950
|
+
* @param {String} namespaces
|
|
14951
|
+
* @api private
|
|
14952
|
+
*/
|
|
14953
|
+
function save(namespaces) {
|
|
14954
|
+
try {
|
|
14955
|
+
if (namespaces) {
|
|
14956
|
+
exports.storage.setItem('debug', namespaces);
|
|
14957
|
+
} else {
|
|
14958
|
+
exports.storage.removeItem('debug');
|
|
14959
|
+
}
|
|
14960
|
+
} catch (error) {
|
|
14961
|
+
// Swallow
|
|
14962
|
+
// XXX (@Qix-) should we be logging these?
|
|
14963
|
+
}
|
|
14964
|
+
}
|
|
14965
|
+
|
|
14966
|
+
/**
|
|
14967
|
+
* Load `namespaces`.
|
|
14968
|
+
*
|
|
14969
|
+
* @return {String} returns the previously persisted debug modes
|
|
14970
|
+
* @api private
|
|
14971
|
+
*/
|
|
14972
|
+
function load() {
|
|
14973
|
+
let r;
|
|
14974
|
+
try {
|
|
14975
|
+
r = exports.storage.getItem('debug');
|
|
14976
|
+
} catch (error) {
|
|
14977
|
+
// Swallow
|
|
14978
|
+
// XXX (@Qix-) should we be logging these?
|
|
14979
|
+
}
|
|
14980
|
+
|
|
14981
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
14982
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
14983
|
+
r = process.env.DEBUG;
|
|
14984
|
+
}
|
|
14985
|
+
|
|
14986
|
+
return r;
|
|
14987
|
+
}
|
|
14988
|
+
|
|
14989
|
+
/**
|
|
14990
|
+
* Localstorage attempts to return the localstorage.
|
|
14991
|
+
*
|
|
14992
|
+
* This is necessary because safari throws
|
|
14993
|
+
* when a user disables cookies/localstorage
|
|
14994
|
+
* and you attempt to access it.
|
|
14995
|
+
*
|
|
14996
|
+
* @return {LocalStorage}
|
|
14997
|
+
* @api private
|
|
14998
|
+
*/
|
|
14999
|
+
|
|
15000
|
+
function localstorage() {
|
|
15001
|
+
try {
|
|
15002
|
+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
15003
|
+
// The Browser also has localStorage in the global context.
|
|
15004
|
+
return localStorage;
|
|
15005
|
+
} catch (error) {
|
|
15006
|
+
// Swallow
|
|
15007
|
+
// XXX (@Qix-) should we be logging these?
|
|
15008
|
+
}
|
|
15009
|
+
}
|
|
15010
|
+
|
|
15011
|
+
module.exports = requireCommon()(exports);
|
|
15012
|
+
|
|
15013
|
+
const {formatters} = module.exports;
|
|
15014
|
+
|
|
15015
|
+
/**
|
|
15016
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
15017
|
+
*/
|
|
15018
|
+
|
|
15019
|
+
formatters.j = function (v) {
|
|
15020
|
+
try {
|
|
15021
|
+
return JSON.stringify(v);
|
|
15022
|
+
} catch (error) {
|
|
15023
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
15024
|
+
}
|
|
15025
|
+
};
|
|
15026
|
+
} (browser, browser.exports));
|
|
15027
|
+
return browser.exports;
|
|
15028
|
+
}
|
|
15029
|
+
|
|
15030
|
+
var node = {exports: {}};
|
|
15031
|
+
|
|
15032
|
+
var hasFlag;
|
|
15033
|
+
var hasRequiredHasFlag;
|
|
15034
|
+
|
|
15035
|
+
function requireHasFlag () {
|
|
15036
|
+
if (hasRequiredHasFlag) return hasFlag;
|
|
15037
|
+
hasRequiredHasFlag = 1;
|
|
15038
|
+
hasFlag = (flag, argv) => {
|
|
15039
|
+
argv = argv || process.argv;
|
|
15040
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
15041
|
+
const pos = argv.indexOf(prefix + flag);
|
|
15042
|
+
const terminatorPos = argv.indexOf('--');
|
|
15043
|
+
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
15044
|
+
};
|
|
15045
|
+
return hasFlag;
|
|
15046
|
+
}
|
|
15047
|
+
|
|
15048
|
+
var supportsColor_1;
|
|
15049
|
+
var hasRequiredSupportsColor;
|
|
15050
|
+
|
|
15051
|
+
function requireSupportsColor () {
|
|
15052
|
+
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
15053
|
+
hasRequiredSupportsColor = 1;
|
|
15054
|
+
const os = require$$0$2;
|
|
15055
|
+
const hasFlag = requireHasFlag();
|
|
15056
|
+
|
|
15057
|
+
const env = process.env;
|
|
15058
|
+
|
|
15059
|
+
let forceColor;
|
|
15060
|
+
if (hasFlag('no-color') ||
|
|
15061
|
+
hasFlag('no-colors') ||
|
|
15062
|
+
hasFlag('color=false')) {
|
|
15063
|
+
forceColor = false;
|
|
15064
|
+
} else if (hasFlag('color') ||
|
|
15065
|
+
hasFlag('colors') ||
|
|
15066
|
+
hasFlag('color=true') ||
|
|
15067
|
+
hasFlag('color=always')) {
|
|
15068
|
+
forceColor = true;
|
|
15069
|
+
}
|
|
15070
|
+
if ('FORCE_COLOR' in env) {
|
|
15071
|
+
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
|
15072
|
+
}
|
|
15073
|
+
|
|
15074
|
+
function translateLevel(level) {
|
|
15075
|
+
if (level === 0) {
|
|
15076
|
+
return false;
|
|
15077
|
+
}
|
|
15078
|
+
|
|
15079
|
+
return {
|
|
15080
|
+
level,
|
|
15081
|
+
hasBasic: true,
|
|
15082
|
+
has256: level >= 2,
|
|
15083
|
+
has16m: level >= 3
|
|
15084
|
+
};
|
|
15085
|
+
}
|
|
15086
|
+
|
|
15087
|
+
function supportsColor(stream) {
|
|
15088
|
+
if (forceColor === false) {
|
|
15089
|
+
return 0;
|
|
15090
|
+
}
|
|
15091
|
+
|
|
15092
|
+
if (hasFlag('color=16m') ||
|
|
15093
|
+
hasFlag('color=full') ||
|
|
15094
|
+
hasFlag('color=truecolor')) {
|
|
15095
|
+
return 3;
|
|
15096
|
+
}
|
|
15097
|
+
|
|
15098
|
+
if (hasFlag('color=256')) {
|
|
15099
|
+
return 2;
|
|
15100
|
+
}
|
|
15101
|
+
|
|
15102
|
+
if (stream && !stream.isTTY && forceColor !== true) {
|
|
15103
|
+
return 0;
|
|
15104
|
+
}
|
|
15105
|
+
|
|
15106
|
+
const min = forceColor ? 1 : 0;
|
|
15107
|
+
|
|
15108
|
+
if (process.platform === 'win32') {
|
|
15109
|
+
// Node.js 7.5.0 is the first version of Node.js to include a patch to
|
|
15110
|
+
// libuv that enables 256 color output on Windows. Anything earlier and it
|
|
15111
|
+
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
|
|
15112
|
+
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
|
|
15113
|
+
// release that supports 256 colors. Windows 10 build 14931 is the first release
|
|
15114
|
+
// that supports 16m/TrueColor.
|
|
15115
|
+
const osRelease = os.release().split('.');
|
|
15116
|
+
if (
|
|
15117
|
+
Number(process.versions.node.split('.')[0]) >= 8 &&
|
|
15118
|
+
Number(osRelease[0]) >= 10 &&
|
|
15119
|
+
Number(osRelease[2]) >= 10586
|
|
15120
|
+
) {
|
|
15121
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
15122
|
+
}
|
|
15123
|
+
|
|
15124
|
+
return 1;
|
|
15125
|
+
}
|
|
15126
|
+
|
|
15127
|
+
if ('CI' in env) {
|
|
15128
|
+
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
15129
|
+
return 1;
|
|
15130
|
+
}
|
|
15131
|
+
|
|
15132
|
+
return min;
|
|
15133
|
+
}
|
|
15134
|
+
|
|
15135
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
15136
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
15137
|
+
}
|
|
15138
|
+
|
|
15139
|
+
if (env.COLORTERM === 'truecolor') {
|
|
15140
|
+
return 3;
|
|
15141
|
+
}
|
|
15142
|
+
|
|
15143
|
+
if ('TERM_PROGRAM' in env) {
|
|
15144
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
15145
|
+
|
|
15146
|
+
switch (env.TERM_PROGRAM) {
|
|
15147
|
+
case 'iTerm.app':
|
|
15148
|
+
return version >= 3 ? 3 : 2;
|
|
15149
|
+
case 'Apple_Terminal':
|
|
15150
|
+
return 2;
|
|
15151
|
+
// No default
|
|
15152
|
+
}
|
|
15153
|
+
}
|
|
15154
|
+
|
|
15155
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
15156
|
+
return 2;
|
|
15157
|
+
}
|
|
15158
|
+
|
|
15159
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
15160
|
+
return 1;
|
|
15161
|
+
}
|
|
15162
|
+
|
|
15163
|
+
if ('COLORTERM' in env) {
|
|
15164
|
+
return 1;
|
|
15165
|
+
}
|
|
15166
|
+
|
|
15167
|
+
if (env.TERM === 'dumb') {
|
|
15168
|
+
return min;
|
|
15169
|
+
}
|
|
15170
|
+
|
|
15171
|
+
return min;
|
|
15172
|
+
}
|
|
15173
|
+
|
|
15174
|
+
function getSupportLevel(stream) {
|
|
15175
|
+
const level = supportsColor(stream);
|
|
15176
|
+
return translateLevel(level);
|
|
15177
|
+
}
|
|
15178
|
+
|
|
15179
|
+
supportsColor_1 = {
|
|
15180
|
+
supportsColor: getSupportLevel,
|
|
15181
|
+
stdout: getSupportLevel(process.stdout),
|
|
15182
|
+
stderr: getSupportLevel(process.stderr)
|
|
15183
|
+
};
|
|
15184
|
+
return supportsColor_1;
|
|
15185
|
+
}
|
|
15186
|
+
|
|
15187
|
+
/**
|
|
15188
|
+
* Module dependencies.
|
|
15189
|
+
*/
|
|
15190
|
+
|
|
15191
|
+
var hasRequiredNode;
|
|
15192
|
+
|
|
15193
|
+
function requireNode () {
|
|
15194
|
+
if (hasRequiredNode) return node.exports;
|
|
15195
|
+
hasRequiredNode = 1;
|
|
15196
|
+
(function (module, exports) {
|
|
15197
|
+
const tty = require$$0$3;
|
|
15198
|
+
const util = require$$1;
|
|
15199
|
+
|
|
15200
|
+
/**
|
|
15201
|
+
* This is the Node.js implementation of `debug()`.
|
|
15202
|
+
*/
|
|
15203
|
+
|
|
15204
|
+
exports.init = init;
|
|
15205
|
+
exports.log = log;
|
|
15206
|
+
exports.formatArgs = formatArgs;
|
|
15207
|
+
exports.save = save;
|
|
15208
|
+
exports.load = load;
|
|
15209
|
+
exports.useColors = useColors;
|
|
15210
|
+
exports.destroy = util.deprecate(
|
|
15211
|
+
() => {},
|
|
15212
|
+
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
15213
|
+
);
|
|
15214
|
+
|
|
15215
|
+
/**
|
|
15216
|
+
* Colors.
|
|
15217
|
+
*/
|
|
15218
|
+
|
|
15219
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
15220
|
+
|
|
15221
|
+
try {
|
|
15222
|
+
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
15223
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
15224
|
+
const supportsColor = requireSupportsColor();
|
|
15225
|
+
|
|
15226
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
15227
|
+
exports.colors = [
|
|
15228
|
+
20,
|
|
15229
|
+
21,
|
|
15230
|
+
26,
|
|
15231
|
+
27,
|
|
15232
|
+
32,
|
|
15233
|
+
33,
|
|
15234
|
+
38,
|
|
15235
|
+
39,
|
|
15236
|
+
40,
|
|
15237
|
+
41,
|
|
15238
|
+
42,
|
|
15239
|
+
43,
|
|
15240
|
+
44,
|
|
15241
|
+
45,
|
|
15242
|
+
56,
|
|
15243
|
+
57,
|
|
15244
|
+
62,
|
|
15245
|
+
63,
|
|
15246
|
+
68,
|
|
15247
|
+
69,
|
|
15248
|
+
74,
|
|
15249
|
+
75,
|
|
15250
|
+
76,
|
|
15251
|
+
77,
|
|
15252
|
+
78,
|
|
15253
|
+
79,
|
|
15254
|
+
80,
|
|
15255
|
+
81,
|
|
15256
|
+
92,
|
|
15257
|
+
93,
|
|
15258
|
+
98,
|
|
15259
|
+
99,
|
|
15260
|
+
112,
|
|
15261
|
+
113,
|
|
15262
|
+
128,
|
|
15263
|
+
129,
|
|
15264
|
+
134,
|
|
15265
|
+
135,
|
|
15266
|
+
148,
|
|
15267
|
+
149,
|
|
15268
|
+
160,
|
|
15269
|
+
161,
|
|
15270
|
+
162,
|
|
15271
|
+
163,
|
|
15272
|
+
164,
|
|
15273
|
+
165,
|
|
15274
|
+
166,
|
|
15275
|
+
167,
|
|
15276
|
+
168,
|
|
15277
|
+
169,
|
|
15278
|
+
170,
|
|
15279
|
+
171,
|
|
15280
|
+
172,
|
|
15281
|
+
173,
|
|
15282
|
+
178,
|
|
15283
|
+
179,
|
|
15284
|
+
184,
|
|
15285
|
+
185,
|
|
15286
|
+
196,
|
|
15287
|
+
197,
|
|
15288
|
+
198,
|
|
15289
|
+
199,
|
|
15290
|
+
200,
|
|
15291
|
+
201,
|
|
15292
|
+
202,
|
|
15293
|
+
203,
|
|
15294
|
+
204,
|
|
15295
|
+
205,
|
|
15296
|
+
206,
|
|
15297
|
+
207,
|
|
15298
|
+
208,
|
|
15299
|
+
209,
|
|
15300
|
+
214,
|
|
15301
|
+
215,
|
|
15302
|
+
220,
|
|
15303
|
+
221
|
|
15304
|
+
];
|
|
15305
|
+
}
|
|
15306
|
+
} catch (error) {
|
|
15307
|
+
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
15308
|
+
}
|
|
15309
|
+
|
|
15310
|
+
/**
|
|
15311
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
15312
|
+
*
|
|
15313
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
15314
|
+
*/
|
|
15315
|
+
|
|
15316
|
+
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
15317
|
+
return /^debug_/i.test(key);
|
|
15318
|
+
}).reduce((obj, key) => {
|
|
15319
|
+
// Camel-case
|
|
15320
|
+
const prop = key
|
|
15321
|
+
.substring(6)
|
|
15322
|
+
.toLowerCase()
|
|
15323
|
+
.replace(/_([a-z])/g, (_, k) => {
|
|
15324
|
+
return k.toUpperCase();
|
|
15325
|
+
});
|
|
15326
|
+
|
|
15327
|
+
// Coerce string value into JS value
|
|
15328
|
+
let val = process.env[key];
|
|
15329
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
15330
|
+
val = true;
|
|
15331
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
15332
|
+
val = false;
|
|
15333
|
+
} else if (val === 'null') {
|
|
15334
|
+
val = null;
|
|
15335
|
+
} else {
|
|
15336
|
+
val = Number(val);
|
|
15337
|
+
}
|
|
15338
|
+
|
|
15339
|
+
obj[prop] = val;
|
|
15340
|
+
return obj;
|
|
15341
|
+
}, {});
|
|
15342
|
+
|
|
15343
|
+
/**
|
|
15344
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
15345
|
+
*/
|
|
15346
|
+
|
|
15347
|
+
function useColors() {
|
|
15348
|
+
return 'colors' in exports.inspectOpts ?
|
|
15349
|
+
Boolean(exports.inspectOpts.colors) :
|
|
15350
|
+
tty.isatty(process.stderr.fd);
|
|
15351
|
+
}
|
|
15352
|
+
|
|
15353
|
+
/**
|
|
15354
|
+
* Adds ANSI color escape codes if enabled.
|
|
15355
|
+
*
|
|
15356
|
+
* @api public
|
|
15357
|
+
*/
|
|
15358
|
+
|
|
15359
|
+
function formatArgs(args) {
|
|
15360
|
+
const {namespace: name, useColors} = this;
|
|
15361
|
+
|
|
15362
|
+
if (useColors) {
|
|
15363
|
+
const c = this.color;
|
|
15364
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
15365
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
15366
|
+
|
|
15367
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
15368
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
15369
|
+
} else {
|
|
15370
|
+
args[0] = getDate() + name + ' ' + args[0];
|
|
15371
|
+
}
|
|
15372
|
+
}
|
|
15373
|
+
|
|
15374
|
+
function getDate() {
|
|
15375
|
+
if (exports.inspectOpts.hideDate) {
|
|
15376
|
+
return '';
|
|
15377
|
+
}
|
|
15378
|
+
return new Date().toISOString() + ' ';
|
|
15379
|
+
}
|
|
15380
|
+
|
|
15381
|
+
/**
|
|
15382
|
+
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
15383
|
+
*/
|
|
15384
|
+
|
|
15385
|
+
function log(...args) {
|
|
15386
|
+
return process.stderr.write(util.format(...args) + '\n');
|
|
15387
|
+
}
|
|
15388
|
+
|
|
15389
|
+
/**
|
|
15390
|
+
* Save `namespaces`.
|
|
15391
|
+
*
|
|
15392
|
+
* @param {String} namespaces
|
|
15393
|
+
* @api private
|
|
15394
|
+
*/
|
|
15395
|
+
function save(namespaces) {
|
|
15396
|
+
if (namespaces) {
|
|
15397
|
+
process.env.DEBUG = namespaces;
|
|
15398
|
+
} else {
|
|
15399
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
|
15400
|
+
// string 'null' or 'undefined'. Just delete instead.
|
|
15401
|
+
delete process.env.DEBUG;
|
|
15402
|
+
}
|
|
15403
|
+
}
|
|
15404
|
+
|
|
15405
|
+
/**
|
|
15406
|
+
* Load `namespaces`.
|
|
15407
|
+
*
|
|
15408
|
+
* @return {String} returns the previously persisted debug modes
|
|
15409
|
+
* @api private
|
|
15410
|
+
*/
|
|
15411
|
+
|
|
15412
|
+
function load() {
|
|
15413
|
+
return process.env.DEBUG;
|
|
15414
|
+
}
|
|
15415
|
+
|
|
15416
|
+
/**
|
|
15417
|
+
* Init logic for `debug` instances.
|
|
15418
|
+
*
|
|
15419
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
15420
|
+
* differently for a particular `debug` instance.
|
|
15421
|
+
*/
|
|
15422
|
+
|
|
15423
|
+
function init(debug) {
|
|
15424
|
+
debug.inspectOpts = {};
|
|
15425
|
+
|
|
15426
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
15427
|
+
for (let i = 0; i < keys.length; i++) {
|
|
15428
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
15429
|
+
}
|
|
15430
|
+
}
|
|
15431
|
+
|
|
15432
|
+
module.exports = requireCommon()(exports);
|
|
15433
|
+
|
|
15434
|
+
const {formatters} = module.exports;
|
|
15435
|
+
|
|
15436
|
+
/**
|
|
15437
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
15438
|
+
*/
|
|
15439
|
+
|
|
15440
|
+
formatters.o = function (v) {
|
|
15441
|
+
this.inspectOpts.colors = this.useColors;
|
|
15442
|
+
return util.inspect(v, this.inspectOpts)
|
|
15443
|
+
.split('\n')
|
|
15444
|
+
.map(str => str.trim())
|
|
15445
|
+
.join(' ');
|
|
15446
|
+
};
|
|
15447
|
+
|
|
15448
|
+
/**
|
|
15449
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
15450
|
+
*/
|
|
15451
|
+
|
|
15452
|
+
formatters.O = function (v) {
|
|
15453
|
+
this.inspectOpts.colors = this.useColors;
|
|
15454
|
+
return util.inspect(v, this.inspectOpts);
|
|
15455
|
+
};
|
|
15456
|
+
} (node, node.exports));
|
|
15457
|
+
return node.exports;
|
|
15458
|
+
}
|
|
15459
|
+
|
|
15460
|
+
/**
|
|
15461
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
15462
|
+
* treat as a browser.
|
|
15463
|
+
*/
|
|
15464
|
+
|
|
15465
|
+
var hasRequiredSrc;
|
|
15466
|
+
|
|
15467
|
+
function requireSrc () {
|
|
15468
|
+
if (hasRequiredSrc) return src.exports;
|
|
15469
|
+
hasRequiredSrc = 1;
|
|
15470
|
+
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
15471
|
+
src.exports = requireBrowser();
|
|
15472
|
+
} else {
|
|
15473
|
+
src.exports = requireNode();
|
|
15474
|
+
}
|
|
15475
|
+
return src.exports;
|
|
15476
|
+
}
|
|
15477
|
+
|
|
14254
15478
|
var debug$1;
|
|
14255
15479
|
|
|
14256
15480
|
var debug_1 = function () {
|
|
14257
15481
|
if (!debug$1) {
|
|
14258
15482
|
try {
|
|
14259
15483
|
/* eslint global-require: off */
|
|
14260
|
-
debug$1 =
|
|
15484
|
+
debug$1 = requireSrc()("follow-redirects");
|
|
14261
15485
|
}
|
|
14262
15486
|
catch (error) { /* */ }
|
|
14263
15487
|
if (typeof debug$1 !== "function") {
|
|
@@ -19880,6 +21104,68 @@ var Posts = /** @class */ (function () {
|
|
|
19880
21104
|
Posts.createWithBlob = function (blob, data) {
|
|
19881
21105
|
return Requests.uploadBlob(PostsRoute.routes.create.url, 'file', blob, data);
|
|
19882
21106
|
};
|
|
21107
|
+
/**
|
|
21108
|
+
* Create a new post with a file divided into chunks.
|
|
21109
|
+
*
|
|
21110
|
+
* @param file The file object to upload.
|
|
21111
|
+
* @param chunkSize Size of each chunk in bytes. Default is 1MB.
|
|
21112
|
+
* @param data Any additional data to pass along to the upload.
|
|
21113
|
+
*
|
|
21114
|
+
* @returns Promise
|
|
21115
|
+
*/
|
|
21116
|
+
/**
|
|
21117
|
+
* Create a new post with a file divided into chunks.
|
|
21118
|
+
*
|
|
21119
|
+
* @param file The file object to upload.
|
|
21120
|
+
* @param chunkSize Size of each chunk in bytes. Default is 1MB.
|
|
21121
|
+
* @param data Any additional data to pass along to the upload.
|
|
21122
|
+
*
|
|
21123
|
+
* @returns Promise
|
|
21124
|
+
*/
|
|
21125
|
+
Posts.createWithFileInChunks = function (file, chunkSize, data) {
|
|
21126
|
+
if (chunkSize === void 0) { chunkSize = 1 * 1024 * 1024; }
|
|
21127
|
+
if (data === void 0) { data = {}; }
|
|
21128
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
21129
|
+
var totalChunks, i, start, end, chunk, formData, key;
|
|
21130
|
+
return __generator(this, function (_a) {
|
|
21131
|
+
switch (_a.label) {
|
|
21132
|
+
case 0:
|
|
21133
|
+
totalChunks = Math.ceil(file.size / chunkSize);
|
|
21134
|
+
i = 0;
|
|
21135
|
+
_a.label = 1;
|
|
21136
|
+
case 1:
|
|
21137
|
+
if (!(i < totalChunks)) return [3 /*break*/, 6];
|
|
21138
|
+
start = i * chunkSize;
|
|
21139
|
+
end = start + chunkSize;
|
|
21140
|
+
chunk = file.slice(start, end);
|
|
21141
|
+
formData = new FormData();
|
|
21142
|
+
formData.append('file', chunk, "".concat(i, "-").concat(file.name)); // Naming chunks as index-filename for identification
|
|
21143
|
+
formData.append('totalChunks', totalChunks.toString());
|
|
21144
|
+
formData.append('currentChunk', i.toString());
|
|
21145
|
+
// merge any other data if provided
|
|
21146
|
+
for (key in data) {
|
|
21147
|
+
formData.append(key, data[key]);
|
|
21148
|
+
}
|
|
21149
|
+
if (!(i === totalChunks - 1)) return [3 /*break*/, 3];
|
|
21150
|
+
return [4 /*yield*/, Requests.uploadFile(PostsRoute.routes.create.url, 'file', chunk, formData)];
|
|
21151
|
+
case 2:
|
|
21152
|
+
_a.sent();
|
|
21153
|
+
return [3 /*break*/, 5];
|
|
21154
|
+
case 3: return [4 /*yield*/, Requests.uploadFile(PostsRoute.routes.create.url, 'file', chunk, formData)];
|
|
21155
|
+
case 4:
|
|
21156
|
+
_a.sent();
|
|
21157
|
+
_a.label = 5;
|
|
21158
|
+
case 5:
|
|
21159
|
+
i++;
|
|
21160
|
+
return [3 /*break*/, 1];
|
|
21161
|
+
case 6:
|
|
21162
|
+
{
|
|
21163
|
+
throw new Error("No response from the last chunk upload");
|
|
21164
|
+
}
|
|
21165
|
+
}
|
|
21166
|
+
});
|
|
21167
|
+
});
|
|
21168
|
+
};
|
|
19883
21169
|
/**
|
|
19884
21170
|
* Update a post.
|
|
19885
21171
|
*
|
|
@@ -20356,6 +21642,55 @@ var TipPackagePurchases = /** @class */ (function () {
|
|
|
20356
21642
|
return TipPackagePurchases;
|
|
20357
21643
|
}());
|
|
20358
21644
|
|
|
21645
|
+
var SocialPostsRoute = /** @class */ (function () {
|
|
21646
|
+
function SocialPostsRoute() {
|
|
21647
|
+
}
|
|
21648
|
+
SocialPostsRoute.routes = {
|
|
21649
|
+
getPosts: { url: '/socialposts', method: HTTP_METHODS.GET },
|
|
21650
|
+
createPost: { url: '/socialposts', method: HTTP_METHODS.POST },
|
|
21651
|
+
retrievePost: { url: '/socialposts/{post_id}', method: HTTP_METHODS.GET },
|
|
21652
|
+
};
|
|
21653
|
+
return SocialPostsRoute;
|
|
21654
|
+
}());
|
|
21655
|
+
|
|
21656
|
+
var SocialPosts = /** @class */ (function () {
|
|
21657
|
+
function SocialPosts() {
|
|
21658
|
+
}
|
|
21659
|
+
/**
|
|
21660
|
+
* List all the Posts.
|
|
21661
|
+
*
|
|
21662
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
|
|
21663
|
+
*
|
|
21664
|
+
* @returns promise
|
|
21665
|
+
*/
|
|
21666
|
+
SocialPosts.list = function (params) {
|
|
21667
|
+
return Requests.processRoute(SocialPostsRoute.routes.getPosts, undefined, undefined, params);
|
|
21668
|
+
};
|
|
21669
|
+
/**
|
|
21670
|
+
* Give a tip to another user
|
|
21671
|
+
*
|
|
21672
|
+
* @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
|
|
21673
|
+
*
|
|
21674
|
+
* @returns A promise
|
|
21675
|
+
*/
|
|
21676
|
+
SocialPosts.create = function (data, params) {
|
|
21677
|
+
return Requests.processRoute(SocialPostsRoute.routes.create, data, {}, params);
|
|
21678
|
+
};
|
|
21679
|
+
/**
|
|
21680
|
+
* Retrieve the information for a single post.
|
|
21681
|
+
*
|
|
21682
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
|
|
21683
|
+
*
|
|
21684
|
+
* @param post_id The id fo the post to retrieve.
|
|
21685
|
+
*
|
|
21686
|
+
* @returns promise
|
|
21687
|
+
*/
|
|
21688
|
+
SocialPosts.view = function (post_id, params) {
|
|
21689
|
+
return Requests.processRoute(SocialPostsRoute.routes.retrievePost, {}, { post_id: post_id }, params);
|
|
21690
|
+
};
|
|
21691
|
+
return SocialPosts;
|
|
21692
|
+
}());
|
|
21693
|
+
|
|
20359
21694
|
var Parser = /** @class */ (function () {
|
|
20360
21695
|
function Parser() {
|
|
20361
21696
|
}
|
|
@@ -20737,6 +22072,7 @@ var Glitch = /** @class */ (function () {
|
|
|
20737
22072
|
Utility: Utility,
|
|
20738
22073
|
Tips: Tips,
|
|
20739
22074
|
Social: Social,
|
|
22075
|
+
SocialPosts: SocialPosts,
|
|
20740
22076
|
TipPackages: TipPackages,
|
|
20741
22077
|
TipEmojis: TipEmojis,
|
|
20742
22078
|
TipPackagePurchases: TipPackagePurchases
|