Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Dec 17, 2025

This PR contains updates to the Node.js SDK for version 21.0.0.

Summary by CodeRabbit

  • New Features

    • Collections can include optional attributes and indexes during creation.
    • Tables can include optional columns and indexes during creation.
  • Documentation

    • Account examples updated to show session-based client initialization.
  • Chores

    • Package and SDK version bumped to 21.1.0 and changelog updated.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

This pull request updates many documentation examples to chain a new .setSession('') call onto the Client initialization (removing the terminating semicolons) and expands SDK APIs to support schema-like definitions: createCollection in src/services/databases.ts now accepts optional attributes?: object[] and indexes?: object[], and createTable in src/services/tables-db.ts now accepts optional columns?: object[] and indexes?: object[]. Package metadata and SDK version identifiers are bumped to 21.1.0 and a changelog entry for 21.1.0 is added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Changes are a mix of many repetitive documentation edits and focused API surface extensions in two service files plus a version bump.
  • Review attention recommended for:
    • Correct overload signatures and param propagation in src/services/databases.ts and src/services/tables-db.ts.
    • Payload assembly to ensure attributes/columns and indexes are only included when provided and serialized correctly.
    • Consistent optional typing and ordering of new parameters across all overloads and doc examples.
    • Consistency of .setSession('') placement across updated docs and no accidental syntax errors from removed semicolons.
    • Version bumps in package.json, src/client.ts, and the new changelog entry.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title states version 21.0.0, but the actual changes update the SDK to version 21.1.0 as shown in package.json and other files. Update the PR title to 'feat: Node.js SDK update for version 21.1.0' to match the actual version bump and changes in the changeset.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e4561a and 704d46f.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • package.json (1 hunks)
  • src/client.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: abnegate Repo: appwrite/sdk-for-node PR: 121 File: docs/examples/databases/create-line-attribute.md:10-16 Timestamp: 2025-09-05T09:48:56.219Z Learning: Documentation examples in .md files in the Appwrite Node.js SDK are illustrative and don't need to be strictly correct or executable code. They focus on showing API structure and usage patterns rather than being copy-paste ready. 
📚 Learning: 2025-09-05T09:48:56.219Z
Learnt from: abnegate Repo: appwrite/sdk-for-node PR: 121 File: docs/examples/databases/create-line-attribute.md:10-16 Timestamp: 2025-09-05T09:48:56.219Z Learning: Documentation examples in .md files in the Appwrite Node.js SDK are illustrative and don't need to be strictly correct or executable code. They focus on showing API structure and usage patterns rather than being copy-paste ready. 

Applied to files:

  • package.json
🔇 Additional comments (2)
package.json (1)

5-5: LGTM! Version bump aligns with feature additions.

The minor version increment to 21.1.0 is appropriate for the backward-compatible API additions mentioned in the changelog.

src/client.ts (1)

36-36: LGTM! Version identifiers updated consistently.

Both the user agent string and the SDK version header have been updated to 21.1.0, maintaining consistency across the SDK's identification metadata.

Also applies to: 85-85


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

@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: 0

♻️ Duplicate comments (1)
docs/examples/account/create-mfa-challenge.md (1)

5-6: Same setSession chaining pattern as other account examples

This matches the updated client initialization pattern shown in the other account docs and keeps usage consistent.

🧹 Nitpick comments (1)
src/services/tables-db.ts (1)

744-828: Optional: consider stronger typing for columns and indexes

Right now both are typed as object[], which is flexible but loses IDE help and compile-time checks for the documented shapes (keys, types, attributes, orders, etc.). If/when dedicated input models (or reusable request-side versions of Models.Column* / Models.ColumnIndex) are available, tightening these to concrete types would improve DX without changing runtime behavior.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec7998e and 2e4561a.

📒 Files selected for processing (16)
  • docs/examples/account/create-anonymous-session.md (1 hunks)
  • docs/examples/account/create-email-password-session.md (1 hunks)
  • docs/examples/account/create-email-token.md (1 hunks)
  • docs/examples/account/create-jwt.md (1 hunks)
  • docs/examples/account/create-magic-url-token.md (1 hunks)
  • docs/examples/account/create-mfa-challenge.md (1 hunks)
  • docs/examples/account/create-o-auth-2-token.md (1 hunks)
  • docs/examples/account/create-phone-token.md (1 hunks)
  • docs/examples/account/create-session.md (1 hunks)
  • docs/examples/account/create.md (1 hunks)
  • docs/examples/account/update-magic-url-session.md (1 hunks)
  • docs/examples/account/update-phone-session.md (1 hunks)
  • docs/examples/databases/create-collection.md (1 hunks)
  • docs/examples/tablesdb/create-table.md (1 hunks)
  • src/services/databases.ts (4 hunks)
  • src/services/tables-db.ts (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: abnegate Repo: appwrite/sdk-for-node PR: 121 File: docs/examples/databases/create-line-attribute.md:10-16 Timestamp: 2025-09-05T09:48:56.219Z Learning: Documentation examples in .md files in the Appwrite Node.js SDK are illustrative and don't need to be strictly correct or executable code. They focus on showing API structure and usage patterns rather than being copy-paste ready. 
📚 Learning: 2025-09-05T09:48:56.219Z
Learnt from: abnegate Repo: appwrite/sdk-for-node PR: 121 File: docs/examples/databases/create-line-attribute.md:10-16 Timestamp: 2025-09-05T09:48:56.219Z Learning: Documentation examples in .md files in the Appwrite Node.js SDK are illustrative and don't need to be strictly correct or executable code. They focus on showing API structure and usage patterns rather than being copy-paste ready. 

Applied to files:

  • docs/examples/account/create-session.md
  • docs/examples/account/create.md
  • docs/examples/account/update-phone-session.md
  • docs/examples/account/create-jwt.md
  • docs/examples/account/create-anonymous-session.md
  • docs/examples/account/create-phone-token.md
  • docs/examples/account/create-o-auth-2-token.md
  • docs/examples/account/update-magic-url-session.md
  • docs/examples/account/create-mfa-challenge.md
  • docs/examples/account/create-magic-url-token.md
  • docs/examples/account/create-email-password-session.md
  • docs/examples/account/create-email-token.md
🧬 Code graph analysis (2)
src/services/databases.ts (1)
src/models.ts (1)
  • Collection (556-597)
src/services/tables-db.ts (1)
src/models.ts (1)
  • Table (1230-1271)
🔇 Additional comments (10)
docs/examples/account/update-phone-session.md (1)

5-6: Verify that Client.setSession() method exists in the source code.

The documentation adds .setSession('') to the client initialization chain across multiple account examples. Please confirm that this method has been implemented in the Client class with proper chainable return type. Since the source code files (src/services/client.ts or equivalent) are not provided in this review, I cannot verify the implementation.

docs/examples/databases/create-collection.md (1)

16-18: Verify that createCollection() accepts the new attributes and indexes parameters.

The documentation now shows optional attributes: [] and indexes: [] parameters in the createCollection method. Please confirm that the implementation in src/services/databases.ts has been updated to accept these parameters and properly includes them in the request payload.

docs/examples/tablesdb/create-table.md (1)

16-18: Verify that createTable() accepts the new columns and indexes parameters.

The documentation now shows optional columns: [] and indexes: [] parameters in the createTable method. Please confirm that the implementation in src/services/tables-db.ts has been updated to accept these parameters and properly includes them in the request payload.

docs/examples/account/create.md (1)

5-6: Client chaining with setSession looks consistent

The new .setSession('') step fits the existing fluent client configuration and keeps the example readable; no issues from an SDK-usage perspective. Based on learnings, these examples are illustrative rather than copy‑paste ready.

docs/examples/account/create-email-token.md (1)

5-6: Consistent client/session initialization

The added .setSession('') call aligns this example with the other account docs’ client setup, so the pattern is uniform across flows.

docs/examples/account/create-session.md (1)

5-6: Fluent client + session chain looks good

Using .setSession('') here matches the new authentication pattern in the other examples and keeps the fluent API style intact.

docs/examples/account/update-magic-url-session.md (1)

5-6: Uniform client configuration across account docs

The added setSession call keeps this magic‑URL example in sync with the other updated account examples’ client setup.

docs/examples/account/create-jwt.md (1)

5-6: Good showcase of new Client.setSession API

This example cleanly demonstrates the new setSession step in the fluent client chain and matches the rest of the updated account examples.

src/services/databases.ts (1)

741-835: createCollection overload and payload wiring look correct

The new optional attributes/indexes parameters are threaded consistently through the overload signatures, positional rest tuple, local params object, and conditional payload fields, so this extends the API surface without breaking existing callers.

src/services/tables-db.ts (1)

735-841: createTable overload and payload wiring look correct

The new columns/indexes parameters are threaded consistently through the JSDoc, both overload signatures, the internal params object, and the request payload. Required parameter checks remain unchanged, and existing positional-callers stay backward compatible because the new arguments are appended and optional. This aligns with the Models.Table shape that already exposes columns and indexes (see src/models.ts:1229-1270).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants