From 3a3a03031173e66a0402c23102cfe82a17404870 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 19 Feb 2024 17:08:49 +1300 Subject: [PATCH] Release candidate for 1.5.x --- README.md | 2 +- docs/examples/account/add-authenticator.md | 4 ++-- docs/examples/account/create2f-a-challenge.md | 4 ++-- docs/examples/account/delete-authenticator.md | 4 ++-- docs/examples/account/verify-authenticator.md | 4 ++-- docs/examples/users/delete-authenticator.md | 4 ++-- package.json | 2 +- src/client.ts | 4 ++-- .../{factor.ts => authentication-factor.ts} | 2 +- src/enums/authenticator-type.ts | 3 +++ src/enums/type.ts | 3 --- src/index.ts | 4 ++-- src/services/account.ts | 20 +++++++++---------- src/services/users.ts | 6 +++--- 14 files changed, 33 insertions(+), 33 deletions(-) rename src/enums/{factor.ts => authentication-factor.ts} (63%) create mode 100644 src/enums/authenticator-type.ts delete mode 100644 src/enums/type.ts diff --git a/README.md b/README.md index 1ae9999..2981c4b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/account/add-authenticator.md b/docs/examples/account/add-authenticator.md index bad3a33..8201ae2 100644 --- a/docs/examples/account/add-authenticator.md +++ b/docs/examples/account/add-authenticator.md @@ -1,4 +1,4 @@ -import { Client, , Account } from "@appwrite.io/console"; +import { Client, AuthenticatorType, Account } from "@appwrite.io/console"; const client = new Client(); @@ -9,7 +9,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const promise = account.addAuthenticator(.Totp); +const promise = account.addAuthenticator(AuthenticatorType.Totp); promise.then(function (response) { console.log(response); // Success diff --git a/docs/examples/account/create2f-a-challenge.md b/docs/examples/account/create2f-a-challenge.md index 91e7941..a54d0ce 100644 --- a/docs/examples/account/create2f-a-challenge.md +++ b/docs/examples/account/create2f-a-challenge.md @@ -1,4 +1,4 @@ -import { Client, , Account } from "@appwrite.io/console"; +import { Client, AuthenticationFactor, Account } from "@appwrite.io/console"; const client = new Client(); @@ -9,7 +9,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const promise = account.create2FAChallenge(.Totp); +const promise = account.create2FAChallenge(AuthenticationFactor.Totp); promise.then(function (response) { console.log(response); // Success diff --git a/docs/examples/account/delete-authenticator.md b/docs/examples/account/delete-authenticator.md index f9a147c..686f395 100644 --- a/docs/examples/account/delete-authenticator.md +++ b/docs/examples/account/delete-authenticator.md @@ -1,4 +1,4 @@ -import { Client, , Account } from "@appwrite.io/console"; +import { Client, AuthenticatorType, Account } from "@appwrite.io/console"; const client = new Client(); @@ -9,7 +9,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const promise = account.deleteAuthenticator(.Totp, '[OTP]'); +const promise = account.deleteAuthenticator(AuthenticatorType.Totp, '[OTP]'); promise.then(function (response) { console.log(response); // Success diff --git a/docs/examples/account/verify-authenticator.md b/docs/examples/account/verify-authenticator.md index 6814546..2ff3395 100644 --- a/docs/examples/account/verify-authenticator.md +++ b/docs/examples/account/verify-authenticator.md @@ -1,4 +1,4 @@ -import { Client, , Account } from "@appwrite.io/console"; +import { Client, AuthenticatorType, Account } from "@appwrite.io/console"; const client = new Client(); @@ -9,7 +9,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const promise = account.verifyAuthenticator(.Totp, '[OTP]'); +const promise = account.verifyAuthenticator(AuthenticatorType.Totp, '[OTP]'); promise.then(function (response) { console.log(response); // Success diff --git a/docs/examples/users/delete-authenticator.md b/docs/examples/users/delete-authenticator.md index 382e6fe..86db6cc 100644 --- a/docs/examples/users/delete-authenticator.md +++ b/docs/examples/users/delete-authenticator.md @@ -1,4 +1,4 @@ -import { Client, , Users } from "@appwrite.io/console"; +import { Client, AuthenticatorType, Users } from "@appwrite.io/console"; const client = new Client(); @@ -9,7 +9,7 @@ client .setProject('5df5acd0d48c2') // Your project ID ; -const promise = users.deleteAuthenticator('[USER_ID]', .Totp, '[OTP]'); +const promise = users.deleteAuthenticator('[USER_ID]', AuthenticatorType.Totp, '[OTP]'); promise.then(function (response) { console.log(response); // Success diff --git a/package.json b/package.json index 99499fb..a49942b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@appwrite.io/console", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "0.6.0-rc.10", + "version": "0.6.0-rc.11", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index b32b436..4183945 100644 --- a/src/client.ts +++ b/src/client.ts @@ -104,8 +104,8 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '0.6.0-rc.10', - 'X-Appwrite-Response-Format': '1.4.0', + 'x-sdk-version': '0.6.0-rc.11', + 'X-Appwrite-Response-Format': '1.5.0', }; /** diff --git a/src/enums/factor.ts b/src/enums/authentication-factor.ts similarity index 63% rename from src/enums/factor.ts rename to src/enums/authentication-factor.ts index 06cd8ac..7ea760d 100644 --- a/src/enums/factor.ts +++ b/src/enums/authentication-factor.ts @@ -1,4 +1,4 @@ -export enum Factor { +export enum AuthenticationFactor { Totp = 'totp', Phone = 'phone', Email = 'email', diff --git a/src/enums/authenticator-type.ts b/src/enums/authenticator-type.ts new file mode 100644 index 0000000..34db0cc --- /dev/null +++ b/src/enums/authenticator-type.ts @@ -0,0 +1,3 @@ +export enum AuthenticatorType { + Totp = 'totp', +} \ No newline at end of file diff --git a/src/enums/type.ts b/src/enums/type.ts deleted file mode 100644 index aa92979..0000000 --- a/src/enums/type.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum Type { - Totp = 'totp', -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c32a258..057a415 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,8 +22,8 @@ export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; export { Role } from './role'; export { ID } from './id'; -export { Factor } from './enums/factor'; -export { Type } from './enums/type'; +export { AuthenticationFactor } from './enums/authentication-factor'; +export { AuthenticatorType } from './enums/authenticator-type'; export { OAuthProvider } from './enums/o-auth-provider'; export { Browser } from './enums/browser'; export { CreditCard } from './enums/credit-card'; diff --git a/src/services/account.ts b/src/services/account.ts index f5a927b..6a70ddc 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -3,8 +3,8 @@ import { AppwriteException, Client } from '../client'; import type { Models } from '../models'; import type { UploadProgress, Payload } from '../client'; import { Query } from '../query'; -import { Factor } from '../enums/factor'; -import { Type } from '../enums/type'; +import { AuthenticationFactor } from '../enums/authentication-factor'; +import { AuthenticatorType } from '../enums/authenticator-type'; import { OAuthProvider } from '../enums/o-auth-provider'; export class Account extends Service { @@ -271,11 +271,11 @@ export class Account extends Service { * Create 2FA Challenge * * - * @param {Factor} factor + * @param {AuthenticationFactor} factor * @throws {AppwriteException} * @returns {Promise} */ - async create2FAChallenge(factor: Factor): Promise { + async create2FAChallenge(factor: AuthenticationFactor): Promise { if (typeof factor === 'undefined') { throw new AppwriteException('Missing required parameter: "factor"'); } @@ -349,11 +349,11 @@ export class Account extends Service { * Add Authenticator * * - * @param {Type} type + * @param {AuthenticatorType} type * @throws {AppwriteException} * @returns {Promise} */ - async addAuthenticator(type: Type): Promise { + async addAuthenticator(type: AuthenticatorType): Promise { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -371,12 +371,12 @@ export class Account extends Service { * Verify Authenticator * * - * @param {Type} type + * @param {AuthenticatorType} type * @param {string} otp * @throws {AppwriteException} * @returns {Promise} */ - async verifyAuthenticator(type: Type, otp: string): Promise> { + async verifyAuthenticator(type: AuthenticatorType, otp: string): Promise> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -402,12 +402,12 @@ export class Account extends Service { * Delete Authenticator * * - * @param {Type} type + * @param {AuthenticatorType} type * @param {string} otp * @throws {AppwriteException} * @returns {Promise} */ - async deleteAuthenticator(type: Type, otp: string): Promise> { + async deleteAuthenticator(type: AuthenticatorType, otp: string): Promise> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } diff --git a/src/services/users.ts b/src/services/users.ts index a04fb2f..79cfcc6 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -5,7 +5,7 @@ import type { UploadProgress, Payload } from '../client'; import { Query } from '../query'; import { PasswordHash } from '../enums/password-hash'; import { UserUsageRange } from '../enums/user-usage-range'; -import { Type } from '../enums/type'; +import { AuthenticatorType } from '../enums/authenticator-type'; import { MessagingProviderType } from '../enums/messaging-provider-type'; export class Users extends Service { @@ -842,12 +842,12 @@ export class Users extends Service { * * * @param {string} userId - * @param {Type} type + * @param {AuthenticatorType} type * @param {string} otp * @throws {AppwriteException} * @returns {Promise} */ - async deleteAuthenticator(userId: string, type: Type, otp: string): Promise> { + async deleteAuthenticator(userId: string, type: AuthenticatorType, otp: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); }