Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 18.1.0

* Breaking: removed `deno-1.21`, `deno-1.24` and `deno-1.35` from `Runtime` and `BuildRuntime` enums
* Breaking: `Assistant.chat` now returns the response text as a `string` instead of `{ message }`
* Breaking: `Domains.getZone` now returns the zone file as a `string` instead of `{ message }`
* Fixed: nested objects in multipart requests are sent as JSON instead of `[object Object]`

## 18.0.0

* Breaking: SDK now targets Appwrite 2.3 (`X-Appwrite-Response-Format: 2.3.0`)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Client, Account } from '@appwrite.io/console';
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:

```html
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@18.0.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@18.1.0"></script>
```

## Getting Started
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@appwrite.io/console",
"homepage": "https://appwrite.io/support",
"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",
"version": "18.0.0",
"version": "18.1.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
32 changes: 27 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
'x-sdk-version': '18.0.0',
'x-sdk-version': '18.1.0',
'X-Appwrite-Response-Format': '2.3.0',
};

Expand Down Expand Up @@ -1171,6 +1171,11 @@ class Client {
for (const nestedValue of value) {
formData.append(`${key}[]`, nestedValue);
}
} else if (
value !== null &&
typeof value === 'object'
) {
formData.append(key, JSONbig.stringify(value));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Transport changes lack behavior tests Multipart objects are now serialized as JSON, and successful text responses are returned as raw strings, but neither behavior has a test. A multipart request with object attributes and a text response from chat or getZone should be checked through observable results; type-checking cannot catch a wrong field value or return value.

Knowledge Base Used: Client configuration and HTTP transport

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/client.ts
Line: 1178

Comment:
**Transport changes lack behavior tests** Multipart objects are now serialized as JSON, and successful text responses are returned as raw strings, but neither behavior has a test. A multipart request with object attributes and a text response from `chat` or `getZone` should be checked through observable results; type-checking cannot catch a wrong field value or return value.

**Knowledge Base Used:** [Client configuration and HTTP transport](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/sdk-for-console/-/docs/sdk-client-and-transport.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

} else {
formData.append(key, value);
}
Expand All @@ -1192,18 +1197,31 @@ class Client {
headers: Headers = {},
originalPayload: Payload = {},
onProgress: (progress: UploadProgress) => void,
responseType = 'json',
) {
const [fileParam, file] =
Object.entries(originalPayload).find(
([_, value]) => value instanceof File,
) ?? [];

if (!file || !fileParam) {
return await this.call(method, url, headers, originalPayload);
return await this.call(
method,
url,
headers,
originalPayload,
responseType,
);
}

if (file.size <= Client.CHUNK_SIZE) {
return await this.call(method, url, headers, originalPayload);
if (file.size <= Client.CHUNK_SIZE || responseType === 'text') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Text uploads bypass chunking If a caller uses the public chunkedUpload method with a text response and a file larger than 5 MB, this condition sends the whole file in one request. It also skips onProgress, so the caller loses progress updates and the upload may fail if the server limits single-request size. Keep large-file chunking independent of the response format.

Knowledge Base Used: Client configuration and HTTP transport

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/client.ts
Line: 1217

Comment:
**Text uploads bypass chunking** If a caller uses the public `chunkedUpload` method with a text response and a file larger than 5 MB, this condition sends the whole file in one request. It also skips `onProgress`, so the caller loses progress updates and the upload may fail if the server limits single-request size. Keep large-file chunking independent of the response format.

**Knowledge Base Used:** [Client configuration and HTTP transport](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/sdk-for-console/-/docs/sdk-client-and-transport.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

return await this.call(
method,
url,
headers,
originalPayload,
responseType,
);
}

const totalChunks = Math.ceil(file.size / Client.CHUNK_SIZE);
Expand All @@ -1223,6 +1241,7 @@ class Client {
url,
firstChunkHeaders,
firstPayload,
responseType,
);
const uploadId = response?.$id;

Expand Down Expand Up @@ -1283,6 +1302,7 @@ class Client {
url,
chunkHeaders,
chunkPayload,
responseType,
);

if (rejected) {
Expand Down Expand Up @@ -1392,7 +1412,9 @@ class Client {
);
}

if (
if (responseType === 'text' && response.status < 400) {
data = await response.text();
} else if (
response.headers.get('content-type')?.includes('application/json')
) {
data = JSONbig.parse(await response.text());
Expand Down
3 changes: 0 additions & 3 deletions src/enums/build-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export enum BuildRuntime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Expand Down
3 changes: 0 additions & 3 deletions src/enums/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export enum Runtime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Expand Down
Loading
Loading