@appwrite.io/console 2.1.0 → 2.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/CHANGELOG.md +4 -0
- package/README.md +2 -2
- package/dist/cjs/sdk.js +55 -16
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +51 -16
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +3812 -16
- package/docs/examples/projects/update-labels.md +14 -0
- package/package.json +7 -1
- package/rollup.config.js +40 -24
- package/src/client.ts +20 -10
- package/src/models.ts +432 -424
- package/src/query.ts +14 -11
- package/src/services/account.ts +20 -20
- package/src/services/avatars.ts +117 -117
- package/src/services/backups.ts +18 -18
- package/src/services/console.ts +24 -24
- package/src/services/databases.ts +119 -119
- package/src/services/domains.ts +204 -204
- package/src/services/functions.ts +30 -30
- package/src/services/health.ts +146 -146
- package/src/services/messaging.ts +54 -54
- package/src/services/migrations.ts +36 -36
- package/src/services/organizations.ts +42 -42
- package/src/services/projects.ts +146 -83
- package/src/services/sites.ts +30 -30
- package/src/services/storage.ts +49 -49
- package/src/services/tables-db.ts +119 -119
- package/src/services/users.ts +39 -39
- package/types/client.d.ts +8 -1
- package/types/models.d.ts +432 -424
- package/types/query.d.ts +8 -8
- package/types/services/account.d.ts +11 -11
- package/types/services/avatars.d.ts +82 -82
- package/types/services/backups.d.ts +8 -8
- package/types/services/console.d.ts +14 -14
- package/types/services/databases.d.ts +70 -70
- package/types/services/domains.d.ts +104 -104
- package/types/services/functions.d.ts +15 -15
- package/types/services/health.d.ts +72 -72
- package/types/services/messaging.d.ts +24 -24
- package/types/services/migrations.d.ts +16 -16
- package/types/services/organizations.d.ts +22 -22
- package/types/services/projects.d.ts +60 -38
- package/types/services/sites.d.ts +15 -15
- package/types/services/storage.d.ts +34 -34
- package/types/services/tables-db.d.ts +70 -70
- package/types/services/users.d.ts +24 -24
package/dist/esm/sdk.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import JSONbigModule from 'json-bigint';
|
|
2
|
+
|
|
1
3
|
/******************************************************************************
|
|
2
4
|
Copyright (c) Microsoft Corporation.
|
|
3
5
|
|
|
@@ -29,6 +31,7 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
|
29
31
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
const JSONbig$1 = JSONbigModule({ useNativeBigInt: true });
|
|
32
35
|
/**
|
|
33
36
|
* Helper class to generate query strings.
|
|
34
37
|
*/
|
|
@@ -58,7 +61,7 @@ class Query {
|
|
|
58
61
|
* @returns {string}
|
|
59
62
|
*/
|
|
60
63
|
toString() {
|
|
61
|
-
return
|
|
64
|
+
return JSONbig$1.stringify({
|
|
62
65
|
method: this.method,
|
|
63
66
|
attribute: this.attribute,
|
|
64
67
|
values: this.values,
|
|
@@ -131,8 +134,8 @@ Query.isNotNull = (attribute) => new Query("isNotNull", attribute).toString();
|
|
|
131
134
|
* Filter resources where attribute is between start and end (inclusive).
|
|
132
135
|
*
|
|
133
136
|
* @param {string} attribute
|
|
134
|
-
* @param {string | number} start
|
|
135
|
-
* @param {string | number} end
|
|
137
|
+
* @param {string | number | bigint} start
|
|
138
|
+
* @param {string | number | bigint} end
|
|
136
139
|
* @returns {string}
|
|
137
140
|
*/
|
|
138
141
|
Query.between = (attribute, start, end) => new Query("between", attribute, [start, end]).toString();
|
|
@@ -245,8 +248,8 @@ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value)
|
|
|
245
248
|
* Filter resources where attribute is not between start and end (exclusive).
|
|
246
249
|
*
|
|
247
250
|
* @param {string} attribute
|
|
248
|
-
* @param {string | number} start
|
|
249
|
-
* @param {string | number} end
|
|
251
|
+
* @param {string | number | bigint} start
|
|
252
|
+
* @param {string | number | bigint} end
|
|
250
253
|
* @returns {string}
|
|
251
254
|
*/
|
|
252
255
|
Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
|
|
@@ -316,14 +319,14 @@ Query.updatedBetween = (start, end) => Query.between("$updatedAt", start, end);
|
|
|
316
319
|
* @param {string[]} queries
|
|
317
320
|
* @returns {string}
|
|
318
321
|
*/
|
|
319
|
-
Query.or = (queries) => new Query("or", undefined, queries.map((query) =>
|
|
322
|
+
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSONbig$1.parse(query))).toString();
|
|
320
323
|
/**
|
|
321
324
|
* Combine multiple queries using logical AND operator.
|
|
322
325
|
*
|
|
323
326
|
* @param {string[]} queries
|
|
324
327
|
* @returns {string}
|
|
325
328
|
*/
|
|
326
|
-
Query.and = (queries) => new Query("and", undefined, queries.map((query) =>
|
|
329
|
+
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSONbig$1.parse(query))).toString();
|
|
327
330
|
/**
|
|
328
331
|
* Filter resources where attribute is at a specific distance from the given coordinates.
|
|
329
332
|
*
|
|
@@ -429,6 +432,7 @@ Query.touches = (attribute, values) => new Query("touches", attribute, [values])
|
|
|
429
432
|
*/
|
|
430
433
|
Query.notTouches = (attribute, values) => new Query("notTouches", attribute, [values]).toString();
|
|
431
434
|
|
|
435
|
+
const JSONbig = JSONbigModule({ useNativeBigInt: true });
|
|
432
436
|
/**
|
|
433
437
|
* Exception thrown by the package
|
|
434
438
|
*/
|
|
@@ -461,7 +465,6 @@ class Client {
|
|
|
461
465
|
this.config = {
|
|
462
466
|
endpoint: 'https://cloud.appwrite.io/v1',
|
|
463
467
|
endpointRealtime: '',
|
|
464
|
-
selfSigned: false,
|
|
465
468
|
project: '',
|
|
466
469
|
key: '',
|
|
467
470
|
jwt: '',
|
|
@@ -469,6 +472,8 @@ class Client {
|
|
|
469
472
|
mode: '',
|
|
470
473
|
cookie: '',
|
|
471
474
|
platform: '',
|
|
475
|
+
selfSigned: false,
|
|
476
|
+
session: undefined,
|
|
472
477
|
};
|
|
473
478
|
/**
|
|
474
479
|
* Custom headers for API requests.
|
|
@@ -477,7 +482,7 @@ class Client {
|
|
|
477
482
|
'x-sdk-name': 'Console',
|
|
478
483
|
'x-sdk-platform': 'console',
|
|
479
484
|
'x-sdk-language': 'web',
|
|
480
|
-
'x-sdk-version': '2.1.
|
|
485
|
+
'x-sdk-version': '2.1.1',
|
|
481
486
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
482
487
|
};
|
|
483
488
|
this.realtime = {
|
|
@@ -515,7 +520,7 @@ class Client {
|
|
|
515
520
|
}
|
|
516
521
|
this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
|
|
517
522
|
var _a;
|
|
518
|
-
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(
|
|
523
|
+
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSONbig.stringify({
|
|
519
524
|
type: 'ping'
|
|
520
525
|
}));
|
|
521
526
|
}, 20000);
|
|
@@ -573,18 +578,18 @@ class Client {
|
|
|
573
578
|
onMessage: (event) => {
|
|
574
579
|
var _a, _b;
|
|
575
580
|
try {
|
|
576
|
-
const message =
|
|
581
|
+
const message = JSONbig.parse(event.data);
|
|
577
582
|
this.realtime.lastMessage = message;
|
|
578
583
|
switch (message.type) {
|
|
579
584
|
case 'connected':
|
|
580
585
|
let session = this.config.session;
|
|
581
586
|
if (!session) {
|
|
582
|
-
const cookie =
|
|
587
|
+
const cookie = JSONbig.parse((_a = window.localStorage.getItem('cookieFallback')) !== null && _a !== void 0 ? _a : '{}');
|
|
583
588
|
session = cookie === null || cookie === void 0 ? void 0 : cookie[`a_session_${this.config.project}`];
|
|
584
589
|
}
|
|
585
590
|
const messageData = message.data;
|
|
586
591
|
if (session && !messageData.user) {
|
|
587
|
-
(_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.send(
|
|
592
|
+
(_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.send(JSONbig.stringify({
|
|
588
593
|
type: 'authentication',
|
|
589
594
|
data: {
|
|
590
595
|
session
|
|
@@ -840,7 +845,7 @@ class Client {
|
|
|
840
845
|
else {
|
|
841
846
|
switch (headers['content-type']) {
|
|
842
847
|
case 'application/json':
|
|
843
|
-
options.body =
|
|
848
|
+
options.body = JSONbig.stringify(params);
|
|
844
849
|
break;
|
|
845
850
|
case 'multipart/form-data':
|
|
846
851
|
const formData = new FormData();
|
|
@@ -923,7 +928,7 @@ class Client {
|
|
|
923
928
|
warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
|
|
924
929
|
}
|
|
925
930
|
if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
|
|
926
|
-
data = yield response.
|
|
931
|
+
data = JSONbig.parse(yield response.text());
|
|
927
932
|
}
|
|
928
933
|
else if (responseType === 'arrayBuffer') {
|
|
929
934
|
data = yield response.arrayBuffer();
|
|
@@ -936,7 +941,7 @@ class Client {
|
|
|
936
941
|
if (400 <= response.status) {
|
|
937
942
|
let responseText = '';
|
|
938
943
|
if (((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) || responseType === 'arrayBuffer') {
|
|
939
|
-
responseText =
|
|
944
|
+
responseText = JSONbig.stringify(data);
|
|
940
945
|
}
|
|
941
946
|
else {
|
|
942
947
|
responseText = data === null || data === void 0 ? void 0 : data.message;
|
|
@@ -16183,6 +16188,36 @@ class Projects {
|
|
|
16183
16188
|
};
|
|
16184
16189
|
return this.client.call('delete', uri, apiHeaders, payload);
|
|
16185
16190
|
}
|
|
16191
|
+
updateLabels(paramsOrFirst, ...rest) {
|
|
16192
|
+
let params;
|
|
16193
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
16194
|
+
params = (paramsOrFirst || {});
|
|
16195
|
+
}
|
|
16196
|
+
else {
|
|
16197
|
+
params = {
|
|
16198
|
+
projectId: paramsOrFirst,
|
|
16199
|
+
labels: rest[0]
|
|
16200
|
+
};
|
|
16201
|
+
}
|
|
16202
|
+
const projectId = params.projectId;
|
|
16203
|
+
const labels = params.labels;
|
|
16204
|
+
if (typeof projectId === 'undefined') {
|
|
16205
|
+
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
16206
|
+
}
|
|
16207
|
+
if (typeof labels === 'undefined') {
|
|
16208
|
+
throw new AppwriteException('Missing required parameter: "labels"');
|
|
16209
|
+
}
|
|
16210
|
+
const apiPath = '/projects/{projectId}/labels'.replace('{projectId}', projectId);
|
|
16211
|
+
const payload = {};
|
|
16212
|
+
if (typeof labels !== 'undefined') {
|
|
16213
|
+
payload['labels'] = labels;
|
|
16214
|
+
}
|
|
16215
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
16216
|
+
const apiHeaders = {
|
|
16217
|
+
'content-type': 'application/json',
|
|
16218
|
+
};
|
|
16219
|
+
return this.client.call('put', uri, apiHeaders, payload);
|
|
16220
|
+
}
|
|
16186
16221
|
updateOAuth2(paramsOrFirst, ...rest) {
|
|
16187
16222
|
let params;
|
|
16188
16223
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|