From 8adfae572304f9c95e0c68b0af64d7bb9245e1d8 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 17 May 2024 04:20:27 +0000 Subject: [PATCH 1/4] fix: minor bugs --- README.md | 2 +- package.json | 4 ---- rollup.config.js | 6 +----- src/client.ts | 7 ++++--- src/enums/credit-card.ts | 2 +- src/enums/flag.ts | 1 + src/models.ts | 14 +++++++++++--- src/services/account.ts | 8 ++++---- 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 28273f5..970db6f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Web SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.5.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![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) diff --git a/package.json b/package.json index 9929e7d..00f26f7 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,6 @@ "tslib": "2.4.0", "typescript": "4.7.2" }, - "dependencies": { - "cross-fetch": "3.1.5", - "isomorphic-form-data": "2.0.0" - }, "jsdelivr": "dist/iife/sdk.js", "unpkg": "dist/iife/sdk.js" } diff --git a/rollup.config.js b/rollup.config.js index a9c3354..cae7a89 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,7 +2,7 @@ import pkg from "./package.json"; import typescript from "@rollup/plugin-typescript"; export default { - external: Object.keys(pkg.dependencies), + external: Object.keys(pkg.dependencies ?? {}), input: "src/index.ts", plugins: [typescript()], output: [ @@ -22,10 +22,6 @@ export default { file: pkg.jsdelivr, name: "Appwrite", extend: true, - globals: { - "cross-fetch": "window", - "FormData": "FormData", - }, }, ], }; diff --git a/src/client.ts b/src/client.ts index 5c1df24..05ca8d2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,5 +1,3 @@ -import 'isomorphic-form-data'; -import { fetch } from 'cross-fetch'; import { Models } from './models'; import { Service } from './service'; @@ -391,7 +389,10 @@ class Client { }; if (typeof window !== 'undefined' && window.localStorage) { - headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback') ?? ''; + const cookieFallback = window.localStorage.getItem('cookieFallback'); + if (cookieFallback) { + headers['X-Fallback-Cookies'] = cookieFallback; + } } if (method === 'GET') { diff --git a/src/enums/credit-card.ts b/src/enums/credit-card.ts index ae917a8..daf43c7 100644 --- a/src/enums/credit-card.ts +++ b/src/enums/credit-card.ts @@ -2,7 +2,7 @@ export enum CreditCard { AmericanExpress = 'amex', Argencard = 'argencard', Cabal = 'cabal', - Consosud = 'censosud', + Cencosud = 'cencosud', DinersClub = 'diners', Discover = 'discover', Elo = 'elo', diff --git a/src/enums/flag.ts b/src/enums/flag.ts index 07416a4..7e1d878 100644 --- a/src/enums/flag.ts +++ b/src/enums/flag.ts @@ -140,6 +140,7 @@ export enum Flag { Palau = 'pw', PapuaNewGuinea = 'pg', Poland = 'pl', + FrenchPolynesia = 'pf', NorthKorea = 'kp', Portugal = 'pt', Paraguay = 'py', diff --git a/src/models.ts b/src/models.ts index 0e907cb..cdbd36f 100644 --- a/src/models.ts +++ b/src/models.ts @@ -502,6 +502,10 @@ export namespace Models { * Session creation date in ISO 8601 format. */ $createdAt: string; + /** + * Session update date in ISO 8601 format. + */ + $updatedAt: string; /** * User ID. */ @@ -1094,17 +1098,21 @@ export namespace Models { */ export type MfaFactors = { /** - * TOTP + * Can TOTP be used for MFA challenge for this account. */ totp: boolean; /** - * Phone + * Can phone (SMS) be used for MFA challenge for this account. */ phone: boolean; /** - * Email + * Can email be used for MFA challenge for this account. */ email: boolean; + /** + * Can recovery code be used for MFA challenge for this account. + */ + recoveryCode: boolean; } /** * Subscriber diff --git a/src/services/account.ts b/src/services/account.ts index 023d178..7e53446 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -254,7 +254,7 @@ export class Account extends Service { * * Add an authenticator app to be used as an MFA factor. Verify the * authenticator using the [verify - * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) + * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) * method. * * @param {AuthenticatorType} type @@ -279,8 +279,8 @@ export class Account extends Service { * Verify Authenticator * * Verify an authenticator app after adding it using the [add - * authenticator](/docs/references/cloud/client-web/account#addAuthenticator) - * method. + * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) + * method. add * * @param {AuthenticatorType} type * @param {string} otp @@ -319,7 +319,7 @@ export class Account extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { + async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } From a5683f1aff1a21d6566fea73926b39613820c61e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 20 May 2024 22:52:25 +0000 Subject: [PATCH 2/4] chore: bump version --- .github/workflows/publish.yml | 42 +++++++++++++++++++++++++++++++++++ README.md | 2 +- package.json | 2 +- src/client.ts | 2 +- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a781772 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +name: Publish to NPM + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Setup Node.js environment + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + + # Determine release tag based on the tag name + - name: Determine release tag + id: release_tag + run: | + if [[ "${{ github.ref }}" == *"-rc"* ]] || [[ "${{ github.ref }}" == *"-RC"* ]]; then + echo "tag=next" >> "$GITHUB_OUTPUT" + else + echo "tag=latest" >> "$GITHUB_OUTPUT" + fi + + # Install dependencies (if any) and build your project (if necessary) + - name: Install dependencies and build + run: | + npm install + npm run build + + # Publish to NPM with the appropriate tag + - name: Publish + run: npm publish --tag ${{ steps.release_tag.outputs.tag }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 970db6f..129ee32 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; 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/package.json b/package.json index 00f26f7..df31482 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "appwrite", "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": "14.0.1", + "version": "14.0.2", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 05ca8d2..91c6fbf 100644 --- a/src/client.ts +++ b/src/client.ts @@ -101,7 +101,7 @@ class Client { 'x-sdk-name': 'Web', 'x-sdk-platform': 'client', 'x-sdk-language': 'web', - 'x-sdk-version': '14.0.1', + 'x-sdk-version': '14.0.2', 'X-Appwrite-Response-Format': '1.5.0', }; From 27bbbd90dbd552e6c971386840bda1a5674924c6 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 23 May 2024 08:45:24 -0700 Subject: [PATCH 3/4] chore: remove travis.yml file as we will be using GitHub actions --- .travis.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 564159b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: node_js -node_js: - - "14.16" - -jobs: - include: - - stage: NPM RC Release - if: tag =~ /-(rc|RC)/ - node_js: "14.16" - script: - - npm install - - npm run build - - echo "Deploying RC to NPM..." - deploy: - provider: npm - email: $NPM_EMAIL - api_key: $NPM_API_KEY - tag: next - - stage: NPM Release - if: not tag =~ /-(rc|RC)/ - node_js: "14.16" - script: - - npm install - - npm run build - - echo "Deploying to NPM..." - deploy: - provider: npm - email: $NPM_EMAIL - api_key: $NPM_API_KEY - skip_cleanup: true - on: - tags: true \ No newline at end of file From d8d8e3c98e8966239e811e4a23d479ff2840a187 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 29 May 2024 15:50:54 +0000 Subject: [PATCH 4/4] chore: bump major version since there are breaking changes --- README.md | 4 ++-- package.json | 2 +- src/client.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 129ee32..0f2cadf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Web SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![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) @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; 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/package.json b/package.json index df31482..f124921 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "appwrite", "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": "14.0.2", + "version": "15.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 91c6fbf..fb91de0 100644 --- a/src/client.ts +++ b/src/client.ts @@ -101,7 +101,7 @@ class Client { 'x-sdk-name': 'Web', 'x-sdk-platform': 'client', 'x-sdk-language': 'web', - 'x-sdk-version': '14.0.2', + 'x-sdk-version': '15.0.0', 'X-Appwrite-Response-Format': '1.5.0', };