@appwrite.io/console 0.1.0-preview-0.1 → 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/README.md +5 -5
- package/dist/cjs/sdk.js +44 -11
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +44 -12
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +44 -11
- package/docs/examples/{teams/update.md → console/variables.md} +3 -3
- package/docs/examples/databases/create-relationship-attribute.md +1 -1
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/index.ts +1 -0
- package/src/models.ts +32 -60
- package/src/query.ts +18 -0
- package/src/services/account.ts +6 -6
- package/src/services/console.ts +30 -0
- package/src/services/databases.ts +17 -16
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +32 -60
- package/types/query.d.ts +6 -0
- package/types/services/account.d.ts +6 -6
- package/types/services/console.d.ts +15 -0
- package/types/services/databases.d.ts +17 -12
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.1.
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.1.1"></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.1.
|
|
107
|
+
'x-sdk-version': '0.1.1',
|
|
102
108
|
'X-Appwrite-Response-Format': '1.0.0',
|
|
103
109
|
};
|
|
104
110
|
this.realtime = {
|
|
@@ -883,7 +889,7 @@ class Account extends Service {
|
|
|
883
889
|
* password combination. This route will create a new session for the user.
|
|
884
890
|
*
|
|
885
891
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
886
|
-
* about session limits](/docs/authentication#limits).
|
|
892
|
+
* about session limits](/docs/authentication-security#limits).
|
|
887
893
|
*
|
|
888
894
|
* @param {string} email
|
|
889
895
|
* @param {string} password
|
|
@@ -928,7 +934,7 @@ class Account extends Service {
|
|
|
928
934
|
* your Appwrite instance by default.
|
|
929
935
|
*
|
|
930
936
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
931
|
-
* about session limits](/docs/authentication#limits).
|
|
937
|
+
* about session limits](/docs/authentication-security#limits).
|
|
932
938
|
*
|
|
933
939
|
* @param {string} userId
|
|
934
940
|
* @param {string} email
|
|
@@ -1019,7 +1025,7 @@ class Account extends Service {
|
|
|
1019
1025
|
* user.
|
|
1020
1026
|
*
|
|
1021
1027
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1022
|
-
* about session limits](/docs/authentication#limits).
|
|
1028
|
+
* about session limits](/docs/authentication-security#limits).
|
|
1023
1029
|
*
|
|
1024
1030
|
*
|
|
1025
1031
|
* @param {string} provider
|
|
@@ -1067,7 +1073,7 @@ class Account extends Service {
|
|
|
1067
1073
|
* is valid for 15 minutes.
|
|
1068
1074
|
*
|
|
1069
1075
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1070
|
-
* about session limits](/docs/authentication#limits).
|
|
1076
|
+
* about session limits](/docs/authentication-security#limits).
|
|
1071
1077
|
*
|
|
1072
1078
|
* @param {string} userId
|
|
1073
1079
|
* @param {string} phone
|
|
@@ -1648,6 +1654,30 @@ class Avatars extends Service {
|
|
|
1648
1654
|
}
|
|
1649
1655
|
}
|
|
1650
1656
|
|
|
1657
|
+
class Console extends Service {
|
|
1658
|
+
constructor(client) {
|
|
1659
|
+
super(client);
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Get Variables
|
|
1663
|
+
*
|
|
1664
|
+
* Get all Environment Variables that are relevant for the console.
|
|
1665
|
+
*
|
|
1666
|
+
* @throws {AppwriteException}
|
|
1667
|
+
* @returns {Promise}
|
|
1668
|
+
*/
|
|
1669
|
+
variables() {
|
|
1670
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1671
|
+
let path = '/console/variables';
|
|
1672
|
+
let payload = {};
|
|
1673
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
1674
|
+
return yield this.client.call('get', uri, {
|
|
1675
|
+
'content-type': 'application/json',
|
|
1676
|
+
}, payload);
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1651
1681
|
class Databases extends Service {
|
|
1652
1682
|
constructor(client) {
|
|
1653
1683
|
super(client);
|
|
@@ -2726,7 +2756,10 @@ class Databases extends Service {
|
|
|
2726
2756
|
});
|
|
2727
2757
|
}
|
|
2728
2758
|
/**
|
|
2729
|
-
* Create
|
|
2759
|
+
* Create Relationship Attribute
|
|
2760
|
+
*
|
|
2761
|
+
* Create relationship attribute. [Learn more about relationship
|
|
2762
|
+
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
2730
2763
|
*
|
|
2731
2764
|
*
|
|
2732
2765
|
* @param {string} databaseId
|
|
@@ -3038,16 +3071,18 @@ class Databases extends Service {
|
|
|
3038
3071
|
/**
|
|
3039
3072
|
* Update Relationship Attribute
|
|
3040
3073
|
*
|
|
3074
|
+
* Update relationship attribute. [Learn more about relationship
|
|
3075
|
+
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
3076
|
+
*
|
|
3041
3077
|
*
|
|
3042
3078
|
* @param {string} databaseId
|
|
3043
3079
|
* @param {string} collectionId
|
|
3044
3080
|
* @param {string} key
|
|
3045
|
-
* @param {boolean} twoWay
|
|
3046
3081
|
* @param {string} onDelete
|
|
3047
3082
|
* @throws {AppwriteException}
|
|
3048
3083
|
* @returns {Promise}
|
|
3049
3084
|
*/
|
|
3050
|
-
updateRelationshipAttribute(databaseId, collectionId, key,
|
|
3085
|
+
updateRelationshipAttribute(databaseId, collectionId, key, onDelete) {
|
|
3051
3086
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3052
3087
|
if (typeof databaseId === 'undefined') {
|
|
3053
3088
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -3060,9 +3095,6 @@ class Databases extends Service {
|
|
|
3060
3095
|
}
|
|
3061
3096
|
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
3062
3097
|
let payload = {};
|
|
3063
|
-
if (typeof twoWay !== 'undefined') {
|
|
3064
|
-
payload['twoWay'] = twoWay;
|
|
3065
|
-
}
|
|
3066
3098
|
if (typeof onDelete !== 'undefined') {
|
|
3067
3099
|
payload['onDelete'] = onDelete;
|
|
3068
3100
|
}
|
|
@@ -7823,6 +7855,7 @@ exports.Account = Account;
|
|
|
7823
7855
|
exports.AppwriteException = AppwriteException;
|
|
7824
7856
|
exports.Avatars = Avatars;
|
|
7825
7857
|
exports.Client = Client;
|
|
7858
|
+
exports.Console = Console;
|
|
7826
7859
|
exports.Databases = Databases;
|
|
7827
7860
|
exports.Functions = Functions;
|
|
7828
7861
|
exports.Graphql = Graphql;
|