Skip to content

Commit 3bb1cfa

Browse files
authored
Merge pull request #118 from appwrite/dev
fix: pong response & chunked upload
2 parents 90564b7 + f93fff6 commit 3bb1cfa

File tree

8 files changed

+16
-50
lines changed

8 files changed

+16
-50
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Web SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
@@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
3333
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:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/appwrite@16.1.0"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/appwrite@17.0.0"></script>
3737
```
3838

3939

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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": "16.1.0",
5+
"version": "17.0.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ type Headers = {
1919
*/
2020
type RealtimeResponse = {
2121
/**
22-
* Type of the response: 'error', 'event', 'connected', 'pong', or 'response'.
22+
* Type of the response: 'error', 'event', 'connected', 'response' or 'pong'.
2323
*/
2424
type: 'error' | 'event' | 'connected' | 'response' | 'pong';
2525

2626
/**
2727
* Data associated with the response based on the response type.
2828
*/
29-
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown>;
29+
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown> | undefined;
3030
}
3131

3232
/**
@@ -315,7 +315,7 @@ class Client {
315315
'x-sdk-name': 'Web',
316316
'x-sdk-platform': 'client',
317317
'x-sdk-language': 'web',
318-
'x-sdk-version': '16.1.0',
318+
'x-sdk-version': '17.0.0',
319319
'X-Appwrite-Response-Format': '1.6.0',
320320
};
321321

@@ -531,6 +531,8 @@ class Client {
531531
})
532532
}
533533
break;
534+
case 'pong':
535+
break; // Handle pong response if needed
534536
case 'error':
535537
throw message.data;
536538
default:

src/enums/image-format.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export enum ImageFormat {
44
Gif = 'gif',
55
Png = 'png',
66
Webp = 'webp',
7+
Heic = 'heic',
78
Avif = 'avif',
89
}

src/services/account.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ This endpoint can also be used to convert an anonymous account to a normal one,
406406
* @param {string} challengeId
407407
* @param {string} otp
408408
* @throws {AppwriteException}
409-
* @returns {Promise<{}>}
409+
* @returns {Promise<Models.Session>}
410410
*/
411-
async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
411+
async updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session> {
412412
if (typeof challengeId === 'undefined') {
413413
throw new AppwriteException('Missing required parameter: "challengeId"');
414414
}
@@ -1186,6 +1186,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
11861186
/**
11871187
* Create push target
11881188
*
1189+
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
11891190
*
11901191
* @param {string} targetId
11911192
* @param {string} identifier
@@ -1228,6 +1229,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
12281229
/**
12291230
* Update push target
12301231
*
1232+
* Update the currently logged in user&#039;s push notification target. You can modify the target&#039;s identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
12311233
*
12321234
* @param {string} targetId
12331235
* @param {string} identifier
@@ -1263,6 +1265,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
12631265
/**
12641266
* Delete push target
12651267
*
1268+
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
12661269
*
12671270
* @param {string} targetId
12681271
* @throws {AppwriteException}
@@ -1336,7 +1339,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
13361339
/**
13371340
* Create magic URL token
13381341
*
1339-
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user&#039;s email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.
1342+
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user&#039;s email address is valid for 1 hour.
13401343
13411344
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
13421345

src/services/avatars.ts

-28
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre
5454

5555
payload['project'] = this.client.config.project;
5656

57-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
58-
uri.searchParams.append(key, value);
59-
}
60-
6157
return uri.toString();
6258
}
6359
/**
@@ -103,10 +99,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre
10399

104100
payload['project'] = this.client.config.project;
105101

106-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
107-
uri.searchParams.append(key, value);
108-
}
109-
110102
return uri.toString();
111103
}
112104
/**
@@ -142,10 +134,6 @@ This endpoint does not follow HTTP redirects.
142134

143135
payload['project'] = this.client.config.project;
144136

145-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
146-
uri.searchParams.append(key, value);
147-
}
148-
149137
return uri.toString();
150138
}
151139
/**
@@ -191,10 +179,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre
191179

192180
payload['project'] = this.client.config.project;
193181

194-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
195-
uri.searchParams.append(key, value);
196-
}
197-
198182
return uri.toString();
199183
}
200184
/**
@@ -240,10 +224,6 @@ This endpoint does not follow HTTP redirects.
240224

241225
payload['project'] = this.client.config.project;
242226

243-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
244-
uri.searchParams.append(key, value);
245-
}
246-
247227
return uri.toString();
248228
}
249229
/**
@@ -291,10 +271,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre
291271

292272
payload['project'] = this.client.config.project;
293273

294-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
295-
uri.searchParams.append(key, value);
296-
}
297-
298274
return uri.toString();
299275
}
300276
/**
@@ -341,10 +317,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre
341317

342318
payload['project'] = this.client.config.project;
343319

344-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
345-
uri.searchParams.append(key, value);
346-
}
347-
348320
return uri.toString();
349321
}
350322
}

src/services/storage.ts

-12
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunk
242242

243243
payload['project'] = this.client.config.project;
244244

245-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
246-
uri.searchParams.append(key, value);
247-
}
248-
249245
return uri.toString();
250246
}
251247
/**
@@ -324,10 +320,6 @@ If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunk
324320

325321
payload['project'] = this.client.config.project;
326322

327-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
328-
uri.searchParams.append(key, value);
329-
}
330-
331323
return uri.toString();
332324
}
333325
/**
@@ -362,10 +354,6 @@ If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunk
362354

363355
payload['project'] = this.client.config.project;
364356

365-
for (const [key, value] of Object.entries(Client.flatten(payload))) {
366-
uri.searchParams.append(key, value);
367-
}
368-
369357
return uri.toString();
370358
}
371359
}

0 commit comments

Comments
 (0)