diff --git a/CHANGELOG.md b/CHANGELOG.md index f0bbbef3..8529642b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log -## 22.1.0 +## 22.1.1 + +* Removed unused BigNumber import from src/client.ts to clean up dependencies +* Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples +* Updated README to specify Appwrite server compatibility with 1.8.x +* Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking) + +## 22.0.1 * Fix doc examples with proper formatting * Add support for the new `Backups` service diff --git a/README.md b/README.md index 764e488d..4be156d7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/activities/get-event.md similarity index 70% rename from docs/examples/health/get-queue-threats.md rename to docs/examples/activities/get-event.md index 9b166cac..da7c261f 100644 --- a/docs/examples/health/get-queue-threats.md +++ b/docs/examples/activities/get-event.md @@ -6,9 +6,9 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const activities = new sdk.Activities(client); -const result = await health.getQueueThreats({ - threshold: null // optional +const result = await activities.getEvent({ + eventId: '' }); ``` diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/activities/list-events.md similarity index 69% rename from docs/examples/health/get-queue-region-manager.md rename to docs/examples/activities/list-events.md index e02b3022..11407e89 100644 --- a/docs/examples/health/get-queue-region-manager.md +++ b/docs/examples/activities/list-events.md @@ -6,9 +6,9 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const activities = new sdk.Activities(client); -const result = await health.getQueueRegionManager({ - threshold: null // optional +const result = await activities.listEvents({ + queries: '' // optional }); ``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index 9d358055..cc83d250 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -14,6 +14,7 @@ const result = await databases.createLongtextAttribute({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 2ea9b87b..6bab1b49 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -14,6 +14,7 @@ const result = await databases.createMediumtextAttribute({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index 5d49ed31..3d56639a 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -14,6 +14,7 @@ const result = await databases.createTextAttribute({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index dd5511d8..75ae5c34 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -15,6 +15,7 @@ const result = await databases.createVarcharAttribute({ size: 1, required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md deleted file mode 100644 index 5b2fd2e2..00000000 --- a/docs/examples/health/get-queue-billing-project-aggregation.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueBillingProjectAggregation({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md deleted file mode 100644 index 61b45003..00000000 --- a/docs/examples/health/get-queue-billing-team-aggregation.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueBillingTeamAggregation({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md deleted file mode 100644 index c37bcd66..00000000 --- a/docs/examples/health/get-queue-priority-builds.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueuePriorityBuilds({ - threshold: null // optional -}); -``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 68e4d7b8..0e43b442 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -14,6 +14,7 @@ const result = await tablesDB.createLongtextColumn({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index ac8108d3..42557dbe 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -14,6 +14,7 @@ const result = await tablesDB.createMediumtextColumn({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index e7cfa7bc..8f9960ac 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -14,6 +14,7 @@ const result = await tablesDB.createTextColumn({ key: '', required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index debd75d8..4f1b5de4 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -15,6 +15,7 @@ const result = await tablesDB.createVarcharColumn({ size: 1, required: false, default: '', // optional - array: false // optional + array: false, // optional + encrypt: false // optional }); ``` diff --git a/package.json b/package.json index 8c5c8807..b04150eb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "22.1.0", + "version": "22.1.1", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 8413e7ef..4ad27aa7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2,15 +2,23 @@ import { fetch, FormData, File } from 'node-fetch-native-with-agent'; import { createAgent } from 'node-fetch-native-with-agent/agent'; import { Models } from './models'; import JSONbigModule from 'json-bigint'; -import BigNumber from 'bignumber.js'; const JSONbigParser = JSONbigModule({ storeAsString: false }); const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true }); const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER); const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER); +function isBigNumber(value: any): boolean { + return value !== null + && typeof value === 'object' + && value._isBigNumber === true + && typeof value.isInteger === 'function' + && typeof value.toFixed === 'function' + && typeof value.toNumber === 'function'; +} + function reviver(_key: string, value: any): any { - if (BigNumber.isBigNumber(value)) { + if (isBigNumber(value)) { if (value.isInteger()) { const str = value.toFixed(); const bi = BigInt(str); @@ -60,7 +68,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/22.1.0'; + let ua = 'AppwriteNodeJSSDK/22.1.1'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -109,7 +117,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '22.1.0', + 'x-sdk-version': '22.1.1', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index d9394ae9..3f85913f 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -6,24 +6,35 @@ export enum BuildRuntime { Node200 = 'node-20.0', Node210 = 'node-21.0', Node22 = 'node-22', + Node23 = 'node-23', + Node24 = 'node-24', + Node25 = 'node-25', Php80 = 'php-8.0', Php81 = 'php-8.1', Php82 = 'php-8.2', Php83 = 'php-8.3', + Php84 = 'php-8.4', Ruby30 = 'ruby-3.0', Ruby31 = 'ruby-3.1', Ruby32 = 'ruby-3.2', Ruby33 = 'ruby-3.3', + Ruby34 = 'ruby-3.4', + Ruby40 = 'ruby-4.0', Python38 = 'python-3.8', Python39 = 'python-3.9', Python310 = 'python-3.10', Python311 = 'python-3.11', Python312 = 'python-3.12', + Python313 = 'python-3.13', + Python314 = 'python-3.14', Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', + Pythonml313 = 'python-ml-3.13', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', + Deno25 = 'deno-2.5', + Deno26 = 'deno-2.6', Dart215 = 'dart-2.15', Dart216 = 'dart-2.16', Dart217 = 'dart-2.17', @@ -39,25 +50,34 @@ export enum BuildRuntime { Dotnet60 = 'dotnet-6.0', Dotnet70 = 'dotnet-7.0', Dotnet80 = 'dotnet-8.0', + Dotnet10 = 'dotnet-10', Java80 = 'java-8.0', Java110 = 'java-11.0', Java170 = 'java-17.0', Java180 = 'java-18.0', Java210 = 'java-21.0', Java22 = 'java-22', + Java25 = 'java-25', Swift55 = 'swift-5.5', Swift58 = 'swift-5.8', Swift59 = 'swift-5.9', Swift510 = 'swift-5.10', + Swift62 = 'swift-6.2', Kotlin16 = 'kotlin-1.6', Kotlin18 = 'kotlin-1.8', Kotlin19 = 'kotlin-1.9', Kotlin20 = 'kotlin-2.0', + Kotlin23 = 'kotlin-2.3', Cpp17 = 'cpp-17', Cpp20 = 'cpp-20', Bun10 = 'bun-1.0', Bun11 = 'bun-1.1', + Bun12 = 'bun-1.2', + Bun13 = 'bun-1.3', Go123 = 'go-1.23', + Go124 = 'go-1.24', + Go125 = 'go-1.25', + Go126 = 'go-1.26', Static1 = 'static-1', Flutter324 = 'flutter-3.24', Flutter327 = 'flutter-3.27', diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index 3b6f9f3b..fda3bab3 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -6,24 +6,35 @@ export enum Runtime { Node200 = 'node-20.0', Node210 = 'node-21.0', Node22 = 'node-22', + Node23 = 'node-23', + Node24 = 'node-24', + Node25 = 'node-25', Php80 = 'php-8.0', Php81 = 'php-8.1', Php82 = 'php-8.2', Php83 = 'php-8.3', + Php84 = 'php-8.4', Ruby30 = 'ruby-3.0', Ruby31 = 'ruby-3.1', Ruby32 = 'ruby-3.2', Ruby33 = 'ruby-3.3', + Ruby34 = 'ruby-3.4', + Ruby40 = 'ruby-4.0', Python38 = 'python-3.8', Python39 = 'python-3.9', Python310 = 'python-3.10', Python311 = 'python-3.11', Python312 = 'python-3.12', + Python313 = 'python-3.13', + Python314 = 'python-3.14', Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', + Pythonml313 = 'python-ml-3.13', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', + Deno25 = 'deno-2.5', + Deno26 = 'deno-2.6', Dart215 = 'dart-2.15', Dart216 = 'dart-2.16', Dart217 = 'dart-2.17', @@ -39,25 +50,34 @@ export enum Runtime { Dotnet60 = 'dotnet-6.0', Dotnet70 = 'dotnet-7.0', Dotnet80 = 'dotnet-8.0', + Dotnet10 = 'dotnet-10', Java80 = 'java-8.0', Java110 = 'java-11.0', Java170 = 'java-17.0', Java180 = 'java-18.0', Java210 = 'java-21.0', Java22 = 'java-22', + Java25 = 'java-25', Swift55 = 'swift-5.5', Swift58 = 'swift-5.8', Swift59 = 'swift-5.9', Swift510 = 'swift-5.10', + Swift62 = 'swift-6.2', Kotlin16 = 'kotlin-1.6', Kotlin18 = 'kotlin-1.8', Kotlin19 = 'kotlin-1.9', Kotlin20 = 'kotlin-2.0', + Kotlin23 = 'kotlin-2.3', Cpp17 = 'cpp-17', Cpp20 = 'cpp-20', Bun10 = 'bun-1.0', Bun11 = 'bun-1.1', + Bun12 = 'bun-1.2', + Bun13 = 'bun-1.3', Go123 = 'go-1.23', + Go124 = 'go-1.24', + Go125 = 'go-1.25', + Go126 = 'go-1.26', Static1 = 'static-1', Flutter324 = 'flutter-3.24', Flutter327 = 'flutter-3.27', diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 4ac98a12..083114b2 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -47,6 +47,8 @@ export enum Scopes { TargetsWrite = 'targets.write', RulesRead = 'rules.read', RulesWrite = 'rules.write', + SchedulesRead = 'schedules.read', + SchedulesWrite = 'schedules.write', MigrationsRead = 'migrations.read', MigrationsWrite = 'migrations.write', VcsRead = 'vcs.read', @@ -62,4 +64,5 @@ export enum Scopes { RestorationsWrite = 'restorations.write', DomainsRead = 'domains.read', DomainsWrite = 'domains.write', + EventsRead = 'events.read', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c356102b..2e7ab5fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; +export { Activities } from './services/activities'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; export { Databases } from './services/databases'; diff --git a/src/models.ts b/src/models.ts index 8f9521eb..e688dcc9 100644 --- a/src/models.ts +++ b/src/models.ts @@ -611,7 +611,7 @@ export namespace Models { /** * Collection attributes. */ - attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeString)[]; + attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; /** * Collection indexes. */ @@ -637,7 +637,7 @@ export namespace Models { /** * List of attributes. */ - attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeString)[]; + attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; } /** @@ -1298,6 +1298,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -1340,6 +1344,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -1382,6 +1390,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -1424,6 +1436,10 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2152,6 +2168,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2194,6 +2214,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2236,6 +2260,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -2278,6 +2306,10 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; } /** @@ -4345,6 +4377,140 @@ export namespace Models { expired: boolean; } + /** + * ActivityEvent + */ + export type ActivityEvent = { + /** + * Event ID. + */ + $id: string; + /** + * User type. + */ + userType: string; + /** + * User ID. + */ + userId: string; + /** + * User Email. + */ + userEmail: string; + /** + * User Name. + */ + userName: string; + /** + * Resource parent. + */ + resourceParent: string; + /** + * Resource type. + */ + resourceType: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource. + */ + resource: string; + /** + * Event name. + */ + event: string; + /** + * User agent. + */ + userAgent: string; + /** + * IP address. + */ + ip: string; + /** + * API mode when event triggered. + */ + mode: string; + /** + * Location. + */ + country: string; + /** + * Log creation date in ISO 8601 format. + */ + time: string; + /** + * Project ID. + */ + projectId: string; + /** + * Team ID. + */ + teamId: string; + /** + * Hostname. + */ + hostname: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + /** * Archive */ @@ -4499,6 +4665,20 @@ export namespace Models { options: string; } + /** + * Activity event list + */ + export type ActivityEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: ActivityEvent[]; + } + /** * Backup archive list */ diff --git a/src/query.ts b/src/query.ts index 66ddc87c..fdd9f407 100644 --- a/src/query.ts +++ b/src/query.ts @@ -272,7 +272,9 @@ export class Query { /** * Filter resources where attribute contains the specified value. + * For string attributes, checks if the string contains the substring. * + * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead. * @param {string} attribute * @param {string | string[]} value * @returns {string} @@ -280,6 +282,30 @@ export class Query { static contains = (attribute: string, value: string | any[]): string => new Query("contains", attribute, value).toString(); + /** + * Filter resources where attribute contains ANY of the specified values. + * For array and relationship attributes, matches documents where the attribute + * contains at least one of the given values. + * + * @param {string} attribute + * @param {any[]} value + * @returns {string} + */ + static containsAny = (attribute: string, value: any[]): string => + new Query("containsAny", attribute, value).toString(); + + /** + * Filter resources where attribute contains ALL of the specified values. + * For array and relationship attributes, matches documents where the attribute + * contains every one of the given values. + * + * @param {string} attribute + * @param {any[]} value + * @returns {string} + */ + static containsAll = (attribute: string, value: any[]): string => + new Query("containsAll", attribute, value).toString(); + /** * Filter resources where attribute does not contain the specified value. * diff --git a/src/services/activities.ts b/src/services/activities.ts new file mode 100644 index 00000000..23071821 --- /dev/null +++ b/src/services/activities.ts @@ -0,0 +1,115 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Activities { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all events for selected filters. + * + * @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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise} + */ + listEvents(params?: { queries?: string }): Promise; + /** + * List all events for selected filters. + * + * @param {string} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEvents(queries?: string): Promise; + listEvents( + paramsOrFirst?: { queries?: string } | string + ): Promise { + let params: { queries?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string }; + } else { + params = { + queries: paramsOrFirst as string + }; + } + + const queries = params.queries; + + + const apiPath = '/activities/events'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get event by ID. + * + * + * @param {string} params.eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getEvent(params: { eventId: string }): Promise; + /** + * Get event by ID. + * + * + * @param {string} eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getEvent(eventId: string): Promise; + getEvent( + paramsOrFirst: { eventId: string } | string + ): Promise { + let params: { eventId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { eventId: string }; + } else { + params = { + eventId: paramsOrFirst as string + }; + } + + const eventId = params.eventId; + + if (typeof eventId === 'undefined') { + throw new AppwriteException('Missing required parameter: "eventId"'); + } + + const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/databases.ts b/src/services/databases.ts index d739a193..f7d5c32d 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2747,10 +2747,11 @@ export class Databases { * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a longtext attribute. * @@ -2761,19 +2762,20 @@ export class Databases { * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2781,7 +2783,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2791,6 +2794,7 @@ export class Databases { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2819,6 +2823,9 @@ export class Databases { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2939,10 +2946,11 @@ export class Databases { * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a mediumtext attribute. * @@ -2953,19 +2961,20 @@ export class Databases { * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2973,7 +2982,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2983,6 +2993,7 @@ export class Databases { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3011,6 +3022,9 @@ export class Databases { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -3820,10 +3834,11 @@ export class Databases { * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a text attribute. * @@ -3834,19 +3849,20 @@ export class Databases { * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -3854,7 +3870,8 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -3864,6 +3881,7 @@ export class Databases { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3892,6 +3910,9 @@ export class Databases { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4207,10 +4228,11 @@ export class Databases { * @param {boolean} params.required - Is attribute required? * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }): Promise; + createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a varchar attribute. * @@ -4222,19 +4244,20 @@ export class Databases { * @param {boolean} required - Is attribute required? * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createVarcharAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -4243,7 +4266,8 @@ export class Databases { size: rest[2] as number, required: rest[3] as boolean, xdefault: rest[4] as string, - array: rest[5] as boolean + array: rest[5] as boolean, + encrypt: rest[6] as boolean }; } @@ -4254,6 +4278,7 @@ export class Databases { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4288,6 +4313,9 @@ export class Databases { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index d40301b4..398450ff 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -2718,10 +2718,11 @@ export class TablesDB { * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a longtext column. * @@ -2732,19 +2733,20 @@ export class TablesDB { * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2752,7 +2754,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2762,6 +2765,7 @@ export class TablesDB { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2790,6 +2794,9 @@ export class TablesDB { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2910,10 +2917,11 @@ export class TablesDB { * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a mediumtext column. * @@ -2924,19 +2932,20 @@ export class TablesDB { * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -2944,7 +2953,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -2954,6 +2964,7 @@ export class TablesDB { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -2982,6 +2993,9 @@ export class TablesDB { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -3786,10 +3800,11 @@ export class TablesDB { * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a text column. * @@ -3800,19 +3815,20 @@ export class TablesDB { * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise; + createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -3820,7 +3836,8 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] as boolean + array: rest[4] as boolean, + encrypt: rest[5] as boolean }; } @@ -3830,6 +3847,7 @@ export class TablesDB { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3858,6 +3876,9 @@ export class TablesDB { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4171,10 +4192,11 @@ export class TablesDB { * @param {boolean} params.required - Is column required? * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} */ - createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }): Promise; + createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** * Create a varchar column. * @@ -4186,19 +4208,20 @@ export class TablesDB { * @param {boolean} required - Is column required? * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise; + createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise; createVarcharColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; } else { params = { databaseId: paramsOrFirst as string, @@ -4207,7 +4230,8 @@ export class TablesDB { size: rest[2] as number, required: rest[3] as boolean, xdefault: rest[4] as string, - array: rest[5] as boolean + array: rest[5] as boolean, + encrypt: rest[6] as boolean }; } @@ -4218,6 +4242,7 @@ export class TablesDB { const required = params.required; const xdefault = params.xdefault; const array = params.array; + const encrypt = params.encrypt; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4252,6 +4277,9 @@ export class TablesDB { if (typeof array !== 'undefined') { payload['array'] = array; } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = {