glitch-javascript-sdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -488,7 +488,7 @@ var isTypedArray = (function(TypedArray) {
488
488
  };
489
489
  })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
490
490
 
491
- var utils$9 = {
491
+ var utils$b = {
492
492
  isArray: isArray$3,
493
493
  isArrayBuffer: isArrayBuffer,
494
494
  isBuffer: isBuffer$2,
@@ -521,7 +521,7 @@ var utils$9 = {
521
521
  isFileList: isFileList
522
522
  };
523
523
 
524
- var utils$8 = utils$9;
524
+ var utils$a = utils$b;
525
525
 
526
526
  function encode$1(val) {
527
527
  return encodeURIComponent(val).
@@ -549,26 +549,26 @@ var buildURL$1 = function buildURL(url, params, paramsSerializer) {
549
549
  var serializedParams;
550
550
  if (paramsSerializer) {
551
551
  serializedParams = paramsSerializer(params);
552
- } else if (utils$8.isURLSearchParams(params)) {
552
+ } else if (utils$a.isURLSearchParams(params)) {
553
553
  serializedParams = params.toString();
554
554
  } else {
555
555
  var parts = [];
556
556
 
557
- utils$8.forEach(params, function serialize(val, key) {
557
+ utils$a.forEach(params, function serialize(val, key) {
558
558
  if (val === null || typeof val === 'undefined') {
559
559
  return;
560
560
  }
561
561
 
562
- if (utils$8.isArray(val)) {
562
+ if (utils$a.isArray(val)) {
563
563
  key = key + '[]';
564
564
  } else {
565
565
  val = [val];
566
566
  }
567
567
 
568
- utils$8.forEach(val, function parseValue(v) {
569
- if (utils$8.isDate(v)) {
568
+ utils$a.forEach(val, function parseValue(v) {
569
+ if (utils$a.isDate(v)) {
570
570
  v = v.toISOString();
571
- } else if (utils$8.isObject(v)) {
571
+ } else if (utils$a.isObject(v)) {
572
572
  v = JSON.stringify(v);
573
573
  }
574
574
  parts.push(encode$1(key) + '=' + encode$1(v));
@@ -590,7 +590,7 @@ var buildURL$1 = function buildURL(url, params, paramsSerializer) {
590
590
  return url;
591
591
  };
592
592
 
593
- var utils$7 = utils$9;
593
+ var utils$9 = utils$b;
594
594
 
595
595
  function InterceptorManager$1() {
596
596
  this.handlers = [];
@@ -634,7 +634,7 @@ InterceptorManager$1.prototype.eject = function eject(id) {
634
634
  * @param {Function} fn The function to call for each interceptor
635
635
  */
636
636
  InterceptorManager$1.prototype.forEach = function forEach(fn) {
637
- utils$7.forEach(this.handlers, function forEachHandler(h) {
637
+ utils$9.forEach(this.handlers, function forEachHandler(h) {
638
638
  if (h !== null) {
639
639
  fn(h);
640
640
  }
@@ -869,10 +869,10 @@ var browser$1 = {
869
869
  uptime: uptime
870
870
  };
871
871
 
872
- var utils$6 = utils$9;
872
+ var utils$8 = utils$b;
873
873
 
874
874
  var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
875
- utils$6.forEach(headers, function processHeader(value, name) {
875
+ utils$8.forEach(headers, function processHeader(value, name) {
876
876
  if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
877
877
  headers[normalizedName] = value;
878
878
  delete headers[name];
@@ -880,99 +880,90 @@ var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName
880
880
  });
881
881
  };
882
882
 
883
- var AxiosError_1;
884
- var hasRequiredAxiosError;
883
+ var utils$7 = utils$b;
885
884
 
886
- function requireAxiosError () {
887
- if (hasRequiredAxiosError) return AxiosError_1;
888
- hasRequiredAxiosError = 1;
889
-
890
- var utils = utils$9;
891
-
892
- /**
893
- * Create an Error with the specified message, config, error code, request and response.
894
- *
895
- * @param {string} message The error message.
896
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
897
- * @param {Object} [config] The config.
898
- * @param {Object} [request] The request.
899
- * @param {Object} [response] The response.
900
- * @returns {Error} The created error.
901
- */
902
- function AxiosError(message, code, config, request, response) {
903
- Error.call(this);
904
- this.message = message;
905
- this.name = 'AxiosError';
906
- code && (this.code = code);
907
- config && (this.config = config);
908
- request && (this.request = request);
909
- response && (this.response = response);
910
- }
911
-
912
- utils.inherits(AxiosError, Error, {
913
- toJSON: function toJSON() {
914
- return {
915
- // Standard
916
- message: this.message,
917
- name: this.name,
918
- // Microsoft
919
- description: this.description,
920
- number: this.number,
921
- // Mozilla
922
- fileName: this.fileName,
923
- lineNumber: this.lineNumber,
924
- columnNumber: this.columnNumber,
925
- stack: this.stack,
926
- // Axios
927
- config: this.config,
928
- code: this.code,
929
- status: this.response && this.response.status ? this.response.status : null
930
- };
931
- }
932
- });
933
-
934
- var prototype = AxiosError.prototype;
935
- var descriptors = {};
885
+ /**
886
+ * Create an Error with the specified message, config, error code, request and response.
887
+ *
888
+ * @param {string} message The error message.
889
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
890
+ * @param {Object} [config] The config.
891
+ * @param {Object} [request] The request.
892
+ * @param {Object} [response] The response.
893
+ * @returns {Error} The created error.
894
+ */
895
+ function AxiosError$2(message, code, config, request, response) {
896
+ Error.call(this);
897
+ this.message = message;
898
+ this.name = 'AxiosError';
899
+ code && (this.code = code);
900
+ config && (this.config = config);
901
+ request && (this.request = request);
902
+ response && (this.response = response);
903
+ }
904
+
905
+ utils$7.inherits(AxiosError$2, Error, {
906
+ toJSON: function toJSON() {
907
+ return {
908
+ // Standard
909
+ message: this.message,
910
+ name: this.name,
911
+ // Microsoft
912
+ description: this.description,
913
+ number: this.number,
914
+ // Mozilla
915
+ fileName: this.fileName,
916
+ lineNumber: this.lineNumber,
917
+ columnNumber: this.columnNumber,
918
+ stack: this.stack,
919
+ // Axios
920
+ config: this.config,
921
+ code: this.code,
922
+ status: this.response && this.response.status ? this.response.status : null
923
+ };
924
+ }
925
+ });
936
926
 
937
- [
938
- 'ERR_BAD_OPTION_VALUE',
939
- 'ERR_BAD_OPTION',
940
- 'ECONNABORTED',
941
- 'ETIMEDOUT',
942
- 'ERR_NETWORK',
943
- 'ERR_FR_TOO_MANY_REDIRECTS',
944
- 'ERR_DEPRECATED',
945
- 'ERR_BAD_RESPONSE',
946
- 'ERR_BAD_REQUEST',
947
- 'ERR_CANCELED'
948
- // eslint-disable-next-line func-names
949
- ].forEach(function(code) {
950
- descriptors[code] = {value: code};
951
- });
927
+ var prototype = AxiosError$2.prototype;
928
+ var descriptors = {};
929
+
930
+ [
931
+ 'ERR_BAD_OPTION_VALUE',
932
+ 'ERR_BAD_OPTION',
933
+ 'ECONNABORTED',
934
+ 'ETIMEDOUT',
935
+ 'ERR_NETWORK',
936
+ 'ERR_FR_TOO_MANY_REDIRECTS',
937
+ 'ERR_DEPRECATED',
938
+ 'ERR_BAD_RESPONSE',
939
+ 'ERR_BAD_REQUEST',
940
+ 'ERR_CANCELED'
941
+ // eslint-disable-next-line func-names
942
+ ].forEach(function(code) {
943
+ descriptors[code] = {value: code};
944
+ });
952
945
 
953
- Object.defineProperties(AxiosError, descriptors);
954
- Object.defineProperty(prototype, 'isAxiosError', {value: true});
946
+ Object.defineProperties(AxiosError$2, descriptors);
947
+ Object.defineProperty(prototype, 'isAxiosError', {value: true});
955
948
 
956
- // eslint-disable-next-line func-names
957
- AxiosError.from = function(error, code, config, request, response, customProps) {
958
- var axiosError = Object.create(prototype);
949
+ // eslint-disable-next-line func-names
950
+ AxiosError$2.from = function(error, code, config, request, response, customProps) {
951
+ var axiosError = Object.create(prototype);
959
952
 
960
- utils.toFlatObject(error, axiosError, function filter(obj) {
961
- return obj !== Error.prototype;
962
- });
953
+ utils$7.toFlatObject(error, axiosError, function filter(obj) {
954
+ return obj !== Error.prototype;
955
+ });
963
956
 
964
- AxiosError.call(axiosError, error.message, code, config, request, response);
957
+ AxiosError$2.call(axiosError, error.message, code, config, request, response);
965
958
 
966
- axiosError.name = error.name;
959
+ axiosError.name = error.name;
967
960
 
968
- customProps && Object.assign(axiosError, customProps);
961
+ customProps && Object.assign(axiosError, customProps);
969
962
 
970
- return axiosError;
971
- };
963
+ return axiosError;
964
+ };
972
965
 
973
- AxiosError_1 = AxiosError;
974
- return AxiosError_1;
975
- }
966
+ var AxiosError_1 = AxiosError$2;
976
967
 
977
968
  var transitional = {
978
969
  silentJSONParsing: true,
@@ -2955,86 +2946,77 @@ function isSlowBuffer (obj) {
2955
2946
  return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
2956
2947
  }
2957
2948
 
2958
- var toFormData_1;
2959
- var hasRequiredToFormData;
2960
-
2961
- function requireToFormData () {
2962
- if (hasRequiredToFormData) return toFormData_1;
2963
- hasRequiredToFormData = 1;
2964
-
2965
- var utils = utils$9;
2949
+ var utils$6 = utils$b;
2966
2950
 
2967
- /**
2968
- * Convert a data object to FormData
2969
- * @param {Object} obj
2970
- * @param {?Object} [formData]
2971
- * @returns {Object}
2972
- **/
2973
-
2974
- function toFormData(obj, formData) {
2975
- // eslint-disable-next-line no-param-reassign
2976
- formData = formData || new FormData();
2951
+ /**
2952
+ * Convert a data object to FormData
2953
+ * @param {Object} obj
2954
+ * @param {?Object} [formData]
2955
+ * @returns {Object}
2956
+ **/
2977
2957
 
2978
- var stack = [];
2958
+ function toFormData$1(obj, formData) {
2959
+ // eslint-disable-next-line no-param-reassign
2960
+ formData = formData || new FormData();
2979
2961
 
2980
- function convertValue(value) {
2981
- if (value === null) return '';
2962
+ var stack = [];
2982
2963
 
2983
- if (utils.isDate(value)) {
2984
- return value.toISOString();
2985
- }
2964
+ function convertValue(value) {
2965
+ if (value === null) return '';
2986
2966
 
2987
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
2988
- return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2989
- }
2967
+ if (utils$6.isDate(value)) {
2968
+ return value.toISOString();
2969
+ }
2990
2970
 
2991
- return value;
2992
- }
2971
+ if (utils$6.isArrayBuffer(value) || utils$6.isTypedArray(value)) {
2972
+ return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2973
+ }
2993
2974
 
2994
- function build(data, parentKey) {
2995
- if (utils.isPlainObject(data) || utils.isArray(data)) {
2996
- if (stack.indexOf(data) !== -1) {
2997
- throw Error('Circular reference detected in ' + parentKey);
2998
- }
2975
+ return value;
2976
+ }
2999
2977
 
3000
- stack.push(data);
3001
-
3002
- utils.forEach(data, function each(value, key) {
3003
- if (utils.isUndefined(value)) return;
3004
- var fullKey = parentKey ? parentKey + '.' + key : key;
3005
- var arr;
3006
-
3007
- if (value && !parentKey && typeof value === 'object') {
3008
- if (utils.endsWith(key, '{}')) {
3009
- // eslint-disable-next-line no-param-reassign
3010
- value = JSON.stringify(value);
3011
- } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
3012
- // eslint-disable-next-line func-names
3013
- arr.forEach(function(el) {
3014
- !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
3015
- });
3016
- return;
3017
- }
3018
- }
2978
+ function build(data, parentKey) {
2979
+ if (utils$6.isPlainObject(data) || utils$6.isArray(data)) {
2980
+ if (stack.indexOf(data) !== -1) {
2981
+ throw Error('Circular reference detected in ' + parentKey);
2982
+ }
3019
2983
 
3020
- build(value, fullKey);
3021
- });
2984
+ stack.push(data);
2985
+
2986
+ utils$6.forEach(data, function each(value, key) {
2987
+ if (utils$6.isUndefined(value)) return;
2988
+ var fullKey = parentKey ? parentKey + '.' + key : key;
2989
+ var arr;
2990
+
2991
+ if (value && !parentKey && typeof value === 'object') {
2992
+ if (utils$6.endsWith(key, '{}')) {
2993
+ // eslint-disable-next-line no-param-reassign
2994
+ value = JSON.stringify(value);
2995
+ } else if (utils$6.endsWith(key, '[]') && (arr = utils$6.toArray(value))) {
2996
+ // eslint-disable-next-line func-names
2997
+ arr.forEach(function(el) {
2998
+ !utils$6.isUndefined(el) && formData.append(fullKey, convertValue(el));
2999
+ });
3000
+ return;
3001
+ }
3002
+ }
3022
3003
 
3023
- stack.pop();
3024
- } else {
3025
- formData.append(parentKey, convertValue(data));
3026
- }
3027
- }
3004
+ build(value, fullKey);
3005
+ });
3028
3006
 
3029
- build(obj);
3007
+ stack.pop();
3008
+ } else {
3009
+ formData.append(parentKey, convertValue(data));
3010
+ }
3011
+ }
3030
3012
 
3031
- return formData;
3032
- }
3013
+ build(obj);
3033
3014
 
3034
- toFormData_1 = toFormData;
3035
- return toFormData_1;
3015
+ return formData;
3036
3016
  }
3037
3017
 
3018
+ var toFormData_1 = toFormData$1;
3019
+
3038
3020
  var settle;
3039
3021
  var hasRequiredSettle;
3040
3022
 
@@ -3042,7 +3024,7 @@ function requireSettle () {
3042
3024
  if (hasRequiredSettle) return settle;
3043
3025
  hasRequiredSettle = 1;
3044
3026
 
3045
- var AxiosError = requireAxiosError();
3027
+ var AxiosError = AxiosError_1;
3046
3028
 
3047
3029
  /**
3048
3030
  * Resolve or reject a Promise based on response status.
@@ -3075,7 +3057,7 @@ function requireCookies () {
3075
3057
  if (hasRequiredCookies) return cookies;
3076
3058
  hasRequiredCookies = 1;
3077
3059
 
3078
- var utils = utils$9;
3060
+ var utils = utils$b;
3079
3061
 
3080
3062
  cookies = (
3081
3063
  utils.isStandardBrowserEnv() ?
@@ -3181,7 +3163,7 @@ function requireParseHeaders () {
3181
3163
  if (hasRequiredParseHeaders) return parseHeaders;
3182
3164
  hasRequiredParseHeaders = 1;
3183
3165
 
3184
- var utils = utils$9;
3166
+ var utils = utils$b;
3185
3167
 
3186
3168
  // Headers whose duplicates are ignored by node
3187
3169
  // c.f. https://nodejs.org/api/http.html#http_message_headers
@@ -3242,7 +3224,7 @@ function requireIsURLSameOrigin () {
3242
3224
  if (hasRequiredIsURLSameOrigin) return isURLSameOrigin;
3243
3225
  hasRequiredIsURLSameOrigin = 1;
3244
3226
 
3245
- var utils = utils$9;
3227
+ var utils = utils$b;
3246
3228
 
3247
3229
  isURLSameOrigin = (
3248
3230
  utils.isStandardBrowserEnv() ?
@@ -3318,8 +3300,8 @@ function requireCanceledError () {
3318
3300
  if (hasRequiredCanceledError) return CanceledError_1;
3319
3301
  hasRequiredCanceledError = 1;
3320
3302
 
3321
- var AxiosError = requireAxiosError();
3322
- var utils = utils$9;
3303
+ var AxiosError = AxiosError_1;
3304
+ var utils = utils$b;
3323
3305
 
3324
3306
  /**
3325
3307
  * A `CanceledError` is an object that is thrown when an operation is canceled.
@@ -3362,7 +3344,7 @@ function requireXhr () {
3362
3344
  if (hasRequiredXhr) return xhr$1;
3363
3345
  hasRequiredXhr = 1;
3364
3346
 
3365
- var utils = utils$9;
3347
+ var utils = utils$b;
3366
3348
  var settle = requireSettle();
3367
3349
  var cookies = requireCookies();
3368
3350
  var buildURL = buildURL$1;
@@ -3370,7 +3352,7 @@ function requireXhr () {
3370
3352
  var parseHeaders = requireParseHeaders();
3371
3353
  var isURLSameOrigin = requireIsURLSameOrigin();
3372
3354
  var transitionalDefaults = transitional;
3373
- var AxiosError = requireAxiosError();
3355
+ var AxiosError = AxiosError_1;
3374
3356
  var CanceledError = requireCanceledError();
3375
3357
  var parseProtocol = requireParseProtocol();
3376
3358
 
@@ -16007,7 +15989,7 @@ function requireHttp () {
16007
15989
  if (hasRequiredHttp) return http_1;
16008
15990
  hasRequiredHttp = 1;
16009
15991
 
16010
- var utils = utils$9;
15992
+ var utils = utils$b;
16011
15993
  var settle = requireSettle();
16012
15994
  var buildFullPath = buildFullPath$1;
16013
15995
  var buildURL = buildURL$1;
@@ -16019,7 +16001,7 @@ function requireHttp () {
16019
16001
  var zlib = require$$8;
16020
16002
  var VERSION = requireData().version;
16021
16003
  var transitionalDefaults = transitional;
16022
- var AxiosError = requireAxiosError();
16004
+ var AxiosError = AxiosError_1;
16023
16005
  var CanceledError = requireCanceledError();
16024
16006
 
16025
16007
  var isHttps = /https:?/;
@@ -28967,11 +28949,11 @@ function requireFormData () {
28967
28949
  return FormDataExports;
28968
28950
  }
28969
28951
 
28970
- var utils$5 = utils$9;
28952
+ var utils$5 = utils$b;
28971
28953
  var normalizeHeaderName = normalizeHeaderName$1;
28972
- var AxiosError$1 = requireAxiosError();
28954
+ var AxiosError$1 = AxiosError_1;
28973
28955
  var transitionalDefaults = transitional;
28974
- var toFormData = requireToFormData();
28956
+ var toFormData = toFormData_1;
28975
28957
 
28976
28958
  var DEFAULT_CONTENT_TYPE = {
28977
28959
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -29112,7 +29094,7 @@ utils$5.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
29112
29094
 
29113
29095
  var defaults_1 = defaults$3;
29114
29096
 
29115
- var utils$4 = utils$9;
29097
+ var utils$4 = utils$b;
29116
29098
  var defaults$2 = defaults_1;
29117
29099
 
29118
29100
  /**
@@ -29146,7 +29128,7 @@ function requireIsCancel () {
29146
29128
  return isCancel$1;
29147
29129
  }
29148
29130
 
29149
- var utils$3 = utils$9;
29131
+ var utils$3 = utils$b;
29150
29132
  var transformData = transformData$1;
29151
29133
  var isCancel = requireIsCancel();
29152
29134
  var defaults$1 = defaults_1;
@@ -29232,7 +29214,7 @@ var dispatchRequest$1 = function dispatchRequest(config) {
29232
29214
  });
29233
29215
  };
29234
29216
 
29235
- var utils$2 = utils$9;
29217
+ var utils$2 = utils$b;
29236
29218
 
29237
29219
  /**
29238
29220
  * Config-specific merge-function which creates a new config-object
@@ -29332,7 +29314,7 @@ var mergeConfig$2 = function mergeConfig(config1, config2) {
29332
29314
  };
29333
29315
 
29334
29316
  var VERSION = requireData().version;
29335
- var AxiosError = requireAxiosError();
29317
+ var AxiosError = AxiosError_1;
29336
29318
 
29337
29319
  var validators$1 = {};
29338
29320
 
@@ -29416,7 +29398,7 @@ var validator$1 = {
29416
29398
  validators: validators$1
29417
29399
  };
29418
29400
 
29419
- var utils$1 = utils$9;
29401
+ var utils$1 = utils$b;
29420
29402
  var buildURL = buildURL$1;
29421
29403
  var InterceptorManager = InterceptorManager_1;
29422
29404
  var dispatchRequest = dispatchRequest$1;
@@ -29744,7 +29726,7 @@ function requireIsAxiosError () {
29744
29726
  if (hasRequiredIsAxiosError) return isAxiosError;
29745
29727
  hasRequiredIsAxiosError = 1;
29746
29728
 
29747
- var utils = utils$9;
29729
+ var utils = utils$b;
29748
29730
 
29749
29731
  /**
29750
29732
  * Determines whether the payload is an error thrown by Axios
@@ -29758,7 +29740,7 @@ function requireIsAxiosError () {
29758
29740
  return isAxiosError;
29759
29741
  }
29760
29742
 
29761
- var utils = utils$9;
29743
+ var utils = utils$b;
29762
29744
  var bind = bind$2;
29763
29745
  var Axios = Axios_1;
29764
29746
  var mergeConfig = mergeConfig$2;
@@ -29799,10 +29781,10 @@ axios$1.CanceledError = requireCanceledError();
29799
29781
  axios$1.CancelToken = requireCancelToken();
29800
29782
  axios$1.isCancel = requireIsCancel();
29801
29783
  axios$1.VERSION = requireData().version;
29802
- axios$1.toFormData = requireToFormData();
29784
+ axios$1.toFormData = toFormData_1;
29803
29785
 
29804
29786
  // Expose AxiosError class
29805
- axios$1.AxiosError = requireAxiosError();
29787
+ axios$1.AxiosError = AxiosError_1;
29806
29788
 
29807
29789
  // alias for CanceledError for backward compatibility
29808
29790
  axios$1.Cancel = axios$1.CanceledError;
@@ -29864,9 +29846,11 @@ var Requests = /** @class */ (function () {
29864
29846
  if (fileData) {
29865
29847
  headers['Content-Type'] = 'multipart/form-data';
29866
29848
  }
29849
+ var uri = "".concat(this.baseUrl).concat(url);
29850
+ var validUri = uri.replace(/\/\//g, '/');
29867
29851
  var axiosPromise = axios({
29868
29852
  method: method,
29869
- url: "".concat(this.baseUrl).concat(url),
29853
+ url: validUri,
29870
29854
  data: fileData || data,
29871
29855
  headers: headers,
29872
29856
  });