-
Notifications
You must be signed in to change notification settings - Fork 11
feat: migrate to node-appwrite SDK v21 #31
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
Open
robertoboero
wants to merge
14
commits into
streamlux:main
Choose a base branch
from
robertoboero:feature/sdk-v21-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: migrate to node-appwrite SDK v21 #31
robertoboero
wants to merge
14
commits into
streamlux:main
from
robertoboero:feature/sdk-v21-migration
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the first step in migrating the extension to support the latest Appwrite SDK and API (compatible with Appwrite 1.8.x). Breaking changes to address in subsequent commits: - Database API now requires databaseId parameter - Storage API now requires bucketId parameter - Functions: Tags renamed to Deployments - Health: method names updated - Permission system updated with helper classes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major type definition changes: - Add Database entity type (databaseId now required) - Add Bucket entity type (bucketId now required) - Rename Tag to Deployment throughout - Add new health check types (PubSub, Storage, etc.) - Add helper types (Permission, Role, Query, ID) - Update User type with new fields (mfa, targets, labels) - Update Function type (runtime replaces env, deployment replaces tag) - Update Execution type with new request/response fields - Deprecate old types with @deprecated annotations - Add DatabasesClient (replaces DatabaseClient) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Export SDK helper classes (Permission, Role, Query, ID) - Update system events to new format: - databases.*.collections.* (with databaseId) - buckets.*.files.* (with bucketId) - functions.*.deployments.* (replaces tags) - Add messaging events (providers, topics, messages) - Update function runtimes list to current versions: - Node.js 18-22, Python 3.9-3.12, PHP 8.0-8.3 - Ruby 3.1-3.3, Dart 2.17-3.3, Deno 1.35-2.0 - Bun 1.0, .NET 6-8, Java 8-21 - Swift 5.8-5.9, Kotlin 1.8-1.9, C++ 17/20, Go 1.22-1.23 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SDK v21 requires databaseId for all database operations and bucketId for all storage operations. These optional fields allow users to configure default IDs per project. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extend clientConfig to include databaseId and bucketId - Pass default databaseId to Database service - Pass default bucketId to Storage service - Fix setSelfSigned to be called conditionally Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Database.ts: Add databaseId parameter to all methods, use Databases (plural), add attribute operations (replaces rules), add permission conversion helpers - Functions.ts: Rename Tags to Deployments, add variable management, new method signatures with runtime/scopes/entrypoint/commands - Storage.ts: Add bucketId parameter to all methods, add bucket operations - Health.ts: Add new health checks (PubSub, Storage, QueueBuilds, QueueMails, QueueMessaging, QueueMigrations, QueueDeletes), update method names - Users.ts: Update create signature (userId first), add new user management methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Database: - Add DatabaseTreeItem to show databases as root level items - CollectionTreeItem now requires databaseId parameter - DocumentsTreeItem uses databaseClient instead of direct SDK - Replace RulesTreeItem with AttributesTreeItem (Rules → Attributes) - Update PermissionsTreeItem for new flat permission array format Functions: - Add deployments/ folder with DeploymentsTreeItem and DeploymentTreeItem - FunctionTreeItem uses DeploymentsTreeItem instead of TagsTreeItem - Update all settings tree items (Name, Schedule, Timeout, Events, Vars) to use new update() method signature - ExecutionsTreeItem uses Query helpers for pagination - ExecutionTreeItem uses $createdAt and duration instead of old fields Storage: - Add BucketTreeItem to show buckets as root level items - FileTreeItem now requires bucketId parameter and shows file details - StorageTreeItemProvider shows bucket hierarchy Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Database commands: - createCollection: Add database selection when no default configured - deleteCollection: Pass databaseId from CollectionTreeItem - deleteDocument: Pass databaseId from CollectionTreeItem hierarchy Function commands: - Add new deployment commands (createDeployment, deleteDeployment, activateDeployment) - Keep tag commands as backward compatibility aliases - createFunction: Add success message and error handling - createExecution: Use duration instead of time, handle scheduled status - viewExecutionOutput/Errors: Use logs/errors instead of stdout/stderr - copyExecutionOutput/Errors: Use logs/errors instead of stdout/stderr registerCommands: - Import new deployment commands - Register both deployment and legacy tag commands Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix Set spread using Array.from() in Database.ts - Fix LogList→LogsList import typo in Users.ts - Update AppwriteCall to accept void promises for delete operations - Update msToDate to handle ISO date strings (SDK v21+) - Replace Rules with Attributes (createAttribute, deleteAttribute) - Remove legacy tag files (replaced by deployments in previous commit) - Update permission commands for new flat array format - Update variable management in VarTreeItem - Update UserTreeItemProvider for SDK v21 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Validate queries/search params in Functions.list() and Users.list() to avoid passing empty strings to SDK v21 API - Add null guards for this.parent?.func in DeploymentsTreeItem, ExecutionsTreeItem, and VarsTreeItem - Make AppwriteCall error handler defensive: type errResp as unknown, add console.error logging, wrap handler in try-catch Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When TypeScript compiles to ES5, the `_super.call(this, ...) || this` pattern can lose properties set in parent constructors if VS Code's TreeItem (an ES2022 class) interferes with the object identity. This caused two categories of bugs: 1. `this.parent` undefined in tree items missing `public readonly parent` 2. `this.label` empty because TreeItem constructor label assignment was lost Fixes: - Add `public readonly parent` to DocumentsTreeItem, AttributesTreeItem, and PermissionsTreeItem constructors (generates explicit _this.parent=) - Add explicit `this.label = label` in AppwriteTreeItemBase after super() - Add explicit `this.label = item.label` in ChildTreeItem after super() - Replace Object.assign with explicit property assignments in ChildTreeItem and CollapsableTreeItem - Add explicit label/description in AttributeTreeItem and PermissionTreeItem - Clean up debug logging in DatabaseTreeItemProvider, add try-catch safety Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rewrite DocumentTreeItem to extend AppwriteTreeItemBase instead of ChildTreeItem. Documents are now collapsible tree items that expand to show all non-system fields as key-value pairs. - Label: document $id - Description: document name or collection ID - Tooltip: document ID, created/updated timestamps - Children: all user-defined fields with symbol-field icons Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use || instead of ?? for nickname fallback so empty strings fall through to projectId (previously showed blank label) - Add endpoint URL as tree item description - Add tooltip with project name, ID, and endpoint Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add NODE_OPTIONS=--openssl-legacy-provider to webpack scripts for compatibility with modern Node.js - Update webpack config: externalize node-appwrite, add Node.js polyfill fallbacks - Update AddProjectWizard for SDK v21 project setup flow - Replace extension marketplace icon and sidebar SVG - Remove legacy createRuleWizard (rules replaced by attributes in v21) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the extension from the legacy
node-appwriteSDK v2.2.3 to v21.1.0, restoring full compatibility with modern Appwrite instances (tested against Appwrite 1.8.1).The original codebase targeted an Appwrite version from 2021. This PR brings it up to date with the current Appwrite API, including the Databases service (which replaced the single-database model), updated authentication methods, and the new permission system.
Key changes
databaseIdPermission.read()/Permission.create()/Permission.update()/Permission.delete()formatcreateRuleWizardand updated all attribute operations to use the SDK v21 APIdatabaseIdandbucketIdfields to project configuration for SDK v21 requirementsBug fixes
TreeItem(compiled as an ES2022 class) caused property loss in ES5-compiled subclasses. Added explicitthis.labelandpublic readonly parentassignments to ensure properties survive the_super.call(this, ...) || thispattern??) not catching empty stringsAppwriteCallerror handler defensive withunknowntyping and try-catch wrappingNew features
Commits
chore: update node-appwrite SDK from v2.2.3 to v21.1.0refactor: update type definitions for SDK v21refactor: update constants for SDK v21feat: add databaseId and bucketId to project configurationrefactor: update client initialization for SDK v21refactor: Update all service modules for SDK v21refactor: Update tree providers for SDK v21refactor: Update commands for SDK v21fix: resolve TypeScript compilation errors and remove legacy codefix: add defensive guards and improve error handlingfix: resolve ES5 class inheritance issues with TreeItem propertiesfeat: make document tree items expandable with field detailsfix: show project name and endpoint in Projects tabchore: update build config, icons, and remove legacy codeTest plan
npx tsc --noEmit— zero TypeScript errorsnpx vsce package— VSIX builds successfullyBreaking changes
databaseIdfield (prompted during setup)🤖 Generated with Claude Code