@dimo-network/data-sdk 1.3.2 → 1.4.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/README.md +49 -2
- package/dist/api/resources/Attestation/index.js +23 -6
- package/dist/api/resources/DimoRestResources.d.ts +2 -2
- package/dist/api/resources/DimoRestResources.js +2 -2
- package/dist/api/resources/{VehicleEvents → VehicleTriggers}/index.d.ts +2 -2
- package/dist/api/resources/{VehicleEvents → VehicleTriggers}/index.js +13 -19
- package/dist/cjs/index.js +555 -507
- package/dist/cjs/index.js.map +1 -1
- package/dist/dimo.d.ts +2 -2
- package/dist/dimo.js +3 -3
- package/dist/environments/index.d.ts +2 -2
- package/dist/environments/index.js +2 -2
- package/dist/esm/index.js +555 -507
- package/dist/esm/index.js.map +1 -1
- package/dist/types/api/resources/DimoRestResources.d.ts +2 -2
- package/dist/types/api/resources/{VehicleEvents → VehicleTriggers}/index.d.ts +2 -2
- package/dist/types/dimo.d.ts +2 -2
- package/dist/types/environments/index.d.ts +2 -2
- package/package.json +4 -5
package/dist/cjs/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var http = require('http');
|
|
|
7
7
|
var https = require('https');
|
|
8
8
|
var Url = require('url');
|
|
9
9
|
var require$$6 = require('fs');
|
|
10
|
-
var
|
|
10
|
+
var crypto$2 = require('crypto');
|
|
11
11
|
var require$$4 = require('assert');
|
|
12
12
|
var require$$1$3 = require('tty');
|
|
13
13
|
var require$$0$2 = require('os');
|
|
@@ -28,7 +28,6 @@ function bind(fn, thisArg) {
|
|
|
28
28
|
|
|
29
29
|
const {toString} = Object.prototype;
|
|
30
30
|
const {getPrototypeOf} = Object;
|
|
31
|
-
const {iterator, toStringTag} = Symbol;
|
|
32
31
|
|
|
33
32
|
const kindOf = (cache => thing => {
|
|
34
33
|
const str = toString.call(thing);
|
|
@@ -155,28 +154,7 @@ const isPlainObject = (val) => {
|
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
const prototype = getPrototypeOf(val);
|
|
158
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Determine if a value is an empty object (safely handles Buffers)
|
|
163
|
-
*
|
|
164
|
-
* @param {*} val The value to test
|
|
165
|
-
*
|
|
166
|
-
* @returns {boolean} True if value is an empty object, otherwise false
|
|
167
|
-
*/
|
|
168
|
-
const isEmptyObject = (val) => {
|
|
169
|
-
// Early return for non-objects or Buffers to prevent RangeError
|
|
170
|
-
if (!isObject$1(val) || isBuffer(val)) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
try {
|
|
175
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
176
|
-
} catch (e) {
|
|
177
|
-
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
157
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
180
158
|
};
|
|
181
159
|
|
|
182
160
|
/**
|
|
@@ -301,11 +279,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
301
279
|
fn.call(null, obj[i], i, obj);
|
|
302
280
|
}
|
|
303
281
|
} else {
|
|
304
|
-
// Buffer check
|
|
305
|
-
if (isBuffer(obj)) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
282
|
// Iterate over object keys
|
|
310
283
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
311
284
|
const len = keys.length;
|
|
@@ -319,10 +292,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
319
292
|
}
|
|
320
293
|
|
|
321
294
|
function findKey(obj, key) {
|
|
322
|
-
if (isBuffer(obj)){
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
295
|
key = key.toLowerCase();
|
|
327
296
|
const keys = Object.keys(obj);
|
|
328
297
|
let i = keys.length;
|
|
@@ -536,13 +505,13 @@ const isTypedArray = (TypedArray => {
|
|
|
536
505
|
* @returns {void}
|
|
537
506
|
*/
|
|
538
507
|
const forEachEntry = (obj, fn) => {
|
|
539
|
-
const generator = obj && obj[iterator];
|
|
508
|
+
const generator = obj && obj[Symbol.iterator];
|
|
540
509
|
|
|
541
|
-
const
|
|
510
|
+
const iterator = generator.call(obj);
|
|
542
511
|
|
|
543
512
|
let result;
|
|
544
513
|
|
|
545
|
-
while ((result =
|
|
514
|
+
while ((result = iterator.next()) && !result.done) {
|
|
546
515
|
const pair = result.value;
|
|
547
516
|
fn.call(obj, pair[0], pair[1]);
|
|
548
517
|
}
|
|
@@ -663,7 +632,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
663
632
|
* @returns {boolean}
|
|
664
633
|
*/
|
|
665
634
|
function isSpecCompliantForm(thing) {
|
|
666
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
635
|
+
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
667
636
|
}
|
|
668
637
|
|
|
669
638
|
const toJSONObject = (obj) => {
|
|
@@ -676,11 +645,6 @@ const toJSONObject = (obj) => {
|
|
|
676
645
|
return;
|
|
677
646
|
}
|
|
678
647
|
|
|
679
|
-
//Buffer check
|
|
680
|
-
if (isBuffer(source)) {
|
|
681
|
-
return source;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
648
|
if(!('toJSON' in source)) {
|
|
685
649
|
stack[i] = source;
|
|
686
650
|
const target = isArray(source) ? [] : {};
|
|
@@ -737,10 +701,6 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
737
701
|
|
|
738
702
|
// *********************
|
|
739
703
|
|
|
740
|
-
|
|
741
|
-
const isIterable$1 = (thing) => thing != null && isFunction(thing[iterator]);
|
|
742
|
-
|
|
743
|
-
|
|
744
704
|
var utils$4 = {
|
|
745
705
|
isArray,
|
|
746
706
|
isArrayBuffer,
|
|
@@ -752,7 +712,6 @@ var utils$4 = {
|
|
|
752
712
|
isBoolean: isBoolean$1,
|
|
753
713
|
isObject: isObject$1,
|
|
754
714
|
isPlainObject,
|
|
755
|
-
isEmptyObject,
|
|
756
715
|
isReadableStream,
|
|
757
716
|
isRequest: isRequest$1,
|
|
758
717
|
isResponse,
|
|
@@ -797,8 +756,7 @@ var utils$4 = {
|
|
|
797
756
|
isAsyncFn,
|
|
798
757
|
isThenable,
|
|
799
758
|
setImmediate: _setImmediate,
|
|
800
|
-
asap
|
|
801
|
-
isIterable: isIterable$1
|
|
759
|
+
asap
|
|
802
760
|
};
|
|
803
761
|
|
|
804
762
|
/**
|
|
@@ -910,11 +868,7 @@ function getAugmentedNamespace(n) {
|
|
|
910
868
|
var f = n.default;
|
|
911
869
|
if (typeof f == "function") {
|
|
912
870
|
var a = function a () {
|
|
913
|
-
|
|
914
|
-
try {
|
|
915
|
-
isInstance = this instanceof a;
|
|
916
|
-
} catch {}
|
|
917
|
-
if (isInstance) {
|
|
871
|
+
if (this instanceof a) {
|
|
918
872
|
return Reflect.construct(f, arguments, this.constructor);
|
|
919
873
|
}
|
|
920
874
|
return f.apply(this, arguments);
|
|
@@ -13635,7 +13589,7 @@ function requireGetIntrinsic () {
|
|
|
13635
13589
|
if (!allowMissing) {
|
|
13636
13590
|
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
13637
13591
|
}
|
|
13638
|
-
return void
|
|
13592
|
+
return void 0;
|
|
13639
13593
|
}
|
|
13640
13594
|
if ($gOPD && (i + 1) >= parts.length) {
|
|
13641
13595
|
var desc = $gOPD(value, part);
|
|
@@ -13733,11 +13687,12 @@ var hasRequiredPopulate;
|
|
|
13733
13687
|
function requirePopulate () {
|
|
13734
13688
|
if (hasRequiredPopulate) return populate;
|
|
13735
13689
|
hasRequiredPopulate = 1;
|
|
13736
|
-
|
|
13737
13690
|
// populates missing values
|
|
13738
|
-
populate = function
|
|
13739
|
-
|
|
13740
|
-
|
|
13691
|
+
populate = function(dst, src) {
|
|
13692
|
+
|
|
13693
|
+
Object.keys(src).forEach(function(prop)
|
|
13694
|
+
{
|
|
13695
|
+
dst[prop] = dst[prop] || src[prop];
|
|
13741
13696
|
});
|
|
13742
13697
|
|
|
13743
13698
|
return dst;
|
|
@@ -13751,7 +13706,6 @@ var hasRequiredForm_data;
|
|
|
13751
13706
|
function requireForm_data () {
|
|
13752
13707
|
if (hasRequiredForm_data) return form_data;
|
|
13753
13708
|
hasRequiredForm_data = 1;
|
|
13754
|
-
|
|
13755
13709
|
var CombinedStream = requireCombined_stream();
|
|
13756
13710
|
var util = require$$1$1;
|
|
13757
13711
|
var path = require$$1$2;
|
|
@@ -13760,20 +13714,24 @@ function requireForm_data () {
|
|
|
13760
13714
|
var parseUrl = Url.parse;
|
|
13761
13715
|
var fs = require$$6;
|
|
13762
13716
|
var Stream$1 = Stream.Stream;
|
|
13763
|
-
var crypto = require$$8;
|
|
13764
13717
|
var mime = requireMimeTypes();
|
|
13765
13718
|
var asynckit = requireAsynckit();
|
|
13766
13719
|
var setToStringTag = /*@__PURE__*/ requireEsSetTostringtag();
|
|
13767
|
-
var hasOwn = /*@__PURE__*/ requireHasown();
|
|
13768
13720
|
var populate = requirePopulate();
|
|
13769
13721
|
|
|
13722
|
+
// Public API
|
|
13723
|
+
form_data = FormData;
|
|
13724
|
+
|
|
13725
|
+
// make it a Stream
|
|
13726
|
+
util.inherits(FormData, CombinedStream);
|
|
13727
|
+
|
|
13770
13728
|
/**
|
|
13771
13729
|
* Create readable "multipart/form-data" streams.
|
|
13772
13730
|
* Can be used to submit forms
|
|
13773
13731
|
* and file uploads to other web applications.
|
|
13774
13732
|
*
|
|
13775
13733
|
* @constructor
|
|
13776
|
-
* @param {
|
|
13734
|
+
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
|
13777
13735
|
*/
|
|
13778
13736
|
function FormData(options) {
|
|
13779
13737
|
if (!(this instanceof FormData)) {
|
|
@@ -13786,39 +13744,35 @@ function requireForm_data () {
|
|
|
13786
13744
|
|
|
13787
13745
|
CombinedStream.call(this);
|
|
13788
13746
|
|
|
13789
|
-
options = options || {};
|
|
13790
|
-
for (var option in options) {
|
|
13747
|
+
options = options || {};
|
|
13748
|
+
for (var option in options) {
|
|
13791
13749
|
this[option] = options[option];
|
|
13792
13750
|
}
|
|
13793
13751
|
}
|
|
13794
13752
|
|
|
13795
|
-
// make it a Stream
|
|
13796
|
-
util.inherits(FormData, CombinedStream);
|
|
13797
|
-
|
|
13798
13753
|
FormData.LINE_BREAK = '\r\n';
|
|
13799
13754
|
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
|
13800
13755
|
|
|
13801
|
-
FormData.prototype.append = function
|
|
13802
|
-
|
|
13756
|
+
FormData.prototype.append = function(field, value, options) {
|
|
13757
|
+
|
|
13758
|
+
options = options || {};
|
|
13803
13759
|
|
|
13804
13760
|
// allow filename as single option
|
|
13805
|
-
if (typeof options
|
|
13806
|
-
options = {
|
|
13761
|
+
if (typeof options == 'string') {
|
|
13762
|
+
options = {filename: options};
|
|
13807
13763
|
}
|
|
13808
13764
|
|
|
13809
13765
|
var append = CombinedStream.prototype.append.bind(this);
|
|
13810
13766
|
|
|
13811
13767
|
// all that streamy business can't handle numbers
|
|
13812
|
-
if (typeof value
|
|
13813
|
-
value =
|
|
13768
|
+
if (typeof value == 'number') {
|
|
13769
|
+
value = '' + value;
|
|
13814
13770
|
}
|
|
13815
13771
|
|
|
13816
13772
|
// https://github.com/felixge/node-form-data/issues/38
|
|
13817
13773
|
if (Array.isArray(value)) {
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
* the way web server expects it
|
|
13821
|
-
*/
|
|
13774
|
+
// Please convert your array into string
|
|
13775
|
+
// the way web server expects it
|
|
13822
13776
|
this._error(new Error('Arrays are not supported.'));
|
|
13823
13777
|
return;
|
|
13824
13778
|
}
|
|
@@ -13834,17 +13788,15 @@ function requireForm_data () {
|
|
|
13834
13788
|
this._trackLength(header, value, options);
|
|
13835
13789
|
};
|
|
13836
13790
|
|
|
13837
|
-
FormData.prototype._trackLength = function
|
|
13791
|
+
FormData.prototype._trackLength = function(header, value, options) {
|
|
13838
13792
|
var valueLength = 0;
|
|
13839
13793
|
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
* incoming file to finish to get its size.
|
|
13845
|
-
*/
|
|
13794
|
+
// used w/ getLengthSync(), when length is known.
|
|
13795
|
+
// e.g. for streaming directly from a remote server,
|
|
13796
|
+
// w/ a known file a size, and not wanting to wait for
|
|
13797
|
+
// incoming file to finish to get its size.
|
|
13846
13798
|
if (options.knownLength != null) {
|
|
13847
|
-
valueLength +=
|
|
13799
|
+
valueLength += +options.knownLength;
|
|
13848
13800
|
} else if (Buffer.isBuffer(value)) {
|
|
13849
13801
|
valueLength = value.length;
|
|
13850
13802
|
} else if (typeof value === 'string') {
|
|
@@ -13854,10 +13806,12 @@ function requireForm_data () {
|
|
|
13854
13806
|
this._valueLength += valueLength;
|
|
13855
13807
|
|
|
13856
13808
|
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
|
13857
|
-
this._overheadLength +=
|
|
13809
|
+
this._overheadLength +=
|
|
13810
|
+
Buffer.byteLength(header) +
|
|
13811
|
+
FormData.LINE_BREAK.length;
|
|
13858
13812
|
|
|
13859
13813
|
// empty or either doesn't have path or not an http response or not a stream
|
|
13860
|
-
if (!value || (!value.path && !(value.readable &&
|
|
13814
|
+
if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream$1))) {
|
|
13861
13815
|
return;
|
|
13862
13816
|
}
|
|
13863
13817
|
|
|
@@ -13867,8 +13821,9 @@ function requireForm_data () {
|
|
|
13867
13821
|
}
|
|
13868
13822
|
};
|
|
13869
13823
|
|
|
13870
|
-
FormData.prototype._lengthRetriever = function
|
|
13871
|
-
if (
|
|
13824
|
+
FormData.prototype._lengthRetriever = function(value, callback) {
|
|
13825
|
+
if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
|
|
13826
|
+
|
|
13872
13827
|
// take read range into a account
|
|
13873
13828
|
// `end` = Infinity –> read file till the end
|
|
13874
13829
|
//
|
|
@@ -13877,52 +13832,54 @@ function requireForm_data () {
|
|
|
13877
13832
|
// Fix it when node fixes it.
|
|
13878
13833
|
// https://github.com/joyent/node/issues/7819
|
|
13879
13834
|
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
|
13835
|
+
|
|
13880
13836
|
// when end specified
|
|
13881
13837
|
// no need to calculate range
|
|
13882
13838
|
// inclusive, starts with 0
|
|
13883
|
-
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
13839
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
13884
13840
|
|
|
13885
|
-
|
|
13841
|
+
// not that fast snoopy
|
|
13886
13842
|
} else {
|
|
13887
13843
|
// still need to fetch file size from fs
|
|
13888
|
-
fs.stat(value.path, function
|
|
13844
|
+
fs.stat(value.path, function(err, stat) {
|
|
13845
|
+
|
|
13846
|
+
var fileSize;
|
|
13847
|
+
|
|
13889
13848
|
if (err) {
|
|
13890
13849
|
callback(err);
|
|
13891
13850
|
return;
|
|
13892
13851
|
}
|
|
13893
13852
|
|
|
13894
13853
|
// update final size based on the range options
|
|
13895
|
-
|
|
13854
|
+
fileSize = stat.size - (value.start ? value.start : 0);
|
|
13896
13855
|
callback(null, fileSize);
|
|
13897
13856
|
});
|
|
13898
13857
|
}
|
|
13899
13858
|
|
|
13900
|
-
|
|
13901
|
-
} else if (
|
|
13902
|
-
callback(null,
|
|
13859
|
+
// or http response
|
|
13860
|
+
} else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
|
13861
|
+
callback(null, +value.headers['content-length']);
|
|
13903
13862
|
|
|
13904
|
-
|
|
13905
|
-
} else if (
|
|
13863
|
+
// or request stream http://github.com/mikeal/request
|
|
13864
|
+
} else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
|
|
13906
13865
|
// wait till response come back
|
|
13907
|
-
value.on('response', function
|
|
13866
|
+
value.on('response', function(response) {
|
|
13908
13867
|
value.pause();
|
|
13909
|
-
callback(null,
|
|
13868
|
+
callback(null, +response.headers['content-length']);
|
|
13910
13869
|
});
|
|
13911
13870
|
value.resume();
|
|
13912
13871
|
|
|
13913
|
-
|
|
13872
|
+
// something else
|
|
13914
13873
|
} else {
|
|
13915
|
-
callback('Unknown stream');
|
|
13874
|
+
callback('Unknown stream');
|
|
13916
13875
|
}
|
|
13917
13876
|
};
|
|
13918
13877
|
|
|
13919
|
-
FormData.prototype._multiPartHeader = function
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
*/
|
|
13925
|
-
if (typeof options.header === 'string') {
|
|
13878
|
+
FormData.prototype._multiPartHeader = function(field, value, options) {
|
|
13879
|
+
// custom header specified (as string)?
|
|
13880
|
+
// it becomes responsible for boundary
|
|
13881
|
+
// (e.g. to handle extra CRLFs on .NET servers)
|
|
13882
|
+
if (typeof options.header == 'string') {
|
|
13926
13883
|
return options.header;
|
|
13927
13884
|
}
|
|
13928
13885
|
|
|
@@ -13930,7 +13887,7 @@ function requireForm_data () {
|
|
|
13930
13887
|
var contentType = this._getContentType(value, options);
|
|
13931
13888
|
|
|
13932
13889
|
var contents = '';
|
|
13933
|
-
var headers
|
|
13890
|
+
var headers = {
|
|
13934
13891
|
// add custom disposition as third element or keep it two elements if not
|
|
13935
13892
|
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
13936
13893
|
// if no content type. allow it to be empty array
|
|
@@ -13938,18 +13895,18 @@ function requireForm_data () {
|
|
|
13938
13895
|
};
|
|
13939
13896
|
|
|
13940
13897
|
// allow custom headers.
|
|
13941
|
-
if (typeof options.header
|
|
13898
|
+
if (typeof options.header == 'object') {
|
|
13942
13899
|
populate(headers, options.header);
|
|
13943
13900
|
}
|
|
13944
13901
|
|
|
13945
13902
|
var header;
|
|
13946
|
-
for (var prop in headers) {
|
|
13947
|
-
if (
|
|
13903
|
+
for (var prop in headers) {
|
|
13904
|
+
if (Object.prototype.hasOwnProperty.call(headers, prop)) {
|
|
13948
13905
|
header = headers[prop];
|
|
13949
13906
|
|
|
13950
13907
|
// skip nullish headers.
|
|
13951
13908
|
if (header == null) {
|
|
13952
|
-
continue;
|
|
13909
|
+
continue;
|
|
13953
13910
|
}
|
|
13954
13911
|
|
|
13955
13912
|
// convert all headers to arrays.
|
|
@@ -13967,45 +13924,49 @@ function requireForm_data () {
|
|
|
13967
13924
|
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
|
13968
13925
|
};
|
|
13969
13926
|
|
|
13970
|
-
FormData.prototype._getContentDisposition = function
|
|
13971
|
-
|
|
13927
|
+
FormData.prototype._getContentDisposition = function(value, options) {
|
|
13928
|
+
|
|
13929
|
+
var filename
|
|
13930
|
+
, contentDisposition
|
|
13931
|
+
;
|
|
13972
13932
|
|
|
13973
13933
|
if (typeof options.filepath === 'string') {
|
|
13974
13934
|
// custom filepath for relative paths
|
|
13975
13935
|
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
|
13976
|
-
} else if (options.filename ||
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
filename = path.basename(options.filename || (value && (value.name || value.path)));
|
|
13983
|
-
} else if (value && value.readable && hasOwn(value, 'httpVersion')) {
|
|
13936
|
+
} else if (options.filename || value.name || value.path) {
|
|
13937
|
+
// custom filename take precedence
|
|
13938
|
+
// formidable and the browser add a name property
|
|
13939
|
+
// fs- and request- streams have path property
|
|
13940
|
+
filename = path.basename(options.filename || value.name || value.path);
|
|
13941
|
+
} else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
|
13984
13942
|
// or try http response
|
|
13985
13943
|
filename = path.basename(value.client._httpMessage.path || '');
|
|
13986
13944
|
}
|
|
13987
13945
|
|
|
13988
13946
|
if (filename) {
|
|
13989
|
-
|
|
13947
|
+
contentDisposition = 'filename="' + filename + '"';
|
|
13990
13948
|
}
|
|
13949
|
+
|
|
13950
|
+
return contentDisposition;
|
|
13991
13951
|
};
|
|
13992
13952
|
|
|
13993
|
-
FormData.prototype._getContentType = function
|
|
13953
|
+
FormData.prototype._getContentType = function(value, options) {
|
|
13954
|
+
|
|
13994
13955
|
// use custom content-type above all
|
|
13995
13956
|
var contentType = options.contentType;
|
|
13996
13957
|
|
|
13997
13958
|
// or try `name` from formidable, browser
|
|
13998
|
-
if (!contentType && value
|
|
13959
|
+
if (!contentType && value.name) {
|
|
13999
13960
|
contentType = mime.lookup(value.name);
|
|
14000
13961
|
}
|
|
14001
13962
|
|
|
14002
13963
|
// or try `path` from fs-, request- streams
|
|
14003
|
-
if (!contentType && value
|
|
13964
|
+
if (!contentType && value.path) {
|
|
14004
13965
|
contentType = mime.lookup(value.path);
|
|
14005
13966
|
}
|
|
14006
13967
|
|
|
14007
13968
|
// or if it's http-reponse
|
|
14008
|
-
if (!contentType && value
|
|
13969
|
+
if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
|
14009
13970
|
contentType = value.headers['content-type'];
|
|
14010
13971
|
}
|
|
14011
13972
|
|
|
@@ -14015,18 +13976,18 @@ function requireForm_data () {
|
|
|
14015
13976
|
}
|
|
14016
13977
|
|
|
14017
13978
|
// fallback to the default content type if `value` is not simple value
|
|
14018
|
-
if (!contentType &&
|
|
13979
|
+
if (!contentType && typeof value == 'object') {
|
|
14019
13980
|
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
|
14020
13981
|
}
|
|
14021
13982
|
|
|
14022
13983
|
return contentType;
|
|
14023
13984
|
};
|
|
14024
13985
|
|
|
14025
|
-
FormData.prototype._multiPartFooter = function
|
|
14026
|
-
return function
|
|
13986
|
+
FormData.prototype._multiPartFooter = function() {
|
|
13987
|
+
return function(next) {
|
|
14027
13988
|
var footer = FormData.LINE_BREAK;
|
|
14028
13989
|
|
|
14029
|
-
var lastPart = this._streams.length === 0;
|
|
13990
|
+
var lastPart = (this._streams.length === 0);
|
|
14030
13991
|
if (lastPart) {
|
|
14031
13992
|
footer += this._lastBoundary();
|
|
14032
13993
|
}
|
|
@@ -14035,18 +13996,18 @@ function requireForm_data () {
|
|
|
14035
13996
|
}.bind(this);
|
|
14036
13997
|
};
|
|
14037
13998
|
|
|
14038
|
-
FormData.prototype._lastBoundary = function
|
|
13999
|
+
FormData.prototype._lastBoundary = function() {
|
|
14039
14000
|
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
|
14040
14001
|
};
|
|
14041
14002
|
|
|
14042
|
-
FormData.prototype.getHeaders = function
|
|
14003
|
+
FormData.prototype.getHeaders = function(userHeaders) {
|
|
14043
14004
|
var header;
|
|
14044
14005
|
var formHeaders = {
|
|
14045
14006
|
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
|
14046
14007
|
};
|
|
14047
14008
|
|
|
14048
|
-
for (header in userHeaders) {
|
|
14049
|
-
if (
|
|
14009
|
+
for (header in userHeaders) {
|
|
14010
|
+
if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
|
|
14050
14011
|
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
14051
14012
|
}
|
|
14052
14013
|
}
|
|
@@ -14054,14 +14015,11 @@ function requireForm_data () {
|
|
|
14054
14015
|
return formHeaders;
|
|
14055
14016
|
};
|
|
14056
14017
|
|
|
14057
|
-
FormData.prototype.setBoundary = function
|
|
14058
|
-
if (typeof boundary !== 'string') {
|
|
14059
|
-
throw new TypeError('FormData boundary must be a string');
|
|
14060
|
-
}
|
|
14018
|
+
FormData.prototype.setBoundary = function(boundary) {
|
|
14061
14019
|
this._boundary = boundary;
|
|
14062
14020
|
};
|
|
14063
14021
|
|
|
14064
|
-
FormData.prototype.getBoundary = function
|
|
14022
|
+
FormData.prototype.getBoundary = function() {
|
|
14065
14023
|
if (!this._boundary) {
|
|
14066
14024
|
this._generateBoundary();
|
|
14067
14025
|
}
|
|
@@ -14069,55 +14027,60 @@ function requireForm_data () {
|
|
|
14069
14027
|
return this._boundary;
|
|
14070
14028
|
};
|
|
14071
14029
|
|
|
14072
|
-
FormData.prototype.getBuffer = function
|
|
14073
|
-
var dataBuffer = new Buffer.alloc(0);
|
|
14030
|
+
FormData.prototype.getBuffer = function() {
|
|
14031
|
+
var dataBuffer = new Buffer.alloc(0);
|
|
14074
14032
|
var boundary = this.getBoundary();
|
|
14075
14033
|
|
|
14076
14034
|
// Create the form content. Add Line breaks to the end of data.
|
|
14077
14035
|
for (var i = 0, len = this._streams.length; i < len; i++) {
|
|
14078
14036
|
if (typeof this._streams[i] !== 'function') {
|
|
14037
|
+
|
|
14079
14038
|
// Add content to the buffer.
|
|
14080
|
-
if
|
|
14081
|
-
dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
|
|
14082
|
-
}
|
|
14083
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
|
|
14039
|
+
if(Buffer.isBuffer(this._streams[i])) {
|
|
14040
|
+
dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
|
|
14041
|
+
}else {
|
|
14042
|
+
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
|
|
14084
14043
|
}
|
|
14085
14044
|
|
|
14086
14045
|
// Add break after content.
|
|
14087
|
-
if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
|
|
14088
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]);
|
|
14046
|
+
if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
|
|
14047
|
+
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
|
|
14089
14048
|
}
|
|
14090
14049
|
}
|
|
14091
14050
|
}
|
|
14092
14051
|
|
|
14093
14052
|
// Add the footer and return the Buffer object.
|
|
14094
|
-
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
14053
|
+
return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
|
|
14095
14054
|
};
|
|
14096
14055
|
|
|
14097
|
-
FormData.prototype._generateBoundary = function
|
|
14056
|
+
FormData.prototype._generateBoundary = function() {
|
|
14098
14057
|
// This generates a 50 character boundary similar to those used by Firefox.
|
|
14099
|
-
|
|
14100
14058
|
// They are optimized for boyer-moore parsing.
|
|
14101
|
-
|
|
14059
|
+
var boundary = '--------------------------';
|
|
14060
|
+
for (var i = 0; i < 24; i++) {
|
|
14061
|
+
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
14062
|
+
}
|
|
14063
|
+
|
|
14064
|
+
this._boundary = boundary;
|
|
14102
14065
|
};
|
|
14103
14066
|
|
|
14104
14067
|
// Note: getLengthSync DOESN'T calculate streams length
|
|
14105
|
-
// As workaround one can calculate file size manually
|
|
14106
|
-
|
|
14068
|
+
// As workaround one can calculate file size manually
|
|
14069
|
+
// and add it as knownLength option
|
|
14070
|
+
FormData.prototype.getLengthSync = function() {
|
|
14107
14071
|
var knownLength = this._overheadLength + this._valueLength;
|
|
14108
14072
|
|
|
14109
|
-
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
14073
|
+
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
14074
|
+
// so it basically checks if there is any value added to the form
|
|
14110
14075
|
if (this._streams.length) {
|
|
14111
14076
|
knownLength += this._lastBoundary().length;
|
|
14112
14077
|
}
|
|
14113
14078
|
|
|
14114
14079
|
// https://github.com/form-data/form-data/issues/40
|
|
14115
14080
|
if (!this.hasKnownLength()) {
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
* Please use getLength(callback) to get proper length
|
|
14120
|
-
*/
|
|
14081
|
+
// Some async length retrievers are present
|
|
14082
|
+
// therefore synchronous length calculation is false.
|
|
14083
|
+
// Please use getLength(callback) to get proper length
|
|
14121
14084
|
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
|
14122
14085
|
}
|
|
14123
14086
|
|
|
@@ -14127,7 +14090,7 @@ function requireForm_data () {
|
|
|
14127
14090
|
// Public API to check if length of added values is known
|
|
14128
14091
|
// https://github.com/form-data/form-data/issues/196
|
|
14129
14092
|
// https://github.com/form-data/form-data/issues/262
|
|
14130
|
-
FormData.prototype.hasKnownLength = function
|
|
14093
|
+
FormData.prototype.hasKnownLength = function() {
|
|
14131
14094
|
var hasKnownLength = true;
|
|
14132
14095
|
|
|
14133
14096
|
if (this._valuesToMeasure.length) {
|
|
@@ -14137,7 +14100,7 @@ function requireForm_data () {
|
|
|
14137
14100
|
return hasKnownLength;
|
|
14138
14101
|
};
|
|
14139
14102
|
|
|
14140
|
-
FormData.prototype.getLength = function
|
|
14103
|
+
FormData.prototype.getLength = function(cb) {
|
|
14141
14104
|
var knownLength = this._overheadLength + this._valueLength;
|
|
14142
14105
|
|
|
14143
14106
|
if (this._streams.length) {
|
|
@@ -14149,13 +14112,13 @@ function requireForm_data () {
|
|
|
14149
14112
|
return;
|
|
14150
14113
|
}
|
|
14151
14114
|
|
|
14152
|
-
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function
|
|
14115
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
14153
14116
|
if (err) {
|
|
14154
14117
|
cb(err);
|
|
14155
14118
|
return;
|
|
14156
14119
|
}
|
|
14157
14120
|
|
|
14158
|
-
values.forEach(function
|
|
14121
|
+
values.forEach(function(length) {
|
|
14159
14122
|
knownLength += length;
|
|
14160
14123
|
});
|
|
14161
14124
|
|
|
@@ -14163,26 +14126,31 @@ function requireForm_data () {
|
|
|
14163
14126
|
});
|
|
14164
14127
|
};
|
|
14165
14128
|
|
|
14166
|
-
FormData.prototype.submit = function
|
|
14167
|
-
var request
|
|
14168
|
-
|
|
14169
|
-
|
|
14129
|
+
FormData.prototype.submit = function(params, cb) {
|
|
14130
|
+
var request
|
|
14131
|
+
, options
|
|
14132
|
+
, defaults = {method: 'post'}
|
|
14133
|
+
;
|
|
14134
|
+
|
|
14135
|
+
// parse provided url if it's string
|
|
14136
|
+
// or treat it as options object
|
|
14137
|
+
if (typeof params == 'string') {
|
|
14170
14138
|
|
|
14171
|
-
|
|
14172
|
-
if (typeof params === 'string') {
|
|
14173
|
-
params = parseUrl(params); // eslint-disable-line no-param-reassign
|
|
14174
|
-
/* eslint sort-keys: 0 */
|
|
14139
|
+
params = parseUrl(params);
|
|
14175
14140
|
options = populate({
|
|
14176
14141
|
port: params.port,
|
|
14177
14142
|
path: params.pathname,
|
|
14178
14143
|
host: params.hostname,
|
|
14179
14144
|
protocol: params.protocol
|
|
14180
14145
|
}, defaults);
|
|
14181
|
-
|
|
14146
|
+
|
|
14147
|
+
// use custom params
|
|
14148
|
+
} else {
|
|
14149
|
+
|
|
14182
14150
|
options = populate(params, defaults);
|
|
14183
14151
|
// if no port provided use default one
|
|
14184
14152
|
if (!options.port) {
|
|
14185
|
-
options.port = options.protocol
|
|
14153
|
+
options.port = options.protocol == 'https:' ? 443 : 80;
|
|
14186
14154
|
}
|
|
14187
14155
|
}
|
|
14188
14156
|
|
|
@@ -14190,14 +14158,14 @@ function requireForm_data () {
|
|
|
14190
14158
|
options.headers = this.getHeaders(params.headers);
|
|
14191
14159
|
|
|
14192
14160
|
// https if specified, fallback to http in any other case
|
|
14193
|
-
if (options.protocol
|
|
14161
|
+
if (options.protocol == 'https:') {
|
|
14194
14162
|
request = https$1.request(options);
|
|
14195
14163
|
} else {
|
|
14196
14164
|
request = http$1.request(options);
|
|
14197
14165
|
}
|
|
14198
14166
|
|
|
14199
14167
|
// get content length and fire away
|
|
14200
|
-
this.getLength(function
|
|
14168
|
+
this.getLength(function(err, length) {
|
|
14201
14169
|
if (err && err !== 'Unknown stream') {
|
|
14202
14170
|
this._error(err);
|
|
14203
14171
|
return;
|
|
@@ -14216,7 +14184,7 @@ function requireForm_data () {
|
|
|
14216
14184
|
request.removeListener('error', callback);
|
|
14217
14185
|
request.removeListener('response', onResponse);
|
|
14218
14186
|
|
|
14219
|
-
return cb.call(this, error, responce);
|
|
14187
|
+
return cb.call(this, error, responce);
|
|
14220
14188
|
};
|
|
14221
14189
|
|
|
14222
14190
|
onResponse = callback.bind(this, null);
|
|
@@ -14229,7 +14197,7 @@ function requireForm_data () {
|
|
|
14229
14197
|
return request;
|
|
14230
14198
|
};
|
|
14231
14199
|
|
|
14232
|
-
FormData.prototype._error = function
|
|
14200
|
+
FormData.prototype._error = function(err) {
|
|
14233
14201
|
if (!this.error) {
|
|
14234
14202
|
this.error = err;
|
|
14235
14203
|
this.pause();
|
|
@@ -14241,9 +14209,6 @@ function requireForm_data () {
|
|
|
14241
14209
|
return '[object FormData]';
|
|
14242
14210
|
};
|
|
14243
14211
|
setToStringTag(FormData, 'FormData');
|
|
14244
|
-
|
|
14245
|
-
// Public API
|
|
14246
|
-
form_data = FormData;
|
|
14247
14212
|
return form_data;
|
|
14248
14213
|
}
|
|
14249
14214
|
|
|
@@ -14365,10 +14330,6 @@ function toFormData$1(obj, formData, options) {
|
|
|
14365
14330
|
return value.toISOString();
|
|
14366
14331
|
}
|
|
14367
14332
|
|
|
14368
|
-
if (utils$4.isBoolean(value)) {
|
|
14369
|
-
return value.toString();
|
|
14370
|
-
}
|
|
14371
|
-
|
|
14372
14333
|
if (!useBlob && utils$4.isBlob(value)) {
|
|
14373
14334
|
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
14374
14335
|
}
|
|
@@ -14671,7 +14632,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
|
14671
14632
|
let str = '';
|
|
14672
14633
|
const {length} = alphabet;
|
|
14673
14634
|
const randomValues = new Uint32Array(size);
|
|
14674
|
-
|
|
14635
|
+
crypto$2.randomFillSync(randomValues);
|
|
14675
14636
|
for (let i = 0; i < size; i++) {
|
|
14676
14637
|
str += alphabet[randomValues[i] % length];
|
|
14677
14638
|
}
|
|
@@ -14751,7 +14712,7 @@ var platform = {
|
|
|
14751
14712
|
};
|
|
14752
14713
|
|
|
14753
14714
|
function toURLEncodedForm(data, options) {
|
|
14754
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
14715
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
14755
14716
|
visitor: function(value, key, path, helpers) {
|
|
14756
14717
|
if (platform.isNode && utils$4.isBuffer(value)) {
|
|
14757
14718
|
this.append(key, value.toString('base64'));
|
|
@@ -14759,9 +14720,8 @@ function toURLEncodedForm(data, options) {
|
|
|
14759
14720
|
}
|
|
14760
14721
|
|
|
14761
14722
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
14762
|
-
}
|
|
14763
|
-
|
|
14764
|
-
});
|
|
14723
|
+
}
|
|
14724
|
+
}, options));
|
|
14765
14725
|
}
|
|
14766
14726
|
|
|
14767
14727
|
/**
|
|
@@ -15153,18 +15113,10 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
15153
15113
|
setHeaders(header, valueOrRewrite);
|
|
15154
15114
|
} else if(utils$4.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
15155
15115
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
15156
|
-
} else if (utils$4.
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
if (!utils$4.isArray(entry)) {
|
|
15160
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
15161
|
-
}
|
|
15162
|
-
|
|
15163
|
-
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
15164
|
-
(utils$4.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
15116
|
+
} else if (utils$4.isHeaders(header)) {
|
|
15117
|
+
for (const [key, value] of header.entries()) {
|
|
15118
|
+
setHeader(value, key, rewrite);
|
|
15165
15119
|
}
|
|
15166
|
-
|
|
15167
|
-
setHeaders(obj, valueOrRewrite);
|
|
15168
15120
|
} else {
|
|
15169
15121
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
15170
15122
|
}
|
|
@@ -15306,10 +15258,6 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
15306
15258
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
15307
15259
|
}
|
|
15308
15260
|
|
|
15309
|
-
getSetCookie() {
|
|
15310
|
-
return this.get("set-cookie") || [];
|
|
15311
|
-
}
|
|
15312
|
-
|
|
15313
15261
|
get [Symbol.toStringTag]() {
|
|
15314
15262
|
return 'AxiosHeaders';
|
|
15315
15263
|
}
|
|
@@ -15474,7 +15422,7 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
15474
15422
|
*/
|
|
15475
15423
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
15476
15424
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
15477
|
-
if (baseURL &&
|
|
15425
|
+
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
|
|
15478
15426
|
return combineURLs(baseURL, requestedURL);
|
|
15479
15427
|
}
|
|
15480
15428
|
return requestedURL;
|
|
@@ -15952,7 +15900,7 @@ function requireCommon () {
|
|
|
15952
15900
|
|
|
15953
15901
|
const split = (typeof namespaces === 'string' ? namespaces : '')
|
|
15954
15902
|
.trim()
|
|
15955
|
-
.replace(
|
|
15903
|
+
.replace(' ', ',')
|
|
15956
15904
|
.split(',')
|
|
15957
15905
|
.filter(Boolean);
|
|
15958
15906
|
|
|
@@ -16304,7 +16252,7 @@ function requireBrowser () {
|
|
|
16304
16252
|
function load() {
|
|
16305
16253
|
let r;
|
|
16306
16254
|
try {
|
|
16307
|
-
r = exports.storage.getItem('debug')
|
|
16255
|
+
r = exports.storage.getItem('debug');
|
|
16308
16256
|
} catch (error) {
|
|
16309
16257
|
// Swallow
|
|
16310
16258
|
// XXX (@Qix-) should we be logging these?
|
|
@@ -17532,7 +17480,7 @@ function requireFollowRedirects () {
|
|
|
17532
17480
|
var followRedirectsExports = requireFollowRedirects();
|
|
17533
17481
|
var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
|
|
17534
17482
|
|
|
17535
|
-
const VERSION$1 = "1.
|
|
17483
|
+
const VERSION$1 = "1.8.2";
|
|
17536
17484
|
|
|
17537
17485
|
function parseProtocol(url) {
|
|
17538
17486
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -17810,7 +17758,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
17810
17758
|
}
|
|
17811
17759
|
|
|
17812
17760
|
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
17813
|
-
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
|
|
17761
|
+
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
|
|
17814
17762
|
let contentLength = footerBytes.byteLength;
|
|
17815
17763
|
|
|
17816
17764
|
const parts = Array.from(form.entries()).map(([name, value]) => {
|
|
@@ -17950,7 +17898,7 @@ function throttle(fn, freq) {
|
|
|
17950
17898
|
clearTimeout(timer);
|
|
17951
17899
|
timer = null;
|
|
17952
17900
|
}
|
|
17953
|
-
fn(
|
|
17901
|
+
fn.apply(null, args);
|
|
17954
17902
|
};
|
|
17955
17903
|
|
|
17956
17904
|
const throttled = (...args) => {
|
|
@@ -18824,7 +18772,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
18824
18772
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
18825
18773
|
};
|
|
18826
18774
|
|
|
18827
|
-
utils$4.forEach(Object.keys({
|
|
18775
|
+
utils$4.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
18828
18776
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
18829
18777
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
18830
18778
|
(utils$4.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -18840,7 +18788,7 @@ var resolveConfig = (config) => {
|
|
|
18840
18788
|
|
|
18841
18789
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
18842
18790
|
|
|
18843
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url
|
|
18791
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
18844
18792
|
|
|
18845
18793
|
// HTTP basic authentication
|
|
18846
18794
|
if (auth) {
|
|
@@ -19357,7 +19305,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
19357
19305
|
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
19358
19306
|
});
|
|
19359
19307
|
|
|
19360
|
-
let response = await fetch(request
|
|
19308
|
+
let response = await fetch(request);
|
|
19361
19309
|
|
|
19362
19310
|
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
19363
19311
|
|
|
@@ -19403,7 +19351,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
19403
19351
|
} catch (err) {
|
|
19404
19352
|
unsubscribe && unsubscribe();
|
|
19405
19353
|
|
|
19406
|
-
if (err && err.name === 'TypeError' && /
|
|
19354
|
+
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
19407
19355
|
throw Object.assign(
|
|
19408
19356
|
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
19409
19357
|
{
|
|
@@ -19669,7 +19617,7 @@ const validators = validator$1.validators;
|
|
|
19669
19617
|
*/
|
|
19670
19618
|
let Axios$1 = class Axios {
|
|
19671
19619
|
constructor(instanceConfig) {
|
|
19672
|
-
this.defaults = instanceConfig
|
|
19620
|
+
this.defaults = instanceConfig;
|
|
19673
19621
|
this.interceptors = {
|
|
19674
19622
|
request: new InterceptorManager(),
|
|
19675
19623
|
response: new InterceptorManager()
|
|
@@ -19800,8 +19748,8 @@ let Axios$1 = class Axios {
|
|
|
19800
19748
|
|
|
19801
19749
|
if (!synchronousRequestInterceptors) {
|
|
19802
19750
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
19803
|
-
chain.unshift(
|
|
19804
|
-
chain.push(
|
|
19751
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
19752
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
19805
19753
|
len = chain.length;
|
|
19806
19754
|
|
|
19807
19755
|
promise = Promise.resolve(config);
|
|
@@ -20226,7 +20174,7 @@ const DimoEnvironment = {
|
|
|
20226
20174
|
Trips: 'https://trips-api.dimo.zone',
|
|
20227
20175
|
Valuations: 'https://valuations-api.dimo.zone',
|
|
20228
20176
|
VehicleSignalDecoding: 'https://vehicle-signal-decoding.dimo.zone',
|
|
20229
|
-
|
|
20177
|
+
VehicleTriggers: 'https://vehicle-triggers-api.dimo.zone',
|
|
20230
20178
|
},
|
|
20231
20179
|
Dev: {
|
|
20232
20180
|
Attestation: 'https://attestation-api.dev.dimo.zone',
|
|
@@ -20239,7 +20187,7 @@ const DimoEnvironment = {
|
|
|
20239
20187
|
Trips: 'https://trips-api.dev.dimo.zone',
|
|
20240
20188
|
Valuations: 'https://valuations-api.dev.dimo.zone',
|
|
20241
20189
|
VehicleSignalDecoding: 'https://vehicle-signal-decoding.dev.dimo.zone',
|
|
20242
|
-
|
|
20190
|
+
VehicleTriggers: 'https://vehicle-triggers-api.dev.dimo.zone',
|
|
20243
20191
|
},
|
|
20244
20192
|
};
|
|
20245
20193
|
|
|
@@ -20693,7 +20641,7 @@ class DIMO {
|
|
|
20693
20641
|
tokenexchange;
|
|
20694
20642
|
trips;
|
|
20695
20643
|
valuations;
|
|
20696
|
-
|
|
20644
|
+
vehicleTriggers;
|
|
20697
20645
|
constructor(env) {
|
|
20698
20646
|
this.identity = new Identity(DimoEnvironment[env].Identity, env);
|
|
20699
20647
|
this.telemetry = new Telemetry(DimoEnvironment[env].Telemetry, env);
|
|
@@ -20707,7 +20655,7 @@ class DIMO {
|
|
|
20707
20655
|
this.tokenexchange = new TokenExchange(DimoEnvironment[env].TokenExchange, env);
|
|
20708
20656
|
this.trips = new Trips(DimoEnvironment[env].Trips, env);
|
|
20709
20657
|
this.valuations = new Valuations(DimoEnvironment[env].Valuations, env);
|
|
20710
|
-
this.
|
|
20658
|
+
this.vehicleTriggers = new VehicleTriggers(DimoEnvironment[env].VehicleTriggers, env);
|
|
20711
20659
|
}
|
|
20712
20660
|
// Helper Function
|
|
20713
20661
|
async authenticate() {
|
|
@@ -22916,7 +22864,7 @@ const keccak256 = (() => {
|
|
|
22916
22864
|
|
|
22917
22865
|
var util;
|
|
22918
22866
|
(function (util) {
|
|
22919
|
-
util.assertEqual = (
|
|
22867
|
+
util.assertEqual = (val) => val;
|
|
22920
22868
|
function assertIs(_arg) { }
|
|
22921
22869
|
util.assertIs = assertIs;
|
|
22922
22870
|
function assertNever(_x) {
|
|
@@ -22963,9 +22911,11 @@ var util;
|
|
|
22963
22911
|
};
|
|
22964
22912
|
util.isInteger = typeof Number.isInteger === "function"
|
|
22965
22913
|
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
22966
|
-
: (val) => typeof val === "number" &&
|
|
22914
|
+
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
22967
22915
|
function joinValues(array, separator = " | ") {
|
|
22968
|
-
return array
|
|
22916
|
+
return array
|
|
22917
|
+
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
22918
|
+
.join(separator);
|
|
22969
22919
|
}
|
|
22970
22920
|
util.joinValues = joinValues;
|
|
22971
22921
|
util.jsonStringifyReplacer = (_, value) => {
|
|
@@ -23014,7 +22964,7 @@ const getParsedType = (data) => {
|
|
|
23014
22964
|
case "string":
|
|
23015
22965
|
return ZodParsedType.string;
|
|
23016
22966
|
case "number":
|
|
23017
|
-
return
|
|
22967
|
+
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
23018
22968
|
case "boolean":
|
|
23019
22969
|
return ZodParsedType.boolean;
|
|
23020
22970
|
case "function":
|
|
@@ -23030,7 +22980,10 @@ const getParsedType = (data) => {
|
|
|
23030
22980
|
if (data === null) {
|
|
23031
22981
|
return ZodParsedType.null;
|
|
23032
22982
|
}
|
|
23033
|
-
if (data.then &&
|
|
22983
|
+
if (data.then &&
|
|
22984
|
+
typeof data.then === "function" &&
|
|
22985
|
+
data.catch &&
|
|
22986
|
+
typeof data.catch === "function") {
|
|
23034
22987
|
return ZodParsedType.promise;
|
|
23035
22988
|
}
|
|
23036
22989
|
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
@@ -23162,9 +23115,8 @@ class ZodError extends Error {
|
|
|
23162
23115
|
const formErrors = [];
|
|
23163
23116
|
for (const sub of this.issues) {
|
|
23164
23117
|
if (sub.path.length > 0) {
|
|
23165
|
-
|
|
23166
|
-
fieldErrors[
|
|
23167
|
-
fieldErrors[firstEl].push(mapper(sub));
|
|
23118
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
23119
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
23168
23120
|
}
|
|
23169
23121
|
else {
|
|
23170
23122
|
formErrors.push(mapper(sub));
|
|
@@ -23247,11 +23199,17 @@ const errorMap = (issue, _ctx) => {
|
|
|
23247
23199
|
else if (issue.type === "string")
|
|
23248
23200
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
23249
23201
|
else if (issue.type === "number")
|
|
23250
|
-
message = `Number must be ${issue.exact
|
|
23251
|
-
|
|
23252
|
-
|
|
23202
|
+
message = `Number must be ${issue.exact
|
|
23203
|
+
? `exactly equal to `
|
|
23204
|
+
: issue.inclusive
|
|
23205
|
+
? `greater than or equal to `
|
|
23206
|
+
: `greater than `}${issue.minimum}`;
|
|
23253
23207
|
else if (issue.type === "date")
|
|
23254
|
-
message = `Date must be ${issue.exact
|
|
23208
|
+
message = `Date must be ${issue.exact
|
|
23209
|
+
? `exactly equal to `
|
|
23210
|
+
: issue.inclusive
|
|
23211
|
+
? `greater than or equal to `
|
|
23212
|
+
: `greater than `}${new Date(Number(issue.minimum))}`;
|
|
23255
23213
|
else
|
|
23256
23214
|
message = "Invalid input";
|
|
23257
23215
|
break;
|
|
@@ -23261,11 +23219,23 @@ const errorMap = (issue, _ctx) => {
|
|
|
23261
23219
|
else if (issue.type === "string")
|
|
23262
23220
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
23263
23221
|
else if (issue.type === "number")
|
|
23264
|
-
message = `Number must be ${issue.exact
|
|
23222
|
+
message = `Number must be ${issue.exact
|
|
23223
|
+
? `exactly`
|
|
23224
|
+
: issue.inclusive
|
|
23225
|
+
? `less than or equal to`
|
|
23226
|
+
: `less than`} ${issue.maximum}`;
|
|
23265
23227
|
else if (issue.type === "bigint")
|
|
23266
|
-
message = `BigInt must be ${issue.exact
|
|
23228
|
+
message = `BigInt must be ${issue.exact
|
|
23229
|
+
? `exactly`
|
|
23230
|
+
: issue.inclusive
|
|
23231
|
+
? `less than or equal to`
|
|
23232
|
+
: `less than`} ${issue.maximum}`;
|
|
23267
23233
|
else if (issue.type === "date")
|
|
23268
|
-
message = `Date must be ${issue.exact
|
|
23234
|
+
message = `Date must be ${issue.exact
|
|
23235
|
+
? `exactly`
|
|
23236
|
+
: issue.inclusive
|
|
23237
|
+
? `smaller than or equal to`
|
|
23238
|
+
: `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
23269
23239
|
else
|
|
23270
23240
|
message = "Invalid input";
|
|
23271
23241
|
break;
|
|
@@ -23387,7 +23357,8 @@ class ParseStatus {
|
|
|
23387
23357
|
status.dirty();
|
|
23388
23358
|
if (value.status === "dirty")
|
|
23389
23359
|
status.dirty();
|
|
23390
|
-
if (key.value !== "__proto__" &&
|
|
23360
|
+
if (key.value !== "__proto__" &&
|
|
23361
|
+
(typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
23391
23362
|
finalObject[key.value] = value.value;
|
|
23392
23363
|
}
|
|
23393
23364
|
}
|
|
@@ -23404,13 +23375,43 @@ const isDirty = (x) => x.status === "dirty";
|
|
|
23404
23375
|
const isValid$2 = (x) => x.status === "valid";
|
|
23405
23376
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
23406
23377
|
|
|
23378
|
+
/******************************************************************************
|
|
23379
|
+
Copyright (c) Microsoft Corporation.
|
|
23380
|
+
|
|
23381
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
23382
|
+
purpose with or without fee is hereby granted.
|
|
23383
|
+
|
|
23384
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23385
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
23386
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23387
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23388
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23389
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23390
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
23391
|
+
***************************************************************************** */
|
|
23392
|
+
|
|
23393
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
23394
|
+
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
23395
|
+
return state.get(receiver);
|
|
23396
|
+
}
|
|
23397
|
+
|
|
23398
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
23399
|
+
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
23400
|
+
return (state.set(receiver, value)), value;
|
|
23401
|
+
}
|
|
23402
|
+
|
|
23403
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
23404
|
+
var e = new Error(message);
|
|
23405
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
23406
|
+
};
|
|
23407
|
+
|
|
23407
23408
|
var errorUtil;
|
|
23408
23409
|
(function (errorUtil) {
|
|
23409
23410
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
23410
|
-
|
|
23411
|
-
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
23411
|
+
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
23412
23412
|
})(errorUtil || (errorUtil = {}));
|
|
23413
23413
|
|
|
23414
|
+
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
23414
23415
|
class ParseInputLazyPath {
|
|
23415
23416
|
constructor(parent, value, path, key) {
|
|
23416
23417
|
this._cachedPath = [];
|
|
@@ -23421,7 +23422,7 @@ class ParseInputLazyPath {
|
|
|
23421
23422
|
}
|
|
23422
23423
|
get path() {
|
|
23423
23424
|
if (!this._cachedPath.length) {
|
|
23424
|
-
if (
|
|
23425
|
+
if (this._key instanceof Array) {
|
|
23425
23426
|
this._cachedPath.push(...this._path, ...this._key);
|
|
23426
23427
|
}
|
|
23427
23428
|
else {
|
|
@@ -23461,16 +23462,17 @@ function processCreateParams(params) {
|
|
|
23461
23462
|
if (errorMap)
|
|
23462
23463
|
return { errorMap: errorMap, description };
|
|
23463
23464
|
const customMap = (iss, ctx) => {
|
|
23465
|
+
var _a, _b;
|
|
23464
23466
|
const { message } = params;
|
|
23465
23467
|
if (iss.code === "invalid_enum_value") {
|
|
23466
|
-
return { message: message
|
|
23468
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
23467
23469
|
}
|
|
23468
23470
|
if (typeof ctx.data === "undefined") {
|
|
23469
|
-
return { message: message
|
|
23471
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
23470
23472
|
}
|
|
23471
23473
|
if (iss.code !== "invalid_type")
|
|
23472
23474
|
return { message: ctx.defaultError };
|
|
23473
|
-
return { message: message
|
|
23475
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
23474
23476
|
};
|
|
23475
23477
|
return { errorMap: customMap, description };
|
|
23476
23478
|
}
|
|
@@ -23522,13 +23524,14 @@ class ZodType {
|
|
|
23522
23524
|
throw result.error;
|
|
23523
23525
|
}
|
|
23524
23526
|
safeParse(data, params) {
|
|
23527
|
+
var _a;
|
|
23525
23528
|
const ctx = {
|
|
23526
23529
|
common: {
|
|
23527
23530
|
issues: [],
|
|
23528
|
-
async: params
|
|
23529
|
-
contextualErrorMap: params
|
|
23531
|
+
async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
|
|
23532
|
+
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
|
|
23530
23533
|
},
|
|
23531
|
-
path: params
|
|
23534
|
+
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
23532
23535
|
schemaErrorMap: this._def.errorMap,
|
|
23533
23536
|
parent: null,
|
|
23534
23537
|
data,
|
|
@@ -23538,6 +23541,7 @@ class ZodType {
|
|
|
23538
23541
|
return handleResult(ctx, result);
|
|
23539
23542
|
}
|
|
23540
23543
|
"~validate"(data) {
|
|
23544
|
+
var _a, _b;
|
|
23541
23545
|
const ctx = {
|
|
23542
23546
|
common: {
|
|
23543
23547
|
issues: [],
|
|
@@ -23561,7 +23565,7 @@ class ZodType {
|
|
|
23561
23565
|
};
|
|
23562
23566
|
}
|
|
23563
23567
|
catch (err) {
|
|
23564
|
-
if (err
|
|
23568
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
23565
23569
|
this["~standard"].async = true;
|
|
23566
23570
|
}
|
|
23567
23571
|
ctx.common = {
|
|
@@ -23588,17 +23592,19 @@ class ZodType {
|
|
|
23588
23592
|
const ctx = {
|
|
23589
23593
|
common: {
|
|
23590
23594
|
issues: [],
|
|
23591
|
-
contextualErrorMap: params
|
|
23595
|
+
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
|
|
23592
23596
|
async: true,
|
|
23593
23597
|
},
|
|
23594
|
-
path: params
|
|
23598
|
+
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
23595
23599
|
schemaErrorMap: this._def.errorMap,
|
|
23596
23600
|
parent: null,
|
|
23597
23601
|
data,
|
|
23598
23602
|
parsedType: getParsedType(data),
|
|
23599
23603
|
};
|
|
23600
23604
|
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
23601
|
-
const result = await (isAsync(maybeAsyncResult)
|
|
23605
|
+
const result = await (isAsync(maybeAsyncResult)
|
|
23606
|
+
? maybeAsyncResult
|
|
23607
|
+
: Promise.resolve(maybeAsyncResult));
|
|
23602
23608
|
return handleResult(ctx, result);
|
|
23603
23609
|
}
|
|
23604
23610
|
refine(check, message) {
|
|
@@ -23642,7 +23648,9 @@ class ZodType {
|
|
|
23642
23648
|
refinement(check, refinementData) {
|
|
23643
23649
|
return this._refinement((val, ctx) => {
|
|
23644
23650
|
if (!check(val)) {
|
|
23645
|
-
ctx.addIssue(typeof refinementData === "function"
|
|
23651
|
+
ctx.addIssue(typeof refinementData === "function"
|
|
23652
|
+
? refinementData(val, ctx)
|
|
23653
|
+
: refinementData);
|
|
23646
23654
|
return false;
|
|
23647
23655
|
}
|
|
23648
23656
|
else {
|
|
@@ -23814,15 +23822,15 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
|
|
|
23814
23822
|
const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
23815
23823
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
23816
23824
|
function timeRegexSource(args) {
|
|
23817
|
-
let
|
|
23825
|
+
// let regex = `\\d{2}:\\d{2}:\\d{2}`;
|
|
23826
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
23818
23827
|
if (args.precision) {
|
|
23819
|
-
|
|
23828
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
23820
23829
|
}
|
|
23821
23830
|
else if (args.precision == null) {
|
|
23822
|
-
|
|
23831
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
23823
23832
|
}
|
|
23824
|
-
|
|
23825
|
-
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
23833
|
+
return regex;
|
|
23826
23834
|
}
|
|
23827
23835
|
function timeRegex(args) {
|
|
23828
23836
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -23851,8 +23859,6 @@ function isValidJWT(jwt, alg) {
|
|
|
23851
23859
|
return false;
|
|
23852
23860
|
try {
|
|
23853
23861
|
const [header] = jwt.split(".");
|
|
23854
|
-
if (!header)
|
|
23855
|
-
return false;
|
|
23856
23862
|
// Convert base64url to base64
|
|
23857
23863
|
const base64 = header
|
|
23858
23864
|
.replace(/-/g, "+")
|
|
@@ -23861,15 +23867,13 @@ function isValidJWT(jwt, alg) {
|
|
|
23861
23867
|
const decoded = JSON.parse(atob(base64));
|
|
23862
23868
|
if (typeof decoded !== "object" || decoded === null)
|
|
23863
23869
|
return false;
|
|
23864
|
-
if (
|
|
23865
|
-
return false;
|
|
23866
|
-
if (!decoded.alg)
|
|
23870
|
+
if (!decoded.typ || !decoded.alg)
|
|
23867
23871
|
return false;
|
|
23868
23872
|
if (alg && decoded.alg !== alg)
|
|
23869
23873
|
return false;
|
|
23870
23874
|
return true;
|
|
23871
23875
|
}
|
|
23872
|
-
catch {
|
|
23876
|
+
catch (_a) {
|
|
23873
23877
|
return false;
|
|
23874
23878
|
}
|
|
23875
23879
|
}
|
|
@@ -24040,7 +24044,7 @@ class ZodString extends ZodType {
|
|
|
24040
24044
|
try {
|
|
24041
24045
|
new URL(input.data);
|
|
24042
24046
|
}
|
|
24043
|
-
catch {
|
|
24047
|
+
catch (_a) {
|
|
24044
24048
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24045
24049
|
addIssueToContext(ctx, {
|
|
24046
24050
|
validation: "url",
|
|
@@ -24270,6 +24274,7 @@ class ZodString extends ZodType {
|
|
|
24270
24274
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
24271
24275
|
}
|
|
24272
24276
|
datetime(options) {
|
|
24277
|
+
var _a, _b;
|
|
24273
24278
|
if (typeof options === "string") {
|
|
24274
24279
|
return this._addCheck({
|
|
24275
24280
|
kind: "datetime",
|
|
@@ -24281,10 +24286,10 @@ class ZodString extends ZodType {
|
|
|
24281
24286
|
}
|
|
24282
24287
|
return this._addCheck({
|
|
24283
24288
|
kind: "datetime",
|
|
24284
|
-
precision: typeof options
|
|
24285
|
-
offset: options
|
|
24286
|
-
local: options
|
|
24287
|
-
...errorUtil.errToObj(options
|
|
24289
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
24290
|
+
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
24291
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
24292
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
|
|
24288
24293
|
});
|
|
24289
24294
|
}
|
|
24290
24295
|
date(message) {
|
|
@@ -24300,8 +24305,8 @@ class ZodString extends ZodType {
|
|
|
24300
24305
|
}
|
|
24301
24306
|
return this._addCheck({
|
|
24302
24307
|
kind: "time",
|
|
24303
|
-
precision: typeof options
|
|
24304
|
-
...errorUtil.errToObj(options
|
|
24308
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
24309
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
|
|
24305
24310
|
});
|
|
24306
24311
|
}
|
|
24307
24312
|
duration(message) {
|
|
@@ -24318,8 +24323,8 @@ class ZodString extends ZodType {
|
|
|
24318
24323
|
return this._addCheck({
|
|
24319
24324
|
kind: "includes",
|
|
24320
24325
|
value: value,
|
|
24321
|
-
position: options
|
|
24322
|
-
...errorUtil.errToObj(options
|
|
24326
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
24327
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
|
|
24323
24328
|
});
|
|
24324
24329
|
}
|
|
24325
24330
|
startsWith(value, message) {
|
|
@@ -24452,10 +24457,11 @@ class ZodString extends ZodType {
|
|
|
24452
24457
|
}
|
|
24453
24458
|
}
|
|
24454
24459
|
ZodString.create = (params) => {
|
|
24460
|
+
var _a;
|
|
24455
24461
|
return new ZodString({
|
|
24456
24462
|
checks: [],
|
|
24457
24463
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
24458
|
-
coerce: params
|
|
24464
|
+
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
24459
24465
|
...processCreateParams(params),
|
|
24460
24466
|
});
|
|
24461
24467
|
};
|
|
@@ -24464,9 +24470,9 @@ function floatSafeRemainder(val, step) {
|
|
|
24464
24470
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
24465
24471
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
24466
24472
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
24467
|
-
const valInt =
|
|
24468
|
-
const stepInt =
|
|
24469
|
-
return (valInt % stepInt) / 10
|
|
24473
|
+
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
24474
|
+
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
24475
|
+
return (valInt % stepInt) / Math.pow(10, decCount);
|
|
24470
24476
|
}
|
|
24471
24477
|
class ZodNumber extends ZodType {
|
|
24472
24478
|
constructor() {
|
|
@@ -24505,7 +24511,9 @@ class ZodNumber extends ZodType {
|
|
|
24505
24511
|
}
|
|
24506
24512
|
}
|
|
24507
24513
|
else if (check.kind === "min") {
|
|
24508
|
-
const tooSmall = check.inclusive
|
|
24514
|
+
const tooSmall = check.inclusive
|
|
24515
|
+
? input.data < check.value
|
|
24516
|
+
: input.data <= check.value;
|
|
24509
24517
|
if (tooSmall) {
|
|
24510
24518
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24511
24519
|
addIssueToContext(ctx, {
|
|
@@ -24520,7 +24528,9 @@ class ZodNumber extends ZodType {
|
|
|
24520
24528
|
}
|
|
24521
24529
|
}
|
|
24522
24530
|
else if (check.kind === "max") {
|
|
24523
|
-
const tooBig = check.inclusive
|
|
24531
|
+
const tooBig = check.inclusive
|
|
24532
|
+
? input.data > check.value
|
|
24533
|
+
: input.data >= check.value;
|
|
24524
24534
|
if (tooBig) {
|
|
24525
24535
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24526
24536
|
addIssueToContext(ctx, {
|
|
@@ -24678,13 +24688,15 @@ class ZodNumber extends ZodType {
|
|
|
24678
24688
|
return max;
|
|
24679
24689
|
}
|
|
24680
24690
|
get isInt() {
|
|
24681
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
24691
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
24692
|
+
(ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
24682
24693
|
}
|
|
24683
24694
|
get isFinite() {
|
|
24684
|
-
let max = null;
|
|
24685
|
-
let min = null;
|
|
24695
|
+
let max = null, min = null;
|
|
24686
24696
|
for (const ch of this._def.checks) {
|
|
24687
|
-
if (ch.kind === "finite" ||
|
|
24697
|
+
if (ch.kind === "finite" ||
|
|
24698
|
+
ch.kind === "int" ||
|
|
24699
|
+
ch.kind === "multipleOf") {
|
|
24688
24700
|
return true;
|
|
24689
24701
|
}
|
|
24690
24702
|
else if (ch.kind === "min") {
|
|
@@ -24703,7 +24715,7 @@ ZodNumber.create = (params) => {
|
|
|
24703
24715
|
return new ZodNumber({
|
|
24704
24716
|
checks: [],
|
|
24705
24717
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
24706
|
-
coerce: params
|
|
24718
|
+
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
|
|
24707
24719
|
...processCreateParams(params),
|
|
24708
24720
|
});
|
|
24709
24721
|
};
|
|
@@ -24718,7 +24730,7 @@ class ZodBigInt extends ZodType {
|
|
|
24718
24730
|
try {
|
|
24719
24731
|
input.data = BigInt(input.data);
|
|
24720
24732
|
}
|
|
24721
|
-
catch {
|
|
24733
|
+
catch (_a) {
|
|
24722
24734
|
return this._getInvalidInput(input);
|
|
24723
24735
|
}
|
|
24724
24736
|
}
|
|
@@ -24730,7 +24742,9 @@ class ZodBigInt extends ZodType {
|
|
|
24730
24742
|
const status = new ParseStatus();
|
|
24731
24743
|
for (const check of this._def.checks) {
|
|
24732
24744
|
if (check.kind === "min") {
|
|
24733
|
-
const tooSmall = check.inclusive
|
|
24745
|
+
const tooSmall = check.inclusive
|
|
24746
|
+
? input.data < check.value
|
|
24747
|
+
: input.data <= check.value;
|
|
24734
24748
|
if (tooSmall) {
|
|
24735
24749
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24736
24750
|
addIssueToContext(ctx, {
|
|
@@ -24744,7 +24758,9 @@ class ZodBigInt extends ZodType {
|
|
|
24744
24758
|
}
|
|
24745
24759
|
}
|
|
24746
24760
|
else if (check.kind === "max") {
|
|
24747
|
-
const tooBig = check.inclusive
|
|
24761
|
+
const tooBig = check.inclusive
|
|
24762
|
+
? input.data > check.value
|
|
24763
|
+
: input.data >= check.value;
|
|
24748
24764
|
if (tooBig) {
|
|
24749
24765
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24750
24766
|
addIssueToContext(ctx, {
|
|
@@ -24876,10 +24892,11 @@ class ZodBigInt extends ZodType {
|
|
|
24876
24892
|
}
|
|
24877
24893
|
}
|
|
24878
24894
|
ZodBigInt.create = (params) => {
|
|
24895
|
+
var _a;
|
|
24879
24896
|
return new ZodBigInt({
|
|
24880
24897
|
checks: [],
|
|
24881
24898
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
24882
|
-
coerce: params
|
|
24899
|
+
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
24883
24900
|
...processCreateParams(params),
|
|
24884
24901
|
});
|
|
24885
24902
|
};
|
|
@@ -24904,7 +24921,7 @@ class ZodBoolean extends ZodType {
|
|
|
24904
24921
|
ZodBoolean.create = (params) => {
|
|
24905
24922
|
return new ZodBoolean({
|
|
24906
24923
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
24907
|
-
coerce: params
|
|
24924
|
+
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
|
|
24908
24925
|
...processCreateParams(params),
|
|
24909
24926
|
});
|
|
24910
24927
|
};
|
|
@@ -24923,7 +24940,7 @@ class ZodDate extends ZodType {
|
|
|
24923
24940
|
});
|
|
24924
24941
|
return INVALID;
|
|
24925
24942
|
}
|
|
24926
|
-
if (
|
|
24943
|
+
if (isNaN(input.data.getTime())) {
|
|
24927
24944
|
const ctx = this._getOrReturnCtx(input);
|
|
24928
24945
|
addIssueToContext(ctx, {
|
|
24929
24946
|
code: ZodIssueCode.invalid_date,
|
|
@@ -25014,7 +25031,7 @@ class ZodDate extends ZodType {
|
|
|
25014
25031
|
ZodDate.create = (params) => {
|
|
25015
25032
|
return new ZodDate({
|
|
25016
25033
|
checks: [],
|
|
25017
|
-
coerce: params
|
|
25034
|
+
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
|
|
25018
25035
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
25019
25036
|
...processCreateParams(params),
|
|
25020
25037
|
});
|
|
@@ -25336,8 +25353,7 @@ class ZodObject extends ZodType {
|
|
|
25336
25353
|
return this._cached;
|
|
25337
25354
|
const shape = this._def.shape();
|
|
25338
25355
|
const keys = util.objectKeys(shape);
|
|
25339
|
-
this._cached = { shape, keys };
|
|
25340
|
-
return this._cached;
|
|
25356
|
+
return (this._cached = { shape, keys });
|
|
25341
25357
|
}
|
|
25342
25358
|
_parse(input) {
|
|
25343
25359
|
const parsedType = this._getType(input);
|
|
@@ -25353,7 +25369,8 @@ class ZodObject extends ZodType {
|
|
|
25353
25369
|
const { status, ctx } = this._processInputParams(input);
|
|
25354
25370
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
25355
25371
|
const extraKeys = [];
|
|
25356
|
-
if (!(this._def.catchall instanceof ZodNever &&
|
|
25372
|
+
if (!(this._def.catchall instanceof ZodNever &&
|
|
25373
|
+
this._def.unknownKeys === "strip")) {
|
|
25357
25374
|
for (const key in ctx.data) {
|
|
25358
25375
|
if (!shapeKeys.includes(key)) {
|
|
25359
25376
|
extraKeys.push(key);
|
|
@@ -25441,10 +25458,11 @@ class ZodObject extends ZodType {
|
|
|
25441
25458
|
...(message !== undefined
|
|
25442
25459
|
? {
|
|
25443
25460
|
errorMap: (issue, ctx) => {
|
|
25444
|
-
|
|
25461
|
+
var _a, _b, _c, _d;
|
|
25462
|
+
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
25445
25463
|
if (issue.code === "unrecognized_keys")
|
|
25446
25464
|
return {
|
|
25447
|
-
message: errorUtil.errToObj(message).message
|
|
25465
|
+
message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
|
|
25448
25466
|
};
|
|
25449
25467
|
return {
|
|
25450
25468
|
message: defaultError,
|
|
@@ -25576,11 +25594,11 @@ class ZodObject extends ZodType {
|
|
|
25576
25594
|
}
|
|
25577
25595
|
pick(mask) {
|
|
25578
25596
|
const shape = {};
|
|
25579
|
-
|
|
25597
|
+
util.objectKeys(mask).forEach((key) => {
|
|
25580
25598
|
if (mask[key] && this.shape[key]) {
|
|
25581
25599
|
shape[key] = this.shape[key];
|
|
25582
25600
|
}
|
|
25583
|
-
}
|
|
25601
|
+
});
|
|
25584
25602
|
return new ZodObject({
|
|
25585
25603
|
...this._def,
|
|
25586
25604
|
shape: () => shape,
|
|
@@ -25588,11 +25606,11 @@ class ZodObject extends ZodType {
|
|
|
25588
25606
|
}
|
|
25589
25607
|
omit(mask) {
|
|
25590
25608
|
const shape = {};
|
|
25591
|
-
|
|
25609
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
25592
25610
|
if (!mask[key]) {
|
|
25593
25611
|
shape[key] = this.shape[key];
|
|
25594
25612
|
}
|
|
25595
|
-
}
|
|
25613
|
+
});
|
|
25596
25614
|
return new ZodObject({
|
|
25597
25615
|
...this._def,
|
|
25598
25616
|
shape: () => shape,
|
|
@@ -25606,7 +25624,7 @@ class ZodObject extends ZodType {
|
|
|
25606
25624
|
}
|
|
25607
25625
|
partial(mask) {
|
|
25608
25626
|
const newShape = {};
|
|
25609
|
-
|
|
25627
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
25610
25628
|
const fieldSchema = this.shape[key];
|
|
25611
25629
|
if (mask && !mask[key]) {
|
|
25612
25630
|
newShape[key] = fieldSchema;
|
|
@@ -25614,7 +25632,7 @@ class ZodObject extends ZodType {
|
|
|
25614
25632
|
else {
|
|
25615
25633
|
newShape[key] = fieldSchema.optional();
|
|
25616
25634
|
}
|
|
25617
|
-
}
|
|
25635
|
+
});
|
|
25618
25636
|
return new ZodObject({
|
|
25619
25637
|
...this._def,
|
|
25620
25638
|
shape: () => newShape,
|
|
@@ -25622,7 +25640,7 @@ class ZodObject extends ZodType {
|
|
|
25622
25640
|
}
|
|
25623
25641
|
required(mask) {
|
|
25624
25642
|
const newShape = {};
|
|
25625
|
-
|
|
25643
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
25626
25644
|
if (mask && !mask[key]) {
|
|
25627
25645
|
newShape[key] = this.shape[key];
|
|
25628
25646
|
}
|
|
@@ -25634,7 +25652,7 @@ class ZodObject extends ZodType {
|
|
|
25634
25652
|
}
|
|
25635
25653
|
newShape[key] = newField;
|
|
25636
25654
|
}
|
|
25637
|
-
}
|
|
25655
|
+
});
|
|
25638
25656
|
return new ZodObject({
|
|
25639
25657
|
...this._def,
|
|
25640
25658
|
shape: () => newShape,
|
|
@@ -25906,7 +25924,9 @@ function mergeValues(a, b) {
|
|
|
25906
25924
|
}
|
|
25907
25925
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
25908
25926
|
const bKeys = util.objectKeys(b);
|
|
25909
|
-
const sharedKeys = util
|
|
25927
|
+
const sharedKeys = util
|
|
25928
|
+
.objectKeys(a)
|
|
25929
|
+
.filter((key) => bKeys.indexOf(key) !== -1);
|
|
25910
25930
|
const newObj = { ...a, ...b };
|
|
25911
25931
|
for (const key of sharedKeys) {
|
|
25912
25932
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
@@ -25933,7 +25953,9 @@ function mergeValues(a, b) {
|
|
|
25933
25953
|
}
|
|
25934
25954
|
return { valid: true, data: newArray };
|
|
25935
25955
|
}
|
|
25936
|
-
else if (aType === ZodParsedType.date &&
|
|
25956
|
+
else if (aType === ZodParsedType.date &&
|
|
25957
|
+
bType === ZodParsedType.date &&
|
|
25958
|
+
+a === +b) {
|
|
25937
25959
|
return { valid: true, data: a };
|
|
25938
25960
|
}
|
|
25939
25961
|
else {
|
|
@@ -25994,7 +26016,6 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
25994
26016
|
...processCreateParams(params),
|
|
25995
26017
|
});
|
|
25996
26018
|
};
|
|
25997
|
-
// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
25998
26019
|
class ZodTuple extends ZodType {
|
|
25999
26020
|
_parse(input) {
|
|
26000
26021
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -26291,7 +26312,12 @@ class ZodFunction extends ZodType {
|
|
|
26291
26312
|
return makeIssue({
|
|
26292
26313
|
data: args,
|
|
26293
26314
|
path: ctx.path,
|
|
26294
|
-
errorMaps: [
|
|
26315
|
+
errorMaps: [
|
|
26316
|
+
ctx.common.contextualErrorMap,
|
|
26317
|
+
ctx.schemaErrorMap,
|
|
26318
|
+
getErrorMap(),
|
|
26319
|
+
errorMap,
|
|
26320
|
+
].filter((x) => !!x),
|
|
26295
26321
|
issueData: {
|
|
26296
26322
|
code: ZodIssueCode.invalid_arguments,
|
|
26297
26323
|
argumentsError: error,
|
|
@@ -26302,7 +26328,12 @@ class ZodFunction extends ZodType {
|
|
|
26302
26328
|
return makeIssue({
|
|
26303
26329
|
data: returns,
|
|
26304
26330
|
path: ctx.path,
|
|
26305
|
-
errorMaps: [
|
|
26331
|
+
errorMaps: [
|
|
26332
|
+
ctx.common.contextualErrorMap,
|
|
26333
|
+
ctx.schemaErrorMap,
|
|
26334
|
+
getErrorMap(),
|
|
26335
|
+
errorMap,
|
|
26336
|
+
].filter((x) => !!x),
|
|
26306
26337
|
issueData: {
|
|
26307
26338
|
code: ZodIssueCode.invalid_return_type,
|
|
26308
26339
|
returnTypeError: error,
|
|
@@ -26318,7 +26349,9 @@ class ZodFunction extends ZodType {
|
|
|
26318
26349
|
const me = this;
|
|
26319
26350
|
return OK(async function (...args) {
|
|
26320
26351
|
const error = new ZodError([]);
|
|
26321
|
-
const parsedArgs = await me._def.args
|
|
26352
|
+
const parsedArgs = await me._def.args
|
|
26353
|
+
.parseAsync(args, params)
|
|
26354
|
+
.catch((e) => {
|
|
26322
26355
|
error.addIssue(makeArgsIssue(args, e));
|
|
26323
26356
|
throw error;
|
|
26324
26357
|
});
|
|
@@ -26379,7 +26412,9 @@ class ZodFunction extends ZodType {
|
|
|
26379
26412
|
}
|
|
26380
26413
|
static create(args, returns, params) {
|
|
26381
26414
|
return new ZodFunction({
|
|
26382
|
-
args: (args
|
|
26415
|
+
args: (args
|
|
26416
|
+
? args
|
|
26417
|
+
: ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
26383
26418
|
returns: returns || ZodUnknown.create(),
|
|
26384
26419
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
26385
26420
|
...processCreateParams(params),
|
|
@@ -26435,6 +26470,10 @@ function createZodEnum(values, params) {
|
|
|
26435
26470
|
});
|
|
26436
26471
|
}
|
|
26437
26472
|
class ZodEnum extends ZodType {
|
|
26473
|
+
constructor() {
|
|
26474
|
+
super(...arguments);
|
|
26475
|
+
_ZodEnum_cache.set(this, void 0);
|
|
26476
|
+
}
|
|
26438
26477
|
_parse(input) {
|
|
26439
26478
|
if (typeof input.data !== "string") {
|
|
26440
26479
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -26446,10 +26485,10 @@ class ZodEnum extends ZodType {
|
|
|
26446
26485
|
});
|
|
26447
26486
|
return INVALID;
|
|
26448
26487
|
}
|
|
26449
|
-
if (!this
|
|
26450
|
-
this
|
|
26488
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
|
|
26489
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
|
|
26451
26490
|
}
|
|
26452
|
-
if (!this.
|
|
26491
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
|
|
26453
26492
|
const ctx = this._getOrReturnCtx(input);
|
|
26454
26493
|
const expectedValues = this._def.values;
|
|
26455
26494
|
addIssueToContext(ctx, {
|
|
@@ -26498,12 +26537,18 @@ class ZodEnum extends ZodType {
|
|
|
26498
26537
|
});
|
|
26499
26538
|
}
|
|
26500
26539
|
}
|
|
26540
|
+
_ZodEnum_cache = new WeakMap();
|
|
26501
26541
|
ZodEnum.create = createZodEnum;
|
|
26502
26542
|
class ZodNativeEnum extends ZodType {
|
|
26543
|
+
constructor() {
|
|
26544
|
+
super(...arguments);
|
|
26545
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
26546
|
+
}
|
|
26503
26547
|
_parse(input) {
|
|
26504
26548
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
26505
26549
|
const ctx = this._getOrReturnCtx(input);
|
|
26506
|
-
if (ctx.parsedType !== ZodParsedType.string &&
|
|
26550
|
+
if (ctx.parsedType !== ZodParsedType.string &&
|
|
26551
|
+
ctx.parsedType !== ZodParsedType.number) {
|
|
26507
26552
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
26508
26553
|
addIssueToContext(ctx, {
|
|
26509
26554
|
expected: util.joinValues(expectedValues),
|
|
@@ -26512,10 +26557,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
26512
26557
|
});
|
|
26513
26558
|
return INVALID;
|
|
26514
26559
|
}
|
|
26515
|
-
if (!this
|
|
26516
|
-
this
|
|
26560
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
|
|
26561
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)));
|
|
26517
26562
|
}
|
|
26518
|
-
if (!this.
|
|
26563
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
|
|
26519
26564
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
26520
26565
|
addIssueToContext(ctx, {
|
|
26521
26566
|
received: ctx.data,
|
|
@@ -26530,6 +26575,7 @@ class ZodNativeEnum extends ZodType {
|
|
|
26530
26575
|
return this._def.values;
|
|
26531
26576
|
}
|
|
26532
26577
|
}
|
|
26578
|
+
_ZodNativeEnum_cache = new WeakMap();
|
|
26533
26579
|
ZodNativeEnum.create = (values, params) => {
|
|
26534
26580
|
return new ZodNativeEnum({
|
|
26535
26581
|
values: values,
|
|
@@ -26543,7 +26589,8 @@ class ZodPromise extends ZodType {
|
|
|
26543
26589
|
}
|
|
26544
26590
|
_parse(input) {
|
|
26545
26591
|
const { ctx } = this._processInputParams(input);
|
|
26546
|
-
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
26592
|
+
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
26593
|
+
ctx.common.async === false) {
|
|
26547
26594
|
addIssueToContext(ctx, {
|
|
26548
26595
|
code: ZodIssueCode.invalid_type,
|
|
26549
26596
|
expected: ZodParsedType.promise,
|
|
@@ -26551,7 +26598,9 @@ class ZodPromise extends ZodType {
|
|
|
26551
26598
|
});
|
|
26552
26599
|
return INVALID;
|
|
26553
26600
|
}
|
|
26554
|
-
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
26601
|
+
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
26602
|
+
? ctx.data
|
|
26603
|
+
: Promise.resolve(ctx.data);
|
|
26555
26604
|
return OK(promisified.then((data) => {
|
|
26556
26605
|
return this._def.type.parseAsync(data, {
|
|
26557
26606
|
path: ctx.path,
|
|
@@ -26657,7 +26706,9 @@ class ZodEffects extends ZodType {
|
|
|
26657
26706
|
return { status: status.value, value: inner.value };
|
|
26658
26707
|
}
|
|
26659
26708
|
else {
|
|
26660
|
-
return this._def.schema
|
|
26709
|
+
return this._def.schema
|
|
26710
|
+
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
26711
|
+
.then((inner) => {
|
|
26661
26712
|
if (inner.status === "aborted")
|
|
26662
26713
|
return INVALID;
|
|
26663
26714
|
if (inner.status === "dirty")
|
|
@@ -26676,7 +26727,7 @@ class ZodEffects extends ZodType {
|
|
|
26676
26727
|
parent: ctx,
|
|
26677
26728
|
});
|
|
26678
26729
|
if (!isValid$2(base))
|
|
26679
|
-
return
|
|
26730
|
+
return base;
|
|
26680
26731
|
const result = effect.transform(base.value, checkCtx);
|
|
26681
26732
|
if (result instanceof Promise) {
|
|
26682
26733
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -26684,13 +26735,12 @@ class ZodEffects extends ZodType {
|
|
|
26684
26735
|
return { status: status.value, value: result };
|
|
26685
26736
|
}
|
|
26686
26737
|
else {
|
|
26687
|
-
return this._def.schema
|
|
26738
|
+
return this._def.schema
|
|
26739
|
+
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
26740
|
+
.then((base) => {
|
|
26688
26741
|
if (!isValid$2(base))
|
|
26689
|
-
return
|
|
26690
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
26691
|
-
status: status.value,
|
|
26692
|
-
value: result,
|
|
26693
|
-
}));
|
|
26742
|
+
return base;
|
|
26743
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
|
|
26694
26744
|
});
|
|
26695
26745
|
}
|
|
26696
26746
|
}
|
|
@@ -26772,7 +26822,9 @@ ZodDefault.create = (type, params) => {
|
|
|
26772
26822
|
return new ZodDefault({
|
|
26773
26823
|
innerType: type,
|
|
26774
26824
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
26775
|
-
defaultValue: typeof params.default === "function"
|
|
26825
|
+
defaultValue: typeof params.default === "function"
|
|
26826
|
+
? params.default
|
|
26827
|
+
: () => params.default,
|
|
26776
26828
|
...processCreateParams(params),
|
|
26777
26829
|
});
|
|
26778
26830
|
};
|
|
@@ -26938,7 +26990,9 @@ class ZodReadonly extends ZodType {
|
|
|
26938
26990
|
}
|
|
26939
26991
|
return data;
|
|
26940
26992
|
};
|
|
26941
|
-
return isAsync(result)
|
|
26993
|
+
return isAsync(result)
|
|
26994
|
+
? result.then((data) => freeze(data))
|
|
26995
|
+
: freeze(result);
|
|
26942
26996
|
}
|
|
26943
26997
|
unwrap() {
|
|
26944
26998
|
return this._def.innerType;
|
|
@@ -26959,7 +27013,11 @@ ZodReadonly.create = (type, params) => {
|
|
|
26959
27013
|
////////////////////////////////////////
|
|
26960
27014
|
////////////////////////////////////////
|
|
26961
27015
|
function cleanParams(params, data) {
|
|
26962
|
-
const p = typeof params === "function"
|
|
27016
|
+
const p = typeof params === "function"
|
|
27017
|
+
? params(data)
|
|
27018
|
+
: typeof params === "string"
|
|
27019
|
+
? { message: params }
|
|
27020
|
+
: params;
|
|
26963
27021
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
26964
27022
|
return p2;
|
|
26965
27023
|
}
|
|
@@ -26977,19 +27035,21 @@ function custom(check, _params = {},
|
|
|
26977
27035
|
fatal) {
|
|
26978
27036
|
if (check)
|
|
26979
27037
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
27038
|
+
var _a, _b;
|
|
26980
27039
|
const r = check(data);
|
|
26981
27040
|
if (r instanceof Promise) {
|
|
26982
27041
|
return r.then((r) => {
|
|
27042
|
+
var _a, _b;
|
|
26983
27043
|
if (!r) {
|
|
26984
27044
|
const params = cleanParams(_params, data);
|
|
26985
|
-
const _fatal = params.fatal
|
|
27045
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
26986
27046
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
26987
27047
|
}
|
|
26988
27048
|
});
|
|
26989
27049
|
}
|
|
26990
27050
|
if (!r) {
|
|
26991
27051
|
const params = cleanParams(_params, data);
|
|
26992
|
-
const _fatal = params.fatal
|
|
27052
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
26993
27053
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
26994
27054
|
}
|
|
26995
27055
|
return;
|
|
@@ -27093,114 +27153,114 @@ const coerce = {
|
|
|
27093
27153
|
const NEVER = INVALID;
|
|
27094
27154
|
|
|
27095
27155
|
var z = /*#__PURE__*/Object.freeze({
|
|
27096
|
-
|
|
27097
|
-
|
|
27098
|
-
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
|
|
27102
|
-
|
|
27103
|
-
|
|
27104
|
-
|
|
27105
|
-
|
|
27106
|
-
|
|
27107
|
-
|
|
27108
|
-
|
|
27109
|
-
|
|
27110
|
-
|
|
27111
|
-
|
|
27112
|
-
|
|
27113
|
-
|
|
27114
|
-
|
|
27115
|
-
|
|
27116
|
-
|
|
27117
|
-
|
|
27118
|
-
|
|
27119
|
-
|
|
27120
|
-
|
|
27121
|
-
|
|
27122
|
-
|
|
27123
|
-
|
|
27124
|
-
|
|
27125
|
-
|
|
27126
|
-
|
|
27127
|
-
|
|
27128
|
-
|
|
27129
|
-
|
|
27130
|
-
|
|
27131
|
-
|
|
27132
|
-
|
|
27133
|
-
|
|
27134
|
-
|
|
27135
|
-
|
|
27136
|
-
|
|
27137
|
-
|
|
27138
|
-
|
|
27139
|
-
|
|
27140
|
-
|
|
27141
|
-
|
|
27142
|
-
|
|
27143
|
-
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
-
|
|
27149
|
-
|
|
27150
|
-
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
|
|
27154
|
-
|
|
27155
|
-
|
|
27156
|
-
|
|
27157
|
-
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27161
|
-
|
|
27162
|
-
|
|
27163
|
-
|
|
27164
|
-
|
|
27165
|
-
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
|
|
27171
|
-
|
|
27172
|
-
|
|
27173
|
-
|
|
27174
|
-
|
|
27175
|
-
|
|
27176
|
-
|
|
27177
|
-
|
|
27178
|
-
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
|
|
27187
|
-
|
|
27188
|
-
|
|
27189
|
-
|
|
27190
|
-
|
|
27191
|
-
|
|
27192
|
-
|
|
27193
|
-
|
|
27194
|
-
|
|
27195
|
-
|
|
27196
|
-
|
|
27197
|
-
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
|
|
27201
|
-
|
|
27202
|
-
|
|
27203
|
-
|
|
27156
|
+
__proto__: null,
|
|
27157
|
+
defaultErrorMap: errorMap,
|
|
27158
|
+
setErrorMap: setErrorMap,
|
|
27159
|
+
getErrorMap: getErrorMap,
|
|
27160
|
+
makeIssue: makeIssue,
|
|
27161
|
+
EMPTY_PATH: EMPTY_PATH,
|
|
27162
|
+
addIssueToContext: addIssueToContext,
|
|
27163
|
+
ParseStatus: ParseStatus,
|
|
27164
|
+
INVALID: INVALID,
|
|
27165
|
+
DIRTY: DIRTY,
|
|
27166
|
+
OK: OK,
|
|
27167
|
+
isAborted: isAborted,
|
|
27168
|
+
isDirty: isDirty,
|
|
27169
|
+
isValid: isValid$2,
|
|
27170
|
+
isAsync: isAsync,
|
|
27171
|
+
get util () { return util; },
|
|
27172
|
+
get objectUtil () { return objectUtil; },
|
|
27173
|
+
ZodParsedType: ZodParsedType,
|
|
27174
|
+
getParsedType: getParsedType,
|
|
27175
|
+
ZodType: ZodType,
|
|
27176
|
+
datetimeRegex: datetimeRegex,
|
|
27177
|
+
ZodString: ZodString,
|
|
27178
|
+
ZodNumber: ZodNumber,
|
|
27179
|
+
ZodBigInt: ZodBigInt,
|
|
27180
|
+
ZodBoolean: ZodBoolean,
|
|
27181
|
+
ZodDate: ZodDate,
|
|
27182
|
+
ZodSymbol: ZodSymbol,
|
|
27183
|
+
ZodUndefined: ZodUndefined,
|
|
27184
|
+
ZodNull: ZodNull,
|
|
27185
|
+
ZodAny: ZodAny,
|
|
27186
|
+
ZodUnknown: ZodUnknown,
|
|
27187
|
+
ZodNever: ZodNever,
|
|
27188
|
+
ZodVoid: ZodVoid,
|
|
27189
|
+
ZodArray: ZodArray,
|
|
27190
|
+
ZodObject: ZodObject,
|
|
27191
|
+
ZodUnion: ZodUnion,
|
|
27192
|
+
ZodDiscriminatedUnion: ZodDiscriminatedUnion,
|
|
27193
|
+
ZodIntersection: ZodIntersection,
|
|
27194
|
+
ZodTuple: ZodTuple,
|
|
27195
|
+
ZodRecord: ZodRecord,
|
|
27196
|
+
ZodMap: ZodMap,
|
|
27197
|
+
ZodSet: ZodSet,
|
|
27198
|
+
ZodFunction: ZodFunction,
|
|
27199
|
+
ZodLazy: ZodLazy,
|
|
27200
|
+
ZodLiteral: ZodLiteral,
|
|
27201
|
+
ZodEnum: ZodEnum,
|
|
27202
|
+
ZodNativeEnum: ZodNativeEnum,
|
|
27203
|
+
ZodPromise: ZodPromise,
|
|
27204
|
+
ZodEffects: ZodEffects,
|
|
27205
|
+
ZodTransformer: ZodEffects,
|
|
27206
|
+
ZodOptional: ZodOptional,
|
|
27207
|
+
ZodNullable: ZodNullable,
|
|
27208
|
+
ZodDefault: ZodDefault,
|
|
27209
|
+
ZodCatch: ZodCatch,
|
|
27210
|
+
ZodNaN: ZodNaN,
|
|
27211
|
+
BRAND: BRAND,
|
|
27212
|
+
ZodBranded: ZodBranded,
|
|
27213
|
+
ZodPipeline: ZodPipeline,
|
|
27214
|
+
ZodReadonly: ZodReadonly,
|
|
27215
|
+
custom: custom,
|
|
27216
|
+
Schema: ZodType,
|
|
27217
|
+
ZodSchema: ZodType,
|
|
27218
|
+
late: late,
|
|
27219
|
+
get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
|
|
27220
|
+
coerce: coerce,
|
|
27221
|
+
any: anyType,
|
|
27222
|
+
array: arrayType,
|
|
27223
|
+
bigint: bigIntType,
|
|
27224
|
+
boolean: booleanType,
|
|
27225
|
+
date: dateType,
|
|
27226
|
+
discriminatedUnion: discriminatedUnionType,
|
|
27227
|
+
effect: effectsType,
|
|
27228
|
+
'enum': enumType,
|
|
27229
|
+
'function': functionType,
|
|
27230
|
+
'instanceof': instanceOfType,
|
|
27231
|
+
intersection: intersectionType,
|
|
27232
|
+
lazy: lazyType,
|
|
27233
|
+
literal: literalType,
|
|
27234
|
+
map: mapType,
|
|
27235
|
+
nan: nanType,
|
|
27236
|
+
nativeEnum: nativeEnumType,
|
|
27237
|
+
never: neverType,
|
|
27238
|
+
'null': nullType,
|
|
27239
|
+
nullable: nullableType,
|
|
27240
|
+
number: numberType,
|
|
27241
|
+
object: objectType,
|
|
27242
|
+
oboolean: oboolean,
|
|
27243
|
+
onumber: onumber,
|
|
27244
|
+
optional: optionalType,
|
|
27245
|
+
ostring: ostring,
|
|
27246
|
+
pipeline: pipelineType,
|
|
27247
|
+
preprocess: preprocessType,
|
|
27248
|
+
promise: promiseType,
|
|
27249
|
+
record: recordType,
|
|
27250
|
+
set: setType,
|
|
27251
|
+
strictObject: strictObjectType,
|
|
27252
|
+
string: stringType,
|
|
27253
|
+
symbol: symbolType,
|
|
27254
|
+
transformer: effectsType,
|
|
27255
|
+
tuple: tupleType,
|
|
27256
|
+
'undefined': undefinedType,
|
|
27257
|
+
union: unionType,
|
|
27258
|
+
unknown: unknownType,
|
|
27259
|
+
'void': voidType,
|
|
27260
|
+
NEVER: NEVER,
|
|
27261
|
+
ZodIssueCode: ZodIssueCode,
|
|
27262
|
+
quotelessJson: quotelessJson,
|
|
27263
|
+
ZodError: ZodError
|
|
27204
27264
|
});
|
|
27205
27265
|
|
|
27206
27266
|
/*
|
|
@@ -28313,11 +28373,12 @@ const convertToZod = (schema) => {
|
|
|
28313
28373
|
}
|
|
28314
28374
|
}
|
|
28315
28375
|
if (Array.isArray(schema.required)) {
|
|
28316
|
-
return
|
|
28376
|
+
return z
|
|
28377
|
+
.object(obj)
|
|
28317
28378
|
.partial()
|
|
28318
28379
|
.required(schema.required.reduce((acc, v) => (Object.assign(Object.assign({}, acc), { [v]: true })), {}));
|
|
28319
28380
|
}
|
|
28320
|
-
return
|
|
28381
|
+
return z.object(obj).partial();
|
|
28321
28382
|
}
|
|
28322
28383
|
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' && (schema === null || schema === void 0 ? void 0 : schema.items)) {
|
|
28323
28384
|
if (Array.isArray(schema.items) && schema.items.length > 1
|
|
@@ -28330,22 +28391,22 @@ const convertToZod = (schema) => {
|
|
|
28330
28391
|
arr.push(zItem);
|
|
28331
28392
|
}
|
|
28332
28393
|
}
|
|
28333
|
-
return
|
|
28394
|
+
return z.tuple(arr);
|
|
28334
28395
|
}
|
|
28335
28396
|
const nextSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items;
|
|
28336
|
-
let zodArraySchema =
|
|
28397
|
+
let zodArraySchema = z.array(convertToZod(nextSchema));
|
|
28337
28398
|
zodArraySchema = schema.minItems !== undefined ? zodArraySchema.min(schema.minItems) : zodArraySchema;
|
|
28338
28399
|
zodArraySchema = schema.maxItems !== undefined ? zodArraySchema.max(schema.maxItems) : zodArraySchema;
|
|
28339
28400
|
return zodArraySchema;
|
|
28340
28401
|
}
|
|
28341
28402
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
28342
|
-
return
|
|
28403
|
+
return z.union(schema.oneOf.map(oneOfSchema => convertToZod(oneOfSchema)));
|
|
28343
28404
|
}
|
|
28344
28405
|
if (schema === null || schema === void 0 ? void 0 : schema.format) {
|
|
28345
28406
|
if (!formats[schema.format]) {
|
|
28346
28407
|
throw new SchemaFormatError(schema.format);
|
|
28347
28408
|
}
|
|
28348
|
-
return
|
|
28409
|
+
return z.any().refine(formats[schema.format], (value) => ({
|
|
28349
28410
|
params: { value, format: schema.format },
|
|
28350
28411
|
}));
|
|
28351
28412
|
}
|
|
@@ -28354,7 +28415,7 @@ const convertToZod = (schema) => {
|
|
|
28354
28415
|
typeof z[String(schema.type)] === 'function') {
|
|
28355
28416
|
return z[String(schema.type)]();
|
|
28356
28417
|
}
|
|
28357
|
-
return
|
|
28418
|
+
return z.object({ data: z.any() }).partial();
|
|
28358
28419
|
};
|
|
28359
28420
|
class Validator {
|
|
28360
28421
|
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
|
@@ -114500,14 +114561,6 @@ function requirePermessageDeflate () {
|
|
|
114500
114561
|
this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';
|
|
114501
114562
|
this[kError][kStatusCode] = 1009;
|
|
114502
114563
|
this.removeListener('data', inflateOnData);
|
|
114503
|
-
|
|
114504
|
-
//
|
|
114505
|
-
// The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the
|
|
114506
|
-
// fact that in Node.js versions prior to 13.10.0, the callback for
|
|
114507
|
-
// `zlib.flush()` is not called if `zlib.close()` is used. Utilizing
|
|
114508
|
-
// `zlib.reset()` ensures that either the callback is invoked or an error is
|
|
114509
|
-
// emitted.
|
|
114510
|
-
//
|
|
114511
114564
|
this.reset();
|
|
114512
114565
|
}
|
|
114513
114566
|
|
|
@@ -114523,12 +114576,6 @@ function requirePermessageDeflate () {
|
|
|
114523
114576
|
// closed when an error is emitted.
|
|
114524
114577
|
//
|
|
114525
114578
|
this[kPerMessageDeflate]._inflate = null;
|
|
114526
|
-
|
|
114527
|
-
if (this[kError]) {
|
|
114528
|
-
this[kCallback](this[kError]);
|
|
114529
|
-
return;
|
|
114530
|
-
}
|
|
114531
|
-
|
|
114532
114579
|
err[kStatusCode] = 1007;
|
|
114533
114580
|
this[kCallback](err);
|
|
114534
114581
|
}
|
|
@@ -115420,7 +115467,7 @@ function requireSender () {
|
|
|
115420
115467
|
hasRequiredSender = 1;
|
|
115421
115468
|
|
|
115422
115469
|
const { Duplex } = Stream;
|
|
115423
|
-
const { randomFillSync } =
|
|
115470
|
+
const { randomFillSync } = crypto$2;
|
|
115424
115471
|
|
|
115425
115472
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
115426
115473
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
|
|
@@ -116545,7 +116592,7 @@ function requireWebsocket () {
|
|
|
116545
116592
|
const http$1 = http;
|
|
116546
116593
|
const net = require$$3;
|
|
116547
116594
|
const tls = require$$4$1;
|
|
116548
|
-
const { randomBytes, createHash } =
|
|
116595
|
+
const { randomBytes, createHash } = crypto$2;
|
|
116549
116596
|
const { Duplex, Readable } = Stream;
|
|
116550
116597
|
const { URL } = Url;
|
|
116551
116598
|
|
|
@@ -117246,7 +117293,7 @@ function requireWebsocket () {
|
|
|
117246
117293
|
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
|
|
117247
117294
|
invalidUrlMessage =
|
|
117248
117295
|
'The URL\'s protocol must be one of "ws:", "wss:", ' +
|
|
117249
|
-
'"http:", "https
|
|
117296
|
+
'"http:", "https", or "ws+unix:"';
|
|
117250
117297
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
117251
117298
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
117252
117299
|
} else if (parsedUrl.hash) {
|
|
@@ -118179,7 +118226,7 @@ function requireWebsocketServer () {
|
|
|
118179
118226
|
const EventEmitter = require$$0$3;
|
|
118180
118227
|
const http$1 = http;
|
|
118181
118228
|
const { Duplex } = Stream;
|
|
118182
|
-
const { createHash } =
|
|
118229
|
+
const { createHash } = crypto$2;
|
|
118183
118230
|
|
|
118184
118231
|
const extension = requireExtension();
|
|
118185
118232
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
@@ -118430,11 +118477,9 @@ function requireWebsocketServer () {
|
|
|
118430
118477
|
return;
|
|
118431
118478
|
}
|
|
118432
118479
|
|
|
118433
|
-
if (version !==
|
|
118480
|
+
if (version !== 8 && version !== 13) {
|
|
118434
118481
|
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
|
118435
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
118436
|
-
'Sec-WebSocket-Version': '13, 8'
|
|
118437
|
-
});
|
|
118482
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
118438
118483
|
return;
|
|
118439
118484
|
}
|
|
118440
118485
|
|
|
@@ -118702,24 +118747,16 @@ function requireWebsocketServer () {
|
|
|
118702
118747
|
* @param {Duplex} socket The socket of the upgrade request
|
|
118703
118748
|
* @param {Number} code The HTTP response status code
|
|
118704
118749
|
* @param {String} message The HTTP response body
|
|
118705
|
-
* @param {Object} [headers] The HTTP response headers
|
|
118706
118750
|
* @private
|
|
118707
118751
|
*/
|
|
118708
|
-
function abortHandshakeOrEmitwsClientError(
|
|
118709
|
-
server,
|
|
118710
|
-
req,
|
|
118711
|
-
socket,
|
|
118712
|
-
code,
|
|
118713
|
-
message,
|
|
118714
|
-
headers
|
|
118715
|
-
) {
|
|
118752
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
118716
118753
|
if (server.listenerCount('wsClientError')) {
|
|
118717
118754
|
const err = new Error(message);
|
|
118718
118755
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
118719
118756
|
|
|
118720
118757
|
server.emit('wsClientError', err, socket, req);
|
|
118721
118758
|
} else {
|
|
118722
|
-
abortHandshake(socket, code, message
|
|
118759
|
+
abortHandshake(socket, code, message);
|
|
118723
118760
|
}
|
|
118724
118761
|
}
|
|
118725
118762
|
return websocketServer;
|
|
@@ -142456,16 +142493,33 @@ class Attestation extends Resource {
|
|
|
142456
142493
|
this.setResource({
|
|
142457
142494
|
createVinVC: {
|
|
142458
142495
|
method: 'POST',
|
|
142459
|
-
path: '/
|
|
142496
|
+
path: '/v2/attestation/vin/:tokenId',
|
|
142497
|
+
auth: 'vehicle_jwt'
|
|
142498
|
+
},
|
|
142499
|
+
createOdometerStatementVC: {
|
|
142500
|
+
method: 'POST',
|
|
142501
|
+
path: '/v2/attestation/odometer-statement/:tokenId',
|
|
142460
142502
|
auth: 'vehicle_jwt',
|
|
142461
|
-
|
|
142462
|
-
'
|
|
142503
|
+
body: {
|
|
142504
|
+
'timestamp': false // Optional parameter
|
|
142463
142505
|
}
|
|
142464
142506
|
},
|
|
142465
|
-
|
|
142507
|
+
createVehicleHealthVC: {
|
|
142466
142508
|
method: 'POST',
|
|
142467
|
-
path: '/
|
|
142468
|
-
auth: 'vehicle_jwt'
|
|
142509
|
+
path: '/v2/attestation/vehicle-health/:tokenId',
|
|
142510
|
+
auth: 'vehicle_jwt',
|
|
142511
|
+
body: {
|
|
142512
|
+
'startTime': true, // Required parameter
|
|
142513
|
+
'endTime': true // Required parameter
|
|
142514
|
+
}
|
|
142515
|
+
},
|
|
142516
|
+
createVehiclePositionVC: {
|
|
142517
|
+
method: 'POST',
|
|
142518
|
+
path: '/v2/attestation/vehicle-position/:tokenId',
|
|
142519
|
+
auth: 'vehicle_jwt',
|
|
142520
|
+
body: {
|
|
142521
|
+
'timestamp': true // Required parameter
|
|
142522
|
+
}
|
|
142469
142523
|
}
|
|
142470
142524
|
});
|
|
142471
142525
|
}
|
|
@@ -142612,9 +142666,9 @@ class Valuations extends Resource {
|
|
|
142612
142666
|
}
|
|
142613
142667
|
|
|
142614
142668
|
/** @format */
|
|
142615
|
-
class
|
|
142669
|
+
class VehicleTriggers extends Resource {
|
|
142616
142670
|
constructor(api, env) {
|
|
142617
|
-
super(api, '
|
|
142671
|
+
super(api, 'VehicleTriggers', env);
|
|
142618
142672
|
this.setResource({
|
|
142619
142673
|
listWebhooks: {
|
|
142620
142674
|
method: 'GET',
|
|
@@ -142626,13 +142680,14 @@ class VehicleEvents extends Resource {
|
|
|
142626
142680
|
path: '/v1/webhooks',
|
|
142627
142681
|
body: {
|
|
142628
142682
|
service: true,
|
|
142629
|
-
|
|
142630
|
-
|
|
142631
|
-
|
|
142683
|
+
metricName: true,
|
|
142684
|
+
condition: true,
|
|
142685
|
+
coolDownPeriod: true,
|
|
142632
142686
|
description: false,
|
|
142633
|
-
|
|
142687
|
+
targetURL: true,
|
|
142634
142688
|
status: true,
|
|
142635
|
-
|
|
142689
|
+
verificationToken: true,
|
|
142690
|
+
displayName: false
|
|
142636
142691
|
},
|
|
142637
142692
|
auth: 'developer_jwt',
|
|
142638
142693
|
},
|
|
@@ -142640,14 +142695,7 @@ class VehicleEvents extends Resource {
|
|
|
142640
142695
|
method: 'PUT',
|
|
142641
142696
|
path: '/v1/webhooks/:webhookId',
|
|
142642
142697
|
body: {
|
|
142643
|
-
|
|
142644
|
-
data: true,
|
|
142645
|
-
trigger: true,
|
|
142646
|
-
setup: true,
|
|
142647
|
-
description: false,
|
|
142648
|
-
target_uri: true,
|
|
142649
|
-
status: true,
|
|
142650
|
-
verification_token: true,
|
|
142698
|
+
request: true
|
|
142651
142699
|
},
|
|
142652
142700
|
auth: 'developer_jwt',
|
|
142653
142701
|
},
|
|
@@ -142668,12 +142716,12 @@ class VehicleEvents extends Resource {
|
|
|
142668
142716
|
},
|
|
142669
142717
|
listVehicleSubscriptions: {
|
|
142670
142718
|
method: 'GET',
|
|
142671
|
-
path: '/v1/webhooks/vehicles/:
|
|
142719
|
+
path: '/v1/webhooks/vehicles/:tokenDID',
|
|
142672
142720
|
auth: 'developer_jwt',
|
|
142673
142721
|
},
|
|
142674
142722
|
subscribeVehicle: {
|
|
142675
142723
|
method: 'POST',
|
|
142676
|
-
path: '/v1/webhooks/:webhookId/subscribe/:
|
|
142724
|
+
path: '/v1/webhooks/:webhookId/subscribe/:tokenDID',
|
|
142677
142725
|
auth: 'developer_jwt',
|
|
142678
142726
|
},
|
|
142679
142727
|
subscribeAllVehicles: {
|
|
@@ -142683,7 +142731,7 @@ class VehicleEvents extends Resource {
|
|
|
142683
142731
|
},
|
|
142684
142732
|
unsubscribeVehicle: {
|
|
142685
142733
|
method: 'DELETE',
|
|
142686
|
-
path: '/v1/webhooks/:webhookId/unsubscribe/:
|
|
142734
|
+
path: '/v1/webhooks/:webhookId/unsubscribe/:tokenDID',
|
|
142687
142735
|
auth: 'developer_jwt',
|
|
142688
142736
|
},
|
|
142689
142737
|
unsubscribeAllVehicles: {
|
|
@@ -142708,5 +142756,5 @@ exports.Telemetry = Telemetry;
|
|
|
142708
142756
|
exports.TokenExchange = TokenExchange;
|
|
142709
142757
|
exports.Trips = Trips;
|
|
142710
142758
|
exports.Valuations = Valuations;
|
|
142711
|
-
exports.
|
|
142759
|
+
exports.VehicleTriggers = VehicleTriggers;
|
|
142712
142760
|
//# sourceMappingURL=index.js.map
|