node-appwrite 8.0.0-RC1 → 8.1.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/.travis.yml +12 -3
- package/README.md +5 -5
- package/docs/examples/account/list-logs.md +20 -0
- package/docs/examples/account/list-sessions.md +20 -0
- package/docs/examples/locale/list-continents.md +20 -0
- package/docs/examples/locale/list-countries-e-u.md +20 -0
- package/docs/examples/locale/list-countries-phones.md +20 -0
- package/docs/examples/locale/list-countries.md +20 -0
- package/docs/examples/locale/list-currencies.md +20 -0
- package/docs/examples/locale/list-languages.md +20 -0
- package/docs/examples/teams/list-memberships.md +20 -0
- package/docs/examples/users/list-logs.md +20 -0
- package/docs/examples/users/list-memberships.md +20 -0
- package/docs/examples/users/list-sessions.md +20 -0
- package/index.d.ts +56 -30
- package/lib/client.js +2 -2
- package/lib/role.js +12 -6
- package/lib/services/account.js +4 -4
- package/lib/services/functions.js +13 -13
- package/lib/services/locale.js +6 -6
- package/lib/services/teams.js +2 -2
- package/lib/services/users.js +6 -6
- package/package.json +1 -1
package/.travis.yml
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
|
|
2
1
|
language: node_js
|
|
3
2
|
node_js:
|
|
4
3
|
- "14.16"
|
|
5
4
|
|
|
6
5
|
jobs:
|
|
7
6
|
include:
|
|
8
|
-
- stage:
|
|
7
|
+
- stage: NPM RC Release
|
|
8
|
+
if: tag == *-RC*
|
|
9
9
|
node_js: "14.16"
|
|
10
|
-
script: echo "Deploying to
|
|
10
|
+
script: echo "Deploying RC to NPM..."
|
|
11
|
+
deploy:
|
|
12
|
+
provider: npm
|
|
13
|
+
email: $NPM_EMAIL
|
|
14
|
+
api_key: $NPM_API_KEY
|
|
15
|
+
tag: next
|
|
16
|
+
- stage: NPM Release
|
|
17
|
+
if: tag != *-RC*
|
|
18
|
+
node_js: "14.16"
|
|
19
|
+
script: echo "Deploying to NPM..."
|
|
11
20
|
deploy:
|
|
12
21
|
provider: npm
|
|
13
22
|
email: $NPM_EMAIL
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Appwrite Node.js 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 1.0.
|
|
9
|
+
**This SDK is compatible with Appwrite server version 1.0.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**
|
|
10
10
|
|
|
11
11
|
> This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
|
|
12
12
|
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)
|
|
@@ -48,7 +48,7 @@ Once your SDK object is set, create any of the Appwrite service objects and choo
|
|
|
48
48
|
```js
|
|
49
49
|
let users = new sdk.Users(client);
|
|
50
50
|
|
|
51
|
-
let promise = users.create(
|
|
51
|
+
let promise = users.create(ID.unique(), 'email@example.com', 'password');
|
|
52
52
|
|
|
53
53
|
promise.then(function (response) {
|
|
54
54
|
console.log(response);
|
|
@@ -71,7 +71,7 @@ client
|
|
|
71
71
|
;
|
|
72
72
|
|
|
73
73
|
let users = new sdk.Users(client);
|
|
74
|
-
let promise = users.create(
|
|
74
|
+
let promise = users.create(ID.unique(), 'email@example.com', 'password');
|
|
75
75
|
|
|
76
76
|
promise.then(function (response) {
|
|
77
77
|
console.log(response);
|
|
@@ -87,7 +87,7 @@ The Appwrite Node SDK raises `AppwriteException` object with `message`, `code` a
|
|
|
87
87
|
let users = new sdk.Users(client);
|
|
88
88
|
|
|
89
89
|
try {
|
|
90
|
-
let res = await users.create(
|
|
90
|
+
let res = await users.create(ID.unique(), 'email@example.com', 'password');
|
|
91
91
|
} catch(e) {
|
|
92
92
|
console.log(e.message);
|
|
93
93
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const account = new sdk.Account(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = account.listLogs();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const account = new sdk.Account(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = account.listSessions();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const locale = new sdk.Locale(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = locale.listContinents();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const locale = new sdk.Locale(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = locale.listCountriesEU();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const locale = new sdk.Locale(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = locale.listCountriesPhones();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const locale = new sdk.Locale(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = locale.listCountries();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const locale = new sdk.Locale(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = locale.listCurrencies();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const locale = new sdk.Locale(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = locale.listLanguages();
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const teams = new sdk.Teams(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = teams.listMemberships('[TEAM_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const users = new sdk.Users(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = users.listLogs('[USER_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const users = new sdk.Users(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = users.listMemberships('[USER_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const sdk = require('node-appwrite');
|
|
2
|
+
|
|
3
|
+
// Init SDK
|
|
4
|
+
const client = new sdk.Client();
|
|
5
|
+
|
|
6
|
+
const users = new sdk.Users(client);
|
|
7
|
+
|
|
8
|
+
client
|
|
9
|
+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
|
10
|
+
.setProject('5df5acd0d48c2') // Your project ID
|
|
11
|
+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
|
12
|
+
;
|
|
13
|
+
|
|
14
|
+
const promise = users.listSessions('[USER_ID]');
|
|
15
|
+
|
|
16
|
+
promise.then(function (response) {
|
|
17
|
+
console.log(response);
|
|
18
|
+
}, function (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
});
|
package/index.d.ts
CHANGED
|
@@ -693,7 +693,11 @@ declare module "node-appwrite" {
|
|
|
693
693
|
/**
|
|
694
694
|
* Collection ID.
|
|
695
695
|
*/
|
|
696
|
-
$
|
|
696
|
+
$collectionId: string;
|
|
697
|
+
/**
|
|
698
|
+
* Database ID.
|
|
699
|
+
*/
|
|
700
|
+
$databaseId: string;
|
|
697
701
|
/**
|
|
698
702
|
* Document creation date in ISO 8601 format.
|
|
699
703
|
*/
|
|
@@ -1229,7 +1233,7 @@ declare module "node-appwrite" {
|
|
|
1229
1233
|
/**
|
|
1230
1234
|
* Whether file-level security is enabled. [Learn more about permissions](/docs/permissions).
|
|
1231
1235
|
*/
|
|
1232
|
-
fileSecurity:
|
|
1236
|
+
fileSecurity: boolean;
|
|
1233
1237
|
/**
|
|
1234
1238
|
* Bucket name.
|
|
1235
1239
|
*/
|
|
@@ -1362,9 +1366,9 @@ declare module "node-appwrite" {
|
|
|
1362
1366
|
*/
|
|
1363
1367
|
name: string;
|
|
1364
1368
|
/**
|
|
1365
|
-
* Function
|
|
1369
|
+
* Function enabled.
|
|
1366
1370
|
*/
|
|
1367
|
-
|
|
1371
|
+
enabled: boolean;
|
|
1368
1372
|
/**
|
|
1369
1373
|
* Function execution runtime.
|
|
1370
1374
|
*/
|
|
@@ -1533,9 +1537,9 @@ declare module "node-appwrite" {
|
|
|
1533
1537
|
*/
|
|
1534
1538
|
stderr: string;
|
|
1535
1539
|
/**
|
|
1536
|
-
* The script execution
|
|
1540
|
+
* The script execution duration in seconds.
|
|
1537
1541
|
*/
|
|
1538
|
-
|
|
1542
|
+
duration: number;
|
|
1539
1543
|
}
|
|
1540
1544
|
/**
|
|
1541
1545
|
* Variable
|
|
@@ -1826,13 +1830,35 @@ declare module "node-appwrite" {
|
|
|
1826
1830
|
|
|
1827
1831
|
static limit(value: number): string;
|
|
1828
1832
|
|
|
1829
|
-
static offset
|
|
1833
|
+
static offset(value: number): string;
|
|
1830
1834
|
|
|
1831
1835
|
private static addQuery(attribute: string, method: string, value: QueryTypes): string;
|
|
1832
1836
|
|
|
1833
1837
|
private static parseValues(value: QueryTypes): string;
|
|
1834
1838
|
}
|
|
1835
1839
|
|
|
1840
|
+
export class ID {
|
|
1841
|
+
static unique(): string;
|
|
1842
|
+
static custom(id: string): string;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
export class Permission {
|
|
1846
|
+
static read(role: string): string;
|
|
1847
|
+
static write(role: string): string;
|
|
1848
|
+
static create(role: string): string;
|
|
1849
|
+
static update(role: string): string;
|
|
1850
|
+
static delete(role: string): string;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
export class Role {
|
|
1854
|
+
static any(): string;
|
|
1855
|
+
static user(id: string, status?: string): string;
|
|
1856
|
+
static users(status?: string): string;
|
|
1857
|
+
static guests(): string;
|
|
1858
|
+
static team(id: string, role?: string): string;
|
|
1859
|
+
static member(id: string): string;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1836
1862
|
export class Account extends Service {
|
|
1837
1863
|
constructor(client: Client);
|
|
1838
1864
|
|
|
@@ -1864,7 +1890,7 @@ declare module "node-appwrite" {
|
|
|
1864
1890
|
*/
|
|
1865
1891
|
updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>>;
|
|
1866
1892
|
/**
|
|
1867
|
-
*
|
|
1893
|
+
* List Account Logs
|
|
1868
1894
|
*
|
|
1869
1895
|
* Get currently logged in user list of latest security activity logs. Each
|
|
1870
1896
|
* log returns user IP address, location and date and time of log.
|
|
@@ -1873,7 +1899,7 @@ declare module "node-appwrite" {
|
|
|
1873
1899
|
* @throws {AppwriteException}
|
|
1874
1900
|
* @returns {Promise}
|
|
1875
1901
|
*/
|
|
1876
|
-
|
|
1902
|
+
listLogs(queries?: string[]): Promise<Models.LogList>;
|
|
1877
1903
|
/**
|
|
1878
1904
|
* Update Account Name
|
|
1879
1905
|
*
|
|
@@ -1973,7 +1999,7 @@ declare module "node-appwrite" {
|
|
|
1973
1999
|
*/
|
|
1974
2000
|
updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise<Models.Token>;
|
|
1975
2001
|
/**
|
|
1976
|
-
*
|
|
2002
|
+
* List Account Sessions
|
|
1977
2003
|
*
|
|
1978
2004
|
* Get currently logged in user list of active sessions across different
|
|
1979
2005
|
* devices.
|
|
@@ -1981,7 +2007,7 @@ declare module "node-appwrite" {
|
|
|
1981
2007
|
* @throws {AppwriteException}
|
|
1982
2008
|
* @returns {Promise}
|
|
1983
2009
|
*/
|
|
1984
|
-
|
|
2010
|
+
listSessions(): Promise<Models.SessionList>;
|
|
1985
2011
|
/**
|
|
1986
2012
|
* Delete All Account Sessions
|
|
1987
2013
|
*
|
|
@@ -2698,10 +2724,11 @@ declare module "node-appwrite" {
|
|
|
2698
2724
|
* @param {string[]} events
|
|
2699
2725
|
* @param {string} schedule
|
|
2700
2726
|
* @param {number} timeout
|
|
2727
|
+
* @param {boolean} enabled
|
|
2701
2728
|
* @throws {AppwriteException}
|
|
2702
2729
|
* @returns {Promise}
|
|
2703
2730
|
*/
|
|
2704
|
-
create(functionId: string, name: string, execute: string[], runtime: string, events?: string[], schedule?: string, timeout?: number): Promise<Models.Function>;
|
|
2731
|
+
create(functionId: string, name: string, execute: string[], runtime: string, events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
|
|
2705
2732
|
/**
|
|
2706
2733
|
* List runtimes
|
|
2707
2734
|
*
|
|
@@ -2732,10 +2759,11 @@ declare module "node-appwrite" {
|
|
|
2732
2759
|
* @param {string[]} events
|
|
2733
2760
|
* @param {string} schedule
|
|
2734
2761
|
* @param {number} timeout
|
|
2762
|
+
* @param {boolean} enabled
|
|
2735
2763
|
* @throws {AppwriteException}
|
|
2736
2764
|
* @returns {Promise}
|
|
2737
2765
|
*/
|
|
2738
|
-
update(functionId: string, name: string, execute: string[], events?: string[], schedule?: string, timeout?: number): Promise<Models.Function>;
|
|
2766
|
+
update(functionId: string, name: string, execute: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
|
|
2739
2767
|
/**
|
|
2740
2768
|
* Delete Function
|
|
2741
2769
|
*
|
|
@@ -2873,12 +2901,10 @@ declare module "node-appwrite" {
|
|
|
2873
2901
|
* Get a list of all variables of a specific function.
|
|
2874
2902
|
*
|
|
2875
2903
|
* @param {string} functionId
|
|
2876
|
-
* @param {string[]} queries
|
|
2877
|
-
* @param {string} search
|
|
2878
2904
|
* @throws {AppwriteException}
|
|
2879
2905
|
* @returns {Promise}
|
|
2880
2906
|
*/
|
|
2881
|
-
listVariables(functionId: string
|
|
2907
|
+
listVariables(functionId: string): Promise<Models.VariableList>;
|
|
2882
2908
|
/**
|
|
2883
2909
|
* Create Variable
|
|
2884
2910
|
*
|
|
@@ -3057,7 +3083,7 @@ declare module "node-appwrite" {
|
|
|
3057
3083
|
* @throws {AppwriteException}
|
|
3058
3084
|
* @returns {Promise}
|
|
3059
3085
|
*/
|
|
3060
|
-
|
|
3086
|
+
listContinents(): Promise<Models.ContinentList>;
|
|
3061
3087
|
/**
|
|
3062
3088
|
* List Countries
|
|
3063
3089
|
*
|
|
@@ -3067,7 +3093,7 @@ declare module "node-appwrite" {
|
|
|
3067
3093
|
* @throws {AppwriteException}
|
|
3068
3094
|
* @returns {Promise}
|
|
3069
3095
|
*/
|
|
3070
|
-
|
|
3096
|
+
listCountries(): Promise<Models.CountryList>;
|
|
3071
3097
|
/**
|
|
3072
3098
|
* List EU Countries
|
|
3073
3099
|
*
|
|
@@ -3077,7 +3103,7 @@ declare module "node-appwrite" {
|
|
|
3077
3103
|
* @throws {AppwriteException}
|
|
3078
3104
|
* @returns {Promise}
|
|
3079
3105
|
*/
|
|
3080
|
-
|
|
3106
|
+
listCountriesEU(): Promise<Models.CountryList>;
|
|
3081
3107
|
/**
|
|
3082
3108
|
* List Countries Phone Codes
|
|
3083
3109
|
*
|
|
@@ -3087,7 +3113,7 @@ declare module "node-appwrite" {
|
|
|
3087
3113
|
* @throws {AppwriteException}
|
|
3088
3114
|
* @returns {Promise}
|
|
3089
3115
|
*/
|
|
3090
|
-
|
|
3116
|
+
listCountriesPhones(): Promise<Models.PhoneList>;
|
|
3091
3117
|
/**
|
|
3092
3118
|
* List Currencies
|
|
3093
3119
|
*
|
|
@@ -3098,7 +3124,7 @@ declare module "node-appwrite" {
|
|
|
3098
3124
|
* @throws {AppwriteException}
|
|
3099
3125
|
* @returns {Promise}
|
|
3100
3126
|
*/
|
|
3101
|
-
|
|
3127
|
+
listCurrencies(): Promise<Models.CurrencyList>;
|
|
3102
3128
|
/**
|
|
3103
3129
|
* List Languages
|
|
3104
3130
|
*
|
|
@@ -3108,7 +3134,7 @@ declare module "node-appwrite" {
|
|
|
3108
3134
|
* @throws {AppwriteException}
|
|
3109
3135
|
* @returns {Promise}
|
|
3110
3136
|
*/
|
|
3111
|
-
|
|
3137
|
+
listLanguages(): Promise<Models.LanguageList>;
|
|
3112
3138
|
}
|
|
3113
3139
|
export class Storage extends Service {
|
|
3114
3140
|
constructor(client: Client);
|
|
@@ -3384,7 +3410,7 @@ declare module "node-appwrite" {
|
|
|
3384
3410
|
*/
|
|
3385
3411
|
delete(teamId: string): Promise<Response>;
|
|
3386
3412
|
/**
|
|
3387
|
-
*
|
|
3413
|
+
* List Team Memberships
|
|
3388
3414
|
*
|
|
3389
3415
|
* Use this endpoint to list a team's members using the team's ID. All team
|
|
3390
3416
|
* members have read access to this endpoint.
|
|
@@ -3395,7 +3421,7 @@ declare module "node-appwrite" {
|
|
|
3395
3421
|
* @throws {AppwriteException}
|
|
3396
3422
|
* @returns {Promise}
|
|
3397
3423
|
*/
|
|
3398
|
-
|
|
3424
|
+
listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
|
|
3399
3425
|
/**
|
|
3400
3426
|
* Create Team Membership
|
|
3401
3427
|
*
|
|
@@ -3669,7 +3695,7 @@ declare module "node-appwrite" {
|
|
|
3669
3695
|
*/
|
|
3670
3696
|
updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>>;
|
|
3671
3697
|
/**
|
|
3672
|
-
*
|
|
3698
|
+
* List User Logs
|
|
3673
3699
|
*
|
|
3674
3700
|
* Get the user activity logs list by its unique ID.
|
|
3675
3701
|
*
|
|
@@ -3678,9 +3704,9 @@ declare module "node-appwrite" {
|
|
|
3678
3704
|
* @throws {AppwriteException}
|
|
3679
3705
|
* @returns {Promise}
|
|
3680
3706
|
*/
|
|
3681
|
-
|
|
3707
|
+
listLogs(userId: string, queries?: string[]): Promise<Models.LogList>;
|
|
3682
3708
|
/**
|
|
3683
|
-
*
|
|
3709
|
+
* List User Memberships
|
|
3684
3710
|
*
|
|
3685
3711
|
* Get the user membership list by its unique ID.
|
|
3686
3712
|
*
|
|
@@ -3688,7 +3714,7 @@ declare module "node-appwrite" {
|
|
|
3688
3714
|
* @throws {AppwriteException}
|
|
3689
3715
|
* @returns {Promise}
|
|
3690
3716
|
*/
|
|
3691
|
-
|
|
3717
|
+
listMemberships(userId: string): Promise<Models.MembershipList>;
|
|
3692
3718
|
/**
|
|
3693
3719
|
* Update Name
|
|
3694
3720
|
*
|
|
@@ -3746,7 +3772,7 @@ declare module "node-appwrite" {
|
|
|
3746
3772
|
*/
|
|
3747
3773
|
updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences>;
|
|
3748
3774
|
/**
|
|
3749
|
-
*
|
|
3775
|
+
* List User Sessions
|
|
3750
3776
|
*
|
|
3751
3777
|
* Get the user sessions list by its unique ID.
|
|
3752
3778
|
*
|
|
@@ -3754,7 +3780,7 @@ declare module "node-appwrite" {
|
|
|
3754
3780
|
* @throws {AppwriteException}
|
|
3755
3781
|
* @returns {Promise}
|
|
3756
3782
|
*/
|
|
3757
|
-
|
|
3783
|
+
listSessions(userId: string): Promise<Models.SessionList>;
|
|
3758
3784
|
/**
|
|
3759
3785
|
* Delete User Sessions
|
|
3760
3786
|
*
|
package/lib/client.js
CHANGED
|
@@ -13,8 +13,8 @@ class Client {
|
|
|
13
13
|
'x-sdk-name': 'Node.js',
|
|
14
14
|
'x-sdk-platform': 'server',
|
|
15
15
|
'x-sdk-language': 'nodejs',
|
|
16
|
-
'x-sdk-version': '8.
|
|
17
|
-
'X-Appwrite-Response-Format' : '1.0.0
|
|
16
|
+
'x-sdk-version': '8.1.0',
|
|
17
|
+
'X-Appwrite-Response-Format' : '1.0.0',
|
|
18
18
|
};
|
|
19
19
|
this.selfSigned = false;
|
|
20
20
|
}
|
package/lib/role.js
CHANGED
|
@@ -2,11 +2,17 @@ class Role {
|
|
|
2
2
|
static any = () => {
|
|
3
3
|
return 'any'
|
|
4
4
|
}
|
|
5
|
-
static user = (id) => {
|
|
6
|
-
|
|
5
|
+
static user = (id, status = '') => {
|
|
6
|
+
if(status === '') {
|
|
7
|
+
return `user:${id}`
|
|
8
|
+
}
|
|
9
|
+
return `user:${id}/${status}`
|
|
7
10
|
}
|
|
8
|
-
static users = () => {
|
|
9
|
-
|
|
11
|
+
static users = (status = '') => {
|
|
12
|
+
if(status === '') {
|
|
13
|
+
return 'users'
|
|
14
|
+
}
|
|
15
|
+
return `users/${status}`
|
|
10
16
|
}
|
|
11
17
|
static guests = () => {
|
|
12
18
|
return 'guests'
|
|
@@ -17,8 +23,8 @@ class Role {
|
|
|
17
23
|
}
|
|
18
24
|
return 'team:' + id + '/' + role
|
|
19
25
|
}
|
|
20
|
-
static
|
|
21
|
-
return '
|
|
26
|
+
static member = (id) => {
|
|
27
|
+
return 'member:' + id
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
|
package/lib/services/account.js
CHANGED
|
@@ -74,7 +74,7 @@ class Account extends Service {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* List Account Logs
|
|
78
78
|
*
|
|
79
79
|
* Get currently logged in user list of latest security activity logs. Each
|
|
80
80
|
* log returns user IP address, location and date and time of log.
|
|
@@ -83,7 +83,7 @@ class Account extends Service {
|
|
|
83
83
|
* @throws {AppwriteException}
|
|
84
84
|
* @returns {Promise}
|
|
85
85
|
*/
|
|
86
|
-
async
|
|
86
|
+
async listLogs(queries) {
|
|
87
87
|
let path = '/account/logs';
|
|
88
88
|
let payload = {};
|
|
89
89
|
|
|
@@ -343,7 +343,7 @@ class Account extends Service {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
346
|
+
* List Account Sessions
|
|
347
347
|
*
|
|
348
348
|
* Get currently logged in user list of active sessions across different
|
|
349
349
|
* devices.
|
|
@@ -351,7 +351,7 @@ class Account extends Service {
|
|
|
351
351
|
* @throws {AppwriteException}
|
|
352
352
|
* @returns {Promise}
|
|
353
353
|
*/
|
|
354
|
-
async
|
|
354
|
+
async listSessions() {
|
|
355
355
|
let path = '/account/sessions';
|
|
356
356
|
let payload = {};
|
|
357
357
|
|
|
@@ -56,10 +56,11 @@ class Functions extends Service {
|
|
|
56
56
|
* @param {string[]} events
|
|
57
57
|
* @param {string} schedule
|
|
58
58
|
* @param {number} timeout
|
|
59
|
+
* @param {boolean} enabled
|
|
59
60
|
* @throws {AppwriteException}
|
|
60
61
|
* @returns {Promise}
|
|
61
62
|
*/
|
|
62
|
-
async create(functionId, name, execute, runtime, events, schedule, timeout) {
|
|
63
|
+
async create(functionId, name, execute, runtime, events, schedule, timeout, enabled) {
|
|
63
64
|
let path = '/functions';
|
|
64
65
|
let payload = {};
|
|
65
66
|
if (typeof functionId === 'undefined') {
|
|
@@ -107,6 +108,10 @@ class Functions extends Service {
|
|
|
107
108
|
payload['timeout'] = timeout;
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
if (typeof enabled !== 'undefined') {
|
|
112
|
+
payload['enabled'] = enabled;
|
|
113
|
+
}
|
|
114
|
+
|
|
110
115
|
return await this.client.call('post', path, {
|
|
111
116
|
'content-type': 'application/json',
|
|
112
117
|
}, payload);
|
|
@@ -162,10 +167,11 @@ class Functions extends Service {
|
|
|
162
167
|
* @param {string[]} events
|
|
163
168
|
* @param {string} schedule
|
|
164
169
|
* @param {number} timeout
|
|
170
|
+
* @param {boolean} enabled
|
|
165
171
|
* @throws {AppwriteException}
|
|
166
172
|
* @returns {Promise}
|
|
167
173
|
*/
|
|
168
|
-
async update(functionId, name, execute, events, schedule, timeout) {
|
|
174
|
+
async update(functionId, name, execute, events, schedule, timeout, enabled) {
|
|
169
175
|
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
170
176
|
let payload = {};
|
|
171
177
|
if (typeof functionId === 'undefined') {
|
|
@@ -201,6 +207,10 @@ class Functions extends Service {
|
|
|
201
207
|
payload['timeout'] = timeout;
|
|
202
208
|
}
|
|
203
209
|
|
|
210
|
+
if (typeof enabled !== 'undefined') {
|
|
211
|
+
payload['enabled'] = enabled;
|
|
212
|
+
}
|
|
213
|
+
|
|
204
214
|
return await this.client.call('put', path, {
|
|
205
215
|
'content-type': 'application/json',
|
|
206
216
|
}, payload);
|
|
@@ -644,12 +654,10 @@ class Functions extends Service {
|
|
|
644
654
|
* Get a list of all variables of a specific function.
|
|
645
655
|
*
|
|
646
656
|
* @param {string} functionId
|
|
647
|
-
* @param {string[]} queries
|
|
648
|
-
* @param {string} search
|
|
649
657
|
* @throws {AppwriteException}
|
|
650
658
|
* @returns {Promise}
|
|
651
659
|
*/
|
|
652
|
-
async listVariables(functionId
|
|
660
|
+
async listVariables(functionId) {
|
|
653
661
|
let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
654
662
|
let payload = {};
|
|
655
663
|
if (typeof functionId === 'undefined') {
|
|
@@ -657,14 +665,6 @@ class Functions extends Service {
|
|
|
657
665
|
}
|
|
658
666
|
|
|
659
667
|
|
|
660
|
-
if (typeof queries !== 'undefined') {
|
|
661
|
-
payload['queries'] = queries;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
if (typeof search !== 'undefined') {
|
|
665
|
-
payload['search'] = search;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
668
|
return await this.client.call('get', path, {
|
|
669
669
|
'content-type': 'application/json',
|
|
670
670
|
}, payload);
|
package/lib/services/locale.js
CHANGED
|
@@ -45,7 +45,7 @@ class Locale extends Service {
|
|
|
45
45
|
* @throws {AppwriteException}
|
|
46
46
|
* @returns {Promise}
|
|
47
47
|
*/
|
|
48
|
-
async
|
|
48
|
+
async listContinents() {
|
|
49
49
|
let path = '/locale/continents';
|
|
50
50
|
let payload = {};
|
|
51
51
|
|
|
@@ -63,7 +63,7 @@ class Locale extends Service {
|
|
|
63
63
|
* @throws {AppwriteException}
|
|
64
64
|
* @returns {Promise}
|
|
65
65
|
*/
|
|
66
|
-
async
|
|
66
|
+
async listCountries() {
|
|
67
67
|
let path = '/locale/countries';
|
|
68
68
|
let payload = {};
|
|
69
69
|
|
|
@@ -81,7 +81,7 @@ class Locale extends Service {
|
|
|
81
81
|
* @throws {AppwriteException}
|
|
82
82
|
* @returns {Promise}
|
|
83
83
|
*/
|
|
84
|
-
async
|
|
84
|
+
async listCountriesEU() {
|
|
85
85
|
let path = '/locale/countries/eu';
|
|
86
86
|
let payload = {};
|
|
87
87
|
|
|
@@ -99,7 +99,7 @@ class Locale extends Service {
|
|
|
99
99
|
* @throws {AppwriteException}
|
|
100
100
|
* @returns {Promise}
|
|
101
101
|
*/
|
|
102
|
-
async
|
|
102
|
+
async listCountriesPhones() {
|
|
103
103
|
let path = '/locale/countries/phones';
|
|
104
104
|
let payload = {};
|
|
105
105
|
|
|
@@ -118,7 +118,7 @@ class Locale extends Service {
|
|
|
118
118
|
* @throws {AppwriteException}
|
|
119
119
|
* @returns {Promise}
|
|
120
120
|
*/
|
|
121
|
-
async
|
|
121
|
+
async listCurrencies() {
|
|
122
122
|
let path = '/locale/currencies';
|
|
123
123
|
let payload = {};
|
|
124
124
|
|
|
@@ -136,7 +136,7 @@ class Locale extends Service {
|
|
|
136
136
|
* @throws {AppwriteException}
|
|
137
137
|
* @returns {Promise}
|
|
138
138
|
*/
|
|
139
|
-
async
|
|
139
|
+
async listLanguages() {
|
|
140
140
|
let path = '/locale/languages';
|
|
141
141
|
let payload = {};
|
|
142
142
|
|
package/lib/services/teams.js
CHANGED
|
@@ -165,7 +165,7 @@ class Teams extends Service {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* List Team Memberships
|
|
169
169
|
*
|
|
170
170
|
* Use this endpoint to list a team's members using the team's ID. All team
|
|
171
171
|
* members have read access to this endpoint.
|
|
@@ -176,7 +176,7 @@ class Teams extends Service {
|
|
|
176
176
|
* @throws {AppwriteException}
|
|
177
177
|
* @returns {Promise}
|
|
178
178
|
*/
|
|
179
|
-
async
|
|
179
|
+
async listMemberships(teamId, queries, search) {
|
|
180
180
|
let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
|
|
181
181
|
let payload = {};
|
|
182
182
|
if (typeof teamId === 'undefined') {
|
package/lib/services/users.js
CHANGED
|
@@ -609,7 +609,7 @@ class Users extends Service {
|
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
/**
|
|
612
|
-
*
|
|
612
|
+
* List User Logs
|
|
613
613
|
*
|
|
614
614
|
* Get the user activity logs list by its unique ID.
|
|
615
615
|
*
|
|
@@ -618,7 +618,7 @@ class Users extends Service {
|
|
|
618
618
|
* @throws {AppwriteException}
|
|
619
619
|
* @returns {Promise}
|
|
620
620
|
*/
|
|
621
|
-
async
|
|
621
|
+
async listLogs(userId, queries) {
|
|
622
622
|
let path = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
623
623
|
let payload = {};
|
|
624
624
|
if (typeof userId === 'undefined') {
|
|
@@ -636,7 +636,7 @@ class Users extends Service {
|
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
/**
|
|
639
|
-
*
|
|
639
|
+
* List User Memberships
|
|
640
640
|
*
|
|
641
641
|
* Get the user membership list by its unique ID.
|
|
642
642
|
*
|
|
@@ -644,7 +644,7 @@ class Users extends Service {
|
|
|
644
644
|
* @throws {AppwriteException}
|
|
645
645
|
* @returns {Promise}
|
|
646
646
|
*/
|
|
647
|
-
async
|
|
647
|
+
async listMemberships(userId) {
|
|
648
648
|
let path = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
649
649
|
let payload = {};
|
|
650
650
|
if (typeof userId === 'undefined') {
|
|
@@ -806,7 +806,7 @@ class Users extends Service {
|
|
|
806
806
|
}
|
|
807
807
|
|
|
808
808
|
/**
|
|
809
|
-
*
|
|
809
|
+
* List User Sessions
|
|
810
810
|
*
|
|
811
811
|
* Get the user sessions list by its unique ID.
|
|
812
812
|
*
|
|
@@ -814,7 +814,7 @@ class Users extends Service {
|
|
|
814
814
|
* @throws {AppwriteException}
|
|
815
815
|
* @returns {Promise}
|
|
816
816
|
*/
|
|
817
|
-
async
|
|
817
|
+
async listSessions(userId) {
|
|
818
818
|
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
819
819
|
let payload = {};
|
|
820
820
|
if (typeof userId === 'undefined') {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "node-appwrite",
|
|
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": "8.
|
|
5
|
+
"version": "8.1.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|