-
Notifications
You must be signed in to change notification settings - Fork 40
feat: Command Line SDK update for version 11.1.0 #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request bumps the CLI version from 11.0.0 to 11.1.0 and introduces a new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20-25 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ 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 |
CHANGELOG.md
Outdated
| ## 11.1.0 | ||
|
|
||
| * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance | ||
| * Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like cli only has changes for total, i dont see operator class added. lets remove this changelog if its intentional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
lib/commands/projects.js (1)
2118-2120: Minor UX: document default and broaden boolean parsing (optional).
- Consider updating option help to say “Default: true”.
- Optionally accept case-insensitive true/false and 1/0 in parseBool for CLI ergonomics.
Example change in parser.js (outside this file):
-const parseBool = (value) => { - if (value === 'true') return true; - if (value === 'false') return false; - throw new commander.InvalidArgumentError('Not a boolean.'); -} +const parseBool = (value) => { + const v = String(value).trim().toLowerCase(); + if (v === 'true' || v === '1' || v === 'yes') return true; + if (v === 'false' || v === '0' || v === 'no') return false; + throw new commander.InvalidArgumentError('Not a boolean (expected true/false, 1/0, yes/no).'); +}Also applies to: 2316-2319, 2368-2371, 2519-2522
lib/commands/sites.js (1)
1363-1366: Optional: clarify default in help and improve parseBool.
- Append “Default: true” in option descriptions.
- Consider enhancing parseBool to accept 1/0, yes/no, case-insensitive, as shown in projects comment.
Also applies to: 1475-1478, 1554-1556
lib/commands/account.js (1)
1776-1777: Optional: CLI help default + tolerant boolean parsing.Same suggestions as other files: mention “Default: true” and consider broadening parseBool.
Also applies to: 1794-1795
lib/commands/teams.js (1)
562-565: Optional: CLI help default + tolerant boolean parsing.Mirror the minor UX improvements suggested in projects/sites.
Also applies to: 599-601, 608-610
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (22)
CHANGELOG.md(1 hunks)README.md(2 hunks)install.ps1(1 hunks)install.sh(1 hunks)lib/client.js(1 hunks)lib/commands/account.js(6 hunks)lib/commands/databases.js(18 hunks)lib/commands/functions.js(15 hunks)lib/commands/messaging.js(28 hunks)lib/commands/migrations.js(4 hunks)lib/commands/projects.js(13 hunks)lib/commands/proxy.js(4 hunks)lib/commands/sites.js(11 hunks)lib/commands/storage.js(8 hunks)lib/commands/tables-db.js(18 hunks)lib/commands/teams.js(11 hunks)lib/commands/tokens.js(3 hunks)lib/commands/users.js(21 hunks)lib/commands/vcs.js(4 hunks)lib/parser.js(1 hunks)package.json(1 hunks)scoop/appwrite.config.json(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (15)
lib/commands/tokens.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/commands/proxy.js (1)
lib/parser.js (1)
parseBool(176-180)
lib/commands/teams.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/commands/migrations.js (1)
lib/parser.js (1)
parseBool(176-180)
lib/commands/account.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/commands/vcs.js (1)
lib/parser.js (1)
parseBool(176-180)
lib/commands/users.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/commands/databases.js (2)
lib/commands/push.js (2)
databasesListAttributes(112-117)databasesListIndexes(145-150)lib/parser.js (1)
parseBool(176-180)
lib/commands/functions.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/client.js (2)
lib/parser.js (1)
os(6-6)lib/config.js (1)
os(1-1)
lib/commands/storage.js (1)
lib/parser.js (1)
parseBool(176-180)
lib/commands/tables-db.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/commands/messaging.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
lib/commands/projects.js (2)
lib/sdks.js (1)
sdkForConsole(4-22)lib/parser.js (1)
parseBool(176-180)
lib/commands/sites.js (2)
lib/sdks.js (1)
sdkForProject(24-55)lib/parser.js (1)
parseBool(176-180)
🔇 Additional comments (29)
install.sh (1)
100-100: LGTM! Version bump is consistent with the release.The version update to 11.1.0 correctly targets the new release for the CLI download URL.
lib/parser.js (1)
125-125: LGTM! Version string updated for error reporting.The CLI version in error reports now correctly reflects 11.1.0.
scoop/appwrite.config.json (1)
3-18: LGTM! Scoop manifest updated consistently.The version and download URLs are correctly updated to 11.1.0 for both x64 and ARM64 architectures.
lib/commands/tokens.js (2)
47-66: LGTM! Total parameter correctly implemented.The
totalparameter is properly added to the typedef, function signature, and payload construction. The conditional check ensures it's only included in the payload when defined.
222-222: LGTM! CLI option correctly wired.The
--totalflag is properly configured with a parser that defaults totruewhen provided without a value, and usesparseBoolfor explicit values. This gives users flexibility:
- Omit flag: server default behavior
--total: calculate total (true)--total true: calculate total (true)--total false: skip calculation (false)lib/commands/migrations.js (2)
46-68: LGTM! Consistent implementation of total parameter.The typedef, function signature, and payload handling for the
totalparameter follow the established pattern from other modules in this PR.
692-692: LGTM! CLI option matches the pattern.The
--totalflag implementation is consistent with other list commands in this update.lib/commands/proxy.js (2)
46-68: LGTM! Total parameter properly integrated.The implementation follows the consistent pattern established across all list endpoints in this PR.
340-340: LGTM! CLI option correctly configured.The
--totalflag is properly wired with the standard parser logic.lib/commands/vcs.js (2)
296-318: LGTM! Total parameter implementation is consistent.The typedef, function signature, and payload construction follow the established pattern for the
totalparameter.
452-452: LGTM! CLI option properly configured.The
--totalflag implementation matches the pattern used across other list commands.lib/commands/storage.js (4)
46-68: LGTM! Total parameter added to listBuckets.The typedef, function signature, and payload handling for the
totalparameter instorageListBucketsare correctly implemented.
293-315: LGTM! Total parameter added to listFiles.The
totalparameter implementation forstorageListFilesfollows the same consistent pattern asstorageListBuckets.
826-826: LGTM! CLI option for list-buckets.The
--totalflag is properly configured for thelist-bucketscommand.
879-879: LGTM! CLI option for list-files.The
--totalflag is properly configured for thelist-filescommand.lib/commands/projects.js (2)
46-46: LGTM: consistent total wiring for projects listings.Typedefs, params, payload, and CLI options look correct and aligned with parseBool behavior (default true when no value supplied).
Also applies to: 55-69, 977-986, 991-994, 1212-1213, 1221-1229, 1864-1865, 1873-1881, 2118-2120, 2316-2319, 2368-2371, 2519-2522
756-792: Dev-keys endpoint is undocumented and doesn't support total parameter.Appwrite does not document a REST API endpoint to list/manage dev keys, so there is no documented "total" query/response parameter for a dev-keys list. The
projectsListDevKeysfunction and command should not expose a--totaloption since the backend doesn't support it.Likely an incorrect or invalid review comment.
lib/commands/sites.js (1)
46-47: LGTM: total flag added consistently across sites list endpoints and CLI.Payload only includes total when defined; CLI default true is correct.
Also applies to: 55-69, 568-569, 577-591, 1052-1053, 1061-1072, 1363-1366, 1475-1478, 1554-1556
lib/commands/account.js (1)
188-189: LGTM: total support for account listings is correct.Threads through typedefs, params, payload, and CLI with sensible default.
Also applies to: 197-208, 283-284, 292-303, 1776-1777, 1794-1795
lib/commands/teams.js (1)
46-47: LGTM: total flag integrated across teams listings and CLI.Implementation is consistent with other modules.
Also applies to: 55-69, 229-230, 238-249, 267-268, 276-289, 562-565, 599-601, 608-610
lib/commands/tables-db.js (1)
43-85: LGTM! Consistent implementation of thetotalparameter across all list operations.The addition of the
totalparameter to the list-related functions (tablesDBList,tablesDBListTables,tablesDBListColumns,tablesDBListIndexes,tablesDBListRows) is well-implemented:
- Typedefs correctly updated with the
totalproperty and appropriate documentation- Function signatures consistently extended to accept the
totalparameter- Conditional payload construction ensures
totalis only sent when explicitly provided- CLI options properly configured with boolean parsing that defaults to
truewhen--totalis specified without a valueThe pattern is uniform across all affected functions and follows existing codebase conventions.
Also applies to: 470-513, 679-719, 2023-2063, 2220-2264, 2847-2853, 2932-2940, 2979-2987, 3303-3311, 3350-3359
lib/commands/functions.js (1)
43-85: LGTM! Clean implementation of thetotalparameter for function-related list operations.The changes to
functionsList,functionsListTemplates,functionsListDeployments, andfunctionsListExecutionsfollow the same solid pattern as intables-db.js:
- Typedef documentation clearly describes the parameter behavior
- Function signatures properly extended
- Payload construction uses defensive checking with
typeof total !== 'undefined'- CLI options configured consistently with appropriate boolean parsing
The implementation is uniform across both files and maintains consistency with the existing codebase architecture.
Also applies to: 251-301, 570-613, 1055-1094, 1422-1429, 1465-1474, 1533-1541, 1613-1620
lib/commands/databases.js (4)
43-68: LGTM! Well-implemented total parameter for databasesList.The implementation follows a clean pattern:
- Typedef documents the boolean parameter clearly
- Function signature properly includes the new parameter
- Conditional payload construction correctly distinguishes
undefinedfromfalse- CLI option properly parses boolean values
The
typeof total !== 'undefined'check ensures backward compatibility—existing callers that don't pass this parameter will continue to work with the server's default behavior.Also applies to: 2864-2870
470-496: Excellent consistency across all database list endpoints.The
totalparameter has been consistently implemented across:
databasesListCollections(lines 470-496)databasesListAttributes(lines 679-702)databasesListDocuments(lines 2019-2046)databasesListIndexes(lines 2571-2594)Each implementation follows the identical pattern for typedefs, function signatures, payload construction, and CLI wiring. This uniformity makes the codebase easier to maintain and reduces the likelihood of bugs.
Also applies to: 679-702, 2019-2046, 2571-2594
2868-2868: CLI option parsing looks correct.The boolean parsing pattern
(value) => value === undefined ? true : parseBool(value)provides intuitive behavior:
--total→true(explicit opt-in)--total true→true--total false→false(performance optimization)- No flag →
undefined(server default, backward compatible)This gives users explicit control while maintaining backward compatibility for existing scripts.
Also applies to: 2955-2955, 3002-3002, 3326-3326, 3459-3459
66-68: The script output confirms backward compatibility is properly maintained. All existing function calls in the codebase (databasesList,databasesListAttributes,databasesListIndexes) are called without thetotalparameter:
- lib/questions.js (line 592):
databasesList()- lib/commands/pull.js (line 301):
databasesList()- lib/commands/push.js (lines 112, 145):
databasesListAttributes()anddatabasesListIndexes()The conditional check at lines 66-68 (and the other locations mentioned) correctly excludes
totalfrom the payload when undefined, allowing these existing callers to continue working unchanged.However, verification of the server-side default behavior—whether it correctly calculates totals when the parameter is absent—cannot be confirmed from the client-side codebase alone. This requires checking server-side implementation or API documentation.
lib/commands/users.js (3)
43-68: LGTM! Consistent total parameter implementation.The
totalparameter implementation inusersListandusersListIdentitiesfollows the same solid pattern as the databases module:
- Clear typedef documentation
- Proper function signature updates
- Correct conditional payload construction with
typeofcheck- Backward compatible design
The consistency across modules ensures predictable behavior for users of the CLI.
Also applies to: 226-251
759-781: Excellent cross-module consistency.The
totalparameter has been uniformly implemented across all user list endpoints:
usersListLogs(lines 759-781)usersListMemberships(lines 796-822)usersListSessions(lines 1185-1203)usersListTargets(lines 1347-1369)This matches the pattern used in databases.js and other modules mentioned in the AI summary (account.js, functions.js, etc.), creating a cohesive API experience across the entire CLI.
Also applies to: 796-822, 1185-1203, 1347-1369
1643-1650: CLI options properly implemented across all user commands.All six user list commands have been updated with the
--totaloption using consistent boolean parsing. The pattern provides intuitive behavior:
- Omitting the flag maintains backward compatibility
- Including
--totalenables explicit control over total count calculation--total falseprovides performance optimization for large result setsAlso applies to: 1680-1686, 1789-1795, 1797-1804, 1878-1884, 1912-1918
| * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan | ||
| * @property {string} search Search term to filter your list results. Max length: 256 chars. | ||
| * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated. | ||
| * @property {boolean} overrideForCli |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Docs: confirm “total” as a filterable attribute for teams.
The queries doc lists name, total, billingPlan. If “total” isn’t an actual data field filter, remove it to avoid confusion with the boolean flag.
🏁 Script executed:
#!/bin/bash
# Inspect teams list docs/comments across repo for "name, total, billingPlan"
rg -nC2 -P "teams.*queries.*name.*total.*billingPlan" lib || trueLength of output: 0
---
🏁 Script executed:
```shell
#!/bin/bash
# Inspect the actual file around lines 44-47
cat -n lib/commands/teams.js | sed -n '35,60p'
Length of output: 1332
🏁 Script executed:
#!/bin/bash
# Search for team query documentation or filter definitions more broadly
rg -n "name.*billingPlan\|billingPlan.*name" lib/commands/teams.js -A2 -B2Length of output: 0
🏁 Script executed:
#!/bin/bash
# Look for any "total" mentions in teams.js to understand its role
rg -n "total" lib/commands/teams.js -C3Length of output: 5849
🏁 Script executed:
#!/bin/bash
# Search for type definitions or JSDoc patterns for listTeams query parameters
rg -n "listTeams\|@property.*queries" lib/commands/teams.js -C3Length of output: 0
Remove "total" from filterable query attributes—it's a response control, not a data field.
The total parameter is a boolean that controls whether the total count is calculated (line 46), not a filterable attribute for queries. It should not appear in the "You may filter on the following attributes" documentation.
- Line 44: Remove
totalfrom:name, total, billingPlan→name, billingPlan - Line 560: Remove
totalfrom the CLI option description to match
Other list endpoints (e.g., teamsListMemberships, teamsListLogs) correctly exclude total from their filterable attributes lists.
🤖 Prompt for AI Agents
In lib/commands/teams.js around lines 44 to 47 (and also update the CLI option
at line 560), remove "total" from the list of filterable query attributes
because it's a response control, not a data field; change the documentation text
so the attributes read "name, billingPlan" instead of "name, total, billingPlan"
and update the CLI option description at line 560 to no longer mention "total."
This PR contains updates to the Command Line SDK for version 11.1.0.
Summary by CodeRabbit
New Features
totalparameter across list endpoints to skip row counting in tables for improved performance. When set to false, the total count will not be calculated, reducing query overhead.Version