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 (adds session configuration in samples).
  • 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

Warning

Rate limit exceeded

@abnegate has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 27 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 37ef231 and 1f96d64.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)

Walkthrough

This PR updates many documentation examples to chain a new .setSession('') call onto Client initialization (removing terminating semicolons). It extends SDK service APIs: Databases.createCollection now accepts optional attributes?: object[] and indexes?: object[]; TablesDB.createTable now accepts optional columns?: object[] and indexes?: object[]. It adds a changelog entry for 21.1.0 and bumps the package/SDK version to 21.1.0 (package.json and src/client.ts).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check overload signatures and param propagation in src/services/databases.ts and src/services/tables-db.ts.
  • Verify payload assembly only includes attributes/columns and indexes when provided and that serialization is correct.
  • Confirm optional typing and parameter ordering are consistent across overloads.
  • Scan updated docs for syntax errors from removed semicolons and consistent placement of .setSession('').
  • Validate version bump and changelog entry match package metadata.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims version 21.0.0 but the actual changes update to version 21.1.0 (in package.json, src/client.ts, and CHANGELOG.md), making the title inaccurate and misleading. Update the PR title to accurately reflect the version change: 'feat: Node.js SDK update for version 21.1.0' or 'feat: Add session configuration and collection/table creation attributes support for v21.1.0'.
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.

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).

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

🧹 Nitpick comments (1)
src/services/databases.ts (1)

741-848: createCollection attributes/indexes extension is correctly wired and backward‑compatible

The new attributes/indexes parameters are consistently added across JSDoc, both overload signatures, the dispatcher (paramsOrFirst + rest), local destructuring, and payload construction. Existing positional calls remain valid because the new params are appended and optional. Using object[] for these definition arrays is also consistent with other array‑of‑object params in this SDK.

If you want to tighten things up later, you could consider introducing lightweight TS types (e.g. CreateCollectionAttributeDefinition, CreateCollectionIndexDefinition) instead of plain object[] to give consumers better tooling and keep the shapes in sync with the REST API, but that’s a nice‑to‑have rather than a blocker.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 704d46f and 37ef231.

📒 Files selected for processing (1)
  • src/services/databases.ts (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 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.
🧬 Code graph analysis (1)
src/services/databases.ts (1)
src/models.ts (1)
  • Collection (556-597)

@abnegate abnegate merged commit 4bede25 into main Dec 18, 2025
2 checks 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.

3 participants