react-native-appwrite 0.7.1 → 0.7.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/sdk.js CHANGED
@@ -77,7 +77,7 @@ class Client {
77
77
  'x-sdk-name': 'React Native',
78
78
  'x-sdk-platform': 'client',
79
79
  'x-sdk-language': 'reactnative',
80
- 'x-sdk-version': '0.7.1',
80
+ 'x-sdk-version': '0.7.2',
81
81
  'X-Appwrite-Response-Format': '1.6.0',
82
82
  };
83
83
  this.realtime = {
@@ -348,9 +348,9 @@ class Client {
348
348
  this.realtime.connect();
349
349
  };
350
350
  }
351
- call(method, url, headers = {}, params = {}) {
352
- var _a;
353
- return __awaiter(this, void 0, void 0, function* () {
351
+ call(method_1, url_1) {
352
+ return __awaiter(this, arguments, void 0, function* (method, url, headers = {}, params = {}) {
353
+ var _a, _b;
354
354
  method = method.toUpperCase();
355
355
  headers = Object.assign({}, this.headers, headers);
356
356
  headers.Origin = `appwrite-${Platform.OS}://${this.config.platform}`;
@@ -389,7 +389,6 @@ class Client {
389
389
  try {
390
390
  let data = null;
391
391
  const response = yield fetch(url.toString(), options);
392
- const text = yield response.text();
393
392
  const warnings = response.headers.get('x-appwrite-warning');
394
393
  if (warnings) {
395
394
  warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
@@ -399,11 +398,18 @@ class Client {
399
398
  }
400
399
  else {
401
400
  data = {
402
- message: text
401
+ message: yield response.text()
403
402
  };
404
403
  }
405
404
  if (400 <= response.status) {
406
- throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, text);
405
+ let responseText = '';
406
+ if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
407
+ responseText = JSON.stringify(data);
408
+ }
409
+ else {
410
+ responseText = data === null || data === void 0 ? void 0 : data.message;
411
+ }
412
+ throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, responseText);
407
413
  }
408
414
  const cookieFallback = response.headers.get('X-Fallback-Cookies');
409
415
  if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
@@ -1987,6 +1993,7 @@ class Databases extends Service {
1987
1993
  * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1988
1994
  * API or directly from your database console.
1989
1995
  *
1996
+ *
1990
1997
  * @param {string} databaseId
1991
1998
  * @param {string} collectionId
1992
1999
  * @param {string} documentId
@@ -2517,8 +2524,8 @@ class Storage extends Service {
2517
2524
  * @throws {AppwriteException}
2518
2525
  * @returns {Promise}
2519
2526
  */
2520
- createFile(bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2521
- return __awaiter(this, void 0, void 0, function* () {
2527
+ createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2528
+ return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2522
2529
  if (typeof bucketId === 'undefined') {
2523
2530
  throw new AppwriteException('Missing required parameter: "bucketId"');
2524
2531
  }
@@ -3343,7 +3350,7 @@ class ID {
3343
3350
  }
3344
3351
  static unique(padding = 7) {
3345
3352
  // Generate a unique ID with padding to have a longer ID
3346
- const baseId = __classPrivateFieldGet(ID, _a, "m", _ID_hexTimestamp).call(ID);
3353
+ const baseId = __classPrivateFieldGet(_a, _a, "m", _ID_hexTimestamp).call(_a);
3347
3354
  let randomPadding = '';
3348
3355
  for (let i = 0; i < padding; i++) {
3349
3356
  const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
@@ -3453,6 +3460,7 @@ var CreditCard;
3453
3460
  CreditCard["Visa"] = "visa";
3454
3461
  CreditCard["MIR"] = "mir";
3455
3462
  CreditCard["Maestro"] = "maestro";
3463
+ CreditCard["Rupay"] = "rupay";
3456
3464
  })(CreditCard || (CreditCard = {}));
3457
3465
 
3458
3466
  var Flag;