Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-appwrite-migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, AppwriteMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.createAppwriteMigration({
resources: [Resources.User],
resources: [AppwriteMigrationResource.User],
endpoint: 'https://example.com',
projectId: '<PROJECT_ID>',
apiKey: '<API_KEY>'
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-firebase-migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, FirebaseMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.createFirebaseMigration({
resources: [Resources.User],
resources: [FirebaseMigrationResource.User],
serviceAccount: '<SERVICE_ACCOUNT>'
});

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-n-host-migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, NHostMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.createNHostMigration({
resources: [Resources.User],
resources: [NHostMigrationResource.User],
subdomain: '<SUBDOMAIN>',
region: '<REGION>',
adminSecret: '<ADMIN_SECRET>',
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-supabase-migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, SupabaseMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.createSupabaseMigration({
resources: [Resources.User],
resources: [SupabaseMigrationResource.User],
endpoint: 'https://example.com',
apiKey: '<API_KEY>',
databaseHost: '<DATABASE_HOST>',
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/get-appwrite-report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, AppwriteMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.getAppwriteReport({
resources: [Resources.User],
resources: [AppwriteMigrationResource.User],
endpoint: 'https://example.com',
projectID: '<PROJECT_ID>',
key: '<KEY>'
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/get-firebase-report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, FirebaseMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.getFirebaseReport({
resources: [Resources.User],
resources: [FirebaseMigrationResource.User],
serviceAccount: '<SERVICE_ACCOUNT>'
});

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/get-n-host-report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, NHostMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.getNHostReport({
resources: [Resources.User],
resources: [NHostMigrationResource.User],
subdomain: '<SUBDOMAIN>',
region: '<REGION>',
adminSecret: '<ADMIN_SECRET>',
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/get-supabase-report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, Resources } from "@appwrite.io/console";
import { Client, Migrations, SupabaseMigrationResource } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const migrations = new Migrations(client);

const result = await migrations.getSupabaseReport({
resources: [Resources.User],
resources: [SupabaseMigrationResource.User],
endpoint: 'https://example.com',
apiKey: '<API_KEY>',
databaseHost: '<DATABASE_HOST>',
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/sites/create-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const sites = new Sites(client);
const result = await sites.createDeployment({
siteId: '<SITE_ID>',
code: document.getElementById('uploader').files[0],
activate: false,
installCommand: '<INSTALL_COMMAND>', // optional
buildCommand: '<BUILD_COMMAND>', // optional
outputDirectory: '<OUTPUT_DIRECTORY>' // optional
outputDirectory: '<OUTPUT_DIRECTORY>', // optional
activate: false // optional
});

console.log(result);
Expand Down
21 changes: 21 additions & 0 deletions src/enums/appwrite-migration-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export enum AppwriteMigrationResource {
User = 'user',
Team = 'team',
Membership = 'membership',
Database = 'database',
Table = 'table',
Column = 'column',
Index = 'index',
Row = 'row',
Document = 'document',
Attribute = 'attribute',
Collection = 'collection',
Bucket = 'bucket',
File = 'file',
Function = 'function',
Deployment = 'deployment',
Environmentvariable = 'environment-variable',
Site = 'site',
Sitedeployment = 'site-deployment',
Sitevariable = 'site-variable',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Enum member keys Environmentvariable, Sitedeployment, and Sitevariable should be PascalCase.

Every other member in this enum (and across NHostMigrationResource / SupabaseMigrationResource) uses PascalCase. These three compound-word keys are inconsistently cased and will be visible as part of the public API. The string values (API literals) don't need to change — only the TypeScript identifiers.

🔤 Proposed fix
-    Environmentvariable = 'environment-variable',
-    Site = 'site',
-    Sitedeployment = 'site-deployment',
-    Sitevariable = 'site-variable',
+    EnvironmentVariable = 'environment-variable',
+    Site = 'site',
+    SiteDeployment = 'site-deployment',
+    SiteVariable = 'site-variable',
📝 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
Environmentvariable = 'environment-variable',
Site = 'site',
Sitedeployment = 'site-deployment',
Sitevariable = 'site-variable',
EnvironmentVariable = 'environment-variable',
Site = 'site',
SiteDeployment = 'site-deployment',
SiteVariable = 'site-variable',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/enums/appwrite-migration-resource.ts` around lines 17 - 20, Rename the
mis-cased enum members in AppwriteMigrationResource to use PascalCase
identifiers: change Environmentvariable -> EnvironmentVariable, Sitedeployment
-> SiteDeployment, and Sitevariable -> SiteVariable while keeping their string
values unchanged; update all usages/imports that reference the old identifiers
(search for AppwriteMigrationResource.Environmentvariable, .Sitedeployment,
.Sitevariable) so callers use the new enum member names.

}
3 changes: 3 additions & 0 deletions src/enums/build-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export enum BuildRuntime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Expand Down
12 changes: 12 additions & 0 deletions src/enums/firebase-migration-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export enum FirebaseMigrationResource {
User = 'user',
Database = 'database',
Table = 'table',
Column = 'column',
Row = 'row',
Document = 'document',
Attribute = 'attribute',
Collection = 'collection',
Bucket = 'bucket',
File = 'file',
}
Comment on lines +1 to +12
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

fd 'migration-resource.ts' src/enums --exec cat {}

Repository: appwrite/sdk-for-console

Length of output: 1736


🌐 Web query:

Firebase migration resource types Firestore Realtime Database API

💡 Result:

Here are the key resource types / resource-name formats you’ll typically use when migrating or integrating Firebase Realtime Database ↔ Firestore via APIs:

Firestore

  • Firestore Database resource name (REST): projects/{project}/databases/{database} (most commonly {database} is (default)). [1]
  • Cloud Monitoring “monitored resource type” for Firestore: firestore.googleapis.com/Database (also commonly seen: firestore_instance). [2]

Firebase Realtime Database

  • Realtime Database REST endpoint format: https://<dbname>.firebaseio.com/<path>.json (URL varies by region; examples use <dbname>.firebaseio.com). [3]
  • Cloud Monitoring “monitored resource type” for Realtime Database: firebase_namespace. [2]

Migration guidance (RTDB → Firestore)

  • Firebase’s recommended approach includes mapping schema differences and (optionally) mirroring new RTDB writes into Firestore using Cloud Functions during the transition. [4]

Sources: [1] [2] [3] [4]


🌐 Web query:

Appwrite Firebase migration resource enum valid values

💡 Result:

For Appwrite Firebase migrations (POST /v1/migrations/firebase), the resources field is an array validated against Firebase’s supported migration resources on the server side (a whitelist) [1].

In practice, the Firebase migration supports migrating these resource categories [2]:

  • users (Firebase Auth)
  • databases (Firestore schema/collections)
  • documents (Firestore documents; noted as partial support in docs)
  • files (Firebase Storage files)

Sources: the migrations endpoint definition/validation [1] and the migrations docs support matrix [2].


Remove or validate Table, Column, Row, Attribute, Collection, and Bucket enum values.

The Appwrite Firebase migration API only supports: users, databases, documents, and files. The enum includes relational database concepts (Table, Column, Row, Attribute) and unsupported values (Collection, Bucket) that don't match Firebase's document model or Appwrite's migration resource whitelist. Callers using these enum members will send invalid resource identifiers to the backend.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/enums/firebase-migration-resource.ts` around lines 1 - 12, The
FirebaseMigrationResource enum contains unsupported members (Table, Column, Row,
Attribute, Collection, Bucket) that will send invalid resources; update the enum
FirebaseMigrationResource to only include the Appwrite-supported identifiers
(e.g., User -> 'users', Database -> 'databases', Document -> 'documents', File
-> 'files') or add a validation layer that translates or rejects the unsupported
members; ensure any code using FirebaseMigrationResource (callers of the enum)
is updated to use the new values or performs validation/mapping before sending
requests so only the allowed resource strings are emitted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Resources {
export enum NHostMigrationResource {
User = 'user',
Database = 'database',
Table = 'table',
Expand Down
3 changes: 3 additions & 0 deletions src/enums/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export enum Runtime {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Expand Down
3 changes: 3 additions & 0 deletions src/enums/runtimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export enum Runtimes {
Pythonml311 = 'python-ml-3.11',
Pythonml312 = 'python-ml-3.12',
Pythonml313 = 'python-ml-3.13',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Expand Down
13 changes: 13 additions & 0 deletions src/enums/supabase-migration-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export enum SupabaseMigrationResource {
User = 'user',
Database = 'database',
Table = 'table',
Column = 'column',
Index = 'index',
Row = 'row',
Document = 'document',
Attribute = 'attribute',
Collection = 'collection',
Bucket = 'bucket',
File = 'file',
}
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ export { ExecutionMethod } from './enums/execution-method';
export { Name } from './enums/name';
export { MessagePriority } from './enums/message-priority';
export { SmtpEncryption } from './enums/smtp-encryption';
export { Resources } from './enums/resources';
export { AppwriteMigrationResource } from './enums/appwrite-migration-resource';
export { FirebaseMigrationResource } from './enums/firebase-migration-resource';
export { NHostMigrationResource } from './enums/n-host-migration-resource';
export { SupabaseMigrationResource } from './enums/supabase-migration-resource';
export { ProjectUsageRange } from './enums/project-usage-range';
export { Region } from './enums/region';
export { Api } from './enums/api';
Expand Down
60 changes: 56 additions & 4 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2627,9 +2627,9 @@ export namespace Models {
*/
$id: string;
/**
* Row automatically incrementing ID.
* Row sequence ID.
*/
$sequence: number;
$sequence: string;
/**
* Table ID.
*/
Expand Down Expand Up @@ -2666,9 +2666,9 @@ export namespace Models {
*/
$id: string;
/**
* Document automatically incrementing ID.
* Document sequence ID.
*/
$sequence: number;
$sequence: string;
/**
* Collection ID.
*/
Expand Down Expand Up @@ -6401,6 +6401,46 @@ export namespace Models {
* Comma-separated list of nameservers.
*/
_APP_DOMAINS_NAMESERVERS: string;
/**
* Database adapter in use.
*/
_APP_DB_ADAPTER: string;
/**
* Whether the database adapter supports relationships.
*/
supportForRelationships: boolean;
/**
* Whether the database adapter supports operators.
*/
supportForOperators: boolean;
/**
* Whether the database adapter supports spatial attributes.
*/
supportForSpatials: boolean;
/**
* Whether the database adapter supports spatial indexes on nullable columns.
*/
supportForSpatialIndexNull: boolean;
/**
* Whether the database adapter supports fulltext wildcard search.
*/
supportForFulltextWildcard: boolean;
/**
* Whether the database adapter supports multiple fulltext indexes per collection.
*/
supportForMultipleFulltextIndexes: boolean;
/**
* Whether the database adapter supports resizing attributes.
*/
supportForAttributeResizing: boolean;
/**
* Whether the database adapter supports fixed schemas with row width limits.
*/
supportForSchemas: boolean;
/**
* Maximum index length supported by the database adapter.
*/
maxIndexLength: number;
}

/**
Expand Down Expand Up @@ -6813,6 +6853,18 @@ export namespace Models {
* Number of functions to be migrated.
*/
function: number;
/**
* Number of sites to be migrated.
*/
site: number;
/**
* Number of site deployments to be migrated.
*/
site-deployment: number;
/**
* Number of site variables to be migrated.
*/
site-variable: number;
/**
* Size of files to be migrated in mb.
*/
Expand Down
Loading