@openfeature/flagd-provider 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -18
- package/index.cjs.js +1807 -1738
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1807 -1736
- package/package.json +12 -11
- package/src/lib/configuration.d.ts +6 -6
- package/src/lib/flagd-provider.d.ts +2 -6
- package/src/lib/service/in-process/file/file-fetch.d.ts +1 -1
- package/src/lib/service/in-process/grpc/grpc-fetch.d.ts +1 -1
- package/src/lib/service/in-process/in-process-service.d.ts +2 -6
- package/src/proto/ts/flagd/evaluation/v1/evaluation.d.ts +50 -589
- package/src/proto/ts/flagd/sync/v1/sync.d.ts +18 -79
- package/src/proto/ts/google/protobuf/struct.d.ts +8 -88
- package/src/proto/ts/schema/v1/schema.d.ts +49 -589
- package/src/proto/ts/sync/v1/sync_service.d.ts +15 -57
- package/src/e2e/constants.d.ts +0 -4
- package/src/e2e/jest.config.d.ts +0 -11
- package/src/e2e/setup-in-process-provider.d.ts +0 -1
- package/src/e2e/setup-rpc-provider.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -1,29 +1,58 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var serverSdk = require('@openfeature/server-sdk');
|
|
6
4
|
var grpcJs = require('@grpc/grpc-js');
|
|
7
5
|
var connectivityState = require('@grpc/grpc-js/build/src/connectivity-state');
|
|
8
6
|
var lruCache = require('lru-cache');
|
|
9
|
-
var
|
|
7
|
+
var node_util = require('node:util');
|
|
10
8
|
var flagdCore = require('@openfeature/flagd-core');
|
|
11
|
-
var core = require('@openfeature/core');
|
|
12
9
|
var fs = require('fs');
|
|
13
10
|
|
|
11
|
+
/******************************************************************************
|
|
12
|
+
Copyright (c) Microsoft Corporation.
|
|
13
|
+
|
|
14
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
15
|
+
purpose with or without fee is hereby granted.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
+
***************************************************************************** */
|
|
25
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
39
|
+
var e = new Error(message);
|
|
40
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
41
|
+
};
|
|
42
|
+
|
|
14
43
|
const EVENT_CONFIGURATION_CHANGE = 'configuration_change';
|
|
15
44
|
const EVENT_PROVIDER_READY = 'provider_ready';
|
|
16
45
|
const DEFAULT_MAX_CACHE_SIZE = 1000;
|
|
17
46
|
|
|
18
47
|
const DEFAULT_CONFIG = {
|
|
19
48
|
host: 'localhost',
|
|
20
|
-
port: 8013,
|
|
21
49
|
tls: false,
|
|
22
|
-
resolverType: 'rpc',
|
|
23
50
|
selector: '',
|
|
24
51
|
cache: 'lru',
|
|
25
52
|
maxCacheSize: DEFAULT_MAX_CACHE_SIZE,
|
|
26
53
|
};
|
|
54
|
+
const DEFAULT_RPC_CONFIG = Object.assign(Object.assign({}, DEFAULT_CONFIG), { resolverType: 'rpc', port: 8013 });
|
|
55
|
+
const DEFAULT_IN_PROCESS_CONFIG = Object.assign(Object.assign({}, DEFAULT_CONFIG), { resolverType: 'in-process', port: 8015 });
|
|
27
56
|
var ENV_VAR;
|
|
28
57
|
(function (ENV_VAR) {
|
|
29
58
|
ENV_VAR["FLAGD_HOST"] = "FLAGD_HOST";
|
|
@@ -43,7 +72,7 @@ const getEnvVarConfig = () => {
|
|
|
43
72
|
})), (Number(process.env[ENV_VAR.FLAGD_PORT]) && {
|
|
44
73
|
port: Number(process.env[ENV_VAR.FLAGD_PORT]),
|
|
45
74
|
})), (process.env[ENV_VAR.FLAGD_TLS] && {
|
|
46
|
-
tls: ((_a = process.env[ENV_VAR.FLAGD_TLS]) === null || _a ===
|
|
75
|
+
tls: ((_a = process.env[ENV_VAR.FLAGD_TLS]) === null || _a === undefined ? undefined : _a.toLowerCase()) === 'true',
|
|
47
76
|
})), (process.env[ENV_VAR.FLAGD_SOCKET_PATH] && {
|
|
48
77
|
socketPath: process.env[ENV_VAR.FLAGD_SOCKET_PATH],
|
|
49
78
|
})), ((process.env[ENV_VAR.FLAGD_CACHE] === 'lru' || process.env[ENV_VAR.FLAGD_CACHE] === 'disabled') && {
|
|
@@ -59,39 +88,13 @@ const getEnvVarConfig = () => {
|
|
|
59
88
|
})));
|
|
60
89
|
};
|
|
61
90
|
function getConfig(options = {}) {
|
|
62
|
-
|
|
91
|
+
const envVarConfig = getEnvVarConfig();
|
|
92
|
+
const defaultConfig = options.resolverType == 'in-process' || envVarConfig.resolverType == 'in-process'
|
|
93
|
+
? DEFAULT_IN_PROCESS_CONFIG
|
|
94
|
+
: DEFAULT_RPC_CONFIG;
|
|
95
|
+
return Object.assign(Object.assign(Object.assign({}, defaultConfig), envVarConfig), options);
|
|
63
96
|
}
|
|
64
97
|
|
|
65
|
-
/******************************************************************************
|
|
66
|
-
Copyright (c) Microsoft Corporation.
|
|
67
|
-
|
|
68
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
69
|
-
purpose with or without fee is hereby granted.
|
|
70
|
-
|
|
71
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
72
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
73
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
74
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
75
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
76
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
77
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
78
|
-
***************************************************************************** */
|
|
79
|
-
|
|
80
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
81
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
82
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
83
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
84
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
85
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
86
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
91
|
-
var e = new Error(message);
|
|
92
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
98
|
/**
|
|
96
99
|
* @license
|
|
97
100
|
* Copyright 2009 The Closure Library Authors
|
|
@@ -280,7 +283,7 @@ function fromNumber(value, unsigned) {
|
|
|
280
283
|
if (value >= TWO_PWR_64_DBL)
|
|
281
284
|
return MAX_UNSIGNED_VALUE;
|
|
282
285
|
} else {
|
|
283
|
-
if (value <= -
|
|
286
|
+
if (value <= -9223372036854776e3)
|
|
284
287
|
return MIN_VALUE;
|
|
285
288
|
if (value + 1 >= TWO_PWR_63_DBL)
|
|
286
289
|
return MAX_VALUE;
|
|
@@ -1079,7 +1082,7 @@ LongPrototype.divide = function divide(divisor) {
|
|
|
1079
1082
|
// negative number / -1 would be 1 larger than the largest
|
|
1080
1083
|
// positive number, due to two's complement.
|
|
1081
1084
|
if (!this.unsigned &&
|
|
1082
|
-
this.high === -
|
|
1085
|
+
this.high === -2147483648 &&
|
|
1083
1086
|
divisor.low === -1 && divisor.high === -1) {
|
|
1084
1087
|
// be consistent with non-wasm code path
|
|
1085
1088
|
return this;
|
|
@@ -1560,1432 +1563,1506 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
|
1560
1563
|
|
|
1561
1564
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1562
1565
|
|
|
1566
|
+
function getDefaultExportFromCjs (x) {
|
|
1567
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1563
1570
|
var indexMinimal = {};
|
|
1564
1571
|
|
|
1565
1572
|
var minimal$1 = {};
|
|
1566
1573
|
|
|
1567
|
-
var aspromise
|
|
1574
|
+
var aspromise;
|
|
1575
|
+
var hasRequiredAspromise;
|
|
1576
|
+
|
|
1577
|
+
function requireAspromise () {
|
|
1578
|
+
if (hasRequiredAspromise) return aspromise;
|
|
1579
|
+
hasRequiredAspromise = 1;
|
|
1580
|
+
aspromise = asPromise;
|
|
1568
1581
|
|
|
1569
|
-
/**
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1582
|
+
/**
|
|
1583
|
+
* Callback as used by {@link util.asPromise}.
|
|
1584
|
+
* @typedef asPromiseCallback
|
|
1585
|
+
* @type {function}
|
|
1586
|
+
* @param {Error|null} error Error, if any
|
|
1587
|
+
* @param {...*} params Additional arguments
|
|
1588
|
+
* @returns {undefined}
|
|
1589
|
+
*/
|
|
1577
1590
|
|
|
1578
|
-
/**
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
function asPromise(fn, ctx/*, varargs */) {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1591
|
+
/**
|
|
1592
|
+
* Returns a promise from a node-style callback function.
|
|
1593
|
+
* @memberof util
|
|
1594
|
+
* @param {asPromiseCallback} fn Function to call
|
|
1595
|
+
* @param {*} ctx Function context
|
|
1596
|
+
* @param {...*} params Function arguments
|
|
1597
|
+
* @returns {Promise<*>} Promisified function
|
|
1598
|
+
*/
|
|
1599
|
+
function asPromise(fn, ctx/*, varargs */) {
|
|
1600
|
+
var params = new Array(arguments.length - 1),
|
|
1601
|
+
offset = 0,
|
|
1602
|
+
index = 2,
|
|
1603
|
+
pending = true;
|
|
1604
|
+
while (index < arguments.length)
|
|
1605
|
+
params[offset++] = arguments[index++];
|
|
1606
|
+
return new Promise(function executor(resolve, reject) {
|
|
1607
|
+
params[offset] = function callback(err/*, varargs */) {
|
|
1608
|
+
if (pending) {
|
|
1609
|
+
pending = false;
|
|
1610
|
+
if (err)
|
|
1611
|
+
reject(err);
|
|
1612
|
+
else {
|
|
1613
|
+
var params = new Array(arguments.length - 1),
|
|
1614
|
+
offset = 0;
|
|
1615
|
+
while (offset < params.length)
|
|
1616
|
+
params[offset++] = arguments[offset];
|
|
1617
|
+
resolve.apply(null, params);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
try {
|
|
1622
|
+
fn.apply(ctx || null, params);
|
|
1623
|
+
} catch (err) {
|
|
1624
|
+
if (pending) {
|
|
1625
|
+
pending = false;
|
|
1626
|
+
reject(err);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
return aspromise;
|
|
1617
1632
|
}
|
|
1618
1633
|
|
|
1619
1634
|
var base64$1 = {};
|
|
1620
1635
|
|
|
1621
|
-
|
|
1636
|
+
var hasRequiredBase64;
|
|
1637
|
+
|
|
1638
|
+
function requireBase64 () {
|
|
1639
|
+
if (hasRequiredBase64) return base64$1;
|
|
1640
|
+
hasRequiredBase64 = 1;
|
|
1641
|
+
(function (exports) {
|
|
1622
1642
|
|
|
1623
|
-
/**
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
var base64 = exports;
|
|
1643
|
+
/**
|
|
1644
|
+
* A minimal base64 implementation for number arrays.
|
|
1645
|
+
* @memberof util
|
|
1646
|
+
* @namespace
|
|
1647
|
+
*/
|
|
1648
|
+
var base64 = exports;
|
|
1629
1649
|
|
|
1630
|
-
/**
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
base64.length = function length(string) {
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
};
|
|
1650
|
+
/**
|
|
1651
|
+
* Calculates the byte length of a base64 encoded string.
|
|
1652
|
+
* @param {string} string Base64 encoded string
|
|
1653
|
+
* @returns {number} Byte length
|
|
1654
|
+
*/
|
|
1655
|
+
base64.length = function length(string) {
|
|
1656
|
+
var p = string.length;
|
|
1657
|
+
if (!p)
|
|
1658
|
+
return 0;
|
|
1659
|
+
var n = 0;
|
|
1660
|
+
while (--p % 4 > 1 && string.charAt(p) === "=")
|
|
1661
|
+
++n;
|
|
1662
|
+
return Math.ceil(string.length * 3) / 4 - n;
|
|
1663
|
+
};
|
|
1644
1664
|
|
|
1645
|
-
// Base64 encoding table
|
|
1646
|
-
var b64 = new Array(64);
|
|
1665
|
+
// Base64 encoding table
|
|
1666
|
+
var b64 = new Array(64);
|
|
1647
1667
|
|
|
1648
|
-
// Base64 decoding table
|
|
1649
|
-
var s64 = new Array(123);
|
|
1668
|
+
// Base64 decoding table
|
|
1669
|
+
var s64 = new Array(123);
|
|
1650
1670
|
|
|
1651
|
-
// 65..90, 97..122, 48..57, 43, 47
|
|
1652
|
-
for (var i = 0; i < 64;)
|
|
1653
|
-
|
|
1671
|
+
// 65..90, 97..122, 48..57, 43, 47
|
|
1672
|
+
for (var i = 0; i < 64;)
|
|
1673
|
+
s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
|
|
1654
1674
|
|
|
1655
|
-
/**
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
base64.encode = function encode(buffer, start, end) {
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Encodes a buffer to a base64 encoded string.
|
|
1677
|
+
* @param {Uint8Array} buffer Source buffer
|
|
1678
|
+
* @param {number} start Source start
|
|
1679
|
+
* @param {number} end Source end
|
|
1680
|
+
* @returns {string} Base64 encoded string
|
|
1681
|
+
*/
|
|
1682
|
+
base64.encode = function encode(buffer, start, end) {
|
|
1683
|
+
var parts = null,
|
|
1684
|
+
chunk = [];
|
|
1685
|
+
var i = 0, // output index
|
|
1686
|
+
j = 0, // goto index
|
|
1687
|
+
t; // temporary
|
|
1688
|
+
while (start < end) {
|
|
1689
|
+
var b = buffer[start++];
|
|
1690
|
+
switch (j) {
|
|
1691
|
+
case 0:
|
|
1692
|
+
chunk[i++] = b64[b >> 2];
|
|
1693
|
+
t = (b & 3) << 4;
|
|
1694
|
+
j = 1;
|
|
1695
|
+
break;
|
|
1696
|
+
case 1:
|
|
1697
|
+
chunk[i++] = b64[t | b >> 4];
|
|
1698
|
+
t = (b & 15) << 2;
|
|
1699
|
+
j = 2;
|
|
1700
|
+
break;
|
|
1701
|
+
case 2:
|
|
1702
|
+
chunk[i++] = b64[t | b >> 6];
|
|
1703
|
+
chunk[i++] = b64[b & 63];
|
|
1704
|
+
j = 0;
|
|
1705
|
+
break;
|
|
1706
|
+
}
|
|
1707
|
+
if (i > 8191) {
|
|
1708
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
|
1709
|
+
i = 0;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
if (j) {
|
|
1713
|
+
chunk[i++] = b64[t];
|
|
1714
|
+
chunk[i++] = 61;
|
|
1715
|
+
if (j === 1)
|
|
1716
|
+
chunk[i++] = 61;
|
|
1717
|
+
}
|
|
1718
|
+
if (parts) {
|
|
1719
|
+
if (i)
|
|
1720
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
1721
|
+
return parts.join("");
|
|
1722
|
+
}
|
|
1723
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
|
1724
|
+
};
|
|
1705
1725
|
|
|
1706
|
-
var invalidEncoding = "invalid encoding";
|
|
1726
|
+
var invalidEncoding = "invalid encoding";
|
|
1707
1727
|
|
|
1708
|
-
/**
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
base64.decode = function decode(string, buffer, offset) {
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
};
|
|
1728
|
+
/**
|
|
1729
|
+
* Decodes a base64 encoded string to a buffer.
|
|
1730
|
+
* @param {string} string Source string
|
|
1731
|
+
* @param {Uint8Array} buffer Destination buffer
|
|
1732
|
+
* @param {number} offset Destination offset
|
|
1733
|
+
* @returns {number} Number of bytes written
|
|
1734
|
+
* @throws {Error} If encoding is invalid
|
|
1735
|
+
*/
|
|
1736
|
+
base64.decode = function decode(string, buffer, offset) {
|
|
1737
|
+
var start = offset;
|
|
1738
|
+
var j = 0, // goto index
|
|
1739
|
+
t; // temporary
|
|
1740
|
+
for (var i = 0; i < string.length;) {
|
|
1741
|
+
var c = string.charCodeAt(i++);
|
|
1742
|
+
if (c === 61 && j > 1)
|
|
1743
|
+
break;
|
|
1744
|
+
if ((c = s64[c]) === undefined)
|
|
1745
|
+
throw Error(invalidEncoding);
|
|
1746
|
+
switch (j) {
|
|
1747
|
+
case 0:
|
|
1748
|
+
t = c;
|
|
1749
|
+
j = 1;
|
|
1750
|
+
break;
|
|
1751
|
+
case 1:
|
|
1752
|
+
buffer[offset++] = t << 2 | (c & 48) >> 4;
|
|
1753
|
+
t = c;
|
|
1754
|
+
j = 2;
|
|
1755
|
+
break;
|
|
1756
|
+
case 2:
|
|
1757
|
+
buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
|
|
1758
|
+
t = c;
|
|
1759
|
+
j = 3;
|
|
1760
|
+
break;
|
|
1761
|
+
case 3:
|
|
1762
|
+
buffer[offset++] = (t & 3) << 6 | c;
|
|
1763
|
+
j = 0;
|
|
1764
|
+
break;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (j === 1)
|
|
1768
|
+
throw Error(invalidEncoding);
|
|
1769
|
+
return offset - start;
|
|
1770
|
+
};
|
|
1751
1771
|
|
|
1752
|
-
/**
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
base64.test = function test(string) {
|
|
1758
|
-
|
|
1759
|
-
};
|
|
1760
|
-
}(base64$1));
|
|
1772
|
+
/**
|
|
1773
|
+
* Tests if the specified string appears to be base64 encoded.
|
|
1774
|
+
* @param {string} string String to test
|
|
1775
|
+
* @returns {boolean} `true` if probably base64 encoded, otherwise false
|
|
1776
|
+
*/
|
|
1777
|
+
base64.test = function test(string) {
|
|
1778
|
+
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
|
|
1779
|
+
};
|
|
1780
|
+
} (base64$1));
|
|
1781
|
+
return base64$1;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
var eventemitter;
|
|
1785
|
+
var hasRequiredEventemitter;
|
|
1761
1786
|
|
|
1762
|
-
|
|
1787
|
+
function requireEventemitter () {
|
|
1788
|
+
if (hasRequiredEventemitter) return eventemitter;
|
|
1789
|
+
hasRequiredEventemitter = 1;
|
|
1790
|
+
eventemitter = EventEmitter;
|
|
1763
1791
|
|
|
1764
|
-
/**
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
function EventEmitter() {
|
|
1792
|
+
/**
|
|
1793
|
+
* Constructs a new event emitter instance.
|
|
1794
|
+
* @classdesc A minimal event emitter.
|
|
1795
|
+
* @memberof util
|
|
1796
|
+
* @constructor
|
|
1797
|
+
*/
|
|
1798
|
+
function EventEmitter() {
|
|
1771
1799
|
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Registered listeners.
|
|
1802
|
+
* @type {Object.<string,*>}
|
|
1803
|
+
* @private
|
|
1804
|
+
*/
|
|
1805
|
+
this._listeners = {};
|
|
1806
|
+
}
|
|
1779
1807
|
|
|
1780
|
-
/**
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
EventEmitter.prototype.on = function on(evt, fn, ctx) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
};
|
|
1808
|
+
/**
|
|
1809
|
+
* Registers an event listener.
|
|
1810
|
+
* @param {string} evt Event name
|
|
1811
|
+
* @param {function} fn Listener
|
|
1812
|
+
* @param {*} [ctx] Listener context
|
|
1813
|
+
* @returns {util.EventEmitter} `this`
|
|
1814
|
+
*/
|
|
1815
|
+
EventEmitter.prototype.on = function on(evt, fn, ctx) {
|
|
1816
|
+
(this._listeners[evt] || (this._listeners[evt] = [])).push({
|
|
1817
|
+
fn : fn,
|
|
1818
|
+
ctx : ctx || this
|
|
1819
|
+
});
|
|
1820
|
+
return this;
|
|
1821
|
+
};
|
|
1794
1822
|
|
|
1795
|
-
/**
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
EventEmitter.prototype.off = function off(evt, fn) {
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
};
|
|
1823
|
+
/**
|
|
1824
|
+
* Removes an event listener or any matching listeners if arguments are omitted.
|
|
1825
|
+
* @param {string} [evt] Event name. Removes all listeners if omitted.
|
|
1826
|
+
* @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
|
|
1827
|
+
* @returns {util.EventEmitter} `this`
|
|
1828
|
+
*/
|
|
1829
|
+
EventEmitter.prototype.off = function off(evt, fn) {
|
|
1830
|
+
if (evt === undefined)
|
|
1831
|
+
this._listeners = {};
|
|
1832
|
+
else {
|
|
1833
|
+
if (fn === undefined)
|
|
1834
|
+
this._listeners[evt] = [];
|
|
1835
|
+
else {
|
|
1836
|
+
var listeners = this._listeners[evt];
|
|
1837
|
+
for (var i = 0; i < listeners.length;)
|
|
1838
|
+
if (listeners[i].fn === fn)
|
|
1839
|
+
listeners.splice(i, 1);
|
|
1840
|
+
else
|
|
1841
|
+
++i;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
return this;
|
|
1845
|
+
};
|
|
1818
1846
|
|
|
1819
|
-
/**
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
EventEmitter.prototype.emit = function emit(evt) {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
};
|
|
1847
|
+
/**
|
|
1848
|
+
* Emits an event by calling its listeners with the specified arguments.
|
|
1849
|
+
* @param {string} evt Event name
|
|
1850
|
+
* @param {...*} args Arguments
|
|
1851
|
+
* @returns {util.EventEmitter} `this`
|
|
1852
|
+
*/
|
|
1853
|
+
EventEmitter.prototype.emit = function emit(evt) {
|
|
1854
|
+
var listeners = this._listeners[evt];
|
|
1855
|
+
if (listeners) {
|
|
1856
|
+
var args = [],
|
|
1857
|
+
i = 1;
|
|
1858
|
+
for (; i < arguments.length;)
|
|
1859
|
+
args.push(arguments[i++]);
|
|
1860
|
+
for (i = 0; i < listeners.length;)
|
|
1861
|
+
listeners[i].fn.apply(listeners[i++].ctx, args);
|
|
1862
|
+
}
|
|
1863
|
+
return this;
|
|
1864
|
+
};
|
|
1865
|
+
return eventemitter;
|
|
1866
|
+
}
|
|
1837
1867
|
|
|
1838
|
-
var float
|
|
1868
|
+
var float;
|
|
1869
|
+
var hasRequiredFloat;
|
|
1870
|
+
|
|
1871
|
+
function requireFloat () {
|
|
1872
|
+
if (hasRequiredFloat) return float;
|
|
1873
|
+
hasRequiredFloat = 1;
|
|
1839
1874
|
|
|
1840
|
-
|
|
1841
|
-
* Reads / writes floats / doubles from / to buffers.
|
|
1842
|
-
* @name util.float
|
|
1843
|
-
* @namespace
|
|
1844
|
-
*/
|
|
1875
|
+
float = factory(factory);
|
|
1845
1876
|
|
|
1846
|
-
/**
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
* @param {Uint8Array} buf Target buffer
|
|
1852
|
-
* @param {number} pos Target buffer offset
|
|
1853
|
-
* @returns {undefined}
|
|
1854
|
-
*/
|
|
1877
|
+
/**
|
|
1878
|
+
* Reads / writes floats / doubles from / to buffers.
|
|
1879
|
+
* @name util.float
|
|
1880
|
+
* @namespace
|
|
1881
|
+
*/
|
|
1855
1882
|
|
|
1856
|
-
/**
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1883
|
+
/**
|
|
1884
|
+
* Writes a 32 bit float to a buffer using little endian byte order.
|
|
1885
|
+
* @name util.float.writeFloatLE
|
|
1886
|
+
* @function
|
|
1887
|
+
* @param {number} val Value to write
|
|
1888
|
+
* @param {Uint8Array} buf Target buffer
|
|
1889
|
+
* @param {number} pos Target buffer offset
|
|
1890
|
+
* @returns {undefined}
|
|
1891
|
+
*/
|
|
1865
1892
|
|
|
1866
|
-
/**
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1893
|
+
/**
|
|
1894
|
+
* Writes a 32 bit float to a buffer using big endian byte order.
|
|
1895
|
+
* @name util.float.writeFloatBE
|
|
1896
|
+
* @function
|
|
1897
|
+
* @param {number} val Value to write
|
|
1898
|
+
* @param {Uint8Array} buf Target buffer
|
|
1899
|
+
* @param {number} pos Target buffer offset
|
|
1900
|
+
* @returns {undefined}
|
|
1901
|
+
*/
|
|
1874
1902
|
|
|
1875
|
-
/**
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1903
|
+
/**
|
|
1904
|
+
* Reads a 32 bit float from a buffer using little endian byte order.
|
|
1905
|
+
* @name util.float.readFloatLE
|
|
1906
|
+
* @function
|
|
1907
|
+
* @param {Uint8Array} buf Source buffer
|
|
1908
|
+
* @param {number} pos Source buffer offset
|
|
1909
|
+
* @returns {number} Value read
|
|
1910
|
+
*/
|
|
1883
1911
|
|
|
1884
|
-
/**
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
*/
|
|
1912
|
+
/**
|
|
1913
|
+
* Reads a 32 bit float from a buffer using big endian byte order.
|
|
1914
|
+
* @name util.float.readFloatBE
|
|
1915
|
+
* @function
|
|
1916
|
+
* @param {Uint8Array} buf Source buffer
|
|
1917
|
+
* @param {number} pos Source buffer offset
|
|
1918
|
+
* @returns {number} Value read
|
|
1919
|
+
*/
|
|
1893
1920
|
|
|
1894
|
-
/**
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1921
|
+
/**
|
|
1922
|
+
* Writes a 64 bit double to a buffer using little endian byte order.
|
|
1923
|
+
* @name util.float.writeDoubleLE
|
|
1924
|
+
* @function
|
|
1925
|
+
* @param {number} val Value to write
|
|
1926
|
+
* @param {Uint8Array} buf Target buffer
|
|
1927
|
+
* @param {number} pos Target buffer offset
|
|
1928
|
+
* @returns {undefined}
|
|
1929
|
+
*/
|
|
1903
1930
|
|
|
1904
|
-
/**
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1931
|
+
/**
|
|
1932
|
+
* Writes a 64 bit double to a buffer using big endian byte order.
|
|
1933
|
+
* @name util.float.writeDoubleBE
|
|
1934
|
+
* @function
|
|
1935
|
+
* @param {number} val Value to write
|
|
1936
|
+
* @param {Uint8Array} buf Target buffer
|
|
1937
|
+
* @param {number} pos Target buffer offset
|
|
1938
|
+
* @returns {undefined}
|
|
1939
|
+
*/
|
|
1912
1940
|
|
|
1913
|
-
/**
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1941
|
+
/**
|
|
1942
|
+
* Reads a 64 bit double from a buffer using little endian byte order.
|
|
1943
|
+
* @name util.float.readDoubleLE
|
|
1944
|
+
* @function
|
|
1945
|
+
* @param {Uint8Array} buf Source buffer
|
|
1946
|
+
* @param {number} pos Source buffer offset
|
|
1947
|
+
* @returns {number} Value read
|
|
1948
|
+
*/
|
|
1921
1949
|
|
|
1922
|
-
|
|
1923
|
-
|
|
1950
|
+
/**
|
|
1951
|
+
* Reads a 64 bit double from a buffer using big endian byte order.
|
|
1952
|
+
* @name util.float.readDoubleBE
|
|
1953
|
+
* @function
|
|
1954
|
+
* @param {Uint8Array} buf Source buffer
|
|
1955
|
+
* @param {number} pos Source buffer offset
|
|
1956
|
+
* @returns {number} Value read
|
|
1957
|
+
*/
|
|
1924
1958
|
|
|
1925
|
-
|
|
1926
|
-
|
|
1959
|
+
// Factory function for the purpose of node-based testing in modified global environments
|
|
1960
|
+
function factory(exports) {
|
|
1927
1961
|
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
le = f8b[3] === 128;
|
|
1962
|
+
// float: typed array
|
|
1963
|
+
if (typeof Float32Array !== "undefined") (function() {
|
|
1931
1964
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
buf[pos + 1] = f8b[1];
|
|
1936
|
-
buf[pos + 2] = f8b[2];
|
|
1937
|
-
buf[pos + 3] = f8b[3];
|
|
1938
|
-
}
|
|
1965
|
+
var f32 = new Float32Array([ -0 ]),
|
|
1966
|
+
f8b = new Uint8Array(f32.buffer),
|
|
1967
|
+
le = f8b[3] === 128;
|
|
1939
1968
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1969
|
+
function writeFloat_f32_cpy(val, buf, pos) {
|
|
1970
|
+
f32[0] = val;
|
|
1971
|
+
buf[pos ] = f8b[0];
|
|
1972
|
+
buf[pos + 1] = f8b[1];
|
|
1973
|
+
buf[pos + 2] = f8b[2];
|
|
1974
|
+
buf[pos + 3] = f8b[3];
|
|
1975
|
+
}
|
|
1947
1976
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1977
|
+
function writeFloat_f32_rev(val, buf, pos) {
|
|
1978
|
+
f32[0] = val;
|
|
1979
|
+
buf[pos ] = f8b[3];
|
|
1980
|
+
buf[pos + 1] = f8b[2];
|
|
1981
|
+
buf[pos + 2] = f8b[1];
|
|
1982
|
+
buf[pos + 3] = f8b[0];
|
|
1983
|
+
}
|
|
1952
1984
|
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
f8b[3] = buf[pos + 3];
|
|
1958
|
-
return f32[0];
|
|
1959
|
-
}
|
|
1985
|
+
/* istanbul ignore next */
|
|
1986
|
+
exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
|
|
1987
|
+
/* istanbul ignore next */
|
|
1988
|
+
exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
|
|
1960
1989
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1990
|
+
function readFloat_f32_cpy(buf, pos) {
|
|
1991
|
+
f8b[0] = buf[pos ];
|
|
1992
|
+
f8b[1] = buf[pos + 1];
|
|
1993
|
+
f8b[2] = buf[pos + 2];
|
|
1994
|
+
f8b[3] = buf[pos + 3];
|
|
1995
|
+
return f32[0];
|
|
1996
|
+
}
|
|
1968
1997
|
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1998
|
+
function readFloat_f32_rev(buf, pos) {
|
|
1999
|
+
f8b[3] = buf[pos ];
|
|
2000
|
+
f8b[2] = buf[pos + 1];
|
|
2001
|
+
f8b[1] = buf[pos + 2];
|
|
2002
|
+
f8b[0] = buf[pos + 3];
|
|
2003
|
+
return f32[0];
|
|
2004
|
+
}
|
|
1973
2005
|
|
|
1974
|
-
|
|
1975
|
-
|
|
2006
|
+
/* istanbul ignore next */
|
|
2007
|
+
exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
|
|
2008
|
+
/* istanbul ignore next */
|
|
2009
|
+
exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
|
|
1976
2010
|
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
if (sign)
|
|
1980
|
-
val = -val;
|
|
1981
|
-
if (val === 0)
|
|
1982
|
-
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);
|
|
1983
|
-
else if (isNaN(val))
|
|
1984
|
-
writeUint(2143289344, buf, pos);
|
|
1985
|
-
else if (val > 3.4028234663852886e+38) // +-Infinity
|
|
1986
|
-
writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
|
|
1987
|
-
else if (val < 1.1754943508222875e-38) // denormal
|
|
1988
|
-
writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
|
|
1989
|
-
else {
|
|
1990
|
-
var exponent = Math.floor(Math.log(val) / Math.LN2),
|
|
1991
|
-
mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
|
|
1992
|
-
writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
2011
|
+
// float: ieee754
|
|
2012
|
+
})(); else (function() {
|
|
1995
2013
|
|
|
1996
|
-
|
|
1997
|
-
|
|
2014
|
+
function writeFloat_ieee754(writeUint, val, buf, pos) {
|
|
2015
|
+
var sign = val < 0 ? 1 : 0;
|
|
2016
|
+
if (sign)
|
|
2017
|
+
val = -val;
|
|
2018
|
+
if (val === 0)
|
|
2019
|
+
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);
|
|
2020
|
+
else if (isNaN(val))
|
|
2021
|
+
writeUint(2143289344, buf, pos);
|
|
2022
|
+
else if (val > 3.4028234663852886e+38) // +-Infinity
|
|
2023
|
+
writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
|
|
2024
|
+
else if (val < 1.1754943508222875e-38) // denormal
|
|
2025
|
+
writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
|
|
2026
|
+
else {
|
|
2027
|
+
var exponent = Math.floor(Math.log(val) / Math.LN2),
|
|
2028
|
+
mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
|
|
2029
|
+
writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
1998
2032
|
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
sign = (uint >> 31) * 2 + 1,
|
|
2002
|
-
exponent = uint >>> 23 & 255,
|
|
2003
|
-
mantissa = uint & 8388607;
|
|
2004
|
-
return exponent === 255
|
|
2005
|
-
? mantissa
|
|
2006
|
-
? NaN
|
|
2007
|
-
: sign * Infinity
|
|
2008
|
-
: exponent === 0 // denormal
|
|
2009
|
-
? sign * 1.401298464324817e-45 * mantissa
|
|
2010
|
-
: sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
|
|
2011
|
-
}
|
|
2033
|
+
exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
|
|
2034
|
+
exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
|
|
2012
2035
|
|
|
2013
|
-
|
|
2014
|
-
|
|
2036
|
+
function readFloat_ieee754(readUint, buf, pos) {
|
|
2037
|
+
var uint = readUint(buf, pos),
|
|
2038
|
+
sign = (uint >> 31) * 2 + 1,
|
|
2039
|
+
exponent = uint >>> 23 & 255,
|
|
2040
|
+
mantissa = uint & 8388607;
|
|
2041
|
+
return exponent === 255
|
|
2042
|
+
? mantissa
|
|
2043
|
+
? NaN
|
|
2044
|
+
: sign * Infinity
|
|
2045
|
+
: exponent === 0 // denormal
|
|
2046
|
+
? sign * 1.401298464324817e-45 * mantissa
|
|
2047
|
+
: sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
|
|
2048
|
+
}
|
|
2015
2049
|
|
|
2016
|
-
|
|
2050
|
+
exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
|
|
2051
|
+
exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
|
|
2017
2052
|
|
|
2018
|
-
|
|
2019
|
-
if (typeof Float64Array !== "undefined") (function() {
|
|
2053
|
+
})();
|
|
2020
2054
|
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
le = f8b[7] === 128;
|
|
2055
|
+
// double: typed array
|
|
2056
|
+
if (typeof Float64Array !== "undefined") (function() {
|
|
2024
2057
|
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
buf[pos + 1] = f8b[1];
|
|
2029
|
-
buf[pos + 2] = f8b[2];
|
|
2030
|
-
buf[pos + 3] = f8b[3];
|
|
2031
|
-
buf[pos + 4] = f8b[4];
|
|
2032
|
-
buf[pos + 5] = f8b[5];
|
|
2033
|
-
buf[pos + 6] = f8b[6];
|
|
2034
|
-
buf[pos + 7] = f8b[7];
|
|
2035
|
-
}
|
|
2058
|
+
var f64 = new Float64Array([-0]),
|
|
2059
|
+
f8b = new Uint8Array(f64.buffer),
|
|
2060
|
+
le = f8b[7] === 128;
|
|
2036
2061
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2062
|
+
function writeDouble_f64_cpy(val, buf, pos) {
|
|
2063
|
+
f64[0] = val;
|
|
2064
|
+
buf[pos ] = f8b[0];
|
|
2065
|
+
buf[pos + 1] = f8b[1];
|
|
2066
|
+
buf[pos + 2] = f8b[2];
|
|
2067
|
+
buf[pos + 3] = f8b[3];
|
|
2068
|
+
buf[pos + 4] = f8b[4];
|
|
2069
|
+
buf[pos + 5] = f8b[5];
|
|
2070
|
+
buf[pos + 6] = f8b[6];
|
|
2071
|
+
buf[pos + 7] = f8b[7];
|
|
2072
|
+
}
|
|
2048
2073
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2074
|
+
function writeDouble_f64_rev(val, buf, pos) {
|
|
2075
|
+
f64[0] = val;
|
|
2076
|
+
buf[pos ] = f8b[7];
|
|
2077
|
+
buf[pos + 1] = f8b[6];
|
|
2078
|
+
buf[pos + 2] = f8b[5];
|
|
2079
|
+
buf[pos + 3] = f8b[4];
|
|
2080
|
+
buf[pos + 4] = f8b[3];
|
|
2081
|
+
buf[pos + 5] = f8b[2];
|
|
2082
|
+
buf[pos + 6] = f8b[1];
|
|
2083
|
+
buf[pos + 7] = f8b[0];
|
|
2084
|
+
}
|
|
2053
2085
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
f8b[3] = buf[pos + 3];
|
|
2059
|
-
f8b[4] = buf[pos + 4];
|
|
2060
|
-
f8b[5] = buf[pos + 5];
|
|
2061
|
-
f8b[6] = buf[pos + 6];
|
|
2062
|
-
f8b[7] = buf[pos + 7];
|
|
2063
|
-
return f64[0];
|
|
2064
|
-
}
|
|
2086
|
+
/* istanbul ignore next */
|
|
2087
|
+
exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
|
|
2088
|
+
/* istanbul ignore next */
|
|
2089
|
+
exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
|
|
2065
2090
|
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2091
|
+
function readDouble_f64_cpy(buf, pos) {
|
|
2092
|
+
f8b[0] = buf[pos ];
|
|
2093
|
+
f8b[1] = buf[pos + 1];
|
|
2094
|
+
f8b[2] = buf[pos + 2];
|
|
2095
|
+
f8b[3] = buf[pos + 3];
|
|
2096
|
+
f8b[4] = buf[pos + 4];
|
|
2097
|
+
f8b[5] = buf[pos + 5];
|
|
2098
|
+
f8b[6] = buf[pos + 6];
|
|
2099
|
+
f8b[7] = buf[pos + 7];
|
|
2100
|
+
return f64[0];
|
|
2101
|
+
}
|
|
2077
2102
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2103
|
+
function readDouble_f64_rev(buf, pos) {
|
|
2104
|
+
f8b[7] = buf[pos ];
|
|
2105
|
+
f8b[6] = buf[pos + 1];
|
|
2106
|
+
f8b[5] = buf[pos + 2];
|
|
2107
|
+
f8b[4] = buf[pos + 3];
|
|
2108
|
+
f8b[3] = buf[pos + 4];
|
|
2109
|
+
f8b[2] = buf[pos + 5];
|
|
2110
|
+
f8b[1] = buf[pos + 6];
|
|
2111
|
+
f8b[0] = buf[pos + 7];
|
|
2112
|
+
return f64[0];
|
|
2113
|
+
}
|
|
2082
2114
|
|
|
2083
|
-
|
|
2084
|
-
|
|
2115
|
+
/* istanbul ignore next */
|
|
2116
|
+
exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
|
|
2117
|
+
/* istanbul ignore next */
|
|
2118
|
+
exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
|
|
2085
2119
|
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
if (sign)
|
|
2089
|
-
val = -val;
|
|
2090
|
-
if (val === 0) {
|
|
2091
|
-
writeUint(0, buf, pos + off0);
|
|
2092
|
-
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);
|
|
2093
|
-
} else if (isNaN(val)) {
|
|
2094
|
-
writeUint(0, buf, pos + off0);
|
|
2095
|
-
writeUint(2146959360, buf, pos + off1);
|
|
2096
|
-
} else if (val > 1.7976931348623157e+308) { // +-Infinity
|
|
2097
|
-
writeUint(0, buf, pos + off0);
|
|
2098
|
-
writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
|
|
2099
|
-
} else {
|
|
2100
|
-
var mantissa;
|
|
2101
|
-
if (val < 2.2250738585072014e-308) { // denormal
|
|
2102
|
-
mantissa = val / 5e-324;
|
|
2103
|
-
writeUint(mantissa >>> 0, buf, pos + off0);
|
|
2104
|
-
writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
|
|
2105
|
-
} else {
|
|
2106
|
-
var exponent = Math.floor(Math.log(val) / Math.LN2);
|
|
2107
|
-
if (exponent === 1024)
|
|
2108
|
-
exponent = 1023;
|
|
2109
|
-
mantissa = val * Math.pow(2, -exponent);
|
|
2110
|
-
writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
|
|
2111
|
-
writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2120
|
+
// double: ieee754
|
|
2121
|
+
})(); else (function() {
|
|
2115
2122
|
|
|
2116
|
-
|
|
2117
|
-
|
|
2123
|
+
function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
|
|
2124
|
+
var sign = val < 0 ? 1 : 0;
|
|
2125
|
+
if (sign)
|
|
2126
|
+
val = -val;
|
|
2127
|
+
if (val === 0) {
|
|
2128
|
+
writeUint(0, buf, pos + off0);
|
|
2129
|
+
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);
|
|
2130
|
+
} else if (isNaN(val)) {
|
|
2131
|
+
writeUint(0, buf, pos + off0);
|
|
2132
|
+
writeUint(2146959360, buf, pos + off1);
|
|
2133
|
+
} else if (val > 1.7976931348623157e+308) { // +-Infinity
|
|
2134
|
+
writeUint(0, buf, pos + off0);
|
|
2135
|
+
writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
|
|
2136
|
+
} else {
|
|
2137
|
+
var mantissa;
|
|
2138
|
+
if (val < 2.2250738585072014e-308) { // denormal
|
|
2139
|
+
mantissa = val / 5e-324;
|
|
2140
|
+
writeUint(mantissa >>> 0, buf, pos + off0);
|
|
2141
|
+
writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
|
|
2142
|
+
} else {
|
|
2143
|
+
var exponent = Math.floor(Math.log(val) / Math.LN2);
|
|
2144
|
+
if (exponent === 1024)
|
|
2145
|
+
exponent = 1023;
|
|
2146
|
+
mantissa = val * Math.pow(2, -exponent);
|
|
2147
|
+
writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
|
|
2148
|
+
writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2118
2152
|
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
hi = readUint(buf, pos + off1);
|
|
2122
|
-
var sign = (hi >> 31) * 2 + 1,
|
|
2123
|
-
exponent = hi >>> 20 & 2047,
|
|
2124
|
-
mantissa = 4294967296 * (hi & 1048575) + lo;
|
|
2125
|
-
return exponent === 2047
|
|
2126
|
-
? mantissa
|
|
2127
|
-
? NaN
|
|
2128
|
-
: sign * Infinity
|
|
2129
|
-
: exponent === 0 // denormal
|
|
2130
|
-
? sign * 5e-324 * mantissa
|
|
2131
|
-
: sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
|
|
2132
|
-
}
|
|
2153
|
+
exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
|
|
2154
|
+
exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
|
|
2133
2155
|
|
|
2134
|
-
|
|
2135
|
-
|
|
2156
|
+
function readDouble_ieee754(readUint, off0, off1, buf, pos) {
|
|
2157
|
+
var lo = readUint(buf, pos + off0),
|
|
2158
|
+
hi = readUint(buf, pos + off1);
|
|
2159
|
+
var sign = (hi >> 31) * 2 + 1,
|
|
2160
|
+
exponent = hi >>> 20 & 2047,
|
|
2161
|
+
mantissa = 4294967296 * (hi & 1048575) + lo;
|
|
2162
|
+
return exponent === 2047
|
|
2163
|
+
? mantissa
|
|
2164
|
+
? NaN
|
|
2165
|
+
: sign * Infinity
|
|
2166
|
+
: exponent === 0 // denormal
|
|
2167
|
+
? sign * 5e-324 * mantissa
|
|
2168
|
+
: sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
|
|
2169
|
+
}
|
|
2136
2170
|
|
|
2137
|
-
|
|
2171
|
+
exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
|
|
2172
|
+
exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
|
|
2138
2173
|
|
|
2139
|
-
|
|
2140
|
-
}
|
|
2174
|
+
})();
|
|
2141
2175
|
|
|
2142
|
-
|
|
2176
|
+
return exports;
|
|
2177
|
+
}
|
|
2143
2178
|
|
|
2144
|
-
|
|
2145
|
-
buf[pos ] = val & 255;
|
|
2146
|
-
buf[pos + 1] = val >>> 8 & 255;
|
|
2147
|
-
buf[pos + 2] = val >>> 16 & 255;
|
|
2148
|
-
buf[pos + 3] = val >>> 24;
|
|
2149
|
-
}
|
|
2179
|
+
// uint helpers
|
|
2150
2180
|
|
|
2151
|
-
function
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
}
|
|
2181
|
+
function writeUintLE(val, buf, pos) {
|
|
2182
|
+
buf[pos ] = val & 255;
|
|
2183
|
+
buf[pos + 1] = val >>> 8 & 255;
|
|
2184
|
+
buf[pos + 2] = val >>> 16 & 255;
|
|
2185
|
+
buf[pos + 3] = val >>> 24;
|
|
2186
|
+
}
|
|
2157
2187
|
|
|
2158
|
-
function
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
}
|
|
2188
|
+
function writeUintBE(val, buf, pos) {
|
|
2189
|
+
buf[pos ] = val >>> 24;
|
|
2190
|
+
buf[pos + 1] = val >>> 16 & 255;
|
|
2191
|
+
buf[pos + 2] = val >>> 8 & 255;
|
|
2192
|
+
buf[pos + 3] = val & 255;
|
|
2193
|
+
}
|
|
2164
2194
|
|
|
2165
|
-
function
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2195
|
+
function readUintLE(buf, pos) {
|
|
2196
|
+
return (buf[pos ]
|
|
2197
|
+
| buf[pos + 1] << 8
|
|
2198
|
+
| buf[pos + 2] << 16
|
|
2199
|
+
| buf[pos + 3] << 24) >>> 0;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
function readUintBE(buf, pos) {
|
|
2203
|
+
return (buf[pos ] << 24
|
|
2204
|
+
| buf[pos + 1] << 16
|
|
2205
|
+
| buf[pos + 2] << 8
|
|
2206
|
+
| buf[pos + 3]) >>> 0;
|
|
2207
|
+
}
|
|
2208
|
+
return float;
|
|
2170
2209
|
}
|
|
2171
2210
|
|
|
2172
|
-
var inquire_1
|
|
2211
|
+
var inquire_1;
|
|
2212
|
+
var hasRequiredInquire;
|
|
2213
|
+
|
|
2214
|
+
function requireInquire () {
|
|
2215
|
+
if (hasRequiredInquire) return inquire_1;
|
|
2216
|
+
hasRequiredInquire = 1;
|
|
2217
|
+
inquire_1 = inquire;
|
|
2173
2218
|
|
|
2174
|
-
/**
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
function inquire(moduleName) {
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2219
|
+
/**
|
|
2220
|
+
* Requires a module only if available.
|
|
2221
|
+
* @memberof util
|
|
2222
|
+
* @param {string} moduleName Module to require
|
|
2223
|
+
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
2224
|
+
*/
|
|
2225
|
+
function inquire(moduleName) {
|
|
2226
|
+
try {
|
|
2227
|
+
var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
|
|
2228
|
+
if (mod && (mod.length || Object.keys(mod).length))
|
|
2229
|
+
return mod;
|
|
2230
|
+
} catch (e) {} // eslint-disable-line no-empty
|
|
2231
|
+
return null;
|
|
2232
|
+
}
|
|
2233
|
+
return inquire_1;
|
|
2187
2234
|
}
|
|
2188
2235
|
|
|
2189
2236
|
var utf8$2 = {};
|
|
2190
2237
|
|
|
2191
|
-
|
|
2238
|
+
var hasRequiredUtf8;
|
|
2239
|
+
|
|
2240
|
+
function requireUtf8 () {
|
|
2241
|
+
if (hasRequiredUtf8) return utf8$2;
|
|
2242
|
+
hasRequiredUtf8 = 1;
|
|
2243
|
+
(function (exports) {
|
|
2192
2244
|
|
|
2193
|
-
/**
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
var utf8 = exports;
|
|
2245
|
+
/**
|
|
2246
|
+
* A minimal UTF8 implementation for number arrays.
|
|
2247
|
+
* @memberof util
|
|
2248
|
+
* @namespace
|
|
2249
|
+
*/
|
|
2250
|
+
var utf8 = exports;
|
|
2199
2251
|
|
|
2200
|
-
/**
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
utf8.length = function utf8_length(string) {
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
};
|
|
2252
|
+
/**
|
|
2253
|
+
* Calculates the UTF8 byte length of a string.
|
|
2254
|
+
* @param {string} string String
|
|
2255
|
+
* @returns {number} Byte length
|
|
2256
|
+
*/
|
|
2257
|
+
utf8.length = function utf8_length(string) {
|
|
2258
|
+
var len = 0,
|
|
2259
|
+
c = 0;
|
|
2260
|
+
for (var i = 0; i < string.length; ++i) {
|
|
2261
|
+
c = string.charCodeAt(i);
|
|
2262
|
+
if (c < 128)
|
|
2263
|
+
len += 1;
|
|
2264
|
+
else if (c < 2048)
|
|
2265
|
+
len += 2;
|
|
2266
|
+
else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
|
|
2267
|
+
++i;
|
|
2268
|
+
len += 4;
|
|
2269
|
+
} else
|
|
2270
|
+
len += 3;
|
|
2271
|
+
}
|
|
2272
|
+
return len;
|
|
2273
|
+
};
|
|
2222
2274
|
|
|
2223
|
-
/**
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
utf8.read = function utf8_read(buffer, start, end) {
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
};
|
|
2275
|
+
/**
|
|
2276
|
+
* Reads UTF8 bytes as a string.
|
|
2277
|
+
* @param {Uint8Array} buffer Source buffer
|
|
2278
|
+
* @param {number} start Source start
|
|
2279
|
+
* @param {number} end Source end
|
|
2280
|
+
* @returns {string} String read
|
|
2281
|
+
*/
|
|
2282
|
+
utf8.read = function utf8_read(buffer, start, end) {
|
|
2283
|
+
var len = end - start;
|
|
2284
|
+
if (len < 1)
|
|
2285
|
+
return "";
|
|
2286
|
+
var parts = null,
|
|
2287
|
+
chunk = [],
|
|
2288
|
+
i = 0, // char offset
|
|
2289
|
+
t; // temporary
|
|
2290
|
+
while (start < end) {
|
|
2291
|
+
t = buffer[start++];
|
|
2292
|
+
if (t < 128)
|
|
2293
|
+
chunk[i++] = t;
|
|
2294
|
+
else if (t > 191 && t < 224)
|
|
2295
|
+
chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
|
|
2296
|
+
else if (t > 239 && t < 365) {
|
|
2297
|
+
t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
|
|
2298
|
+
chunk[i++] = 0xD800 + (t >> 10);
|
|
2299
|
+
chunk[i++] = 0xDC00 + (t & 1023);
|
|
2300
|
+
} else
|
|
2301
|
+
chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
|
|
2302
|
+
if (i > 8191) {
|
|
2303
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
|
2304
|
+
i = 0;
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
if (parts) {
|
|
2308
|
+
if (i)
|
|
2309
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
2310
|
+
return parts.join("");
|
|
2311
|
+
}
|
|
2312
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
|
2313
|
+
};
|
|
2262
2314
|
|
|
2263
|
-
/**
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
utf8.write = function utf8_write(string, buffer, offset) {
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
};
|
|
2296
|
-
}(utf8$2));
|
|
2315
|
+
/**
|
|
2316
|
+
* Writes a string as UTF8 bytes.
|
|
2317
|
+
* @param {string} string Source string
|
|
2318
|
+
* @param {Uint8Array} buffer Destination buffer
|
|
2319
|
+
* @param {number} offset Destination offset
|
|
2320
|
+
* @returns {number} Bytes written
|
|
2321
|
+
*/
|
|
2322
|
+
utf8.write = function utf8_write(string, buffer, offset) {
|
|
2323
|
+
var start = offset,
|
|
2324
|
+
c1, // character 1
|
|
2325
|
+
c2; // character 2
|
|
2326
|
+
for (var i = 0; i < string.length; ++i) {
|
|
2327
|
+
c1 = string.charCodeAt(i);
|
|
2328
|
+
if (c1 < 128) {
|
|
2329
|
+
buffer[offset++] = c1;
|
|
2330
|
+
} else if (c1 < 2048) {
|
|
2331
|
+
buffer[offset++] = c1 >> 6 | 192;
|
|
2332
|
+
buffer[offset++] = c1 & 63 | 128;
|
|
2333
|
+
} else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
|
|
2334
|
+
c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
|
|
2335
|
+
++i;
|
|
2336
|
+
buffer[offset++] = c1 >> 18 | 240;
|
|
2337
|
+
buffer[offset++] = c1 >> 12 & 63 | 128;
|
|
2338
|
+
buffer[offset++] = c1 >> 6 & 63 | 128;
|
|
2339
|
+
buffer[offset++] = c1 & 63 | 128;
|
|
2340
|
+
} else {
|
|
2341
|
+
buffer[offset++] = c1 >> 12 | 224;
|
|
2342
|
+
buffer[offset++] = c1 >> 6 & 63 | 128;
|
|
2343
|
+
buffer[offset++] = c1 & 63 | 128;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
return offset - start;
|
|
2347
|
+
};
|
|
2348
|
+
} (utf8$2));
|
|
2349
|
+
return utf8$2;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
var pool_1;
|
|
2353
|
+
var hasRequiredPool;
|
|
2297
2354
|
|
|
2298
|
-
|
|
2355
|
+
function requirePool () {
|
|
2356
|
+
if (hasRequiredPool) return pool_1;
|
|
2357
|
+
hasRequiredPool = 1;
|
|
2358
|
+
pool_1 = pool;
|
|
2299
2359
|
|
|
2300
|
-
/**
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2360
|
+
/**
|
|
2361
|
+
* An allocator as used by {@link util.pool}.
|
|
2362
|
+
* @typedef PoolAllocator
|
|
2363
|
+
* @type {function}
|
|
2364
|
+
* @param {number} size Buffer size
|
|
2365
|
+
* @returns {Uint8Array} Buffer
|
|
2366
|
+
*/
|
|
2307
2367
|
|
|
2308
|
-
/**
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2368
|
+
/**
|
|
2369
|
+
* A slicer as used by {@link util.pool}.
|
|
2370
|
+
* @typedef PoolSlicer
|
|
2371
|
+
* @type {function}
|
|
2372
|
+
* @param {number} start Start offset
|
|
2373
|
+
* @param {number} end End offset
|
|
2374
|
+
* @returns {Uint8Array} Buffer slice
|
|
2375
|
+
* @this {Uint8Array}
|
|
2376
|
+
*/
|
|
2317
2377
|
|
|
2318
|
-
/**
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
function pool(alloc, slice, size) {
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
}
|
|
2345
|
-
|
|
2346
|
-
var longbits = LongBits$2;
|
|
2347
|
-
|
|
2348
|
-
var util$5 = minimal$1;
|
|
2349
|
-
|
|
2350
|
-
/**
|
|
2351
|
-
* Constructs new long bits.
|
|
2352
|
-
* @classdesc Helper class for working with the low and high bits of a 64 bit value.
|
|
2353
|
-
* @memberof util
|
|
2354
|
-
* @constructor
|
|
2355
|
-
* @param {number} lo Low 32 bits, unsigned
|
|
2356
|
-
* @param {number} hi High 32 bits, unsigned
|
|
2357
|
-
*/
|
|
2358
|
-
function LongBits$2(lo, hi) {
|
|
2359
|
-
|
|
2360
|
-
// note that the casts below are theoretically unnecessary as of today, but older statically
|
|
2361
|
-
// generated converter code might still call the ctor with signed 32bits. kept for compat.
|
|
2362
|
-
|
|
2363
|
-
/**
|
|
2364
|
-
* Low bits.
|
|
2365
|
-
* @type {number}
|
|
2366
|
-
*/
|
|
2367
|
-
this.lo = lo >>> 0;
|
|
2368
|
-
|
|
2369
|
-
/**
|
|
2370
|
-
* High bits.
|
|
2371
|
-
* @type {number}
|
|
2372
|
-
*/
|
|
2373
|
-
this.hi = hi >>> 0;
|
|
2378
|
+
/**
|
|
2379
|
+
* A general purpose buffer pool.
|
|
2380
|
+
* @memberof util
|
|
2381
|
+
* @function
|
|
2382
|
+
* @param {PoolAllocator} alloc Allocator
|
|
2383
|
+
* @param {PoolSlicer} slice Slicer
|
|
2384
|
+
* @param {number} [size=8192] Slab size
|
|
2385
|
+
* @returns {PoolAllocator} Pooled allocator
|
|
2386
|
+
*/
|
|
2387
|
+
function pool(alloc, slice, size) {
|
|
2388
|
+
var SIZE = size || 8192;
|
|
2389
|
+
var MAX = SIZE >>> 1;
|
|
2390
|
+
var slab = null;
|
|
2391
|
+
var offset = SIZE;
|
|
2392
|
+
return function pool_alloc(size) {
|
|
2393
|
+
if (size < 1 || size > MAX)
|
|
2394
|
+
return alloc(size);
|
|
2395
|
+
if (offset + size > SIZE) {
|
|
2396
|
+
slab = alloc(SIZE);
|
|
2397
|
+
offset = 0;
|
|
2398
|
+
}
|
|
2399
|
+
var buf = slice.call(slab, offset, offset += size);
|
|
2400
|
+
if (offset & 7) // align to 32 bit
|
|
2401
|
+
offset = (offset | 7) + 1;
|
|
2402
|
+
return buf;
|
|
2403
|
+
};
|
|
2404
|
+
}
|
|
2405
|
+
return pool_1;
|
|
2374
2406
|
}
|
|
2375
2407
|
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
&& commonjsGlobal.process.versions.node);
|
|
2583
|
-
|
|
2584
|
-
/**
|
|
2585
|
-
* Global object reference.
|
|
2586
|
-
* @memberof util
|
|
2587
|
-
* @type {Object}
|
|
2588
|
-
*/
|
|
2589
|
-
util.global = util.isNode && commonjsGlobal
|
|
2590
|
-
|| typeof window !== "undefined" && window
|
|
2591
|
-
|| typeof self !== "undefined" && self
|
|
2592
|
-
|| commonjsGlobal; // eslint-disable-line no-invalid-this
|
|
2593
|
-
|
|
2594
|
-
/**
|
|
2595
|
-
* An immuable empty array.
|
|
2596
|
-
* @memberof util
|
|
2597
|
-
* @type {Array.<*>}
|
|
2598
|
-
* @const
|
|
2599
|
-
*/
|
|
2600
|
-
util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes
|
|
2601
|
-
|
|
2602
|
-
/**
|
|
2603
|
-
* An immutable empty object.
|
|
2604
|
-
* @type {Object}
|
|
2605
|
-
* @const
|
|
2606
|
-
*/
|
|
2607
|
-
util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes
|
|
2608
|
-
|
|
2609
|
-
/**
|
|
2610
|
-
* Tests if the specified value is an integer.
|
|
2611
|
-
* @function
|
|
2612
|
-
* @param {*} value Value to test
|
|
2613
|
-
* @returns {boolean} `true` if the value is an integer
|
|
2614
|
-
*/
|
|
2615
|
-
util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {
|
|
2616
|
-
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
|
2617
|
-
};
|
|
2618
|
-
|
|
2619
|
-
/**
|
|
2620
|
-
* Tests if the specified value is a string.
|
|
2621
|
-
* @param {*} value Value to test
|
|
2622
|
-
* @returns {boolean} `true` if the value is a string
|
|
2623
|
-
*/
|
|
2624
|
-
util.isString = function isString(value) {
|
|
2625
|
-
return typeof value === "string" || value instanceof String;
|
|
2626
|
-
};
|
|
2627
|
-
|
|
2628
|
-
/**
|
|
2629
|
-
* Tests if the specified value is a non-null object.
|
|
2630
|
-
* @param {*} value Value to test
|
|
2631
|
-
* @returns {boolean} `true` if the value is a non-null object
|
|
2632
|
-
*/
|
|
2633
|
-
util.isObject = function isObject(value) {
|
|
2634
|
-
return value && typeof value === "object";
|
|
2635
|
-
};
|
|
2636
|
-
|
|
2637
|
-
/**
|
|
2638
|
-
* Checks if a property on a message is considered to be present.
|
|
2639
|
-
* This is an alias of {@link util.isSet}.
|
|
2640
|
-
* @function
|
|
2641
|
-
* @param {Object} obj Plain object or message instance
|
|
2642
|
-
* @param {string} prop Property name
|
|
2643
|
-
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
|
2644
|
-
*/
|
|
2645
|
-
util.isset =
|
|
2646
|
-
|
|
2647
|
-
/**
|
|
2648
|
-
* Checks if a property on a message is considered to be present.
|
|
2649
|
-
* @param {Object} obj Plain object or message instance
|
|
2650
|
-
* @param {string} prop Property name
|
|
2651
|
-
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
|
2652
|
-
*/
|
|
2653
|
-
util.isSet = function isSet(obj, prop) {
|
|
2654
|
-
var value = obj[prop];
|
|
2655
|
-
if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
|
|
2656
|
-
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
|
2657
|
-
return false;
|
|
2658
|
-
};
|
|
2659
|
-
|
|
2660
|
-
/**
|
|
2661
|
-
* Any compatible Buffer instance.
|
|
2662
|
-
* This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
|
|
2663
|
-
* @interface Buffer
|
|
2664
|
-
* @extends Uint8Array
|
|
2665
|
-
*/
|
|
2666
|
-
|
|
2667
|
-
/**
|
|
2668
|
-
* Node's Buffer class if available.
|
|
2669
|
-
* @type {Constructor<Buffer>}
|
|
2670
|
-
*/
|
|
2671
|
-
util.Buffer = (function() {
|
|
2672
|
-
try {
|
|
2673
|
-
var Buffer = util.inquire("buffer").Buffer;
|
|
2674
|
-
// refuse to use non-node buffers if not explicitly assigned (perf reasons):
|
|
2675
|
-
return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;
|
|
2676
|
-
} catch (e) {
|
|
2677
|
-
/* istanbul ignore next */
|
|
2678
|
-
return null;
|
|
2679
|
-
}
|
|
2680
|
-
})();
|
|
2681
|
-
|
|
2682
|
-
// Internal alias of or polyfull for Buffer.from.
|
|
2683
|
-
util._Buffer_from = null;
|
|
2684
|
-
|
|
2685
|
-
// Internal alias of or polyfill for Buffer.allocUnsafe.
|
|
2686
|
-
util._Buffer_allocUnsafe = null;
|
|
2687
|
-
|
|
2688
|
-
/**
|
|
2689
|
-
* Creates a new buffer of whatever type supported by the environment.
|
|
2690
|
-
* @param {number|number[]} [sizeOrArray=0] Buffer size or number array
|
|
2691
|
-
* @returns {Uint8Array|Buffer} Buffer
|
|
2692
|
-
*/
|
|
2693
|
-
util.newBuffer = function newBuffer(sizeOrArray) {
|
|
2694
|
-
/* istanbul ignore next */
|
|
2695
|
-
return typeof sizeOrArray === "number"
|
|
2696
|
-
? util.Buffer
|
|
2697
|
-
? util._Buffer_allocUnsafe(sizeOrArray)
|
|
2698
|
-
: new util.Array(sizeOrArray)
|
|
2699
|
-
: util.Buffer
|
|
2700
|
-
? util._Buffer_from(sizeOrArray)
|
|
2701
|
-
: typeof Uint8Array === "undefined"
|
|
2702
|
-
? sizeOrArray
|
|
2703
|
-
: new Uint8Array(sizeOrArray);
|
|
2704
|
-
};
|
|
2705
|
-
|
|
2706
|
-
/**
|
|
2707
|
-
* Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.
|
|
2708
|
-
* @type {Constructor<Uint8Array>}
|
|
2709
|
-
*/
|
|
2710
|
-
util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array;
|
|
2711
|
-
|
|
2712
|
-
/**
|
|
2713
|
-
* Any compatible Long instance.
|
|
2714
|
-
* This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.
|
|
2715
|
-
* @interface Long
|
|
2716
|
-
* @property {number} low Low bits
|
|
2717
|
-
* @property {number} high High bits
|
|
2718
|
-
* @property {boolean} unsigned Whether unsigned or not
|
|
2719
|
-
*/
|
|
2720
|
-
|
|
2721
|
-
/**
|
|
2722
|
-
* Long.js's Long class if available.
|
|
2723
|
-
* @type {Constructor<Long>}
|
|
2724
|
-
*/
|
|
2725
|
-
util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long
|
|
2726
|
-
|| /* istanbul ignore next */ util.global.Long
|
|
2727
|
-
|| util.inquire("long");
|
|
2728
|
-
|
|
2729
|
-
/**
|
|
2730
|
-
* Regular expression used to verify 2 bit (`bool`) map keys.
|
|
2731
|
-
* @type {RegExp}
|
|
2732
|
-
* @const
|
|
2733
|
-
*/
|
|
2734
|
-
util.key2Re = /^true|false|0|1$/;
|
|
2735
|
-
|
|
2736
|
-
/**
|
|
2737
|
-
* Regular expression used to verify 32 bit (`int32` etc.) map keys.
|
|
2738
|
-
* @type {RegExp}
|
|
2739
|
-
* @const
|
|
2740
|
-
*/
|
|
2741
|
-
util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
|
|
2742
|
-
|
|
2743
|
-
/**
|
|
2744
|
-
* Regular expression used to verify 64 bit (`int64` etc.) map keys.
|
|
2745
|
-
* @type {RegExp}
|
|
2746
|
-
* @const
|
|
2747
|
-
*/
|
|
2748
|
-
util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
|
|
2749
|
-
|
|
2750
|
-
/**
|
|
2751
|
-
* Converts a number or long to an 8 characters long hash string.
|
|
2752
|
-
* @param {Long|number} value Value to convert
|
|
2753
|
-
* @returns {string} Hash
|
|
2754
|
-
*/
|
|
2755
|
-
util.longToHash = function longToHash(value) {
|
|
2756
|
-
return value
|
|
2757
|
-
? util.LongBits.from(value).toHash()
|
|
2758
|
-
: util.LongBits.zeroHash;
|
|
2759
|
-
};
|
|
2760
|
-
|
|
2761
|
-
/**
|
|
2762
|
-
* Converts an 8 characters long hash string to a long or number.
|
|
2763
|
-
* @param {string} hash Hash
|
|
2764
|
-
* @param {boolean} [unsigned=false] Whether unsigned or not
|
|
2765
|
-
* @returns {Long|number} Original value
|
|
2766
|
-
*/
|
|
2767
|
-
util.longFromHash = function longFromHash(hash, unsigned) {
|
|
2768
|
-
var bits = util.LongBits.fromHash(hash);
|
|
2769
|
-
if (util.Long)
|
|
2770
|
-
return util.Long.fromBits(bits.lo, bits.hi, unsigned);
|
|
2771
|
-
return bits.toNumber(Boolean(unsigned));
|
|
2772
|
-
};
|
|
2773
|
-
|
|
2774
|
-
/**
|
|
2775
|
-
* Merges the properties of the source object into the destination object.
|
|
2776
|
-
* @memberof util
|
|
2777
|
-
* @param {Object.<string,*>} dst Destination object
|
|
2778
|
-
* @param {Object.<string,*>} src Source object
|
|
2779
|
-
* @param {boolean} [ifNotSet=false] Merges only if the key is not already set
|
|
2780
|
-
* @returns {Object.<string,*>} Destination object
|
|
2781
|
-
*/
|
|
2782
|
-
function merge(dst, src, ifNotSet) { // used by converters
|
|
2783
|
-
for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
|
|
2784
|
-
if (dst[keys[i]] === undefined || !ifNotSet)
|
|
2785
|
-
dst[keys[i]] = src[keys[i]];
|
|
2786
|
-
return dst;
|
|
2408
|
+
var longbits;
|
|
2409
|
+
var hasRequiredLongbits;
|
|
2410
|
+
|
|
2411
|
+
function requireLongbits () {
|
|
2412
|
+
if (hasRequiredLongbits) return longbits;
|
|
2413
|
+
hasRequiredLongbits = 1;
|
|
2414
|
+
longbits = LongBits;
|
|
2415
|
+
|
|
2416
|
+
var util = requireMinimal();
|
|
2417
|
+
|
|
2418
|
+
/**
|
|
2419
|
+
* Constructs new long bits.
|
|
2420
|
+
* @classdesc Helper class for working with the low and high bits of a 64 bit value.
|
|
2421
|
+
* @memberof util
|
|
2422
|
+
* @constructor
|
|
2423
|
+
* @param {number} lo Low 32 bits, unsigned
|
|
2424
|
+
* @param {number} hi High 32 bits, unsigned
|
|
2425
|
+
*/
|
|
2426
|
+
function LongBits(lo, hi) {
|
|
2427
|
+
|
|
2428
|
+
// note that the casts below are theoretically unnecessary as of today, but older statically
|
|
2429
|
+
// generated converter code might still call the ctor with signed 32bits. kept for compat.
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Low bits.
|
|
2433
|
+
* @type {number}
|
|
2434
|
+
*/
|
|
2435
|
+
this.lo = lo >>> 0;
|
|
2436
|
+
|
|
2437
|
+
/**
|
|
2438
|
+
* High bits.
|
|
2439
|
+
* @type {number}
|
|
2440
|
+
*/
|
|
2441
|
+
this.hi = hi >>> 0;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* Zero bits.
|
|
2446
|
+
* @memberof util.LongBits
|
|
2447
|
+
* @type {util.LongBits}
|
|
2448
|
+
*/
|
|
2449
|
+
var zero = LongBits.zero = new LongBits(0, 0);
|
|
2450
|
+
|
|
2451
|
+
zero.toNumber = function() { return 0; };
|
|
2452
|
+
zero.zzEncode = zero.zzDecode = function() { return this; };
|
|
2453
|
+
zero.length = function() { return 1; };
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Zero hash.
|
|
2457
|
+
* @memberof util.LongBits
|
|
2458
|
+
* @type {string}
|
|
2459
|
+
*/
|
|
2460
|
+
var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
|
|
2461
|
+
|
|
2462
|
+
/**
|
|
2463
|
+
* Constructs new long bits from the specified number.
|
|
2464
|
+
* @param {number} value Value
|
|
2465
|
+
* @returns {util.LongBits} Instance
|
|
2466
|
+
*/
|
|
2467
|
+
LongBits.fromNumber = function fromNumber(value) {
|
|
2468
|
+
if (value === 0)
|
|
2469
|
+
return zero;
|
|
2470
|
+
var sign = value < 0;
|
|
2471
|
+
if (sign)
|
|
2472
|
+
value = -value;
|
|
2473
|
+
var lo = value >>> 0,
|
|
2474
|
+
hi = (value - lo) / 4294967296 >>> 0;
|
|
2475
|
+
if (sign) {
|
|
2476
|
+
hi = ~hi >>> 0;
|
|
2477
|
+
lo = ~lo >>> 0;
|
|
2478
|
+
if (++lo > 4294967295) {
|
|
2479
|
+
lo = 0;
|
|
2480
|
+
if (++hi > 4294967295)
|
|
2481
|
+
hi = 0;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
return new LongBits(lo, hi);
|
|
2485
|
+
};
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* Constructs new long bits from a number, long or string.
|
|
2489
|
+
* @param {Long|number|string} value Value
|
|
2490
|
+
* @returns {util.LongBits} Instance
|
|
2491
|
+
*/
|
|
2492
|
+
LongBits.from = function from(value) {
|
|
2493
|
+
if (typeof value === "number")
|
|
2494
|
+
return LongBits.fromNumber(value);
|
|
2495
|
+
if (util.isString(value)) {
|
|
2496
|
+
/* istanbul ignore else */
|
|
2497
|
+
if (util.Long)
|
|
2498
|
+
value = util.Long.fromString(value);
|
|
2499
|
+
else
|
|
2500
|
+
return LongBits.fromNumber(parseInt(value, 10));
|
|
2501
|
+
}
|
|
2502
|
+
return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2505
|
+
/**
|
|
2506
|
+
* Converts this long bits to a possibly unsafe JavaScript number.
|
|
2507
|
+
* @param {boolean} [unsigned=false] Whether unsigned or not
|
|
2508
|
+
* @returns {number} Possibly unsafe number
|
|
2509
|
+
*/
|
|
2510
|
+
LongBits.prototype.toNumber = function toNumber(unsigned) {
|
|
2511
|
+
if (!unsigned && this.hi >>> 31) {
|
|
2512
|
+
var lo = ~this.lo + 1 >>> 0,
|
|
2513
|
+
hi = ~this.hi >>> 0;
|
|
2514
|
+
if (!lo)
|
|
2515
|
+
hi = hi + 1 >>> 0;
|
|
2516
|
+
return -(lo + hi * 4294967296);
|
|
2517
|
+
}
|
|
2518
|
+
return this.lo + this.hi * 4294967296;
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* Converts this long bits to a long.
|
|
2523
|
+
* @param {boolean} [unsigned=false] Whether unsigned or not
|
|
2524
|
+
* @returns {Long} Long
|
|
2525
|
+
*/
|
|
2526
|
+
LongBits.prototype.toLong = function toLong(unsigned) {
|
|
2527
|
+
return util.Long
|
|
2528
|
+
? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
|
|
2529
|
+
/* istanbul ignore next */
|
|
2530
|
+
: { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
|
|
2531
|
+
};
|
|
2532
|
+
|
|
2533
|
+
var charCodeAt = String.prototype.charCodeAt;
|
|
2534
|
+
|
|
2535
|
+
/**
|
|
2536
|
+
* Constructs new long bits from the specified 8 characters long hash.
|
|
2537
|
+
* @param {string} hash Hash
|
|
2538
|
+
* @returns {util.LongBits} Bits
|
|
2539
|
+
*/
|
|
2540
|
+
LongBits.fromHash = function fromHash(hash) {
|
|
2541
|
+
if (hash === zeroHash)
|
|
2542
|
+
return zero;
|
|
2543
|
+
return new LongBits(
|
|
2544
|
+
( charCodeAt.call(hash, 0)
|
|
2545
|
+
| charCodeAt.call(hash, 1) << 8
|
|
2546
|
+
| charCodeAt.call(hash, 2) << 16
|
|
2547
|
+
| charCodeAt.call(hash, 3) << 24) >>> 0
|
|
2548
|
+
,
|
|
2549
|
+
( charCodeAt.call(hash, 4)
|
|
2550
|
+
| charCodeAt.call(hash, 5) << 8
|
|
2551
|
+
| charCodeAt.call(hash, 6) << 16
|
|
2552
|
+
| charCodeAt.call(hash, 7) << 24) >>> 0
|
|
2553
|
+
);
|
|
2554
|
+
};
|
|
2555
|
+
|
|
2556
|
+
/**
|
|
2557
|
+
* Converts this long bits to a 8 characters long hash.
|
|
2558
|
+
* @returns {string} Hash
|
|
2559
|
+
*/
|
|
2560
|
+
LongBits.prototype.toHash = function toHash() {
|
|
2561
|
+
return String.fromCharCode(
|
|
2562
|
+
this.lo & 255,
|
|
2563
|
+
this.lo >>> 8 & 255,
|
|
2564
|
+
this.lo >>> 16 & 255,
|
|
2565
|
+
this.lo >>> 24 ,
|
|
2566
|
+
this.hi & 255,
|
|
2567
|
+
this.hi >>> 8 & 255,
|
|
2568
|
+
this.hi >>> 16 & 255,
|
|
2569
|
+
this.hi >>> 24
|
|
2570
|
+
);
|
|
2571
|
+
};
|
|
2572
|
+
|
|
2573
|
+
/**
|
|
2574
|
+
* Zig-zag encodes this long bits.
|
|
2575
|
+
* @returns {util.LongBits} `this`
|
|
2576
|
+
*/
|
|
2577
|
+
LongBits.prototype.zzEncode = function zzEncode() {
|
|
2578
|
+
var mask = this.hi >> 31;
|
|
2579
|
+
this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
|
|
2580
|
+
this.lo = ( this.lo << 1 ^ mask) >>> 0;
|
|
2581
|
+
return this;
|
|
2582
|
+
};
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Zig-zag decodes this long bits.
|
|
2586
|
+
* @returns {util.LongBits} `this`
|
|
2587
|
+
*/
|
|
2588
|
+
LongBits.prototype.zzDecode = function zzDecode() {
|
|
2589
|
+
var mask = -(this.lo & 1);
|
|
2590
|
+
this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
|
|
2591
|
+
this.hi = ( this.hi >>> 1 ^ mask) >>> 0;
|
|
2592
|
+
return this;
|
|
2593
|
+
};
|
|
2594
|
+
|
|
2595
|
+
/**
|
|
2596
|
+
* Calculates the length of this longbits when encoded as a varint.
|
|
2597
|
+
* @returns {number} Length
|
|
2598
|
+
*/
|
|
2599
|
+
LongBits.prototype.length = function length() {
|
|
2600
|
+
var part0 = this.lo,
|
|
2601
|
+
part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
|
|
2602
|
+
part2 = this.hi >>> 24;
|
|
2603
|
+
return part2 === 0
|
|
2604
|
+
? part1 === 0
|
|
2605
|
+
? part0 < 16384
|
|
2606
|
+
? part0 < 128 ? 1 : 2
|
|
2607
|
+
: part0 < 2097152 ? 3 : 4
|
|
2608
|
+
: part1 < 16384
|
|
2609
|
+
? part1 < 128 ? 5 : 6
|
|
2610
|
+
: part1 < 2097152 ? 7 : 8
|
|
2611
|
+
: part2 < 128 ? 9 : 10;
|
|
2612
|
+
};
|
|
2613
|
+
return longbits;
|
|
2787
2614
|
}
|
|
2788
2615
|
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2616
|
+
var hasRequiredMinimal;
|
|
2617
|
+
|
|
2618
|
+
function requireMinimal () {
|
|
2619
|
+
if (hasRequiredMinimal) return minimal$1;
|
|
2620
|
+
hasRequiredMinimal = 1;
|
|
2621
|
+
(function (exports) {
|
|
2622
|
+
var util = exports;
|
|
2623
|
+
|
|
2624
|
+
// used to return a Promise where callback is omitted
|
|
2625
|
+
util.asPromise = requireAspromise();
|
|
2626
|
+
|
|
2627
|
+
// converts to / from base64 encoded strings
|
|
2628
|
+
util.base64 = requireBase64();
|
|
2629
|
+
|
|
2630
|
+
// base class of rpc.Service
|
|
2631
|
+
util.EventEmitter = requireEventemitter();
|
|
2632
|
+
|
|
2633
|
+
// float handling accross browsers
|
|
2634
|
+
util.float = requireFloat();
|
|
2635
|
+
|
|
2636
|
+
// requires modules optionally and hides the call from bundlers
|
|
2637
|
+
util.inquire = requireInquire();
|
|
2638
|
+
|
|
2639
|
+
// converts to / from utf8 encoded strings
|
|
2640
|
+
util.utf8 = requireUtf8();
|
|
2641
|
+
|
|
2642
|
+
// provides a node-like buffer pool in the browser
|
|
2643
|
+
util.pool = requirePool();
|
|
2644
|
+
|
|
2645
|
+
// utility to work with the low and high bits of a 64 bit value
|
|
2646
|
+
util.LongBits = requireLongbits();
|
|
2647
|
+
|
|
2648
|
+
/**
|
|
2649
|
+
* Whether running within node or not.
|
|
2650
|
+
* @memberof util
|
|
2651
|
+
* @type {boolean}
|
|
2652
|
+
*/
|
|
2653
|
+
util.isNode = Boolean(typeof commonjsGlobal !== "undefined"
|
|
2654
|
+
&& commonjsGlobal
|
|
2655
|
+
&& commonjsGlobal.process
|
|
2656
|
+
&& commonjsGlobal.process.versions
|
|
2657
|
+
&& commonjsGlobal.process.versions.node);
|
|
2658
|
+
|
|
2659
|
+
/**
|
|
2660
|
+
* Global object reference.
|
|
2661
|
+
* @memberof util
|
|
2662
|
+
* @type {Object}
|
|
2663
|
+
*/
|
|
2664
|
+
util.global = util.isNode && commonjsGlobal
|
|
2665
|
+
|| typeof window !== "undefined" && window
|
|
2666
|
+
|| typeof self !== "undefined" && self
|
|
2667
|
+
|| commonjsGlobal; // eslint-disable-line no-invalid-this
|
|
2668
|
+
|
|
2669
|
+
/**
|
|
2670
|
+
* An immuable empty array.
|
|
2671
|
+
* @memberof util
|
|
2672
|
+
* @type {Array.<*>}
|
|
2673
|
+
* @const
|
|
2674
|
+
*/
|
|
2675
|
+
util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes
|
|
2676
|
+
|
|
2677
|
+
/**
|
|
2678
|
+
* An immutable empty object.
|
|
2679
|
+
* @type {Object}
|
|
2680
|
+
* @const
|
|
2681
|
+
*/
|
|
2682
|
+
util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes
|
|
2683
|
+
|
|
2684
|
+
/**
|
|
2685
|
+
* Tests if the specified value is an integer.
|
|
2686
|
+
* @function
|
|
2687
|
+
* @param {*} value Value to test
|
|
2688
|
+
* @returns {boolean} `true` if the value is an integer
|
|
2689
|
+
*/
|
|
2690
|
+
util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {
|
|
2691
|
+
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
|
2692
|
+
};
|
|
2693
|
+
|
|
2694
|
+
/**
|
|
2695
|
+
* Tests if the specified value is a string.
|
|
2696
|
+
* @param {*} value Value to test
|
|
2697
|
+
* @returns {boolean} `true` if the value is a string
|
|
2698
|
+
*/
|
|
2699
|
+
util.isString = function isString(value) {
|
|
2700
|
+
return typeof value === "string" || value instanceof String;
|
|
2701
|
+
};
|
|
2702
|
+
|
|
2703
|
+
/**
|
|
2704
|
+
* Tests if the specified value is a non-null object.
|
|
2705
|
+
* @param {*} value Value to test
|
|
2706
|
+
* @returns {boolean} `true` if the value is a non-null object
|
|
2707
|
+
*/
|
|
2708
|
+
util.isObject = function isObject(value) {
|
|
2709
|
+
return value && typeof value === "object";
|
|
2710
|
+
};
|
|
2711
|
+
|
|
2712
|
+
/**
|
|
2713
|
+
* Checks if a property on a message is considered to be present.
|
|
2714
|
+
* This is an alias of {@link util.isSet}.
|
|
2715
|
+
* @function
|
|
2716
|
+
* @param {Object} obj Plain object or message instance
|
|
2717
|
+
* @param {string} prop Property name
|
|
2718
|
+
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
|
2719
|
+
*/
|
|
2720
|
+
util.isset =
|
|
2721
|
+
|
|
2722
|
+
/**
|
|
2723
|
+
* Checks if a property on a message is considered to be present.
|
|
2724
|
+
* @param {Object} obj Plain object or message instance
|
|
2725
|
+
* @param {string} prop Property name
|
|
2726
|
+
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
|
2727
|
+
*/
|
|
2728
|
+
util.isSet = function isSet(obj, prop) {
|
|
2729
|
+
var value = obj[prop];
|
|
2730
|
+
if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
|
|
2731
|
+
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
|
2732
|
+
return false;
|
|
2733
|
+
};
|
|
2734
|
+
|
|
2735
|
+
/**
|
|
2736
|
+
* Any compatible Buffer instance.
|
|
2737
|
+
* This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
|
|
2738
|
+
* @interface Buffer
|
|
2739
|
+
* @extends Uint8Array
|
|
2740
|
+
*/
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Node's Buffer class if available.
|
|
2744
|
+
* @type {Constructor<Buffer>}
|
|
2745
|
+
*/
|
|
2746
|
+
util.Buffer = (function() {
|
|
2747
|
+
try {
|
|
2748
|
+
var Buffer = util.inquire("buffer").Buffer;
|
|
2749
|
+
// refuse to use non-node buffers if not explicitly assigned (perf reasons):
|
|
2750
|
+
return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;
|
|
2751
|
+
} catch (e) {
|
|
2752
|
+
/* istanbul ignore next */
|
|
2753
|
+
return null;
|
|
2754
|
+
}
|
|
2755
|
+
})();
|
|
2756
|
+
|
|
2757
|
+
// Internal alias of or polyfull for Buffer.from.
|
|
2758
|
+
util._Buffer_from = null;
|
|
2759
|
+
|
|
2760
|
+
// Internal alias of or polyfill for Buffer.allocUnsafe.
|
|
2761
|
+
util._Buffer_allocUnsafe = null;
|
|
2762
|
+
|
|
2763
|
+
/**
|
|
2764
|
+
* Creates a new buffer of whatever type supported by the environment.
|
|
2765
|
+
* @param {number|number[]} [sizeOrArray=0] Buffer size or number array
|
|
2766
|
+
* @returns {Uint8Array|Buffer} Buffer
|
|
2767
|
+
*/
|
|
2768
|
+
util.newBuffer = function newBuffer(sizeOrArray) {
|
|
2769
|
+
/* istanbul ignore next */
|
|
2770
|
+
return typeof sizeOrArray === "number"
|
|
2771
|
+
? util.Buffer
|
|
2772
|
+
? util._Buffer_allocUnsafe(sizeOrArray)
|
|
2773
|
+
: new util.Array(sizeOrArray)
|
|
2774
|
+
: util.Buffer
|
|
2775
|
+
? util._Buffer_from(sizeOrArray)
|
|
2776
|
+
: typeof Uint8Array === "undefined"
|
|
2777
|
+
? sizeOrArray
|
|
2778
|
+
: new Uint8Array(sizeOrArray);
|
|
2779
|
+
};
|
|
2780
|
+
|
|
2781
|
+
/**
|
|
2782
|
+
* Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.
|
|
2783
|
+
* @type {Constructor<Uint8Array>}
|
|
2784
|
+
*/
|
|
2785
|
+
util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array;
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* Any compatible Long instance.
|
|
2789
|
+
* This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.
|
|
2790
|
+
* @interface Long
|
|
2791
|
+
* @property {number} low Low bits
|
|
2792
|
+
* @property {number} high High bits
|
|
2793
|
+
* @property {boolean} unsigned Whether unsigned or not
|
|
2794
|
+
*/
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* Long.js's Long class if available.
|
|
2798
|
+
* @type {Constructor<Long>}
|
|
2799
|
+
*/
|
|
2800
|
+
util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long
|
|
2801
|
+
|| /* istanbul ignore next */ util.global.Long
|
|
2802
|
+
|| util.inquire("long");
|
|
2803
|
+
|
|
2804
|
+
/**
|
|
2805
|
+
* Regular expression used to verify 2 bit (`bool`) map keys.
|
|
2806
|
+
* @type {RegExp}
|
|
2807
|
+
* @const
|
|
2808
|
+
*/
|
|
2809
|
+
util.key2Re = /^true|false|0|1$/;
|
|
2810
|
+
|
|
2811
|
+
/**
|
|
2812
|
+
* Regular expression used to verify 32 bit (`int32` etc.) map keys.
|
|
2813
|
+
* @type {RegExp}
|
|
2814
|
+
* @const
|
|
2815
|
+
*/
|
|
2816
|
+
util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
|
|
2817
|
+
|
|
2818
|
+
/**
|
|
2819
|
+
* Regular expression used to verify 64 bit (`int64` etc.) map keys.
|
|
2820
|
+
* @type {RegExp}
|
|
2821
|
+
* @const
|
|
2822
|
+
*/
|
|
2823
|
+
util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
|
|
2824
|
+
|
|
2825
|
+
/**
|
|
2826
|
+
* Converts a number or long to an 8 characters long hash string.
|
|
2827
|
+
* @param {Long|number} value Value to convert
|
|
2828
|
+
* @returns {string} Hash
|
|
2829
|
+
*/
|
|
2830
|
+
util.longToHash = function longToHash(value) {
|
|
2831
|
+
return value
|
|
2832
|
+
? util.LongBits.from(value).toHash()
|
|
2833
|
+
: util.LongBits.zeroHash;
|
|
2834
|
+
};
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
* Converts an 8 characters long hash string to a long or number.
|
|
2838
|
+
* @param {string} hash Hash
|
|
2839
|
+
* @param {boolean} [unsigned=false] Whether unsigned or not
|
|
2840
|
+
* @returns {Long|number} Original value
|
|
2841
|
+
*/
|
|
2842
|
+
util.longFromHash = function longFromHash(hash, unsigned) {
|
|
2843
|
+
var bits = util.LongBits.fromHash(hash);
|
|
2844
|
+
if (util.Long)
|
|
2845
|
+
return util.Long.fromBits(bits.lo, bits.hi, unsigned);
|
|
2846
|
+
return bits.toNumber(Boolean(unsigned));
|
|
2847
|
+
};
|
|
2848
|
+
|
|
2849
|
+
/**
|
|
2850
|
+
* Merges the properties of the source object into the destination object.
|
|
2851
|
+
* @memberof util
|
|
2852
|
+
* @param {Object.<string,*>} dst Destination object
|
|
2853
|
+
* @param {Object.<string,*>} src Source object
|
|
2854
|
+
* @param {boolean} [ifNotSet=false] Merges only if the key is not already set
|
|
2855
|
+
* @returns {Object.<string,*>} Destination object
|
|
2856
|
+
*/
|
|
2857
|
+
function merge(dst, src, ifNotSet) { // used by converters
|
|
2858
|
+
for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
|
|
2859
|
+
if (dst[keys[i]] === undefined || !ifNotSet)
|
|
2860
|
+
dst[keys[i]] = src[keys[i]];
|
|
2861
|
+
return dst;
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
util.merge = merge;
|
|
2865
|
+
|
|
2866
|
+
/**
|
|
2867
|
+
* Converts the first character of a string to lower case.
|
|
2868
|
+
* @param {string} str String to convert
|
|
2869
|
+
* @returns {string} Converted string
|
|
2870
|
+
*/
|
|
2871
|
+
util.lcFirst = function lcFirst(str) {
|
|
2872
|
+
return str.charAt(0).toLowerCase() + str.substring(1);
|
|
2873
|
+
};
|
|
2874
|
+
|
|
2875
|
+
/**
|
|
2876
|
+
* Creates a custom error constructor.
|
|
2877
|
+
* @memberof util
|
|
2878
|
+
* @param {string} name Error name
|
|
2879
|
+
* @returns {Constructor<Error>} Custom error constructor
|
|
2880
|
+
*/
|
|
2881
|
+
function newError(name) {
|
|
2882
|
+
|
|
2883
|
+
function CustomError(message, properties) {
|
|
2884
|
+
|
|
2885
|
+
if (!(this instanceof CustomError))
|
|
2886
|
+
return new CustomError(message, properties);
|
|
2887
|
+
|
|
2888
|
+
// Error.call(this, message);
|
|
2889
|
+
// ^ just returns a new error instance because the ctor can be called as a function
|
|
2890
|
+
|
|
2891
|
+
Object.defineProperty(this, "message", { get: function() { return message; } });
|
|
2892
|
+
|
|
2893
|
+
/* istanbul ignore next */
|
|
2894
|
+
if (Error.captureStackTrace) // node
|
|
2895
|
+
Error.captureStackTrace(this, CustomError);
|
|
2896
|
+
else
|
|
2897
|
+
Object.defineProperty(this, "stack", { value: new Error().stack || "" });
|
|
2898
|
+
|
|
2899
|
+
if (properties)
|
|
2900
|
+
merge(this, properties);
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
CustomError.prototype = Object.create(Error.prototype, {
|
|
2904
|
+
constructor: {
|
|
2905
|
+
value: CustomError,
|
|
2906
|
+
writable: true,
|
|
2907
|
+
enumerable: false,
|
|
2908
|
+
configurable: true,
|
|
2909
|
+
},
|
|
2910
|
+
name: {
|
|
2911
|
+
get: function get() { return name; },
|
|
2912
|
+
set: undefined,
|
|
2913
|
+
enumerable: false,
|
|
2914
|
+
// configurable: false would accurately preserve the behavior of
|
|
2915
|
+
// the original, but I'm guessing that was not intentional.
|
|
2916
|
+
// For an actual error subclass, this property would
|
|
2917
|
+
// be configurable.
|
|
2918
|
+
configurable: true,
|
|
2919
|
+
},
|
|
2920
|
+
toString: {
|
|
2921
|
+
value: function value() { return this.name + ": " + this.message; },
|
|
2922
|
+
writable: true,
|
|
2923
|
+
enumerable: false,
|
|
2924
|
+
configurable: true,
|
|
2925
|
+
},
|
|
2926
|
+
});
|
|
2927
|
+
|
|
2928
|
+
return CustomError;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
util.newError = newError;
|
|
2932
|
+
|
|
2933
|
+
/**
|
|
2934
|
+
* Constructs a new protocol error.
|
|
2935
|
+
* @classdesc Error subclass indicating a protocol specifc error.
|
|
2936
|
+
* @memberof util
|
|
2937
|
+
* @extends Error
|
|
2938
|
+
* @template T extends Message<T>
|
|
2939
|
+
* @constructor
|
|
2940
|
+
* @param {string} message Error message
|
|
2941
|
+
* @param {Object.<string,*>} [properties] Additional properties
|
|
2942
|
+
* @example
|
|
2943
|
+
* try {
|
|
2944
|
+
* MyMessage.decode(someBuffer); // throws if required fields are missing
|
|
2945
|
+
* } catch (e) {
|
|
2946
|
+
* if (e instanceof ProtocolError && e.instance)
|
|
2947
|
+
* console.log("decoded so far: " + JSON.stringify(e.instance));
|
|
2948
|
+
* }
|
|
2949
|
+
*/
|
|
2950
|
+
util.ProtocolError = newError("ProtocolError");
|
|
2951
|
+
|
|
2952
|
+
/**
|
|
2953
|
+
* So far decoded message instance.
|
|
2954
|
+
* @name util.ProtocolError#instance
|
|
2955
|
+
* @type {Message<T>}
|
|
2956
|
+
*/
|
|
2957
|
+
|
|
2958
|
+
/**
|
|
2959
|
+
* A OneOf getter as returned by {@link util.oneOfGetter}.
|
|
2960
|
+
* @typedef OneOfGetter
|
|
2961
|
+
* @type {function}
|
|
2962
|
+
* @returns {string|undefined} Set field name, if any
|
|
2963
|
+
*/
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* Builds a getter for a oneof's present field name.
|
|
2967
|
+
* @param {string[]} fieldNames Field names
|
|
2968
|
+
* @returns {OneOfGetter} Unbound getter
|
|
2969
|
+
*/
|
|
2970
|
+
util.oneOfGetter = function getOneOf(fieldNames) {
|
|
2971
|
+
var fieldMap = {};
|
|
2972
|
+
for (var i = 0; i < fieldNames.length; ++i)
|
|
2973
|
+
fieldMap[fieldNames[i]] = 1;
|
|
2974
|
+
|
|
2975
|
+
/**
|
|
2976
|
+
* @returns {string|undefined} Set field name, if any
|
|
2977
|
+
* @this Object
|
|
2978
|
+
* @ignore
|
|
2979
|
+
*/
|
|
2980
|
+
return function() { // eslint-disable-line consistent-return
|
|
2981
|
+
for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)
|
|
2982
|
+
if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)
|
|
2983
|
+
return keys[i];
|
|
2984
|
+
};
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
/**
|
|
2988
|
+
* A OneOf setter as returned by {@link util.oneOfSetter}.
|
|
2989
|
+
* @typedef OneOfSetter
|
|
2990
|
+
* @type {function}
|
|
2991
|
+
* @param {string|undefined} value Field name
|
|
2992
|
+
* @returns {undefined}
|
|
2993
|
+
*/
|
|
2994
|
+
|
|
2995
|
+
/**
|
|
2996
|
+
* Builds a setter for a oneof's present field name.
|
|
2997
|
+
* @param {string[]} fieldNames Field names
|
|
2998
|
+
* @returns {OneOfSetter} Unbound setter
|
|
2999
|
+
*/
|
|
3000
|
+
util.oneOfSetter = function setOneOf(fieldNames) {
|
|
3001
|
+
|
|
3002
|
+
/**
|
|
3003
|
+
* @param {string} name Field name
|
|
3004
|
+
* @returns {undefined}
|
|
3005
|
+
* @this Object
|
|
3006
|
+
* @ignore
|
|
3007
|
+
*/
|
|
3008
|
+
return function(name) {
|
|
3009
|
+
for (var i = 0; i < fieldNames.length; ++i)
|
|
3010
|
+
if (fieldNames[i] !== name)
|
|
3011
|
+
delete this[fieldNames[i]];
|
|
3012
|
+
};
|
|
3013
|
+
};
|
|
3014
|
+
|
|
3015
|
+
/**
|
|
3016
|
+
* Default conversion options used for {@link Message#toJSON} implementations.
|
|
3017
|
+
*
|
|
3018
|
+
* These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
|
|
3019
|
+
*
|
|
3020
|
+
* - Longs become strings
|
|
3021
|
+
* - Enums become string keys
|
|
3022
|
+
* - Bytes become base64 encoded strings
|
|
3023
|
+
* - (Sub-)Messages become plain objects
|
|
3024
|
+
* - Maps become plain objects with all string keys
|
|
3025
|
+
* - Repeated fields become arrays
|
|
3026
|
+
* - NaN and Infinity for float and double fields become strings
|
|
3027
|
+
*
|
|
3028
|
+
* @type {IConversionOptions}
|
|
3029
|
+
* @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
|
|
3030
|
+
*/
|
|
3031
|
+
util.toJSONOptions = {
|
|
3032
|
+
longs: String,
|
|
3033
|
+
enums: String,
|
|
3034
|
+
bytes: String,
|
|
3035
|
+
json: true
|
|
3036
|
+
};
|
|
3037
|
+
|
|
3038
|
+
// Sets up buffer utility according to the environment (called in index-minimal)
|
|
3039
|
+
util._configure = function() {
|
|
3040
|
+
var Buffer = util.Buffer;
|
|
3041
|
+
/* istanbul ignore if */
|
|
3042
|
+
if (!Buffer) {
|
|
3043
|
+
util._Buffer_from = util._Buffer_allocUnsafe = null;
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
// because node 4.x buffers are incompatible & immutable
|
|
3047
|
+
// see: https://github.com/dcodeIO/protobuf.js/pull/665
|
|
3048
|
+
util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
|
|
3049
|
+
/* istanbul ignore next */
|
|
3050
|
+
function Buffer_from(value, encoding) {
|
|
3051
|
+
return new Buffer(value, encoding);
|
|
3052
|
+
};
|
|
3053
|
+
util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
|
|
3054
|
+
/* istanbul ignore next */
|
|
3055
|
+
function Buffer_allocUnsafe(size) {
|
|
3056
|
+
return new Buffer(size);
|
|
3057
|
+
};
|
|
3058
|
+
};
|
|
3059
|
+
} (minimal$1));
|
|
3060
|
+
return minimal$1;
|
|
2854
3061
|
}
|
|
2855
3062
|
|
|
2856
|
-
util.newError = newError;
|
|
2857
|
-
|
|
2858
|
-
/**
|
|
2859
|
-
* Constructs a new protocol error.
|
|
2860
|
-
* @classdesc Error subclass indicating a protocol specifc error.
|
|
2861
|
-
* @memberof util
|
|
2862
|
-
* @extends Error
|
|
2863
|
-
* @template T extends Message<T>
|
|
2864
|
-
* @constructor
|
|
2865
|
-
* @param {string} message Error message
|
|
2866
|
-
* @param {Object.<string,*>} [properties] Additional properties
|
|
2867
|
-
* @example
|
|
2868
|
-
* try {
|
|
2869
|
-
* MyMessage.decode(someBuffer); // throws if required fields are missing
|
|
2870
|
-
* } catch (e) {
|
|
2871
|
-
* if (e instanceof ProtocolError && e.instance)
|
|
2872
|
-
* console.log("decoded so far: " + JSON.stringify(e.instance));
|
|
2873
|
-
* }
|
|
2874
|
-
*/
|
|
2875
|
-
util.ProtocolError = newError("ProtocolError");
|
|
2876
|
-
|
|
2877
|
-
/**
|
|
2878
|
-
* So far decoded message instance.
|
|
2879
|
-
* @name util.ProtocolError#instance
|
|
2880
|
-
* @type {Message<T>}
|
|
2881
|
-
*/
|
|
2882
|
-
|
|
2883
|
-
/**
|
|
2884
|
-
* A OneOf getter as returned by {@link util.oneOfGetter}.
|
|
2885
|
-
* @typedef OneOfGetter
|
|
2886
|
-
* @type {function}
|
|
2887
|
-
* @returns {string|undefined} Set field name, if any
|
|
2888
|
-
*/
|
|
2889
|
-
|
|
2890
|
-
/**
|
|
2891
|
-
* Builds a getter for a oneof's present field name.
|
|
2892
|
-
* @param {string[]} fieldNames Field names
|
|
2893
|
-
* @returns {OneOfGetter} Unbound getter
|
|
2894
|
-
*/
|
|
2895
|
-
util.oneOfGetter = function getOneOf(fieldNames) {
|
|
2896
|
-
var fieldMap = {};
|
|
2897
|
-
for (var i = 0; i < fieldNames.length; ++i)
|
|
2898
|
-
fieldMap[fieldNames[i]] = 1;
|
|
2899
|
-
|
|
2900
|
-
/**
|
|
2901
|
-
* @returns {string|undefined} Set field name, if any
|
|
2902
|
-
* @this Object
|
|
2903
|
-
* @ignore
|
|
2904
|
-
*/
|
|
2905
|
-
return function() { // eslint-disable-line consistent-return
|
|
2906
|
-
for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)
|
|
2907
|
-
if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)
|
|
2908
|
-
return keys[i];
|
|
2909
|
-
};
|
|
2910
|
-
};
|
|
2911
|
-
|
|
2912
|
-
/**
|
|
2913
|
-
* A OneOf setter as returned by {@link util.oneOfSetter}.
|
|
2914
|
-
* @typedef OneOfSetter
|
|
2915
|
-
* @type {function}
|
|
2916
|
-
* @param {string|undefined} value Field name
|
|
2917
|
-
* @returns {undefined}
|
|
2918
|
-
*/
|
|
2919
|
-
|
|
2920
|
-
/**
|
|
2921
|
-
* Builds a setter for a oneof's present field name.
|
|
2922
|
-
* @param {string[]} fieldNames Field names
|
|
2923
|
-
* @returns {OneOfSetter} Unbound setter
|
|
2924
|
-
*/
|
|
2925
|
-
util.oneOfSetter = function setOneOf(fieldNames) {
|
|
2926
|
-
|
|
2927
|
-
/**
|
|
2928
|
-
* @param {string} name Field name
|
|
2929
|
-
* @returns {undefined}
|
|
2930
|
-
* @this Object
|
|
2931
|
-
* @ignore
|
|
2932
|
-
*/
|
|
2933
|
-
return function(name) {
|
|
2934
|
-
for (var i = 0; i < fieldNames.length; ++i)
|
|
2935
|
-
if (fieldNames[i] !== name)
|
|
2936
|
-
delete this[fieldNames[i]];
|
|
2937
|
-
};
|
|
2938
|
-
};
|
|
2939
|
-
|
|
2940
|
-
/**
|
|
2941
|
-
* Default conversion options used for {@link Message#toJSON} implementations.
|
|
2942
|
-
*
|
|
2943
|
-
* These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
|
|
2944
|
-
*
|
|
2945
|
-
* - Longs become strings
|
|
2946
|
-
* - Enums become string keys
|
|
2947
|
-
* - Bytes become base64 encoded strings
|
|
2948
|
-
* - (Sub-)Messages become plain objects
|
|
2949
|
-
* - Maps become plain objects with all string keys
|
|
2950
|
-
* - Repeated fields become arrays
|
|
2951
|
-
* - NaN and Infinity for float and double fields become strings
|
|
2952
|
-
*
|
|
2953
|
-
* @type {IConversionOptions}
|
|
2954
|
-
* @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
|
|
2955
|
-
*/
|
|
2956
|
-
util.toJSONOptions = {
|
|
2957
|
-
longs: String,
|
|
2958
|
-
enums: String,
|
|
2959
|
-
bytes: String,
|
|
2960
|
-
json: true
|
|
2961
|
-
};
|
|
2962
|
-
|
|
2963
|
-
// Sets up buffer utility according to the environment (called in index-minimal)
|
|
2964
|
-
util._configure = function() {
|
|
2965
|
-
var Buffer = util.Buffer;
|
|
2966
|
-
/* istanbul ignore if */
|
|
2967
|
-
if (!Buffer) {
|
|
2968
|
-
util._Buffer_from = util._Buffer_allocUnsafe = null;
|
|
2969
|
-
return;
|
|
2970
|
-
}
|
|
2971
|
-
// because node 4.x buffers are incompatible & immutable
|
|
2972
|
-
// see: https://github.com/dcodeIO/protobuf.js/pull/665
|
|
2973
|
-
util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
|
|
2974
|
-
/* istanbul ignore next */
|
|
2975
|
-
function Buffer_from(value, encoding) {
|
|
2976
|
-
return new Buffer(value, encoding);
|
|
2977
|
-
};
|
|
2978
|
-
util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
|
|
2979
|
-
/* istanbul ignore next */
|
|
2980
|
-
function Buffer_allocUnsafe(size) {
|
|
2981
|
-
return new Buffer(size);
|
|
2982
|
-
};
|
|
2983
|
-
};
|
|
2984
|
-
}(minimal$1));
|
|
2985
|
-
|
|
2986
3063
|
var writer = Writer$1;
|
|
2987
3064
|
|
|
2988
|
-
var util$4 =
|
|
3065
|
+
var util$4 = requireMinimal();
|
|
2989
3066
|
|
|
2990
3067
|
var BufferWriter$1; // cyclic
|
|
2991
3068
|
|
|
@@ -3454,7 +3531,7 @@ var writer_buffer = BufferWriter;
|
|
|
3454
3531
|
var Writer = writer;
|
|
3455
3532
|
(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
|
|
3456
3533
|
|
|
3457
|
-
var util$3 =
|
|
3534
|
+
var util$3 = requireMinimal();
|
|
3458
3535
|
|
|
3459
3536
|
/**
|
|
3460
3537
|
* Constructs a new buffer writer instance.
|
|
@@ -3535,7 +3612,7 @@ BufferWriter._configure();
|
|
|
3535
3612
|
|
|
3536
3613
|
var reader = Reader$1;
|
|
3537
3614
|
|
|
3538
|
-
var util$2 =
|
|
3615
|
+
var util$2 = requireMinimal();
|
|
3539
3616
|
|
|
3540
3617
|
var BufferReader$1; // cyclic
|
|
3541
3618
|
|
|
@@ -3955,7 +4032,7 @@ var reader_buffer = BufferReader;
|
|
|
3955
4032
|
var Reader = reader;
|
|
3956
4033
|
(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
|
|
3957
4034
|
|
|
3958
|
-
var util$1 =
|
|
4035
|
+
var util$1 = requireMinimal();
|
|
3959
4036
|
|
|
3960
4037
|
/**
|
|
3961
4038
|
* Constructs a new buffer reader instance.
|
|
@@ -4004,7 +4081,7 @@ var rpc = {};
|
|
|
4004
4081
|
|
|
4005
4082
|
var service = Service;
|
|
4006
4083
|
|
|
4007
|
-
var util =
|
|
4084
|
+
var util = requireMinimal();
|
|
4008
4085
|
|
|
4009
4086
|
// Extends EventEmitter
|
|
4010
4087
|
(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
|
|
@@ -4146,84 +4223,86 @@ Service.prototype.end = function end(endedByRPC) {
|
|
|
4146
4223
|
|
|
4147
4224
|
(function (exports) {
|
|
4148
4225
|
|
|
4149
|
-
/**
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
var rpc = exports;
|
|
4154
|
-
|
|
4155
|
-
/**
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
/**
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
rpc.Service = service;
|
|
4183
|
-
}(rpc));
|
|
4226
|
+
/**
|
|
4227
|
+
* Streaming RPC helpers.
|
|
4228
|
+
* @namespace
|
|
4229
|
+
*/
|
|
4230
|
+
var rpc = exports;
|
|
4231
|
+
|
|
4232
|
+
/**
|
|
4233
|
+
* RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.
|
|
4234
|
+
* @typedef RPCImpl
|
|
4235
|
+
* @type {function}
|
|
4236
|
+
* @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called
|
|
4237
|
+
* @param {Uint8Array} requestData Request data
|
|
4238
|
+
* @param {RPCImplCallback} callback Callback function
|
|
4239
|
+
* @returns {undefined}
|
|
4240
|
+
* @example
|
|
4241
|
+
* function rpcImpl(method, requestData, callback) {
|
|
4242
|
+
* if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code
|
|
4243
|
+
* throw Error("no such method");
|
|
4244
|
+
* asynchronouslyObtainAResponse(requestData, function(err, responseData) {
|
|
4245
|
+
* callback(err, responseData);
|
|
4246
|
+
* });
|
|
4247
|
+
* }
|
|
4248
|
+
*/
|
|
4249
|
+
|
|
4250
|
+
/**
|
|
4251
|
+
* Node-style callback as used by {@link RPCImpl}.
|
|
4252
|
+
* @typedef RPCImplCallback
|
|
4253
|
+
* @type {function}
|
|
4254
|
+
* @param {Error|null} error Error, if any, otherwise `null`
|
|
4255
|
+
* @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error
|
|
4256
|
+
* @returns {undefined}
|
|
4257
|
+
*/
|
|
4258
|
+
|
|
4259
|
+
rpc.Service = service;
|
|
4260
|
+
} (rpc));
|
|
4184
4261
|
|
|
4185
4262
|
var roots = {};
|
|
4186
4263
|
|
|
4187
4264
|
(function (exports) {
|
|
4188
|
-
var protobuf = exports;
|
|
4189
|
-
|
|
4190
|
-
/**
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
protobuf.build = "minimal";
|
|
4197
|
-
|
|
4198
|
-
// Serialization
|
|
4199
|
-
protobuf.Writer = writer;
|
|
4200
|
-
protobuf.BufferWriter = writer_buffer;
|
|
4201
|
-
protobuf.Reader = reader;
|
|
4202
|
-
protobuf.BufferReader = reader_buffer;
|
|
4203
|
-
|
|
4204
|
-
// Utility
|
|
4205
|
-
protobuf.util =
|
|
4206
|
-
protobuf.rpc = rpc;
|
|
4207
|
-
protobuf.roots = roots;
|
|
4208
|
-
protobuf.configure = configure;
|
|
4209
|
-
|
|
4210
|
-
/* istanbul ignore next */
|
|
4211
|
-
/**
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
function configure() {
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
}
|
|
4220
|
-
|
|
4221
|
-
// Set up buffer utility according to the environment
|
|
4222
|
-
configure();
|
|
4223
|
-
}(indexMinimal));
|
|
4265
|
+
var protobuf = exports;
|
|
4266
|
+
|
|
4267
|
+
/**
|
|
4268
|
+
* Build type, one of `"full"`, `"light"` or `"minimal"`.
|
|
4269
|
+
* @name build
|
|
4270
|
+
* @type {string}
|
|
4271
|
+
* @const
|
|
4272
|
+
*/
|
|
4273
|
+
protobuf.build = "minimal";
|
|
4274
|
+
|
|
4275
|
+
// Serialization
|
|
4276
|
+
protobuf.Writer = writer;
|
|
4277
|
+
protobuf.BufferWriter = writer_buffer;
|
|
4278
|
+
protobuf.Reader = reader;
|
|
4279
|
+
protobuf.BufferReader = reader_buffer;
|
|
4280
|
+
|
|
4281
|
+
// Utility
|
|
4282
|
+
protobuf.util = requireMinimal();
|
|
4283
|
+
protobuf.rpc = rpc;
|
|
4284
|
+
protobuf.roots = roots;
|
|
4285
|
+
protobuf.configure = configure;
|
|
4286
|
+
|
|
4287
|
+
/* istanbul ignore next */
|
|
4288
|
+
/**
|
|
4289
|
+
* Reconfigures the library according to the environment.
|
|
4290
|
+
* @returns {undefined}
|
|
4291
|
+
*/
|
|
4292
|
+
function configure() {
|
|
4293
|
+
protobuf.util._configure();
|
|
4294
|
+
protobuf.Writer._configure(protobuf.BufferWriter);
|
|
4295
|
+
protobuf.Reader._configure(protobuf.BufferReader);
|
|
4296
|
+
}
|
|
4297
|
+
|
|
4298
|
+
// Set up buffer utility according to the environment
|
|
4299
|
+
configure();
|
|
4300
|
+
} (indexMinimal));
|
|
4224
4301
|
|
|
4225
4302
|
var minimal = indexMinimal;
|
|
4226
4303
|
|
|
4304
|
+
var _m0 = /*@__PURE__*/getDefaultExportFromCjs(minimal);
|
|
4305
|
+
|
|
4227
4306
|
/* eslint-disable */
|
|
4228
4307
|
/**
|
|
4229
4308
|
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
@@ -4261,7 +4340,7 @@ function createBaseStruct() {
|
|
|
4261
4340
|
return { fields: {} };
|
|
4262
4341
|
}
|
|
4263
4342
|
const Struct = {
|
|
4264
|
-
encode(message, writer =
|
|
4343
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4265
4344
|
Object.entries(message.fields).forEach(([key, value]) => {
|
|
4266
4345
|
if (value !== undefined) {
|
|
4267
4346
|
Struct_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
|
|
@@ -4270,7 +4349,7 @@ const Struct = {
|
|
|
4270
4349
|
return writer;
|
|
4271
4350
|
},
|
|
4272
4351
|
decode(input, length) {
|
|
4273
|
-
const reader = input instanceof
|
|
4352
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4274
4353
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4275
4354
|
const message = createBaseStruct();
|
|
4276
4355
|
while (reader.pos < end) {
|
|
@@ -4317,12 +4396,12 @@ const Struct = {
|
|
|
4317
4396
|
return obj;
|
|
4318
4397
|
},
|
|
4319
4398
|
create(base) {
|
|
4320
|
-
return Struct.fromPartial(base !== null && base !==
|
|
4399
|
+
return Struct.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4321
4400
|
},
|
|
4322
4401
|
fromPartial(object) {
|
|
4323
4402
|
var _a;
|
|
4324
4403
|
const message = createBaseStruct();
|
|
4325
|
-
message.fields = Object.entries((_a = object.fields) !== null && _a !==
|
|
4404
|
+
message.fields = Object.entries((_a = object.fields) !== null && _a !== undefined ? _a : {}).reduce((acc, [key, value]) => {
|
|
4326
4405
|
if (value !== undefined) {
|
|
4327
4406
|
acc[key] = value;
|
|
4328
4407
|
}
|
|
@@ -4353,7 +4432,7 @@ function createBaseStruct_FieldsEntry() {
|
|
|
4353
4432
|
return { key: "", value: undefined };
|
|
4354
4433
|
}
|
|
4355
4434
|
const Struct_FieldsEntry = {
|
|
4356
|
-
encode(message, writer =
|
|
4435
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4357
4436
|
if (message.key !== "") {
|
|
4358
4437
|
writer.uint32(10).string(message.key);
|
|
4359
4438
|
}
|
|
@@ -4363,7 +4442,7 @@ const Struct_FieldsEntry = {
|
|
|
4363
4442
|
return writer;
|
|
4364
4443
|
},
|
|
4365
4444
|
decode(input, length) {
|
|
4366
|
-
const reader = input instanceof
|
|
4445
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4367
4446
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4368
4447
|
const message = createBaseStruct_FieldsEntry();
|
|
4369
4448
|
while (reader.pos < end) {
|
|
@@ -4390,7 +4469,7 @@ const Struct_FieldsEntry = {
|
|
|
4390
4469
|
return message;
|
|
4391
4470
|
},
|
|
4392
4471
|
fromJSON(object) {
|
|
4393
|
-
return { key: isSet$2(object.key) ? String(object.key) : "", value: isSet$2(object === null || object ===
|
|
4472
|
+
return { key: isSet$2(object.key) ? String(object.key) : "", value: isSet$2(object === null || object === undefined ? undefined : object.value) ? object.value : undefined };
|
|
4394
4473
|
},
|
|
4395
4474
|
toJSON(message) {
|
|
4396
4475
|
const obj = {};
|
|
@@ -4403,13 +4482,13 @@ const Struct_FieldsEntry = {
|
|
|
4403
4482
|
return obj;
|
|
4404
4483
|
},
|
|
4405
4484
|
create(base) {
|
|
4406
|
-
return Struct_FieldsEntry.fromPartial(base !== null && base !==
|
|
4485
|
+
return Struct_FieldsEntry.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4407
4486
|
},
|
|
4408
4487
|
fromPartial(object) {
|
|
4409
4488
|
var _a, _b;
|
|
4410
4489
|
const message = createBaseStruct_FieldsEntry();
|
|
4411
|
-
message.key = (_a = object.key) !== null && _a !==
|
|
4412
|
-
message.value = (_b = object.value) !== null && _b !==
|
|
4490
|
+
message.key = (_a = object.key) !== null && _a !== undefined ? _a : "";
|
|
4491
|
+
message.value = (_b = object.value) !== null && _b !== undefined ? _b : undefined;
|
|
4413
4492
|
return message;
|
|
4414
4493
|
},
|
|
4415
4494
|
};
|
|
@@ -4424,7 +4503,7 @@ function createBaseValue() {
|
|
|
4424
4503
|
};
|
|
4425
4504
|
}
|
|
4426
4505
|
const Value = {
|
|
4427
|
-
encode(message, writer =
|
|
4506
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4428
4507
|
if (message.nullValue !== undefined) {
|
|
4429
4508
|
writer.uint32(8).int32(message.nullValue);
|
|
4430
4509
|
}
|
|
@@ -4446,7 +4525,7 @@ const Value = {
|
|
|
4446
4525
|
return writer;
|
|
4447
4526
|
},
|
|
4448
4527
|
decode(input, length) {
|
|
4449
|
-
const reader = input instanceof
|
|
4528
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4450
4529
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4451
4530
|
const message = createBaseValue();
|
|
4452
4531
|
while (reader.pos < end) {
|
|
@@ -4529,17 +4608,17 @@ const Value = {
|
|
|
4529
4608
|
return obj;
|
|
4530
4609
|
},
|
|
4531
4610
|
create(base) {
|
|
4532
|
-
return Value.fromPartial(base !== null && base !==
|
|
4611
|
+
return Value.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4533
4612
|
},
|
|
4534
4613
|
fromPartial(object) {
|
|
4535
4614
|
var _a, _b, _c, _d, _e, _f;
|
|
4536
4615
|
const message = createBaseValue();
|
|
4537
|
-
message.nullValue = (_a = object.nullValue) !== null && _a !==
|
|
4538
|
-
message.numberValue = (_b = object.numberValue) !== null && _b !==
|
|
4539
|
-
message.stringValue = (_c = object.stringValue) !== null && _c !==
|
|
4540
|
-
message.boolValue = (_d = object.boolValue) !== null && _d !==
|
|
4541
|
-
message.structValue = (_e = object.structValue) !== null && _e !==
|
|
4542
|
-
message.listValue = (_f = object.listValue) !== null && _f !==
|
|
4616
|
+
message.nullValue = (_a = object.nullValue) !== null && _a !== undefined ? _a : undefined;
|
|
4617
|
+
message.numberValue = (_b = object.numberValue) !== null && _b !== undefined ? _b : undefined;
|
|
4618
|
+
message.stringValue = (_c = object.stringValue) !== null && _c !== undefined ? _c : undefined;
|
|
4619
|
+
message.boolValue = (_d = object.boolValue) !== null && _d !== undefined ? _d : undefined;
|
|
4620
|
+
message.structValue = (_e = object.structValue) !== null && _e !== undefined ? _e : undefined;
|
|
4621
|
+
message.listValue = (_f = object.listValue) !== null && _f !== undefined ? _f : undefined;
|
|
4543
4622
|
return message;
|
|
4544
4623
|
},
|
|
4545
4624
|
wrap(value) {
|
|
@@ -4571,19 +4650,19 @@ const Value = {
|
|
|
4571
4650
|
if (message.stringValue !== undefined) {
|
|
4572
4651
|
return message.stringValue;
|
|
4573
4652
|
}
|
|
4574
|
-
else if ((message === null || message ===
|
|
4653
|
+
else if ((message === null || message === undefined ? undefined : message.numberValue) !== undefined) {
|
|
4575
4654
|
return message.numberValue;
|
|
4576
4655
|
}
|
|
4577
|
-
else if ((message === null || message ===
|
|
4656
|
+
else if ((message === null || message === undefined ? undefined : message.boolValue) !== undefined) {
|
|
4578
4657
|
return message.boolValue;
|
|
4579
4658
|
}
|
|
4580
|
-
else if ((message === null || message ===
|
|
4659
|
+
else if ((message === null || message === undefined ? undefined : message.structValue) !== undefined) {
|
|
4581
4660
|
return message.structValue;
|
|
4582
4661
|
}
|
|
4583
|
-
else if ((message === null || message ===
|
|
4662
|
+
else if ((message === null || message === undefined ? undefined : message.listValue) !== undefined) {
|
|
4584
4663
|
return message.listValue;
|
|
4585
4664
|
}
|
|
4586
|
-
else if ((message === null || message ===
|
|
4665
|
+
else if ((message === null || message === undefined ? undefined : message.nullValue) !== undefined) {
|
|
4587
4666
|
return null;
|
|
4588
4667
|
}
|
|
4589
4668
|
return undefined;
|
|
@@ -4593,14 +4672,14 @@ function createBaseListValue() {
|
|
|
4593
4672
|
return { values: [] };
|
|
4594
4673
|
}
|
|
4595
4674
|
const ListValue = {
|
|
4596
|
-
encode(message, writer =
|
|
4675
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4597
4676
|
for (const v of message.values) {
|
|
4598
4677
|
Value.encode(Value.wrap(v), writer.uint32(10).fork()).ldelim();
|
|
4599
4678
|
}
|
|
4600
4679
|
return writer;
|
|
4601
4680
|
},
|
|
4602
4681
|
decode(input, length) {
|
|
4603
|
-
const reader = input instanceof
|
|
4682
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4604
4683
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4605
4684
|
const message = createBaseListValue();
|
|
4606
4685
|
while (reader.pos < end) {
|
|
@@ -4621,32 +4700,32 @@ const ListValue = {
|
|
|
4621
4700
|
return message;
|
|
4622
4701
|
},
|
|
4623
4702
|
fromJSON(object) {
|
|
4624
|
-
return { values: Array.isArray(object === null || object ===
|
|
4703
|
+
return { values: Array.isArray(object === null || object === undefined ? undefined : object.values) ? [...object.values] : [] };
|
|
4625
4704
|
},
|
|
4626
4705
|
toJSON(message) {
|
|
4627
4706
|
var _a;
|
|
4628
4707
|
const obj = {};
|
|
4629
|
-
if ((_a = message.values) === null || _a ===
|
|
4708
|
+
if ((_a = message.values) === null || _a === undefined ? undefined : _a.length) {
|
|
4630
4709
|
obj.values = message.values;
|
|
4631
4710
|
}
|
|
4632
4711
|
return obj;
|
|
4633
4712
|
},
|
|
4634
4713
|
create(base) {
|
|
4635
|
-
return ListValue.fromPartial(base !== null && base !==
|
|
4714
|
+
return ListValue.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4636
4715
|
},
|
|
4637
4716
|
fromPartial(object) {
|
|
4638
4717
|
var _a;
|
|
4639
4718
|
const message = createBaseListValue();
|
|
4640
|
-
message.values = ((_a = object.values) === null || _a ===
|
|
4719
|
+
message.values = ((_a = object.values) === null || _a === undefined ? undefined : _a.map((e) => e)) || [];
|
|
4641
4720
|
return message;
|
|
4642
4721
|
},
|
|
4643
4722
|
wrap(array) {
|
|
4644
4723
|
const result = createBaseListValue();
|
|
4645
|
-
result.values = array !== null && array !==
|
|
4724
|
+
result.values = array !== null && array !== undefined ? array : [];
|
|
4646
4725
|
return result;
|
|
4647
4726
|
},
|
|
4648
4727
|
unwrap(message) {
|
|
4649
|
-
if ((message === null || message ===
|
|
4728
|
+
if ((message === null || message === undefined ? undefined : message.hasOwnProperty("values")) && Array.isArray(message.values)) {
|
|
4650
4729
|
return message.values;
|
|
4651
4730
|
}
|
|
4652
4731
|
else {
|
|
@@ -4666,14 +4745,14 @@ function createBaseResolveAllRequest() {
|
|
|
4666
4745
|
return { context: undefined };
|
|
4667
4746
|
}
|
|
4668
4747
|
const ResolveAllRequest = {
|
|
4669
|
-
encode(message, writer =
|
|
4748
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4670
4749
|
if (message.context !== undefined) {
|
|
4671
4750
|
Struct.encode(Struct.wrap(message.context), writer.uint32(10).fork()).ldelim();
|
|
4672
4751
|
}
|
|
4673
4752
|
return writer;
|
|
4674
4753
|
},
|
|
4675
4754
|
decode(input, length) {
|
|
4676
|
-
const reader = input instanceof
|
|
4755
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4677
4756
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4678
4757
|
const message = createBaseResolveAllRequest();
|
|
4679
4758
|
while (reader.pos < end) {
|
|
@@ -4704,12 +4783,12 @@ const ResolveAllRequest = {
|
|
|
4704
4783
|
return obj;
|
|
4705
4784
|
},
|
|
4706
4785
|
create(base) {
|
|
4707
|
-
return ResolveAllRequest.fromPartial(base !== null && base !==
|
|
4786
|
+
return ResolveAllRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4708
4787
|
},
|
|
4709
4788
|
fromPartial(object) {
|
|
4710
4789
|
var _a;
|
|
4711
4790
|
const message = createBaseResolveAllRequest();
|
|
4712
|
-
message.context = (_a = object.context) !== null && _a !==
|
|
4791
|
+
message.context = (_a = object.context) !== null && _a !== undefined ? _a : undefined;
|
|
4713
4792
|
return message;
|
|
4714
4793
|
},
|
|
4715
4794
|
};
|
|
@@ -4717,14 +4796,14 @@ function createBaseResolveAllResponse() {
|
|
|
4717
4796
|
return { flags: {} };
|
|
4718
4797
|
}
|
|
4719
4798
|
const ResolveAllResponse = {
|
|
4720
|
-
encode(message, writer =
|
|
4799
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4721
4800
|
Object.entries(message.flags).forEach(([key, value]) => {
|
|
4722
4801
|
ResolveAllResponse_FlagsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
|
|
4723
4802
|
});
|
|
4724
4803
|
return writer;
|
|
4725
4804
|
},
|
|
4726
4805
|
decode(input, length) {
|
|
4727
|
-
const reader = input instanceof
|
|
4806
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4728
4807
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4729
4808
|
const message = createBaseResolveAllResponse();
|
|
4730
4809
|
while (reader.pos < end) {
|
|
@@ -4771,12 +4850,12 @@ const ResolveAllResponse = {
|
|
|
4771
4850
|
return obj;
|
|
4772
4851
|
},
|
|
4773
4852
|
create(base) {
|
|
4774
|
-
return ResolveAllResponse.fromPartial(base !== null && base !==
|
|
4853
|
+
return ResolveAllResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4775
4854
|
},
|
|
4776
4855
|
fromPartial(object) {
|
|
4777
4856
|
var _a;
|
|
4778
4857
|
const message = createBaseResolveAllResponse();
|
|
4779
|
-
message.flags = Object.entries((_a = object.flags) !== null && _a !==
|
|
4858
|
+
message.flags = Object.entries((_a = object.flags) !== null && _a !== undefined ? _a : {}).reduce((acc, [key, value]) => {
|
|
4780
4859
|
if (value !== undefined) {
|
|
4781
4860
|
acc[key] = AnyFlag.fromPartial(value);
|
|
4782
4861
|
}
|
|
@@ -4789,7 +4868,7 @@ function createBaseResolveAllResponse_FlagsEntry() {
|
|
|
4789
4868
|
return { key: "", value: undefined };
|
|
4790
4869
|
}
|
|
4791
4870
|
const ResolveAllResponse_FlagsEntry = {
|
|
4792
|
-
encode(message, writer =
|
|
4871
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4793
4872
|
if (message.key !== "") {
|
|
4794
4873
|
writer.uint32(10).string(message.key);
|
|
4795
4874
|
}
|
|
@@ -4799,7 +4878,7 @@ const ResolveAllResponse_FlagsEntry = {
|
|
|
4799
4878
|
return writer;
|
|
4800
4879
|
},
|
|
4801
4880
|
decode(input, length) {
|
|
4802
|
-
const reader = input instanceof
|
|
4881
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4803
4882
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4804
4883
|
const message = createBaseResolveAllResponse_FlagsEntry();
|
|
4805
4884
|
while (reader.pos < end) {
|
|
@@ -4842,12 +4921,12 @@ const ResolveAllResponse_FlagsEntry = {
|
|
|
4842
4921
|
return obj;
|
|
4843
4922
|
},
|
|
4844
4923
|
create(base) {
|
|
4845
|
-
return ResolveAllResponse_FlagsEntry.fromPartial(base !== null && base !==
|
|
4924
|
+
return ResolveAllResponse_FlagsEntry.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4846
4925
|
},
|
|
4847
4926
|
fromPartial(object) {
|
|
4848
4927
|
var _a;
|
|
4849
4928
|
const message = createBaseResolveAllResponse_FlagsEntry();
|
|
4850
|
-
message.key = (_a = object.key) !== null && _a !==
|
|
4929
|
+
message.key = (_a = object.key) !== null && _a !== undefined ? _a : "";
|
|
4851
4930
|
message.value = (object.value !== undefined && object.value !== null)
|
|
4852
4931
|
? AnyFlag.fromPartial(object.value)
|
|
4853
4932
|
: undefined;
|
|
@@ -4862,10 +4941,11 @@ function createBaseAnyFlag() {
|
|
|
4862
4941
|
stringValue: undefined,
|
|
4863
4942
|
doubleValue: undefined,
|
|
4864
4943
|
objectValue: undefined,
|
|
4944
|
+
metadata: undefined,
|
|
4865
4945
|
};
|
|
4866
4946
|
}
|
|
4867
4947
|
const AnyFlag = {
|
|
4868
|
-
encode(message, writer =
|
|
4948
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4869
4949
|
if (message.reason !== "") {
|
|
4870
4950
|
writer.uint32(10).string(message.reason);
|
|
4871
4951
|
}
|
|
@@ -4884,10 +4964,13 @@ const AnyFlag = {
|
|
|
4884
4964
|
if (message.objectValue !== undefined) {
|
|
4885
4965
|
Struct.encode(Struct.wrap(message.objectValue), writer.uint32(50).fork()).ldelim();
|
|
4886
4966
|
}
|
|
4967
|
+
if (message.metadata !== undefined) {
|
|
4968
|
+
Struct.encode(Struct.wrap(message.metadata), writer.uint32(58).fork()).ldelim();
|
|
4969
|
+
}
|
|
4887
4970
|
return writer;
|
|
4888
4971
|
},
|
|
4889
4972
|
decode(input, length) {
|
|
4890
|
-
const reader = input instanceof
|
|
4973
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
4891
4974
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4892
4975
|
const message = createBaseAnyFlag();
|
|
4893
4976
|
while (reader.pos < end) {
|
|
@@ -4929,6 +5012,12 @@ const AnyFlag = {
|
|
|
4929
5012
|
}
|
|
4930
5013
|
message.objectValue = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
4931
5014
|
continue;
|
|
5015
|
+
case 7:
|
|
5016
|
+
if (tag !== 58) {
|
|
5017
|
+
break;
|
|
5018
|
+
}
|
|
5019
|
+
message.metadata = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
5020
|
+
continue;
|
|
4932
5021
|
}
|
|
4933
5022
|
if ((tag & 7) === 4 || tag === 0) {
|
|
4934
5023
|
break;
|
|
@@ -4945,6 +5034,7 @@ const AnyFlag = {
|
|
|
4945
5034
|
stringValue: isSet$1(object.stringValue) ? String(object.stringValue) : undefined,
|
|
4946
5035
|
doubleValue: isSet$1(object.doubleValue) ? Number(object.doubleValue) : undefined,
|
|
4947
5036
|
objectValue: isObject$1(object.objectValue) ? object.objectValue : undefined,
|
|
5037
|
+
metadata: isObject$1(object.metadata) ? object.metadata : undefined,
|
|
4948
5038
|
};
|
|
4949
5039
|
},
|
|
4950
5040
|
toJSON(message) {
|
|
@@ -4967,20 +5057,24 @@ const AnyFlag = {
|
|
|
4967
5057
|
if (message.objectValue !== undefined) {
|
|
4968
5058
|
obj.objectValue = message.objectValue;
|
|
4969
5059
|
}
|
|
5060
|
+
if (message.metadata !== undefined) {
|
|
5061
|
+
obj.metadata = message.metadata;
|
|
5062
|
+
}
|
|
4970
5063
|
return obj;
|
|
4971
5064
|
},
|
|
4972
5065
|
create(base) {
|
|
4973
|
-
return AnyFlag.fromPartial(base !== null && base !==
|
|
5066
|
+
return AnyFlag.fromPartial(base !== null && base !== undefined ? base : {});
|
|
4974
5067
|
},
|
|
4975
5068
|
fromPartial(object) {
|
|
4976
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5069
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4977
5070
|
const message = createBaseAnyFlag();
|
|
4978
|
-
message.reason = (_a = object.reason) !== null && _a !==
|
|
4979
|
-
message.variant = (_b = object.variant) !== null && _b !==
|
|
4980
|
-
message.boolValue = (_c = object.boolValue) !== null && _c !==
|
|
4981
|
-
message.stringValue = (_d = object.stringValue) !== null && _d !==
|
|
4982
|
-
message.doubleValue = (_e = object.doubleValue) !== null && _e !==
|
|
4983
|
-
message.objectValue = (_f = object.objectValue) !== null && _f !==
|
|
5071
|
+
message.reason = (_a = object.reason) !== null && _a !== undefined ? _a : "";
|
|
5072
|
+
message.variant = (_b = object.variant) !== null && _b !== undefined ? _b : "";
|
|
5073
|
+
message.boolValue = (_c = object.boolValue) !== null && _c !== undefined ? _c : undefined;
|
|
5074
|
+
message.stringValue = (_d = object.stringValue) !== null && _d !== undefined ? _d : undefined;
|
|
5075
|
+
message.doubleValue = (_e = object.doubleValue) !== null && _e !== undefined ? _e : undefined;
|
|
5076
|
+
message.objectValue = (_f = object.objectValue) !== null && _f !== undefined ? _f : undefined;
|
|
5077
|
+
message.metadata = (_g = object.metadata) !== null && _g !== undefined ? _g : undefined;
|
|
4984
5078
|
return message;
|
|
4985
5079
|
},
|
|
4986
5080
|
};
|
|
@@ -4988,7 +5082,7 @@ function createBaseResolveBooleanRequest() {
|
|
|
4988
5082
|
return { flagKey: "", context: undefined };
|
|
4989
5083
|
}
|
|
4990
5084
|
const ResolveBooleanRequest = {
|
|
4991
|
-
encode(message, writer =
|
|
5085
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
4992
5086
|
if (message.flagKey !== "") {
|
|
4993
5087
|
writer.uint32(10).string(message.flagKey);
|
|
4994
5088
|
}
|
|
@@ -4998,7 +5092,7 @@ const ResolveBooleanRequest = {
|
|
|
4998
5092
|
return writer;
|
|
4999
5093
|
},
|
|
5000
5094
|
decode(input, length) {
|
|
5001
|
-
const reader = input instanceof
|
|
5095
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5002
5096
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5003
5097
|
const message = createBaseResolveBooleanRequest();
|
|
5004
5098
|
while (reader.pos < end) {
|
|
@@ -5041,13 +5135,13 @@ const ResolveBooleanRequest = {
|
|
|
5041
5135
|
return obj;
|
|
5042
5136
|
},
|
|
5043
5137
|
create(base) {
|
|
5044
|
-
return ResolveBooleanRequest.fromPartial(base !== null && base !==
|
|
5138
|
+
return ResolveBooleanRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5045
5139
|
},
|
|
5046
5140
|
fromPartial(object) {
|
|
5047
5141
|
var _a, _b;
|
|
5048
5142
|
const message = createBaseResolveBooleanRequest();
|
|
5049
|
-
message.flagKey = (_a = object.flagKey) !== null && _a !==
|
|
5050
|
-
message.context = (_b = object.context) !== null && _b !==
|
|
5143
|
+
message.flagKey = (_a = object.flagKey) !== null && _a !== undefined ? _a : "";
|
|
5144
|
+
message.context = (_b = object.context) !== null && _b !== undefined ? _b : undefined;
|
|
5051
5145
|
return message;
|
|
5052
5146
|
},
|
|
5053
5147
|
};
|
|
@@ -5055,7 +5149,7 @@ function createBaseResolveBooleanResponse() {
|
|
|
5055
5149
|
return { value: false, reason: "", variant: "", metadata: undefined };
|
|
5056
5150
|
}
|
|
5057
5151
|
const ResolveBooleanResponse = {
|
|
5058
|
-
encode(message, writer =
|
|
5152
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5059
5153
|
if (message.value === true) {
|
|
5060
5154
|
writer.uint32(8).bool(message.value);
|
|
5061
5155
|
}
|
|
@@ -5071,7 +5165,7 @@ const ResolveBooleanResponse = {
|
|
|
5071
5165
|
return writer;
|
|
5072
5166
|
},
|
|
5073
5167
|
decode(input, length) {
|
|
5074
|
-
const reader = input instanceof
|
|
5168
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5075
5169
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5076
5170
|
const message = createBaseResolveBooleanResponse();
|
|
5077
5171
|
while (reader.pos < end) {
|
|
@@ -5134,15 +5228,15 @@ const ResolveBooleanResponse = {
|
|
|
5134
5228
|
return obj;
|
|
5135
5229
|
},
|
|
5136
5230
|
create(base) {
|
|
5137
|
-
return ResolveBooleanResponse.fromPartial(base !== null && base !==
|
|
5231
|
+
return ResolveBooleanResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5138
5232
|
},
|
|
5139
5233
|
fromPartial(object) {
|
|
5140
5234
|
var _a, _b, _c, _d;
|
|
5141
5235
|
const message = createBaseResolveBooleanResponse();
|
|
5142
|
-
message.value = (_a = object.value) !== null && _a !==
|
|
5143
|
-
message.reason = (_b = object.reason) !== null && _b !==
|
|
5144
|
-
message.variant = (_c = object.variant) !== null && _c !==
|
|
5145
|
-
message.metadata = (_d = object.metadata) !== null && _d !==
|
|
5236
|
+
message.value = (_a = object.value) !== null && _a !== undefined ? _a : false;
|
|
5237
|
+
message.reason = (_b = object.reason) !== null && _b !== undefined ? _b : "";
|
|
5238
|
+
message.variant = (_c = object.variant) !== null && _c !== undefined ? _c : "";
|
|
5239
|
+
message.metadata = (_d = object.metadata) !== null && _d !== undefined ? _d : undefined;
|
|
5146
5240
|
return message;
|
|
5147
5241
|
},
|
|
5148
5242
|
};
|
|
@@ -5150,7 +5244,7 @@ function createBaseResolveStringRequest() {
|
|
|
5150
5244
|
return { flagKey: "", context: undefined };
|
|
5151
5245
|
}
|
|
5152
5246
|
const ResolveStringRequest = {
|
|
5153
|
-
encode(message, writer =
|
|
5247
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5154
5248
|
if (message.flagKey !== "") {
|
|
5155
5249
|
writer.uint32(10).string(message.flagKey);
|
|
5156
5250
|
}
|
|
@@ -5160,7 +5254,7 @@ const ResolveStringRequest = {
|
|
|
5160
5254
|
return writer;
|
|
5161
5255
|
},
|
|
5162
5256
|
decode(input, length) {
|
|
5163
|
-
const reader = input instanceof
|
|
5257
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5164
5258
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5165
5259
|
const message = createBaseResolveStringRequest();
|
|
5166
5260
|
while (reader.pos < end) {
|
|
@@ -5203,13 +5297,13 @@ const ResolveStringRequest = {
|
|
|
5203
5297
|
return obj;
|
|
5204
5298
|
},
|
|
5205
5299
|
create(base) {
|
|
5206
|
-
return ResolveStringRequest.fromPartial(base !== null && base !==
|
|
5300
|
+
return ResolveStringRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5207
5301
|
},
|
|
5208
5302
|
fromPartial(object) {
|
|
5209
5303
|
var _a, _b;
|
|
5210
5304
|
const message = createBaseResolveStringRequest();
|
|
5211
|
-
message.flagKey = (_a = object.flagKey) !== null && _a !==
|
|
5212
|
-
message.context = (_b = object.context) !== null && _b !==
|
|
5305
|
+
message.flagKey = (_a = object.flagKey) !== null && _a !== undefined ? _a : "";
|
|
5306
|
+
message.context = (_b = object.context) !== null && _b !== undefined ? _b : undefined;
|
|
5213
5307
|
return message;
|
|
5214
5308
|
},
|
|
5215
5309
|
};
|
|
@@ -5217,7 +5311,7 @@ function createBaseResolveStringResponse() {
|
|
|
5217
5311
|
return { value: "", reason: "", variant: "", metadata: undefined };
|
|
5218
5312
|
}
|
|
5219
5313
|
const ResolveStringResponse = {
|
|
5220
|
-
encode(message, writer =
|
|
5314
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5221
5315
|
if (message.value !== "") {
|
|
5222
5316
|
writer.uint32(10).string(message.value);
|
|
5223
5317
|
}
|
|
@@ -5233,7 +5327,7 @@ const ResolveStringResponse = {
|
|
|
5233
5327
|
return writer;
|
|
5234
5328
|
},
|
|
5235
5329
|
decode(input, length) {
|
|
5236
|
-
const reader = input instanceof
|
|
5330
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5237
5331
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5238
5332
|
const message = createBaseResolveStringResponse();
|
|
5239
5333
|
while (reader.pos < end) {
|
|
@@ -5296,15 +5390,15 @@ const ResolveStringResponse = {
|
|
|
5296
5390
|
return obj;
|
|
5297
5391
|
},
|
|
5298
5392
|
create(base) {
|
|
5299
|
-
return ResolveStringResponse.fromPartial(base !== null && base !==
|
|
5393
|
+
return ResolveStringResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5300
5394
|
},
|
|
5301
5395
|
fromPartial(object) {
|
|
5302
5396
|
var _a, _b, _c, _d;
|
|
5303
5397
|
const message = createBaseResolveStringResponse();
|
|
5304
|
-
message.value = (_a = object.value) !== null && _a !==
|
|
5305
|
-
message.reason = (_b = object.reason) !== null && _b !==
|
|
5306
|
-
message.variant = (_c = object.variant) !== null && _c !==
|
|
5307
|
-
message.metadata = (_d = object.metadata) !== null && _d !==
|
|
5398
|
+
message.value = (_a = object.value) !== null && _a !== undefined ? _a : "";
|
|
5399
|
+
message.reason = (_b = object.reason) !== null && _b !== undefined ? _b : "";
|
|
5400
|
+
message.variant = (_c = object.variant) !== null && _c !== undefined ? _c : "";
|
|
5401
|
+
message.metadata = (_d = object.metadata) !== null && _d !== undefined ? _d : undefined;
|
|
5308
5402
|
return message;
|
|
5309
5403
|
},
|
|
5310
5404
|
};
|
|
@@ -5312,7 +5406,7 @@ function createBaseResolveFloatRequest() {
|
|
|
5312
5406
|
return { flagKey: "", context: undefined };
|
|
5313
5407
|
}
|
|
5314
5408
|
const ResolveFloatRequest = {
|
|
5315
|
-
encode(message, writer =
|
|
5409
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5316
5410
|
if (message.flagKey !== "") {
|
|
5317
5411
|
writer.uint32(10).string(message.flagKey);
|
|
5318
5412
|
}
|
|
@@ -5322,7 +5416,7 @@ const ResolveFloatRequest = {
|
|
|
5322
5416
|
return writer;
|
|
5323
5417
|
},
|
|
5324
5418
|
decode(input, length) {
|
|
5325
|
-
const reader = input instanceof
|
|
5419
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5326
5420
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5327
5421
|
const message = createBaseResolveFloatRequest();
|
|
5328
5422
|
while (reader.pos < end) {
|
|
@@ -5365,13 +5459,13 @@ const ResolveFloatRequest = {
|
|
|
5365
5459
|
return obj;
|
|
5366
5460
|
},
|
|
5367
5461
|
create(base) {
|
|
5368
|
-
return ResolveFloatRequest.fromPartial(base !== null && base !==
|
|
5462
|
+
return ResolveFloatRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5369
5463
|
},
|
|
5370
5464
|
fromPartial(object) {
|
|
5371
5465
|
var _a, _b;
|
|
5372
5466
|
const message = createBaseResolveFloatRequest();
|
|
5373
|
-
message.flagKey = (_a = object.flagKey) !== null && _a !==
|
|
5374
|
-
message.context = (_b = object.context) !== null && _b !==
|
|
5467
|
+
message.flagKey = (_a = object.flagKey) !== null && _a !== undefined ? _a : "";
|
|
5468
|
+
message.context = (_b = object.context) !== null && _b !== undefined ? _b : undefined;
|
|
5375
5469
|
return message;
|
|
5376
5470
|
},
|
|
5377
5471
|
};
|
|
@@ -5379,7 +5473,7 @@ function createBaseResolveFloatResponse() {
|
|
|
5379
5473
|
return { value: 0, reason: "", variant: "", metadata: undefined };
|
|
5380
5474
|
}
|
|
5381
5475
|
const ResolveFloatResponse = {
|
|
5382
|
-
encode(message, writer =
|
|
5476
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5383
5477
|
if (message.value !== 0) {
|
|
5384
5478
|
writer.uint32(9).double(message.value);
|
|
5385
5479
|
}
|
|
@@ -5395,7 +5489,7 @@ const ResolveFloatResponse = {
|
|
|
5395
5489
|
return writer;
|
|
5396
5490
|
},
|
|
5397
5491
|
decode(input, length) {
|
|
5398
|
-
const reader = input instanceof
|
|
5492
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5399
5493
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5400
5494
|
const message = createBaseResolveFloatResponse();
|
|
5401
5495
|
while (reader.pos < end) {
|
|
@@ -5458,15 +5552,15 @@ const ResolveFloatResponse = {
|
|
|
5458
5552
|
return obj;
|
|
5459
5553
|
},
|
|
5460
5554
|
create(base) {
|
|
5461
|
-
return ResolveFloatResponse.fromPartial(base !== null && base !==
|
|
5555
|
+
return ResolveFloatResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5462
5556
|
},
|
|
5463
5557
|
fromPartial(object) {
|
|
5464
5558
|
var _a, _b, _c, _d;
|
|
5465
5559
|
const message = createBaseResolveFloatResponse();
|
|
5466
|
-
message.value = (_a = object.value) !== null && _a !==
|
|
5467
|
-
message.reason = (_b = object.reason) !== null && _b !==
|
|
5468
|
-
message.variant = (_c = object.variant) !== null && _c !==
|
|
5469
|
-
message.metadata = (_d = object.metadata) !== null && _d !==
|
|
5560
|
+
message.value = (_a = object.value) !== null && _a !== undefined ? _a : 0;
|
|
5561
|
+
message.reason = (_b = object.reason) !== null && _b !== undefined ? _b : "";
|
|
5562
|
+
message.variant = (_c = object.variant) !== null && _c !== undefined ? _c : "";
|
|
5563
|
+
message.metadata = (_d = object.metadata) !== null && _d !== undefined ? _d : undefined;
|
|
5470
5564
|
return message;
|
|
5471
5565
|
},
|
|
5472
5566
|
};
|
|
@@ -5474,7 +5568,7 @@ function createBaseResolveIntRequest() {
|
|
|
5474
5568
|
return { flagKey: "", context: undefined };
|
|
5475
5569
|
}
|
|
5476
5570
|
const ResolveIntRequest = {
|
|
5477
|
-
encode(message, writer =
|
|
5571
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5478
5572
|
if (message.flagKey !== "") {
|
|
5479
5573
|
writer.uint32(10).string(message.flagKey);
|
|
5480
5574
|
}
|
|
@@ -5484,7 +5578,7 @@ const ResolveIntRequest = {
|
|
|
5484
5578
|
return writer;
|
|
5485
5579
|
},
|
|
5486
5580
|
decode(input, length) {
|
|
5487
|
-
const reader = input instanceof
|
|
5581
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5488
5582
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5489
5583
|
const message = createBaseResolveIntRequest();
|
|
5490
5584
|
while (reader.pos < end) {
|
|
@@ -5527,13 +5621,13 @@ const ResolveIntRequest = {
|
|
|
5527
5621
|
return obj;
|
|
5528
5622
|
},
|
|
5529
5623
|
create(base) {
|
|
5530
|
-
return ResolveIntRequest.fromPartial(base !== null && base !==
|
|
5624
|
+
return ResolveIntRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5531
5625
|
},
|
|
5532
5626
|
fromPartial(object) {
|
|
5533
5627
|
var _a, _b;
|
|
5534
5628
|
const message = createBaseResolveIntRequest();
|
|
5535
|
-
message.flagKey = (_a = object.flagKey) !== null && _a !==
|
|
5536
|
-
message.context = (_b = object.context) !== null && _b !==
|
|
5629
|
+
message.flagKey = (_a = object.flagKey) !== null && _a !== undefined ? _a : "";
|
|
5630
|
+
message.context = (_b = object.context) !== null && _b !== undefined ? _b : undefined;
|
|
5537
5631
|
return message;
|
|
5538
5632
|
},
|
|
5539
5633
|
};
|
|
@@ -5541,7 +5635,7 @@ function createBaseResolveIntResponse() {
|
|
|
5541
5635
|
return { value: "0", reason: "", variant: "", metadata: undefined };
|
|
5542
5636
|
}
|
|
5543
5637
|
const ResolveIntResponse = {
|
|
5544
|
-
encode(message, writer =
|
|
5638
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5545
5639
|
if (message.value !== "0") {
|
|
5546
5640
|
writer.uint32(8).int64(message.value);
|
|
5547
5641
|
}
|
|
@@ -5557,7 +5651,7 @@ const ResolveIntResponse = {
|
|
|
5557
5651
|
return writer;
|
|
5558
5652
|
},
|
|
5559
5653
|
decode(input, length) {
|
|
5560
|
-
const reader = input instanceof
|
|
5654
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5561
5655
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5562
5656
|
const message = createBaseResolveIntResponse();
|
|
5563
5657
|
while (reader.pos < end) {
|
|
@@ -5620,15 +5714,15 @@ const ResolveIntResponse = {
|
|
|
5620
5714
|
return obj;
|
|
5621
5715
|
},
|
|
5622
5716
|
create(base) {
|
|
5623
|
-
return ResolveIntResponse.fromPartial(base !== null && base !==
|
|
5717
|
+
return ResolveIntResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5624
5718
|
},
|
|
5625
5719
|
fromPartial(object) {
|
|
5626
5720
|
var _a, _b, _c, _d;
|
|
5627
5721
|
const message = createBaseResolveIntResponse();
|
|
5628
|
-
message.value = (_a = object.value) !== null && _a !==
|
|
5629
|
-
message.reason = (_b = object.reason) !== null && _b !==
|
|
5630
|
-
message.variant = (_c = object.variant) !== null && _c !==
|
|
5631
|
-
message.metadata = (_d = object.metadata) !== null && _d !==
|
|
5722
|
+
message.value = (_a = object.value) !== null && _a !== undefined ? _a : "0";
|
|
5723
|
+
message.reason = (_b = object.reason) !== null && _b !== undefined ? _b : "";
|
|
5724
|
+
message.variant = (_c = object.variant) !== null && _c !== undefined ? _c : "";
|
|
5725
|
+
message.metadata = (_d = object.metadata) !== null && _d !== undefined ? _d : undefined;
|
|
5632
5726
|
return message;
|
|
5633
5727
|
},
|
|
5634
5728
|
};
|
|
@@ -5636,7 +5730,7 @@ function createBaseResolveObjectRequest() {
|
|
|
5636
5730
|
return { flagKey: "", context: undefined };
|
|
5637
5731
|
}
|
|
5638
5732
|
const ResolveObjectRequest = {
|
|
5639
|
-
encode(message, writer =
|
|
5733
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5640
5734
|
if (message.flagKey !== "") {
|
|
5641
5735
|
writer.uint32(10).string(message.flagKey);
|
|
5642
5736
|
}
|
|
@@ -5646,7 +5740,7 @@ const ResolveObjectRequest = {
|
|
|
5646
5740
|
return writer;
|
|
5647
5741
|
},
|
|
5648
5742
|
decode(input, length) {
|
|
5649
|
-
const reader = input instanceof
|
|
5743
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5650
5744
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5651
5745
|
const message = createBaseResolveObjectRequest();
|
|
5652
5746
|
while (reader.pos < end) {
|
|
@@ -5689,13 +5783,13 @@ const ResolveObjectRequest = {
|
|
|
5689
5783
|
return obj;
|
|
5690
5784
|
},
|
|
5691
5785
|
create(base) {
|
|
5692
|
-
return ResolveObjectRequest.fromPartial(base !== null && base !==
|
|
5786
|
+
return ResolveObjectRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5693
5787
|
},
|
|
5694
5788
|
fromPartial(object) {
|
|
5695
5789
|
var _a, _b;
|
|
5696
5790
|
const message = createBaseResolveObjectRequest();
|
|
5697
|
-
message.flagKey = (_a = object.flagKey) !== null && _a !==
|
|
5698
|
-
message.context = (_b = object.context) !== null && _b !==
|
|
5791
|
+
message.flagKey = (_a = object.flagKey) !== null && _a !== undefined ? _a : "";
|
|
5792
|
+
message.context = (_b = object.context) !== null && _b !== undefined ? _b : undefined;
|
|
5699
5793
|
return message;
|
|
5700
5794
|
},
|
|
5701
5795
|
};
|
|
@@ -5703,7 +5797,7 @@ function createBaseResolveObjectResponse() {
|
|
|
5703
5797
|
return { value: undefined, reason: "", variant: "", metadata: undefined };
|
|
5704
5798
|
}
|
|
5705
5799
|
const ResolveObjectResponse = {
|
|
5706
|
-
encode(message, writer =
|
|
5800
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5707
5801
|
if (message.value !== undefined) {
|
|
5708
5802
|
Struct.encode(Struct.wrap(message.value), writer.uint32(10).fork()).ldelim();
|
|
5709
5803
|
}
|
|
@@ -5719,7 +5813,7 @@ const ResolveObjectResponse = {
|
|
|
5719
5813
|
return writer;
|
|
5720
5814
|
},
|
|
5721
5815
|
decode(input, length) {
|
|
5722
|
-
const reader = input instanceof
|
|
5816
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5723
5817
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5724
5818
|
const message = createBaseResolveObjectResponse();
|
|
5725
5819
|
while (reader.pos < end) {
|
|
@@ -5782,15 +5876,15 @@ const ResolveObjectResponse = {
|
|
|
5782
5876
|
return obj;
|
|
5783
5877
|
},
|
|
5784
5878
|
create(base) {
|
|
5785
|
-
return ResolveObjectResponse.fromPartial(base !== null && base !==
|
|
5879
|
+
return ResolveObjectResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5786
5880
|
},
|
|
5787
5881
|
fromPartial(object) {
|
|
5788
5882
|
var _a, _b, _c, _d;
|
|
5789
5883
|
const message = createBaseResolveObjectResponse();
|
|
5790
|
-
message.value = (_a = object.value) !== null && _a !==
|
|
5791
|
-
message.reason = (_b = object.reason) !== null && _b !==
|
|
5792
|
-
message.variant = (_c = object.variant) !== null && _c !==
|
|
5793
|
-
message.metadata = (_d = object.metadata) !== null && _d !==
|
|
5884
|
+
message.value = (_a = object.value) !== null && _a !== undefined ? _a : undefined;
|
|
5885
|
+
message.reason = (_b = object.reason) !== null && _b !== undefined ? _b : "";
|
|
5886
|
+
message.variant = (_c = object.variant) !== null && _c !== undefined ? _c : "";
|
|
5887
|
+
message.metadata = (_d = object.metadata) !== null && _d !== undefined ? _d : undefined;
|
|
5794
5888
|
return message;
|
|
5795
5889
|
},
|
|
5796
5890
|
};
|
|
@@ -5798,7 +5892,7 @@ function createBaseEventStreamResponse() {
|
|
|
5798
5892
|
return { type: "", data: undefined };
|
|
5799
5893
|
}
|
|
5800
5894
|
const EventStreamResponse = {
|
|
5801
|
-
encode(message, writer =
|
|
5895
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
5802
5896
|
if (message.type !== "") {
|
|
5803
5897
|
writer.uint32(10).string(message.type);
|
|
5804
5898
|
}
|
|
@@ -5808,7 +5902,7 @@ const EventStreamResponse = {
|
|
|
5808
5902
|
return writer;
|
|
5809
5903
|
},
|
|
5810
5904
|
decode(input, length) {
|
|
5811
|
-
const reader = input instanceof
|
|
5905
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5812
5906
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5813
5907
|
const message = createBaseEventStreamResponse();
|
|
5814
5908
|
while (reader.pos < end) {
|
|
@@ -5851,13 +5945,13 @@ const EventStreamResponse = {
|
|
|
5851
5945
|
return obj;
|
|
5852
5946
|
},
|
|
5853
5947
|
create(base) {
|
|
5854
|
-
return EventStreamResponse.fromPartial(base !== null && base !==
|
|
5948
|
+
return EventStreamResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5855
5949
|
},
|
|
5856
5950
|
fromPartial(object) {
|
|
5857
5951
|
var _a, _b;
|
|
5858
5952
|
const message = createBaseEventStreamResponse();
|
|
5859
|
-
message.type = (_a = object.type) !== null && _a !==
|
|
5860
|
-
message.data = (_b = object.data) !== null && _b !==
|
|
5953
|
+
message.type = (_a = object.type) !== null && _a !== undefined ? _a : "";
|
|
5954
|
+
message.data = (_b = object.data) !== null && _b !== undefined ? _b : undefined;
|
|
5861
5955
|
return message;
|
|
5862
5956
|
},
|
|
5863
5957
|
};
|
|
@@ -5865,11 +5959,11 @@ function createBaseEventStreamRequest() {
|
|
|
5865
5959
|
return {};
|
|
5866
5960
|
}
|
|
5867
5961
|
const EventStreamRequest = {
|
|
5868
|
-
encode(_, writer =
|
|
5962
|
+
encode(_, writer = _m0.Writer.create()) {
|
|
5869
5963
|
return writer;
|
|
5870
5964
|
},
|
|
5871
5965
|
decode(input, length) {
|
|
5872
|
-
const reader = input instanceof
|
|
5966
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
5873
5967
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5874
5968
|
const message = createBaseEventStreamRequest();
|
|
5875
5969
|
while (reader.pos < end) {
|
|
@@ -5889,7 +5983,7 @@ const EventStreamRequest = {
|
|
|
5889
5983
|
return obj;
|
|
5890
5984
|
},
|
|
5891
5985
|
create(base) {
|
|
5892
|
-
return EventStreamRequest.fromPartial(base !== null && base !==
|
|
5986
|
+
return EventStreamRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
5893
5987
|
},
|
|
5894
5988
|
fromPartial(_) {
|
|
5895
5989
|
const message = createBaseEventStreamRequest();
|
|
@@ -5965,9 +6059,9 @@ const ServiceClient = grpcJs.makeGenericClientConstructor(ServiceService, "flagd
|
|
|
5965
6059
|
function longToString(long) {
|
|
5966
6060
|
return long.toString();
|
|
5967
6061
|
}
|
|
5968
|
-
if (
|
|
5969
|
-
|
|
5970
|
-
|
|
6062
|
+
if (_m0.util.Long !== Long) {
|
|
6063
|
+
_m0.util.Long = Long;
|
|
6064
|
+
_m0.configure();
|
|
5971
6065
|
}
|
|
5972
6066
|
function isObject$1(value) {
|
|
5973
6067
|
return typeof value === "object" && value !== null;
|
|
@@ -6002,7 +6096,7 @@ class GRPCService {
|
|
|
6002
6096
|
this._eventStream = undefined;
|
|
6003
6097
|
this.onRejected = (err) => {
|
|
6004
6098
|
// map the errors
|
|
6005
|
-
switch (err === null || err ===
|
|
6099
|
+
switch (err === null || err === undefined ? undefined : err.code) {
|
|
6006
6100
|
case grpcJs.status.DATA_LOSS:
|
|
6007
6101
|
throw new serverSdk.ParseError(err.details);
|
|
6008
6102
|
case grpcJs.status.INVALID_ARGUMENT:
|
|
@@ -6012,7 +6106,7 @@ class GRPCService {
|
|
|
6012
6106
|
case grpcJs.status.UNAVAILABLE:
|
|
6013
6107
|
throw new serverSdk.FlagNotFoundError(err.details);
|
|
6014
6108
|
default:
|
|
6015
|
-
throw new serverSdk.GeneralError(err === null || err ===
|
|
6109
|
+
throw new serverSdk.GeneralError(err === null || err === undefined ? undefined : err.details);
|
|
6016
6110
|
}
|
|
6017
6111
|
};
|
|
6018
6112
|
const { host, port, tls, socketPath } = config;
|
|
@@ -6028,45 +6122,45 @@ class GRPCService {
|
|
|
6028
6122
|
return new Promise((resolve, reject) => this.listen(reconnectCallback, changedCallback, disconnectCallback, resolve, reject));
|
|
6029
6123
|
}
|
|
6030
6124
|
disconnect() {
|
|
6031
|
-
return __awaiter(this,
|
|
6125
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6032
6126
|
closeStreamIfDefined(this._eventStream);
|
|
6033
6127
|
this._client.close();
|
|
6034
6128
|
});
|
|
6035
6129
|
}
|
|
6036
6130
|
resolveBoolean(flagKey, _, context, logger) {
|
|
6037
|
-
return __awaiter(this,
|
|
6131
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6038
6132
|
return this.resolve(this._client.resolveBoolean, flagKey, context, logger);
|
|
6039
6133
|
});
|
|
6040
6134
|
}
|
|
6041
6135
|
resolveString(flagKey, _, context, logger) {
|
|
6042
|
-
return __awaiter(this,
|
|
6136
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6043
6137
|
return this.resolve(this._client.resolveString, flagKey, context, logger);
|
|
6044
6138
|
});
|
|
6045
6139
|
}
|
|
6046
6140
|
resolveNumber(flagKey, _, context, logger) {
|
|
6047
|
-
return __awaiter(this,
|
|
6141
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6048
6142
|
return this.resolve(this._client.resolveFloat, flagKey, context, logger);
|
|
6049
6143
|
});
|
|
6050
6144
|
}
|
|
6051
6145
|
resolveObject(flagKey, _, context, logger) {
|
|
6052
|
-
return __awaiter(this,
|
|
6146
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6053
6147
|
return this.resolve(this._client.resolveObject, flagKey, context, logger);
|
|
6054
6148
|
});
|
|
6055
6149
|
}
|
|
6056
6150
|
listen(reconnectCallback, changedCallback, disconnectCallback, resolveConnect, rejectConnect) {
|
|
6057
6151
|
var _a;
|
|
6058
|
-
(_a = this.logger) === null || _a ===
|
|
6152
|
+
(_a = this.logger) === null || _a === undefined ? undefined : _a.debug(`${FlagdProvider.name}: connecting stream...`);
|
|
6059
6153
|
// close the previous stream if we're reconnecting
|
|
6060
6154
|
closeStreamIfDefined(this._eventStream);
|
|
6061
6155
|
const stream = this._client.eventStream({}, {});
|
|
6062
6156
|
stream.on('error', (err) => {
|
|
6063
|
-
rejectConnect === null || rejectConnect ===
|
|
6157
|
+
rejectConnect === null || rejectConnect === undefined ? undefined : rejectConnect(err);
|
|
6064
6158
|
this.handleError(reconnectCallback, changedCallback, disconnectCallback);
|
|
6065
6159
|
});
|
|
6066
6160
|
stream.on('data', (message) => {
|
|
6067
6161
|
var _a;
|
|
6068
6162
|
if (message.type === EVENT_PROVIDER_READY) {
|
|
6069
|
-
(_a = this.logger) === null || _a ===
|
|
6163
|
+
(_a = this.logger) === null || _a === undefined ? undefined : _a.debug(`${FlagdProvider.name}: streaming connection established with flagd`);
|
|
6070
6164
|
// if resolveConnect is undefined, this is a reconnection; we only want to fire the reconnect callback in that case
|
|
6071
6165
|
if (resolveConnect) {
|
|
6072
6166
|
resolveConnect();
|
|
@@ -6085,16 +6179,16 @@ class GRPCService {
|
|
|
6085
6179
|
var _a;
|
|
6086
6180
|
if (message.data) {
|
|
6087
6181
|
const data = message.data;
|
|
6088
|
-
(_a = this.logger) === null || _a ===
|
|
6089
|
-
if (data && typeof data === 'object' && 'flags' in data && (data === null || data ===
|
|
6182
|
+
(_a = this.logger) === null || _a === undefined ? undefined : _a.debug(`${FlagdProvider.name}: got message: ${JSON.stringify(data, undefined, 2)}`);
|
|
6183
|
+
if (data && typeof data === 'object' && 'flags' in data && (data === null || data === undefined ? undefined : data['flags'])) {
|
|
6090
6184
|
const flagChangeMessage = data;
|
|
6091
6185
|
const flagsChanged = Object.keys(flagChangeMessage.flags || []);
|
|
6092
6186
|
if (this._cacheEnabled) {
|
|
6093
6187
|
// remove each changed key from cache
|
|
6094
6188
|
flagsChanged.forEach((key) => {
|
|
6095
6189
|
var _a, _b;
|
|
6096
|
-
if ((_a = this._cache) === null || _a ===
|
|
6097
|
-
(_b = this.logger) === null || _b ===
|
|
6190
|
+
if ((_a = this._cache) === null || _a === undefined ? undefined : _a.delete(key)) {
|
|
6191
|
+
(_b = this.logger) === null || _b === undefined ? undefined : _b.debug(`${FlagdProvider.name}: evicted key: ${key} from cache.`);
|
|
6098
6192
|
}
|
|
6099
6193
|
});
|
|
6100
6194
|
}
|
|
@@ -6111,16 +6205,16 @@ class GRPCService {
|
|
|
6111
6205
|
handleError(reconnectCallback, changedCallback, disconnectCallback) {
|
|
6112
6206
|
var _a, _b;
|
|
6113
6207
|
disconnectCallback('streaming connection error, will attempt reconnect...');
|
|
6114
|
-
(_a = this.logger) === null || _a ===
|
|
6115
|
-
(_b = this._cache) === null || _b ===
|
|
6208
|
+
(_a = this.logger) === null || _a === undefined ? undefined : _a.error(`${FlagdProvider.name}: streaming connection error, will attempt reconnect...`);
|
|
6209
|
+
(_b = this._cache) === null || _b === undefined ? undefined : _b.clear();
|
|
6116
6210
|
this.reconnect(reconnectCallback, changedCallback, disconnectCallback);
|
|
6117
6211
|
}
|
|
6118
6212
|
resolve(promise, flagKey, context, logger) {
|
|
6119
|
-
return __awaiter(this,
|
|
6213
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6120
6214
|
var _a, _b;
|
|
6121
|
-
const resolver =
|
|
6215
|
+
const resolver = node_util.promisify(promise);
|
|
6122
6216
|
if (this._cacheActive) {
|
|
6123
|
-
const cached = (_a = this._cache) === null || _a ===
|
|
6217
|
+
const cached = (_a = this._cache) === null || _a === undefined ? undefined : _a.get(flagKey);
|
|
6124
6218
|
if (cached) {
|
|
6125
6219
|
return Object.assign(Object.assign({}, cached), { reason: serverSdk.StandardResolutionReasons.CACHED });
|
|
6126
6220
|
}
|
|
@@ -6138,19 +6232,73 @@ class GRPCService {
|
|
|
6138
6232
|
logger.debug(`${FlagdProvider.name}: resolved flag with key: ${resolved.value}, variant: ${response.variant}, reason: ${response.reason}`);
|
|
6139
6233
|
if (this._cacheActive && response.reason === serverSdk.StandardResolutionReasons.STATIC) {
|
|
6140
6234
|
// cache this static value
|
|
6141
|
-
(_b = this._cache) === null || _b ===
|
|
6235
|
+
(_b = this._cache) === null || _b === undefined ? undefined : _b.set(flagKey, resolved);
|
|
6142
6236
|
}
|
|
6143
6237
|
return resolved;
|
|
6144
6238
|
});
|
|
6145
6239
|
}
|
|
6146
6240
|
}
|
|
6147
6241
|
|
|
6242
|
+
const encoding = 'utf8';
|
|
6243
|
+
class FileFetch {
|
|
6244
|
+
constructor(filename, logger) {
|
|
6245
|
+
this._filename = filename;
|
|
6246
|
+
this._logger = logger;
|
|
6247
|
+
}
|
|
6248
|
+
connect(dataFillCallback, _, changedCallback) {
|
|
6249
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6250
|
+
var _a, _b;
|
|
6251
|
+
(_a = this._logger) === null || _a === undefined ? undefined : _a.debug('Starting file sync connection');
|
|
6252
|
+
try {
|
|
6253
|
+
const output = yield fs.promises.readFile(this._filename, encoding);
|
|
6254
|
+
// Don't emit the change event for the initial read
|
|
6255
|
+
dataFillCallback(output);
|
|
6256
|
+
// Using watchFile instead of watch to support virtualized host file systems.
|
|
6257
|
+
fs.watchFile(this._filename, () => __awaiter(this, void 0, void 0, function* () {
|
|
6258
|
+
var _a;
|
|
6259
|
+
try {
|
|
6260
|
+
const data = yield fs.promises.readFile(this._filename, encoding);
|
|
6261
|
+
const changes = dataFillCallback(data);
|
|
6262
|
+
if (changes.length > 0) {
|
|
6263
|
+
changedCallback(changes);
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
catch (err) {
|
|
6267
|
+
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.error(`Error reading file: ${err}`);
|
|
6268
|
+
}
|
|
6269
|
+
}));
|
|
6270
|
+
}
|
|
6271
|
+
catch (err) {
|
|
6272
|
+
if (err instanceof serverSdk.OpenFeatureError) {
|
|
6273
|
+
throw err;
|
|
6274
|
+
}
|
|
6275
|
+
else {
|
|
6276
|
+
switch (err === null || err === undefined ? undefined : err.code) {
|
|
6277
|
+
case 'ENOENT':
|
|
6278
|
+
throw new serverSdk.GeneralError(`File not found: ${this._filename}`);
|
|
6279
|
+
case 'EACCES':
|
|
6280
|
+
throw new serverSdk.GeneralError(`File not accessible: ${this._filename}`);
|
|
6281
|
+
default:
|
|
6282
|
+
(_b = this._logger) === null || _b === undefined ? undefined : _b.debug(`Error reading file: ${err}`);
|
|
6283
|
+
throw new serverSdk.GeneralError();
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
}
|
|
6287
|
+
});
|
|
6288
|
+
}
|
|
6289
|
+
disconnect() {
|
|
6290
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6291
|
+
fs.unwatchFile(this._filename);
|
|
6292
|
+
});
|
|
6293
|
+
}
|
|
6294
|
+
}
|
|
6295
|
+
|
|
6148
6296
|
/* eslint-disable */
|
|
6149
6297
|
function createBaseSyncFlagsRequest() {
|
|
6150
6298
|
return { providerId: "", selector: "" };
|
|
6151
6299
|
}
|
|
6152
6300
|
const SyncFlagsRequest = {
|
|
6153
|
-
encode(message, writer =
|
|
6301
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
6154
6302
|
if (message.providerId !== "") {
|
|
6155
6303
|
writer.uint32(10).string(message.providerId);
|
|
6156
6304
|
}
|
|
@@ -6160,7 +6308,7 @@ const SyncFlagsRequest = {
|
|
|
6160
6308
|
return writer;
|
|
6161
6309
|
},
|
|
6162
6310
|
decode(input, length) {
|
|
6163
|
-
const reader = input instanceof
|
|
6311
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
6164
6312
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6165
6313
|
const message = createBaseSyncFlagsRequest();
|
|
6166
6314
|
while (reader.pos < end) {
|
|
@@ -6203,13 +6351,13 @@ const SyncFlagsRequest = {
|
|
|
6203
6351
|
return obj;
|
|
6204
6352
|
},
|
|
6205
6353
|
create(base) {
|
|
6206
|
-
return SyncFlagsRequest.fromPartial(base !== null && base !==
|
|
6354
|
+
return SyncFlagsRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
6207
6355
|
},
|
|
6208
6356
|
fromPartial(object) {
|
|
6209
6357
|
var _a, _b;
|
|
6210
6358
|
const message = createBaseSyncFlagsRequest();
|
|
6211
|
-
message.providerId = (_a = object.providerId) !== null && _a !==
|
|
6212
|
-
message.selector = (_b = object.selector) !== null && _b !==
|
|
6359
|
+
message.providerId = (_a = object.providerId) !== null && _a !== undefined ? _a : "";
|
|
6360
|
+
message.selector = (_b = object.selector) !== null && _b !== undefined ? _b : "";
|
|
6213
6361
|
return message;
|
|
6214
6362
|
},
|
|
6215
6363
|
};
|
|
@@ -6217,14 +6365,14 @@ function createBaseSyncFlagsResponse() {
|
|
|
6217
6365
|
return { flagConfiguration: "" };
|
|
6218
6366
|
}
|
|
6219
6367
|
const SyncFlagsResponse = {
|
|
6220
|
-
encode(message, writer =
|
|
6368
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
6221
6369
|
if (message.flagConfiguration !== "") {
|
|
6222
6370
|
writer.uint32(10).string(message.flagConfiguration);
|
|
6223
6371
|
}
|
|
6224
6372
|
return writer;
|
|
6225
6373
|
},
|
|
6226
6374
|
decode(input, length) {
|
|
6227
|
-
const reader = input instanceof
|
|
6375
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
6228
6376
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6229
6377
|
const message = createBaseSyncFlagsResponse();
|
|
6230
6378
|
while (reader.pos < end) {
|
|
@@ -6255,12 +6403,12 @@ const SyncFlagsResponse = {
|
|
|
6255
6403
|
return obj;
|
|
6256
6404
|
},
|
|
6257
6405
|
create(base) {
|
|
6258
|
-
return SyncFlagsResponse.fromPartial(base !== null && base !==
|
|
6406
|
+
return SyncFlagsResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
6259
6407
|
},
|
|
6260
6408
|
fromPartial(object) {
|
|
6261
6409
|
var _a;
|
|
6262
6410
|
const message = createBaseSyncFlagsResponse();
|
|
6263
|
-
message.flagConfiguration = (_a = object.flagConfiguration) !== null && _a !==
|
|
6411
|
+
message.flagConfiguration = (_a = object.flagConfiguration) !== null && _a !== undefined ? _a : "";
|
|
6264
6412
|
return message;
|
|
6265
6413
|
},
|
|
6266
6414
|
};
|
|
@@ -6268,7 +6416,7 @@ function createBaseFetchAllFlagsRequest() {
|
|
|
6268
6416
|
return { providerId: "", selector: "" };
|
|
6269
6417
|
}
|
|
6270
6418
|
const FetchAllFlagsRequest = {
|
|
6271
|
-
encode(message, writer =
|
|
6419
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
6272
6420
|
if (message.providerId !== "") {
|
|
6273
6421
|
writer.uint32(10).string(message.providerId);
|
|
6274
6422
|
}
|
|
@@ -6278,7 +6426,7 @@ const FetchAllFlagsRequest = {
|
|
|
6278
6426
|
return writer;
|
|
6279
6427
|
},
|
|
6280
6428
|
decode(input, length) {
|
|
6281
|
-
const reader = input instanceof
|
|
6429
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
6282
6430
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6283
6431
|
const message = createBaseFetchAllFlagsRequest();
|
|
6284
6432
|
while (reader.pos < end) {
|
|
@@ -6321,13 +6469,13 @@ const FetchAllFlagsRequest = {
|
|
|
6321
6469
|
return obj;
|
|
6322
6470
|
},
|
|
6323
6471
|
create(base) {
|
|
6324
|
-
return FetchAllFlagsRequest.fromPartial(base !== null && base !==
|
|
6472
|
+
return FetchAllFlagsRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
6325
6473
|
},
|
|
6326
6474
|
fromPartial(object) {
|
|
6327
6475
|
var _a, _b;
|
|
6328
6476
|
const message = createBaseFetchAllFlagsRequest();
|
|
6329
|
-
message.providerId = (_a = object.providerId) !== null && _a !==
|
|
6330
|
-
message.selector = (_b = object.selector) !== null && _b !==
|
|
6477
|
+
message.providerId = (_a = object.providerId) !== null && _a !== undefined ? _a : "";
|
|
6478
|
+
message.selector = (_b = object.selector) !== null && _b !== undefined ? _b : "";
|
|
6331
6479
|
return message;
|
|
6332
6480
|
},
|
|
6333
6481
|
};
|
|
@@ -6335,14 +6483,14 @@ function createBaseFetchAllFlagsResponse() {
|
|
|
6335
6483
|
return { flagConfiguration: "" };
|
|
6336
6484
|
}
|
|
6337
6485
|
const FetchAllFlagsResponse = {
|
|
6338
|
-
encode(message, writer =
|
|
6486
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
6339
6487
|
if (message.flagConfiguration !== "") {
|
|
6340
6488
|
writer.uint32(10).string(message.flagConfiguration);
|
|
6341
6489
|
}
|
|
6342
6490
|
return writer;
|
|
6343
6491
|
},
|
|
6344
6492
|
decode(input, length) {
|
|
6345
|
-
const reader = input instanceof
|
|
6493
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
6346
6494
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6347
6495
|
const message = createBaseFetchAllFlagsResponse();
|
|
6348
6496
|
while (reader.pos < end) {
|
|
@@ -6373,12 +6521,12 @@ const FetchAllFlagsResponse = {
|
|
|
6373
6521
|
return obj;
|
|
6374
6522
|
},
|
|
6375
6523
|
create(base) {
|
|
6376
|
-
return FetchAllFlagsResponse.fromPartial(base !== null && base !==
|
|
6524
|
+
return FetchAllFlagsResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
6377
6525
|
},
|
|
6378
6526
|
fromPartial(object) {
|
|
6379
6527
|
var _a;
|
|
6380
6528
|
const message = createBaseFetchAllFlagsResponse();
|
|
6381
|
-
message.flagConfiguration = (_a = object.flagConfiguration) !== null && _a !==
|
|
6529
|
+
message.flagConfiguration = (_a = object.flagConfiguration) !== null && _a !== undefined ? _a : "";
|
|
6382
6530
|
return message;
|
|
6383
6531
|
},
|
|
6384
6532
|
};
|
|
@@ -6386,11 +6534,11 @@ function createBaseGetMetadataRequest() {
|
|
|
6386
6534
|
return {};
|
|
6387
6535
|
}
|
|
6388
6536
|
const GetMetadataRequest = {
|
|
6389
|
-
encode(_, writer =
|
|
6537
|
+
encode(_, writer = _m0.Writer.create()) {
|
|
6390
6538
|
return writer;
|
|
6391
6539
|
},
|
|
6392
6540
|
decode(input, length) {
|
|
6393
|
-
const reader = input instanceof
|
|
6541
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
6394
6542
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6395
6543
|
const message = createBaseGetMetadataRequest();
|
|
6396
6544
|
while (reader.pos < end) {
|
|
@@ -6410,7 +6558,7 @@ const GetMetadataRequest = {
|
|
|
6410
6558
|
return obj;
|
|
6411
6559
|
},
|
|
6412
6560
|
create(base) {
|
|
6413
|
-
return GetMetadataRequest.fromPartial(base !== null && base !==
|
|
6561
|
+
return GetMetadataRequest.fromPartial(base !== null && base !== undefined ? base : {});
|
|
6414
6562
|
},
|
|
6415
6563
|
fromPartial(_) {
|
|
6416
6564
|
const message = createBaseGetMetadataRequest();
|
|
@@ -6421,14 +6569,14 @@ function createBaseGetMetadataResponse() {
|
|
|
6421
6569
|
return { metadata: undefined };
|
|
6422
6570
|
}
|
|
6423
6571
|
const GetMetadataResponse = {
|
|
6424
|
-
encode(message, writer =
|
|
6572
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
6425
6573
|
if (message.metadata !== undefined) {
|
|
6426
6574
|
Struct.encode(Struct.wrap(message.metadata), writer.uint32(18).fork()).ldelim();
|
|
6427
6575
|
}
|
|
6428
6576
|
return writer;
|
|
6429
6577
|
},
|
|
6430
6578
|
decode(input, length) {
|
|
6431
|
-
const reader = input instanceof
|
|
6579
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
6432
6580
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
6433
6581
|
const message = createBaseGetMetadataResponse();
|
|
6434
6582
|
while (reader.pos < end) {
|
|
@@ -6459,12 +6607,12 @@ const GetMetadataResponse = {
|
|
|
6459
6607
|
return obj;
|
|
6460
6608
|
},
|
|
6461
6609
|
create(base) {
|
|
6462
|
-
return GetMetadataResponse.fromPartial(base !== null && base !==
|
|
6610
|
+
return GetMetadataResponse.fromPartial(base !== null && base !== undefined ? base : {});
|
|
6463
6611
|
},
|
|
6464
6612
|
fromPartial(object) {
|
|
6465
6613
|
var _a;
|
|
6466
6614
|
const message = createBaseGetMetadataResponse();
|
|
6467
|
-
message.metadata = (_a = object.metadata) !== null && _a !==
|
|
6615
|
+
message.metadata = (_a = object.metadata) !== null && _a !== undefined ? _a : undefined;
|
|
6468
6616
|
return message;
|
|
6469
6617
|
},
|
|
6470
6618
|
};
|
|
@@ -6530,21 +6678,22 @@ class GrpcFetch {
|
|
|
6530
6678
|
this._request = { providerId: '', selector: selector ? selector : '' };
|
|
6531
6679
|
}
|
|
6532
6680
|
connect(dataCallback, reconnectCallback, changedCallback, disconnectCallback) {
|
|
6533
|
-
return
|
|
6681
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6682
|
+
yield new Promise((resolve, reject) => this.listen(dataCallback, reconnectCallback, changedCallback, disconnectCallback, resolve, reject));
|
|
6534
6683
|
this._initialized = true;
|
|
6535
6684
|
});
|
|
6536
6685
|
}
|
|
6537
6686
|
disconnect() {
|
|
6538
|
-
return __awaiter(this,
|
|
6687
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6539
6688
|
var _a;
|
|
6540
|
-
(_a = this._logger) === null || _a ===
|
|
6689
|
+
(_a = this._logger) === null || _a === undefined ? undefined : _a.debug('Disconnecting gRPC sync connection');
|
|
6541
6690
|
closeStreamIfDefined(this._syncStream);
|
|
6542
6691
|
this._syncClient.close();
|
|
6543
6692
|
});
|
|
6544
6693
|
}
|
|
6545
6694
|
listen(dataCallback, reconnectCallback, changedCallback, disconnectCallback, resolveConnect, rejectConnect) {
|
|
6546
6695
|
var _a;
|
|
6547
|
-
(_a = this._logger) === null || _a ===
|
|
6696
|
+
(_a = this._logger) === null || _a === undefined ? undefined : _a.debug('Starting gRPC sync connection');
|
|
6548
6697
|
closeStreamIfDefined(this._syncStream);
|
|
6549
6698
|
try {
|
|
6550
6699
|
this._syncStream = this._syncClient.syncFlags(this._request);
|
|
@@ -6580,12 +6729,12 @@ class GrpcFetch {
|
|
|
6580
6729
|
}
|
|
6581
6730
|
handleError(err, dataCallback, reconnectCallback, changedCallback, disconnectCallback, rejectConnect) {
|
|
6582
6731
|
var _a, _b, _c;
|
|
6583
|
-
(_a = this._logger) === null || _a ===
|
|
6584
|
-
(_b = this._logger) === null || _b ===
|
|
6732
|
+
(_a = this._logger) === null || _a === undefined ? undefined : _a.error('Connection error, attempting to reconnect');
|
|
6733
|
+
(_b = this._logger) === null || _b === undefined ? undefined : _b.debug(err);
|
|
6585
6734
|
this._isConnected = false;
|
|
6586
|
-
const errorMessage = (_c = err === null || err ===
|
|
6735
|
+
const errorMessage = (_c = err === null || err === undefined ? undefined : err.message) !== null && _c !== undefined ? _c : 'Failed to connect to syncFlags stream';
|
|
6587
6736
|
disconnectCallback(errorMessage);
|
|
6588
|
-
rejectConnect === null || rejectConnect ===
|
|
6737
|
+
rejectConnect === null || rejectConnect === undefined ? undefined : rejectConnect(new serverSdk.GeneralError(errorMessage));
|
|
6589
6738
|
this.reconnect(dataCallback, reconnectCallback, changedCallback, disconnectCallback);
|
|
6590
6739
|
}
|
|
6591
6740
|
reconnect(dataCallback, reconnectCallback, changedCallback, disconnectCallback) {
|
|
@@ -6596,60 +6745,6 @@ class GrpcFetch {
|
|
|
6596
6745
|
}
|
|
6597
6746
|
}
|
|
6598
6747
|
|
|
6599
|
-
const encoding = 'utf8';
|
|
6600
|
-
class FileFetch {
|
|
6601
|
-
constructor(filename, logger) {
|
|
6602
|
-
this._filename = filename;
|
|
6603
|
-
this._logger = logger;
|
|
6604
|
-
}
|
|
6605
|
-
connect(dataFillCallback, _, changedCallback) {
|
|
6606
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6607
|
-
var _a, _b;
|
|
6608
|
-
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.debug('Starting file sync connection');
|
|
6609
|
-
try {
|
|
6610
|
-
const output = yield fs.promises.readFile(this._filename, encoding);
|
|
6611
|
-
// Don't emit the change event for the initial read
|
|
6612
|
-
dataFillCallback(output);
|
|
6613
|
-
// Using watchFile instead of watch to support virtualized host file systems.
|
|
6614
|
-
fs.watchFile(this._filename, () => __awaiter(this, void 0, void 0, function* () {
|
|
6615
|
-
var _c;
|
|
6616
|
-
try {
|
|
6617
|
-
const data = yield fs.promises.readFile(this._filename, encoding);
|
|
6618
|
-
const changes = dataFillCallback(data);
|
|
6619
|
-
if (changes.length > 0) {
|
|
6620
|
-
changedCallback(changes);
|
|
6621
|
-
}
|
|
6622
|
-
}
|
|
6623
|
-
catch (err) {
|
|
6624
|
-
(_c = this._logger) === null || _c === void 0 ? void 0 : _c.error(`Error reading file: ${err}`);
|
|
6625
|
-
}
|
|
6626
|
-
}));
|
|
6627
|
-
}
|
|
6628
|
-
catch (err) {
|
|
6629
|
-
if (err instanceof core.OpenFeatureError) {
|
|
6630
|
-
throw err;
|
|
6631
|
-
}
|
|
6632
|
-
else {
|
|
6633
|
-
switch (err === null || err === void 0 ? void 0 : err.code) {
|
|
6634
|
-
case 'ENOENT':
|
|
6635
|
-
throw new core.GeneralError(`File not found: ${this._filename}`);
|
|
6636
|
-
case 'EACCES':
|
|
6637
|
-
throw new core.GeneralError(`File not accessible: ${this._filename}`);
|
|
6638
|
-
default:
|
|
6639
|
-
(_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug(`Error reading file: ${err}`);
|
|
6640
|
-
throw new core.GeneralError();
|
|
6641
|
-
}
|
|
6642
|
-
}
|
|
6643
|
-
}
|
|
6644
|
-
});
|
|
6645
|
-
}
|
|
6646
|
-
disconnect() {
|
|
6647
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6648
|
-
fs.unwatchFile(this._filename);
|
|
6649
|
-
});
|
|
6650
|
-
}
|
|
6651
|
-
}
|
|
6652
|
-
|
|
6653
6748
|
class InProcessService {
|
|
6654
6749
|
constructor(config, dataFetcher, logger) {
|
|
6655
6750
|
this.config = config;
|
|
@@ -6664,39 +6759,37 @@ class InProcessService {
|
|
|
6664
6759
|
return this._dataFetcher.connect(this.setFlagConfiguration.bind(this), reconnectCallback, changedCallback, disconnectCallback);
|
|
6665
6760
|
}
|
|
6666
6761
|
disconnect() {
|
|
6667
|
-
return __awaiter(this,
|
|
6762
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6668
6763
|
this._dataFetcher.disconnect();
|
|
6669
6764
|
});
|
|
6670
6765
|
}
|
|
6671
6766
|
resolveBoolean(flagKey, defaultValue, context, logger) {
|
|
6672
|
-
return __awaiter(this,
|
|
6767
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6673
6768
|
return this.evaluate('boolean', flagKey, defaultValue, context, logger);
|
|
6674
6769
|
});
|
|
6675
6770
|
}
|
|
6676
6771
|
resolveNumber(flagKey, defaultValue, context, logger) {
|
|
6677
|
-
return __awaiter(this,
|
|
6772
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6678
6773
|
return this.evaluate('number', flagKey, defaultValue, context, logger);
|
|
6679
6774
|
});
|
|
6680
6775
|
}
|
|
6681
6776
|
resolveString(flagKey, defaultValue, context, logger) {
|
|
6682
|
-
return __awaiter(this,
|
|
6777
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6683
6778
|
return this.evaluate('string', flagKey, defaultValue, context, logger);
|
|
6684
6779
|
});
|
|
6685
6780
|
}
|
|
6686
6781
|
resolveObject(flagKey, defaultValue, context, logger) {
|
|
6687
|
-
return __awaiter(this,
|
|
6782
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6688
6783
|
return this.evaluate('object', flagKey, defaultValue, context, logger);
|
|
6689
6784
|
});
|
|
6690
6785
|
}
|
|
6691
6786
|
evaluate(type, flagKey, defaultValue, context, logger) {
|
|
6692
|
-
const
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
addFlagMetadata() {
|
|
6699
|
-
return Object.assign({}, (this.config.selector ? { scope: this.config.selector } : {}));
|
|
6787
|
+
const resolution = this._flagdCore.resolve(type, flagKey, defaultValue, context, logger);
|
|
6788
|
+
// Add selector as scope if not already present in flag metadata
|
|
6789
|
+
if (this.config.selector && !resolution.flagMetadata['scope']) {
|
|
6790
|
+
return Object.assign(Object.assign({}, resolution), { flagMetadata: Object.assign(Object.assign({}, resolution.flagMetadata), { scope: this.config.selector }) });
|
|
6791
|
+
}
|
|
6792
|
+
return resolution;
|
|
6700
6793
|
}
|
|
6701
6794
|
/**
|
|
6702
6795
|
* Sets the flag configuration
|
|
@@ -6710,12 +6803,6 @@ class InProcessService {
|
|
|
6710
6803
|
}
|
|
6711
6804
|
|
|
6712
6805
|
class FlagdProvider {
|
|
6713
|
-
get status() {
|
|
6714
|
-
return this._status;
|
|
6715
|
-
}
|
|
6716
|
-
get events() {
|
|
6717
|
-
return this._events;
|
|
6718
|
-
}
|
|
6719
6806
|
/**
|
|
6720
6807
|
* Construct a new flagd provider.
|
|
6721
6808
|
*
|
|
@@ -6726,16 +6813,10 @@ class FlagdProvider {
|
|
|
6726
6813
|
constructor(options, logger, service) {
|
|
6727
6814
|
this.logger = logger;
|
|
6728
6815
|
this.metadata = {
|
|
6729
|
-
name: 'flagd
|
|
6816
|
+
name: 'flagd',
|
|
6730
6817
|
};
|
|
6731
6818
|
this.runsOn = 'server';
|
|
6732
|
-
this.
|
|
6733
|
-
this._events = new serverSdk.OpenFeatureEventEmitter();
|
|
6734
|
-
this.logRejected = (err, flagKey, logger) => {
|
|
6735
|
-
logger.error(`Error resolving flag ${flagKey}: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
6736
|
-
logger.error(err === null || err === void 0 ? void 0 : err.stack);
|
|
6737
|
-
throw err;
|
|
6738
|
-
};
|
|
6819
|
+
this.events = new serverSdk.OpenFeatureEventEmitter();
|
|
6739
6820
|
const config = getConfig(options);
|
|
6740
6821
|
this._service = service
|
|
6741
6822
|
? service
|
|
@@ -6744,56 +6825,44 @@ class FlagdProvider {
|
|
|
6744
6825
|
: new GRPCService(config, undefined, logger);
|
|
6745
6826
|
}
|
|
6746
6827
|
initialize() {
|
|
6747
|
-
return this
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.debug(err);
|
|
6759
|
-
throw err;
|
|
6828
|
+
return __awaiter(this, undefined, undefined, function* () {
|
|
6829
|
+
var _a, _b, _c;
|
|
6830
|
+
try {
|
|
6831
|
+
yield this._service.connect(this.handleReconnect.bind(this), this.handleChanged.bind(this), this.handleError.bind(this));
|
|
6832
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug(`${this.metadata.name}: ready`);
|
|
6833
|
+
}
|
|
6834
|
+
catch (err) {
|
|
6835
|
+
(_b = this.logger) === null || _b === undefined ? undefined : _b.error(`${this.metadata.name}: error during initialization: ${err === null || err === undefined ? undefined : err.message}`);
|
|
6836
|
+
(_c = this.logger) === null || _c === undefined ? undefined : _c.debug(err);
|
|
6837
|
+
throw err;
|
|
6838
|
+
}
|
|
6760
6839
|
});
|
|
6761
6840
|
}
|
|
6762
6841
|
onClose() {
|
|
6763
6842
|
var _a;
|
|
6764
|
-
(_a = this.logger) === null || _a ===
|
|
6843
|
+
(_a = this.logger) === null || _a === undefined ? undefined : _a.debug(`${this.metadata.name}: shutting down`);
|
|
6765
6844
|
return this._service.disconnect();
|
|
6766
6845
|
}
|
|
6767
6846
|
resolveBooleanEvaluation(flagKey, defaultValue, transformedContext, logger) {
|
|
6768
|
-
return this._service
|
|
6769
|
-
.resolveBoolean(flagKey, defaultValue, transformedContext, logger)
|
|
6770
|
-
.catch((err) => this.logRejected(err, flagKey, logger));
|
|
6847
|
+
return this._service.resolveBoolean(flagKey, defaultValue, transformedContext, logger);
|
|
6771
6848
|
}
|
|
6772
6849
|
resolveStringEvaluation(flagKey, defaultValue, transformedContext, logger) {
|
|
6773
|
-
return this._service
|
|
6774
|
-
.resolveString(flagKey, defaultValue, transformedContext, logger)
|
|
6775
|
-
.catch((err) => this.logRejected(err, flagKey, logger));
|
|
6850
|
+
return this._service.resolveString(flagKey, defaultValue, transformedContext, logger);
|
|
6776
6851
|
}
|
|
6777
6852
|
resolveNumberEvaluation(flagKey, defaultValue, transformedContext, logger) {
|
|
6778
|
-
return this._service
|
|
6779
|
-
.resolveNumber(flagKey, defaultValue, transformedContext, logger)
|
|
6780
|
-
.catch((err) => this.logRejected(err, flagKey, logger));
|
|
6853
|
+
return this._service.resolveNumber(flagKey, defaultValue, transformedContext, logger);
|
|
6781
6854
|
}
|
|
6782
6855
|
resolveObjectEvaluation(flagKey, defaultValue, transformedContext, logger) {
|
|
6783
|
-
return this._service
|
|
6784
|
-
.resolveObject(flagKey, defaultValue, transformedContext, logger)
|
|
6785
|
-
.catch((err) => this.logRejected(err, flagKey, logger));
|
|
6856
|
+
return this._service.resolveObject(flagKey, defaultValue, transformedContext, logger);
|
|
6786
6857
|
}
|
|
6787
6858
|
handleReconnect() {
|
|
6788
|
-
this.
|
|
6789
|
-
this._events.emit(serverSdk.ProviderEvents.Ready);
|
|
6859
|
+
this.events.emit(serverSdk.ProviderEvents.Ready);
|
|
6790
6860
|
}
|
|
6791
6861
|
handleError(message) {
|
|
6792
|
-
this.
|
|
6793
|
-
this._events.emit(serverSdk.ProviderEvents.Error, { message });
|
|
6862
|
+
this.events.emit(serverSdk.ProviderEvents.Error, { message });
|
|
6794
6863
|
}
|
|
6795
6864
|
handleChanged(flagsChanged) {
|
|
6796
|
-
this.
|
|
6865
|
+
this.events.emit(serverSdk.ProviderEvents.ConfigurationChanged, { flagsChanged });
|
|
6797
6866
|
}
|
|
6798
6867
|
}
|
|
6799
6868
|
|