@squidcloud/client 1.0.190 → 1.0.192
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
CHANGED
|
@@ -1412,567 +1412,6 @@ __exportStar(__webpack_require__(9862), exports);
|
|
|
1412
1412
|
__exportStar(__webpack_require__(7122), exports);
|
|
1413
1413
|
//# sourceMappingURL=index.js.map
|
|
1414
1414
|
|
|
1415
|
-
/***/ }),
|
|
1416
|
-
|
|
1417
|
-
/***/ 9372:
|
|
1418
|
-
/***/ (function(module, exports) {
|
|
1419
|
-
|
|
1420
|
-
var global = typeof self !== 'undefined' ? self : this;
|
|
1421
|
-
var __self__ = (function () {
|
|
1422
|
-
function F() {
|
|
1423
|
-
this.fetch = false;
|
|
1424
|
-
this.DOMException = global.DOMException
|
|
1425
|
-
}
|
|
1426
|
-
F.prototype = global;
|
|
1427
|
-
return new F();
|
|
1428
|
-
})();
|
|
1429
|
-
(function(self) {
|
|
1430
|
-
|
|
1431
|
-
var irrelevant = (function (exports) {
|
|
1432
|
-
|
|
1433
|
-
var support = {
|
|
1434
|
-
searchParams: 'URLSearchParams' in self,
|
|
1435
|
-
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
1436
|
-
blob:
|
|
1437
|
-
'FileReader' in self &&
|
|
1438
|
-
'Blob' in self &&
|
|
1439
|
-
(function() {
|
|
1440
|
-
try {
|
|
1441
|
-
new Blob();
|
|
1442
|
-
return true
|
|
1443
|
-
} catch (e) {
|
|
1444
|
-
return false
|
|
1445
|
-
}
|
|
1446
|
-
})(),
|
|
1447
|
-
formData: 'FormData' in self,
|
|
1448
|
-
arrayBuffer: 'ArrayBuffer' in self
|
|
1449
|
-
};
|
|
1450
|
-
|
|
1451
|
-
function isDataView(obj) {
|
|
1452
|
-
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
if (support.arrayBuffer) {
|
|
1456
|
-
var viewClasses = [
|
|
1457
|
-
'[object Int8Array]',
|
|
1458
|
-
'[object Uint8Array]',
|
|
1459
|
-
'[object Uint8ClampedArray]',
|
|
1460
|
-
'[object Int16Array]',
|
|
1461
|
-
'[object Uint16Array]',
|
|
1462
|
-
'[object Int32Array]',
|
|
1463
|
-
'[object Uint32Array]',
|
|
1464
|
-
'[object Float32Array]',
|
|
1465
|
-
'[object Float64Array]'
|
|
1466
|
-
];
|
|
1467
|
-
|
|
1468
|
-
var isArrayBufferView =
|
|
1469
|
-
ArrayBuffer.isView ||
|
|
1470
|
-
function(obj) {
|
|
1471
|
-
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
1472
|
-
};
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
function normalizeName(name) {
|
|
1476
|
-
if (typeof name !== 'string') {
|
|
1477
|
-
name = String(name);
|
|
1478
|
-
}
|
|
1479
|
-
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
1480
|
-
throw new TypeError('Invalid character in header field name')
|
|
1481
|
-
}
|
|
1482
|
-
return name.toLowerCase()
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
function normalizeValue(value) {
|
|
1486
|
-
if (typeof value !== 'string') {
|
|
1487
|
-
value = String(value);
|
|
1488
|
-
}
|
|
1489
|
-
return value
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
// Build a destructive iterator for the value list
|
|
1493
|
-
function iteratorFor(items) {
|
|
1494
|
-
var iterator = {
|
|
1495
|
-
next: function() {
|
|
1496
|
-
var value = items.shift();
|
|
1497
|
-
return {done: value === undefined, value: value}
|
|
1498
|
-
}
|
|
1499
|
-
};
|
|
1500
|
-
|
|
1501
|
-
if (support.iterable) {
|
|
1502
|
-
iterator[Symbol.iterator] = function() {
|
|
1503
|
-
return iterator
|
|
1504
|
-
};
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
return iterator
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
function Headers(headers) {
|
|
1511
|
-
this.map = {};
|
|
1512
|
-
|
|
1513
|
-
if (headers instanceof Headers) {
|
|
1514
|
-
headers.forEach(function(value, name) {
|
|
1515
|
-
this.append(name, value);
|
|
1516
|
-
}, this);
|
|
1517
|
-
} else if (Array.isArray(headers)) {
|
|
1518
|
-
headers.forEach(function(header) {
|
|
1519
|
-
this.append(header[0], header[1]);
|
|
1520
|
-
}, this);
|
|
1521
|
-
} else if (headers) {
|
|
1522
|
-
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
1523
|
-
this.append(name, headers[name]);
|
|
1524
|
-
}, this);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
Headers.prototype.append = function(name, value) {
|
|
1529
|
-
name = normalizeName(name);
|
|
1530
|
-
value = normalizeValue(value);
|
|
1531
|
-
var oldValue = this.map[name];
|
|
1532
|
-
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
1533
|
-
};
|
|
1534
|
-
|
|
1535
|
-
Headers.prototype['delete'] = function(name) {
|
|
1536
|
-
delete this.map[normalizeName(name)];
|
|
1537
|
-
};
|
|
1538
|
-
|
|
1539
|
-
Headers.prototype.get = function(name) {
|
|
1540
|
-
name = normalizeName(name);
|
|
1541
|
-
return this.has(name) ? this.map[name] : null
|
|
1542
|
-
};
|
|
1543
|
-
|
|
1544
|
-
Headers.prototype.has = function(name) {
|
|
1545
|
-
return this.map.hasOwnProperty(normalizeName(name))
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1548
|
-
Headers.prototype.set = function(name, value) {
|
|
1549
|
-
this.map[normalizeName(name)] = normalizeValue(value);
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
|
-
Headers.prototype.forEach = function(callback, thisArg) {
|
|
1553
|
-
for (var name in this.map) {
|
|
1554
|
-
if (this.map.hasOwnProperty(name)) {
|
|
1555
|
-
callback.call(thisArg, this.map[name], name, this);
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
Headers.prototype.keys = function() {
|
|
1561
|
-
var items = [];
|
|
1562
|
-
this.forEach(function(value, name) {
|
|
1563
|
-
items.push(name);
|
|
1564
|
-
});
|
|
1565
|
-
return iteratorFor(items)
|
|
1566
|
-
};
|
|
1567
|
-
|
|
1568
|
-
Headers.prototype.values = function() {
|
|
1569
|
-
var items = [];
|
|
1570
|
-
this.forEach(function(value) {
|
|
1571
|
-
items.push(value);
|
|
1572
|
-
});
|
|
1573
|
-
return iteratorFor(items)
|
|
1574
|
-
};
|
|
1575
|
-
|
|
1576
|
-
Headers.prototype.entries = function() {
|
|
1577
|
-
var items = [];
|
|
1578
|
-
this.forEach(function(value, name) {
|
|
1579
|
-
items.push([name, value]);
|
|
1580
|
-
});
|
|
1581
|
-
return iteratorFor(items)
|
|
1582
|
-
};
|
|
1583
|
-
|
|
1584
|
-
if (support.iterable) {
|
|
1585
|
-
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
function consumed(body) {
|
|
1589
|
-
if (body.bodyUsed) {
|
|
1590
|
-
return Promise.reject(new TypeError('Already read'))
|
|
1591
|
-
}
|
|
1592
|
-
body.bodyUsed = true;
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
function fileReaderReady(reader) {
|
|
1596
|
-
return new Promise(function(resolve, reject) {
|
|
1597
|
-
reader.onload = function() {
|
|
1598
|
-
resolve(reader.result);
|
|
1599
|
-
};
|
|
1600
|
-
reader.onerror = function() {
|
|
1601
|
-
reject(reader.error);
|
|
1602
|
-
};
|
|
1603
|
-
})
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
function readBlobAsArrayBuffer(blob) {
|
|
1607
|
-
var reader = new FileReader();
|
|
1608
|
-
var promise = fileReaderReady(reader);
|
|
1609
|
-
reader.readAsArrayBuffer(blob);
|
|
1610
|
-
return promise
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
function readBlobAsText(blob) {
|
|
1614
|
-
var reader = new FileReader();
|
|
1615
|
-
var promise = fileReaderReady(reader);
|
|
1616
|
-
reader.readAsText(blob);
|
|
1617
|
-
return promise
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
function readArrayBufferAsText(buf) {
|
|
1621
|
-
var view = new Uint8Array(buf);
|
|
1622
|
-
var chars = new Array(view.length);
|
|
1623
|
-
|
|
1624
|
-
for (var i = 0; i < view.length; i++) {
|
|
1625
|
-
chars[i] = String.fromCharCode(view[i]);
|
|
1626
|
-
}
|
|
1627
|
-
return chars.join('')
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
function bufferClone(buf) {
|
|
1631
|
-
if (buf.slice) {
|
|
1632
|
-
return buf.slice(0)
|
|
1633
|
-
} else {
|
|
1634
|
-
var view = new Uint8Array(buf.byteLength);
|
|
1635
|
-
view.set(new Uint8Array(buf));
|
|
1636
|
-
return view.buffer
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
function Body() {
|
|
1641
|
-
this.bodyUsed = false;
|
|
1642
|
-
|
|
1643
|
-
this._initBody = function(body) {
|
|
1644
|
-
this._bodyInit = body;
|
|
1645
|
-
if (!body) {
|
|
1646
|
-
this._bodyText = '';
|
|
1647
|
-
} else if (typeof body === 'string') {
|
|
1648
|
-
this._bodyText = body;
|
|
1649
|
-
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
1650
|
-
this._bodyBlob = body;
|
|
1651
|
-
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
1652
|
-
this._bodyFormData = body;
|
|
1653
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
1654
|
-
this._bodyText = body.toString();
|
|
1655
|
-
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
1656
|
-
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
1657
|
-
// IE 10-11 can't handle a DataView body.
|
|
1658
|
-
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
1659
|
-
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
1660
|
-
this._bodyArrayBuffer = bufferClone(body);
|
|
1661
|
-
} else {
|
|
1662
|
-
this._bodyText = body = Object.prototype.toString.call(body);
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
if (!this.headers.get('content-type')) {
|
|
1666
|
-
if (typeof body === 'string') {
|
|
1667
|
-
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
1668
|
-
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
1669
|
-
this.headers.set('content-type', this._bodyBlob.type);
|
|
1670
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
1671
|
-
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
};
|
|
1675
|
-
|
|
1676
|
-
if (support.blob) {
|
|
1677
|
-
this.blob = function() {
|
|
1678
|
-
var rejected = consumed(this);
|
|
1679
|
-
if (rejected) {
|
|
1680
|
-
return rejected
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
if (this._bodyBlob) {
|
|
1684
|
-
return Promise.resolve(this._bodyBlob)
|
|
1685
|
-
} else if (this._bodyArrayBuffer) {
|
|
1686
|
-
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
1687
|
-
} else if (this._bodyFormData) {
|
|
1688
|
-
throw new Error('could not read FormData body as blob')
|
|
1689
|
-
} else {
|
|
1690
|
-
return Promise.resolve(new Blob([this._bodyText]))
|
|
1691
|
-
}
|
|
1692
|
-
};
|
|
1693
|
-
|
|
1694
|
-
this.arrayBuffer = function() {
|
|
1695
|
-
if (this._bodyArrayBuffer) {
|
|
1696
|
-
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
1697
|
-
} else {
|
|
1698
|
-
return this.blob().then(readBlobAsArrayBuffer)
|
|
1699
|
-
}
|
|
1700
|
-
};
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
this.text = function() {
|
|
1704
|
-
var rejected = consumed(this);
|
|
1705
|
-
if (rejected) {
|
|
1706
|
-
return rejected
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
if (this._bodyBlob) {
|
|
1710
|
-
return readBlobAsText(this._bodyBlob)
|
|
1711
|
-
} else if (this._bodyArrayBuffer) {
|
|
1712
|
-
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
1713
|
-
} else if (this._bodyFormData) {
|
|
1714
|
-
throw new Error('could not read FormData body as text')
|
|
1715
|
-
} else {
|
|
1716
|
-
return Promise.resolve(this._bodyText)
|
|
1717
|
-
}
|
|
1718
|
-
};
|
|
1719
|
-
|
|
1720
|
-
if (support.formData) {
|
|
1721
|
-
this.formData = function() {
|
|
1722
|
-
return this.text().then(decode)
|
|
1723
|
-
};
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
this.json = function() {
|
|
1727
|
-
return this.text().then(JSON.parse)
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
return this
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
// HTTP methods whose capitalization should be normalized
|
|
1734
|
-
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
1735
|
-
|
|
1736
|
-
function normalizeMethod(method) {
|
|
1737
|
-
var upcased = method.toUpperCase();
|
|
1738
|
-
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
function Request(input, options) {
|
|
1742
|
-
options = options || {};
|
|
1743
|
-
var body = options.body;
|
|
1744
|
-
|
|
1745
|
-
if (input instanceof Request) {
|
|
1746
|
-
if (input.bodyUsed) {
|
|
1747
|
-
throw new TypeError('Already read')
|
|
1748
|
-
}
|
|
1749
|
-
this.url = input.url;
|
|
1750
|
-
this.credentials = input.credentials;
|
|
1751
|
-
if (!options.headers) {
|
|
1752
|
-
this.headers = new Headers(input.headers);
|
|
1753
|
-
}
|
|
1754
|
-
this.method = input.method;
|
|
1755
|
-
this.mode = input.mode;
|
|
1756
|
-
this.signal = input.signal;
|
|
1757
|
-
if (!body && input._bodyInit != null) {
|
|
1758
|
-
body = input._bodyInit;
|
|
1759
|
-
input.bodyUsed = true;
|
|
1760
|
-
}
|
|
1761
|
-
} else {
|
|
1762
|
-
this.url = String(input);
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
1766
|
-
if (options.headers || !this.headers) {
|
|
1767
|
-
this.headers = new Headers(options.headers);
|
|
1768
|
-
}
|
|
1769
|
-
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
1770
|
-
this.mode = options.mode || this.mode || null;
|
|
1771
|
-
this.signal = options.signal || this.signal;
|
|
1772
|
-
this.referrer = null;
|
|
1773
|
-
|
|
1774
|
-
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
1775
|
-
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
1776
|
-
}
|
|
1777
|
-
this._initBody(body);
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
Request.prototype.clone = function() {
|
|
1781
|
-
return new Request(this, {body: this._bodyInit})
|
|
1782
|
-
};
|
|
1783
|
-
|
|
1784
|
-
function decode(body) {
|
|
1785
|
-
var form = new FormData();
|
|
1786
|
-
body
|
|
1787
|
-
.trim()
|
|
1788
|
-
.split('&')
|
|
1789
|
-
.forEach(function(bytes) {
|
|
1790
|
-
if (bytes) {
|
|
1791
|
-
var split = bytes.split('=');
|
|
1792
|
-
var name = split.shift().replace(/\+/g, ' ');
|
|
1793
|
-
var value = split.join('=').replace(/\+/g, ' ');
|
|
1794
|
-
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
return form
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
function parseHeaders(rawHeaders) {
|
|
1801
|
-
var headers = new Headers();
|
|
1802
|
-
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
1803
|
-
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
1804
|
-
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
1805
|
-
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
1806
|
-
var parts = line.split(':');
|
|
1807
|
-
var key = parts.shift().trim();
|
|
1808
|
-
if (key) {
|
|
1809
|
-
var value = parts.join(':').trim();
|
|
1810
|
-
headers.append(key, value);
|
|
1811
|
-
}
|
|
1812
|
-
});
|
|
1813
|
-
return headers
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
Body.call(Request.prototype);
|
|
1817
|
-
|
|
1818
|
-
function Response(bodyInit, options) {
|
|
1819
|
-
if (!options) {
|
|
1820
|
-
options = {};
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
this.type = 'default';
|
|
1824
|
-
this.status = options.status === undefined ? 200 : options.status;
|
|
1825
|
-
this.ok = this.status >= 200 && this.status < 300;
|
|
1826
|
-
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
1827
|
-
this.headers = new Headers(options.headers);
|
|
1828
|
-
this.url = options.url || '';
|
|
1829
|
-
this._initBody(bodyInit);
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
Body.call(Response.prototype);
|
|
1833
|
-
|
|
1834
|
-
Response.prototype.clone = function() {
|
|
1835
|
-
return new Response(this._bodyInit, {
|
|
1836
|
-
status: this.status,
|
|
1837
|
-
statusText: this.statusText,
|
|
1838
|
-
headers: new Headers(this.headers),
|
|
1839
|
-
url: this.url
|
|
1840
|
-
})
|
|
1841
|
-
};
|
|
1842
|
-
|
|
1843
|
-
Response.error = function() {
|
|
1844
|
-
var response = new Response(null, {status: 0, statusText: ''});
|
|
1845
|
-
response.type = 'error';
|
|
1846
|
-
return response
|
|
1847
|
-
};
|
|
1848
|
-
|
|
1849
|
-
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
1850
|
-
|
|
1851
|
-
Response.redirect = function(url, status) {
|
|
1852
|
-
if (redirectStatuses.indexOf(status) === -1) {
|
|
1853
|
-
throw new RangeError('Invalid status code')
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
return new Response(null, {status: status, headers: {location: url}})
|
|
1857
|
-
};
|
|
1858
|
-
|
|
1859
|
-
exports.DOMException = self.DOMException;
|
|
1860
|
-
try {
|
|
1861
|
-
new exports.DOMException();
|
|
1862
|
-
} catch (err) {
|
|
1863
|
-
exports.DOMException = function(message, name) {
|
|
1864
|
-
this.message = message;
|
|
1865
|
-
this.name = name;
|
|
1866
|
-
var error = Error(message);
|
|
1867
|
-
this.stack = error.stack;
|
|
1868
|
-
};
|
|
1869
|
-
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
1870
|
-
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
function fetch(input, init) {
|
|
1874
|
-
return new Promise(function(resolve, reject) {
|
|
1875
|
-
var request = new Request(input, init);
|
|
1876
|
-
|
|
1877
|
-
if (request.signal && request.signal.aborted) {
|
|
1878
|
-
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
var xhr = new XMLHttpRequest();
|
|
1882
|
-
|
|
1883
|
-
function abortXhr() {
|
|
1884
|
-
xhr.abort();
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
xhr.onload = function() {
|
|
1888
|
-
var options = {
|
|
1889
|
-
status: xhr.status,
|
|
1890
|
-
statusText: xhr.statusText,
|
|
1891
|
-
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
1892
|
-
};
|
|
1893
|
-
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
1894
|
-
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
1895
|
-
resolve(new Response(body, options));
|
|
1896
|
-
};
|
|
1897
|
-
|
|
1898
|
-
xhr.onerror = function() {
|
|
1899
|
-
reject(new TypeError('Network request failed'));
|
|
1900
|
-
};
|
|
1901
|
-
|
|
1902
|
-
xhr.ontimeout = function() {
|
|
1903
|
-
reject(new TypeError('Network request failed'));
|
|
1904
|
-
};
|
|
1905
|
-
|
|
1906
|
-
xhr.onabort = function() {
|
|
1907
|
-
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
1908
|
-
};
|
|
1909
|
-
|
|
1910
|
-
xhr.open(request.method, request.url, true);
|
|
1911
|
-
|
|
1912
|
-
if (request.credentials === 'include') {
|
|
1913
|
-
xhr.withCredentials = true;
|
|
1914
|
-
} else if (request.credentials === 'omit') {
|
|
1915
|
-
xhr.withCredentials = false;
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
if ('responseType' in xhr && support.blob) {
|
|
1919
|
-
xhr.responseType = 'blob';
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
request.headers.forEach(function(value, name) {
|
|
1923
|
-
xhr.setRequestHeader(name, value);
|
|
1924
|
-
});
|
|
1925
|
-
|
|
1926
|
-
if (request.signal) {
|
|
1927
|
-
request.signal.addEventListener('abort', abortXhr);
|
|
1928
|
-
|
|
1929
|
-
xhr.onreadystatechange = function() {
|
|
1930
|
-
// DONE (success or failure)
|
|
1931
|
-
if (xhr.readyState === 4) {
|
|
1932
|
-
request.signal.removeEventListener('abort', abortXhr);
|
|
1933
|
-
}
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
1938
|
-
})
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
fetch.polyfill = true;
|
|
1942
|
-
|
|
1943
|
-
if (!self.fetch) {
|
|
1944
|
-
self.fetch = fetch;
|
|
1945
|
-
self.Headers = Headers;
|
|
1946
|
-
self.Request = Request;
|
|
1947
|
-
self.Response = Response;
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
exports.Headers = Headers;
|
|
1951
|
-
exports.Request = Request;
|
|
1952
|
-
exports.Response = Response;
|
|
1953
|
-
exports.fetch = fetch;
|
|
1954
|
-
|
|
1955
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1956
|
-
|
|
1957
|
-
return exports;
|
|
1958
|
-
|
|
1959
|
-
})({});
|
|
1960
|
-
})(__self__);
|
|
1961
|
-
__self__.fetch.ponyfill = true;
|
|
1962
|
-
// Remove "polyfill" property added by whatwg-fetch
|
|
1963
|
-
delete __self__.fetch.polyfill;
|
|
1964
|
-
// Choose between native implementation (global) or custom implementation (__self__)
|
|
1965
|
-
// var ctx = global.fetch ? global : __self__;
|
|
1966
|
-
var ctx = __self__; // this line disable service worker support temporarily
|
|
1967
|
-
exports = ctx.fetch // To enable: import fetch from 'cross-fetch'
|
|
1968
|
-
exports["default"] = ctx.fetch // For TypeScript consumers without esModuleInterop.
|
|
1969
|
-
exports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'
|
|
1970
|
-
exports.Headers = ctx.Headers
|
|
1971
|
-
exports.Request = ctx.Request
|
|
1972
|
-
exports.Response = ctx.Response
|
|
1973
|
-
module.exports = exports
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
1415
|
/***/ }),
|
|
1977
1416
|
|
|
1978
1417
|
/***/ 8784:
|
|
@@ -29346,7 +28785,6 @@ var rfdc_default = /*#__PURE__*/__webpack_require__.n(rfdc);
|
|
|
29346
28785
|
;// CONCATENATED MODULE: ../internal-common/src/utils/object.ts
|
|
29347
28786
|
|
|
29348
28787
|
|
|
29349
|
-
|
|
29350
28788
|
const SPLIT_REGEX_FOR_GET_IN_PATH = /[.\[\]]/;
|
|
29351
28789
|
/** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
|
|
29352
28790
|
function getInPath(obj, path) {
|
|
@@ -29384,7 +28822,7 @@ function setInPath(obj, path, value, delimiter = '.') {
|
|
|
29384
28822
|
const key = (0,dist.truthy)(splitPath.shift());
|
|
29385
28823
|
if (splitPath.length) {
|
|
29386
28824
|
const fieldValue = currentObj[key];
|
|
29387
|
-
const newCurrentObj = isJsObject(fieldValue) ? (_a =
|
|
28825
|
+
const newCurrentObj = isJsObject(fieldValue) ? (_a = cloneShallow(fieldValue)) !== null && _a !== void 0 ? _a : {} : {};
|
|
29388
28826
|
currentObj[key] = newCurrentObj;
|
|
29389
28827
|
currentObj = newCurrentObj;
|
|
29390
28828
|
}
|
|
@@ -29400,7 +28838,7 @@ function deleteInPath(obj, path, delimiter = '.') {
|
|
|
29400
28838
|
while (splitPath.length) {
|
|
29401
28839
|
const key = (0,dist.truthy)(splitPath.shift());
|
|
29402
28840
|
if (splitPath.length) {
|
|
29403
|
-
const newCurrentObj = isJsObject(currentObj[key]) ? (_a =
|
|
28841
|
+
const newCurrentObj = isJsObject(currentObj[key]) ? (_a = cloneShallow(currentObj[key])) !== null && _a !== void 0 ? _a : {} : {};
|
|
29404
28842
|
currentObj[key] = newCurrentObj;
|
|
29405
28843
|
currentObj = newCurrentObj;
|
|
29406
28844
|
}
|
|
@@ -29495,6 +28933,20 @@ function cloneDeep(value) {
|
|
|
29495
28933
|
// and it cases some tests to fail.
|
|
29496
28934
|
return rfdc_default()()(value);
|
|
29497
28935
|
}
|
|
28936
|
+
/** Creates a shallow clone of the object. */
|
|
28937
|
+
function cloneShallow(value) {
|
|
28938
|
+
if (typeof value !== 'object' || value === null)
|
|
28939
|
+
return value;
|
|
28940
|
+
if (value instanceof Date)
|
|
28941
|
+
return new Date(value);
|
|
28942
|
+
if (Array.isArray(value))
|
|
28943
|
+
return [...value];
|
|
28944
|
+
if (value instanceof Map)
|
|
28945
|
+
return new Map(Array.from(value));
|
|
28946
|
+
if (value instanceof Set)
|
|
28947
|
+
return new Set(Array.from(value));
|
|
28948
|
+
return Object.assign({}, value);
|
|
28949
|
+
}
|
|
29498
28950
|
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
29499
28951
|
function compareValues(v1, v2) {
|
|
29500
28952
|
if (v1 === v2 || (isNil(v1) && isNil(v2))) {
|
|
@@ -29561,6 +29013,19 @@ function groupBy(array, getKey) {
|
|
|
29561
29013
|
return result;
|
|
29562
29014
|
}, {});
|
|
29563
29015
|
}
|
|
29016
|
+
/**
|
|
29017
|
+
* Picks selected fields from the object and returns a new object with the fields selected.
|
|
29018
|
+
* The selected fields are assigned by reference (there is no cloning).
|
|
29019
|
+
*/
|
|
29020
|
+
function pick(obj, keys) {
|
|
29021
|
+
const result = {};
|
|
29022
|
+
for (const key of keys) {
|
|
29023
|
+
if (key in obj) {
|
|
29024
|
+
result[key] = obj[key];
|
|
29025
|
+
}
|
|
29026
|
+
}
|
|
29027
|
+
return result;
|
|
29028
|
+
}
|
|
29564
29029
|
|
|
29565
29030
|
;// CONCATENATED MODULE: ../internal-common/src/utils/serialization.ts
|
|
29566
29031
|
|
|
@@ -31323,7 +30788,7 @@ class BaseQueryBuilder {
|
|
|
31323
30788
|
* A shortcut for where(fieldName, 'like', pattern).
|
|
31324
30789
|
*
|
|
31325
30790
|
* @param fieldName The name of the field to query.
|
|
31326
|
-
* @param pattern The pattern to compare against. '%' matches 0 or more
|
|
30791
|
+
* @param pattern The pattern to compare against. '%' matches 0 or more characters. '_' matches exactly one character. '\' can be used to escape '%', '_'. or another '\'. Note that any '\' that is not followed by '%', '_', or '\' is invalid.
|
|
31327
30792
|
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
31328
30793
|
* @returns The query builder.
|
|
31329
30794
|
*/
|
|
@@ -31335,7 +30800,7 @@ class BaseQueryBuilder {
|
|
|
31335
30800
|
* A shortcut for where(fieldName, 'not like', pattern).
|
|
31336
30801
|
*
|
|
31337
30802
|
* @param fieldName The name of the field to query.
|
|
31338
|
-
* @param pattern The pattern to compare against. '%' matches 0 or more
|
|
30803
|
+
* @param pattern The pattern to compare against. '%' matches 0 or more characters. '_' matches exactly one character. '\' can be used to escape '%', '_'. or another '\'. Note that any '\' that is not followed by '%', '_', or '\' is invalid.
|
|
31339
30804
|
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
31340
30805
|
* @returns The query builder.
|
|
31341
30806
|
*/
|
|
@@ -49649,9 +49114,6 @@ var extras = {
|
|
|
49649
49114
|
gql["default"] = gql;
|
|
49650
49115
|
/* harmony default export */ const graphql_tag_lib = ((/* unused pure expression or super */ null && (gql)));
|
|
49651
49116
|
//# sourceMappingURL=index.js.map
|
|
49652
|
-
// EXTERNAL MODULE: ../node_modules/cross-fetch/dist/browser-ponyfill.js
|
|
49653
|
-
var browser_ponyfill = __webpack_require__(9372);
|
|
49654
|
-
var browser_ponyfill_default = /*#__PURE__*/__webpack_require__.n(browser_ponyfill);
|
|
49655
49117
|
;// CONCATENATED MODULE: ../internal-common/src/utils/http.ts
|
|
49656
49118
|
const kotlinControllers = [
|
|
49657
49119
|
'query',
|
|
@@ -49708,47 +49170,9 @@ function isIOS(regionPrefix) {
|
|
|
49708
49170
|
return /ios$/.test(regionPrefix);
|
|
49709
49171
|
}
|
|
49710
49172
|
|
|
49711
|
-
;// CONCATENATED MODULE: ../internal-common/src/utils/squid-private-options.ts
|
|
49712
|
-
|
|
49713
|
-
function squid_private_options_getGlobal() {
|
|
49714
|
-
if (typeof window !== 'undefined') {
|
|
49715
|
-
return window;
|
|
49716
|
-
}
|
|
49717
|
-
else if (typeof __webpack_require__.g !== 'undefined') {
|
|
49718
|
-
return __webpack_require__.g;
|
|
49719
|
-
}
|
|
49720
|
-
else if (typeof self !== 'undefined') {
|
|
49721
|
-
return self;
|
|
49722
|
-
}
|
|
49723
|
-
(0,dist.fail)('Failed to get global context');
|
|
49724
|
-
}
|
|
49725
|
-
function getSquidPrivateOptions() {
|
|
49726
|
-
const globalScope = squid_private_options_getGlobal();
|
|
49727
|
-
let privateOptions = globalScope['__squidPrivateOptions'];
|
|
49728
|
-
if (!privateOptions) {
|
|
49729
|
-
privateOptions = {};
|
|
49730
|
-
globalScope['__squidPrivateOptions'] = privateOptions;
|
|
49731
|
-
}
|
|
49732
|
-
return privateOptions;
|
|
49733
|
-
}
|
|
49734
|
-
function setSquidPrivateOption(optionName, value) {
|
|
49735
|
-
getSquidPrivateOptions()[optionName] = value;
|
|
49736
|
-
}
|
|
49737
|
-
function getSquidPrivateOption(optionName) {
|
|
49738
|
-
return getSquidPrivateOptions()[optionName];
|
|
49739
|
-
}
|
|
49740
|
-
/**
|
|
49741
|
-
* When set to 'true' (boolean), the Graphql client in Squid uses new 'fetch' based
|
|
49742
|
-
* HTTP client instead of cross-fetch library.
|
|
49743
|
-
* The option will be removed after the migration is tested and all issues are fixed.
|
|
49744
|
-
*/
|
|
49745
|
-
const SQUID_PRIVATE_OPTION_USE_FETCH_IN_GRAPHQL_CLIENT = 'useFetchInGraphqlClient';
|
|
49746
|
-
|
|
49747
49173
|
;// CONCATENATED MODULE: ./src/graphql-client.ts
|
|
49748
49174
|
|
|
49749
49175
|
|
|
49750
|
-
|
|
49751
|
-
|
|
49752
49176
|
/** A GraphQL client that can be used to query and mutate data. */
|
|
49753
49177
|
class GraphQLClient {
|
|
49754
49178
|
/** @internal */
|
|
@@ -49757,13 +49181,10 @@ class GraphQLClient {
|
|
|
49757
49181
|
this.region = region;
|
|
49758
49182
|
this.appId = appId;
|
|
49759
49183
|
const url = getApplicationUrl(this.region, this.appId, `${integrationId}/graphql`);
|
|
49760
|
-
const forceFetch = Date.now() > 0; // TODO: remove this after testing with GA.
|
|
49761
|
-
const fetchImpl = getSquidPrivateOption(SQUID_PRIVATE_OPTION_USE_FETCH_IN_GRAPHQL_CLIENT) || forceFetch ? fetch : (browser_ponyfill_default());
|
|
49762
49184
|
this.client = new ApolloClient({
|
|
49763
49185
|
link: new HttpLink({
|
|
49764
49186
|
uri: url,
|
|
49765
49187
|
headers: this.rpcManager.getStaticHeaders(),
|
|
49766
|
-
fetch: fetchImpl,
|
|
49767
49188
|
}),
|
|
49768
49189
|
cache: new InMemoryCache(),
|
|
49769
49190
|
});
|
|
@@ -12,9 +12,16 @@ export declare function isEmpty(a: unknown): boolean;
|
|
|
12
12
|
export declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...fieldsToRemove: K): Pick<T, Exclude<keyof T, K[number]>>;
|
|
13
13
|
/** Creates a deep copy of the object. Copies all Date, Map, Set fields. */
|
|
14
14
|
export declare function cloneDeep<T>(value: T): T;
|
|
15
|
+
/** Creates a shallow clone of the object. */
|
|
16
|
+
export declare function cloneShallow<T>(value: T): T;
|
|
15
17
|
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
16
18
|
export declare function compareValues(v1: unknown, v2: unknown): number;
|
|
17
19
|
/** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */
|
|
18
20
|
export declare function mapValues<ResultType extends object = Record<string, unknown>, InputType extends Record<string, unknown> = Record<string, unknown>>(obj: InputType, valueMapperFn: (value: any, key: keyof InputType, obj: InputType) => unknown): ResultType;
|
|
19
21
|
/** Groups elements of the array by key. See _.groupBy for details. */
|
|
20
22
|
export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (item: T) => K): Record<K, T[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Picks selected fields from the object and returns a new object with the fields selected.
|
|
25
|
+
* The selected fields are assigned by reference (there is no cloning).
|
|
26
|
+
*/
|
|
27
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
@@ -87,7 +87,7 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
87
87
|
* A shortcut for where(fieldName, 'like', pattern).
|
|
88
88
|
*
|
|
89
89
|
* @param fieldName The name of the field to query.
|
|
90
|
-
* @param pattern The pattern to compare against. '%' matches 0 or more
|
|
90
|
+
* @param pattern The pattern to compare against. '%' matches 0 or more characters. '_' matches exactly one character. '\' can be used to escape '%', '_'. or another '\'. Note that any '\' that is not followed by '%', '_', or '\' is invalid.
|
|
91
91
|
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
92
92
|
* @returns The query builder.
|
|
93
93
|
*/
|
|
@@ -96,7 +96,7 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
|
96
96
|
* A shortcut for where(fieldName, 'not like', pattern).
|
|
97
97
|
*
|
|
98
98
|
* @param fieldName The name of the field to query.
|
|
99
|
-
* @param pattern The pattern to compare against. '%' matches 0 or more
|
|
99
|
+
* @param pattern The pattern to compare against. '%' matches 0 or more characters. '_' matches exactly one character. '\' can be used to escape '%', '_'. or another '\'. Note that any '\' that is not followed by '%', '_', or '\' is invalid.
|
|
100
100
|
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
101
101
|
* @returns The query builder.
|
|
102
102
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.192",
|
|
4
4
|
"description": "A typescript implementation of the Squid client",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/typescript-client/src/index.d.ts",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"ajv": "^8.11.2",
|
|
41
41
|
"ajv-formats": "^2.1.1",
|
|
42
42
|
"bufferutil": "^4.0.7",
|
|
43
|
-
"cross-fetch": "^3.1.5",
|
|
44
43
|
"date-fns": "^2.30.0",
|
|
45
44
|
"deep-diff": "^1.0.2",
|
|
46
45
|
"graphql": "^16.6.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function setSquidPrivateOption<T = unknown>(optionName: string, value: T): void;
|
|
2
|
-
export declare function getSquidPrivateOption<T = unknown>(optionName: string): T | undefined;
|
|
3
|
-
/**
|
|
4
|
-
* When set to 'true' (boolean), the Graphql client in Squid uses new 'fetch' based
|
|
5
|
-
* HTTP client instead of cross-fetch library.
|
|
6
|
-
* The option will be removed after the migration is tested and all issues are fixed.
|
|
7
|
-
*/
|
|
8
|
-
export declare const SQUID_PRIVATE_OPTION_USE_FETCH_IN_GRAPHQL_CLIENT = "useFetchInGraphqlClient";
|