@dimo-network/data-sdk 1.3.3 → 1.5.1

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