@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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/cjs/sdk.js +132 -4
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +132 -4
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +132 -4
- package/docs/examples/domains/create-purchase.md +25 -0
- package/docs/examples/organizations/get-scopes.md +2 -1
- package/package.json +1 -1
- package/src/client.ts +7 -2
- package/src/models.ts +5 -1
- package/src/query.ts +26 -0
- package/src/services/domains.ts +147 -0
- package/src/services/organizations.ts +14 -6
- package/types/models.d.ts +5 -1
- package/types/query.d.ts +22 -0
- package/types/services/domains.d.ts +49 -0
- package/types/services/organizations.d.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
* Add support for `createPurchase` method in `Domains` service
|
|
6
|
+
* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals
|
|
7
|
+
|
|
3
8
|
## 3.0.0
|
|
4
9
|
|
|
5
10
|
* Breaking: EmailTemplateType enum values renamed and updated (Magicsession -> MagicSession, Mfachallenge -> MfaChallenge, Sessionalert -> SessionAlert, Otpsession -> OtpSession) and their underlying string values changed accordingly, which may affect existing integrations.
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
|
|
|
33
33
|
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@3.
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@3.1.0"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -249,12 +249,34 @@ Query.limit = (limit) => new Query("limit", undefined, limit).toString();
|
|
|
249
249
|
Query.offset = (offset) => new Query("offset", undefined, offset).toString();
|
|
250
250
|
/**
|
|
251
251
|
* Filter resources where attribute contains the specified value.
|
|
252
|
+
* For string attributes, checks if the string contains the substring.
|
|
252
253
|
*
|
|
254
|
+
* Note: For array attributes, use {@link containsAny} or {@link containsAll} instead.
|
|
253
255
|
* @param {string} attribute
|
|
254
256
|
* @param {string | string[]} value
|
|
255
257
|
* @returns {string}
|
|
256
258
|
*/
|
|
257
259
|
Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
|
|
260
|
+
/**
|
|
261
|
+
* Filter resources where attribute contains ANY of the specified values.
|
|
262
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
263
|
+
* contains at least one of the given values.
|
|
264
|
+
*
|
|
265
|
+
* @param {string} attribute
|
|
266
|
+
* @param {any[]} value
|
|
267
|
+
* @returns {string}
|
|
268
|
+
*/
|
|
269
|
+
Query.containsAny = (attribute, value) => new Query("containsAny", attribute, value).toString();
|
|
270
|
+
/**
|
|
271
|
+
* Filter resources where attribute contains ALL of the specified values.
|
|
272
|
+
* For array and relationship attributes, matches documents where the attribute
|
|
273
|
+
* contains every one of the given values.
|
|
274
|
+
*
|
|
275
|
+
* @param {string} attribute
|
|
276
|
+
* @param {any[]} value
|
|
277
|
+
* @returns {string}
|
|
278
|
+
*/
|
|
279
|
+
Query.containsAll = (attribute, value) => new Query("containsAll", attribute, value).toString();
|
|
258
280
|
/**
|
|
259
281
|
* Filter resources where attribute does not contain the specified value.
|
|
260
282
|
*
|
|
@@ -472,6 +494,8 @@ const JSONbigParser = JSONbigModule__default["default"]({ storeAsString: false }
|
|
|
472
494
|
const JSONbigSerializer = JSONbigModule__default["default"]({ useNativeBigInt: true });
|
|
473
495
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
474
496
|
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
497
|
+
const MAX_INT64 = BigInt('9223372036854775807');
|
|
498
|
+
const MIN_INT64 = BigInt('-9223372036854775808');
|
|
475
499
|
function isBigNumber(value) {
|
|
476
500
|
return value !== null
|
|
477
501
|
&& typeof value === 'object'
|
|
@@ -488,7 +512,10 @@ function reviver(_key, value) {
|
|
|
488
512
|
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
489
513
|
return Number(str);
|
|
490
514
|
}
|
|
491
|
-
|
|
515
|
+
if (bi >= MIN_INT64 && bi <= MAX_INT64) {
|
|
516
|
+
return bi;
|
|
517
|
+
}
|
|
518
|
+
return value.toNumber();
|
|
492
519
|
}
|
|
493
520
|
return value.toNumber();
|
|
494
521
|
}
|
|
@@ -547,7 +574,7 @@ class Client {
|
|
|
547
574
|
'x-sdk-name': 'Console',
|
|
548
575
|
'x-sdk-platform': 'console',
|
|
549
576
|
'x-sdk-language': 'web',
|
|
550
|
-
'x-sdk-version': '3.
|
|
577
|
+
'x-sdk-version': '3.1.0',
|
|
551
578
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
552
579
|
};
|
|
553
580
|
this.realtime = {
|
|
@@ -7736,6 +7763,102 @@ class Domains {
|
|
|
7736
7763
|
const apiHeaders = {};
|
|
7737
7764
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
7738
7765
|
}
|
|
7766
|
+
createPurchase(paramsOrFirst, ...rest) {
|
|
7767
|
+
let params;
|
|
7768
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
7769
|
+
params = (paramsOrFirst || {});
|
|
7770
|
+
}
|
|
7771
|
+
else {
|
|
7772
|
+
params = {
|
|
7773
|
+
domain: paramsOrFirst,
|
|
7774
|
+
teamId: rest[0],
|
|
7775
|
+
firstName: rest[1],
|
|
7776
|
+
lastName: rest[2],
|
|
7777
|
+
email: rest[3],
|
|
7778
|
+
phone: rest[4],
|
|
7779
|
+
billingAddressId: rest[5],
|
|
7780
|
+
paymentMethodId: rest[6],
|
|
7781
|
+
addressLine3: rest[7],
|
|
7782
|
+
companyName: rest[8],
|
|
7783
|
+
periodYears: rest[9]
|
|
7784
|
+
};
|
|
7785
|
+
}
|
|
7786
|
+
const domain = params.domain;
|
|
7787
|
+
const teamId = params.teamId;
|
|
7788
|
+
const firstName = params.firstName;
|
|
7789
|
+
const lastName = params.lastName;
|
|
7790
|
+
const email = params.email;
|
|
7791
|
+
const phone = params.phone;
|
|
7792
|
+
const billingAddressId = params.billingAddressId;
|
|
7793
|
+
const paymentMethodId = params.paymentMethodId;
|
|
7794
|
+
const addressLine3 = params.addressLine3;
|
|
7795
|
+
const companyName = params.companyName;
|
|
7796
|
+
const periodYears = params.periodYears;
|
|
7797
|
+
if (typeof domain === 'undefined') {
|
|
7798
|
+
throw new AppwriteException('Missing required parameter: "domain"');
|
|
7799
|
+
}
|
|
7800
|
+
if (typeof teamId === 'undefined') {
|
|
7801
|
+
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
7802
|
+
}
|
|
7803
|
+
if (typeof firstName === 'undefined') {
|
|
7804
|
+
throw new AppwriteException('Missing required parameter: "firstName"');
|
|
7805
|
+
}
|
|
7806
|
+
if (typeof lastName === 'undefined') {
|
|
7807
|
+
throw new AppwriteException('Missing required parameter: "lastName"');
|
|
7808
|
+
}
|
|
7809
|
+
if (typeof email === 'undefined') {
|
|
7810
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
7811
|
+
}
|
|
7812
|
+
if (typeof phone === 'undefined') {
|
|
7813
|
+
throw new AppwriteException('Missing required parameter: "phone"');
|
|
7814
|
+
}
|
|
7815
|
+
if (typeof billingAddressId === 'undefined') {
|
|
7816
|
+
throw new AppwriteException('Missing required parameter: "billingAddressId"');
|
|
7817
|
+
}
|
|
7818
|
+
if (typeof paymentMethodId === 'undefined') {
|
|
7819
|
+
throw new AppwriteException('Missing required parameter: "paymentMethodId"');
|
|
7820
|
+
}
|
|
7821
|
+
const apiPath = '/domains/purchases';
|
|
7822
|
+
const payload = {};
|
|
7823
|
+
if (typeof domain !== 'undefined') {
|
|
7824
|
+
payload['domain'] = domain;
|
|
7825
|
+
}
|
|
7826
|
+
if (typeof teamId !== 'undefined') {
|
|
7827
|
+
payload['teamId'] = teamId;
|
|
7828
|
+
}
|
|
7829
|
+
if (typeof firstName !== 'undefined') {
|
|
7830
|
+
payload['firstName'] = firstName;
|
|
7831
|
+
}
|
|
7832
|
+
if (typeof lastName !== 'undefined') {
|
|
7833
|
+
payload['lastName'] = lastName;
|
|
7834
|
+
}
|
|
7835
|
+
if (typeof email !== 'undefined') {
|
|
7836
|
+
payload['email'] = email;
|
|
7837
|
+
}
|
|
7838
|
+
if (typeof phone !== 'undefined') {
|
|
7839
|
+
payload['phone'] = phone;
|
|
7840
|
+
}
|
|
7841
|
+
if (typeof billingAddressId !== 'undefined') {
|
|
7842
|
+
payload['billingAddressId'] = billingAddressId;
|
|
7843
|
+
}
|
|
7844
|
+
if (typeof addressLine3 !== 'undefined') {
|
|
7845
|
+
payload['addressLine3'] = addressLine3;
|
|
7846
|
+
}
|
|
7847
|
+
if (typeof companyName !== 'undefined') {
|
|
7848
|
+
payload['companyName'] = companyName;
|
|
7849
|
+
}
|
|
7850
|
+
if (typeof periodYears !== 'undefined') {
|
|
7851
|
+
payload['periodYears'] = periodYears;
|
|
7852
|
+
}
|
|
7853
|
+
if (typeof paymentMethodId !== 'undefined') {
|
|
7854
|
+
payload['paymentMethodId'] = paymentMethodId;
|
|
7855
|
+
}
|
|
7856
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
7857
|
+
const apiHeaders = {
|
|
7858
|
+
'content-type': 'application/json',
|
|
7859
|
+
};
|
|
7860
|
+
return this.client.call('post', uri, apiHeaders, payload);
|
|
7861
|
+
}
|
|
7739
7862
|
listSuggestions(paramsOrFirst, ...rest) {
|
|
7740
7863
|
let params;
|
|
7741
7864
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -15842,22 +15965,27 @@ class Organizations {
|
|
|
15842
15965
|
const apiHeaders = {};
|
|
15843
15966
|
return this.client.call('get', uri, apiHeaders, payload);
|
|
15844
15967
|
}
|
|
15845
|
-
getScopes(paramsOrFirst) {
|
|
15968
|
+
getScopes(paramsOrFirst, ...rest) {
|
|
15846
15969
|
let params;
|
|
15847
15970
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
15848
15971
|
params = (paramsOrFirst || {});
|
|
15849
15972
|
}
|
|
15850
15973
|
else {
|
|
15851
15974
|
params = {
|
|
15852
|
-
organizationId: paramsOrFirst
|
|
15975
|
+
organizationId: paramsOrFirst,
|
|
15976
|
+
projectId: rest[0]
|
|
15853
15977
|
};
|
|
15854
15978
|
}
|
|
15855
15979
|
const organizationId = params.organizationId;
|
|
15980
|
+
const projectId = params.projectId;
|
|
15856
15981
|
if (typeof organizationId === 'undefined') {
|
|
15857
15982
|
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
15858
15983
|
}
|
|
15859
15984
|
const apiPath = '/organizations/{organizationId}/roles'.replace('{organizationId}', organizationId);
|
|
15860
15985
|
const payload = {};
|
|
15986
|
+
if (typeof projectId !== 'undefined') {
|
|
15987
|
+
payload['projectId'] = projectId;
|
|
15988
|
+
}
|
|
15861
15989
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
15862
15990
|
const apiHeaders = {};
|
|
15863
15991
|
return this.client.call('get', uri, apiHeaders, payload);
|