Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 = 'environmentVariable',
Site = 'site',
SiteDeployment = 'siteDeployment',
SiteVariable = 'siteVariable',
}
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',
}
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;
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 | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, verify the actual code at the specified lines in src/models.ts
echo "=== Lines 2630-2632 (Row.$sequence) ==="
sed -n '2625,2635p' src/models.ts

echo -e "\n=== Lines 2669-2671 (Document.$sequence) ==="
sed -n '2664,2674p' src/models.ts

echo -e "\n=== Lines 6404-6443 (ConsoleVariables new fields) ==="
sed -n '6400,6450p' src/models.ts

echo -e "\n=== Lines 6856-6867 (MigrationReport new fields) ==="
sed -n '6850,6875p' src/models.ts

Repository: appwrite/sdk-for-console

Length of output: 2828


🏁 Script executed:

# Search for usages of $sequence in the codebase
echo "=== Searching for $sequence usages ==="
rg -n '\$sequence' --type ts -C 3

Repository: appwrite/sdk-for-console

Length of output: 624


🏁 Script executed:

# Check git history to understand what changed
echo "=== Check git diff for src/models.ts to see the exact changes ==="
git diff HEAD~1 src/models.ts | head -200

Repository: appwrite/sdk-for-console

Length of output: 337


Breaking type change in $sequence: numberstring will break downstream consumers.

Both Row.$sequence (line 2632) and Document.$sequence (line 2671) are now typed as string. Any TypeScript consumer using arithmetic ($sequence + 1), numeric comparisons ($sequence > 0), or passing $sequence to number-typed APIs will get a compile error post-upgrade; untyped JavaScript callers will break at runtime. This should be flagged explicitly in the 3.1.0 migration guide.

Internal SDK usages do not exist to audit (expected for an SDK package); the breaking change impact is on downstream consumers.

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

In `@src/models.ts` around lines 2630 - 2632, Row.$sequence and Document.$sequence
were changed from number to string which breaks downstream consumers; restore
compatibility by typing both as string | number (or revert to number if strings
are not required) so arithmetic and numeric APIs continue to work, and add an
explicit entry to the 3.1.0 migration guide noting the change and recommended
consumer action; update the definitions for $sequence on the Row and Document
types (search for Row.$sequence and Document.$sequence) and add the migration
note to the release/migration docs.

/**
* 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;
Comment on lines +6404 to +6443
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

New ConsoleVariables fields should be optional to reflect server-version variability.

All ten new fields (_APP_DB_ADAPTER, supportForRelationships, supportForOperators, supportForSpatials, supportForSpatialIndexNull, supportForFulltextWildcard, supportForMultipleFulltextIndexes, supportForAttributeResizing, supportForSchemas, maxIndexLength) are declared as required. Consumers running against a pre-3.1.0 server won't receive these fields — TypeScript says they're present but they'll be undefined at runtime.

🛡️ Proposed fix — mark new fields as optional
-        _APP_DB_ADAPTER: string;
+        _APP_DB_ADAPTER?: string;
-        supportForRelationships: boolean;
+        supportForRelationships?: boolean;
-        supportForOperators: boolean;
+        supportForOperators?: boolean;
-        supportForSpatials: boolean;
+        supportForSpatials?: boolean;
-        supportForSpatialIndexNull: boolean;
+        supportForSpatialIndexNull?: boolean;
-        supportForFulltextWildcard: boolean;
+        supportForFulltextWildcard?: boolean;
-        supportForMultipleFulltextIndexes: boolean;
+        supportForMultipleFulltextIndexes?: boolean;
-        supportForAttributeResizing: boolean;
+        supportForAttributeResizing?: boolean;
-        supportForSchemas: boolean;
+        supportForSchemas?: boolean;
-        maxIndexLength: number;
+        maxIndexLength?: number;
📝 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
/**
* 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;
/**
* 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;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/models.ts` around lines 6404 - 6443, The new ConsoleVariables fields are
declared required but may be missing on older servers; update the
ConsoleVariables type by making each of these properties
optional—_APP_DB_ADAPTER, supportForRelationships, supportForOperators,
supportForSpatials, supportForSpatialIndexNull, supportForFulltextWildcard,
supportForMultipleFulltextIndexes, supportForAttributeResizing,
supportForSchemas, and maxIndexLength—so consumers handle undefined values
safely (i.e., change their declarations to optional properties on the
ConsoleVariables interface/type).

}

/**
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;
Comment on lines +6860 to +6863
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

MigrationReport.site should be optional.

This required field won't be present in responses from servers older than 3.1.0, creating the same runtime-versus-type mismatch as the ConsoleVariables additions above.

🛡️ Proposed fix
-        site: number;
+        site?: number;
📝 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
/**
* Number of sites to be migrated.
*/
site: number;
/**
* Number of sites to be migrated.
*/
site?: number;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/models.ts` around lines 6856 - 6859, The MigrationReport.site property is
currently required but older servers (<3.1.0) omit it; make MigrationReport.site
optional by changing its declaration to an optional property (i.e., mark site as
optional) in the MigrationReport/interface definition so callers handle absence
safely (look for the MigrationReport type and the site field in src/models.ts
and update its signature to allow undefined).

/**
* Number of site deployments to be migrated.
*/
siteDeployment: number;
/**
* Number of site variables to be migrated.
*/
siteVariable: number;
/**
* Size of files to be migrated in mb.
*/
Expand Down
Loading