Skip to content

Commit

Permalink
Merge pull request #97 from appwrite/dev
Browse files Browse the repository at this point in the history
fix: minor bugs
  • Loading branch information
stnguyen90 authored May 29, 2024
2 parents 0fa902a + d8d8e3c commit eab8856
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 56 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.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)
Expand Down Expand Up @@ -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 <body> tag, but before you use any Appwrite services:

```html
<script src="https://cdn.jsdelivr.net/npm/appwrite@14.0.1"></script>
<script src="https://cdn.jsdelivr.net/npm/appwrite@15.0.0"></script>
```


Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "15.0.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down Expand Up @@ -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"
}
6 changes: 1 addition & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -22,10 +22,6 @@ export default {
file: pkg.jsdelivr,
name: "Appwrite",
extend: true,
globals: {
"cross-fetch": "window",
"FormData": "FormData",
},
},
],
};
9 changes: 5 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'isomorphic-form-data';
import { fetch } from 'cross-fetch';
import { Models } from './models';
import { Service } from './service';

Expand Down Expand Up @@ -103,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': '15.0.0',
'X-Appwrite-Response-Format': '1.5.0',
};

Expand Down Expand Up @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion src/enums/credit-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export enum CreditCard {
AmericanExpress = 'amex',
Argencard = 'argencard',
Cabal = 'cabal',
Consosud = 'censosud',
Cencosud = 'cencosud',
DinersClub = 'diners',
Discover = 'discover',
Elo = 'elo',
Expand Down
1 change: 1 addition & 0 deletions src/enums/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export enum Flag {
Palau = 'pw',
PapuaNewGuinea = 'pg',
Poland = 'pl',
FrenchPolynesia = 'pf',
NorthKorea = 'kp',
Portugal = 'pt',
Paraguay = 'py',
Expand Down
14 changes: 11 additions & 3 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -319,7 +319,7 @@ export class Account extends Service {
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
Expand Down

0 comments on commit eab8856

Please sign in to comment.