react-native-appwrite 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/sdk.js CHANGED
@@ -77,12 +77,13 @@ 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.5.0',
80
+ 'x-sdk-version': '0.7.0',
81
81
  'X-Appwrite-Response-Format': '1.6.0',
82
82
  };
83
83
  this.realtime = {
84
84
  socket: undefined,
85
85
  timeout: undefined,
86
+ heartbeat: undefined,
86
87
  url: '',
87
88
  channels: new Set(),
88
89
  subscriptions: new Map(),
@@ -108,6 +109,17 @@ class Client {
108
109
  return 60000;
109
110
  }
110
111
  },
112
+ createHeartbeat: () => {
113
+ if (this.realtime.heartbeat) {
114
+ clearTimeout(this.realtime.heartbeat);
115
+ }
116
+ this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
117
+ var _a;
118
+ (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({
119
+ type: 'ping'
120
+ }));
121
+ }, 20000);
122
+ },
111
123
  createSocket: () => {
112
124
  var _a, _b, _c;
113
125
  if (this.realtime.channels.size < 1) {
@@ -141,6 +153,7 @@ class Client {
141
153
  this.realtime.socket.addEventListener('message', this.realtime.onMessage);
142
154
  this.realtime.socket.addEventListener('open', _event => {
143
155
  this.realtime.reconnectAttempts = 0;
156
+ this.realtime.createHeartbeat();
144
157
  });
145
158
  this.realtime.socket.addEventListener('close', event => {
146
159
  var _a, _b, _c;
@@ -178,6 +191,8 @@ class Client {
178
191
  });
179
192
  }
180
193
  break;
194
+ case 'pong':
195
+ break; // Handle pong response if needed
181
196
  case 'error':
182
197
  throw message.data;
183
198
  default:
@@ -517,7 +532,7 @@ class Account extends Service {
517
532
  });
518
533
  }
519
534
  /**
520
- * List Identities
535
+ * List identities
521
536
  *
522
537
  * Get the list of identities for the currently logged in user.
523
538
  *
@@ -631,7 +646,7 @@ class Account extends Service {
631
646
  });
632
647
  }
633
648
  /**
634
- * Create Authenticator
649
+ * Create authenticator
635
650
  *
636
651
  * Add an authenticator app to be used as an MFA factor. Verify the
637
652
  * authenticator using the [verify
@@ -656,7 +671,7 @@ class Account extends Service {
656
671
  });
657
672
  }
658
673
  /**
659
- * Verify Authenticator
674
+ * Verify authenticator
660
675
  *
661
676
  * Verify an authenticator app after adding it using the [add
662
677
  * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
@@ -687,7 +702,7 @@ class Account extends Service {
687
702
  });
688
703
  }
689
704
  /**
690
- * Delete Authenticator
705
+ * Delete authenticator
691
706
  *
692
707
  * Delete an authenticator for a user by ID.
693
708
  *
@@ -709,7 +724,7 @@ class Account extends Service {
709
724
  });
710
725
  }
711
726
  /**
712
- * Create MFA Challenge
727
+ * Create MFA challenge
713
728
  *
714
729
  * Begin the process of MFA verification after sign-in. Finish the flow with
715
730
  * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -736,7 +751,7 @@ class Account extends Service {
736
751
  });
737
752
  }
738
753
  /**
739
- * Create MFA Challenge (confirmation)
754
+ * Create MFA challenge (confirmation)
740
755
  *
741
756
  * Complete the MFA challenge by providing the one-time password. Finish the
742
757
  * process of MFA verification by providing the one-time password. To begin
@@ -772,7 +787,7 @@ class Account extends Service {
772
787
  });
773
788
  }
774
789
  /**
775
- * List Factors
790
+ * List factors
776
791
  *
777
792
  * List the factors available on the account to be used as a MFA challange.
778
793
  *
@@ -790,7 +805,7 @@ class Account extends Service {
790
805
  });
791
806
  }
792
807
  /**
793
- * Get MFA Recovery Codes
808
+ * Get MFA recovery codes
794
809
  *
795
810
  * Get recovery codes that can be used as backup for MFA flow. Before getting
796
811
  * codes, they must be generated using
@@ -811,7 +826,7 @@ class Account extends Service {
811
826
  });
812
827
  }
813
828
  /**
814
- * Create MFA Recovery Codes
829
+ * Create MFA recovery codes
815
830
  *
816
831
  * Generate recovery codes as backup for MFA flow. It's recommended to
817
832
  * generate and show then immediately after user successfully adds their
@@ -833,7 +848,7 @@ class Account extends Service {
833
848
  });
834
849
  }
835
850
  /**
836
- * Regenerate MFA Recovery Codes
851
+ * Regenerate MFA recovery codes
837
852
  *
838
853
  * Regenerate recovery codes that can be used as backup for MFA flow. Before
839
854
  * regenerating codes, they must be first generated using
@@ -1423,6 +1438,11 @@ class Account extends Service {
1423
1438
  /**
1424
1439
  * Create push target
1425
1440
  *
1441
+ * Use this endpoint to register a device for push notifications. Provide a
1442
+ * target ID (custom or generated using ID.unique()), a device identifier
1443
+ * (usually a device token), and optionally specify which provider should send
1444
+ * notifications to this target. The target is automatically linked to the
1445
+ * current session and includes device information like brand and model.
1426
1446
  *
1427
1447
  * @param {string} targetId
1428
1448
  * @param {string} identifier
@@ -1458,6 +1478,11 @@ class Account extends Service {
1458
1478
  /**
1459
1479
  * Update push target
1460
1480
  *
1481
+ * Update the currently logged in user's push notification target. You can
1482
+ * modify the target's identifier (device token) and provider ID (token,
1483
+ * email, phone etc.). The target must exist and belong to the current user.
1484
+ * If you change the provider ID, notifications will be sent through the new
1485
+ * messaging provider instead.
1461
1486
  *
1462
1487
  * @param {string} targetId
1463
1488
  * @param {string} identifier
@@ -1486,6 +1511,9 @@ class Account extends Service {
1486
1511
  /**
1487
1512
  * Delete push target
1488
1513
  *
1514
+ * Delete a push notification target for the currently logged in user. After
1515
+ * deletion, the device will no longer receive push notifications. The target
1516
+ * must exist and belong to the current user.
1489
1517
  *
1490
1518
  * @param {string} targetId
1491
1519
  * @throws {AppwriteException}
@@ -1560,9 +1588,7 @@ class Account extends Service {
1560
1588
  * [POST
1561
1589
  * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1562
1590
  * endpoint to complete the login process. The link sent to the user's email
1563
- * address is valid for 1 hour. If you are on a mobile device you can leave
1564
- * the URL parameter empty, so that the login completion will be handled by
1565
- * your Appwrite instance by default.
1591
+ * address is valid for 1 hour.
1566
1592
  *
1567
1593
  * A user is limited to 10 active sessions at a time by default. [Learn more
1568
1594
  * about session
@@ -2507,7 +2533,7 @@ class Locale extends Service {
2507
2533
  });
2508
2534
  }
2509
2535
  /**
2510
- * List Locale Codes
2536
+ * List locale codes
2511
2537
  *
2512
2538
  * List of all locale codes in [ISO
2513
2539
  * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
@@ -2808,13 +2834,11 @@ class Storage extends Service {
2808
2834
  };
2809
2835
  let offset = 0;
2810
2836
  let response = undefined;
2811
- if (fileId != 'unique()') {
2812
- try {
2813
- response = yield this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
2814
- offset = response.chunksUploaded * Service.CHUNK_SIZE;
2815
- }
2816
- catch (e) {
2817
- }
2837
+ try {
2838
+ response = yield this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
2839
+ offset = response.chunksUploaded * Service.CHUNK_SIZE;
2840
+ }
2841
+ catch (e) {
2818
2842
  }
2819
2843
  let timestamp = new Date().getTime();
2820
2844
  while (offset < size) {
@@ -2912,7 +2936,7 @@ class Storage extends Service {
2912
2936
  });
2913
2937
  }
2914
2938
  /**
2915
- * Delete File
2939
+ * Delete file
2916
2940
  *
2917
2941
  * Delete a file by its unique ID. Only users with write permissions have
2918
2942
  * access to delete this resource.
@@ -3217,7 +3241,8 @@ class Teams extends Service {
3217
3241
  * List team memberships
3218
3242
  *
3219
3243
  * Use this endpoint to list a team's members using the team's ID. All team
3220
- * members have read access to this endpoint.
3244
+ * members have read access to this endpoint. Hide sensitive attributes from
3245
+ * the response by toggling membership privacy in the Console.
3221
3246
  *
3222
3247
  * @param {string} teamId
3223
3248
  * @param {string[]} queries
@@ -3317,7 +3342,8 @@ class Teams extends Service {
3317
3342
  * Get team membership
3318
3343
  *
3319
3344
  * Get a team member by the membership unique id. All team members have read
3320
- * access for this resource.
3345
+ * access for this resource. Hide sensitive attributes from the response by
3346
+ * toggling membership privacy in the Console.
3321
3347
  *
3322
3348
  * @param {string} teamId
3323
3349
  * @param {string} membershipId
@@ -4011,6 +4037,8 @@ var ImageFormat;
4011
4037
  ImageFormat["Gif"] = "gif";
4012
4038
  ImageFormat["Png"] = "png";
4013
4039
  ImageFormat["Webp"] = "webp";
4040
+ ImageFormat["Heic"] = "heic";
4041
+ ImageFormat["Avif"] = "avif";
4014
4042
  })(ImageFormat || (ImageFormat = {}));
4015
4043
 
4016
4044
  export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Permission, Query, Role, Storage, Teams };