@appwrite.io/console 15.1.0 → 15.2.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/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@15.1.0"></script>
36
+ <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@15.2.0"></script>
37
37
  ```
38
38
 
39
39
 
package/dist/cjs/sdk.js CHANGED
@@ -622,7 +622,7 @@ class Client {
622
622
  'x-sdk-name': 'Console',
623
623
  'x-sdk-platform': 'console',
624
624
  'x-sdk-language': 'web',
625
- 'x-sdk-version': '15.1.0',
625
+ 'x-sdk-version': '15.2.0',
626
626
  'X-Appwrite-Response-Format': '1.9.5',
627
627
  };
628
628
  this.realtime = {
@@ -674,7 +674,10 @@ class Client {
674
674
  }
675
675
  const encodedProject = encodeURIComponent((_b = this.config.project) !== null && _b !== void 0 ? _b : '');
676
676
  // URL carries only the project; channels/queries are sent via subscribe message.
677
- const queryParams = 'project=' + encodedProject;
677
+ let queryParams = 'project=' + encodedProject;
678
+ if (this.config.jwt) {
679
+ queryParams += '&jwt=' + encodeURIComponent(this.config.jwt);
680
+ }
678
681
  const url = this.config.endpointRealtime + '/realtime?' + queryParams;
679
682
  if (url !== this.realtime.url || // Check if URL is present
680
683
  !this.realtime.socket || // Check if WebSocket has not been created
@@ -14289,15 +14292,22 @@ class Functions {
14289
14292
  };
14290
14293
  return this.client.call('get', uri, apiHeaders, payload);
14291
14294
  }
14292
- /**
14293
- * List allowed function specifications for this instance.
14294
- *
14295
- * @throws {AppwriteException}
14296
- * @returns {Promise<Models.SpecificationList>}
14297
- */
14298
- listSpecifications() {
14295
+ listSpecifications(paramsOrFirst) {
14296
+ let params;
14297
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
14298
+ params = (paramsOrFirst || {});
14299
+ }
14300
+ else {
14301
+ params = {
14302
+ type: paramsOrFirst
14303
+ };
14304
+ }
14305
+ const type = params.type;
14299
14306
  const apiPath = '/functions/specifications';
14300
14307
  const payload = {};
14308
+ if (typeof type !== 'undefined') {
14309
+ payload['type'] = type;
14310
+ }
14301
14311
  const uri = new URL(this.client.config.endpoint + apiPath);
14302
14312
  const apiHeaders = {
14303
14313
  'X-Appwrite-Project': this.client.config.project,
@@ -15632,29 +15642,6 @@ class Health {
15632
15642
  };
15633
15643
  return this.client.call('get', uri, apiHeaders, payload);
15634
15644
  }
15635
- getQueuePriorityBuilds(paramsOrFirst) {
15636
- let params;
15637
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
15638
- params = (paramsOrFirst || {});
15639
- }
15640
- else {
15641
- params = {
15642
- threshold: paramsOrFirst
15643
- };
15644
- }
15645
- const threshold = params.threshold;
15646
- const apiPath = '/health/queue/builds-priority';
15647
- const payload = {};
15648
- if (typeof threshold !== 'undefined') {
15649
- payload['threshold'] = threshold;
15650
- }
15651
- const uri = new URL(this.client.config.endpoint + apiPath);
15652
- const apiHeaders = {
15653
- 'X-Appwrite-Project': this.client.config.project,
15654
- 'accept': 'application/json',
15655
- };
15656
- return this.client.call('get', uri, apiHeaders, payload);
15657
- }
15658
15645
  getQueueCertificates(paramsOrFirst) {
15659
15646
  let params;
15660
15647
  if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -27132,15 +27119,22 @@ class Sites {
27132
27119
  };
27133
27120
  return this.client.call('get', uri, apiHeaders, payload);
27134
27121
  }
27135
- /**
27136
- * List allowed site specifications for this instance.
27137
- *
27138
- * @throws {AppwriteException}
27139
- * @returns {Promise<Models.SpecificationList>}
27140
- */
27141
- listSpecifications() {
27122
+ listSpecifications(paramsOrFirst) {
27123
+ let params;
27124
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
27125
+ params = (paramsOrFirst || {});
27126
+ }
27127
+ else {
27128
+ params = {
27129
+ type: paramsOrFirst
27130
+ };
27131
+ }
27132
+ const type = params.type;
27142
27133
  const apiPath = '/sites/specifications';
27143
27134
  const payload = {};
27135
+ if (typeof type !== 'undefined') {
27136
+ payload['type'] = type;
27137
+ }
27144
27138
  const uri = new URL(this.client.config.endpoint + apiPath);
27145
27139
  const apiHeaders = {
27146
27140
  'X-Appwrite-Project': this.client.config.project,
@@ -36804,7 +36798,11 @@ class Realtime {
36804
36798
  throw new AppwriteException('Missing project ID');
36805
36799
  }
36806
36800
  // URL carries only the project; channels/queries are sent via the subscribe message.
36807
- const queryParams = `project=${projectId}`;
36801
+ let queryParams = `project=${projectId}`;
36802
+ const jwt = this.client.config.jwt;
36803
+ if (jwt) {
36804
+ queryParams += `&jwt=${encodeURIComponent(jwt)}`;
36805
+ }
36808
36806
  const endpoint = this.client.config.endpointRealtime !== ''
36809
36807
  ? this.client.config.endpointRealtime
36810
36808
  : this.client.config.endpoint || '';