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/cjs/sdk.js CHANGED
@@ -99,7 +99,7 @@ class Client {
99
99
  'x-sdk-name': 'React Native',
100
100
  'x-sdk-platform': 'client',
101
101
  'x-sdk-language': 'reactnative',
102
- 'x-sdk-version': '0.7.1',
102
+ 'x-sdk-version': '0.7.2',
103
103
  'X-Appwrite-Response-Format': '1.6.0',
104
104
  };
105
105
  this.realtime = {
@@ -370,9 +370,9 @@ class Client {
370
370
  this.realtime.connect();
371
371
  };
372
372
  }
373
- call(method, url, headers = {}, params = {}) {
374
- var _a;
375
- return __awaiter(this, void 0, void 0, function* () {
373
+ call(method_1, url_1) {
374
+ return __awaiter(this, arguments, void 0, function* (method, url, headers = {}, params = {}) {
375
+ var _a, _b;
376
376
  method = method.toUpperCase();
377
377
  headers = Object.assign({}, this.headers, headers);
378
378
  headers.Origin = `appwrite-${reactNative.Platform.OS}://${this.config.platform}`;
@@ -411,7 +411,6 @@ class Client {
411
411
  try {
412
412
  let data = null;
413
413
  const response = yield fetch(url.toString(), options);
414
- const text = yield response.text();
415
414
  const warnings = response.headers.get('x-appwrite-warning');
416
415
  if (warnings) {
417
416
  warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
@@ -421,11 +420,18 @@ class Client {
421
420
  }
422
421
  else {
423
422
  data = {
424
- message: text
423
+ message: yield response.text()
425
424
  };
426
425
  }
427
426
  if (400 <= response.status) {
428
- throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, text);
427
+ let responseText = '';
428
+ if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
429
+ responseText = JSON.stringify(data);
430
+ }
431
+ else {
432
+ responseText = data === null || data === void 0 ? void 0 : data.message;
433
+ }
434
+ throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, responseText);
429
435
  }
430
436
  const cookieFallback = response.headers.get('X-Fallback-Cookies');
431
437
  if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
@@ -2009,6 +2015,7 @@ class Databases extends Service {
2009
2015
  * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
2010
2016
  * API or directly from your database console.
2011
2017
  *
2018
+ *
2012
2019
  * @param {string} databaseId
2013
2020
  * @param {string} collectionId
2014
2021
  * @param {string} documentId
@@ -2539,8 +2546,8 @@ class Storage extends Service {
2539
2546
  * @throws {AppwriteException}
2540
2547
  * @returns {Promise}
2541
2548
  */
2542
- createFile(bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2543
- return __awaiter(this, void 0, void 0, function* () {
2549
+ createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2550
+ return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2544
2551
  if (typeof bucketId === 'undefined') {
2545
2552
  throw new AppwriteException('Missing required parameter: "bucketId"');
2546
2553
  }
@@ -3365,7 +3372,7 @@ class ID {
3365
3372
  }
3366
3373
  static unique(padding = 7) {
3367
3374
  // Generate a unique ID with padding to have a longer ID
3368
- const baseId = __classPrivateFieldGet(ID, _a, "m", _ID_hexTimestamp).call(ID);
3375
+ const baseId = __classPrivateFieldGet(_a, _a, "m", _ID_hexTimestamp).call(_a);
3369
3376
  let randomPadding = '';
3370
3377
  for (let i = 0; i < padding; i++) {
3371
3378
  const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
@@ -3475,6 +3482,7 @@ exports.CreditCard = void 0;
3475
3482
  CreditCard["Visa"] = "visa";
3476
3483
  CreditCard["MIR"] = "mir";
3477
3484
  CreditCard["Maestro"] = "maestro";
3485
+ CreditCard["Rupay"] = "rupay";
3478
3486
  })(exports.CreditCard || (exports.CreditCard = {}));
3479
3487
 
3480
3488
  exports.Flag = void 0;