Skip to content

feat: Web SDK update for version 24.0.0#161

Merged
abnegate merged 7 commits intomainfrom
dev
Mar 26, 2026
Merged

feat: Web SDK update for version 24.0.0#161
abnegate merged 7 commits intomainfrom
dev

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented Mar 24, 2026

This PR contains updates to the Web SDK for version 24.0.0.

* Added `DocumentsDB` API with document management methods
* Added `VectorsDB` API with vector document methods
* Updated API version to 1.9.0 and server compatibility to 1.8.x
* Updated CDN script to `appwrite@22.4.1`
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 24, 2026

Greptile Summary

This PR introduces two new service classes (DocumentsDB and VectorsDB) for Appwrite's 22.5.0 release, adds user impersonation header support to the client, bumps the API response format to 1.9.0, and upgrades the dev toolchain (Rollup 3, TypeScript 5). The new services are well-structured and mirror each other closely, with consistent parameter overloads and proper runtime validation throughout.

Key findings:

  • Server version inconsistency: README.md states compatibility with 1.8.x while src/index.ts declares 1.9.x and client.ts sends X-Appwrite-Response-Format: 1.9.0. All three should be aligned (likely to 1.9.x). The API version badge in README.md also still shows 1.8.1.
  • Unused imports in both src/services/documents-db.ts and src/services/vectors-db.ts: Service (neither class extends it) and UploadProgress (never referenced) are imported but dead.
  • data.toString mutation in client.ts: the new code patches a custom toString method directly onto every response object for BigInt-safe serialization. This is functional but mutates returned values in a non-obvious way.
  • The rollup.config.js fix (switching from a bare import of package.json to readFileSync + JSON.parse) is the correct approach for Rollup 3 compatibility.

Confidence Score: 4/5

  • Safe to merge after resolving the README/index.ts version mismatch and cleaning up unused imports.
  • The new service implementations are logically sound and consistent. No critical bugs were found. The main issues are a documentation/versioning inconsistency that could mislead users about which server version is required, and dead imports that should be cleaned up before publishing.
  • README.md (version mismatch with src/index.ts and client.ts), src/services/documents-db.ts and src/services/vectors-db.ts (unused imports)

Important Files Changed

Filename Overview
src/services/documents-db.ts New DocumentsDB service with full CRUD, upsert, transaction, and increment/decrement operations over /documentsdb/ endpoints. Logic is consistent and well-structured, but Service and UploadProgress are imported but never used.
src/services/vectors-db.ts New VectorsDB service mirroring most of DocumentsDB for vector-specific documents over /vectorsdb/ endpoints. Same unused import issue as DocumentsDB (Service and UploadProgress).
src/client.ts Adds three new impersonation header setters (setImpersonateUserId, setImpersonateUserEmail, setImpersonateUserPhone) and bumps SDK/response-format version. Also adds an inline data.toString mutation for BigInt-safe JSON serialization — functional but potentially surprising for callers.
README.md Server compatibility statement says 1.8.x while src/index.ts and client.ts headers target 1.9.0/1.9.x. The badge URL also still shows 1.8.1, creating three conflicting version references for users.
src/index.ts Exports for new DocumentsDB and VectorsDB services added correctly; compatibility comment updated to 1.9.x.
src/services/databases.ts New upsertDocuments method added using a PUT request to /databases/{databaseId}/collections/{collectionId}/documents. Correctly marked as deprecated in favour of TablesDB.upsertRows. Parameter validation and both overload signatures are consistent.
src/models.ts $sequence type changed from number to string in both Row and Document models; Log comments updated for impersonation semantics; User model gains impersonator and impersonatorUserId optional fields.
package.json Version bumped to 22.5.0; dev dependencies upgraded (rollup 2→3, TypeScript 4→5, rollup plugins to current versions).
rollup.config.js JSON import replaced with readFileSync + JSON.parse to stay compatible with rollup 3's stricter ES module handling (which no longer supports import of JSON by default).

Comments Outside Diff (1)

  1. README.md, line 30 (link)

    P2 API version badge still shows 1.8.1

    The badge URL still references api%20version-1.8.1, but the response format header has been bumped to 1.9.0. This should be updated to 1.9.0 to match.

Reviews (1): Last reviewed commit: "feat: update Web SDK to 22.5.0" | Re-trigger Greptile

Comment thread src/services/documents-db.ts Outdated
Comment thread src/services/vectors-db.ts Outdated
Comment thread README.md
Comment thread src/client.ts
@ChiragAgg5k ChiragAgg5k changed the title feat: Web SDK update for version 22.5.0 feat: Web SDK update for version 23.0.0 Mar 25, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

Warning

Rate limit exceeded

@ChiragAgg5k has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77f3b683-565e-4d03-a2eb-39c66549df34

📥 Commits

Reviewing files that changed from the base of the PR and between ee01d7f and d72ff0a.

📒 Files selected for processing (1)
  • src/models.ts

Walkthrough

This PR updates the Appwrite Web SDK from version 23.0.0 to 24.0.0 with support for Appwrite server 1.9.x. The release introduces user impersonation capabilities through three new fluent methods on the Client class (setImpersonateUserId, setImpersonateUserEmail, setImpersonateUserPhone) that set corresponding request headers. A new upsertDocuments method is added to the Databases service for upserting document collections. The $sequence field type is changed from number to string in Row and Document models. SDK headers are updated, tooling dependencies are refreshed, and documentation with examples are added accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main change: a version update of the Web SDK to 24.0.0, which is the primary objective reflected in all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (5)
docs/examples/vectorsdb/list-documents.md (1)

10-17: Consider clarifying the ttl parameter value.

The example shows ttl: 0, which may be ambiguous. Consider adding a comment to clarify whether 0 means "no caching," "use default," or another specific behavior, to help developers understand the parameter's usage.

📝 Example with clarified comment
     queries: [], // optional
     transactionId: '<TRANSACTION_ID>', // optional
     total: false, // optional
-    ttl: 0 // optional
+    ttl: 0 // optional - 0 disables caching (or specify time in seconds)
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/vectorsdb/list-documents.md` around lines 10 - 17, Clarify the
ttl parameter in the vectorsDB.listDocuments example by updating the inline
comment for ttl to state what 0 means (e.g., "0 = no caching" or "0 = use
default server TTL") so readers know the behavior; change the comment next to
ttl in the vectorsDB.listDocuments call to explicitly describe the intended
semantics of 0 and, if relevant, list other accepted values or refer to the API
docs for default behavior.
docs/examples/databases/upsert-documents.md (1)

13-13: Enhance example with a sample document structure.

The empty documents: [] array doesn't show users what structure documents should have. Consider adding at least one example document to demonstrate the expected format and required fields.

📚 Suggested improvement
-    documents: [],
+    documents: [
+        {
+            $id: '<DOCUMENT_ID>',
+            $permissions: [Permission.read(Role.any())],
+            // your document data
+            title: 'Example Document',
+            content: 'Document content here'
+        }
+    ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/databases/upsert-documents.md` at line 13, Replace the empty
documents array used in the example by providing a representative sample
document so users see the expected structure; update the documents: [] entry to
include at least one object showing common keys (e.g., id or _id, text or
content, and a metadata object with example fields like author, timestamp, tags)
and a brief realistic text value so callers of the documents array (the
documents variable) know required/optional fields and types.
docs/examples/documentsdb/list-documents.md (1)

16-16: Consider clarifying the TTL parameter value.

The example shows ttl: 0, which may not represent a meaningful cache duration. Consider using a positive example value (e.g., ttl: 3600) or adding a comment indicating valid ranges to help users understand appropriate values.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/list-documents.md` at line 16, The example uses
ttl: 0 which is ambiguous; update the example in list-documents.md to show a
meaningful positive TTL (e.g., ttl: 3600) or add an inline comment clarifying
valid ranges/semantics for the ttl parameter so readers understand it represents
seconds and that 0 may mean no caching or immediate expiry; locate the ttl
example near the documentsdb listing and replace or annotate the ttl: 0 line
accordingly.
docs/examples/documentsdb/update-document.md (1)

14-14: Enhance example with sample update data.

The empty data: {} object doesn't demonstrate what fields can be updated. Consider adding example fields to show users the expected structure.

📚 Suggested improvement
-    data: {}, // optional
+    data: { // optional
+        username: 'walter.obrien.updated',
+        age: 31
+    },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/update-document.md` at line 14, The example uses an
empty update payload (`data: {}`) which doesn't illustrate allowed fields;
replace it with a concrete sample object (e.g., `data` containing fields such as
title, content or summary, tags array, and metadata/lastModified) so readers see
the expected structure and common updatable keys; update the example line that
currently shows `data: {}` to include those sample fields and keep values
realistic but non-sensitive to clarify usage.
docs/examples/documentsdb/decrement-document-attribute.md (1)

14-14: Use a meaningful placeholder for the attribute parameter.

The empty string '' is not a valid attribute name and may confuse users. Consider using a descriptive placeholder or example value to demonstrate proper usage.

📝 Suggested improvement
-    attribute: '',
+    attribute: 'itemCount', // or use '<ATTRIBUTE_NAME>' as placeholder
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples/documentsdb/decrement-document-attribute.md` at line 14, The
example uses an empty string for the attribute parameter which is invalid and
confusing; update the example in decrement-document-attribute.md to use a
meaningful placeholder attribute name (e.g., "count" or "stock") wherever the
attribute: '' appears so readers see a real attribute name to decrement, and
ensure any explanatory text or adjacent examples reflect that same placeholder
(look for the attribute property in the example block).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/examples/documentsdb/increment-document-attribute.md`:
- Around line 14-16: The example passes an empty attribute and uses null for
numeric optionals which is invalid; update the snippet so "attribute" is a
meaningful placeholder (e.g., "count" or "views") and either omit the optional
numeric fields or provide valid numbers (e.g., value: 1, max: 10) instead of
null so it matches the API signature value?: number and max?: number.

In `@docs/examples/documentsdb/update-transaction.md`:
- Around line 10-14: The example for documentsDB.updateTransaction is confusing
because it sets both commit: false and rollback: false; update the snippet to
show a realistic workflow by demonstrating one action only (either commit or
rollback). Replace the current example with a commit scenario (set commit: true
and omit rollback) or a rollback scenario (set rollback: true and omit commit),
keeping the transactionId placeholder intact and ensuring the call still uses
documentsDB.updateTransaction and the transactionId, commit, and rollback
parameter names.

In `@docs/examples/vectorsdb/update-transaction.md`:
- Around line 10-14: The example for vectorsDB.updateTransaction is misleading
by setting both commit: false and rollback: false; update the snippet to show a
realistic single-action usage (either commit or rollback). For a commit example
call vectorsDB.updateTransaction({ transactionId: '<TRANSACTION_ID>', commit:
true }) and for a rollback example call vectorsDB.updateTransaction({
transactionId: '<TRANSACTION_ID>', rollback: true }); omit the opposite flag in
each case (or leave it false) so the intended workflow is clear.

In `@README.md`:
- Line 9: The README's server compatibility line conflicts with CHANGELOG.md and
src/index.ts; pick the authoritative target version (e.g., 1.8.x or 1.9.x) and
update all references to match: edit the README sentence that currently says
"This SDK is compatible with Appwrite server version 1.9.x" to the chosen
version, and update the version string in src/index.ts and CHANGELOG.md so all
three sources are identical; ensure the chosen version is used consistently
across README.md, CHANGELOG.md, and src/index.ts.

In `@src/services/documents-db.ts`:
- Around line 421-576: Modify the createDocument and createDocuments helpers to
accept an optional transactionId parameter: add transactionId to the params
object type and to the deprecated positional/rest signatures (for createDocument
it's the 5th/rest[3] param, for createDocuments it's the 3rd/rest[1] param),
extract const transactionId = params.transactionId, validate presence only as
optional (no required check), and include payload['transactionId'] =
transactionId when defined before calling this.client.call; update both
createDocument and createDocuments implementations to handle the new param for
object-style and positional-style invocation.

In `@src/services/vectors-db.ts`:
- Around line 77-89: The overload normalization in createTransaction currently
drops a caller-supplied ttl when passed as 0 because it uses falsy check on
paramsOrFirst; update the conditional to test typeof paramsOrFirst ===
'undefined' (and similarly replace the internal falsy check) so that numeric 0
is preserved and params is set to { ttl: paramsOrFirst as number } when a number
is passed, ensuring createTransaction(paramsOrFirst) correctly normalizes ttl =
0 into params.

---

Nitpick comments:
In `@docs/examples/databases/upsert-documents.md`:
- Line 13: Replace the empty documents array used in the example by providing a
representative sample document so users see the expected structure; update the
documents: [] entry to include at least one object showing common keys (e.g., id
or _id, text or content, and a metadata object with example fields like author,
timestamp, tags) and a brief realistic text value so callers of the documents
array (the documents variable) know required/optional fields and types.

In `@docs/examples/documentsdb/decrement-document-attribute.md`:
- Line 14: The example uses an empty string for the attribute parameter which is
invalid and confusing; update the example in decrement-document-attribute.md to
use a meaningful placeholder attribute name (e.g., "count" or "stock") wherever
the attribute: '' appears so readers see a real attribute name to decrement, and
ensure any explanatory text or adjacent examples reflect that same placeholder
(look for the attribute property in the example block).

In `@docs/examples/documentsdb/list-documents.md`:
- Line 16: The example uses ttl: 0 which is ambiguous; update the example in
list-documents.md to show a meaningful positive TTL (e.g., ttl: 3600) or add an
inline comment clarifying valid ranges/semantics for the ttl parameter so
readers understand it represents seconds and that 0 may mean no caching or
immediate expiry; locate the ttl example near the documentsdb listing and
replace or annotate the ttl: 0 line accordingly.

In `@docs/examples/documentsdb/update-document.md`:
- Line 14: The example uses an empty update payload (`data: {}`) which doesn't
illustrate allowed fields; replace it with a concrete sample object (e.g.,
`data` containing fields such as title, content or summary, tags array, and
metadata/lastModified) so readers see the expected structure and common
updatable keys; update the example line that currently shows `data: {}` to
include those sample fields and keep values realistic but non-sensitive to
clarify usage.

In `@docs/examples/vectorsdb/list-documents.md`:
- Around line 10-17: Clarify the ttl parameter in the vectorsDB.listDocuments
example by updating the inline comment for ttl to state what 0 means (e.g., "0 =
no caching" or "0 = use default server TTL") so readers know the behavior;
change the comment next to ttl in the vectorsDB.listDocuments call to explicitly
describe the intended semantics of 0 and, if relevant, list other accepted
values or refer to the API docs for default behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 18b6e6d2-484f-4b00-bffa-91d4fcfc14a5

📥 Commits

Reviewing files that changed from the base of the PR and between cf65e76 and 0c4b515.

📒 Files selected for processing (38)
  • CHANGELOG.md
  • README.md
  • docs/examples/databases/upsert-documents.md
  • docs/examples/documentsdb/create-document.md
  • docs/examples/documentsdb/create-documents.md
  • docs/examples/documentsdb/create-operations.md
  • docs/examples/documentsdb/create-transaction.md
  • docs/examples/documentsdb/decrement-document-attribute.md
  • docs/examples/documentsdb/delete-document.md
  • docs/examples/documentsdb/delete-transaction.md
  • docs/examples/documentsdb/get-document.md
  • docs/examples/documentsdb/get-transaction.md
  • docs/examples/documentsdb/increment-document-attribute.md
  • docs/examples/documentsdb/list-documents.md
  • docs/examples/documentsdb/list-transactions.md
  • docs/examples/documentsdb/update-document.md
  • docs/examples/documentsdb/update-transaction.md
  • docs/examples/documentsdb/upsert-document.md
  • docs/examples/vectorsdb/create-document.md
  • docs/examples/vectorsdb/create-operations.md
  • docs/examples/vectorsdb/create-transaction.md
  • docs/examples/vectorsdb/delete-document.md
  • docs/examples/vectorsdb/delete-transaction.md
  • docs/examples/vectorsdb/get-document.md
  • docs/examples/vectorsdb/get-transaction.md
  • docs/examples/vectorsdb/list-documents.md
  • docs/examples/vectorsdb/list-transactions.md
  • docs/examples/vectorsdb/update-document.md
  • docs/examples/vectorsdb/update-transaction.md
  • docs/examples/vectorsdb/upsert-document.md
  • package.json
  • rollup.config.js
  • src/client.ts
  • src/index.ts
  • src/models.ts
  • src/services/databases.ts
  • src/services/documents-db.ts
  • src/services/vectors-db.ts

Comment thread docs/examples/documentsdb/increment-document-attribute.md Outdated
Comment thread docs/examples/documentsdb/update-transaction.md Outdated
Comment thread docs/examples/vectorsdb/update-transaction.md Outdated
Comment thread README.md
Comment thread src/services/documents-db.ts Outdated
Comment thread src/services/vectors-db.ts Outdated
@ChiragAgg5k ChiragAgg5k changed the title feat: Web SDK update for version 23.0.0 feat: Web SDK update for version 24.0.0 Mar 25, 2026
@abnegate abnegate merged commit 10c6a81 into main Mar 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants