Skip to content

Conversation

@ItzNotABug
Copy link
Member

@ItzNotABug ItzNotABug commented Jan 14, 2026

What does this PR do?

Changes as per latest server specs, these include -

  1. Updates to Runtime enums
  2. Output is now correctly renamed to ImageFormat
  3. Introduces Backups module for managing Database backups
  4. Introduces Organization module

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

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • Introduced Backups module for managing archives, policies, and restorations
    • Introduced Organizations module with delete and estimation capabilities
    • Added Health queue billing and threat monitoring methods
    • Added support for large integer values (bigint)
  • Breaking Changes

    • Renamed Output enum to ImageFormat
    • Updated Account.createJWT to accept optional duration parameter
    • Removed support for Deno 1.21, 1.24, and 1.35 runtimes
  • Improvements

    • Updated Node.js runtime from 20.x to 22
    • Enhanced OIDC support in publishing workflow
    • Expanded documentation with comprehensive code examples

✏️ Tip: You can customize this high-level summary in your review settings.

@ItzNotABug ItzNotABug self-assigned this Jan 14, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

Walkthrough

This pull request updates the SDK from version 21.1.0 to 21.1.1, introducing significant new functionality and breaking changes. Key updates include: introduction of Backups and Organizations services with full CRUD operations; replacement of the Output enum with ImageFormat; removal of deprecated Deno runtime versions; addition of bigint support throughout numeric type systems; implementation of json-bigint for large integer serialization; new method overloads for backward compatibility; updates to GitHub Actions workflow for Node.js 22 and npm OIDC provenance; and addition of 13 new documentation examples demonstrating the new Backups API and Health queue endpoints. The package.json version is incremented and dependencies adjusted accordingly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and generic, using the phrase 'sync as per latest cloud specs' which does not convey specific information about the changeset. While it references the intent of synchronization, it lacks concrete detail about what is being updated. Replace with a more specific title that highlights the main changes, e.g., 'Add Backups and Organizations services, rename Output to ImageFormat, and update Runtime enums' or 'Introduce Backups and Organizations modules with API alignment updates'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Caution

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

⚠️ Outside diff range comments (12)
src/services/tables-db.ts (3)

3879-3983: Fix lengths?: number | bigint[] — likely intended (number | bigint)[].

As written, lengths?: number | bigint[] (Line 3893, 3914, 3926) allows a single number or an array of bigint, but not an array of numbers (and not a mixed array). The JSDoc type (Line 3889/3904) has the same issue. This looks like a precedence mistake and can lead to bad call-sites and incorrect payload shapes.

Proposed fix
-     * `@param` {number | bigint[]} params.lengths - Length of index. Maximum of 100
+     * `@param` {(number | bigint)[]} params.lengths - Length of index. Maximum of 100
 ...
-    createIndex(params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number | bigint[]  }): Promise<Models.ColumnIndex>;
+    createIndex(params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: (number | bigint)[]  }): Promise<Models.ColumnIndex>;
 ...
-     * `@param` {number | bigint[]} lengths - Length of index. Maximum of 100
+     * `@param` {(number | bigint)[]} lengths - Length of index. Maximum of 100
 ...
-    createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number | bigint[]): Promise<Models.ColumnIndex>;
+    createIndex(databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: (number | bigint)[]): Promise<Models.ColumnIndex>;
 ...
-        paramsOrFirst: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number | bigint[] } | string,
-        ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (string[])?, (number | bigint[])?]
+        paramsOrFirst: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: (number | bigint)[] } | string,
+        ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (string[])?, ((number | bigint)[])?]
     ): Promise<Models.ColumnIndex> {
-        let params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: number | bigint[] };
+        let params: { databaseId: string, tableId: string, key: string, type: IndexType, columns: string[], orders?: string[], lengths?: (number | bigint)[] };
 ...
-                lengths: rest[5] as number | bigint[]
+                lengths: rest[5] as (number | bigint)[]
             };

4933-5026: Docstrings: “must be a number” / “increment” wording is now misleading with bigint + decrement.

  • decrementRowColumn docs still say “Value to increment…” (Line 4940, 4954).
  • Both increment/decrement say “must be a number” while types are number | bigint (Line 4940-4942, 5035-5037).

Consider updating the wording to match the widened types and the operation.

Proposed doc tweak
-     * `@param` {number | bigint} params.value - Value to increment the column by. The value must be a number.
+     * `@param` {number | bigint} params.value - Value to decrement the column by.
...
-     * `@param` {number | bigint} value - Value to increment the column by. The value must be a number.
+     * `@param` {number | bigint} value - Value to decrement the column by.
...
-     * `@param` {number | bigint} params.value - Value to increment the column by. The value must be a number.
+     * `@param` {number | bigint} params.value - Value to increment the column by.
...
-     * `@param` {number | bigint} value - Value to increment the column by. The value must be a number.
+     * `@param` {number | bigint} value - Value to increment the column by.

Also applies to: 5028-5121


1906-2014: Remove bigint type from float column min/max/default parameters.

The Appwrite TablesDB API specification for float columns accepts only number values for min, max, and default—not bigint. The current type signatures (number | bigint) in both createFloatColumn and updateFloatColumn expose a surface area the backend does not support. Developers passing bigint values will encounter runtime rejection. Change min/max/xdefault from number | bigint to number to match the backend contract.

Also applies to: updateFloatColumn (lines 2016–2124).

src/services/users.ts (1)

615-746: Fix JSDoc: scrypt fields are documented “optional” but treated as required.

passwordSalt/passwordCpu/passwordMemory/passwordParallel/passwordLength are described as optional (Line 621-625) but are non-optional in the overload (Line 630-650) and hard-required by runtime checks (Line 689-703). Either make them truly optional (and remove throws) or update docs to match the current behavior.

Proposed doc-only fix (match current behavior)
- * `@param` {string} params.passwordSalt - Optional salt used to hash password.
- * `@param` {number | bigint} params.passwordCpu - Optional CPU cost used to hash password.
- * `@param` {number | bigint} params.passwordMemory - Optional memory cost used to hash password.
- * `@param` {number | bigint} params.passwordParallel - Optional parallelization cost used to hash password.
- * `@param` {number | bigint} params.passwordLength - Optional hash length used to hash password.
+ * `@param` {string} params.passwordSalt - Salt used to hash password.
+ * `@param` {number | bigint} params.passwordCpu - CPU cost used to hash password.
+ * `@param` {number | bigint} params.passwordMemory - Memory cost used to hash password.
+ * `@param` {number | bigint} params.passwordParallel - Parallelization cost used to hash password.
+ * `@param` {number | bigint} params.passwordLength - Hash length used to hash password.
src/services/storage.ts (2)

81-208: Tighten opacity type to number only (not bigint).

The opacity parameter in getFilePreview (line 882) is documented as "Pass a number between 0 to 1" but is typed as number | bigint. Since opacity is a fractional value in the 0–1 range, bigint is not a valid type. Change to opacity?: number.

BigInt handling for maximumFileSize in POST bodies (JSON payloads) is properly supported via the json-bigint module configured with useNativeBigInt: true in client.ts (line 5), so no concerns there.


870-1012: Change opacity parameter type from number | bigint to number only.

The opacity parameter accepts fractional values between 0 and 1 per the documentation, but the current type signature allows bigint, which cannot represent decimals and is semantically incorrect. This creates a misleading API contract.

URL query string encoding handles bigint values safely (converted to strings), so no issue there. However, the type signature should accurately reflect that opacity requires decimal support.

Type corrections needed
- getFilePreview(params: { bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number | bigint, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string  }): Promise<ArrayBuffer>;
+ getFilePreview(params: { bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string  }): Promise<ArrayBuffer>;

- getFilePreview(bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number | bigint, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string): Promise<ArrayBuffer>;
+ getFilePreview(bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string): Promise<ArrayBuffer>;

- paramsOrFirst: { bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number | bigint, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string } | string,
+ paramsOrFirst: { bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string } | string,

- ...rest: [(string)?, (number | bigint)?, (number | bigint)?, (ImageGravity)?, (number | bigint)?, (number | bigint)?, (string)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?, (ImageFormat)?, (string)?]
+ ...rest: [(string)?, (number | bigint)?, (number | bigint)?, (ImageGravity)?, (number | bigint)?, (number | bigint)?, (string)?, (number | bigint)?, (number)?, (number | bigint)?, (string)?, (ImageFormat)?, (string)?]

- let params: { bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number | bigint, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string };
+ let params: { bucketId: string, fileId: string, width?: number | bigint, height?: number | bigint, gravity?: ImageGravity, quality?: number | bigint, borderWidth?: number | bigint, borderColor?: string, borderRadius?: number | bigint, opacity?: number, rotation?: number | bigint, background?: string, output?: ImageFormat, token?: string };

- opacity: rest[8] as number | bigint,
+ opacity: rest[8] as number,
src/services/databases.ts (4)

4672-4862: Docs nit: decrement/increment JSDoc still says “Value to increment…”.
Now that types were touched, it’s a good chance to fix these parameter descriptions to match the method behavior.


2054-2147: Remove the runtime check for xdefault or make the parameter required in the type signature.

xdefault is marked optional (?) in the type signature but throws 'Missing required parameter: "xdefault"' at runtime if undefined. This violates the type contract and will cause runtime errors for callers who rely on the optional typing. Either remove the ? from the type signature to make it required, or remove the undefined check to allow omitting the parameter.

This pattern affects updateFloatAttribute (lines 2054–2147), updateIntegerAttribute (lines 2276–2369), and updateStringAttribute (lines 3345–3432).


209-259: Critical bug: createTransaction(0) and createTransaction(0n) silently drop the ttl value.

The condition !paramsOrFirst treats 0 and 0n as falsy, routing them into the object-style branch where (0 || {}) becomes {}, losing the value entirely. Since ttl can legitimately be 0 seconds, this is a breaking bug affecting valid API calls.

Fix
-        if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
+        if (typeof paramsOrFirst === 'undefined' || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
             params = (paramsOrFirst || {}) as { ttl?: number | bigint };
         } else {
             params = {
                 ttl: paramsOrFirst as number | bigint            
             };
         }

4938-5043: Fix createIndex lengths parameter type to accept arrays.

The lengths parameter type number | bigint[] is incorrect due to TypeScript operator precedence—it parses as (number) | (bigint[]), accepting only scalar number or bigint[] arrays, but rejecting number[] arrays. Given the documentation states "Maximum of 100" and the orders parameter uses string[], the type should be (number | bigint)[] to accept an array where each element is number or bigint.

This affects:

  • Both method overloads in createIndex
  • The implementation signature and variable declarations
  • src/services/tables-db.ts has the identical issue in its createIndex method
Proposed fix
-     * `@param` {number | bigint[]} params.lengths - Length of index. Maximum of 100
+     * `@param` {(number | bigint)[]} params.lengths - Length of index. Maximum of 100
...
-    createIndex(params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number | bigint[]  }): Promise<Models.Index>;
+    createIndex(params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: (number | bigint)[]  }): Promise<Models.Index>;
...
-    createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number | bigint[]): Promise<Models.Index>;
+    createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: (number | bigint)[]): Promise<Models.Index>;
...
-        ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (string[])?, (number | bigint[])?]
+        ...rest: [(string)?, (string)?, (IndexType)?, (string[])?, (string[])?, ((number | bigint)[])?]
...
-        let params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number | bigint[] };
+        let params: { databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: (number | bigint)[] };
...
-                lengths: rest[5] as number | bigint[]
+                lengths: rest[5] as (number | bigint)[]
src/models.ts (2)

1946-1953: Type precedence error in lengths array type.

The type number | bigint[] is parsed as number | (bigint[]) due to operator precedence, meaning "a number OR an array of bigints". This should be (number | bigint)[] to represent "an array of numbers or bigints".

🐛 Proposed fix
         /**
          * Index attributes length.
          */
-        lengths: number | bigint[];
+        lengths: (number | bigint)[];

1992-1999: Same type precedence error in ColumnIndex.lengths.

Apply the same fix as for Index.lengths.

🐛 Proposed fix
         /**
          * Index columns length.
          */
-        lengths: number | bigint[];
+        lengths: (number | bigint)[];
🤖 Fix all issues with AI agents
In `@src/index.ts`:
- Line 32: Update the CHANGELOG to document the breaking change: add an entry
stating that the Output enum was removed and replaced by ImageFormat, list the
equivalent values (jpg, jpeg, png, webp, heic, avif, gif), mark it as breaking
and reference the version bump (the original addition in 21.0.0), and include
concise migration guidance showing that consumers should replace usages of
Output with ImageFormat (e.g., ImageFormat.jpg) and import ImageFormat from
'./enums/image-format' instead of using Output.

In `@src/services/backups.ts`:
- Around line 126-193: Fix the JSDoc text typos in the Backup service methods:
update "using it's ID" to "using its ID" in getArchive overloads, change
deleteArchive param description from "Policy ID" to "Archive ID" (for both
overloads that reference params.archiveId / archiveId), and remove stray
backticks in phrases like "Choose a custom ID`" across the getArchive and
deleteArchive docs (and any other similar occurrences in this file, e.g., the
other overload JSDoc blocks and related docs).

In `@src/services/organizations.ts`:
- Around line 64-80: The JSDoc for both overloads of
estimationDeleteOrganization incorrectly labels the parameter as "Team ID";
update the `@param` descriptions for the signatures named
estimationDeleteOrganization (the object-style overload params.organizationId
and the string overload organizationId) to say "Organization ID" instead of
"Team ID" so the documentation matches the method purpose.
- Around line 12-28: Update the JSDoc for both overloads of the delete method to
reference "Organization ID" instead of "Team ID": locate the delete(params: {
organizationId: string }) and delete(organizationId: string) declarations and
change the `@param` descriptions so they describe organizationId as "Organization
ID" (or similar accurate wording) to fix the copy-paste error.
🧹 Nitpick comments (8)
docs/examples/health/get-queue-threats.md (1)

10-12: Consider using a sample value or omitting the optional parameter.

Passing null for threshold may confuse users since the parameter type is number | bigint. For illustrative purposes, either omit the parameter entirely or provide a sample numeric value.

📝 Suggested alternatives

Option 1: Omit the optional parameter

-const result = await health.getQueueThreats({
-    threshold: null // optional
-});
+const result = await health.getQueueThreats();

Option 2: Provide a sample value

-const result = await health.getQueueThreats({
-    threshold: null // optional
-});
+const result = await health.getQueueThreats({
+    threshold: 5000 // optional
+});

Based on learnings, documentation examples are illustrative, so this is a minor stylistic suggestion.

docs/examples/health/get-queue-region-manager.md (1)

10-12: Consider showing a real threshold value or omitting the parameter.

Since threshold is optional, demonstrating it with null may be less clear than either omitting it entirely or showing a realistic value (e.g., threshold: 5000). This would better illustrate the parameter's purpose for users referencing the example.

♻️ Suggested alternatives

Option 1: Omit the optional parameter

 const result = await health.getQueueRegionManager({
-    threshold: null // optional
 });

Option 2: Show a realistic value

 const result = await health.getQueueRegionManager({
-    threshold: null // optional
+    threshold: 5000 // optional
 });
docs/examples/health/get-queue-priority-builds.md (1)

10-12: Consider showing a real threshold value or omitting the parameter.

Since threshold is optional, demonstrating it with null may be less clear than either omitting it entirely or showing a realistic value (e.g., threshold: 5000). This would better illustrate the parameter's purpose for users referencing the example.

♻️ Suggested alternatives

Option 1: Omit the optional parameter

 const result = await health.getQueuePriorityBuilds({
-    threshold: null // optional
 });

Option 2: Show a realistic value

 const result = await health.getQueuePriorityBuilds({
-    threshold: null // optional
+    threshold: 5000 // optional
 });
src/client.ts (1)

102-104: Consider including endpoint value in error message for debugging.

The error message at line 103 doesn't include the endpoint value, unlike line 107. For easier debugging, consider including the value when it's not a string:

💡 Suggested improvement
     setEndpoint(endpoint: string): this {
         if (!endpoint || typeof endpoint !== 'string') {
-            throw new AppwriteException('Endpoint must be a valid string');
+            throw new AppwriteException('Endpoint must be a valid string, received: ' + (typeof endpoint === 'string' ? endpoint : typeof endpoint));
         }
src/services/messaging.ts (1)

3300-3507: Consider a shared alias for number | bigint to reduce signature noise (if not generator-owned).
E.g., type Int = number | bigint; used for badge / port would make the overloads easier to scan.

src/services/tables-db.ts (1)

3590-3654: Nice improvement: getColumn returns a concrete union; consider an alias to reduce duplication.

The expanded return union is more accurate than {}. To keep signatures readable, consider adding/using a Models.Column (or similar) union alias instead of repeating the full union in 3 places.

src/services/databases.ts (1)

3628-3693: getAttribute return union is fine; consider a shared alias to reduce churn.
If Models already has a single “Attribute” union type, using it here would avoid repeated edits whenever attribute models change.

src/services/backups.ts (1)

126-176: Consider URL-encoding path params (archiveId, policyId, restorationId) for safety/robustness.
Even if IDs are restricted, encodeURIComponent() avoids accidental path breaking and future-proofs the client.

Also applies to: 177-228, 387-570, 702-752

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4bede25 and 390b296.

📒 Files selected for processing (53)
  • .github/workflows/publish.yml
  • CHANGELOG.md
  • LICENSE
  • README.md
  • docs/examples/account/create-jwt.md
  • docs/examples/avatars/get-screenshot.md
  • docs/examples/backups/create-archive.md
  • docs/examples/backups/create-policy.md
  • docs/examples/backups/create-restoration.md
  • docs/examples/backups/delete-archive.md
  • docs/examples/backups/delete-policy.md
  • docs/examples/backups/get-archive.md
  • docs/examples/backups/get-policy.md
  • docs/examples/backups/get-restoration.md
  • docs/examples/backups/list-archives.md
  • docs/examples/backups/list-policies.md
  • docs/examples/backups/list-restorations.md
  • docs/examples/backups/update-policy.md
  • docs/examples/databases/update-document.md
  • docs/examples/databases/update-documents.md
  • docs/examples/databases/upsert-document.md
  • docs/examples/health/get-queue-billing-project-aggregation.md
  • docs/examples/health/get-queue-billing-team-aggregation.md
  • docs/examples/health/get-queue-priority-builds.md
  • docs/examples/health/get-queue-region-manager.md
  • docs/examples/health/get-queue-threats.md
  • docs/examples/organizations/delete.md
  • docs/examples/organizations/estimation-delete-organization.md
  • docs/examples/tablesdb/update-row.md
  • docs/examples/tablesdb/update-rows.md
  • docs/examples/tablesdb/upsert-row.md
  • package.json
  • src/client.ts
  • src/enums/build-runtime.ts
  • src/enums/name.ts
  • src/enums/o-auth-provider.ts
  • src/enums/output.ts
  • src/enums/runtime.ts
  • src/index.ts
  • src/models.ts
  • src/query.ts
  • src/services/account.ts
  • src/services/avatars.ts
  • src/services/backups.ts
  • src/services/databases.ts
  • src/services/functions.ts
  • src/services/health.ts
  • src/services/messaging.ts
  • src/services/organizations.ts
  • src/services/sites.ts
  • src/services/storage.ts
  • src/services/tables-db.ts
  • src/services/users.ts
💤 Files with no reviewable changes (3)
  • src/enums/runtime.ts
  • src/enums/build-runtime.ts
  • src/enums/output.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-05T09:48:56.219Z
Learnt from: abnegate
Repo: appwrite/sdk-for-node PR: 121
File: docs/examples/databases/create-line-attribute.md:10-16
Timestamp: 2025-09-05T09:48:56.219Z
Learning: Documentation examples in .md files in the Appwrite Node.js SDK are illustrative and don't need to be strictly correct or executable code. They focus on showing API structure and usage patterns rather than being copy-paste ready.

Applied to files:

  • docs/examples/backups/create-restoration.md
  • docs/examples/backups/list-archives.md
  • docs/examples/health/get-queue-threats.md
  • docs/examples/backups/get-archive.md
  • README.md
  • docs/examples/backups/list-policies.md
  • docs/examples/backups/delete-archive.md
  • docs/examples/backups/create-archive.md
  • LICENSE
  • docs/examples/organizations/delete.md
  • docs/examples/health/get-queue-region-manager.md
  • docs/examples/backups/create-policy.md
  • docs/examples/organizations/estimation-delete-organization.md
  • docs/examples/health/get-queue-billing-team-aggregation.md
  • docs/examples/databases/upsert-document.md
  • docs/examples/backups/get-restoration.md
  • docs/examples/backups/get-policy.md
  • docs/examples/backups/delete-policy.md
  • docs/examples/health/get-queue-billing-project-aggregation.md
  • docs/examples/health/get-queue-priority-builds.md
  • docs/examples/backups/update-policy.md
  • docs/examples/backups/list-restorations.md
  • package.json
🧬 Code graph analysis (11)
src/services/organizations.ts (1)
src/models.ts (1)
  • EstimationDeleteOrganization (4247-4252)
src/services/functions.ts (1)
src/models.ts (2)
  • Runtime (3105-3138)
  • Function (2987-3100)
src/services/users.ts (1)
src/models.ts (5)
  • Preferences (2364-2365)
  • DefaultPreferences (2367-2370)
  • User (2172-2249)
  • Jwt (2573-2578)
  • Token (2543-2568)
src/services/account.ts (1)
src/models.ts (1)
  • Jwt (2573-2578)
src/services/messaging.ts (1)
src/models.ts (2)
  • Message (3759-3812)
  • Provider (3717-3754)
src/services/sites.ts (1)
src/models.ts (1)
  • Site (2865-2982)
src/services/tables-db.ts (1)
src/models.ts (13)
  • ColumnFloat (1398-1443)
  • ColumnInteger (1348-1393)
  • ColumnString (1298-1343)
  • ColumnBoolean (1448-1485)
  • ColumnEmail (1490-1531)
  • ColumnEnum (1536-1581)
  • ColumnUrl (1632-1673)
  • ColumnIp (1586-1627)
  • ColumnDatetime (1678-1719)
  • ColumnRelationship (1724-1781)
  • ColumnIndex (1958-1999)
  • Row (2004-2033)
  • DefaultRow (2035-2038)
src/services/backups.ts (1)
src/models.ts (5)
  • BackupArchiveList (4257-4266)
  • BackupArchive (3969-4018)
  • BackupPolicy (4117-4162)
  • BackupRestoration (4167-4212)
  • BackupRestorationList (4285-4294)
src/services/storage.ts (1)
src/models.ts (2)
  • Bucket (2681-2738)
  • File (2631-2676)
src/services/avatars.ts (1)
src/index.ts (1)
  • ImageFormat (32-32)
src/services/databases.ts (1)
src/models.ts (14)
  • Transaction (3855-3880)
  • AttributeFloat (724-769)
  • AttributeInteger (674-719)
  • AttributeString (624-669)
  • AttributeBoolean (774-811)
  • AttributeEmail (816-857)
  • AttributeEnum (862-907)
  • AttributeUrl (958-999)
  • AttributeIp (912-953)
  • AttributeDatetime (1004-1045)
  • AttributeRelationship (1050-1107)
  • Document (2043-2072)
  • DefaultDocument (2074-2077)
  • Index (1912-1953)
🪛 LanguageTool
README.md

[style] ~14-~14: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help ...

(EN_WEAK_ADJECTIVE)


[grammar] ~14-~14: Use a hyphen to join words.
Context: ...e development tasks behind a very simple to use REST API. Appwrite aims to help y...

(QB_NEW_EN_HYPHEN)


[grammar] ~14-~14: Use a hyphen to join words.
Context: ...evelopment tasks behind a very simple to use REST API. Appwrite aims to help you ...

(QB_NEW_EN_HYPHEN)

🪛 markdownlint-cli2 (0.18.1)
docs/examples/tablesdb/update-rows.md

16-16: Bare URL used

(MD034, no-bare-urls)

docs/examples/databases/update-document.md

16-16: Bare URL used

(MD034, no-bare-urls)

docs/examples/tablesdb/update-row.md

16-16: Bare URL used

(MD034, no-bare-urls)

CHANGELOG.md

11-11: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (75)
src/enums/name.ts (1)

12-12: LGTM!

The new V1screenshots enum member follows the established naming conventions and is correctly placed within the enum structure. This addition aligns with the PR objective of syncing with the latest cloud specifications.

LICENSE (1)

1-1: LGTM!

The copyright year update to 2026 is appropriate and routine.

docs/examples/databases/upsert-document.md (1)

14-20: LGTM!

The populated data object provides a more realistic and helpful example for developers than an empty object.

docs/examples/organizations/estimation-delete-organization.md (1)

1-12: LGTM!

The example correctly demonstrates the usage pattern for the new Organizations service and estimationDeleteOrganization method.

docs/examples/account/create-jwt.md (1)

10-12: LGTM!

The example correctly reflects the updated createJWT API signature with the optional duration parameter.

CHANGELOG.md (2)

3-5: LGTM!

The new version 21.1.1 entry appropriately documents the SDK updates to match the latest server specifications.


14-15: LGTM!

The formatting improvements enhance readability without changing the content.

Also applies to: 62-63, 105-106

.github/workflows/publish.yml (3)

8-10: LGTM! Proper permissions for npm OIDC provenance.

The id-token: write permission enables OpenID Connect token generation required for npm provenance attestation. Combined with --provenance in the publish step, this establishes a secure, verifiable link between the published package and this repository.


22-26: LGTM! Node 22 upgrade with npm OIDC preparation.

Node 22 is the current LTS version. Updating npm to the latest version ensures compatibility with OIDC-based provenance publishing.


42-43: Verify Trusted Publisher configuration on npmjs.com for OIDC-based publishing.

The workflow correctly configures OIDC on GitHub Actions with permissions: id-token: write, a GitHub-hosted runner, and npm publish --provenance. However, to use OIDC without npm tokens, you must register a Trusted Publisher on npmjs.com for this repository and workflow. The configuration requires:

  • Repository: appwrite/sdk-for-node
  • Workflow filename: .github/workflows/publish.yml (case-sensitive)
  • (Optional) Environment name if used

Without this npjs.com-side setup, the publish will fail during OIDC token exchange.

src/services/functions.ts (2)

92-92: LGTM! Consistent timeout type widening to number | bigint.

The type update is consistently applied across JSDoc, object-style overload, positional overload, implementation signature, internal params type, and rest-parameter casting for the create method. This aligns with the Function model type definition in src/models.ts.


370-370: LGTM! Consistent timeout type widening in update method.

Same consistent pattern applied to the update method as in create - all signatures, params, and internal typing correctly widened to number | bigint.

src/services/avatars.ts (3)

9-9: LGTM! Enum rename from Output to ImageFormat.

The import correctly reflects the enum rename. This is consistently used in the getScreenshot method's output parameter type.


24-30: LGTM! Consistent number | bigint widening for avatar dimension parameters.

The type widening for width, height, and quality parameters is consistently applied across JSDoc, object-style signature, positional signature, implementation, and internal typing. This pattern is correctly replicated across all avatar methods (getBrowser, getCreditCard, getFlag, getImage, getInitials, getQR, getScreenshot).


582-586: LGTM! getScreenshot method updated with ImageFormat and number | bigint parameters.

The getScreenshot method correctly uses ImageFormat for the output type and widens all numeric parameters (viewport dimensions, scale, geolocation, sleep, output dimensions, quality) to number | bigint. The changes are consistent across all overload signatures and internal typing.

package.json (2)

4-5: LGTM! Version bump to 21.1.1.

The version increment aligns with the SDK updates for bigint support and enum changes.


44-44: No action needed — json-bigint version is current and secure.

Version 1.0.0 is the latest available release and includes the security fix for CVE-2020-8237 (prototype-pollution). No security advisories exist for this version.

docs/examples/avatars/get-screenshot.md (1)

33-33: LGTM! Example updated to use ImageFormat.Jpg.

The documentation correctly reflects the enum rename from Output to ImageFormat, maintaining consistency with the API changes in src/services/avatars.ts.

README.md (3)

4-4: Version badge updated correctly.

The API version badge update from 1.8.0 to 1.8.1 aligns with the SDK synchronization objectives.


9-9: Compatibility statement broadened to "latest".

Changing from "Appwrite server version 1.8.x" to "Appwrite server version latest" removes version-specific constraints. Ensure this reflects the intended support policy—users may expect compatibility guarantees with specific server versions.


14-14: Grammar improvement applied.

The sentence now correctly reads "abstracts and simplifies" instead of the previous version with typos.

docs/examples/health/get-queue-billing-project-aggregation.md (1)

1-12: Example demonstrates the new Health queue method.

The example correctly shows the API structure for getQueueBillingProjectAggregation. Based on learnings, documentation examples are illustrative and focus on showing API structure rather than being executable.

docs/examples/backups/get-restoration.md (1)

1-12: Example demonstrates the new Backups service.

The example clearly shows how to retrieve a restoration using the newly introduced Backups service, following the SDK's established documentation patterns.

docs/examples/backups/delete-archive.md (1)

1-12: Example demonstrates archive deletion.

The example clearly illustrates how to delete a backup archive using the new Backups service, maintaining consistency with the SDK's documentation style.

docs/examples/tablesdb/update-row.md (1)

14-20: Improved example with realistic data payload.

The update from an empty data object to a populated one with sample fields (username, email, fullName, age, isAdmin) better demonstrates the API's usage pattern and helps developers understand the expected data structure.

src/index.ts (1)

4-4: LGTM! New service exports properly integrated.

The Backups and Organizations service exports are correctly added and maintain alphabetical ordering with the existing service exports.

Also applies to: 11-11

docs/examples/databases/update-document.md (1)

14-20: LGTM! Improved documentation with realistic example data.

The populated data object provides clearer guidance for SDK users on expected payload structure. The static analysis warning about a "bare URL" on line 16 is a false positive—it's flagging the email address string value, not an actual URL.

docs/examples/tablesdb/upsert-row.md (1)

14-20: LGTM! Consistent example data across documentation.

The populated data object is consistent with other database operation examples in this PR, providing a clear illustration of expected payload structure.

docs/examples/backups/list-restorations.md (1)

1-12: LGTM! Good documentation for the new Backups service.

The example clearly demonstrates initializing the client with API key authentication and invoking listRestorations. This aligns with the new Backups service export added in src/index.ts.

docs/examples/organizations/delete.md (1)

1-12: LGTM!

The example clearly demonstrates the Organizations service usage for deleting an organization, with appropriate client setup including session authentication.

docs/examples/tablesdb/update-rows.md (1)

13-19: LGTM! Populated data improves the example.

The expanded data payload with realistic user fields makes the example more illustrative of actual usage patterns.

Note: The static analysis warning (MD034) on line 16 is a false positive—the email address is a valid JSON string value, not a bare URL.

docs/examples/databases/update-documents.md (1)

13-19: LGTM! Improved example clarity.

The populated user object demonstrates realistic usage of the data parameter, making the example more helpful for SDK users.

docs/examples/health/get-queue-billing-team-aggregation.md (1)

1-12: LGTM! Documentation example clearly illustrates the API structure.

The example correctly demonstrates the Health service's getQueueBillingTeamAggregation endpoint with optional parameter usage. The object-style parameter passing aligns with the API surface described in the PR changes.

Based on learnings, documentation examples are illustrative and focus on showing API structure rather than being strictly executable code.

docs/examples/backups/list-policies.md (1)

1-12: LGTM! Documentation example correctly demonstrates the new Backups API.

The example clearly shows how to use the new Backups service to list policies with optional query parameters. The structure aligns with the Backups service API surface introduced in this PR.

docs/examples/backups/list-archives.md (1)

1-12: LGTM! Consistent documentation example for the Backups API.

The example correctly demonstrates the listArchives method with optional query parameters, following the same pattern as other Backups service examples in this PR.

docs/examples/backups/get-archive.md (1)

1-12: LGTM! Documentation example clearly shows archive retrieval pattern.

The example correctly demonstrates fetching a specific backup archive using the getArchive method with the required archiveId parameter.

docs/examples/backups/update-policy.md (1)

1-16: LGTM! Comprehensive documentation example for policy updates.

The example effectively demonstrates the updatePolicy method signature, clearly distinguishing between the required policyId parameter and optional configuration fields (name, retention, schedule, enabled).

docs/examples/backups/create-archive.md (1)

1-13: LGTM! Documentation example correctly demonstrates the Backups API structure.

The example follows the established pattern for Appwrite SDK documentation and accurately shows the createArchive method signature with both required and optional parameters.

docs/examples/backups/get-policy.md (1)

1-12: LGTM! Clean and straightforward example.

The example correctly demonstrates the getPolicy method with the required policyId parameter.

docs/examples/backups/delete-policy.md (1)

1-12: LGTM! Example accurately shows the delete operation.

The example correctly demonstrates the deletePolicy method signature.

docs/examples/backups/create-policy.md (1)

1-18: LGTM! Example comprehensively demonstrates the createPolicy API.

The example correctly shows all required parameters (policyId, services, retention, schedule) and optional parameters (name, resourceId, enabled) with helpful inline comments distinguishing optional fields.

docs/examples/backups/create-restoration.md (1)

1-15: LGTM! Example effectively demonstrates the restoration API.

The example correctly shows the createRestoration method with required parameters (archiveId, services) and optional parameters (newResourceId, newResourceName) clearly marked.

src/enums/o-auth-provider.ts (1)

42-44: LGTM! New OAuth providers added.

The new providers (Mockunverified, GithubImagine, GoogleImagine) are correctly added. Minor note: Mockunverified could be MockUnverified for consistency with other multi-word enum keys like PaypalSandbox and TradeshiftBox, but this may be intentional to match server specifications.

src/client.ts (2)

4-5: LGTM! JSONBigInt configured correctly.

The json-bigint module is properly configured with useNativeBigInt: true, which ensures bigint values are preserved as native JavaScript BigInt rather than being converted to a custom type. This aligns with the type expansions (number | bigint) throughout the SDK.


247-248: LGTM! JSONBigInt usage is consistent across request/response flow.

The JSONbig.stringify and JSONbig.parse replacements are correctly applied to:

  • Request body serialization (line 247)
  • Response parsing (line 354)
  • Error response text construction (line 366)

This ensures bigint values round-trip correctly through the SDK.

Also applies to: 354-354, 366-366

src/services/organizations.ts (1)

29-62: LGTM! Implementation follows SDK patterns correctly.

The delete method implementation is consistent with other service methods in the SDK:

  • Proper overload handling for object vs primitive parameters
  • Correct validation of required parameters
  • Proper URL path construction and HTTP method usage
src/services/account.ts (2)

305-352: LGTM! createJWT method properly extended with bigint-compatible duration parameter.

The implementation correctly:

  • Adds overloads for both object and primitive parameter styles
  • Handles the number | bigint type for duration
  • Only includes duration in payload when defined
  • Follows the existing pattern used by other methods in this class

2341-2364: LGTM! OAuth2 token documentation updated with new providers.

The provider list correctly includes the new githubImagine and googleImagine providers. Note that the mock-unverified provider from the enum is not listed in the JSDoc, which may be intentional if mock providers are meant for internal/testing use only.

src/query.ts (4)

1-6: LGTM! Bigint support properly integrated into Query types.

The type system is correctly extended:

  • QueryTypesSingle includes bigint
  • QueryTypesList includes bigint[]
  • JSONbig module is configured consistently with src/client.ts

This ensures queries containing bigint values are properly typed and serialized.


46-52: LGTM! Query serialization preserves bigint values.

Using JSONbig.stringify ensures that bigint values in query parameters are correctly serialized without precision loss.


136-141: LGTM! Range filter methods correctly support bigint.

Both between and notBetween methods now accept string | number | bigint for the start and end parameters, enabling queries on large integer fields.

Also applies to: 280-285


369-379: LGTM! Logical operators correctly parse queries with bigint support.

The or and and methods use JSONbig.parse to deserialize query strings, ensuring bigint values in nested queries are preserved when combining them.

src/services/messaging.ts (3)

550-617: Overload/rest tuple wiring for badge looks consistent.
Indices and optionality line up (rest[12]badge, then draft, scheduledAt, etc.).


2993-3209: BigInt port has the same serialization concern as badge—please confirm end-to-end support.
Even though SMTP ports are typically small, widening to bigint means callers can now pass one; ensure the request serializer won’t throw and that the API actually accepts large integer JSON numbers.


367-433: No action required — bigint support for badge is properly handled by existing json-bigint integration.

The request body serialization already uses JSONbig.stringify() (initialized with useNativeBigInt: true) rather than JSON.stringify(), so bigint values in the payload will serialize correctly without runtime errors. The type changes to support number | bigint for badge parameters are safe and consistent with the SDK's serialization infrastructure.

src/services/tables-db.ts (1)

207-257: Request-body serialization already supports bigint via json-bigint.

The codebase uses json-bigint (configured with useNativeBigInt: true) for request serialization in Client.call. At line 247 of src/client.ts, request bodies are serialized with JSONbig.stringify(params), which properly handles bigint values. No runtime crash will occur when passing bigint in the payload.

Likely an incorrect or invalid review comment.

src/services/users.ts (1)

1117-1182: BigInt serialization is properly handled — no action needed.

The codebase already uses the json-bigint library (configured with useNativeBigInt: true) for JSON request serialization in src/client.ts line 247. The createJWT method with duration?: number | bigint will serialize correctly through JSONbig.stringify(params) rather than the native JSON.stringify(), which explicitly supports native BigInt values.

Likely an incorrect or invalid review comment.

src/services/backups.ts (1)

12-752: Overall structure matches existing service patterns (overloads, payload construction, required param checks).
Looks consistent with the rest of the SDK services.

src/services/health.ts (7)

179-228: LGTM! New queue endpoint for billing project aggregation.

The implementation correctly handles both object-style and deprecated single-parameter overloads. The parameter type discrimination and payload construction are properly implemented.


230-279: LGTM! New queue endpoint for billing team aggregation.

Follows the same well-structured pattern as getQueueBillingProjectAggregation.


332-381: LGTM! New priority builds queue endpoint.

Implementation is consistent with other queue methods and correctly handles the threshold parameter with number | bigint support.


860-909: LGTM! New region manager queue endpoint.

Implementation follows the established pattern. The default threshold of 100 (noted in JSDoc) differs from other endpoints (5000), which appears intentional for this specific queue type.


1013-1062: LGTM! New threats queue endpoint.

Consistent implementation with other queue endpoints. Default threshold of 100 matches the region manager endpoint pattern.


281-330: LGTM on existing queue method updates.

All existing queue methods have been consistently updated to support number | bigint for threshold parameters while maintaining backward compatibility through the overload pattern.

Also applies to: 383-432, 493-542, 605-654, 656-705, 707-756, 758-807, 809-858, 911-960, 962-1011, 1064-1113


434-491: LGTM on multi-parameter queue methods.

getQueueDatabases and getFailedJobs correctly handle multiple parameters with rest parameters for the deprecated overload, maintaining consistency with the single-parameter methods.

Also applies to: 544-603

src/models.ts (10)

551-559: Verify type consistency between JSDoc and type definitions.

The JSDoc comments describe these as "Database backup policies" and "Database backup archives", but the types are Index[] and Collection[] respectively. Given that new types BackupPolicy and BackupArchive are introduced in this PR, verify whether these should be:

  • policies: BackupPolicy[]
  • archives: BackupArchive[]

If the current types are intentional (matching the server API), consider updating the JSDoc comments to clarify why these reuse existing types rather than the new backup-specific types.


22-31: LGTM on list type total field updates.

All list types consistently updated to total: number | bigint to support large result sets. This aligns with JSONBigInt support mentioned in the PR summary.

Also applies to: 36-45, 50-59, 64-73, 78-87, 92-101, 106-115, 120-129, 134-143, 148-157, 162-171, 176-185, 190-199, 204-213, 218-227, 232-241, 246-255, 260-269, 274-283, 288-297, 302-311, 316-325, 330-339, 344-353, 358-367, 372-381, 386-395, 400-409, 414-423, 428-437, 442-451, 456-465, 470-479, 484-493, 498-507, 512-521


658-669: LGTM on attribute type bigint support.

Size and min/max/default fields in AttributeString, AttributeInteger, and AttributeFloat correctly updated to number | bigint.

Also applies to: 708-719, 758-769


2010-2013: LGTM on sequence field bigint support.

$sequence fields in Row and Document types correctly updated to support auto-incrementing IDs that could exceed safe integer range.

Also applies to: 2049-2052


2665-2676: LGTM on remaining bigint field updates.

All size, count, timestamp, and numeric metric fields appropriately updated to number | bigint across File, Bucket, Deployment, Execution, HealthQueue, HealthStatus, HealthTime, Specification, Message, Topic, and Transaction types.

Also applies to: 2711-2738, 3225-3264, 3355-3378, 3537-3542, 3553-3556, 3597-3608, 3629-3636, 3801-3804, 3835-3846, 3873-3876


3965-4018: LGTM on new BackupArchive type.

Well-structured type for backup archives with appropriate fields for tracking archive status, size, and associated resources.


4020-4112: LGTM on new Invoice type.

Comprehensive billing type with proper numeric fields for amounts, tax calculations, and usage tracking. The usage: UsageResources[] field correctly references the new UsageResources type.


4114-4162: LGTM on new BackupPolicy type.

Policy type with schedule (CRON format), retention period, and resource targeting. The retention: number | bigint appropriately supports large retention periods.


4164-4212: LGTM on new BackupRestoration type.

Restoration tracking type with appropriate status tracking and migration reference.


4214-4294: LGTM on remaining new types.

UsageResources, EstimationDeleteOrganization, BackupArchiveList, BackupPolicyList, and BackupRestorationList types are well-structured and follow established patterns.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

export { Theme } from './enums/theme';
export { Timezone } from './enums/timezone';
export { Output } from './enums/output';
export { ImageFormat } from './enums/image-format';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if Output enum file still exists
echo "=== Checking for Output enum file ==="
fd -t f "output.ts" src/enums/

echo ""
echo "=== Checking for remaining references to 'Output' enum ==="
rg -n "Output" --type ts -g "!node_modules"

Repository: appwrite/sdk-for-node

Length of output: 2023


🏁 Script executed:

#!/bin/bash
# Check the actual exports in src/index.ts around line 32
echo "=== Content of src/index.ts ==="
cat -n src/index.ts | head -50

echo ""
echo "=== Check if ImageFormat enum file exists ==="
fd -t f "image-format.ts" src/

echo ""
echo "=== Look for CHANGELOG or breaking changes documentation ==="
fd -t f "CHANGELOG" . || fd -t f "changelog" .

echo ""
echo "=== Search for any 'Output' enum definition ==="
rg -n "enum Output" --type ts

Repository: appwrite/sdk-for-node

Length of output: 3196


🏁 Script executed:

#!/bin/bash
# Check git history of index.ts to see if Output was ever exported
echo "=== Git history of index.ts changes ==="
git log --oneline -20 src/index.ts

echo ""
echo "=== Check if Output was in previous versions of index.ts ==="
git log -p src/index.ts | grep -A 2 -B 2 "Output" | head -30

echo ""
echo "=== Read ImageFormat enum ==="
cat src/enums/image-format.ts

echo ""
echo "=== Search CHANGELOG for 'Output' and 'ImageFormat' ==="
grep -n -i "output\|imageformat" CHANGELOG.md | head -20

Repository: appwrite/sdk-for-node

Length of output: 481


🏁 Script executed:

#!/bin/bash
# Read CHANGELOG around the Output mention
echo "=== CHANGELOG content (first 50 lines) ==="
head -50 CHANGELOG.md

echo ""
echo "=== Search CHANGELOG for breaking changes or migration notes ==="
grep -n -i "breaking\|deprecated\|removed\|migration" CHANGELOG.md | head -10

echo ""
echo "=== Check if Output enum was ever exported - search all versions in git ==="
git log --all --full-history -p -- src/index.ts | grep -C 3 "Output" | head -20

Repository: appwrite/sdk-for-node

Length of output: 2372


🏁 Script executed:

#!/bin/bash
# Find the Output enum definition in git history
echo "=== Search git for Output enum definition ==="
git log --all -p -- src/enums/output.ts | head -50

echo ""
echo "=== Check when output.ts was deleted ==="
git log --all --diff-filter=D -- src/enums/output.ts

echo ""
echo "=== Check if there's any migration guide or deprecation in docs ==="
fd -t f "README\|MIGRATION\|GUIDE\|DEPRECAT" . -i | head -10

Repository: appwrite/sdk-for-node

Length of output: 728


🏁 Script executed:

#!/bin/bash
# Check the full git history including deletions
echo "=== Check git log for all changes to output.ts ==="
git log --all --full-history --oneline -- src/enums/output.ts

echo ""
echo "=== Check if output.ts currently exists ==="
ls -la src/enums/output.ts 2>&1

echo ""
echo "=== Check git diff to see what's changed ==="
git status src/enums/output.ts 2>&1

echo ""
echo "=== Check all commits mentioning Output enum ==="
git log --all --oneline --grep="Output" || echo "No commits found"

echo ""
echo "=== Check recent commits affecting index.ts and enums ==="
git log --oneline -10 -- src/index.ts src/enums/

Repository: appwrite/sdk-for-node

Length of output: 561


🏁 Script executed:

#!/bin/bash
# Check the actual diff between commits
echo "=== Check commit e4e5be2 details ==="
git show e4e5be2 --stat

echo ""
echo "=== Check merge commit ec7998e ==="
git show ec7998e --stat | head -50

echo ""
echo "=== Check if output.ts exists on any branch ==="
git branch -a --contains e4e5be2 || git log --oneline -1

echo ""
echo "=== List all enums currently exported ==="
grep "export.*from.*enums" src/index.ts

echo ""
echo "=== Check CHANGELOG for latest version breaking changes section ==="
sed -n '1,30p' CHANGELOG.md

Repository: appwrite/sdk-for-node

Length of output: 7472


Update CHANGELOG to document the removal of Output enum and replacement with ImageFormat.

This is confirmed as a breaking change. The Output enum, which was added in version 21.0.0 according to the CHANGELOG, has been removed and replaced with ImageFormat. However, the CHANGELOG does not reflect this removal or document the replacement. Add an entry clarifying that Output has been deprecated/removed in favor of ImageFormat (which contains the same values: jpg, jpeg, png, webp, heic, avif, gif) and provide migration guidance for consumers currently using Output.

🤖 Prompt for AI Agents
In `@src/index.ts` at line 32, Update the CHANGELOG to document the breaking
change: add an entry stating that the Output enum was removed and replaced by
ImageFormat, list the equivalent values (jpg, jpeg, png, webp, heic, avif, gif),
mark it as breaking and reference the version bump (the original addition in
21.0.0), and include concise migration guidance showing that consumers should
replace usages of Output with ImageFormat (e.g., ImageFormat.jpg) and import
ImageFormat from './enums/image-format' instead of using Output.

Comment on lines +126 to +193
/**
* Get a backup archive using it's ID.
*
* @param {string} params.archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @throws {AppwriteException}
* @returns {Promise<Models.BackupArchive>}
*/
getArchive(params: { archiveId: string }): Promise<Models.BackupArchive>;
/**
* Get a backup archive using it's ID.
*
* @param {string} archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @throws {AppwriteException}
* @returns {Promise<Models.BackupArchive>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getArchive(archiveId: string): Promise<Models.BackupArchive>;
getArchive(
paramsOrFirst: { archiveId: string } | string
): Promise<Models.BackupArchive> {
let params: { archiveId: string };

if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
params = (paramsOrFirst || {}) as { archiveId: string };
} else {
params = {
archiveId: paramsOrFirst as string
};
}

const archiveId = params.archiveId;

if (typeof archiveId === 'undefined') {
throw new AppwriteException('Missing required parameter: "archiveId"');
}

const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId);
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);

const apiHeaders: { [header: string]: string } = {
}

return this.client.call(
'get',
uri,
apiHeaders,
payload,
);
}

/**
* Delete an existing archive for a project.
*
* @param {string} params.archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteArchive(params: { archiveId: string }): Promise<{}>;
/**
* Delete an existing archive for a project.
*
* @param {string} archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteArchive(archiveId: string): Promise<{}>;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix minor doc issues (“its”, wrong label, stray backtick).
Examples:

  • “using it’s ID” → “using its ID”
  • deleteArchive: param description says “Policy ID” but it’s archiveId
  • Several “Choose a custom ID`” stray backticks

Also applies to: 177-193, 387-462

🤖 Prompt for AI Agents
In `@src/services/backups.ts` around lines 126 - 193, Fix the JSDoc text typos in
the Backup service methods: update "using it's ID" to "using its ID" in
getArchive overloads, change deleteArchive param description from "Policy ID" to
"Archive ID" (for both overloads that reference params.archiveId / archiveId),
and remove stray backticks in phrases like "Choose a custom ID`" across the
getArchive and deleteArchive docs (and any other similar occurrences in this
file, e.g., the other overload JSDoc blocks and related docs).

Comment on lines 280 to 385
/**
* Create a new backup policy.
*
* @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string[]} params.services - Array of services to backup
* @param {number | bigint} params.retention - Days to keep backups before deletion
* @param {string} params.schedule - Schedule CRON syntax.
* @param {string} params.name - Policy name. Max length: 128 chars.
* @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up.
* @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken
* @throws {AppwriteException}
* @returns {Promise<Models.BackupPolicy>}
*/
createPolicy(params: { policyId: string, services: string[], retention: number | bigint, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise<Models.BackupPolicy>;
/**
* Create a new backup policy.
*
* @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string[]} services - Array of services to backup
* @param {number | bigint} retention - Days to keep backups before deletion
* @param {string} schedule - Schedule CRON syntax.
* @param {string} name - Policy name. Max length: 128 chars.
* @param {string} resourceId - Resource ID. When set, only this single resource will be backed up.
* @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken
* @throws {AppwriteException}
* @returns {Promise<Models.BackupPolicy>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createPolicy(policyId: string, services: string[], retention: number | bigint, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>;
createPolicy(
paramsOrFirst: { policyId: string, services: string[], retention: number | bigint, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string,
...rest: [(string[])?, (number | bigint)?, (string)?, (string)?, (string)?, (boolean)?]
): Promise<Models.BackupPolicy> {
let params: { policyId: string, services: string[], retention: number | bigint, schedule: string, name?: string, resourceId?: string, enabled?: boolean };

if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
params = (paramsOrFirst || {}) as { policyId: string, services: string[], retention: number | bigint, schedule: string, name?: string, resourceId?: string, enabled?: boolean };
} else {
params = {
policyId: paramsOrFirst as string,
services: rest[0] as string[],
retention: rest[1] as number | bigint,
schedule: rest[2] as string,
name: rest[3] as string,
resourceId: rest[4] as string,
enabled: rest[5] as boolean
};
}

const policyId = params.policyId;
const services = params.services;
const retention = params.retention;
const schedule = params.schedule;
const name = params.name;
const resourceId = params.resourceId;
const enabled = params.enabled;

if (typeof policyId === 'undefined') {
throw new AppwriteException('Missing required parameter: "policyId"');
}
if (typeof services === 'undefined') {
throw new AppwriteException('Missing required parameter: "services"');
}
if (typeof retention === 'undefined') {
throw new AppwriteException('Missing required parameter: "retention"');
}
if (typeof schedule === 'undefined') {
throw new AppwriteException('Missing required parameter: "schedule"');
}

const apiPath = '/backups/policies';
const payload: Payload = {};
if (typeof policyId !== 'undefined') {
payload['policyId'] = policyId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof services !== 'undefined') {
payload['services'] = services;
}
if (typeof resourceId !== 'undefined') {
payload['resourceId'] = resourceId;
}
if (typeof enabled !== 'undefined') {
payload['enabled'] = enabled;
}
if (typeof retention !== 'undefined') {
payload['retention'] = retention;
}
if (typeof schedule !== 'undefined') {
payload['schedule'] = schedule;
}
const uri = new URL(this.client.config.endpoint + apiPath);

const apiHeaders: { [header: string]: string } = {
'content-type': 'application/json',
}

return this.client.call(
'post',
uri,
apiHeaders,
payload,
);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Verify API contract: endpoint naming + required fields (likely spec mismatch).

  • createRestoration uses /backups/restoration but the other restoration endpoints are /backups/restorations/*.
  • createPolicy doesn’t require/validate name, but Models.BackupPolicy.name is non-optional in the provided models snippet.

Also applies to: 571-701

Comment on lines +12 to +28
/**
* Delete an organization.
*
* @param {string} params.organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: { organizationId: string }): Promise<{}>;
/**
* Delete an organization.
*
* @param {string} organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(organizationId: string): Promise<{}>;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

JSDoc incorrectly references "Team ID" instead of "Organization ID".

The @param descriptions mention "Team ID" but the parameter is organizationId. This appears to be a copy-paste error that could confuse developers.

📝 Suggested fix
     /**
      * Delete an organization.
      *
-     * `@param` {string} params.organizationId - Team ID.
+     * `@param` {string} params.organizationId - Organization ID.
      * `@throws` {AppwriteException}
      * `@returns` {Promise<{}>}
      */
     delete(params: { organizationId: string  }): Promise<{}>;
     /**
      * Delete an organization.
      *
-     * `@param` {string} organizationId - Team ID.
+     * `@param` {string} organizationId - Organization ID.
      * `@throws` {AppwriteException}
      * `@returns` {Promise<{}>}
      * `@deprecated` Use the object parameter style method for a better developer experience.
      */
📝 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
/**
* Delete an organization.
*
* @param {string} params.organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: { organizationId: string }): Promise<{}>;
/**
* Delete an organization.
*
* @param {string} organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(organizationId: string): Promise<{}>;
/**
* Delete an organization.
*
* `@param` {string} params.organizationId - Organization ID.
* `@throws` {AppwriteException}
* `@returns` {Promise<{}>}
*/
delete(params: { organizationId: string }): Promise<{}>;
/**
* Delete an organization.
*
* `@param` {string} organizationId - Organization ID.
* `@throws` {AppwriteException}
* `@returns` {Promise<{}>}
* `@deprecated` Use the object parameter style method for a better developer experience.
*/
delete(organizationId: string): Promise<{}>;
🤖 Prompt for AI Agents
In `@src/services/organizations.ts` around lines 12 - 28, Update the JSDoc for
both overloads of the delete method to reference "Organization ID" instead of
"Team ID": locate the delete(params: { organizationId: string }) and
delete(organizationId: string) declarations and change the `@param` descriptions
so they describe organizationId as "Organization ID" (or similar accurate
wording) to fix the copy-paste error.

Comment on lines +64 to +80
/**
* Get estimation for deleting an organization.
*
* @param {string} params.organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Models.EstimationDeleteOrganization>}
*/
estimationDeleteOrganization(params: { organizationId: string }): Promise<Models.EstimationDeleteOrganization>;
/**
* Get estimation for deleting an organization.
*
* @param {string} organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Models.EstimationDeleteOrganization>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
estimationDeleteOrganization(organizationId: string): Promise<Models.EstimationDeleteOrganization>;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same JSDoc issue: "Team ID" should be "Organization ID".

📝 Suggested fix
     /**
      * Get estimation for deleting an organization.
      *
-     * `@param` {string} params.organizationId - Team ID.
+     * `@param` {string} params.organizationId - Organization ID.
      * `@throws` {AppwriteException}
      * `@returns` {Promise<Models.EstimationDeleteOrganization>}
      */
     estimationDeleteOrganization(params: { organizationId: string  }): Promise<Models.EstimationDeleteOrganization>;
     /**
      * Get estimation for deleting an organization.
      *
-     * `@param` {string} organizationId - Team ID.
+     * `@param` {string} organizationId - Organization ID.
      * `@throws` {AppwriteException}
      * `@returns` {Promise<Models.EstimationDeleteOrganization>}
      * `@deprecated` Use the object parameter style method for a better developer experience.
      */
📝 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
/**
* Get estimation for deleting an organization.
*
* @param {string} params.organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Models.EstimationDeleteOrganization>}
*/
estimationDeleteOrganization(params: { organizationId: string }): Promise<Models.EstimationDeleteOrganization>;
/**
* Get estimation for deleting an organization.
*
* @param {string} organizationId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Models.EstimationDeleteOrganization>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
estimationDeleteOrganization(organizationId: string): Promise<Models.EstimationDeleteOrganization>;
/**
* Get estimation for deleting an organization.
*
* `@param` {string} params.organizationId - Organization ID.
* `@throws` {AppwriteException}
* `@returns` {Promise<Models.EstimationDeleteOrganization>}
*/
estimationDeleteOrganization(params: { organizationId: string }): Promise<Models.EstimationDeleteOrganization>;
/**
* Get estimation for deleting an organization.
*
* `@param` {string} organizationId - Organization ID.
* `@throws` {AppwriteException}
* `@returns` {Promise<Models.EstimationDeleteOrganization>}
* `@deprecated` Use the object parameter style method for a better developer experience.
*/
estimationDeleteOrganization(organizationId: string): Promise<Models.EstimationDeleteOrganization>;
🤖 Prompt for AI Agents
In `@src/services/organizations.ts` around lines 64 - 80, The JSDoc for both
overloads of estimationDeleteOrganization incorrectly labels the parameter as
"Team ID"; update the `@param` descriptions for the signatures named
estimationDeleteOrganization (the object-style overload params.organizationId
and the string overload organizationId) to say "Organization ID" instead of
"Team ID" so the documentation matches the method purpose.

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

Caution

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

⚠️ Outside diff range comments (8)
src/services/account.ts (1)

302-352: Bug: createJWT(0) is treated as “no params” due to !paramsOrFirst check.

If a caller passes 0 (or any falsy number), the code enters the “object/undefined” branch and drops duration.

Proposed fix
-        if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
+        if (typeof paramsOrFirst === 'undefined' || (typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
             params = (paramsOrFirst || {}) as { duration?: number };
         } else {
             params = {
                 duration: paramsOrFirst as number            
             };
         }
src/models.ts (3)

674-719: bigint support is inconsistent: default should likely allow bigint too.

You widened min/max to number | bigint, but default remains number for both integer attribute/column types.

Proposed fix
 export type AttributeInteger = {
@@
-        default?: number;
+        default?: number | bigint;
     }

 export type ColumnInteger = {
@@
-        default?: number;
+        default?: number | bigint;
     }

Also applies to: 1348-1393


526-559: Incorrect types on Database.policies and Database.archives.

The fields are typed as Index[] and Collection[], but the docstrings state "Database backup policies" and "Database backup archives". The dedicated BackupPolicy and BackupArchive types exist and are the correct types for these fields. Using Index[] and Collection[] is semantically incorrect—these represent database indexes and collections, not backup data.

Proposed fix
 export type Database = {
     /**
      * Database backup policies.
      */
-    policies: Index[];
+    policies: BackupPolicy[];
     /**
      * Database backup archives.
      */
-    archives: Collection[];
+    archives: BackupArchive[];
 }

526-559: Fix incorrect type definitions for backup policies and archives in Database type

The policies field should be BackupPolicy[] instead of Index[], and the archives field should be BackupArchive[] instead of Collection[]. The field descriptions correctly indicate these are database backup-related types, but the types themselves reference database schema types (Index and Collection), which is incorrect. The correct types (BackupPolicy and BackupArchive) are already defined elsewhere in the codebase (lines 4125 and 3977 respectively) and used consistently in BackupPolicyList and BackupArchiveList.

src/services/databases.ts (4)

2268-2370: updateIntegerAttribute types say xdefault optional, but runtime requires it.

Overloads and params typing mark xdefault?: number | bigint (Line 2276, 2293, 2298), but the implementation throws if xdefault is undefined (Line 2336-2338). This is a TS contract bug (and can mislead callers).

Proposed fix (make xdefault required in overloads + params typing)
- updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string  }): Promise<Models.AttributeInteger>;
+ updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string  }): Promise<Models.AttributeInteger>;

- updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>;
+ updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>;

  updateIntegerAttribute(
-     paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string,
+     paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string,
      ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?]    
  ): Promise<Models.AttributeInteger> {
-     let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string };
+     let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string };

2157-2258: Type mismatch: AttributeInteger.default should accept bigint to match input parameter.

The createIntegerAttribute method accepts xdefault?: number | bigint and writes it to the request payload as default. However, Models.AttributeInteger.default is typed as number (src/models.ts:718), not number | bigint. This creates an inconsistency where the response type doesn't match the input surface.

Update Models.AttributeInteger.default type from number to number | bigint to align with the input parameters.

Note: BigInt serialization is safe; the SDK already uses json-bigint with useNativeBigInt: true for payload serialization (src/client.ts:4-5, 247).


3635-3693: getAttribute return type missing geometry attribute models.

The method's return type union omits Models.AttributePoint, Models.AttributeLineString, and Models.AttributePolygon, which are defined in the Models and can be returned by this API. Without these types, callers cannot properly narrow the return type for geometry attributes.

Fix: extend return type union to include geometry types
- * `@returns` {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>}
+ * `@returns` {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon>}

- getAttribute(params: { databaseId: string, collectionId: string, key: string  }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>;
+ getAttribute(params: { databaseId: string, collectionId: string, key: string  }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon>;

- getAttribute(databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>;
+ getAttribute(databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon>;

- ): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString> {
+ ): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon> {

4432-4506: Restore data as required and update documentation to clarify.

The Appwrite Databases API requires the data field in upsert requests (PUT /databases/{databaseId}/collections/{collectionId}/documents/{documentId}). Making data optional in the TypeScript client (line 4485–4487) allows invalid calls that fail at the server instead of being caught client-side. This shifts validation burden to the API and provides worse developer experience.

Either:

  1. Revert data to a required parameter, or
  2. Keep it optional but clearly document that the server will reject requests without data, and add client-side validation to throw an error if data is undefined (similar to the checks for databaseId, collectionId, and documentId).

The @deprecated JSDoc should also explicitly note that data is required even though it is marked optional in the signature.

🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Around line 3-10: Update the CHANGELOG.md entry: change the header from "##
21.1.1" to "## 21.2.0" to reflect the breaking change, and fix MD007 by
converting the nested bullet indentation under that header from 4 spaces to 2
spaces; ensure the line that documents the rename uses the exact symbols
"Output" and "ImageFormat" (e.g., "`Output` is now renamed to `ImageFormat` -
Note that this is a breaking change") so the breaking change is clearly recorded
under the new 21.2.0 heading.

In `@src/models.ts`:
- Around line 4172-4220: The BackupRestoration type currently declares options:
string but the doc says it's an optional key-value object; update the
BackupRestoration definition (symbol: BackupRestoration) to use an object-ish
type and mark it optional, e.g. change options: string to options?:
Record<string, unknown> (or a more specific Record if known) so consumers can
safely access keys.

In `@src/services/tables-db.ts`:
- Around line 3597-3615: The getColumn overloads and implementation currently
omit geo column types; update all three return-type unions for getColumn (the
JSDoc/typed signature, the deprecated signature, and the implementation
signature) to include Models.ColumnLine, Models.ColumnPoint, and
Models.ColumnPolygon so the method can return geo columns created by
createLineColumn/createPointColumn/createPolygonColumn; ensure any local
variable typing for params/return in the getColumn implementation matches the
extended union as well.
♻️ Duplicate comments (2)
src/services/backups.ts (2)

126-193: Fix doc typos (“its”), wrong label (Archive vs Policy), and stray backticks in JSDoc.

Proposed doc fixes
-     * Get a backup archive using it's ID.
+     * Get a backup archive using its ID.
...
-     * `@param` {string} params.archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} params.archiveId - Archive ID. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
...
-     * Get a backup archive using it's ID.
+     * Get a backup archive using its ID.
...
-     * `@param` {string} archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} archiveId - Archive ID. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
...
-     * `@param` {string} params.archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} params.archiveId - Archive ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
...
-     * `@param` {string} archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} archiveId - Archive ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

-     * Get a backup policy using it's ID.
+     * Get a backup policy using its ID.
...
-     * `@param` {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} params.policyId - Policy ID. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
...
-     * Get a backup policy using it's ID.
+     * Get a backup policy using its ID.
...
-     * `@param` {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} policyId - Policy ID. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

-     * Update an existing policy using it's ID.
+     * Update an existing policy using its ID.
...
-     * Delete a policy using it's ID.
+     * Delete a policy using its ID.

-     * `@param` {string} params.restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} params.restorationId - Restoration ID. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
...
-     * `@param` {string} restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
+     * `@param` {string} restorationId - Restoration ID. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

Also applies to: 387-462, 702-718


280-385: Verify createRestoration endpoint path + make createPolicy.name required if the API/model requires it.

  • createRestoration uses '/backups/restoration' but listRestorations/getRestoration use '/backups/restorations' → likely a 404/spec mismatch.
  • createPolicy has name?: string and no validation, but Models.BackupPolicy.name is non-optional; if the API requires it, this should be required + validated.
Proposed fix (pending spec confirmation)
-    createPolicy(params: { policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean  }): Promise<Models.BackupPolicy>;
+    createPolicy(params: { policyId: string, services: string[], retention: number, schedule: string, name: string, resourceId?: string, enabled?: boolean  }): Promise<Models.BackupPolicy>;
...
-    createPolicy(policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>;
+    createPolicy(policyId: string, services: string[], retention: number, schedule: string, name: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>;
...
-        paramsOrFirst: { policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string,
+        paramsOrFirst: { policyId: string, services: string[], retention: number, schedule: string, name: string, resourceId?: string, enabled?: boolean } | string,
...
-        let params: { policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean };
+        let params: { policyId: string, services: string[], retention: number, schedule: string, name: string, resourceId?: string, enabled?: boolean };
...
-            params = (paramsOrFirst || {}) as { policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean };
+            params = (paramsOrFirst || {}) as { policyId: string, services: string[], retention: number, schedule: string, name: string, resourceId?: string, enabled?: boolean };
...
         if (typeof schedule === 'undefined') {
             throw new AppwriteException('Missing required parameter: "schedule"');
         }
+        if (typeof name === 'undefined') {
+            throw new AppwriteException('Missing required parameter: "name"');
+        }

-        const apiPath = '/backups/restoration';
+        const apiPath = '/backups/restorations';
In Appwrite Cloud API specs, what is the correct endpoint for creating a backup restoration: `/backups/restoration` or `/backups/restorations`?
In Appwrite Cloud API specs, is `name` required when creating a backup policy (`POST /backups/policies`)?

Also applies to: 571-649

🧹 Nitpick comments (3)
src/services/health.ts (1)

179-279: Bug: threshold=0 gets dropped in new health queue methods due to !paramsOrFirst.

All newly added methods use if (!paramsOrFirst || ...), so passing 0 will be treated as “no params” and won’t send threshold.

Proposed fix (apply to each new method)
-        if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
+        if (typeof paramsOrFirst === 'undefined' || (typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
             params = (paramsOrFirst || {}) as { threshold?: number };
         } else {
             params = {
                 threshold: paramsOrFirst as number            
             };
         }

Also applies to: 332-382, 860-910, 1013-1063

src/models.ts (2)

2631-2684: Consider whether new required fields (File.encryption, File.compression, Bucket.totalSize) should be optional for compatibility.

If older server versions (or partial projections) don’t include these fields, making them required can break consumers who type-narrow/deserialize strictly.

Also applies to: 2689-2746


4031-4120: Doc/field naming nits in new billing models.

  • Invoice.teamId is documented as “Project ID” (seems inconsistent with the field name).
  • UsageResources.desc is a bit unclear vs “description” (if this is part of the public surface, consider aligning with server naming consistently).

Also applies to: 4222-4251

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 390b296 and 58e8f55.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • src/enums/o-auth-provider.ts
  • src/models.ts
  • src/services/account.ts
  • src/services/avatars.ts
  • src/services/backups.ts
  • src/services/databases.ts
  • src/services/health.ts
  • src/services/storage.ts
  • src/services/tables-db.ts
💤 Files with no reviewable changes (1)
  • src/enums/o-auth-provider.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/services/storage.ts
🧰 Additional context used
🧬 Code graph analysis (6)
src/services/account.ts (1)
src/models.ts (1)
  • Jwt (2573-2578)
src/services/databases.ts (1)
src/models.ts (10)
  • AttributeInteger (674-719)
  • AttributeBoolean (774-811)
  • AttributeFloat (724-769)
  • AttributeEmail (816-857)
  • AttributeEnum (862-907)
  • AttributeUrl (958-999)
  • AttributeIp (912-953)
  • AttributeDatetime (1004-1045)
  • AttributeRelationship (1050-1107)
  • AttributeString (624-669)
src/services/health.ts (1)
src/models.ts (1)
  • HealthQueue (3545-3550)
src/services/avatars.ts (1)
src/index.ts (3)
  • Theme (30-30)
  • Timezone (31-31)
  • ImageFormat (32-32)
src/services/backups.ts (1)
src/models.ts (6)
  • BackupArchiveList (4265-4274)
  • BackupArchive (3977-4026)
  • BackupPolicyList (4279-4288)
  • BackupPolicy (4125-4170)
  • BackupRestoration (4175-4220)
  • BackupRestorationList (4293-4302)
src/services/tables-db.ts (1)
src/models.ts (10)
  • ColumnInteger (1348-1393)
  • ColumnBoolean (1448-1485)
  • ColumnFloat (1398-1443)
  • ColumnEmail (1490-1531)
  • ColumnEnum (1536-1581)
  • ColumnUrl (1632-1673)
  • ColumnIp (1586-1627)
  • ColumnDatetime (1678-1719)
  • ColumnRelationship (1724-1781)
  • ColumnString (1298-1343)
🪛 markdownlint-cli2 (0.18.1)
CHANGELOG.md

6-6: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


7-7: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


8-8: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


9-9: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

🔇 Additional comments (5)
src/services/avatars.ts (3)

9-9: LGTM!

Import correctly updated to use the renamed ImageFormat enum, aligning with the PR objective to rename Output to ImageFormat.


582-648: LGTM!

The Output to ImageFormat rename is consistently applied across all overloads, type declarations, JSDoc annotations, and implementation casts in the getScreenshot method.


30-30: AI summary inconsistency: bigint types not present.

The AI summary claims parameter types were broadened to number | bigint for width, height, and quality across avatar endpoints, but the actual code shows only number types. Please verify if bigint support was intentionally omitted from this file or if changes are missing.

src/services/backups.ts (1)

1-125: Backups service structure/overload pattern is consistent with other services.

src/services/tables-db.ts (1)

2134-2233: Remove this comment. The code properly handles bigint serialization using the json-bigint library with useNativeBigInt: true configuration. Requests will not crash when bigint values are present in the payload, as they are serialized via JSONbig.stringify() rather than native JSON.stringify(). The type difference between input parameters accepting number | bigint and the response model's default?: number is not a problem—it's standard API design where input types can be wider than response types.

Likely an incorrect or invalid review comment.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +3 to +10
## 21.1.1

* Update SDK as per latest server specs, these include -
* Updates to Runtime enums
* `Output` is now renamed to `ImageFormat` - Note that this is a breaking change
* Introduces Backups module for managing Database backups
* Introduces Organization module

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Read the CHANGELOG.md file to examine the actual structure and indentation
head -50 CHANGELOG.md

Repository: appwrite/sdk-for-node

Length of output: 1706


🏁 Script executed:

# Check for markdown linting configuration files
fd -e json -e yaml -e yml | xargs grep -l "markdownlint\|MD007" 2>/dev/null || echo "No linting config found with grep"
ls -la | grep -E "markdownlint|eslint"

Repository: appwrite/sdk-for-node

Length of output: 182


🏁 Script executed:

# Look for any documentation about versioning
fd -e md | xargs grep -l "semver\|semantic.*version\|breaking.*change" 2>/dev/null | head -10

Repository: appwrite/sdk-for-node

Length of output: 77


🏁 Script executed:

# Read the markdownlint configuration
cat coderabbit.markdownlint-cli2.jsonc

Repository: appwrite/sdk-for-node

Length of output: 543


🏁 Script executed:

# Check if there's any semver or release documentation
fd -e md | xargs grep -i "breaking\|semver\|version" 2>/dev/null | grep -v node_modules | head -20

Repository: appwrite/sdk-for-node

Length of output: 1084


🏁 Script executed:

# Look at more context around version releases to understand versioning strategy
grep -A 5 "^## [0-9]" CHANGELOG.md | head -80

Repository: appwrite/sdk-for-node

Length of output: 2485


Fix MD007 list indentation and correct version bump for breaking change.

The nested bullets under 21.1.1 use 4-space indentation, which violates MD007 (default rule requires 2-space). Additionally, the changelog explicitly documents a breaking change (OutputImageFormat rename), which should bump the minor version to 21.2.0, not the patch version, per semver conventions used elsewhere in this project (e.g., 21.0.0 and 16.0.0 for breaking changes).

Proposed formatting fix
 ## 21.1.1
-
-* Update SDK as per latest server specs, these include -
-    * Updates to Runtime enums
-    * `Output` is now renamed to `ImageFormat` - Note that this is a breaking change
-    * Introduces Backups module for managing Database backups
-    * Introduces Organization module
+* Update SDK as per latest server specs, these include:
+  * Updates to Runtime enums
+  * `Output` is now renamed to `ImageFormat` - Note that this is a breaking change
+  * Introduces Backups module for managing Database backups
+  * Introduces Organization module
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

6-6: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


7-7: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


8-8: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


9-9: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

🤖 Prompt for AI Agents
In `@CHANGELOG.md` around lines 3 - 10, Update the CHANGELOG.md entry: change the
header from "## 21.1.1" to "## 21.2.0" to reflect the breaking change, and fix
MD007 by converting the nested bullet indentation under that header from 4
spaces to 2 spaces; ensure the line that documents the rename uses the exact
symbols "Output" and "ImageFormat" (e.g., "`Output` is now renamed to
`ImageFormat` - Note that this is a breaking change") so the breaking change is
clearly recorded under the new 21.2.0 heading.

Comment on lines +4172 to +4220
/**
* Restoration
*/
export type BackupRestoration = {
/**
* Restoration ID.
*/
$id: string;
/**
* Restoration creation time in ISO 8601 format.
*/
$createdAt: string;
/**
* Restoration update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Backup archive ID.
*/
archiveId: string;
/**
* Backup policy ID.
*/
policyId: string;
/**
* The status of the restoration. Possible values: pending, downloading, processing, completed, failed.
*/
status: string;
/**
* The backup start time.
*/
startedAt: string;
/**
* Migration ID.
*/
migrationId: string;
/**
* The services that are backed up by this policy.
*/
services: string[];
/**
* The resources that are backed up by this policy.
*/
resources: string[];
/**
* Optional data in key-value object.
*/
options: string;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

BackupRestoration.options is typed as string but documented as key-value object.

This should be an object-ish type (e.g., Record<string, unknown>), otherwise consumers can’t safely access keys.

Proposed fix
 export type BackupRestoration = {
@@
-        /**
-         * Optional data in key-value object. 
-         */
-        options: string;
+        /**
+         * Optional data in key-value object.
+         */
+        options: Record<string, unknown>;
     }
📝 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
/**
* Restoration
*/
export type BackupRestoration = {
/**
* Restoration ID.
*/
$id: string;
/**
* Restoration creation time in ISO 8601 format.
*/
$createdAt: string;
/**
* Restoration update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Backup archive ID.
*/
archiveId: string;
/**
* Backup policy ID.
*/
policyId: string;
/**
* The status of the restoration. Possible values: pending, downloading, processing, completed, failed.
*/
status: string;
/**
* The backup start time.
*/
startedAt: string;
/**
* Migration ID.
*/
migrationId: string;
/**
* The services that are backed up by this policy.
*/
services: string[];
/**
* The resources that are backed up by this policy.
*/
resources: string[];
/**
* Optional data in key-value object.
*/
options: string;
}
/**
* Restoration
*/
export type BackupRestoration = {
/**
* Restoration ID.
*/
$id: string;
/**
* Restoration creation time in ISO 8601 format.
*/
$createdAt: string;
/**
* Restoration update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Backup archive ID.
*/
archiveId: string;
/**
* Backup policy ID.
*/
policyId: string;
/**
* The status of the restoration. Possible values: pending, downloading, processing, completed, failed.
*/
status: string;
/**
* The backup start time.
*/
startedAt: string;
/**
* Migration ID.
*/
migrationId: string;
/**
* The services that are backed up by this policy.
*/
services: string[];
/**
* The resources that are backed up by this policy.
*/
resources: string[];
/**
* Optional data in key-value object.
*/
options: Record<string, unknown>;
}
🤖 Prompt for AI Agents
In `@src/models.ts` around lines 4172 - 4220, The BackupRestoration type currently
declares options: string but the doc says it's an optional key-value object;
update the BackupRestoration definition (symbol: BackupRestoration) to use an
object-ish type and mark it optional, e.g. change options: string to options?:
Record<string, unknown> (or a more specific Record if known) so consumers can
safely access keys.

Comment on lines +3597 to 3615
* @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>}
*/
getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>;
getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>;
/**
* Get column by ID.
*
* @param {string} databaseId - Database ID.
* @param {string} tableId - Table ID.
* @param {string} key - Column Key.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getColumn(databaseId: string, tableId: string, key: string): Promise<{}>;
getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>;
getColumn(
paramsOrFirst: { databaseId: string, tableId: string, key: string } | string,
...rest: [(string)?, (string)?]
): Promise<{}> {
): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString> {
let params: { databaseId: string, tableId: string, key: string };
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's verify the file exists and check the relevant lines
wc -l src/services/tables-db.ts

Repository: appwrite/sdk-for-node

Length of output: 95


🏁 Script executed:

# Let's look at the getColumn method around the specified lines
head -n 3620 src/services/tables-db.ts | tail -n 30

Repository: appwrite/sdk-for-node

Length of output: 2390


🏁 Script executed:

# Search for createLineColumn, createPointColumn, createPolygonColumn methods
rg "createLineColumn|createPointColumn|createPolygonColumn" src/services/tables-db.ts

Repository: appwrite/sdk-for-node

Length of output: 1011


🏁 Script executed:

# Search for ColumnLine, ColumnPoint, ColumnPolygon model types
rg "ColumnLine|ColumnPoint|ColumnPolygon" src/

Repository: appwrite/sdk-for-node

Length of output: 4353


🏁 Script executed:

# Check the full return type union in getColumn method signature
rg -A 5 "getColumn\(params:" src/services/tables-db.ts | head -n 20

Repository: appwrite/sdk-for-node

Length of output: 501


🏁 Script executed:

# Search for Model type definitions to see all available column types
rg "ColumnBoolean|ColumnInteger|ColumnFloat" src/ | grep -i "models\|interface\|type" | head -n 10

Repository: appwrite/sdk-for-node

Length of output: 1218


🏁 Script executed:

# Search for the complete column union definition in models.ts
rg -B 5 -A 10 "columns:" src/models.ts | head -n 50

Repository: appwrite/sdk-for-node

Length of output: 1434


🏁 Script executed:

# Check if there's a dedicated Column type union in models.ts
rg "type Column.*=" src/models.ts | head -n 20

Repository: appwrite/sdk-for-node

Length of output: 589


🏁 Script executed:

# Let's see how many places getColumn is referenced/used
rg "getColumn" src/services/tables-db.ts | wc -l

Repository: appwrite/sdk-for-node

Length of output: 66


🏁 Script executed:

# Check if there are any overloads or implementations of getColumn that might handle these types
sed -n '3590,3650p' src/services/tables-db.ts

Repository: appwrite/sdk-for-node

Length of output: 3526


Extend getColumn return type to include geo column types.

The return type union is missing Models.ColumnLine | Models.ColumnPoint | Models.ColumnPolygon. The service supports creating these columns via createLineColumn(), createPointColumn(), and createPolygonColumn(), and the models define a complete column union that includes these types (see Table.columns and ColumnList.columns in models.ts). Update all three getColumn overloads and its implementation to include the missing geo types.

Proposed fix (extend union to include geo columns)
-     * `@returns` {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>}
+     * `@returns` {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString | Models.ColumnLine | Models.ColumnPoint | Models.ColumnPolygon>}
      */
-    getColumn(params: { databaseId: string, tableId: string, key: string  }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>;
+    getColumn(params: { databaseId: string, tableId: string, key: string  }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString | Models.ColumnLine | Models.ColumnPoint | Models.ColumnPolygon>;

-     * `@returns` {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>}
+     * `@returns` {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString | Models.ColumnLine | Models.ColumnPoint | Models.ColumnPolygon>}
      * `@deprecated` Use the object parameter style method for a better developer experience.
      */
-    getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>;
+    getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString | Models.ColumnLine | Models.ColumnPoint | Models.ColumnPolygon>;

-    ): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString> {
+    ): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString | Models.ColumnLine | Models.ColumnPoint | Models.ColumnPolygon> {
🤖 Prompt for AI Agents
In `@src/services/tables-db.ts` around lines 3597 - 3615, The getColumn overloads
and implementation currently omit geo column types; update all three return-type
unions for getColumn (the JSDoc/typed signature, the deprecated signature, and
the implementation signature) to include Models.ColumnLine, Models.ColumnPoint,
and Models.ColumnPolygon so the method can return geo columns created by
createLineColumn/createPointColumn/createPolygonColumn; ensure any local
variable typing for params/return in the getColumn implementation matches the
extended union as well.

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.

2 participants