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.
Files changed (158) hide show
  1. package/.github/workflows/publish.yml +9 -8
  2. package/CHANGELOG.md +6 -0
  3. package/LICENSE +1 -1
  4. package/README.md +2 -2
  5. package/dist/cjs/sdk.js +223 -44
  6. package/dist/cjs/sdk.js.map +1 -1
  7. package/dist/esm/sdk.js +219 -45
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +2 -0
  10. package/docs/examples/account/create-email-password-session.md +2 -0
  11. package/docs/examples/account/create-email-token.md +2 -0
  12. package/docs/examples/account/create-email-verification.md +2 -0
  13. package/docs/examples/account/create-jwt.md +5 -1
  14. package/docs/examples/account/create-magic-url-token.md +2 -0
  15. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  16. package/docs/examples/account/create-mfa-challenge.md +2 -0
  17. package/docs/examples/account/create-mfa-recovery-codes.md +2 -0
  18. package/docs/examples/account/create-o-auth-2-session.md +2 -0
  19. package/docs/examples/account/create-o-auth-2-token.md +2 -0
  20. package/docs/examples/account/create-phone-token.md +2 -0
  21. package/docs/examples/account/create-phone-verification.md +2 -0
  22. package/docs/examples/account/create-push-target.md +2 -0
  23. package/docs/examples/account/create-recovery.md +2 -0
  24. package/docs/examples/account/create-session.md +2 -0
  25. package/docs/examples/account/create-verification.md +2 -0
  26. package/docs/examples/account/create.md +2 -0
  27. package/docs/examples/account/delete-identity.md +2 -0
  28. package/docs/examples/account/delete-mfa-authenticator.md +2 -0
  29. package/docs/examples/account/delete-push-target.md +2 -0
  30. package/docs/examples/account/delete-session.md +2 -0
  31. package/docs/examples/account/delete-sessions.md +2 -0
  32. package/docs/examples/account/get-mfa-recovery-codes.md +2 -0
  33. package/docs/examples/account/get-prefs.md +2 -0
  34. package/docs/examples/account/get-session.md +2 -0
  35. package/docs/examples/account/get.md +2 -0
  36. package/docs/examples/account/list-identities.md +2 -0
  37. package/docs/examples/account/list-logs.md +2 -0
  38. package/docs/examples/account/list-mfa-factors.md +2 -0
  39. package/docs/examples/account/list-sessions.md +2 -0
  40. package/docs/examples/account/update-email-verification.md +2 -0
  41. package/docs/examples/account/update-email.md +2 -0
  42. package/docs/examples/account/update-magic-url-session.md +2 -0
  43. package/docs/examples/account/update-mfa-authenticator.md +2 -0
  44. package/docs/examples/account/update-mfa-challenge.md +2 -0
  45. package/docs/examples/account/update-mfa-recovery-codes.md +2 -0
  46. package/docs/examples/account/update-mfa.md +2 -0
  47. package/docs/examples/account/update-name.md +2 -0
  48. package/docs/examples/account/update-password.md +2 -0
  49. package/docs/examples/account/update-phone-session.md +2 -0
  50. package/docs/examples/account/update-phone-verification.md +2 -0
  51. package/docs/examples/account/update-phone.md +2 -0
  52. package/docs/examples/account/update-prefs.md +2 -0
  53. package/docs/examples/account/update-push-target.md +2 -0
  54. package/docs/examples/account/update-recovery.md +2 -0
  55. package/docs/examples/account/update-session.md +2 -0
  56. package/docs/examples/account/update-status.md +2 -0
  57. package/docs/examples/account/update-verification.md +2 -0
  58. package/docs/examples/avatars/get-browser.md +2 -0
  59. package/docs/examples/avatars/get-credit-card.md +2 -0
  60. package/docs/examples/avatars/get-favicon.md +2 -0
  61. package/docs/examples/avatars/get-flag.md +2 -0
  62. package/docs/examples/avatars/get-image.md +2 -0
  63. package/docs/examples/avatars/get-initials.md +2 -0
  64. package/docs/examples/avatars/get-qr.md +2 -0
  65. package/docs/examples/avatars/get-screenshot.md +7 -5
  66. package/docs/examples/databases/create-document.md +2 -0
  67. package/docs/examples/databases/create-operations.md +2 -0
  68. package/docs/examples/databases/create-transaction.md +2 -0
  69. package/docs/examples/databases/decrement-document-attribute.md +2 -0
  70. package/docs/examples/databases/delete-document.md +2 -0
  71. package/docs/examples/databases/delete-transaction.md +2 -0
  72. package/docs/examples/databases/get-document.md +2 -0
  73. package/docs/examples/databases/get-transaction.md +2 -0
  74. package/docs/examples/databases/increment-document-attribute.md +2 -0
  75. package/docs/examples/databases/list-documents.md +2 -0
  76. package/docs/examples/databases/list-transactions.md +2 -0
  77. package/docs/examples/databases/update-document.md +9 -1
  78. package/docs/examples/databases/update-transaction.md +2 -0
  79. package/docs/examples/databases/upsert-document.md +9 -1
  80. package/docs/examples/functions/create-execution.md +2 -0
  81. package/docs/examples/functions/get-execution.md +2 -0
  82. package/docs/examples/functions/list-executions.md +2 -0
  83. package/docs/examples/graphql/mutation.md +2 -0
  84. package/docs/examples/graphql/query.md +2 -0
  85. package/docs/examples/locale/get.md +2 -0
  86. package/docs/examples/locale/list-codes.md +2 -0
  87. package/docs/examples/locale/list-continents.md +2 -0
  88. package/docs/examples/locale/list-countries-eu.md +2 -0
  89. package/docs/examples/locale/list-countries-phones.md +2 -0
  90. package/docs/examples/locale/list-countries.md +2 -0
  91. package/docs/examples/locale/list-currencies.md +2 -0
  92. package/docs/examples/locale/list-languages.md +2 -0
  93. package/docs/examples/messaging/create-subscriber.md +2 -0
  94. package/docs/examples/messaging/delete-subscriber.md +2 -0
  95. package/docs/examples/storage/create-file.md +2 -0
  96. package/docs/examples/storage/delete-file.md +2 -0
  97. package/docs/examples/storage/get-file-download.md +2 -0
  98. package/docs/examples/storage/get-file-preview.md +2 -0
  99. package/docs/examples/storage/get-file-view.md +2 -0
  100. package/docs/examples/storage/get-file.md +2 -0
  101. package/docs/examples/storage/list-files.md +2 -0
  102. package/docs/examples/storage/update-file.md +2 -0
  103. package/docs/examples/tablesdb/create-operations.md +2 -0
  104. package/docs/examples/tablesdb/create-row.md +2 -0
  105. package/docs/examples/tablesdb/create-transaction.md +2 -0
  106. package/docs/examples/tablesdb/decrement-row-column.md +2 -0
  107. package/docs/examples/tablesdb/delete-row.md +2 -0
  108. package/docs/examples/tablesdb/delete-transaction.md +2 -0
  109. package/docs/examples/tablesdb/get-row.md +2 -0
  110. package/docs/examples/tablesdb/get-transaction.md +2 -0
  111. package/docs/examples/tablesdb/increment-row-column.md +2 -0
  112. package/docs/examples/tablesdb/list-rows.md +2 -0
  113. package/docs/examples/tablesdb/list-transactions.md +2 -0
  114. package/docs/examples/tablesdb/update-row.md +9 -1
  115. package/docs/examples/tablesdb/update-transaction.md +2 -0
  116. package/docs/examples/tablesdb/upsert-row.md +9 -1
  117. package/docs/examples/teams/create-membership.md +4 -2
  118. package/docs/examples/teams/create.md +2 -0
  119. package/docs/examples/teams/delete-membership.md +2 -0
  120. package/docs/examples/teams/delete.md +2 -0
  121. package/docs/examples/teams/get-membership.md +2 -0
  122. package/docs/examples/teams/get-prefs.md +2 -0
  123. package/docs/examples/teams/get.md +2 -0
  124. package/docs/examples/teams/list-memberships.md +2 -0
  125. package/docs/examples/teams/list.md +2 -0
  126. package/docs/examples/teams/update-membership-status.md +2 -0
  127. package/docs/examples/teams/update-membership.md +4 -2
  128. package/docs/examples/teams/update-name.md +2 -0
  129. package/docs/examples/teams/update-prefs.md +2 -0
  130. package/package.json +6 -3
  131. package/rollup.config.js +3 -1
  132. package/src/channel.ts +134 -0
  133. package/src/client.ts +41 -6
  134. package/src/enums/browser-permission.ts +22 -0
  135. package/src/enums/o-auth-provider.ts +0 -1
  136. package/src/enums/roles.ts +5 -0
  137. package/src/index.ts +4 -2
  138. package/src/models.ts +8 -0
  139. package/src/query.ts +54 -9
  140. package/src/services/account.ts +30 -1
  141. package/src/services/avatars.ts +17 -16
  142. package/src/services/databases.ts +5 -9
  143. package/src/services/storage.ts +8 -8
  144. package/src/services/teams.ts +19 -18
  145. package/types/channel.d.ts +71 -0
  146. package/types/enums/browser-permission.d.ts +22 -0
  147. package/types/enums/o-auth-provider.d.ts +1 -2
  148. package/types/enums/roles.d.ts +5 -0
  149. package/types/index.d.ts +4 -2
  150. package/types/models.d.ts +8 -0
  151. package/types/query.d.ts +36 -6
  152. package/types/services/account.d.ts +13 -1
  153. package/types/services/avatars.d.ts +12 -11
  154. package/types/services/databases.d.ts +2 -2
  155. package/types/services/storage.d.ts +8 -8
  156. package/types/services/teams.d.ts +9 -8
  157. package/src/enums/output.ts +0 -9
  158. package/types/enums/output.d.ts +0 -9
@@ -5,6 +5,10 @@ on:
5
5
  types: [published]
6
6
  workflow_dispatch:
7
7
 
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
8
12
  jobs:
9
13
  publish:
10
14
  runs-on: ubuntu-latest
@@ -12,14 +16,15 @@ jobs:
12
16
  steps:
13
17
  - uses: actions/checkout@v4
14
18
 
15
- # Setup Node.js environment
16
19
  - name: Use Node.js
17
20
  uses: actions/setup-node@v4
18
21
  with:
19
- node-version: '20.x'
22
+ node-version: '22'
20
23
  registry-url: 'https://registry.npmjs.org'
21
24
 
22
- # Determine release tag based on the tag name
25
+ - name: Update npm to latest version for OIDC support
26
+ run: npm install -g npm@latest
27
+
23
28
  - name: Determine release tag
24
29
  id: release_tag
25
30
  run: |
@@ -29,14 +34,10 @@ jobs:
29
34
  echo "tag=latest" >> "$GITHUB_OUTPUT"
30
35
  fi
31
36
 
32
- # Install dependencies (if any) and build your project (if necessary)
33
37
  - name: Install dependencies and build
34
38
  run: |
35
39
  npm install
36
40
  npm run build
37
41
 
38
- # Publish to NPM with the appropriate tag
39
42
  - name: Publish
40
- run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
41
- env:
42
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }}
43
+ run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ## 0.20.0
4
+
5
+ * Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`).
6
+ * Breaking change: `Output` enum has been removed; use `ImageFormat` instead.
7
+ * Add `Channel` helpers for Realtime.
8
+
3
9
  ## 0.19.0
4
10
 
5
11
  * Add `getScreenshot` method to `Avatars` service
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
1
+ Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Appwrite React Native SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
4
- ![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square)
5
5
  [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
7
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
8
8
 
9
9
  **This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).**
10
10
 
11
- Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11
+ Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
12
12
 
13
13
  ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)
14
14
 
package/dist/cjs/sdk.js CHANGED
@@ -1,8 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var reactNative = require('react-native');
4
+ var JSONbigModule = require('json-bigint');
5
+ var BigNumber = require('bignumber.js');
4
6
  var FileSystem = require('expo-file-system');
5
7
 
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
6
10
  function _interopNamespace(e) {
7
11
  if (e && e.__esModule) return e;
8
12
  var n = Object.create(null);
@@ -21,6 +25,8 @@ function _interopNamespace(e) {
21
25
  return Object.freeze(n);
22
26
  }
23
27
 
28
+ var JSONbigModule__default = /*#__PURE__*/_interopDefaultLegacy(JSONbigModule);
29
+ var BigNumber__default = /*#__PURE__*/_interopDefaultLegacy(BigNumber);
24
30
  var FileSystem__namespace = /*#__PURE__*/_interopNamespace(FileSystem);
25
31
 
26
32
  /******************************************************************************
@@ -74,6 +80,28 @@ class Service {
74
80
  }
75
81
  Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
76
82
 
83
+ const JSONbigParser = JSONbigModule__default["default"]({ storeAsString: false });
84
+ const JSONbigSerializer = JSONbigModule__default["default"]({ useNativeBigInt: true });
85
+ const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
86
+ const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
87
+ function reviver(_key, value) {
88
+ if (BigNumber__default["default"].isBigNumber(value)) {
89
+ if (value.isInteger()) {
90
+ const str = value.toFixed();
91
+ const bi = BigInt(str);
92
+ if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
93
+ return Number(str);
94
+ }
95
+ return bi;
96
+ }
97
+ return value.toNumber();
98
+ }
99
+ return value;
100
+ }
101
+ const JSONbig$1 = {
102
+ parse: (text) => JSONbigParser.parse(text, reviver),
103
+ stringify: JSONbigSerializer.stringify
104
+ };
77
105
  class AppwriteException extends Error {
78
106
  constructor(message, code = 0, type = '', response = '') {
79
107
  super(message);
@@ -100,7 +128,7 @@ class Client {
100
128
  'x-sdk-name': 'React Native',
101
129
  'x-sdk-platform': 'client',
102
130
  'x-sdk-language': 'reactnative',
103
- 'x-sdk-version': '0.19.0',
131
+ 'x-sdk-version': '0.20.0',
104
132
  'X-Appwrite-Response-Format': '1.8.0',
105
133
  };
106
134
  this.realtime = {
@@ -138,7 +166,7 @@ class Client {
138
166
  }
139
167
  this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
140
168
  var _a;
141
- (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({
169
+ (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSONbig$1.stringify({
142
170
  type: 'ping'
143
171
  }));
144
172
  }, 20000);
@@ -198,7 +226,7 @@ class Client {
198
226
  },
199
227
  onMessage: (event) => {
200
228
  try {
201
- const message = JSON.parse(event.data);
229
+ const message = JSONbig$1.parse(event.data);
202
230
  this.realtime.lastMessage = message;
203
231
  switch (message.type) {
204
232
  case 'event':
@@ -250,6 +278,9 @@ class Client {
250
278
  * @returns {this}
251
279
  */
252
280
  setEndpoint(endpoint) {
281
+ if (!endpoint || typeof endpoint !== 'string') {
282
+ throw new AppwriteException('Endpoint must be a valid string');
283
+ }
253
284
  if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
254
285
  throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
255
286
  }
@@ -265,6 +296,9 @@ class Client {
265
296
  * @returns {this}
266
297
  */
267
298
  setEndpointRealtime(endpointRealtime) {
299
+ if (!endpointRealtime || typeof endpointRealtime !== 'string') {
300
+ throw new AppwriteException('Endpoint must be a valid string');
301
+ }
268
302
  if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
269
303
  throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
270
304
  }
@@ -412,7 +446,7 @@ class Client {
412
446
  else {
413
447
  switch (headers['content-type']) {
414
448
  case 'application/json':
415
- options.body = JSON.stringify(params);
449
+ options.body = JSONbig$1.stringify(params);
416
450
  break;
417
451
  case 'multipart/form-data':
418
452
  let formData = new FormData();
@@ -439,7 +473,7 @@ class Client {
439
473
  warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
440
474
  }
441
475
  if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
442
- data = yield response.json();
476
+ data = JSONbig$1.parse(yield response.text());
443
477
  }
444
478
  else if (responseType === 'arrayBuffer') {
445
479
  data = yield response.arrayBuffer();
@@ -452,7 +486,7 @@ class Client {
452
486
  if (400 <= response.status) {
453
487
  let responseText = '';
454
488
  if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
455
- responseText = JSON.stringify(data);
489
+ responseText = JSONbig$1.stringify(data);
456
490
  }
457
491
  else {
458
492
  responseText = data === null || data === void 0 ? void 0 : data.message;
@@ -614,15 +648,22 @@ class Account extends Service {
614
648
  'content-type': 'application/json',
615
649
  }, payload);
616
650
  }
617
- /**
618
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
619
- *
620
- * @throws {AppwriteException}
621
- * @returns {Promise}
622
- */
623
- createJWT() {
651
+ createJWT(paramsOrFirst) {
652
+ let params;
653
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
654
+ params = (paramsOrFirst || {});
655
+ }
656
+ else {
657
+ params = {
658
+ duration: paramsOrFirst
659
+ };
660
+ }
661
+ const duration = params.duration;
624
662
  const apiPath = '/account/jwts';
625
663
  const payload = {};
664
+ if (typeof duration !== 'undefined') {
665
+ payload['duration'] = duration;
666
+ }
626
667
  const uri = new URL(this.client.config.endpoint + apiPath);
627
668
  return this.client.call('post', uri, {
628
669
  'content-type': 'application/json',
@@ -2569,12 +2610,12 @@ class Avatars extends Service {
2569
2610
  * @param {number} longitude
2570
2611
  * @param {number} accuracy
2571
2612
  * @param {boolean} touch
2572
- * @param {string[]} permissions
2613
+ * @param {BrowserPermission[]} permissions
2573
2614
  * @param {number} sleep
2574
2615
  * @param {number} width
2575
2616
  * @param {number} height
2576
2617
  * @param {number} quality
2577
- * @param {Output} output
2618
+ * @param {ImageFormat} output
2578
2619
  * @throws {AppwriteException}
2579
2620
  * @returns {URL}
2580
2621
  */
@@ -2951,9 +2992,6 @@ class Databases extends Service {
2951
2992
  if (typeof documentId === 'undefined') {
2952
2993
  throw new AppwriteException('Missing required parameter: "documentId"');
2953
2994
  }
2954
- if (typeof data === 'undefined') {
2955
- throw new AppwriteException('Missing required parameter: "data"');
2956
- }
2957
2995
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2958
2996
  const payload = {};
2959
2997
  if (typeof data !== 'undefined') {
@@ -4891,6 +4929,7 @@ class Teams extends Service {
4891
4929
  }
4892
4930
  }
4893
4931
 
4932
+ const JSONbig = JSONbigModule__default["default"]({ useNativeBigInt: true });
4894
4933
  class Query {
4895
4934
  constructor(method, attribute, values) {
4896
4935
  this.method = method;
@@ -4905,7 +4944,7 @@ class Query {
4905
4944
  }
4906
4945
  }
4907
4946
  toString() {
4908
- return JSON.stringify({
4947
+ return JSONbig.stringify({
4909
4948
  method: this.method,
4910
4949
  attribute: this.attribute,
4911
4950
  values: this.values,
@@ -4914,12 +4953,34 @@ class Query {
4914
4953
  }
4915
4954
  Query.equal = (attribute, value) => new Query("equal", attribute, value).toString();
4916
4955
  Query.notEqual = (attribute, value) => new Query("notEqual", attribute, value).toString();
4956
+ /**
4957
+ * Filter resources where attribute matches a regular expression pattern.
4958
+ *
4959
+ * @param {string} attribute The attribute to filter on.
4960
+ * @param {string} pattern The regular expression pattern to match.
4961
+ * @returns {string}
4962
+ */
4963
+ Query.regex = (attribute, pattern) => new Query("regex", attribute, pattern).toString();
4917
4964
  Query.lessThan = (attribute, value) => new Query("lessThan", attribute, value).toString();
4918
4965
  Query.lessThanEqual = (attribute, value) => new Query("lessThanEqual", attribute, value).toString();
4919
4966
  Query.greaterThan = (attribute, value) => new Query("greaterThan", attribute, value).toString();
4920
4967
  Query.greaterThanEqual = (attribute, value) => new Query("greaterThanEqual", attribute, value).toString();
4921
4968
  Query.isNull = (attribute) => new Query("isNull", attribute).toString();
4922
4969
  Query.isNotNull = (attribute) => new Query("isNotNull", attribute).toString();
4970
+ /**
4971
+ * Filter resources where the specified attributes exist.
4972
+ *
4973
+ * @param {string[]} attributes The list of attributes that must exist.
4974
+ * @returns {string}
4975
+ */
4976
+ Query.exists = (attributes) => new Query("exists", undefined, attributes).toString();
4977
+ /**
4978
+ * Filter resources where the specified attributes do not exist.
4979
+ *
4980
+ * @param {string[]} attributes The list of attributes that must not exist.
4981
+ * @returns {string}
4982
+ */
4983
+ Query.notExists = (attributes) => new Query("notExists", undefined, attributes).toString();
4923
4984
  Query.between = (attribute, start, end) => new Query("between", attribute, [start, end]).toString();
4924
4985
  Query.startsWith = (attribute, value) => new Query("startsWith", attribute, value).toString();
4925
4986
  Query.endsWith = (attribute, value) => new Query("endsWith", attribute, value).toString();
@@ -4961,8 +5022,8 @@ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value)
4961
5022
  * Filter resources where attribute is not between start and end (exclusive).
4962
5023
  *
4963
5024
  * @param {string} attribute
4964
- * @param {string | number} start
4965
- * @param {string | number} end
5025
+ * @param {string | number | bigint} start
5026
+ * @param {string | number | bigint} end
4966
5027
  * @returns {string}
4967
5028
  */
4968
5029
  Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
@@ -5026,8 +5087,16 @@ Query.updatedAfter = (value) => Query.greaterThan("$updatedAt", value);
5026
5087
  * @returns {string}
5027
5088
  */
5028
5089
  Query.updatedBetween = (start, end) => Query.between("$updatedAt", start, end);
5029
- Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
5030
- Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
5090
+ Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSONbig.parse(query))).toString();
5091
+ Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSONbig.parse(query))).toString();
5092
+ /**
5093
+ * Filter array elements where at least one element matches all the specified queries.
5094
+ *
5095
+ * @param {string} attribute The attribute containing the array to filter on.
5096
+ * @param {string[]} queries The list of query strings to match against array elements.
5097
+ * @returns {string}
5098
+ */
5099
+ Query.elemMatch = (attribute, queries) => new Query("elemMatch", attribute, queries.map((query) => JSONbig.parse(query))).toString();
5031
5100
  /**
5032
5101
  * Filter resources where attribute is at a specific distance from the given coordinates.
5033
5102
  *
@@ -5270,6 +5339,96 @@ _a = ID, _ID_hexTimestamp = function _ID_hexTimestamp() {
5270
5339
  return hexTimestamp;
5271
5340
  };
5272
5341
 
5342
+ function normalize(id) {
5343
+ const trimmed = id.trim();
5344
+ return trimmed === "" ? "*" : trimmed;
5345
+ }
5346
+ class Channel {
5347
+ constructor(segments) {
5348
+ this.segments = segments;
5349
+ }
5350
+ next(segment, id = "*") {
5351
+ return new Channel([...this.segments, segment, normalize(id)]);
5352
+ }
5353
+ resolve(action) {
5354
+ return new Channel([...this.segments, action]);
5355
+ }
5356
+ toString() {
5357
+ return this.segments.join(".");
5358
+ }
5359
+ // --- DATABASE ROUTE ---
5360
+ // Only available on Channel<Database>
5361
+ collection(id = "*") {
5362
+ return this.next("collections", id);
5363
+ }
5364
+ // Only available on Channel<Collection>
5365
+ document(id = "*") {
5366
+ return this.next("documents", id);
5367
+ }
5368
+ // --- TABLESDB ROUTE ---
5369
+ table(id = "*") {
5370
+ return this.next("tables", id);
5371
+ }
5372
+ row(id = "*") {
5373
+ return this.next("rows", id);
5374
+ }
5375
+ // --- BUCKET ROUTE ---
5376
+ file(id = "*") {
5377
+ return this.next("files", id);
5378
+ }
5379
+ // --- FUNCTION ROUTE ---
5380
+ execution(id = "*") {
5381
+ return this.next("executions", id);
5382
+ }
5383
+ // --- TERMINAL ACTIONS ---
5384
+ // Restricted to the Actionable union
5385
+ create() {
5386
+ return this.resolve("create");
5387
+ }
5388
+ update() {
5389
+ return this.resolve("update");
5390
+ }
5391
+ delete() {
5392
+ return this.resolve("delete");
5393
+ }
5394
+ // --- ROOT FACTORIES ---
5395
+ static database(id = "*") {
5396
+ return new Channel(["databases", normalize(id)]);
5397
+ }
5398
+ static tablesdb(id = "*") {
5399
+ return new Channel(["tablesdb", normalize(id)]);
5400
+ }
5401
+ static bucket(id = "*") {
5402
+ return new Channel(["buckets", normalize(id)]);
5403
+ }
5404
+ static function(id = "*") {
5405
+ return new Channel(["functions", normalize(id)]);
5406
+ }
5407
+ static team(id = "*") {
5408
+ return new Channel(["teams", normalize(id)]);
5409
+ }
5410
+ static membership(id = "*") {
5411
+ return new Channel(["memberships", normalize(id)]);
5412
+ }
5413
+ static account(userId = "") {
5414
+ const id = normalize(userId);
5415
+ return id === "*" ? "account" : `account.${id}`;
5416
+ }
5417
+ // Global events
5418
+ static get documents() {
5419
+ return "documents";
5420
+ }
5421
+ static get rows() {
5422
+ return "rows";
5423
+ }
5424
+ static get files() {
5425
+ return "files";
5426
+ }
5427
+ static get executions() {
5428
+ return "executions";
5429
+ }
5430
+ }
5431
+
5273
5432
  exports.Condition = void 0;
5274
5433
  (function (Condition) {
5275
5434
  Condition["Equal"] = "equal";
@@ -5589,7 +5748,6 @@ exports.OAuthProvider = void 0;
5589
5748
  OAuthProvider["Yandex"] = "yandex";
5590
5749
  OAuthProvider["Zoho"] = "zoho";
5591
5750
  OAuthProvider["Zoom"] = "zoom";
5592
- OAuthProvider["Mock"] = "mock";
5593
5751
  })(exports.OAuthProvider || (exports.OAuthProvider = {}));
5594
5752
 
5595
5753
  exports.Browser = void 0;
@@ -6259,16 +6417,40 @@ exports.Timezone = void 0;
6259
6417
  Timezone["Utc"] = "utc";
6260
6418
  })(exports.Timezone || (exports.Timezone = {}));
6261
6419
 
6262
- exports.Output = void 0;
6263
- (function (Output) {
6264
- Output["Jpg"] = "jpg";
6265
- Output["Jpeg"] = "jpeg";
6266
- Output["Png"] = "png";
6267
- Output["Webp"] = "webp";
6268
- Output["Heic"] = "heic";
6269
- Output["Avif"] = "avif";
6270
- Output["Gif"] = "gif";
6271
- })(exports.Output || (exports.Output = {}));
6420
+ exports.BrowserPermission = void 0;
6421
+ (function (BrowserPermission) {
6422
+ BrowserPermission["Geolocation"] = "geolocation";
6423
+ BrowserPermission["Camera"] = "camera";
6424
+ BrowserPermission["Microphone"] = "microphone";
6425
+ BrowserPermission["Notifications"] = "notifications";
6426
+ BrowserPermission["Midi"] = "midi";
6427
+ BrowserPermission["Push"] = "push";
6428
+ BrowserPermission["ClipboardRead"] = "clipboard-read";
6429
+ BrowserPermission["ClipboardWrite"] = "clipboard-write";
6430
+ BrowserPermission["PaymentHandler"] = "payment-handler";
6431
+ BrowserPermission["Usb"] = "usb";
6432
+ BrowserPermission["Bluetooth"] = "bluetooth";
6433
+ BrowserPermission["Accelerometer"] = "accelerometer";
6434
+ BrowserPermission["Gyroscope"] = "gyroscope";
6435
+ BrowserPermission["Magnetometer"] = "magnetometer";
6436
+ BrowserPermission["AmbientLightSensor"] = "ambient-light-sensor";
6437
+ BrowserPermission["BackgroundSync"] = "background-sync";
6438
+ BrowserPermission["PersistentStorage"] = "persistent-storage";
6439
+ BrowserPermission["ScreenWakeLock"] = "screen-wake-lock";
6440
+ BrowserPermission["WebShare"] = "web-share";
6441
+ BrowserPermission["XrSpatialTracking"] = "xr-spatial-tracking";
6442
+ })(exports.BrowserPermission || (exports.BrowserPermission = {}));
6443
+
6444
+ exports.ImageFormat = void 0;
6445
+ (function (ImageFormat) {
6446
+ ImageFormat["Jpg"] = "jpg";
6447
+ ImageFormat["Jpeg"] = "jpeg";
6448
+ ImageFormat["Png"] = "png";
6449
+ ImageFormat["Webp"] = "webp";
6450
+ ImageFormat["Heic"] = "heic";
6451
+ ImageFormat["Avif"] = "avif";
6452
+ ImageFormat["Gif"] = "gif";
6453
+ })(exports.ImageFormat || (exports.ImageFormat = {}));
6272
6454
 
6273
6455
  exports.ExecutionMethod = void 0;
6274
6456
  (function (ExecutionMethod) {
@@ -6294,16 +6476,12 @@ exports.ImageGravity = void 0;
6294
6476
  ImageGravity["BottomRight"] = "bottom-right";
6295
6477
  })(exports.ImageGravity || (exports.ImageGravity = {}));
6296
6478
 
6297
- exports.ImageFormat = void 0;
6298
- (function (ImageFormat) {
6299
- ImageFormat["Jpg"] = "jpg";
6300
- ImageFormat["Jpeg"] = "jpeg";
6301
- ImageFormat["Png"] = "png";
6302
- ImageFormat["Webp"] = "webp";
6303
- ImageFormat["Heic"] = "heic";
6304
- ImageFormat["Avif"] = "avif";
6305
- ImageFormat["Gif"] = "gif";
6306
- })(exports.ImageFormat || (exports.ImageFormat = {}));
6479
+ exports.Roles = void 0;
6480
+ (function (Roles) {
6481
+ Roles["Admin"] = "admin";
6482
+ Roles["Developer"] = "developer";
6483
+ Roles["Owner"] = "owner";
6484
+ })(exports.Roles || (exports.Roles = {}));
6307
6485
 
6308
6486
  exports.ExecutionTrigger = void 0;
6309
6487
  (function (ExecutionTrigger) {
@@ -6324,6 +6502,7 @@ exports.ExecutionStatus = void 0;
6324
6502
  exports.Account = Account;
6325
6503
  exports.AppwriteException = AppwriteException;
6326
6504
  exports.Avatars = Avatars;
6505
+ exports.Channel = Channel;
6327
6506
  exports.Client = Client;
6328
6507
  exports.Databases = Databases;
6329
6508
  exports.Functions = Functions;