@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.
- package/.github/workflows/publish.yml +18 -0
- package/README.md +5 -5
- package/dist/cjs/sdk.js +155 -36
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +154 -37
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +155 -36
- package/docs/examples/account/create-with-invite-code.md +18 -0
- package/docs/examples/console/variables.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 +2 -0
- package/src/models.ts +117 -215
- package/src/query.ts +18 -0
- package/src/services/account.ts +60 -0
- package/src/services/console.ts +30 -0
- package/src/services/databases.ts +11 -11
- 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 +2 -0
- package/types/models.d.ts +117 -215
- package/types/query.d.ts +6 -0
- package/types/services/account.d.ts +19 -0
- package/types/services/console.d.ts +15 -0
- package/types/services/databases.d.ts +11 -11
- 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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Publish Package to npmjs
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v3
|
|
10
|
+
- uses: actions/setup-node@v3
|
|
11
|
+
with:
|
|
12
|
+
node-version: "16.x"
|
|
13
|
+
registry-url: "https://registry.npmjs.org"
|
|
14
|
+
- run: npm install
|
|
15
|
+
- run: npm run build
|
|
16
|
+
- run: npm publish
|
|
17
|
+
env:
|
|
18
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Appwrite Console SDK
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://travis-ci.com/appwrite/sdk-generator)
|
|
6
6
|
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
|
8
8
|
|
|
9
|
-
**This SDK is compatible with Appwrite server version
|
|
9
|
+
**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).**
|
|
10
10
|
|
|
11
11
|
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
|
12
12
|
|
|
@@ -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.
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.2.0"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
|
|
@@ -96,10 +96,10 @@ account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
|
|
|
96
96
|
|
|
97
97
|
### Learn more
|
|
98
98
|
You can use the following resources to learn more and get help
|
|
99
|
-
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-
|
|
99
|
+
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-web)
|
|
100
100
|
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
|
101
101
|
- 💬 [Discord Community](https://appwrite.io/discord)
|
|
102
|
-
- 🚂 [Appwrite
|
|
102
|
+
- 🚂 [Appwrite Web Playground](https://github.com/appwrite/playground-for-web)
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
## Contribution
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -57,6 +57,12 @@ Query.lessThan = (attribute, value) => Query.addQuery(attribute, "lessThan", val
|
|
|
57
57
|
Query.lessThanEqual = (attribute, value) => Query.addQuery(attribute, "lessThanEqual", value);
|
|
58
58
|
Query.greaterThan = (attribute, value) => Query.addQuery(attribute, "greaterThan", value);
|
|
59
59
|
Query.greaterThanEqual = (attribute, value) => Query.addQuery(attribute, "greaterThanEqual", value);
|
|
60
|
+
Query.isNull = (attribute) => `isNull("${attribute}")`;
|
|
61
|
+
Query.isNotNull = (attribute) => `isNotNull("${attribute}")`;
|
|
62
|
+
Query.between = (attribute, start, end) => `between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
|
|
63
|
+
Query.startsWith = (attribute, value) => Query.addQuery(attribute, "startsWith", value);
|
|
64
|
+
Query.endsWith = (attribute, value) => Query.addQuery(attribute, "endsWith", value);
|
|
65
|
+
Query.select = (attributes) => `select([${attributes.map((attr) => `"${attr}"`).join(",")}])`;
|
|
60
66
|
Query.search = (attribute, value) => Query.addQuery(attribute, "search", value);
|
|
61
67
|
Query.orderDesc = (attribute) => `orderDesc("${attribute}")`;
|
|
62
68
|
Query.orderAsc = (attribute) => `orderAsc("${attribute}")`;
|
|
@@ -98,7 +104,7 @@ class Client {
|
|
|
98
104
|
'x-sdk-name': 'Console',
|
|
99
105
|
'x-sdk-platform': 'console',
|
|
100
106
|
'x-sdk-language': 'web',
|
|
101
|
-
'x-sdk-version': '0.
|
|
107
|
+
'x-sdk-version': '0.2.0',
|
|
102
108
|
'X-Appwrite-Response-Format': '1.0.0',
|
|
103
109
|
};
|
|
104
110
|
this.realtime = {
|
|
@@ -540,6 +546,58 @@ class Account extends Service {
|
|
|
540
546
|
}, payload);
|
|
541
547
|
});
|
|
542
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Create account using an invite code
|
|
551
|
+
*
|
|
552
|
+
* Use this endpoint to allow a new user to register a new account in your
|
|
553
|
+
* project. After the user registration completes successfully, you can use
|
|
554
|
+
* the [/account/verfication](/docs/client/account#accountCreateVerification)
|
|
555
|
+
* route to start verifying the user email address. To allow the new user to
|
|
556
|
+
* login to their new account, you need to create a new [account
|
|
557
|
+
* session](/docs/client/account#accountCreateSession).
|
|
558
|
+
*
|
|
559
|
+
* @param {string} userId
|
|
560
|
+
* @param {string} email
|
|
561
|
+
* @param {string} password
|
|
562
|
+
* @param {string} name
|
|
563
|
+
* @param {string} code
|
|
564
|
+
* @throws {AppwriteException}
|
|
565
|
+
* @returns {Promise}
|
|
566
|
+
*/
|
|
567
|
+
createWithInviteCode(userId, email, password, name, code) {
|
|
568
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
569
|
+
if (typeof userId === 'undefined') {
|
|
570
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
571
|
+
}
|
|
572
|
+
if (typeof email === 'undefined') {
|
|
573
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
574
|
+
}
|
|
575
|
+
if (typeof password === 'undefined') {
|
|
576
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
577
|
+
}
|
|
578
|
+
let path = '/account/invite';
|
|
579
|
+
let payload = {};
|
|
580
|
+
if (typeof userId !== 'undefined') {
|
|
581
|
+
payload['userId'] = userId;
|
|
582
|
+
}
|
|
583
|
+
if (typeof email !== 'undefined') {
|
|
584
|
+
payload['email'] = email;
|
|
585
|
+
}
|
|
586
|
+
if (typeof password !== 'undefined') {
|
|
587
|
+
payload['password'] = password;
|
|
588
|
+
}
|
|
589
|
+
if (typeof name !== 'undefined') {
|
|
590
|
+
payload['name'] = name;
|
|
591
|
+
}
|
|
592
|
+
if (typeof code !== 'undefined') {
|
|
593
|
+
payload['code'] = code;
|
|
594
|
+
}
|
|
595
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
596
|
+
return yield this.client.call('post', uri, {
|
|
597
|
+
'content-type': 'application/json',
|
|
598
|
+
}, payload);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
543
601
|
/**
|
|
544
602
|
* Create JWT
|
|
545
603
|
*
|
|
@@ -1648,6 +1706,30 @@ class Avatars extends Service {
|
|
|
1648
1706
|
}
|
|
1649
1707
|
}
|
|
1650
1708
|
|
|
1709
|
+
class Console extends Service {
|
|
1710
|
+
constructor(client) {
|
|
1711
|
+
super(client);
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Get Variables
|
|
1715
|
+
*
|
|
1716
|
+
* Get all Environment Variables that are relevant for the console.
|
|
1717
|
+
*
|
|
1718
|
+
* @throws {AppwriteException}
|
|
1719
|
+
* @returns {Promise}
|
|
1720
|
+
*/
|
|
1721
|
+
variables() {
|
|
1722
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1723
|
+
let path = '/console/variables';
|
|
1724
|
+
let payload = {};
|
|
1725
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
1726
|
+
return yield this.client.call('get', uri, {
|
|
1727
|
+
'content-type': 'application/json',
|
|
1728
|
+
}, payload);
|
|
1729
|
+
});
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1651
1733
|
class Databases extends Service {
|
|
1652
1734
|
constructor(client) {
|
|
1653
1735
|
super(client);
|
|
@@ -2729,7 +2811,7 @@ class Databases extends Service {
|
|
|
2729
2811
|
* Create Relationship Attribute
|
|
2730
2812
|
*
|
|
2731
2813
|
* Create relationship attribute. [Learn more about relationship
|
|
2732
|
-
* attributes](docs/databases-relationships#relationship-attributes).
|
|
2814
|
+
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
2733
2815
|
*
|
|
2734
2816
|
*
|
|
2735
2817
|
* @param {string} databaseId
|
|
@@ -3042,7 +3124,7 @@ class Databases extends Service {
|
|
|
3042
3124
|
* Update Relationship Attribute
|
|
3043
3125
|
*
|
|
3044
3126
|
* Update relationship attribute. [Learn more about relationship
|
|
3045
|
-
* attributes](docs/databases-relationships#relationship-attributes).
|
|
3127
|
+
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
3046
3128
|
*
|
|
3047
3129
|
*
|
|
3048
3130
|
* @param {string} databaseId
|
|
@@ -4354,7 +4436,7 @@ class Health extends Service {
|
|
|
4354
4436
|
/**
|
|
4355
4437
|
* Get Cache
|
|
4356
4438
|
*
|
|
4357
|
-
* Check the Appwrite in-memory cache
|
|
4439
|
+
* Check the Appwrite in-memory cache servers are up and connection is
|
|
4358
4440
|
* successful.
|
|
4359
4441
|
*
|
|
4360
4442
|
* @throws {AppwriteException}
|
|
@@ -4373,7 +4455,7 @@ class Health extends Service {
|
|
|
4373
4455
|
/**
|
|
4374
4456
|
* Get DB
|
|
4375
4457
|
*
|
|
4376
|
-
* Check the Appwrite database
|
|
4458
|
+
* Check the Appwrite database servers are up and connection is successful.
|
|
4377
4459
|
*
|
|
4378
4460
|
* @throws {AppwriteException}
|
|
4379
4461
|
* @returns {Promise}
|
|
@@ -4388,6 +4470,43 @@ class Health extends Service {
|
|
|
4388
4470
|
}, payload);
|
|
4389
4471
|
});
|
|
4390
4472
|
}
|
|
4473
|
+
/**
|
|
4474
|
+
* Get PubSub
|
|
4475
|
+
*
|
|
4476
|
+
* Check the Appwrite pub-sub servers are up and connection is successful.
|
|
4477
|
+
*
|
|
4478
|
+
* @throws {AppwriteException}
|
|
4479
|
+
* @returns {Promise}
|
|
4480
|
+
*/
|
|
4481
|
+
getPubSub() {
|
|
4482
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4483
|
+
let path = '/health/pubsub';
|
|
4484
|
+
let payload = {};
|
|
4485
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4486
|
+
return yield this.client.call('get', uri, {
|
|
4487
|
+
'content-type': 'application/json',
|
|
4488
|
+
}, payload);
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4491
|
+
/**
|
|
4492
|
+
* Get Queue
|
|
4493
|
+
*
|
|
4494
|
+
* Check the Appwrite queue messaging servers are up and connection is
|
|
4495
|
+
* successful.
|
|
4496
|
+
*
|
|
4497
|
+
* @throws {AppwriteException}
|
|
4498
|
+
* @returns {Promise}
|
|
4499
|
+
*/
|
|
4500
|
+
getQueue() {
|
|
4501
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4502
|
+
let path = '/health/queue';
|
|
4503
|
+
let payload = {};
|
|
4504
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4505
|
+
return yield this.client.call('get', uri, {
|
|
4506
|
+
'content-type': 'application/json',
|
|
4507
|
+
}, payload);
|
|
4508
|
+
});
|
|
4509
|
+
}
|
|
4391
4510
|
/**
|
|
4392
4511
|
* Get Certificates Queue
|
|
4393
4512
|
*
|
|
@@ -4651,6 +4770,33 @@ class Locale extends Service {
|
|
|
4651
4770
|
}
|
|
4652
4771
|
}
|
|
4653
4772
|
|
|
4773
|
+
class Project extends Service {
|
|
4774
|
+
constructor(client) {
|
|
4775
|
+
super(client);
|
|
4776
|
+
}
|
|
4777
|
+
/**
|
|
4778
|
+
* Get usage stats for a project
|
|
4779
|
+
*
|
|
4780
|
+
*
|
|
4781
|
+
* @param {string} range
|
|
4782
|
+
* @throws {AppwriteException}
|
|
4783
|
+
* @returns {Promise}
|
|
4784
|
+
*/
|
|
4785
|
+
getUsage(range) {
|
|
4786
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4787
|
+
let path = '/project/usage';
|
|
4788
|
+
let payload = {};
|
|
4789
|
+
if (typeof range !== 'undefined') {
|
|
4790
|
+
payload['range'] = range;
|
|
4791
|
+
}
|
|
4792
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
4793
|
+
return yield this.client.call('get', uri, {
|
|
4794
|
+
'content-type': 'application/json',
|
|
4795
|
+
}, payload);
|
|
4796
|
+
});
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4654
4800
|
class Projects extends Service {
|
|
4655
4801
|
constructor(client) {
|
|
4656
4802
|
super(client);
|
|
@@ -5557,31 +5703,6 @@ class Projects extends Service {
|
|
|
5557
5703
|
}, payload);
|
|
5558
5704
|
});
|
|
5559
5705
|
}
|
|
5560
|
-
/**
|
|
5561
|
-
* Get usage stats for a project
|
|
5562
|
-
*
|
|
5563
|
-
*
|
|
5564
|
-
* @param {string} projectId
|
|
5565
|
-
* @param {string} range
|
|
5566
|
-
* @throws {AppwriteException}
|
|
5567
|
-
* @returns {Promise}
|
|
5568
|
-
*/
|
|
5569
|
-
getUsage(projectId, range) {
|
|
5570
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5571
|
-
if (typeof projectId === 'undefined') {
|
|
5572
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
5573
|
-
}
|
|
5574
|
-
let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
|
|
5575
|
-
let payload = {};
|
|
5576
|
-
if (typeof range !== 'undefined') {
|
|
5577
|
-
payload['range'] = range;
|
|
5578
|
-
}
|
|
5579
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
5580
|
-
return yield this.client.call('get', uri, {
|
|
5581
|
-
'content-type': 'application/json',
|
|
5582
|
-
}, payload);
|
|
5583
|
-
});
|
|
5584
|
-
}
|
|
5585
5706
|
/**
|
|
5586
5707
|
* List Webhooks
|
|
5587
5708
|
*
|
|
@@ -6369,7 +6490,7 @@ class Storage extends Service {
|
|
|
6369
6490
|
});
|
|
6370
6491
|
}
|
|
6371
6492
|
/**
|
|
6372
|
-
* Get usage stats for
|
|
6493
|
+
* Get usage stats for storage bucket
|
|
6373
6494
|
*
|
|
6374
6495
|
*
|
|
6375
6496
|
* @param {string} bucketId
|
|
@@ -7319,20 +7440,16 @@ class Users extends Service {
|
|
|
7319
7440
|
*
|
|
7320
7441
|
*
|
|
7321
7442
|
* @param {string} range
|
|
7322
|
-
* @param {string} provider
|
|
7323
7443
|
* @throws {AppwriteException}
|
|
7324
7444
|
* @returns {Promise}
|
|
7325
7445
|
*/
|
|
7326
|
-
getUsage(range
|
|
7446
|
+
getUsage(range) {
|
|
7327
7447
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7328
7448
|
let path = '/users/usage';
|
|
7329
7449
|
let payload = {};
|
|
7330
7450
|
if (typeof range !== 'undefined') {
|
|
7331
7451
|
payload['range'] = range;
|
|
7332
7452
|
}
|
|
7333
|
-
if (typeof provider !== 'undefined') {
|
|
7334
|
-
payload['provider'] = provider;
|
|
7335
|
-
}
|
|
7336
7453
|
const uri = new URL(this.client.config.endpoint + path);
|
|
7337
7454
|
return yield this.client.call('get', uri, {
|
|
7338
7455
|
'content-type': 'application/json',
|
|
@@ -7825,6 +7942,7 @@ exports.Account = Account;
|
|
|
7825
7942
|
exports.AppwriteException = AppwriteException;
|
|
7826
7943
|
exports.Avatars = Avatars;
|
|
7827
7944
|
exports.Client = Client;
|
|
7945
|
+
exports.Console = Console;
|
|
7828
7946
|
exports.Databases = Databases;
|
|
7829
7947
|
exports.Functions = Functions;
|
|
7830
7948
|
exports.Graphql = Graphql;
|
|
@@ -7832,6 +7950,7 @@ exports.Health = Health;
|
|
|
7832
7950
|
exports.ID = ID;
|
|
7833
7951
|
exports.Locale = Locale;
|
|
7834
7952
|
exports.Permission = Permission;
|
|
7953
|
+
exports.Project = Project;
|
|
7835
7954
|
exports.Projects = Projects;
|
|
7836
7955
|
exports.Query = Query;
|
|
7837
7956
|
exports.Role = Role;
|