diff --git a/LICENSE b/LICENSE index 5479bb8..c1602fc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/src/client.ts b/src/client.ts index a0618c9..e92ddea 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,11 +11,11 @@ export class Client { endpoint: string = 'https://cloud.appwrite.io/v1'; headers: Payload = { 'content-type': '', - 'user-agent' : `AppwriteDenoSDK/12.2.0 (${Deno.build.os}; ${Deno.build.arch})`, + 'user-agent' : `AppwriteDenoSDK/13.0.0 (${Deno.build.os}; ${Deno.build.arch})`, 'x-sdk-name': 'Deno', 'x-sdk-platform': 'server', 'x-sdk-language': 'deno', - 'x-sdk-version': '12.2.0', + 'x-sdk-version': '13.0.0', 'X-Appwrite-Response-Format':'1.6.0', }; diff --git a/src/enums/image-format.ts b/src/enums/image-format.ts index 8599e30..bcbe3e9 100644 --- a/src/enums/image-format.ts +++ b/src/enums/image-format.ts @@ -4,5 +4,6 @@ export enum ImageFormat { Gif = 'gif', Png = 'png', Webp = 'webp', + Heic = 'heic', Avif = 'avif', } \ No newline at end of file diff --git a/src/services/account.ts b/src/services/account.ts index a86a8b9..ea409e2 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -425,7 +425,7 @@ export class Account extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async updateMfaChallenge(challengeId: string, otp: string): Promise { + async updateMfaChallenge(challengeId: string, otp: string): Promise { if (typeof challengeId === 'undefined') { throw new AppwriteException('Missing required parameter: "challengeId"'); } @@ -1529,4 +1529,4 @@ export class Account extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/avatars.ts b/src/services/avatars.ts index f47b654..649559f 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -366,4 +366,4 @@ export class Avatars extends Service { 'arraybuffer' ); } -} \ No newline at end of file +} diff --git a/src/services/databases.ts b/src/services/databases.ts index ebd1826..e85ff9a 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -2149,4 +2149,4 @@ export class Databases extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/functions.ts b/src/services/functions.ts index 5533976..a7354ae 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -469,7 +469,7 @@ export class Functions extends Service { } const size = code.size; - + const apiHeaders: { [header: string]: string } = { 'content-type': 'multipart/form-data', }; @@ -501,7 +501,7 @@ export class Functions extends Service { } let uploadableChunkTrimmed: Uint8Array; - + if(currentPosition + 1 >= Client.CHUNK_SIZE) { uploadableChunkTrimmed = uploadableChunk; } else { @@ -658,6 +658,12 @@ export class Functions extends Service { /** * Rebuild deployment * + * Create a new build for an existing function deployment. This endpoint + * allows you to rebuild a deployment with the updated function configuration, + * including its entrypoint and build commands if they have been modified The + * build process will be queued and executed asynchronously. The original + * deployment's code will be preserved and used for the new build. + * * @param {string} functionId * @param {string} deploymentId * @param {string} buildId @@ -692,6 +698,12 @@ export class Functions extends Service { /** * Cancel deployment * + * Cancel an ongoing function deployment build. If the build is already in + * progress, it will be stopped and marked as canceled. If the build hasn't + * started yet, it will be marked as canceled without executing. You cannot + * cancel builds that have already completed (status 'ready') or failed. The + * response includes the final build status and details. + * * @param {string} functionId * @param {string} deploymentId * @throws {AppwriteException} @@ -1088,4 +1100,4 @@ export class Functions extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 3f250e6..80562db 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -83,4 +83,4 @@ export class Graphql extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/health.ts b/src/services/health.ts index 557f3d1..2a89e7f 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -630,4 +630,4 @@ export class Health extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/locale.ts b/src/services/locale.ts index c73bd8e..d362aa1 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -210,4 +210,4 @@ export class Locale extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 3472d45..a5c4997 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -472,7 +472,7 @@ export class Messaging extends Service { /** * Update SMS * - * Update an email message by its unique ID. + * Update an SMS message by its unique ID. * * * @param {string} messageId @@ -2260,4 +2260,4 @@ export class Messaging extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/storage.ts b/src/services/storage.ts index dad613d..7b4668f 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -343,7 +343,7 @@ export class Storage extends Service { } const size = file.size; - + const apiHeaders: { [header: string]: string } = { 'content-type': 'multipart/form-data', }; @@ -353,16 +353,14 @@ export class Storage extends Service { let chunksUploaded = 0; - if(fileId != 'unique()') { - try { - response = await this.client.call( - 'get', - apiPath + '/' + fileId, - apiHeaders - ); - chunksUploaded = response.chunksUploaded; - } catch(e) { - } + try { + response = await this.client.call( + 'get', + apiPath + '/' + fileId, + apiHeaders + ); + chunksUploaded = response.chunksUploaded; + } catch(e) { } let currentChunk = 1; @@ -386,7 +384,7 @@ export class Storage extends Service { } let uploadableChunkTrimmed: Uint8Array; - + if(currentPosition + 1 >= Client.CHUNK_SIZE) { uploadableChunkTrimmed = uploadableChunk; } else { @@ -708,4 +706,4 @@ export class Storage extends Service { 'arraybuffer' ); } -} \ No newline at end of file +} diff --git a/src/services/teams.ts b/src/services/teams.ts index 2775360..f939671 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -533,4 +533,4 @@ export class Teams extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/src/services/users.ts b/src/services/users.ts index 9ccabed..3911bb4 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -877,7 +877,7 @@ export class Users extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise> { + async deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1647,4 +1647,4 @@ export class Users extends Service { 'json' ); } -} \ No newline at end of file +} diff --git a/test/services/account.test.ts b/test/services/account.test.ts index 58664e6..f558689 100644 --- a/test/services/account.test.ts +++ b/test/services/account.test.ts @@ -274,17 +274,45 @@ describe('Account service', () => { test('test method updateMfaChallenge()', async () => { - const data = ''; + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(new Response(data))) + const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(Response.json(data))); const response = await account.updateMfaChallenge( '', '', ); - const text = await response.text(); - assertEquals(text, data); + assertEquals(response, data); stubbedFetch.restore(); }); diff --git a/test/services/users.test.ts b/test/services/users.test.ts index af1a605..374732e 100644 --- a/test/services/users.test.ts +++ b/test/services/users.test.ts @@ -505,32 +505,17 @@ describe('Users service', () => { test('test method deleteMfaAuthenticator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = ''; - const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(Response.json(data))); + const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(new Response(data))) const response = await users.deleteMfaAuthenticator( '', 'totp', ); - assertEquals(response, data); + const text = await response.text(); + assertEquals(text, data); stubbedFetch.restore(); });