node-appwrite 4.0.0 → 5.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.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/docs/examples/account/update-session.md +20 -0
  3. package/docs/examples/functions/{create-tag.md → create-deployment.md} +1 -1
  4. package/docs/examples/functions/{delete-tag.md → delete-deployment.md} +1 -1
  5. package/docs/examples/functions/{update-tag.md → get-deployment.md} +1 -1
  6. package/docs/examples/functions/{list-tags.md → list-deployments.md} +1 -1
  7. package/docs/examples/functions/retry-build.md +20 -0
  8. package/docs/examples/functions/{get-tag.md → update-deployment.md} +1 -1
  9. package/docs/examples/storage/create-bucket.md +20 -0
  10. package/docs/examples/storage/create-file.md +1 -1
  11. package/docs/examples/storage/delete-bucket.md +20 -0
  12. package/docs/examples/storage/delete-file.md +1 -1
  13. package/docs/examples/storage/get-bucket.md +20 -0
  14. package/docs/examples/storage/get-file-download.md +1 -1
  15. package/docs/examples/storage/get-file-preview.md +1 -1
  16. package/docs/examples/storage/get-file-view.md +1 -1
  17. package/docs/examples/storage/get-file.md +1 -1
  18. package/docs/examples/storage/list-buckets.md +20 -0
  19. package/docs/examples/storage/list-files.md +1 -1
  20. package/docs/examples/storage/update-bucket.md +20 -0
  21. package/docs/examples/storage/update-file.md +1 -1
  22. package/index.d.ts +411 -151
  23. package/index.js +3 -1
  24. package/lib/client.js +7 -5
  25. package/lib/exception.js +2 -1
  26. package/lib/query.js +2 -0
  27. package/lib/services/account.js +28 -3
  28. package/lib/services/avatars.js +3 -0
  29. package/lib/services/database.js +6 -3
  30. package/lib/services/functions.js +207 -116
  31. package/lib/services/health.js +3 -0
  32. package/lib/services/locale.js +3 -0
  33. package/lib/services/storage.js +379 -33
  34. package/lib/services/teams.js +7 -0
  35. package/lib/services/users.js +6 -2
  36. package/package.json +2 -2
@@ -1,8 +1,258 @@
1
1
  const Service = require('../service.js');
2
2
  const AppwriteException = require('../exception.js');
3
+ const client = require('../client.js');
4
+ const { promisify } = require('util');
5
+ const fs = require('fs');
3
6
 
4
7
  class Storage extends Service {
5
8
 
9
+ /**
10
+ * List buckets
11
+ *
12
+ * Get a list of all the storage buckets. You can use the query params to
13
+ * filter your results.
14
+ *
15
+ * @param {string} search
16
+ * @param {number} limit
17
+ * @param {number} offset
18
+ * @param {string} cursor
19
+ * @param {string} cursorDirection
20
+ * @param {string} orderType
21
+ * @throws {AppwriteException}
22
+ * @returns {Promise}
23
+ */
24
+ async listBuckets(search, limit, offset, cursor, cursorDirection, orderType) {
25
+ let path = '/storage/buckets';
26
+ let payload = {};
27
+
28
+ if (typeof search !== 'undefined') {
29
+ payload['search'] = search;
30
+ }
31
+
32
+ if (typeof limit !== 'undefined') {
33
+ payload['limit'] = limit;
34
+ }
35
+
36
+ if (typeof offset !== 'undefined') {
37
+ payload['offset'] = offset;
38
+ }
39
+
40
+ if (typeof cursor !== 'undefined') {
41
+ payload['cursor'] = cursor;
42
+ }
43
+
44
+ if (typeof cursorDirection !== 'undefined') {
45
+ payload['cursorDirection'] = cursorDirection;
46
+ }
47
+
48
+ if (typeof orderType !== 'undefined') {
49
+ payload['orderType'] = orderType;
50
+ }
51
+
52
+ return await this.client.call('get', path, {
53
+ 'content-type': 'application/json',
54
+ }, payload);
55
+ }
56
+
57
+ /**
58
+ * Create bucket
59
+ *
60
+ * Create a new storage bucket.
61
+ *
62
+ * @param {string} bucketId
63
+ * @param {string} name
64
+ * @param {string} permission
65
+ * @param {string[]} read
66
+ * @param {string[]} write
67
+ * @param {boolean} enabled
68
+ * @param {number} maximumFileSize
69
+ * @param {string[]} allowedFileExtensions
70
+ * @param {boolean} encryption
71
+ * @param {boolean} antivirus
72
+ * @throws {AppwriteException}
73
+ * @returns {Promise}
74
+ */
75
+ async createBucket(bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus) {
76
+ if (typeof bucketId === 'undefined') {
77
+ throw new AppwriteException('Missing required parameter: "bucketId"');
78
+ }
79
+
80
+ if (typeof name === 'undefined') {
81
+ throw new AppwriteException('Missing required parameter: "name"');
82
+ }
83
+
84
+ if (typeof permission === 'undefined') {
85
+ throw new AppwriteException('Missing required parameter: "permission"');
86
+ }
87
+
88
+ let path = '/storage/buckets';
89
+ let payload = {};
90
+
91
+ if (typeof bucketId !== 'undefined') {
92
+ payload['bucketId'] = bucketId;
93
+ }
94
+
95
+ if (typeof name !== 'undefined') {
96
+ payload['name'] = name;
97
+ }
98
+
99
+ if (typeof permission !== 'undefined') {
100
+ payload['permission'] = permission;
101
+ }
102
+
103
+ if (typeof read !== 'undefined') {
104
+ payload['read'] = read;
105
+ }
106
+
107
+ if (typeof write !== 'undefined') {
108
+ payload['write'] = write;
109
+ }
110
+
111
+ if (typeof enabled !== 'undefined') {
112
+ payload['enabled'] = enabled;
113
+ }
114
+
115
+ if (typeof maximumFileSize !== 'undefined') {
116
+ payload['maximumFileSize'] = maximumFileSize;
117
+ }
118
+
119
+ if (typeof allowedFileExtensions !== 'undefined') {
120
+ payload['allowedFileExtensions'] = allowedFileExtensions;
121
+ }
122
+
123
+ if (typeof encryption !== 'undefined') {
124
+ payload['encryption'] = encryption;
125
+ }
126
+
127
+ if (typeof antivirus !== 'undefined') {
128
+ payload['antivirus'] = antivirus;
129
+ }
130
+
131
+ return await this.client.call('post', path, {
132
+ 'content-type': 'application/json',
133
+ }, payload);
134
+ }
135
+
136
+ /**
137
+ * Get Bucket
138
+ *
139
+ * Get a storage bucket by its unique ID. This endpoint response returns a
140
+ * JSON object with the storage bucket metadata.
141
+ *
142
+ * @param {string} bucketId
143
+ * @throws {AppwriteException}
144
+ * @returns {Promise}
145
+ */
146
+ async getBucket(bucketId) {
147
+ if (typeof bucketId === 'undefined') {
148
+ throw new AppwriteException('Missing required parameter: "bucketId"');
149
+ }
150
+
151
+ let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
152
+ let payload = {};
153
+
154
+ return await this.client.call('get', path, {
155
+ 'content-type': 'application/json',
156
+ }, payload);
157
+ }
158
+
159
+ /**
160
+ * Update Bucket
161
+ *
162
+ * Update a storage bucket by its unique ID.
163
+ *
164
+ * @param {string} bucketId
165
+ * @param {string} name
166
+ * @param {string} permission
167
+ * @param {string[]} read
168
+ * @param {string[]} write
169
+ * @param {boolean} enabled
170
+ * @param {number} maximumFileSize
171
+ * @param {string[]} allowedFileExtensions
172
+ * @param {boolean} encryption
173
+ * @param {boolean} antivirus
174
+ * @throws {AppwriteException}
175
+ * @returns {Promise}
176
+ */
177
+ async updateBucket(bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus) {
178
+ if (typeof bucketId === 'undefined') {
179
+ throw new AppwriteException('Missing required parameter: "bucketId"');
180
+ }
181
+
182
+ if (typeof name === 'undefined') {
183
+ throw new AppwriteException('Missing required parameter: "name"');
184
+ }
185
+
186
+ if (typeof permission === 'undefined') {
187
+ throw new AppwriteException('Missing required parameter: "permission"');
188
+ }
189
+
190
+ let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
191
+ let payload = {};
192
+
193
+ if (typeof name !== 'undefined') {
194
+ payload['name'] = name;
195
+ }
196
+
197
+ if (typeof permission !== 'undefined') {
198
+ payload['permission'] = permission;
199
+ }
200
+
201
+ if (typeof read !== 'undefined') {
202
+ payload['read'] = read;
203
+ }
204
+
205
+ if (typeof write !== 'undefined') {
206
+ payload['write'] = write;
207
+ }
208
+
209
+ if (typeof enabled !== 'undefined') {
210
+ payload['enabled'] = enabled;
211
+ }
212
+
213
+ if (typeof maximumFileSize !== 'undefined') {
214
+ payload['maximumFileSize'] = maximumFileSize;
215
+ }
216
+
217
+ if (typeof allowedFileExtensions !== 'undefined') {
218
+ payload['allowedFileExtensions'] = allowedFileExtensions;
219
+ }
220
+
221
+ if (typeof encryption !== 'undefined') {
222
+ payload['encryption'] = encryption;
223
+ }
224
+
225
+ if (typeof antivirus !== 'undefined') {
226
+ payload['antivirus'] = antivirus;
227
+ }
228
+
229
+ return await this.client.call('put', path, {
230
+ 'content-type': 'application/json',
231
+ }, payload);
232
+ }
233
+
234
+ /**
235
+ * Delete Bucket
236
+ *
237
+ * Delete a storage bucket by its unique ID.
238
+ *
239
+ * @param {string} bucketId
240
+ * @throws {AppwriteException}
241
+ * @returns {Promise}
242
+ */
243
+ async deleteBucket(bucketId) {
244
+ if (typeof bucketId === 'undefined') {
245
+ throw new AppwriteException('Missing required parameter: "bucketId"');
246
+ }
247
+
248
+ let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
249
+ let payload = {};
250
+
251
+ return await this.client.call('delete', path, {
252
+ 'content-type': 'application/json',
253
+ }, payload);
254
+ }
255
+
6
256
  /**
7
257
  * List Files
8
258
  *
@@ -10,6 +260,7 @@ class Storage extends Service {
10
260
  * your results. On admin mode, this endpoint will return a list of all of the
11
261
  * project's files. [Learn more about different API modes](/docs/admin).
12
262
  *
263
+ * @param {string} bucketId
13
264
  * @param {string} search
14
265
  * @param {number} limit
15
266
  * @param {number} offset
@@ -19,8 +270,12 @@ class Storage extends Service {
19
270
  * @throws {AppwriteException}
20
271
  * @returns {Promise}
21
272
  */
22
- async listFiles(search, limit, offset, cursor, cursorDirection, orderType) {
23
- let path = '/storage/files';
273
+ async listFiles(bucketId, search, limit, offset, cursor, cursorDirection, orderType) {
274
+ if (typeof bucketId === 'undefined') {
275
+ throw new AppwriteException('Missing required parameter: "bucketId"');
276
+ }
277
+
278
+ let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
24
279
  let payload = {};
25
280
 
26
281
  if (typeof search !== 'undefined') {
@@ -55,18 +310,38 @@ class Storage extends Service {
55
310
  /**
56
311
  * Create File
57
312
  *
58
- * Create a new file. The user who creates the file will automatically be
59
- * assigned to read and write access unless he has passed custom values for
60
- * read and write arguments.
313
+ * Create a new file. Before using this route, you should create a new bucket
314
+ * resource using either a [server
315
+ * integration](/docs/server/database#storageCreateBucket) API or directly
316
+ * from your Appwrite console.
317
+ *
318
+ * Larger files should be uploaded using multiple requests with the
319
+ * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
320
+ * header to send a partial request with a maximum supported chunk of `5MB`.
321
+ * The `content-range` header values should always be in bytes.
322
+ *
323
+ * When the first request is sent, the server will return the **File** object,
324
+ * and the subsequent part request must include the file's **id** in
325
+ * `x-appwrite-id` header to allow the server to know that the partial upload
326
+ * is for the existing file and not for a new one.
327
+ *
328
+ * If you're creating a new file using one of the Appwrite SDKs, all the
329
+ * chunking logic will be managed by the SDK internally.
330
+ *
61
331
  *
332
+ * @param {string} bucketId
62
333
  * @param {string} fileId
63
- * @param {File} file
334
+ * @param {string} file
64
335
  * @param {string[]} read
65
336
  * @param {string[]} write
66
337
  * @throws {AppwriteException}
67
338
  * @returns {Promise}
68
339
  */
69
- async createFile(fileId, file, read, write) {
340
+ async createFile(bucketId, fileId, file, read, write, onProgress = () => {}) {
341
+ if (typeof bucketId === 'undefined') {
342
+ throw new AppwriteException('Missing required parameter: "bucketId"');
343
+ }
344
+
70
345
  if (typeof fileId === 'undefined') {
71
346
  throw new AppwriteException('Missing required parameter: "fileId"');
72
347
  }
@@ -75,7 +350,7 @@ class Storage extends Service {
75
350
  throw new AppwriteException('Missing required parameter: "file"');
76
351
  }
77
352
 
78
- let path = '/storage/files';
353
+ let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
79
354
  let payload = {};
80
355
 
81
356
  if (typeof fileId !== 'undefined') {
@@ -83,7 +358,7 @@ class Storage extends Service {
83
358
  }
84
359
 
85
360
  if (typeof file !== 'undefined') {
86
- payload['file'] = file;
361
+ payload['file'] = file.toString();
87
362
  }
88
363
 
89
364
  if (typeof read !== 'undefined') {
@@ -94,9 +369,57 @@ class Storage extends Service {
94
369
  payload['write'] = write;
95
370
  }
96
371
 
97
- return await this.client.call('post', path, {
98
- 'content-type': 'multipart/form-data',
99
- }, payload);
372
+ const { size: size } = await promisify(fs.stat)(file);
373
+
374
+ if (size <= client.CHUNK_SIZE) {
375
+ payload['file'] = fs.createReadStream(file);
376
+
377
+ return await this.client.call('post', path, {
378
+ 'content-type': 'multipart/form-data',
379
+ }, payload);
380
+ } else {
381
+ let id = undefined;
382
+ let response = undefined;
383
+
384
+ const totalCounters = Math.ceil(size / client.CHUNK_SIZE);
385
+
386
+ for (let counter = 0; counter < totalCounters; counter++) {
387
+ const start = (counter * client.CHUNK_SIZE);
388
+ const end = Math.min((((counter * client.CHUNK_SIZE) + client.CHUNK_SIZE) - 1), size);
389
+ const headers = {
390
+ 'content-type': 'multipart/form-data',
391
+ 'content-range': 'bytes ' + start + '-' + end + '/' + size
392
+ };
393
+
394
+ if (id) {
395
+ headers['x-appwrite-id'] = id;
396
+ }
397
+
398
+ const stream = fs.createReadStream(file, {
399
+ start,
400
+ end
401
+ });
402
+ payload['file'] = stream;
403
+
404
+ response = await this.client.call('post', path, headers, payload);
405
+
406
+ if (!id) {
407
+ id = response['$id'];
408
+ }
409
+
410
+ if (onProgress !== null) {
411
+ onProgress({
412
+ $id: response['$id'],
413
+ progress: Math.min((counter+1) * client.CHUNK_SIZE, size) / size * 100,
414
+ sizeUploaded: end+1,
415
+ chunksTotal: response['chunksTotal'],
416
+ chunksUploaded: response['chunksUploaded']
417
+ });
418
+ }
419
+ }
420
+
421
+ return response;
422
+ }
100
423
  }
101
424
 
102
425
  /**
@@ -105,16 +428,21 @@ class Storage extends Service {
105
428
  * Get a file by its unique ID. This endpoint response returns a JSON object
106
429
  * with the file metadata.
107
430
  *
431
+ * @param {string} bucketId
108
432
  * @param {string} fileId
109
433
  * @throws {AppwriteException}
110
434
  * @returns {Promise}
111
435
  */
112
- async getFile(fileId) {
436
+ async getFile(bucketId, fileId) {
437
+ if (typeof bucketId === 'undefined') {
438
+ throw new AppwriteException('Missing required parameter: "bucketId"');
439
+ }
440
+
113
441
  if (typeof fileId === 'undefined') {
114
442
  throw new AppwriteException('Missing required parameter: "fileId"');
115
443
  }
116
444
 
117
- let path = '/storage/files/{fileId}'.replace('{fileId}', fileId);
445
+ let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
118
446
  let payload = {};
119
447
 
120
448
  return await this.client.call('get', path, {
@@ -128,26 +456,23 @@ class Storage extends Service {
128
456
  * Update a file by its unique ID. Only users with write permissions have
129
457
  * access to update this resource.
130
458
  *
459
+ * @param {string} bucketId
131
460
  * @param {string} fileId
132
461
  * @param {string[]} read
133
462
  * @param {string[]} write
134
463
  * @throws {AppwriteException}
135
464
  * @returns {Promise}
136
465
  */
137
- async updateFile(fileId, read, write) {
138
- if (typeof fileId === 'undefined') {
139
- throw new AppwriteException('Missing required parameter: "fileId"');
466
+ async updateFile(bucketId, fileId, read, write) {
467
+ if (typeof bucketId === 'undefined') {
468
+ throw new AppwriteException('Missing required parameter: "bucketId"');
140
469
  }
141
470
 
142
- if (typeof read === 'undefined') {
143
- throw new AppwriteException('Missing required parameter: "read"');
144
- }
145
-
146
- if (typeof write === 'undefined') {
147
- throw new AppwriteException('Missing required parameter: "write"');
471
+ if (typeof fileId === 'undefined') {
472
+ throw new AppwriteException('Missing required parameter: "fileId"');
148
473
  }
149
474
 
150
- let path = '/storage/files/{fileId}'.replace('{fileId}', fileId);
475
+ let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
151
476
  let payload = {};
152
477
 
153
478
  if (typeof read !== 'undefined') {
@@ -169,16 +494,21 @@ class Storage extends Service {
169
494
  * Delete a file by its unique ID. Only users with write permissions have
170
495
  * access to delete this resource.
171
496
  *
497
+ * @param {string} bucketId
172
498
  * @param {string} fileId
173
499
  * @throws {AppwriteException}
174
500
  * @returns {Promise}
175
501
  */
176
- async deleteFile(fileId) {
502
+ async deleteFile(bucketId, fileId) {
503
+ if (typeof bucketId === 'undefined') {
504
+ throw new AppwriteException('Missing required parameter: "bucketId"');
505
+ }
506
+
177
507
  if (typeof fileId === 'undefined') {
178
508
  throw new AppwriteException('Missing required parameter: "fileId"');
179
509
  }
180
510
 
181
- let path = '/storage/files/{fileId}'.replace('{fileId}', fileId);
511
+ let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
182
512
  let payload = {};
183
513
 
184
514
  return await this.client.call('delete', path, {
@@ -193,16 +523,21 @@ class Storage extends Service {
193
523
  * 'Content-Disposition: attachment' header that tells the browser to start
194
524
  * downloading the file to user downloads directory.
195
525
  *
526
+ * @param {string} bucketId
196
527
  * @param {string} fileId
197
528
  * @throws {AppwriteException}
198
529
  * @returns {Promise}
199
530
  */
200
- async getFileDownload(fileId) {
531
+ async getFileDownload(bucketId, fileId) {
532
+ if (typeof bucketId === 'undefined') {
533
+ throw new AppwriteException('Missing required parameter: "bucketId"');
534
+ }
535
+
201
536
  if (typeof fileId === 'undefined') {
202
537
  throw new AppwriteException('Missing required parameter: "fileId"');
203
538
  }
204
539
 
205
- let path = '/storage/files/{fileId}/download'.replace('{fileId}', fileId);
540
+ let path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
206
541
  let payload = {};
207
542
 
208
543
  return await this.client.call('get', path, {
@@ -216,8 +551,10 @@ class Storage extends Service {
216
551
  * Get a file preview image. Currently, this method supports preview for image
217
552
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
218
553
  * and spreadsheets, will return the file icon image. You can also pass query
219
- * string arguments for cutting and resizing your preview image.
554
+ * string arguments for cutting and resizing your preview image. Preview is
555
+ * supported only for image files smaller than 10MB.
220
556
  *
557
+ * @param {string} bucketId
221
558
  * @param {string} fileId
222
559
  * @param {number} width
223
560
  * @param {number} height
@@ -233,12 +570,16 @@ class Storage extends Service {
233
570
  * @throws {AppwriteException}
234
571
  * @returns {Promise}
235
572
  */
236
- async getFilePreview(fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
573
+ async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
574
+ if (typeof bucketId === 'undefined') {
575
+ throw new AppwriteException('Missing required parameter: "bucketId"');
576
+ }
577
+
237
578
  if (typeof fileId === 'undefined') {
238
579
  throw new AppwriteException('Missing required parameter: "fileId"');
239
580
  }
240
581
 
241
- let path = '/storage/files/{fileId}/preview'.replace('{fileId}', fileId);
582
+ let path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
242
583
  let payload = {};
243
584
 
244
585
  if (typeof width !== 'undefined') {
@@ -297,16 +638,21 @@ class Storage extends Service {
297
638
  * download method but returns with no 'Content-Disposition: attachment'
298
639
  * header.
299
640
  *
641
+ * @param {string} bucketId
300
642
  * @param {string} fileId
301
643
  * @throws {AppwriteException}
302
644
  * @returns {Promise}
303
645
  */
304
- async getFileView(fileId) {
646
+ async getFileView(bucketId, fileId) {
647
+ if (typeof bucketId === 'undefined') {
648
+ throw new AppwriteException('Missing required parameter: "bucketId"');
649
+ }
650
+
305
651
  if (typeof fileId === 'undefined') {
306
652
  throw new AppwriteException('Missing required parameter: "fileId"');
307
653
  }
308
654
 
309
- let path = '/storage/files/{fileId}/view'.replace('{fileId}', fileId);
655
+ let path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
310
656
  let payload = {};
311
657
 
312
658
  return await this.client.call('get', path, {
@@ -1,5 +1,8 @@
1
1
  const Service = require('../service.js');
2
2
  const AppwriteException = require('../exception.js');
3
+ const client = require('../client.js');
4
+ const { promisify } = require('util');
5
+ const fs = require('fs');
3
6
 
4
7
  class Teams extends Service {
5
8
 
@@ -395,6 +398,10 @@ class Teams extends Service {
395
398
  * Use this endpoint to allow a user to accept an invitation to join a team
396
399
  * after being redirected back to your app from the invitation email received
397
400
  * by the user.
401
+ *
402
+ * If the request is successful, a session for the user is automatically
403
+ * created.
404
+ *
398
405
  *
399
406
  * @param {string} teamId
400
407
  * @param {string} membershipId
@@ -1,5 +1,8 @@
1
1
  const Service = require('../service.js');
2
2
  const AppwriteException = require('../exception.js');
3
+ const client = require('../client.js');
4
+ const { promisify } = require('util');
5
+ const fs = require('fs');
3
6
 
4
7
  class Users extends Service {
5
8
 
@@ -294,8 +297,9 @@ class Users extends Service {
294
297
  /**
295
298
  * Update User Preferences
296
299
  *
297
- * Update the user preferences by its unique ID. You can pass only the
298
- * specific settings you wish to update.
300
+ * Update the user preferences by its unique ID. The object you pass is stored
301
+ * as is, and replaces any previous value. The maximum allowed prefs size is
302
+ * 64kB and throws error if exceeded.
299
303
  *
300
304
  * @param {string} userId
301
305
  * @param {object} prefs
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": "4.0.0",
5
+ "version": "5.0.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "devDependencies": {},
14
14
  "dependencies": {
15
- "axios": "^0.24.0",
15
+ "axios": "^0.25.0",
16
16
  "form-data": "^4.0.0"
17
17
  }
18
18
  }