-
Notifications
You must be signed in to change notification settings - Fork 40
feat: Command Line SDK update for version 10.0.1 #201
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
WalkthroughPatch release to 10.0.1 across repo: version strings updated in package.json, install scripts (PowerShell/Bash), client headers, parser, README, Scoop manifest, and changelog. CLI commands updated: push migrates to tablesDB APIs, adjusts attribute relationship handling (relatedTable fallback), index creation uses columns, tracks changed tables, and updates success messages; pull text adjusted. Config schema keys switched from documentSecurity→rowSecurity and attributes→columns; added KeyIndexesColumns and wired it into table indexing. Projects command help now lists explicit platform types. Type generation updated: Dart template reworked (ordered attributes, import dedup, (de)serialization tweaks); TypeScript uses type-only Models import. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ 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: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
CHANGELOG.md(1 hunks)README.md(2 hunks)install.ps1(1 hunks)install.sh(1 hunks)lib/client.js(1 hunks)lib/commands/projects.js(2 hunks)lib/commands/pull.js(2 hunks)lib/commands/push.js(11 hunks)lib/config.js(3 hunks)lib/parser.js(1 hunks)lib/type-generation/languages/dart.js(1 hunks)lib/type-generation/languages/typescript.js(1 hunks)package.json(1 hunks)scoop/appwrite.config.json(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
lib/commands/pull.js (1)
lib/parser.js (2)
success(194-196)chalk(1-1)
lib/type-generation/languages/dart.js (1)
lib/type-generation/attribute.js (1)
AttributeType(1-12)
lib/commands/push.js (2)
lib/commands/tables-db.js (4)
tablesDBUpdate(205-229)tablesDBCreate(95-122)tablesDBGetTable(364-385)tablesDBUpdateTable(402-433)lib/config.js (1)
KeysTable(12-12)
🔇 Additional comments (10)
scoop/appwrite.config.json (1)
3-3: LGTM! Version bump is consistent.The version and download URLs have been correctly updated to 10.0.1 across all architecture variants.
Also applies to: 9-9, 18-18
package.json (1)
5-5: LGTM! Package version updated correctly.The version bump to 10.0.1 is consistent with the patch release described in the CHANGELOG.
install.ps1 (1)
16-17: LGTM! Download URLs updated correctly.Both x64 and arm64 Windows binary URLs have been updated to reference the 10.0.1 release.
install.sh (1)
100-100: LGTM! Version constant updated correctly.The
GITHUB_LATEST_VERSIONhas been updated to 10.0.1, which will be used to construct the download URL for all platforms.CHANGELOG.md (1)
3-9: LGTM! Changelog appropriately documents patch fixes.The 10.0.1 changelog section correctly documents the bug fixes included in this patch release, following the existing format and conventions.
lib/commands/pull.js (1)
361-361: LGTM! Terminology updated for consistency.The success messages now use "tableDBs" instead of "tables databases", aligning with the tablesDB terminology used throughout the codebase.
Also applies to: 401-401
README.md (1)
32-32: LGTM! Documentation updated to reflect version 10.0.1.The version verification examples correctly show the new 10.0.1 version output.
Also applies to: 63-63
lib/type-generation/languages/typescript.js (1)
72-72: LGTM! Improved TypeScript import syntax.The change from
import { type Models }toimport type { Models }is the preferred TypeScript syntax for type-only imports. This makes the intent more explicit and ensures proper tree-shaking.lib/commands/projects.js (1)
1237-1237: Nice to see the platform type list spelled out.Explicit values in both the typedef and CLI help make it much easier for users to discover the supported platform targets.
Also applies to: 2357-2357
lib/config.js (1)
12-13: Schema whitelist keeps pace with the table DB rename.The new
rowSecurity/columnskeys and dedicated index whitelist keep local config sanitization aligned with the API.Also applies to: 65-66, 72-72, 408-409
| 'x-sdk-version': '10.0.1', | ||
| 'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`, |
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.
🛠️ Refactor suggestion | 🟠 Major
Avoid hardcoding the version strings.
The version is hardcoded in the SDK headers. This creates maintenance burden and risks version drift. Consider importing the version from package.json for consistency.
Apply this approach:
+const { version } = require('../package.json');
+
class Client {
CHUNK_SIZE = 5*1024*1024; // 5MB
constructor() {
this.endpoint = 'https://cloud.appwrite.io/v1';
this.headers = {
'content-type': '',
'x-sdk-name': 'Command Line',
'x-sdk-platform': 'console',
'x-sdk-language': 'cli',
- 'x-sdk-version': '10.0.1',
- 'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
+ 'x-sdk-version': version,
+ 'user-agent' : `AppwriteCLI/${version} (${os.type()} ${os.version()}; ${os.arch()})`,
'X-Appwrite-Response-Format' : '1.8.0',
};
}📝 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.
| 'x-sdk-version': '10.0.1', | |
| 'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`, | |
| // lib/client.js | |
| const os = require('os'); | |
| const { version } = require('../package.json'); | |
| class Client { | |
| CHUNK_SIZE = 5 * 1024 * 1024; // 5MB | |
| constructor() { | |
| this.endpoint = 'https://cloud.appwrite.io/v1'; | |
| this.headers = { | |
| 'content-type': '', | |
| 'x-sdk-name': 'Command Line', | |
| 'x-sdk-platform': 'console', | |
| 'x-sdk-language': 'cli', | |
| - 'x-sdk-version': '10.0.1', | |
| 'x-sdk-version': version, | |
| 'user-agent': `AppwriteCLI/${version} (${os.type()} ${os.version()}; ${os.arch()})`, | |
| 'X-Appwrite-Response-Format': '1.8.0', | |
| }; | |
| } | |
| // ... rest of the class | |
| } |
🤖 Prompt for AI Agents
In lib/client.js around lines 19 to 20, the SDK and User-Agent version strings
are hardcoded which can drift; import the package version (e.g.,
require('../package.json').version or appropriate path) at top of the file and
replace the literal '10.0.1' occurrences with that imported variable so both
'x-sdk-version' and the User-Agent interpolate the package version dynamically.
| if (remoteTable.name !== table.name) changes.push('name'); | ||
| if (remoteTable.rowSecurity !== table.rowSecurity) changes.push('rowSecurity'); | ||
| if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions'])) changes.push('permissions'); | ||
|
|
||
| if (changes.length > 0) { | ||
| await tablesDBUpdateTable({ | ||
| databaseId: table['databaseId'], | ||
| tableId: table['$id'], | ||
| name: table.name, | ||
| parseOutput: false | ||
| parseOutput: false, | ||
| rowSecurity: table.rowSecurity, | ||
| permissions: table['$permissions'] | ||
| }) |
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.
Don't drop table enabled updates
We no longer propagate the table enabled flag when pushing. Any change to enabled in appwrite.config.json now silently does nothing, and newly created tables always come up with the API default instead of the configured state. Please wire the flag back into the change detection and into the create/update payloads so pushes keep tables enabled/disabled as intended.
Apply this diff to restore the missing behavior:
const changes = [];
if (remoteTable.name !== table.name) changes.push('name');
if (remoteTable.rowSecurity !== table.rowSecurity) changes.push('rowSecurity');
+ if (remoteTable.enabled !== table.enabled) changes.push('enabled');
if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions'])) changes.push('permissions');
if (changes.length > 0) {
await tablesDBUpdateTable({
databaseId: table['databaseId'],
tableId: table['$id'],
name: table.name,
parseOutput: false,
rowSecurity: table.rowSecurity,
- permissions: table['$permissions']
+ permissions: table['$permissions'],
+ enabled: table.enabled
})
@@
await tablesDBCreateTable({
databaseId: table['databaseId'],
tableId: table['$id'],
name: table.name,
rowSecurity: table.rowSecurity,
- permissions: table['$permissions'],
+ permissions: table['$permissions'],
+ enabled: table.enabled,
parseOutput: false
})Also applies to: 1805-1811
🤖 Prompt for AI Agents
In lib/commands/push.js around lines 1781-1793 (and similarly 1805-1811), the
table 'enabled' flag is not being compared or sent to the API; add a comparison
that pushes 'enabled' into the changes array when remoteTable.enabled !==
table.enabled, and include enabled: table.enabled in the payload passed to
tablesDBUpdateTable (and the equivalent create call around 1805-1811) so both
update and create requests carry the configured enabled state.
| } | ||
|
|
||
| const version = '10.0.0'; | ||
| const version = '10.0.1'; |
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.
🛠️ Refactor suggestion | 🟠 Major
Avoid hardcoding the version string.
The version is hardcoded here but package.json is already imported at the top of the file (line 4). Hardcoding creates a maintenance burden and risks version drift between this file and package.json.
Apply this diff to use the version from package.json:
+const { description, version } = require('../package.json');
-const { description } = require('../package.json');Then update line 125:
- const version = '10.0.1';
+ // version is now imported from package.json above📝 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.
| const version = '10.0.1'; | |
| // lib/parser.js | |
| // (near line 4) | |
| const { description, version } = require('../package.json'); | |
| // … | |
| // (around line 125) | |
| // version is now imported from package.json above |
🤖 Prompt for AI Agents
In lib/parser.js around line 125, the version is hardcoded as '10.0.1' which can
drift from package.json (already imported at line 4); replace the hardcoded
assignment with a reference to the imported package.json version (e.g., use the
imported package object’s version property) so the file reads the version from
package.json instead of a literal string.
| map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%> | ||
| <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%> |
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.
Compilation breaks: firstOrNull is undefined in generated Dart.
Iterable doesn’t expose firstOrNull in the standard Dart SDK, so generated models fail to compile unless consumers add their own extension/import. Please stick with firstWhere (with the null guard you already have) so optional enums still deserialize correctly.
- map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null
+ map['<%= attribute.key %>'] != null
+ ? <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])
+ : null📝 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.
| map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%> | |
| <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%> | |
| // before (optional enum branch) | |
| map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%> | |
| <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%> | |
| // after applying the diff | |
| map['<%= attribute.key %>'] != null | |
| ? <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>']) | |
| : null<% } else { -%> | |
| <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%> |
🤖 Prompt for AI Agents
In lib/type-generation/languages/dart.js around lines 133-134, replace the
non-existent Iterable.firstOrNull usage with firstWhere(..., orElse: () => null)
so the generated Dart uses the standard SDK API (e.g. map['key'] != null ?
EnumType.values.where((e) => e.name == map['key']).firstWhere((e) => true,
orElse: () => null) : null — implement it properly to return the found element
or null); update the template to use firstWhere with an orElse that returns null
so optional enum deserialization compiles without extra extensions or imports.
This PR contains updates to the Command Line SDK for version 10.0.1.
Summary by CodeRabbit