Skip to content

feat: Web SDK update for version 22.1.0#152

Merged
abnegate merged 6 commits intomainfrom
dev
Feb 13, 2026
Merged

feat: Web SDK update for version 22.1.0#152
abnegate merged 6 commits intomainfrom
dev

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Feb 12, 2026

This PR contains updates to the Web SDK for version 22.1.0.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

Warning

Rate limit exceeded

@ArnabChatterjee20k has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

This pull request bumps the SDK version from 22.0.0 to 22.1.0 and introduces several significant changes: a refactored realtime subscription system with per-subscription query support and slot-based routing, removal of the Roles enum with migration to string[] type parameters in Teams, new API key and payment method management for accounts, a new Organizations service, and expanded model types including invoices and billing. Most documentation examples are reformatted with markdown code fences for consistency. OAuth providers and a Scopes enum are also added.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
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.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (134 files):

⚔️ CHANGELOG.md (content)
⚔️ README.md (content)
⚔️ docs/examples/account/create-anonymous-session.md (content)
⚔️ docs/examples/account/create-email-password-session.md (content)
⚔️ docs/examples/account/create-email-token.md (content)
⚔️ docs/examples/account/create-email-verification.md (content)
⚔️ docs/examples/account/create-jwt.md (content)
⚔️ docs/examples/account/create-magic-url-token.md (content)
⚔️ docs/examples/account/create-mfa-authenticator.md (content)
⚔️ docs/examples/account/create-mfa-challenge.md (content)
⚔️ docs/examples/account/create-mfa-recovery-codes.md (content)
⚔️ docs/examples/account/create-o-auth-2-session.md (content)
⚔️ docs/examples/account/create-o-auth-2-token.md (content)
⚔️ docs/examples/account/create-phone-token.md (content)
⚔️ docs/examples/account/create-phone-verification.md (content)
⚔️ docs/examples/account/create-push-target.md (content)
⚔️ docs/examples/account/create-recovery.md (content)
⚔️ docs/examples/account/create-session.md (content)
⚔️ docs/examples/account/create-verification.md (content)
⚔️ docs/examples/account/create.md (content)
⚔️ docs/examples/account/delete-identity.md (content)
⚔️ docs/examples/account/delete-mfa-authenticator.md (content)
⚔️ docs/examples/account/delete-push-target.md (content)
⚔️ docs/examples/account/delete-session.md (content)
⚔️ docs/examples/account/delete-sessions.md (content)
⚔️ docs/examples/account/get-mfa-recovery-codes.md (content)
⚔️ docs/examples/account/get-prefs.md (content)
⚔️ docs/examples/account/get-session.md (content)
⚔️ docs/examples/account/get.md (content)
⚔️ docs/examples/account/list-identities.md (content)
⚔️ docs/examples/account/list-logs.md (content)
⚔️ docs/examples/account/list-mfa-factors.md (content)
⚔️ docs/examples/account/list-sessions.md (content)
⚔️ docs/examples/account/update-email-verification.md (content)
⚔️ docs/examples/account/update-email.md (content)
⚔️ docs/examples/account/update-magic-url-session.md (content)
⚔️ docs/examples/account/update-mfa-authenticator.md (content)
⚔️ docs/examples/account/update-mfa-challenge.md (content)
⚔️ docs/examples/account/update-mfa-recovery-codes.md (content)
⚔️ docs/examples/account/update-mfa.md (content)
⚔️ docs/examples/account/update-name.md (content)
⚔️ docs/examples/account/update-password.md (content)
⚔️ docs/examples/account/update-phone-session.md (content)
⚔️ docs/examples/account/update-phone-verification.md (content)
⚔️ docs/examples/account/update-phone.md (content)
⚔️ docs/examples/account/update-prefs.md (content)
⚔️ docs/examples/account/update-push-target.md (content)
⚔️ docs/examples/account/update-recovery.md (content)
⚔️ docs/examples/account/update-session.md (content)
⚔️ docs/examples/account/update-status.md (content)
⚔️ docs/examples/account/update-verification.md (content)
⚔️ docs/examples/avatars/get-browser.md (content)
⚔️ docs/examples/avatars/get-credit-card.md (content)
⚔️ docs/examples/avatars/get-favicon.md (content)
⚔️ docs/examples/avatars/get-flag.md (content)
⚔️ docs/examples/avatars/get-image.md (content)
⚔️ docs/examples/avatars/get-initials.md (content)
⚔️ docs/examples/avatars/get-qr.md (content)
⚔️ docs/examples/avatars/get-screenshot.md (content)
⚔️ docs/examples/databases/create-document.md (content)
⚔️ docs/examples/databases/create-operations.md (content)
⚔️ docs/examples/databases/create-transaction.md (content)
⚔️ docs/examples/databases/decrement-document-attribute.md (content)
⚔️ docs/examples/databases/delete-document.md (content)
⚔️ docs/examples/databases/delete-transaction.md (content)
⚔️ docs/examples/databases/get-document.md (content)
⚔️ docs/examples/databases/get-transaction.md (content)
⚔️ docs/examples/databases/increment-document-attribute.md (content)
⚔️ docs/examples/databases/list-documents.md (content)
⚔️ docs/examples/databases/list-transactions.md (content)
⚔️ docs/examples/databases/update-document.md (content)
⚔️ docs/examples/databases/update-transaction.md (content)
⚔️ docs/examples/databases/upsert-document.md (content)
⚔️ docs/examples/functions/create-execution.md (content)
⚔️ docs/examples/functions/get-execution.md (content)
⚔️ docs/examples/functions/list-executions.md (content)
⚔️ docs/examples/graphql/mutation.md (content)
⚔️ docs/examples/graphql/query.md (content)
⚔️ docs/examples/locale/get.md (content)
⚔️ docs/examples/locale/list-codes.md (content)
⚔️ docs/examples/locale/list-continents.md (content)
⚔️ docs/examples/locale/list-countries-eu.md (content)
⚔️ docs/examples/locale/list-countries-phones.md (content)
⚔️ docs/examples/locale/list-countries.md (content)
⚔️ docs/examples/locale/list-currencies.md (content)
⚔️ docs/examples/locale/list-languages.md (content)
⚔️ docs/examples/messaging/create-subscriber.md (content)
⚔️ docs/examples/messaging/delete-subscriber.md (content)
⚔️ docs/examples/storage/create-file.md (content)
⚔️ docs/examples/storage/delete-file.md (content)
⚔️ docs/examples/storage/get-file-download.md (content)
⚔️ docs/examples/storage/get-file-preview.md (content)
⚔️ docs/examples/storage/get-file-view.md (content)
⚔️ docs/examples/storage/get-file.md (content)
⚔️ docs/examples/storage/list-files.md (content)
⚔️ docs/examples/storage/update-file.md (content)
⚔️ docs/examples/tablesdb/create-operations.md (content)
⚔️ docs/examples/tablesdb/create-row.md (content)
⚔️ docs/examples/tablesdb/create-transaction.md (content)
⚔️ docs/examples/tablesdb/decrement-row-column.md (content)
⚔️ docs/examples/tablesdb/delete-row.md (content)
⚔️ docs/examples/tablesdb/delete-transaction.md (content)
⚔️ docs/examples/tablesdb/get-row.md (content)
⚔️ docs/examples/tablesdb/get-transaction.md (content)
⚔️ docs/examples/tablesdb/increment-row-column.md (content)
⚔️ docs/examples/tablesdb/list-rows.md (content)
⚔️ docs/examples/tablesdb/list-transactions.md (content)
⚔️ docs/examples/tablesdb/update-row.md (content)
⚔️ docs/examples/tablesdb/update-transaction.md (content)
⚔️ docs/examples/tablesdb/upsert-row.md (content)
⚔️ docs/examples/teams/create-membership.md (content)
⚔️ docs/examples/teams/create.md (content)
⚔️ docs/examples/teams/delete-membership.md (content)
⚔️ docs/examples/teams/delete.md (content)
⚔️ docs/examples/teams/get-membership.md (content)
⚔️ docs/examples/teams/get-prefs.md (content)
⚔️ docs/examples/teams/get.md (content)
⚔️ docs/examples/teams/list-memberships.md (content)
⚔️ docs/examples/teams/list.md (content)
⚔️ docs/examples/teams/update-membership-status.md (content)
⚔️ docs/examples/teams/update-membership.md (content)
⚔️ docs/examples/teams/update-name.md (content)
⚔️ docs/examples/teams/update-prefs.md (content)
⚔️ package.json (content)
⚔️ src/channel.ts (content)
⚔️ src/client.ts (content)
⚔️ src/enums/o-auth-provider.ts (content)
⚔️ src/index.ts (content)
⚔️ src/models.ts (content)
⚔️ src/services/account.ts (content)
⚔️ src/services/avatars.ts (content)
⚔️ src/services/graphql.ts (content)
⚔️ src/services/realtime.ts (content)
⚔️ src/services/teams.ts (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Web SDK update for version 22.1.0' is concise and clearly indicates the main change is a version update, but it's somewhat generic and doesn't convey the specific technical improvements or features added in this release.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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.

Caution

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

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

492-498: ⚠️ Potential issue | 🟡 Minor

Guard against empty-object inputs bypassing required-parameter checks.

With the new 'key' in paramsOrFirst gates, {} now falls into the positional path and passes the typeof ... !== 'undefined' checks, which can yield [object Object] in the URL instead of a clear missing‑parameter error. Consider short‑circuiting when a plain object lacks the expected keys (or keep the previous object detection) for these methods.

💡 Example fix pattern (apply similarly to the other methods)
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) {
-     params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
- } else {
+ if (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) {
+     if (!('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst)) {
+         throw new AppwriteException('Missing required parameter: "provider"');
+     }
+     params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
+ } else {
      params = {
          provider: paramsOrFirst as OAuthProvider,
          success: rest[0] as string,
          failure: rest[1] as string,
          scopes: rest[2] as string[]
      };
  }

Also applies to: 544-550, 600-607, 663-670, 724-731, 776-783, 829-836, 884-891, 1897-1906, 2649-2658

🧹 Nitpick comments (2)
docs/examples/account/update-push-target.md (1)

10-13: Make the example runnable without top‑level await.

Top‑level await only works in ESM contexts; for doc snippets it’s safer to wrap in an async IIFE (or add a brief note).

♻️ Proposed fix
-const result = await account.updatePushTarget({
-    targetId: '<TARGET_ID>',
-    identifier: '<IDENTIFIER>'
-});
-
-console.log(result);
+(async () => {
+  const result = await account.updatePushTarget({
+    targetId: '<TARGET_ID>',
+    identifier: '<IDENTIFIER>'
+  });
+
+  console.log(result);
+})();
src/services/avatars.ts (1)

53-53: Overly broad object-detection check, but safe given the required-param validation downstream.

The condition now treats paramsOrFirst as the object overload if any of code, width, height, or quality is present, rather than just code. This means getBrowser({ width: 200 }) (missing the required code) takes the object path and correctly throws "Missing required parameter: code" at Line 70, which is fine. However, since Browser/CreditCard/Flag are string enums (strings at runtime), the typeof === 'object' check alone is already sufficient to distinguish the two overloads — the additional 'key' in ... OR checks are redundant.

Given this appears to be generated SDK code, this is a cosmetic observation, not a blocker.

@ChiragAgg5k ChiragAgg5k changed the title feat: Web SDK update for version 22.0.0 feat: Web SDK update for version 22.1.0 Feb 12, 2026
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: 4

Caution

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

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

711-1016: ⚠️ Potential issue | 🟠 Major

Allow null for key expiration in the key APIs.

The JSDoc for createKey and updateKey documents that the expire parameter accepts null for unlimited expiration, but the TypeScript signatures only allow string. This prevents passing valid values and misleads TypeScript users. Update method overloads to accept string | null and align the Models.Key.expire field type accordingly.

Suggested signature fix
-    createKey(params: { name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>;
+    createKey(params: { name: string, scopes: Scopes[], expire?: string | null }): Promise<Models.Key>;
...
-    createKey(name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>;
+    createKey(name: string, scopes: Scopes[], expire?: string | null): Promise<Models.Key>;
...
-    updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>;
+    updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string | null }): Promise<Models.Key>;
...
-    updateKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>;
+    updateKey(keyId: string, name: string, scopes: Scopes[], expire?: string | null): Promise<Models.Key>;
...
export type Key = {
    ...
-    expire: string;
+    expire: string | null;
🤖 Fix all issues with AI agents
In `@README.md`:
- Line 9: The README's compatibility line ("**This SDK is compatible with
Appwrite server version latest. ...**") is too vague and will age; replace
"latest" with the concrete server version number this SDK was tested against
(e.g., "1.8.x" or the exact version like "22.1.0"), or add a version
badge/variable and a short note indicating which SDK release maps to which
server version so consumers can see the tested compatibility; update that bolded
sentence accordingly and ensure the previous-releases link remains for older
versions.

In `@src/models.ts`:
- Around line 1647-1649: The JSDoc for the PaymentMethod.userId field is
incorrect ("ID of the Team"); update the comment above the userId property in
the PaymentMethod model to accurately describe the field (e.g., "User ID" or the
actual owner type if not a user). Locate the userId property in the
PaymentMethod interface/class (symbol: userId under PaymentMethod) and replace
the misleading comment with the correct short description reflecting the field's
purpose.
- Around line 1121-1123: The Key model's expire field and the account service
methods need to allow null per the documented API: change the Key
interface/property named expire from type string to string | null and update the
createKey and updateKey method signatures in src/services/account.ts so their
expire parameter is expire?: string | null (preserving optional semantics);
ensure any related type references use the updated Key.expire type so passing
null for unlimited expiration compiles.

In `@src/services/account.ts`:
- Around line 123-476: The JSDoc for listBillingAddresses incorrectly lists
non-existent filters ("expired", "failed"); update the comment above the
listBillingAddresses method to remove or correct those attributes so it only
documents valid queryable fields (e.g., "userId" or whatever the BillingAddress
model actually supports). Locate the JSDoc block for the listBillingAddresses
overloads and edit the "You may filter on the following attributes" sentence to
reflect the real BillingAddress attributes or omit the attribute list entirely.
🧹 Nitpick comments (2)
docs/examples/account/update-key.md (1)

13-14: Consider showing a realistic value or omitting expire entirely.

Passing an empty string '' for an optional date/expiry parameter is ambiguous — it's unclear whether the server interprets this as "no expiry" or rejects it. Showing a real ISO date or simply omitting the field would be more helpful to users.

src/channel.ts (1)

16-16: Align ActionableChannel with the updated Actionable union.

Actionable drops Execution, but ActionableChannel still includes Channel<Execution>, which can mislead consumers about which channels support create/update/delete. Consider removing Execution or renaming the alias/comment to reflect its broader scope.

♻️ Suggested tweak
-export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
+export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Team> | Channel<Membership>;

Also applies to: 145-145

[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/releases).**
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

Vague compatibility statement: "server version latest" will age poorly.

Replacing a specific server version (e.g., 1.8.x) with the word "latest" removes useful compatibility information. As the server evolves, users won't know which server version this SDK release was tested against. Consider keeping a concrete version number (e.g., 1.8.x or whatever version 22.1.0 targets).

🤖 Prompt for AI Agents
In `@README.md` at line 9, The README's compatibility line ("**This SDK is
compatible with Appwrite server version latest. ...**") is too vague and will
age; replace "latest" with the concrete server version number this SDK was
tested against (e.g., "1.8.x" or the exact version like "22.1.0"), or add a
version badge/variable and a short note indicating which SDK release maps to
which server version so consumers can see the tested compatibility; update that
bolded sentence accordingly and ensure the previous-releases link remains for
older versions.

Comment on lines +1121 to +1123
* Key expiration date in ISO 8601 format.
*/
expire: 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 look at the exact code in src/models.ts around lines 1121-1123
sed -n '1110,1130p' src/models.ts

Repository: appwrite/sdk-for-web

Length of output: 503


🏁 Script executed:

# Also check the context around the Key model to understand the full structure
sed -n '1080,1140p' src/models.ts

Repository: appwrite/sdk-for-web

Length of output: 1745


🏁 Script executed:

# Now let's look at the createKey and updateKey signatures in src/services/account.ts
grep -n "createKey\|updateKey" src/services/account.ts | head -20

Repository: appwrite/sdk-for-web

Length of output: 511


🏁 Script executed:

# Search for any references to key expiration handling in the codebase
rg "expire.*null|null.*expire" --type ts -C 2

Repository: appwrite/sdk-for-web

Length of output: 2126


🏁 Script executed:

# Look for test files or documentation about key expiration
find . -type f \( -name "*.test.ts" -o -name "*.spec.ts" -o -name "*.md" \) | xargs grep -l "expire\|expiration" 2>/dev/null | head -10

Repository: appwrite/sdk-for-web

Length of output: 139


🏁 Script executed:

# Check the example documentation for key creation/update
cat docs/examples/account/create-key.md docs/examples/account/update-key.md

Repository: appwrite/sdk-for-web

Length of output: 924


🏁 Script executed:

# Also search for any tests or references showing null expiration values
rg "expire.*null|expire.*undefined" src/ -C 2

Repository: appwrite/sdk-for-web

Length of output: 2662


Allow null for key expiration in the model and service signatures.

The JSDoc documentation in src/services/account.ts explicitly states "Use null for unlimited expiration," but the TypeScript types don't reflect this contract. The Key model defines expire: string and the createKey/updateKey method signatures use expire?: string, both of which reject null values at compile time despite the documented API contract supporting them.

Update src/models.ts to allow null:

-        expire: string;
+        expire: string | null;

Update the method signatures in src/services/account.ts from expire?: string to expire?: string | null for both createKey and updateKey methods.

📝 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
* Key expiration date in ISO 8601 format.
*/
expire: string;
* Key expiration date in ISO 8601 format.
*/
expire: string | null;
🤖 Prompt for AI Agents
In `@src/models.ts` around lines 1121 - 1123, The Key model's expire field and the
account service methods need to allow null per the documented API: change the
Key interface/property named expire from type string to string | null and update
the createKey and updateKey method signatures in src/services/account.ts so
their expire parameter is expire?: string | null (preserving optional
semantics); ensure any related type references use the updated Key.expire type
so passing null for unlimited expiration compiles.

Comment on lines +1647 to +1649
* ID of the Team.
*/
userId: 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 | 🟡 Minor

PaymentMethod.userId doc label is misleading.

The field is userId, but the comment says “ID of the Team.” Consider updating the comment to “User ID” (or the correct owner if it’s not a user) to avoid confusion.

📝 Suggested doc fix
-         * ID of the Team.
+         * User ID.
📝 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
* ID of the Team.
*/
userId: string;
* User ID.
*/
userId: string;
🤖 Prompt for AI Agents
In `@src/models.ts` around lines 1647 - 1649, The JSDoc for the
PaymentMethod.userId field is incorrect ("ID of the Team"); update the comment
above the userId property in the PaymentMethod model to accurately describe the
field (e.g., "User ID" or the actual owner type if not a user). Locate the
userId property in the PaymentMethod interface/class (symbol: userId under
PaymentMethod) and replace the misleading comment with the correct short
description reflecting the field's 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: 2

🤖 Fix all issues with AI agents
In `@src/models.ts`:
- Around line 1439-1443: The JSDoc for BillingAddress.$id is incorrect (it says
"Region ID"); update the comment for the BillingAddress.$id property to "Billing
Address ID" (or "Address ID") to accurately describe the field in the
BillingAddress type so the property documentation matches the model.

In `@src/services/account.ts`:
- Around line 373-384: The listKeys method loses an explicit false when called
as listKeys(false) because the current guard uses !paramsOrFirst, which treats
false as "no params" and drops total; update the branching in listKeys to first
check for a boolean positional argument (typeof paramsOrFirst === 'boolean')
and, if so, set params = { total: paramsOrFirst }, otherwise handle the object
case (typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) and
default to {} when undefined; refer to the paramsOrFirst variable and
listKeys(...) signature to locate where to change the conditional so that
explicit false is preserved.
🧹 Nitpick comments (2)
src/models.ts (2)

1460-1471: Inconsistent JSDoc casing for city, state, and postalCode.

These comments use lowercase ("city", "state", "postal code") while the rest of the model and codebase capitalize the first letter of doc comments. Minor nit for consistency.

Proposed fix
         /**
-         * city
+         * City.
          */
         city: string;
         /**
-         * state
+         * State.
          */
         state: string;
         /**
-         * postal code
+         * Postal code.
          */
         postalCode: string;

1614-1616: Type-level JSDoc says "paymentMethod" (lowercase) — should be "PaymentMethod".

Line 1615's doc comment reads paymentMethod which is inconsistent with all other model doc comments that use PascalCase.

Proposed fix
     /**
-     * paymentMethod
+     * PaymentMethod
      */

src/models.ts Outdated
Comment on lines 1439 to 1443
export type BillingAddress = {
/**
* Region ID
*/
$id: 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 | 🟡 Minor

BillingAddress.$id JSDoc says "Region ID" — likely a copy-paste error.

The comment should read "Billing Address ID" (or simply "Address ID") to match the model's purpose.

Proposed fix
-        /**
-         * Region ID
-         */
+        /**
+         * Billing Address ID.
+         */
         $id: string;
🤖 Prompt for AI Agents
In `@src/models.ts` around lines 1439 - 1443, The JSDoc for BillingAddress.$id is
incorrect (it says "Region ID"); update the comment for the BillingAddress.$id
property to "Billing Address ID" (or "Address ID") to accurately describe the
field in the BillingAddress type so the property documentation matches the
model.

Comment on lines +373 to +384
listKeys(
paramsOrFirst?: { total?: boolean } | boolean
): Promise<Models.KeyList> {
let params: { total?: boolean };

if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
params = (paramsOrFirst || {}) as { total?: boolean };
} else {
params = {
total: paramsOrFirst as boolean
};
}
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

listKeys(false) silently drops the total parameter.

When a user calls listKeys(false) (the deprecated positional style), the !paramsOrFirst guard evaluates !false → true, routing into the object branch where params becomes {} and total is lost. The user's intent to disable total counting is silently ignored.

This is specific to listKeys because it's the only method whose sole positional parameter is an optional boolean.

Proposed fix
     listKeys(
         paramsOrFirst?: { total?: boolean } | boolean    
     ): Promise<Models.KeyList> {
         let params: { total?: boolean };
         
-        if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
+        if (paramsOrFirst === undefined || paramsOrFirst === null || (typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
             params = (paramsOrFirst || {}) as { total?: boolean };
         } else {
             params = {
                 total: paramsOrFirst as boolean            
             };
         }
🤖 Prompt for AI Agents
In `@src/services/account.ts` around lines 373 - 384, The listKeys method loses an
explicit false when called as listKeys(false) because the current guard uses
!paramsOrFirst, which treats false as "no params" and drops total; update the
branching in listKeys to first check for a boolean positional argument (typeof
paramsOrFirst === 'boolean') and, if so, set params = { total: paramsOrFirst },
otherwise handle the object case (typeof paramsOrFirst === 'object' &&
!Array.isArray(paramsOrFirst)) and default to {} when undefined; refer to the
paramsOrFirst variable and listKeys(...) signature to locate where to change the
conditional so that explicit false is preserved.

@abnegate abnegate merged commit 54e8289 into main Feb 13, 2026
1 check passed
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.

3 participants