@dimo-network/data-sdk 1.3.3 → 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/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 +532 -501
- 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 +532 -501
- 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 +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import http from 'http';
|
|
|
5
5
|
import https from 'https';
|
|
6
6
|
import Url from 'url';
|
|
7
7
|
import require$$6 from 'fs';
|
|
8
|
-
import
|
|
8
|
+
import crypto$2 from 'crypto';
|
|
9
9
|
import require$$4 from 'assert';
|
|
10
10
|
import require$$1$3 from 'tty';
|
|
11
11
|
import require$$0$2 from 'os';
|
|
@@ -26,7 +26,6 @@ function bind(fn, thisArg) {
|
|
|
26
26
|
|
|
27
27
|
const {toString} = Object.prototype;
|
|
28
28
|
const {getPrototypeOf} = Object;
|
|
29
|
-
const {iterator, toStringTag} = Symbol;
|
|
30
29
|
|
|
31
30
|
const kindOf = (cache => thing => {
|
|
32
31
|
const str = toString.call(thing);
|
|
@@ -153,28 +152,7 @@ const isPlainObject = (val) => {
|
|
|
153
152
|
}
|
|
154
153
|
|
|
155
154
|
const prototype = getPrototypeOf(val);
|
|
156
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Determine if a value is an empty object (safely handles Buffers)
|
|
161
|
-
*
|
|
162
|
-
* @param {*} val The value to test
|
|
163
|
-
*
|
|
164
|
-
* @returns {boolean} True if value is an empty object, otherwise false
|
|
165
|
-
*/
|
|
166
|
-
const isEmptyObject = (val) => {
|
|
167
|
-
// Early return for non-objects or Buffers to prevent RangeError
|
|
168
|
-
if (!isObject$1(val) || isBuffer(val)) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
try {
|
|
173
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
174
|
-
} catch (e) {
|
|
175
|
-
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
155
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
178
156
|
};
|
|
179
157
|
|
|
180
158
|
/**
|
|
@@ -299,11 +277,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
299
277
|
fn.call(null, obj[i], i, obj);
|
|
300
278
|
}
|
|
301
279
|
} else {
|
|
302
|
-
// Buffer check
|
|
303
|
-
if (isBuffer(obj)) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
280
|
// Iterate over object keys
|
|
308
281
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
309
282
|
const len = keys.length;
|
|
@@ -317,10 +290,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
317
290
|
}
|
|
318
291
|
|
|
319
292
|
function findKey(obj, key) {
|
|
320
|
-
if (isBuffer(obj)){
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
293
|
key = key.toLowerCase();
|
|
325
294
|
const keys = Object.keys(obj);
|
|
326
295
|
let i = keys.length;
|
|
@@ -534,13 +503,13 @@ const isTypedArray = (TypedArray => {
|
|
|
534
503
|
* @returns {void}
|
|
535
504
|
*/
|
|
536
505
|
const forEachEntry = (obj, fn) => {
|
|
537
|
-
const generator = obj && obj[iterator];
|
|
506
|
+
const generator = obj && obj[Symbol.iterator];
|
|
538
507
|
|
|
539
|
-
const
|
|
508
|
+
const iterator = generator.call(obj);
|
|
540
509
|
|
|
541
510
|
let result;
|
|
542
511
|
|
|
543
|
-
while ((result =
|
|
512
|
+
while ((result = iterator.next()) && !result.done) {
|
|
544
513
|
const pair = result.value;
|
|
545
514
|
fn.call(obj, pair[0], pair[1]);
|
|
546
515
|
}
|
|
@@ -661,7 +630,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
661
630
|
* @returns {boolean}
|
|
662
631
|
*/
|
|
663
632
|
function isSpecCompliantForm(thing) {
|
|
664
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
633
|
+
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
665
634
|
}
|
|
666
635
|
|
|
667
636
|
const toJSONObject = (obj) => {
|
|
@@ -674,11 +643,6 @@ const toJSONObject = (obj) => {
|
|
|
674
643
|
return;
|
|
675
644
|
}
|
|
676
645
|
|
|
677
|
-
//Buffer check
|
|
678
|
-
if (isBuffer(source)) {
|
|
679
|
-
return source;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
646
|
if(!('toJSON' in source)) {
|
|
683
647
|
stack[i] = source;
|
|
684
648
|
const target = isArray(source) ? [] : {};
|
|
@@ -735,10 +699,6 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
735
699
|
|
|
736
700
|
// *********************
|
|
737
701
|
|
|
738
|
-
|
|
739
|
-
const isIterable$1 = (thing) => thing != null && isFunction(thing[iterator]);
|
|
740
|
-
|
|
741
|
-
|
|
742
702
|
var utils$4 = {
|
|
743
703
|
isArray,
|
|
744
704
|
isArrayBuffer,
|
|
@@ -750,7 +710,6 @@ var utils$4 = {
|
|
|
750
710
|
isBoolean: isBoolean$1,
|
|
751
711
|
isObject: isObject$1,
|
|
752
712
|
isPlainObject,
|
|
753
|
-
isEmptyObject,
|
|
754
713
|
isReadableStream,
|
|
755
714
|
isRequest: isRequest$1,
|
|
756
715
|
isResponse,
|
|
@@ -795,8 +754,7 @@ var utils$4 = {
|
|
|
795
754
|
isAsyncFn,
|
|
796
755
|
isThenable,
|
|
797
756
|
setImmediate: _setImmediate,
|
|
798
|
-
asap
|
|
799
|
-
isIterable: isIterable$1
|
|
757
|
+
asap
|
|
800
758
|
};
|
|
801
759
|
|
|
802
760
|
/**
|
|
@@ -908,11 +866,7 @@ function getAugmentedNamespace(n) {
|
|
|
908
866
|
var f = n.default;
|
|
909
867
|
if (typeof f == "function") {
|
|
910
868
|
var a = function a () {
|
|
911
|
-
|
|
912
|
-
try {
|
|
913
|
-
isInstance = this instanceof a;
|
|
914
|
-
} catch {}
|
|
915
|
-
if (isInstance) {
|
|
869
|
+
if (this instanceof a) {
|
|
916
870
|
return Reflect.construct(f, arguments, this.constructor);
|
|
917
871
|
}
|
|
918
872
|
return f.apply(this, arguments);
|
|
@@ -13633,7 +13587,7 @@ function requireGetIntrinsic () {
|
|
|
13633
13587
|
if (!allowMissing) {
|
|
13634
13588
|
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
13635
13589
|
}
|
|
13636
|
-
return void
|
|
13590
|
+
return void 0;
|
|
13637
13591
|
}
|
|
13638
13592
|
if ($gOPD && (i + 1) >= parts.length) {
|
|
13639
13593
|
var desc = $gOPD(value, part);
|
|
@@ -13731,11 +13685,12 @@ var hasRequiredPopulate;
|
|
|
13731
13685
|
function requirePopulate () {
|
|
13732
13686
|
if (hasRequiredPopulate) return populate;
|
|
13733
13687
|
hasRequiredPopulate = 1;
|
|
13734
|
-
|
|
13735
13688
|
// populates missing values
|
|
13736
|
-
populate = function
|
|
13737
|
-
|
|
13738
|
-
|
|
13689
|
+
populate = function(dst, src) {
|
|
13690
|
+
|
|
13691
|
+
Object.keys(src).forEach(function(prop)
|
|
13692
|
+
{
|
|
13693
|
+
dst[prop] = dst[prop] || src[prop];
|
|
13739
13694
|
});
|
|
13740
13695
|
|
|
13741
13696
|
return dst;
|
|
@@ -13749,7 +13704,6 @@ var hasRequiredForm_data;
|
|
|
13749
13704
|
function requireForm_data () {
|
|
13750
13705
|
if (hasRequiredForm_data) return form_data;
|
|
13751
13706
|
hasRequiredForm_data = 1;
|
|
13752
|
-
|
|
13753
13707
|
var CombinedStream = requireCombined_stream();
|
|
13754
13708
|
var util = require$$1$1;
|
|
13755
13709
|
var path = require$$1$2;
|
|
@@ -13758,20 +13712,24 @@ function requireForm_data () {
|
|
|
13758
13712
|
var parseUrl = Url.parse;
|
|
13759
13713
|
var fs = require$$6;
|
|
13760
13714
|
var Stream$1 = Stream.Stream;
|
|
13761
|
-
var crypto = require$$8;
|
|
13762
13715
|
var mime = requireMimeTypes();
|
|
13763
13716
|
var asynckit = requireAsynckit();
|
|
13764
13717
|
var setToStringTag = /*@__PURE__*/ requireEsSetTostringtag();
|
|
13765
|
-
var hasOwn = /*@__PURE__*/ requireHasown();
|
|
13766
13718
|
var populate = requirePopulate();
|
|
13767
13719
|
|
|
13720
|
+
// Public API
|
|
13721
|
+
form_data = FormData;
|
|
13722
|
+
|
|
13723
|
+
// make it a Stream
|
|
13724
|
+
util.inherits(FormData, CombinedStream);
|
|
13725
|
+
|
|
13768
13726
|
/**
|
|
13769
13727
|
* Create readable "multipart/form-data" streams.
|
|
13770
13728
|
* Can be used to submit forms
|
|
13771
13729
|
* and file uploads to other web applications.
|
|
13772
13730
|
*
|
|
13773
13731
|
* @constructor
|
|
13774
|
-
* @param {
|
|
13732
|
+
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
|
13775
13733
|
*/
|
|
13776
13734
|
function FormData(options) {
|
|
13777
13735
|
if (!(this instanceof FormData)) {
|
|
@@ -13784,39 +13742,35 @@ function requireForm_data () {
|
|
|
13784
13742
|
|
|
13785
13743
|
CombinedStream.call(this);
|
|
13786
13744
|
|
|
13787
|
-
options = options || {};
|
|
13788
|
-
for (var option in options) {
|
|
13745
|
+
options = options || {};
|
|
13746
|
+
for (var option in options) {
|
|
13789
13747
|
this[option] = options[option];
|
|
13790
13748
|
}
|
|
13791
13749
|
}
|
|
13792
13750
|
|
|
13793
|
-
// make it a Stream
|
|
13794
|
-
util.inherits(FormData, CombinedStream);
|
|
13795
|
-
|
|
13796
13751
|
FormData.LINE_BREAK = '\r\n';
|
|
13797
13752
|
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
|
13798
13753
|
|
|
13799
|
-
FormData.prototype.append = function
|
|
13800
|
-
|
|
13754
|
+
FormData.prototype.append = function(field, value, options) {
|
|
13755
|
+
|
|
13756
|
+
options = options || {};
|
|
13801
13757
|
|
|
13802
13758
|
// allow filename as single option
|
|
13803
|
-
if (typeof options
|
|
13804
|
-
options = {
|
|
13759
|
+
if (typeof options == 'string') {
|
|
13760
|
+
options = {filename: options};
|
|
13805
13761
|
}
|
|
13806
13762
|
|
|
13807
13763
|
var append = CombinedStream.prototype.append.bind(this);
|
|
13808
13764
|
|
|
13809
13765
|
// all that streamy business can't handle numbers
|
|
13810
|
-
if (typeof value
|
|
13811
|
-
value =
|
|
13766
|
+
if (typeof value == 'number') {
|
|
13767
|
+
value = '' + value;
|
|
13812
13768
|
}
|
|
13813
13769
|
|
|
13814
13770
|
// https://github.com/felixge/node-form-data/issues/38
|
|
13815
13771
|
if (Array.isArray(value)) {
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
* the way web server expects it
|
|
13819
|
-
*/
|
|
13772
|
+
// Please convert your array into string
|
|
13773
|
+
// the way web server expects it
|
|
13820
13774
|
this._error(new Error('Arrays are not supported.'));
|
|
13821
13775
|
return;
|
|
13822
13776
|
}
|
|
@@ -13832,17 +13786,15 @@ function requireForm_data () {
|
|
|
13832
13786
|
this._trackLength(header, value, options);
|
|
13833
13787
|
};
|
|
13834
13788
|
|
|
13835
|
-
FormData.prototype._trackLength = function
|
|
13789
|
+
FormData.prototype._trackLength = function(header, value, options) {
|
|
13836
13790
|
var valueLength = 0;
|
|
13837
13791
|
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
* incoming file to finish to get its size.
|
|
13843
|
-
*/
|
|
13792
|
+
// used w/ getLengthSync(), when length is known.
|
|
13793
|
+
// e.g. for streaming directly from a remote server,
|
|
13794
|
+
// w/ a known file a size, and not wanting to wait for
|
|
13795
|
+
// incoming file to finish to get its size.
|
|
13844
13796
|
if (options.knownLength != null) {
|
|
13845
|
-
valueLength +=
|
|
13797
|
+
valueLength += +options.knownLength;
|
|
13846
13798
|
} else if (Buffer.isBuffer(value)) {
|
|
13847
13799
|
valueLength = value.length;
|
|
13848
13800
|
} else if (typeof value === 'string') {
|
|
@@ -13852,10 +13804,12 @@ function requireForm_data () {
|
|
|
13852
13804
|
this._valueLength += valueLength;
|
|
13853
13805
|
|
|
13854
13806
|
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
|
13855
|
-
this._overheadLength +=
|
|
13807
|
+
this._overheadLength +=
|
|
13808
|
+
Buffer.byteLength(header) +
|
|
13809
|
+
FormData.LINE_BREAK.length;
|
|
13856
13810
|
|
|
13857
13811
|
// empty or either doesn't have path or not an http response or not a stream
|
|
13858
|
-
if (!value || (!value.path && !(value.readable &&
|
|
13812
|
+
if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream$1))) {
|
|
13859
13813
|
return;
|
|
13860
13814
|
}
|
|
13861
13815
|
|
|
@@ -13865,8 +13819,9 @@ function requireForm_data () {
|
|
|
13865
13819
|
}
|
|
13866
13820
|
};
|
|
13867
13821
|
|
|
13868
|
-
FormData.prototype._lengthRetriever = function
|
|
13869
|
-
if (
|
|
13822
|
+
FormData.prototype._lengthRetriever = function(value, callback) {
|
|
13823
|
+
if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
|
|
13824
|
+
|
|
13870
13825
|
// take read range into a account
|
|
13871
13826
|
// `end` = Infinity –> read file till the end
|
|
13872
13827
|
//
|
|
@@ -13875,52 +13830,54 @@ function requireForm_data () {
|
|
|
13875
13830
|
// Fix it when node fixes it.
|
|
13876
13831
|
// https://github.com/joyent/node/issues/7819
|
|
13877
13832
|
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
|
13833
|
+
|
|
13878
13834
|
// when end specified
|
|
13879
13835
|
// no need to calculate range
|
|
13880
13836
|
// inclusive, starts with 0
|
|
13881
|
-
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
13837
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
13882
13838
|
|
|
13883
|
-
|
|
13839
|
+
// not that fast snoopy
|
|
13884
13840
|
} else {
|
|
13885
13841
|
// still need to fetch file size from fs
|
|
13886
|
-
fs.stat(value.path, function
|
|
13842
|
+
fs.stat(value.path, function(err, stat) {
|
|
13843
|
+
|
|
13844
|
+
var fileSize;
|
|
13845
|
+
|
|
13887
13846
|
if (err) {
|
|
13888
13847
|
callback(err);
|
|
13889
13848
|
return;
|
|
13890
13849
|
}
|
|
13891
13850
|
|
|
13892
13851
|
// update final size based on the range options
|
|
13893
|
-
|
|
13852
|
+
fileSize = stat.size - (value.start ? value.start : 0);
|
|
13894
13853
|
callback(null, fileSize);
|
|
13895
13854
|
});
|
|
13896
13855
|
}
|
|
13897
13856
|
|
|
13898
|
-
|
|
13899
|
-
} else if (
|
|
13900
|
-
callback(null,
|
|
13857
|
+
// or http response
|
|
13858
|
+
} else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
|
13859
|
+
callback(null, +value.headers['content-length']);
|
|
13901
13860
|
|
|
13902
|
-
|
|
13903
|
-
} else if (
|
|
13861
|
+
// or request stream http://github.com/mikeal/request
|
|
13862
|
+
} else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
|
|
13904
13863
|
// wait till response come back
|
|
13905
|
-
value.on('response', function
|
|
13864
|
+
value.on('response', function(response) {
|
|
13906
13865
|
value.pause();
|
|
13907
|
-
callback(null,
|
|
13866
|
+
callback(null, +response.headers['content-length']);
|
|
13908
13867
|
});
|
|
13909
13868
|
value.resume();
|
|
13910
13869
|
|
|
13911
|
-
|
|
13870
|
+
// something else
|
|
13912
13871
|
} else {
|
|
13913
|
-
callback('Unknown stream');
|
|
13872
|
+
callback('Unknown stream');
|
|
13914
13873
|
}
|
|
13915
13874
|
};
|
|
13916
13875
|
|
|
13917
|
-
FormData.prototype._multiPartHeader = function
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
*/
|
|
13923
|
-
if (typeof options.header === 'string') {
|
|
13876
|
+
FormData.prototype._multiPartHeader = function(field, value, options) {
|
|
13877
|
+
// custom header specified (as string)?
|
|
13878
|
+
// it becomes responsible for boundary
|
|
13879
|
+
// (e.g. to handle extra CRLFs on .NET servers)
|
|
13880
|
+
if (typeof options.header == 'string') {
|
|
13924
13881
|
return options.header;
|
|
13925
13882
|
}
|
|
13926
13883
|
|
|
@@ -13928,7 +13885,7 @@ function requireForm_data () {
|
|
|
13928
13885
|
var contentType = this._getContentType(value, options);
|
|
13929
13886
|
|
|
13930
13887
|
var contents = '';
|
|
13931
|
-
var headers
|
|
13888
|
+
var headers = {
|
|
13932
13889
|
// add custom disposition as third element or keep it two elements if not
|
|
13933
13890
|
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
13934
13891
|
// if no content type. allow it to be empty array
|
|
@@ -13936,18 +13893,18 @@ function requireForm_data () {
|
|
|
13936
13893
|
};
|
|
13937
13894
|
|
|
13938
13895
|
// allow custom headers.
|
|
13939
|
-
if (typeof options.header
|
|
13896
|
+
if (typeof options.header == 'object') {
|
|
13940
13897
|
populate(headers, options.header);
|
|
13941
13898
|
}
|
|
13942
13899
|
|
|
13943
13900
|
var header;
|
|
13944
|
-
for (var prop in headers) {
|
|
13945
|
-
if (
|
|
13901
|
+
for (var prop in headers) {
|
|
13902
|
+
if (Object.prototype.hasOwnProperty.call(headers, prop)) {
|
|
13946
13903
|
header = headers[prop];
|
|
13947
13904
|
|
|
13948
13905
|
// skip nullish headers.
|
|
13949
13906
|
if (header == null) {
|
|
13950
|
-
continue;
|
|
13907
|
+
continue;
|
|
13951
13908
|
}
|
|
13952
13909
|
|
|
13953
13910
|
// convert all headers to arrays.
|
|
@@ -13965,45 +13922,49 @@ function requireForm_data () {
|
|
|
13965
13922
|
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
|
13966
13923
|
};
|
|
13967
13924
|
|
|
13968
|
-
FormData.prototype._getContentDisposition = function
|
|
13969
|
-
|
|
13925
|
+
FormData.prototype._getContentDisposition = function(value, options) {
|
|
13926
|
+
|
|
13927
|
+
var filename
|
|
13928
|
+
, contentDisposition
|
|
13929
|
+
;
|
|
13970
13930
|
|
|
13971
13931
|
if (typeof options.filepath === 'string') {
|
|
13972
13932
|
// custom filepath for relative paths
|
|
13973
13933
|
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
|
13974
|
-
} else if (options.filename ||
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
filename = path.basename(options.filename || (value && (value.name || value.path)));
|
|
13981
|
-
} else if (value && value.readable && hasOwn(value, 'httpVersion')) {
|
|
13934
|
+
} else if (options.filename || value.name || value.path) {
|
|
13935
|
+
// custom filename take precedence
|
|
13936
|
+
// formidable and the browser add a name property
|
|
13937
|
+
// fs- and request- streams have path property
|
|
13938
|
+
filename = path.basename(options.filename || value.name || value.path);
|
|
13939
|
+
} else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
|
13982
13940
|
// or try http response
|
|
13983
13941
|
filename = path.basename(value.client._httpMessage.path || '');
|
|
13984
13942
|
}
|
|
13985
13943
|
|
|
13986
13944
|
if (filename) {
|
|
13987
|
-
|
|
13945
|
+
contentDisposition = 'filename="' + filename + '"';
|
|
13988
13946
|
}
|
|
13947
|
+
|
|
13948
|
+
return contentDisposition;
|
|
13989
13949
|
};
|
|
13990
13950
|
|
|
13991
|
-
FormData.prototype._getContentType = function
|
|
13951
|
+
FormData.prototype._getContentType = function(value, options) {
|
|
13952
|
+
|
|
13992
13953
|
// use custom content-type above all
|
|
13993
13954
|
var contentType = options.contentType;
|
|
13994
13955
|
|
|
13995
13956
|
// or try `name` from formidable, browser
|
|
13996
|
-
if (!contentType && value
|
|
13957
|
+
if (!contentType && value.name) {
|
|
13997
13958
|
contentType = mime.lookup(value.name);
|
|
13998
13959
|
}
|
|
13999
13960
|
|
|
14000
13961
|
// or try `path` from fs-, request- streams
|
|
14001
|
-
if (!contentType && value
|
|
13962
|
+
if (!contentType && value.path) {
|
|
14002
13963
|
contentType = mime.lookup(value.path);
|
|
14003
13964
|
}
|
|
14004
13965
|
|
|
14005
13966
|
// or if it's http-reponse
|
|
14006
|
-
if (!contentType && value
|
|
13967
|
+
if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
|
|
14007
13968
|
contentType = value.headers['content-type'];
|
|
14008
13969
|
}
|
|
14009
13970
|
|
|
@@ -14013,18 +13974,18 @@ function requireForm_data () {
|
|
|
14013
13974
|
}
|
|
14014
13975
|
|
|
14015
13976
|
// fallback to the default content type if `value` is not simple value
|
|
14016
|
-
if (!contentType &&
|
|
13977
|
+
if (!contentType && typeof value == 'object') {
|
|
14017
13978
|
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
|
14018
13979
|
}
|
|
14019
13980
|
|
|
14020
13981
|
return contentType;
|
|
14021
13982
|
};
|
|
14022
13983
|
|
|
14023
|
-
FormData.prototype._multiPartFooter = function
|
|
14024
|
-
return function
|
|
13984
|
+
FormData.prototype._multiPartFooter = function() {
|
|
13985
|
+
return function(next) {
|
|
14025
13986
|
var footer = FormData.LINE_BREAK;
|
|
14026
13987
|
|
|
14027
|
-
var lastPart = this._streams.length === 0;
|
|
13988
|
+
var lastPart = (this._streams.length === 0);
|
|
14028
13989
|
if (lastPart) {
|
|
14029
13990
|
footer += this._lastBoundary();
|
|
14030
13991
|
}
|
|
@@ -14033,18 +13994,18 @@ function requireForm_data () {
|
|
|
14033
13994
|
}.bind(this);
|
|
14034
13995
|
};
|
|
14035
13996
|
|
|
14036
|
-
FormData.prototype._lastBoundary = function
|
|
13997
|
+
FormData.prototype._lastBoundary = function() {
|
|
14037
13998
|
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
|
14038
13999
|
};
|
|
14039
14000
|
|
|
14040
|
-
FormData.prototype.getHeaders = function
|
|
14001
|
+
FormData.prototype.getHeaders = function(userHeaders) {
|
|
14041
14002
|
var header;
|
|
14042
14003
|
var formHeaders = {
|
|
14043
14004
|
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
|
14044
14005
|
};
|
|
14045
14006
|
|
|
14046
|
-
for (header in userHeaders) {
|
|
14047
|
-
if (
|
|
14007
|
+
for (header in userHeaders) {
|
|
14008
|
+
if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
|
|
14048
14009
|
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
14049
14010
|
}
|
|
14050
14011
|
}
|
|
@@ -14052,14 +14013,11 @@ function requireForm_data () {
|
|
|
14052
14013
|
return formHeaders;
|
|
14053
14014
|
};
|
|
14054
14015
|
|
|
14055
|
-
FormData.prototype.setBoundary = function
|
|
14056
|
-
if (typeof boundary !== 'string') {
|
|
14057
|
-
throw new TypeError('FormData boundary must be a string');
|
|
14058
|
-
}
|
|
14016
|
+
FormData.prototype.setBoundary = function(boundary) {
|
|
14059
14017
|
this._boundary = boundary;
|
|
14060
14018
|
};
|
|
14061
14019
|
|
|
14062
|
-
FormData.prototype.getBoundary = function
|
|
14020
|
+
FormData.prototype.getBoundary = function() {
|
|
14063
14021
|
if (!this._boundary) {
|
|
14064
14022
|
this._generateBoundary();
|
|
14065
14023
|
}
|
|
@@ -14067,55 +14025,60 @@ function requireForm_data () {
|
|
|
14067
14025
|
return this._boundary;
|
|
14068
14026
|
};
|
|
14069
14027
|
|
|
14070
|
-
FormData.prototype.getBuffer = function
|
|
14071
|
-
var dataBuffer = new Buffer.alloc(0);
|
|
14028
|
+
FormData.prototype.getBuffer = function() {
|
|
14029
|
+
var dataBuffer = new Buffer.alloc(0);
|
|
14072
14030
|
var boundary = this.getBoundary();
|
|
14073
14031
|
|
|
14074
14032
|
// Create the form content. Add Line breaks to the end of data.
|
|
14075
14033
|
for (var i = 0, len = this._streams.length; i < len; i++) {
|
|
14076
14034
|
if (typeof this._streams[i] !== 'function') {
|
|
14035
|
+
|
|
14077
14036
|
// Add content to the buffer.
|
|
14078
|
-
if
|
|
14079
|
-
dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
|
|
14080
|
-
}
|
|
14081
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
|
|
14037
|
+
if(Buffer.isBuffer(this._streams[i])) {
|
|
14038
|
+
dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
|
|
14039
|
+
}else {
|
|
14040
|
+
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
|
|
14082
14041
|
}
|
|
14083
14042
|
|
|
14084
14043
|
// Add break after content.
|
|
14085
|
-
if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
|
|
14086
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]);
|
|
14044
|
+
if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
|
|
14045
|
+
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
|
|
14087
14046
|
}
|
|
14088
14047
|
}
|
|
14089
14048
|
}
|
|
14090
14049
|
|
|
14091
14050
|
// Add the footer and return the Buffer object.
|
|
14092
|
-
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
14051
|
+
return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
|
|
14093
14052
|
};
|
|
14094
14053
|
|
|
14095
|
-
FormData.prototype._generateBoundary = function
|
|
14054
|
+
FormData.prototype._generateBoundary = function() {
|
|
14096
14055
|
// This generates a 50 character boundary similar to those used by Firefox.
|
|
14097
|
-
|
|
14098
14056
|
// They are optimized for boyer-moore parsing.
|
|
14099
|
-
|
|
14057
|
+
var boundary = '--------------------------';
|
|
14058
|
+
for (var i = 0; i < 24; i++) {
|
|
14059
|
+
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
14060
|
+
}
|
|
14061
|
+
|
|
14062
|
+
this._boundary = boundary;
|
|
14100
14063
|
};
|
|
14101
14064
|
|
|
14102
14065
|
// Note: getLengthSync DOESN'T calculate streams length
|
|
14103
|
-
// As workaround one can calculate file size manually
|
|
14104
|
-
|
|
14066
|
+
// As workaround one can calculate file size manually
|
|
14067
|
+
// and add it as knownLength option
|
|
14068
|
+
FormData.prototype.getLengthSync = function() {
|
|
14105
14069
|
var knownLength = this._overheadLength + this._valueLength;
|
|
14106
14070
|
|
|
14107
|
-
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
14071
|
+
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
14072
|
+
// so it basically checks if there is any value added to the form
|
|
14108
14073
|
if (this._streams.length) {
|
|
14109
14074
|
knownLength += this._lastBoundary().length;
|
|
14110
14075
|
}
|
|
14111
14076
|
|
|
14112
14077
|
// https://github.com/form-data/form-data/issues/40
|
|
14113
14078
|
if (!this.hasKnownLength()) {
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
* Please use getLength(callback) to get proper length
|
|
14118
|
-
*/
|
|
14079
|
+
// Some async length retrievers are present
|
|
14080
|
+
// therefore synchronous length calculation is false.
|
|
14081
|
+
// Please use getLength(callback) to get proper length
|
|
14119
14082
|
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
|
14120
14083
|
}
|
|
14121
14084
|
|
|
@@ -14125,7 +14088,7 @@ function requireForm_data () {
|
|
|
14125
14088
|
// Public API to check if length of added values is known
|
|
14126
14089
|
// https://github.com/form-data/form-data/issues/196
|
|
14127
14090
|
// https://github.com/form-data/form-data/issues/262
|
|
14128
|
-
FormData.prototype.hasKnownLength = function
|
|
14091
|
+
FormData.prototype.hasKnownLength = function() {
|
|
14129
14092
|
var hasKnownLength = true;
|
|
14130
14093
|
|
|
14131
14094
|
if (this._valuesToMeasure.length) {
|
|
@@ -14135,7 +14098,7 @@ function requireForm_data () {
|
|
|
14135
14098
|
return hasKnownLength;
|
|
14136
14099
|
};
|
|
14137
14100
|
|
|
14138
|
-
FormData.prototype.getLength = function
|
|
14101
|
+
FormData.prototype.getLength = function(cb) {
|
|
14139
14102
|
var knownLength = this._overheadLength + this._valueLength;
|
|
14140
14103
|
|
|
14141
14104
|
if (this._streams.length) {
|
|
@@ -14147,13 +14110,13 @@ function requireForm_data () {
|
|
|
14147
14110
|
return;
|
|
14148
14111
|
}
|
|
14149
14112
|
|
|
14150
|
-
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function
|
|
14113
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
14151
14114
|
if (err) {
|
|
14152
14115
|
cb(err);
|
|
14153
14116
|
return;
|
|
14154
14117
|
}
|
|
14155
14118
|
|
|
14156
|
-
values.forEach(function
|
|
14119
|
+
values.forEach(function(length) {
|
|
14157
14120
|
knownLength += length;
|
|
14158
14121
|
});
|
|
14159
14122
|
|
|
@@ -14161,26 +14124,31 @@ function requireForm_data () {
|
|
|
14161
14124
|
});
|
|
14162
14125
|
};
|
|
14163
14126
|
|
|
14164
|
-
FormData.prototype.submit = function
|
|
14165
|
-
var request
|
|
14166
|
-
|
|
14167
|
-
|
|
14127
|
+
FormData.prototype.submit = function(params, cb) {
|
|
14128
|
+
var request
|
|
14129
|
+
, options
|
|
14130
|
+
, defaults = {method: 'post'}
|
|
14131
|
+
;
|
|
14132
|
+
|
|
14133
|
+
// parse provided url if it's string
|
|
14134
|
+
// or treat it as options object
|
|
14135
|
+
if (typeof params == 'string') {
|
|
14168
14136
|
|
|
14169
|
-
|
|
14170
|
-
if (typeof params === 'string') {
|
|
14171
|
-
params = parseUrl(params); // eslint-disable-line no-param-reassign
|
|
14172
|
-
/* eslint sort-keys: 0 */
|
|
14137
|
+
params = parseUrl(params);
|
|
14173
14138
|
options = populate({
|
|
14174
14139
|
port: params.port,
|
|
14175
14140
|
path: params.pathname,
|
|
14176
14141
|
host: params.hostname,
|
|
14177
14142
|
protocol: params.protocol
|
|
14178
14143
|
}, defaults);
|
|
14179
|
-
|
|
14144
|
+
|
|
14145
|
+
// use custom params
|
|
14146
|
+
} else {
|
|
14147
|
+
|
|
14180
14148
|
options = populate(params, defaults);
|
|
14181
14149
|
// if no port provided use default one
|
|
14182
14150
|
if (!options.port) {
|
|
14183
|
-
options.port = options.protocol
|
|
14151
|
+
options.port = options.protocol == 'https:' ? 443 : 80;
|
|
14184
14152
|
}
|
|
14185
14153
|
}
|
|
14186
14154
|
|
|
@@ -14188,14 +14156,14 @@ function requireForm_data () {
|
|
|
14188
14156
|
options.headers = this.getHeaders(params.headers);
|
|
14189
14157
|
|
|
14190
14158
|
// https if specified, fallback to http in any other case
|
|
14191
|
-
if (options.protocol
|
|
14159
|
+
if (options.protocol == 'https:') {
|
|
14192
14160
|
request = https$1.request(options);
|
|
14193
14161
|
} else {
|
|
14194
14162
|
request = http$1.request(options);
|
|
14195
14163
|
}
|
|
14196
14164
|
|
|
14197
14165
|
// get content length and fire away
|
|
14198
|
-
this.getLength(function
|
|
14166
|
+
this.getLength(function(err, length) {
|
|
14199
14167
|
if (err && err !== 'Unknown stream') {
|
|
14200
14168
|
this._error(err);
|
|
14201
14169
|
return;
|
|
@@ -14214,7 +14182,7 @@ function requireForm_data () {
|
|
|
14214
14182
|
request.removeListener('error', callback);
|
|
14215
14183
|
request.removeListener('response', onResponse);
|
|
14216
14184
|
|
|
14217
|
-
return cb.call(this, error, responce);
|
|
14185
|
+
return cb.call(this, error, responce);
|
|
14218
14186
|
};
|
|
14219
14187
|
|
|
14220
14188
|
onResponse = callback.bind(this, null);
|
|
@@ -14227,7 +14195,7 @@ function requireForm_data () {
|
|
|
14227
14195
|
return request;
|
|
14228
14196
|
};
|
|
14229
14197
|
|
|
14230
|
-
FormData.prototype._error = function
|
|
14198
|
+
FormData.prototype._error = function(err) {
|
|
14231
14199
|
if (!this.error) {
|
|
14232
14200
|
this.error = err;
|
|
14233
14201
|
this.pause();
|
|
@@ -14239,9 +14207,6 @@ function requireForm_data () {
|
|
|
14239
14207
|
return '[object FormData]';
|
|
14240
14208
|
};
|
|
14241
14209
|
setToStringTag(FormData, 'FormData');
|
|
14242
|
-
|
|
14243
|
-
// Public API
|
|
14244
|
-
form_data = FormData;
|
|
14245
14210
|
return form_data;
|
|
14246
14211
|
}
|
|
14247
14212
|
|
|
@@ -14363,10 +14328,6 @@ function toFormData$1(obj, formData, options) {
|
|
|
14363
14328
|
return value.toISOString();
|
|
14364
14329
|
}
|
|
14365
14330
|
|
|
14366
|
-
if (utils$4.isBoolean(value)) {
|
|
14367
|
-
return value.toString();
|
|
14368
|
-
}
|
|
14369
|
-
|
|
14370
14331
|
if (!useBlob && utils$4.isBlob(value)) {
|
|
14371
14332
|
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
14372
14333
|
}
|
|
@@ -14669,7 +14630,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
|
14669
14630
|
let str = '';
|
|
14670
14631
|
const {length} = alphabet;
|
|
14671
14632
|
const randomValues = new Uint32Array(size);
|
|
14672
|
-
|
|
14633
|
+
crypto$2.randomFillSync(randomValues);
|
|
14673
14634
|
for (let i = 0; i < size; i++) {
|
|
14674
14635
|
str += alphabet[randomValues[i] % length];
|
|
14675
14636
|
}
|
|
@@ -14749,7 +14710,7 @@ var platform = {
|
|
|
14749
14710
|
};
|
|
14750
14711
|
|
|
14751
14712
|
function toURLEncodedForm(data, options) {
|
|
14752
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
14713
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
14753
14714
|
visitor: function(value, key, path, helpers) {
|
|
14754
14715
|
if (platform.isNode && utils$4.isBuffer(value)) {
|
|
14755
14716
|
this.append(key, value.toString('base64'));
|
|
@@ -14757,9 +14718,8 @@ function toURLEncodedForm(data, options) {
|
|
|
14757
14718
|
}
|
|
14758
14719
|
|
|
14759
14720
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
14760
|
-
}
|
|
14761
|
-
|
|
14762
|
-
});
|
|
14721
|
+
}
|
|
14722
|
+
}, options));
|
|
14763
14723
|
}
|
|
14764
14724
|
|
|
14765
14725
|
/**
|
|
@@ -15151,18 +15111,10 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
15151
15111
|
setHeaders(header, valueOrRewrite);
|
|
15152
15112
|
} else if(utils$4.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
15153
15113
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
15154
|
-
} else if (utils$4.
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
if (!utils$4.isArray(entry)) {
|
|
15158
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
15159
|
-
}
|
|
15160
|
-
|
|
15161
|
-
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
15162
|
-
(utils$4.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
15114
|
+
} else if (utils$4.isHeaders(header)) {
|
|
15115
|
+
for (const [key, value] of header.entries()) {
|
|
15116
|
+
setHeader(value, key, rewrite);
|
|
15163
15117
|
}
|
|
15164
|
-
|
|
15165
|
-
setHeaders(obj, valueOrRewrite);
|
|
15166
15118
|
} else {
|
|
15167
15119
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
15168
15120
|
}
|
|
@@ -15304,10 +15256,6 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
15304
15256
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
15305
15257
|
}
|
|
15306
15258
|
|
|
15307
|
-
getSetCookie() {
|
|
15308
|
-
return this.get("set-cookie") || [];
|
|
15309
|
-
}
|
|
15310
|
-
|
|
15311
15259
|
get [Symbol.toStringTag]() {
|
|
15312
15260
|
return 'AxiosHeaders';
|
|
15313
15261
|
}
|
|
@@ -15472,7 +15420,7 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
15472
15420
|
*/
|
|
15473
15421
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
15474
15422
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
15475
|
-
if (baseURL &&
|
|
15423
|
+
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
|
|
15476
15424
|
return combineURLs(baseURL, requestedURL);
|
|
15477
15425
|
}
|
|
15478
15426
|
return requestedURL;
|
|
@@ -15950,7 +15898,7 @@ function requireCommon () {
|
|
|
15950
15898
|
|
|
15951
15899
|
const split = (typeof namespaces === 'string' ? namespaces : '')
|
|
15952
15900
|
.trim()
|
|
15953
|
-
.replace(
|
|
15901
|
+
.replace(' ', ',')
|
|
15954
15902
|
.split(',')
|
|
15955
15903
|
.filter(Boolean);
|
|
15956
15904
|
|
|
@@ -16302,7 +16250,7 @@ function requireBrowser () {
|
|
|
16302
16250
|
function load() {
|
|
16303
16251
|
let r;
|
|
16304
16252
|
try {
|
|
16305
|
-
r = exports.storage.getItem('debug')
|
|
16253
|
+
r = exports.storage.getItem('debug');
|
|
16306
16254
|
} catch (error) {
|
|
16307
16255
|
// Swallow
|
|
16308
16256
|
// XXX (@Qix-) should we be logging these?
|
|
@@ -17530,7 +17478,7 @@ function requireFollowRedirects () {
|
|
|
17530
17478
|
var followRedirectsExports = requireFollowRedirects();
|
|
17531
17479
|
var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
|
|
17532
17480
|
|
|
17533
|
-
const VERSION$1 = "1.
|
|
17481
|
+
const VERSION$1 = "1.8.2";
|
|
17534
17482
|
|
|
17535
17483
|
function parseProtocol(url) {
|
|
17536
17484
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -17808,7 +17756,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
17808
17756
|
}
|
|
17809
17757
|
|
|
17810
17758
|
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
17811
|
-
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
|
|
17759
|
+
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
|
|
17812
17760
|
let contentLength = footerBytes.byteLength;
|
|
17813
17761
|
|
|
17814
17762
|
const parts = Array.from(form.entries()).map(([name, value]) => {
|
|
@@ -17948,7 +17896,7 @@ function throttle(fn, freq) {
|
|
|
17948
17896
|
clearTimeout(timer);
|
|
17949
17897
|
timer = null;
|
|
17950
17898
|
}
|
|
17951
|
-
fn(
|
|
17899
|
+
fn.apply(null, args);
|
|
17952
17900
|
};
|
|
17953
17901
|
|
|
17954
17902
|
const throttled = (...args) => {
|
|
@@ -18822,7 +18770,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
18822
18770
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
18823
18771
|
};
|
|
18824
18772
|
|
|
18825
|
-
utils$4.forEach(Object.keys({
|
|
18773
|
+
utils$4.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
18826
18774
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
18827
18775
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
18828
18776
|
(utils$4.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -18838,7 +18786,7 @@ var resolveConfig = (config) => {
|
|
|
18838
18786
|
|
|
18839
18787
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
18840
18788
|
|
|
18841
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url
|
|
18789
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
18842
18790
|
|
|
18843
18791
|
// HTTP basic authentication
|
|
18844
18792
|
if (auth) {
|
|
@@ -19355,7 +19303,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
19355
19303
|
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
19356
19304
|
});
|
|
19357
19305
|
|
|
19358
|
-
let response = await fetch(request
|
|
19306
|
+
let response = await fetch(request);
|
|
19359
19307
|
|
|
19360
19308
|
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
19361
19309
|
|
|
@@ -19401,7 +19349,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
19401
19349
|
} catch (err) {
|
|
19402
19350
|
unsubscribe && unsubscribe();
|
|
19403
19351
|
|
|
19404
|
-
if (err && err.name === 'TypeError' && /
|
|
19352
|
+
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
19405
19353
|
throw Object.assign(
|
|
19406
19354
|
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
19407
19355
|
{
|
|
@@ -19667,7 +19615,7 @@ const validators = validator$1.validators;
|
|
|
19667
19615
|
*/
|
|
19668
19616
|
let Axios$1 = class Axios {
|
|
19669
19617
|
constructor(instanceConfig) {
|
|
19670
|
-
this.defaults = instanceConfig
|
|
19618
|
+
this.defaults = instanceConfig;
|
|
19671
19619
|
this.interceptors = {
|
|
19672
19620
|
request: new InterceptorManager(),
|
|
19673
19621
|
response: new InterceptorManager()
|
|
@@ -19798,8 +19746,8 @@ let Axios$1 = class Axios {
|
|
|
19798
19746
|
|
|
19799
19747
|
if (!synchronousRequestInterceptors) {
|
|
19800
19748
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
19801
|
-
chain.unshift(
|
|
19802
|
-
chain.push(
|
|
19749
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
19750
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
19803
19751
|
len = chain.length;
|
|
19804
19752
|
|
|
19805
19753
|
promise = Promise.resolve(config);
|
|
@@ -20224,7 +20172,7 @@ const DimoEnvironment = {
|
|
|
20224
20172
|
Trips: 'https://trips-api.dimo.zone',
|
|
20225
20173
|
Valuations: 'https://valuations-api.dimo.zone',
|
|
20226
20174
|
VehicleSignalDecoding: 'https://vehicle-signal-decoding.dimo.zone',
|
|
20227
|
-
|
|
20175
|
+
VehicleTriggers: 'https://vehicle-triggers-api.dimo.zone',
|
|
20228
20176
|
},
|
|
20229
20177
|
Dev: {
|
|
20230
20178
|
Attestation: 'https://attestation-api.dev.dimo.zone',
|
|
@@ -20237,7 +20185,7 @@ const DimoEnvironment = {
|
|
|
20237
20185
|
Trips: 'https://trips-api.dev.dimo.zone',
|
|
20238
20186
|
Valuations: 'https://valuations-api.dev.dimo.zone',
|
|
20239
20187
|
VehicleSignalDecoding: 'https://vehicle-signal-decoding.dev.dimo.zone',
|
|
20240
|
-
|
|
20188
|
+
VehicleTriggers: 'https://vehicle-triggers-api.dev.dimo.zone',
|
|
20241
20189
|
},
|
|
20242
20190
|
};
|
|
20243
20191
|
|
|
@@ -20691,7 +20639,7 @@ class DIMO {
|
|
|
20691
20639
|
tokenexchange;
|
|
20692
20640
|
trips;
|
|
20693
20641
|
valuations;
|
|
20694
|
-
|
|
20642
|
+
vehicleTriggers;
|
|
20695
20643
|
constructor(env) {
|
|
20696
20644
|
this.identity = new Identity(DimoEnvironment[env].Identity, env);
|
|
20697
20645
|
this.telemetry = new Telemetry(DimoEnvironment[env].Telemetry, env);
|
|
@@ -20705,7 +20653,7 @@ class DIMO {
|
|
|
20705
20653
|
this.tokenexchange = new TokenExchange(DimoEnvironment[env].TokenExchange, env);
|
|
20706
20654
|
this.trips = new Trips(DimoEnvironment[env].Trips, env);
|
|
20707
20655
|
this.valuations = new Valuations(DimoEnvironment[env].Valuations, env);
|
|
20708
|
-
this.
|
|
20656
|
+
this.vehicleTriggers = new VehicleTriggers(DimoEnvironment[env].VehicleTriggers, env);
|
|
20709
20657
|
}
|
|
20710
20658
|
// Helper Function
|
|
20711
20659
|
async authenticate() {
|
|
@@ -22914,7 +22862,7 @@ const keccak256 = (() => {
|
|
|
22914
22862
|
|
|
22915
22863
|
var util;
|
|
22916
22864
|
(function (util) {
|
|
22917
|
-
util.assertEqual = (
|
|
22865
|
+
util.assertEqual = (val) => val;
|
|
22918
22866
|
function assertIs(_arg) { }
|
|
22919
22867
|
util.assertIs = assertIs;
|
|
22920
22868
|
function assertNever(_x) {
|
|
@@ -22961,9 +22909,11 @@ var util;
|
|
|
22961
22909
|
};
|
|
22962
22910
|
util.isInteger = typeof Number.isInteger === "function"
|
|
22963
22911
|
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
22964
|
-
: (val) => typeof val === "number" &&
|
|
22912
|
+
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
22965
22913
|
function joinValues(array, separator = " | ") {
|
|
22966
|
-
return array
|
|
22914
|
+
return array
|
|
22915
|
+
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
22916
|
+
.join(separator);
|
|
22967
22917
|
}
|
|
22968
22918
|
util.joinValues = joinValues;
|
|
22969
22919
|
util.jsonStringifyReplacer = (_, value) => {
|
|
@@ -23012,7 +22962,7 @@ const getParsedType = (data) => {
|
|
|
23012
22962
|
case "string":
|
|
23013
22963
|
return ZodParsedType.string;
|
|
23014
22964
|
case "number":
|
|
23015
|
-
return
|
|
22965
|
+
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
23016
22966
|
case "boolean":
|
|
23017
22967
|
return ZodParsedType.boolean;
|
|
23018
22968
|
case "function":
|
|
@@ -23028,7 +22978,10 @@ const getParsedType = (data) => {
|
|
|
23028
22978
|
if (data === null) {
|
|
23029
22979
|
return ZodParsedType.null;
|
|
23030
22980
|
}
|
|
23031
|
-
if (data.then &&
|
|
22981
|
+
if (data.then &&
|
|
22982
|
+
typeof data.then === "function" &&
|
|
22983
|
+
data.catch &&
|
|
22984
|
+
typeof data.catch === "function") {
|
|
23032
22985
|
return ZodParsedType.promise;
|
|
23033
22986
|
}
|
|
23034
22987
|
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
@@ -23160,9 +23113,8 @@ class ZodError extends Error {
|
|
|
23160
23113
|
const formErrors = [];
|
|
23161
23114
|
for (const sub of this.issues) {
|
|
23162
23115
|
if (sub.path.length > 0) {
|
|
23163
|
-
|
|
23164
|
-
fieldErrors[
|
|
23165
|
-
fieldErrors[firstEl].push(mapper(sub));
|
|
23116
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
23117
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
23166
23118
|
}
|
|
23167
23119
|
else {
|
|
23168
23120
|
formErrors.push(mapper(sub));
|
|
@@ -23245,11 +23197,17 @@ const errorMap = (issue, _ctx) => {
|
|
|
23245
23197
|
else if (issue.type === "string")
|
|
23246
23198
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
23247
23199
|
else if (issue.type === "number")
|
|
23248
|
-
message = `Number must be ${issue.exact
|
|
23249
|
-
|
|
23250
|
-
|
|
23200
|
+
message = `Number must be ${issue.exact
|
|
23201
|
+
? `exactly equal to `
|
|
23202
|
+
: issue.inclusive
|
|
23203
|
+
? `greater than or equal to `
|
|
23204
|
+
: `greater than `}${issue.minimum}`;
|
|
23251
23205
|
else if (issue.type === "date")
|
|
23252
|
-
message = `Date must be ${issue.exact
|
|
23206
|
+
message = `Date must be ${issue.exact
|
|
23207
|
+
? `exactly equal to `
|
|
23208
|
+
: issue.inclusive
|
|
23209
|
+
? `greater than or equal to `
|
|
23210
|
+
: `greater than `}${new Date(Number(issue.minimum))}`;
|
|
23253
23211
|
else
|
|
23254
23212
|
message = "Invalid input";
|
|
23255
23213
|
break;
|
|
@@ -23259,11 +23217,23 @@ const errorMap = (issue, _ctx) => {
|
|
|
23259
23217
|
else if (issue.type === "string")
|
|
23260
23218
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
23261
23219
|
else if (issue.type === "number")
|
|
23262
|
-
message = `Number must be ${issue.exact
|
|
23220
|
+
message = `Number must be ${issue.exact
|
|
23221
|
+
? `exactly`
|
|
23222
|
+
: issue.inclusive
|
|
23223
|
+
? `less than or equal to`
|
|
23224
|
+
: `less than`} ${issue.maximum}`;
|
|
23263
23225
|
else if (issue.type === "bigint")
|
|
23264
|
-
message = `BigInt must be ${issue.exact
|
|
23226
|
+
message = `BigInt must be ${issue.exact
|
|
23227
|
+
? `exactly`
|
|
23228
|
+
: issue.inclusive
|
|
23229
|
+
? `less than or equal to`
|
|
23230
|
+
: `less than`} ${issue.maximum}`;
|
|
23265
23231
|
else if (issue.type === "date")
|
|
23266
|
-
message = `Date must be ${issue.exact
|
|
23232
|
+
message = `Date must be ${issue.exact
|
|
23233
|
+
? `exactly`
|
|
23234
|
+
: issue.inclusive
|
|
23235
|
+
? `smaller than or equal to`
|
|
23236
|
+
: `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
23267
23237
|
else
|
|
23268
23238
|
message = "Invalid input";
|
|
23269
23239
|
break;
|
|
@@ -23385,7 +23355,8 @@ class ParseStatus {
|
|
|
23385
23355
|
status.dirty();
|
|
23386
23356
|
if (value.status === "dirty")
|
|
23387
23357
|
status.dirty();
|
|
23388
|
-
if (key.value !== "__proto__" &&
|
|
23358
|
+
if (key.value !== "__proto__" &&
|
|
23359
|
+
(typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
23389
23360
|
finalObject[key.value] = value.value;
|
|
23390
23361
|
}
|
|
23391
23362
|
}
|
|
@@ -23402,13 +23373,43 @@ const isDirty = (x) => x.status === "dirty";
|
|
|
23402
23373
|
const isValid$2 = (x) => x.status === "valid";
|
|
23403
23374
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
23404
23375
|
|
|
23376
|
+
/******************************************************************************
|
|
23377
|
+
Copyright (c) Microsoft Corporation.
|
|
23378
|
+
|
|
23379
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
23380
|
+
purpose with or without fee is hereby granted.
|
|
23381
|
+
|
|
23382
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23383
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
23384
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23385
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23386
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23387
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23388
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
23389
|
+
***************************************************************************** */
|
|
23390
|
+
|
|
23391
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
23392
|
+
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");
|
|
23393
|
+
return state.get(receiver);
|
|
23394
|
+
}
|
|
23395
|
+
|
|
23396
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
23397
|
+
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");
|
|
23398
|
+
return (state.set(receiver, value)), value;
|
|
23399
|
+
}
|
|
23400
|
+
|
|
23401
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
23402
|
+
var e = new Error(message);
|
|
23403
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
23404
|
+
};
|
|
23405
|
+
|
|
23405
23406
|
var errorUtil;
|
|
23406
23407
|
(function (errorUtil) {
|
|
23407
23408
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
23408
|
-
|
|
23409
|
-
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
23409
|
+
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
23410
23410
|
})(errorUtil || (errorUtil = {}));
|
|
23411
23411
|
|
|
23412
|
+
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
23412
23413
|
class ParseInputLazyPath {
|
|
23413
23414
|
constructor(parent, value, path, key) {
|
|
23414
23415
|
this._cachedPath = [];
|
|
@@ -23419,7 +23420,7 @@ class ParseInputLazyPath {
|
|
|
23419
23420
|
}
|
|
23420
23421
|
get path() {
|
|
23421
23422
|
if (!this._cachedPath.length) {
|
|
23422
|
-
if (
|
|
23423
|
+
if (this._key instanceof Array) {
|
|
23423
23424
|
this._cachedPath.push(...this._path, ...this._key);
|
|
23424
23425
|
}
|
|
23425
23426
|
else {
|
|
@@ -23459,16 +23460,17 @@ function processCreateParams(params) {
|
|
|
23459
23460
|
if (errorMap)
|
|
23460
23461
|
return { errorMap: errorMap, description };
|
|
23461
23462
|
const customMap = (iss, ctx) => {
|
|
23463
|
+
var _a, _b;
|
|
23462
23464
|
const { message } = params;
|
|
23463
23465
|
if (iss.code === "invalid_enum_value") {
|
|
23464
|
-
return { message: message
|
|
23466
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
23465
23467
|
}
|
|
23466
23468
|
if (typeof ctx.data === "undefined") {
|
|
23467
|
-
return { message: message
|
|
23469
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
23468
23470
|
}
|
|
23469
23471
|
if (iss.code !== "invalid_type")
|
|
23470
23472
|
return { message: ctx.defaultError };
|
|
23471
|
-
return { message: message
|
|
23473
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
23472
23474
|
};
|
|
23473
23475
|
return { errorMap: customMap, description };
|
|
23474
23476
|
}
|
|
@@ -23520,13 +23522,14 @@ class ZodType {
|
|
|
23520
23522
|
throw result.error;
|
|
23521
23523
|
}
|
|
23522
23524
|
safeParse(data, params) {
|
|
23525
|
+
var _a;
|
|
23523
23526
|
const ctx = {
|
|
23524
23527
|
common: {
|
|
23525
23528
|
issues: [],
|
|
23526
|
-
async: params
|
|
23527
|
-
contextualErrorMap: params
|
|
23529
|
+
async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
|
|
23530
|
+
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
|
|
23528
23531
|
},
|
|
23529
|
-
path: params
|
|
23532
|
+
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
23530
23533
|
schemaErrorMap: this._def.errorMap,
|
|
23531
23534
|
parent: null,
|
|
23532
23535
|
data,
|
|
@@ -23536,6 +23539,7 @@ class ZodType {
|
|
|
23536
23539
|
return handleResult(ctx, result);
|
|
23537
23540
|
}
|
|
23538
23541
|
"~validate"(data) {
|
|
23542
|
+
var _a, _b;
|
|
23539
23543
|
const ctx = {
|
|
23540
23544
|
common: {
|
|
23541
23545
|
issues: [],
|
|
@@ -23559,7 +23563,7 @@ class ZodType {
|
|
|
23559
23563
|
};
|
|
23560
23564
|
}
|
|
23561
23565
|
catch (err) {
|
|
23562
|
-
if (err
|
|
23566
|
+
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")) {
|
|
23563
23567
|
this["~standard"].async = true;
|
|
23564
23568
|
}
|
|
23565
23569
|
ctx.common = {
|
|
@@ -23586,17 +23590,19 @@ class ZodType {
|
|
|
23586
23590
|
const ctx = {
|
|
23587
23591
|
common: {
|
|
23588
23592
|
issues: [],
|
|
23589
|
-
contextualErrorMap: params
|
|
23593
|
+
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
|
|
23590
23594
|
async: true,
|
|
23591
23595
|
},
|
|
23592
|
-
path: params
|
|
23596
|
+
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
23593
23597
|
schemaErrorMap: this._def.errorMap,
|
|
23594
23598
|
parent: null,
|
|
23595
23599
|
data,
|
|
23596
23600
|
parsedType: getParsedType(data),
|
|
23597
23601
|
};
|
|
23598
23602
|
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
23599
|
-
const result = await (isAsync(maybeAsyncResult)
|
|
23603
|
+
const result = await (isAsync(maybeAsyncResult)
|
|
23604
|
+
? maybeAsyncResult
|
|
23605
|
+
: Promise.resolve(maybeAsyncResult));
|
|
23600
23606
|
return handleResult(ctx, result);
|
|
23601
23607
|
}
|
|
23602
23608
|
refine(check, message) {
|
|
@@ -23640,7 +23646,9 @@ class ZodType {
|
|
|
23640
23646
|
refinement(check, refinementData) {
|
|
23641
23647
|
return this._refinement((val, ctx) => {
|
|
23642
23648
|
if (!check(val)) {
|
|
23643
|
-
ctx.addIssue(typeof refinementData === "function"
|
|
23649
|
+
ctx.addIssue(typeof refinementData === "function"
|
|
23650
|
+
? refinementData(val, ctx)
|
|
23651
|
+
: refinementData);
|
|
23644
23652
|
return false;
|
|
23645
23653
|
}
|
|
23646
23654
|
else {
|
|
@@ -23812,15 +23820,15 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
|
|
|
23812
23820
|
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])))`;
|
|
23813
23821
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
23814
23822
|
function timeRegexSource(args) {
|
|
23815
|
-
let
|
|
23823
|
+
// let regex = `\\d{2}:\\d{2}:\\d{2}`;
|
|
23824
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
23816
23825
|
if (args.precision) {
|
|
23817
|
-
|
|
23826
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
23818
23827
|
}
|
|
23819
23828
|
else if (args.precision == null) {
|
|
23820
|
-
|
|
23829
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
23821
23830
|
}
|
|
23822
|
-
|
|
23823
|
-
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
23831
|
+
return regex;
|
|
23824
23832
|
}
|
|
23825
23833
|
function timeRegex(args) {
|
|
23826
23834
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -23849,8 +23857,6 @@ function isValidJWT(jwt, alg) {
|
|
|
23849
23857
|
return false;
|
|
23850
23858
|
try {
|
|
23851
23859
|
const [header] = jwt.split(".");
|
|
23852
|
-
if (!header)
|
|
23853
|
-
return false;
|
|
23854
23860
|
// Convert base64url to base64
|
|
23855
23861
|
const base64 = header
|
|
23856
23862
|
.replace(/-/g, "+")
|
|
@@ -23859,15 +23865,13 @@ function isValidJWT(jwt, alg) {
|
|
|
23859
23865
|
const decoded = JSON.parse(atob(base64));
|
|
23860
23866
|
if (typeof decoded !== "object" || decoded === null)
|
|
23861
23867
|
return false;
|
|
23862
|
-
if (
|
|
23863
|
-
return false;
|
|
23864
|
-
if (!decoded.alg)
|
|
23868
|
+
if (!decoded.typ || !decoded.alg)
|
|
23865
23869
|
return false;
|
|
23866
23870
|
if (alg && decoded.alg !== alg)
|
|
23867
23871
|
return false;
|
|
23868
23872
|
return true;
|
|
23869
23873
|
}
|
|
23870
|
-
catch {
|
|
23874
|
+
catch (_a) {
|
|
23871
23875
|
return false;
|
|
23872
23876
|
}
|
|
23873
23877
|
}
|
|
@@ -24038,7 +24042,7 @@ class ZodString extends ZodType {
|
|
|
24038
24042
|
try {
|
|
24039
24043
|
new URL(input.data);
|
|
24040
24044
|
}
|
|
24041
|
-
catch {
|
|
24045
|
+
catch (_a) {
|
|
24042
24046
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24043
24047
|
addIssueToContext(ctx, {
|
|
24044
24048
|
validation: "url",
|
|
@@ -24268,6 +24272,7 @@ class ZodString extends ZodType {
|
|
|
24268
24272
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
24269
24273
|
}
|
|
24270
24274
|
datetime(options) {
|
|
24275
|
+
var _a, _b;
|
|
24271
24276
|
if (typeof options === "string") {
|
|
24272
24277
|
return this._addCheck({
|
|
24273
24278
|
kind: "datetime",
|
|
@@ -24279,10 +24284,10 @@ class ZodString extends ZodType {
|
|
|
24279
24284
|
}
|
|
24280
24285
|
return this._addCheck({
|
|
24281
24286
|
kind: "datetime",
|
|
24282
|
-
precision: typeof options
|
|
24283
|
-
offset: options
|
|
24284
|
-
local: options
|
|
24285
|
-
...errorUtil.errToObj(options
|
|
24287
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
24288
|
+
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
24289
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
24290
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
|
|
24286
24291
|
});
|
|
24287
24292
|
}
|
|
24288
24293
|
date(message) {
|
|
@@ -24298,8 +24303,8 @@ class ZodString extends ZodType {
|
|
|
24298
24303
|
}
|
|
24299
24304
|
return this._addCheck({
|
|
24300
24305
|
kind: "time",
|
|
24301
|
-
precision: typeof options
|
|
24302
|
-
...errorUtil.errToObj(options
|
|
24306
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
24307
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
|
|
24303
24308
|
});
|
|
24304
24309
|
}
|
|
24305
24310
|
duration(message) {
|
|
@@ -24316,8 +24321,8 @@ class ZodString extends ZodType {
|
|
|
24316
24321
|
return this._addCheck({
|
|
24317
24322
|
kind: "includes",
|
|
24318
24323
|
value: value,
|
|
24319
|
-
position: options
|
|
24320
|
-
...errorUtil.errToObj(options
|
|
24324
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
24325
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
|
|
24321
24326
|
});
|
|
24322
24327
|
}
|
|
24323
24328
|
startsWith(value, message) {
|
|
@@ -24450,10 +24455,11 @@ class ZodString extends ZodType {
|
|
|
24450
24455
|
}
|
|
24451
24456
|
}
|
|
24452
24457
|
ZodString.create = (params) => {
|
|
24458
|
+
var _a;
|
|
24453
24459
|
return new ZodString({
|
|
24454
24460
|
checks: [],
|
|
24455
24461
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
24456
|
-
coerce: params
|
|
24462
|
+
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
24457
24463
|
...processCreateParams(params),
|
|
24458
24464
|
});
|
|
24459
24465
|
};
|
|
@@ -24462,9 +24468,9 @@ function floatSafeRemainder(val, step) {
|
|
|
24462
24468
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
24463
24469
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
24464
24470
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
24465
|
-
const valInt =
|
|
24466
|
-
const stepInt =
|
|
24467
|
-
return (valInt % stepInt) / 10
|
|
24471
|
+
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
24472
|
+
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
24473
|
+
return (valInt % stepInt) / Math.pow(10, decCount);
|
|
24468
24474
|
}
|
|
24469
24475
|
class ZodNumber extends ZodType {
|
|
24470
24476
|
constructor() {
|
|
@@ -24503,7 +24509,9 @@ class ZodNumber extends ZodType {
|
|
|
24503
24509
|
}
|
|
24504
24510
|
}
|
|
24505
24511
|
else if (check.kind === "min") {
|
|
24506
|
-
const tooSmall = check.inclusive
|
|
24512
|
+
const tooSmall = check.inclusive
|
|
24513
|
+
? input.data < check.value
|
|
24514
|
+
: input.data <= check.value;
|
|
24507
24515
|
if (tooSmall) {
|
|
24508
24516
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24509
24517
|
addIssueToContext(ctx, {
|
|
@@ -24518,7 +24526,9 @@ class ZodNumber extends ZodType {
|
|
|
24518
24526
|
}
|
|
24519
24527
|
}
|
|
24520
24528
|
else if (check.kind === "max") {
|
|
24521
|
-
const tooBig = check.inclusive
|
|
24529
|
+
const tooBig = check.inclusive
|
|
24530
|
+
? input.data > check.value
|
|
24531
|
+
: input.data >= check.value;
|
|
24522
24532
|
if (tooBig) {
|
|
24523
24533
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24524
24534
|
addIssueToContext(ctx, {
|
|
@@ -24676,13 +24686,15 @@ class ZodNumber extends ZodType {
|
|
|
24676
24686
|
return max;
|
|
24677
24687
|
}
|
|
24678
24688
|
get isInt() {
|
|
24679
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
24689
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
24690
|
+
(ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
24680
24691
|
}
|
|
24681
24692
|
get isFinite() {
|
|
24682
|
-
let max = null;
|
|
24683
|
-
let min = null;
|
|
24693
|
+
let max = null, min = null;
|
|
24684
24694
|
for (const ch of this._def.checks) {
|
|
24685
|
-
if (ch.kind === "finite" ||
|
|
24695
|
+
if (ch.kind === "finite" ||
|
|
24696
|
+
ch.kind === "int" ||
|
|
24697
|
+
ch.kind === "multipleOf") {
|
|
24686
24698
|
return true;
|
|
24687
24699
|
}
|
|
24688
24700
|
else if (ch.kind === "min") {
|
|
@@ -24701,7 +24713,7 @@ ZodNumber.create = (params) => {
|
|
|
24701
24713
|
return new ZodNumber({
|
|
24702
24714
|
checks: [],
|
|
24703
24715
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
24704
|
-
coerce: params
|
|
24716
|
+
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
|
|
24705
24717
|
...processCreateParams(params),
|
|
24706
24718
|
});
|
|
24707
24719
|
};
|
|
@@ -24716,7 +24728,7 @@ class ZodBigInt extends ZodType {
|
|
|
24716
24728
|
try {
|
|
24717
24729
|
input.data = BigInt(input.data);
|
|
24718
24730
|
}
|
|
24719
|
-
catch {
|
|
24731
|
+
catch (_a) {
|
|
24720
24732
|
return this._getInvalidInput(input);
|
|
24721
24733
|
}
|
|
24722
24734
|
}
|
|
@@ -24728,7 +24740,9 @@ class ZodBigInt extends ZodType {
|
|
|
24728
24740
|
const status = new ParseStatus();
|
|
24729
24741
|
for (const check of this._def.checks) {
|
|
24730
24742
|
if (check.kind === "min") {
|
|
24731
|
-
const tooSmall = check.inclusive
|
|
24743
|
+
const tooSmall = check.inclusive
|
|
24744
|
+
? input.data < check.value
|
|
24745
|
+
: input.data <= check.value;
|
|
24732
24746
|
if (tooSmall) {
|
|
24733
24747
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24734
24748
|
addIssueToContext(ctx, {
|
|
@@ -24742,7 +24756,9 @@ class ZodBigInt extends ZodType {
|
|
|
24742
24756
|
}
|
|
24743
24757
|
}
|
|
24744
24758
|
else if (check.kind === "max") {
|
|
24745
|
-
const tooBig = check.inclusive
|
|
24759
|
+
const tooBig = check.inclusive
|
|
24760
|
+
? input.data > check.value
|
|
24761
|
+
: input.data >= check.value;
|
|
24746
24762
|
if (tooBig) {
|
|
24747
24763
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
24748
24764
|
addIssueToContext(ctx, {
|
|
@@ -24874,10 +24890,11 @@ class ZodBigInt extends ZodType {
|
|
|
24874
24890
|
}
|
|
24875
24891
|
}
|
|
24876
24892
|
ZodBigInt.create = (params) => {
|
|
24893
|
+
var _a;
|
|
24877
24894
|
return new ZodBigInt({
|
|
24878
24895
|
checks: [],
|
|
24879
24896
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
24880
|
-
coerce: params
|
|
24897
|
+
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
24881
24898
|
...processCreateParams(params),
|
|
24882
24899
|
});
|
|
24883
24900
|
};
|
|
@@ -24902,7 +24919,7 @@ class ZodBoolean extends ZodType {
|
|
|
24902
24919
|
ZodBoolean.create = (params) => {
|
|
24903
24920
|
return new ZodBoolean({
|
|
24904
24921
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
24905
|
-
coerce: params
|
|
24922
|
+
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
|
|
24906
24923
|
...processCreateParams(params),
|
|
24907
24924
|
});
|
|
24908
24925
|
};
|
|
@@ -24921,7 +24938,7 @@ class ZodDate extends ZodType {
|
|
|
24921
24938
|
});
|
|
24922
24939
|
return INVALID;
|
|
24923
24940
|
}
|
|
24924
|
-
if (
|
|
24941
|
+
if (isNaN(input.data.getTime())) {
|
|
24925
24942
|
const ctx = this._getOrReturnCtx(input);
|
|
24926
24943
|
addIssueToContext(ctx, {
|
|
24927
24944
|
code: ZodIssueCode.invalid_date,
|
|
@@ -25012,7 +25029,7 @@ class ZodDate extends ZodType {
|
|
|
25012
25029
|
ZodDate.create = (params) => {
|
|
25013
25030
|
return new ZodDate({
|
|
25014
25031
|
checks: [],
|
|
25015
|
-
coerce: params
|
|
25032
|
+
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
|
|
25016
25033
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
25017
25034
|
...processCreateParams(params),
|
|
25018
25035
|
});
|
|
@@ -25334,8 +25351,7 @@ class ZodObject extends ZodType {
|
|
|
25334
25351
|
return this._cached;
|
|
25335
25352
|
const shape = this._def.shape();
|
|
25336
25353
|
const keys = util.objectKeys(shape);
|
|
25337
|
-
this._cached = { shape, keys };
|
|
25338
|
-
return this._cached;
|
|
25354
|
+
return (this._cached = { shape, keys });
|
|
25339
25355
|
}
|
|
25340
25356
|
_parse(input) {
|
|
25341
25357
|
const parsedType = this._getType(input);
|
|
@@ -25351,7 +25367,8 @@ class ZodObject extends ZodType {
|
|
|
25351
25367
|
const { status, ctx } = this._processInputParams(input);
|
|
25352
25368
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
25353
25369
|
const extraKeys = [];
|
|
25354
|
-
if (!(this._def.catchall instanceof ZodNever &&
|
|
25370
|
+
if (!(this._def.catchall instanceof ZodNever &&
|
|
25371
|
+
this._def.unknownKeys === "strip")) {
|
|
25355
25372
|
for (const key in ctx.data) {
|
|
25356
25373
|
if (!shapeKeys.includes(key)) {
|
|
25357
25374
|
extraKeys.push(key);
|
|
@@ -25439,10 +25456,11 @@ class ZodObject extends ZodType {
|
|
|
25439
25456
|
...(message !== undefined
|
|
25440
25457
|
? {
|
|
25441
25458
|
errorMap: (issue, ctx) => {
|
|
25442
|
-
|
|
25459
|
+
var _a, _b, _c, _d;
|
|
25460
|
+
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;
|
|
25443
25461
|
if (issue.code === "unrecognized_keys")
|
|
25444
25462
|
return {
|
|
25445
|
-
message: errorUtil.errToObj(message).message
|
|
25463
|
+
message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
|
|
25446
25464
|
};
|
|
25447
25465
|
return {
|
|
25448
25466
|
message: defaultError,
|
|
@@ -25574,11 +25592,11 @@ class ZodObject extends ZodType {
|
|
|
25574
25592
|
}
|
|
25575
25593
|
pick(mask) {
|
|
25576
25594
|
const shape = {};
|
|
25577
|
-
|
|
25595
|
+
util.objectKeys(mask).forEach((key) => {
|
|
25578
25596
|
if (mask[key] && this.shape[key]) {
|
|
25579
25597
|
shape[key] = this.shape[key];
|
|
25580
25598
|
}
|
|
25581
|
-
}
|
|
25599
|
+
});
|
|
25582
25600
|
return new ZodObject({
|
|
25583
25601
|
...this._def,
|
|
25584
25602
|
shape: () => shape,
|
|
@@ -25586,11 +25604,11 @@ class ZodObject extends ZodType {
|
|
|
25586
25604
|
}
|
|
25587
25605
|
omit(mask) {
|
|
25588
25606
|
const shape = {};
|
|
25589
|
-
|
|
25607
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
25590
25608
|
if (!mask[key]) {
|
|
25591
25609
|
shape[key] = this.shape[key];
|
|
25592
25610
|
}
|
|
25593
|
-
}
|
|
25611
|
+
});
|
|
25594
25612
|
return new ZodObject({
|
|
25595
25613
|
...this._def,
|
|
25596
25614
|
shape: () => shape,
|
|
@@ -25604,7 +25622,7 @@ class ZodObject extends ZodType {
|
|
|
25604
25622
|
}
|
|
25605
25623
|
partial(mask) {
|
|
25606
25624
|
const newShape = {};
|
|
25607
|
-
|
|
25625
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
25608
25626
|
const fieldSchema = this.shape[key];
|
|
25609
25627
|
if (mask && !mask[key]) {
|
|
25610
25628
|
newShape[key] = fieldSchema;
|
|
@@ -25612,7 +25630,7 @@ class ZodObject extends ZodType {
|
|
|
25612
25630
|
else {
|
|
25613
25631
|
newShape[key] = fieldSchema.optional();
|
|
25614
25632
|
}
|
|
25615
|
-
}
|
|
25633
|
+
});
|
|
25616
25634
|
return new ZodObject({
|
|
25617
25635
|
...this._def,
|
|
25618
25636
|
shape: () => newShape,
|
|
@@ -25620,7 +25638,7 @@ class ZodObject extends ZodType {
|
|
|
25620
25638
|
}
|
|
25621
25639
|
required(mask) {
|
|
25622
25640
|
const newShape = {};
|
|
25623
|
-
|
|
25641
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
25624
25642
|
if (mask && !mask[key]) {
|
|
25625
25643
|
newShape[key] = this.shape[key];
|
|
25626
25644
|
}
|
|
@@ -25632,7 +25650,7 @@ class ZodObject extends ZodType {
|
|
|
25632
25650
|
}
|
|
25633
25651
|
newShape[key] = newField;
|
|
25634
25652
|
}
|
|
25635
|
-
}
|
|
25653
|
+
});
|
|
25636
25654
|
return new ZodObject({
|
|
25637
25655
|
...this._def,
|
|
25638
25656
|
shape: () => newShape,
|
|
@@ -25904,7 +25922,9 @@ function mergeValues(a, b) {
|
|
|
25904
25922
|
}
|
|
25905
25923
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
25906
25924
|
const bKeys = util.objectKeys(b);
|
|
25907
|
-
const sharedKeys = util
|
|
25925
|
+
const sharedKeys = util
|
|
25926
|
+
.objectKeys(a)
|
|
25927
|
+
.filter((key) => bKeys.indexOf(key) !== -1);
|
|
25908
25928
|
const newObj = { ...a, ...b };
|
|
25909
25929
|
for (const key of sharedKeys) {
|
|
25910
25930
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
@@ -25931,7 +25951,9 @@ function mergeValues(a, b) {
|
|
|
25931
25951
|
}
|
|
25932
25952
|
return { valid: true, data: newArray };
|
|
25933
25953
|
}
|
|
25934
|
-
else if (aType === ZodParsedType.date &&
|
|
25954
|
+
else if (aType === ZodParsedType.date &&
|
|
25955
|
+
bType === ZodParsedType.date &&
|
|
25956
|
+
+a === +b) {
|
|
25935
25957
|
return { valid: true, data: a };
|
|
25936
25958
|
}
|
|
25937
25959
|
else {
|
|
@@ -25992,7 +26014,6 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
25992
26014
|
...processCreateParams(params),
|
|
25993
26015
|
});
|
|
25994
26016
|
};
|
|
25995
|
-
// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
25996
26017
|
class ZodTuple extends ZodType {
|
|
25997
26018
|
_parse(input) {
|
|
25998
26019
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -26289,7 +26310,12 @@ class ZodFunction extends ZodType {
|
|
|
26289
26310
|
return makeIssue({
|
|
26290
26311
|
data: args,
|
|
26291
26312
|
path: ctx.path,
|
|
26292
|
-
errorMaps: [
|
|
26313
|
+
errorMaps: [
|
|
26314
|
+
ctx.common.contextualErrorMap,
|
|
26315
|
+
ctx.schemaErrorMap,
|
|
26316
|
+
getErrorMap(),
|
|
26317
|
+
errorMap,
|
|
26318
|
+
].filter((x) => !!x),
|
|
26293
26319
|
issueData: {
|
|
26294
26320
|
code: ZodIssueCode.invalid_arguments,
|
|
26295
26321
|
argumentsError: error,
|
|
@@ -26300,7 +26326,12 @@ class ZodFunction extends ZodType {
|
|
|
26300
26326
|
return makeIssue({
|
|
26301
26327
|
data: returns,
|
|
26302
26328
|
path: ctx.path,
|
|
26303
|
-
errorMaps: [
|
|
26329
|
+
errorMaps: [
|
|
26330
|
+
ctx.common.contextualErrorMap,
|
|
26331
|
+
ctx.schemaErrorMap,
|
|
26332
|
+
getErrorMap(),
|
|
26333
|
+
errorMap,
|
|
26334
|
+
].filter((x) => !!x),
|
|
26304
26335
|
issueData: {
|
|
26305
26336
|
code: ZodIssueCode.invalid_return_type,
|
|
26306
26337
|
returnTypeError: error,
|
|
@@ -26316,7 +26347,9 @@ class ZodFunction extends ZodType {
|
|
|
26316
26347
|
const me = this;
|
|
26317
26348
|
return OK(async function (...args) {
|
|
26318
26349
|
const error = new ZodError([]);
|
|
26319
|
-
const parsedArgs = await me._def.args
|
|
26350
|
+
const parsedArgs = await me._def.args
|
|
26351
|
+
.parseAsync(args, params)
|
|
26352
|
+
.catch((e) => {
|
|
26320
26353
|
error.addIssue(makeArgsIssue(args, e));
|
|
26321
26354
|
throw error;
|
|
26322
26355
|
});
|
|
@@ -26377,7 +26410,9 @@ class ZodFunction extends ZodType {
|
|
|
26377
26410
|
}
|
|
26378
26411
|
static create(args, returns, params) {
|
|
26379
26412
|
return new ZodFunction({
|
|
26380
|
-
args: (args
|
|
26413
|
+
args: (args
|
|
26414
|
+
? args
|
|
26415
|
+
: ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
26381
26416
|
returns: returns || ZodUnknown.create(),
|
|
26382
26417
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
26383
26418
|
...processCreateParams(params),
|
|
@@ -26433,6 +26468,10 @@ function createZodEnum(values, params) {
|
|
|
26433
26468
|
});
|
|
26434
26469
|
}
|
|
26435
26470
|
class ZodEnum extends ZodType {
|
|
26471
|
+
constructor() {
|
|
26472
|
+
super(...arguments);
|
|
26473
|
+
_ZodEnum_cache.set(this, void 0);
|
|
26474
|
+
}
|
|
26436
26475
|
_parse(input) {
|
|
26437
26476
|
if (typeof input.data !== "string") {
|
|
26438
26477
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -26444,10 +26483,10 @@ class ZodEnum extends ZodType {
|
|
|
26444
26483
|
});
|
|
26445
26484
|
return INVALID;
|
|
26446
26485
|
}
|
|
26447
|
-
if (!this
|
|
26448
|
-
this
|
|
26486
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {
|
|
26487
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));
|
|
26449
26488
|
}
|
|
26450
|
-
if (!this.
|
|
26489
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {
|
|
26451
26490
|
const ctx = this._getOrReturnCtx(input);
|
|
26452
26491
|
const expectedValues = this._def.values;
|
|
26453
26492
|
addIssueToContext(ctx, {
|
|
@@ -26496,12 +26535,18 @@ class ZodEnum extends ZodType {
|
|
|
26496
26535
|
});
|
|
26497
26536
|
}
|
|
26498
26537
|
}
|
|
26538
|
+
_ZodEnum_cache = new WeakMap();
|
|
26499
26539
|
ZodEnum.create = createZodEnum;
|
|
26500
26540
|
class ZodNativeEnum extends ZodType {
|
|
26541
|
+
constructor() {
|
|
26542
|
+
super(...arguments);
|
|
26543
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
26544
|
+
}
|
|
26501
26545
|
_parse(input) {
|
|
26502
26546
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
26503
26547
|
const ctx = this._getOrReturnCtx(input);
|
|
26504
|
-
if (ctx.parsedType !== ZodParsedType.string &&
|
|
26548
|
+
if (ctx.parsedType !== ZodParsedType.string &&
|
|
26549
|
+
ctx.parsedType !== ZodParsedType.number) {
|
|
26505
26550
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
26506
26551
|
addIssueToContext(ctx, {
|
|
26507
26552
|
expected: util.joinValues(expectedValues),
|
|
@@ -26510,10 +26555,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
26510
26555
|
});
|
|
26511
26556
|
return INVALID;
|
|
26512
26557
|
}
|
|
26513
|
-
if (!this
|
|
26514
|
-
this
|
|
26558
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {
|
|
26559
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)));
|
|
26515
26560
|
}
|
|
26516
|
-
if (!this.
|
|
26561
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {
|
|
26517
26562
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
26518
26563
|
addIssueToContext(ctx, {
|
|
26519
26564
|
received: ctx.data,
|
|
@@ -26528,6 +26573,7 @@ class ZodNativeEnum extends ZodType {
|
|
|
26528
26573
|
return this._def.values;
|
|
26529
26574
|
}
|
|
26530
26575
|
}
|
|
26576
|
+
_ZodNativeEnum_cache = new WeakMap();
|
|
26531
26577
|
ZodNativeEnum.create = (values, params) => {
|
|
26532
26578
|
return new ZodNativeEnum({
|
|
26533
26579
|
values: values,
|
|
@@ -26541,7 +26587,8 @@ class ZodPromise extends ZodType {
|
|
|
26541
26587
|
}
|
|
26542
26588
|
_parse(input) {
|
|
26543
26589
|
const { ctx } = this._processInputParams(input);
|
|
26544
|
-
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
26590
|
+
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
26591
|
+
ctx.common.async === false) {
|
|
26545
26592
|
addIssueToContext(ctx, {
|
|
26546
26593
|
code: ZodIssueCode.invalid_type,
|
|
26547
26594
|
expected: ZodParsedType.promise,
|
|
@@ -26549,7 +26596,9 @@ class ZodPromise extends ZodType {
|
|
|
26549
26596
|
});
|
|
26550
26597
|
return INVALID;
|
|
26551
26598
|
}
|
|
26552
|
-
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
26599
|
+
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
26600
|
+
? ctx.data
|
|
26601
|
+
: Promise.resolve(ctx.data);
|
|
26553
26602
|
return OK(promisified.then((data) => {
|
|
26554
26603
|
return this._def.type.parseAsync(data, {
|
|
26555
26604
|
path: ctx.path,
|
|
@@ -26655,7 +26704,9 @@ class ZodEffects extends ZodType {
|
|
|
26655
26704
|
return { status: status.value, value: inner.value };
|
|
26656
26705
|
}
|
|
26657
26706
|
else {
|
|
26658
|
-
return this._def.schema
|
|
26707
|
+
return this._def.schema
|
|
26708
|
+
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
26709
|
+
.then((inner) => {
|
|
26659
26710
|
if (inner.status === "aborted")
|
|
26660
26711
|
return INVALID;
|
|
26661
26712
|
if (inner.status === "dirty")
|
|
@@ -26674,7 +26725,7 @@ class ZodEffects extends ZodType {
|
|
|
26674
26725
|
parent: ctx,
|
|
26675
26726
|
});
|
|
26676
26727
|
if (!isValid$2(base))
|
|
26677
|
-
return
|
|
26728
|
+
return base;
|
|
26678
26729
|
const result = effect.transform(base.value, checkCtx);
|
|
26679
26730
|
if (result instanceof Promise) {
|
|
26680
26731
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -26682,13 +26733,12 @@ class ZodEffects extends ZodType {
|
|
|
26682
26733
|
return { status: status.value, value: result };
|
|
26683
26734
|
}
|
|
26684
26735
|
else {
|
|
26685
|
-
return this._def.schema
|
|
26736
|
+
return this._def.schema
|
|
26737
|
+
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
26738
|
+
.then((base) => {
|
|
26686
26739
|
if (!isValid$2(base))
|
|
26687
|
-
return
|
|
26688
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
26689
|
-
status: status.value,
|
|
26690
|
-
value: result,
|
|
26691
|
-
}));
|
|
26740
|
+
return base;
|
|
26741
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
|
|
26692
26742
|
});
|
|
26693
26743
|
}
|
|
26694
26744
|
}
|
|
@@ -26770,7 +26820,9 @@ ZodDefault.create = (type, params) => {
|
|
|
26770
26820
|
return new ZodDefault({
|
|
26771
26821
|
innerType: type,
|
|
26772
26822
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
26773
|
-
defaultValue: typeof params.default === "function"
|
|
26823
|
+
defaultValue: typeof params.default === "function"
|
|
26824
|
+
? params.default
|
|
26825
|
+
: () => params.default,
|
|
26774
26826
|
...processCreateParams(params),
|
|
26775
26827
|
});
|
|
26776
26828
|
};
|
|
@@ -26936,7 +26988,9 @@ class ZodReadonly extends ZodType {
|
|
|
26936
26988
|
}
|
|
26937
26989
|
return data;
|
|
26938
26990
|
};
|
|
26939
|
-
return isAsync(result)
|
|
26991
|
+
return isAsync(result)
|
|
26992
|
+
? result.then((data) => freeze(data))
|
|
26993
|
+
: freeze(result);
|
|
26940
26994
|
}
|
|
26941
26995
|
unwrap() {
|
|
26942
26996
|
return this._def.innerType;
|
|
@@ -26957,7 +27011,11 @@ ZodReadonly.create = (type, params) => {
|
|
|
26957
27011
|
////////////////////////////////////////
|
|
26958
27012
|
////////////////////////////////////////
|
|
26959
27013
|
function cleanParams(params, data) {
|
|
26960
|
-
const p = typeof params === "function"
|
|
27014
|
+
const p = typeof params === "function"
|
|
27015
|
+
? params(data)
|
|
27016
|
+
: typeof params === "string"
|
|
27017
|
+
? { message: params }
|
|
27018
|
+
: params;
|
|
26961
27019
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
26962
27020
|
return p2;
|
|
26963
27021
|
}
|
|
@@ -26975,19 +27033,21 @@ function custom(check, _params = {},
|
|
|
26975
27033
|
fatal) {
|
|
26976
27034
|
if (check)
|
|
26977
27035
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
27036
|
+
var _a, _b;
|
|
26978
27037
|
const r = check(data);
|
|
26979
27038
|
if (r instanceof Promise) {
|
|
26980
27039
|
return r.then((r) => {
|
|
27040
|
+
var _a, _b;
|
|
26981
27041
|
if (!r) {
|
|
26982
27042
|
const params = cleanParams(_params, data);
|
|
26983
|
-
const _fatal = params.fatal
|
|
27043
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
26984
27044
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
26985
27045
|
}
|
|
26986
27046
|
});
|
|
26987
27047
|
}
|
|
26988
27048
|
if (!r) {
|
|
26989
27049
|
const params = cleanParams(_params, data);
|
|
26990
|
-
const _fatal = params.fatal
|
|
27050
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
26991
27051
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
26992
27052
|
}
|
|
26993
27053
|
return;
|
|
@@ -27091,114 +27151,114 @@ const coerce = {
|
|
|
27091
27151
|
const NEVER = INVALID;
|
|
27092
27152
|
|
|
27093
27153
|
var z = /*#__PURE__*/Object.freeze({
|
|
27094
|
-
|
|
27095
|
-
|
|
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
|
-
|
|
27154
|
+
__proto__: null,
|
|
27155
|
+
defaultErrorMap: errorMap,
|
|
27156
|
+
setErrorMap: setErrorMap,
|
|
27157
|
+
getErrorMap: getErrorMap,
|
|
27158
|
+
makeIssue: makeIssue,
|
|
27159
|
+
EMPTY_PATH: EMPTY_PATH,
|
|
27160
|
+
addIssueToContext: addIssueToContext,
|
|
27161
|
+
ParseStatus: ParseStatus,
|
|
27162
|
+
INVALID: INVALID,
|
|
27163
|
+
DIRTY: DIRTY,
|
|
27164
|
+
OK: OK,
|
|
27165
|
+
isAborted: isAborted,
|
|
27166
|
+
isDirty: isDirty,
|
|
27167
|
+
isValid: isValid$2,
|
|
27168
|
+
isAsync: isAsync,
|
|
27169
|
+
get util () { return util; },
|
|
27170
|
+
get objectUtil () { return objectUtil; },
|
|
27171
|
+
ZodParsedType: ZodParsedType,
|
|
27172
|
+
getParsedType: getParsedType,
|
|
27173
|
+
ZodType: ZodType,
|
|
27174
|
+
datetimeRegex: datetimeRegex,
|
|
27175
|
+
ZodString: ZodString,
|
|
27176
|
+
ZodNumber: ZodNumber,
|
|
27177
|
+
ZodBigInt: ZodBigInt,
|
|
27178
|
+
ZodBoolean: ZodBoolean,
|
|
27179
|
+
ZodDate: ZodDate,
|
|
27180
|
+
ZodSymbol: ZodSymbol,
|
|
27181
|
+
ZodUndefined: ZodUndefined,
|
|
27182
|
+
ZodNull: ZodNull,
|
|
27183
|
+
ZodAny: ZodAny,
|
|
27184
|
+
ZodUnknown: ZodUnknown,
|
|
27185
|
+
ZodNever: ZodNever,
|
|
27186
|
+
ZodVoid: ZodVoid,
|
|
27187
|
+
ZodArray: ZodArray,
|
|
27188
|
+
ZodObject: ZodObject,
|
|
27189
|
+
ZodUnion: ZodUnion,
|
|
27190
|
+
ZodDiscriminatedUnion: ZodDiscriminatedUnion,
|
|
27191
|
+
ZodIntersection: ZodIntersection,
|
|
27192
|
+
ZodTuple: ZodTuple,
|
|
27193
|
+
ZodRecord: ZodRecord,
|
|
27194
|
+
ZodMap: ZodMap,
|
|
27195
|
+
ZodSet: ZodSet,
|
|
27196
|
+
ZodFunction: ZodFunction,
|
|
27197
|
+
ZodLazy: ZodLazy,
|
|
27198
|
+
ZodLiteral: ZodLiteral,
|
|
27199
|
+
ZodEnum: ZodEnum,
|
|
27200
|
+
ZodNativeEnum: ZodNativeEnum,
|
|
27201
|
+
ZodPromise: ZodPromise,
|
|
27202
|
+
ZodEffects: ZodEffects,
|
|
27203
|
+
ZodTransformer: ZodEffects,
|
|
27204
|
+
ZodOptional: ZodOptional,
|
|
27205
|
+
ZodNullable: ZodNullable,
|
|
27206
|
+
ZodDefault: ZodDefault,
|
|
27207
|
+
ZodCatch: ZodCatch,
|
|
27208
|
+
ZodNaN: ZodNaN,
|
|
27209
|
+
BRAND: BRAND,
|
|
27210
|
+
ZodBranded: ZodBranded,
|
|
27211
|
+
ZodPipeline: ZodPipeline,
|
|
27212
|
+
ZodReadonly: ZodReadonly,
|
|
27213
|
+
custom: custom,
|
|
27214
|
+
Schema: ZodType,
|
|
27215
|
+
ZodSchema: ZodType,
|
|
27216
|
+
late: late,
|
|
27217
|
+
get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
|
|
27218
|
+
coerce: coerce,
|
|
27219
|
+
any: anyType,
|
|
27220
|
+
array: arrayType,
|
|
27221
|
+
bigint: bigIntType,
|
|
27222
|
+
boolean: booleanType,
|
|
27223
|
+
date: dateType,
|
|
27224
|
+
discriminatedUnion: discriminatedUnionType,
|
|
27225
|
+
effect: effectsType,
|
|
27226
|
+
'enum': enumType,
|
|
27227
|
+
'function': functionType,
|
|
27228
|
+
'instanceof': instanceOfType,
|
|
27229
|
+
intersection: intersectionType,
|
|
27230
|
+
lazy: lazyType,
|
|
27231
|
+
literal: literalType,
|
|
27232
|
+
map: mapType,
|
|
27233
|
+
nan: nanType,
|
|
27234
|
+
nativeEnum: nativeEnumType,
|
|
27235
|
+
never: neverType,
|
|
27236
|
+
'null': nullType,
|
|
27237
|
+
nullable: nullableType,
|
|
27238
|
+
number: numberType,
|
|
27239
|
+
object: objectType,
|
|
27240
|
+
oboolean: oboolean,
|
|
27241
|
+
onumber: onumber,
|
|
27242
|
+
optional: optionalType,
|
|
27243
|
+
ostring: ostring,
|
|
27244
|
+
pipeline: pipelineType,
|
|
27245
|
+
preprocess: preprocessType,
|
|
27246
|
+
promise: promiseType,
|
|
27247
|
+
record: recordType,
|
|
27248
|
+
set: setType,
|
|
27249
|
+
strictObject: strictObjectType,
|
|
27250
|
+
string: stringType,
|
|
27251
|
+
symbol: symbolType,
|
|
27252
|
+
transformer: effectsType,
|
|
27253
|
+
tuple: tupleType,
|
|
27254
|
+
'undefined': undefinedType,
|
|
27255
|
+
union: unionType,
|
|
27256
|
+
unknown: unknownType,
|
|
27257
|
+
'void': voidType,
|
|
27258
|
+
NEVER: NEVER,
|
|
27259
|
+
ZodIssueCode: ZodIssueCode,
|
|
27260
|
+
quotelessJson: quotelessJson,
|
|
27261
|
+
ZodError: ZodError
|
|
27202
27262
|
});
|
|
27203
27263
|
|
|
27204
27264
|
/*
|
|
@@ -28311,11 +28371,12 @@ const convertToZod = (schema) => {
|
|
|
28311
28371
|
}
|
|
28312
28372
|
}
|
|
28313
28373
|
if (Array.isArray(schema.required)) {
|
|
28314
|
-
return
|
|
28374
|
+
return z
|
|
28375
|
+
.object(obj)
|
|
28315
28376
|
.partial()
|
|
28316
28377
|
.required(schema.required.reduce((acc, v) => (Object.assign(Object.assign({}, acc), { [v]: true })), {}));
|
|
28317
28378
|
}
|
|
28318
|
-
return
|
|
28379
|
+
return z.object(obj).partial();
|
|
28319
28380
|
}
|
|
28320
28381
|
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' && (schema === null || schema === void 0 ? void 0 : schema.items)) {
|
|
28321
28382
|
if (Array.isArray(schema.items) && schema.items.length > 1
|
|
@@ -28328,22 +28389,22 @@ const convertToZod = (schema) => {
|
|
|
28328
28389
|
arr.push(zItem);
|
|
28329
28390
|
}
|
|
28330
28391
|
}
|
|
28331
|
-
return
|
|
28392
|
+
return z.tuple(arr);
|
|
28332
28393
|
}
|
|
28333
28394
|
const nextSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items;
|
|
28334
|
-
let zodArraySchema =
|
|
28395
|
+
let zodArraySchema = z.array(convertToZod(nextSchema));
|
|
28335
28396
|
zodArraySchema = schema.minItems !== undefined ? zodArraySchema.min(schema.minItems) : zodArraySchema;
|
|
28336
28397
|
zodArraySchema = schema.maxItems !== undefined ? zodArraySchema.max(schema.maxItems) : zodArraySchema;
|
|
28337
28398
|
return zodArraySchema;
|
|
28338
28399
|
}
|
|
28339
28400
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
28340
|
-
return
|
|
28401
|
+
return z.union(schema.oneOf.map(oneOfSchema => convertToZod(oneOfSchema)));
|
|
28341
28402
|
}
|
|
28342
28403
|
if (schema === null || schema === void 0 ? void 0 : schema.format) {
|
|
28343
28404
|
if (!formats[schema.format]) {
|
|
28344
28405
|
throw new SchemaFormatError(schema.format);
|
|
28345
28406
|
}
|
|
28346
|
-
return
|
|
28407
|
+
return z.any().refine(formats[schema.format], (value) => ({
|
|
28347
28408
|
params: { value, format: schema.format },
|
|
28348
28409
|
}));
|
|
28349
28410
|
}
|
|
@@ -28352,7 +28413,7 @@ const convertToZod = (schema) => {
|
|
|
28352
28413
|
typeof z[String(schema.type)] === 'function') {
|
|
28353
28414
|
return z[String(schema.type)]();
|
|
28354
28415
|
}
|
|
28355
|
-
return
|
|
28416
|
+
return z.object({ data: z.any() }).partial();
|
|
28356
28417
|
};
|
|
28357
28418
|
class Validator {
|
|
28358
28419
|
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
|
@@ -114498,14 +114559,6 @@ function requirePermessageDeflate () {
|
|
|
114498
114559
|
this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';
|
|
114499
114560
|
this[kError][kStatusCode] = 1009;
|
|
114500
114561
|
this.removeListener('data', inflateOnData);
|
|
114501
|
-
|
|
114502
|
-
//
|
|
114503
|
-
// The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the
|
|
114504
|
-
// fact that in Node.js versions prior to 13.10.0, the callback for
|
|
114505
|
-
// `zlib.flush()` is not called if `zlib.close()` is used. Utilizing
|
|
114506
|
-
// `zlib.reset()` ensures that either the callback is invoked or an error is
|
|
114507
|
-
// emitted.
|
|
114508
|
-
//
|
|
114509
114562
|
this.reset();
|
|
114510
114563
|
}
|
|
114511
114564
|
|
|
@@ -114521,12 +114574,6 @@ function requirePermessageDeflate () {
|
|
|
114521
114574
|
// closed when an error is emitted.
|
|
114522
114575
|
//
|
|
114523
114576
|
this[kPerMessageDeflate]._inflate = null;
|
|
114524
|
-
|
|
114525
|
-
if (this[kError]) {
|
|
114526
|
-
this[kCallback](this[kError]);
|
|
114527
|
-
return;
|
|
114528
|
-
}
|
|
114529
|
-
|
|
114530
114577
|
err[kStatusCode] = 1007;
|
|
114531
114578
|
this[kCallback](err);
|
|
114532
114579
|
}
|
|
@@ -115418,7 +115465,7 @@ function requireSender () {
|
|
|
115418
115465
|
hasRequiredSender = 1;
|
|
115419
115466
|
|
|
115420
115467
|
const { Duplex } = Stream;
|
|
115421
|
-
const { randomFillSync } =
|
|
115468
|
+
const { randomFillSync } = crypto$2;
|
|
115422
115469
|
|
|
115423
115470
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
115424
115471
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
|
|
@@ -116543,7 +116590,7 @@ function requireWebsocket () {
|
|
|
116543
116590
|
const http$1 = http;
|
|
116544
116591
|
const net = require$$3;
|
|
116545
116592
|
const tls = require$$4$1;
|
|
116546
|
-
const { randomBytes, createHash } =
|
|
116593
|
+
const { randomBytes, createHash } = crypto$2;
|
|
116547
116594
|
const { Duplex, Readable } = Stream;
|
|
116548
116595
|
const { URL } = Url;
|
|
116549
116596
|
|
|
@@ -117244,7 +117291,7 @@ function requireWebsocket () {
|
|
|
117244
117291
|
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
|
|
117245
117292
|
invalidUrlMessage =
|
|
117246
117293
|
'The URL\'s protocol must be one of "ws:", "wss:", ' +
|
|
117247
|
-
'"http:", "https
|
|
117294
|
+
'"http:", "https", or "ws+unix:"';
|
|
117248
117295
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
117249
117296
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
117250
117297
|
} else if (parsedUrl.hash) {
|
|
@@ -118177,7 +118224,7 @@ function requireWebsocketServer () {
|
|
|
118177
118224
|
const EventEmitter = require$$0$5;
|
|
118178
118225
|
const http$1 = http;
|
|
118179
118226
|
const { Duplex } = Stream;
|
|
118180
|
-
const { createHash } =
|
|
118227
|
+
const { createHash } = crypto$2;
|
|
118181
118228
|
|
|
118182
118229
|
const extension = requireExtension();
|
|
118183
118230
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
@@ -118428,11 +118475,9 @@ function requireWebsocketServer () {
|
|
|
118428
118475
|
return;
|
|
118429
118476
|
}
|
|
118430
118477
|
|
|
118431
|
-
if (version !==
|
|
118478
|
+
if (version !== 8 && version !== 13) {
|
|
118432
118479
|
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
|
118433
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
118434
|
-
'Sec-WebSocket-Version': '13, 8'
|
|
118435
|
-
});
|
|
118480
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
118436
118481
|
return;
|
|
118437
118482
|
}
|
|
118438
118483
|
|
|
@@ -118700,24 +118745,16 @@ function requireWebsocketServer () {
|
|
|
118700
118745
|
* @param {Duplex} socket The socket of the upgrade request
|
|
118701
118746
|
* @param {Number} code The HTTP response status code
|
|
118702
118747
|
* @param {String} message The HTTP response body
|
|
118703
|
-
* @param {Object} [headers] The HTTP response headers
|
|
118704
118748
|
* @private
|
|
118705
118749
|
*/
|
|
118706
|
-
function abortHandshakeOrEmitwsClientError(
|
|
118707
|
-
server,
|
|
118708
|
-
req,
|
|
118709
|
-
socket,
|
|
118710
|
-
code,
|
|
118711
|
-
message,
|
|
118712
|
-
headers
|
|
118713
|
-
) {
|
|
118750
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
118714
118751
|
if (server.listenerCount('wsClientError')) {
|
|
118715
118752
|
const err = new Error(message);
|
|
118716
118753
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
118717
118754
|
|
|
118718
118755
|
server.emit('wsClientError', err, socket, req);
|
|
118719
118756
|
} else {
|
|
118720
|
-
abortHandshake(socket, code, message
|
|
118757
|
+
abortHandshake(socket, code, message);
|
|
118721
118758
|
}
|
|
118722
118759
|
}
|
|
118723
118760
|
return websocketServer;
|
|
@@ -142627,9 +142664,9 @@ class Valuations extends Resource {
|
|
|
142627
142664
|
}
|
|
142628
142665
|
|
|
142629
142666
|
/** @format */
|
|
142630
|
-
class
|
|
142667
|
+
class VehicleTriggers extends Resource {
|
|
142631
142668
|
constructor(api, env) {
|
|
142632
|
-
super(api, '
|
|
142669
|
+
super(api, 'VehicleTriggers', env);
|
|
142633
142670
|
this.setResource({
|
|
142634
142671
|
listWebhooks: {
|
|
142635
142672
|
method: 'GET',
|
|
@@ -142641,13 +142678,14 @@ class VehicleEvents extends Resource {
|
|
|
142641
142678
|
path: '/v1/webhooks',
|
|
142642
142679
|
body: {
|
|
142643
142680
|
service: true,
|
|
142644
|
-
|
|
142645
|
-
|
|
142646
|
-
|
|
142681
|
+
metricName: true,
|
|
142682
|
+
condition: true,
|
|
142683
|
+
coolDownPeriod: true,
|
|
142647
142684
|
description: false,
|
|
142648
|
-
|
|
142685
|
+
targetURL: true,
|
|
142649
142686
|
status: true,
|
|
142650
|
-
|
|
142687
|
+
verificationToken: true,
|
|
142688
|
+
displayName: false
|
|
142651
142689
|
},
|
|
142652
142690
|
auth: 'developer_jwt',
|
|
142653
142691
|
},
|
|
@@ -142655,14 +142693,7 @@ class VehicleEvents extends Resource {
|
|
|
142655
142693
|
method: 'PUT',
|
|
142656
142694
|
path: '/v1/webhooks/:webhookId',
|
|
142657
142695
|
body: {
|
|
142658
|
-
|
|
142659
|
-
data: true,
|
|
142660
|
-
trigger: true,
|
|
142661
|
-
setup: true,
|
|
142662
|
-
description: false,
|
|
142663
|
-
target_uri: true,
|
|
142664
|
-
status: true,
|
|
142665
|
-
verification_token: true,
|
|
142696
|
+
request: true
|
|
142666
142697
|
},
|
|
142667
142698
|
auth: 'developer_jwt',
|
|
142668
142699
|
},
|
|
@@ -142683,12 +142714,12 @@ class VehicleEvents extends Resource {
|
|
|
142683
142714
|
},
|
|
142684
142715
|
listVehicleSubscriptions: {
|
|
142685
142716
|
method: 'GET',
|
|
142686
|
-
path: '/v1/webhooks/vehicles/:
|
|
142717
|
+
path: '/v1/webhooks/vehicles/:tokenDID',
|
|
142687
142718
|
auth: 'developer_jwt',
|
|
142688
142719
|
},
|
|
142689
142720
|
subscribeVehicle: {
|
|
142690
142721
|
method: 'POST',
|
|
142691
|
-
path: '/v1/webhooks/:webhookId/subscribe/:
|
|
142722
|
+
path: '/v1/webhooks/:webhookId/subscribe/:tokenDID',
|
|
142692
142723
|
auth: 'developer_jwt',
|
|
142693
142724
|
},
|
|
142694
142725
|
subscribeAllVehicles: {
|
|
@@ -142698,7 +142729,7 @@ class VehicleEvents extends Resource {
|
|
|
142698
142729
|
},
|
|
142699
142730
|
unsubscribeVehicle: {
|
|
142700
142731
|
method: 'DELETE',
|
|
142701
|
-
path: '/v1/webhooks/:webhookId/unsubscribe/:
|
|
142732
|
+
path: '/v1/webhooks/:webhookId/unsubscribe/:tokenDID',
|
|
142702
142733
|
auth: 'developer_jwt',
|
|
142703
142734
|
},
|
|
142704
142735
|
unsubscribeAllVehicles: {
|
|
@@ -142710,5 +142741,5 @@ class VehicleEvents extends Resource {
|
|
|
142710
142741
|
}
|
|
142711
142742
|
}
|
|
142712
142743
|
|
|
142713
|
-
export { Attestation, Auth, DIMO, DeviceDefinitions, Devices, DimoConstants, DimoEnvironment, DimoError, Identity, Telemetry, TokenExchange, Trips, Valuations,
|
|
142744
|
+
export { Attestation, Auth, DIMO, DeviceDefinitions, Devices, DimoConstants, DimoEnvironment, DimoError, Identity, Telemetry, TokenExchange, Trips, Valuations, VehicleTriggers };
|
|
142714
142745
|
//# sourceMappingURL=index.js.map
|