Skip to content

Commit eab8856

Browse files
authored
Merge pull request #97 from appwrite/dev
fix: minor bugs
2 parents 0fa902a + d8d8e3c commit eab8856

File tree

10 files changed

+68
-56
lines changed

10 files changed

+68
-56
lines changed

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
# Setup Node.js environment
16+
- name: Use Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
22+
# Determine release tag based on the tag name
23+
- name: Determine release tag
24+
id: release_tag
25+
run: |
26+
if [[ "${{ github.ref }}" == *"-rc"* ]] || [[ "${{ github.ref }}" == *"-RC"* ]]; then
27+
echo "tag=next" >> "$GITHUB_OUTPUT"
28+
else
29+
echo "tag=latest" >> "$GITHUB_OUTPUT"
30+
fi
31+
32+
# Install dependencies (if any) and build your project (if necessary)
33+
- name: Install dependencies and build
34+
run: |
35+
npm install
36+
npm run build
37+
38+
# Publish to NPM with the appropriate tag
39+
- name: Publish
40+
run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Web SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-web.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.5.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![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";
3333
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:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/appwrite@14.0.1"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/appwrite@15.0.0"></script>
3737
```
3838

3939

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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",
5-
"version": "14.0.1",
5+
"version": "15.0.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {
@@ -32,10 +32,6 @@
3232
"tslib": "2.4.0",
3333
"typescript": "4.7.2"
3434
},
35-
"dependencies": {
36-
"cross-fetch": "3.1.5",
37-
"isomorphic-form-data": "2.0.0"
38-
},
3935
"jsdelivr": "dist/iife/sdk.js",
4036
"unpkg": "dist/iife/sdk.js"
4137
}

rollup.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import pkg from "./package.json";
22
import typescript from "@rollup/plugin-typescript";
33

44
export default {
5-
external: Object.keys(pkg.dependencies),
5+
external: Object.keys(pkg.dependencies ?? {}),
66
input: "src/index.ts",
77
plugins: [typescript()],
88
output: [
@@ -22,10 +22,6 @@ export default {
2222
file: pkg.jsdelivr,
2323
name: "Appwrite",
2424
extend: true,
25-
globals: {
26-
"cross-fetch": "window",
27-
"FormData": "FormData",
28-
},
2925
},
3026
],
3127
};

src/client.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'isomorphic-form-data';
2-
import { fetch } from 'cross-fetch';
31
import { Models } from './models';
42
import { Service } from './service';
53

@@ -103,7 +101,7 @@ class Client {
103101
'x-sdk-name': 'Web',
104102
'x-sdk-platform': 'client',
105103
'x-sdk-language': 'web',
106-
'x-sdk-version': '14.0.1',
104+
'x-sdk-version': '15.0.0',
107105
'X-Appwrite-Response-Format': '1.5.0',
108106
};
109107

@@ -391,7 +389,10 @@ class Client {
391389
};
392390

393391
if (typeof window !== 'undefined' && window.localStorage) {
394-
headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback') ?? '';
392+
const cookieFallback = window.localStorage.getItem('cookieFallback');
393+
if (cookieFallback) {
394+
headers['X-Fallback-Cookies'] = cookieFallback;
395+
}
395396
}
396397

397398
if (method === 'GET') {

src/enums/credit-card.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export enum CreditCard {
22
AmericanExpress = 'amex',
33
Argencard = 'argencard',
44
Cabal = 'cabal',
5-
Consosud = 'censosud',
5+
Cencosud = 'cencosud',
66
DinersClub = 'diners',
77
Discover = 'discover',
88
Elo = 'elo',

src/enums/flag.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export enum Flag {
140140
Palau = 'pw',
141141
PapuaNewGuinea = 'pg',
142142
Poland = 'pl',
143+
FrenchPolynesia = 'pf',
143144
NorthKorea = 'kp',
144145
Portugal = 'pt',
145146
Paraguay = 'py',

src/models.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,10 @@ export namespace Models {
502502
* Session creation date in ISO 8601 format.
503503
*/
504504
$createdAt: string;
505+
/**
506+
* Session update date in ISO 8601 format.
507+
*/
508+
$updatedAt: string;
505509
/**
506510
* User ID.
507511
*/
@@ -1094,17 +1098,21 @@ export namespace Models {
10941098
*/
10951099
export type MfaFactors = {
10961100
/**
1097-
* TOTP
1101+
* Can TOTP be used for MFA challenge for this account.
10981102
*/
10991103
totp: boolean;
11001104
/**
1101-
* Phone
1105+
* Can phone (SMS) be used for MFA challenge for this account.
11021106
*/
11031107
phone: boolean;
11041108
/**
1105-
* Email
1109+
* Can email be used for MFA challenge for this account.
11061110
*/
11071111
email: boolean;
1112+
/**
1113+
* Can recovery code be used for MFA challenge for this account.
1114+
*/
1115+
recoveryCode: boolean;
11081116
}
11091117
/**
11101118
* Subscriber

src/services/account.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export class Account extends Service {
254254
*
255255
* Add an authenticator app to be used as an MFA factor. Verify the
256256
* authenticator using the [verify
257-
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
257+
* authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
258258
* method.
259259
*
260260
* @param {AuthenticatorType} type
@@ -279,8 +279,8 @@ export class Account extends Service {
279279
* Verify Authenticator
280280
*
281281
* Verify an authenticator app after adding it using the [add
282-
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
283-
* method.
282+
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
283+
* method. add
284284
*
285285
* @param {AuthenticatorType} type
286286
* @param {string} otp
@@ -319,7 +319,7 @@ export class Account extends Service {
319319
* @throws {AppwriteException}
320320
* @returns {Promise}
321321
*/
322-
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
322+
async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
323323
if (typeof type === 'undefined') {
324324
throw new AppwriteException('Missing required parameter: "type"');
325325
}

0 commit comments

Comments
 (0)