@appwrite.io/console 0.6.1 → 0.6.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
@@ -1,6 +1,3 @@
1
- import 'isomorphic-form-data';
2
- import { fetch } from 'cross-fetch';
3
-
4
1
  /******************************************************************************
5
2
  Copyright (c) Microsoft Corporation.
6
3
 
@@ -121,7 +118,7 @@ class Client {
121
118
  'x-sdk-name': 'Console',
122
119
  'x-sdk-platform': 'console',
123
120
  'x-sdk-language': 'web',
124
- 'x-sdk-version': '0.6.1',
121
+ 'x-sdk-version': '0.6.2',
125
122
  'X-Appwrite-Response-Format': '1.5.0',
126
123
  };
127
124
  this.realtime = {
@@ -153,9 +150,12 @@ class Client {
153
150
  }
154
151
  },
155
152
  createSocket: () => {
156
- var _a, _b;
157
- if (this.realtime.channels.size < 1)
153
+ var _a, _b, _c;
154
+ if (this.realtime.channels.size < 1) {
155
+ this.realtime.reconnect = false;
156
+ (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.close();
158
157
  return;
158
+ }
159
159
  const channels = new URLSearchParams();
160
160
  channels.set('project', this.config.project);
161
161
  this.realtime.channels.forEach(channel => {
@@ -164,10 +164,10 @@ class Client {
164
164
  const url = this.config.endpointRealtime + '/realtime?' + channels.toString();
165
165
  if (url !== this.realtime.url || // Check if URL is present
166
166
  !this.realtime.socket || // Check if WebSocket has not been created
167
- ((_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
167
+ ((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
168
168
  ) {
169
169
  if (this.realtime.socket &&
170
- ((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
170
+ ((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
171
171
  ) {
172
172
  this.realtime.reconnect = false;
173
173
  this.realtime.socket.close();
@@ -384,7 +384,7 @@ class Client {
384
384
  };
385
385
  }
386
386
  call(method, url, headers = {}, params = {}) {
387
- var _a, _b;
387
+ var _a;
388
388
  return __awaiter(this, void 0, void 0, function* () {
389
389
  method = method.toUpperCase();
390
390
  headers = Object.assign({}, this.headers, headers);
@@ -394,7 +394,10 @@ class Client {
394
394
  credentials: 'include'
395
395
  };
396
396
  if (typeof window !== 'undefined' && window.localStorage) {
397
- headers['X-Fallback-Cookies'] = (_a = window.localStorage.getItem('cookieFallback')) !== null && _a !== void 0 ? _a : '';
397
+ const cookieFallback = window.localStorage.getItem('cookieFallback');
398
+ if (cookieFallback) {
399
+ headers['X-Fallback-Cookies'] = cookieFallback;
400
+ }
398
401
  }
399
402
  if (method === 'GET') {
400
403
  for (const [key, value] of Object.entries(Service.flatten(params))) {
@@ -426,7 +429,7 @@ class Client {
426
429
  try {
427
430
  let data = null;
428
431
  const response = yield fetch(url.toString(), options);
429
- if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
432
+ if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
430
433
  data = yield response.json();
431
434
  }
432
435
  else {
@@ -701,7 +704,7 @@ class Account extends Service {
701
704
  *
702
705
  * Add an authenticator app to be used as an MFA factor. Verify the
703
706
  * authenticator using the [verify
704
- * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
707
+ * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
705
708
  * method.
706
709
  *
707
710
  * @param {AuthenticatorType} type
@@ -725,8 +728,8 @@ class Account extends Service {
725
728
  * Verify Authenticator
726
729
  *
727
730
  * Verify an authenticator app after adding it using the [add
728
- * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
729
- * method.
731
+ * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
732
+ * method. add
730
733
  *
731
734
  * @param {AuthenticatorType} type
732
735
  * @param {string} otp
@@ -5873,10 +5876,11 @@ class Messaging extends Service {
5873
5876
  * @param {string[]} cc
5874
5877
  * @param {string[]} bcc
5875
5878
  * @param {string} scheduledAt
5879
+ * @param {string[]} attachments
5876
5880
  * @throws {AppwriteException}
5877
5881
  * @returns {Promise}
5878
5882
  */
5879
- updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt) {
5883
+ updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt, attachments) {
5880
5884
  return __awaiter(this, void 0, void 0, function* () {
5881
5885
  if (typeof messageId === 'undefined') {
5882
5886
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5913,6 +5917,9 @@ class Messaging extends Service {
5913
5917
  if (typeof scheduledAt !== 'undefined') {
5914
5918
  payload['scheduledAt'] = scheduledAt;
5915
5919
  }
5920
+ if (typeof attachments !== 'undefined') {
5921
+ payload['attachments'] = attachments;
5922
+ }
5916
5923
  const uri = new URL(this.client.config.endpoint + apiPath);
5917
5924
  return yield this.client.call('patch', uri, {
5918
5925
  'content-type': 'application/json',
@@ -13149,6 +13156,7 @@ var Flag;
13149
13156
  Flag["Palau"] = "pw";
13150
13157
  Flag["PapuaNewGuinea"] = "pg";
13151
13158
  Flag["Poland"] = "pl";
13159
+ Flag["FrenchPolynesia"] = "pf";
13152
13160
  Flag["NorthKorea"] = "kp";
13153
13161
  Flag["Portugal"] = "pt";
13154
13162
  Flag["Paraguay"] = "py";
@@ -13254,6 +13262,10 @@ var Runtime;
13254
13262
  Runtime["Python310"] = "python-3.10";
13255
13263
  Runtime["Python311"] = "python-3.11";
13256
13264
  Runtime["Python312"] = "python-3.12";
13265
+ Runtime["Pythonml311"] = "python-ml-3.11";
13266
+ Runtime["Deno121"] = "deno-1.21";
13267
+ Runtime["Deno124"] = "deno-1.24";
13268
+ Runtime["Deno135"] = "deno-1.35";
13257
13269
  Runtime["Deno140"] = "deno-1.40";
13258
13270
  Runtime["Dart215"] = "dart-2.15";
13259
13271
  Runtime["Dart216"] = "dart-2.16";