react-native-appwrite 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +9 -8
- package/CHANGELOG.md +11 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/cjs/sdk.js +881 -36
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +877 -37
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-anonymous-session.md +2 -0
- package/docs/examples/account/create-email-password-session.md +2 -0
- package/docs/examples/account/create-email-token.md +2 -0
- package/docs/examples/account/create-email-verification.md +2 -0
- package/docs/examples/account/create-jwt.md +5 -1
- package/docs/examples/account/create-magic-url-token.md +2 -0
- package/docs/examples/account/create-mfa-authenticator.md +2 -0
- package/docs/examples/account/create-mfa-challenge.md +2 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +2 -0
- package/docs/examples/account/create-o-auth-2-session.md +2 -0
- package/docs/examples/account/create-o-auth-2-token.md +2 -0
- package/docs/examples/account/create-phone-token.md +2 -0
- package/docs/examples/account/create-phone-verification.md +2 -0
- package/docs/examples/account/create-push-target.md +2 -0
- package/docs/examples/account/create-recovery.md +2 -0
- package/docs/examples/account/create-session.md +2 -0
- package/docs/examples/account/create-verification.md +2 -0
- package/docs/examples/account/create.md +2 -0
- package/docs/examples/account/delete-identity.md +2 -0
- package/docs/examples/account/delete-mfa-authenticator.md +2 -0
- package/docs/examples/account/delete-push-target.md +2 -0
- package/docs/examples/account/delete-session.md +2 -0
- package/docs/examples/account/delete-sessions.md +2 -0
- package/docs/examples/account/get-mfa-recovery-codes.md +2 -0
- package/docs/examples/account/get-prefs.md +2 -0
- package/docs/examples/account/get-session.md +2 -0
- package/docs/examples/account/get.md +2 -0
- package/docs/examples/account/list-identities.md +2 -0
- package/docs/examples/account/list-logs.md +2 -0
- package/docs/examples/account/list-mfa-factors.md +2 -0
- package/docs/examples/account/list-sessions.md +2 -0
- package/docs/examples/account/update-email-verification.md +2 -0
- package/docs/examples/account/update-email.md +2 -0
- package/docs/examples/account/update-magic-url-session.md +2 -0
- package/docs/examples/account/update-mfa-authenticator.md +2 -0
- package/docs/examples/account/update-mfa-challenge.md +2 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +2 -0
- package/docs/examples/account/update-mfa.md +2 -0
- package/docs/examples/account/update-name.md +2 -0
- package/docs/examples/account/update-password.md +2 -0
- package/docs/examples/account/update-phone-session.md +2 -0
- package/docs/examples/account/update-phone-verification.md +2 -0
- package/docs/examples/account/update-phone.md +2 -0
- package/docs/examples/account/update-prefs.md +2 -0
- package/docs/examples/account/update-push-target.md +2 -0
- package/docs/examples/account/update-recovery.md +2 -0
- package/docs/examples/account/update-session.md +2 -0
- package/docs/examples/account/update-status.md +2 -0
- package/docs/examples/account/update-verification.md +2 -0
- package/docs/examples/avatars/get-browser.md +2 -0
- package/docs/examples/avatars/get-credit-card.md +2 -0
- package/docs/examples/avatars/get-favicon.md +2 -0
- package/docs/examples/avatars/get-flag.md +2 -0
- package/docs/examples/avatars/get-image.md +2 -0
- package/docs/examples/avatars/get-initials.md +2 -0
- package/docs/examples/avatars/get-qr.md +2 -0
- package/docs/examples/avatars/get-screenshot.md +37 -0
- package/docs/examples/databases/create-document.md +2 -0
- package/docs/examples/databases/create-operations.md +2 -0
- package/docs/examples/databases/create-transaction.md +2 -0
- package/docs/examples/databases/decrement-document-attribute.md +2 -0
- package/docs/examples/databases/delete-document.md +2 -0
- package/docs/examples/databases/delete-transaction.md +2 -0
- package/docs/examples/databases/get-document.md +2 -0
- package/docs/examples/databases/get-transaction.md +2 -0
- package/docs/examples/databases/increment-document-attribute.md +2 -0
- package/docs/examples/databases/list-documents.md +2 -0
- package/docs/examples/databases/list-transactions.md +2 -0
- package/docs/examples/databases/update-document.md +9 -1
- package/docs/examples/databases/update-transaction.md +2 -0
- package/docs/examples/databases/upsert-document.md +9 -1
- package/docs/examples/functions/create-execution.md +2 -0
- package/docs/examples/functions/get-execution.md +2 -0
- package/docs/examples/functions/list-executions.md +2 -0
- package/docs/examples/graphql/mutation.md +2 -0
- package/docs/examples/graphql/query.md +2 -0
- package/docs/examples/locale/get.md +2 -0
- package/docs/examples/locale/list-codes.md +2 -0
- package/docs/examples/locale/list-continents.md +2 -0
- package/docs/examples/locale/list-countries-eu.md +2 -0
- package/docs/examples/locale/list-countries-phones.md +2 -0
- package/docs/examples/locale/list-countries.md +2 -0
- package/docs/examples/locale/list-currencies.md +2 -0
- package/docs/examples/locale/list-languages.md +2 -0
- package/docs/examples/messaging/create-subscriber.md +2 -0
- package/docs/examples/messaging/delete-subscriber.md +2 -0
- package/docs/examples/storage/create-file.md +2 -0
- package/docs/examples/storage/delete-file.md +2 -0
- package/docs/examples/storage/get-file-download.md +2 -0
- package/docs/examples/storage/get-file-preview.md +2 -0
- package/docs/examples/storage/get-file-view.md +2 -0
- package/docs/examples/storage/get-file.md +2 -0
- package/docs/examples/storage/list-files.md +2 -0
- package/docs/examples/storage/update-file.md +2 -0
- package/docs/examples/tablesdb/create-operations.md +2 -0
- package/docs/examples/tablesdb/create-row.md +2 -0
- package/docs/examples/tablesdb/create-transaction.md +2 -0
- package/docs/examples/tablesdb/decrement-row-column.md +2 -0
- package/docs/examples/tablesdb/delete-row.md +2 -0
- package/docs/examples/tablesdb/delete-transaction.md +2 -0
- package/docs/examples/tablesdb/get-row.md +2 -0
- package/docs/examples/tablesdb/get-transaction.md +2 -0
- package/docs/examples/tablesdb/increment-row-column.md +2 -0
- package/docs/examples/tablesdb/list-rows.md +2 -0
- package/docs/examples/tablesdb/list-transactions.md +2 -0
- package/docs/examples/tablesdb/update-row.md +9 -1
- package/docs/examples/tablesdb/update-transaction.md +2 -0
- package/docs/examples/tablesdb/upsert-row.md +9 -1
- package/docs/examples/teams/create-membership.md +4 -2
- package/docs/examples/teams/create.md +2 -0
- package/docs/examples/teams/delete-membership.md +2 -0
- package/docs/examples/teams/delete.md +2 -0
- package/docs/examples/teams/get-membership.md +2 -0
- package/docs/examples/teams/get-prefs.md +2 -0
- package/docs/examples/teams/get.md +2 -0
- package/docs/examples/teams/list-memberships.md +2 -0
- package/docs/examples/teams/list.md +2 -0
- package/docs/examples/teams/update-membership-status.md +2 -0
- package/docs/examples/teams/update-membership.md +4 -2
- package/docs/examples/teams/update-name.md +2 -0
- package/docs/examples/teams/update-prefs.md +2 -0
- package/package.json +7 -4
- package/rollup.config.js +3 -1
- package/src/channel.ts +134 -0
- package/src/client.ts +41 -6
- package/src/enums/browser-permission.ts +22 -0
- package/src/enums/o-auth-provider.ts +0 -1
- package/src/enums/roles.ts +5 -0
- package/src/enums/theme.ts +4 -0
- package/src/enums/timezone.ts +421 -0
- package/src/index.ts +6 -1
- package/src/models.ts +8 -0
- package/src/query.ts +54 -9
- package/src/services/account.ts +34 -5
- package/src/services/avatars.ts +348 -0
- package/src/services/databases.ts +5 -9
- package/src/services/storage.ts +8 -8
- package/src/services/teams.ts +19 -18
- package/types/channel.d.ts +71 -0
- package/types/enums/browser-permission.d.ts +22 -0
- package/types/enums/o-auth-provider.d.ts +1 -2
- package/types/enums/roles.d.ts +5 -0
- package/types/enums/theme.d.ts +4 -0
- package/types/enums/timezone.d.ts +421 -0
- package/types/index.d.ts +6 -1
- package/types/models.d.ts +8 -0
- package/types/query.d.ts +36 -6
- package/types/services/account.d.ts +13 -1
- package/types/services/avatars.d.ts +124 -0
- package/types/services/databases.d.ts +2 -2
- package/types/services/storage.d.ts +8 -8
- package/types/services/teams.d.ts +9 -8
- package/.gitpod.yml +0 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
```javascript
|
|
2
|
+
import { Client, Teams, Roles } from "react-native-appwrite";
|
|
2
3
|
|
|
3
4
|
const client = new Client()
|
|
4
5
|
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
@@ -9,7 +10,8 @@ const teams = new Teams(client);
|
|
|
9
10
|
const result = await teams.updateMembership({
|
|
10
11
|
teamId: '<TEAM_ID>',
|
|
11
12
|
membershipId: '<MEMBERSHIP_ID>',
|
|
12
|
-
roles: []
|
|
13
|
+
roles: [Roles.Admin]
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
console.log(result);
|
|
17
|
+
```
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-appwrite",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
|
-
"description": "Appwrite is an open-source self-hosted backend server that
|
|
5
|
-
"version": "0.
|
|
4
|
+
"description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
+
"version": "0.20.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@rollup/plugin-typescript": "8.3.2",
|
|
29
|
-
"
|
|
29
|
+
"@types/json-bigint": "1.0.4",
|
|
30
|
+
"playwright": "1.56.1",
|
|
30
31
|
"rollup": "2.75.4",
|
|
31
32
|
"serve-handler": "6.1.0",
|
|
32
33
|
"tslib": "2.4.0",
|
|
@@ -34,7 +35,9 @@
|
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"expo-file-system": "18.*.*",
|
|
37
|
-
"
|
|
38
|
+
"json-bigint": "1.0.0",
|
|
39
|
+
"react-native": ">=0.76.7 <1.0.0",
|
|
40
|
+
"bignumber.js": "^9.0.0"
|
|
38
41
|
},
|
|
39
42
|
"peerDependencies": {
|
|
40
43
|
"expo": "*"
|
package/rollup.config.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import pkg from "./package.json";
|
|
2
2
|
import typescript from "@rollup/plugin-typescript";
|
|
3
3
|
|
|
4
|
+
const external = Object.keys(pkg.dependencies ?? {});
|
|
5
|
+
|
|
4
6
|
export default {
|
|
5
|
-
external: Object.keys(pkg.dependencies),
|
|
6
7
|
input: "src/index.ts",
|
|
8
|
+
external,
|
|
7
9
|
plugins: [typescript()],
|
|
8
10
|
output: [
|
|
9
11
|
{
|
package/src/channel.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
interface Root {}
|
|
2
|
+
interface Database { _db: any }
|
|
3
|
+
interface Collection { _coll: any }
|
|
4
|
+
interface Document { _doc: any }
|
|
5
|
+
interface TablesDB { _tdb: any }
|
|
6
|
+
interface Table { _tbl: any }
|
|
7
|
+
interface Row { _row: any }
|
|
8
|
+
interface Bucket { _bkt: any }
|
|
9
|
+
interface File { _file: any }
|
|
10
|
+
interface Func { _fn: any }
|
|
11
|
+
interface Execution { _exec: any }
|
|
12
|
+
interface Team { _team: any }
|
|
13
|
+
interface Membership { _mem: any }
|
|
14
|
+
interface Resolved { _res: any }
|
|
15
|
+
|
|
16
|
+
type Actionable = Document | Row | File | Execution | Team | Membership;
|
|
17
|
+
|
|
18
|
+
function normalize(id: string): string {
|
|
19
|
+
const trimmed = id.trim();
|
|
20
|
+
return trimmed === "" ? "*" : trimmed;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class Channel<T> {
|
|
24
|
+
declare _type: T;
|
|
25
|
+
|
|
26
|
+
private constructor(private readonly segments: string[]) {}
|
|
27
|
+
|
|
28
|
+
private next<N>(segment: string, id: string = "*"): Channel<N> {
|
|
29
|
+
return new Channel<N>([...this.segments, segment, normalize(id)]) as any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private resolve(action: string): Channel<Resolved> {
|
|
33
|
+
return new Channel<Resolved>([...this.segments, action]) as any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
toString(): string {
|
|
37
|
+
return this.segments.join(".");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// --- DATABASE ROUTE ---
|
|
41
|
+
// Only available on Channel<Database>
|
|
42
|
+
collection(this: Channel<Database>, id: string = "*"): Channel<Collection> {
|
|
43
|
+
return this.next<Collection>("collections", id);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Only available on Channel<Collection>
|
|
47
|
+
document(this: Channel<Collection>, id: string = "*"): Channel<Document> {
|
|
48
|
+
return this.next<Document>("documents", id);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// --- TABLESDB ROUTE ---
|
|
52
|
+
table(this: Channel<TablesDB>, id: string = "*"): Channel<Table> {
|
|
53
|
+
return this.next<Table>("tables", id);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
row(this: Channel<Table>, id: string = "*"): Channel<Row> {
|
|
57
|
+
return this.next<Row>("rows", id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --- BUCKET ROUTE ---
|
|
61
|
+
file(this: Channel<Bucket>, id: string = "*"): Channel<File> {
|
|
62
|
+
return this.next<File>("files", id);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// --- FUNCTION ROUTE ---
|
|
66
|
+
execution(this: Channel<Func>, id: string = "*"): Channel<Execution> {
|
|
67
|
+
return this.next<Execution>("executions", id);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// --- TERMINAL ACTIONS ---
|
|
71
|
+
// Restricted to the Actionable union
|
|
72
|
+
create(this: Channel<Actionable>): Channel<Resolved> {
|
|
73
|
+
return this.resolve("create");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
update(this: Channel<Actionable>): Channel<Resolved> {
|
|
77
|
+
return this.resolve("update");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
delete(this: Channel<Actionable>): Channel<Resolved> {
|
|
81
|
+
return this.resolve("delete");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// --- ROOT FACTORIES ---
|
|
85
|
+
static database(id: string = "*") {
|
|
86
|
+
return new Channel<Database>(["databases", normalize(id)]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static tablesdb(id: string = "*") {
|
|
90
|
+
return new Channel<TablesDB>(["tablesdb", normalize(id)]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static bucket(id: string = "*") {
|
|
94
|
+
return new Channel<Bucket>(["buckets", normalize(id)]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static function(id: string = "*") {
|
|
98
|
+
return new Channel<Func>(["functions", normalize(id)]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static team(id: string = "*") {
|
|
102
|
+
return new Channel<Team>(["teams", normalize(id)]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static membership(id: string = "*") {
|
|
106
|
+
return new Channel<Membership>(["memberships", normalize(id)]);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static account(userId: string = ""): string {
|
|
110
|
+
const id = normalize(userId);
|
|
111
|
+
return id === "*" ? "account" : `account.${id}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Global events
|
|
115
|
+
static get documents(): string {
|
|
116
|
+
return "documents";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static get rows(): string {
|
|
120
|
+
return "rows";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static get files(): string {
|
|
124
|
+
return "files";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static get executions(): string {
|
|
128
|
+
return "executions";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Export types for backward compatibility with realtime
|
|
133
|
+
export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
|
|
134
|
+
export type ResolvedChannel = Channel<Resolved>;
|
package/src/client.ts
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { Models } from './models';
|
|
2
2
|
import { Service } from './service';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
+
import JSONbigModule from 'json-bigint';
|
|
5
|
+
import BigNumber from 'bignumber.js';
|
|
6
|
+
const JSONbigParser = JSONbigModule({ storeAsString: false });
|
|
7
|
+
const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });
|
|
8
|
+
|
|
9
|
+
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
10
|
+
const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
11
|
+
|
|
12
|
+
function reviver(_key: string, value: any): any {
|
|
13
|
+
if (BigNumber.isBigNumber(value)) {
|
|
14
|
+
if (value.isInteger()) {
|
|
15
|
+
const str = value.toFixed();
|
|
16
|
+
const bi = BigInt(str);
|
|
17
|
+
if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
|
|
18
|
+
return Number(str);
|
|
19
|
+
}
|
|
20
|
+
return bi;
|
|
21
|
+
}
|
|
22
|
+
return value.toNumber();
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const JSONbig = {
|
|
28
|
+
parse: (text: string) => JSONbigParser.parse(text, reviver),
|
|
29
|
+
stringify: JSONbigSerializer.stringify
|
|
30
|
+
};
|
|
4
31
|
|
|
5
32
|
type Payload = {
|
|
6
33
|
[key: string]: any;
|
|
@@ -115,7 +142,7 @@ class Client {
|
|
|
115
142
|
'x-sdk-name': 'React Native',
|
|
116
143
|
'x-sdk-platform': 'client',
|
|
117
144
|
'x-sdk-language': 'reactnative',
|
|
118
|
-
'x-sdk-version': '0.
|
|
145
|
+
'x-sdk-version': '0.20.0',
|
|
119
146
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
120
147
|
};
|
|
121
148
|
|
|
@@ -129,6 +156,10 @@ class Client {
|
|
|
129
156
|
* @returns {this}
|
|
130
157
|
*/
|
|
131
158
|
setEndpoint(endpoint: string): this {
|
|
159
|
+
if (!endpoint || typeof endpoint !== 'string') {
|
|
160
|
+
throw new AppwriteException('Endpoint must be a valid string');
|
|
161
|
+
}
|
|
162
|
+
|
|
132
163
|
if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
|
|
133
164
|
throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
|
|
134
165
|
}
|
|
@@ -147,6 +178,10 @@ class Client {
|
|
|
147
178
|
* @returns {this}
|
|
148
179
|
*/
|
|
149
180
|
setEndpointRealtime(endpointRealtime: string): this {
|
|
181
|
+
if (!endpointRealtime || typeof endpointRealtime !== 'string') {
|
|
182
|
+
throw new AppwriteException('Endpoint must be a valid string');
|
|
183
|
+
}
|
|
184
|
+
|
|
150
185
|
if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
|
|
151
186
|
throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
|
|
152
187
|
}
|
|
@@ -278,7 +313,7 @@ class Client {
|
|
|
278
313
|
}
|
|
279
314
|
|
|
280
315
|
this.realtime.heartbeat = window?.setInterval(() => {
|
|
281
|
-
this.realtime.socket?.send(
|
|
316
|
+
this.realtime.socket?.send(JSONbig.stringify({
|
|
282
317
|
type: 'ping'
|
|
283
318
|
}));
|
|
284
319
|
}, 20_000);
|
|
@@ -347,7 +382,7 @@ class Client {
|
|
|
347
382
|
},
|
|
348
383
|
onMessage: (event) => {
|
|
349
384
|
try {
|
|
350
|
-
const message: RealtimeResponse =
|
|
385
|
+
const message: RealtimeResponse = JSONbig.parse(event.data);
|
|
351
386
|
this.realtime.lastMessage = message;
|
|
352
387
|
switch (message.type) {
|
|
353
388
|
case 'event':
|
|
@@ -454,7 +489,7 @@ class Client {
|
|
|
454
489
|
} else {
|
|
455
490
|
switch (headers['content-type']) {
|
|
456
491
|
case 'application/json':
|
|
457
|
-
options.body =
|
|
492
|
+
options.body = JSONbig.stringify(params);
|
|
458
493
|
break;
|
|
459
494
|
|
|
460
495
|
case 'multipart/form-data':
|
|
@@ -487,7 +522,7 @@ class Client {
|
|
|
487
522
|
}
|
|
488
523
|
|
|
489
524
|
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
490
|
-
data = await response.
|
|
525
|
+
data = JSONbig.parse(await response.text());
|
|
491
526
|
} else if (responseType === 'arrayBuffer') {
|
|
492
527
|
data = await response.arrayBuffer();
|
|
493
528
|
} else {
|
|
@@ -499,7 +534,7 @@ class Client {
|
|
|
499
534
|
if (400 <= response.status) {
|
|
500
535
|
let responseText = '';
|
|
501
536
|
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
502
|
-
responseText =
|
|
537
|
+
responseText = JSONbig.stringify(data);
|
|
503
538
|
} else {
|
|
504
539
|
responseText = data?.message;
|
|
505
540
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export enum BrowserPermission {
|
|
2
|
+
Geolocation = 'geolocation',
|
|
3
|
+
Camera = 'camera',
|
|
4
|
+
Microphone = 'microphone',
|
|
5
|
+
Notifications = 'notifications',
|
|
6
|
+
Midi = 'midi',
|
|
7
|
+
Push = 'push',
|
|
8
|
+
ClipboardRead = 'clipboard-read',
|
|
9
|
+
ClipboardWrite = 'clipboard-write',
|
|
10
|
+
PaymentHandler = 'payment-handler',
|
|
11
|
+
Usb = 'usb',
|
|
12
|
+
Bluetooth = 'bluetooth',
|
|
13
|
+
Accelerometer = 'accelerometer',
|
|
14
|
+
Gyroscope = 'gyroscope',
|
|
15
|
+
Magnetometer = 'magnetometer',
|
|
16
|
+
AmbientLightSensor = 'ambient-light-sensor',
|
|
17
|
+
BackgroundSync = 'background-sync',
|
|
18
|
+
PersistentStorage = 'persistent-storage',
|
|
19
|
+
ScreenWakeLock = 'screen-wake-lock',
|
|
20
|
+
WebShare = 'web-share',
|
|
21
|
+
XrSpatialTracking = 'xr-spatial-tracking',
|
|
22
|
+
}
|