-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Command Line SDK update for version 1.8.x #196
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
Warning Rate limit exceeded@abnegate has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 27 minutes and 15 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (2)
WalkthroughThis change updates spatial attribute/column handling and TypeScript code generation. In lib/commands/databases.js and lib/commands/tables-db.js, xdefault for line/point/polygon is documented and treated as coordinate arrays instead of strings, with runtime normalization mapping boolean true to an empty array before assigning default. CLI help text for --xdefault is updated accordingly. JSDoc/param types reflect the new array formats, including enum-related docs in tables-db. In lib/type-generation/languages/typescript.js, the generator now validates attribute keys and quotes invalid identifiers when emitting TypeScript properties. No function signatures were changed. Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
lib/type-generation/languages/typescript.js (1)
93-95
: Quote invalid identifiers: good; also guard TS keywords.The regex covers identifier characters but not reserved keywords. Safer to quote names like "class", "default", etc.
-<% const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propertyName); -%> +<% const isValidIdentifier = + /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propertyName) && + !['break','case','class','catch','const','continue','debugger','default','delete','do','else','export','extends','finally','for','function','if','import','in','instanceof','new','return','super','switch','this','throw','try','typeof','var','void','while','with','yield','let','enum','await','implements','package','protected','static','interface','private','public'].includes(propertyName); -%>lib/commands/databases.js (1)
2860-2861
: CLI help: tell users to pass JSON.Add a short hint so users quote JSON arrays properly at the shell.
-.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.`) +.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Pass as JSON (e.g., --xdefault '[[12.34,56.78],[23.45,67.89]]'). Cannot be set when attribute is required.`)Repeat the same JSON hint for point and polygon options.
Also applies to: 2870-2871, 2881-2882, 2891-2892, 2902-2903, 2912-2913
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
lib/commands/databases.js
(18 hunks)lib/commands/tables-db.js
(18 hunks)lib/type-generation/languages/typescript.js
(1 hunks)
🔇 Additional comments (2)
lib/commands/databases.js (1)
1188-1188
: Docs: spatial xdefault shapes look correct.The new array-based formats for line/point/polygon defaults are clear and consistent.
Also applies to: 1232-1232, 1277-1277, 1321-1321, 1366-1366, 1410-1410
lib/commands/tables-db.js (1)
1188-1188
: Docs: spatial xdefault shapes look correct.The new array-based formats for line/point/polygon defaults are clear and consistent.
Also applies to: 1232-1232, 1277-1277, 1321-1321, 1366-1366, 1410-1410
xdefault = xdefault === true ? [] : xdefault; | ||
if (typeof xdefault !== 'undefined') { | ||
payload['default'] = xdefault; | ||
} |
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.
xdefault passed as string; must JSON.parse before sending.
Commander delivers CLI args as strings. Without parsing, the API receives a string instead of an array and will fail validation for spatial defaults.
Apply parsing in all spatial attribute helpers:
xdefault = xdefault === true ? [] : xdefault;
+if (typeof xdefault === 'string') {
+ xdefault = JSON.parse(xdefault);
+}
if (typeof xdefault !== 'undefined') {
payload['default'] = xdefault;
}
Also applies to: 1250-1253, 1297-1300, 1339-1342, 1386-1389, 1429-1432
xdefault = xdefault === true ? [] : xdefault; | ||
if (typeof xdefault !== 'undefined') { | ||
payload['default'] = xdefault; | ||
} |
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.
xdefault must be JSON-parsed before send.
Same issue here: CLI supplies strings; the API expects arrays.
xdefault = xdefault === true ? [] : xdefault;
+if (typeof xdefault === 'string') {
+ xdefault = JSON.parse(xdefault);
+}
if (typeof xdefault !== 'undefined') {
payload['default'] = xdefault;
}
Also applies to: 1250-1253, 1297-1300, 1339-1342, 1386-1389, 1429-1432
.option(`--xdefault <xdefault>`, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`) | ||
.action(actionRunner(tablesDBCreateLineColumn)) |
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.
CLI help: add JSON hint + fix “documents” → “rows”.
- Add a note to pass xdefault as JSON.
- Replace “documents” with “rows” in tables-db update command descriptions.
- .description(`Update a line column. Changing the 'default' value will not update already existing documents.`)
+ .description(`Update a line column. Changing the 'default' value will not update already existing rows.`)
-.option(`--xdefault <xdefault>`, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required.`)
+.option(`--xdefault <xdefault>`, `Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Pass as JSON (e.g., --xdefault '[[12.34,56.78],[23.45,67.89]]'). Cannot be set when column is required.`)
Apply the same “rows” wording and JSON hint for point and polygon update/create commands.
Also applies to: 2853-2855, 2864-2865, 2874-2876, 2885-2886, 2895-2897
This PR contains updates to the Command Line SDK for Appwrite version 1.8.x.\n\nCommit: chore: testing 6
Summary by CodeRabbit
New Features
Bug Fixes
Documentation