@appwrite.io/console 0.1.0 → 0.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.
@@ -49,7 +49,7 @@ export class Health extends Service {
49
49
  /**
50
50
  * Get Cache
51
51
  *
52
- * Check the Appwrite in-memory cache server is up and connection is
52
+ * Check the Appwrite in-memory cache servers are up and connection is
53
53
  * successful.
54
54
  *
55
55
  * @throws {AppwriteException}
@@ -68,7 +68,7 @@ export class Health extends Service {
68
68
  /**
69
69
  * Get DB
70
70
  *
71
- * Check the Appwrite database server is up and connection is successful.
71
+ * Check the Appwrite database servers are up and connection is successful.
72
72
  *
73
73
  * @throws {AppwriteException}
74
74
  * @returns {Promise}
@@ -83,6 +83,43 @@ export class Health extends Service {
83
83
  }, payload);
84
84
  }
85
85
 
86
+ /**
87
+ * Get PubSub
88
+ *
89
+ * Check the Appwrite pub-sub servers are up and connection is successful.
90
+ *
91
+ * @throws {AppwriteException}
92
+ * @returns {Promise}
93
+ */
94
+ async getPubSub(): Promise<Models.HealthStatus> {
95
+ let path = '/health/pubsub';
96
+ let payload: Payload = {};
97
+
98
+ const uri = new URL(this.client.config.endpoint + path);
99
+ return await this.client.call('get', uri, {
100
+ 'content-type': 'application/json',
101
+ }, payload);
102
+ }
103
+
104
+ /**
105
+ * Get Queue
106
+ *
107
+ * Check the Appwrite queue messaging servers are up and connection is
108
+ * successful.
109
+ *
110
+ * @throws {AppwriteException}
111
+ * @returns {Promise}
112
+ */
113
+ async getQueue(): Promise<Models.HealthStatus> {
114
+ let path = '/health/queue';
115
+ let payload: Payload = {};
116
+
117
+ const uri = new URL(this.client.config.endpoint + path);
118
+ return await this.client.call('get', uri, {
119
+ 'content-type': 'application/json',
120
+ }, payload);
121
+ }
122
+
86
123
  /**
87
124
  * Get Certificates Queue
88
125
  *
@@ -0,0 +1,34 @@
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 Project extends Service {
7
+
8
+ constructor(client: Client)
9
+ {
10
+ super(client);
11
+ }
12
+
13
+ /**
14
+ * Get usage stats for a project
15
+ *
16
+ *
17
+ * @param {string} range
18
+ * @throws {AppwriteException}
19
+ * @returns {Promise}
20
+ */
21
+ async getUsage(range?: string): Promise<Models.UsageProject> {
22
+ let path = '/project/usage';
23
+ let payload: Payload = {};
24
+
25
+ if (typeof range !== 'undefined') {
26
+ payload['range'] = range;
27
+ }
28
+
29
+ const uri = new URL(this.client.config.endpoint + path);
30
+ return await this.client.call('get', uri, {
31
+ 'content-type': 'application/json',
32
+ }, payload);
33
+ }
34
+ };
@@ -1024,33 +1024,6 @@ export class Projects extends Service {
1024
1024
  }, payload);
1025
1025
  }
1026
1026
 
1027
- /**
1028
- * Get usage stats for a project
1029
- *
1030
- *
1031
- * @param {string} projectId
1032
- * @param {string} range
1033
- * @throws {AppwriteException}
1034
- * @returns {Promise}
1035
- */
1036
- async getUsage(projectId: string, range?: string): Promise<Models.UsageProject> {
1037
- if (typeof projectId === 'undefined') {
1038
- throw new AppwriteException('Missing required parameter: "projectId"');
1039
- }
1040
-
1041
- let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
1042
- let payload: Payload = {};
1043
-
1044
- if (typeof range !== 'undefined') {
1045
- payload['range'] = range;
1046
- }
1047
-
1048
- const uri = new URL(this.client.config.endpoint + path);
1049
- return await this.client.call('get', uri, {
1050
- 'content-type': 'application/json',
1051
- }, payload);
1052
- }
1053
-
1054
1027
  /**
1055
1028
  * List Webhooks
1056
1029
  *
@@ -663,7 +663,7 @@ export class Storage extends Service {
663
663
  }
664
664
 
665
665
  /**
666
- * Get usage stats for a storage bucket
666
+ * Get usage stats for storage bucket
667
667
  *
668
668
  *
669
669
  * @param {string} bucketId
@@ -539,11 +539,10 @@ export class Users extends Service {
539
539
  *
540
540
  *
541
541
  * @param {string} range
542
- * @param {string} provider
543
542
  * @throws {AppwriteException}
544
543
  * @returns {Promise}
545
544
  */
546
- async getUsage(range?: string, provider?: string): Promise<Models.UsageUsers> {
545
+ async getUsage(range?: string): Promise<Models.UsageUsers> {
547
546
  let path = '/users/usage';
548
547
  let payload: Payload = {};
549
548
 
@@ -551,10 +550,6 @@ export class Users extends Service {
551
550
  payload['range'] = range;
552
551
  }
553
552
 
554
- if (typeof provider !== 'undefined') {
555
- payload['provider'] = provider;
556
- }
557
-
558
553
  const uri = new URL(this.client.config.endpoint + path);
559
554
  return await this.client.call('get', uri, {
560
555
  'content-type': 'application/json',
package/types/index.d.ts CHANGED
@@ -1,11 +1,13 @@
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';
7
8
  export { Health } from './services/health';
8
9
  export { Locale } from './services/locale';
10
+ export { Project } from './services/project';
9
11
  export { Projects } from './services/projects';
10
12
  export { Storage } from './services/storage';
11
13
  export { Teams } from './services/teams';
package/types/models.d.ts CHANGED
@@ -1082,6 +1082,59 @@ export declare namespace Models {
1082
1082
  */
1083
1083
  threads: number;
1084
1084
  };
1085
+ /**
1086
+ * Account
1087
+ */
1088
+ type Account<Preferences extends Models.Preferences> = {
1089
+ /**
1090
+ * User ID.
1091
+ */
1092
+ $id: string;
1093
+ /**
1094
+ * User creation date in ISO 8601 format.
1095
+ */
1096
+ $createdAt: string;
1097
+ /**
1098
+ * User update date in ISO 8601 format.
1099
+ */
1100
+ $updatedAt: string;
1101
+ /**
1102
+ * User name.
1103
+ */
1104
+ name: string;
1105
+ /**
1106
+ * User registration date in ISO 8601 format.
1107
+ */
1108
+ registration: string;
1109
+ /**
1110
+ * User status. Pass `true` for enabled and `false` for disabled.
1111
+ */
1112
+ status: boolean;
1113
+ /**
1114
+ * Password update time in ISO 8601 format.
1115
+ */
1116
+ passwordUpdate: string;
1117
+ /**
1118
+ * User email address.
1119
+ */
1120
+ email: string;
1121
+ /**
1122
+ * User phone number in E.164 format.
1123
+ */
1124
+ phone: string;
1125
+ /**
1126
+ * Email verification status.
1127
+ */
1128
+ emailVerification: boolean;
1129
+ /**
1130
+ * Phone verification status.
1131
+ */
1132
+ phoneVerification: boolean;
1133
+ /**
1134
+ * User preferences as a key-value object
1135
+ */
1136
+ prefs: Preferences;
1137
+ };
1085
1138
  /**
1086
1139
  * Preferences
1087
1140
  */
@@ -1492,14 +1545,6 @@ export declare namespace Models {
1492
1545
  * Function execution schedult in CRON format.
1493
1546
  */
1494
1547
  schedule: string;
1495
- /**
1496
- * Function&#039;s next scheduled execution time in ISO 8601 format.
1497
- */
1498
- scheduleNext: string;
1499
- /**
1500
- * Function&#039;s previous scheduled execution time in ISO 8601 format.
1501
- */
1502
- schedulePrevious: string;
1503
1548
  /**
1504
1549
  * Function execution timeout in seconds.
1505
1550
  */
@@ -2150,6 +2195,10 @@ export declare namespace Models {
2150
2195
  * Health Status
2151
2196
  */
2152
2197
  type HealthStatus = {
2198
+ /**
2199
+ * Name of the service.
2200
+ */
2201
+ name: string;
2153
2202
  /**
2154
2203
  * Duration in milliseconds how long the health check took.
2155
2204
  */
@@ -2200,63 +2249,15 @@ export declare namespace Models {
2200
2249
  /**
2201
2250
  * Aggregated stats for total number of documents.
2202
2251
  */
2203
- databasesCount: Metric[];
2204
- /**
2205
- * Aggregated stats for total number of documents.
2206
- */
2207
- documentsCount: Metric[];
2208
- /**
2209
- * Aggregated stats for total number of collections.
2210
- */
2211
- collectionsCount: Metric[];
2212
- /**
2213
- * Aggregated stats for documents created.
2214
- */
2215
- databasesCreate: Metric[];
2216
- /**
2217
- * Aggregated stats for documents read.
2218
- */
2219
- databasesRead: Metric[];
2220
- /**
2221
- * Aggregated stats for documents updated.
2222
- */
2223
- databasesUpdate: Metric[];
2252
+ databasesTotal: Metric[];
2224
2253
  /**
2225
2254
  * Aggregated stats for total number of collections.
2226
2255
  */
2227
- databasesDelete: Metric[];
2228
- /**
2229
- * Aggregated stats for documents created.
2230
- */
2231
- documentsCreate: Metric[];
2232
- /**
2233
- * Aggregated stats for documents read.
2234
- */
2235
- documentsRead: Metric[];
2236
- /**
2237
- * Aggregated stats for documents updated.
2238
- */
2239
- documentsUpdate: Metric[];
2240
- /**
2241
- * Aggregated stats for documents deleted.
2242
- */
2243
- documentsDelete: Metric[];
2256
+ collectionsTotal: Metric[];
2244
2257
  /**
2245
- * Aggregated stats for collections created.
2246
- */
2247
- collectionsCreate: Metric[];
2248
- /**
2249
- * Aggregated stats for collections read.
2250
- */
2251
- collectionsRead: Metric[];
2252
- /**
2253
- * Aggregated stats for collections updated.
2254
- */
2255
- collectionsUpdate: Metric[];
2256
- /**
2257
- * Aggregated stats for collections delete.
2258
+ * Aggregated stats for total number of documents.
2258
2259
  */
2259
- collectionsDelete: Metric[];
2260
+ documentsTotal: Metric[];
2260
2261
  };
2261
2262
  /**
2262
2263
  * UsageDatabase
@@ -2266,46 +2267,14 @@ export declare namespace Models {
2266
2267
  * The time range of the usage stats.
2267
2268
  */
2268
2269
  range: string;
2269
- /**
2270
- * Aggregated stats for total number of documents.
2271
- */
2272
- documentsCount: Metric[];
2273
2270
  /**
2274
2271
  * Aggregated stats for total number of collections.
2275
2272
  */
2276
- collectionsCount: Metric[];
2273
+ collectionsTotal: Metric[];
2277
2274
  /**
2278
- * Aggregated stats for documents created.
2279
- */
2280
- documentsCreate: Metric[];
2281
- /**
2282
- * Aggregated stats for documents read.
2283
- */
2284
- documentsRead: Metric[];
2285
- /**
2286
- * Aggregated stats for documents updated.
2287
- */
2288
- documentsUpdate: Metric[];
2289
- /**
2290
- * Aggregated stats for documents deleted.
2291
- */
2292
- documentsDelete: Metric[];
2293
- /**
2294
- * Aggregated stats for collections created.
2295
- */
2296
- collectionsCreate: Metric[];
2297
- /**
2298
- * Aggregated stats for collections read.
2299
- */
2300
- collectionsRead: Metric[];
2301
- /**
2302
- * Aggregated stats for collections updated.
2303
- */
2304
- collectionsUpdate: Metric[];
2305
- /**
2306
- * Aggregated stats for collections delete.
2275
+ * Aggregated stats for total number of documents.
2307
2276
  */
2308
- collectionsDelete: Metric[];
2277
+ documentsTotal: Metric[];
2309
2278
  };
2310
2279
  /**
2311
2280
  * UsageCollection
@@ -2318,23 +2287,7 @@ export declare namespace Models {
2318
2287
  /**
2319
2288
  * Aggregated stats for total number of documents.
2320
2289
  */
2321
- documentsCount: Metric[];
2322
- /**
2323
- * Aggregated stats for documents created.
2324
- */
2325
- documentsCreate: Metric[];
2326
- /**
2327
- * Aggregated stats for documents read.
2328
- */
2329
- documentsRead: Metric[];
2330
- /**
2331
- * Aggregated stats for documents updated.
2332
- */
2333
- documentsUpdate: Metric[];
2334
- /**
2335
- * Aggregated stats for documents deleted.
2336
- */
2337
- documentsDelete: Metric[];
2290
+ documentsTotal: Metric[];
2338
2291
  };
2339
2292
  /**
2340
2293
  * UsageUsers
@@ -2347,35 +2300,11 @@ export declare namespace Models {
2347
2300
  /**
2348
2301
  * Aggregated stats for total number of users.
2349
2302
  */
2350
- usersCount: Metric[];
2351
- /**
2352
- * Aggregated stats for users created.
2353
- */
2354
- usersCreate: Metric[];
2355
- /**
2356
- * Aggregated stats for users read.
2357
- */
2358
- usersRead: Metric[];
2359
- /**
2360
- * Aggregated stats for users updated.
2361
- */
2362
- usersUpdate: Metric[];
2363
- /**
2364
- * Aggregated stats for users deleted.
2365
- */
2366
- usersDelete: Metric[];
2303
+ usersTotal: Metric[];
2367
2304
  /**
2368
2305
  * Aggregated stats for sessions created.
2369
2306
  */
2370
- sessionsCreate: Metric[];
2371
- /**
2372
- * Aggregated stats for sessions created for a provider ( email, anonymous or oauth2 ).
2373
- */
2374
- sessionsProviderCreate: Metric[];
2375
- /**
2376
- * Aggregated stats for sessions deleted.
2377
- */
2378
- sessionsDelete: Metric[];
2307
+ sessionsTotal: Metric[];
2379
2308
  };
2380
2309
  /**
2381
2310
  * StorageUsage
@@ -2385,50 +2314,18 @@ export declare namespace Models {
2385
2314
  * The time range of the usage stats.
2386
2315
  */
2387
2316
  range: string;
2388
- /**
2389
- * Aggregated stats for the occupied storage size (in bytes).
2390
- */
2391
- storage: Metric[];
2392
- /**
2393
- * Aggregated stats for total number of files.
2394
- */
2395
- filesCount: Metric[];
2396
2317
  /**
2397
2318
  * Aggregated stats for total number of buckets.
2398
2319
  */
2399
- bucketsCount: Metric[];
2400
- /**
2401
- * Aggregated stats for buckets created.
2402
- */
2403
- bucketsCreate: Metric[];
2404
- /**
2405
- * Aggregated stats for buckets read.
2406
- */
2407
- bucketsRead: Metric[];
2320
+ bucketsTotal: Metric[];
2408
2321
  /**
2409
- * Aggregated stats for buckets updated.
2410
- */
2411
- bucketsUpdate: Metric[];
2412
- /**
2413
- * Aggregated stats for buckets deleted.
2414
- */
2415
- bucketsDelete: Metric[];
2416
- /**
2417
- * Aggregated stats for files created.
2418
- */
2419
- filesCreate: Metric[];
2420
- /**
2421
- * Aggregated stats for files read.
2422
- */
2423
- filesRead: Metric[];
2424
- /**
2425
- * Aggregated stats for files updated.
2322
+ * Aggregated stats for total number of files.
2426
2323
  */
2427
- filesUpdate: Metric[];
2324
+ filesTotal: Metric[];
2428
2325
  /**
2429
- * Aggregated stats for files deleted.
2326
+ * Aggregated stats for the occupied storage size (in bytes).
2430
2327
  */
2431
- filesDelete: Metric[];
2328
+ filesStorage: Metric[];
2432
2329
  };
2433
2330
  /**
2434
2331
  * UsageBuckets
@@ -2441,27 +2338,11 @@ export declare namespace Models {
2441
2338
  /**
2442
2339
  * Aggregated stats for total number of files in this bucket.
2443
2340
  */
2444
- filesCount: Metric[];
2341
+ filesTotal: Metric[];
2445
2342
  /**
2446
2343
  * Aggregated stats for total storage of files in this bucket.
2447
2344
  */
2448
2345
  filesStorage: Metric[];
2449
- /**
2450
- * Aggregated stats for files created.
2451
- */
2452
- filesCreate: Metric[];
2453
- /**
2454
- * Aggregated stats for files read.
2455
- */
2456
- filesRead: Metric[];
2457
- /**
2458
- * Aggregated stats for files updated.
2459
- */
2460
- filesUpdate: Metric[];
2461
- /**
2462
- * Aggregated stats for files deleted.
2463
- */
2464
- filesDelete: Metric[];
2465
2346
  };
2466
2347
  /**
2467
2348
  * UsageFunctions
@@ -2472,37 +2353,37 @@ export declare namespace Models {
2472
2353
  */
2473
2354
  range: string;
2474
2355
  /**
2475
- * Aggregated stats for number of function executions.
2476
- */
2477
- executionsTotal: Metric[];
2478
- /**
2479
- * Aggregated stats for function execution failures.
2356
+ * Aggregated stats for number of functions.
2480
2357
  */
2481
- executionsFailure: Metric[];
2358
+ functionsTotal: Metric[];
2482
2359
  /**
2483
- * Aggregated stats for function execution successes.
2360
+ * Aggregated stats for number of function deployments.
2484
2361
  */
2485
- executionsSuccess: Metric[];
2362
+ deploymentsTotal: Metric[];
2486
2363
  /**
2487
- * Aggregated stats for function execution duration.
2364
+ * Aggregated stats for function deployments storage.
2488
2365
  */
2489
- executionsTime: Metric[];
2366
+ deploymentsStorage: Metric[];
2490
2367
  /**
2491
2368
  * Aggregated stats for number of function builds.
2492
2369
  */
2493
2370
  buildsTotal: Metric[];
2494
2371
  /**
2495
- * Aggregated stats for function build failures.
2372
+ * Aggregated stats for builds storage.
2496
2373
  */
2497
- buildsFailure: Metric[];
2374
+ buildsStorage: Metric[];
2498
2375
  /**
2499
- * Aggregated stats for function build successes.
2376
+ * Aggregated stats for function build compute.
2500
2377
  */
2501
- buildsSuccess: Metric[];
2378
+ buildsTime: Metric[];
2502
2379
  /**
2503
- * Aggregated stats for function build duration.
2380
+ * Aggregated stats for number of function executions.
2504
2381
  */
2505
- buildsTime: Metric[];
2382
+ executionsTotal: Metric[];
2383
+ /**
2384
+ * Aggregated stats for function execution compute.
2385
+ */
2386
+ executionsTime: Metric[];
2506
2387
  };
2507
2388
  /**
2508
2389
  * UsageProject
@@ -2515,7 +2396,7 @@ export declare namespace Models {
2515
2396
  /**
2516
2397
  * Aggregated stats for number of requests.
2517
2398
  */
2518
- requests: Metric[];
2399
+ requestsTotal: Metric[];
2519
2400
  /**
2520
2401
  * Aggregated stats for consumed bandwidth.
2521
2402
  */
@@ -2523,26 +2404,47 @@ export declare namespace Models {
2523
2404
  /**
2524
2405
  * Aggregated stats for function executions.
2525
2406
  */
2526
- executions: Metric[];
2407
+ executionsTotal: Metric[];
2527
2408
  /**
2528
2409
  * Aggregated stats for number of documents.
2529
2410
  */
2530
- documents: Metric[];
2411
+ documentsTotal: Metric[];
2531
2412
  /**
2532
2413
  * Aggregated stats for number of databases.
2533
2414
  */
2534
- databases: Metric[];
2415
+ databasesTotal: Metric[];
2535
2416
  /**
2536
2417
  * Aggregated stats for number of users.
2537
2418
  */
2538
- users: Metric[];
2419
+ usersTotal: Metric[];
2539
2420
  /**
2540
2421
  * Aggregated stats for the occupied storage size (in bytes).
2541
2422
  */
2542
- storage: Metric[];
2423
+ filesStorage: Metric[];
2543
2424
  /**
2544
2425
  * Aggregated stats for number of buckets.
2545
2426
  */
2546
- buckets: Metric[];
2427
+ bucketsTotal: Metric[];
2428
+ };
2429
+ /**
2430
+ * Console Variables
2431
+ */
2432
+ type ConsoleVariables = {
2433
+ /**
2434
+ * CNAME target for your Appwrite custom domains.
2435
+ */
2436
+ _APP_DOMAIN_TARGET: string;
2437
+ /**
2438
+ * Maximum file size allowed for file upload in bytes.
2439
+ */
2440
+ _APP_STORAGE_LIMIT: number;
2441
+ /**
2442
+ * Maximum file size allowed for deployment in bytes.
2443
+ */
2444
+ _APP_FUNCTIONS_SIZE_LIMIT: number;
2445
+ /**
2446
+ * 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;.
2447
+ */
2448
+ _APP_USAGE_STATS: string;
2547
2449
  };
2548
2450
  }
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;
@@ -48,6 +48,25 @@ export declare class Account extends Service {
48
48
  * @returns {Promise}
49
49
  */
50
50
  updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>>;
51
+ /**
52
+ * Create account using an invite code
53
+ *
54
+ * Use this endpoint to allow a new user to register a new account in your
55
+ * project. After the user registration completes successfully, you can use
56
+ * the [/account/verfication](/docs/client/account#accountCreateVerification)
57
+ * route to start verifying the user email address. To allow the new user to
58
+ * login to their new account, you need to create a new [account
59
+ * session](/docs/client/account#accountCreateSession).
60
+ *
61
+ * @param {string} userId
62
+ * @param {string} email
63
+ * @param {string} password
64
+ * @param {string} name
65
+ * @param {string} code
66
+ * @throws {AppwriteException}
67
+ * @returns {Promise}
68
+ */
69
+ createWithInviteCode<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string, code?: string): Promise<Models.Account<Preferences>>;
51
70
  /**
52
71
  * Create JWT
53
72
  *