react-native-appwrite 0.5.0 → 0.6.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/cjs/sdk.js CHANGED
@@ -99,12 +99,13 @@ 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.5.0',
102
+ 'x-sdk-version': '0.6.0',
103
103
  'X-Appwrite-Response-Format': '1.6.0',
104
104
  };
105
105
  this.realtime = {
106
106
  socket: undefined,
107
107
  timeout: undefined,
108
+ heartbeat: undefined,
108
109
  url: '',
109
110
  channels: new Set(),
110
111
  subscriptions: new Map(),
@@ -130,6 +131,17 @@ class Client {
130
131
  return 60000;
131
132
  }
132
133
  },
134
+ createHeartbeat: () => {
135
+ if (this.realtime.heartbeat) {
136
+ clearTimeout(this.realtime.heartbeat);
137
+ }
138
+ this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
139
+ var _a;
140
+ (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({
141
+ type: 'ping'
142
+ }));
143
+ }, 20000);
144
+ },
133
145
  createSocket: () => {
134
146
  var _a, _b, _c;
135
147
  if (this.realtime.channels.size < 1) {
@@ -163,6 +175,7 @@ class Client {
163
175
  this.realtime.socket.addEventListener('message', this.realtime.onMessage);
164
176
  this.realtime.socket.addEventListener('open', _event => {
165
177
  this.realtime.reconnectAttempts = 0;
178
+ this.realtime.createHeartbeat();
166
179
  });
167
180
  this.realtime.socket.addEventListener('close', event => {
168
181
  var _a, _b, _c;
@@ -539,7 +552,7 @@ class Account extends Service {
539
552
  });
540
553
  }
541
554
  /**
542
- * List Identities
555
+ * List identities
543
556
  *
544
557
  * Get the list of identities for the currently logged in user.
545
558
  *
@@ -653,7 +666,7 @@ class Account extends Service {
653
666
  });
654
667
  }
655
668
  /**
656
- * Create Authenticator
669
+ * Create authenticator
657
670
  *
658
671
  * Add an authenticator app to be used as an MFA factor. Verify the
659
672
  * authenticator using the [verify
@@ -678,7 +691,7 @@ class Account extends Service {
678
691
  });
679
692
  }
680
693
  /**
681
- * Verify Authenticator
694
+ * Verify authenticator
682
695
  *
683
696
  * Verify an authenticator app after adding it using the [add
684
697
  * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
@@ -709,7 +722,7 @@ class Account extends Service {
709
722
  });
710
723
  }
711
724
  /**
712
- * Delete Authenticator
725
+ * Delete authenticator
713
726
  *
714
727
  * Delete an authenticator for a user by ID.
715
728
  *
@@ -731,7 +744,7 @@ class Account extends Service {
731
744
  });
732
745
  }
733
746
  /**
734
- * Create MFA Challenge
747
+ * Create MFA challenge
735
748
  *
736
749
  * Begin the process of MFA verification after sign-in. Finish the flow with
737
750
  * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -758,7 +771,7 @@ class Account extends Service {
758
771
  });
759
772
  }
760
773
  /**
761
- * Create MFA Challenge (confirmation)
774
+ * Create MFA challenge (confirmation)
762
775
  *
763
776
  * Complete the MFA challenge by providing the one-time password. Finish the
764
777
  * process of MFA verification by providing the one-time password. To begin
@@ -794,7 +807,7 @@ class Account extends Service {
794
807
  });
795
808
  }
796
809
  /**
797
- * List Factors
810
+ * List factors
798
811
  *
799
812
  * List the factors available on the account to be used as a MFA challange.
800
813
  *
@@ -812,7 +825,7 @@ class Account extends Service {
812
825
  });
813
826
  }
814
827
  /**
815
- * Get MFA Recovery Codes
828
+ * Get MFA recovery codes
816
829
  *
817
830
  * Get recovery codes that can be used as backup for MFA flow. Before getting
818
831
  * codes, they must be generated using
@@ -833,7 +846,7 @@ class Account extends Service {
833
846
  });
834
847
  }
835
848
  /**
836
- * Create MFA Recovery Codes
849
+ * Create MFA recovery codes
837
850
  *
838
851
  * Generate recovery codes as backup for MFA flow. It's recommended to
839
852
  * generate and show then immediately after user successfully adds their
@@ -855,7 +868,7 @@ class Account extends Service {
855
868
  });
856
869
  }
857
870
  /**
858
- * Regenerate MFA Recovery Codes
871
+ * Regenerate MFA recovery codes
859
872
  *
860
873
  * Regenerate recovery codes that can be used as backup for MFA flow. Before
861
874
  * regenerating codes, they must be first generated using
@@ -2529,7 +2542,7 @@ class Locale extends Service {
2529
2542
  });
2530
2543
  }
2531
2544
  /**
2532
- * List Locale Codes
2545
+ * List locale codes
2533
2546
  *
2534
2547
  * List of all locale codes in [ISO
2535
2548
  * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
@@ -2934,7 +2947,7 @@ class Storage extends Service {
2934
2947
  });
2935
2948
  }
2936
2949
  /**
2937
- * Delete File
2950
+ * Delete file
2938
2951
  *
2939
2952
  * Delete a file by its unique ID. Only users with write permissions have
2940
2953
  * access to delete this resource.
@@ -3239,7 +3252,8 @@ class Teams extends Service {
3239
3252
  * List team memberships
3240
3253
  *
3241
3254
  * Use this endpoint to list a team's members using the team's ID. All team
3242
- * members have read access to this endpoint.
3255
+ * members have read access to this endpoint. Hide sensitive attributes from
3256
+ * the response by toggling membership privacy in the Console.
3243
3257
  *
3244
3258
  * @param {string} teamId
3245
3259
  * @param {string[]} queries
@@ -3339,7 +3353,8 @@ class Teams extends Service {
3339
3353
  * Get team membership
3340
3354
  *
3341
3355
  * Get a team member by the membership unique id. All team members have read
3342
- * access for this resource.
3356
+ * access for this resource. Hide sensitive attributes from the response by
3357
+ * toggling membership privacy in the Console.
3343
3358
  *
3344
3359
  * @param {string} teamId
3345
3360
  * @param {string} membershipId
@@ -4033,6 +4048,7 @@ exports.ImageFormat = void 0;
4033
4048
  ImageFormat["Gif"] = "gif";
4034
4049
  ImageFormat["Png"] = "png";
4035
4050
  ImageFormat["Webp"] = "webp";
4051
+ ImageFormat["Avif"] = "avif";
4036
4052
  })(exports.ImageFormat || (exports.ImageFormat = {}));
4037
4053
 
4038
4054
  exports.Account = Account;