react-native-appwrite 0.19.0 → 0.20.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/.github/workflows/publish.yml +9 -8
- package/CHANGELOG.md +6 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/cjs/sdk.js +223 -44
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +219 -45
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-anonymous-session.md +2 -0
- package/docs/examples/account/create-email-password-session.md +2 -0
- package/docs/examples/account/create-email-token.md +2 -0
- package/docs/examples/account/create-email-verification.md +2 -0
- package/docs/examples/account/create-jwt.md +5 -1
- package/docs/examples/account/create-magic-url-token.md +2 -0
- package/docs/examples/account/create-mfa-authenticator.md +2 -0
- package/docs/examples/account/create-mfa-challenge.md +2 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +2 -0
- package/docs/examples/account/create-o-auth-2-session.md +2 -0
- package/docs/examples/account/create-o-auth-2-token.md +2 -0
- package/docs/examples/account/create-phone-token.md +2 -0
- package/docs/examples/account/create-phone-verification.md +2 -0
- package/docs/examples/account/create-push-target.md +2 -0
- package/docs/examples/account/create-recovery.md +2 -0
- package/docs/examples/account/create-session.md +2 -0
- package/docs/examples/account/create-verification.md +2 -0
- package/docs/examples/account/create.md +2 -0
- package/docs/examples/account/delete-identity.md +2 -0
- package/docs/examples/account/delete-mfa-authenticator.md +2 -0
- package/docs/examples/account/delete-push-target.md +2 -0
- package/docs/examples/account/delete-session.md +2 -0
- package/docs/examples/account/delete-sessions.md +2 -0
- package/docs/examples/account/get-mfa-recovery-codes.md +2 -0
- package/docs/examples/account/get-prefs.md +2 -0
- package/docs/examples/account/get-session.md +2 -0
- package/docs/examples/account/get.md +2 -0
- package/docs/examples/account/list-identities.md +2 -0
- package/docs/examples/account/list-logs.md +2 -0
- package/docs/examples/account/list-mfa-factors.md +2 -0
- package/docs/examples/account/list-sessions.md +2 -0
- package/docs/examples/account/update-email-verification.md +2 -0
- package/docs/examples/account/update-email.md +2 -0
- package/docs/examples/account/update-magic-url-session.md +2 -0
- package/docs/examples/account/update-mfa-authenticator.md +2 -0
- package/docs/examples/account/update-mfa-challenge.md +2 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +2 -0
- package/docs/examples/account/update-mfa.md +2 -0
- package/docs/examples/account/update-name.md +2 -0
- package/docs/examples/account/update-password.md +2 -0
- package/docs/examples/account/update-phone-session.md +2 -0
- package/docs/examples/account/update-phone-verification.md +2 -0
- package/docs/examples/account/update-phone.md +2 -0
- package/docs/examples/account/update-prefs.md +2 -0
- package/docs/examples/account/update-push-target.md +2 -0
- package/docs/examples/account/update-recovery.md +2 -0
- package/docs/examples/account/update-session.md +2 -0
- package/docs/examples/account/update-status.md +2 -0
- package/docs/examples/account/update-verification.md +2 -0
- package/docs/examples/avatars/get-browser.md +2 -0
- package/docs/examples/avatars/get-credit-card.md +2 -0
- package/docs/examples/avatars/get-favicon.md +2 -0
- package/docs/examples/avatars/get-flag.md +2 -0
- package/docs/examples/avatars/get-image.md +2 -0
- package/docs/examples/avatars/get-initials.md +2 -0
- package/docs/examples/avatars/get-qr.md +2 -0
- package/docs/examples/avatars/get-screenshot.md +7 -5
- package/docs/examples/databases/create-document.md +2 -0
- package/docs/examples/databases/create-operations.md +2 -0
- package/docs/examples/databases/create-transaction.md +2 -0
- package/docs/examples/databases/decrement-document-attribute.md +2 -0
- package/docs/examples/databases/delete-document.md +2 -0
- package/docs/examples/databases/delete-transaction.md +2 -0
- package/docs/examples/databases/get-document.md +2 -0
- package/docs/examples/databases/get-transaction.md +2 -0
- package/docs/examples/databases/increment-document-attribute.md +2 -0
- package/docs/examples/databases/list-documents.md +2 -0
- package/docs/examples/databases/list-transactions.md +2 -0
- package/docs/examples/databases/update-document.md +9 -1
- package/docs/examples/databases/update-transaction.md +2 -0
- package/docs/examples/databases/upsert-document.md +9 -1
- package/docs/examples/functions/create-execution.md +2 -0
- package/docs/examples/functions/get-execution.md +2 -0
- package/docs/examples/functions/list-executions.md +2 -0
- package/docs/examples/graphql/mutation.md +2 -0
- package/docs/examples/graphql/query.md +2 -0
- package/docs/examples/locale/get.md +2 -0
- package/docs/examples/locale/list-codes.md +2 -0
- package/docs/examples/locale/list-continents.md +2 -0
- package/docs/examples/locale/list-countries-eu.md +2 -0
- package/docs/examples/locale/list-countries-phones.md +2 -0
- package/docs/examples/locale/list-countries.md +2 -0
- package/docs/examples/locale/list-currencies.md +2 -0
- package/docs/examples/locale/list-languages.md +2 -0
- package/docs/examples/messaging/create-subscriber.md +2 -0
- package/docs/examples/messaging/delete-subscriber.md +2 -0
- package/docs/examples/storage/create-file.md +2 -0
- package/docs/examples/storage/delete-file.md +2 -0
- package/docs/examples/storage/get-file-download.md +2 -0
- package/docs/examples/storage/get-file-preview.md +2 -0
- package/docs/examples/storage/get-file-view.md +2 -0
- package/docs/examples/storage/get-file.md +2 -0
- package/docs/examples/storage/list-files.md +2 -0
- package/docs/examples/storage/update-file.md +2 -0
- package/docs/examples/tablesdb/create-operations.md +2 -0
- package/docs/examples/tablesdb/create-row.md +2 -0
- package/docs/examples/tablesdb/create-transaction.md +2 -0
- package/docs/examples/tablesdb/decrement-row-column.md +2 -0
- package/docs/examples/tablesdb/delete-row.md +2 -0
- package/docs/examples/tablesdb/delete-transaction.md +2 -0
- package/docs/examples/tablesdb/get-row.md +2 -0
- package/docs/examples/tablesdb/get-transaction.md +2 -0
- package/docs/examples/tablesdb/increment-row-column.md +2 -0
- package/docs/examples/tablesdb/list-rows.md +2 -0
- package/docs/examples/tablesdb/list-transactions.md +2 -0
- package/docs/examples/tablesdb/update-row.md +9 -1
- package/docs/examples/tablesdb/update-transaction.md +2 -0
- package/docs/examples/tablesdb/upsert-row.md +9 -1
- package/docs/examples/teams/create-membership.md +4 -2
- package/docs/examples/teams/create.md +2 -0
- package/docs/examples/teams/delete-membership.md +2 -0
- package/docs/examples/teams/delete.md +2 -0
- package/docs/examples/teams/get-membership.md +2 -0
- package/docs/examples/teams/get-prefs.md +2 -0
- package/docs/examples/teams/get.md +2 -0
- package/docs/examples/teams/list-memberships.md +2 -0
- package/docs/examples/teams/list.md +2 -0
- package/docs/examples/teams/update-membership-status.md +2 -0
- package/docs/examples/teams/update-membership.md +4 -2
- package/docs/examples/teams/update-name.md +2 -0
- package/docs/examples/teams/update-prefs.md +2 -0
- package/package.json +6 -3
- package/rollup.config.js +3 -1
- package/src/channel.ts +134 -0
- package/src/client.ts +41 -6
- package/src/enums/browser-permission.ts +22 -0
- package/src/enums/o-auth-provider.ts +0 -1
- package/src/enums/roles.ts +5 -0
- package/src/index.ts +4 -2
- package/src/models.ts +8 -0
- package/src/query.ts +54 -9
- package/src/services/account.ts +30 -1
- package/src/services/avatars.ts +17 -16
- package/src/services/databases.ts +5 -9
- package/src/services/storage.ts +8 -8
- package/src/services/teams.ts +19 -18
- package/types/channel.d.ts +71 -0
- package/types/enums/browser-permission.d.ts +22 -0
- package/types/enums/o-auth-provider.d.ts +1 -2
- package/types/enums/roles.d.ts +5 -0
- package/types/index.d.ts +4 -2
- package/types/models.d.ts +8 -0
- package/types/query.d.ts +36 -6
- package/types/services/account.d.ts +13 -1
- package/types/services/avatars.d.ts +12 -11
- package/types/services/databases.d.ts +2 -2
- package/types/services/storage.d.ts +8 -8
- package/types/services/teams.d.ts +9 -8
- package/src/enums/output.ts +0 -9
- package/types/enums/output.d.ts +0 -9
package/dist/esm/sdk.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import JSONbigModule from 'json-bigint';
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
2
4
|
import * as FileSystem from 'expo-file-system';
|
|
3
5
|
|
|
4
6
|
/******************************************************************************
|
|
@@ -52,6 +54,28 @@ class Service {
|
|
|
52
54
|
}
|
|
53
55
|
Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
|
|
54
56
|
|
|
57
|
+
const JSONbigParser = JSONbigModule({ storeAsString: false });
|
|
58
|
+
const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
|
|
59
|
+
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
60
|
+
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
61
|
+
function reviver(_key, value) {
|
|
62
|
+
if (BigNumber.isBigNumber(value)) {
|
|
63
|
+
if (value.isInteger()) {
|
|
64
|
+
const str = value.toFixed();
|
|
65
|
+
const bi = BigInt(str);
|
|
66
|
+
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
67
|
+
return Number(str);
|
|
68
|
+
}
|
|
69
|
+
return bi;
|
|
70
|
+
}
|
|
71
|
+
return value.toNumber();
|
|
72
|
+
}
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
const JSONbig$1 = {
|
|
76
|
+
parse: (text) => JSONbigParser.parse(text, reviver),
|
|
77
|
+
stringify: JSONbigSerializer.stringify
|
|
78
|
+
};
|
|
55
79
|
class AppwriteException extends Error {
|
|
56
80
|
constructor(message, code = 0, type = '', response = '') {
|
|
57
81
|
super(message);
|
|
@@ -78,7 +102,7 @@ class Client {
|
|
|
78
102
|
'x-sdk-name': 'React Native',
|
|
79
103
|
'x-sdk-platform': 'client',
|
|
80
104
|
'x-sdk-language': 'reactnative',
|
|
81
|
-
'x-sdk-version': '0.
|
|
105
|
+
'x-sdk-version': '0.20.0',
|
|
82
106
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
83
107
|
};
|
|
84
108
|
this.realtime = {
|
|
@@ -116,7 +140,7 @@ class Client {
|
|
|
116
140
|
}
|
|
117
141
|
this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
|
|
118
142
|
var _a;
|
|
119
|
-
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(
|
|
143
|
+
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSONbig$1.stringify({
|
|
120
144
|
type: 'ping'
|
|
121
145
|
}));
|
|
122
146
|
}, 20000);
|
|
@@ -176,7 +200,7 @@ class Client {
|
|
|
176
200
|
},
|
|
177
201
|
onMessage: (event) => {
|
|
178
202
|
try {
|
|
179
|
-
const message =
|
|
203
|
+
const message = JSONbig$1.parse(event.data);
|
|
180
204
|
this.realtime.lastMessage = message;
|
|
181
205
|
switch (message.type) {
|
|
182
206
|
case 'event':
|
|
@@ -228,6 +252,9 @@ class Client {
|
|
|
228
252
|
* @returns {this}
|
|
229
253
|
*/
|
|
230
254
|
setEndpoint(endpoint) {
|
|
255
|
+
if (!endpoint || typeof endpoint !== 'string') {
|
|
256
|
+
throw new AppwriteException('Endpoint must be a valid string');
|
|
257
|
+
}
|
|
231
258
|
if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
|
|
232
259
|
throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
|
|
233
260
|
}
|
|
@@ -243,6 +270,9 @@ class Client {
|
|
|
243
270
|
* @returns {this}
|
|
244
271
|
*/
|
|
245
272
|
setEndpointRealtime(endpointRealtime) {
|
|
273
|
+
if (!endpointRealtime || typeof endpointRealtime !== 'string') {
|
|
274
|
+
throw new AppwriteException('Endpoint must be a valid string');
|
|
275
|
+
}
|
|
246
276
|
if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
|
|
247
277
|
throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
|
|
248
278
|
}
|
|
@@ -390,7 +420,7 @@ class Client {
|
|
|
390
420
|
else {
|
|
391
421
|
switch (headers['content-type']) {
|
|
392
422
|
case 'application/json':
|
|
393
|
-
options.body =
|
|
423
|
+
options.body = JSONbig$1.stringify(params);
|
|
394
424
|
break;
|
|
395
425
|
case 'multipart/form-data':
|
|
396
426
|
let formData = new FormData();
|
|
@@ -417,7 +447,7 @@ class Client {
|
|
|
417
447
|
warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
|
|
418
448
|
}
|
|
419
449
|
if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
|
|
420
|
-
data = yield response.
|
|
450
|
+
data = JSONbig$1.parse(yield response.text());
|
|
421
451
|
}
|
|
422
452
|
else if (responseType === 'arrayBuffer') {
|
|
423
453
|
data = yield response.arrayBuffer();
|
|
@@ -430,7 +460,7 @@ class Client {
|
|
|
430
460
|
if (400 <= response.status) {
|
|
431
461
|
let responseText = '';
|
|
432
462
|
if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
|
|
433
|
-
responseText =
|
|
463
|
+
responseText = JSONbig$1.stringify(data);
|
|
434
464
|
}
|
|
435
465
|
else {
|
|
436
466
|
responseText = data === null || data === void 0 ? void 0 : data.message;
|
|
@@ -592,15 +622,22 @@ class Account extends Service {
|
|
|
592
622
|
'content-type': 'application/json',
|
|
593
623
|
}, payload);
|
|
594
624
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
625
|
+
createJWT(paramsOrFirst) {
|
|
626
|
+
let params;
|
|
627
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
628
|
+
params = (paramsOrFirst || {});
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
params = {
|
|
632
|
+
duration: paramsOrFirst
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
const duration = params.duration;
|
|
602
636
|
const apiPath = '/account/jwts';
|
|
603
637
|
const payload = {};
|
|
638
|
+
if (typeof duration !== 'undefined') {
|
|
639
|
+
payload['duration'] = duration;
|
|
640
|
+
}
|
|
604
641
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
605
642
|
return this.client.call('post', uri, {
|
|
606
643
|
'content-type': 'application/json',
|
|
@@ -2547,12 +2584,12 @@ class Avatars extends Service {
|
|
|
2547
2584
|
* @param {number} longitude
|
|
2548
2585
|
* @param {number} accuracy
|
|
2549
2586
|
* @param {boolean} touch
|
|
2550
|
-
* @param {
|
|
2587
|
+
* @param {BrowserPermission[]} permissions
|
|
2551
2588
|
* @param {number} sleep
|
|
2552
2589
|
* @param {number} width
|
|
2553
2590
|
* @param {number} height
|
|
2554
2591
|
* @param {number} quality
|
|
2555
|
-
* @param {
|
|
2592
|
+
* @param {ImageFormat} output
|
|
2556
2593
|
* @throws {AppwriteException}
|
|
2557
2594
|
* @returns {URL}
|
|
2558
2595
|
*/
|
|
@@ -2929,9 +2966,6 @@ class Databases extends Service {
|
|
|
2929
2966
|
if (typeof documentId === 'undefined') {
|
|
2930
2967
|
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2931
2968
|
}
|
|
2932
|
-
if (typeof data === 'undefined') {
|
|
2933
|
-
throw new AppwriteException('Missing required parameter: "data"');
|
|
2934
|
-
}
|
|
2935
2969
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2936
2970
|
const payload = {};
|
|
2937
2971
|
if (typeof data !== 'undefined') {
|
|
@@ -4869,6 +4903,7 @@ class Teams extends Service {
|
|
|
4869
4903
|
}
|
|
4870
4904
|
}
|
|
4871
4905
|
|
|
4906
|
+
const JSONbig = JSONbigModule({ useNativeBigInt: true });
|
|
4872
4907
|
class Query {
|
|
4873
4908
|
constructor(method, attribute, values) {
|
|
4874
4909
|
this.method = method;
|
|
@@ -4883,7 +4918,7 @@ class Query {
|
|
|
4883
4918
|
}
|
|
4884
4919
|
}
|
|
4885
4920
|
toString() {
|
|
4886
|
-
return
|
|
4921
|
+
return JSONbig.stringify({
|
|
4887
4922
|
method: this.method,
|
|
4888
4923
|
attribute: this.attribute,
|
|
4889
4924
|
values: this.values,
|
|
@@ -4892,12 +4927,34 @@ class Query {
|
|
|
4892
4927
|
}
|
|
4893
4928
|
Query.equal = (attribute, value) => new Query("equal", attribute, value).toString();
|
|
4894
4929
|
Query.notEqual = (attribute, value) => new Query("notEqual", attribute, value).toString();
|
|
4930
|
+
/**
|
|
4931
|
+
* Filter resources where attribute matches a regular expression pattern.
|
|
4932
|
+
*
|
|
4933
|
+
* @param {string} attribute The attribute to filter on.
|
|
4934
|
+
* @param {string} pattern The regular expression pattern to match.
|
|
4935
|
+
* @returns {string}
|
|
4936
|
+
*/
|
|
4937
|
+
Query.regex = (attribute, pattern) => new Query("regex", attribute, pattern).toString();
|
|
4895
4938
|
Query.lessThan = (attribute, value) => new Query("lessThan", attribute, value).toString();
|
|
4896
4939
|
Query.lessThanEqual = (attribute, value) => new Query("lessThanEqual", attribute, value).toString();
|
|
4897
4940
|
Query.greaterThan = (attribute, value) => new Query("greaterThan", attribute, value).toString();
|
|
4898
4941
|
Query.greaterThanEqual = (attribute, value) => new Query("greaterThanEqual", attribute, value).toString();
|
|
4899
4942
|
Query.isNull = (attribute) => new Query("isNull", attribute).toString();
|
|
4900
4943
|
Query.isNotNull = (attribute) => new Query("isNotNull", attribute).toString();
|
|
4944
|
+
/**
|
|
4945
|
+
* Filter resources where the specified attributes exist.
|
|
4946
|
+
*
|
|
4947
|
+
* @param {string[]} attributes The list of attributes that must exist.
|
|
4948
|
+
* @returns {string}
|
|
4949
|
+
*/
|
|
4950
|
+
Query.exists = (attributes) => new Query("exists", undefined, attributes).toString();
|
|
4951
|
+
/**
|
|
4952
|
+
* Filter resources where the specified attributes do not exist.
|
|
4953
|
+
*
|
|
4954
|
+
* @param {string[]} attributes The list of attributes that must not exist.
|
|
4955
|
+
* @returns {string}
|
|
4956
|
+
*/
|
|
4957
|
+
Query.notExists = (attributes) => new Query("notExists", undefined, attributes).toString();
|
|
4901
4958
|
Query.between = (attribute, start, end) => new Query("between", attribute, [start, end]).toString();
|
|
4902
4959
|
Query.startsWith = (attribute, value) => new Query("startsWith", attribute, value).toString();
|
|
4903
4960
|
Query.endsWith = (attribute, value) => new Query("endsWith", attribute, value).toString();
|
|
@@ -4939,8 +4996,8 @@ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value)
|
|
|
4939
4996
|
* Filter resources where attribute is not between start and end (exclusive).
|
|
4940
4997
|
*
|
|
4941
4998
|
* @param {string} attribute
|
|
4942
|
-
* @param {string | number} start
|
|
4943
|
-
* @param {string | number} end
|
|
4999
|
+
* @param {string | number | bigint} start
|
|
5000
|
+
* @param {string | number | bigint} end
|
|
4944
5001
|
* @returns {string}
|
|
4945
5002
|
*/
|
|
4946
5003
|
Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
|
|
@@ -5004,8 +5061,16 @@ Query.updatedAfter = (value) => Query.greaterThan("$updatedAt", value);
|
|
|
5004
5061
|
* @returns {string}
|
|
5005
5062
|
*/
|
|
5006
5063
|
Query.updatedBetween = (start, end) => Query.between("$updatedAt", start, end);
|
|
5007
|
-
Query.or = (queries) => new Query("or", undefined, queries.map((query) =>
|
|
5008
|
-
Query.and = (queries) => new Query("and", undefined, queries.map((query) =>
|
|
5064
|
+
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSONbig.parse(query))).toString();
|
|
5065
|
+
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSONbig.parse(query))).toString();
|
|
5066
|
+
/**
|
|
5067
|
+
* Filter array elements where at least one element matches all the specified queries.
|
|
5068
|
+
*
|
|
5069
|
+
* @param {string} attribute The attribute containing the array to filter on.
|
|
5070
|
+
* @param {string[]} queries The list of query strings to match against array elements.
|
|
5071
|
+
* @returns {string}
|
|
5072
|
+
*/
|
|
5073
|
+
Query.elemMatch = (attribute, queries) => new Query("elemMatch", attribute, queries.map((query) => JSONbig.parse(query))).toString();
|
|
5009
5074
|
/**
|
|
5010
5075
|
* Filter resources where attribute is at a specific distance from the given coordinates.
|
|
5011
5076
|
*
|
|
@@ -5248,6 +5313,96 @@ _a = ID, _ID_hexTimestamp = function _ID_hexTimestamp() {
|
|
|
5248
5313
|
return hexTimestamp;
|
|
5249
5314
|
};
|
|
5250
5315
|
|
|
5316
|
+
function normalize(id) {
|
|
5317
|
+
const trimmed = id.trim();
|
|
5318
|
+
return trimmed === "" ? "*" : trimmed;
|
|
5319
|
+
}
|
|
5320
|
+
class Channel {
|
|
5321
|
+
constructor(segments) {
|
|
5322
|
+
this.segments = segments;
|
|
5323
|
+
}
|
|
5324
|
+
next(segment, id = "*") {
|
|
5325
|
+
return new Channel([...this.segments, segment, normalize(id)]);
|
|
5326
|
+
}
|
|
5327
|
+
resolve(action) {
|
|
5328
|
+
return new Channel([...this.segments, action]);
|
|
5329
|
+
}
|
|
5330
|
+
toString() {
|
|
5331
|
+
return this.segments.join(".");
|
|
5332
|
+
}
|
|
5333
|
+
// --- DATABASE ROUTE ---
|
|
5334
|
+
// Only available on Channel<Database>
|
|
5335
|
+
collection(id = "*") {
|
|
5336
|
+
return this.next("collections", id);
|
|
5337
|
+
}
|
|
5338
|
+
// Only available on Channel<Collection>
|
|
5339
|
+
document(id = "*") {
|
|
5340
|
+
return this.next("documents", id);
|
|
5341
|
+
}
|
|
5342
|
+
// --- TABLESDB ROUTE ---
|
|
5343
|
+
table(id = "*") {
|
|
5344
|
+
return this.next("tables", id);
|
|
5345
|
+
}
|
|
5346
|
+
row(id = "*") {
|
|
5347
|
+
return this.next("rows", id);
|
|
5348
|
+
}
|
|
5349
|
+
// --- BUCKET ROUTE ---
|
|
5350
|
+
file(id = "*") {
|
|
5351
|
+
return this.next("files", id);
|
|
5352
|
+
}
|
|
5353
|
+
// --- FUNCTION ROUTE ---
|
|
5354
|
+
execution(id = "*") {
|
|
5355
|
+
return this.next("executions", id);
|
|
5356
|
+
}
|
|
5357
|
+
// --- TERMINAL ACTIONS ---
|
|
5358
|
+
// Restricted to the Actionable union
|
|
5359
|
+
create() {
|
|
5360
|
+
return this.resolve("create");
|
|
5361
|
+
}
|
|
5362
|
+
update() {
|
|
5363
|
+
return this.resolve("update");
|
|
5364
|
+
}
|
|
5365
|
+
delete() {
|
|
5366
|
+
return this.resolve("delete");
|
|
5367
|
+
}
|
|
5368
|
+
// --- ROOT FACTORIES ---
|
|
5369
|
+
static database(id = "*") {
|
|
5370
|
+
return new Channel(["databases", normalize(id)]);
|
|
5371
|
+
}
|
|
5372
|
+
static tablesdb(id = "*") {
|
|
5373
|
+
return new Channel(["tablesdb", normalize(id)]);
|
|
5374
|
+
}
|
|
5375
|
+
static bucket(id = "*") {
|
|
5376
|
+
return new Channel(["buckets", normalize(id)]);
|
|
5377
|
+
}
|
|
5378
|
+
static function(id = "*") {
|
|
5379
|
+
return new Channel(["functions", normalize(id)]);
|
|
5380
|
+
}
|
|
5381
|
+
static team(id = "*") {
|
|
5382
|
+
return new Channel(["teams", normalize(id)]);
|
|
5383
|
+
}
|
|
5384
|
+
static membership(id = "*") {
|
|
5385
|
+
return new Channel(["memberships", normalize(id)]);
|
|
5386
|
+
}
|
|
5387
|
+
static account(userId = "") {
|
|
5388
|
+
const id = normalize(userId);
|
|
5389
|
+
return id === "*" ? "account" : `account.${id}`;
|
|
5390
|
+
}
|
|
5391
|
+
// Global events
|
|
5392
|
+
static get documents() {
|
|
5393
|
+
return "documents";
|
|
5394
|
+
}
|
|
5395
|
+
static get rows() {
|
|
5396
|
+
return "rows";
|
|
5397
|
+
}
|
|
5398
|
+
static get files() {
|
|
5399
|
+
return "files";
|
|
5400
|
+
}
|
|
5401
|
+
static get executions() {
|
|
5402
|
+
return "executions";
|
|
5403
|
+
}
|
|
5404
|
+
}
|
|
5405
|
+
|
|
5251
5406
|
var Condition;
|
|
5252
5407
|
(function (Condition) {
|
|
5253
5408
|
Condition["Equal"] = "equal";
|
|
@@ -5567,7 +5722,6 @@ var OAuthProvider;
|
|
|
5567
5722
|
OAuthProvider["Yandex"] = "yandex";
|
|
5568
5723
|
OAuthProvider["Zoho"] = "zoho";
|
|
5569
5724
|
OAuthProvider["Zoom"] = "zoom";
|
|
5570
|
-
OAuthProvider["Mock"] = "mock";
|
|
5571
5725
|
})(OAuthProvider || (OAuthProvider = {}));
|
|
5572
5726
|
|
|
5573
5727
|
var Browser;
|
|
@@ -6237,16 +6391,40 @@ var Timezone;
|
|
|
6237
6391
|
Timezone["Utc"] = "utc";
|
|
6238
6392
|
})(Timezone || (Timezone = {}));
|
|
6239
6393
|
|
|
6240
|
-
var
|
|
6241
|
-
(function (
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6394
|
+
var BrowserPermission;
|
|
6395
|
+
(function (BrowserPermission) {
|
|
6396
|
+
BrowserPermission["Geolocation"] = "geolocation";
|
|
6397
|
+
BrowserPermission["Camera"] = "camera";
|
|
6398
|
+
BrowserPermission["Microphone"] = "microphone";
|
|
6399
|
+
BrowserPermission["Notifications"] = "notifications";
|
|
6400
|
+
BrowserPermission["Midi"] = "midi";
|
|
6401
|
+
BrowserPermission["Push"] = "push";
|
|
6402
|
+
BrowserPermission["ClipboardRead"] = "clipboard-read";
|
|
6403
|
+
BrowserPermission["ClipboardWrite"] = "clipboard-write";
|
|
6404
|
+
BrowserPermission["PaymentHandler"] = "payment-handler";
|
|
6405
|
+
BrowserPermission["Usb"] = "usb";
|
|
6406
|
+
BrowserPermission["Bluetooth"] = "bluetooth";
|
|
6407
|
+
BrowserPermission["Accelerometer"] = "accelerometer";
|
|
6408
|
+
BrowserPermission["Gyroscope"] = "gyroscope";
|
|
6409
|
+
BrowserPermission["Magnetometer"] = "magnetometer";
|
|
6410
|
+
BrowserPermission["AmbientLightSensor"] = "ambient-light-sensor";
|
|
6411
|
+
BrowserPermission["BackgroundSync"] = "background-sync";
|
|
6412
|
+
BrowserPermission["PersistentStorage"] = "persistent-storage";
|
|
6413
|
+
BrowserPermission["ScreenWakeLock"] = "screen-wake-lock";
|
|
6414
|
+
BrowserPermission["WebShare"] = "web-share";
|
|
6415
|
+
BrowserPermission["XrSpatialTracking"] = "xr-spatial-tracking";
|
|
6416
|
+
})(BrowserPermission || (BrowserPermission = {}));
|
|
6417
|
+
|
|
6418
|
+
var ImageFormat;
|
|
6419
|
+
(function (ImageFormat) {
|
|
6420
|
+
ImageFormat["Jpg"] = "jpg";
|
|
6421
|
+
ImageFormat["Jpeg"] = "jpeg";
|
|
6422
|
+
ImageFormat["Png"] = "png";
|
|
6423
|
+
ImageFormat["Webp"] = "webp";
|
|
6424
|
+
ImageFormat["Heic"] = "heic";
|
|
6425
|
+
ImageFormat["Avif"] = "avif";
|
|
6426
|
+
ImageFormat["Gif"] = "gif";
|
|
6427
|
+
})(ImageFormat || (ImageFormat = {}));
|
|
6250
6428
|
|
|
6251
6429
|
var ExecutionMethod;
|
|
6252
6430
|
(function (ExecutionMethod) {
|
|
@@ -6272,16 +6450,12 @@ var ImageGravity;
|
|
|
6272
6450
|
ImageGravity["BottomRight"] = "bottom-right";
|
|
6273
6451
|
})(ImageGravity || (ImageGravity = {}));
|
|
6274
6452
|
|
|
6275
|
-
var
|
|
6276
|
-
(function (
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
ImageFormat["Heic"] = "heic";
|
|
6282
|
-
ImageFormat["Avif"] = "avif";
|
|
6283
|
-
ImageFormat["Gif"] = "gif";
|
|
6284
|
-
})(ImageFormat || (ImageFormat = {}));
|
|
6453
|
+
var Roles;
|
|
6454
|
+
(function (Roles) {
|
|
6455
|
+
Roles["Admin"] = "admin";
|
|
6456
|
+
Roles["Developer"] = "developer";
|
|
6457
|
+
Roles["Owner"] = "owner";
|
|
6458
|
+
})(Roles || (Roles = {}));
|
|
6285
6459
|
|
|
6286
6460
|
var ExecutionTrigger;
|
|
6287
6461
|
(function (ExecutionTrigger) {
|
|
@@ -6299,5 +6473,5 @@ var ExecutionStatus;
|
|
|
6299
6473
|
ExecutionStatus["Scheduled"] = "scheduled";
|
|
6300
6474
|
})(ExecutionStatus || (ExecutionStatus = {}));
|
|
6301
6475
|
|
|
6302
|
-
export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, Condition, CreditCard, Databases, ExecutionMethod, ExecutionStatus, ExecutionTrigger, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Operator,
|
|
6476
|
+
export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, BrowserPermission, Channel, Client, Condition, CreditCard, Databases, ExecutionMethod, ExecutionStatus, ExecutionTrigger, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Operator, Permission, Query, Role, Roles, Storage, TablesDB, Teams, Theme, Timezone };
|
|
6303
6477
|
//# sourceMappingURL=sdk.js.map
|