@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/.travis.yml CHANGED
@@ -5,7 +5,7 @@ node_js:
5
5
  jobs:
6
6
  include:
7
7
  - stage: NPM RC Release
8
- if: tag == *-rc*
8
+ if: tag =~ /-(rc|RC)/
9
9
  node_js: "14.16"
10
10
  script:
11
11
  - npm install
@@ -17,7 +17,7 @@ jobs:
17
17
  api_key: $NPM_API_KEY
18
18
  tag: next
19
19
  - stage: NPM Release
20
- if: tag != *-rc*
20
+ if: not tag =~ /-(rc|RC)/
21
21
  node_js: "14.16"
22
22
  script:
23
23
  - npm install
package/README.md CHANGED
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
33
33
  To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
34
34
 
35
35
  ```html
36
- <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.1"></script>
36
+ <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.2"></script>
37
37
  ```
38
38
 
39
39
 
package/dist/cjs/sdk.js CHANGED
@@ -1,8 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('isomorphic-form-data');
4
- var crossFetch = require('cross-fetch');
5
-
6
3
  /******************************************************************************
7
4
  Copyright (c) Microsoft Corporation.
8
5
 
@@ -123,7 +120,7 @@ class Client {
123
120
  'x-sdk-name': 'Console',
124
121
  'x-sdk-platform': 'console',
125
122
  'x-sdk-language': 'web',
126
- 'x-sdk-version': '0.6.1',
123
+ 'x-sdk-version': '0.6.2',
127
124
  'X-Appwrite-Response-Format': '1.5.0',
128
125
  };
129
126
  this.realtime = {
@@ -155,9 +152,12 @@ class Client {
155
152
  }
156
153
  },
157
154
  createSocket: () => {
158
- var _a, _b;
159
- if (this.realtime.channels.size < 1)
155
+ var _a, _b, _c;
156
+ if (this.realtime.channels.size < 1) {
157
+ this.realtime.reconnect = false;
158
+ (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.close();
160
159
  return;
160
+ }
161
161
  const channels = new URLSearchParams();
162
162
  channels.set('project', this.config.project);
163
163
  this.realtime.channels.forEach(channel => {
@@ -166,10 +166,10 @@ class Client {
166
166
  const url = this.config.endpointRealtime + '/realtime?' + channels.toString();
167
167
  if (url !== this.realtime.url || // Check if URL is present
168
168
  !this.realtime.socket || // Check if WebSocket has not been created
169
- ((_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
169
+ ((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
170
170
  ) {
171
171
  if (this.realtime.socket &&
172
- ((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
172
+ ((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
173
173
  ) {
174
174
  this.realtime.reconnect = false;
175
175
  this.realtime.socket.close();
@@ -386,7 +386,7 @@ class Client {
386
386
  };
387
387
  }
388
388
  call(method, url, headers = {}, params = {}) {
389
- var _a, _b;
389
+ var _a;
390
390
  return __awaiter(this, void 0, void 0, function* () {
391
391
  method = method.toUpperCase();
392
392
  headers = Object.assign({}, this.headers, headers);
@@ -396,7 +396,10 @@ class Client {
396
396
  credentials: 'include'
397
397
  };
398
398
  if (typeof window !== 'undefined' && window.localStorage) {
399
- headers['X-Fallback-Cookies'] = (_a = window.localStorage.getItem('cookieFallback')) !== null && _a !== void 0 ? _a : '';
399
+ const cookieFallback = window.localStorage.getItem('cookieFallback');
400
+ if (cookieFallback) {
401
+ headers['X-Fallback-Cookies'] = cookieFallback;
402
+ }
400
403
  }
401
404
  if (method === 'GET') {
402
405
  for (const [key, value] of Object.entries(Service.flatten(params))) {
@@ -427,8 +430,8 @@ class Client {
427
430
  }
428
431
  try {
429
432
  let data = null;
430
- const response = yield crossFetch.fetch(url.toString(), options);
431
- if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
433
+ const response = yield fetch(url.toString(), options);
434
+ if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
432
435
  data = yield response.json();
433
436
  }
434
437
  else {
@@ -703,7 +706,7 @@ class Account extends Service {
703
706
  *
704
707
  * Add an authenticator app to be used as an MFA factor. Verify the
705
708
  * authenticator using the [verify
706
- * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
709
+ * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
707
710
  * method.
708
711
  *
709
712
  * @param {AuthenticatorType} type
@@ -727,8 +730,8 @@ class Account extends Service {
727
730
  * Verify Authenticator
728
731
  *
729
732
  * Verify an authenticator app after adding it using the [add
730
- * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
731
- * method.
733
+ * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
734
+ * method. add
732
735
  *
733
736
  * @param {AuthenticatorType} type
734
737
  * @param {string} otp
@@ -5875,10 +5878,11 @@ class Messaging extends Service {
5875
5878
  * @param {string[]} cc
5876
5879
  * @param {string[]} bcc
5877
5880
  * @param {string} scheduledAt
5881
+ * @param {string[]} attachments
5878
5882
  * @throws {AppwriteException}
5879
5883
  * @returns {Promise}
5880
5884
  */
5881
- updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt) {
5885
+ updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt, attachments) {
5882
5886
  return __awaiter(this, void 0, void 0, function* () {
5883
5887
  if (typeof messageId === 'undefined') {
5884
5888
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5915,6 +5919,9 @@ class Messaging extends Service {
5915
5919
  if (typeof scheduledAt !== 'undefined') {
5916
5920
  payload['scheduledAt'] = scheduledAt;
5917
5921
  }
5922
+ if (typeof attachments !== 'undefined') {
5923
+ payload['attachments'] = attachments;
5924
+ }
5918
5925
  const uri = new URL(this.client.config.endpoint + apiPath);
5919
5926
  return yield this.client.call('patch', uri, {
5920
5927
  'content-type': 'application/json',
@@ -13151,6 +13158,7 @@ exports.Flag = void 0;
13151
13158
  Flag["Palau"] = "pw";
13152
13159
  Flag["PapuaNewGuinea"] = "pg";
13153
13160
  Flag["Poland"] = "pl";
13161
+ Flag["FrenchPolynesia"] = "pf";
13154
13162
  Flag["NorthKorea"] = "kp";
13155
13163
  Flag["Portugal"] = "pt";
13156
13164
  Flag["Paraguay"] = "py";
@@ -13256,6 +13264,10 @@ exports.Runtime = void 0;
13256
13264
  Runtime["Python310"] = "python-3.10";
13257
13265
  Runtime["Python311"] = "python-3.11";
13258
13266
  Runtime["Python312"] = "python-3.12";
13267
+ Runtime["Pythonml311"] = "python-ml-3.11";
13268
+ Runtime["Deno121"] = "deno-1.21";
13269
+ Runtime["Deno124"] = "deno-1.24";
13270
+ Runtime["Deno135"] = "deno-1.35";
13259
13271
  Runtime["Deno140"] = "deno-1.40";
13260
13272
  Runtime["Dart215"] = "dart-2.15";
13261
13273
  Runtime["Dart216"] = "dart-2.16";