@appwrite.io/console 18.1.0 → 18.3.0-rc.1

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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/sdk.js +1876 -259
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1872 -257
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +6294 -4654
  7. package/package.json +2 -2
  8. package/types/client.d.ts +4 -1
  9. package/types/enums/analytics-dimension.d.ts +24 -0
  10. package/types/enums/analytics-interval.d.ts +6 -0
  11. package/types/enums/build-runtime.d.ts +3 -0
  12. package/types/enums/o-auth-provider.d.ts +1 -0
  13. package/types/enums/project-key-scopes.d.ts +4 -1
  14. package/types/enums/project-o-auth-provider-id.d.ts +1 -0
  15. package/types/enums/proxy-rule-deployment-resource-type.d.ts +2 -1
  16. package/types/enums/query-suggestion-resource.d.ts +1 -0
  17. package/types/enums/runtime.d.ts +3 -0
  18. package/types/enums/usage-event-dimension.d.ts +9 -0
  19. package/types/enums/usage-event-metric.d.ts +4 -0
  20. package/types/enums/usage-gauge-metric.d.ts +1 -0
  21. package/types/index.d.ts +5 -0
  22. package/types/models.d.ts +285 -15
  23. package/types/services/account.d.ts +37 -10
  24. package/types/services/analytics-tracking.d.ts +211 -0
  25. package/types/services/analytics.d.ts +254 -0
  26. package/types/services/avatars.d.ts +33 -5
  27. package/types/services/console.d.ts +39 -3
  28. package/types/services/databases.d.ts +4 -1
  29. package/types/services/documents-db.d.ts +4 -1
  30. package/types/services/functions.d.ts +17 -2
  31. package/types/services/locale.d.ts +91 -7
  32. package/types/services/messaging.d.ts +40 -34
  33. package/types/services/notifications.d.ts +4 -1
  34. package/types/services/project.d.ts +29 -4
  35. package/types/services/proxy.d.ts +4 -0
  36. package/types/services/push.d.ts +26 -4
  37. package/types/services/sites.d.ts +21 -3
  38. package/types/services/tables-db.d.ts +4 -1
  39. package/types/services/teams.d.ts +2 -2
  40. package/types/services/usage.d.ts +4 -4
  41. package/types/services/vcs.d.ts +12 -3
  42. package/types/services/vectors-db.d.ts +4 -1
  43. package/types/services/webhooks.d.ts +2 -2
  44. package/types/service.d.ts +0 -11
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.3.0-rc.1',
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
  *
@@ -1519,29 +1520,6 @@ class Client {
1519
1520
  }
1520
1521
  Client.CHUNK_SIZE = 1024 * 1024 * 5;
1521
1522
 
1522
- class Service {
1523
- constructor(client) {
1524
- this.client = client;
1525
- }
1526
- static flatten(data, prefix = '') {
1527
- let output = {};
1528
- for (const [key, value] of Object.entries(data)) {
1529
- const finalKey = prefix ? prefix + '[' + key + ']' : key;
1530
- if (Array.isArray(value)) {
1531
- output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
1532
- }
1533
- else {
1534
- output[finalKey] = value;
1535
- }
1536
- }
1537
- return output;
1538
- }
1539
- }
1540
- /**
1541
- * The size for chunked uploads in bytes.
1542
- */
1543
- Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
1544
-
1545
1523
  class Account {
1546
1524
  constructor(client) {
1547
1525
  this.client = client;
@@ -3352,15 +3330,25 @@ class Account {
3352
3330
  };
3353
3331
  return this.client.call('put', uri, apiHeaders, apiPayload);
3354
3332
  }
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() {
3333
+ listSessions(paramsOrFirst) {
3334
+ let params;
3335
+ if (typeof paramsOrFirst === 'undefined' ||
3336
+ (paramsOrFirst &&
3337
+ typeof paramsOrFirst === 'object' &&
3338
+ !Array.isArray(paramsOrFirst))) {
3339
+ params = (paramsOrFirst || {});
3340
+ }
3341
+ else {
3342
+ params = {
3343
+ total: paramsOrFirst,
3344
+ };
3345
+ }
3346
+ const total = params.total;
3362
3347
  const apiPath = '/account/sessions';
3363
3348
  const apiPayload = {};
3349
+ if (typeof total !== 'undefined') {
3350
+ apiPayload['total'] = total;
3351
+ }
3364
3352
  const uri = new URL(this.client.config.endpoint + apiPath);
3365
3353
  const apiHeaders = {
3366
3354
  'X-Appwrite-Project': this.client.config.project,
@@ -3368,15 +3356,25 @@ class Account {
3368
3356
  };
3369
3357
  return this.client.call('get', uri, apiHeaders, apiPayload);
3370
3358
  }
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() {
3359
+ deleteSessions(paramsOrFirst) {
3360
+ let params;
3361
+ if (typeof paramsOrFirst === 'undefined' ||
3362
+ (paramsOrFirst &&
3363
+ typeof paramsOrFirst === 'object' &&
3364
+ !Array.isArray(paramsOrFirst))) {
3365
+ params = (paramsOrFirst || {});
3366
+ }
3367
+ else {
3368
+ params = {
3369
+ current: paramsOrFirst,
3370
+ };
3371
+ }
3372
+ const current = params.current;
3378
3373
  const apiPath = '/account/sessions';
3379
3374
  const apiPayload = {};
3375
+ if (typeof current !== 'undefined') {
3376
+ apiPayload['current'] = current;
3377
+ }
3380
3378
  const uri = new URL(this.client.config.endpoint + apiPath);
3381
3379
  const apiHeaders = {
3382
3380
  'X-Appwrite-Project': this.client.config.project,
@@ -3413,10 +3411,12 @@ class Account {
3413
3411
  params = {
3414
3412
  email: paramsOrFirst,
3415
3413
  password: rest[0],
3414
+ duration: rest[1],
3416
3415
  };
3417
3416
  }
3418
3417
  const email = params.email;
3419
3418
  const password = params.password;
3419
+ const duration = params.duration;
3420
3420
  if (typeof email === 'undefined') {
3421
3421
  throw new AppwriteException('Missing required parameter: "email"');
3422
3422
  }
@@ -3431,6 +3431,9 @@ class Account {
3431
3431
  if (typeof password !== 'undefined') {
3432
3432
  apiPayload['password'] = password;
3433
3433
  }
3434
+ if (typeof duration !== 'undefined') {
3435
+ apiPayload['duration'] = duration;
3436
+ }
3434
3437
  const uri = new URL(this.client.config.endpoint + apiPath);
3435
3438
  const apiHeaders = {
3436
3439
  'X-Appwrite-Project': this.client.config.project,
@@ -3578,7 +3581,7 @@ class Account {
3578
3581
  }
3579
3582
  const uri = new URL(this.client.config.endpoint + apiPath);
3580
3583
  apiPayload['project'] = this.client.config.project;
3581
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
3584
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
3582
3585
  uri.searchParams.append(key, value);
3583
3586
  }
3584
3587
  if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
@@ -3987,7 +3990,7 @@ class Account {
3987
3990
  }
3988
3991
  const uri = new URL(this.client.config.endpoint + apiPath);
3989
3992
  apiPayload['project'] = this.client.config.project;
3990
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
3993
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
3991
3994
  uri.searchParams.append(key, value);
3992
3995
  }
3993
3996
  if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
@@ -4555,6 +4558,369 @@ class Affiliates {
4555
4558
  }
4556
4559
  }
4557
4560
 
4561
+ class Analytics {
4562
+ constructor(client) {
4563
+ this.client = client;
4564
+ }
4565
+ listProperties(paramsOrFirst, ...rest) {
4566
+ let params;
4567
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
4568
+ (paramsOrFirst &&
4569
+ typeof paramsOrFirst === 'object' &&
4570
+ !Array.isArray(paramsOrFirst))) {
4571
+ params = (paramsOrFirst || {});
4572
+ }
4573
+ else {
4574
+ params = {
4575
+ queries: paramsOrFirst,
4576
+ search: rest[0],
4577
+ total: rest[1],
4578
+ };
4579
+ }
4580
+ const queries = params.queries;
4581
+ const search = params.search;
4582
+ const total = params.total;
4583
+ const apiPath = '/analytics/properties';
4584
+ const apiPayload = {};
4585
+ if (typeof queries !== 'undefined') {
4586
+ apiPayload['queries'] = queries;
4587
+ }
4588
+ if (typeof search !== 'undefined') {
4589
+ apiPayload['search'] = search;
4590
+ }
4591
+ if (typeof total !== 'undefined') {
4592
+ apiPayload['total'] = total;
4593
+ }
4594
+ const uri = new URL(this.client.config.endpoint + apiPath);
4595
+ const apiHeaders = {
4596
+ 'X-Appwrite-Project': this.client.config.project,
4597
+ accept: 'application/json',
4598
+ };
4599
+ return this.client.call('get', uri, apiHeaders, apiPayload);
4600
+ }
4601
+ createProperty(paramsOrFirst, ...rest) {
4602
+ let params;
4603
+ if (paramsOrFirst &&
4604
+ typeof paramsOrFirst === 'object' &&
4605
+ !Array.isArray(paramsOrFirst)) {
4606
+ params = (paramsOrFirst || {});
4607
+ }
4608
+ else {
4609
+ params = {
4610
+ propertyId: paramsOrFirst,
4611
+ name: rest[0],
4612
+ domain: rest[1],
4613
+ timezone: rest[2],
4614
+ enabled: rest[3],
4615
+ xpublic: rest[4],
4616
+ allowedOrigins: rest[5],
4617
+ };
4618
+ }
4619
+ const propertyId = params.propertyId;
4620
+ const name = params.name;
4621
+ const domain = params.domain;
4622
+ const timezone = params.timezone;
4623
+ const enabled = params.enabled;
4624
+ const xpublic = params.xpublic;
4625
+ const allowedOrigins = params.allowedOrigins;
4626
+ if (typeof propertyId === 'undefined') {
4627
+ throw new AppwriteException('Missing required parameter: "propertyId"');
4628
+ }
4629
+ if (typeof name === 'undefined') {
4630
+ throw new AppwriteException('Missing required parameter: "name"');
4631
+ }
4632
+ const apiPath = '/analytics/properties';
4633
+ const apiPayload = {};
4634
+ if (typeof propertyId !== 'undefined') {
4635
+ apiPayload['propertyId'] = propertyId;
4636
+ }
4637
+ if (typeof name !== 'undefined') {
4638
+ apiPayload['name'] = name;
4639
+ }
4640
+ if (typeof domain !== 'undefined') {
4641
+ apiPayload['domain'] = domain;
4642
+ }
4643
+ if (typeof timezone !== 'undefined') {
4644
+ apiPayload['timezone'] = timezone;
4645
+ }
4646
+ if (typeof enabled !== 'undefined') {
4647
+ apiPayload['enabled'] = enabled;
4648
+ }
4649
+ if (typeof xpublic !== 'undefined') {
4650
+ apiPayload['public'] = xpublic;
4651
+ }
4652
+ if (typeof allowedOrigins !== 'undefined') {
4653
+ apiPayload['allowedOrigins'] = allowedOrigins;
4654
+ }
4655
+ const uri = new URL(this.client.config.endpoint + apiPath);
4656
+ const apiHeaders = {
4657
+ 'X-Appwrite-Project': this.client.config.project,
4658
+ 'content-type': 'application/json',
4659
+ accept: 'application/json',
4660
+ };
4661
+ return this.client.call('post', uri, apiHeaders, apiPayload);
4662
+ }
4663
+ getProperty(paramsOrFirst) {
4664
+ let params;
4665
+ if (paramsOrFirst &&
4666
+ typeof paramsOrFirst === 'object' &&
4667
+ !Array.isArray(paramsOrFirst)) {
4668
+ params = (paramsOrFirst || {});
4669
+ }
4670
+ else {
4671
+ params = {
4672
+ propertyId: paramsOrFirst,
4673
+ };
4674
+ }
4675
+ const propertyId = params.propertyId;
4676
+ if (typeof propertyId === 'undefined' || propertyId === '') {
4677
+ throw new AppwriteException('Missing required parameter: "propertyId"');
4678
+ }
4679
+ const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
4680
+ const apiPayload = {};
4681
+ const uri = new URL(this.client.config.endpoint + apiPath);
4682
+ const apiHeaders = {
4683
+ 'X-Appwrite-Project': this.client.config.project,
4684
+ accept: 'application/json',
4685
+ };
4686
+ return this.client.call('get', uri, apiHeaders, apiPayload);
4687
+ }
4688
+ updateProperty(paramsOrFirst, ...rest) {
4689
+ let params;
4690
+ if (paramsOrFirst &&
4691
+ typeof paramsOrFirst === 'object' &&
4692
+ !Array.isArray(paramsOrFirst)) {
4693
+ params = (paramsOrFirst || {});
4694
+ }
4695
+ else {
4696
+ params = {
4697
+ propertyId: paramsOrFirst,
4698
+ name: rest[0],
4699
+ domain: rest[1],
4700
+ timezone: rest[2],
4701
+ enabled: rest[3],
4702
+ xpublic: rest[4],
4703
+ allowedOrigins: rest[5],
4704
+ };
4705
+ }
4706
+ const propertyId = params.propertyId;
4707
+ const name = params.name;
4708
+ const domain = params.domain;
4709
+ const timezone = params.timezone;
4710
+ const enabled = params.enabled;
4711
+ const xpublic = params.xpublic;
4712
+ const allowedOrigins = params.allowedOrigins;
4713
+ if (typeof propertyId === 'undefined' || propertyId === '') {
4714
+ throw new AppwriteException('Missing required parameter: "propertyId"');
4715
+ }
4716
+ const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
4717
+ const apiPayload = {};
4718
+ if (typeof name !== 'undefined') {
4719
+ apiPayload['name'] = name;
4720
+ }
4721
+ if (typeof domain !== 'undefined') {
4722
+ apiPayload['domain'] = domain;
4723
+ }
4724
+ if (typeof timezone !== 'undefined') {
4725
+ apiPayload['timezone'] = timezone;
4726
+ }
4727
+ if (typeof enabled !== 'undefined') {
4728
+ apiPayload['enabled'] = enabled;
4729
+ }
4730
+ if (typeof xpublic !== 'undefined') {
4731
+ apiPayload['public'] = xpublic;
4732
+ }
4733
+ if (typeof allowedOrigins !== 'undefined') {
4734
+ apiPayload['allowedOrigins'] = allowedOrigins;
4735
+ }
4736
+ const uri = new URL(this.client.config.endpoint + apiPath);
4737
+ const apiHeaders = {
4738
+ 'X-Appwrite-Project': this.client.config.project,
4739
+ 'content-type': 'application/json',
4740
+ accept: 'application/json',
4741
+ };
4742
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
4743
+ }
4744
+ deleteProperty(paramsOrFirst) {
4745
+ let params;
4746
+ if (paramsOrFirst &&
4747
+ typeof paramsOrFirst === 'object' &&
4748
+ !Array.isArray(paramsOrFirst)) {
4749
+ params = (paramsOrFirst || {});
4750
+ }
4751
+ else {
4752
+ params = {
4753
+ propertyId: paramsOrFirst,
4754
+ };
4755
+ }
4756
+ const propertyId = params.propertyId;
4757
+ if (typeof propertyId === 'undefined' || propertyId === '') {
4758
+ throw new AppwriteException('Missing required parameter: "propertyId"');
4759
+ }
4760
+ const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
4761
+ const apiPayload = {};
4762
+ const uri = new URL(this.client.config.endpoint + apiPath);
4763
+ const apiHeaders = {
4764
+ 'X-Appwrite-Project': this.client.config.project,
4765
+ 'content-type': 'application/json',
4766
+ accept: 'application/json',
4767
+ };
4768
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
4769
+ }
4770
+ createEvent(paramsOrFirst, ...rest) {
4771
+ let params;
4772
+ if (paramsOrFirst &&
4773
+ typeof paramsOrFirst === 'object' &&
4774
+ !Array.isArray(paramsOrFirst)) {
4775
+ params = (paramsOrFirst || {});
4776
+ }
4777
+ else {
4778
+ params = {
4779
+ propertyId: paramsOrFirst,
4780
+ name: rest[0],
4781
+ url: rest[1],
4782
+ domain: rest[2],
4783
+ referrer: rest[3],
4784
+ screenWidth: rest[4],
4785
+ sessionHash: rest[5],
4786
+ scrollDepth: rest[6],
4787
+ engagementTime: rest[7],
4788
+ props: rest[8],
4789
+ userId: rest[9],
4790
+ ip: rest[10],
4791
+ userAgent: rest[11],
4792
+ };
4793
+ }
4794
+ const propertyId = params.propertyId;
4795
+ const name = params.name;
4796
+ const url = params.url;
4797
+ const domain = params.domain;
4798
+ const referrer = params.referrer;
4799
+ const screenWidth = params.screenWidth;
4800
+ const sessionHash = params.sessionHash;
4801
+ const scrollDepth = params.scrollDepth;
4802
+ const engagementTime = params.engagementTime;
4803
+ const props = params.props;
4804
+ const userId = params.userId;
4805
+ const ip = params.ip;
4806
+ const userAgent = params.userAgent;
4807
+ if (typeof propertyId === 'undefined' || propertyId === '') {
4808
+ throw new AppwriteException('Missing required parameter: "propertyId"');
4809
+ }
4810
+ if (typeof name === 'undefined') {
4811
+ throw new AppwriteException('Missing required parameter: "name"');
4812
+ }
4813
+ if (typeof url === 'undefined') {
4814
+ throw new AppwriteException('Missing required parameter: "url"');
4815
+ }
4816
+ const apiPath = '/analytics/properties/{propertyId}/events'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
4817
+ const apiPayload = {};
4818
+ if (typeof name !== 'undefined') {
4819
+ apiPayload['name'] = name;
4820
+ }
4821
+ if (typeof url !== 'undefined') {
4822
+ apiPayload['url'] = url;
4823
+ }
4824
+ if (typeof domain !== 'undefined') {
4825
+ apiPayload['domain'] = domain;
4826
+ }
4827
+ if (typeof referrer !== 'undefined') {
4828
+ apiPayload['referrer'] = referrer;
4829
+ }
4830
+ if (typeof screenWidth !== 'undefined') {
4831
+ apiPayload['screenWidth'] = screenWidth;
4832
+ }
4833
+ if (typeof sessionHash !== 'undefined') {
4834
+ apiPayload['sessionHash'] = sessionHash;
4835
+ }
4836
+ if (typeof scrollDepth !== 'undefined') {
4837
+ apiPayload['scrollDepth'] = scrollDepth;
4838
+ }
4839
+ if (typeof engagementTime !== 'undefined') {
4840
+ apiPayload['engagementTime'] = engagementTime;
4841
+ }
4842
+ if (typeof props !== 'undefined') {
4843
+ apiPayload['props'] = props;
4844
+ }
4845
+ if (typeof userId !== 'undefined') {
4846
+ apiPayload['userId'] = userId;
4847
+ }
4848
+ if (typeof ip !== 'undefined') {
4849
+ apiPayload['ip'] = ip;
4850
+ }
4851
+ if (typeof userAgent !== 'undefined') {
4852
+ apiPayload['userAgent'] = userAgent;
4853
+ }
4854
+ const uri = new URL(this.client.config.endpoint + apiPath);
4855
+ const apiHeaders = {
4856
+ 'X-Appwrite-Project': this.client.config.project,
4857
+ 'content-type': 'application/json',
4858
+ accept: 'application/json',
4859
+ };
4860
+ return this.client.call('post', uri, apiHeaders, apiPayload);
4861
+ }
4862
+ listMetrics(paramsOrFirst, ...rest) {
4863
+ let params;
4864
+ if (paramsOrFirst &&
4865
+ typeof paramsOrFirst === 'object' &&
4866
+ !Array.isArray(paramsOrFirst)) {
4867
+ params = (paramsOrFirst || {});
4868
+ }
4869
+ else {
4870
+ params = {
4871
+ propertyId: paramsOrFirst,
4872
+ queries: rest[0],
4873
+ interval: rest[1],
4874
+ dimensions: rest[2],
4875
+ dateRange: rest[3],
4876
+ startAt: rest[4],
4877
+ endAt: rest[5],
4878
+ limit: rest[6],
4879
+ };
4880
+ }
4881
+ const propertyId = params.propertyId;
4882
+ const queries = params.queries;
4883
+ const interval = params.interval;
4884
+ const dimensions = params.dimensions;
4885
+ const dateRange = params.dateRange;
4886
+ const startAt = params.startAt;
4887
+ const endAt = params.endAt;
4888
+ const limit = params.limit;
4889
+ if (typeof propertyId === 'undefined' || propertyId === '') {
4890
+ throw new AppwriteException('Missing required parameter: "propertyId"');
4891
+ }
4892
+ const apiPath = '/analytics/properties/{propertyId}/metrics'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
4893
+ const apiPayload = {};
4894
+ if (typeof queries !== 'undefined') {
4895
+ apiPayload['queries'] = queries;
4896
+ }
4897
+ if (typeof interval !== 'undefined') {
4898
+ apiPayload['interval'] = interval;
4899
+ }
4900
+ if (typeof dimensions !== 'undefined') {
4901
+ apiPayload['dimensions'] = dimensions;
4902
+ }
4903
+ if (typeof dateRange !== 'undefined') {
4904
+ apiPayload['dateRange'] = dateRange;
4905
+ }
4906
+ if (typeof startAt !== 'undefined') {
4907
+ apiPayload['startAt'] = startAt;
4908
+ }
4909
+ if (typeof endAt !== 'undefined') {
4910
+ apiPayload['endAt'] = endAt;
4911
+ }
4912
+ if (typeof limit !== 'undefined') {
4913
+ apiPayload['limit'] = limit;
4914
+ }
4915
+ const uri = new URL(this.client.config.endpoint + apiPath);
4916
+ const apiHeaders = {
4917
+ 'X-Appwrite-Project': this.client.config.project,
4918
+ accept: 'application/json',
4919
+ };
4920
+ return this.client.call('get', uri, apiHeaders, apiPayload);
4921
+ }
4922
+ }
4923
+
4558
4924
  class Apps {
4559
4925
  constructor(client) {
4560
4926
  this.client = client;
@@ -5447,7 +5813,7 @@ class Avatars {
5447
5813
  const uri = new URL(this.client.config.endpoint + apiPath);
5448
5814
  apiPayload['project'] = this.client.config.project;
5449
5815
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5450
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
5816
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5451
5817
  uri.searchParams.append(key, value);
5452
5818
  }
5453
5819
  return uri.toString();
@@ -5492,7 +5858,7 @@ class Avatars {
5492
5858
  const uri = new URL(this.client.config.endpoint + apiPath);
5493
5859
  apiPayload['project'] = this.client.config.project;
5494
5860
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5495
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
5861
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5496
5862
  uri.searchParams.append(key, value);
5497
5863
  }
5498
5864
  return uri.toString();
@@ -5521,7 +5887,7 @@ class Avatars {
5521
5887
  const uri = new URL(this.client.config.endpoint + apiPath);
5522
5888
  apiPayload['project'] = this.client.config.project;
5523
5889
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5524
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
5890
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5525
5891
  uri.searchParams.append(key, value);
5526
5892
  }
5527
5893
  return uri.toString();
@@ -5566,7 +5932,7 @@ class Avatars {
5566
5932
  const uri = new URL(this.client.config.endpoint + apiPath);
5567
5933
  apiPayload['project'] = this.client.config.project;
5568
5934
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5569
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
5935
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5570
5936
  uri.searchParams.append(key, value);
5571
5937
  }
5572
5938
  return uri.toString();
@@ -5605,7 +5971,7 @@ class Avatars {
5605
5971
  const uri = new URL(this.client.config.endpoint + apiPath);
5606
5972
  apiPayload['project'] = this.client.config.project;
5607
5973
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5608
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
5974
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5609
5975
  uri.searchParams.append(key, value);
5610
5976
  }
5611
5977
  return uri.toString();
@@ -5647,7 +6013,7 @@ class Avatars {
5647
6013
  const uri = new URL(this.client.config.endpoint + apiPath);
5648
6014
  apiPayload['project'] = this.client.config.project;
5649
6015
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5650
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6016
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5651
6017
  uri.searchParams.append(key, value);
5652
6018
  }
5653
6019
  return uri.toString();
@@ -5709,11 +6075,61 @@ class Avatars {
5709
6075
  const uri = new URL(this.client.config.endpoint + apiPath);
5710
6076
  apiPayload['project'] = this.client.config.project;
5711
6077
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5712
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6078
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5713
6079
  uri.searchParams.append(key, value);
5714
6080
  }
5715
6081
  return uri.toString();
5716
6082
  }
6083
+ updatePhoto(paramsOrFirst, ...rest) {
6084
+ let params;
6085
+ let onProgress;
6086
+ if (paramsOrFirst &&
6087
+ typeof paramsOrFirst === 'object' &&
6088
+ !Array.isArray(paramsOrFirst) &&
6089
+ ('file' in paramsOrFirst || 'onProgress' in paramsOrFirst)) {
6090
+ params = (paramsOrFirst || {});
6091
+ onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
6092
+ }
6093
+ else {
6094
+ params = {
6095
+ file: paramsOrFirst,
6096
+ };
6097
+ onProgress = rest[0];
6098
+ }
6099
+ const file = params.file;
6100
+ if (typeof file === 'undefined') {
6101
+ throw new AppwriteException('Missing required parameter: "file"');
6102
+ }
6103
+ const apiPath = '/avatars/photo';
6104
+ const apiPayload = {};
6105
+ if (typeof file !== 'undefined') {
6106
+ apiPayload['file'] = file;
6107
+ }
6108
+ const uri = new URL(this.client.config.endpoint + apiPath);
6109
+ const apiHeaders = {
6110
+ 'X-Appwrite-Project': this.client.config.project,
6111
+ 'content-type': 'multipart/form-data',
6112
+ accept: 'application/json',
6113
+ };
6114
+ return this.client.chunkedUpload('put', uri, apiHeaders, apiPayload, onProgress);
6115
+ }
6116
+ /**
6117
+ * 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.
6118
+ *
6119
+ * @throws {AppwriteException}
6120
+ * @returns {Promise<{}>}
6121
+ */
6122
+ deletePhoto() {
6123
+ const apiPath = '/avatars/photo';
6124
+ const apiPayload = {};
6125
+ const uri = new URL(this.client.config.endpoint + apiPath);
6126
+ const apiHeaders = {
6127
+ 'X-Appwrite-Project': this.client.config.project,
6128
+ 'content-type': 'application/json',
6129
+ accept: 'application/json',
6130
+ };
6131
+ return this.client.call('delete', uri, apiHeaders, apiPayload);
6132
+ }
5717
6133
  getQR(paramsOrFirst, ...rest) {
5718
6134
  let params;
5719
6135
  if (paramsOrFirst &&
@@ -5753,7 +6169,7 @@ class Avatars {
5753
6169
  const uri = new URL(this.client.config.endpoint + apiPath);
5754
6170
  apiPayload['project'] = this.client.config.project;
5755
6171
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5756
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6172
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5757
6173
  uri.searchParams.append(key, value);
5758
6174
  }
5759
6175
  return uri.toString();
@@ -5877,7 +6293,7 @@ class Avatars {
5877
6293
  const uri = new URL(this.client.config.endpoint + apiPath);
5878
6294
  apiPayload['project'] = this.client.config.project;
5879
6295
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
5880
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6296
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5881
6297
  uri.searchParams.append(key, value);
5882
6298
  }
5883
6299
  return uri.toString();
@@ -6416,15 +6832,25 @@ class Console {
6416
6832
  };
6417
6833
  return this.client.call('get', uri, apiHeaders, apiPayload);
6418
6834
  }
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() {
6835
+ listOAuth2Providers(paramsOrFirst) {
6836
+ let params;
6837
+ if (typeof paramsOrFirst === 'undefined' ||
6838
+ (paramsOrFirst &&
6839
+ typeof paramsOrFirst === 'object' &&
6840
+ !Array.isArray(paramsOrFirst))) {
6841
+ params = (paramsOrFirst || {});
6842
+ }
6843
+ else {
6844
+ params = {
6845
+ total: paramsOrFirst,
6846
+ };
6847
+ }
6848
+ const total = params.total;
6426
6849
  const apiPath = '/console/oauth2-providers';
6427
6850
  const apiPayload = {};
6851
+ if (typeof total !== 'undefined') {
6852
+ apiPayload['total'] = total;
6853
+ }
6428
6854
  const uri = new URL(this.client.config.endpoint + apiPath);
6429
6855
  const apiHeaders = {
6430
6856
  'X-Appwrite-Project': this.client.config.project,
@@ -6604,15 +7030,25 @@ class Console {
6604
7030
  };
6605
7031
  return this.client.call('get', uri, apiHeaders, apiPayload);
6606
7032
  }
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() {
7033
+ listOrganizationScopes(paramsOrFirst) {
7034
+ let params;
7035
+ if (typeof paramsOrFirst === 'undefined' ||
7036
+ (paramsOrFirst &&
7037
+ typeof paramsOrFirst === 'object' &&
7038
+ !Array.isArray(paramsOrFirst))) {
7039
+ params = (paramsOrFirst || {});
7040
+ }
7041
+ else {
7042
+ params = {
7043
+ total: paramsOrFirst,
7044
+ };
7045
+ }
7046
+ const total = params.total;
6614
7047
  const apiPath = '/console/scopes/organization';
6615
7048
  const apiPayload = {};
7049
+ if (typeof total !== 'undefined') {
7050
+ apiPayload['total'] = total;
7051
+ }
6616
7052
  const uri = new URL(this.client.config.endpoint + apiPath);
6617
7053
  const apiHeaders = {
6618
7054
  'X-Appwrite-Project': this.client.config.project,
@@ -6620,15 +7056,25 @@ class Console {
6620
7056
  };
6621
7057
  return this.client.call('get', uri, apiHeaders, apiPayload);
6622
7058
  }
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() {
7059
+ listProjectScopes(paramsOrFirst) {
7060
+ let params;
7061
+ if (typeof paramsOrFirst === 'undefined' ||
7062
+ (paramsOrFirst &&
7063
+ typeof paramsOrFirst === 'object' &&
7064
+ !Array.isArray(paramsOrFirst))) {
7065
+ params = (paramsOrFirst || {});
7066
+ }
7067
+ else {
7068
+ params = {
7069
+ total: paramsOrFirst,
7070
+ };
7071
+ }
7072
+ const total = params.total;
6630
7073
  const apiPath = '/console/scopes/project';
6631
7074
  const apiPayload = {};
7075
+ if (typeof total !== 'undefined') {
7076
+ apiPayload['total'] = total;
7077
+ }
6632
7078
  const uri = new URL(this.client.config.endpoint + apiPath);
6633
7079
  const apiHeaders = {
6634
7080
  'X-Appwrite-Project': this.client.config.project,
@@ -6961,9 +7407,9 @@ class Databases {
6961
7407
  };
6962
7408
  return this.client.call('post', uri, apiHeaders, apiPayload);
6963
7409
  }
6964
- listTransactions(paramsOrFirst) {
7410
+ listTransactions(paramsOrFirst, ...rest) {
6965
7411
  let params;
6966
- if (typeof paramsOrFirst === 'undefined' ||
7412
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
6967
7413
  (paramsOrFirst &&
6968
7414
  typeof paramsOrFirst === 'object' &&
6969
7415
  !Array.isArray(paramsOrFirst))) {
@@ -6972,14 +7418,19 @@ class Databases {
6972
7418
  else {
6973
7419
  params = {
6974
7420
  queries: paramsOrFirst,
7421
+ total: rest[0],
6975
7422
  };
6976
7423
  }
6977
7424
  const queries = params.queries;
7425
+ const total = params.total;
6978
7426
  const apiPath = '/databases/transactions';
6979
7427
  const apiPayload = {};
6980
7428
  if (typeof queries !== 'undefined') {
6981
7429
  apiPayload['queries'] = queries;
6982
7430
  }
7431
+ if (typeof total !== 'undefined') {
7432
+ apiPayload['total'] = total;
7433
+ }
6983
7434
  const uri = new URL(this.client.config.endpoint + apiPath);
6984
7435
  const apiHeaders = {
6985
7436
  'X-Appwrite-Project': this.client.config.project,
@@ -10722,9 +11173,9 @@ class DocumentsDB {
10722
11173
  };
10723
11174
  return this.client.call('get', uri, apiHeaders, apiPayload);
10724
11175
  }
10725
- listTransactions(paramsOrFirst) {
11176
+ listTransactions(paramsOrFirst, ...rest) {
10726
11177
  let params;
10727
- if (typeof paramsOrFirst === 'undefined' ||
11178
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
10728
11179
  (paramsOrFirst &&
10729
11180
  typeof paramsOrFirst === 'object' &&
10730
11181
  !Array.isArray(paramsOrFirst))) {
@@ -10733,14 +11184,19 @@ class DocumentsDB {
10733
11184
  else {
10734
11185
  params = {
10735
11186
  queries: paramsOrFirst,
11187
+ total: rest[0],
10736
11188
  };
10737
11189
  }
10738
11190
  const queries = params.queries;
11191
+ const total = params.total;
10739
11192
  const apiPath = '/documentsdb/transactions';
10740
11193
  const apiPayload = {};
10741
11194
  if (typeof queries !== 'undefined') {
10742
11195
  apiPayload['queries'] = queries;
10743
11196
  }
11197
+ if (typeof total !== 'undefined') {
11198
+ apiPayload['total'] = total;
11199
+ }
10744
11200
  const uri = new URL(this.client.config.endpoint + apiPath);
10745
11201
  const apiHeaders = {
10746
11202
  'X-Appwrite-Project': this.client.config.project,
@@ -14706,15 +15162,25 @@ class Functions {
14706
15162
  };
14707
15163
  return this.client.call('post', uri, apiHeaders, apiPayload);
14708
15164
  }
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() {
15165
+ listRuntimes(paramsOrFirst) {
15166
+ let params;
15167
+ if (typeof paramsOrFirst === 'undefined' ||
15168
+ (paramsOrFirst &&
15169
+ typeof paramsOrFirst === 'object' &&
15170
+ !Array.isArray(paramsOrFirst))) {
15171
+ params = (paramsOrFirst || {});
15172
+ }
15173
+ else {
15174
+ params = {
15175
+ total: paramsOrFirst,
15176
+ };
15177
+ }
15178
+ const total = params.total;
14716
15179
  const apiPath = '/functions/runtimes';
14717
15180
  const apiPayload = {};
15181
+ if (typeof total !== 'undefined') {
15182
+ apiPayload['total'] = total;
15183
+ }
14718
15184
  const uri = new URL(this.client.config.endpoint + apiPath);
14719
15185
  const apiHeaders = {
14720
15186
  'X-Appwrite-Project': this.client.config.project,
@@ -14722,9 +15188,9 @@ class Functions {
14722
15188
  };
14723
15189
  return this.client.call('get', uri, apiHeaders, apiPayload);
14724
15190
  }
14725
- listSpecifications(paramsOrFirst) {
15191
+ listSpecifications(paramsOrFirst, ...rest) {
14726
15192
  let params;
14727
- if (typeof paramsOrFirst === 'undefined' ||
15193
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
14728
15194
  (paramsOrFirst &&
14729
15195
  typeof paramsOrFirst === 'object' &&
14730
15196
  !Array.isArray(paramsOrFirst))) {
@@ -14733,14 +15199,19 @@ class Functions {
14733
15199
  else {
14734
15200
  params = {
14735
15201
  type: paramsOrFirst,
15202
+ total: rest[0],
14736
15203
  };
14737
15204
  }
14738
15205
  const type = params.type;
15206
+ const total = params.total;
14739
15207
  const apiPath = '/functions/specifications';
14740
15208
  const apiPayload = {};
14741
15209
  if (typeof type !== 'undefined') {
14742
15210
  apiPayload['type'] = type;
14743
15211
  }
15212
+ if (typeof total !== 'undefined') {
15213
+ apiPayload['total'] = total;
15214
+ }
14744
15215
  const uri = new URL(this.client.config.endpoint + apiPath);
14745
15216
  const apiHeaders = {
14746
15217
  'X-Appwrite-Project': this.client.config.project,
@@ -15398,7 +15869,7 @@ class Functions {
15398
15869
  const uri = new URL(this.client.config.endpoint + apiPath);
15399
15870
  apiPayload['project'] = this.client.config.project;
15400
15871
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
15401
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
15872
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
15402
15873
  uri.searchParams.append(key, value);
15403
15874
  }
15404
15875
  return uri.toString();
@@ -16052,15 +16523,25 @@ class Locale {
16052
16523
  };
16053
16524
  return this.client.call('get', uri, apiHeaders, apiPayload);
16054
16525
  }
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() {
16526
+ listCodes(paramsOrFirst) {
16527
+ let params;
16528
+ if (typeof paramsOrFirst === 'undefined' ||
16529
+ (paramsOrFirst &&
16530
+ typeof paramsOrFirst === 'object' &&
16531
+ !Array.isArray(paramsOrFirst))) {
16532
+ params = (paramsOrFirst || {});
16533
+ }
16534
+ else {
16535
+ params = {
16536
+ total: paramsOrFirst,
16537
+ };
16538
+ }
16539
+ const total = params.total;
16062
16540
  const apiPath = '/locale/codes';
16063
16541
  const apiPayload = {};
16542
+ if (typeof total !== 'undefined') {
16543
+ apiPayload['total'] = total;
16544
+ }
16064
16545
  const uri = new URL(this.client.config.endpoint + apiPath);
16065
16546
  const apiHeaders = {
16066
16547
  'X-Appwrite-Project': this.client.config.project,
@@ -16068,15 +16549,25 @@ class Locale {
16068
16549
  };
16069
16550
  return this.client.call('get', uri, apiHeaders, apiPayload);
16070
16551
  }
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() {
16552
+ listContinents(paramsOrFirst) {
16553
+ let params;
16554
+ if (typeof paramsOrFirst === 'undefined' ||
16555
+ (paramsOrFirst &&
16556
+ typeof paramsOrFirst === 'object' &&
16557
+ !Array.isArray(paramsOrFirst))) {
16558
+ params = (paramsOrFirst || {});
16559
+ }
16560
+ else {
16561
+ params = {
16562
+ total: paramsOrFirst,
16563
+ };
16564
+ }
16565
+ const total = params.total;
16078
16566
  const apiPath = '/locale/continents';
16079
16567
  const apiPayload = {};
16568
+ if (typeof total !== 'undefined') {
16569
+ apiPayload['total'] = total;
16570
+ }
16080
16571
  const uri = new URL(this.client.config.endpoint + apiPath);
16081
16572
  const apiHeaders = {
16082
16573
  'X-Appwrite-Project': this.client.config.project,
@@ -16084,15 +16575,25 @@ class Locale {
16084
16575
  };
16085
16576
  return this.client.call('get', uri, apiHeaders, apiPayload);
16086
16577
  }
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() {
16578
+ listCountries(paramsOrFirst) {
16579
+ let params;
16580
+ if (typeof paramsOrFirst === 'undefined' ||
16581
+ (paramsOrFirst &&
16582
+ typeof paramsOrFirst === 'object' &&
16583
+ !Array.isArray(paramsOrFirst))) {
16584
+ params = (paramsOrFirst || {});
16585
+ }
16586
+ else {
16587
+ params = {
16588
+ total: paramsOrFirst,
16589
+ };
16590
+ }
16591
+ const total = params.total;
16094
16592
  const apiPath = '/locale/countries';
16095
16593
  const apiPayload = {};
16594
+ if (typeof total !== 'undefined') {
16595
+ apiPayload['total'] = total;
16596
+ }
16096
16597
  const uri = new URL(this.client.config.endpoint + apiPath);
16097
16598
  const apiHeaders = {
16098
16599
  'X-Appwrite-Project': this.client.config.project,
@@ -16100,15 +16601,25 @@ class Locale {
16100
16601
  };
16101
16602
  return this.client.call('get', uri, apiHeaders, apiPayload);
16102
16603
  }
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() {
16604
+ listCountriesEU(paramsOrFirst) {
16605
+ let params;
16606
+ if (typeof paramsOrFirst === 'undefined' ||
16607
+ (paramsOrFirst &&
16608
+ typeof paramsOrFirst === 'object' &&
16609
+ !Array.isArray(paramsOrFirst))) {
16610
+ params = (paramsOrFirst || {});
16611
+ }
16612
+ else {
16613
+ params = {
16614
+ total: paramsOrFirst,
16615
+ };
16616
+ }
16617
+ const total = params.total;
16110
16618
  const apiPath = '/locale/countries/eu';
16111
16619
  const apiPayload = {};
16620
+ if (typeof total !== 'undefined') {
16621
+ apiPayload['total'] = total;
16622
+ }
16112
16623
  const uri = new URL(this.client.config.endpoint + apiPath);
16113
16624
  const apiHeaders = {
16114
16625
  'X-Appwrite-Project': this.client.config.project,
@@ -16116,15 +16627,25 @@ class Locale {
16116
16627
  };
16117
16628
  return this.client.call('get', uri, apiHeaders, apiPayload);
16118
16629
  }
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() {
16630
+ listCountriesPhones(paramsOrFirst) {
16631
+ let params;
16632
+ if (typeof paramsOrFirst === 'undefined' ||
16633
+ (paramsOrFirst &&
16634
+ typeof paramsOrFirst === 'object' &&
16635
+ !Array.isArray(paramsOrFirst))) {
16636
+ params = (paramsOrFirst || {});
16637
+ }
16638
+ else {
16639
+ params = {
16640
+ total: paramsOrFirst,
16641
+ };
16642
+ }
16643
+ const total = params.total;
16126
16644
  const apiPath = '/locale/countries/phones';
16127
16645
  const apiPayload = {};
16646
+ if (typeof total !== 'undefined') {
16647
+ apiPayload['total'] = total;
16648
+ }
16128
16649
  const uri = new URL(this.client.config.endpoint + apiPath);
16129
16650
  const apiHeaders = {
16130
16651
  'X-Appwrite-Project': this.client.config.project,
@@ -16132,15 +16653,25 @@ class Locale {
16132
16653
  };
16133
16654
  return this.client.call('get', uri, apiHeaders, apiPayload);
16134
16655
  }
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() {
16656
+ listCurrencies(paramsOrFirst) {
16657
+ let params;
16658
+ if (typeof paramsOrFirst === 'undefined' ||
16659
+ (paramsOrFirst &&
16660
+ typeof paramsOrFirst === 'object' &&
16661
+ !Array.isArray(paramsOrFirst))) {
16662
+ params = (paramsOrFirst || {});
16663
+ }
16664
+ else {
16665
+ params = {
16666
+ total: paramsOrFirst,
16667
+ };
16668
+ }
16669
+ const total = params.total;
16142
16670
  const apiPath = '/locale/currencies';
16143
16671
  const apiPayload = {};
16672
+ if (typeof total !== 'undefined') {
16673
+ apiPayload['total'] = total;
16674
+ }
16144
16675
  const uri = new URL(this.client.config.endpoint + apiPath);
16145
16676
  const apiHeaders = {
16146
16677
  'X-Appwrite-Project': this.client.config.project,
@@ -16148,15 +16679,25 @@ class Locale {
16148
16679
  };
16149
16680
  return this.client.call('get', uri, apiHeaders, apiPayload);
16150
16681
  }
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() {
16682
+ listLanguages(paramsOrFirst) {
16683
+ let params;
16684
+ if (typeof paramsOrFirst === 'undefined' ||
16685
+ (paramsOrFirst &&
16686
+ typeof paramsOrFirst === 'object' &&
16687
+ !Array.isArray(paramsOrFirst))) {
16688
+ params = (paramsOrFirst || {});
16689
+ }
16690
+ else {
16691
+ params = {
16692
+ total: paramsOrFirst,
16693
+ };
16694
+ }
16695
+ const total = params.total;
16158
16696
  const apiPath = '/locale/languages';
16159
16697
  const apiPayload = {};
16698
+ if (typeof total !== 'undefined') {
16699
+ apiPayload['total'] = total;
16700
+ }
16160
16701
  const uri = new URL(this.client.config.endpoint + apiPath);
16161
16702
  const apiHeaders = {
16162
16703
  'X-Appwrite-Project': this.client.config.project,
@@ -16590,40 +17131,46 @@ class Messaging {
16590
17131
  else {
16591
17132
  params = {
16592
17133
  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],
17134
+ subject: rest[0],
17135
+ content: rest[1],
17136
+ topics: rest[2],
17137
+ users: rest[3],
17138
+ targets: rest[4],
17139
+ cc: rest[5],
17140
+ bcc: rest[6],
17141
+ attachments: rest[7],
17142
+ replyToEmail: rest[8],
17143
+ replyToName: rest[9],
17144
+ draft: rest[10],
17145
+ html: rest[11],
17146
+ scheduledAt: rest[12],
16606
17147
  };
16607
17148
  }
16608
17149
  const messageId = params.messageId;
17150
+ const subject = params.subject;
17151
+ const content = params.content;
16609
17152
  const topics = params.topics;
16610
17153
  const users = params.users;
16611
17154
  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
17155
  const cc = params.cc;
16617
17156
  const bcc = params.bcc;
17157
+ const attachments = params.attachments;
16618
17158
  const replyToEmail = params.replyToEmail;
16619
17159
  const replyToName = params.replyToName;
17160
+ const draft = params.draft;
17161
+ const html = params.html;
16620
17162
  const scheduledAt = params.scheduledAt;
16621
- const attachments = params.attachments;
16622
17163
  if (typeof messageId === 'undefined' || messageId === '') {
16623
17164
  throw new AppwriteException('Missing required parameter: "messageId"');
16624
17165
  }
16625
17166
  const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
16626
17167
  const apiPayload = {};
17168
+ if (typeof subject !== 'undefined') {
17169
+ apiPayload['subject'] = subject;
17170
+ }
17171
+ if (typeof content !== 'undefined') {
17172
+ apiPayload['content'] = content;
17173
+ }
16627
17174
  if (typeof topics !== 'undefined') {
16628
17175
  apiPayload['topics'] = topics;
16629
17176
  }
@@ -16633,36 +17180,30 @@ class Messaging {
16633
17180
  if (typeof targets !== 'undefined') {
16634
17181
  apiPayload['targets'] = targets;
16635
17182
  }
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
17183
  if (typeof cc !== 'undefined') {
16649
17184
  apiPayload['cc'] = cc;
16650
17185
  }
16651
17186
  if (typeof bcc !== 'undefined') {
16652
17187
  apiPayload['bcc'] = bcc;
16653
17188
  }
17189
+ if (typeof attachments !== 'undefined') {
17190
+ apiPayload['attachments'] = attachments;
17191
+ }
16654
17192
  if (typeof replyToEmail !== 'undefined') {
16655
17193
  apiPayload['replyToEmail'] = replyToEmail;
16656
17194
  }
16657
17195
  if (typeof replyToName !== 'undefined') {
16658
17196
  apiPayload['replyToName'] = replyToName;
16659
17197
  }
17198
+ if (typeof draft !== 'undefined') {
17199
+ apiPayload['draft'] = draft;
17200
+ }
17201
+ if (typeof html !== 'undefined') {
17202
+ apiPayload['html'] = html;
17203
+ }
16660
17204
  if (typeof scheduledAt !== 'undefined') {
16661
17205
  apiPayload['scheduledAt'] = scheduledAt;
16662
17206
  }
16663
- if (typeof attachments !== 'undefined') {
16664
- apiPayload['attachments'] = attachments;
16665
- }
16666
17207
  const uri = new URL(this.client.config.endpoint + apiPath);
16667
17208
  const apiHeaders = {
16668
17209
  'X-Appwrite-Project': this.client.config.project,
@@ -16699,6 +17240,7 @@ class Messaging {
16699
17240
  contentAvailable: rest[15],
16700
17241
  critical: rest[16],
16701
17242
  priority: rest[17],
17243
+ channelId: rest[18],
16702
17244
  };
16703
17245
  }
16704
17246
  const messageId = params.messageId;
@@ -16720,6 +17262,7 @@ class Messaging {
16720
17262
  const contentAvailable = params.contentAvailable;
16721
17263
  const critical = params.critical;
16722
17264
  const priority = params.priority;
17265
+ const channelId = params.channelId;
16723
17266
  if (typeof messageId === 'undefined') {
16724
17267
  throw new AppwriteException('Missing required parameter: "messageId"');
16725
17268
  }
@@ -16782,6 +17325,9 @@ class Messaging {
16782
17325
  if (typeof priority !== 'undefined') {
16783
17326
  apiPayload['priority'] = priority;
16784
17327
  }
17328
+ if (typeof channelId !== 'undefined') {
17329
+ apiPayload['channelId'] = channelId;
17330
+ }
16785
17331
  const uri = new URL(this.client.config.endpoint + apiPath);
16786
17332
  const apiHeaders = {
16787
17333
  'X-Appwrite-Project': this.client.config.project,
@@ -16800,11 +17346,11 @@ class Messaging {
16800
17346
  else {
16801
17347
  params = {
16802
17348
  messageId: paramsOrFirst,
16803
- topics: rest[0],
16804
- users: rest[1],
16805
- targets: rest[2],
16806
- title: rest[3],
16807
- body: rest[4],
17349
+ title: rest[0],
17350
+ body: rest[1],
17351
+ topics: rest[2],
17352
+ users: rest[3],
17353
+ targets: rest[4],
16808
17354
  data: rest[5],
16809
17355
  action: rest[6],
16810
17356
  image: rest[7],
@@ -16818,14 +17364,15 @@ class Messaging {
16818
17364
  contentAvailable: rest[15],
16819
17365
  critical: rest[16],
16820
17366
  priority: rest[17],
17367
+ channelId: rest[18],
16821
17368
  };
16822
17369
  }
16823
17370
  const messageId = params.messageId;
17371
+ const title = params.title;
17372
+ const body = params.body;
16824
17373
  const topics = params.topics;
16825
17374
  const users = params.users;
16826
17375
  const targets = params.targets;
16827
- const title = params.title;
16828
- const body = params.body;
16829
17376
  const data = params.data;
16830
17377
  const action = params.action;
16831
17378
  const image = params.image;
@@ -16839,11 +17386,18 @@ class Messaging {
16839
17386
  const contentAvailable = params.contentAvailable;
16840
17387
  const critical = params.critical;
16841
17388
  const priority = params.priority;
17389
+ const channelId = params.channelId;
16842
17390
  if (typeof messageId === 'undefined' || messageId === '') {
16843
17391
  throw new AppwriteException('Missing required parameter: "messageId"');
16844
17392
  }
16845
17393
  const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
16846
17394
  const apiPayload = {};
17395
+ if (typeof title !== 'undefined') {
17396
+ apiPayload['title'] = title;
17397
+ }
17398
+ if (typeof body !== 'undefined') {
17399
+ apiPayload['body'] = body;
17400
+ }
16847
17401
  if (typeof topics !== 'undefined') {
16848
17402
  apiPayload['topics'] = topics;
16849
17403
  }
@@ -16853,12 +17407,6 @@ class Messaging {
16853
17407
  if (typeof targets !== 'undefined') {
16854
17408
  apiPayload['targets'] = targets;
16855
17409
  }
16856
- if (typeof title !== 'undefined') {
16857
- apiPayload['title'] = title;
16858
- }
16859
- if (typeof body !== 'undefined') {
16860
- apiPayload['body'] = body;
16861
- }
16862
17410
  if (typeof data !== 'undefined') {
16863
17411
  apiPayload['data'] = data;
16864
17412
  }
@@ -16898,6 +17446,9 @@ class Messaging {
16898
17446
  if (typeof priority !== 'undefined') {
16899
17447
  apiPayload['priority'] = priority;
16900
17448
  }
17449
+ if (typeof channelId !== 'undefined') {
17450
+ apiPayload['channelId'] = channelId;
17451
+ }
16901
17452
  const uri = new URL(this.client.config.endpoint + apiPath);
16902
17453
  const apiHeaders = {
16903
17454
  'X-Appwrite-Project': this.client.config.project,
@@ -17040,19 +17591,19 @@ class Messaging {
17040
17591
  else {
17041
17592
  params = {
17042
17593
  messageId: paramsOrFirst,
17043
- topics: rest[0],
17044
- users: rest[1],
17045
- targets: rest[2],
17046
- content: rest[3],
17594
+ content: rest[0],
17595
+ topics: rest[1],
17596
+ users: rest[2],
17597
+ targets: rest[3],
17047
17598
  draft: rest[4],
17048
17599
  scheduledAt: rest[5],
17049
17600
  };
17050
17601
  }
17051
17602
  const messageId = params.messageId;
17603
+ const content = params.content;
17052
17604
  const topics = params.topics;
17053
17605
  const users = params.users;
17054
17606
  const targets = params.targets;
17055
- const content = params.content;
17056
17607
  const draft = params.draft;
17057
17608
  const scheduledAt = params.scheduledAt;
17058
17609
  if (typeof messageId === 'undefined' || messageId === '') {
@@ -17060,6 +17611,9 @@ class Messaging {
17060
17611
  }
17061
17612
  const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
17062
17613
  const apiPayload = {};
17614
+ if (typeof content !== 'undefined') {
17615
+ apiPayload['content'] = content;
17616
+ }
17063
17617
  if (typeof topics !== 'undefined') {
17064
17618
  apiPayload['topics'] = topics;
17065
17619
  }
@@ -17069,9 +17623,6 @@ class Messaging {
17069
17623
  if (typeof targets !== 'undefined') {
17070
17624
  apiPayload['targets'] = targets;
17071
17625
  }
17072
- if (typeof content !== 'undefined') {
17073
- apiPayload['content'] = content;
17074
- }
17075
17626
  if (typeof draft !== 'undefined') {
17076
17627
  apiPayload['draft'] = draft;
17077
17628
  }
@@ -17096,19 +17647,19 @@ class Messaging {
17096
17647
  else {
17097
17648
  params = {
17098
17649
  messageId: paramsOrFirst,
17099
- topics: rest[0],
17100
- users: rest[1],
17101
- targets: rest[2],
17102
- content: rest[3],
17650
+ content: rest[0],
17651
+ topics: rest[1],
17652
+ users: rest[2],
17653
+ targets: rest[3],
17103
17654
  draft: rest[4],
17104
17655
  scheduledAt: rest[5],
17105
17656
  };
17106
17657
  }
17107
17658
  const messageId = params.messageId;
17659
+ const content = params.content;
17108
17660
  const topics = params.topics;
17109
17661
  const users = params.users;
17110
17662
  const targets = params.targets;
17111
- const content = params.content;
17112
17663
  const draft = params.draft;
17113
17664
  const scheduledAt = params.scheduledAt;
17114
17665
  if (typeof messageId === 'undefined' || messageId === '') {
@@ -17116,6 +17667,9 @@ class Messaging {
17116
17667
  }
17117
17668
  const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId)));
17118
17669
  const apiPayload = {};
17670
+ if (typeof content !== 'undefined') {
17671
+ apiPayload['content'] = content;
17672
+ }
17119
17673
  if (typeof topics !== 'undefined') {
17120
17674
  apiPayload['topics'] = topics;
17121
17675
  }
@@ -17125,9 +17679,6 @@ class Messaging {
17125
17679
  if (typeof targets !== 'undefined') {
17126
17680
  apiPayload['targets'] = targets;
17127
17681
  }
17128
- if (typeof content !== 'undefined') {
17129
- apiPayload['content'] = content;
17130
- }
17131
17682
  if (typeof draft !== 'undefined') {
17132
17683
  apiPayload['draft'] = draft;
17133
17684
  }
@@ -23199,9 +23750,9 @@ class Notifications {
23199
23750
  constructor(client) {
23200
23751
  this.client = client;
23201
23752
  }
23202
- list(paramsOrFirst) {
23753
+ list(paramsOrFirst, ...rest) {
23203
23754
  let params;
23204
- if (typeof paramsOrFirst === 'undefined' ||
23755
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
23205
23756
  (paramsOrFirst &&
23206
23757
  typeof paramsOrFirst === 'object' &&
23207
23758
  !Array.isArray(paramsOrFirst))) {
@@ -23210,14 +23761,19 @@ class Notifications {
23210
23761
  else {
23211
23762
  params = {
23212
23763
  queries: paramsOrFirst,
23764
+ total: rest[0],
23213
23765
  };
23214
23766
  }
23215
23767
  const queries = params.queries;
23768
+ const total = params.total;
23216
23769
  const apiPath = '/notifications';
23217
23770
  const apiPayload = {};
23218
23771
  if (typeof queries !== 'undefined') {
23219
23772
  apiPayload['queries'] = queries;
23220
23773
  }
23774
+ if (typeof total !== 'undefined') {
23775
+ apiPayload['total'] = total;
23776
+ }
23221
23777
  const uri = new URL(this.client.config.endpoint + apiPath);
23222
23778
  const apiHeaders = {
23223
23779
  'X-Appwrite-Project': this.client.config.project,
@@ -25952,7 +26508,7 @@ class Organizations {
25952
26508
  const uri = new URL(this.client.config.endpoint + apiPath);
25953
26509
  apiPayload['project'] = this.client.config.project;
25954
26510
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
25955
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
26511
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
25956
26512
  uri.searchParams.append(key, value);
25957
26513
  }
25958
26514
  return uri.toString();
@@ -26059,7 +26615,7 @@ class Organizations {
26059
26615
  const uri = new URL(this.client.config.endpoint + apiPath);
26060
26616
  apiPayload['project'] = this.client.config.project;
26061
26617
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
26062
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
26618
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
26063
26619
  uri.searchParams.append(key, value);
26064
26620
  }
26065
26621
  return uri.toString();
@@ -30507,6 +31063,43 @@ class Project {
30507
31063
  };
30508
31064
  return this.client.call('patch', uri, apiHeaders, apiPayload);
30509
31065
  }
31066
+ updateOAuth2Webflow(paramsOrFirst, ...rest) {
31067
+ let params;
31068
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
31069
+ (paramsOrFirst &&
31070
+ typeof paramsOrFirst === 'object' &&
31071
+ !Array.isArray(paramsOrFirst))) {
31072
+ params = (paramsOrFirst || {});
31073
+ }
31074
+ else {
31075
+ params = {
31076
+ clientId: paramsOrFirst,
31077
+ clientSecret: rest[0],
31078
+ enabled: rest[1],
31079
+ };
31080
+ }
31081
+ const clientId = params.clientId;
31082
+ const clientSecret = params.clientSecret;
31083
+ const enabled = params.enabled;
31084
+ const apiPath = '/project/oauth2/webflow';
31085
+ const apiPayload = {};
31086
+ if (typeof clientId !== 'undefined') {
31087
+ apiPayload['clientId'] = clientId;
31088
+ }
31089
+ if (typeof clientSecret !== 'undefined') {
31090
+ apiPayload['clientSecret'] = clientSecret;
31091
+ }
31092
+ if (typeof enabled !== 'undefined') {
31093
+ apiPayload['enabled'] = enabled;
31094
+ }
31095
+ const uri = new URL(this.client.config.endpoint + apiPath);
31096
+ const apiHeaders = {
31097
+ 'X-Appwrite-Project': this.client.config.project,
31098
+ 'content-type': 'application/json',
31099
+ accept: 'application/json',
31100
+ };
31101
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
31102
+ }
30510
31103
  updateOAuth2WordPress(paramsOrFirst, ...rest) {
30511
31104
  let params;
30512
31105
  if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
@@ -33489,15 +34082,25 @@ class Sites {
33489
34082
  };
33490
34083
  return this.client.call('post', uri, apiHeaders, apiPayload);
33491
34084
  }
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() {
34085
+ listFrameworks(paramsOrFirst) {
34086
+ let params;
34087
+ if (typeof paramsOrFirst === 'undefined' ||
34088
+ (paramsOrFirst &&
34089
+ typeof paramsOrFirst === 'object' &&
34090
+ !Array.isArray(paramsOrFirst))) {
34091
+ params = (paramsOrFirst || {});
34092
+ }
34093
+ else {
34094
+ params = {
34095
+ total: paramsOrFirst,
34096
+ };
34097
+ }
34098
+ const total = params.total;
33499
34099
  const apiPath = '/sites/frameworks';
33500
34100
  const apiPayload = {};
34101
+ if (typeof total !== 'undefined') {
34102
+ apiPayload['total'] = total;
34103
+ }
33501
34104
  const uri = new URL(this.client.config.endpoint + apiPath);
33502
34105
  const apiHeaders = {
33503
34106
  'X-Appwrite-Project': this.client.config.project,
@@ -33505,9 +34108,9 @@ class Sites {
33505
34108
  };
33506
34109
  return this.client.call('get', uri, apiHeaders, apiPayload);
33507
34110
  }
33508
- listSpecifications(paramsOrFirst) {
34111
+ listSpecifications(paramsOrFirst, ...rest) {
33509
34112
  let params;
33510
- if (typeof paramsOrFirst === 'undefined' ||
34113
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
33511
34114
  (paramsOrFirst &&
33512
34115
  typeof paramsOrFirst === 'object' &&
33513
34116
  !Array.isArray(paramsOrFirst))) {
@@ -33516,14 +34119,19 @@ class Sites {
33516
34119
  else {
33517
34120
  params = {
33518
34121
  type: paramsOrFirst,
34122
+ total: rest[0],
33519
34123
  };
33520
34124
  }
33521
34125
  const type = params.type;
34126
+ const total = params.total;
33522
34127
  const apiPath = '/sites/specifications';
33523
34128
  const apiPayload = {};
33524
34129
  if (typeof type !== 'undefined') {
33525
34130
  apiPayload['type'] = type;
33526
34131
  }
34132
+ if (typeof total !== 'undefined') {
34133
+ apiPayload['total'] = total;
34134
+ }
33527
34135
  const uri = new URL(this.client.config.endpoint + apiPath);
33528
34136
  const apiHeaders = {
33529
34137
  'X-Appwrite-Project': this.client.config.project,
@@ -33540,7 +34148,8 @@ class Sites {
33540
34148
  ('frameworks' in paramsOrFirst ||
33541
34149
  'useCases' in paramsOrFirst ||
33542
34150
  'limit' in paramsOrFirst ||
33543
- 'offset' in paramsOrFirst))) {
34151
+ 'offset' in paramsOrFirst ||
34152
+ 'total' in paramsOrFirst))) {
33544
34153
  params = (paramsOrFirst || {});
33545
34154
  }
33546
34155
  else {
@@ -33549,12 +34158,14 @@ class Sites {
33549
34158
  useCases: rest[0],
33550
34159
  limit: rest[1],
33551
34160
  offset: rest[2],
34161
+ total: rest[3],
33552
34162
  };
33553
34163
  }
33554
34164
  const frameworks = params.frameworks;
33555
34165
  const useCases = params.useCases;
33556
34166
  const limit = params.limit;
33557
34167
  const offset = params.offset;
34168
+ const total = params.total;
33558
34169
  const apiPath = '/sites/templates';
33559
34170
  const apiPayload = {};
33560
34171
  if (typeof frameworks !== 'undefined') {
@@ -33569,6 +34180,9 @@ class Sites {
33569
34180
  if (typeof offset !== 'undefined') {
33570
34181
  apiPayload['offset'] = offset;
33571
34182
  }
34183
+ if (typeof total !== 'undefined') {
34184
+ apiPayload['total'] = total;
34185
+ }
33572
34186
  const uri = new URL(this.client.config.endpoint + apiPath);
33573
34187
  const apiHeaders = {
33574
34188
  'X-Appwrite-Project': this.client.config.project,
@@ -34185,7 +34799,7 @@ class Sites {
34185
34799
  const uri = new URL(this.client.config.endpoint + apiPath);
34186
34800
  apiPayload['project'] = this.client.config.project;
34187
34801
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
34188
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
34802
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
34189
34803
  uri.searchParams.append(key, value);
34190
34804
  }
34191
34805
  return uri.toString();
@@ -35016,7 +35630,7 @@ class Storage {
35016
35630
  const uri = new URL(this.client.config.endpoint + apiPath);
35017
35631
  apiPayload['project'] = this.client.config.project;
35018
35632
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
35019
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
35633
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
35020
35634
  uri.searchParams.append(key, value);
35021
35635
  }
35022
35636
  return uri.toString();
@@ -35109,7 +35723,7 @@ class Storage {
35109
35723
  const uri = new URL(this.client.config.endpoint + apiPath);
35110
35724
  apiPayload['project'] = this.client.config.project;
35111
35725
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
35112
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
35726
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
35113
35727
  uri.searchParams.append(key, value);
35114
35728
  }
35115
35729
  return uri.toString();
@@ -35147,7 +35761,7 @@ class Storage {
35147
35761
  const uri = new URL(this.client.config.endpoint + apiPath);
35148
35762
  apiPayload['project'] = this.client.config.project;
35149
35763
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
35150
- for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
35764
+ for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
35151
35765
  uri.searchParams.append(key, value);
35152
35766
  }
35153
35767
  return uri.toString();
@@ -35267,9 +35881,9 @@ class TablesDB {
35267
35881
  };
35268
35882
  return this.client.call('get', uri, apiHeaders, apiPayload);
35269
35883
  }
35270
- listTransactions(paramsOrFirst) {
35884
+ listTransactions(paramsOrFirst, ...rest) {
35271
35885
  let params;
35272
- if (typeof paramsOrFirst === 'undefined' ||
35886
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
35273
35887
  (paramsOrFirst &&
35274
35888
  typeof paramsOrFirst === 'object' &&
35275
35889
  !Array.isArray(paramsOrFirst))) {
@@ -35278,14 +35892,19 @@ class TablesDB {
35278
35892
  else {
35279
35893
  params = {
35280
35894
  queries: paramsOrFirst,
35895
+ total: rest[0],
35281
35896
  };
35282
35897
  }
35283
35898
  const queries = params.queries;
35899
+ const total = params.total;
35284
35900
  const apiPath = '/tablesdb/transactions';
35285
35901
  const apiPayload = {};
35286
35902
  if (typeof queries !== 'undefined') {
35287
35903
  apiPayload['queries'] = queries;
35288
35904
  }
35905
+ if (typeof total !== 'undefined') {
35906
+ apiPayload['total'] = total;
35907
+ }
35289
35908
  const uri = new URL(this.client.config.endpoint + apiPath);
35290
35909
  const apiHeaders = {
35291
35910
  'X-Appwrite-Project': this.client.config.project,
@@ -42107,12 +42726,14 @@ class Vcs {
42107
42726
  type: rest[0],
42108
42727
  search: rest[1],
42109
42728
  queries: rest[2],
42729
+ total: rest[3],
42110
42730
  };
42111
42731
  }
42112
42732
  const installationId = params.installationId;
42113
42733
  const type = params.type;
42114
42734
  const search = params.search;
42115
42735
  const queries = params.queries;
42736
+ const total = params.total;
42116
42737
  if (typeof installationId === 'undefined' || installationId === '') {
42117
42738
  throw new AppwriteException('Missing required parameter: "installationId"');
42118
42739
  }
@@ -42130,6 +42751,9 @@ class Vcs {
42130
42751
  if (typeof queries !== 'undefined') {
42131
42752
  apiPayload['queries'] = queries;
42132
42753
  }
42754
+ if (typeof total !== 'undefined') {
42755
+ apiPayload['total'] = total;
42756
+ }
42133
42757
  const uri = new URL(this.client.config.endpoint + apiPath);
42134
42758
  const apiHeaders = {
42135
42759
  'X-Appwrite-Project': this.client.config.project,
@@ -42230,12 +42854,14 @@ class Vcs {
42230
42854
  providerRepositoryId: rest[0],
42231
42855
  search: rest[1],
42232
42856
  queries: rest[2],
42857
+ total: rest[3],
42233
42858
  };
42234
42859
  }
42235
42860
  const installationId = params.installationId;
42236
42861
  const providerRepositoryId = params.providerRepositoryId;
42237
42862
  const search = params.search;
42238
42863
  const queries = params.queries;
42864
+ const total = params.total;
42239
42865
  if (typeof installationId === 'undefined' || installationId === '') {
42240
42866
  throw new AppwriteException('Missing required parameter: "installationId"');
42241
42867
  }
@@ -42253,6 +42879,9 @@ class Vcs {
42253
42879
  if (typeof queries !== 'undefined') {
42254
42880
  apiPayload['queries'] = queries;
42255
42881
  }
42882
+ if (typeof total !== 'undefined') {
42883
+ apiPayload['total'] = total;
42884
+ }
42256
42885
  const uri = new URL(this.client.config.endpoint + apiPath);
42257
42886
  const apiHeaders = {
42258
42887
  'X-Appwrite-Project': this.client.config.project,
@@ -42443,11 +43072,13 @@ class Vcs {
42443
43072
  installationId: paramsOrFirst,
42444
43073
  search: rest[0],
42445
43074
  queries: rest[1],
43075
+ total: rest[2],
42446
43076
  };
42447
43077
  }
42448
43078
  const installationId = params.installationId;
42449
43079
  const search = params.search;
42450
43080
  const queries = params.queries;
43081
+ const total = params.total;
42451
43082
  if (typeof installationId === 'undefined' || installationId === '') {
42452
43083
  throw new AppwriteException('Missing required parameter: "installationId"');
42453
43084
  }
@@ -42459,6 +43090,9 @@ class Vcs {
42459
43090
  if (typeof queries !== 'undefined') {
42460
43091
  apiPayload['queries'] = queries;
42461
43092
  }
43093
+ if (typeof total !== 'undefined') {
43094
+ apiPayload['total'] = total;
43095
+ }
42462
43096
  const uri = new URL(this.client.config.endpoint + apiPath);
42463
43097
  const apiHeaders = {
42464
43098
  'X-Appwrite-Project': this.client.config.project,
@@ -42576,9 +43210,9 @@ class VectorsDB {
42576
43210
  };
42577
43211
  return this.client.call('get', uri, apiHeaders, apiPayload);
42578
43212
  }
42579
- listTransactions(paramsOrFirst) {
43213
+ listTransactions(paramsOrFirst, ...rest) {
42580
43214
  let params;
42581
- if (typeof paramsOrFirst === 'undefined' ||
43215
+ if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
42582
43216
  (paramsOrFirst &&
42583
43217
  typeof paramsOrFirst === 'object' &&
42584
43218
  !Array.isArray(paramsOrFirst))) {
@@ -42587,14 +43221,19 @@ class VectorsDB {
42587
43221
  else {
42588
43222
  params = {
42589
43223
  queries: paramsOrFirst,
43224
+ total: rest[0],
42590
43225
  };
42591
43226
  }
42592
43227
  const queries = params.queries;
43228
+ const total = params.total;
42593
43229
  const apiPath = '/vectorsdb/transactions';
42594
43230
  const apiPayload = {};
42595
43231
  if (typeof queries !== 'undefined') {
42596
43232
  apiPayload['queries'] = queries;
42597
43233
  }
43234
+ if (typeof total !== 'undefined') {
43235
+ apiPayload['total'] = total;
43236
+ }
42598
43237
  const uri = new URL(this.client.config.endpoint + apiPath);
42599
43238
  const apiHeaders = {
42600
43239
  'X-Appwrite-Project': this.client.config.project,
@@ -45656,6 +46295,27 @@ class Realtime {
45656
46295
  }
45657
46296
  }
45658
46297
 
46298
+ const TAB_ID_KEY = 'appwrite-push-client-id';
46299
+ // Loaded on first connect, so an app that never uses Push does not bundle mqtt.js.
46300
+ let transport = null;
46301
+ function loadTransport() {
46302
+ if (!transport) {
46303
+ transport = Promise.all([import('mqtt'), import('buffer')]).then(
46304
+ // The browser build of mqtt.js (dist/mqtt.esm.js) exports only a default.
46305
+ ([mqtt, buffer]) => {
46306
+ var _a;
46307
+ return ({
46308
+ connect: ((_a = mqtt.default) !== null && _a !== void 0 ? _a : mqtt).connect,
46309
+ Buffer: buffer.Buffer,
46310
+ });
46311
+ });
46312
+ // A failed load must not poison later connects.
46313
+ transport.catch(() => {
46314
+ transport = null;
46315
+ });
46316
+ }
46317
+ return transport;
46318
+ }
45659
46319
  // Fixed connection tuning — not exposed as options.
45660
46320
  const KEEP_ALIVE_SECONDS = 60;
45661
46321
  const RECONNECT_PERIOD_MS = 2000;
@@ -45680,11 +46340,13 @@ const RECONNECT_PERIOD_MS = 2000;
45680
46340
  * );
45681
46341
  * // sub.update({ background: true }); sub.unsubscribe();
45682
46342
  */
45683
- class Push extends Service {
46343
+ class Push {
45684
46344
  constructor(client) {
45685
- super(client);
45686
46345
  this.mqtt = null;
45687
46346
  this.connecting = null;
46347
+ this.Buffer = null;
46348
+ /** Bumped by close(), so a connect still loading mqtt.js knows to stop. */
46349
+ this.generation = 0;
45688
46350
  /** Set once the first CONNACK lands, so 'connect' events after are reconnects. */
45689
46351
  this.everConnected = false;
45690
46352
  /** Errors already handed to onError, so one failure is reported once. */
@@ -45696,11 +46358,20 @@ class Push extends Service {
45696
46358
  // Local id -> subscription state. The id is never sent to the broker; it only lets
45697
46359
  // the same topic carry more than one callback (each with its own options).
45698
46360
  /**
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.
46361
+ * This tab's part of the default client id when the tab has none yet (see claimTabId):
46362
+ * random, but kept for this instance so reconnects resume the same broker session.
45701
46363
  */
45702
46364
  this.fallbackClientId = randomId();
46365
+ /** The default client id claimed for this instance's connection, released on close(). */
46366
+ this.tabId = '';
46367
+ /** In-flight claim of {@link tabId}, memoized per generation: a credential switch (same
46368
+ * generation) shares the one claim; a close/reopen (new generation) chains a fresh claim. */
46369
+ this.tabIdClaim = null;
46370
+ this.tabIdClaimGeneration = -1;
46371
+ this.connectedKey = '';
46372
+ this.connectionEpoch = 0;
45703
46373
  this.subscriptions = new Map();
46374
+ this.client = client;
45704
46375
  }
45705
46376
  // The broker subscription for a filter uses the highest QoS any local subscription on
45706
46377
  // it wants, so a QoS-0 subscription never downgrades a QoS-1 one sharing the filter.
@@ -45800,7 +46471,17 @@ class Push extends Service {
45800
46471
  if (background) {
45801
46472
  this.requestNotificationPermission();
45802
46473
  }
45803
- const client = yield this.connect();
46474
+ let client;
46475
+ try {
46476
+ client = yield this.connect();
46477
+ }
46478
+ catch (err) {
46479
+ if (err instanceof SupersededError) {
46480
+ return this.subscribeWith(topicsOrCallback, callbackOrOptions, topicOptions);
46481
+ }
46482
+ throw err;
46483
+ }
46484
+ const epoch = this.connectionEpoch;
45804
46485
  const ids = [];
45805
46486
  const acks = [];
45806
46487
  for (const topic of topicList) {
@@ -45859,6 +46540,12 @@ class Push extends Service {
45859
46540
  yield Promise.all(acks);
45860
46541
  }
45861
46542
  catch (err) {
46543
+ if (epoch !== this.connectionEpoch) {
46544
+ for (const id of ids) {
46545
+ this.subscriptions.delete(id);
46546
+ }
46547
+ return this.subscribeWith(topicsOrCallback, callbackOrOptions, topicOptions);
46548
+ }
45862
46549
  unsubscribe();
45863
46550
  throw err;
45864
46551
  }
@@ -45919,7 +46606,14 @@ class Push extends Service {
45919
46606
  this.mqtt.end(true);
45920
46607
  this.mqtt = null;
45921
46608
  }
46609
+ if (this.tabId !== '') {
46610
+ releaseTabId(this.tabId);
46611
+ this.tabId = '';
46612
+ }
45922
46613
  this.connecting = null;
46614
+ // Bumping the generation ends the current claim: one still in flight releases its id when
46615
+ // it resolves, and the next open() chains a fresh claim after it (see claimClientId).
46616
+ this.generation++;
45923
46617
  this.everConnected = false;
45924
46618
  this.subscriptions.clear();
45925
46619
  }
@@ -45944,19 +46638,62 @@ class Push extends Service {
45944
46638
  }
45945
46639
  // --- internals ---
45946
46640
  connect() {
45947
- if (this.mqtt) {
46641
+ var _a;
46642
+ if ((this.mqtt || this.connecting) &&
46643
+ this.connectedKey !== this.credentialKey()) {
46644
+ this.connectionEpoch++;
46645
+ (_a = this.mqtt) === null || _a === void 0 ? void 0 : _a.end(true);
46646
+ this.mqtt = null;
46647
+ this.connecting = null;
46648
+ this.everConnected = this.subscriptions.size > 0;
46649
+ }
46650
+ if (this.mqtt && !this.connecting) {
45948
46651
  return Promise.resolve(this.mqtt);
45949
46652
  }
45950
46653
  if (!this.connecting) {
45951
- this.connecting = this.open();
46654
+ const connecting = this.open();
46655
+ this.connecting = connecting;
45952
46656
  // A failed open must not poison future attempts — clear the cached
45953
46657
  // in-flight promise so a later subscribe/publish can retry.
45954
- this.connecting.catch(() => {
45955
- this.connecting = null;
46658
+ connecting.catch(() => {
46659
+ if (this.connecting === connecting) {
46660
+ this.connecting = null;
46661
+ }
45956
46662
  });
45957
46663
  }
45958
46664
  return this.connecting.then(() => this.mqtt);
45959
46665
  }
46666
+ credential() {
46667
+ if (this.client.config.jwt) {
46668
+ return {
46669
+ authMethod: 'appwrite-jwt',
46670
+ credential: this.client.config.jwt,
46671
+ };
46672
+ }
46673
+ if (this.client.config.session) {
46674
+ return {
46675
+ authMethod: 'appwrite-session',
46676
+ credential: this.client.config.session,
46677
+ };
46678
+ }
46679
+ throw new Error('No credential set on the client; call Client.setJWT() or Client.setSession() first.');
46680
+ }
46681
+ credentialKey() {
46682
+ var _a, _b;
46683
+ try {
46684
+ const { authMethod, credential } = this.credential();
46685
+ return [
46686
+ this.endpointUrl(),
46687
+ (_a = this.client.config.project) !== null && _a !== void 0 ? _a : '',
46688
+ (_b = this.client.config.pushClientId) !== null && _b !== void 0 ? _b : '',
46689
+ authMethod,
46690
+ credential,
46691
+ ].join('|');
46692
+ }
46693
+ catch (_c) {
46694
+ return '';
46695
+ }
46696
+ }
45960
46697
  endpointUrl() {
45961
46698
  // The push endpoint set on the client (Client.setPushEndpoint) wins.
45962
46699
  if (this.client.config.endpointPush !== '') {
@@ -45974,35 +46711,76 @@ class Push extends Service {
45974
46711
  ? wsEndpoint
45975
46712
  : `${wsEndpoint.slice(0, at + separator.length)}push.${wsEndpoint.slice(at + separator.length)}`;
45976
46713
  }
46714
+ /**
46715
+ * Claim this connection's default client id, memoized per generation. A credential switch (same
46716
+ * generation) shares the one claim, so concurrent open() calls never each claim. A close/reopen
46717
+ * (a new generation) chains a fresh claim after the previous one has settled and released its
46718
+ * id, so the reopened connection can take the tab's stored id back rather than a fallback. A
46719
+ * claim that resolves after its generation has ended releases its id instead of keeping it, so
46720
+ * a stale open connects with nothing reserved and the stored id is never stranded.
46721
+ */
46722
+ claimClientId() {
46723
+ var _a;
46724
+ const generation = this.generation;
46725
+ if (this.tabIdClaim === null ||
46726
+ this.tabIdClaimGeneration !== generation) {
46727
+ const previous = (_a = this.tabIdClaim) !== null && _a !== void 0 ? _a : Promise.resolve('');
46728
+ this.tabIdClaimGeneration = generation;
46729
+ const claim = previous
46730
+ .catch(() => '')
46731
+ .then(() => claimTabId(this.fallbackClientId))
46732
+ .then((id) => {
46733
+ if (this.generation !== generation) {
46734
+ releaseTabId(id);
46735
+ return '';
46736
+ }
46737
+ this.tabId = id;
46738
+ return id;
46739
+ });
46740
+ this.tabIdClaim = claim;
46741
+ return claim;
46742
+ }
46743
+ return this.tabIdClaim;
46744
+ }
45977
46745
  open() {
45978
46746
  return __awaiter(this, void 0, void 0, function* () {
45979
46747
  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
- }
46748
+ const { authMethod, credential } = this.credential();
46749
+ this.connectedKey = this.credentialKey();
46750
+ const epoch = this.connectionEpoch;
46751
+ const generation = this.generation;
45994
46752
  const project = (_a = this.client.config.project) !== null && _a !== void 0 ? _a : '';
45995
46753
  // Client id, when the app did not set one with Client.setPushClientId(). Unlike the
45996
46754
  // 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.
46755
+ // rejects an empty id with clean start off, so derive one per user and tab from the
46756
+ // credential this connection authenticates with (the JWT's userId, or the session's user
46757
+ // id) and an id kept in the tab's sessionStorage. It stays the same across reloads, so
46758
+ // the broker's replay cursor resumes, and differs between tabs and browsers, so two of
46759
+ // them do not take over each other's session. The credential itself is never used.
46760
+ const userId = authMethod === 'appwrite-jwt'
46761
+ ? userIdFromJwt(credential)
46762
+ : userIdFromSession(credential);
46763
+ // Claim once per instance (memoized) and reuse it across reconnects and credential
46764
+ // switches, so concurrent open() calls never each claim and strand the tab's stored id.
46765
+ // Concurrent instances still get distinct ids. If close() ran while the claim was pending
46766
+ // this open is stale, so stop before connecting (the claim releases its own id).
46767
+ if (!this.client.config.pushClientId) {
46768
+ yield this.claimClientId();
46769
+ if (generation !== this.generation) {
46770
+ throw new Error('Push was closed while connecting.');
46771
+ }
46772
+ }
46773
+ const tabId = this.tabId;
46001
46774
  const clientId = this.client.config.pushClientId ||
46002
- (authMethod === 'appwrite-jwt'
46003
- ? userIdFromJwt(credential)
46004
- : userIdFromSession(credential)) ||
46005
- this.fallbackClientId;
46775
+ (userId ? `${userId}-${tabId}` : tabId);
46776
+ const { connect, Buffer } = yield loadTransport();
46777
+ if (generation !== this.generation) {
46778
+ throw new Error('Push was closed while connecting.');
46779
+ }
46780
+ if (epoch !== this.connectionEpoch) {
46781
+ throw new SupersededError();
46782
+ }
46783
+ this.Buffer = Buffer;
46006
46784
  const options = {
46007
46785
  clientId,
46008
46786
  protocolVersion: 5,
@@ -46017,7 +46795,7 @@ class Push extends Service {
46017
46795
  userProperties: { projectId: project },
46018
46796
  },
46019
46797
  };
46020
- const client = mqtt.connect(this.endpointUrl(), options);
46798
+ const client = connect(this.endpointUrl(), options);
46021
46799
  this.mqtt = client;
46022
46800
  client.on('message', (_topic, _payload, packet) => {
46023
46801
  this.dispatch(packet).catch((err) => this.report(err));
@@ -46049,6 +46827,9 @@ class Push extends Service {
46049
46827
  }
46050
46828
  });
46051
46829
  client.on('error', (err) => {
46830
+ if (epoch !== this.connectionEpoch) {
46831
+ return;
46832
+ }
46052
46833
  const error = this.connectError(err, refusedReason);
46053
46834
  // While the first connect is pending its caller receives the error (and reports it
46054
46835
  // through fail()); afterwards, e.g. on reconnect, report it here.
@@ -46067,6 +46848,10 @@ class Push extends Service {
46067
46848
  const onConnect = (packet) => {
46068
46849
  var _a, _b;
46069
46850
  cleanup();
46851
+ if (epoch !== this.connectionEpoch) {
46852
+ reject(new SupersededError());
46853
+ return;
46854
+ }
46070
46855
  const rc = (_b = (_a = packet.reasonCode) !== null && _a !== void 0 ? _a : packet.returnCode) !== null && _b !== void 0 ? _b : 0;
46071
46856
  if (rc !== 0) {
46072
46857
  this.close();
@@ -46078,16 +46863,30 @@ class Push extends Service {
46078
46863
  };
46079
46864
  const onError = (err) => {
46080
46865
  cleanup();
46866
+ if (epoch !== this.connectionEpoch) {
46867
+ reject(new SupersededError());
46868
+ return;
46869
+ }
46081
46870
  this.close();
46082
46871
  reject(this.connectError(err, refusedReason));
46083
46872
  };
46873
+ const onClose = () => {
46874
+ if (epoch !== this.connectionEpoch) {
46875
+ cleanup();
46876
+ reject(new SupersededError());
46877
+ }
46878
+ };
46084
46879
  const cleanup = () => {
46085
- this.opening = false;
46880
+ if (epoch === this.connectionEpoch) {
46881
+ this.opening = false;
46882
+ }
46086
46883
  client.removeListener('connect', onConnect);
46087
46884
  client.removeListener('error', onError);
46885
+ client.removeListener('close', onClose);
46088
46886
  };
46089
46887
  client.on('connect', onConnect);
46090
46888
  client.on('error', onError);
46889
+ client.on('close', onClose);
46091
46890
  client.connect();
46092
46891
  });
46093
46892
  });
@@ -46109,6 +46908,7 @@ class Push extends Service {
46109
46908
  /** Fan a delivered packet out to every subscription whose filter matches. */
46110
46909
  dispatch(packet) {
46111
46910
  return __awaiter(this, void 0, void 0, function* () {
46911
+ const Buffer = this.Buffer;
46112
46912
  const payload = Buffer.isBuffer(packet.payload)
46113
46913
  ? packet.payload
46114
46914
  : Buffer.from(packet.payload);
@@ -46152,6 +46952,11 @@ class Push extends Service {
46152
46952
  }
46153
46953
  }
46154
46954
  }
46955
+ class SupersededError extends Error {
46956
+ constructor() {
46957
+ super('The push connection was superseded');
46958
+ }
46959
+ }
46155
46960
  /** Normalize anything thrown or passed to an error handler into an `Error`. */
46156
46961
  function toError(error) {
46157
46962
  return error instanceof Error ? error : new Error(String(error));
@@ -46170,8 +46975,7 @@ function userIdFromJwt(jwt) {
46170
46975
  return '';
46171
46976
  }
46172
46977
  try {
46173
- const json = Buffer.from(parts[1].replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf-8');
46174
- const payload = JSON.parse(json);
46978
+ const payload = JSON.parse(decodeBase64(parts[1].replace(/-/g, '+').replace(/_/g, '/')));
46175
46979
  return typeof payload.userId === 'string' ? payload.userId : '';
46176
46980
  }
46177
46981
  catch (_a) {
@@ -46187,13 +46991,99 @@ function userIdFromSession(session) {
46187
46991
  return '';
46188
46992
  }
46189
46993
  try {
46190
- const payload = JSON.parse(Buffer.from(session, 'base64').toString('utf-8'));
46994
+ const payload = JSON.parse(decodeBase64(session));
46191
46995
  return typeof payload.id === 'string' ? payload.id : '';
46192
46996
  }
46193
46997
  catch (_a) {
46194
46998
  return '';
46195
46999
  }
46196
47000
  }
47001
+ /** Ids in use by live connections in this page, so two Push instances never share a client id. */
47002
+ const claimedTabIds = new Set();
47003
+ /** The tab's stored id, resolved and locked once per page (see claimStoredTabId). */
47004
+ let storedTabIdClaim = null;
47005
+ /**
47006
+ * A default client id for one Push connection in this page. The first connection alive takes the
47007
+ * tab's stored id (kept in sessionStorage and locked for the page's lifetime, so it stays the same
47008
+ * across reloads and the broker's replay cursor resumes). Any connection alive at the same time
47009
+ * takes a distinct locked id instead, so simultaneous Push instances never share a client id and
47010
+ * so cannot take over each other's broker session. `fallback` is this instance's own random id.
47011
+ */
47012
+ function claimTabId(fallback) {
47013
+ return __awaiter(this, void 0, void 0, function* () {
47014
+ const stored = yield claimStoredTabId(fallback);
47015
+ if (stored !== '' && !claimedTabIds.has(stored)) {
47016
+ claimedTabIds.add(stored);
47017
+ return stored;
47018
+ }
47019
+ // The tab's id is taken by another live connection here: take a distinct, locked id without
47020
+ // touching the tab's stored cursor.
47021
+ let id = fallback;
47022
+ while (claimedTabIds.has(id)) {
47023
+ id = randomId();
47024
+ }
47025
+ const locks = typeof navigator === 'undefined' ? undefined : navigator.locks;
47026
+ if (locks) {
47027
+ yield holdTabId(locks, id);
47028
+ }
47029
+ claimedTabIds.add(id);
47030
+ return id;
47031
+ });
47032
+ }
47033
+ /** Free an id when its connection closes, so a later connection can reuse it (e.g. the stored id). */
47034
+ function releaseTabId(id) {
47035
+ claimedTabIds.delete(id);
47036
+ }
47037
+ /**
47038
+ * The tab's stored id, resolved and locked once per page: the value in sessionStorage when a lock
47039
+ * on it is free (this tab owns it), else a fresh id that is locked and stored. Without Web Locks
47040
+ * (or when locking fails) a copied id cannot be told apart from another tab's, so the page uses a
47041
+ * fresh id and leaves sessionStorage alone. '' when sessionStorage cannot be read, so the caller
47042
+ * falls back to its own id.
47043
+ */
47044
+ function claimStoredTabId(fallback) {
47045
+ storedTabIdClaim !== null && storedTabIdClaim !== void 0 ? storedTabIdClaim : (storedTabIdClaim = (() => __awaiter(this, void 0, void 0, function* () {
47046
+ const locks = typeof navigator === 'undefined' ? undefined : navigator.locks;
47047
+ if (!locks) {
47048
+ return fallback;
47049
+ }
47050
+ let stored;
47051
+ try {
47052
+ stored = window.sessionStorage.getItem(TAB_ID_KEY);
47053
+ }
47054
+ catch (_a) {
47055
+ return '';
47056
+ }
47057
+ if (stored && (yield holdTabId(locks, stored))) {
47058
+ return stored;
47059
+ }
47060
+ if (!(yield holdTabId(locks, fallback))) {
47061
+ return fallback;
47062
+ }
47063
+ try {
47064
+ window.sessionStorage.setItem(TAB_ID_KEY, fallback);
47065
+ }
47066
+ catch (_b) {
47067
+ // Not persisted, but still usable as this page's stored id for this session.
47068
+ }
47069
+ return fallback;
47070
+ }))());
47071
+ return storedTabIdClaim;
47072
+ }
47073
+ function holdTabId(locks, id) {
47074
+ return new Promise((resolve) => {
47075
+ locks
47076
+ .request(`${TAB_ID_KEY}:${id}`, { ifAvailable: true }, (lock) => {
47077
+ resolve(lock !== null);
47078
+ return lock ? new Promise(() => { }) : undefined;
47079
+ })
47080
+ .catch(() => resolve(false));
47081
+ });
47082
+ }
47083
+ /** Base64 to UTF-8 text without `buffer`, which only loads once Push connects. */
47084
+ function decodeBase64(value) {
47085
+ return new TextDecoder().decode(Uint8Array.from(atob(value), (char) => char.charCodeAt(0)));
47086
+ }
46197
47087
  /** A hex id, uuid4-like enough for a client-generated client id suffix. */
46198
47088
  function randomId() {
46199
47089
  let out = '';
@@ -46221,6 +47111,670 @@ function matches(filter, topic) {
46221
47111
  return filterParts.length === topicParts.length;
46222
47112
  }
46223
47113
 
47114
+ /**
47115
+ * Analytics auto-tracking helpers.
47116
+ *
47117
+ * These are hand-written companions to the generated `Analytics` service.
47118
+ * The generated service exposes `createEvent(params)` for arbitrary events;
47119
+ * this module wires up common auto-tracking behaviours (pageviews, outbound
47120
+ * links, downloads, scroll depth, active engagement) on top of it.
47121
+ *
47122
+ * The tracking helpers accept a plain event-emitter function so they do not
47123
+ * hard-couple to the generated `Analytics` class. The emitter adapts this
47124
+ * module's option shape to `createEvent`: `url` is required there, and `props`
47125
+ * is a flat alternating key/value list rather than an object.
47126
+ *
47127
+ * ```ts
47128
+ * const analytics = new Analytics(client);
47129
+ * const tracking = new AnalyticsTracking(
47130
+ * (name, options) => analytics.createEvent({
47131
+ * propertyId: options?.propertyId ?? '<PROPERTY_ID>',
47132
+ * name,
47133
+ * url: options?.url ?? window.location.href,
47134
+ * referrer: options?.referrer,
47135
+ * scrollDepth: options?.scrollDepth,
47136
+ * engagementTime: options?.engagementTime,
47137
+ * props: Object.entries(options?.props ?? {}).flatMap(
47138
+ * ([key, value]) => [key, String(value)],
47139
+ * ),
47140
+ * }),
47141
+ * { propertyId: '<PROPERTY_ID>' }
47142
+ * );
47143
+ * tracking.enableAllAutoTracking();
47144
+ * ```
47145
+ *
47146
+ * `propertyId` is optional: when set it is merged into the options of every
47147
+ * emitted event, so an emitter that forwards `options.propertyId` (as above)
47148
+ * picks it up instead of every caller hand-rolling it into the closure.
47149
+ * Per-event `propertyId` always wins over the configured default.
47150
+ *
47151
+ * All helpers respect `navigator.doNotTrack === '1'` by default; opt out with
47152
+ * `respectDoNotTrack: false` in the constructor options.
47153
+ *
47154
+ * Engagement time follows Plausible's model: rather than one total at unload,
47155
+ * a delta is emitted at every natural checkpoint of the visit (tab hidden, SPA
47156
+ * route change, unload). See `enableAutoEngagementTime` for details.
47157
+ *
47158
+ * Auto-emitted event names follow `snake_case` + lowercase (`pageview`,
47159
+ * `outbound_link`, `file_download`, `screen_view`, etc.). Any prop keys use
47160
+ * camelCase to match the endpoint's parameter naming. Callers can pass any
47161
+ * custom event name; the auto-track methods only own the events they emit
47162
+ * themselves.
47163
+ */
47164
+ const DEFAULT_DOWNLOAD_EXTENSIONS = [
47165
+ 'pdf',
47166
+ 'zip',
47167
+ 'rar',
47168
+ '7z',
47169
+ 'tar',
47170
+ 'gz',
47171
+ 'csv',
47172
+ 'tsv',
47173
+ 'xls',
47174
+ 'xlsx',
47175
+ 'doc',
47176
+ 'docx',
47177
+ 'ppt',
47178
+ 'pptx',
47179
+ 'dmg',
47180
+ 'exe',
47181
+ 'msi',
47182
+ 'pkg',
47183
+ 'deb',
47184
+ 'rpm',
47185
+ 'apk',
47186
+ 'mp3',
47187
+ 'wav',
47188
+ 'flac',
47189
+ 'mp4',
47190
+ 'mov',
47191
+ 'avi',
47192
+ 'mkv',
47193
+ 'webm',
47194
+ ];
47195
+ /**
47196
+ * Two-part public suffixes common enough to matter for outbound-link detection.
47197
+ * See `rootDomain()` for why this is a short list rather than the Public Suffix
47198
+ * List.
47199
+ */
47200
+ const MULTI_PART_SUFFIXES = new Set([
47201
+ 'co.uk',
47202
+ 'org.uk',
47203
+ 'ac.uk',
47204
+ 'gov.uk',
47205
+ 'me.uk',
47206
+ 'net.uk',
47207
+ 'sch.uk',
47208
+ 'co.jp',
47209
+ 'ne.jp',
47210
+ 'or.jp',
47211
+ 'ac.jp',
47212
+ 'go.jp',
47213
+ 'com.au',
47214
+ 'net.au',
47215
+ 'org.au',
47216
+ 'edu.au',
47217
+ 'gov.au',
47218
+ 'com.br',
47219
+ 'net.br',
47220
+ 'org.br',
47221
+ 'com.cn',
47222
+ 'net.cn',
47223
+ 'org.cn',
47224
+ 'gov.cn',
47225
+ 'co.in',
47226
+ 'net.in',
47227
+ 'org.in',
47228
+ 'co.nz',
47229
+ 'net.nz',
47230
+ 'org.nz',
47231
+ 'co.za',
47232
+ 'org.za',
47233
+ 'com.mx',
47234
+ 'com.ar',
47235
+ 'com.co',
47236
+ 'com.pe',
47237
+ 'com.tr',
47238
+ 'com.tw',
47239
+ 'com.sg',
47240
+ 'com.hk',
47241
+ 'com.my',
47242
+ 'com.ph',
47243
+ 'com.vn',
47244
+ 'co.kr',
47245
+ 'co.il',
47246
+ 'co.id',
47247
+ 'co.th',
47248
+ 'com.ua',
47249
+ 'com.pl',
47250
+ 'com.es',
47251
+ ]);
47252
+ const SCROLL_DEPTH_THROTTLE_MS = 200;
47253
+ class AnalyticsTracking {
47254
+ constructor(emit, options = {}) {
47255
+ this.pageviewCleanups = [];
47256
+ this.scrollCleanups = [];
47257
+ this.engagementCleanups = [];
47258
+ this.maxScrollDepth = 0;
47259
+ this.scrollTicking = false;
47260
+ this.lastScrollReport = 0;
47261
+ this.engagementStart = 0;
47262
+ this.engagementAccumulatedMs = 0;
47263
+ this.engagementActive = false;
47264
+ this.emit = emit;
47265
+ this.respectDoNotTrack = options.respectDoNotTrack !== false;
47266
+ this.propertyId = options.propertyId;
47267
+ }
47268
+ /**
47269
+ * Enable the opinionated default auto-tracking set: pageviews, outbound
47270
+ * links, scroll depth and active engagement time. Downloads must be opted
47271
+ * into separately via `enableAutoDownloadTracking()` because the extension
47272
+ * list is application-specific.
47273
+ */
47274
+ enableAllAutoTracking() {
47275
+ this.enableAutoPageviews();
47276
+ this.enableAutoOutboundTracking();
47277
+ this.enableAutoScrollDepth();
47278
+ this.enableAutoEngagementTime();
47279
+ }
47280
+ /**
47281
+ * Track an event manually. Respects the DNT setting and swallows emitter
47282
+ * exceptions so tracking failures never surface to the host page.
47283
+ */
47284
+ track(name, options) {
47285
+ if (!this.canTrack()) {
47286
+ return;
47287
+ }
47288
+ try {
47289
+ this.emit(name, this.withPropertyId(options));
47290
+ }
47291
+ catch (error) {
47292
+ console.warn('AnalyticsTracking: emitter threw', error);
47293
+ }
47294
+ }
47295
+ /**
47296
+ * Convenience wrapper for pageview-shaped events.
47297
+ */
47298
+ pageview(url, referrer) {
47299
+ this.track('pageview', {
47300
+ url: url !== null && url !== void 0 ? url : this.currentPageUrl(),
47301
+ referrer: referrer !== null && referrer !== void 0 ? referrer : (typeof document !== 'undefined'
47302
+ ? document.referrer
47303
+ : undefined),
47304
+ });
47305
+ }
47306
+ /**
47307
+ * Enable SPA-aware pageview tracking. Fires an initial pageview on
47308
+ * enable, then again on every `pushState`, `replaceState`, `popstate`
47309
+ * or hashchange. Idempotent — repeat calls no-op.
47310
+ */
47311
+ enableAutoPageviews() {
47312
+ if (this.pageviewCleanups.length > 0) {
47313
+ return;
47314
+ }
47315
+ if (typeof window === 'undefined' || typeof history === 'undefined') {
47316
+ return;
47317
+ }
47318
+ this.currentPath = this.currentPageUrl();
47319
+ this.pageview();
47320
+ const handleNavigation = () => {
47321
+ const nextPath = this.currentPageUrl();
47322
+ if (nextPath === this.currentPath) {
47323
+ return;
47324
+ }
47325
+ const previous = this.currentPath;
47326
+ this.currentPath = nextPath;
47327
+ this.flushScrollDepth(previous);
47328
+ this.flushEngagement(previous);
47329
+ this.pageview(nextPath);
47330
+ // flushEngagement no longer auto-restarts the timer (see its
47331
+ // implementation note re: bfcache). SPA navigation stays on the
47332
+ // same document, so restart engagement tracking for the new
47333
+ // route as long as the tab is visible.
47334
+ if (this.engagementCleanups.length > 0 &&
47335
+ (typeof document === 'undefined' ||
47336
+ document.visibilityState !== 'hidden')) {
47337
+ this.startEngagement();
47338
+ }
47339
+ };
47340
+ const originalPushState = history.pushState.bind(history);
47341
+ const originalReplaceState = history.replaceState.bind(history);
47342
+ // Our wrappers stay reachable after cleanup whenever another library
47343
+ // patched on top of ours, so they have to be switchable off rather than
47344
+ // merely unreferenced.
47345
+ let patchActive = true;
47346
+ const patchedPushState = (data, unused, url) => {
47347
+ originalPushState(data, unused, url);
47348
+ if (patchActive) {
47349
+ handleNavigation();
47350
+ }
47351
+ };
47352
+ const patchedReplaceState = (data, unused, url) => {
47353
+ originalReplaceState(data, unused, url);
47354
+ if (patchActive) {
47355
+ handleNavigation();
47356
+ }
47357
+ };
47358
+ history.pushState = patchedPushState;
47359
+ history.replaceState = patchedReplaceState;
47360
+ const popstateHandler = () => handleNavigation();
47361
+ const hashchangeHandler = () => handleNavigation();
47362
+ window.addEventListener('popstate', popstateHandler);
47363
+ window.addEventListener('hashchange', hashchangeHandler);
47364
+ this.pageviewCleanups.push(() => {
47365
+ // Only unwind our own patch. A router (Next.js App Router, React
47366
+ // Router, …) that patched these after us owns the current value,
47367
+ // and assigning our saved reference back would silently throw its
47368
+ // wrapper away. In that case ours stays in the chain, which is why
47369
+ // `patchActive` exists: the wrapper keeps delegating to the original
47370
+ // but stops reporting.
47371
+ patchActive = false;
47372
+ if (history.pushState === patchedPushState) {
47373
+ history.pushState = originalPushState;
47374
+ }
47375
+ if (history.replaceState === patchedReplaceState) {
47376
+ history.replaceState = originalReplaceState;
47377
+ }
47378
+ window.removeEventListener('popstate', popstateHandler);
47379
+ window.removeEventListener('hashchange', hashchangeHandler);
47380
+ });
47381
+ }
47382
+ /**
47383
+ * Disable auto-pageview tracking installed by `enableAutoPageviews`.
47384
+ * Safe to call when auto-pageviews were never enabled.
47385
+ */
47386
+ disableAutoPageviews() {
47387
+ for (const cleanup of this.pageviewCleanups) {
47388
+ cleanup();
47389
+ }
47390
+ this.pageviewCleanups = [];
47391
+ }
47392
+ /**
47393
+ * Enable click-based outbound link tracking. Detects anchor clicks that
47394
+ * navigate to a different origin and fires an `outbound_link` event
47395
+ * (with `hostname` and `href` props) before the browser navigates.
47396
+ */
47397
+ enableAutoOutboundTracking(options = {}) {
47398
+ if (this.outboundCleanup) {
47399
+ return;
47400
+ }
47401
+ if (typeof document === 'undefined') {
47402
+ return;
47403
+ }
47404
+ const includeSubdomains = options.includeSubdomains === true;
47405
+ const clickHandler = (event) => {
47406
+ const anchor = this.findAnchor(event.target);
47407
+ if (!anchor || !anchor.href) {
47408
+ return;
47409
+ }
47410
+ const target = this.parseUrl(anchor.href);
47411
+ if (!target || !this.isExternal(target, includeSubdomains)) {
47412
+ return;
47413
+ }
47414
+ this.track('outbound_link', {
47415
+ url: target.href,
47416
+ props: { hostname: target.hostname, href: target.href },
47417
+ });
47418
+ };
47419
+ document.addEventListener('click', clickHandler, { capture: true });
47420
+ this.outboundCleanup = () => document.removeEventListener('click', clickHandler, {
47421
+ capture: true,
47422
+ });
47423
+ }
47424
+ /**
47425
+ * Disable outbound-link tracking installed by `enableAutoOutboundTracking`.
47426
+ * Safe to call when auto-outbound was never enabled.
47427
+ */
47428
+ disableAutoOutboundTracking() {
47429
+ if (this.outboundCleanup) {
47430
+ this.outboundCleanup();
47431
+ this.outboundCleanup = undefined;
47432
+ }
47433
+ }
47434
+ /**
47435
+ * Enable click-based download tracking. Detects anchor clicks that point
47436
+ * at a file whose extension appears in the configured list and fires a
47437
+ * `file_download` event with `filename`, `extension` and `href` props.
47438
+ */
47439
+ enableAutoDownloadTracking(options = {}) {
47440
+ var _a;
47441
+ if (this.downloadCleanup) {
47442
+ return;
47443
+ }
47444
+ if (typeof document === 'undefined') {
47445
+ return;
47446
+ }
47447
+ const extensions = ((_a = options.extensions) !== null && _a !== void 0 ? _a : DEFAULT_DOWNLOAD_EXTENSIONS).map((ext) => ext.toLowerCase().replace(/^\./, ''));
47448
+ const extensionSet = new Set(extensions);
47449
+ const clickHandler = (event) => {
47450
+ var _a, _b;
47451
+ const anchor = this.findAnchor(event.target);
47452
+ if (!anchor || !anchor.href) {
47453
+ return;
47454
+ }
47455
+ const url = this.parseUrl(anchor.href);
47456
+ if (!url) {
47457
+ return;
47458
+ }
47459
+ const filename = (_a = url.pathname.split('/').pop()) !== null && _a !== void 0 ? _a : '';
47460
+ const extension = filename.includes('.')
47461
+ ? (_b = filename.split('.').pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase()
47462
+ : undefined;
47463
+ if (!extension || !extensionSet.has(extension)) {
47464
+ return;
47465
+ }
47466
+ this.track('file_download', {
47467
+ url: url.href,
47468
+ props: { filename, extension, href: url.href },
47469
+ });
47470
+ };
47471
+ document.addEventListener('click', clickHandler, { capture: true });
47472
+ this.downloadCleanup = () => document.removeEventListener('click', clickHandler, {
47473
+ capture: true,
47474
+ });
47475
+ }
47476
+ /**
47477
+ * Disable file-download tracking installed by `enableAutoDownloadTracking`.
47478
+ * Safe to call when auto-download was never enabled.
47479
+ */
47480
+ disableAutoDownloadTracking() {
47481
+ if (this.downloadCleanup) {
47482
+ this.downloadCleanup();
47483
+ this.downloadCleanup = undefined;
47484
+ }
47485
+ }
47486
+ /**
47487
+ * Enable passive scroll-depth tracking. Records the maximum percent of the
47488
+ * document scrolled and reports it on `beforeunload` and on SPA route
47489
+ * changes. Uses a throttled passive listener so it is safe on hot paths.
47490
+ */
47491
+ enableAutoScrollDepth() {
47492
+ if (this.scrollCleanups.length > 0) {
47493
+ return;
47494
+ }
47495
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
47496
+ return;
47497
+ }
47498
+ this.maxScrollDepth = 0;
47499
+ this.lastScrollReport = 0;
47500
+ const scrollHandler = () => {
47501
+ if (this.scrollTicking) {
47502
+ return;
47503
+ }
47504
+ this.scrollTicking = true;
47505
+ window.requestAnimationFrame(() => {
47506
+ const now = Date.now();
47507
+ if (now - this.lastScrollReport < SCROLL_DEPTH_THROTTLE_MS) {
47508
+ this.scrollTicking = false;
47509
+ return;
47510
+ }
47511
+ this.lastScrollReport = now;
47512
+ const depth = this.computeScrollDepth();
47513
+ if (depth > this.maxScrollDepth) {
47514
+ this.maxScrollDepth = depth;
47515
+ }
47516
+ this.scrollTicking = false;
47517
+ });
47518
+ };
47519
+ const unloadHandler = () => {
47520
+ this.flushScrollDepth(this.currentPageUrl());
47521
+ };
47522
+ window.addEventListener('scroll', scrollHandler, { passive: true });
47523
+ window.addEventListener('beforeunload', unloadHandler);
47524
+ window.addEventListener('pagehide', unloadHandler);
47525
+ this.scrollCleanups.push(() => {
47526
+ window.removeEventListener('scroll', scrollHandler);
47527
+ window.removeEventListener('beforeunload', unloadHandler);
47528
+ window.removeEventListener('pagehide', unloadHandler);
47529
+ });
47530
+ }
47531
+ /**
47532
+ * Disable scroll-depth tracking installed by `enableAutoScrollDepth`. Safe
47533
+ * to call when auto-scroll-depth was never enabled. Any accumulated depth
47534
+ * for the current page is dropped.
47535
+ */
47536
+ disableAutoScrollDepth() {
47537
+ for (const cleanup of this.scrollCleanups) {
47538
+ cleanup();
47539
+ }
47540
+ this.scrollCleanups = [];
47541
+ this.maxScrollDepth = 0;
47542
+ this.scrollTicking = false;
47543
+ this.lastScrollReport = 0;
47544
+ }
47545
+ /**
47546
+ * Enable active engagement-time tracking. Counts time the tab is visible
47547
+ * and uses `visibilitychange` to exclude background time.
47548
+ *
47549
+ * Delivery follows Plausible's model rather than a single total at the
47550
+ * end of the visit: an `engagement_time` event is emitted at every natural
47551
+ * checkpoint — the tab going hidden, an SPA route change, and finally
47552
+ * `beforeunload`/`pagehide`. Unload is kept only as a best-effort last
47553
+ * flush; it is the least reliable moment to send anything (browsers
47554
+ * routinely cancel in-flight requests there, and `sendBeacon` cannot set
47555
+ * the `X-Appwrite-Project` header the endpoint requires), so it must never
47556
+ * be the only delivery.
47557
+ *
47558
+ * Each event carries a **delta** — the seconds accrued since the previous
47559
+ * flush, not a running total — so the values are additive per session and
47560
+ * a lost event costs only its own slice.
47561
+ *
47562
+ * There is deliberately no periodic ping. The cadence is driven by
47563
+ * navigation and tab switches, so request volume tracks what the visitor
47564
+ * actually does instead of multiplying with time on page.
47565
+ */
47566
+ enableAutoEngagementTime() {
47567
+ if (this.engagementCleanups.length > 0) {
47568
+ return;
47569
+ }
47570
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
47571
+ return;
47572
+ }
47573
+ this.engagementAccumulatedMs = 0;
47574
+ // Do not start the clock for a tab that is already hidden (prerender,
47575
+ // background tab restore); `visibilitychange` starts it when it is
47576
+ // actually looked at.
47577
+ if (document.visibilityState !== 'hidden') {
47578
+ this.startEngagement();
47579
+ }
47580
+ const visibilityHandler = () => {
47581
+ if (document.visibilityState === 'hidden') {
47582
+ // Flush, don't just pause. The page is still fully alive here,
47583
+ // which makes this the most reliable delivery point in the
47584
+ // whole visit — and it is the same moment Plausible reports on.
47585
+ this.flushEngagement(this.currentPageUrl());
47586
+ }
47587
+ else if (document.visibilityState === 'visible') {
47588
+ this.startEngagement();
47589
+ }
47590
+ };
47591
+ const unloadHandler = () => {
47592
+ this.flushEngagement(this.currentPageUrl());
47593
+ };
47594
+ const pageshowHandler = (event) => {
47595
+ // When the page is restored from the back-forward cache the
47596
+ // engagement timer is in a stopped state (flushEngagement paused
47597
+ // it on pagehide and does not auto-restart). Kick off a fresh
47598
+ // engagementStart so bfcache dwell time is not billed as
47599
+ // engagement.
47600
+ if (event.persisted) {
47601
+ this.startEngagement();
47602
+ }
47603
+ };
47604
+ document.addEventListener('visibilitychange', visibilityHandler);
47605
+ window.addEventListener('beforeunload', unloadHandler);
47606
+ window.addEventListener('pagehide', unloadHandler);
47607
+ window.addEventListener('pageshow', pageshowHandler);
47608
+ this.engagementCleanups.push(() => {
47609
+ document.removeEventListener('visibilitychange', visibilityHandler);
47610
+ window.removeEventListener('beforeunload', unloadHandler);
47611
+ window.removeEventListener('pagehide', unloadHandler);
47612
+ window.removeEventListener('pageshow', pageshowHandler);
47613
+ });
47614
+ }
47615
+ /**
47616
+ * Disable engagement-time tracking installed by `enableAutoEngagementTime`.
47617
+ * Safe to call when auto-engagement was never enabled. Any accumulated
47618
+ * engagement time is dropped without being emitted.
47619
+ */
47620
+ disableAutoEngagementTime() {
47621
+ for (const cleanup of this.engagementCleanups) {
47622
+ cleanup();
47623
+ }
47624
+ this.engagementCleanups = [];
47625
+ this.engagementActive = false;
47626
+ this.engagementAccumulatedMs = 0;
47627
+ this.engagementStart = 0;
47628
+ }
47629
+ /**
47630
+ * Merge the configured `propertyId` into an event's options. Returns the
47631
+ * caller's object untouched when no default is configured (or the event
47632
+ * already carries one), so emitters written against the pre-`propertyId`
47633
+ * shape keep receiving exactly what they received before.
47634
+ */
47635
+ withPropertyId(options) {
47636
+ if (this.propertyId === undefined ||
47637
+ (options === null || options === void 0 ? void 0 : options.propertyId) !== undefined) {
47638
+ return options;
47639
+ }
47640
+ return Object.assign(Object.assign({}, (options !== null && options !== void 0 ? options : {})), { propertyId: this.propertyId });
47641
+ }
47642
+ canTrack() {
47643
+ if (!this.respectDoNotTrack) {
47644
+ return true;
47645
+ }
47646
+ if (typeof navigator === 'undefined') {
47647
+ return true;
47648
+ }
47649
+ return navigator.doNotTrack !== '1';
47650
+ }
47651
+ currentPageUrl() {
47652
+ if (typeof window === 'undefined' || !window.location) {
47653
+ return '';
47654
+ }
47655
+ return window.location.href;
47656
+ }
47657
+ findAnchor(target) {
47658
+ let node = target;
47659
+ while (node) {
47660
+ if (node.tagName === 'A') {
47661
+ return node;
47662
+ }
47663
+ node = node.parentNode;
47664
+ }
47665
+ return null;
47666
+ }
47667
+ parseUrl(href) {
47668
+ try {
47669
+ return new URL(href, window.location.href);
47670
+ }
47671
+ catch (_a) {
47672
+ return null;
47673
+ }
47674
+ }
47675
+ isExternal(target, includeSubdomains) {
47676
+ if (target.protocol !== 'http:' && target.protocol !== 'https:') {
47677
+ return false;
47678
+ }
47679
+ if (target.hostname === window.location.hostname) {
47680
+ return false;
47681
+ }
47682
+ if (includeSubdomains) {
47683
+ return true;
47684
+ }
47685
+ const root = this.rootDomain(window.location.hostname);
47686
+ return this.rootDomain(target.hostname) !== root;
47687
+ }
47688
+ rootDomain(hostname) {
47689
+ const parts = hostname.split('.');
47690
+ if (parts.length <= 2) {
47691
+ return hostname;
47692
+ }
47693
+ // Taking the last two labels is wrong wherever the registry sells names
47694
+ // one level down: `shop.example.co.uk` and `google.co.uk` both reduce to
47695
+ // `co.uk`, so every outbound click between two `.co.uk` sites looks
47696
+ // internal and is dropped. Take three labels after a known two-part
47697
+ // suffix instead.
47698
+ //
47699
+ // This is a heuristic, not the Public Suffix List — the full list is
47700
+ // orders of magnitude larger than this whole file, and a tracking
47701
+ // snippet cannot carry it. Sites on a suffix that is missing here can
47702
+ // pass `includeSubdomains: true` to treat every other host as outbound.
47703
+ const suffix = parts.slice(-2).join('.');
47704
+ if (parts.length > 2 && MULTI_PART_SUFFIXES.has(suffix)) {
47705
+ return parts.slice(-3).join('.');
47706
+ }
47707
+ return suffix;
47708
+ }
47709
+ computeScrollDepth() {
47710
+ const scrollTop = window.scrollY || document.documentElement.scrollTop;
47711
+ const viewport = window.innerHeight || document.documentElement.clientHeight;
47712
+ const total = document.documentElement.scrollHeight;
47713
+ if (total <= viewport) {
47714
+ return 100;
47715
+ }
47716
+ const depth = Math.round(((scrollTop + viewport) / total) * 100);
47717
+ return Math.max(0, Math.min(100, depth));
47718
+ }
47719
+ flushScrollDepth(url) {
47720
+ if (this.scrollCleanups.length === 0) {
47721
+ return;
47722
+ }
47723
+ if (this.maxScrollDepth <= 0) {
47724
+ return;
47725
+ }
47726
+ this.track('scroll_depth', {
47727
+ url,
47728
+ scrollDepth: this.maxScrollDepth,
47729
+ });
47730
+ this.maxScrollDepth = 0;
47731
+ }
47732
+ startEngagement() {
47733
+ if (this.engagementActive) {
47734
+ return;
47735
+ }
47736
+ this.engagementActive = true;
47737
+ this.engagementStart = Date.now();
47738
+ }
47739
+ pauseEngagement() {
47740
+ if (!this.engagementActive) {
47741
+ return;
47742
+ }
47743
+ this.engagementActive = false;
47744
+ this.engagementAccumulatedMs += Date.now() - this.engagementStart;
47745
+ }
47746
+ flushEngagement(url) {
47747
+ if (this.engagementCleanups.length === 0) {
47748
+ return;
47749
+ }
47750
+ this.pauseEngagement();
47751
+ // Deltas, not a running total: emit only what accrued since the last
47752
+ // flush. `floor` plus keeping the sub-second remainder in the
47753
+ // accumulator is what makes repeated flushes safe — nothing is emitted
47754
+ // twice, and a visit chopped into many short segments does not lose a
47755
+ // fraction of a second to rounding on every one of them.
47756
+ const seconds = Math.floor(this.engagementAccumulatedMs / 1000);
47757
+ if (seconds > 0) {
47758
+ // Deduct before emitting so a synchronous emitter that re-enters
47759
+ // (or throws) can never bill the same seconds again.
47760
+ this.engagementAccumulatedMs -= seconds * 1000;
47761
+ this.track('engagement_time', {
47762
+ url,
47763
+ engagementTime: seconds,
47764
+ });
47765
+ }
47766
+ // NOTE: intentionally do NOT call startEngagement() here. flushEngagement
47767
+ // runs on `pagehide`, which is also the last hook before the browser
47768
+ // may freeze the page into the back-forward cache. Auto-restarting
47769
+ // would snapshot engagementStart just before the freeze; the next
47770
+ // pauseEngagement (after bfcache restore) would then bill the entire
47771
+ // bfcache dwell as active engagement. Restart is driven by explicit
47772
+ // resume signals: `pageshow` (with `persisted === true`),
47773
+ // `visibilitychange` back to visible, or the SPA navigation flow in
47774
+ // `enableAutoPageviews`.
47775
+ }
47776
+ }
47777
+
46224
47778
  /**
46225
47779
  * Helper class to generate permission strings for resources.
46226
47780
  */
@@ -46917,6 +48471,7 @@ var OAuthProvider;
46917
48471
  OAuthProvider["Tradeshift"] = "tradeshift";
46918
48472
  OAuthProvider["TradeshiftBox"] = "tradeshiftBox";
46919
48473
  OAuthProvider["Twitch"] = "twitch";
48474
+ OAuthProvider["Webflow"] = "webflow";
46920
48475
  OAuthProvider["Wordpress"] = "wordpress";
46921
48476
  OAuthProvider["X"] = "x";
46922
48477
  OAuthProvider["Yahoo"] = "yahoo";
@@ -46926,6 +48481,40 @@ var OAuthProvider;
46926
48481
  OAuthProvider["Zoom"] = "zoom";
46927
48482
  })(OAuthProvider || (OAuthProvider = {}));
46928
48483
 
48484
+ var AnalyticsInterval;
48485
+ (function (AnalyticsInterval) {
48486
+ AnalyticsInterval["OneHour"] = "1h";
48487
+ AnalyticsInterval["OneDay"] = "1d";
48488
+ AnalyticsInterval["OneWeek"] = "1w";
48489
+ AnalyticsInterval["OneMonth"] = "1m";
48490
+ })(AnalyticsInterval || (AnalyticsInterval = {}));
48491
+
48492
+ var AnalyticsDimension;
48493
+ (function (AnalyticsDimension) {
48494
+ AnalyticsDimension["Country"] = "country";
48495
+ AnalyticsDimension["Region"] = "region";
48496
+ AnalyticsDimension["City"] = "city";
48497
+ AnalyticsDimension["Browser"] = "browser";
48498
+ AnalyticsDimension["OperatingSystem"] = "operatingSystem";
48499
+ AnalyticsDimension["Device"] = "device";
48500
+ AnalyticsDimension["ScreenSize"] = "screenSize";
48501
+ AnalyticsDimension["ReferrerSource"] = "referrerSource";
48502
+ AnalyticsDimension["Channel"] = "channel";
48503
+ AnalyticsDimension["UtmSource"] = "utmSource";
48504
+ AnalyticsDimension["UtmMedium"] = "utmMedium";
48505
+ AnalyticsDimension["UtmCampaign"] = "utmCampaign";
48506
+ AnalyticsDimension["UtmContent"] = "utmContent";
48507
+ AnalyticsDimension["UtmTerm"] = "utmTerm";
48508
+ AnalyticsDimension["Page"] = "page";
48509
+ AnalyticsDimension["Hostname"] = "hostname";
48510
+ AnalyticsDimension["EntryPage"] = "entryPage";
48511
+ AnalyticsDimension["ExitPage"] = "exitPage";
48512
+ AnalyticsDimension["TrafficType"] = "trafficType";
48513
+ AnalyticsDimension["BotName"] = "botName";
48514
+ AnalyticsDimension["BotCategory"] = "botCategory";
48515
+ AnalyticsDimension["EventName"] = "eventName";
48516
+ })(AnalyticsDimension || (AnalyticsDimension = {}));
48517
+
46929
48518
  var Browser;
46930
48519
  (function (Browser) {
46931
48520
  Browser["AvantBrowser"] = "aa";
@@ -47741,6 +49330,7 @@ var QuerySuggestionResource;
47741
49330
  QuerySuggestionResource["ResourceTokens"] = "resourcetokens";
47742
49331
  QuerySuggestionResource["Transactions"] = "transactions";
47743
49332
  QuerySuggestionResource["TransactionLogs"] = "transactionlogs";
49333
+ QuerySuggestionResource["AnalyticsProperties"] = "analyticsproperties";
47744
49334
  QuerySuggestionResource["DedicatedDatabases"] = "dedicateddatabases";
47745
49335
  QuerySuggestionResource["DedicatedDatabaseConfigs"] = "dedicateddatabaseconfigs";
47746
49336
  QuerySuggestionResource["DedicatedDatabaseRuntimes"] = "dedicateddatabaseruntimes";
@@ -47988,6 +49578,9 @@ var Runtime;
47988
49578
  Runtime["Pythonml311"] = "python-ml-3.11";
47989
49579
  Runtime["Pythonml312"] = "python-ml-3.12";
47990
49580
  Runtime["Pythonml313"] = "python-ml-3.13";
49581
+ Runtime["Deno121"] = "deno-1.21";
49582
+ Runtime["Deno124"] = "deno-1.24";
49583
+ Runtime["Deno135"] = "deno-1.35";
47991
49584
  Runtime["Deno140"] = "deno-1.40";
47992
49585
  Runtime["Deno146"] = "deno-1.46";
47993
49586
  Runtime["Deno20"] = "deno-2.0";
@@ -48145,6 +49738,7 @@ var ProjectKeyScopes;
48145
49738
  ProjectKeyScopes["WebhooksWrite"] = "webhooks.write";
48146
49739
  ProjectKeyScopes["LocaleRead"] = "locale.read";
48147
49740
  ProjectKeyScopes["AvatarsRead"] = "avatars.read";
49741
+ ProjectKeyScopes["AvatarsWrite"] = "avatars.write";
48148
49742
  ProjectKeyScopes["HealthRead"] = "health.read";
48149
49743
  ProjectKeyScopes["AssistantRead"] = "assistant.read";
48150
49744
  ProjectKeyScopes["MigrationsRead"] = "migrations.read";
@@ -48177,6 +49771,8 @@ var ProjectKeyScopes;
48177
49771
  ProjectKeyScopes["Oauth2Read"] = "oauth2.read";
48178
49772
  ProjectKeyScopes["Oauth2Write"] = "oauth2.write";
48179
49773
  ProjectKeyScopes["Oauth2Introspect"] = "oauth2.introspect";
49774
+ ProjectKeyScopes["AnalyticsRead"] = "analytics.read";
49775
+ ProjectKeyScopes["AnalyticsWrite"] = "analytics.write";
48180
49776
  })(ProjectKeyScopes || (ProjectKeyScopes = {}));
48181
49777
 
48182
49778
  var FunctionTemplateUseCase;
@@ -48539,6 +50135,7 @@ var ProjectOAuthProviderId;
48539
50135
  ProjectOAuthProviderId["Tradeshift"] = "tradeshift";
48540
50136
  ProjectOAuthProviderId["TradeshiftBox"] = "tradeshiftBox";
48541
50137
  ProjectOAuthProviderId["Twitch"] = "twitch";
50138
+ ProjectOAuthProviderId["Webflow"] = "webflow";
48542
50139
  ProjectOAuthProviderId["Wordpress"] = "wordpress";
48543
50140
  ProjectOAuthProviderId["X"] = "x";
48544
50141
  ProjectOAuthProviderId["Yahoo"] = "yahoo";
@@ -48692,6 +50289,9 @@ var BuildRuntime;
48692
50289
  BuildRuntime["Pythonml311"] = "python-ml-3.11";
48693
50290
  BuildRuntime["Pythonml312"] = "python-ml-3.12";
48694
50291
  BuildRuntime["Pythonml313"] = "python-ml-3.13";
50292
+ BuildRuntime["Deno121"] = "deno-1.21";
50293
+ BuildRuntime["Deno124"] = "deno-1.24";
50294
+ BuildRuntime["Deno135"] = "deno-1.35";
48695
50295
  BuildRuntime["Deno140"] = "deno-1.40";
48696
50296
  BuildRuntime["Deno146"] = "deno-1.46";
48697
50297
  BuildRuntime["Deno20"] = "deno-2.0";
@@ -48807,6 +50407,9 @@ var TablesDBIndexType;
48807
50407
 
48808
50408
  var UsageEventMetric;
48809
50409
  (function (UsageEventMetric) {
50410
+ UsageEventMetric["AnalyticsEvents"] = "analytics.events";
50411
+ UsageEventMetric["AnalyticsPageviews"] = "analytics.pageviews";
50412
+ UsageEventMetric["AnalyticsBotsEvents"] = "analytics.bots.events";
48810
50413
  UsageEventMetric["NetworkRequests"] = "network.requests";
48811
50414
  UsageEventMetric["NetworkInbound"] = "network.inbound";
48812
50415
  UsageEventMetric["NetworkOutbound"] = "network.outbound";
@@ -48814,6 +50417,7 @@ var UsageEventMetric;
48814
50417
  UsageEventMetric["WebhooksEventsFailed"] = "webhooks.events.failed";
48815
50418
  UsageEventMetric["AuthMethodPhone"] = "auth.method.phone";
48816
50419
  UsageEventMetric["MessagesSent"] = "messages.sent";
50420
+ UsageEventMetric["MessagesFailed"] = "messages.failed";
48817
50421
  UsageEventMetric["MessagesSmsSent"] = "messages.sms.sent";
48818
50422
  UsageEventMetric["Executions"] = "executions";
48819
50423
  UsageEventMetric["ExecutionsCompute"] = "executions.compute";
@@ -48892,6 +50496,15 @@ var UsageEventDimension;
48892
50496
  UsageEventDimension["SdkVersion"] = "sdkVersion";
48893
50497
  UsageEventDimension["TeamId"] = "teamId";
48894
50498
  UsageEventDimension["ResourceId"] = "resourceId";
50499
+ UsageEventDimension["Protocol"] = "protocol";
50500
+ UsageEventDimension["QueryKeys"] = "queryKeys";
50501
+ UsageEventDimension["Accept"] = "accept";
50502
+ UsageEventDimension["AcceptLanguage"] = "acceptLanguage";
50503
+ UsageEventDimension["PostalCode"] = "postalCode";
50504
+ UsageEventDimension["Latitude"] = "latitude";
50505
+ UsageEventDimension["Longitude"] = "longitude";
50506
+ UsageEventDimension["TimeZone"] = "timeZone";
50507
+ UsageEventDimension["WeatherCode"] = "weatherCode";
48895
50508
  UsageEventDimension["Isp"] = "isp";
48896
50509
  UsageEventDimension["AutonomousSystemNumber"] = "autonomousSystemNumber";
48897
50510
  UsageEventDimension["AutonomousSystemOrganization"] = "autonomousSystemOrganization";
@@ -48914,6 +50527,7 @@ var UsageOrderDirection;
48914
50527
 
48915
50528
  var UsageGaugeMetric;
48916
50529
  (function (UsageGaugeMetric) {
50530
+ UsageGaugeMetric["AnalyticsProperties"] = "analytics.properties";
48917
50531
  UsageGaugeMetric["Teams"] = "teams";
48918
50532
  UsageGaugeMetric["Users"] = "users";
48919
50533
  UsageGaugeMetric["Messages"] = "messages";
@@ -49189,6 +50803,7 @@ var ProxyRuleDeploymentResourceType;
49189
50803
  (function (ProxyRuleDeploymentResourceType) {
49190
50804
  ProxyRuleDeploymentResourceType["Function"] = "function";
49191
50805
  ProxyRuleDeploymentResourceType["Site"] = "site";
50806
+ ProxyRuleDeploymentResourceType["DedicatedDatabase"] = "dedicatedDatabase";
49192
50807
  })(ProxyRuleDeploymentResourceType || (ProxyRuleDeploymentResourceType = {}));
49193
50808
 
49194
50809
  var ProxyRuleStatus;
@@ -49244,5 +50859,5 @@ var WafRuleAction;
49244
50859
  WafRuleAction["Redirect"] = "redirect";
49245
50860
  })(WafRuleAction || (WafRuleAction = {}));
49246
50861
 
49247
- export { Account, AccountKeyScopes, Activities, Adapter, AddonKey, Advisor, Affiliates, Apps, AppwriteException, AppwriteMigrationResource, Assistant, AttributeStatus, AuthenticationFactor, AuthenticatorType, Avatars, BackupServices, Backups, BillingPlanGroup, BlockMode, BlockResourceType, Browser, BrowserPermission, BrowserTheme, BuildRuntime, CacheDatabase, CacheTarget, Channel, Client, ColumnStatus, Compression, Condition, Console, ConsoleResourceType, ConversationType, CreditCard, DatabaseStatus, DatabaseType, Databases, DatabasesIndexType, DeploymentDownloadType, DeploymentStatus, DetectionFrameworkType, DetectionRuntimeType, DocumentsDB, DocumentsDBIndexType, DomainPurchaseStatus, DomainRegistrationType, DomainSuggestionType, DomainTransferStatusEnum, Domains, EmbeddingModel, Embeddings, ExecutionMethod, ExecutionResourceType, ExecutionStatus, ExecutionTrigger, FirebaseMigrationResource, Flag, Framework, FunctionTemplateUseCase, Functions, Graphql, Growth, ID, IdTokenProvider, ImageFormat, ImageGravity, IndexStatus, InvalidationType, Locale, Manager, MessagePriority, MessageStatus, Messaging, MessagingProviderType, Migrations, Mongo, Mysql, NHostMigrationResource, Notifications, OAuth2Auth0Prompt, OAuth2DiscordPrompt, OAuth2GithubPrompt, OAuth2GooglePrompt, OAuth2KakaoPrompt, OAuth2MicrosoftPrompt, OAuth2OidcPrompt, OAuth2OktaPrompt, OAuth2SalesforcePrompt, OAuth2ZohoPrompt, OAuthProvider, Oauth2, OnDuplicate, Operator, OrderBy, Organization, OrganizationKeyScopes, Organizations, PasswordHash, Permission, Platform, PlatformType, Postgresql, Presences, Project, ProjectAuthMethodId, ProjectEmailTemplateId, ProjectEmailTemplateLocale, ProjectKeyScopes, ProjectOAuth2Auth0Prompt, ProjectOAuth2DiscordPrompt, ProjectOAuth2GitHubPrompt, ProjectOAuth2GooglePrompt, ProjectOAuth2KakaoPrompt, ProjectOAuth2MicrosoftPrompt, ProjectOAuth2OidcPrompt, ProjectOAuth2OktaPrompt, ProjectOAuth2SalesforcePrompt, ProjectOAuth2ZohoPrompt, ProjectOAuthProviderId, ProjectPolicyId, ProjectProtocolId, ProjectSMTPSecure, ProjectServiceId, Projects, Proxy, ProxyResourceType, ProxyRuleDeploymentResourceType, ProxyRuleStatus, Push, Query, QuerySuggestionResource, Realtime, Region, RelationMutate, RelationshipType, ResolvedTopic, Role, Runtime, ScheduleResourceType, SiteTemplateUseCase, Sites, SmtpEncryption, Status, StatusCode, Storage, SupabaseMigrationResource, TablesDB, TablesDBIndexType, Teams, TemplateReferenceType, Timezone, Tokens, Topic, Usage, UsageEventDimension, UsageEventMetric, UsageGaugeDimension, UsageGaugeMetric, UsageInterval, UsageOrderBy, UsageOrderDirection, UsageRange, Users, VCSDetectionType, VCSReferenceType, Vcs, VectorsDB, VectorsDBIndexType, Waf, WafRuleAction, Webhooks };
50862
+ export { Account, AccountKeyScopes, Activities, Adapter, AddonKey, Advisor, Affiliates, Analytics, AnalyticsDimension, AnalyticsInterval, AnalyticsTracking, Apps, AppwriteException, AppwriteMigrationResource, Assistant, AttributeStatus, AuthenticationFactor, AuthenticatorType, Avatars, BackupServices, Backups, BillingPlanGroup, BlockMode, BlockResourceType, Browser, BrowserPermission, BrowserTheme, BuildRuntime, CacheDatabase, CacheTarget, Channel, Client, ColumnStatus, Compression, Condition, Console, ConsoleResourceType, ConversationType, CreditCard, DatabaseStatus, DatabaseType, Databases, DatabasesIndexType, DeploymentDownloadType, DeploymentStatus, DetectionFrameworkType, DetectionRuntimeType, DocumentsDB, DocumentsDBIndexType, DomainPurchaseStatus, DomainRegistrationType, DomainSuggestionType, DomainTransferStatusEnum, Domains, EmbeddingModel, Embeddings, ExecutionMethod, ExecutionResourceType, ExecutionStatus, ExecutionTrigger, FirebaseMigrationResource, Flag, Framework, FunctionTemplateUseCase, Functions, Graphql, Growth, ID, IdTokenProvider, ImageFormat, ImageGravity, IndexStatus, InvalidationType, Locale, Manager, MessagePriority, MessageStatus, Messaging, MessagingProviderType, Migrations, Mongo, Mysql, NHostMigrationResource, Notifications, OAuth2Auth0Prompt, OAuth2DiscordPrompt, OAuth2GithubPrompt, OAuth2GooglePrompt, OAuth2KakaoPrompt, OAuth2MicrosoftPrompt, OAuth2OidcPrompt, OAuth2OktaPrompt, OAuth2SalesforcePrompt, OAuth2ZohoPrompt, OAuthProvider, Oauth2, OnDuplicate, Operator, OrderBy, Organization, OrganizationKeyScopes, Organizations, PasswordHash, Permission, Platform, PlatformType, Postgresql, Presences, Project, ProjectAuthMethodId, ProjectEmailTemplateId, ProjectEmailTemplateLocale, ProjectKeyScopes, ProjectOAuth2Auth0Prompt, ProjectOAuth2DiscordPrompt, ProjectOAuth2GitHubPrompt, ProjectOAuth2GooglePrompt, ProjectOAuth2KakaoPrompt, ProjectOAuth2MicrosoftPrompt, ProjectOAuth2OidcPrompt, ProjectOAuth2OktaPrompt, ProjectOAuth2SalesforcePrompt, ProjectOAuth2ZohoPrompt, ProjectOAuthProviderId, ProjectPolicyId, ProjectProtocolId, ProjectSMTPSecure, ProjectServiceId, Projects, Proxy, ProxyResourceType, ProxyRuleDeploymentResourceType, ProxyRuleStatus, Push, Query, QuerySuggestionResource, Realtime, Region, RelationMutate, RelationshipType, ResolvedTopic, Role, Runtime, ScheduleResourceType, SiteTemplateUseCase, Sites, SmtpEncryption, Status, StatusCode, Storage, SupabaseMigrationResource, TablesDB, TablesDBIndexType, Teams, TemplateReferenceType, Timezone, Tokens, Topic, Usage, UsageEventDimension, UsageEventMetric, UsageGaugeDimension, UsageGaugeMetric, UsageInterval, UsageOrderBy, UsageOrderDirection, UsageRange, Users, VCSDetectionType, VCSReferenceType, Vcs, VectorsDB, VectorsDBIndexType, Waf, WafRuleAction, Webhooks };
49248
50863
  //# sourceMappingURL=sdk.js.map