react-native-appwrite 0.17.1 → 0.18.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/CHANGELOG.md +5 -0
- package/dist/cjs/sdk.js +339 -17
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +339 -18
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/list-identities.md +2 -1
- package/docs/examples/account/list-logs.md +2 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/list-documents.md +2 -1
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/upsert-document.md +1 -1
- package/docs/examples/functions/list-executions.md +2 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/list-files.md +2 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/tablesdb/create-row.md +1 -1
- package/docs/examples/tablesdb/list-rows.md +2 -1
- package/docs/examples/tablesdb/update-row.md +1 -1
- package/docs/examples/tablesdb/upsert-row.md +1 -1
- package/docs/examples/teams/list-memberships.md +2 -1
- package/docs/examples/teams/list.md +2 -1
- package/package.json +2 -3
- package/src/client.ts +1 -1
- package/src/enums/execution-status.ts +1 -0
- package/src/index.ts +3 -0
- package/src/models.ts +1 -1
- package/src/operator.ts +308 -0
- package/src/query.ts +6 -6
- package/src/services/account.ts +30 -12
- package/src/services/databases.ts +15 -7
- package/src/services/functions.ts +15 -7
- package/src/services/storage.ts +15 -7
- package/src/services/tables-db.ts +15 -7
- package/src/services/teams.ts +30 -14
- package/types/enums/execution-status.d.ts +2 -1
- package/types/index.d.ts +3 -0
- package/types/models.d.ts +1 -1
- package/types/operator.d.ts +180 -0
- package/types/services/account.d.ts +8 -2
- package/types/services/databases.d.ts +4 -1
- package/types/services/functions.d.ts +4 -1
- package/types/services/storage.d.ts +4 -1
- package/types/services/tables-db.d.ts +4 -1
- package/types/services/teams.d.ts +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
|
|
6
|
+
* Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations
|
|
7
|
+
|
|
3
8
|
## 0.17.1
|
|
4
9
|
|
|
5
10
|
* Add transaction support for Databases and TablesDB
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -100,7 +100,7 @@ class Client {
|
|
|
100
100
|
'x-sdk-name': 'React Native',
|
|
101
101
|
'x-sdk-platform': 'client',
|
|
102
102
|
'x-sdk-language': 'reactnative',
|
|
103
|
-
'x-sdk-version': '0.
|
|
103
|
+
'x-sdk-version': '0.18.0',
|
|
104
104
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
105
105
|
};
|
|
106
106
|
this.realtime = {
|
|
@@ -569,22 +569,27 @@ class Account extends Service {
|
|
|
569
569
|
'content-type': 'application/json',
|
|
570
570
|
}, payload);
|
|
571
571
|
}
|
|
572
|
-
listIdentities(paramsOrFirst) {
|
|
572
|
+
listIdentities(paramsOrFirst, ...rest) {
|
|
573
573
|
let params;
|
|
574
574
|
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
575
575
|
params = (paramsOrFirst || {});
|
|
576
576
|
}
|
|
577
577
|
else {
|
|
578
578
|
params = {
|
|
579
|
-
queries: paramsOrFirst
|
|
579
|
+
queries: paramsOrFirst,
|
|
580
|
+
total: rest[0]
|
|
580
581
|
};
|
|
581
582
|
}
|
|
582
583
|
const queries = params.queries;
|
|
584
|
+
const total = params.total;
|
|
583
585
|
const apiPath = '/account/identities';
|
|
584
586
|
const payload = {};
|
|
585
587
|
if (typeof queries !== 'undefined') {
|
|
586
588
|
payload['queries'] = queries;
|
|
587
589
|
}
|
|
590
|
+
if (typeof total !== 'undefined') {
|
|
591
|
+
payload['total'] = total;
|
|
592
|
+
}
|
|
588
593
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
589
594
|
return this.client.call('get', uri, {}, payload);
|
|
590
595
|
}
|
|
@@ -623,22 +628,27 @@ class Account extends Service {
|
|
|
623
628
|
'content-type': 'application/json',
|
|
624
629
|
}, payload);
|
|
625
630
|
}
|
|
626
|
-
listLogs(paramsOrFirst) {
|
|
631
|
+
listLogs(paramsOrFirst, ...rest) {
|
|
627
632
|
let params;
|
|
628
633
|
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
629
634
|
params = (paramsOrFirst || {});
|
|
630
635
|
}
|
|
631
636
|
else {
|
|
632
637
|
params = {
|
|
633
|
-
queries: paramsOrFirst
|
|
638
|
+
queries: paramsOrFirst,
|
|
639
|
+
total: rest[0]
|
|
634
640
|
};
|
|
635
641
|
}
|
|
636
642
|
const queries = params.queries;
|
|
643
|
+
const total = params.total;
|
|
637
644
|
const apiPath = '/account/logs';
|
|
638
645
|
const payload = {};
|
|
639
646
|
if (typeof queries !== 'undefined') {
|
|
640
647
|
payload['queries'] = queries;
|
|
641
648
|
}
|
|
649
|
+
if (typeof total !== 'undefined') {
|
|
650
|
+
payload['total'] = total;
|
|
651
|
+
}
|
|
642
652
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
643
653
|
return this.client.call('get', uri, {}, payload);
|
|
644
654
|
}
|
|
@@ -2565,13 +2575,15 @@ class Databases extends Service {
|
|
|
2565
2575
|
databaseId: paramsOrFirst,
|
|
2566
2576
|
collectionId: rest[0],
|
|
2567
2577
|
queries: rest[1],
|
|
2568
|
-
transactionId: rest[2]
|
|
2578
|
+
transactionId: rest[2],
|
|
2579
|
+
total: rest[3]
|
|
2569
2580
|
};
|
|
2570
2581
|
}
|
|
2571
2582
|
const databaseId = params.databaseId;
|
|
2572
2583
|
const collectionId = params.collectionId;
|
|
2573
2584
|
const queries = params.queries;
|
|
2574
2585
|
const transactionId = params.transactionId;
|
|
2586
|
+
const total = params.total;
|
|
2575
2587
|
if (typeof databaseId === 'undefined') {
|
|
2576
2588
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2577
2589
|
}
|
|
@@ -2586,6 +2598,9 @@ class Databases extends Service {
|
|
|
2586
2598
|
if (typeof transactionId !== 'undefined') {
|
|
2587
2599
|
payload['transactionId'] = transactionId;
|
|
2588
2600
|
}
|
|
2601
|
+
if (typeof total !== 'undefined') {
|
|
2602
|
+
payload['total'] = total;
|
|
2603
|
+
}
|
|
2589
2604
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2590
2605
|
return this.client.call('get', uri, {}, payload);
|
|
2591
2606
|
}
|
|
@@ -2927,11 +2942,13 @@ class Functions extends Service {
|
|
|
2927
2942
|
else {
|
|
2928
2943
|
params = {
|
|
2929
2944
|
functionId: paramsOrFirst,
|
|
2930
|
-
queries: rest[0]
|
|
2945
|
+
queries: rest[0],
|
|
2946
|
+
total: rest[1]
|
|
2931
2947
|
};
|
|
2932
2948
|
}
|
|
2933
2949
|
const functionId = params.functionId;
|
|
2934
2950
|
const queries = params.queries;
|
|
2951
|
+
const total = params.total;
|
|
2935
2952
|
if (typeof functionId === 'undefined') {
|
|
2936
2953
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2937
2954
|
}
|
|
@@ -2940,6 +2957,9 @@ class Functions extends Service {
|
|
|
2940
2957
|
if (typeof queries !== 'undefined') {
|
|
2941
2958
|
payload['queries'] = queries;
|
|
2942
2959
|
}
|
|
2960
|
+
if (typeof total !== 'undefined') {
|
|
2961
|
+
payload['total'] = total;
|
|
2962
|
+
}
|
|
2943
2963
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2944
2964
|
return this.client.call('get', uri, {}, payload);
|
|
2945
2965
|
}
|
|
@@ -3262,12 +3282,14 @@ class Storage extends Service {
|
|
|
3262
3282
|
params = {
|
|
3263
3283
|
bucketId: paramsOrFirst,
|
|
3264
3284
|
queries: rest[0],
|
|
3265
|
-
search: rest[1]
|
|
3285
|
+
search: rest[1],
|
|
3286
|
+
total: rest[2]
|
|
3266
3287
|
};
|
|
3267
3288
|
}
|
|
3268
3289
|
const bucketId = params.bucketId;
|
|
3269
3290
|
const queries = params.queries;
|
|
3270
3291
|
const search = params.search;
|
|
3292
|
+
const total = params.total;
|
|
3271
3293
|
if (typeof bucketId === 'undefined') {
|
|
3272
3294
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
3273
3295
|
}
|
|
@@ -3279,6 +3301,9 @@ class Storage extends Service {
|
|
|
3279
3301
|
if (typeof search !== 'undefined') {
|
|
3280
3302
|
payload['search'] = search;
|
|
3281
3303
|
}
|
|
3304
|
+
if (typeof total !== 'undefined') {
|
|
3305
|
+
payload['total'] = total;
|
|
3306
|
+
}
|
|
3282
3307
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3283
3308
|
return this.client.call('get', uri, {}, payload);
|
|
3284
3309
|
}
|
|
@@ -3885,13 +3910,15 @@ class TablesDB extends Service {
|
|
|
3885
3910
|
databaseId: paramsOrFirst,
|
|
3886
3911
|
tableId: rest[0],
|
|
3887
3912
|
queries: rest[1],
|
|
3888
|
-
transactionId: rest[2]
|
|
3913
|
+
transactionId: rest[2],
|
|
3914
|
+
total: rest[3]
|
|
3889
3915
|
};
|
|
3890
3916
|
}
|
|
3891
3917
|
const databaseId = params.databaseId;
|
|
3892
3918
|
const tableId = params.tableId;
|
|
3893
3919
|
const queries = params.queries;
|
|
3894
3920
|
const transactionId = params.transactionId;
|
|
3921
|
+
const total = params.total;
|
|
3895
3922
|
if (typeof databaseId === 'undefined') {
|
|
3896
3923
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3897
3924
|
}
|
|
@@ -3906,6 +3933,9 @@ class TablesDB extends Service {
|
|
|
3906
3933
|
if (typeof transactionId !== 'undefined') {
|
|
3907
3934
|
payload['transactionId'] = transactionId;
|
|
3908
3935
|
}
|
|
3936
|
+
if (typeof total !== 'undefined') {
|
|
3937
|
+
payload['total'] = total;
|
|
3938
|
+
}
|
|
3909
3939
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3910
3940
|
return this.client.call('get', uri, {}, payload);
|
|
3911
3941
|
}
|
|
@@ -4244,11 +4274,13 @@ class Teams extends Service {
|
|
|
4244
4274
|
else {
|
|
4245
4275
|
params = {
|
|
4246
4276
|
queries: paramsOrFirst,
|
|
4247
|
-
search: rest[0]
|
|
4277
|
+
search: rest[0],
|
|
4278
|
+
total: rest[1]
|
|
4248
4279
|
};
|
|
4249
4280
|
}
|
|
4250
4281
|
const queries = params.queries;
|
|
4251
4282
|
const search = params.search;
|
|
4283
|
+
const total = params.total;
|
|
4252
4284
|
const apiPath = '/teams';
|
|
4253
4285
|
const payload = {};
|
|
4254
4286
|
if (typeof queries !== 'undefined') {
|
|
@@ -4257,6 +4289,9 @@ class Teams extends Service {
|
|
|
4257
4289
|
if (typeof search !== 'undefined') {
|
|
4258
4290
|
payload['search'] = search;
|
|
4259
4291
|
}
|
|
4292
|
+
if (typeof total !== 'undefined') {
|
|
4293
|
+
payload['total'] = total;
|
|
4294
|
+
}
|
|
4260
4295
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4261
4296
|
return this.client.call('get', uri, {}, payload);
|
|
4262
4297
|
}
|
|
@@ -4375,12 +4410,14 @@ class Teams extends Service {
|
|
|
4375
4410
|
params = {
|
|
4376
4411
|
teamId: paramsOrFirst,
|
|
4377
4412
|
queries: rest[0],
|
|
4378
|
-
search: rest[1]
|
|
4413
|
+
search: rest[1],
|
|
4414
|
+
total: rest[2]
|
|
4379
4415
|
};
|
|
4380
4416
|
}
|
|
4381
4417
|
const teamId = params.teamId;
|
|
4382
4418
|
const queries = params.queries;
|
|
4383
4419
|
const search = params.search;
|
|
4420
|
+
const total = params.total;
|
|
4384
4421
|
if (typeof teamId === 'undefined') {
|
|
4385
4422
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
4386
4423
|
}
|
|
@@ -4392,6 +4429,9 @@ class Teams extends Service {
|
|
|
4392
4429
|
if (typeof search !== 'undefined') {
|
|
4393
4430
|
payload['search'] = search;
|
|
4394
4431
|
}
|
|
4432
|
+
if (typeof total !== 'undefined') {
|
|
4433
|
+
payload['total'] = total;
|
|
4434
|
+
}
|
|
4395
4435
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4396
4436
|
return this.client.call('get', uri, {}, payload);
|
|
4397
4437
|
}
|
|
@@ -4722,14 +4762,14 @@ Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, va
|
|
|
4722
4762
|
* @param {string} value
|
|
4723
4763
|
* @returns {string}
|
|
4724
4764
|
*/
|
|
4725
|
-
Query.createdBefore = (value) =>
|
|
4765
|
+
Query.createdBefore = (value) => Query.lessThan("$createdAt", value);
|
|
4726
4766
|
/**
|
|
4727
4767
|
* Filter resources where document was created after date.
|
|
4728
4768
|
*
|
|
4729
4769
|
* @param {string} value
|
|
4730
4770
|
* @returns {string}
|
|
4731
4771
|
*/
|
|
4732
|
-
Query.createdAfter = (value) =>
|
|
4772
|
+
Query.createdAfter = (value) => Query.greaterThan("$createdAt", value);
|
|
4733
4773
|
/**
|
|
4734
4774
|
* Filter resources where document was created between dates.
|
|
4735
4775
|
*
|
|
@@ -4737,21 +4777,21 @@ Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toSt
|
|
|
4737
4777
|
* @param {string} end
|
|
4738
4778
|
* @returns {string}
|
|
4739
4779
|
*/
|
|
4740
|
-
Query.createdBetween = (start, end) =>
|
|
4780
|
+
Query.createdBetween = (start, end) => Query.between("$createdAt", start, end);
|
|
4741
4781
|
/**
|
|
4742
4782
|
* Filter resources where document was updated before date.
|
|
4743
4783
|
*
|
|
4744
4784
|
* @param {string} value
|
|
4745
4785
|
* @returns {string}
|
|
4746
4786
|
*/
|
|
4747
|
-
Query.updatedBefore = (value) =>
|
|
4787
|
+
Query.updatedBefore = (value) => Query.lessThan("$updatedAt", value);
|
|
4748
4788
|
/**
|
|
4749
4789
|
* Filter resources where document was updated after date.
|
|
4750
4790
|
*
|
|
4751
4791
|
* @param {string} value
|
|
4752
4792
|
* @returns {string}
|
|
4753
4793
|
*/
|
|
4754
|
-
Query.updatedAfter = (value) =>
|
|
4794
|
+
Query.updatedAfter = (value) => Query.greaterThan("$updatedAt", value);
|
|
4755
4795
|
/**
|
|
4756
4796
|
* Filter resources where document was updated between dates.
|
|
4757
4797
|
*
|
|
@@ -4759,7 +4799,7 @@ Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toSt
|
|
|
4759
4799
|
* @param {string} end
|
|
4760
4800
|
* @returns {string}
|
|
4761
4801
|
*/
|
|
4762
|
-
Query.updatedBetween = (start, end) =>
|
|
4802
|
+
Query.updatedBetween = (start, end) => Query.between("$updatedAt", start, end);
|
|
4763
4803
|
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
4764
4804
|
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
4765
4805
|
/**
|
|
@@ -5004,6 +5044,271 @@ _a = ID, _ID_hexTimestamp = function _ID_hexTimestamp() {
|
|
|
5004
5044
|
return hexTimestamp;
|
|
5005
5045
|
};
|
|
5006
5046
|
|
|
5047
|
+
exports.Condition = void 0;
|
|
5048
|
+
(function (Condition) {
|
|
5049
|
+
Condition["Equal"] = "equal";
|
|
5050
|
+
Condition["NotEqual"] = "notEqual";
|
|
5051
|
+
Condition["GreaterThan"] = "greaterThan";
|
|
5052
|
+
Condition["GreaterThanEqual"] = "greaterThanEqual";
|
|
5053
|
+
Condition["LessThan"] = "lessThan";
|
|
5054
|
+
Condition["LessThanEqual"] = "lessThanEqual";
|
|
5055
|
+
Condition["Contains"] = "contains";
|
|
5056
|
+
Condition["IsNull"] = "isNull";
|
|
5057
|
+
Condition["IsNotNull"] = "isNotNull";
|
|
5058
|
+
})(exports.Condition || (exports.Condition = {}));
|
|
5059
|
+
/**
|
|
5060
|
+
* Helper class to generate operator strings for atomic operations.
|
|
5061
|
+
*/
|
|
5062
|
+
class Operator {
|
|
5063
|
+
/**
|
|
5064
|
+
* Constructor for Operator class.
|
|
5065
|
+
*
|
|
5066
|
+
* @param {string} method
|
|
5067
|
+
* @param {OperatorValues} values
|
|
5068
|
+
*/
|
|
5069
|
+
constructor(method, values) {
|
|
5070
|
+
this.method = method;
|
|
5071
|
+
if (values !== undefined) {
|
|
5072
|
+
if (Array.isArray(values)) {
|
|
5073
|
+
this.values = values;
|
|
5074
|
+
}
|
|
5075
|
+
else {
|
|
5076
|
+
this.values = [values];
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
/**
|
|
5081
|
+
* Convert the operator object to a JSON string.
|
|
5082
|
+
*
|
|
5083
|
+
* @returns {string}
|
|
5084
|
+
*/
|
|
5085
|
+
toString() {
|
|
5086
|
+
return JSON.stringify({
|
|
5087
|
+
method: this.method,
|
|
5088
|
+
values: this.values,
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
/**
|
|
5093
|
+
* Increment a numeric attribute by a specified value.
|
|
5094
|
+
*
|
|
5095
|
+
* @param {number} value
|
|
5096
|
+
* @param {number} max
|
|
5097
|
+
* @returns {string}
|
|
5098
|
+
*/
|
|
5099
|
+
Operator.increment = (value = 1, max) => {
|
|
5100
|
+
if (isNaN(value) || !isFinite(value)) {
|
|
5101
|
+
throw new Error("Value cannot be NaN or Infinity");
|
|
5102
|
+
}
|
|
5103
|
+
if (max !== undefined && (isNaN(max) || !isFinite(max))) {
|
|
5104
|
+
throw new Error("Max cannot be NaN or Infinity");
|
|
5105
|
+
}
|
|
5106
|
+
const values = [value];
|
|
5107
|
+
if (max !== undefined) {
|
|
5108
|
+
values.push(max);
|
|
5109
|
+
}
|
|
5110
|
+
return new Operator("increment", values).toString();
|
|
5111
|
+
};
|
|
5112
|
+
/**
|
|
5113
|
+
* Decrement a numeric attribute by a specified value.
|
|
5114
|
+
*
|
|
5115
|
+
* @param {number} value
|
|
5116
|
+
* @param {number} min
|
|
5117
|
+
* @returns {string}
|
|
5118
|
+
*/
|
|
5119
|
+
Operator.decrement = (value = 1, min) => {
|
|
5120
|
+
if (isNaN(value) || !isFinite(value)) {
|
|
5121
|
+
throw new Error("Value cannot be NaN or Infinity");
|
|
5122
|
+
}
|
|
5123
|
+
if (min !== undefined && (isNaN(min) || !isFinite(min))) {
|
|
5124
|
+
throw new Error("Min cannot be NaN or Infinity");
|
|
5125
|
+
}
|
|
5126
|
+
const values = [value];
|
|
5127
|
+
if (min !== undefined) {
|
|
5128
|
+
values.push(min);
|
|
5129
|
+
}
|
|
5130
|
+
return new Operator("decrement", values).toString();
|
|
5131
|
+
};
|
|
5132
|
+
/**
|
|
5133
|
+
* Multiply a numeric attribute by a specified factor.
|
|
5134
|
+
*
|
|
5135
|
+
* @param {number} factor
|
|
5136
|
+
* @param {number} max
|
|
5137
|
+
* @returns {string}
|
|
5138
|
+
*/
|
|
5139
|
+
Operator.multiply = (factor, max) => {
|
|
5140
|
+
if (isNaN(factor) || !isFinite(factor)) {
|
|
5141
|
+
throw new Error("Factor cannot be NaN or Infinity");
|
|
5142
|
+
}
|
|
5143
|
+
if (max !== undefined && (isNaN(max) || !isFinite(max))) {
|
|
5144
|
+
throw new Error("Max cannot be NaN or Infinity");
|
|
5145
|
+
}
|
|
5146
|
+
const values = [factor];
|
|
5147
|
+
if (max !== undefined) {
|
|
5148
|
+
values.push(max);
|
|
5149
|
+
}
|
|
5150
|
+
return new Operator("multiply", values).toString();
|
|
5151
|
+
};
|
|
5152
|
+
/**
|
|
5153
|
+
* Divide a numeric attribute by a specified divisor.
|
|
5154
|
+
*
|
|
5155
|
+
* @param {number} divisor
|
|
5156
|
+
* @param {number} min
|
|
5157
|
+
* @returns {string}
|
|
5158
|
+
*/
|
|
5159
|
+
Operator.divide = (divisor, min) => {
|
|
5160
|
+
if (isNaN(divisor) || !isFinite(divisor)) {
|
|
5161
|
+
throw new Error("Divisor cannot be NaN or Infinity");
|
|
5162
|
+
}
|
|
5163
|
+
if (min !== undefined && (isNaN(min) || !isFinite(min))) {
|
|
5164
|
+
throw new Error("Min cannot be NaN or Infinity");
|
|
5165
|
+
}
|
|
5166
|
+
if (divisor === 0) {
|
|
5167
|
+
throw new Error("Divisor cannot be zero");
|
|
5168
|
+
}
|
|
5169
|
+
const values = [divisor];
|
|
5170
|
+
if (min !== undefined) {
|
|
5171
|
+
values.push(min);
|
|
5172
|
+
}
|
|
5173
|
+
return new Operator("divide", values).toString();
|
|
5174
|
+
};
|
|
5175
|
+
/**
|
|
5176
|
+
* Apply modulo operation on a numeric attribute.
|
|
5177
|
+
*
|
|
5178
|
+
* @param {number} divisor
|
|
5179
|
+
* @returns {string}
|
|
5180
|
+
*/
|
|
5181
|
+
Operator.modulo = (divisor) => {
|
|
5182
|
+
if (isNaN(divisor) || !isFinite(divisor)) {
|
|
5183
|
+
throw new Error("Divisor cannot be NaN or Infinity");
|
|
5184
|
+
}
|
|
5185
|
+
if (divisor === 0) {
|
|
5186
|
+
throw new Error("Divisor cannot be zero");
|
|
5187
|
+
}
|
|
5188
|
+
return new Operator("modulo", [divisor]).toString();
|
|
5189
|
+
};
|
|
5190
|
+
/**
|
|
5191
|
+
* Raise a numeric attribute to a specified power.
|
|
5192
|
+
*
|
|
5193
|
+
* @param {number} exponent
|
|
5194
|
+
* @param {number} max
|
|
5195
|
+
* @returns {string}
|
|
5196
|
+
*/
|
|
5197
|
+
Operator.power = (exponent, max) => {
|
|
5198
|
+
if (isNaN(exponent) || !isFinite(exponent)) {
|
|
5199
|
+
throw new Error("Exponent cannot be NaN or Infinity");
|
|
5200
|
+
}
|
|
5201
|
+
if (max !== undefined && (isNaN(max) || !isFinite(max))) {
|
|
5202
|
+
throw new Error("Max cannot be NaN or Infinity");
|
|
5203
|
+
}
|
|
5204
|
+
const values = [exponent];
|
|
5205
|
+
if (max !== undefined) {
|
|
5206
|
+
values.push(max);
|
|
5207
|
+
}
|
|
5208
|
+
return new Operator("power", values).toString();
|
|
5209
|
+
};
|
|
5210
|
+
/**
|
|
5211
|
+
* Append values to an array attribute.
|
|
5212
|
+
*
|
|
5213
|
+
* @param {any[]} values
|
|
5214
|
+
* @returns {string}
|
|
5215
|
+
*/
|
|
5216
|
+
Operator.arrayAppend = (values) => new Operator("arrayAppend", values).toString();
|
|
5217
|
+
/**
|
|
5218
|
+
* Prepend values to an array attribute.
|
|
5219
|
+
*
|
|
5220
|
+
* @param {any[]} values
|
|
5221
|
+
* @returns {string}
|
|
5222
|
+
*/
|
|
5223
|
+
Operator.arrayPrepend = (values) => new Operator("arrayPrepend", values).toString();
|
|
5224
|
+
/**
|
|
5225
|
+
* Insert a value at a specific index in an array attribute.
|
|
5226
|
+
*
|
|
5227
|
+
* @param {number} index
|
|
5228
|
+
* @param {any} value
|
|
5229
|
+
* @returns {string}
|
|
5230
|
+
*/
|
|
5231
|
+
Operator.arrayInsert = (index, value) => new Operator("arrayInsert", [index, value]).toString();
|
|
5232
|
+
/**
|
|
5233
|
+
* Remove a value from an array attribute.
|
|
5234
|
+
*
|
|
5235
|
+
* @param {any} value
|
|
5236
|
+
* @returns {string}
|
|
5237
|
+
*/
|
|
5238
|
+
Operator.arrayRemove = (value) => new Operator("arrayRemove", [value]).toString();
|
|
5239
|
+
/**
|
|
5240
|
+
* Remove duplicate values from an array attribute.
|
|
5241
|
+
*
|
|
5242
|
+
* @returns {string}
|
|
5243
|
+
*/
|
|
5244
|
+
Operator.arrayUnique = () => new Operator("arrayUnique", []).toString();
|
|
5245
|
+
/**
|
|
5246
|
+
* Keep only values that exist in both the current array and the provided array.
|
|
5247
|
+
*
|
|
5248
|
+
* @param {any[]} values
|
|
5249
|
+
* @returns {string}
|
|
5250
|
+
*/
|
|
5251
|
+
Operator.arrayIntersect = (values) => new Operator("arrayIntersect", values).toString();
|
|
5252
|
+
/**
|
|
5253
|
+
* Remove values from the array that exist in the provided array.
|
|
5254
|
+
*
|
|
5255
|
+
* @param {any[]} values
|
|
5256
|
+
* @returns {string}
|
|
5257
|
+
*/
|
|
5258
|
+
Operator.arrayDiff = (values) => new Operator("arrayDiff", values).toString();
|
|
5259
|
+
/**
|
|
5260
|
+
* Filter array values based on a condition.
|
|
5261
|
+
*
|
|
5262
|
+
* @param {Condition} condition
|
|
5263
|
+
* @param {any} value
|
|
5264
|
+
* @returns {string}
|
|
5265
|
+
*/
|
|
5266
|
+
Operator.arrayFilter = (condition, value) => {
|
|
5267
|
+
const values = [condition, value === undefined ? null : value];
|
|
5268
|
+
return new Operator("arrayFilter", values).toString();
|
|
5269
|
+
};
|
|
5270
|
+
/**
|
|
5271
|
+
* Concatenate a value to a string or array attribute.
|
|
5272
|
+
*
|
|
5273
|
+
* @param {any} value
|
|
5274
|
+
* @returns {string}
|
|
5275
|
+
*/
|
|
5276
|
+
Operator.stringConcat = (value) => new Operator("stringConcat", [value]).toString();
|
|
5277
|
+
/**
|
|
5278
|
+
* Replace occurrences of a search string with a replacement string.
|
|
5279
|
+
*
|
|
5280
|
+
* @param {string} search
|
|
5281
|
+
* @param {string} replace
|
|
5282
|
+
* @returns {string}
|
|
5283
|
+
*/
|
|
5284
|
+
Operator.stringReplace = (search, replace) => new Operator("stringReplace", [search, replace]).toString();
|
|
5285
|
+
/**
|
|
5286
|
+
* Toggle a boolean attribute.
|
|
5287
|
+
*
|
|
5288
|
+
* @returns {string}
|
|
5289
|
+
*/
|
|
5290
|
+
Operator.toggle = () => new Operator("toggle", []).toString();
|
|
5291
|
+
/**
|
|
5292
|
+
* Add days to a date attribute.
|
|
5293
|
+
*
|
|
5294
|
+
* @param {number} days
|
|
5295
|
+
* @returns {string}
|
|
5296
|
+
*/
|
|
5297
|
+
Operator.dateAddDays = (days) => new Operator("dateAddDays", [days]).toString();
|
|
5298
|
+
/**
|
|
5299
|
+
* Subtract days from a date attribute.
|
|
5300
|
+
*
|
|
5301
|
+
* @param {number} days
|
|
5302
|
+
* @returns {string}
|
|
5303
|
+
*/
|
|
5304
|
+
Operator.dateSubDays = (days) => new Operator("dateSubDays", [days]).toString();
|
|
5305
|
+
/**
|
|
5306
|
+
* Set a date attribute to the current date and time.
|
|
5307
|
+
*
|
|
5308
|
+
* @returns {string}
|
|
5309
|
+
*/
|
|
5310
|
+
Operator.dateSetNow = () => new Operator("dateSetNow", []).toString();
|
|
5311
|
+
|
|
5007
5312
|
exports.AuthenticatorType = void 0;
|
|
5008
5313
|
(function (AuthenticatorType) {
|
|
5009
5314
|
AuthenticatorType["Totp"] = "totp";
|
|
@@ -5334,6 +5639,22 @@ exports.ImageFormat = void 0;
|
|
|
5334
5639
|
ImageFormat["Gif"] = "gif";
|
|
5335
5640
|
})(exports.ImageFormat || (exports.ImageFormat = {}));
|
|
5336
5641
|
|
|
5642
|
+
exports.ExecutionTrigger = void 0;
|
|
5643
|
+
(function (ExecutionTrigger) {
|
|
5644
|
+
ExecutionTrigger["Http"] = "http";
|
|
5645
|
+
ExecutionTrigger["Schedule"] = "schedule";
|
|
5646
|
+
ExecutionTrigger["Event"] = "event";
|
|
5647
|
+
})(exports.ExecutionTrigger || (exports.ExecutionTrigger = {}));
|
|
5648
|
+
|
|
5649
|
+
exports.ExecutionStatus = void 0;
|
|
5650
|
+
(function (ExecutionStatus) {
|
|
5651
|
+
ExecutionStatus["Waiting"] = "waiting";
|
|
5652
|
+
ExecutionStatus["Processing"] = "processing";
|
|
5653
|
+
ExecutionStatus["Completed"] = "completed";
|
|
5654
|
+
ExecutionStatus["Failed"] = "failed";
|
|
5655
|
+
ExecutionStatus["Scheduled"] = "scheduled";
|
|
5656
|
+
})(exports.ExecutionStatus || (exports.ExecutionStatus = {}));
|
|
5657
|
+
|
|
5337
5658
|
exports.Account = Account;
|
|
5338
5659
|
exports.AppwriteException = AppwriteException;
|
|
5339
5660
|
exports.Avatars = Avatars;
|
|
@@ -5344,6 +5665,7 @@ exports.Graphql = Graphql;
|
|
|
5344
5665
|
exports.ID = ID;
|
|
5345
5666
|
exports.Locale = Locale;
|
|
5346
5667
|
exports.Messaging = Messaging;
|
|
5668
|
+
exports.Operator = Operator;
|
|
5347
5669
|
exports.Permission = Permission;
|
|
5348
5670
|
exports.Query = Query;
|
|
5349
5671
|
exports.Role = Role;
|