@appwrite.io/console 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/sdk.js CHANGED
@@ -243,12 +243,34 @@ Query.limit = (limit) => new Query("limit", undefined, limit).toString();
243
243
  Query.offset = (offset) => new Query("offset", undefined, offset).toString();
244
244
  /**
245
245
  * Filter resources where attribute contains the specified value.
246
+ * For string attributes, checks if the string contains the substring.
246
247
  *
248
+ * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead.
247
249
  * @param {string} attribute
248
250
  * @param {string | string[]} value
249
251
  * @returns {string}
250
252
  */
251
253
  Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
254
+ /**
255
+ * Filter resources where attribute contains ANY of the specified values.
256
+ * For array and relationship attributes, matches documents where the attribute
257
+ * contains at least one of the given values.
258
+ *
259
+ * @param {string} attribute
260
+ * @param {any[]} value
261
+ * @returns {string}
262
+ */
263
+ Query.containsAny = (attribute, value) => new Query("containsAny", attribute, value).toString();
264
+ /**
265
+ * Filter resources where attribute contains ALL of the specified values.
266
+ * For array and relationship attributes, matches documents where the attribute
267
+ * contains every one of the given values.
268
+ *
269
+ * @param {string} attribute
270
+ * @param {any[]} value
271
+ * @returns {string}
272
+ */
273
+ Query.containsAll = (attribute, value) => new Query("containsAll", attribute, value).toString();
252
274
  /**
253
275
  * Filter resources where attribute does not contain the specified value.
254
276
  *
@@ -466,6 +488,8 @@ const JSONbigParser = JSONbigModule({ storeAsString: false });
466
488
  const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
467
489
  const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
468
490
  const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
491
+ const MAX_INT64 = BigInt('9223372036854775807');
492
+ const MIN_INT64 = BigInt('-9223372036854775808');
469
493
  function isBigNumber(value) {
470
494
  return value !== null
471
495
  && typeof value === 'object'
@@ -482,7 +506,10 @@ function reviver(_key, value) {
482
506
  if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
483
507
  return Number(str);
484
508
  }
485
- return bi;
509
+ if (bi >= MIN_INT64 && bi <= MAX_INT64) {
510
+ return bi;
511
+ }
512
+ return value.toNumber();
486
513
  }
487
514
  return value.toNumber();
488
515
  }
@@ -541,7 +568,7 @@ class Client {
541
568
  'x-sdk-name': 'Console',
542
569
  'x-sdk-platform': 'console',
543
570
  'x-sdk-language': 'web',
544
- 'x-sdk-version': '3.0.0',
571
+ 'x-sdk-version': '3.1.0',
545
572
  'X-Appwrite-Response-Format': '1.8.0',
546
573
  };
547
574
  this.realtime = {
@@ -7730,6 +7757,102 @@ class Domains {
7730
7757
  const apiHeaders = {};
7731
7758
  return this.client.call('get', uri, apiHeaders, payload);
7732
7759
  }
7760
+ createPurchase(paramsOrFirst, ...rest) {
7761
+ let params;
7762
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7763
+ params = (paramsOrFirst || {});
7764
+ }
7765
+ else {
7766
+ params = {
7767
+ domain: paramsOrFirst,
7768
+ teamId: rest[0],
7769
+ firstName: rest[1],
7770
+ lastName: rest[2],
7771
+ email: rest[3],
7772
+ phone: rest[4],
7773
+ billingAddressId: rest[5],
7774
+ paymentMethodId: rest[6],
7775
+ addressLine3: rest[7],
7776
+ companyName: rest[8],
7777
+ periodYears: rest[9]
7778
+ };
7779
+ }
7780
+ const domain = params.domain;
7781
+ const teamId = params.teamId;
7782
+ const firstName = params.firstName;
7783
+ const lastName = params.lastName;
7784
+ const email = params.email;
7785
+ const phone = params.phone;
7786
+ const billingAddressId = params.billingAddressId;
7787
+ const paymentMethodId = params.paymentMethodId;
7788
+ const addressLine3 = params.addressLine3;
7789
+ const companyName = params.companyName;
7790
+ const periodYears = params.periodYears;
7791
+ if (typeof domain === 'undefined') {
7792
+ throw new AppwriteException('Missing required parameter: "domain"');
7793
+ }
7794
+ if (typeof teamId === 'undefined') {
7795
+ throw new AppwriteException('Missing required parameter: "teamId"');
7796
+ }
7797
+ if (typeof firstName === 'undefined') {
7798
+ throw new AppwriteException('Missing required parameter: "firstName"');
7799
+ }
7800
+ if (typeof lastName === 'undefined') {
7801
+ throw new AppwriteException('Missing required parameter: "lastName"');
7802
+ }
7803
+ if (typeof email === 'undefined') {
7804
+ throw new AppwriteException('Missing required parameter: "email"');
7805
+ }
7806
+ if (typeof phone === 'undefined') {
7807
+ throw new AppwriteException('Missing required parameter: "phone"');
7808
+ }
7809
+ if (typeof billingAddressId === 'undefined') {
7810
+ throw new AppwriteException('Missing required parameter: "billingAddressId"');
7811
+ }
7812
+ if (typeof paymentMethodId === 'undefined') {
7813
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
7814
+ }
7815
+ const apiPath = '/domains/purchases';
7816
+ const payload = {};
7817
+ if (typeof domain !== 'undefined') {
7818
+ payload['domain'] = domain;
7819
+ }
7820
+ if (typeof teamId !== 'undefined') {
7821
+ payload['teamId'] = teamId;
7822
+ }
7823
+ if (typeof firstName !== 'undefined') {
7824
+ payload['firstName'] = firstName;
7825
+ }
7826
+ if (typeof lastName !== 'undefined') {
7827
+ payload['lastName'] = lastName;
7828
+ }
7829
+ if (typeof email !== 'undefined') {
7830
+ payload['email'] = email;
7831
+ }
7832
+ if (typeof phone !== 'undefined') {
7833
+ payload['phone'] = phone;
7834
+ }
7835
+ if (typeof billingAddressId !== 'undefined') {
7836
+ payload['billingAddressId'] = billingAddressId;
7837
+ }
7838
+ if (typeof addressLine3 !== 'undefined') {
7839
+ payload['addressLine3'] = addressLine3;
7840
+ }
7841
+ if (typeof companyName !== 'undefined') {
7842
+ payload['companyName'] = companyName;
7843
+ }
7844
+ if (typeof periodYears !== 'undefined') {
7845
+ payload['periodYears'] = periodYears;
7846
+ }
7847
+ if (typeof paymentMethodId !== 'undefined') {
7848
+ payload['paymentMethodId'] = paymentMethodId;
7849
+ }
7850
+ const uri = new URL(this.client.config.endpoint + apiPath);
7851
+ const apiHeaders = {
7852
+ 'content-type': 'application/json',
7853
+ };
7854
+ return this.client.call('post', uri, apiHeaders, payload);
7855
+ }
7733
7856
  listSuggestions(paramsOrFirst, ...rest) {
7734
7857
  let params;
7735
7858
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -15836,22 +15959,27 @@ class Organizations {
15836
15959
  const apiHeaders = {};
15837
15960
  return this.client.call('get', uri, apiHeaders, payload);
15838
15961
  }
15839
- getScopes(paramsOrFirst) {
15962
+ getScopes(paramsOrFirst, ...rest) {
15840
15963
  let params;
15841
15964
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
15842
15965
  params = (paramsOrFirst || {});
15843
15966
  }
15844
15967
  else {
15845
15968
  params = {
15846
- organizationId: paramsOrFirst
15969
+ organizationId: paramsOrFirst,
15970
+ projectId: rest[0]
15847
15971
  };
15848
15972
  }
15849
15973
  const organizationId = params.organizationId;
15974
+ const projectId = params.projectId;
15850
15975
  if (typeof organizationId === 'undefined') {
15851
15976
  throw new AppwriteException('Missing required parameter: "organizationId"');
15852
15977
  }
15853
15978
  const apiPath = '/organizations/{organizationId}/roles'.replace('{organizationId}', organizationId);
15854
15979
  const payload = {};
15980
+ if (typeof projectId !== 'undefined') {
15981
+ payload['projectId'] = projectId;
15982
+ }
15855
15983
  const uri = new URL(this.client.config.endpoint + apiPath);
15856
15984
  const apiHeaders = {};
15857
15985
  return this.client.call('get', uri, apiHeaders, payload);