node-appwrite 8.2.0 → 9.0.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/LICENSE +1 -1
- package/README.md +2 -2
- package/docs/examples/account/update-password.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +20 -0
- package/docs/examples/databases/update-boolean-attribute.md +20 -0
- package/docs/examples/databases/update-datetime-attribute.md +20 -0
- package/docs/examples/databases/update-email-attribute.md +20 -0
- package/docs/examples/databases/update-enum-attribute.md +20 -0
- package/docs/examples/databases/update-float-attribute.md +20 -0
- package/docs/examples/databases/update-integer-attribute.md +20 -0
- package/docs/examples/databases/update-ip-attribute.md +20 -0
- package/docs/examples/databases/update-relationship-attribute.md +20 -0
- package/docs/examples/databases/update-string-attribute.md +20 -0
- package/docs/examples/databases/update-url-attribute.md +20 -0
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/teams/create-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +20 -0
- package/docs/examples/teams/{update.md → update-name.md} +1 -1
- package/docs/examples/teams/update-prefs.md +20 -0
- package/docs/examples/users/update-password.md +1 -1
- package/index.d.ts +334 -112
- package/lib/client.js +2 -1
- package/lib/inputFile.js +6 -8
- package/lib/query.js +18 -0
- package/lib/services/databases.js +720 -104
- package/lib/services/functions.js +45 -45
- package/lib/services/storage.js +43 -35
- package/lib/services/teams.js +87 -19
- package/package.json +6 -4
package/lib/client.js
CHANGED
|
@@ -9,11 +9,12 @@ class Client {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
this.endpoint = 'https://HOSTNAME/v1';
|
|
11
11
|
this.headers = {
|
|
12
|
+
'accept-encoding': '*',
|
|
12
13
|
'content-type': '',
|
|
13
14
|
'x-sdk-name': 'Node.js',
|
|
14
15
|
'x-sdk-platform': 'server',
|
|
15
16
|
'x-sdk-language': 'nodejs',
|
|
16
|
-
'x-sdk-version': '
|
|
17
|
+
'x-sdk-version': '9.0.0',
|
|
17
18
|
'X-Appwrite-Response-Format' : '1.0.0',
|
|
18
19
|
};
|
|
19
20
|
this.selfSigned = false;
|
package/lib/inputFile.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { Readable } = require('stream');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
const { promisify } = require('util');
|
|
4
3
|
|
|
5
4
|
class InputFile {
|
|
6
5
|
stream; // Content of file, readable stream
|
|
@@ -14,16 +13,15 @@ class InputFile {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
static fromBuffer = (buffer, filename) => {
|
|
17
|
-
const stream = Readable.from(buffer
|
|
16
|
+
const stream = Readable.from(buffer);
|
|
18
17
|
const size = Buffer.byteLength(buffer);
|
|
19
18
|
return new InputFile(stream, filename, size);
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
static fromBlob = (blob, filename) => {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
return new InputFile(stream, filename);
|
|
21
|
+
static fromBlob = async (blob, filename) => {
|
|
22
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
23
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
24
|
+
return InputFile.fromBuffer(buffer, filename);
|
|
27
25
|
};
|
|
28
26
|
|
|
29
27
|
static fromStream = (stream, filename, size) => {
|
|
@@ -32,7 +30,7 @@ class InputFile {
|
|
|
32
30
|
|
|
33
31
|
static fromPlainText = (content, filename) => {
|
|
34
32
|
const buffer = Buffer.from(content, "utf-8");
|
|
35
|
-
const stream = Readable.from(buffer
|
|
33
|
+
const stream = Readable.from(buffer);
|
|
36
34
|
const size = Buffer.byteLength(buffer);
|
|
37
35
|
return new InputFile(stream, filename, size);
|
|
38
36
|
};
|
package/lib/query.js
CHANGED
|
@@ -17,6 +17,24 @@ class Query {
|
|
|
17
17
|
static greaterThanEqual = (attribute, value) =>
|
|
18
18
|
Query.addQuery(attribute, "greaterThanEqual", value);
|
|
19
19
|
|
|
20
|
+
static isNull = (attribute) =>
|
|
21
|
+
`isNull("${attribute}")`;
|
|
22
|
+
|
|
23
|
+
static isNotNull = (attribute) =>
|
|
24
|
+
`isNotNull("${attribute}")`;
|
|
25
|
+
|
|
26
|
+
static between = (attribute, start, end) =>
|
|
27
|
+
Query.addQuery(attribute, "between", [start, end]);
|
|
28
|
+
|
|
29
|
+
static startsWith = (attribute, value) =>
|
|
30
|
+
Query.addQuery(attribute, "startsWith", value);
|
|
31
|
+
|
|
32
|
+
static endsWith = (attribute, value) =>
|
|
33
|
+
Query.addQuery(attribute, "endsWith", value);
|
|
34
|
+
|
|
35
|
+
static select = (attributes) =>
|
|
36
|
+
`select([${attributes.map((attr) => `"${attr}"`).join(",")}])`;
|
|
37
|
+
|
|
20
38
|
static search = (attribute, value) =>
|
|
21
39
|
Query.addQuery(attribute, "search", value);
|
|
22
40
|
|