@appwrite.io/console 0.1.1 → 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.
- package/.github/workflows/publish.yml +18 -0
- package/README.md +2 -2
- package/dist/cjs/sdk.js +122 -34
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +122 -35
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +122 -34
- package/docs/examples/account/create-with-invite-code.md +18 -0
- package/docs/examples/health/get-pub-sub.md +18 -0
- package/docs/examples/health/get-queue.md +18 -0
- package/docs/examples/{projects → project}/get-usage.md +3 -3
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/index.ts +1 -0
- package/src/models.ts +96 -215
- package/src/services/account.ts +60 -0
- package/src/services/health.ts +39 -2
- package/src/services/project.ts +34 -0
- package/src/services/projects.ts +0 -27
- package/src/services/storage.ts +1 -1
- package/src/services/users.ts +1 -6
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +96 -215
- package/types/services/account.d.ts +19 -0
- package/types/services/health.d.ts +21 -2
- package/types/services/project.d.ts +15 -0
- package/types/services/projects.d.ts +0 -10
- package/types/services/storage.d.ts +1 -1
- package/types/services/users.d.ts +1 -2
- package/.travis.yml +0 -32
package/dist/iife/sdk.js
CHANGED
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
'x-sdk-name': 'Console',
|
|
103
103
|
'x-sdk-platform': 'console',
|
|
104
104
|
'x-sdk-language': 'web',
|
|
105
|
-
'x-sdk-version': '0.
|
|
105
|
+
'x-sdk-version': '0.2.0',
|
|
106
106
|
'X-Appwrite-Response-Format': '1.0.0',
|
|
107
107
|
};
|
|
108
108
|
this.realtime = {
|
|
@@ -544,6 +544,58 @@
|
|
|
544
544
|
}, payload);
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Create account using an invite code
|
|
549
|
+
*
|
|
550
|
+
* Use this endpoint to allow a new user to register a new account in your
|
|
551
|
+
* project. After the user registration completes successfully, you can use
|
|
552
|
+
* the [/account/verfication](/docs/client/account#accountCreateVerification)
|
|
553
|
+
* route to start verifying the user email address. To allow the new user to
|
|
554
|
+
* login to their new account, you need to create a new [account
|
|
555
|
+
* session](/docs/client/account#accountCreateSession).
|
|
556
|
+
*
|
|
557
|
+
* @param {string} userId
|
|
558
|
+
* @param {string} email
|
|
559
|
+
* @param {string} password
|
|
560
|
+
* @param {string} name
|
|
561
|
+
* @param {string} code
|
|
562
|
+
* @throws {AppwriteException}
|
|
563
|
+
* @returns {Promise}
|
|
564
|
+
*/
|
|
565
|
+
createWithInviteCode(userId, email, password, name, code) {
|
|
566
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
567
|
+
if (typeof userId === 'undefined') {
|
|
568
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
569
|
+
}
|
|
570
|
+
if (typeof email === 'undefined') {
|
|
571
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
572
|
+
}
|
|
573
|
+
if (typeof password === 'undefined') {
|
|
574
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
575
|
+
}
|
|
576
|
+
let path = '/account/invite';
|
|
577
|
+
let payload = {};
|
|
578
|
+
if (typeof userId !== 'undefined') {
|
|
579
|
+
payload['userId'] = userId;
|
|
580
|
+
}
|
|
581
|
+
if (typeof email !== 'undefined') {
|
|
582
|
+
payload['email'] = email;
|
|
583
|
+
}
|
|
584
|
+
if (typeof password !== 'undefined') {
|
|
585
|
+
payload['password'] = password;
|
|
586
|
+
}
|
|
587
|
+
if (typeof name !== 'undefined') {
|
|
588
|
+
payload['name'] = name;
|
|
589
|
+
}
|
|
590
|
+
if (typeof code !== 'undefined') {
|
|
591
|
+
payload['code'] = code;
|
|
592
|
+
}
|
|
593
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
594
|
+
return yield this.client.call('post', uri, {
|
|
595
|
+
'content-type': 'application/json',
|
|
596
|
+
}, payload);
|
|
597
|
+
});
|
|
598
|
+
}
|
|
547
599
|
/**
|
|
548
600
|
* Create JWT
|
|
549
601
|
*
|
|
@@ -4382,7 +4434,7 @@
|
|
|
4382
4434
|
/**
|
|
4383
4435
|
* Get Cache
|
|
4384
4436
|
*
|
|
4385
|
-
* Check the Appwrite in-memory cache
|
|
4437
|
+
* Check the Appwrite in-memory cache servers are up and connection is
|
|
4386
4438
|
* successful.
|
|
4387
4439
|
*
|
|
4388
4440
|
* @throws {AppwriteException}
|
|
@@ -4401,7 +4453,7 @@
|
|
|
4401
4453
|
/**
|
|
4402
4454
|
* Get DB
|
|
4403
4455
|
*
|
|
4404
|
-
* Check the Appwrite database
|
|
4456
|
+
* Check the Appwrite database servers are up and connection is successful.
|
|
4405
4457
|
*
|
|
4406
4458
|
* @throws {AppwriteException}
|
|
4407
4459
|
* @returns {Promise}
|
|
@@ -4416,6 +4468,43 @@
|
|
|
4416
4468
|
}, payload);
|
|
4417
4469
|
});
|
|
4418
4470
|
}
|
|
4471
|
+
/**
|
|
4472
|
+
* Get PubSub
|
|
4473
|
+
*
|
|
4474
|
+
* Check the Appwrite pub-sub servers are up and connection is successful.
|
|
4475
|
+
*
|
|
4476
|
+
* @throws {AppwriteException}
|
|
4477
|
+
* @returns {Promise}
|
|
4478
|
+
*/
|
|
4479
|
+
getPubSub() {
|
|
4480
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4481
|
+
let path = '/health/pubsub';
|
|
4482
|
+
let payload = {};
|
|
4483
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4484
|
+
return yield this.client.call('get', uri, {
|
|
4485
|
+
'content-type': 'application/json',
|
|
4486
|
+
}, payload);
|
|
4487
|
+
});
|
|
4488
|
+
}
|
|
4489
|
+
/**
|
|
4490
|
+
* Get Queue
|
|
4491
|
+
*
|
|
4492
|
+
* Check the Appwrite queue messaging servers are up and connection is
|
|
4493
|
+
* successful.
|
|
4494
|
+
*
|
|
4495
|
+
* @throws {AppwriteException}
|
|
4496
|
+
* @returns {Promise}
|
|
4497
|
+
*/
|
|
4498
|
+
getQueue() {
|
|
4499
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4500
|
+
let path = '/health/queue';
|
|
4501
|
+
let payload = {};
|
|
4502
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4503
|
+
return yield this.client.call('get', uri, {
|
|
4504
|
+
'content-type': 'application/json',
|
|
4505
|
+
}, payload);
|
|
4506
|
+
});
|
|
4507
|
+
}
|
|
4419
4508
|
/**
|
|
4420
4509
|
* Get Certificates Queue
|
|
4421
4510
|
*
|
|
@@ -4679,6 +4768,33 @@
|
|
|
4679
4768
|
}
|
|
4680
4769
|
}
|
|
4681
4770
|
|
|
4771
|
+
class Project extends Service {
|
|
4772
|
+
constructor(client) {
|
|
4773
|
+
super(client);
|
|
4774
|
+
}
|
|
4775
|
+
/**
|
|
4776
|
+
* Get usage stats for a project
|
|
4777
|
+
*
|
|
4778
|
+
*
|
|
4779
|
+
* @param {string} range
|
|
4780
|
+
* @throws {AppwriteException}
|
|
4781
|
+
* @returns {Promise}
|
|
4782
|
+
*/
|
|
4783
|
+
getUsage(range) {
|
|
4784
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4785
|
+
let path = '/project/usage';
|
|
4786
|
+
let payload = {};
|
|
4787
|
+
if (typeof range !== 'undefined') {
|
|
4788
|
+
payload['range'] = range;
|
|
4789
|
+
}
|
|
4790
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4791
|
+
return yield this.client.call('get', uri, {
|
|
4792
|
+
'content-type': 'application/json',
|
|
4793
|
+
}, payload);
|
|
4794
|
+
});
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4682
4798
|
class Projects extends Service {
|
|
4683
4799
|
constructor(client) {
|
|
4684
4800
|
super(client);
|
|
@@ -5585,31 +5701,6 @@
|
|
|
5585
5701
|
}, payload);
|
|
5586
5702
|
});
|
|
5587
5703
|
}
|
|
5588
|
-
/**
|
|
5589
|
-
* Get usage stats for a project
|
|
5590
|
-
*
|
|
5591
|
-
*
|
|
5592
|
-
* @param {string} projectId
|
|
5593
|
-
* @param {string} range
|
|
5594
|
-
* @throws {AppwriteException}
|
|
5595
|
-
* @returns {Promise}
|
|
5596
|
-
*/
|
|
5597
|
-
getUsage(projectId, range) {
|
|
5598
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5599
|
-
if (typeof projectId === 'undefined') {
|
|
5600
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
5601
|
-
}
|
|
5602
|
-
let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
|
|
5603
|
-
let payload = {};
|
|
5604
|
-
if (typeof range !== 'undefined') {
|
|
5605
|
-
payload['range'] = range;
|
|
5606
|
-
}
|
|
5607
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
5608
|
-
return yield this.client.call('get', uri, {
|
|
5609
|
-
'content-type': 'application/json',
|
|
5610
|
-
}, payload);
|
|
5611
|
-
});
|
|
5612
|
-
}
|
|
5613
5704
|
/**
|
|
5614
5705
|
* List Webhooks
|
|
5615
5706
|
*
|
|
@@ -6397,7 +6488,7 @@
|
|
|
6397
6488
|
});
|
|
6398
6489
|
}
|
|
6399
6490
|
/**
|
|
6400
|
-
* Get usage stats for
|
|
6491
|
+
* Get usage stats for storage bucket
|
|
6401
6492
|
*
|
|
6402
6493
|
*
|
|
6403
6494
|
* @param {string} bucketId
|
|
@@ -7347,20 +7438,16 @@
|
|
|
7347
7438
|
*
|
|
7348
7439
|
*
|
|
7349
7440
|
* @param {string} range
|
|
7350
|
-
* @param {string} provider
|
|
7351
7441
|
* @throws {AppwriteException}
|
|
7352
7442
|
* @returns {Promise}
|
|
7353
7443
|
*/
|
|
7354
|
-
getUsage(range
|
|
7444
|
+
getUsage(range) {
|
|
7355
7445
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7356
7446
|
let path = '/users/usage';
|
|
7357
7447
|
let payload = {};
|
|
7358
7448
|
if (typeof range !== 'undefined') {
|
|
7359
7449
|
payload['range'] = range;
|
|
7360
7450
|
}
|
|
7361
|
-
if (typeof provider !== 'undefined') {
|
|
7362
|
-
payload['provider'] = provider;
|
|
7363
|
-
}
|
|
7364
7451
|
const uri = new URL(this.client.config.endpoint + path);
|
|
7365
7452
|
return yield this.client.call('get', uri, {
|
|
7366
7453
|
'content-type': 'application/json',
|
|
@@ -7861,6 +7948,7 @@
|
|
|
7861
7948
|
exports.ID = ID;
|
|
7862
7949
|
exports.Locale = Locale;
|
|
7863
7950
|
exports.Permission = Permission;
|
|
7951
|
+
exports.Project = Project;
|
|
7864
7952
|
exports.Projects = Projects;
|
|
7865
7953
|
exports.Query = Query;
|
|
7866
7954
|
exports.Role = Role;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Account } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client();
|
|
4
|
+
|
|
5
|
+
const account = new Account(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 = account.createWithInviteCode('[USER_ID]', 'email@example.com', 'password');
|
|
13
|
+
|
|
14
|
+
promise.then(function (response) {
|
|
15
|
+
console.log(response); // Success
|
|
16
|
+
}, function (error) {
|
|
17
|
+
console.log(error); // Failure
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Health } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client();
|
|
4
|
+
|
|
5
|
+
const health = new Health(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 = health.getPubSub();
|
|
13
|
+
|
|
14
|
+
promise.then(function (response) {
|
|
15
|
+
console.log(response); // Success
|
|
16
|
+
}, function (error) {
|
|
17
|
+
console.log(error); // Failure
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Health } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client();
|
|
4
|
+
|
|
5
|
+
const health = new Health(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 = health.getQueue();
|
|
13
|
+
|
|
14
|
+
promise.then(function (response) {
|
|
15
|
+
console.log(response); // Success
|
|
16
|
+
}, function (error) {
|
|
17
|
+
console.log(error); // Failure
|
|
18
|
+
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Client,
|
|
1
|
+
import { Client, Project } from "@appwrite.io/console";
|
|
2
2
|
|
|
3
3
|
const client = new Client();
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const project = new Project(client);
|
|
6
6
|
|
|
7
7
|
client
|
|
8
8
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
9
9
|
.setProject('5df5acd0d48c2') // Your project ID
|
|
10
10
|
;
|
|
11
11
|
|
|
12
|
-
const promise =
|
|
12
|
+
const promise = project.getUsage();
|
|
13
13
|
|
|
14
14
|
promise.then(function (response) {
|
|
15
15
|
console.log(response); // Success
|
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.
|
|
5
|
+
"version": "0.2.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
package/src/client.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { Functions } from './services/functions';
|
|
|
7
7
|
export { Graphql } from './services/graphql';
|
|
8
8
|
export { Health } from './services/health';
|
|
9
9
|
export { Locale } from './services/locale';
|
|
10
|
+
export { Project } from './services/project';
|
|
10
11
|
export { Projects } from './services/projects';
|
|
11
12
|
export { Storage } from './services/storage';
|
|
12
13
|
export { Teams } from './services/teams';
|