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