Conversation
WalkthroughThis patch release (22.1.1) adds a new Activities service with listEvents and getEvent plus ActivityEvent and ActivityEventList models; introduces an optional encrypt boolean on many text-related attribute/column create/update APIs in Databases and TablesDB; extends Query with containsAny and containsAll; expands Runtime and BuildRuntime enums with many new entries; adds Scopes entries (SchedulesRead, SchedulesWrite, EventsRead); replaces direct BigNumber checks with an internal isBigNumber helper in the client; and updates documentation, README, CHANGELOG, and package version strings. Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/client.ts (1)
11-18: Reasonable duck-typing to decouple from a directbignumber.jsimport.The helper mirrors what
BigNumber.isBigNumber()checks internally (the_isBigNumberflag) and adds method-existence guards for extra safety. Since it's only invoked inside the JSONreviver(where values originate fromjson-bigint), the false-positive risk is negligible.Worth noting: the
_isBigNumberproperty is an internal implementation detail of bignumber.js. If the transitive dependency (viajson-bigint@1.0.0) ever changes that flag, this will silently stop converting big numbers. The pinnedjson-bigintversion mitigates this, but a brief inline comment documenting why this shape is checked would help future maintainers.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/client.ts` around lines 11 - 18, Add a brief inline comment above the isBigNumber function explaining that the shape-check (checking _isBigNumber plus method existence for isInteger/toFixed/toNumber) is intentional duck-typing to avoid a hard dependency on bignumber.js, that the check mirrors BigNumber.isBigNumber and is used only by the JSON reviver (values come from json-bigint@1.0.0), and note the risk that if the transitive dependency changes the internal _isBigNumber flag this conversion will stop working — mention the pinned json-bigint version as the current mitigation.src/services/activities.ts (1)
29-40: Simplify the redundant dispatch condition inlistEvents.Inside the
||, theparamsOrFirst &&prefix is unreachable-if-false (the left arm!paramsOrFirstalready handles the falsy case), and!Array.isArray(paramsOrFirst)is redundant because the union type{ queries?: string } | stringnever contains an array.♻️ Simplified condition
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + if (!paramsOrFirst || typeof paramsOrFirst === 'object') {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/services/activities.ts` around lines 29 - 40, The conditional in listEvents is overly complex and contains unreachable/redundant checks; simplify it by distinguishing string vs object directly: replace the current if (...) that uses "!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))" with a clear branch such as "if (!paramsOrFirst || typeof paramsOrFirst === 'object')" to treat paramsOrFirst as the params object (assigning params = (paramsOrFirst || {}) as { queries?: string }), and use an else branch for the string case (params = { queries: paramsOrFirst as string }); reference function name listEvents and parameter paramsOrFirst when making this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Around line 3-8: The 22.1.1 changelog is missing several feature entries and
intermediate versions; update the 22.1.1 section to list the new Activities
service (methods: listEvents, getEvent), new Query methods containsAny and
containsAll, new Scopes enumerations (SchedulesRead, SchedulesWrite,
EventsRead), added BuildRuntime enum values, and the new encrypt parameter on
text-like column creation methods (createStringColumn, createLongtextColumn,
createMediumtextColumn) and then reorder or insert missing release headers so
changelog no longer jumps from 22.1.1 to 20.3.0 (add entries for 22.1.0, 22.0.0,
and 21.x as appropriate) so the history is complete and each feature is
attributed to the correct release.
In `@src/models.ts`:
- Around line 4488-4491: The JSDoc for the property clientEngineVersion is
incorrect; update the comment text above the clientEngineVersion field to read
"Client engine version." instead of "Client engine name." to match the property
semantics (see adjacent clientEngine for reference) so the documentation
accurately describes the clientEngineVersion property.
In `@src/services/activities.ts`:
- Around line 12-28: The two overloaded listEvents method signatures and their
JSDoc are incorrect: change the parameter type from string to string[] for both
overloads and update the `@param` JSDoc annotations to `@param` {string[]} (or
describe as an array of strings) so the method signature and docs match the
intended "Array of query strings" behavior; update references to the parameter
name (queries) in both the object-style overload listEvents(params?: { queries?:
string[] }) and the deprecated overload listEvents(queries?: string[]) and
ensure the return type and throws remain unchanged.
---
Nitpick comments:
In `@src/client.ts`:
- Around line 11-18: Add a brief inline comment above the isBigNumber function
explaining that the shape-check (checking _isBigNumber plus method existence for
isInteger/toFixed/toNumber) is intentional duck-typing to avoid a hard
dependency on bignumber.js, that the check mirrors BigNumber.isBigNumber and is
used only by the JSON reviver (values come from json-bigint@1.0.0), and note the
risk that if the transitive dependency changes the internal _isBigNumber flag
this conversion will stop working — mention the pinned json-bigint version as
the current mitigation.
In `@src/services/activities.ts`:
- Around line 29-40: The conditional in listEvents is overly complex and
contains unreachable/redundant checks; simplify it by distinguishing string vs
object directly: replace the current if (...) that uses "!paramsOrFirst ||
(paramsOrFirst && typeof paramsOrFirst === 'object' &&
!Array.isArray(paramsOrFirst))" with a clear branch such as "if (!paramsOrFirst
|| typeof paramsOrFirst === 'object')" to treat paramsOrFirst as the params
object (assigning params = (paramsOrFirst || {}) as { queries?: string }), and
use an else branch for the string case (params = { queries: paramsOrFirst as
string }); reference function name listEvents and parameter paramsOrFirst when
making this change.
| ## 22.1.1 | ||
|
|
||
| * Fix doc examples with proper formatting | ||
| * Add support for the new `Backups` service | ||
|
|
||
| ## 22.0.0 | ||
|
|
||
| * Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`). | ||
| * Breaking change: `Output` enum has been removed; use `ImageFormat` instead. | ||
| * Add `getQueueAudits` support to `Health` service. | ||
| * Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. | ||
|
|
||
| ## 21.1.0 | ||
|
|
||
| * Added ability to create columns and indexes synchronously while creating a table | ||
|
|
||
| ## 21.0.0 | ||
|
|
||
| * Rename `VCSDeploymentType` enum to `VCSReferenceType` | ||
| * Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters | ||
| * Add `getScreenshot` method to `Avatars` service | ||
| * Add `Theme`, `Timezone` and `Output` enums | ||
| * Removed unused BigNumber import from src/client.ts to clean up dependencies | ||
| * Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples | ||
| * Updated README to specify Appwrite server compatibility with 1.8.x | ||
| * Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check git history for CHANGELOG.md changes
echo "=== Git log for CHANGELOG.md (last 10 commits) ==="
git log --oneline -10 -- CHANGELOG.md
echo ""
echo "=== Diff of previous version of CHANGELOG.md ==="
git show HEAD~1:CHANGELOG.md 2>/dev/null | head -150Repository: appwrite/sdk-for-node
Length of output: 181
🏁 Script executed:
#!/bin/bash
# First, check the size of CHANGELOG.md
wc -l CHANGELOG.md
echo ""
echo "=== Full CHANGELOG.md content ==="
cat CHANGELOG.mdRepository: appwrite/sdk-for-node
Length of output: 3936
🏁 Script executed:
#!/bin/bash
# Search for Activities service
echo "=== Searching for Activities service ==="
rg "class Activities|service.*Activities" src/ --type ts --type js -i | head -20
echo ""
echo "=== Searching for containsAny/containsAll Query methods ==="
rg "containsAny|containsAll" src/ --type ts --type js | head -20
echo ""
echo "=== Searching for Scopes enum/entries ==="
rg "SchedulesRead|SchedulesWrite|EventsRead" src/ --type ts --type js | head -20
echo ""
echo "=== Searching for encrypt parameter ==="
rg "encrypt.*:.*bool|encrypt.*:.*false" src/ --type ts --type js | head -30Repository: appwrite/sdk-for-node
Length of output: 7582
🏁 Script executed:
#!/bin/bash
echo "=== Searching for BuildRuntime enum ==="
rg "enum BuildRuntime|class BuildRuntime" src/ --type ts --type js -A 20 | head -50
echo ""
echo "=== Checking Activities service methods ==="
rg "listEvents|getEvent" src/services/activities.ts -A 2 | head -20Repository: appwrite/sdk-for-node
Length of output: 1848
Add missing 22.1.1 changelog entries for new features.
The 22.1.1 section omits several notable additions shipped in this release:
- New
Activitiesservice withlistEventsandgetEventmethods - New
Querymethods:containsAnyandcontainsAll - New
Scopesentries:SchedulesRead,SchedulesWrite,EventsRead - New
BuildRuntimeenum entries - New
encryptparameter on text-like column creation methods (createStringColumn,createLongtextColumn,createMediumtextColumn)
The changelog also jumps from 22.1.1 directly to 20.3.0, with entries for 22.1.0, 22.0.0, and 21.x versions missing.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CHANGELOG.md` around lines 3 - 8, The 22.1.1 changelog is missing several
feature entries and intermediate versions; update the 22.1.1 section to list the
new Activities service (methods: listEvents, getEvent), new Query methods
containsAny and containsAll, new Scopes enumerations (SchedulesRead,
SchedulesWrite, EventsRead), added BuildRuntime enum values, and the new encrypt
parameter on text-like column creation methods (createStringColumn,
createLongtextColumn, createMediumtextColumn) and then reorder or insert missing
release headers so changelog no longer jumps from 22.1.1 to 20.3.0 (add entries
for 22.1.0, 22.0.0, and 21.x as appropriate) so the history is complete and each
feature is attributed to the correct release.
| /** | ||
| * Client engine name. | ||
| */ | ||
| clientEngineVersion: string; |
There was a problem hiding this comment.
Doc comment for clientEngineVersion incorrectly reads "Client engine name."
Should be "Client engine version." — the comment was likely copied verbatim from the adjacent clientEngine field.
📝 Proposed fix
/**
- * Client engine name.
+ * Client engine version.
*/
clientEngineVersion: string;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Client engine name. | |
| */ | |
| clientEngineVersion: string; | |
| /** | |
| * Client engine version. | |
| */ | |
| clientEngineVersion: string; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/models.ts` around lines 4488 - 4491, The JSDoc for the property
clientEngineVersion is incorrect; update the comment text above the
clientEngineVersion field to read "Client engine version." instead of "Client
engine name." to match the property semantics (see adjacent clientEngine for
reference) so the documentation accurately describes the clientEngineVersion
property.
| /** | ||
| * List all events for selected filters. | ||
| * | ||
| * @param {string} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.ActivityEventList>} | ||
| */ | ||
| listEvents(params?: { queries?: string }): Promise<Models.ActivityEventList>; | ||
| /** | ||
| * List all events for selected filters. | ||
| * | ||
| * @param {string} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.ActivityEventList>} | ||
| * @deprecated Use the object parameter style method for a better developer experience. | ||
| */ | ||
| listEvents(queries?: string): Promise<Models.ActivityEventList>; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check the structure of the src/services directory
git ls-files src/services/ | head -20Repository: appwrite/sdk-for-node
Length of output: 450
🏁 Script executed:
# Check the activities.ts file at the specified lines
cat -n src/services/activities.ts | sed -n '12,28p'Repository: appwrite/sdk-for-node
Length of output: 1369
🏁 Script executed:
# Search for queries parameter types across service files
rg -n --type=ts 'queries\??\s*:' src/services/ | grep -E '(string|queries)' | head -30Repository: appwrite/sdk-for-node
Length of output: 3828
🏁 Script executed:
# Check databases.ts for queries parameter types
rg -n --type=ts 'queries' src/services/databases.ts | head -20Repository: appwrite/sdk-for-node
Length of output: 2161
🏁 Script executed:
# Do a broader search to see all queries parameter declarations in activities.ts
rg -n --type=ts 'queries' src/services/activities.tsRepository: appwrite/sdk-for-node
Length of output: 1238
🏁 Script executed:
# Check a few more service files to confirm the pattern
rg -n --type=ts 'queries\??\s*:\s*string\[\]' src/services/ | wc -l
rg -n --type=ts 'queries\??\s*:\s*string[^[]' src/services/ | wc -lRepository: appwrite/sdk-for-node
Length of output: 202
Fix queries parameter type and JSDoc in listEvents() methods.
The queries parameter is typed as string but should be string[]. The JSDoc explicitly states "Array of query strings" and "Maximum of 100 queries are allowed," yet both overloads declare queries as string instead of string[]. Additionally, the JSDoc incorrectly annotates the type as @param {string} when it should be @param {string[]}.
All other Appwrite SDK services (Databases, Users, Tokens, etc.) consistently use string[] for this parameter. This type mismatch will cause TypeScript callers to send a single string where an array is expected, leading to runtime failures.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/activities.ts` around lines 12 - 28, The two overloaded
listEvents method signatures and their JSDoc are incorrect: change the parameter
type from string to string[] for both overloads and update the `@param` JSDoc
annotations to `@param` {string[]} (or describe as an array of strings) so the
method signature and docs match the intended "Array of query strings" behavior;
update references to the parameter name (queries) in both the object-style
overload listEvents(params?: { queries?: string[] }) and the deprecated overload
listEvents(queries?: string[]) and ensure the return type and throws remain
unchanged.
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@CHANGELOG.md`:
- Around line 3-8: Update the 22.1.1 changelog entry to include all user-facing
features added in this release: add bullets for the new Activities service
(listEvents, getEvent), new models ActivityEvent and ActivityEventList, new
Query helper functions containsAny and containsAll, new Scopes entries
(SchedulesRead, SchedulesWrite, EventsRead), new BuildRuntime/Runtime enum
values, and the new optional encrypt parameter on text-like attribute/column
creation/update methods in Databases and TablesDB; ensure each bullet references
the exact symbol names (Activities, listEvents, getEvent, ActivityEvent,
ActivityEventList, containsAny, containsAll, SchedulesRead, SchedulesWrite,
EventsRead, BuildRuntime, Runtime, encrypt, Databases, TablesDB) and is phrased
consistently with the existing changelog style.
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@CHANGELOG.md`:
- Around line 3-8: Update the 22.1.1 changelog entry to list the new public API
additions discovered in the PR: add an "API additions" subsection that documents
the new Activities service (class/namespace Activities) with its listEvents and
getEvent methods (src/services/activities.ts), the new Query helper functions
containsAny and containsAll, the new Scopes enum entries SchedulesRead,
SchedulesWrite and EventsRead, the additional BuildRuntime enum values, and the
new optional encrypt parameter on createStringColumn, createLongtextColumn,
createMediumtextColumn and related Databases / TablesDB attribute/column
creation methods; make each bullet concise and reference the method/enum names
exactly so users can find them in the code/docs.
This PR contains updates to the Node.js SDK for version 22.1.1 .
Summary by CodeRabbit
New Features
Documentation
Chores