Skip to content

Conversation

abnegate
Copy link
Member

@abnegate abnegate commented Sep 4, 2025

What does this PR do?

Fixes #194

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • CLI: create/update support for line, point, and polygon attributes/columns (Databases & Tables DB).
    • Added C# target for type generation.
  • Improvements

    • JS/TS type generation now targets Row instead of Document.
    • Push/pull now prefer Tables DB; autopull skips deprecated resources; “Collections” relabeled “Legacy Databases”.
    • MFA login flow and prompts updated.
  • Documentation

    • Added CLI examples for geometric attributes/columns; README install output updated.
  • Chores

    • Release bumped to 9.1.0 and install scripts/manifests refreshed.

Copy link

coderabbitai bot commented Sep 4, 2025

Walkthrough

Version bumped to 9.1.0 across package metadata, installers, README, parser, and client user-agent. Added create/update APIs and CLI commands for geometric attributes/columns (line, point, polygon) in Databases and Tables DB, with accompanying documentation examples. Tables DB support introduced via new config helpers and tables-focused push/pull flows (including localConfig.getTablesDB/addTablesDB), pullResources gained a skipDeprecated flag and init passes it. MFA identifiers were renamed for consistent casing. Type generation adds C# support and JS/TS templates now reference Models.Row.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 12

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
lib/parser.js (1)

224-224: Typo in user-facing help text ("whomai").

Fix the visible string to avoid confusing users.

Apply this diff:

-    "whoami": `The whomai command gives information about the currently logged-in user.`,
+    "whoami": `The whoami command gives information about the currently logged-in user.`,
install.ps1 (3)

47-53: Do not use break here; it throws “Cannot break outside of a loop”. Return instead and correct the policy check.

-function CheckSystemInfo {
+function CheckSystemInfo {
     Write-Host "[1/4] Getting System Info ..."
-    if ((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {
-        Write-Host "PowerShell requires an execution policy of 'RemoteSigned'."
-        Write-Host "To make this change please run:"
-        Write-Host "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
-        break
-    }
+    $policy = Get-ExecutionPolicy -Scope CurrentUser
+    if ($policy -in @('Restricted','Undefined')) {
+        Write-Host "PowerShell execution policy must be at least 'RemoteSigned'."
+        Write-Host "Run: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -Force"
+        return
+    }
 }

56-64: Harden download with error handling; stop on failures.

 function DownloadBinary {
     Write-Host "[2/4] Downloading Appwrite CLI binary ..."
-    Write-Host "🚦 Fetching latest version ... " -ForegroundColor green
+    Write-Host "🚦 Fetching Appwrite CLI v9.0.3 ... " -ForegroundColor green
 
-    if((Get-CimInstance Win32_operatingsystem).OSArchitecture -like '*ARM*') {
-      Invoke-WebRequest -Uri $GITHUB_arm64_URL -OutFile $APPWRITE_DOWNLOAD_DIR
-    } else {
-      Invoke-WebRequest -Uri $GITHUB_x64_URL -OutFile $APPWRITE_DOWNLOAD_DIR
-    }
+    try {
+      if ((Get-CimInstance Win32_OperatingSystem).OSArchitecture -like '*ARM*') {
+        Invoke-WebRequest -Uri $GITHUB_arm64_URL -OutFile $APPWRITE_DOWNLOAD_DIR -ErrorAction Stop
+      } else {
+        Invoke-WebRequest -Uri $GITHUB_x64_URL -OutFile $APPWRITE_DOWNLOAD_DIR -ErrorAction Stop
+      }
+    } catch {
+      Write-Error "Download failed: $($_.Exception.Message)"
+      return
+    }

65-67: Make install idempotent: create dir with -Force and replace existing binary safely.

-    New-Item -ItemType Directory -Path $APPWRITE_INSTALL_DIR
-    Move-Item $APPWRITE_DOWNLOAD_DIR $APPWRITE_INSTALL_PATH
+    New-Item -ItemType Directory -Path $APPWRITE_INSTALL_DIR -Force -ErrorAction SilentlyContinue | Out-Null
+    if (Test-Path $APPWRITE_INSTALL_PATH) { Remove-Item $APPWRITE_INSTALL_PATH -Force -ErrorAction SilentlyContinue }
+    Move-Item -Path $APPWRITE_DOWNLOAD_DIR -Destination $APPWRITE_INSTALL_PATH -Force
lib/config.js (1)

43-69: Add "relatedTableId" to KeysColumns in lib/config.js
Include "relatedTableId" immediately before "relatedTable" in the KeysColumns Set so that Config._addDBEntity retains the API’s relatedTableId for table columns.

🧹 Nitpick comments (30)
lib/commands/generic.js (3)

80-80: Mask OTP input for privacy.

Consider masking the OTP prompt (password-style) to avoid echoing codes in terminals. See suggested diff in lib/questions.js for questionsMFAChallenge.


82-87: Update MFA challenge call is correct; consider a small retry loop.

The challengeId/otp update with sdk: client is correct. Optionally, allow 1–2 retries on invalid OTPs before aborting to improve UX.


96-99: Avoid false hint on invalid credentials when no endpoint flag is provided.

endpoint can be undefined, making endpoint !== DEFAULT_ENDPOINT true and printing an inaccurate hint. Use configEndpoint instead.

Apply:

-            if (endpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials') {
+            if (configEndpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials') {
                 log('Use the --endpoint option for self-hosted instances')
             }
lib/questions.js (3)

263-263: Label nit: “Legacy Databases” clarity.

Renaming Collections to “(Legacy Databases)” is fine. Ensure docs/CLI help elsewhere use the same wording to avoid confusion.


880-883: Using accountListMFAFactors correctly; add empty-state guard.

If the account has no enabled factors, choices becomes empty and Inquirer will error. Consider a friendly error or fallback.

Example:

             const choices = [
               ...
             ].filter((ch) => factors[ch.value] === true);
-            return choices;
+            if (!choices.length) {
+                throw new Error("No MFA factors enabled for this account. Enable one in the console and try again.");
+            }
+            return choices;

909-921: Mask OTP input to protect codes in shared terminals.

Switch the OTP prompt to a password input with a mask.

Apply:

-const questionsMFAChallenge = [
-    {
-        type: "input",
-        name: "otp",
-        message: "Enter OTP",
-        validate(value) {
-            if (!value) {
-                return "Please enter OTP";
-            }
-            return true;
-        },
-    }
-];
+const questionsMFAChallenge = [
+    {
+        type: "password",
+        mask: "*",
+        name: "otp",
+        message: "Enter OTP",
+        validate(value) {
+            if (!value) return "Please enter OTP";
+            return true;
+        },
+    }
+];
install.sh (1)

100-111: Make version configurable and harden the download existence check.

Avoid future drift and flaky checks; allow overriding the version via env and use HTTP status instead of grepping response body.

Apply this diff:

-    GITHUB_LATEST_VERSION="9.0.3"
+    GITHUB_LATEST_VERSION="${APPWRITE_CLI_VERSION:-9.0.3}"
@@
-    res=$(curl -s $GITHUB_URL)
-    if [[ "$res" == *"Not Found"* ]]; then
+    http_code=$(curl -sI -o /dev/null -w "%{http_code}" "$GITHUB_URL")
+    if [ "$http_code" != "200" ]; then
         printf "${RED}❌ Couldn't find executable for $OS ($ARCH). Please contact the Appwrite team ${NC} \n"
         exit 1
     fi
-    curl -L -o $APPWRITE_TEMP_NAME $GITHUB_URL
+    curl -L -o "$APPWRITE_TEMP_NAME" "$GITHUB_URL"
lib/parser.js (2)

125-128: Stop hard-coding CLI version; read from package.json.

Prevents future mismatches across docs/installers.

Apply this diff:

-            const version = '9.0.3';
+            const version = require('../package.json').version;

If you prefer to avoid requiring mid-function, also destructure at the top near Line 4:

// at the top of the file
const { description, version } = require('../package.json');
// ...
// and here:
const version = version;

233-247: Duplicate export of drawTable.

The symbol appears twice in module.exports; remove the duplicate.

Apply this diff:

 module.exports = {
     drawTable,
     parse,
     actionRunner,
     parseInteger,
     parseBool,
     log,
     warn,
     hint,
     success,
     error,
     commandDescriptions,
-    cliConfig,
-    drawTable
+    cliConfig,
 }
install.ps1 (1)

57-57: Minor wording: not actually “latest” since URLs are pinned.

-    Write-Host "🚦 Fetching latest version ... " -ForegroundColor green
+    Write-Host "🚦 Fetching Appwrite CLI v9.0.3 ... " -ForegroundColor green
lib/type-generation/languages/javascript.js (1)

85-91: Use the base alias in generated typedefs to keep compatibility across Databases and Tables DB.

- * @typedef {Row & {
+ * @typedef {Base & {
lib/type-generation/languages/typescript.js (1)

91-91: Switch to Models.Row — verify SDK type availability; consider fallback

Some projects may still have SDKs without Models.Row, causing type errors in generated d.ts. Either document the minimum SDK version or add a fallback to Models.Document when Row is unavailable.

Example approach: choose base type dynamically in the generator and use it in the template:

// compute once
const baseModelType = /* detect installed SDK version or feature */ ? 'Row' : 'Document';

// in template
export type <%- toPascalCase(collection.name) %> = Models.<%- baseModelType %> & { ... }
scoop/appwrite.config.json (1)

3-3: Version/URLs updated — consider adding sha256 hashes and autoupdate

Scoop manifests typically include per-arch hashes and an autoupdate block for integrity and maintenance.

Example:

"architecture": {
  "64bit": {
    "url": ".../appwrite-cli-win-x64.exe",
    "hash": "sha256:<>",
    "bin": [["appwrite-cli-win-x64.exe","appwrite"]]
  },
  "arm64": {
    "url": ".../appwrite-cli-win-arm64.exe",
    "hash": "sha256:<>",
    "bin": [["appwrite-cli-win-arm64.exe","appwrite"]]
  }
},
"autoupdate": {
  "architecture": {
    "64bit": { "url": "https://github.com/appwrite/sdk-for-cli/releases/download/$version/appwrite-cli-win-x64.exe" },
    "arm64": { "url": "https://github.com/appwrite/sdk-for-cli/releases/download/$version/appwrite-cli-win-arm64.exe" }
  }
}

Also applies to: 9-9, 18-18

lib/config.js (2)

161-174: Use strict equality for ID comparison

Compare IDs with === to avoid coercion surprises.

-            if (entities[i]['$id'] == $id) {
+            if (entities[i]['$id'] === $id) {

176-193: Use strict equality for ID comparison

Same here for replacement path.

-            if (entities[i]['$id'] == props['$id']) {
+            if (entities[i]['$id'] === props['$id']) {
lib/commands/tables-db.js (1)

2831-2891: Align CLI copy: use “column” (not “attribute”) and “rows” (not “documents”)

Geometric command descriptions should match Tables DB terminology.

 tablesDB
     .command(`create-line-column`)
-    .description(`Create a geometric line attribute.`)
+    .description(`Create a line column.`)
...
 tablesDB
     .command(`update-line-column`)
-    .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.`)
...
 tablesDB
     .command(`create-point-column`)
-    .description(`Create a geometric point attribute.`)
+    .description(`Create a point column.`)
...
 tablesDB
     .command(`update-point-column`)
-    .description(`Update a point column. Changing the 'default' value will not update already existing documents.`)
+    .description(`Update a point column. Changing the 'default' value will not update already existing rows.`)
...
 tablesDB
     .command(`create-polygon-column`)
-    .description(`Create a geometric polygon attribute.`)
+    .description(`Create a polygon column.`)
...
 tablesDB
     .command(`update-polygon-column`)
-    .description(`Update a polygon column. Changing the 'default' value will not update already existing documents.`)
+    .description(`Update a polygon column. Changing the 'default' value will not update already existing rows.`)
lib/commands/init.js (1)

127-129: Log skipped Collections during autopull.
Add a log before calling pullResources to inform users that deprecated Collections are omitted and how to include them.

--- lib/commands/init.js
@@ -127,3 +127,4
-            await pullResources({
-                skipDeprecated: true
-            });
+            log("Autopull: skipping deprecated Collections. Run 'appwrite pull collections' to include them.");
+            await pullResources({ skipDeprecated: true });
docs/examples/tablesdb/update-point-column.md (1)

4-5: Use explicit placeholder for --key
Replace the empty string with a clear <KEY> placeholder in the example:

-    --key '' \
-    --required false
+    --key <KEY> \
+    --required false
lib/commands/pull.js (2)

19-21: Signature change to options object looks good

Destructuring with a default keeps backward compatibility for callers. Consider adding a short JSDoc for discoverability.

Example JSDoc:

/**
 * Pull selected resources.
 * @param {{ skipDeprecated?: boolean }} [opts]
 */

33-36: If skipDeprecated=true, interactive prompt can still return “collections” -> silent no-op

You delete the handler, but the prompt choices still include “collections”. If selected, action is undefined and nothing happens without feedback. Filter the prompt choices or warn explicitly when the selection is unavailable due to skipDeprecated.

Example (conceptual):

const q = { ...questionsPullResources[0] };
if (skipDeprecated) {
  q.choices = q.choices.filter(c => c.value !== 'collections');
}
const answers = await inquirer.prompt([q]);

Or after selection:

if (!action) {
  warn("Selected resource is deprecated; use 'tables' instead.");
  return;
}
lib/commands/types.js (1)

122-140: Consider extracting the normalization logic to a separate function.

The table data normalization logic (renaming columns to attributes, relatedTable to relatedCollection) could be extracted to improve readability and testability.

+const normalizeTableData = (table) => {
+  const { columns, ...rest } = table;
+  return {
+    ...rest,
+    attributes: (columns || []).map(column => {
+      if (column.relatedTable) {
+        const { relatedTable, ...columnRest } = column;
+        return {
+          ...columnRest,
+          relatedCollection: relatedTable
+        };
+      }
+      return column;
+    })
+  };
+};

 // Use tables if available, otherwise use collections
 let dataItems = tables.length > 0 ? tables : collections;
 const itemType = tables.length > 0 ? 'tables' : 'collections';

 // Normalize tables data: rename 'columns' to 'attributes' for template compatibility
 if (tables.length > 0) {
-  dataItems = dataItems.map(table => {
-    const { columns, ...rest } = table;
-    return {
-      ...rest,
-      attributes: (columns || []).map(column => {
-        if (column.relatedTable) {
-          const { relatedTable, ...columnRest } = column;
-          return {
-            ...columnRest,
-            relatedCollection: relatedTable
-          };
-        }
-        return column;
-      })
-    };
-  });
+  dataItems = dataItems.map(normalizeTableData);
 }
lib/commands/push.js (1)

921-939: Consider renaming createColumns for clarity.

The function createColumns creates table columns but internally calls createAttribute. Consider either:

  1. Renaming the function to be more descriptive of its dual purpose
  2. Creating a separate column-specific creation function

Since this function specifically handles table columns and reuses the attribute creation logic, you might want to add a comment explaining this relationship for future maintainers.

+/**
+ * Creates columns for a table. Uses the same underlying attribute creation
+ * mechanism as collections since columns are conceptually similar to attributes.
+ */
 const createColumns = async (columns, table) => {
lib/type-generation/languages/csharp.js (1)

75-75: Consider adding XML documentation comments.

C# classes typically benefit from XML documentation comments for IntelliSense support.

+    /// <summary>
+    /// Gets or sets the <%- attribute.key %> property.
+    /// </summary>
     [JsonPropertyName("<%- attribute.key %>")]
     public <%- getType(attribute, collections) %> <%= toPascalCase(attribute.key) %> { get; private set; }
lib/commands/databases.js (7)

1226-1266: Do the same JSON parsing for update-line defaults

Keep update consistent with create to avoid sending a literal string in PATCH.

Apply the same diff for handling xdefault and adjust the typedef line here to {string|Object}.


1270-1311: Point defaults: parse JSON and broaden typedef

Same rationale as line. Prevent raw string defaults and reflect accurate types in JSDoc.

Apply the same parsing block and typedef tweak ({string|Object}) in this function’s create path.


1313-1355: Point update: mirror JSON parsing

Ensure update also parses xdefault as above for symmetry and correctness.


1357-1398: Polygon defaults: parse JSON and fix typedef

Align with line/point create handlers.


1400-1441: Polygon update: parse JSON for xdefault

Maintain consistent behavior across all geometry attribute updaters.


2847-2867: Clarify CLI help and accept JSON for --xdefault robustly

Current help says “as JSON string” but the handler forwards the string verbatim. After adopting JSON parsing in the functions, update the help to say it accepts JSON string or object. Consider adding an example in the description (e.g., --xdefault '{"type":"LineString","coordinates":[[0,0],[1,1]]}').


2869-2910: Repeat CLI help clarification for point/polygon commands

Mirror the improved wording/examples for point and polygon to reduce user confusion.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6702551 and 8c64326.

📒 Files selected for processing (32)
  • README.md (2 hunks)
  • docs/examples/databases/create-line-attribute.md (1 hunks)
  • docs/examples/databases/create-point-attribute.md (1 hunks)
  • docs/examples/databases/create-polygon-attribute.md (1 hunks)
  • docs/examples/databases/update-line-attribute.md (1 hunks)
  • docs/examples/databases/update-point-attribute.md (1 hunks)
  • docs/examples/databases/update-polygon-attribute.md (1 hunks)
  • docs/examples/tablesdb/create-line-column.md (1 hunks)
  • docs/examples/tablesdb/create-point-column.md (1 hunks)
  • docs/examples/tablesdb/create-polygon-column.md (1 hunks)
  • docs/examples/tablesdb/update-line-column.md (1 hunks)
  • docs/examples/tablesdb/update-point-column.md (1 hunks)
  • docs/examples/tablesdb/update-polygon-column.md (1 hunks)
  • install.ps1 (1 hunks)
  • install.sh (1 hunks)
  • lib/client.js (3 hunks)
  • lib/commands/databases.js (3 hunks)
  • lib/commands/functions.js (2 hunks)
  • lib/commands/generic.js (2 hunks)
  • lib/commands/init.js (1 hunks)
  • lib/commands/pull.js (3 hunks)
  • lib/commands/push.js (7 hunks)
  • lib/commands/tables-db.js (3 hunks)
  • lib/commands/types.js (5 hunks)
  • lib/config.js (3 hunks)
  • lib/parser.js (1 hunks)
  • lib/questions.js (6 hunks)
  • lib/type-generation/languages/csharp.js (1 hunks)
  • lib/type-generation/languages/javascript.js (2 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 (10)
lib/commands/init.js (1)
lib/commands/pull.js (1)
  • pullResources (19-50)
lib/type-generation/languages/csharp.js (1)
lib/type-generation/attribute.js (1)
  • AttributeType (1-12)
lib/client.js (3)
lib/commands/generic.js (1)
  • url (253-253)
lib/commands/init.js (1)
  • url (99-99)
lib/utils.js (1)
  • url (105-105)
lib/commands/pull.js (1)
lib/commands/push.js (1)
  • actions (942-951)
lib/commands/generic.js (2)
lib/questions.js (5)
  • client (156-156)
  • client (225-225)
  • client (618-618)
  • client (879-879)
  • questionsMFAChallenge (909-921)
lib/commands/account.js (13)
  • accountCreateMFAChallenge (446-467)
  • client (53-54)
  • client (89-90)
  • client (130-131)
  • client (161-162)
  • client (197-198)
  • client (229-230)
  • client (258-259)
  • client (288-289)
  • client (320-321)
  • client (353-354)
  • client (384-385)
  • accountUpdateMFAChallenge (480-504)
lib/commands/types.js (2)
lib/commands/push.js (11)
  • require (7-7)
  • require (9-9)
  • require (10-10)
  • require (11-11)
  • require (12-12)
  • require (13-13)
  • require (14-14)
  • require (15-15)
  • require (16-16)
  • tables (1702-1702)
  • collections (1843-1843)
lib/questions.js (2)
  • tables (767-767)
  • collections (746-746)
lib/questions.js (1)
lib/commands/account.js (1)
  • accountListMFAFactors (515-532)
lib/commands/databases.js (2)
lib/sdks.js (2)
  • sdkForProject (24-55)
  • key (28-28)
lib/parser.js (3)
  • parse (20-47)
  • parseBool (176-180)
  • actionRunner (158-166)
lib/commands/tables-db.js (2)
lib/sdks.js (2)
  • sdkForProject (24-55)
  • key (28-28)
lib/parser.js (3)
  • parse (20-47)
  • parseBool (176-180)
  • actionRunner (158-166)
lib/commands/push.js (1)
lib/commands/tables-db.js (2)
  • tablesDBUpdateTable (402-433)
  • tablesDBCreateTable (317-351)
🪛 Biome (2.1.2)
lib/type-generation/languages/csharp.js

[error] 27-27: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Safe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🔇 Additional comments (32)
lib/commands/generic.js (2)

8-9: MFA rename alignment looks good.

Imports now match the renamed exports (questionsMFAChallenge, accountCreateMFAChallenge, accountUpdateMFAChallenge). No issues spotted.


74-79: Correct API call for creating MFA challenge.

Passing sdk: client ensures the call reuses the current console client. Looks correct.

lib/questions.js (3)

8-8: Import rename to accountListMFAFactors is consistent.

Matches the updated command export; usage below also updated.


675-675: Push menu label matches pull menu.

Consistency kept between pull/push menus for Collections → “(Legacy Databases)”.


1022-1022: Export rename is correct and matches consumers.

questionsMFAChallenge is exported and referenced by generic.js.

install.sh (1)

100-103: LGTM: version bump to 9.0.3.

Constant and URL composition align with the release.

package.json (1)

5-5: LGTM: version bumped to 9.0.3.

Matches installers and docs updates in this PR.

README.md (2)

32-33: LGTM: docs reflect 9.0.3 in both verification snippets.

Also applies to: 63-64


31-33: No stale 9.0.2 references found.

install.ps1 (1)

16-17: Version bump URLs to 9.0.3 — looks good.

lib/type-generation/languages/javascript.js (1)

67-71: Guard Models.Row import behind TablesDB support
Node.js SDK exposed Models.Row in v18.0.0 (github.com); confirm your Web SDK release also exports Models.Row before replacing Models.Document with a union. If you must support older SDKs, keep only:

/**
 * @typedef {import('${this._getAppwriteDependency()}').Models.Document} Document
 */

and defer adding Models.Row (and the Document|Row Base alias) until both SDKs ship TablesDB.

lib/client.js (1)

20-21: All version references updated to 9.0.3

Confirmed no remaining “9.0.2” strings across docs, installers, and code (package.json, install scripts, README.md, scoop config, lib files).

lib/commands/functions.js (1)

1085-1085: Doc/help now state default method is POST — LGTM

Accurate and clearer for users.

Also applies to: 1609-1609

lib/config.js (2)

508-519: LGTM: Tables DB helpers

getTablesDBs/getTablesDB/addTablesDB cleanly reuse the generic helpers and KeysDatabase.


520-530: LGTM: Databases now use generic helpers

Wrapper methods reduce duplication without changing behavior.

lib/commands/tables-db.js (2)

3192-3197: Exports look complete

All six new geometry helpers are exported and wired into the CLI.


1181-1268: Handle JSON xdefault for geometry columns
Wrap the default assignment in a try…catch and JSON.parse if xdefault is a string, falling back to the original value. Apply this to all create/update methods for line, point and polygon columns. Confirm against the latest server docs whether the API expects an object (not a JSON-string) before shipping this change.

lib/commands/init.js (1)

127-129: Passing skipDeprecated: true to pullResources during init autopull looks good.

docs/examples/tablesdb/update-line-column.md (1)

4-5: Replace --key '' with --key <KEY> to illustrate the required placeholder.

lib/commands/types.js (3)

15-15: LGTM! C# language support correctly added.

The C# language support is properly integrated following the existing pattern for other language implementations.

Also applies to: 37-38


61-61: LGTM! Language choice updated.

The "cs" option is correctly added to the available language choices.


103-116: Ensure backward compatibility for users with only collections.

The logic correctly prioritizes tables over collections. However, users upgrading may have existing workflows expecting collections. This fallback approach maintains backward compatibility while supporting the new tables feature.

lib/commands/push.js (5)

54-56: LGTM! Tables DB functions correctly imported.

The new Tables DB functions are properly imported for use in the push workflow.


1777-1782: LGTM! Tables DB update flow correctly implemented.

The code properly uses tablesDBUpdateTable for updating table properties in the Tables DB workflow.


1793-1800: LGTM! Table creation flow correctly implemented.

The code properly handles table creation using tablesDBCreateTable when the table doesn't exist.


1824-1824: LGTM! Column creation properly integrated.

The table push flow correctly uses the new createColumns function for handling table columns.


1735-1735: No action required — getTablesDB is implemented in lib/config.js at line 512.

lib/type-generation/languages/csharp.js (3)

42-44: Consider C# nullable reference types best practices.

The nullable type handling with ? suffix is correct for C# 8.0+. The template correctly includes #nullable enable directive at the top.


111-118: Verify null handling in array conversions.

The array type conversions handle nullable values differently. For consistency and safety:

  • String arrays filter out nulls when required (.Where(x => x != null))
  • Numeric arrays use conditional expressions for nullable types

This approach is correct and handles edge cases properly.


90-133: LGTM! Comprehensive deserialization logic.

The From method provides thorough handling of all data types including:

  • Enum parsing with case-insensitive support
  • Recursive relationship deserialization
  • Proper null handling for optional fields
  • Appropriate type conversions for numeric types
lib/commands/databases.js (2)

3212-3217: Exports for new geometry helpers look good

New functions are correctly added to module.exports.


1183-1211: Ignore JSON.parse suggestion for xdefault
Appwrite mandates that the default value’s type matches the declared attribute type. For geometry stored in a string attribute (e.g. JSON‐stringified GeoJSON), you must pass the raw string—do not attempt to parse it into an object.

Likely an incorrect or invalid review comment.

Comment on lines +1 to +5
appwrite databases create-line-attribute \
--database-id <DATABASE_ID> \
--collection-id <COLLECTION_ID> \
--key '' \
--required false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix invalid example: --key '' is misleading/likely invalid

Users copy-pasting this will create an attribute with an empty key, which should be rejected. Show a concrete placeholder or example instead.

Apply this diff:

 appwrite databases create-line-attribute \
     --database-id <DATABASE_ID> \
     --collection-id <COLLECTION_ID> \
-    --key '' \
+    --key <KEY> \
     --required false
📝 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.

Suggested change
appwrite databases create-line-attribute \
--database-id <DATABASE_ID> \
--collection-id <COLLECTION_ID> \
--key '' \
--required false
appwrite databases create-line-attribute \
--database-id <DATABASE_ID> \
--collection-id <COLLECTION_ID> \
--key <KEY> \
--required false
🤖 Prompt for AI Agents
In docs/examples/databases/create-line-attribute.md around lines 1 to 5, the
example uses --key '' which is misleading and may create an empty/invalid
attribute key; replace the empty key with a concrete placeholder or realistic
example (e.g. --key example_key or --key username) so users can copy-paste
safely and understand the expected format; update the example command to use
that placeholder and ensure any accompanying text clarifies it should be
replaced with a real attribute key.

@abnegate abnegate merged commit 71e8c88 into master Sep 5, 2025
1 check was pending
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)
lib/client.js (1)

150-154: Fix URL construction: string concat breaks absolute URLs and double-slash handling

Concatenating this.endpoint + path yields invalid URLs when path is absolute (e.g., https://...) and is brittle with leading/trailing slashes. Use WHATWG URL semantics with a base and a normalized relative path.

Apply:

-    headers = {...this.headers, ...headers};
-    const url = new URL(this.endpoint + path);
+    headers = {...this.headers, ...headers};
+    const isAbs = typeof path === "string" && /^(https?:)?\/\//i.test(path);
+    const base = this.endpoint.replace(/\/+$/, "/");
+    const rel = typeof path === "string" ? path.replace(/^\/+/, "") : "";
+    const url = new URL(isAbs ? path : rel, base);
🧹 Nitpick comments (3)
lib/client.js (3)

183-188: Reuse a single Undici Agent instead of creating one per request

Constructing a new Agent for every call is wasteful and prevents connection reuse. Initialize once and refresh only when selfSigned changes.

Apply:

 class Client {
   CHUNK_SIZE = 5*1024*1024; // 5MB

   constructor() {
     this.endpoint = 'https://cloud.appwrite.io/v1';
+    this.selfSigned = false;
     this.headers = {
@@
       'X-Appwrite-Response-Format' : '1.8.0',
     };
+    this.agent = new Agent({ connect: { rejectUnauthorized: !this.selfSigned } });
   }
@@
   setSelfSigned(status) {
-    this.selfSigned = status;
+    this.selfSigned = Boolean(status);
+    this.agent = new Agent({ connect: { rejectUnauthorized: !this.selfSigned } });
@@
-      response = await fetch(url.toString(), {
+      response = await fetch(url.toString(), {
         method: method.toUpperCase(),
         headers,
         body,
-        dispatcher: new Agent({
-            connect: {
-                rejectUnauthorized: !this.selfSigned,
-            },
-        }),
+        dispatcher: this.agent,
       });

2-2: Remove unused import

https is not used.

-const https = require("https");

151-159: Normalize header casing to ensure multipart detection works reliably

headers["content-type"] check can miss Content-Type (title-cased) inputs. Normalize merged headers to lowercase keys once.

-    headers = {...this.headers, ...headers};
+    headers = Object.fromEntries(
+      Object.entries({ ...this.headers, ...headers })
+        .map(([k, v]) => [String(k).toLowerCase(), v])
+    );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0ae570a and 936b43d.

📒 Files selected for processing (1)
  • lib/client.js (1 hunks)
🔇 Additional comments (1)
lib/client.js (1)

19-21: Version bump looks good

x-sdk-version and User-Agent updated to 9.1.0 in sync. No issues.

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.

🐛 Bug Report: accountListMfaFactors is not a function
2 participants