@appwrite.io/console 18.1.0 → 18.2.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/dist/esm/sdk.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import JSONbigModule from 'json-bigint';
2
- import { Buffer } from 'buffer';
3
- import mqtt from 'mqtt';
4
2
 
5
3
  /******************************************************************************
6
4
  Copyright (c) Microsoft Corporation.
@@ -669,7 +667,7 @@ class Client {
669
667
  'x-sdk-name': 'Console',
670
668
  'x-sdk-platform': 'console',
671
669
  'x-sdk-language': 'web',
672
- 'x-sdk-version': '18.1.0',
670
+ 'x-sdk-version': '18.2.0',
673
671
  'X-Appwrite-Response-Format': '2.3.0',
674
672
  };
675
673
  this.realtime = {
@@ -936,7 +934,10 @@ class Client {
936
934
  *
937
935
  * A stable client id for the AppwritePush service. The broker keys its
938
936
  * offline-replay cursor on this id, so pass a stable value to resume replay across
939
- * reloads/restarts. Defaults to a per-connection id when unset.
937
+ * reloads/restarts. Defaults, when unset, to one per user and tab: stable across reloads of
938
+ * the tab, different in every other tab, and distinct for each connection open at the same
939
+ * time, so no two connections take over each other's session. An explicit id shared by
940
+ * several tabs or connections makes them do that.
940
941
  *
941
942
  * @param {string} pushClientId
942
943
  *
@@ -3352,15 +3353,25 @@ class Account {
3352
3353
  };
3353
3354
  return this.client.call('put', uri, apiHeaders, apiPayload);
3354
3355
  }
3355
- /**
3356
- * Get the list of active sessions across different devices for the currently logged in user.
3357
- *
3358
- * @throws {AppwriteException}
3359
- * @returns {Promise<Models.SessionList>}
3360
- */
3361
- listSessions() {
3356
+ listSessions(paramsOrFirst) {
3357
+ let params;
3358
+ if (typeof paramsOrFirst === 'undefined' ||
3359
+ (paramsOrFirst &&
3360
+ typeof paramsOrFirst === 'object' &&
3361
+ !Array.isArray(paramsOrFirst))) {
3362
+ params = (paramsOrFirst || {});
3363
+ }
3364
+ else {
3365
+ params = {
3366
+ total: paramsOrFirst,
3367
+ };
3368
+ }
3369
+ const total = params.total;
3362
3370
  const apiPath = '/account/sessions';
3363
3371
  const apiPayload = {};
3372
+ if (typeof total !== 'undefined') {
3373
+ apiPayload['total'] = total;
3374
+ }
3364
3375
  const uri = new URL(this.client.config.endpoint + apiPath);
3365
3376
  const apiHeaders = {
3366
3377
  'X-Appwrite-Project': this.client.config.project,
@@ -3368,15 +3379,25 @@ class Account {
3368
3379
  };
3369
3380
  return this.client.call('get', uri, apiHeaders, apiPayload);
3370
3381
  }
3371
- /**
3372
- * Delete all sessions from the user account and remove any sessions cookies from the end client.
3373
- *
3374
- * @throws {AppwriteException}
3375
- * @returns {Promise<{}>}
3376
- */
3377
- deleteSessions() {
3382
+ deleteSessions(paramsOrFirst) {
3383
+ let params;
3384
+ if (typeof paramsOrFirst === 'undefined' ||
3385
+ (paramsOrFirst &&
3386
+ typeof paramsOrFirst === 'object' &&
3387
+ !Array.isArray(paramsOrFirst))) {
3388
+ params = (paramsOrFirst || {});
3389
+ }
3390
+ else {
3391
+ params = {
3392
+ current: paramsOrFirst,
3393
+ };
3394
+ }
3395
+ const current = params.current;
3378
3396
  const apiPath = '/account/sessions';
3379
3397
  const apiPayload = {};
3398
+ if (typeof current !== 'undefined') {
3399
+ apiPayload['current'] = current;
3400
+ }
3380
3401
  const uri = new URL(this.client.config.endpoint + apiPath);
3381
3402
  const apiHeaders = {
3382
3403
  'X-Appwrite-Project': this.client.config.project,
@@ -3413,10 +3434,12 @@ class Account {
3413
3434
  params = {
3414
3435
  email: paramsOrFirst,
3415
3436
  password: rest[0],
3437
+ duration: rest[1],
3416
3438
  };
3417
3439
  }
3418
3440
  const email = params.email;
3419
3441
  const password = params.password;
3442
+ const duration = params.duration;
3420
3443
  if (typeof email === 'undefined') {
3421
3444
  throw new AppwriteException('Missing required parameter: "email"');
3422
3445
  }
@@ -3431,6 +3454,9 @@ class Account {
3431
3454
  if (typeof password !== 'undefined') {
3432
3455
  apiPayload['password'] = password;
3433
3456
  }
3457
+ if (typeof duration !== 'undefined') {
3458
+ apiPayload['duration'] = duration;
3459
+ }
3434
3460
  const uri = new URL(this.client.config.endpoint + apiPath);
3435
3461
  const apiHeaders = {
3436
3462
  'X-Appwrite-Project': this.client.config.project,
@@ -5714,6 +5740,56 @@ class Avatars {
5714
5740
  }
5715
5741
  return uri.toString();
5716
5742
  }
5743
+ updatePhoto(paramsOrFirst, ...rest) {
5744
+ let params;
5745
+ let onProgress;
5746
+ if (paramsOrFirst &&
5747
+ typeof paramsOrFirst === 'object' &&
5748
+ !Array.isArray(paramsOrFirst) &&
5749
+ ('file' in paramsOrFirst || 'onProgress' in paramsOrFirst)) {
5750
+ params = (paramsOrFirst || {});
5751
+ onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
5752
+ }
5753
+ else {
5754
+ params = {
5755
+ file: paramsOrFirst,
5756
+ };
5757
+ onProgress = rest[0];
5758
+ }
5759
+ const file = params.file;
5760
+ if (typeof file === 'undefined') {
5761
+ throw new AppwriteException('Missing required parameter: "file"');
5762
+ }
5763
+ const apiPath = '/avatars/photo';
5764
+ const apiPayload = {};
5765
+ if (typeof file !== 'undefined') {
5766
+ apiPayload['file'] = file;
5767
+ }
5768
+ const uri = new URL(this.client.config.endpoint + apiPath);
5769
+ const apiHeaders = {
5770
+ 'X-Appwrite-Project': this.client.config.project,
5771
+ 'content-type': 'multipart/form-data',
5772
+ accept: 'application/json',
5773
+ };
5774
+ return this.client.chunkedUpload('put', uri, apiHeaders, apiPayload, onProgress);
5775
+ }
5776
+ /**
5777
+ * Delete the profile photo of the currently authenticated user and store the built-in static placeholder in its place. The placeholder is the user's photo from then on, so it takes priority over every other photo source — OAuth2 identity photos, Gravatar, Libravatar, and initials — until a new photo is uploaded with avatars.updatePhoto.
5778
+ *
5779
+ * @throws {AppwriteException}
5780
+ * @returns {Promise<{}>}
5781
+ */
5782
+ deletePhoto() {
5783
+ const apiPath = '/avatars/photo';
5784
+ const apiPayload = {};
5785
+ const uri = new URL(this.client.config.endpoint + apiPath);
5786
+ const apiHeaders = {
5787
+ 'X-Appwrite-Project': this.client.config.project,
5788
+ 'content-type': 'application/json',
5789
+ accept: 'application/json',
5790
+ };
5791
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
5792
+ }
5717
5793
  getQR(paramsOrFirst, ...rest) {
5718
5794
  let params;
5719
5795
  if (paramsOrFirst &&
@@ -6416,15 +6492,25 @@ class Console {
6416
6492
  };
6417
6493
  return this.client.call('get', uri, apiHeaders, apiPayload);
6418
6494
  }
6419
- /**
6420
- * List all OAuth2 providers supported by the Appwrite server, along with the parameters required to configure each provider. The response excludes mock providers but includes sandbox providers.
6421
- *
6422
- * @throws {AppwriteException}
6423
- * @returns {Promise<Models.ConsoleOAuth2ProviderList>}
6424
- */
6425
- listOAuth2Providers() {
6495
+ listOAuth2Providers(paramsOrFirst) {
6496
+ let params;
6497
+ if (typeof paramsOrFirst === 'undefined' ||
6498
+ (paramsOrFirst &&
6499
+ typeof paramsOrFirst === 'object' &&
6500
+ !Array.isArray(paramsOrFirst))) {
6501
+ params = (paramsOrFirst || {});
6502
+ }
6503
+ else {
6504
+ params = {
6505
+ total: paramsOrFirst,
6506
+ };
6507
+ }
6508
+ const total = params.total;
6426
6509
  const apiPath = '/console/oauth2-providers';
6427
6510
  const apiPayload = {};
6511
+ if (typeof total !== 'undefined') {
6512
+ apiPayload['total'] = total;
6513
+ }
6428
6514
  const uri = new URL(this.client.config.endpoint + apiPath);
6429
6515
  const apiHeaders = {
6430
6516
  'X-Appwrite-Project': this.client.config.project,
@@ -6604,15 +6690,25 @@ class Console {
6604
6690
  };
6605
6691
  return this.client.call('get', uri, apiHeaders, apiPayload);
6606
6692
  }
6607
- /**
6608
- * List all scopes available for organization API keys, along with a description for each scope.
6609
- *
6610
- * @throws {AppwriteException}
6611
- * @returns {Promise<Models.ConsoleKeyScopeList>}
6612
- */
6613
- listOrganizationScopes() {
6693
+ listOrganizationScopes(paramsOrFirst) {
6694
+ let params;
6695
+ if (typeof paramsOrFirst === 'undefined' ||
6696
+ (paramsOrFirst &&
6697
+ typeof paramsOrFirst === 'object' &&
6698
+ !Array.isArray(paramsOrFirst))) {
6699
+ params = (paramsOrFirst || {});
6700
+ }
6701
+ else {
6702
+ params = {
6703
+ total: paramsOrFirst,
6704
+ };
6705
+ }
6706
+ const total = params.total;
6614
6707
  const apiPath = '/console/scopes/organization';
6615
6708
  const apiPayload = {};
6709
+ if (typeof total !== 'undefined') {
6710
+ apiPayload['total'] = total;
6711
+ }
6616
6712
  const uri = new URL(this.client.config.endpoint + apiPath);
6617
6713
  const apiHeaders = {
6618
6714
  'X-Appwrite-Project': this.client.config.project,
@@ -6620,15 +6716,25 @@ class Console {
6620
6716
  };
6621
6717
  return this.client.call('get', uri, apiHeaders, apiPayload);
6622
6718
  }
6623
- /**
6624
- * List all scopes available for project API keys, along with a description for each scope.
6625
- *
6626
- * @throws {AppwriteException}
6627
- * @returns {Promise<Models.ConsoleKeyScopeList>}
6628
- */
6629
- listProjectScopes() {
6719
+ listProjectScopes(paramsOrFirst) {
6720
+ let params;
6721
+ if (typeof paramsOrFirst === 'undefined' ||
6722
+ (paramsOrFirst &&
6723
+ typeof paramsOrFirst === 'object' &&
6724
+ !Array.isArray(paramsOrFirst))) {
6725
+ params = (paramsOrFirst || {});
6726
+ }
6727
+ else {
6728
+ params = {
6729
+ total: paramsOrFirst,
6730
+ };
6731
+ }
6732
+ const total = params.total;
6630
6733
  const apiPath = '/console/scopes/project';
6631
6734
  const apiPayload = {};
6735
+ if (typeof total !== 'undefined') {
6736
+ apiPayload['total'] = total;
6737
+ }
6632
6738
  const uri = new URL(this.client.config.endpoint + apiPath);
6633
6739
  const apiHeaders = {
6634
6740
  'X-Appwrite-Project': this.client.config.project,
@@ -6961,9 +7067,9 @@ class Databases {
6961
7067
  };
6962
7068
  return this.client.call('post', uri, apiHeaders, apiPayload);
6963
7069
  }
6964
- listTransactions(paramsOrFirst) {
7070
+ listTransactions(paramsOrFirst, ...rest) {
6965
7071
  let params;
6966
- if (typeof paramsOrFirst === 'undefined' ||
7072
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
6967
7073
  (paramsOrFirst &&
6968
7074
  typeof paramsOrFirst === 'object' &&
6969
7075
  !Array.isArray(paramsOrFirst))) {
@@ -6972,14 +7078,19 @@ class Databases {
6972
7078
  else {
6973
7079
  params = {
6974
7080
  queries: paramsOrFirst,
7081
+ total: rest[0],
6975
7082
  };
6976
7083
  }
6977
7084
  const queries = params.queries;
7085
+ const total = params.total;
6978
7086
  const apiPath = '/databases/transactions';
6979
7087
  const apiPayload = {};
6980
7088
  if (typeof queries !== 'undefined') {
6981
7089
  apiPayload['queries'] = queries;
6982
7090
  }
7091
+ if (typeof total !== 'undefined') {
7092
+ apiPayload['total'] = total;
7093
+ }
6983
7094
  const uri = new URL(this.client.config.endpoint + apiPath);
6984
7095
  const apiHeaders = {
6985
7096
  'X-Appwrite-Project': this.client.config.project,
@@ -10722,9 +10833,9 @@ class DocumentsDB {
10722
10833
  };
10723
10834
  return this.client.call('get', uri, apiHeaders, apiPayload);
10724
10835
  }
10725
- listTransactions(paramsOrFirst) {
10836
+ listTransactions(paramsOrFirst, ...rest) {
10726
10837
  let params;
10727
- if (typeof paramsOrFirst === 'undefined' ||
10838
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
10728
10839
  (paramsOrFirst &&
10729
10840
  typeof paramsOrFirst === 'object' &&
10730
10841
  !Array.isArray(paramsOrFirst))) {
@@ -10733,14 +10844,19 @@ class DocumentsDB {
10733
10844
  else {
10734
10845
  params = {
10735
10846
  queries: paramsOrFirst,
10847
+ total: rest[0],
10736
10848
  };
10737
10849
  }
10738
10850
  const queries = params.queries;
10851
+ const total = params.total;
10739
10852
  const apiPath = '/documentsdb/transactions';
10740
10853
  const apiPayload = {};
10741
10854
  if (typeof queries !== 'undefined') {
10742
10855
  apiPayload['queries'] = queries;
10743
10856
  }
10857
+ if (typeof total !== 'undefined') {
10858
+ apiPayload['total'] = total;
10859
+ }
10744
10860
  const uri = new URL(this.client.config.endpoint + apiPath);
10745
10861
  const apiHeaders = {
10746
10862
  'X-Appwrite-Project': this.client.config.project,
@@ -14706,15 +14822,25 @@ class Functions {
14706
14822
  };
14707
14823
  return this.client.call('post', uri, apiHeaders, apiPayload);
14708
14824
  }
14709
- /**
14710
- * Get a list of all runtimes that are currently active on your instance.
14711
- *
14712
- * @throws {AppwriteException}
14713
- * @returns {Promise<Models.RuntimeList>}
14714
- */
14715
- listRuntimes() {
14825
+ listRuntimes(paramsOrFirst) {
14826
+ let params;
14827
+ if (typeof paramsOrFirst === 'undefined' ||
14828
+ (paramsOrFirst &&
14829
+ typeof paramsOrFirst === 'object' &&
14830
+ !Array.isArray(paramsOrFirst))) {
14831
+ params = (paramsOrFirst || {});
14832
+ }
14833
+ else {
14834
+ params = {
14835
+ total: paramsOrFirst,
14836
+ };
14837
+ }
14838
+ const total = params.total;
14716
14839
  const apiPath = '/functions/runtimes';
14717
14840
  const apiPayload = {};
14841
+ if (typeof total !== 'undefined') {
14842
+ apiPayload['total'] = total;
14843
+ }
14718
14844
  const uri = new URL(this.client.config.endpoint + apiPath);
14719
14845
  const apiHeaders = {
14720
14846
  'X-Appwrite-Project': this.client.config.project,
@@ -14722,9 +14848,9 @@ class Functions {
14722
14848
  };
14723
14849
  return this.client.call('get', uri, apiHeaders, apiPayload);
14724
14850
  }
14725
- listSpecifications(paramsOrFirst) {
14851
+ listSpecifications(paramsOrFirst, ...rest) {
14726
14852
  let params;
14727
- if (typeof paramsOrFirst === 'undefined' ||
14853
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
14728
14854
  (paramsOrFirst &&
14729
14855
  typeof paramsOrFirst === 'object' &&
14730
14856
  !Array.isArray(paramsOrFirst))) {
@@ -14733,14 +14859,19 @@ class Functions {
14733
14859
  else {
14734
14860
  params = {
14735
14861
  type: paramsOrFirst,
14862
+ total: rest[0],
14736
14863
  };
14737
14864
  }
14738
14865
  const type = params.type;
14866
+ const total = params.total;
14739
14867
  const apiPath = '/functions/specifications';
14740
14868
  const apiPayload = {};
14741
14869
  if (typeof type !== 'undefined') {
14742
14870
  apiPayload['type'] = type;
14743
14871
  }
14872
+ if (typeof total !== 'undefined') {
14873
+ apiPayload['total'] = total;
14874
+ }
14744
14875
  const uri = new URL(this.client.config.endpoint + apiPath);
14745
14876
  const apiHeaders = {
14746
14877
  'X-Appwrite-Project': this.client.config.project,
@@ -16052,15 +16183,25 @@ class Locale {
16052
16183
  };
16053
16184
  return this.client.call('get', uri, apiHeaders, apiPayload);
16054
16185
  }
16055
- /**
16056
- * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
16057
- *
16058
- * @throws {AppwriteException}
16059
- * @returns {Promise<Models.LocaleCodeList>}
16060
- */
16061
- listCodes() {
16186
+ listCodes(paramsOrFirst) {
16187
+ let params;
16188
+ if (typeof paramsOrFirst === 'undefined' ||
16189
+ (paramsOrFirst &&
16190
+ typeof paramsOrFirst === 'object' &&
16191
+ !Array.isArray(paramsOrFirst))) {
16192
+ params = (paramsOrFirst || {});
16193
+ }
16194
+ else {
16195
+ params = {
16196
+ total: paramsOrFirst,
16197
+ };
16198
+ }
16199
+ const total = params.total;
16062
16200
  const apiPath = '/locale/codes';
16063
16201
  const apiPayload = {};
16202
+ if (typeof total !== 'undefined') {
16203
+ apiPayload['total'] = total;
16204
+ }
16064
16205
  const uri = new URL(this.client.config.endpoint + apiPath);
16065
16206
  const apiHeaders = {
16066
16207
  'X-Appwrite-Project': this.client.config.project,
@@ -16068,15 +16209,25 @@ class Locale {
16068
16209
  };
16069
16210
  return this.client.call('get', uri, apiHeaders, apiPayload);
16070
16211
  }
16071
- /**
16072
- * List of all continents. You can use the locale header to get the data in a supported language.
16073
- *
16074
- * @throws {AppwriteException}
16075
- * @returns {Promise<Models.ContinentList>}
16076
- */
16077
- listContinents() {
16212
+ listContinents(paramsOrFirst) {
16213
+ let params;
16214
+ if (typeof paramsOrFirst === 'undefined' ||
16215
+ (paramsOrFirst &&
16216
+ typeof paramsOrFirst === 'object' &&
16217
+ !Array.isArray(paramsOrFirst))) {
16218
+ params = (paramsOrFirst || {});
16219
+ }
16220
+ else {
16221
+ params = {
16222
+ total: paramsOrFirst,
16223
+ };
16224
+ }
16225
+ const total = params.total;
16078
16226
  const apiPath = '/locale/continents';
16079
16227
  const apiPayload = {};
16228
+ if (typeof total !== 'undefined') {
16229
+ apiPayload['total'] = total;
16230
+ }
16080
16231
  const uri = new URL(this.client.config.endpoint + apiPath);
16081
16232
  const apiHeaders = {
16082
16233
  'X-Appwrite-Project': this.client.config.project,
@@ -16084,15 +16235,25 @@ class Locale {
16084
16235
  };
16085
16236
  return this.client.call('get', uri, apiHeaders, apiPayload);
16086
16237
  }
16087
- /**
16088
- * List of all countries. You can use the locale header to get the data in a supported language.
16089
- *
16090
- * @throws {AppwriteException}
16091
- * @returns {Promise<Models.CountryList>}
16092
- */
16093
- listCountries() {
16238
+ listCountries(paramsOrFirst) {
16239
+ let params;
16240
+ if (typeof paramsOrFirst === 'undefined' ||
16241
+ (paramsOrFirst &&
16242
+ typeof paramsOrFirst === 'object' &&
16243
+ !Array.isArray(paramsOrFirst))) {
16244
+ params = (paramsOrFirst || {});
16245
+ }
16246
+ else {
16247
+ params = {
16248
+ total: paramsOrFirst,
16249
+ };
16250
+ }
16251
+ const total = params.total;
16094
16252
  const apiPath = '/locale/countries';
16095
16253
  const apiPayload = {};
16254
+ if (typeof total !== 'undefined') {
16255
+ apiPayload['total'] = total;
16256
+ }
16096
16257
  const uri = new URL(this.client.config.endpoint + apiPath);
16097
16258
  const apiHeaders = {
16098
16259
  'X-Appwrite-Project': this.client.config.project,
@@ -16100,15 +16261,25 @@ class Locale {
16100
16261
  };
16101
16262
  return this.client.call('get', uri, apiHeaders, apiPayload);
16102
16263
  }
16103
- /**
16104
- * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
16105
- *
16106
- * @throws {AppwriteException}
16107
- * @returns {Promise<Models.CountryList>}
16108
- */
16109
- listCountriesEU() {
16264
+ listCountriesEU(paramsOrFirst) {
16265
+ let params;
16266
+ if (typeof paramsOrFirst === 'undefined' ||
16267
+ (paramsOrFirst &&
16268
+ typeof paramsOrFirst === 'object' &&
16269
+ !Array.isArray(paramsOrFirst))) {
16270
+ params = (paramsOrFirst || {});
16271
+ }
16272
+ else {
16273
+ params = {
16274
+ total: paramsOrFirst,
16275
+ };
16276
+ }
16277
+ const total = params.total;
16110
16278
  const apiPath = '/locale/countries/eu';
16111
16279
  const apiPayload = {};
16280
+ if (typeof total !== 'undefined') {
16281
+ apiPayload['total'] = total;
16282
+ }
16112
16283
  const uri = new URL(this.client.config.endpoint + apiPath);
16113
16284
  const apiHeaders = {
16114
16285
  'X-Appwrite-Project': this.client.config.project,
@@ -16116,15 +16287,25 @@ class Locale {
16116
16287
  };
16117
16288
  return this.client.call('get', uri, apiHeaders, apiPayload);
16118
16289
  }
16119
- /**
16120
- * List of all countries phone codes. You can use the locale header to get the data in a supported language.
16121
- *
16122
- * @throws {AppwriteException}
16123
- * @returns {Promise<Models.PhoneList>}
16124
- */
16125
- listCountriesPhones() {
16290
+ listCountriesPhones(paramsOrFirst) {
16291
+ let params;
16292
+ if (typeof paramsOrFirst === 'undefined' ||
16293
+ (paramsOrFirst &&
16294
+ typeof paramsOrFirst === 'object' &&
16295
+ !Array.isArray(paramsOrFirst))) {
16296
+ params = (paramsOrFirst || {});
16297
+ }
16298
+ else {
16299
+ params = {
16300
+ total: paramsOrFirst,
16301
+ };
16302
+ }
16303
+ const total = params.total;
16126
16304
  const apiPath = '/locale/countries/phones';
16127
16305
  const apiPayload = {};
16306
+ if (typeof total !== 'undefined') {
16307
+ apiPayload['total'] = total;
16308
+ }
16128
16309
  const uri = new URL(this.client.config.endpoint + apiPath);
16129
16310
  const apiHeaders = {
16130
16311
  'X-Appwrite-Project': this.client.config.project,
@@ -16132,15 +16313,25 @@ class Locale {
16132
16313
  };
16133
16314
  return this.client.call('get', uri, apiHeaders, apiPayload);
16134
16315
  }
16135
- /**
16136
- * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
16137
- *
16138
- * @throws {AppwriteException}
16139
- * @returns {Promise<Models.CurrencyList>}
16140
- */
16141
- listCurrencies() {
16316
+ listCurrencies(paramsOrFirst) {
16317
+ let params;
16318
+ if (typeof paramsOrFirst === 'undefined' ||
16319
+ (paramsOrFirst &&
16320
+ typeof paramsOrFirst === 'object' &&
16321
+ !Array.isArray(paramsOrFirst))) {
16322
+ params = (paramsOrFirst || {});
16323
+ }
16324
+ else {
16325
+ params = {
16326
+ total: paramsOrFirst,
16327
+ };
16328
+ }
16329
+ const total = params.total;
16142
16330
  const apiPath = '/locale/currencies';
16143
16331
  const apiPayload = {};
16332
+ if (typeof total !== 'undefined') {
16333
+ apiPayload['total'] = total;
16334
+ }
16144
16335
  const uri = new URL(this.client.config.endpoint + apiPath);
16145
16336
  const apiHeaders = {
16146
16337
  'X-Appwrite-Project': this.client.config.project,
@@ -16148,15 +16339,25 @@ class Locale {
16148
16339
  };
16149
16340
  return this.client.call('get', uri, apiHeaders, apiPayload);
16150
16341
  }
16151
- /**
16152
- * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
16153
- *
16154
- * @throws {AppwriteException}
16155
- * @returns {Promise<Models.LanguageList>}
16156
- */
16157
- listLanguages() {
16342
+ listLanguages(paramsOrFirst) {
16343
+ let params;
16344
+ if (typeof paramsOrFirst === 'undefined' ||
16345
+ (paramsOrFirst &&
16346
+ typeof paramsOrFirst === 'object' &&
16347
+ !Array.isArray(paramsOrFirst))) {
16348
+ params = (paramsOrFirst || {});
16349
+ }
16350
+ else {
16351
+ params = {
16352
+ total: paramsOrFirst,
16353
+ };
16354
+ }
16355
+ const total = params.total;
16158
16356
  const apiPath = '/locale/languages';
16159
16357
  const apiPayload = {};
16358
+ if (typeof total !== 'undefined') {
16359
+ apiPayload['total'] = total;
16360
+ }
16160
16361
  const uri = new URL(this.client.config.endpoint + apiPath);
16161
16362
  const apiHeaders = {
16162
16363
  'X-Appwrite-Project': this.client.config.project,
@@ -16590,40 +16791,46 @@ class Messaging {
16590
16791
  else {
16591
16792
  params = {
16592
16793
  messageId: paramsOrFirst,
16593
- topics: rest[0],
16594
- users: rest[1],
16595
- targets: rest[2],
16596
- subject: rest[3],
16597
- content: rest[4],
16598
- draft: rest[5],
16599
- html: rest[6],
16600
- cc: rest[7],
16601
- bcc: rest[8],
16602
- replyToEmail: rest[9],
16603
- replyToName: rest[10],
16604
- scheduledAt: rest[11],
16605
- attachments: rest[12],
16794
+ subject: rest[0],
16795
+ content: rest[1],
16796
+ topics: rest[2],
16797
+ users: rest[3],
16798
+ targets: rest[4],
16799
+ cc: rest[5],
16800
+ bcc: rest[6],
16801
+ attachments: rest[7],
16802
+ replyToEmail: rest[8],
16803
+ replyToName: rest[9],
16804
+ draft: rest[10],
16805
+ html: rest[11],
16806
+ scheduledAt: rest[12],
16606
16807
  };
16607
16808
  }
16608
16809
  const messageId = params.messageId;
16810
+ const subject = params.subject;
16811
+ const content = params.content;
16609
16812
  const topics = params.topics;
16610
16813
  const users = params.users;
16611
16814
  const targets = params.targets;
16612
- const subject = params.subject;
16613
- const content = params.content;
16614
- const draft = params.draft;
16615
- const html = params.html;
16616
16815
  const cc = params.cc;
16617
16816
  const bcc = params.bcc;
16817
+ const attachments = params.attachments;
16618
16818
  const replyToEmail = params.replyToEmail;
16619
16819
  const replyToName = params.replyToName;
16820
+ const draft = params.draft;
16821
+ const html = params.html;
16620
16822
  const scheduledAt = params.scheduledAt;
16621
- const attachments = params.attachments;
16622
16823
  if (typeof messageId === 'undefined' || messageId === '') {
16623
16824
  throw new AppwriteException('Missing required parameter: "messageId"');
16624
16825
  }
16625
16826
  const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
16626
16827
  const apiPayload = {};
16828
+ if (typeof subject !== 'undefined') {
16829
+ apiPayload['subject'] = subject;
16830
+ }
16831
+ if (typeof content !== 'undefined') {
16832
+ apiPayload['content'] = content;
16833
+ }
16627
16834
  if (typeof topics !== 'undefined') {
16628
16835
  apiPayload['topics'] = topics;
16629
16836
  }
@@ -16633,36 +16840,30 @@ class Messaging {
16633
16840
  if (typeof targets !== 'undefined') {
16634
16841
  apiPayload['targets'] = targets;
16635
16842
  }
16636
- if (typeof subject !== 'undefined') {
16637
- apiPayload['subject'] = subject;
16638
- }
16639
- if (typeof content !== 'undefined') {
16640
- apiPayload['content'] = content;
16641
- }
16642
- if (typeof draft !== 'undefined') {
16643
- apiPayload['draft'] = draft;
16644
- }
16645
- if (typeof html !== 'undefined') {
16646
- apiPayload['html'] = html;
16647
- }
16648
16843
  if (typeof cc !== 'undefined') {
16649
16844
  apiPayload['cc'] = cc;
16650
16845
  }
16651
16846
  if (typeof bcc !== 'undefined') {
16652
16847
  apiPayload['bcc'] = bcc;
16653
16848
  }
16849
+ if (typeof attachments !== 'undefined') {
16850
+ apiPayload['attachments'] = attachments;
16851
+ }
16654
16852
  if (typeof replyToEmail !== 'undefined') {
16655
16853
  apiPayload['replyToEmail'] = replyToEmail;
16656
16854
  }
16657
16855
  if (typeof replyToName !== 'undefined') {
16658
16856
  apiPayload['replyToName'] = replyToName;
16659
16857
  }
16858
+ if (typeof draft !== 'undefined') {
16859
+ apiPayload['draft'] = draft;
16860
+ }
16861
+ if (typeof html !== 'undefined') {
16862
+ apiPayload['html'] = html;
16863
+ }
16660
16864
  if (typeof scheduledAt !== 'undefined') {
16661
16865
  apiPayload['scheduledAt'] = scheduledAt;
16662
16866
  }
16663
- if (typeof attachments !== 'undefined') {
16664
- apiPayload['attachments'] = attachments;
16665
- }
16666
16867
  const uri = new URL(this.client.config.endpoint + apiPath);
16667
16868
  const apiHeaders = {
16668
16869
  'X-Appwrite-Project': this.client.config.project,
@@ -16699,6 +16900,7 @@ class Messaging {
16699
16900
  contentAvailable: rest[15],
16700
16901
  critical: rest[16],
16701
16902
  priority: rest[17],
16903
+ channelId: rest[18],
16702
16904
  };
16703
16905
  }
16704
16906
  const messageId = params.messageId;
@@ -16720,6 +16922,7 @@ class Messaging {
16720
16922
  const contentAvailable = params.contentAvailable;
16721
16923
  const critical = params.critical;
16722
16924
  const priority = params.priority;
16925
+ const channelId = params.channelId;
16723
16926
  if (typeof messageId === 'undefined') {
16724
16927
  throw new AppwriteException('Missing required parameter: "messageId"');
16725
16928
  }
@@ -16782,6 +16985,9 @@ class Messaging {
16782
16985
  if (typeof priority !== 'undefined') {
16783
16986
  apiPayload['priority'] = priority;
16784
16987
  }
16988
+ if (typeof channelId !== 'undefined') {
16989
+ apiPayload['channelId'] = channelId;
16990
+ }
16785
16991
  const uri = new URL(this.client.config.endpoint + apiPath);
16786
16992
  const apiHeaders = {
16787
16993
  'X-Appwrite-Project': this.client.config.project,
@@ -16800,11 +17006,11 @@ class Messaging {
16800
17006
  else {
16801
17007
  params = {
16802
17008
  messageId: paramsOrFirst,
16803
- topics: rest[0],
16804
- users: rest[1],
16805
- targets: rest[2],
16806
- title: rest[3],
16807
- body: rest[4],
17009
+ title: rest[0],
17010
+ body: rest[1],
17011
+ topics: rest[2],
17012
+ users: rest[3],
17013
+ targets: rest[4],
16808
17014
  data: rest[5],
16809
17015
  action: rest[6],
16810
17016
  image: rest[7],
@@ -16818,14 +17024,15 @@ class Messaging {
16818
17024
  contentAvailable: rest[15],
16819
17025
  critical: rest[16],
16820
17026
  priority: rest[17],
17027
+ channelId: rest[18],
16821
17028
  };
16822
17029
  }
16823
17030
  const messageId = params.messageId;
17031
+ const title = params.title;
17032
+ const body = params.body;
16824
17033
  const topics = params.topics;
16825
17034
  const users = params.users;
16826
17035
  const targets = params.targets;
16827
- const title = params.title;
16828
- const body = params.body;
16829
17036
  const data = params.data;
16830
17037
  const action = params.action;
16831
17038
  const image = params.image;
@@ -16839,11 +17046,18 @@ class Messaging {
16839
17046
  const contentAvailable = params.contentAvailable;
16840
17047
  const critical = params.critical;
16841
17048
  const priority = params.priority;
17049
+ const channelId = params.channelId;
16842
17050
  if (typeof messageId === 'undefined' || messageId === '') {
16843
17051
  throw new AppwriteException('Missing required parameter: "messageId"');
16844
17052
  }
16845
17053
  const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
16846
17054
  const apiPayload = {};
17055
+ if (typeof title !== 'undefined') {
17056
+ apiPayload['title'] = title;
17057
+ }
17058
+ if (typeof body !== 'undefined') {
17059
+ apiPayload['body'] = body;
17060
+ }
16847
17061
  if (typeof topics !== 'undefined') {
16848
17062
  apiPayload['topics'] = topics;
16849
17063
  }
@@ -16853,12 +17067,6 @@ class Messaging {
16853
17067
  if (typeof targets !== 'undefined') {
16854
17068
  apiPayload['targets'] = targets;
16855
17069
  }
16856
- if (typeof title !== 'undefined') {
16857
- apiPayload['title'] = title;
16858
- }
16859
- if (typeof body !== 'undefined') {
16860
- apiPayload['body'] = body;
16861
- }
16862
17070
  if (typeof data !== 'undefined') {
16863
17071
  apiPayload['data'] = data;
16864
17072
  }
@@ -16898,6 +17106,9 @@ class Messaging {
16898
17106
  if (typeof priority !== 'undefined') {
16899
17107
  apiPayload['priority'] = priority;
16900
17108
  }
17109
+ if (typeof channelId !== 'undefined') {
17110
+ apiPayload['channelId'] = channelId;
17111
+ }
16901
17112
  const uri = new URL(this.client.config.endpoint + apiPath);
16902
17113
  const apiHeaders = {
16903
17114
  'X-Appwrite-Project': this.client.config.project,
@@ -16993,17 +17204,73 @@ class Messaging {
16993
17204
  const targets = params.targets;
16994
17205
  const draft = params.draft;
16995
17206
  const scheduledAt = params.scheduledAt;
16996
- if (typeof messageId === 'undefined') {
17207
+ if (typeof messageId === 'undefined') {
17208
+ throw new AppwriteException('Missing required parameter: "messageId"');
17209
+ }
17210
+ if (typeof content === 'undefined') {
17211
+ throw new AppwriteException('Missing required parameter: "content"');
17212
+ }
17213
+ const apiPath = '/messaging/messages/sms';
17214
+ const apiPayload = {};
17215
+ if (typeof messageId !== 'undefined') {
17216
+ apiPayload['messageId'] = messageId;
17217
+ }
17218
+ if (typeof content !== 'undefined') {
17219
+ apiPayload['content'] = content;
17220
+ }
17221
+ if (typeof topics !== 'undefined') {
17222
+ apiPayload['topics'] = topics;
17223
+ }
17224
+ if (typeof users !== 'undefined') {
17225
+ apiPayload['users'] = users;
17226
+ }
17227
+ if (typeof targets !== 'undefined') {
17228
+ apiPayload['targets'] = targets;
17229
+ }
17230
+ if (typeof draft !== 'undefined') {
17231
+ apiPayload['draft'] = draft;
17232
+ }
17233
+ if (typeof scheduledAt !== 'undefined') {
17234
+ apiPayload['scheduledAt'] = scheduledAt;
17235
+ }
17236
+ const uri = new URL(this.client.config.endpoint + apiPath);
17237
+ const apiHeaders = {
17238
+ 'X-Appwrite-Project': this.client.config.project,
17239
+ 'content-type': 'application/json',
17240
+ accept: 'application/json',
17241
+ };
17242
+ return this.client.call('post', uri, apiHeaders, apiPayload);
17243
+ }
17244
+ updateSms(paramsOrFirst, ...rest) {
17245
+ let params;
17246
+ if (paramsOrFirst &&
17247
+ typeof paramsOrFirst === 'object' &&
17248
+ !Array.isArray(paramsOrFirst)) {
17249
+ params = (paramsOrFirst || {});
17250
+ }
17251
+ else {
17252
+ params = {
17253
+ messageId: paramsOrFirst,
17254
+ content: rest[0],
17255
+ topics: rest[1],
17256
+ users: rest[2],
17257
+ targets: rest[3],
17258
+ draft: rest[4],
17259
+ scheduledAt: rest[5],
17260
+ };
17261
+ }
17262
+ const messageId = params.messageId;
17263
+ const content = params.content;
17264
+ const topics = params.topics;
17265
+ const users = params.users;
17266
+ const targets = params.targets;
17267
+ const draft = params.draft;
17268
+ const scheduledAt = params.scheduledAt;
17269
+ if (typeof messageId === 'undefined' || messageId === '') {
16997
17270
  throw new AppwriteException('Missing required parameter: "messageId"');
16998
17271
  }
16999
- if (typeof content === 'undefined') {
17000
- throw new AppwriteException('Missing required parameter: "content"');
17001
- }
17002
- const apiPath = '/messaging/messages/sms';
17272
+ const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
17003
17273
  const apiPayload = {};
17004
- if (typeof messageId !== 'undefined') {
17005
- apiPayload['messageId'] = messageId;
17006
- }
17007
17274
  if (typeof content !== 'undefined') {
17008
17275
  apiPayload['content'] = content;
17009
17276
  }
@@ -17028,9 +17295,9 @@ class Messaging {
17028
17295
  'content-type': 'application/json',
17029
17296
  accept: 'application/json',
17030
17297
  };
17031
- return this.client.call('post', uri, apiHeaders, apiPayload);
17298
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
17032
17299
  }
17033
- updateSms(paramsOrFirst, ...rest) {
17300
+ updateSMS(paramsOrFirst, ...rest) {
17034
17301
  let params;
17035
17302
  if (paramsOrFirst &&
17036
17303
  typeof paramsOrFirst === 'object' &&
@@ -17040,19 +17307,19 @@ class Messaging {
17040
17307
  else {
17041
17308
  params = {
17042
17309
  messageId: paramsOrFirst,
17043
- topics: rest[0],
17044
- users: rest[1],
17045
- targets: rest[2],
17046
- content: rest[3],
17310
+ content: rest[0],
17311
+ topics: rest[1],
17312
+ users: rest[2],
17313
+ targets: rest[3],
17047
17314
  draft: rest[4],
17048
17315
  scheduledAt: rest[5],
17049
17316
  };
17050
17317
  }
17051
17318
  const messageId = params.messageId;
17319
+ const content = params.content;
17052
17320
  const topics = params.topics;
17053
17321
  const users = params.users;
17054
17322
  const targets = params.targets;
17055
- const content = params.content;
17056
17323
  const draft = params.draft;
17057
17324
  const scheduledAt = params.scheduledAt;
17058
17325
  if (typeof messageId === 'undefined' || messageId === '') {
@@ -17060,62 +17327,9 @@ class Messaging {
17060
17327
  }
17061
17328
  const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
17062
17329
  const apiPayload = {};
17063
- if (typeof topics !== 'undefined') {
17064
- apiPayload['topics'] = topics;
17065
- }
17066
- if (typeof users !== 'undefined') {
17067
- apiPayload['users'] = users;
17068
- }
17069
- if (typeof targets !== 'undefined') {
17070
- apiPayload['targets'] = targets;
17071
- }
17072
17330
  if (typeof content !== 'undefined') {
17073
17331
  apiPayload['content'] = content;
17074
17332
  }
17075
- if (typeof draft !== 'undefined') {
17076
- apiPayload['draft'] = draft;
17077
- }
17078
- if (typeof scheduledAt !== 'undefined') {
17079
- apiPayload['scheduledAt'] = scheduledAt;
17080
- }
17081
- const uri = new URL(this.client.config.endpoint + apiPath);
17082
- const apiHeaders = {
17083
- 'X-Appwrite-Project': this.client.config.project,
17084
- 'content-type': 'application/json',
17085
- accept: 'application/json',
17086
- };
17087
- return this.client.call('patch', uri, apiHeaders, apiPayload);
17088
- }
17089
- updateSMS(paramsOrFirst, ...rest) {
17090
- let params;
17091
- if (paramsOrFirst &&
17092
- typeof paramsOrFirst === 'object' &&
17093
- !Array.isArray(paramsOrFirst)) {
17094
- params = (paramsOrFirst || {});
17095
- }
17096
- else {
17097
- params = {
17098
- messageId: paramsOrFirst,
17099
- topics: rest[0],
17100
- users: rest[1],
17101
- targets: rest[2],
17102
- content: rest[3],
17103
- draft: rest[4],
17104
- scheduledAt: rest[5],
17105
- };
17106
- }
17107
- const messageId = params.messageId;
17108
- const topics = params.topics;
17109
- const users = params.users;
17110
- const targets = params.targets;
17111
- const content = params.content;
17112
- const draft = params.draft;
17113
- const scheduledAt = params.scheduledAt;
17114
- if (typeof messageId === 'undefined' || messageId === '') {
17115
- throw new AppwriteException('Missing required parameter: "messageId"');
17116
- }
17117
- const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
17118
- const apiPayload = {};
17119
17333
  if (typeof topics !== 'undefined') {
17120
17334
  apiPayload['topics'] = topics;
17121
17335
  }
@@ -17125,9 +17339,6 @@ class Messaging {
17125
17339
  if (typeof targets !== 'undefined') {
17126
17340
  apiPayload['targets'] = targets;
17127
17341
  }
17128
- if (typeof content !== 'undefined') {
17129
- apiPayload['content'] = content;
17130
- }
17131
17342
  if (typeof draft !== 'undefined') {
17132
17343
  apiPayload['draft'] = draft;
17133
17344
  }
@@ -23199,9 +23410,9 @@ class Notifications {
23199
23410
  constructor(client) {
23200
23411
  this.client = client;
23201
23412
  }
23202
- list(paramsOrFirst) {
23413
+ list(paramsOrFirst, ...rest) {
23203
23414
  let params;
23204
- if (typeof paramsOrFirst === 'undefined' ||
23415
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
23205
23416
  (paramsOrFirst &&
23206
23417
  typeof paramsOrFirst === 'object' &&
23207
23418
  !Array.isArray(paramsOrFirst))) {
@@ -23210,14 +23421,19 @@ class Notifications {
23210
23421
  else {
23211
23422
  params = {
23212
23423
  queries: paramsOrFirst,
23424
+ total: rest[0],
23213
23425
  };
23214
23426
  }
23215
23427
  const queries = params.queries;
23428
+ const total = params.total;
23216
23429
  const apiPath = '/notifications';
23217
23430
  const apiPayload = {};
23218
23431
  if (typeof queries !== 'undefined') {
23219
23432
  apiPayload['queries'] = queries;
23220
23433
  }
23434
+ if (typeof total !== 'undefined') {
23435
+ apiPayload['total'] = total;
23436
+ }
23221
23437
  const uri = new URL(this.client.config.endpoint + apiPath);
23222
23438
  const apiHeaders = {
23223
23439
  'X-Appwrite-Project': this.client.config.project,
@@ -30507,6 +30723,43 @@ class Project {
30507
30723
  };
30508
30724
  return this.client.call('patch', uri, apiHeaders, apiPayload);
30509
30725
  }
30726
+ updateOAuth2Webflow(paramsOrFirst, ...rest) {
30727
+ let params;
30728
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
30729
+ (paramsOrFirst &&
30730
+ typeof paramsOrFirst === 'object' &&
30731
+ !Array.isArray(paramsOrFirst))) {
30732
+ params = (paramsOrFirst || {});
30733
+ }
30734
+ else {
30735
+ params = {
30736
+ clientId: paramsOrFirst,
30737
+ clientSecret: rest[0],
30738
+ enabled: rest[1],
30739
+ };
30740
+ }
30741
+ const clientId = params.clientId;
30742
+ const clientSecret = params.clientSecret;
30743
+ const enabled = params.enabled;
30744
+ const apiPath = '/project/oauth2/webflow';
30745
+ const apiPayload = {};
30746
+ if (typeof clientId !== 'undefined') {
30747
+ apiPayload['clientId'] = clientId;
30748
+ }
30749
+ if (typeof clientSecret !== 'undefined') {
30750
+ apiPayload['clientSecret'] = clientSecret;
30751
+ }
30752
+ if (typeof enabled !== 'undefined') {
30753
+ apiPayload['enabled'] = enabled;
30754
+ }
30755
+ const uri = new URL(this.client.config.endpoint + apiPath);
30756
+ const apiHeaders = {
30757
+ 'X-Appwrite-Project': this.client.config.project,
30758
+ 'content-type': 'application/json',
30759
+ accept: 'application/json',
30760
+ };
30761
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
30762
+ }
30510
30763
  updateOAuth2WordPress(paramsOrFirst, ...rest) {
30511
30764
  let params;
30512
30765
  if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
@@ -33489,15 +33742,25 @@ class Sites {
33489
33742
  };
33490
33743
  return this.client.call('post', uri, apiHeaders, apiPayload);
33491
33744
  }
33492
- /**
33493
- * Get a list of all frameworks that are currently available on the server instance.
33494
- *
33495
- * @throws {AppwriteException}
33496
- * @returns {Promise<Models.FrameworkList>}
33497
- */
33498
- listFrameworks() {
33745
+ listFrameworks(paramsOrFirst) {
33746
+ let params;
33747
+ if (typeof paramsOrFirst === 'undefined' ||
33748
+ (paramsOrFirst &&
33749
+ typeof paramsOrFirst === 'object' &&
33750
+ !Array.isArray(paramsOrFirst))) {
33751
+ params = (paramsOrFirst || {});
33752
+ }
33753
+ else {
33754
+ params = {
33755
+ total: paramsOrFirst,
33756
+ };
33757
+ }
33758
+ const total = params.total;
33499
33759
  const apiPath = '/sites/frameworks';
33500
33760
  const apiPayload = {};
33761
+ if (typeof total !== 'undefined') {
33762
+ apiPayload['total'] = total;
33763
+ }
33501
33764
  const uri = new URL(this.client.config.endpoint + apiPath);
33502
33765
  const apiHeaders = {
33503
33766
  'X-Appwrite-Project': this.client.config.project,
@@ -33505,9 +33768,9 @@ class Sites {
33505
33768
  };
33506
33769
  return this.client.call('get', uri, apiHeaders, apiPayload);
33507
33770
  }
33508
- listSpecifications(paramsOrFirst) {
33771
+ listSpecifications(paramsOrFirst, ...rest) {
33509
33772
  let params;
33510
- if (typeof paramsOrFirst === 'undefined' ||
33773
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
33511
33774
  (paramsOrFirst &&
33512
33775
  typeof paramsOrFirst === 'object' &&
33513
33776
  !Array.isArray(paramsOrFirst))) {
@@ -33516,14 +33779,19 @@ class Sites {
33516
33779
  else {
33517
33780
  params = {
33518
33781
  type: paramsOrFirst,
33782
+ total: rest[0],
33519
33783
  };
33520
33784
  }
33521
33785
  const type = params.type;
33786
+ const total = params.total;
33522
33787
  const apiPath = '/sites/specifications';
33523
33788
  const apiPayload = {};
33524
33789
  if (typeof type !== 'undefined') {
33525
33790
  apiPayload['type'] = type;
33526
33791
  }
33792
+ if (typeof total !== 'undefined') {
33793
+ apiPayload['total'] = total;
33794
+ }
33527
33795
  const uri = new URL(this.client.config.endpoint + apiPath);
33528
33796
  const apiHeaders = {
33529
33797
  'X-Appwrite-Project': this.client.config.project,
@@ -33540,7 +33808,8 @@ class Sites {
33540
33808
  ('frameworks' in paramsOrFirst ||
33541
33809
  'useCases' in paramsOrFirst ||
33542
33810
  'limit' in paramsOrFirst ||
33543
- 'offset' in paramsOrFirst))) {
33811
+ 'offset' in paramsOrFirst ||
33812
+ 'total' in paramsOrFirst))) {
33544
33813
  params = (paramsOrFirst || {});
33545
33814
  }
33546
33815
  else {
@@ -33549,12 +33818,14 @@ class Sites {
33549
33818
  useCases: rest[0],
33550
33819
  limit: rest[1],
33551
33820
  offset: rest[2],
33821
+ total: rest[3],
33552
33822
  };
33553
33823
  }
33554
33824
  const frameworks = params.frameworks;
33555
33825
  const useCases = params.useCases;
33556
33826
  const limit = params.limit;
33557
33827
  const offset = params.offset;
33828
+ const total = params.total;
33558
33829
  const apiPath = '/sites/templates';
33559
33830
  const apiPayload = {};
33560
33831
  if (typeof frameworks !== 'undefined') {
@@ -33569,6 +33840,9 @@ class Sites {
33569
33840
  if (typeof offset !== 'undefined') {
33570
33841
  apiPayload['offset'] = offset;
33571
33842
  }
33843
+ if (typeof total !== 'undefined') {
33844
+ apiPayload['total'] = total;
33845
+ }
33572
33846
  const uri = new URL(this.client.config.endpoint + apiPath);
33573
33847
  const apiHeaders = {
33574
33848
  'X-Appwrite-Project': this.client.config.project,
@@ -35267,9 +35541,9 @@ class TablesDB {
35267
35541
  };
35268
35542
  return this.client.call('get', uri, apiHeaders, apiPayload);
35269
35543
  }
35270
- listTransactions(paramsOrFirst) {
35544
+ listTransactions(paramsOrFirst, ...rest) {
35271
35545
  let params;
35272
- if (typeof paramsOrFirst === 'undefined' ||
35546
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
35273
35547
  (paramsOrFirst &&
35274
35548
  typeof paramsOrFirst === 'object' &&
35275
35549
  !Array.isArray(paramsOrFirst))) {
@@ -35278,14 +35552,19 @@ class TablesDB {
35278
35552
  else {
35279
35553
  params = {
35280
35554
  queries: paramsOrFirst,
35555
+ total: rest[0],
35281
35556
  };
35282
35557
  }
35283
35558
  const queries = params.queries;
35559
+ const total = params.total;
35284
35560
  const apiPath = '/tablesdb/transactions';
35285
35561
  const apiPayload = {};
35286
35562
  if (typeof queries !== 'undefined') {
35287
35563
  apiPayload['queries'] = queries;
35288
35564
  }
35565
+ if (typeof total !== 'undefined') {
35566
+ apiPayload['total'] = total;
35567
+ }
35289
35568
  const uri = new URL(this.client.config.endpoint + apiPath);
35290
35569
  const apiHeaders = {
35291
35570
  'X-Appwrite-Project': this.client.config.project,
@@ -42107,12 +42386,14 @@ class Vcs {
42107
42386
  type: rest[0],
42108
42387
  search: rest[1],
42109
42388
  queries: rest[2],
42389
+ total: rest[3],
42110
42390
  };
42111
42391
  }
42112
42392
  const installationId = params.installationId;
42113
42393
  const type = params.type;
42114
42394
  const search = params.search;
42115
42395
  const queries = params.queries;
42396
+ const total = params.total;
42116
42397
  if (typeof installationId === 'undefined' || installationId === '') {
42117
42398
  throw new AppwriteException('Missing required parameter: "installationId"');
42118
42399
  }
@@ -42130,6 +42411,9 @@ class Vcs {
42130
42411
  if (typeof queries !== 'undefined') {
42131
42412
  apiPayload['queries'] = queries;
42132
42413
  }
42414
+ if (typeof total !== 'undefined') {
42415
+ apiPayload['total'] = total;
42416
+ }
42133
42417
  const uri = new URL(this.client.config.endpoint + apiPath);
42134
42418
  const apiHeaders = {
42135
42419
  'X-Appwrite-Project': this.client.config.project,
@@ -42230,12 +42514,14 @@ class Vcs {
42230
42514
  providerRepositoryId: rest[0],
42231
42515
  search: rest[1],
42232
42516
  queries: rest[2],
42517
+ total: rest[3],
42233
42518
  };
42234
42519
  }
42235
42520
  const installationId = params.installationId;
42236
42521
  const providerRepositoryId = params.providerRepositoryId;
42237
42522
  const search = params.search;
42238
42523
  const queries = params.queries;
42524
+ const total = params.total;
42239
42525
  if (typeof installationId === 'undefined' || installationId === '') {
42240
42526
  throw new AppwriteException('Missing required parameter: "installationId"');
42241
42527
  }
@@ -42253,6 +42539,9 @@ class Vcs {
42253
42539
  if (typeof queries !== 'undefined') {
42254
42540
  apiPayload['queries'] = queries;
42255
42541
  }
42542
+ if (typeof total !== 'undefined') {
42543
+ apiPayload['total'] = total;
42544
+ }
42256
42545
  const uri = new URL(this.client.config.endpoint + apiPath);
42257
42546
  const apiHeaders = {
42258
42547
  'X-Appwrite-Project': this.client.config.project,
@@ -42443,11 +42732,13 @@ class Vcs {
42443
42732
  installationId: paramsOrFirst,
42444
42733
  search: rest[0],
42445
42734
  queries: rest[1],
42735
+ total: rest[2],
42446
42736
  };
42447
42737
  }
42448
42738
  const installationId = params.installationId;
42449
42739
  const search = params.search;
42450
42740
  const queries = params.queries;
42741
+ const total = params.total;
42451
42742
  if (typeof installationId === 'undefined' || installationId === '') {
42452
42743
  throw new AppwriteException('Missing required parameter: "installationId"');
42453
42744
  }
@@ -42459,6 +42750,9 @@ class Vcs {
42459
42750
  if (typeof queries !== 'undefined') {
42460
42751
  apiPayload['queries'] = queries;
42461
42752
  }
42753
+ if (typeof total !== 'undefined') {
42754
+ apiPayload['total'] = total;
42755
+ }
42462
42756
  const uri = new URL(this.client.config.endpoint + apiPath);
42463
42757
  const apiHeaders = {
42464
42758
  'X-Appwrite-Project': this.client.config.project,
@@ -42576,9 +42870,9 @@ class VectorsDB {
42576
42870
  };
42577
42871
  return this.client.call('get', uri, apiHeaders, apiPayload);
42578
42872
  }
42579
- listTransactions(paramsOrFirst) {
42873
+ listTransactions(paramsOrFirst, ...rest) {
42580
42874
  let params;
42581
- if (typeof paramsOrFirst === 'undefined' ||
42875
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
42582
42876
  (paramsOrFirst &&
42583
42877
  typeof paramsOrFirst === 'object' &&
42584
42878
  !Array.isArray(paramsOrFirst))) {
@@ -42587,14 +42881,19 @@ class VectorsDB {
42587
42881
  else {
42588
42882
  params = {
42589
42883
  queries: paramsOrFirst,
42884
+ total: rest[0],
42590
42885
  };
42591
42886
  }
42592
42887
  const queries = params.queries;
42888
+ const total = params.total;
42593
42889
  const apiPath = '/vectorsdb/transactions';
42594
42890
  const apiPayload = {};
42595
42891
  if (typeof queries !== 'undefined') {
42596
42892
  apiPayload['queries'] = queries;
42597
42893
  }
42894
+ if (typeof total !== 'undefined') {
42895
+ apiPayload['total'] = total;
42896
+ }
42598
42897
  const uri = new URL(this.client.config.endpoint + apiPath);
42599
42898
  const apiHeaders = {
42600
42899
  'X-Appwrite-Project': this.client.config.project,
@@ -45656,6 +45955,27 @@ class Realtime {
45656
45955
  }
45657
45956
  }
45658
45957
 
45958
+ const TAB_ID_KEY = 'appwrite-push-client-id';
45959
+ // Loaded on first connect, so an app that never uses Push does not bundle mqtt.js.
45960
+ let transport = null;
45961
+ function loadTransport() {
45962
+ if (!transport) {
45963
+ transport = Promise.all([import('mqtt'), import('buffer')]).then(
45964
+ // The browser build of mqtt.js (dist/mqtt.esm.js) exports only a default.
45965
+ ([mqtt, buffer]) => {
45966
+ var _a;
45967
+ return ({
45968
+ connect: ((_a = mqtt.default) !== null && _a !== void 0 ? _a : mqtt).connect,
45969
+ Buffer: buffer.Buffer,
45970
+ });
45971
+ });
45972
+ // A failed load must not poison later connects.
45973
+ transport.catch(() => {
45974
+ transport = null;
45975
+ });
45976
+ }
45977
+ return transport;
45978
+ }
45659
45979
  // Fixed connection tuning — not exposed as options.
45660
45980
  const KEEP_ALIVE_SECONDS = 60;
45661
45981
  const RECONNECT_PERIOD_MS = 2000;
@@ -45685,6 +46005,9 @@ class Push extends Service {
45685
46005
  super(client);
45686
46006
  this.mqtt = null;
45687
46007
  this.connecting = null;
46008
+ this.Buffer = null;
46009
+ /** Bumped by close(), so a connect still loading mqtt.js knows to stop. */
46010
+ this.generation = 0;
45688
46011
  /** Set once the first CONNACK lands, so 'connect' events after are reconnects. */
45689
46012
  this.everConnected = false;
45690
46013
  /** Errors already handed to onError, so one failure is reported once. */
@@ -45696,10 +46019,18 @@ class Push extends Service {
45696
46019
  // Local id -> subscription state. The id is never sent to the broker; it only lets
45697
46020
  // the same topic carry more than one callback (each with its own options).
45698
46021
  /**
45699
- * The client id when the credential names no user (and none was set): random, but kept for
45700
- * this instance so reconnects resume the same broker session.
46022
+ * This tab's part of the default client id when the tab has none yet (see claimTabId):
46023
+ * random, but kept for this instance so reconnects resume the same broker session.
45701
46024
  */
45702
46025
  this.fallbackClientId = randomId();
46026
+ /** The default client id claimed for this instance's connection, released on close(). */
46027
+ this.tabId = '';
46028
+ /** In-flight claim of {@link tabId}, memoized per generation: a credential switch (same
46029
+ * generation) shares the one claim; a close/reopen (new generation) chains a fresh claim. */
46030
+ this.tabIdClaim = null;
46031
+ this.tabIdClaimGeneration = -1;
46032
+ this.connectedKey = '';
46033
+ this.connectionEpoch = 0;
45703
46034
  this.subscriptions = new Map();
45704
46035
  }
45705
46036
  // The broker subscription for a filter uses the highest QoS any local subscription on
@@ -45800,7 +46131,17 @@ class Push extends Service {
45800
46131
  if (background) {
45801
46132
  this.requestNotificationPermission();
45802
46133
  }
45803
- const client = yield this.connect();
46134
+ let client;
46135
+ try {
46136
+ client = yield this.connect();
46137
+ }
46138
+ catch (err) {
46139
+ if (err instanceof SupersededError) {
46140
+ return this.subscribeWith(topicsOrCallback, callbackOrOptions, topicOptions);
46141
+ }
46142
+ throw err;
46143
+ }
46144
+ const epoch = this.connectionEpoch;
45804
46145
  const ids = [];
45805
46146
  const acks = [];
45806
46147
  for (const topic of topicList) {
@@ -45859,6 +46200,12 @@ class Push extends Service {
45859
46200
  yield Promise.all(acks);
45860
46201
  }
45861
46202
  catch (err) {
46203
+ if (epoch !== this.connectionEpoch) {
46204
+ for (const id of ids) {
46205
+ this.subscriptions.delete(id);
46206
+ }
46207
+ return this.subscribeWith(topicsOrCallback, callbackOrOptions, topicOptions);
46208
+ }
45862
46209
  unsubscribe();
45863
46210
  throw err;
45864
46211
  }
@@ -45919,7 +46266,14 @@ class Push extends Service {
45919
46266
  this.mqtt.end(true);
45920
46267
  this.mqtt = null;
45921
46268
  }
46269
+ if (this.tabId !== '') {
46270
+ releaseTabId(this.tabId);
46271
+ this.tabId = '';
46272
+ }
45922
46273
  this.connecting = null;
46274
+ // Bumping the generation ends the current claim: one still in flight releases its id when
46275
+ // it resolves, and the next open() chains a fresh claim after it (see claimClientId).
46276
+ this.generation++;
45923
46277
  this.everConnected = false;
45924
46278
  this.subscriptions.clear();
45925
46279
  }
@@ -45944,19 +46298,62 @@ class Push extends Service {
45944
46298
  }
45945
46299
  // --- internals ---
45946
46300
  connect() {
45947
- if (this.mqtt) {
46301
+ var _a;
46302
+ if ((this.mqtt || this.connecting) &&
46303
+ this.connectedKey !== this.credentialKey()) {
46304
+ this.connectionEpoch++;
46305
+ (_a = this.mqtt) === null || _a === void 0 ? void 0 : _a.end(true);
46306
+ this.mqtt = null;
46307
+ this.connecting = null;
46308
+ this.everConnected = this.subscriptions.size > 0;
46309
+ }
46310
+ if (this.mqtt && !this.connecting) {
45948
46311
  return Promise.resolve(this.mqtt);
45949
46312
  }
45950
46313
  if (!this.connecting) {
45951
- this.connecting = this.open();
46314
+ const connecting = this.open();
46315
+ this.connecting = connecting;
45952
46316
  // A failed open must not poison future attempts — clear the cached
45953
46317
  // in-flight promise so a later subscribe/publish can retry.
45954
- this.connecting.catch(() => {
45955
- this.connecting = null;
46318
+ connecting.catch(() => {
46319
+ if (this.connecting === connecting) {
46320
+ this.connecting = null;
46321
+ }
45956
46322
  });
45957
46323
  }
45958
46324
  return this.connecting.then(() => this.mqtt);
45959
46325
  }
46326
+ credential() {
46327
+ if (this.client.config.jwt) {
46328
+ return {
46329
+ authMethod: 'appwrite-jwt',
46330
+ credential: this.client.config.jwt,
46331
+ };
46332
+ }
46333
+ if (this.client.config.session) {
46334
+ return {
46335
+ authMethod: 'appwrite-session',
46336
+ credential: this.client.config.session,
46337
+ };
46338
+ }
46339
+ throw new Error('No credential set on the client; call Client.setJWT() or Client.setSession() first.');
46340
+ }
46341
+ credentialKey() {
46342
+ var _a, _b;
46343
+ try {
46344
+ const { authMethod, credential } = this.credential();
46345
+ return [
46346
+ this.endpointUrl(),
46347
+ (_a = this.client.config.project) !== null && _a !== void 0 ? _a : '',
46348
+ (_b = this.client.config.pushClientId) !== null && _b !== void 0 ? _b : '',
46349
+ authMethod,
46350
+ credential,
46351
+ ].join('|');
46352
+ }
46353
+ catch (_c) {
46354
+ return '';
46355
+ }
46356
+ }
45960
46357
  endpointUrl() {
45961
46358
  // The push endpoint set on the client (Client.setPushEndpoint) wins.
45962
46359
  if (this.client.config.endpointPush !== '') {
@@ -45974,35 +46371,76 @@ class Push extends Service {
45974
46371
  ? wsEndpoint
45975
46372
  : `${wsEndpoint.slice(0, at + separator.length)}push.${wsEndpoint.slice(at + separator.length)}`;
45976
46373
  }
46374
+ /**
46375
+ * Claim this connection's default client id, memoized per generation. A credential switch (same
46376
+ * generation) shares the one claim, so concurrent open() calls never each claim. A close/reopen
46377
+ * (a new generation) chains a fresh claim after the previous one has settled and released its
46378
+ * id, so the reopened connection can take the tab's stored id back rather than a fallback. A
46379
+ * claim that resolves after its generation has ended releases its id instead of keeping it, so
46380
+ * a stale open connects with nothing reserved and the stored id is never stranded.
46381
+ */
46382
+ claimClientId() {
46383
+ var _a;
46384
+ const generation = this.generation;
46385
+ if (this.tabIdClaim === null ||
46386
+ this.tabIdClaimGeneration !== generation) {
46387
+ const previous = (_a = this.tabIdClaim) !== null && _a !== void 0 ? _a : Promise.resolve('');
46388
+ this.tabIdClaimGeneration = generation;
46389
+ const claim = previous
46390
+ .catch(() => '')
46391
+ .then(() => claimTabId(this.fallbackClientId))
46392
+ .then((id) => {
46393
+ if (this.generation !== generation) {
46394
+ releaseTabId(id);
46395
+ return '';
46396
+ }
46397
+ this.tabId = id;
46398
+ return id;
46399
+ });
46400
+ this.tabIdClaim = claim;
46401
+ return claim;
46402
+ }
46403
+ return this.tabIdClaim;
46404
+ }
45977
46405
  open() {
45978
46406
  return __awaiter(this, void 0, void 0, function* () {
45979
46407
  var _a;
45980
- // Read the credential set on the client (via Client.setJWT / setSession).
45981
- let authMethod;
45982
- let credential;
45983
- if (this.client.config.jwt) {
45984
- authMethod = 'appwrite-jwt';
45985
- credential = this.client.config.jwt;
45986
- }
45987
- else if (this.client.config.session) {
45988
- authMethod = 'appwrite-session';
45989
- credential = this.client.config.session;
45990
- }
45991
- else {
45992
- throw new Error('No credential set on the client; call Client.setJWT() or Client.setSession() first.');
45993
- }
46408
+ const { authMethod, credential } = this.credential();
46409
+ this.connectedKey = this.credentialKey();
46410
+ const epoch = this.connectionEpoch;
46411
+ const generation = this.generation;
45994
46412
  const project = (_a = this.client.config.project) !== null && _a !== void 0 ? _a : '';
45995
46413
  // Client id, when the app did not set one with Client.setPushClientId(). Unlike the
45996
46414
  // native SDKs (which send an empty id and let the broker derive a stable one), mqtt.js
45997
- // rejects an empty id with clean start off, so derive a stable per-user id here from the
45998
- // credential this connection authenticates with: the JWT's userId, or the session's user
45999
- // id. A stable id keeps the broker's replay cursor resuming across reloads. The
46000
- // credential itself is never used as the id.
46415
+ // rejects an empty id with clean start off, so derive one per user and tab from the
46416
+ // credential this connection authenticates with (the JWT's userId, or the session's user
46417
+ // id) and an id kept in the tab's sessionStorage. It stays the same across reloads, so
46418
+ // the broker's replay cursor resumes, and differs between tabs and browsers, so two of
46419
+ // them do not take over each other's session. The credential itself is never used.
46420
+ const userId = authMethod === 'appwrite-jwt'
46421
+ ? userIdFromJwt(credential)
46422
+ : userIdFromSession(credential);
46423
+ // Claim once per instance (memoized) and reuse it across reconnects and credential
46424
+ // switches, so concurrent open() calls never each claim and strand the tab's stored id.
46425
+ // Concurrent instances still get distinct ids. If close() ran while the claim was pending
46426
+ // this open is stale, so stop before connecting (the claim releases its own id).
46427
+ if (!this.client.config.pushClientId) {
46428
+ yield this.claimClientId();
46429
+ if (generation !== this.generation) {
46430
+ throw new Error('Push was closed while connecting.');
46431
+ }
46432
+ }
46433
+ const tabId = this.tabId;
46001
46434
  const clientId = this.client.config.pushClientId ||
46002
- (authMethod === 'appwrite-jwt'
46003
- ? userIdFromJwt(credential)
46004
- : userIdFromSession(credential)) ||
46005
- this.fallbackClientId;
46435
+ (userId ? `${userId}-${tabId}` : tabId);
46436
+ const { connect, Buffer } = yield loadTransport();
46437
+ if (generation !== this.generation) {
46438
+ throw new Error('Push was closed while connecting.');
46439
+ }
46440
+ if (epoch !== this.connectionEpoch) {
46441
+ throw new SupersededError();
46442
+ }
46443
+ this.Buffer = Buffer;
46006
46444
  const options = {
46007
46445
  clientId,
46008
46446
  protocolVersion: 5,
@@ -46017,7 +46455,7 @@ class Push extends Service {
46017
46455
  userProperties: { projectId: project },
46018
46456
  },
46019
46457
  };
46020
- const client = mqtt.connect(this.endpointUrl(), options);
46458
+ const client = connect(this.endpointUrl(), options);
46021
46459
  this.mqtt = client;
46022
46460
  client.on('message', (_topic, _payload, packet) => {
46023
46461
  this.dispatch(packet).catch((err) => this.report(err));
@@ -46049,6 +46487,9 @@ class Push extends Service {
46049
46487
  }
46050
46488
  });
46051
46489
  client.on('error', (err) => {
46490
+ if (epoch !== this.connectionEpoch) {
46491
+ return;
46492
+ }
46052
46493
  const error = this.connectError(err, refusedReason);
46053
46494
  // While the first connect is pending its caller receives the error (and reports it
46054
46495
  // through fail()); afterwards, e.g. on reconnect, report it here.
@@ -46067,6 +46508,10 @@ class Push extends Service {
46067
46508
  const onConnect = (packet) => {
46068
46509
  var _a, _b;
46069
46510
  cleanup();
46511
+ if (epoch !== this.connectionEpoch) {
46512
+ reject(new SupersededError());
46513
+ return;
46514
+ }
46070
46515
  const rc = (_b = (_a = packet.reasonCode) !== null && _a !== void 0 ? _a : packet.returnCode) !== null && _b !== void 0 ? _b : 0;
46071
46516
  if (rc !== 0) {
46072
46517
  this.close();
@@ -46078,16 +46523,30 @@ class Push extends Service {
46078
46523
  };
46079
46524
  const onError = (err) => {
46080
46525
  cleanup();
46526
+ if (epoch !== this.connectionEpoch) {
46527
+ reject(new SupersededError());
46528
+ return;
46529
+ }
46081
46530
  this.close();
46082
46531
  reject(this.connectError(err, refusedReason));
46083
46532
  };
46533
+ const onClose = () => {
46534
+ if (epoch !== this.connectionEpoch) {
46535
+ cleanup();
46536
+ reject(new SupersededError());
46537
+ }
46538
+ };
46084
46539
  const cleanup = () => {
46085
- this.opening = false;
46540
+ if (epoch === this.connectionEpoch) {
46541
+ this.opening = false;
46542
+ }
46086
46543
  client.removeListener('connect', onConnect);
46087
46544
  client.removeListener('error', onError);
46545
+ client.removeListener('close', onClose);
46088
46546
  };
46089
46547
  client.on('connect', onConnect);
46090
46548
  client.on('error', onError);
46549
+ client.on('close', onClose);
46091
46550
  client.connect();
46092
46551
  });
46093
46552
  });
@@ -46109,6 +46568,7 @@ class Push extends Service {
46109
46568
  /** Fan a delivered packet out to every subscription whose filter matches. */
46110
46569
  dispatch(packet) {
46111
46570
  return __awaiter(this, void 0, void 0, function* () {
46571
+ const Buffer = this.Buffer;
46112
46572
  const payload = Buffer.isBuffer(packet.payload)
46113
46573
  ? packet.payload
46114
46574
  : Buffer.from(packet.payload);
@@ -46152,6 +46612,11 @@ class Push extends Service {
46152
46612
  }
46153
46613
  }
46154
46614
  }
46615
+ class SupersededError extends Error {
46616
+ constructor() {
46617
+ super('The push connection was superseded');
46618
+ }
46619
+ }
46155
46620
  /** Normalize anything thrown or passed to an error handler into an `Error`. */
46156
46621
  function toError(error) {
46157
46622
  return error instanceof Error ? error : new Error(String(error));
@@ -46170,8 +46635,7 @@ function userIdFromJwt(jwt) {
46170
46635
  return '';
46171
46636
  }
46172
46637
  try {
46173
- const json = Buffer.from(parts[1].replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf-8');
46174
- const payload = JSON.parse(json);
46638
+ const payload = JSON.parse(decodeBase64(parts[1].replace(/-/g, '+').replace(/_/g, '/')));
46175
46639
  return typeof payload.userId === 'string' ? payload.userId : '';
46176
46640
  }
46177
46641
  catch (_a) {
@@ -46187,13 +46651,99 @@ function userIdFromSession(session) {
46187
46651
  return '';
46188
46652
  }
46189
46653
  try {
46190
- const payload = JSON.parse(Buffer.from(session, 'base64').toString('utf-8'));
46654
+ const payload = JSON.parse(decodeBase64(session));
46191
46655
  return typeof payload.id === 'string' ? payload.id : '';
46192
46656
  }
46193
46657
  catch (_a) {
46194
46658
  return '';
46195
46659
  }
46196
46660
  }
46661
+ /** Ids in use by live connections in this page, so two Push instances never share a client id. */
46662
+ const claimedTabIds = new Set();
46663
+ /** The tab's stored id, resolved and locked once per page (see claimStoredTabId). */
46664
+ let storedTabIdClaim = null;
46665
+ /**
46666
+ * A default client id for one Push connection in this page. The first connection alive takes the
46667
+ * tab's stored id (kept in sessionStorage and locked for the page's lifetime, so it stays the same
46668
+ * across reloads and the broker's replay cursor resumes). Any connection alive at the same time
46669
+ * takes a distinct locked id instead, so simultaneous Push instances never share a client id and
46670
+ * so cannot take over each other's broker session. `fallback` is this instance's own random id.
46671
+ */
46672
+ function claimTabId(fallback) {
46673
+ return __awaiter(this, void 0, void 0, function* () {
46674
+ const stored = yield claimStoredTabId(fallback);
46675
+ if (stored !== '' && !claimedTabIds.has(stored)) {
46676
+ claimedTabIds.add(stored);
46677
+ return stored;
46678
+ }
46679
+ // The tab's id is taken by another live connection here: take a distinct, locked id without
46680
+ // touching the tab's stored cursor.
46681
+ let id = fallback;
46682
+ while (claimedTabIds.has(id)) {
46683
+ id = randomId();
46684
+ }
46685
+ const locks = typeof navigator === 'undefined' ? undefined : navigator.locks;
46686
+ if (locks) {
46687
+ yield holdTabId(locks, id);
46688
+ }
46689
+ claimedTabIds.add(id);
46690
+ return id;
46691
+ });
46692
+ }
46693
+ /** Free an id when its connection closes, so a later connection can reuse it (e.g. the stored id). */
46694
+ function releaseTabId(id) {
46695
+ claimedTabIds.delete(id);
46696
+ }
46697
+ /**
46698
+ * The tab's stored id, resolved and locked once per page: the value in sessionStorage when a lock
46699
+ * on it is free (this tab owns it), else a fresh id that is locked and stored. Without Web Locks
46700
+ * (or when locking fails) a copied id cannot be told apart from another tab's, so the page uses a
46701
+ * fresh id and leaves sessionStorage alone. '' when sessionStorage cannot be read, so the caller
46702
+ * falls back to its own id.
46703
+ */
46704
+ function claimStoredTabId(fallback) {
46705
+ storedTabIdClaim !== null && storedTabIdClaim !== void 0 ? storedTabIdClaim : (storedTabIdClaim = (() => __awaiter(this, void 0, void 0, function* () {
46706
+ const locks = typeof navigator === 'undefined' ? undefined : navigator.locks;
46707
+ if (!locks) {
46708
+ return fallback;
46709
+ }
46710
+ let stored;
46711
+ try {
46712
+ stored = window.sessionStorage.getItem(TAB_ID_KEY);
46713
+ }
46714
+ catch (_a) {
46715
+ return '';
46716
+ }
46717
+ if (stored && (yield holdTabId(locks, stored))) {
46718
+ return stored;
46719
+ }
46720
+ if (!(yield holdTabId(locks, fallback))) {
46721
+ return fallback;
46722
+ }
46723
+ try {
46724
+ window.sessionStorage.setItem(TAB_ID_KEY, fallback);
46725
+ }
46726
+ catch (_b) {
46727
+ // Not persisted, but still usable as this page's stored id for this session.
46728
+ }
46729
+ return fallback;
46730
+ }))());
46731
+ return storedTabIdClaim;
46732
+ }
46733
+ function holdTabId(locks, id) {
46734
+ return new Promise((resolve) => {
46735
+ locks
46736
+ .request(`${TAB_ID_KEY}:${id}`, { ifAvailable: true }, (lock) => {
46737
+ resolve(lock !== null);
46738
+ return lock ? new Promise(() => { }) : undefined;
46739
+ })
46740
+ .catch(() => resolve(false));
46741
+ });
46742
+ }
46743
+ /** Base64 to UTF-8 text without `buffer`, which only loads once Push connects. */
46744
+ function decodeBase64(value) {
46745
+ return new TextDecoder().decode(Uint8Array.from(atob(value), (char) => char.charCodeAt(0)));
46746
+ }
46197
46747
  /** A hex id, uuid4-like enough for a client-generated client id suffix. */
46198
46748
  function randomId() {
46199
46749
  let out = '';
@@ -46917,6 +47467,7 @@ var OAuthProvider;
46917
47467
  OAuthProvider["Tradeshift"] = "tradeshift";
46918
47468
  OAuthProvider["TradeshiftBox"] = "tradeshiftBox";
46919
47469
  OAuthProvider["Twitch"] = "twitch";
47470
+ OAuthProvider["Webflow"] = "webflow";
46920
47471
  OAuthProvider["Wordpress"] = "wordpress";
46921
47472
  OAuthProvider["X"] = "x";
46922
47473
  OAuthProvider["Yahoo"] = "yahoo";
@@ -47988,6 +48539,9 @@ var Runtime;
47988
48539
  Runtime["Pythonml311"] = "python-ml-3.11";
47989
48540
  Runtime["Pythonml312"] = "python-ml-3.12";
47990
48541
  Runtime["Pythonml313"] = "python-ml-3.13";
48542
+ Runtime["Deno121"] = "deno-1.21";
48543
+ Runtime["Deno124"] = "deno-1.24";
48544
+ Runtime["Deno135"] = "deno-1.35";
47991
48545
  Runtime["Deno140"] = "deno-1.40";
47992
48546
  Runtime["Deno146"] = "deno-1.46";
47993
48547
  Runtime["Deno20"] = "deno-2.0";
@@ -48145,6 +48699,7 @@ var ProjectKeyScopes;
48145
48699
  ProjectKeyScopes["WebhooksWrite"] = "webhooks.write";
48146
48700
  ProjectKeyScopes["LocaleRead"] = "locale.read";
48147
48701
  ProjectKeyScopes["AvatarsRead"] = "avatars.read";
48702
+ ProjectKeyScopes["AvatarsWrite"] = "avatars.write";
48148
48703
  ProjectKeyScopes["HealthRead"] = "health.read";
48149
48704
  ProjectKeyScopes["AssistantRead"] = "assistant.read";
48150
48705
  ProjectKeyScopes["MigrationsRead"] = "migrations.read";
@@ -48539,6 +49094,7 @@ var ProjectOAuthProviderId;
48539
49094
  ProjectOAuthProviderId["Tradeshift"] = "tradeshift";
48540
49095
  ProjectOAuthProviderId["TradeshiftBox"] = "tradeshiftBox";
48541
49096
  ProjectOAuthProviderId["Twitch"] = "twitch";
49097
+ ProjectOAuthProviderId["Webflow"] = "webflow";
48542
49098
  ProjectOAuthProviderId["Wordpress"] = "wordpress";
48543
49099
  ProjectOAuthProviderId["X"] = "x";
48544
49100
  ProjectOAuthProviderId["Yahoo"] = "yahoo";
@@ -48692,6 +49248,9 @@ var BuildRuntime;
48692
49248
  BuildRuntime["Pythonml311"] = "python-ml-3.11";
48693
49249
  BuildRuntime["Pythonml312"] = "python-ml-3.12";
48694
49250
  BuildRuntime["Pythonml313"] = "python-ml-3.13";
49251
+ BuildRuntime["Deno121"] = "deno-1.21";
49252
+ BuildRuntime["Deno124"] = "deno-1.24";
49253
+ BuildRuntime["Deno135"] = "deno-1.35";
48695
49254
  BuildRuntime["Deno140"] = "deno-1.40";
48696
49255
  BuildRuntime["Deno146"] = "deno-1.46";
48697
49256
  BuildRuntime["Deno20"] = "deno-2.0";
@@ -48814,6 +49373,7 @@ var UsageEventMetric;
48814
49373
  UsageEventMetric["WebhooksEventsFailed"] = "webhooks.events.failed";
48815
49374
  UsageEventMetric["AuthMethodPhone"] = "auth.method.phone";
48816
49375
  UsageEventMetric["MessagesSent"] = "messages.sent";
49376
+ UsageEventMetric["MessagesFailed"] = "messages.failed";
48817
49377
  UsageEventMetric["MessagesSmsSent"] = "messages.sms.sent";
48818
49378
  UsageEventMetric["Executions"] = "executions";
48819
49379
  UsageEventMetric["ExecutionsCompute"] = "executions.compute";
@@ -48892,6 +49452,15 @@ var UsageEventDimension;
48892
49452
  UsageEventDimension["SdkVersion"] = "sdkVersion";
48893
49453
  UsageEventDimension["TeamId"] = "teamId";
48894
49454
  UsageEventDimension["ResourceId"] = "resourceId";
49455
+ UsageEventDimension["Protocol"] = "protocol";
49456
+ UsageEventDimension["QueryKeys"] = "queryKeys";
49457
+ UsageEventDimension["Accept"] = "accept";
49458
+ UsageEventDimension["AcceptLanguage"] = "acceptLanguage";
49459
+ UsageEventDimension["PostalCode"] = "postalCode";
49460
+ UsageEventDimension["Latitude"] = "latitude";
49461
+ UsageEventDimension["Longitude"] = "longitude";
49462
+ UsageEventDimension["TimeZone"] = "timeZone";
49463
+ UsageEventDimension["WeatherCode"] = "weatherCode";
48895
49464
  UsageEventDimension["Isp"] = "isp";
48896
49465
  UsageEventDimension["AutonomousSystemNumber"] = "autonomousSystemNumber";
48897
49466
  UsageEventDimension["AutonomousSystemOrganization"] = "autonomousSystemOrganization";