react-native-appwrite 0.6.0 → 0.7.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/autoclose.yml +11 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/cjs/sdk.js +23 -11
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +23 -11
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +5 -3
- package/src/enums/image-format.ts +1 -0
- package/src/services/account.ts +15 -4
- package/src/services/storage.ts +4 -6
- package/types/enums/image-format.d.ts +1 -0
- package/types/services/account.d.ts +15 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "react-native-appwrite",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.7.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
package/src/client.ts
CHANGED
|
@@ -11,8 +11,8 @@ type Headers = {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
type RealtimeResponse = {
|
|
14
|
-
type: 'error' | 'event' | 'connected' | 'response';
|
|
15
|
-
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown
|
|
14
|
+
type: 'error' | 'event' | 'connected' | 'response' | 'pong';
|
|
15
|
+
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown> | undefined;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
type RealtimeRequest = {
|
|
@@ -114,7 +114,7 @@ class Client {
|
|
|
114
114
|
'x-sdk-name': 'React Native',
|
|
115
115
|
'x-sdk-platform': 'client',
|
|
116
116
|
'x-sdk-language': 'reactnative',
|
|
117
|
-
'x-sdk-version': '0.
|
|
117
|
+
'x-sdk-version': '0.7.0',
|
|
118
118
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
119
119
|
};
|
|
120
120
|
|
|
@@ -339,6 +339,8 @@ class Client {
|
|
|
339
339
|
})
|
|
340
340
|
}
|
|
341
341
|
break;
|
|
342
|
+
case 'pong':
|
|
343
|
+
break; // Handle pong response if needed
|
|
342
344
|
case 'error':
|
|
343
345
|
throw message.data;
|
|
344
346
|
default:
|
package/src/services/account.ts
CHANGED
|
@@ -378,7 +378,7 @@ export class Account extends Service {
|
|
|
378
378
|
* @throws {AppwriteException}
|
|
379
379
|
* @returns {Promise}
|
|
380
380
|
*/
|
|
381
|
-
async updateMfaChallenge(challengeId: string, otp: string): Promise<
|
|
381
|
+
async updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session> {
|
|
382
382
|
if (typeof challengeId === 'undefined') {
|
|
383
383
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
384
384
|
}
|
|
@@ -1104,6 +1104,11 @@ export class Account extends Service {
|
|
|
1104
1104
|
/**
|
|
1105
1105
|
* Create push target
|
|
1106
1106
|
*
|
|
1107
|
+
* Use this endpoint to register a device for push notifications. Provide a
|
|
1108
|
+
* target ID (custom or generated using ID.unique()), a device identifier
|
|
1109
|
+
* (usually a device token), and optionally specify which provider should send
|
|
1110
|
+
* notifications to this target. The target is automatically linked to the
|
|
1111
|
+
* current session and includes device information like brand and model.
|
|
1107
1112
|
*
|
|
1108
1113
|
* @param {string} targetId
|
|
1109
1114
|
* @param {string} identifier
|
|
@@ -1144,6 +1149,11 @@ export class Account extends Service {
|
|
|
1144
1149
|
/**
|
|
1145
1150
|
* Update push target
|
|
1146
1151
|
*
|
|
1152
|
+
* Update the currently logged in user's push notification target. You can
|
|
1153
|
+
* modify the target's identifier (device token) and provider ID (token,
|
|
1154
|
+
* email, phone etc.). The target must exist and belong to the current user.
|
|
1155
|
+
* If you change the provider ID, notifications will be sent through the new
|
|
1156
|
+
* messaging provider instead.
|
|
1147
1157
|
*
|
|
1148
1158
|
* @param {string} targetId
|
|
1149
1159
|
* @param {string} identifier
|
|
@@ -1175,6 +1185,9 @@ export class Account extends Service {
|
|
|
1175
1185
|
/**
|
|
1176
1186
|
* Delete push target
|
|
1177
1187
|
*
|
|
1188
|
+
* Delete a push notification target for the currently logged in user. After
|
|
1189
|
+
* deletion, the device will no longer receive push notifications. The target
|
|
1190
|
+
* must exist and belong to the current user.
|
|
1178
1191
|
*
|
|
1179
1192
|
* @param {string} targetId
|
|
1180
1193
|
* @throws {AppwriteException}
|
|
@@ -1255,9 +1268,7 @@ export class Account extends Service {
|
|
|
1255
1268
|
* [POST
|
|
1256
1269
|
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1257
1270
|
* endpoint to complete the login process. The link sent to the user's email
|
|
1258
|
-
* address is valid for 1 hour.
|
|
1259
|
-
* the URL parameter empty, so that the login completion will be handled by
|
|
1260
|
-
* your Appwrite instance by default.
|
|
1271
|
+
* address is valid for 1 hour.
|
|
1261
1272
|
*
|
|
1262
1273
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1263
1274
|
* about session
|
package/src/services/storage.ts
CHANGED
|
@@ -122,12 +122,10 @@ export class Storage extends Service {
|
|
|
122
122
|
|
|
123
123
|
let offset = 0;
|
|
124
124
|
let response = undefined;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
} catch(e) {
|
|
130
|
-
}
|
|
125
|
+
try {
|
|
126
|
+
response = await this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
|
|
127
|
+
offset = response.chunksUploaded * Service.CHUNK_SIZE;
|
|
128
|
+
} catch(e) {
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
let timestamp = new Date().getTime();
|
|
@@ -168,7 +168,7 @@ export declare class Account extends Service {
|
|
|
168
168
|
* @throws {AppwriteException}
|
|
169
169
|
* @returns {Promise}
|
|
170
170
|
*/
|
|
171
|
-
updateMfaChallenge(challengeId: string, otp: string): Promise<
|
|
171
|
+
updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
172
172
|
/**
|
|
173
173
|
* List factors
|
|
174
174
|
*
|
|
@@ -482,6 +482,11 @@ export declare class Account extends Service {
|
|
|
482
482
|
/**
|
|
483
483
|
* Create push target
|
|
484
484
|
*
|
|
485
|
+
* Use this endpoint to register a device for push notifications. Provide a
|
|
486
|
+
* target ID (custom or generated using ID.unique()), a device identifier
|
|
487
|
+
* (usually a device token), and optionally specify which provider should send
|
|
488
|
+
* notifications to this target. The target is automatically linked to the
|
|
489
|
+
* current session and includes device information like brand and model.
|
|
485
490
|
*
|
|
486
491
|
* @param {string} targetId
|
|
487
492
|
* @param {string} identifier
|
|
@@ -493,6 +498,11 @@ export declare class Account extends Service {
|
|
|
493
498
|
/**
|
|
494
499
|
* Update push target
|
|
495
500
|
*
|
|
501
|
+
* Update the currently logged in user's push notification target. You can
|
|
502
|
+
* modify the target's identifier (device token) and provider ID (token,
|
|
503
|
+
* email, phone etc.). The target must exist and belong to the current user.
|
|
504
|
+
* If you change the provider ID, notifications will be sent through the new
|
|
505
|
+
* messaging provider instead.
|
|
496
506
|
*
|
|
497
507
|
* @param {string} targetId
|
|
498
508
|
* @param {string} identifier
|
|
@@ -503,6 +513,9 @@ export declare class Account extends Service {
|
|
|
503
513
|
/**
|
|
504
514
|
* Delete push target
|
|
505
515
|
*
|
|
516
|
+
* Delete a push notification target for the currently logged in user. After
|
|
517
|
+
* deletion, the device will no longer receive push notifications. The target
|
|
518
|
+
* must exist and belong to the current user.
|
|
506
519
|
*
|
|
507
520
|
* @param {string} targetId
|
|
508
521
|
* @throws {AppwriteException}
|
|
@@ -541,9 +554,7 @@ export declare class Account extends Service {
|
|
|
541
554
|
* [POST
|
|
542
555
|
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
543
556
|
* endpoint to complete the login process. The link sent to the user's email
|
|
544
|
-
* address is valid for 1 hour.
|
|
545
|
-
* the URL parameter empty, so that the login completion will be handled by
|
|
546
|
-
* your Appwrite instance by default.
|
|
557
|
+
* address is valid for 1 hour.
|
|
547
558
|
*
|
|
548
559
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
549
560
|
* about session
|