@appwrite.io/console 0.1.0 → 0.1.1

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/iife/sdk.js CHANGED
@@ -55,6 +55,12 @@
55
55
  Query.lessThanEqual = (attribute, value) => Query.addQuery(attribute, "lessThanEqual", value);
56
56
  Query.greaterThan = (attribute, value) => Query.addQuery(attribute, "greaterThan", value);
57
57
  Query.greaterThanEqual = (attribute, value) => Query.addQuery(attribute, "greaterThanEqual", value);
58
+ Query.isNull = (attribute) => `isNull("${attribute}")`;
59
+ Query.isNotNull = (attribute) => `isNotNull("${attribute}")`;
60
+ Query.between = (attribute, start, end) => `between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
61
+ Query.startsWith = (attribute, value) => Query.addQuery(attribute, "startsWith", value);
62
+ Query.endsWith = (attribute, value) => Query.addQuery(attribute, "endsWith", value);
63
+ Query.select = (attributes) => `select([${attributes.map((attr) => `"${attr}"`).join(",")}])`;
58
64
  Query.search = (attribute, value) => Query.addQuery(attribute, "search", value);
59
65
  Query.orderDesc = (attribute) => `orderDesc("${attribute}")`;
60
66
  Query.orderAsc = (attribute) => `orderAsc("${attribute}")`;
@@ -96,7 +102,7 @@
96
102
  'x-sdk-name': 'Console',
97
103
  'x-sdk-platform': 'console',
98
104
  'x-sdk-language': 'web',
99
- 'x-sdk-version': '0.1.0',
105
+ 'x-sdk-version': '0.1.1',
100
106
  'X-Appwrite-Response-Format': '1.0.0',
101
107
  };
102
108
  this.realtime = {
@@ -1646,6 +1652,30 @@
1646
1652
  }
1647
1653
  }
1648
1654
 
1655
+ class Console extends Service {
1656
+ constructor(client) {
1657
+ super(client);
1658
+ }
1659
+ /**
1660
+ * Get Variables
1661
+ *
1662
+ * Get all Environment Variables that are relevant for the console.
1663
+ *
1664
+ * @throws {AppwriteException}
1665
+ * @returns {Promise}
1666
+ */
1667
+ variables() {
1668
+ return __awaiter(this, void 0, void 0, function* () {
1669
+ let path = '/console/variables';
1670
+ let payload = {};
1671
+ const uri = new URL(this.client.config.endpoint + path);
1672
+ return yield this.client.call('get', uri, {
1673
+ 'content-type': 'application/json',
1674
+ }, payload);
1675
+ });
1676
+ }
1677
+ }
1678
+
1649
1679
  class Databases extends Service {
1650
1680
  constructor(client) {
1651
1681
  super(client);
@@ -2727,7 +2757,7 @@
2727
2757
  * Create Relationship Attribute
2728
2758
  *
2729
2759
  * Create relationship attribute. [Learn more about relationship
2730
- * attributes](docs/databases-relationships#relationship-attributes).
2760
+ * attributes](/docs/databases-relationships#relationship-attributes).
2731
2761
  *
2732
2762
  *
2733
2763
  * @param {string} databaseId
@@ -3040,7 +3070,7 @@
3040
3070
  * Update Relationship Attribute
3041
3071
  *
3042
3072
  * Update relationship attribute. [Learn more about relationship
3043
- * attributes](docs/databases-relationships#relationship-attributes).
3073
+ * attributes](/docs/databases-relationships#relationship-attributes).
3044
3074
  *
3045
3075
  *
3046
3076
  * @param {string} databaseId
@@ -7823,6 +7853,7 @@
7823
7853
  exports.AppwriteException = AppwriteException;
7824
7854
  exports.Avatars = Avatars;
7825
7855
  exports.Client = Client;
7856
+ exports.Console = Console;
7826
7857
  exports.Databases = Databases;
7827
7858
  exports.Functions = Functions;
7828
7859
  exports.Graphql = Graphql;
@@ -0,0 +1,18 @@
1
+ import { Client, Console } from "@appwrite.io/console";
2
+
3
+ const client = new Client();
4
+
5
+ const console = new Console(client);
6
+
7
+ client
8
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9
+ .setProject('5df5acd0d48c2') // Your project ID
10
+ ;
11
+
12
+ const promise = console.variables();
13
+
14
+ promise.then(function (response) {
15
+ console.log(response); // Success
16
+ }, function (error) {
17
+ console.log(error); // Failure
18
+ });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@appwrite.io/console",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
package/src/client.ts CHANGED
@@ -104,7 +104,7 @@ class Client {
104
104
  'x-sdk-name': 'Console',
105
105
  'x-sdk-platform': 'console',
106
106
  'x-sdk-language': 'web',
107
- 'x-sdk-version': '0.1.0',
107
+ 'x-sdk-version': '0.1.1',
108
108
  'X-Appwrite-Response-Format': '1.0.0',
109
109
  };
110
110
 
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { Client, Query, AppwriteException } from './client';
2
2
  export { Account } from './services/account';
3
3
  export { Avatars } from './services/avatars';
4
+ export { Console } from './services/console';
4
5
  export { Databases } from './services/databases';
5
6
  export { Functions } from './services/functions';
6
7
  export { Graphql } from './services/graphql';
package/src/models.ts CHANGED
@@ -2545,4 +2545,25 @@ export namespace Models {
2545
2545
  */
2546
2546
  buckets: Metric[];
2547
2547
  }
2548
+ /**
2549
+ * Console Variables
2550
+ */
2551
+ export type ConsoleVariables = {
2552
+ /**
2553
+ * CNAME target for your Appwrite custom domains.
2554
+ */
2555
+ _APP_DOMAIN_TARGET: string;
2556
+ /**
2557
+ * Maximum file size allowed for file upload in bytes.
2558
+ */
2559
+ _APP_STORAGE_LIMIT: number;
2560
+ /**
2561
+ * Maximum file size allowed for deployment in bytes.
2562
+ */
2563
+ _APP_FUNCTIONS_SIZE_LIMIT: number;
2564
+ /**
2565
+ * Defines if usage stats are enabled. This value is set to 'enabled' by default, to disable the usage stats set the value to 'disabled'.
2566
+ */
2567
+ _APP_USAGE_STATS: string;
2568
+ }
2548
2569
  }
package/src/query.ts CHANGED
@@ -21,6 +21,24 @@ export class Query {
21
21
  static greaterThanEqual = (attribute: string, value: QueryTypes): string =>
22
22
  Query.addQuery(attribute, "greaterThanEqual", value);
23
23
 
24
+ static isNull = (attribute: string): string =>
25
+ `isNull("${attribute}")`;
26
+
27
+ static isNotNull = (attribute: string): string =>
28
+ `isNotNull("${attribute}")`;
29
+
30
+ static between = (attribute: string, start: string|number, end: string|number): string =>
31
+ `between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
32
+
33
+ static startsWith = (attribute: string, value: string): string =>
34
+ Query.addQuery(attribute, "startsWith", value);
35
+
36
+ static endsWith = (attribute: string, value: string): string =>
37
+ Query.addQuery(attribute, "endsWith", value);
38
+
39
+ static select = (attributes: string[]): string =>
40
+ `select([${attributes.map((attr: string) => `"${attr}"`).join(",")}])`;
41
+
24
42
  static search = (attribute: string, value: string): string =>
25
43
  Query.addQuery(attribute, "search", value);
26
44
 
@@ -0,0 +1,30 @@
1
+ import { Service } from '../service';
2
+ import { AppwriteException, Client } from '../client';
3
+ import type { Models } from '../models';
4
+ import type { UploadProgress, Payload } from '../client';
5
+
6
+ export class Console extends Service {
7
+
8
+ constructor(client: Client)
9
+ {
10
+ super(client);
11
+ }
12
+
13
+ /**
14
+ * Get Variables
15
+ *
16
+ * Get all Environment Variables that are relevant for the console.
17
+ *
18
+ * @throws {AppwriteException}
19
+ * @returns {Promise}
20
+ */
21
+ async variables(): Promise<Models.ConsoleVariables> {
22
+ let path = '/console/variables';
23
+ let payload: Payload = {};
24
+
25
+ const uri = new URL(this.client.config.endpoint + path);
26
+ return await this.client.call('get', uri, {
27
+ 'content-type': 'application/json',
28
+ }, payload);
29
+ }
30
+ };
@@ -472,7 +472,7 @@ export class Databases extends Service {
472
472
  * @throws {AppwriteException}
473
473
  * @returns {Promise}
474
474
  */
475
- async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: boolean): Promise<Models.AttributeBoolean> {
475
+ async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean> {
476
476
  if (typeof databaseId === 'undefined') {
477
477
  throw new AppwriteException('Missing required parameter: "databaseId"');
478
478
  }
@@ -577,7 +577,7 @@ export class Databases extends Service {
577
577
  * @throws {AppwriteException}
578
578
  * @returns {Promise}
579
579
  */
580
- async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeDatetime> {
580
+ async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime> {
581
581
  if (typeof databaseId === 'undefined') {
582
582
  throw new AppwriteException('Missing required parameter: "databaseId"');
583
583
  }
@@ -687,7 +687,7 @@ export class Databases extends Service {
687
687
  * @throws {AppwriteException}
688
688
  * @returns {Promise}
689
689
  */
690
- async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeEmail> {
690
+ async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail> {
691
691
  if (typeof databaseId === 'undefined') {
692
692
  throw new AppwriteException('Missing required parameter: "databaseId"');
693
693
  }
@@ -805,7 +805,7 @@ export class Databases extends Service {
805
805
  * @throws {AppwriteException}
806
806
  * @returns {Promise}
807
807
  */
808
- async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault: string): Promise<Models.AttributeEnum> {
808
+ async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum> {
809
809
  if (typeof databaseId === 'undefined') {
810
810
  throw new AppwriteException('Missing required parameter: "databaseId"');
811
811
  }
@@ -936,7 +936,7 @@ export class Databases extends Service {
936
936
  * @throws {AppwriteException}
937
937
  * @returns {Promise}
938
938
  */
939
- async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault: number): Promise<Models.AttributeFloat> {
939
+ async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat> {
940
940
  if (typeof databaseId === 'undefined') {
941
941
  throw new AppwriteException('Missing required parameter: "databaseId"');
942
942
  }
@@ -1075,7 +1075,7 @@ export class Databases extends Service {
1075
1075
  * @throws {AppwriteException}
1076
1076
  * @returns {Promise}
1077
1077
  */
1078
- async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault: number): Promise<Models.AttributeInteger> {
1078
+ async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger> {
1079
1079
  if (typeof databaseId === 'undefined') {
1080
1080
  throw new AppwriteException('Missing required parameter: "databaseId"');
1081
1081
  }
@@ -1201,7 +1201,7 @@ export class Databases extends Service {
1201
1201
  * @throws {AppwriteException}
1202
1202
  * @returns {Promise}
1203
1203
  */
1204
- async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeIp> {
1204
+ async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp> {
1205
1205
  if (typeof databaseId === 'undefined') {
1206
1206
  throw new AppwriteException('Missing required parameter: "databaseId"');
1207
1207
  }
@@ -1243,7 +1243,7 @@ export class Databases extends Service {
1243
1243
  * Create Relationship Attribute
1244
1244
  *
1245
1245
  * Create relationship attribute. [Learn more about relationship
1246
- * attributes](docs/databases-relationships#relationship-attributes).
1246
+ * attributes](/docs/databases-relationships#relationship-attributes).
1247
1247
  *
1248
1248
  *
1249
1249
  * @param {string} databaseId
@@ -1388,7 +1388,7 @@ export class Databases extends Service {
1388
1388
  * @throws {AppwriteException}
1389
1389
  * @returns {Promise}
1390
1390
  */
1391
- async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeString> {
1391
+ async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString> {
1392
1392
  if (typeof databaseId === 'undefined') {
1393
1393
  throw new AppwriteException('Missing required parameter: "databaseId"');
1394
1394
  }
@@ -1498,7 +1498,7 @@ export class Databases extends Service {
1498
1498
  * @throws {AppwriteException}
1499
1499
  * @returns {Promise}
1500
1500
  */
1501
- async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeUrl> {
1501
+ async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl> {
1502
1502
  if (typeof databaseId === 'undefined') {
1503
1503
  throw new AppwriteException('Missing required parameter: "databaseId"');
1504
1504
  }
@@ -1604,7 +1604,7 @@ export class Databases extends Service {
1604
1604
  * Update Relationship Attribute
1605
1605
  *
1606
1606
  * Update relationship attribute. [Learn more about relationship
1607
- * attributes](docs/databases-relationships#relationship-attributes).
1607
+ * attributes](/docs/databases-relationships#relationship-attributes).
1608
1608
  *
1609
1609
  *
1610
1610
  * @param {string} databaseId
package/types/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { Client, Query, AppwriteException } from './client';
2
2
  export { Account } from './services/account';
3
3
  export { Avatars } from './services/avatars';
4
+ export { Console } from './services/console';
4
5
  export { Databases } from './services/databases';
5
6
  export { Functions } from './services/functions';
6
7
  export { Graphql } from './services/graphql';
package/types/models.d.ts CHANGED
@@ -2545,4 +2545,25 @@ export declare namespace Models {
2545
2545
  */
2546
2546
  buckets: Metric[];
2547
2547
  };
2548
+ /**
2549
+ * Console Variables
2550
+ */
2551
+ type ConsoleVariables = {
2552
+ /**
2553
+ * CNAME target for your Appwrite custom domains.
2554
+ */
2555
+ _APP_DOMAIN_TARGET: string;
2556
+ /**
2557
+ * Maximum file size allowed for file upload in bytes.
2558
+ */
2559
+ _APP_STORAGE_LIMIT: number;
2560
+ /**
2561
+ * Maximum file size allowed for deployment in bytes.
2562
+ */
2563
+ _APP_FUNCTIONS_SIZE_LIMIT: number;
2564
+ /**
2565
+ * Defines if usage stats are enabled. This value is set to &#039;enabled&#039; by default, to disable the usage stats set the value to &#039;disabled&#039;.
2566
+ */
2567
+ _APP_USAGE_STATS: string;
2568
+ };
2548
2569
  }
package/types/query.d.ts CHANGED
@@ -8,6 +8,12 @@ export declare class Query {
8
8
  static lessThanEqual: (attribute: string, value: QueryTypes) => string;
9
9
  static greaterThan: (attribute: string, value: QueryTypes) => string;
10
10
  static greaterThanEqual: (attribute: string, value: QueryTypes) => string;
11
+ static isNull: (attribute: string) => string;
12
+ static isNotNull: (attribute: string) => string;
13
+ static between: (attribute: string, start: string | number, end: string | number) => string;
14
+ static startsWith: (attribute: string, value: string) => string;
15
+ static endsWith: (attribute: string, value: string) => string;
16
+ static select: (attributes: string[]) => string;
11
17
  static search: (attribute: string, value: string) => string;
12
18
  static orderDesc: (attribute: string) => string;
13
19
  static orderAsc: (attribute: string) => string;
@@ -0,0 +1,15 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Console extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * Get Variables
8
+ *
9
+ * Get all Environment Variables that are relevant for the console.
10
+ *
11
+ * @throws {AppwriteException}
12
+ * @returns {Promise}
13
+ */
14
+ variables(): Promise<Models.ConsoleVariables>;
15
+ }
@@ -176,7 +176,7 @@ export declare class Databases extends Service {
176
176
  * @throws {AppwriteException}
177
177
  * @returns {Promise}
178
178
  */
179
- updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: boolean): Promise<Models.AttributeBoolean>;
179
+ updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean>;
180
180
  /**
181
181
  * Create DateTime Attribute
182
182
  *
@@ -203,7 +203,7 @@ export declare class Databases extends Service {
203
203
  * @throws {AppwriteException}
204
204
  * @returns {Promise}
205
205
  */
206
- updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeDatetime>;
206
+ updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime>;
207
207
  /**
208
208
  * Create Email Attribute
209
209
  *
@@ -235,7 +235,7 @@ export declare class Databases extends Service {
235
235
  * @throws {AppwriteException}
236
236
  * @returns {Promise}
237
237
  */
238
- updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeEmail>;
238
+ updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail>;
239
239
  /**
240
240
  * Create Enum Attribute
241
241
  *
@@ -267,7 +267,7 @@ export declare class Databases extends Service {
267
267
  * @throws {AppwriteException}
268
268
  * @returns {Promise}
269
269
  */
270
- updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault: string): Promise<Models.AttributeEnum>;
270
+ updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum>;
271
271
  /**
272
272
  * Create Float Attribute
273
273
  *
@@ -304,7 +304,7 @@ export declare class Databases extends Service {
304
304
  * @throws {AppwriteException}
305
305
  * @returns {Promise}
306
306
  */
307
- updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault: number): Promise<Models.AttributeFloat>;
307
+ updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat>;
308
308
  /**
309
309
  * Create Integer Attribute
310
310
  *
@@ -341,7 +341,7 @@ export declare class Databases extends Service {
341
341
  * @throws {AppwriteException}
342
342
  * @returns {Promise}
343
343
  */
344
- updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault: number): Promise<Models.AttributeInteger>;
344
+ updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger>;
345
345
  /**
346
346
  * Create IP Address Attribute
347
347
  *
@@ -373,12 +373,12 @@ export declare class Databases extends Service {
373
373
  * @throws {AppwriteException}
374
374
  * @returns {Promise}
375
375
  */
376
- updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeIp>;
376
+ updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp>;
377
377
  /**
378
378
  * Create Relationship Attribute
379
379
  *
380
380
  * Create relationship attribute. [Learn more about relationship
381
- * attributes](docs/databases-relationships#relationship-attributes).
381
+ * attributes](/docs/databases-relationships#relationship-attributes).
382
382
  *
383
383
  *
384
384
  * @param {string} databaseId
@@ -425,7 +425,7 @@ export declare class Databases extends Service {
425
425
  * @throws {AppwriteException}
426
426
  * @returns {Promise}
427
427
  */
428
- updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeString>;
428
+ updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString>;
429
429
  /**
430
430
  * Create URL Attribute
431
431
  *
@@ -457,7 +457,7 @@ export declare class Databases extends Service {
457
457
  * @throws {AppwriteException}
458
458
  * @returns {Promise}
459
459
  */
460
- updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeUrl>;
460
+ updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl>;
461
461
  /**
462
462
  * Get Attribute
463
463
  *
@@ -484,7 +484,7 @@ export declare class Databases extends Service {
484
484
  * Update Relationship Attribute
485
485
  *
486
486
  * Update relationship attribute. [Learn more about relationship
487
- * attributes](docs/databases-relationships#relationship-attributes).
487
+ * attributes](/docs/databases-relationships#relationship-attributes).
488
488
  *
489
489
  *
490
490
  * @param {string} databaseId