@waku/rln 0.1.7 → 0.1.8-3545a8e.0
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/bundle/_virtual/__node-resolve_empty.js +2 -2
- package/bundle/_virtual/assert.js +3 -0
- package/bundle/_virtual/assert2.js +3 -0
- package/bundle/_virtual/browser2.js +3 -0
- package/bundle/_virtual/errors-browser.js +3 -0
- package/bundle/_virtual/errors.js +3 -0
- package/bundle/_virtual/events.js +3 -0
- package/bundle/_virtual/index3.js +3 -0
- package/bundle/_virtual/index4.js +3 -0
- package/bundle/_virtual/index5.js +3 -0
- package/bundle/_virtual/index6.js +3 -0
- package/bundle/_virtual/index7.js +3 -0
- package/bundle/_virtual/index8.js +3 -0
- package/bundle/_virtual/index9.js +3 -0
- package/bundle/_virtual/readable-browser.js +3 -0
- package/bundle/_virtual/string_decoder.js +3 -0
- package/bundle/_virtual/types2.js +3 -0
- package/bundle/_virtual/util.js +3 -0
- package/bundle/_virtual/utils.js +2 -2
- package/bundle/_virtual/utils2.js +2 -2
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/_sha2.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/hmac.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/pbkdf2.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/scrypt.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha256.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha512.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/utils.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
- package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
- package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
- package/bundle/node_modules/@noble/hashes/esm/utils.js +1 -8
- package/bundle/node_modules/assert/build/assert.js +569 -0
- package/bundle/node_modules/assert/build/internal/assert/assertion_error.js +455 -0
- package/bundle/node_modules/assert/build/internal/errors.js +174 -0
- package/bundle/node_modules/assert/build/internal/util/comparisons.js +585 -0
- package/bundle/node_modules/available-typed-arrays/index.js +20 -0
- package/bundle/node_modules/b4a/browser.js +589 -0
- package/bundle/node_modules/b4a/lib/ascii.js +33 -0
- package/bundle/node_modules/b4a/lib/base64.js +65 -0
- package/bundle/node_modules/b4a/lib/hex.js +53 -0
- package/bundle/node_modules/b4a/lib/utf16le.js +42 -0
- package/bundle/node_modules/b4a/lib/utf8.js +147 -0
- package/bundle/node_modules/base64-js/index.js +152 -0
- package/bundle/node_modules/blake-hash/lib/api/blake.js +3 -0
- package/bundle/node_modules/blake-hash/lib/blake.js +74 -0
- package/bundle/node_modules/blake-hash/lib/blake224.js +4 -0
- package/bundle/node_modules/blake-hash/lib/blake256.js +4 -0
- package/bundle/node_modules/blake-hash/lib/blake384.js +4 -0
- package/bundle/node_modules/blake-hash/lib/blake512.js +4 -0
- package/bundle/node_modules/blake2b/index.js +327 -0
- package/bundle/node_modules/blake2b-wasm/blake2b.js +44 -0
- package/bundle/node_modules/blake2b-wasm/index.js +143 -0
- package/bundle/node_modules/bn.js/lib/bn.js +2 -2
- package/bundle/node_modules/buffer/index.js +1823 -0
- package/bundle/node_modules/call-bind/callBound.js +18 -0
- package/bundle/node_modules/call-bind/index.js +35 -0
- package/bundle/node_modules/call-bind-apply-helpers/actualApply.js +15 -0
- package/bundle/node_modules/call-bind-apply-helpers/applyBind.js +14 -0
- package/bundle/node_modules/call-bind-apply-helpers/functionApply.js +13 -0
- package/bundle/node_modules/call-bind-apply-helpers/functionCall.js +13 -0
- package/bundle/node_modules/call-bind-apply-helpers/index.js +20 -0
- package/bundle/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/bundle/node_modules/call-bound/index.js +22 -0
- package/bundle/node_modules/circomlibjs/src/poseidon_constants.js +208 -0
- package/bundle/node_modules/circomlibjs/src/poseidon_constants_opt.js +24808 -0
- package/bundle/node_modules/circomlibjs/src/poseidon_gencontract.js +10 -0
- package/bundle/node_modules/circomlibjs/src/poseidon_wasm.js +433 -0
- package/bundle/node_modules/define-data-property/index.js +61 -0
- package/bundle/node_modules/define-properties/index.js +60 -0
- package/bundle/node_modules/dunder-proto/get.js +42 -0
- package/bundle/node_modules/es-define-property/index.js +14 -0
- package/bundle/node_modules/es-errors/eval.js +4 -0
- package/bundle/node_modules/es-errors/index.js +4 -0
- package/bundle/node_modules/es-errors/range.js +4 -0
- package/bundle/node_modules/es-errors/ref.js +4 -0
- package/bundle/node_modules/es-errors/syntax.js +4 -0
- package/bundle/node_modules/es-errors/type.js +4 -0
- package/bundle/node_modules/es-errors/uri.js +4 -0
- package/bundle/node_modules/es-object-atoms/index.js +4 -0
- package/bundle/node_modules/events/events.js +479 -0
- package/bundle/node_modules/ffjavascript/build/browser.esm.js +16533 -0
- package/bundle/node_modules/for-each/index.js +71 -0
- package/bundle/node_modules/function-bind/implementation.js +93 -0
- package/bundle/node_modules/function-bind/index.js +16 -0
- package/bundle/node_modules/get-intrinsic/index.js +404 -0
- package/bundle/node_modules/get-proto/Object.getPrototypeOf.js +17 -0
- package/bundle/node_modules/get-proto/Reflect.getPrototypeOf.js +13 -0
- package/bundle/node_modules/get-proto/index.js +40 -0
- package/bundle/node_modules/gopd/gOPD.js +4 -0
- package/bundle/node_modules/gopd/index.js +17 -0
- package/bundle/node_modules/has-property-descriptors/index.js +24 -0
- package/bundle/node_modules/has-symbols/index.js +25 -0
- package/bundle/node_modules/has-symbols/shams.js +45 -0
- package/bundle/node_modules/has-tostringtag/shams.js +10 -0
- package/bundle/node_modules/hasown/index.js +19 -0
- package/bundle/node_modules/ieee754/index.js +90 -0
- package/bundle/node_modules/is-arguments/index.js +47 -0
- package/bundle/node_modules/is-callable/index.js +101 -0
- package/bundle/node_modules/is-generator-function/index.js +52 -0
- package/bundle/node_modules/is-nan/implementation.js +16 -0
- package/bundle/node_modules/is-nan/index.js +35 -0
- package/bundle/node_modules/is-nan/polyfill.js +21 -0
- package/bundle/node_modules/is-nan/shim.js +28 -0
- package/bundle/node_modules/is-regex/index.js +74 -0
- package/bundle/node_modules/is-typed-array/index.js +10 -0
- package/bundle/node_modules/math-intrinsics/abs.js +4 -0
- package/bundle/node_modules/math-intrinsics/floor.js +4 -0
- package/bundle/node_modules/math-intrinsics/isNaN.js +6 -0
- package/bundle/node_modules/math-intrinsics/max.js +4 -0
- package/bundle/node_modules/math-intrinsics/min.js +4 -0
- package/bundle/node_modules/math-intrinsics/pow.js +4 -0
- package/bundle/node_modules/math-intrinsics/round.js +4 -0
- package/bundle/node_modules/math-intrinsics/sign.js +13 -0
- package/bundle/node_modules/nanoassert/index.js +20 -0
- package/bundle/node_modules/object-is/implementation.js +18 -0
- package/bundle/node_modules/object-is/index.js +33 -0
- package/bundle/node_modules/object-is/polyfill.js +9 -0
- package/bundle/node_modules/object-is/shim.js +26 -0
- package/bundle/node_modules/object-keys/implementation.js +133 -0
- package/bundle/node_modules/object-keys/index.js +35 -0
- package/bundle/node_modules/object-keys/isArguments.js +17 -0
- package/bundle/node_modules/object.assign/implementation.js +51 -0
- package/bundle/node_modules/object.assign/polyfill.js +57 -0
- package/bundle/node_modules/possible-typed-array-names/index.js +17 -0
- package/bundle/node_modules/readable-stream/errors-browser.js +129 -0
- package/bundle/node_modules/readable-stream/lib/_stream_duplex.js +113 -0
- package/bundle/node_modules/readable-stream/lib/_stream_passthrough.js +15 -0
- package/bundle/node_modules/readable-stream/lib/_stream_readable.js +1032 -0
- package/bundle/node_modules/readable-stream/lib/_stream_transform.js +132 -0
- package/bundle/node_modules/readable-stream/lib/_stream_writable.js +629 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/async_iterator.js +191 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/buffer_list.js +196 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/from-browser.js +13 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/pipeline.js +87 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/state.js +25 -0
- package/bundle/node_modules/readable-stream/lib/internal/streams/stream-browser.js +5 -0
- package/bundle/node_modules/readable-stream/readable-browser.js +24 -0
- package/bundle/node_modules/safe-buffer/index.js +81 -0
- package/bundle/node_modules/safe-regex-test/index.js +21 -0
- package/bundle/node_modules/set-function-length/index.js +48 -0
- package/bundle/node_modules/string_decoder/lib/string_decoder.js +285 -0
- package/bundle/node_modules/util/support/isBufferBrowser.js +8 -0
- package/bundle/node_modules/util/support/types.js +338 -0
- package/bundle/node_modules/util/util.js +721 -0
- package/bundle/node_modules/util-deprecate/browser.js +70 -0
- package/bundle/node_modules/which-typed-array/index.js +126 -0
- package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +0 -3
- package/bundle/packages/core/dist/lib/connection_manager/dialer.js +0 -3
- package/bundle/packages/core/dist/lib/connection_manager/discovery_dialer.js +0 -3
- package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +0 -3
- package/bundle/packages/core/dist/lib/connection_manager/shard_reader.js +0 -3
- package/bundle/packages/core/dist/lib/message/version_0.js +32 -11
- package/bundle/packages/core/dist/lib/store/store.js +0 -3
- package/bundle/packages/rln/dist/codec.js +4 -5
- package/bundle/packages/rln/dist/contract/rln_base_contract.js +0 -3
- package/bundle/packages/rln/dist/contract/rln_contract.js +0 -3
- package/bundle/packages/rln/dist/credentials_manager.js +18 -16
- package/bundle/packages/rln/dist/keystore/keystore.js +0 -3
- package/bundle/packages/rln/dist/message.js +0 -3
- package/bundle/packages/rln/dist/rln.js +2 -5
- package/bundle/packages/rln/dist/utils/epoch.js +0 -3
- package/bundle/packages/rln/dist/utils/pure_poseidon.js +37 -0
- package/bundle/packages/utils/dist/bytes/index.js +1 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/codec.d.ts +2 -1
- package/dist/codec.js +4 -2
- package/dist/codec.js.map +1 -1
- package/dist/codec.test-utils.d.ts +1 -0
- package/dist/codec.test-utils.js +6 -1
- package/dist/codec.test-utils.js.map +1 -1
- package/dist/credentials_manager.js +18 -13
- package/dist/credentials_manager.js.map +1 -1
- package/dist/rln.d.ts +2 -2
- package/dist/rln.js +2 -2
- package/dist/rln.js.map +1 -1
- package/dist/utils/pure_poseidon.d.ts +7 -0
- package/dist/utils/pure_poseidon.js +26 -0
- package/dist/utils/pure_poseidon.js.map +1 -0
- package/package.json +1 -93
- package/src/codec.test-utils.ts +9 -1
- package/src/codec.ts +7 -3
- package/src/credentials_manager.ts +24 -18
- package/src/rln.ts +4 -2
- package/src/utils/pure_poseidon.ts +32 -0
- package/bundle/node_modules/@noble/hashes/esm/hmac.js +0 -88
- package/bundle/node_modules/@noble/hashes/esm/sha256.js +0 -16
- package/bundle/packages/interfaces/dist/constants.js +0 -6
- package/bundle/packages/utils/dist/common/sharding/index.js +0 -91
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import { __module as assert } from '../../../_virtual/assert2.js';
|
|
2
|
+
import { __require as requireErrors } from './internal/errors.js';
|
|
3
|
+
import { __require as requireAssertion_error } from './internal/assert/assertion_error.js';
|
|
4
|
+
import '../../util/util.js';
|
|
5
|
+
import { p as polyfill } from '../../object.assign/polyfill.js';
|
|
6
|
+
import { p as polyfill$1 } from '../../object-is/polyfill.js';
|
|
7
|
+
import { c as callBound } from '../../call-bind/callBound.js';
|
|
8
|
+
import { __require as requireComparisons } from './internal/util/comparisons.js';
|
|
9
|
+
import { __exports as util } from '../../../_virtual/util.js';
|
|
10
|
+
|
|
11
|
+
var hasRequiredAssert;
|
|
12
|
+
|
|
13
|
+
function requireAssert () {
|
|
14
|
+
if (hasRequiredAssert) return assert.exports;
|
|
15
|
+
hasRequiredAssert = 1;
|
|
16
|
+
|
|
17
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
+
var _require = requireErrors(),
|
|
21
|
+
_require$codes = _require.codes,
|
|
22
|
+
ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
|
|
23
|
+
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
|
24
|
+
ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
|
|
25
|
+
ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
|
|
26
|
+
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
|
|
27
|
+
var AssertionError = requireAssertion_error();
|
|
28
|
+
var _require2 = util,
|
|
29
|
+
inspect = _require2.inspect;
|
|
30
|
+
var _require$types = util.types,
|
|
31
|
+
isPromise = _require$types.isPromise,
|
|
32
|
+
isRegExp = _require$types.isRegExp;
|
|
33
|
+
var objectAssign = polyfill();
|
|
34
|
+
var objectIs = polyfill$1();
|
|
35
|
+
var RegExpPrototypeTest = callBound('RegExp.prototype.test');
|
|
36
|
+
var isDeepEqual;
|
|
37
|
+
var isDeepStrictEqual;
|
|
38
|
+
function lazyLoadComparison() {
|
|
39
|
+
var comparison = requireComparisons();
|
|
40
|
+
isDeepEqual = comparison.isDeepEqual;
|
|
41
|
+
isDeepStrictEqual = comparison.isDeepStrictEqual;
|
|
42
|
+
}
|
|
43
|
+
var warned = false;
|
|
44
|
+
|
|
45
|
+
// The assert module provides functions that throw
|
|
46
|
+
// AssertionError's when particular conditions are not met. The
|
|
47
|
+
// assert module must conform to the following interface.
|
|
48
|
+
|
|
49
|
+
var assert$1 = assert.exports = ok;
|
|
50
|
+
var NO_EXCEPTION_SENTINEL = {};
|
|
51
|
+
|
|
52
|
+
// All of the following functions must throw an AssertionError
|
|
53
|
+
// when a corresponding condition is not met, with a message that
|
|
54
|
+
// may be undefined if not provided. All assertion methods provide
|
|
55
|
+
// both the actual and expected values to the assertion error for
|
|
56
|
+
// display purposes.
|
|
57
|
+
|
|
58
|
+
function innerFail(obj) {
|
|
59
|
+
if (obj.message instanceof Error) throw obj.message;
|
|
60
|
+
throw new AssertionError(obj);
|
|
61
|
+
}
|
|
62
|
+
function fail(actual, expected, message, operator, stackStartFn) {
|
|
63
|
+
var argsLen = arguments.length;
|
|
64
|
+
var internalMessage;
|
|
65
|
+
if (argsLen === 0) {
|
|
66
|
+
internalMessage = 'Failed';
|
|
67
|
+
} else if (argsLen === 1) {
|
|
68
|
+
message = actual;
|
|
69
|
+
actual = undefined;
|
|
70
|
+
} else {
|
|
71
|
+
if (warned === false) {
|
|
72
|
+
warned = true;
|
|
73
|
+
var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);
|
|
74
|
+
warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');
|
|
75
|
+
}
|
|
76
|
+
if (argsLen === 2) operator = '!=';
|
|
77
|
+
}
|
|
78
|
+
if (message instanceof Error) throw message;
|
|
79
|
+
var errArgs = {
|
|
80
|
+
actual: actual,
|
|
81
|
+
expected: expected,
|
|
82
|
+
operator: operator === undefined ? 'fail' : operator,
|
|
83
|
+
stackStartFn: stackStartFn || fail
|
|
84
|
+
};
|
|
85
|
+
if (message !== undefined) {
|
|
86
|
+
errArgs.message = message;
|
|
87
|
+
}
|
|
88
|
+
var err = new AssertionError(errArgs);
|
|
89
|
+
if (internalMessage) {
|
|
90
|
+
err.message = internalMessage;
|
|
91
|
+
err.generatedMessage = true;
|
|
92
|
+
}
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
95
|
+
assert$1.fail = fail;
|
|
96
|
+
|
|
97
|
+
// The AssertionError is defined in internal/error.
|
|
98
|
+
assert$1.AssertionError = AssertionError;
|
|
99
|
+
function innerOk(fn, argLen, value, message) {
|
|
100
|
+
if (!value) {
|
|
101
|
+
var generatedMessage = false;
|
|
102
|
+
if (argLen === 0) {
|
|
103
|
+
generatedMessage = true;
|
|
104
|
+
message = 'No value argument passed to `assert.ok()`';
|
|
105
|
+
} else if (message instanceof Error) {
|
|
106
|
+
throw message;
|
|
107
|
+
}
|
|
108
|
+
var err = new AssertionError({
|
|
109
|
+
actual: value,
|
|
110
|
+
expected: true,
|
|
111
|
+
message: message,
|
|
112
|
+
operator: '==',
|
|
113
|
+
stackStartFn: fn
|
|
114
|
+
});
|
|
115
|
+
err.generatedMessage = generatedMessage;
|
|
116
|
+
throw err;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Pure assertion tests whether a value is truthy, as determined
|
|
121
|
+
// by !!value.
|
|
122
|
+
function ok() {
|
|
123
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
124
|
+
args[_key] = arguments[_key];
|
|
125
|
+
}
|
|
126
|
+
innerOk.apply(void 0, [ok, args.length].concat(args));
|
|
127
|
+
}
|
|
128
|
+
assert$1.ok = ok;
|
|
129
|
+
|
|
130
|
+
// The equality assertion tests shallow, coercive equality with ==.
|
|
131
|
+
/* eslint-disable no-restricted-properties */
|
|
132
|
+
assert$1.equal = function equal(actual, expected, message) {
|
|
133
|
+
if (arguments.length < 2) {
|
|
134
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
135
|
+
}
|
|
136
|
+
// eslint-disable-next-line eqeqeq
|
|
137
|
+
if (actual != expected) {
|
|
138
|
+
innerFail({
|
|
139
|
+
actual: actual,
|
|
140
|
+
expected: expected,
|
|
141
|
+
message: message,
|
|
142
|
+
operator: '==',
|
|
143
|
+
stackStartFn: equal
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// The non-equality assertion tests for whether two objects are not
|
|
149
|
+
// equal with !=.
|
|
150
|
+
assert$1.notEqual = function notEqual(actual, expected, message) {
|
|
151
|
+
if (arguments.length < 2) {
|
|
152
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
153
|
+
}
|
|
154
|
+
// eslint-disable-next-line eqeqeq
|
|
155
|
+
if (actual == expected) {
|
|
156
|
+
innerFail({
|
|
157
|
+
actual: actual,
|
|
158
|
+
expected: expected,
|
|
159
|
+
message: message,
|
|
160
|
+
operator: '!=',
|
|
161
|
+
stackStartFn: notEqual
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// The equivalence assertion tests a deep equality relation.
|
|
167
|
+
assert$1.deepEqual = function deepEqual(actual, expected, message) {
|
|
168
|
+
if (arguments.length < 2) {
|
|
169
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
170
|
+
}
|
|
171
|
+
if (isDeepEqual === undefined) lazyLoadComparison();
|
|
172
|
+
if (!isDeepEqual(actual, expected)) {
|
|
173
|
+
innerFail({
|
|
174
|
+
actual: actual,
|
|
175
|
+
expected: expected,
|
|
176
|
+
message: message,
|
|
177
|
+
operator: 'deepEqual',
|
|
178
|
+
stackStartFn: deepEqual
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// The non-equivalence assertion tests for any deep inequality.
|
|
184
|
+
assert$1.notDeepEqual = function notDeepEqual(actual, expected, message) {
|
|
185
|
+
if (arguments.length < 2) {
|
|
186
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
187
|
+
}
|
|
188
|
+
if (isDeepEqual === undefined) lazyLoadComparison();
|
|
189
|
+
if (isDeepEqual(actual, expected)) {
|
|
190
|
+
innerFail({
|
|
191
|
+
actual: actual,
|
|
192
|
+
expected: expected,
|
|
193
|
+
message: message,
|
|
194
|
+
operator: 'notDeepEqual',
|
|
195
|
+
stackStartFn: notDeepEqual
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
/* eslint-enable */
|
|
200
|
+
|
|
201
|
+
assert$1.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
|
|
202
|
+
if (arguments.length < 2) {
|
|
203
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
204
|
+
}
|
|
205
|
+
if (isDeepEqual === undefined) lazyLoadComparison();
|
|
206
|
+
if (!isDeepStrictEqual(actual, expected)) {
|
|
207
|
+
innerFail({
|
|
208
|
+
actual: actual,
|
|
209
|
+
expected: expected,
|
|
210
|
+
message: message,
|
|
211
|
+
operator: 'deepStrictEqual',
|
|
212
|
+
stackStartFn: deepStrictEqual
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
assert$1.notDeepStrictEqual = notDeepStrictEqual;
|
|
217
|
+
function notDeepStrictEqual(actual, expected, message) {
|
|
218
|
+
if (arguments.length < 2) {
|
|
219
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
220
|
+
}
|
|
221
|
+
if (isDeepEqual === undefined) lazyLoadComparison();
|
|
222
|
+
if (isDeepStrictEqual(actual, expected)) {
|
|
223
|
+
innerFail({
|
|
224
|
+
actual: actual,
|
|
225
|
+
expected: expected,
|
|
226
|
+
message: message,
|
|
227
|
+
operator: 'notDeepStrictEqual',
|
|
228
|
+
stackStartFn: notDeepStrictEqual
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
assert$1.strictEqual = function strictEqual(actual, expected, message) {
|
|
233
|
+
if (arguments.length < 2) {
|
|
234
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
235
|
+
}
|
|
236
|
+
if (!objectIs(actual, expected)) {
|
|
237
|
+
innerFail({
|
|
238
|
+
actual: actual,
|
|
239
|
+
expected: expected,
|
|
240
|
+
message: message,
|
|
241
|
+
operator: 'strictEqual',
|
|
242
|
+
stackStartFn: strictEqual
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
assert$1.notStrictEqual = function notStrictEqual(actual, expected, message) {
|
|
247
|
+
if (arguments.length < 2) {
|
|
248
|
+
throw new ERR_MISSING_ARGS('actual', 'expected');
|
|
249
|
+
}
|
|
250
|
+
if (objectIs(actual, expected)) {
|
|
251
|
+
innerFail({
|
|
252
|
+
actual: actual,
|
|
253
|
+
expected: expected,
|
|
254
|
+
message: message,
|
|
255
|
+
operator: 'notStrictEqual',
|
|
256
|
+
stackStartFn: notStrictEqual
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
var Comparison = /*#__PURE__*/_createClass(function Comparison(obj, keys, actual) {
|
|
261
|
+
var _this = this;
|
|
262
|
+
_classCallCheck(this, Comparison);
|
|
263
|
+
keys.forEach(function (key) {
|
|
264
|
+
if (key in obj) {
|
|
265
|
+
if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && RegExpPrototypeTest(obj[key], actual[key])) {
|
|
266
|
+
_this[key] = actual[key];
|
|
267
|
+
} else {
|
|
268
|
+
_this[key] = obj[key];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
function compareExceptionKey(actual, expected, key, message, keys, fn) {
|
|
274
|
+
if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
|
|
275
|
+
if (!message) {
|
|
276
|
+
// Create placeholder objects to create a nice output.
|
|
277
|
+
var a = new Comparison(actual, keys);
|
|
278
|
+
var b = new Comparison(expected, keys, actual);
|
|
279
|
+
var err = new AssertionError({
|
|
280
|
+
actual: a,
|
|
281
|
+
expected: b,
|
|
282
|
+
operator: 'deepStrictEqual',
|
|
283
|
+
stackStartFn: fn
|
|
284
|
+
});
|
|
285
|
+
err.actual = actual;
|
|
286
|
+
err.expected = expected;
|
|
287
|
+
err.operator = fn.name;
|
|
288
|
+
throw err;
|
|
289
|
+
}
|
|
290
|
+
innerFail({
|
|
291
|
+
actual: actual,
|
|
292
|
+
expected: expected,
|
|
293
|
+
message: message,
|
|
294
|
+
operator: fn.name,
|
|
295
|
+
stackStartFn: fn
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function expectedException(actual, expected, msg, fn) {
|
|
300
|
+
if (typeof expected !== 'function') {
|
|
301
|
+
if (isRegExp(expected)) return RegExpPrototypeTest(expected, actual);
|
|
302
|
+
// assert.doesNotThrow does not accept objects.
|
|
303
|
+
if (arguments.length === 2) {
|
|
304
|
+
throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Handle primitives properly.
|
|
308
|
+
if (_typeof(actual) !== 'object' || actual === null) {
|
|
309
|
+
var err = new AssertionError({
|
|
310
|
+
actual: actual,
|
|
311
|
+
expected: expected,
|
|
312
|
+
message: msg,
|
|
313
|
+
operator: 'deepStrictEqual',
|
|
314
|
+
stackStartFn: fn
|
|
315
|
+
});
|
|
316
|
+
err.operator = fn.name;
|
|
317
|
+
throw err;
|
|
318
|
+
}
|
|
319
|
+
var keys = Object.keys(expected);
|
|
320
|
+
// Special handle errors to make sure the name and the message are compared
|
|
321
|
+
// as well.
|
|
322
|
+
if (expected instanceof Error) {
|
|
323
|
+
keys.push('name', 'message');
|
|
324
|
+
} else if (keys.length === 0) {
|
|
325
|
+
throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');
|
|
326
|
+
}
|
|
327
|
+
if (isDeepEqual === undefined) lazyLoadComparison();
|
|
328
|
+
keys.forEach(function (key) {
|
|
329
|
+
if (typeof actual[key] === 'string' && isRegExp(expected[key]) && RegExpPrototypeTest(expected[key], actual[key])) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
compareExceptionKey(actual, expected, key, msg, keys, fn);
|
|
333
|
+
});
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
// Guard instanceof against arrow functions as they don't have a prototype.
|
|
337
|
+
if (expected.prototype !== undefined && actual instanceof expected) {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
if (Error.isPrototypeOf(expected)) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return expected.call({}, actual) === true;
|
|
344
|
+
}
|
|
345
|
+
function getActual(fn) {
|
|
346
|
+
if (typeof fn !== 'function') {
|
|
347
|
+
throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
fn();
|
|
351
|
+
} catch (e) {
|
|
352
|
+
return e;
|
|
353
|
+
}
|
|
354
|
+
return NO_EXCEPTION_SENTINEL;
|
|
355
|
+
}
|
|
356
|
+
function checkIsPromise(obj) {
|
|
357
|
+
// Accept native ES6 promises and promises that are implemented in a similar
|
|
358
|
+
// way. Do not accept thenables that use a function as `obj` and that have no
|
|
359
|
+
// `catch` handler.
|
|
360
|
+
|
|
361
|
+
// TODO: thenables are checked up until they have the correct methods,
|
|
362
|
+
// but according to documentation, the `then` method should receive
|
|
363
|
+
// the `fulfill` and `reject` arguments as well or it may be never resolved.
|
|
364
|
+
|
|
365
|
+
return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';
|
|
366
|
+
}
|
|
367
|
+
function waitForActual(promiseFn) {
|
|
368
|
+
return Promise.resolve().then(function () {
|
|
369
|
+
var resultPromise;
|
|
370
|
+
if (typeof promiseFn === 'function') {
|
|
371
|
+
// Return a rejected promise if `promiseFn` throws synchronously.
|
|
372
|
+
resultPromise = promiseFn();
|
|
373
|
+
// Fail in case no promise is returned.
|
|
374
|
+
if (!checkIsPromise(resultPromise)) {
|
|
375
|
+
throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);
|
|
376
|
+
}
|
|
377
|
+
} else if (checkIsPromise(promiseFn)) {
|
|
378
|
+
resultPromise = promiseFn;
|
|
379
|
+
} else {
|
|
380
|
+
throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);
|
|
381
|
+
}
|
|
382
|
+
return Promise.resolve().then(function () {
|
|
383
|
+
return resultPromise;
|
|
384
|
+
}).then(function () {
|
|
385
|
+
return NO_EXCEPTION_SENTINEL;
|
|
386
|
+
}).catch(function (e) {
|
|
387
|
+
return e;
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function expectsError(stackStartFn, actual, error, message) {
|
|
392
|
+
if (typeof error === 'string') {
|
|
393
|
+
if (arguments.length === 4) {
|
|
394
|
+
throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
|
|
395
|
+
}
|
|
396
|
+
if (_typeof(actual) === 'object' && actual !== null) {
|
|
397
|
+
if (actual.message === error) {
|
|
398
|
+
throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message."));
|
|
399
|
+
}
|
|
400
|
+
} else if (actual === error) {
|
|
401
|
+
throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message."));
|
|
402
|
+
}
|
|
403
|
+
message = error;
|
|
404
|
+
error = undefined;
|
|
405
|
+
} else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {
|
|
406
|
+
throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
|
|
407
|
+
}
|
|
408
|
+
if (actual === NO_EXCEPTION_SENTINEL) {
|
|
409
|
+
var details = '';
|
|
410
|
+
if (error && error.name) {
|
|
411
|
+
details += " (".concat(error.name, ")");
|
|
412
|
+
}
|
|
413
|
+
details += message ? ": ".concat(message) : '.';
|
|
414
|
+
var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';
|
|
415
|
+
innerFail({
|
|
416
|
+
actual: undefined,
|
|
417
|
+
expected: error,
|
|
418
|
+
operator: stackStartFn.name,
|
|
419
|
+
message: "Missing expected ".concat(fnType).concat(details),
|
|
420
|
+
stackStartFn: stackStartFn
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
if (error && !expectedException(actual, error, message, stackStartFn)) {
|
|
424
|
+
throw actual;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function expectsNoError(stackStartFn, actual, error, message) {
|
|
428
|
+
if (actual === NO_EXCEPTION_SENTINEL) return;
|
|
429
|
+
if (typeof error === 'string') {
|
|
430
|
+
message = error;
|
|
431
|
+
error = undefined;
|
|
432
|
+
}
|
|
433
|
+
if (!error || expectedException(actual, error)) {
|
|
434
|
+
var details = message ? ": ".concat(message) : '.';
|
|
435
|
+
var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';
|
|
436
|
+
innerFail({
|
|
437
|
+
actual: actual,
|
|
438
|
+
expected: error,
|
|
439
|
+
operator: stackStartFn.name,
|
|
440
|
+
message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""),
|
|
441
|
+
stackStartFn: stackStartFn
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
throw actual;
|
|
445
|
+
}
|
|
446
|
+
assert$1.throws = function throws(promiseFn) {
|
|
447
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
448
|
+
args[_key2 - 1] = arguments[_key2];
|
|
449
|
+
}
|
|
450
|
+
expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
|
|
451
|
+
};
|
|
452
|
+
assert$1.rejects = function rejects(promiseFn) {
|
|
453
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
454
|
+
args[_key3 - 1] = arguments[_key3];
|
|
455
|
+
}
|
|
456
|
+
return waitForActual(promiseFn).then(function (result) {
|
|
457
|
+
return expectsError.apply(void 0, [rejects, result].concat(args));
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
assert$1.doesNotThrow = function doesNotThrow(fn) {
|
|
461
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
462
|
+
args[_key4 - 1] = arguments[_key4];
|
|
463
|
+
}
|
|
464
|
+
expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
|
|
465
|
+
};
|
|
466
|
+
assert$1.doesNotReject = function doesNotReject(fn) {
|
|
467
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
468
|
+
args[_key5 - 1] = arguments[_key5];
|
|
469
|
+
}
|
|
470
|
+
return waitForActual(fn).then(function (result) {
|
|
471
|
+
return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
assert$1.ifError = function ifError(err) {
|
|
475
|
+
if (err !== null && err !== undefined) {
|
|
476
|
+
var message = 'ifError got unwanted exception: ';
|
|
477
|
+
if (_typeof(err) === 'object' && typeof err.message === 'string') {
|
|
478
|
+
if (err.message.length === 0 && err.constructor) {
|
|
479
|
+
message += err.constructor.name;
|
|
480
|
+
} else {
|
|
481
|
+
message += err.message;
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
message += inspect(err);
|
|
485
|
+
}
|
|
486
|
+
var newErr = new AssertionError({
|
|
487
|
+
actual: err,
|
|
488
|
+
expected: null,
|
|
489
|
+
operator: 'ifError',
|
|
490
|
+
message: message,
|
|
491
|
+
stackStartFn: ifError
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
// Make sure we actually have a stack trace!
|
|
495
|
+
var origStack = err.stack;
|
|
496
|
+
if (typeof origStack === 'string') {
|
|
497
|
+
// This will remove any duplicated frames from the error frames taken
|
|
498
|
+
// from within `ifError` and add the original error frames to the newly
|
|
499
|
+
// created ones.
|
|
500
|
+
var tmp2 = origStack.split('\n');
|
|
501
|
+
tmp2.shift();
|
|
502
|
+
// Filter all frames existing in err.stack.
|
|
503
|
+
var tmp1 = newErr.stack.split('\n');
|
|
504
|
+
for (var i = 0; i < tmp2.length; i++) {
|
|
505
|
+
// Find the first occurrence of the frame.
|
|
506
|
+
var pos = tmp1.indexOf(tmp2[i]);
|
|
507
|
+
if (pos !== -1) {
|
|
508
|
+
// Only keep new frames.
|
|
509
|
+
tmp1 = tmp1.slice(0, pos);
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n'));
|
|
514
|
+
}
|
|
515
|
+
throw newErr;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
// Currently in sync with Node.js lib/assert.js
|
|
520
|
+
// https://github.com/nodejs/node/commit/2a871df3dfb8ea663ef5e1f8f62701ec51384ecb
|
|
521
|
+
function internalMatch(string, regexp, message, fn, fnName) {
|
|
522
|
+
if (!isRegExp(regexp)) {
|
|
523
|
+
throw new ERR_INVALID_ARG_TYPE('regexp', 'RegExp', regexp);
|
|
524
|
+
}
|
|
525
|
+
var match = fnName === 'match';
|
|
526
|
+
if (typeof string !== 'string' || RegExpPrototypeTest(regexp, string) !== match) {
|
|
527
|
+
if (message instanceof Error) {
|
|
528
|
+
throw message;
|
|
529
|
+
}
|
|
530
|
+
var generatedMessage = !message;
|
|
531
|
+
|
|
532
|
+
// 'The input was expected to not match the regular expression ' +
|
|
533
|
+
message = message || (typeof string !== 'string' ? 'The "string" argument must be of type string. Received type ' + "".concat(_typeof(string), " (").concat(inspect(string), ")") : (match ? 'The input did not match the regular expression ' : 'The input was expected to not match the regular expression ') + "".concat(inspect(regexp), ". Input:\n\n").concat(inspect(string), "\n"));
|
|
534
|
+
var err = new AssertionError({
|
|
535
|
+
actual: string,
|
|
536
|
+
expected: regexp,
|
|
537
|
+
message: message,
|
|
538
|
+
operator: fnName,
|
|
539
|
+
stackStartFn: fn
|
|
540
|
+
});
|
|
541
|
+
err.generatedMessage = generatedMessage;
|
|
542
|
+
throw err;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
assert$1.match = function match(string, regexp, message) {
|
|
546
|
+
internalMatch(string, regexp, message, match, 'match');
|
|
547
|
+
};
|
|
548
|
+
assert$1.doesNotMatch = function doesNotMatch(string, regexp, message) {
|
|
549
|
+
internalMatch(string, regexp, message, doesNotMatch, 'doesNotMatch');
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
// Expose a strict only variant of assert
|
|
553
|
+
function strict() {
|
|
554
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
555
|
+
args[_key6] = arguments[_key6];
|
|
556
|
+
}
|
|
557
|
+
innerOk.apply(void 0, [strict, args.length].concat(args));
|
|
558
|
+
}
|
|
559
|
+
assert$1.strict = objectAssign(strict, assert$1, {
|
|
560
|
+
equal: assert$1.strictEqual,
|
|
561
|
+
deepEqual: assert$1.deepStrictEqual,
|
|
562
|
+
notEqual: assert$1.notStrictEqual,
|
|
563
|
+
notDeepEqual: assert$1.notDeepStrictEqual
|
|
564
|
+
});
|
|
565
|
+
assert$1.strict.strict = assert$1.strict;
|
|
566
|
+
return assert.exports;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export { requireAssert as __require };
|