-
Notifications
You must be signed in to change notification settings - Fork 35
feat: React Native SDK update for version 0.21.0 #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis PR removes the exported Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/examples/teams/create-membership.md`:
- Line 12: The example uses an empty roles array which doesn't show the new
string-based usage; update the example's payload (the object with the roles
property) to include a realistic string role like "owner" (e.g., set roles to
['owner'] or another meaningful role) to demonstrate free-form string roles
instead of leaving roles: [] in the create-membership example.
In `@docs/examples/teams/update-membership.md`:
- Line 13: The example uses an empty roles array which doesn't demonstrate
string-based roles; update the example in update-membership.md by replacing
roles: [] with a concrete role string like roles: ["member"] (or ["admin"] as
appropriate) so readers see the expected string-based role format; ensure the
same pattern is applied consistently where the roles property is shown (e.g.,
create-membership examples).
🧹 Nitpick comments (1)
src/client.ts (1)
478-479: Static analysis: implicit return value fromforEachcallback.Line 479 (
Set.addreturns theSet) triggers a Biome lint error. Line 476 has the same pre-existing pattern, but since line 479 is new code, consider wrapping it in braces for consistency with the linter.Suggested fix
- queryStrings.forEach(query => this.realtime.queries.add(query)); + queryStrings.forEach(query => { this.realtime.queries.add(query); });
| const result = await teams.createMembership({ | ||
| teamId: '<TEAM_ID>', | ||
| roles: [Roles.Admin], | ||
| roles: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example with empty roles array doesn't demonstrate the new string-based usage.
Since the Roles enum was removed in favor of free-form strings, the example should show a realistic role value (e.g., ['owner']) rather than an empty array. An empty array may confuse users into thinking roles are no longer needed or supported.
- roles: [],
+ roles: ['owner'],📝 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.
| roles: [], | |
| roles: ['owner'], |
🤖 Prompt for AI Agents
In `@docs/examples/teams/create-membership.md` at line 12, The example uses an
empty roles array which doesn't show the new string-based usage; update the
example's payload (the object with the roles property) to include a realistic
string role like "owner" (e.g., set roles to ['owner'] or another meaningful
role) to demonstrate free-form string roles instead of leaving roles: [] in the
create-membership example.
| teamId: '<TEAM_ID>', | ||
| membershipId: '<MEMBERSHIP_ID>', | ||
| roles: [Roles.Admin] | ||
| roles: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern: empty roles array doesn't illustrate string-based roles.
Same as in create-membership.md — showing a concrete role string would make the example more useful.
- roles: []
+ roles: ['owner']📝 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.
| roles: [] | |
| roles: ['owner'] |
🤖 Prompt for AI Agents
In `@docs/examples/teams/update-membership.md` at line 13, The example uses an
empty roles array which doesn't demonstrate string-based roles; update the
example in update-membership.md by replacing roles: [] with a concrete role
string like roles: ["member"] (or ["admin"] as appropriate) so readers see the
expected string-based role format; ensure the same pattern is applied
consistently where the roles property is shown (e.g., create-membership
examples).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
4-9:⚠️ Potential issue | 🟡 MinorVersion inconsistency between badge and compatibility statement.
Line 4 badge still references
api version-1.8.1, while Line 9 now states compatibility with "Appwrite server version latest." These should be aligned. Additionally, "version latest" is vague — users need a concrete server version (or range) to determine compatibility. Consider specifying the actual minimum compatible server version.
🤖 Fix all issues with AI agents
In `@src/models.ts`:
- Around line 1644-1646: The JSDoc for the property userId is incorrect—update
the comment for the userId field to accurately state that it represents the ID
of the user who owns the payment method (or, if the server model actually uses a
team owner, rename the field to teamId and adjust the types accordingly); verify
against the server-side model and make the JSDoc match the actual semantics used
by the PaymentMethod model (reference the userId property to locate where to
change the comment).
- Around line 1437-1440: The JSDoc for the $id property is incorrect (it
currently reads "Region ID"); update the comment for the $id field to "Billing
Address ID" to match the entity semantics and generated docs—locate the $id
declaration in the same model (the property named $id) and replace the JSDoc
text only so consumers see "Billing Address ID".
In `@src/services/account.ts`:
- Around line 680-705: The guard in listKeys(...) incorrectly treats falsy
primitives like false as "no argument", causing calls like listKeys(false) to
drop total; update the presence check in listKeys to explicitly detect undefined
(e.g., use typeof paramsOrFirst === 'undefined' or arguments.length === 0)
instead of using !paramsOrFirst so that boolean false is preserved; apply the
same pattern to the similar overload in createJWT(...) to avoid dropping falsy
numeric/boolean arguments when callers pass 0 or false.
In `@src/services/organizations.ts`:
- Around line 16-32: Update the JSDoc `@param` descriptions that incorrectly say
"Team ID" to "Organization ID" for methods dealing with organizationId (notably
the overloaded delete signatures and estimationDeleteOrganization); search for
occurrences of the string "Team ID" in src/services/organizations.ts and replace
the `@param` text for organizationId with "Organization ID" so the docs are
consistent with other methods like createDowngradeFeedback and getPaymentMethod.
- Around line 61-78: Fix the possessive typo in the JSDoc comments for
getBillingAddress and getPaymentMethod by replacing "it's" with "its" in the
description strings; update the comment for getBillingAddress (method name:
getBillingAddress) from "Get a billing address using it's ID" to "Get a billing
address using its ID" and likewise update the comment for getPaymentMethod
(method name: getPaymentMethod) from "Get an organization's payment method using
it's payment method ID" to "Get an organization's payment method using its
payment method ID".
🧹 Nitpick comments (8)
src/channel.ts (2)
16-16:ActionableChannelstill includesChannel<Execution>afterExecutionwas removed fromActionable.
Actionableno longer includesExecution(Line 16), so.create(),.update(),.delete()cannot be called on aChannel<Execution>. However,ActionableChannel(Line 131) still listsChannel<Execution>, which is misleading—the name implies these channels are "actionable."If
ActionableChannelis purely a convenience union for realtime subscription types (not tied to the terminal actions), consider renaming it to something likeSubscribableChannelto avoid confusion. Otherwise, if it should mirrorActionable, removeChannel<Execution>from it.Also applies to: 131-131
108-110:account()return type changed fromChannelto plainstring.This is consistent with the other global event helpers (
documents,rows,files,executions) that also returnstring. However, unlike those (which arestatic getaccessors),accountis a regular static method. Consider making it a getter for consistency:- static account(): string { - return "account"; - } + static get account(): string { + return "account"; + }This would align the calling convention (
Channel.accountvsChannel.account()) with the other string-returning statics likeChannel.documents,Channel.files, etc.src/enums/o-auth-provider.ts (1)
41-42: New entries break the alphabetical ordering of enum members.The existing members are alphabetically sorted (Amazon → Zoom), but
GithubImagineandGoogleImagineare appended at the end. Since this SDK is auto-generated, this is likely a generator concern rather than something to fix here, but worth noting if the generator ordering logic needs attention.src/models.ts (3)
1457-1468: Inconsistent capitalization in JSDoc comments forcity,state, andpostalCode.Other field descriptions in this file use title-case (e.g., "Street address", "Address country"), but these three are all lowercase. Minor nit for consistency.
📝 Suggested fix
/** - * city + * City */ city: string; /** - * state + * State */ state: string; /** - * postal code + * Postal code */ postalCode: string;
1611-1612: JSDoc type label uses lowercase "paymentMethod".TypeScript convention and the pattern in this file use PascalCase for type names in JSDoc headers (e.g., "BillingAddress", "Key"). This should be "PaymentMethod".
📝 Suggested fix
/** - * paymentMethod + * PaymentMethod */
1697-1725: Type nameUsageResources(plural) represents a single resource entry.The JSDoc header says "UsageResource" (singular), but the exported type is
UsageResources. SinceInvoice.usageis already typed asUsageResources[], the plural name causes a confusingUsageResources[]("resources-list of resources"). Consider renaming the type toUsageResource(singular) for clarity.Note: this would also require updating the
Invoice.usagefield type reference.src/services/organizations.ts (1)
1-6: Unused imports:FileSystem,Platform, andUploadProgress.These imports (
expo-file-system,react-native'sPlatform, andUploadProgress) are not referenced anywhere in this service file. They appear to be boilerplate from code generation. If this is auto-generated, this is fine, but if hand-maintained, consider removing them to reduce unnecessary dependencies.src/services/account.ts (1)
2629-2678: Object-detection guard forcreateOAuth2Sessionis fragile with plain objects.Line 2635: The guard checks
'provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst. If a caller passes a plain object without any of these keys (e.g., an empty object{}), it falls through to the else branch and casts the object asOAuthProvider. This is a minor edge case since TypeScript types would prevent it in well-typed code, and theproviderrequired-check at line 2651 would catch it at runtime.Same pattern applies to
createOAuth2Tokenat line 3325.
| /** | ||
| * Region ID | ||
| */ | ||
| $id: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSDoc for $id says "Region ID" — likely a copy-paste error.
This should read "Billing Address ID" to match the entity type. The current comment is misleading for consumers reading the type docs.
📝 Suggested fix
export type BillingAddress = {
/**
- * Region ID
+ * Billing Address ID.
*/
$id: string;📝 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.
| /** | |
| * Region ID | |
| */ | |
| $id: string; | |
| /** | |
| * Billing Address ID. | |
| */ | |
| $id: string; |
🤖 Prompt for AI Agents
In `@src/models.ts` around lines 1437 - 1440, The JSDoc for the $id property is
incorrect (it currently reads "Region ID"); update the comment for the $id field
to "Billing Address ID" to match the entity semantics and generated docs—locate
the $id declaration in the same model (the property named $id) and replace the
JSDoc text only so consumers see "Billing Address ID".
| * ID of the Team. | ||
| */ | ||
| userId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading JSDoc: userId documented as "ID of the Team."
The field name is userId but the doc says "ID of the Team." This is confusing and likely a copy-paste error from the server-side definition. It should clarify whether this is the user or the team that owns the payment method.
🤖 Prompt for AI Agents
In `@src/models.ts` around lines 1644 - 1646, The JSDoc for the property userId is
incorrect—update the comment for the userId field to accurately state that it
represents the ID of the user who owns the payment method (or, if the server
model actually uses a team owner, rename the field to teamId and adjust the
types accordingly); verify against the server-side model and make the JSDoc
match the actual semantics used by the PaymentMethod model (reference the userId
property to locate where to change the comment).
| 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 | ||
| }; | ||
| } | ||
|
|
||
| const total = params.total; | ||
|
|
||
| const apiPath = '/account/keys'; | ||
| const payload: Payload = {}; | ||
|
|
||
| if (typeof total !== 'undefined') { | ||
| payload['total'] = total; | ||
| } | ||
|
|
||
| const uri = new URL(this.client.config.endpoint + apiPath); | ||
| return this.client.call('get', uri, { | ||
| }, payload); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: listKeys(false) silently drops the total parameter.
Line 685: the guard !paramsOrFirst || (...) treats falsy primitives (false, 0) as "no argument provided." When a consumer calls the deprecated overload listKeys(false), the !false check is true, so it enters the object-parameter branch with params = (false || {}) → {}, silently discarding total = false. This defeats the purpose of the total parameter (which exists specifically to be set to false).
The same root cause affects createJWT(0) at line 640 (though duration=0 is likely an invalid value, the pattern is still incorrect).
Since this appears to be auto-generated SDK code, the fix should be applied in the code generator. The guard should distinguish "not provided" from "falsy primitive" — e.g., check arguments.length === 0 or use typeof paramsOrFirst === 'undefined' instead of !paramsOrFirst.
Suggested fix for listKeys
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
+ if (typeof paramsOrFirst === 'undefined' || (paramsOrFirst !== null && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {📝 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.
| 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 | |
| }; | |
| } | |
| const total = params.total; | |
| const apiPath = '/account/keys'; | |
| const payload: Payload = {}; | |
| if (typeof total !== 'undefined') { | |
| payload['total'] = total; | |
| } | |
| const uri = new URL(this.client.config.endpoint + apiPath); | |
| return this.client.call('get', uri, { | |
| }, payload); | |
| } | |
| listKeys( | |
| paramsOrFirst?: { total?: boolean } | boolean | |
| ): Promise<Models.KeyList> { | |
| let params: { total?: boolean }; | |
| if (typeof paramsOrFirst === 'undefined' || (paramsOrFirst !== null && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { | |
| params = (paramsOrFirst || {}) as { total?: boolean }; | |
| } else { | |
| params = { | |
| total: paramsOrFirst as boolean | |
| }; | |
| } | |
| const total = params.total; | |
| const apiPath = '/account/keys'; | |
| const payload: Payload = {}; | |
| if (typeof total !== 'undefined') { | |
| payload['total'] = total; | |
| } | |
| const uri = new URL(this.client.config.endpoint + apiPath); | |
| return this.client.call('get', uri, { | |
| }, payload); | |
| } |
🤖 Prompt for AI Agents
In `@src/services/account.ts` around lines 680 - 705, The guard in listKeys(...)
incorrectly treats falsy primitives like false as "no argument", causing calls
like listKeys(false) to drop total; update the presence check in listKeys to
explicitly detect undefined (e.g., use typeof paramsOrFirst === 'undefined' or
arguments.length === 0) instead of using !paramsOrFirst so that boolean false is
preserved; apply the same pattern to the similar overload in createJWT(...) to
avoid dropping falsy numeric/boolean arguments when callers pass 0 or false.
| /** | ||
| * 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<{}>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSDoc inconsistency: organizationId documented as "Team ID" in delete and estimationDeleteOrganization.
The @param descriptions for organizationId say "Team ID" in the delete (lines 19, 27) and estimationDeleteOrganization (lines 117, 125) methods, while other methods like createDowngradeFeedback (line 163) and getPaymentMethod (line 258) correctly say "Organization ID". This inconsistency could confuse consumers of the API docs.
Also applies to: 114-130
🤖 Prompt for AI Agents
In `@src/services/organizations.ts` around lines 16 - 32, Update the JSDoc `@param`
descriptions that incorrectly say "Team ID" to "Organization ID" for methods
dealing with organizationId (notably the overloaded delete signatures and
estimationDeleteOrganization); search for occurrences of the string "Team ID" in
src/services/organizations.ts and replace the `@param` text for organizationId
with "Organization ID" so the docs are consistent with other methods like
createDowngradeFeedback and getPaymentMethod.
| /** | ||
| * Get a billing address using it's ID. | ||
| * | ||
| * @param {string} params.organizationId - Organization ID | ||
| * @param {string} params.billingAddressId - Unique ID of billing address | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise} | ||
| */ | ||
| getBillingAddress(params: { organizationId: string, billingAddressId: string }): Promise<Models.BillingAddress>; | ||
| /** | ||
| * Get a billing address using it's ID. | ||
| * | ||
| * @param {string} organizationId - Organization ID | ||
| * @param {string} billingAddressId - Unique ID of billing address | ||
| * @throws {AppwriteException} | ||
| * @returns {Promise<Models.BillingAddress>} | ||
| * @deprecated Use the object parameter style method for a better developer experience. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "it's" → "its" (possessive) in getBillingAddress and getPaymentMethod JSDoc.
"it's" is a contraction of "it is", whereas the possessive form "its" is correct here.
- Line 62/71: "Get a billing address using it's ID" → "using its ID"
- Line 256/265: "Get an organization's payment method using it's payment method ID" → "using its payment method ID"
Also applies to: 255-272
🤖 Prompt for AI Agents
In `@src/services/organizations.ts` around lines 61 - 78, Fix the possessive typo
in the JSDoc comments for getBillingAddress and getPaymentMethod by replacing
"it's" with "its" in the description strings; update the comment for
getBillingAddress (method name: getBillingAddress) from "Get a billing address
using it's ID" to "Get a billing address using its ID" and likewise update the
comment for getPaymentMethod (method name: getPaymentMethod) from "Get an
organization's payment method using it's payment method ID" to "Get an
organization's payment method using its payment method ID".
This PR contains updates to the React Native SDK for version 0.21.0.
Summary by CodeRabbit
New Features
Breaking Changes
Bug Fixes
Documentation
Chores