@appwrite.io/console 2.1.1 → 2.1.3
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 +8 -0
- package/README.md +1 -1
- package/dist/cjs/sdk.js +311 -17
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +310 -18
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +344 -70
- package/docs/examples/domains/list-suggestions.md +18 -0
- package/docs/examples/health/get-queue-audits.md +13 -0
- package/docs/examples/organizations/create.md +2 -2
- package/docs/examples/organizations/estimation-create-organization.md +2 -2
- package/docs/examples/organizations/estimation-update-plan.md +2 -2
- package/docs/examples/organizations/update-plan.md +2 -2
- package/package.json +3 -2
- package/src/channel.ts +134 -0
- package/src/client.ts +79 -9
- package/src/enums/billing-plan.ts +17 -0
- package/src/enums/filter-type.ts +4 -0
- package/src/enums/name.ts +1 -0
- package/src/enums/o-auth-provider.ts +0 -2
- package/src/index.ts +3 -0
- package/src/models.ts +437 -375
- package/src/query.ts +42 -0
- 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 +89 -89
- package/src/services/domains.ts +295 -204
- package/src/services/functions.ts +30 -30
- package/src/services/health.ts +201 -152
- package/src/services/messaging.ts +54 -54
- package/src/services/migrations.ts +36 -36
- package/src/services/organizations.ts +67 -66
- package/src/services/projects.ts +81 -81
- package/src/services/realtime.ts +35 -12
- package/src/services/sites.ts +30 -30
- package/src/services/storage.ts +45 -45
- package/src/services/tables-db.ts +89 -89
- package/src/services/users.ts +39 -39
- package/types/channel.d.ts +71 -0
- package/types/client.d.ts +11 -3
- package/types/enums/billing-plan.d.ts +17 -0
- package/types/enums/filter-type.d.ts +4 -0
- package/types/enums/name.d.ts +1 -0
- package/types/enums/o-auth-provider.d.ts +0 -2
- package/types/index.d.ts +3 -0
- package/types/models.d.ts +434 -375
- package/types/query.d.ts +30 -0
- 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 +50 -50
- package/types/services/domains.d.ts +139 -104
- package/types/services/functions.d.ts +15 -15
- package/types/services/health.d.ts +95 -78
- package/types/services/messaging.d.ts +24 -24
- package/types/services/migrations.d.ts +16 -16
- package/types/services/organizations.d.ts +37 -36
- package/types/services/projects.d.ts +36 -36
- package/types/services/realtime.d.ts +17 -8
- package/types/services/sites.d.ts +15 -15
- package/types/services/storage.d.ts +30 -30
- package/types/services/tables-db.d.ts +50 -50
- package/types/services/users.d.ts +24 -24
package/dist/iife/sdk.js
CHANGED
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
(function (globalObject) {
|
|
45
45
|
|
|
46
46
|
/*
|
|
47
|
-
* bignumber.js v9.
|
|
47
|
+
* bignumber.js v9.0.0
|
|
48
48
|
* A JavaScript library for arbitrary-precision arithmetic.
|
|
49
49
|
* https://github.com/MikeMcl/bignumber.js
|
|
50
|
-
* Copyright (c)
|
|
50
|
+
* Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
51
51
|
* MIT Licensed.
|
|
52
52
|
*
|
|
53
53
|
* BigNumber.prototype methods | BigNumber methods
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
|
|
188
188
|
// The maximum number of significant digits of the result of the exponentiatedBy operation.
|
|
189
189
|
// If POW_PRECISION is 0, there will be unlimited significant digits.
|
|
190
|
-
POW_PRECISION = 0,
|
|
190
|
+
POW_PRECISION = 0, // 0 to MAX
|
|
191
191
|
|
|
192
192
|
// The format specification used by the BigNumber.prototype.toFormat method.
|
|
193
193
|
FORMAT = {
|
|
@@ -197,15 +197,14 @@
|
|
|
197
197
|
groupSeparator: ',',
|
|
198
198
|
decimalSeparator: '.',
|
|
199
199
|
fractionGroupSize: 0,
|
|
200
|
-
fractionGroupSeparator: '\xA0',
|
|
200
|
+
fractionGroupSeparator: '\xA0', // non-breaking space
|
|
201
201
|
suffix: ''
|
|
202
202
|
},
|
|
203
203
|
|
|
204
204
|
// The alphabet used for base conversion. It must be at least 2 characters long, with no '+',
|
|
205
205
|
// '-', '.', whitespace, or repeated character.
|
|
206
206
|
// '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
|
|
207
|
-
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'
|
|
208
|
-
alphabetHasNormalDecimalDigits = true;
|
|
207
|
+
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
|
|
209
208
|
|
|
210
209
|
|
|
211
210
|
//------------------------------------------------------------------------------------------
|
|
@@ -295,7 +294,7 @@
|
|
|
295
294
|
|
|
296
295
|
// Allow exponential notation to be used with base 10 argument, while
|
|
297
296
|
// also rounding to DECIMAL_PLACES as with other bases.
|
|
298
|
-
if (b == 10
|
|
297
|
+
if (b == 10) {
|
|
299
298
|
x = new BigNumber(v);
|
|
300
299
|
return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
|
|
301
300
|
}
|
|
@@ -584,10 +583,9 @@
|
|
|
584
583
|
if (obj.hasOwnProperty(p = 'ALPHABET')) {
|
|
585
584
|
v = obj[p];
|
|
586
585
|
|
|
587
|
-
// Disallow if
|
|
586
|
+
// Disallow if only one character,
|
|
588
587
|
// or if it contains '+', '-', '.', whitespace, or a repeated character.
|
|
589
|
-
if (typeof v == 'string' &&
|
|
590
|
-
alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789';
|
|
588
|
+
if (typeof v == 'string' && !/^.$|[+-.\s]|(.).*\1/.test(v)) {
|
|
591
589
|
ALPHABET = v;
|
|
592
590
|
} else {
|
|
593
591
|
throw Error
|
|
@@ -679,7 +677,7 @@
|
|
|
679
677
|
* arguments {number|string|BigNumber}
|
|
680
678
|
*/
|
|
681
679
|
BigNumber.maximum = BigNumber.max = function () {
|
|
682
|
-
return maxOrMin(arguments,
|
|
680
|
+
return maxOrMin(arguments, P.lt);
|
|
683
681
|
};
|
|
684
682
|
|
|
685
683
|
|
|
@@ -689,7 +687,7 @@
|
|
|
689
687
|
* arguments {number|string|BigNumber}
|
|
690
688
|
*/
|
|
691
689
|
BigNumber.minimum = BigNumber.min = function () {
|
|
692
|
-
return maxOrMin(arguments,
|
|
690
|
+
return maxOrMin(arguments, P.gt);
|
|
693
691
|
};
|
|
694
692
|
|
|
695
693
|
|
|
@@ -948,7 +946,7 @@
|
|
|
948
946
|
|
|
949
947
|
// xc now represents str converted to baseOut.
|
|
950
948
|
|
|
951
|
-
//
|
|
949
|
+
// THe index of the rounding digit.
|
|
952
950
|
d = e + dp + 1;
|
|
953
951
|
|
|
954
952
|
// The rounding digit: the digit to the right of the digit that may be rounded up.
|
|
@@ -1312,7 +1310,7 @@
|
|
|
1312
1310
|
|
|
1313
1311
|
// Fixed-point notation.
|
|
1314
1312
|
} else {
|
|
1315
|
-
i -= ne
|
|
1313
|
+
i -= ne;
|
|
1316
1314
|
str = toFixedPoint(str, e, '0');
|
|
1317
1315
|
|
|
1318
1316
|
// Append zeros?
|
|
@@ -1333,20 +1331,24 @@
|
|
|
1333
1331
|
|
|
1334
1332
|
|
|
1335
1333
|
// Handle BigNumber.max and BigNumber.min.
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
var k, y,
|
|
1334
|
+
function maxOrMin(args, method) {
|
|
1335
|
+
var n,
|
|
1339
1336
|
i = 1,
|
|
1340
|
-
|
|
1337
|
+
m = new BigNumber(args[0]);
|
|
1341
1338
|
|
|
1342
1339
|
for (; i < args.length; i++) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1340
|
+
n = new BigNumber(args[i]);
|
|
1341
|
+
|
|
1342
|
+
// If any number is NaN, return NaN.
|
|
1343
|
+
if (!n.s) {
|
|
1344
|
+
m = n;
|
|
1345
|
+
break;
|
|
1346
|
+
} else if (method.call(m, n)) {
|
|
1347
|
+
m = n;
|
|
1346
1348
|
}
|
|
1347
1349
|
}
|
|
1348
1350
|
|
|
1349
|
-
return
|
|
1351
|
+
return m;
|
|
1350
1352
|
}
|
|
1351
1353
|
|
|
1352
1354
|
|
|
@@ -1465,7 +1467,7 @@
|
|
|
1465
1467
|
n = xc[ni = 0];
|
|
1466
1468
|
|
|
1467
1469
|
// Get the rounding digit at index j of n.
|
|
1468
|
-
rd =
|
|
1470
|
+
rd = n / pows10[d - j - 1] % 10 | 0;
|
|
1469
1471
|
} else {
|
|
1470
1472
|
ni = mathceil((i + 1) / LOG_BASE);
|
|
1471
1473
|
|
|
@@ -1496,7 +1498,7 @@
|
|
|
1496
1498
|
j = i - LOG_BASE + d;
|
|
1497
1499
|
|
|
1498
1500
|
// Get the rounding digit at index j of n.
|
|
1499
|
-
rd = j < 0 ? 0 :
|
|
1501
|
+
rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;
|
|
1500
1502
|
}
|
|
1501
1503
|
}
|
|
1502
1504
|
|
|
@@ -1744,7 +1746,7 @@
|
|
|
1744
1746
|
|
|
1745
1747
|
// The sign of the result of pow when x is negative depends on the evenness of n.
|
|
1746
1748
|
// If +n overflows to ±Infinity, the evenness of n would be not be known.
|
|
1747
|
-
y = new BigNumber(Math.pow(+valueOf(x), nIsBig ?
|
|
1749
|
+
y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));
|
|
1748
1750
|
return m ? y.mod(m) : y;
|
|
1749
1751
|
}
|
|
1750
1752
|
|
|
@@ -2045,12 +2047,7 @@
|
|
|
2045
2047
|
}
|
|
2046
2048
|
|
|
2047
2049
|
// x < y? Point xc to the array of the bigger number.
|
|
2048
|
-
if (xLTy)
|
|
2049
|
-
t = xc;
|
|
2050
|
-
xc = yc;
|
|
2051
|
-
yc = t;
|
|
2052
|
-
y.s = -y.s;
|
|
2053
|
-
}
|
|
2050
|
+
if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;
|
|
2054
2051
|
|
|
2055
2052
|
b = (j = yc.length) - (i = xc.length);
|
|
2056
2053
|
|
|
@@ -2204,14 +2201,7 @@
|
|
|
2204
2201
|
ycL = yc.length;
|
|
2205
2202
|
|
|
2206
2203
|
// Ensure xc points to longer array and xcL to its length.
|
|
2207
|
-
if (xcL < ycL)
|
|
2208
|
-
zc = xc;
|
|
2209
|
-
xc = yc;
|
|
2210
|
-
yc = zc;
|
|
2211
|
-
i = xcL;
|
|
2212
|
-
xcL = ycL;
|
|
2213
|
-
ycL = i;
|
|
2214
|
-
}
|
|
2204
|
+
if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;
|
|
2215
2205
|
|
|
2216
2206
|
// Initialise the result array with zeros.
|
|
2217
2207
|
for (i = xcL + ycL, zc = []; i--; zc.push(0));
|
|
@@ -2332,12 +2322,7 @@
|
|
|
2332
2322
|
b = yc.length;
|
|
2333
2323
|
|
|
2334
2324
|
// Point xc to the longer array, and b to the shorter length.
|
|
2335
|
-
if (a - b < 0)
|
|
2336
|
-
t = yc;
|
|
2337
|
-
yc = xc;
|
|
2338
|
-
xc = t;
|
|
2339
|
-
b = a;
|
|
2340
|
-
}
|
|
2325
|
+
if (a - b < 0) t = yc, yc = xc, xc = t, b = a;
|
|
2341
2326
|
|
|
2342
2327
|
// Only start adding at yc.length - 1 as the further digits of xc can be ignored.
|
|
2343
2328
|
for (a = 0; b;) {
|
|
@@ -2453,7 +2438,7 @@
|
|
|
2453
2438
|
e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
|
|
2454
2439
|
|
|
2455
2440
|
if (s == 1 / 0) {
|
|
2456
|
-
n = '
|
|
2441
|
+
n = '1e' + e;
|
|
2457
2442
|
} else {
|
|
2458
2443
|
n = s.toExponential();
|
|
2459
2444
|
n = n.slice(0, n.indexOf('e') + 1) + e;
|
|
@@ -2623,12 +2608,7 @@
|
|
|
2623
2608
|
intDigits = isNeg ? intPart.slice(1) : intPart,
|
|
2624
2609
|
len = intDigits.length;
|
|
2625
2610
|
|
|
2626
|
-
if (g2)
|
|
2627
|
-
i = g1;
|
|
2628
|
-
g1 = g2;
|
|
2629
|
-
g2 = i;
|
|
2630
|
-
len -= i;
|
|
2631
|
-
}
|
|
2611
|
+
if (g2) i = g1, g1 = g2, g2 = i, len -= i;
|
|
2632
2612
|
|
|
2633
2613
|
if (g1 > 0 && len > 0) {
|
|
2634
2614
|
i = len % g1 || g1;
|
|
@@ -2780,7 +2760,7 @@
|
|
|
2780
2760
|
str = e <= TO_EXP_NEG || e >= TO_EXP_POS
|
|
2781
2761
|
? toExponential(coeffToString(n.c), e)
|
|
2782
2762
|
: toFixedPoint(coeffToString(n.c), e, '0');
|
|
2783
|
-
} else if (b === 10
|
|
2763
|
+
} else if (b === 10) {
|
|
2784
2764
|
n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
|
|
2785
2765
|
str = toFixedPoint(coeffToString(n.c), n.e, '0');
|
|
2786
2766
|
} else {
|
|
@@ -2960,6 +2940,8 @@
|
|
|
2960
2940
|
})(commonjsGlobal);
|
|
2961
2941
|
} (bignumber));
|
|
2962
2942
|
|
|
2943
|
+
var BigNumber$1 = bignumber.exports;
|
|
2944
|
+
|
|
2963
2945
|
(function (module) {
|
|
2964
2946
|
var BigNumber = bignumber.exports;
|
|
2965
2947
|
|
|
@@ -3848,6 +3830,14 @@
|
|
|
3848
3830
|
* @returns {string}
|
|
3849
3831
|
*/
|
|
3850
3832
|
Query.notEqual = (attribute, value) => new Query("notEqual", attribute, value).toString();
|
|
3833
|
+
/**
|
|
3834
|
+
* Filter resources where attribute matches a regular expression pattern.
|
|
3835
|
+
*
|
|
3836
|
+
* @param {string} attribute The attribute to filter on.
|
|
3837
|
+
* @param {string} pattern The regular expression pattern to match.
|
|
3838
|
+
* @returns {string}
|
|
3839
|
+
*/
|
|
3840
|
+
Query.regex = (attribute, pattern) => new Query("regex", attribute, pattern).toString();
|
|
3851
3841
|
/**
|
|
3852
3842
|
* Filter resources where attribute is less than value.
|
|
3853
3843
|
*
|
|
@@ -3894,6 +3884,20 @@
|
|
|
3894
3884
|
* @returns {string}
|
|
3895
3885
|
*/
|
|
3896
3886
|
Query.isNotNull = (attribute) => new Query("isNotNull", attribute).toString();
|
|
3887
|
+
/**
|
|
3888
|
+
* Filter resources where the specified attributes exist.
|
|
3889
|
+
*
|
|
3890
|
+
* @param {string[]} attributes The list of attributes that must exist.
|
|
3891
|
+
* @returns {string}
|
|
3892
|
+
*/
|
|
3893
|
+
Query.exists = (attributes) => new Query("exists", undefined, attributes).toString();
|
|
3894
|
+
/**
|
|
3895
|
+
* Filter resources where the specified attributes do not exist.
|
|
3896
|
+
*
|
|
3897
|
+
* @param {string[]} attributes The list of attributes that must not exist.
|
|
3898
|
+
* @returns {string}
|
|
3899
|
+
*/
|
|
3900
|
+
Query.notExists = (attributes) => new Query("notExists", undefined, attributes).toString();
|
|
3897
3901
|
/**
|
|
3898
3902
|
* Filter resources where attribute is between start and end (inclusive).
|
|
3899
3903
|
*
|
|
@@ -4091,6 +4095,14 @@
|
|
|
4091
4095
|
* @returns {string}
|
|
4092
4096
|
*/
|
|
4093
4097
|
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSONbig$1.parse(query))).toString();
|
|
4098
|
+
/**
|
|
4099
|
+
* Filter array elements where at least one element matches all the specified queries.
|
|
4100
|
+
*
|
|
4101
|
+
* @param {string} attribute The attribute containing the array to filter on.
|
|
4102
|
+
* @param {string[]} queries The list of query strings to match against array elements.
|
|
4103
|
+
* @returns {string}
|
|
4104
|
+
*/
|
|
4105
|
+
Query.elemMatch = (attribute, queries) => new Query("elemMatch", attribute, queries.map((query) => JSONbig$1.parse(query))).toString();
|
|
4094
4106
|
/**
|
|
4095
4107
|
* Filter resources where attribute is at a specific distance from the given coordinates.
|
|
4096
4108
|
*
|
|
@@ -4196,7 +4208,47 @@
|
|
|
4196
4208
|
*/
|
|
4197
4209
|
Query.notTouches = (attribute, values) => new Query("notTouches", attribute, [values]).toString();
|
|
4198
4210
|
|
|
4199
|
-
const
|
|
4211
|
+
const JSONbigParser = jsonBigint.exports({ storeAsString: false });
|
|
4212
|
+
const JSONbigSerializer = jsonBigint.exports({ useNativeBigInt: true });
|
|
4213
|
+
/**
|
|
4214
|
+
* Converts BigNumber objects from json-bigint to native types.
|
|
4215
|
+
* - Integer BigNumbers → BigInt (if unsafe) or number (if safe)
|
|
4216
|
+
* - Float BigNumbers → number
|
|
4217
|
+
* - Strings remain strings (never converted to BigNumber by json-bigint)
|
|
4218
|
+
*/
|
|
4219
|
+
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4220
|
+
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
4221
|
+
function convertBigNumbers(value) {
|
|
4222
|
+
if (value === null || value === undefined)
|
|
4223
|
+
return value;
|
|
4224
|
+
if (Array.isArray(value)) {
|
|
4225
|
+
return value.map(convertBigNumbers);
|
|
4226
|
+
}
|
|
4227
|
+
if (BigNumber$1.isBigNumber(value)) {
|
|
4228
|
+
if (value.isInteger()) {
|
|
4229
|
+
const str = value.toFixed();
|
|
4230
|
+
const bi = BigInt(str);
|
|
4231
|
+
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
4232
|
+
return Number(str);
|
|
4233
|
+
}
|
|
4234
|
+
return bi;
|
|
4235
|
+
}
|
|
4236
|
+
// float
|
|
4237
|
+
return value.toNumber();
|
|
4238
|
+
}
|
|
4239
|
+
if (typeof value === 'object') {
|
|
4240
|
+
const result = {};
|
|
4241
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4242
|
+
result[k] = convertBigNumbers(v);
|
|
4243
|
+
}
|
|
4244
|
+
return result;
|
|
4245
|
+
}
|
|
4246
|
+
return value;
|
|
4247
|
+
}
|
|
4248
|
+
const JSONbig = {
|
|
4249
|
+
parse: (text) => convertBigNumbers(JSONbigParser.parse(text)),
|
|
4250
|
+
stringify: JSONbigSerializer.stringify
|
|
4251
|
+
};
|
|
4200
4252
|
/**
|
|
4201
4253
|
* Exception thrown by the package
|
|
4202
4254
|
*/
|
|
@@ -4246,7 +4298,7 @@
|
|
|
4246
4298
|
'x-sdk-name': 'Console',
|
|
4247
4299
|
'x-sdk-platform': 'console',
|
|
4248
4300
|
'x-sdk-language': 'web',
|
|
4249
|
-
'x-sdk-version': '2.1.
|
|
4301
|
+
'x-sdk-version': '2.1.3',
|
|
4250
4302
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
4251
4303
|
};
|
|
4252
4304
|
this.realtime = {
|
|
@@ -4548,8 +4600,8 @@
|
|
|
4548
4600
|
* @deprecated Use the Realtime service instead.
|
|
4549
4601
|
* @see Realtime
|
|
4550
4602
|
*
|
|
4551
|
-
* @param {string|string[]} channels
|
|
4552
|
-
* Channel to subscribe - pass a single channel as a string or multiple with an array
|
|
4603
|
+
* @param {string|string[]|Channel<any>|ActionableChannel|ResolvedChannel|(Channel<any>|ActionableChannel|ResolvedChannel)[]} channels
|
|
4604
|
+
* Channel to subscribe - pass a single channel as a string or Channel builder instance, or multiple with an array.
|
|
4553
4605
|
*
|
|
4554
4606
|
* Possible channels are:
|
|
4555
4607
|
* - account
|
|
@@ -4567,21 +4619,40 @@
|
|
|
4567
4619
|
* - teams.[ID]
|
|
4568
4620
|
* - memberships
|
|
4569
4621
|
* - memberships.[ID]
|
|
4622
|
+
*
|
|
4623
|
+
* You can also use Channel builders:
|
|
4624
|
+
* - Channel.database('db').collection('col').document('doc').create()
|
|
4625
|
+
* - Channel.bucket('bucket').file('file').update()
|
|
4626
|
+
* - Channel.function('func').execution('exec').delete()
|
|
4627
|
+
* - Channel.team('team').create()
|
|
4628
|
+
* - Channel.membership('membership').update()
|
|
4570
4629
|
* @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update.
|
|
4571
4630
|
* @returns {() => void} Unsubscribes from events.
|
|
4572
4631
|
*/
|
|
4573
4632
|
subscribe(channels, callback) {
|
|
4574
|
-
|
|
4575
|
-
|
|
4633
|
+
const channelArray = Array.isArray(channels) ? channels : [channels];
|
|
4634
|
+
// Convert Channel instances to strings
|
|
4635
|
+
const channelStrings = channelArray.map(ch => {
|
|
4636
|
+
if (typeof ch === 'string') {
|
|
4637
|
+
return ch;
|
|
4638
|
+
}
|
|
4639
|
+
// All Channel instances have toString() method
|
|
4640
|
+
if (ch && typeof ch.toString === 'function') {
|
|
4641
|
+
return ch.toString();
|
|
4642
|
+
}
|
|
4643
|
+
// Fallback to generic string conversion
|
|
4644
|
+
return String(ch);
|
|
4645
|
+
});
|
|
4646
|
+
channelStrings.forEach(channel => this.realtime.channels.add(channel));
|
|
4576
4647
|
const counter = this.realtime.subscriptionsCounter++;
|
|
4577
4648
|
this.realtime.subscriptions.set(counter, {
|
|
4578
|
-
channels:
|
|
4649
|
+
channels: channelStrings,
|
|
4579
4650
|
callback
|
|
4580
4651
|
});
|
|
4581
4652
|
this.realtime.connect();
|
|
4582
4653
|
return () => {
|
|
4583
4654
|
this.realtime.subscriptions.delete(counter);
|
|
4584
|
-
this.realtime.cleanUp(
|
|
4655
|
+
this.realtime.cleanUp(channelStrings);
|
|
4585
4656
|
this.realtime.connect();
|
|
4586
4657
|
};
|
|
4587
4658
|
}
|
|
@@ -10701,6 +10772,54 @@
|
|
|
10701
10772
|
};
|
|
10702
10773
|
return this.client.call('post', uri, apiHeaders, payload);
|
|
10703
10774
|
}
|
|
10775
|
+
listSuggestions(paramsOrFirst, ...rest) {
|
|
10776
|
+
let params;
|
|
10777
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
10778
|
+
params = (paramsOrFirst || {});
|
|
10779
|
+
}
|
|
10780
|
+
else {
|
|
10781
|
+
params = {
|
|
10782
|
+
query: paramsOrFirst,
|
|
10783
|
+
tlds: rest[0],
|
|
10784
|
+
limit: rest[1],
|
|
10785
|
+
filterType: rest[2],
|
|
10786
|
+
priceMax: rest[3],
|
|
10787
|
+
priceMin: rest[4]
|
|
10788
|
+
};
|
|
10789
|
+
}
|
|
10790
|
+
const query = params.query;
|
|
10791
|
+
const tlds = params.tlds;
|
|
10792
|
+
const limit = params.limit;
|
|
10793
|
+
const filterType = params.filterType;
|
|
10794
|
+
const priceMax = params.priceMax;
|
|
10795
|
+
const priceMin = params.priceMin;
|
|
10796
|
+
if (typeof query === 'undefined') {
|
|
10797
|
+
throw new AppwriteException('Missing required parameter: "query"');
|
|
10798
|
+
}
|
|
10799
|
+
const apiPath = '/domains/suggestions';
|
|
10800
|
+
const payload = {};
|
|
10801
|
+
if (typeof query !== 'undefined') {
|
|
10802
|
+
payload['query'] = query;
|
|
10803
|
+
}
|
|
10804
|
+
if (typeof tlds !== 'undefined') {
|
|
10805
|
+
payload['tlds'] = tlds;
|
|
10806
|
+
}
|
|
10807
|
+
if (typeof limit !== 'undefined') {
|
|
10808
|
+
payload['limit'] = limit;
|
|
10809
|
+
}
|
|
10810
|
+
if (typeof filterType !== 'undefined') {
|
|
10811
|
+
payload['filterType'] = filterType;
|
|
10812
|
+
}
|
|
10813
|
+
if (typeof priceMax !== 'undefined') {
|
|
10814
|
+
payload['priceMax'] = priceMax;
|
|
10815
|
+
}
|
|
10816
|
+
if (typeof priceMin !== 'undefined') {
|
|
10817
|
+
payload['priceMin'] = priceMin;
|
|
10818
|
+
}
|
|
10819
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
10820
|
+
const apiHeaders = {};
|
|
10821
|
+
return this.client.call('get', uri, apiHeaders, payload);
|
|
10822
|
+
}
|
|
10704
10823
|
get(paramsOrFirst) {
|
|
10705
10824
|
let params;
|
|
10706
10825
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -13501,7 +13620,7 @@
|
|
|
13501
13620
|
* Check the Appwrite in-memory cache servers are up and connection is successful.
|
|
13502
13621
|
*
|
|
13503
13622
|
* @throws {AppwriteException}
|
|
13504
|
-
* @returns {Promise<Models.
|
|
13623
|
+
* @returns {Promise<Models.HealthStatusList>}
|
|
13505
13624
|
*/
|
|
13506
13625
|
getCache() {
|
|
13507
13626
|
const apiPath = '/health/cache';
|
|
@@ -13534,7 +13653,7 @@
|
|
|
13534
13653
|
* Check the Appwrite database servers are up and connection is successful.
|
|
13535
13654
|
*
|
|
13536
13655
|
* @throws {AppwriteException}
|
|
13537
|
-
* @returns {Promise<Models.
|
|
13656
|
+
* @returns {Promise<Models.HealthStatusList>}
|
|
13538
13657
|
*/
|
|
13539
13658
|
getDB() {
|
|
13540
13659
|
const apiPath = '/health/db';
|
|
@@ -13547,7 +13666,7 @@
|
|
|
13547
13666
|
* Check the Appwrite pub-sub servers are up and connection is successful.
|
|
13548
13667
|
*
|
|
13549
13668
|
* @throws {AppwriteException}
|
|
13550
|
-
* @returns {Promise<Models.
|
|
13669
|
+
* @returns {Promise<Models.HealthStatusList>}
|
|
13551
13670
|
*/
|
|
13552
13671
|
getPubSub() {
|
|
13553
13672
|
const apiPath = '/health/pubsub';
|
|
@@ -13556,6 +13675,26 @@
|
|
|
13556
13675
|
const apiHeaders = {};
|
|
13557
13676
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
13558
13677
|
}
|
|
13678
|
+
getQueueAudits(paramsOrFirst) {
|
|
13679
|
+
let params;
|
|
13680
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
13681
|
+
params = (paramsOrFirst || {});
|
|
13682
|
+
}
|
|
13683
|
+
else {
|
|
13684
|
+
params = {
|
|
13685
|
+
threshold: paramsOrFirst
|
|
13686
|
+
};
|
|
13687
|
+
}
|
|
13688
|
+
const threshold = params.threshold;
|
|
13689
|
+
const apiPath = '/health/queue/audits';
|
|
13690
|
+
const payload = {};
|
|
13691
|
+
if (typeof threshold !== 'undefined') {
|
|
13692
|
+
payload['threshold'] = threshold;
|
|
13693
|
+
}
|
|
13694
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
13695
|
+
const apiHeaders = {};
|
|
13696
|
+
return this.client.call('get', uri, apiHeaders, payload);
|
|
13697
|
+
}
|
|
13559
13698
|
getQueueBillingProjectAggregation(paramsOrFirst) {
|
|
13560
13699
|
let params;
|
|
13561
13700
|
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -17675,7 +17814,7 @@
|
|
|
17675
17814
|
}
|
|
17676
17815
|
estimationCreateOrganization(paramsOrFirst, ...rest) {
|
|
17677
17816
|
let params;
|
|
17678
|
-
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
17817
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'billingPlan' in paramsOrFirst)) {
|
|
17679
17818
|
params = (paramsOrFirst || {});
|
|
17680
17819
|
}
|
|
17681
17820
|
else {
|
|
@@ -28613,11 +28752,31 @@
|
|
|
28613
28752
|
sleep(ms) {
|
|
28614
28753
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
28615
28754
|
}
|
|
28755
|
+
/**
|
|
28756
|
+
* Convert a channel value to a string
|
|
28757
|
+
*
|
|
28758
|
+
* @private
|
|
28759
|
+
* @param {string | Channel<any> | ActionableChannel | ResolvedChannel} channel - Channel value (string or Channel builder instance)
|
|
28760
|
+
* @returns {string} Channel string representation
|
|
28761
|
+
*/
|
|
28762
|
+
channelToString(channel) {
|
|
28763
|
+
if (typeof channel === 'string') {
|
|
28764
|
+
return channel;
|
|
28765
|
+
}
|
|
28766
|
+
// All Channel instances have toString() method
|
|
28767
|
+
if (channel && typeof channel.toString === 'function') {
|
|
28768
|
+
return channel.toString();
|
|
28769
|
+
}
|
|
28770
|
+
return String(channel);
|
|
28771
|
+
}
|
|
28616
28772
|
subscribe(channelsOrChannel, callback) {
|
|
28617
28773
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28618
|
-
const
|
|
28619
|
-
?
|
|
28620
|
-
:
|
|
28774
|
+
const channelArray = Array.isArray(channelsOrChannel)
|
|
28775
|
+
? channelsOrChannel
|
|
28776
|
+
: [channelsOrChannel];
|
|
28777
|
+
// Convert all channels to strings
|
|
28778
|
+
const channelStrings = channelArray.map(ch => this.channelToString(ch));
|
|
28779
|
+
const channels = new Set(channelStrings);
|
|
28621
28780
|
this.subscriptionsCounter++;
|
|
28622
28781
|
const count = this.subscriptionsCounter;
|
|
28623
28782
|
for (const channel of channels) {
|
|
@@ -28921,6 +29080,96 @@
|
|
|
28921
29080
|
return hexTimestamp;
|
|
28922
29081
|
};
|
|
28923
29082
|
|
|
29083
|
+
function normalize(id) {
|
|
29084
|
+
const trimmed = id.trim();
|
|
29085
|
+
return trimmed === "" ? "*" : trimmed;
|
|
29086
|
+
}
|
|
29087
|
+
class Channel {
|
|
29088
|
+
constructor(segments) {
|
|
29089
|
+
this.segments = segments;
|
|
29090
|
+
}
|
|
29091
|
+
next(segment, id = "*") {
|
|
29092
|
+
return new Channel([...this.segments, segment, normalize(id)]);
|
|
29093
|
+
}
|
|
29094
|
+
resolve(action) {
|
|
29095
|
+
return new Channel([...this.segments, action]);
|
|
29096
|
+
}
|
|
29097
|
+
toString() {
|
|
29098
|
+
return this.segments.join(".");
|
|
29099
|
+
}
|
|
29100
|
+
// --- DATABASE ROUTE ---
|
|
29101
|
+
// Only available on Channel<Database>
|
|
29102
|
+
collection(id = "*") {
|
|
29103
|
+
return this.next("collections", id);
|
|
29104
|
+
}
|
|
29105
|
+
// Only available on Channel<Collection>
|
|
29106
|
+
document(id = "*") {
|
|
29107
|
+
return this.next("documents", id);
|
|
29108
|
+
}
|
|
29109
|
+
// --- TABLESDB ROUTE ---
|
|
29110
|
+
table(id = "*") {
|
|
29111
|
+
return this.next("tables", id);
|
|
29112
|
+
}
|
|
29113
|
+
row(id = "*") {
|
|
29114
|
+
return this.next("rows", id);
|
|
29115
|
+
}
|
|
29116
|
+
// --- BUCKET ROUTE ---
|
|
29117
|
+
file(id = "*") {
|
|
29118
|
+
return this.next("files", id);
|
|
29119
|
+
}
|
|
29120
|
+
// --- FUNCTION ROUTE ---
|
|
29121
|
+
execution(id = "*") {
|
|
29122
|
+
return this.next("executions", id);
|
|
29123
|
+
}
|
|
29124
|
+
// --- TERMINAL ACTIONS ---
|
|
29125
|
+
// Restricted to the Actionable union
|
|
29126
|
+
create() {
|
|
29127
|
+
return this.resolve("create");
|
|
29128
|
+
}
|
|
29129
|
+
update() {
|
|
29130
|
+
return this.resolve("update");
|
|
29131
|
+
}
|
|
29132
|
+
delete() {
|
|
29133
|
+
return this.resolve("delete");
|
|
29134
|
+
}
|
|
29135
|
+
// --- ROOT FACTORIES ---
|
|
29136
|
+
static database(id = "*") {
|
|
29137
|
+
return new Channel(["databases", normalize(id)]);
|
|
29138
|
+
}
|
|
29139
|
+
static tablesdb(id = "*") {
|
|
29140
|
+
return new Channel(["tablesdb", normalize(id)]);
|
|
29141
|
+
}
|
|
29142
|
+
static bucket(id = "*") {
|
|
29143
|
+
return new Channel(["buckets", normalize(id)]);
|
|
29144
|
+
}
|
|
29145
|
+
static function(id = "*") {
|
|
29146
|
+
return new Channel(["functions", normalize(id)]);
|
|
29147
|
+
}
|
|
29148
|
+
static team(id = "*") {
|
|
29149
|
+
return new Channel(["teams", normalize(id)]);
|
|
29150
|
+
}
|
|
29151
|
+
static membership(id = "*") {
|
|
29152
|
+
return new Channel(["memberships", normalize(id)]);
|
|
29153
|
+
}
|
|
29154
|
+
static account(userId = "") {
|
|
29155
|
+
const id = normalize(userId);
|
|
29156
|
+
return id === "*" ? "account" : `account.${id}`;
|
|
29157
|
+
}
|
|
29158
|
+
// Global events
|
|
29159
|
+
static get documents() {
|
|
29160
|
+
return "documents";
|
|
29161
|
+
}
|
|
29162
|
+
static get rows() {
|
|
29163
|
+
return "rows";
|
|
29164
|
+
}
|
|
29165
|
+
static get files() {
|
|
29166
|
+
return "files";
|
|
29167
|
+
}
|
|
29168
|
+
static get executions() {
|
|
29169
|
+
return "executions";
|
|
29170
|
+
}
|
|
29171
|
+
}
|
|
29172
|
+
|
|
28924
29173
|
exports.Condition = void 0;
|
|
28925
29174
|
(function (Condition) {
|
|
28926
29175
|
Condition["Equal"] = "equal";
|
|
@@ -29240,8 +29489,6 @@
|
|
|
29240
29489
|
OAuthProvider["Yandex"] = "yandex";
|
|
29241
29490
|
OAuthProvider["Zoho"] = "zoho";
|
|
29242
29491
|
OAuthProvider["Zoom"] = "zoom";
|
|
29243
|
-
OAuthProvider["Mock"] = "mock";
|
|
29244
|
-
OAuthProvider["Mockunverified"] = "mock-unverified";
|
|
29245
29492
|
OAuthProvider["GithubImagine"] = "githubImagine";
|
|
29246
29493
|
OAuthProvider["GoogleImagine"] = "googleImagine";
|
|
29247
29494
|
})(exports.OAuthProvider || (exports.OAuthProvider = {}));
|
|
@@ -29965,6 +30212,12 @@
|
|
|
29965
30212
|
IndexType["Spatial"] = "spatial";
|
|
29966
30213
|
})(exports.IndexType || (exports.IndexType = {}));
|
|
29967
30214
|
|
|
30215
|
+
exports.FilterType = void 0;
|
|
30216
|
+
(function (FilterType) {
|
|
30217
|
+
FilterType["Premium"] = "premium";
|
|
30218
|
+
FilterType["Suggestion"] = "suggestion";
|
|
30219
|
+
})(exports.FilterType || (exports.FilterType = {}));
|
|
30220
|
+
|
|
29968
30221
|
exports.Runtime = void 0;
|
|
29969
30222
|
(function (Runtime) {
|
|
29970
30223
|
Runtime["Node145"] = "node-14.5";
|
|
@@ -30076,6 +30329,7 @@
|
|
|
30076
30329
|
Name["V1webhooks"] = "v1-webhooks";
|
|
30077
30330
|
Name["V1certificates"] = "v1-certificates";
|
|
30078
30331
|
Name["V1builds"] = "v1-builds";
|
|
30332
|
+
Name["V1screenshots"] = "v1-screenshots";
|
|
30079
30333
|
Name["V1messaging"] = "v1-messaging";
|
|
30080
30334
|
Name["V1migrations"] = "v1-migrations";
|
|
30081
30335
|
})(exports.Name || (exports.Name = {}));
|
|
@@ -30093,6 +30347,25 @@
|
|
|
30093
30347
|
SmtpEncryption["Tls"] = "tls";
|
|
30094
30348
|
})(exports.SmtpEncryption || (exports.SmtpEncryption = {}));
|
|
30095
30349
|
|
|
30350
|
+
exports.BillingPlan = void 0;
|
|
30351
|
+
(function (BillingPlan) {
|
|
30352
|
+
BillingPlan["Tier0"] = "tier-0";
|
|
30353
|
+
BillingPlan["Tier1"] = "tier-1";
|
|
30354
|
+
BillingPlan["Tier2"] = "tier-2";
|
|
30355
|
+
BillingPlan["Imaginetier0"] = "imagine-tier-0";
|
|
30356
|
+
BillingPlan["Imaginetier1"] = "imagine-tier-1";
|
|
30357
|
+
BillingPlan["Imaginetier150"] = "imagine-tier-1-50";
|
|
30358
|
+
BillingPlan["Imaginetier1100"] = "imagine-tier-1-100";
|
|
30359
|
+
BillingPlan["Imaginetier1200"] = "imagine-tier-1-200";
|
|
30360
|
+
BillingPlan["Imaginetier1290"] = "imagine-tier-1-290";
|
|
30361
|
+
BillingPlan["Imaginetier1480"] = "imagine-tier-1-480";
|
|
30362
|
+
BillingPlan["Imaginetier1700"] = "imagine-tier-1-700";
|
|
30363
|
+
BillingPlan["Imaginetier1900"] = "imagine-tier-1-900";
|
|
30364
|
+
BillingPlan["Imaginetier11100"] = "imagine-tier-1-1100";
|
|
30365
|
+
BillingPlan["Imaginetier11650"] = "imagine-tier-1-1650";
|
|
30366
|
+
BillingPlan["Imaginetier12200"] = "imagine-tier-1-2200";
|
|
30367
|
+
})(exports.BillingPlan || (exports.BillingPlan = {}));
|
|
30368
|
+
|
|
30096
30369
|
exports.ProjectUsageRange = void 0;
|
|
30097
30370
|
(function (ProjectUsageRange) {
|
|
30098
30371
|
ProjectUsageRange["OneHour"] = "1h";
|
|
@@ -30725,6 +30998,7 @@
|
|
|
30725
30998
|
exports.Assistant = Assistant;
|
|
30726
30999
|
exports.Avatars = Avatars;
|
|
30727
31000
|
exports.Backups = Backups;
|
|
31001
|
+
exports.Channel = Channel;
|
|
30728
31002
|
exports.Client = Client;
|
|
30729
31003
|
exports.Console = Console;
|
|
30730
31004
|
exports.Databases = Databases;
|