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/dist/esm/sdk.js
CHANGED
|
@@ -78,7 +78,7 @@ class Client {
|
|
|
78
78
|
'x-sdk-name': 'React Native',
|
|
79
79
|
'x-sdk-platform': 'client',
|
|
80
80
|
'x-sdk-language': 'reactnative',
|
|
81
|
-
'x-sdk-version': '0.
|
|
81
|
+
'x-sdk-version': '0.18.0',
|
|
82
82
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
83
83
|
};
|
|
84
84
|
this.realtime = {
|
|
@@ -547,22 +547,27 @@ class Account extends Service {
|
|
|
547
547
|
'content-type': 'application/json',
|
|
548
548
|
}, payload);
|
|
549
549
|
}
|
|
550
|
-
listIdentities(paramsOrFirst) {
|
|
550
|
+
listIdentities(paramsOrFirst, ...rest) {
|
|
551
551
|
let params;
|
|
552
552
|
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
553
553
|
params = (paramsOrFirst || {});
|
|
554
554
|
}
|
|
555
555
|
else {
|
|
556
556
|
params = {
|
|
557
|
-
queries: paramsOrFirst
|
|
557
|
+
queries: paramsOrFirst,
|
|
558
|
+
total: rest[0]
|
|
558
559
|
};
|
|
559
560
|
}
|
|
560
561
|
const queries = params.queries;
|
|
562
|
+
const total = params.total;
|
|
561
563
|
const apiPath = '/account/identities';
|
|
562
564
|
const payload = {};
|
|
563
565
|
if (typeof queries !== 'undefined') {
|
|
564
566
|
payload['queries'] = queries;
|
|
565
567
|
}
|
|
568
|
+
if (typeof total !== 'undefined') {
|
|
569
|
+
payload['total'] = total;
|
|
570
|
+
}
|
|
566
571
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
567
572
|
return this.client.call('get', uri, {}, payload);
|
|
568
573
|
}
|
|
@@ -601,22 +606,27 @@ class Account extends Service {
|
|
|
601
606
|
'content-type': 'application/json',
|
|
602
607
|
}, payload);
|
|
603
608
|
}
|
|
604
|
-
listLogs(paramsOrFirst) {
|
|
609
|
+
listLogs(paramsOrFirst, ...rest) {
|
|
605
610
|
let params;
|
|
606
611
|
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
607
612
|
params = (paramsOrFirst || {});
|
|
608
613
|
}
|
|
609
614
|
else {
|
|
610
615
|
params = {
|
|
611
|
-
queries: paramsOrFirst
|
|
616
|
+
queries: paramsOrFirst,
|
|
617
|
+
total: rest[0]
|
|
612
618
|
};
|
|
613
619
|
}
|
|
614
620
|
const queries = params.queries;
|
|
621
|
+
const total = params.total;
|
|
615
622
|
const apiPath = '/account/logs';
|
|
616
623
|
const payload = {};
|
|
617
624
|
if (typeof queries !== 'undefined') {
|
|
618
625
|
payload['queries'] = queries;
|
|
619
626
|
}
|
|
627
|
+
if (typeof total !== 'undefined') {
|
|
628
|
+
payload['total'] = total;
|
|
629
|
+
}
|
|
620
630
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
621
631
|
return this.client.call('get', uri, {}, payload);
|
|
622
632
|
}
|
|
@@ -2543,13 +2553,15 @@ class Databases extends Service {
|
|
|
2543
2553
|
databaseId: paramsOrFirst,
|
|
2544
2554
|
collectionId: rest[0],
|
|
2545
2555
|
queries: rest[1],
|
|
2546
|
-
transactionId: rest[2]
|
|
2556
|
+
transactionId: rest[2],
|
|
2557
|
+
total: rest[3]
|
|
2547
2558
|
};
|
|
2548
2559
|
}
|
|
2549
2560
|
const databaseId = params.databaseId;
|
|
2550
2561
|
const collectionId = params.collectionId;
|
|
2551
2562
|
const queries = params.queries;
|
|
2552
2563
|
const transactionId = params.transactionId;
|
|
2564
|
+
const total = params.total;
|
|
2553
2565
|
if (typeof databaseId === 'undefined') {
|
|
2554
2566
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2555
2567
|
}
|
|
@@ -2564,6 +2576,9 @@ class Databases extends Service {
|
|
|
2564
2576
|
if (typeof transactionId !== 'undefined') {
|
|
2565
2577
|
payload['transactionId'] = transactionId;
|
|
2566
2578
|
}
|
|
2579
|
+
if (typeof total !== 'undefined') {
|
|
2580
|
+
payload['total'] = total;
|
|
2581
|
+
}
|
|
2567
2582
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2568
2583
|
return this.client.call('get', uri, {}, payload);
|
|
2569
2584
|
}
|
|
@@ -2905,11 +2920,13 @@ class Functions extends Service {
|
|
|
2905
2920
|
else {
|
|
2906
2921
|
params = {
|
|
2907
2922
|
functionId: paramsOrFirst,
|
|
2908
|
-
queries: rest[0]
|
|
2923
|
+
queries: rest[0],
|
|
2924
|
+
total: rest[1]
|
|
2909
2925
|
};
|
|
2910
2926
|
}
|
|
2911
2927
|
const functionId = params.functionId;
|
|
2912
2928
|
const queries = params.queries;
|
|
2929
|
+
const total = params.total;
|
|
2913
2930
|
if (typeof functionId === 'undefined') {
|
|
2914
2931
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2915
2932
|
}
|
|
@@ -2918,6 +2935,9 @@ class Functions extends Service {
|
|
|
2918
2935
|
if (typeof queries !== 'undefined') {
|
|
2919
2936
|
payload['queries'] = queries;
|
|
2920
2937
|
}
|
|
2938
|
+
if (typeof total !== 'undefined') {
|
|
2939
|
+
payload['total'] = total;
|
|
2940
|
+
}
|
|
2921
2941
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2922
2942
|
return this.client.call('get', uri, {}, payload);
|
|
2923
2943
|
}
|
|
@@ -3240,12 +3260,14 @@ class Storage extends Service {
|
|
|
3240
3260
|
params = {
|
|
3241
3261
|
bucketId: paramsOrFirst,
|
|
3242
3262
|
queries: rest[0],
|
|
3243
|
-
search: rest[1]
|
|
3263
|
+
search: rest[1],
|
|
3264
|
+
total: rest[2]
|
|
3244
3265
|
};
|
|
3245
3266
|
}
|
|
3246
3267
|
const bucketId = params.bucketId;
|
|
3247
3268
|
const queries = params.queries;
|
|
3248
3269
|
const search = params.search;
|
|
3270
|
+
const total = params.total;
|
|
3249
3271
|
if (typeof bucketId === 'undefined') {
|
|
3250
3272
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
3251
3273
|
}
|
|
@@ -3257,6 +3279,9 @@ class Storage extends Service {
|
|
|
3257
3279
|
if (typeof search !== 'undefined') {
|
|
3258
3280
|
payload['search'] = search;
|
|
3259
3281
|
}
|
|
3282
|
+
if (typeof total !== 'undefined') {
|
|
3283
|
+
payload['total'] = total;
|
|
3284
|
+
}
|
|
3260
3285
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3261
3286
|
return this.client.call('get', uri, {}, payload);
|
|
3262
3287
|
}
|
|
@@ -3863,13 +3888,15 @@ class TablesDB extends Service {
|
|
|
3863
3888
|
databaseId: paramsOrFirst,
|
|
3864
3889
|
tableId: rest[0],
|
|
3865
3890
|
queries: rest[1],
|
|
3866
|
-
transactionId: rest[2]
|
|
3891
|
+
transactionId: rest[2],
|
|
3892
|
+
total: rest[3]
|
|
3867
3893
|
};
|
|
3868
3894
|
}
|
|
3869
3895
|
const databaseId = params.databaseId;
|
|
3870
3896
|
const tableId = params.tableId;
|
|
3871
3897
|
const queries = params.queries;
|
|
3872
3898
|
const transactionId = params.transactionId;
|
|
3899
|
+
const total = params.total;
|
|
3873
3900
|
if (typeof databaseId === 'undefined') {
|
|
3874
3901
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3875
3902
|
}
|
|
@@ -3884,6 +3911,9 @@ class TablesDB extends Service {
|
|
|
3884
3911
|
if (typeof transactionId !== 'undefined') {
|
|
3885
3912
|
payload['transactionId'] = transactionId;
|
|
3886
3913
|
}
|
|
3914
|
+
if (typeof total !== 'undefined') {
|
|
3915
|
+
payload['total'] = total;
|
|
3916
|
+
}
|
|
3887
3917
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3888
3918
|
return this.client.call('get', uri, {}, payload);
|
|
3889
3919
|
}
|
|
@@ -4222,11 +4252,13 @@ class Teams extends Service {
|
|
|
4222
4252
|
else {
|
|
4223
4253
|
params = {
|
|
4224
4254
|
queries: paramsOrFirst,
|
|
4225
|
-
search: rest[0]
|
|
4255
|
+
search: rest[0],
|
|
4256
|
+
total: rest[1]
|
|
4226
4257
|
};
|
|
4227
4258
|
}
|
|
4228
4259
|
const queries = params.queries;
|
|
4229
4260
|
const search = params.search;
|
|
4261
|
+
const total = params.total;
|
|
4230
4262
|
const apiPath = '/teams';
|
|
4231
4263
|
const payload = {};
|
|
4232
4264
|
if (typeof queries !== 'undefined') {
|
|
@@ -4235,6 +4267,9 @@ class Teams extends Service {
|
|
|
4235
4267
|
if (typeof search !== 'undefined') {
|
|
4236
4268
|
payload['search'] = search;
|
|
4237
4269
|
}
|
|
4270
|
+
if (typeof total !== 'undefined') {
|
|
4271
|
+
payload['total'] = total;
|
|
4272
|
+
}
|
|
4238
4273
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4239
4274
|
return this.client.call('get', uri, {}, payload);
|
|
4240
4275
|
}
|
|
@@ -4353,12 +4388,14 @@ class Teams extends Service {
|
|
|
4353
4388
|
params = {
|
|
4354
4389
|
teamId: paramsOrFirst,
|
|
4355
4390
|
queries: rest[0],
|
|
4356
|
-
search: rest[1]
|
|
4391
|
+
search: rest[1],
|
|
4392
|
+
total: rest[2]
|
|
4357
4393
|
};
|
|
4358
4394
|
}
|
|
4359
4395
|
const teamId = params.teamId;
|
|
4360
4396
|
const queries = params.queries;
|
|
4361
4397
|
const search = params.search;
|
|
4398
|
+
const total = params.total;
|
|
4362
4399
|
if (typeof teamId === 'undefined') {
|
|
4363
4400
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
4364
4401
|
}
|
|
@@ -4370,6 +4407,9 @@ class Teams extends Service {
|
|
|
4370
4407
|
if (typeof search !== 'undefined') {
|
|
4371
4408
|
payload['search'] = search;
|
|
4372
4409
|
}
|
|
4410
|
+
if (typeof total !== 'undefined') {
|
|
4411
|
+
payload['total'] = total;
|
|
4412
|
+
}
|
|
4373
4413
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
4374
4414
|
return this.client.call('get', uri, {}, payload);
|
|
4375
4415
|
}
|
|
@@ -4700,14 +4740,14 @@ Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, va
|
|
|
4700
4740
|
* @param {string} value
|
|
4701
4741
|
* @returns {string}
|
|
4702
4742
|
*/
|
|
4703
|
-
Query.createdBefore = (value) =>
|
|
4743
|
+
Query.createdBefore = (value) => Query.lessThan("$createdAt", value);
|
|
4704
4744
|
/**
|
|
4705
4745
|
* Filter resources where document was created after date.
|
|
4706
4746
|
*
|
|
4707
4747
|
* @param {string} value
|
|
4708
4748
|
* @returns {string}
|
|
4709
4749
|
*/
|
|
4710
|
-
Query.createdAfter = (value) =>
|
|
4750
|
+
Query.createdAfter = (value) => Query.greaterThan("$createdAt", value);
|
|
4711
4751
|
/**
|
|
4712
4752
|
* Filter resources where document was created between dates.
|
|
4713
4753
|
*
|
|
@@ -4715,21 +4755,21 @@ Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toSt
|
|
|
4715
4755
|
* @param {string} end
|
|
4716
4756
|
* @returns {string}
|
|
4717
4757
|
*/
|
|
4718
|
-
Query.createdBetween = (start, end) =>
|
|
4758
|
+
Query.createdBetween = (start, end) => Query.between("$createdAt", start, end);
|
|
4719
4759
|
/**
|
|
4720
4760
|
* Filter resources where document was updated before date.
|
|
4721
4761
|
*
|
|
4722
4762
|
* @param {string} value
|
|
4723
4763
|
* @returns {string}
|
|
4724
4764
|
*/
|
|
4725
|
-
Query.updatedBefore = (value) =>
|
|
4765
|
+
Query.updatedBefore = (value) => Query.lessThan("$updatedAt", value);
|
|
4726
4766
|
/**
|
|
4727
4767
|
* Filter resources where document was updated after date.
|
|
4728
4768
|
*
|
|
4729
4769
|
* @param {string} value
|
|
4730
4770
|
* @returns {string}
|
|
4731
4771
|
*/
|
|
4732
|
-
Query.updatedAfter = (value) =>
|
|
4772
|
+
Query.updatedAfter = (value) => Query.greaterThan("$updatedAt", value);
|
|
4733
4773
|
/**
|
|
4734
4774
|
* Filter resources where document was updated between dates.
|
|
4735
4775
|
*
|
|
@@ -4737,7 +4777,7 @@ Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toSt
|
|
|
4737
4777
|
* @param {string} end
|
|
4738
4778
|
* @returns {string}
|
|
4739
4779
|
*/
|
|
4740
|
-
Query.updatedBetween = (start, end) =>
|
|
4780
|
+
Query.updatedBetween = (start, end) => Query.between("$updatedAt", start, end);
|
|
4741
4781
|
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
4742
4782
|
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
4743
4783
|
/**
|
|
@@ -4982,6 +5022,271 @@ _a = ID, _ID_hexTimestamp = function _ID_hexTimestamp() {
|
|
|
4982
5022
|
return hexTimestamp;
|
|
4983
5023
|
};
|
|
4984
5024
|
|
|
5025
|
+
var Condition;
|
|
5026
|
+
(function (Condition) {
|
|
5027
|
+
Condition["Equal"] = "equal";
|
|
5028
|
+
Condition["NotEqual"] = "notEqual";
|
|
5029
|
+
Condition["GreaterThan"] = "greaterThan";
|
|
5030
|
+
Condition["GreaterThanEqual"] = "greaterThanEqual";
|
|
5031
|
+
Condition["LessThan"] = "lessThan";
|
|
5032
|
+
Condition["LessThanEqual"] = "lessThanEqual";
|
|
5033
|
+
Condition["Contains"] = "contains";
|
|
5034
|
+
Condition["IsNull"] = "isNull";
|
|
5035
|
+
Condition["IsNotNull"] = "isNotNull";
|
|
5036
|
+
})(Condition || (Condition = {}));
|
|
5037
|
+
/**
|
|
5038
|
+
* Helper class to generate operator strings for atomic operations.
|
|
5039
|
+
*/
|
|
5040
|
+
class Operator {
|
|
5041
|
+
/**
|
|
5042
|
+
* Constructor for Operator class.
|
|
5043
|
+
*
|
|
5044
|
+
* @param {string} method
|
|
5045
|
+
* @param {OperatorValues} values
|
|
5046
|
+
*/
|
|
5047
|
+
constructor(method, values) {
|
|
5048
|
+
this.method = method;
|
|
5049
|
+
if (values !== undefined) {
|
|
5050
|
+
if (Array.isArray(values)) {
|
|
5051
|
+
this.values = values;
|
|
5052
|
+
}
|
|
5053
|
+
else {
|
|
5054
|
+
this.values = [values];
|
|
5055
|
+
}
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5058
|
+
/**
|
|
5059
|
+
* Convert the operator object to a JSON string.
|
|
5060
|
+
*
|
|
5061
|
+
* @returns {string}
|
|
5062
|
+
*/
|
|
5063
|
+
toString() {
|
|
5064
|
+
return JSON.stringify({
|
|
5065
|
+
method: this.method,
|
|
5066
|
+
values: this.values,
|
|
5067
|
+
});
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
/**
|
|
5071
|
+
* Increment a numeric attribute by a specified value.
|
|
5072
|
+
*
|
|
5073
|
+
* @param {number} value
|
|
5074
|
+
* @param {number} max
|
|
5075
|
+
* @returns {string}
|
|
5076
|
+
*/
|
|
5077
|
+
Operator.increment = (value = 1, max) => {
|
|
5078
|
+
if (isNaN(value) || !isFinite(value)) {
|
|
5079
|
+
throw new Error("Value cannot be NaN or Infinity");
|
|
5080
|
+
}
|
|
5081
|
+
if (max !== undefined && (isNaN(max) || !isFinite(max))) {
|
|
5082
|
+
throw new Error("Max cannot be NaN or Infinity");
|
|
5083
|
+
}
|
|
5084
|
+
const values = [value];
|
|
5085
|
+
if (max !== undefined) {
|
|
5086
|
+
values.push(max);
|
|
5087
|
+
}
|
|
5088
|
+
return new Operator("increment", values).toString();
|
|
5089
|
+
};
|
|
5090
|
+
/**
|
|
5091
|
+
* Decrement a numeric attribute by a specified value.
|
|
5092
|
+
*
|
|
5093
|
+
* @param {number} value
|
|
5094
|
+
* @param {number} min
|
|
5095
|
+
* @returns {string}
|
|
5096
|
+
*/
|
|
5097
|
+
Operator.decrement = (value = 1, min) => {
|
|
5098
|
+
if (isNaN(value) || !isFinite(value)) {
|
|
5099
|
+
throw new Error("Value cannot be NaN or Infinity");
|
|
5100
|
+
}
|
|
5101
|
+
if (min !== undefined && (isNaN(min) || !isFinite(min))) {
|
|
5102
|
+
throw new Error("Min cannot be NaN or Infinity");
|
|
5103
|
+
}
|
|
5104
|
+
const values = [value];
|
|
5105
|
+
if (min !== undefined) {
|
|
5106
|
+
values.push(min);
|
|
5107
|
+
}
|
|
5108
|
+
return new Operator("decrement", values).toString();
|
|
5109
|
+
};
|
|
5110
|
+
/**
|
|
5111
|
+
* Multiply a numeric attribute by a specified factor.
|
|
5112
|
+
*
|
|
5113
|
+
* @param {number} factor
|
|
5114
|
+
* @param {number} max
|
|
5115
|
+
* @returns {string}
|
|
5116
|
+
*/
|
|
5117
|
+
Operator.multiply = (factor, max) => {
|
|
5118
|
+
if (isNaN(factor) || !isFinite(factor)) {
|
|
5119
|
+
throw new Error("Factor cannot be NaN or Infinity");
|
|
5120
|
+
}
|
|
5121
|
+
if (max !== undefined && (isNaN(max) || !isFinite(max))) {
|
|
5122
|
+
throw new Error("Max cannot be NaN or Infinity");
|
|
5123
|
+
}
|
|
5124
|
+
const values = [factor];
|
|
5125
|
+
if (max !== undefined) {
|
|
5126
|
+
values.push(max);
|
|
5127
|
+
}
|
|
5128
|
+
return new Operator("multiply", values).toString();
|
|
5129
|
+
};
|
|
5130
|
+
/**
|
|
5131
|
+
* Divide a numeric attribute by a specified divisor.
|
|
5132
|
+
*
|
|
5133
|
+
* @param {number} divisor
|
|
5134
|
+
* @param {number} min
|
|
5135
|
+
* @returns {string}
|
|
5136
|
+
*/
|
|
5137
|
+
Operator.divide = (divisor, min) => {
|
|
5138
|
+
if (isNaN(divisor) || !isFinite(divisor)) {
|
|
5139
|
+
throw new Error("Divisor cannot be NaN or Infinity");
|
|
5140
|
+
}
|
|
5141
|
+
if (min !== undefined && (isNaN(min) || !isFinite(min))) {
|
|
5142
|
+
throw new Error("Min cannot be NaN or Infinity");
|
|
5143
|
+
}
|
|
5144
|
+
if (divisor === 0) {
|
|
5145
|
+
throw new Error("Divisor cannot be zero");
|
|
5146
|
+
}
|
|
5147
|
+
const values = [divisor];
|
|
5148
|
+
if (min !== undefined) {
|
|
5149
|
+
values.push(min);
|
|
5150
|
+
}
|
|
5151
|
+
return new Operator("divide", values).toString();
|
|
5152
|
+
};
|
|
5153
|
+
/**
|
|
5154
|
+
* Apply modulo operation on a numeric attribute.
|
|
5155
|
+
*
|
|
5156
|
+
* @param {number} divisor
|
|
5157
|
+
* @returns {string}
|
|
5158
|
+
*/
|
|
5159
|
+
Operator.modulo = (divisor) => {
|
|
5160
|
+
if (isNaN(divisor) || !isFinite(divisor)) {
|
|
5161
|
+
throw new Error("Divisor cannot be NaN or Infinity");
|
|
5162
|
+
}
|
|
5163
|
+
if (divisor === 0) {
|
|
5164
|
+
throw new Error("Divisor cannot be zero");
|
|
5165
|
+
}
|
|
5166
|
+
return new Operator("modulo", [divisor]).toString();
|
|
5167
|
+
};
|
|
5168
|
+
/**
|
|
5169
|
+
* Raise a numeric attribute to a specified power.
|
|
5170
|
+
*
|
|
5171
|
+
* @param {number} exponent
|
|
5172
|
+
* @param {number} max
|
|
5173
|
+
* @returns {string}
|
|
5174
|
+
*/
|
|
5175
|
+
Operator.power = (exponent, max) => {
|
|
5176
|
+
if (isNaN(exponent) || !isFinite(exponent)) {
|
|
5177
|
+
throw new Error("Exponent cannot be NaN or Infinity");
|
|
5178
|
+
}
|
|
5179
|
+
if (max !== undefined && (isNaN(max) || !isFinite(max))) {
|
|
5180
|
+
throw new Error("Max cannot be NaN or Infinity");
|
|
5181
|
+
}
|
|
5182
|
+
const values = [exponent];
|
|
5183
|
+
if (max !== undefined) {
|
|
5184
|
+
values.push(max);
|
|
5185
|
+
}
|
|
5186
|
+
return new Operator("power", values).toString();
|
|
5187
|
+
};
|
|
5188
|
+
/**
|
|
5189
|
+
* Append values to an array attribute.
|
|
5190
|
+
*
|
|
5191
|
+
* @param {any[]} values
|
|
5192
|
+
* @returns {string}
|
|
5193
|
+
*/
|
|
5194
|
+
Operator.arrayAppend = (values) => new Operator("arrayAppend", values).toString();
|
|
5195
|
+
/**
|
|
5196
|
+
* Prepend values to an array attribute.
|
|
5197
|
+
*
|
|
5198
|
+
* @param {any[]} values
|
|
5199
|
+
* @returns {string}
|
|
5200
|
+
*/
|
|
5201
|
+
Operator.arrayPrepend = (values) => new Operator("arrayPrepend", values).toString();
|
|
5202
|
+
/**
|
|
5203
|
+
* Insert a value at a specific index in an array attribute.
|
|
5204
|
+
*
|
|
5205
|
+
* @param {number} index
|
|
5206
|
+
* @param {any} value
|
|
5207
|
+
* @returns {string}
|
|
5208
|
+
*/
|
|
5209
|
+
Operator.arrayInsert = (index, value) => new Operator("arrayInsert", [index, value]).toString();
|
|
5210
|
+
/**
|
|
5211
|
+
* Remove a value from an array attribute.
|
|
5212
|
+
*
|
|
5213
|
+
* @param {any} value
|
|
5214
|
+
* @returns {string}
|
|
5215
|
+
*/
|
|
5216
|
+
Operator.arrayRemove = (value) => new Operator("arrayRemove", [value]).toString();
|
|
5217
|
+
/**
|
|
5218
|
+
* Remove duplicate values from an array attribute.
|
|
5219
|
+
*
|
|
5220
|
+
* @returns {string}
|
|
5221
|
+
*/
|
|
5222
|
+
Operator.arrayUnique = () => new Operator("arrayUnique", []).toString();
|
|
5223
|
+
/**
|
|
5224
|
+
* Keep only values that exist in both the current array and the provided array.
|
|
5225
|
+
*
|
|
5226
|
+
* @param {any[]} values
|
|
5227
|
+
* @returns {string}
|
|
5228
|
+
*/
|
|
5229
|
+
Operator.arrayIntersect = (values) => new Operator("arrayIntersect", values).toString();
|
|
5230
|
+
/**
|
|
5231
|
+
* Remove values from the array that exist in the provided array.
|
|
5232
|
+
*
|
|
5233
|
+
* @param {any[]} values
|
|
5234
|
+
* @returns {string}
|
|
5235
|
+
*/
|
|
5236
|
+
Operator.arrayDiff = (values) => new Operator("arrayDiff", values).toString();
|
|
5237
|
+
/**
|
|
5238
|
+
* Filter array values based on a condition.
|
|
5239
|
+
*
|
|
5240
|
+
* @param {Condition} condition
|
|
5241
|
+
* @param {any} value
|
|
5242
|
+
* @returns {string}
|
|
5243
|
+
*/
|
|
5244
|
+
Operator.arrayFilter = (condition, value) => {
|
|
5245
|
+
const values = [condition, value === undefined ? null : value];
|
|
5246
|
+
return new Operator("arrayFilter", values).toString();
|
|
5247
|
+
};
|
|
5248
|
+
/**
|
|
5249
|
+
* Concatenate a value to a string or array attribute.
|
|
5250
|
+
*
|
|
5251
|
+
* @param {any} value
|
|
5252
|
+
* @returns {string}
|
|
5253
|
+
*/
|
|
5254
|
+
Operator.stringConcat = (value) => new Operator("stringConcat", [value]).toString();
|
|
5255
|
+
/**
|
|
5256
|
+
* Replace occurrences of a search string with a replacement string.
|
|
5257
|
+
*
|
|
5258
|
+
* @param {string} search
|
|
5259
|
+
* @param {string} replace
|
|
5260
|
+
* @returns {string}
|
|
5261
|
+
*/
|
|
5262
|
+
Operator.stringReplace = (search, replace) => new Operator("stringReplace", [search, replace]).toString();
|
|
5263
|
+
/**
|
|
5264
|
+
* Toggle a boolean attribute.
|
|
5265
|
+
*
|
|
5266
|
+
* @returns {string}
|
|
5267
|
+
*/
|
|
5268
|
+
Operator.toggle = () => new Operator("toggle", []).toString();
|
|
5269
|
+
/**
|
|
5270
|
+
* Add days to a date attribute.
|
|
5271
|
+
*
|
|
5272
|
+
* @param {number} days
|
|
5273
|
+
* @returns {string}
|
|
5274
|
+
*/
|
|
5275
|
+
Operator.dateAddDays = (days) => new Operator("dateAddDays", [days]).toString();
|
|
5276
|
+
/**
|
|
5277
|
+
* Subtract days from a date attribute.
|
|
5278
|
+
*
|
|
5279
|
+
* @param {number} days
|
|
5280
|
+
* @returns {string}
|
|
5281
|
+
*/
|
|
5282
|
+
Operator.dateSubDays = (days) => new Operator("dateSubDays", [days]).toString();
|
|
5283
|
+
/**
|
|
5284
|
+
* Set a date attribute to the current date and time.
|
|
5285
|
+
*
|
|
5286
|
+
* @returns {string}
|
|
5287
|
+
*/
|
|
5288
|
+
Operator.dateSetNow = () => new Operator("dateSetNow", []).toString();
|
|
5289
|
+
|
|
4985
5290
|
var AuthenticatorType;
|
|
4986
5291
|
(function (AuthenticatorType) {
|
|
4987
5292
|
AuthenticatorType["Totp"] = "totp";
|
|
@@ -5312,5 +5617,21 @@ var ImageFormat;
|
|
|
5312
5617
|
ImageFormat["Gif"] = "gif";
|
|
5313
5618
|
})(ImageFormat || (ImageFormat = {}));
|
|
5314
5619
|
|
|
5315
|
-
|
|
5620
|
+
var ExecutionTrigger;
|
|
5621
|
+
(function (ExecutionTrigger) {
|
|
5622
|
+
ExecutionTrigger["Http"] = "http";
|
|
5623
|
+
ExecutionTrigger["Schedule"] = "schedule";
|
|
5624
|
+
ExecutionTrigger["Event"] = "event";
|
|
5625
|
+
})(ExecutionTrigger || (ExecutionTrigger = {}));
|
|
5626
|
+
|
|
5627
|
+
var ExecutionStatus;
|
|
5628
|
+
(function (ExecutionStatus) {
|
|
5629
|
+
ExecutionStatus["Waiting"] = "waiting";
|
|
5630
|
+
ExecutionStatus["Processing"] = "processing";
|
|
5631
|
+
ExecutionStatus["Completed"] = "completed";
|
|
5632
|
+
ExecutionStatus["Failed"] = "failed";
|
|
5633
|
+
ExecutionStatus["Scheduled"] = "scheduled";
|
|
5634
|
+
})(ExecutionStatus || (ExecutionStatus = {}));
|
|
5635
|
+
|
|
5636
|
+
export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, Condition, CreditCard, Databases, ExecutionMethod, ExecutionStatus, ExecutionTrigger, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Operator, Permission, Query, Role, Storage, TablesDB, Teams };
|
|
5316
5637
|
//# sourceMappingURL=sdk.js.map
|