diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index d9125be8..9c412c5b 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -12,7 +12,8 @@ const result = await databases.listDocuments({ collectionId: '', queries: [], // optional transactionId: '', // optional - total: false // optional + total: false, // optional + ttl: 0 // optional }); console.log(result); diff --git a/docs/examples/migrations/create-appwrite-migration.md b/docs/examples/migrations/create-appwrite-migration.md index 2f7c07f8..d0f61541 100644 --- a/docs/examples/migrations/create-appwrite-migration.md +++ b/docs/examples/migrations/create-appwrite-migration.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '', apiKey: '' diff --git a/docs/examples/migrations/create-firebase-migration.md b/docs/examples/migrations/create-firebase-migration.md index 21c97217..775df556 100644 --- a/docs/examples/migrations/create-firebase-migration.md +++ b/docs/examples/migrations/create-firebase-migration.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '' }); diff --git a/docs/examples/migrations/create-n-host-migration.md b/docs/examples/migrations/create-n-host-migration.md index a24f9f35..cd17162a 100644 --- a/docs/examples/migrations/create-n-host-migration.md +++ b/docs/examples/migrations/create-n-host-migration.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '', region: '', adminSecret: '', diff --git a/docs/examples/migrations/create-supabase-migration.md b/docs/examples/migrations/create-supabase-migration.md index 3344ac0e..6463d358 100644 --- a/docs/examples/migrations/create-supabase-migration.md +++ b/docs/examples/migrations/create-supabase-migration.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '', databaseHost: '', diff --git a/docs/examples/migrations/get-appwrite-report.md b/docs/examples/migrations/get-appwrite-report.md index b8396f26..d5417c9f 100644 --- a/docs/examples/migrations/get-appwrite-report.md +++ b/docs/examples/migrations/get-appwrite-report.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '', key: '' diff --git a/docs/examples/migrations/get-firebase-report.md b/docs/examples/migrations/get-firebase-report.md index 2c652ce8..46b9d859 100644 --- a/docs/examples/migrations/get-firebase-report.md +++ b/docs/examples/migrations/get-firebase-report.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '' }); diff --git a/docs/examples/migrations/get-n-host-report.md b/docs/examples/migrations/get-n-host-report.md index 16c2626d..4ed95ea9 100644 --- a/docs/examples/migrations/get-n-host-report.md +++ b/docs/examples/migrations/get-n-host-report.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '', region: '', adminSecret: '', diff --git a/docs/examples/migrations/get-supabase-report.md b/docs/examples/migrations/get-supabase-report.md index 40f04a21..834dd6bb 100644 --- a/docs/examples/migrations/get-supabase-report.md +++ b/docs/examples/migrations/get-supabase-report.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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: '', databaseHost: '', diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index 0b9ea0cd..ce2f439e 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -10,10 +10,10 @@ const sites = new Sites(client); const result = await sites.createDeployment({ siteId: '', code: document.getElementById('uploader').files[0], - activate: false, installCommand: '', // optional buildCommand: '', // optional - outputDirectory: '' // optional + outputDirectory: '', // optional + activate: false // optional }); console.log(result); diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 0ada5b3e..95df1e02 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -12,7 +12,8 @@ const result = await tablesDB.listRows({ tableId: '', queries: [], // optional transactionId: '', // optional - total: false // optional + total: false, // optional + ttl: 0 // optional }); console.log(result); diff --git a/src/channel.ts b/src/channel.ts index 39322cfe..a5d7ee38 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -16,8 +16,14 @@ interface Resolved { _res: any } type Actionable = Document | Row | File | Team | Membership; function normalize(id: string): string { - const trimmed = id.trim(); - return trimmed === "" ? "*" : trimmed; + if (id === undefined || id === null) { + throw new Error("Channel ID is required"); + } + const trimmed = String(id).trim(); + if (trimmed === "") { + throw new Error("Channel ID is required"); + } + return trimmed; } export class Channel { @@ -44,9 +50,8 @@ export class Channel { // --- DATABASE ROUTE --- // Only available on Channel - collection(this: Channel, id?: string): Channel { - // Default: wildcard collection ID - return this.next("collections", id ?? "*"); + collection(this: Channel, id: string): Channel { + return this.next("collections", id); } // Only available on Channel @@ -56,9 +61,8 @@ export class Channel { } // --- TABLESDB ROUTE --- - table(this: Channel, id?: string): Channel { - // Default: wildcard table ID - return this.next
("tables", id ?? "*"); + table(this: Channel, id: string): Channel
{ + return this.next
("tables", id); } row(this: Channel
, id?: string): Channel { @@ -91,31 +95,31 @@ export class Channel { } // --- ROOT FACTORIES --- - static database(id: string = "*") { + static database(id: string) { return new Channel(["databases", normalize(id)]); } - static execution(id: string = "*") { + static execution(id: string) { return new Channel(["executions", normalize(id)]); } - static tablesdb(id: string = "*") { + static tablesdb(id: string) { return new Channel(["tablesdb", normalize(id)]); } - static bucket(id: string = "*") { + static bucket(id: string) { return new Channel(["buckets", normalize(id)]); } - static function(id: string = "*") { + static function(id: string) { return new Channel(["functions", normalize(id)]); } - static team(id: string = "*") { + static team(id: string) { return new Channel(["teams", normalize(id)]); } - static membership(id: string = "*") { + static membership(id: string) { return new Channel(["memberships", normalize(id)]); } diff --git a/src/enums/appwrite-migration-resource.ts b/src/enums/appwrite-migration-resource.ts new file mode 100644 index 00000000..7b743626 --- /dev/null +++ b/src/enums/appwrite-migration-resource.ts @@ -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', +} \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index 3f85913f..0741a17e 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -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', diff --git a/src/enums/firebase-migration-resource.ts b/src/enums/firebase-migration-resource.ts new file mode 100644 index 00000000..b8e16769 --- /dev/null +++ b/src/enums/firebase-migration-resource.ts @@ -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', +} \ No newline at end of file diff --git a/src/enums/resources.ts b/src/enums/n-host-migration-resource.ts similarity index 87% rename from src/enums/resources.ts rename to src/enums/n-host-migration-resource.ts index 066e2e03..4c1366af 100644 --- a/src/enums/resources.ts +++ b/src/enums/n-host-migration-resource.ts @@ -1,4 +1,4 @@ -export enum Resources { +export enum NHostMigrationResource { User = 'user', Database = 'database', Table = 'table', diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index fda3bab3..68765627 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -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', diff --git a/src/enums/runtimes.ts b/src/enums/runtimes.ts index 546822bf..646bb23c 100644 --- a/src/enums/runtimes.ts +++ b/src/enums/runtimes.ts @@ -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', diff --git a/src/enums/supabase-migration-resource.ts b/src/enums/supabase-migration-resource.ts new file mode 100644 index 00000000..de6b7b90 --- /dev/null +++ b/src/enums/supabase-migration-resource.ts @@ -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', +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6dcd18e6..6b0489b6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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'; diff --git a/src/models.ts b/src/models.ts index 60599312..d6fe6632 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2627,7 +2627,7 @@ export namespace Models { */ $id: string; /** - * Row automatically incrementing ID. + * Row sequence ID. */ $sequence: number; /** @@ -2666,7 +2666,7 @@ export namespace Models { */ $id: string; /** - * Document automatically incrementing ID. + * Document sequence ID. */ $sequence: number; /** @@ -6401,6 +6401,50 @@ 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; + /** + * Whether the database adapter uses integer sequence IDs. + */ + supportForIntegerIds: boolean; } /** @@ -6813,6 +6857,10 @@ export namespace Models { * Number of functions to be migrated. */ function: number; + /** + * Number of sites to be migrated. + */ + site: number; /** * Size of files to be migrated in mb. */ diff --git a/src/services/databases.ts b/src/services/databases.ts index c1b0a800..ff923c5e 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1188,7 +1188,7 @@ export class Databases { * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. @@ -1203,7 +1203,7 @@ export class Databases { * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. @@ -3660,6 +3660,90 @@ export class Databases { ); } + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. + */ + updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; + updateRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** * Create a string attribute. * @@ -4622,90 +4706,6 @@ export class Databases { ); } - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. - */ - updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; - updateRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -4714,11 +4714,12 @@ export class Databases { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -4727,26 +4728,28 @@ export class Databases { * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; + listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, queries: rest[1] as string[], transactionId: rest[2] as string, - total: rest[3] as boolean + total: rest[3] as boolean, + ttl: rest[4] as number }; } @@ -4755,6 +4758,7 @@ export class Databases { const queries = params.queries; const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4774,6 +4778,9 @@ export class Databases { if (typeof total !== 'undefined') { payload['total'] = total; } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 260b763c..89c754fd 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -4929,7 +4929,7 @@ export class Messaging { * Get a list of all subscribers from the current Appwrite project. * * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} @@ -4940,7 +4940,7 @@ export class Messaging { * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType * @param {string} search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} diff --git a/src/services/migrations.ts b/src/services/migrations.ts index 6b728f00..143486ed 100644 --- a/src/services/migrations.ts +++ b/src/services/migrations.ts @@ -2,7 +2,10 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { Resources } from '../enums/resources'; +import { AppwriteMigrationResource } from '../enums/appwrite-migration-resource'; +import { FirebaseMigrationResource } from '../enums/firebase-migration-resource'; +import { NHostMigrationResource } from '../enums/n-host-migration-resource'; +import { SupabaseMigrationResource } from '../enums/supabase-migration-resource'; export class Migrations { client: Client; @@ -80,18 +83,18 @@ export class Migrations { /** * Migrate data from another Appwrite project to your current project. This endpoint allows you to migrate resources like databases, collections, documents, users, and files from an existing Appwrite project. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {AppwriteMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.endpoint - Source Appwrite endpoint * @param {string} params.projectId - Source Project ID * @param {string} params.apiKey - Source API Key * @throws {AppwriteException} * @returns {Promise} */ - createAppwriteMigration(params: { resources: Resources[], endpoint: string, projectId: string, apiKey: string }): Promise; + createAppwriteMigration(params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }): Promise; /** * Migrate data from another Appwrite project to your current project. This endpoint allows you to migrate resources like databases, collections, documents, users, and files from an existing Appwrite project. * - * @param {Resources[]} resources - List of resources to migrate + * @param {AppwriteMigrationResource[]} resources - List of resources to migrate * @param {string} endpoint - Source Appwrite endpoint * @param {string} projectId - Source Project ID * @param {string} apiKey - Source API Key @@ -99,18 +102,18 @@ export class Migrations { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createAppwriteMigration(resources: Resources[], endpoint: string, projectId: string, apiKey: string): Promise; + createAppwriteMigration(resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string): Promise; createAppwriteMigration( - paramsOrFirst: { resources: Resources[], endpoint: string, projectId: string, apiKey: string } | Resources[], + paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string } | AppwriteMigrationResource[], ...rest: [(string)?, (string)?, (string)?] ): Promise { - let params: { resources: Resources[], endpoint: string, projectId: string, apiKey: string }; + let params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectId' in paramsOrFirst || 'apiKey' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], endpoint: string, projectId: string, apiKey: string }; + params = (paramsOrFirst || {}) as { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as AppwriteMigrationResource[], endpoint: rest[0] as string, projectId: rest[1] as string, apiKey: rest[2] as string @@ -166,18 +169,18 @@ export class Migrations { /** * Generate a report of the data in an Appwrite project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {AppwriteMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.endpoint - Source's Appwrite Endpoint * @param {string} params.projectID - Source's Project ID * @param {string} params.key - Source's API Key * @throws {AppwriteException} * @returns {Promise} */ - getAppwriteReport(params: { resources: Resources[], endpoint: string, projectID: string, key: string }): Promise; + getAppwriteReport(params: { resources: AppwriteMigrationResource[], endpoint: string, projectID: string, key: string }): Promise; /** * Generate a report of the data in an Appwrite project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} resources - List of resources to migrate + * @param {AppwriteMigrationResource[]} resources - List of resources to migrate * @param {string} endpoint - Source's Appwrite Endpoint * @param {string} projectID - Source's Project ID * @param {string} key - Source's API Key @@ -185,18 +188,18 @@ export class Migrations { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getAppwriteReport(resources: Resources[], endpoint: string, projectID: string, key: string): Promise; + getAppwriteReport(resources: AppwriteMigrationResource[], endpoint: string, projectID: string, key: string): Promise; getAppwriteReport( - paramsOrFirst: { resources: Resources[], endpoint: string, projectID: string, key: string } | Resources[], + paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectID: string, key: string } | AppwriteMigrationResource[], ...rest: [(string)?, (string)?, (string)?] ): Promise { - let params: { resources: Resources[], endpoint: string, projectID: string, key: string }; + let params: { resources: AppwriteMigrationResource[], endpoint: string, projectID: string, key: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectID' in paramsOrFirst || 'key' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], endpoint: string, projectID: string, key: string }; + params = (paramsOrFirst || {}) as { resources: AppwriteMigrationResource[], endpoint: string, projectID: string, key: string }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as AppwriteMigrationResource[], endpoint: rest[0] as string, projectID: rest[1] as string, key: rest[2] as string @@ -449,33 +452,33 @@ export class Migrations { /** * Migrate data from a Firebase project to your Appwrite project. This endpoint allows you to migrate resources like authentication and other supported services from a Firebase project. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {FirebaseMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.serviceAccount - JSON of the Firebase service account credentials * @throws {AppwriteException} * @returns {Promise} */ - createFirebaseMigration(params: { resources: Resources[], serviceAccount: string }): Promise; + createFirebaseMigration(params: { resources: FirebaseMigrationResource[], serviceAccount: string }): Promise; /** * Migrate data from a Firebase project to your Appwrite project. This endpoint allows you to migrate resources like authentication and other supported services from a Firebase project. * - * @param {Resources[]} resources - List of resources to migrate + * @param {FirebaseMigrationResource[]} resources - List of resources to migrate * @param {string} serviceAccount - JSON of the Firebase service account credentials * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFirebaseMigration(resources: Resources[], serviceAccount: string): Promise; + createFirebaseMigration(resources: FirebaseMigrationResource[], serviceAccount: string): Promise; createFirebaseMigration( - paramsOrFirst: { resources: Resources[], serviceAccount: string } | Resources[], + paramsOrFirst: { resources: FirebaseMigrationResource[], serviceAccount: string } | FirebaseMigrationResource[], ...rest: [(string)?] ): Promise { - let params: { resources: Resources[], serviceAccount: string }; + let params: { resources: FirebaseMigrationResource[], serviceAccount: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'serviceAccount' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], serviceAccount: string }; + params = (paramsOrFirst || {}) as { resources: FirebaseMigrationResource[], serviceAccount: string }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as FirebaseMigrationResource[], serviceAccount: rest[0] as string }; } @@ -515,33 +518,33 @@ export class Migrations { /** * Generate a report of the data in a Firebase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {FirebaseMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.serviceAccount - JSON of the Firebase service account credentials * @throws {AppwriteException} * @returns {Promise} */ - getFirebaseReport(params: { resources: Resources[], serviceAccount: string }): Promise; + getFirebaseReport(params: { resources: FirebaseMigrationResource[], serviceAccount: string }): Promise; /** * Generate a report of the data in a Firebase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} resources - List of resources to migrate + * @param {FirebaseMigrationResource[]} resources - List of resources to migrate * @param {string} serviceAccount - JSON of the Firebase service account credentials * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getFirebaseReport(resources: Resources[], serviceAccount: string): Promise; + getFirebaseReport(resources: FirebaseMigrationResource[], serviceAccount: string): Promise; getFirebaseReport( - paramsOrFirst: { resources: Resources[], serviceAccount: string } | Resources[], + paramsOrFirst: { resources: FirebaseMigrationResource[], serviceAccount: string } | FirebaseMigrationResource[], ...rest: [(string)?] ): Promise { - let params: { resources: Resources[], serviceAccount: string }; + let params: { resources: FirebaseMigrationResource[], serviceAccount: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'serviceAccount' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], serviceAccount: string }; + params = (paramsOrFirst || {}) as { resources: FirebaseMigrationResource[], serviceAccount: string }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as FirebaseMigrationResource[], serviceAccount: rest[0] as string }; } @@ -580,7 +583,7 @@ export class Migrations { /** * Migrate data from an NHost project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from an NHost project. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {NHostMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.subdomain - Source's Subdomain * @param {string} params.region - Source's Region * @param {string} params.adminSecret - Source's Admin Secret @@ -591,11 +594,11 @@ export class Migrations { * @throws {AppwriteException} * @returns {Promise} */ - createNHostMigration(params: { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }): Promise; + createNHostMigration(params: { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }): Promise; /** * Migrate data from an NHost project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from an NHost project. * - * @param {Resources[]} resources - List of resources to migrate + * @param {NHostMigrationResource[]} resources - List of resources to migrate * @param {string} subdomain - Source's Subdomain * @param {string} region - Source's Region * @param {string} adminSecret - Source's Admin Secret @@ -607,18 +610,18 @@ export class Migrations { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createNHostMigration(resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number): Promise; + createNHostMigration(resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number): Promise; createNHostMigration( - paramsOrFirst: { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number } | Resources[], + paramsOrFirst: { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number } | NHostMigrationResource[], ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?] ): Promise { - let params: { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; + let params: { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'subdomain' in paramsOrFirst || 'region' in paramsOrFirst || 'adminSecret' in paramsOrFirst || 'database' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; + params = (paramsOrFirst || {}) as { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as NHostMigrationResource[], subdomain: rest[0] as string, region: rest[1] as string, adminSecret: rest[2] as string, @@ -703,7 +706,7 @@ export class Migrations { /** * Generate a detailed report of the data in an NHost project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} params.resources - List of resources to migrate. + * @param {NHostMigrationResource[]} params.resources - List of resources to migrate. * @param {string} params.subdomain - Source's Subdomain. * @param {string} params.region - Source's Region. * @param {string} params.adminSecret - Source's Admin Secret. @@ -714,11 +717,11 @@ export class Migrations { * @throws {AppwriteException} * @returns {Promise} */ - getNHostReport(params: { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }): Promise; + getNHostReport(params: { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }): Promise; /** * Generate a detailed report of the data in an NHost project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} resources - List of resources to migrate. + * @param {NHostMigrationResource[]} resources - List of resources to migrate. * @param {string} subdomain - Source's Subdomain. * @param {string} region - Source's Region. * @param {string} adminSecret - Source's Admin Secret. @@ -730,18 +733,18 @@ export class Migrations { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getNHostReport(resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number): Promise; + getNHostReport(resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number): Promise; getNHostReport( - paramsOrFirst: { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number } | Resources[], + paramsOrFirst: { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number } | NHostMigrationResource[], ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?] ): Promise { - let params: { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; + let params: { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'subdomain' in paramsOrFirst || 'region' in paramsOrFirst || 'adminSecret' in paramsOrFirst || 'database' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; + params = (paramsOrFirst || {}) as { resources: NHostMigrationResource[], subdomain: string, region: string, adminSecret: string, database: string, username: string, password: string, port?: number }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as NHostMigrationResource[], subdomain: rest[0] as string, region: rest[1] as string, adminSecret: rest[2] as string, @@ -825,7 +828,7 @@ export class Migrations { /** * Migrate data from a Supabase project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from a Supabase project. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {SupabaseMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.endpoint - Source's Supabase Endpoint * @param {string} params.apiKey - Source's API Key * @param {string} params.databaseHost - Source's Database Host @@ -835,11 +838,11 @@ export class Migrations { * @throws {AppwriteException} * @returns {Promise} */ - createSupabaseMigration(params: { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }): Promise; + createSupabaseMigration(params: { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }): Promise; /** * Migrate data from a Supabase project to your Appwrite project. This endpoint allows you to migrate resources like authentication, databases, and other supported services from a Supabase project. * - * @param {Resources[]} resources - List of resources to migrate + * @param {SupabaseMigrationResource[]} resources - List of resources to migrate * @param {string} endpoint - Source's Supabase Endpoint * @param {string} apiKey - Source's API Key * @param {string} databaseHost - Source's Database Host @@ -850,18 +853,18 @@ export class Migrations { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createSupabaseMigration(resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number): Promise; + createSupabaseMigration(resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number): Promise; createSupabaseMigration( - paramsOrFirst: { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number } | Resources[], + paramsOrFirst: { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number } | SupabaseMigrationResource[], ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (number)?] ): Promise { - let params: { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; + let params: { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'apiKey' in paramsOrFirst || 'databaseHost' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; + params = (paramsOrFirst || {}) as { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as SupabaseMigrationResource[], endpoint: rest[0] as string, apiKey: rest[1] as string, databaseHost: rest[2] as string, @@ -938,7 +941,7 @@ export class Migrations { /** * Generate a report of the data in a Supabase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} params.resources - List of resources to migrate + * @param {SupabaseMigrationResource[]} params.resources - List of resources to migrate * @param {string} params.endpoint - Source's Supabase Endpoint. * @param {string} params.apiKey - Source's API Key. * @param {string} params.databaseHost - Source's Database Host. @@ -948,11 +951,11 @@ export class Migrations { * @throws {AppwriteException} * @returns {Promise} */ - getSupabaseReport(params: { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }): Promise; + getSupabaseReport(params: { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }): Promise; /** * Generate a report of the data in a Supabase project before migrating. This endpoint analyzes the source project and returns information about the resources that can be migrated. * - * @param {Resources[]} resources - List of resources to migrate + * @param {SupabaseMigrationResource[]} resources - List of resources to migrate * @param {string} endpoint - Source's Supabase Endpoint. * @param {string} apiKey - Source's API Key. * @param {string} databaseHost - Source's Database Host. @@ -963,18 +966,18 @@ export class Migrations { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getSupabaseReport(resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number): Promise; + getSupabaseReport(resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number): Promise; getSupabaseReport( - paramsOrFirst: { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number } | Resources[], + paramsOrFirst: { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number } | SupabaseMigrationResource[], ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (number)?] ): Promise { - let params: { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; + let params: { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'apiKey' in paramsOrFirst || 'databaseHost' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: Resources[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; + params = (paramsOrFirst || {}) as { resources: SupabaseMigrationResource[], endpoint: string, apiKey: string, databaseHost: string, username: string, password: string, port?: number }; } else { params = { - resources: paramsOrFirst as Resources[], + resources: paramsOrFirst as SupabaseMigrationResource[], endpoint: rest[0] as string, apiKey: rest[1] as string, databaseHost: rest[2] as string, diff --git a/src/services/sites.ts b/src/services/sites.ts index f499b1ae..8d0e05fc 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -912,56 +912,56 @@ export class Sites { * * @param {string} params.siteId - Site ID. * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. * @param {string} params.installCommand - Install Commands. * @param {string} params.buildCommand - Build Commands. * @param {string} params.outputDirectory - Output Directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise; /** * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. * * @param {string} siteId - Site ID. * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. * @param {string} installCommand - Install Commands. * @param {string} buildCommand - Build Commands. * @param {string} outputDirectory - Output Directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeployment(siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void): Promise; + createDeployment(siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (boolean)?, (string)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] ): Promise { - let params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; + let params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; let onProgress: ((progress: UploadProgress) => void); if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; + params = (paramsOrFirst || {}) as { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); } else { params = { siteId: paramsOrFirst as string, code: rest[0] as File, - activate: rest[1] as boolean, - installCommand: rest[2] as string, - buildCommand: rest[3] as string, - outputDirectory: rest[4] as string + installCommand: rest[1] as string, + buildCommand: rest[2] as string, + outputDirectory: rest[3] as string, + activate: rest[4] as boolean }; onProgress = rest[5] as ((progress: UploadProgress) => void); } const siteId = params.siteId; const code = params.code; - const activate = params.activate; const installCommand = params.installCommand; const buildCommand = params.buildCommand; const outputDirectory = params.outputDirectory; + const activate = params.activate; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -969,9 +969,6 @@ export class Sites { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } - if (typeof activate === 'undefined') { - throw new AppwriteException('Missing required parameter: "activate"'); - } const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); const payload: Payload = {}; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 792ca08b..c37d8768 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -5052,10 +5052,11 @@ export class TablesDB { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} */ - listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * @@ -5064,26 +5065,28 @@ export class TablesDB { * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; + listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listRows( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, queries: rest[1] as string[], transactionId: rest[2] as string, - total: rest[3] as boolean + total: rest[3] as boolean, + ttl: rest[4] as number }; } @@ -5092,6 +5095,7 @@ export class TablesDB { const queries = params.queries; const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -5111,6 +5115,9 @@ export class TablesDB { if (typeof total !== 'undefined') { payload['total'] = total; } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/teams.ts b/src/services/teams.ts index 4def4b76..a03f899c 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -465,7 +465,7 @@ export class Teams { * * * @param {string} params.teamId - Team ID. - * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param {string} params.email - Email of the new team member. * @param {string} params.userId - ID of the user to be added to a team. * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -486,7 +486,7 @@ export class Teams { * * * @param {string} teamId - Team ID. - * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param {string} email - Email of the new team member. * @param {string} userId - ID of the user to be added to a team. * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -631,7 +631,7 @@ export class Teams { * * @param {string} params.teamId - Team ID. * @param {string} params.membershipId - Membership ID. - * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise} */ @@ -642,7 +642,7 @@ export class Teams { * * @param {string} teamId - Team ID. * @param {string} membershipId - Membership ID. - * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience.