Skip to content

Commit 8113032

Browse files
authored
Merge pull request #88 from appwrite/dev
fix: minor bugs
2 parents 0dc59ba + 5584303 commit 8113032

18 files changed

+116
-82
lines changed

.github/workflows/publish.yml

+42
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

-35
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Node.js SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-node.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.6-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)

docs/examples/messaging/create-msg91provider.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const messaging = new sdk.Messaging(client);
1010
const result = await messaging.createMsg91Provider(
1111
'<PROVIDER_ID>', // providerId
1212
'<NAME>', // name
13-
'+12065550100', // from (optional)
13+
'<TEMPLATE_ID>', // templateId (optional)
1414
'<SENDER_ID>', // senderId (optional)
1515
'<AUTH_KEY>', // authKey (optional)
1616
false // enabled (optional)

docs/examples/messaging/update-email.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ const result = await messaging.updateEmail(
1818
false, // html (optional)
1919
[], // cc (optional)
2020
[], // bcc (optional)
21-
'' // scheduledAt (optional)
21+
'', // scheduledAt (optional)
22+
[] // attachments (optional)
2223
);

docs/examples/messaging/update-msg91provider.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const result = await messaging.updateMsg91Provider(
1111
'<PROVIDER_ID>', // providerId
1212
'<NAME>', // name (optional)
1313
false, // enabled (optional)
14+
'<TEMPLATE_ID>', // templateId (optional)
1415
'<SENDER_ID>', // senderId (optional)
15-
'<AUTH_KEY>', // authKey (optional)
16-
'<FROM>' // from (optional)
16+
'<AUTH_KEY>' // authKey (optional)
1717
);

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-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": "12.1.0-rc.4",
5+
"version": "13.0.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/index.js",
88
"type": "commonjs",
@@ -31,6 +31,9 @@
3131
}
3232
}
3333
},
34+
"files": [
35+
"dist"
36+
],
3437
"module": "dist/index.mjs",
3538
"types": "dist/index.d.ts",
3639
"repository": {
@@ -40,6 +43,7 @@
4043
"devDependencies": {
4144
"@types/node": "20.11.25",
4245
"tsup": "7.2.0",
46+
"esbuild-plugin-file-path-extensions": "^2.0.0",
4347
"tslib": "2.6.2",
4448
"typescript": "5.4.2"
4549
},

src/client.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AppwriteException extends Error {
3333
}
3434

3535
function getUserAgent() {
36-
let ua = 'AppwriteNodeJSSDK/12.1.0-rc.4';
36+
let ua = 'AppwriteNodeJSSDK/13.0.0';
3737

3838
// `process` is a global in Node.js, but not fully available in all runtimes.
3939
const platform: string[] = [];
@@ -82,7 +82,7 @@ class Client {
8282
'x-sdk-name': 'Node.js',
8383
'x-sdk-platform': 'server',
8484
'x-sdk-language': 'nodejs',
85-
'x-sdk-version': '12.1.0-rc.4',
85+
'x-sdk-version': '13.0.0',
8686
'user-agent' : getUserAgent(),
8787
'X-Appwrite-Response-Format': '1.5.0',
8888
};

src/enums/credit-card.ts

+1-1
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

+1
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/enums/name.ts

-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ export enum Name {
1111
V1builds = 'v1-builds',
1212
V1messaging = 'v1-messaging',
1313
V1migrations = 'v1-migrations',
14-
Hamsterv1 = 'hamsterv1',
1514
}

src/enums/runtime.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export enum Runtime {
1818
Python310 = 'python-3.10',
1919
Python311 = 'python-3.11',
2020
Python312 = 'python-3.12',
21+
Pythonml311 = 'python-ml-3.11',
2122
Deno140 = 'deno-1.40',
2223
Dart215 = 'dart-2.15',
2324
Dart216 = 'dart-2.16',

src/models.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,10 @@ export namespace Models {
11901190
* Session creation date in ISO 8601 format.
11911191
*/
11921192
$createdAt: string;
1193+
/**
1194+
* Session update date in ISO 8601 format.
1195+
*/
1196+
$updatedAt: string;
11931197
/**
11941198
* User ID.
11951199
*/
@@ -2176,17 +2180,21 @@ export namespace Models {
21762180
*/
21772181
export type MfaFactors = {
21782182
/**
2179-
* TOTP
2183+
* Can TOTP be used for MFA challenge for this account.
21802184
*/
21812185
totp: boolean;
21822186
/**
2183-
* Phone
2187+
* Can phone (SMS) be used for MFA challenge for this account.
21842188
*/
21852189
phone: boolean;
21862190
/**
2187-
* Email
2191+
* Can email be used for MFA challenge for this account.
21882192
*/
21892193
email: boolean;
2194+
/**
2195+
* Can recovery code be used for MFA challenge for this account.
2196+
*/
2197+
recoveryCode: boolean;
21902198
}
21912199
/**
21922200
* Provider

src/services/account.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
266266
/**
267267
* Add Authenticator
268268
*
269-
* 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) method.
269+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
270270
*
271271
* @param {AuthenticatorType} type
272272
* @throws {AppwriteException}
@@ -294,7 +294,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
294294
/**
295295
* Verify Authenticator
296296
*
297-
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.
297+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add
298298
*
299299
* @param {AuthenticatorType} type
300300
* @param {string} otp
@@ -334,9 +334,9 @@ This endpoint can also be used to convert an anonymous account to a normal one,
334334
* @param {AuthenticatorType} type
335335
* @param {string} otp
336336
* @throws {AppwriteException}
337-
* @returns {Promise<Models.User<Preferences>>}
337+
* @returns {Promise<{}>}
338338
*/
339-
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
339+
async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
340340
if (typeof type === 'undefined') {
341341
throw new AppwriteException('Missing required parameter: "type"');
342342
}

src/services/messaging.ts

+14-10
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ export class Messaging {
139139
* @param {string[]} cc
140140
* @param {string[]} bcc
141141
* @param {string} scheduledAt
142+
* @param {string[]} attachments
142143
* @throws {AppwriteException}
143144
* @returns {Promise<Models.Message>}
144145
*/
145-
async updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string): Promise<Models.Message> {
146+
async updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message> {
146147
if (typeof messageId === 'undefined') {
147148
throw new AppwriteException('Missing required parameter: "messageId"');
148149
}
@@ -178,6 +179,9 @@ export class Messaging {
178179
if (typeof scheduledAt !== 'undefined') {
179180
payload['scheduledAt'] = scheduledAt;
180181
}
182+
if (typeof attachments !== 'undefined') {
183+
payload['attachments'] = attachments;
184+
}
181185
const uri = new URL(this.client.config.endpoint + apiPath);
182186

183187
const apiHeaders: { [header: string]: string } = {
@@ -986,14 +990,14 @@ export class Messaging {
986990
*
987991
* @param {string} providerId
988992
* @param {string} name
989-
* @param {string} from
993+
* @param {string} templateId
990994
* @param {string} senderId
991995
* @param {string} authKey
992996
* @param {boolean} enabled
993997
* @throws {AppwriteException}
994998
* @returns {Promise<Models.Provider>}
995999
*/
996-
async createMsg91Provider(providerId: string, name: string, from?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider> {
1000+
async createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider> {
9971001
if (typeof providerId === 'undefined') {
9981002
throw new AppwriteException('Missing required parameter: "providerId"');
9991003
}
@@ -1008,8 +1012,8 @@ export class Messaging {
10081012
if (typeof name !== 'undefined') {
10091013
payload['name'] = name;
10101014
}
1011-
if (typeof from !== 'undefined') {
1012-
payload['from'] = from;
1015+
if (typeof templateId !== 'undefined') {
1016+
payload['templateId'] = templateId;
10131017
}
10141018
if (typeof senderId !== 'undefined') {
10151019
payload['senderId'] = senderId;
@@ -1041,13 +1045,13 @@ export class Messaging {
10411045
* @param {string} providerId
10421046
* @param {string} name
10431047
* @param {boolean} enabled
1048+
* @param {string} templateId
10441049
* @param {string} senderId
10451050
* @param {string} authKey
1046-
* @param {string} from
10471051
* @throws {AppwriteException}
10481052
* @returns {Promise<Models.Provider>}
10491053
*/
1050-
async updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, senderId?: string, authKey?: string, from?: string): Promise<Models.Provider> {
1054+
async updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider> {
10511055
if (typeof providerId === 'undefined') {
10521056
throw new AppwriteException('Missing required parameter: "providerId"');
10531057
}
@@ -1059,15 +1063,15 @@ export class Messaging {
10591063
if (typeof enabled !== 'undefined') {
10601064
payload['enabled'] = enabled;
10611065
}
1066+
if (typeof templateId !== 'undefined') {
1067+
payload['templateId'] = templateId;
1068+
}
10621069
if (typeof senderId !== 'undefined') {
10631070
payload['senderId'] = senderId;
10641071
}
10651072
if (typeof authKey !== 'undefined') {
10661073
payload['authKey'] = authKey;
10671074
}
1068-
if (typeof from !== 'undefined') {
1069-
payload['from'] = from;
1070-
}
10711075
const uri = new URL(this.client.config.endpoint + apiPath);
10721076

10731077
const apiHeaders: { [header: string]: string } = {

src/services/users.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,8 @@ If you want to generate a token for a custom authentication flow, use the [POST
14411441
/**
14421442
* Create token
14431443
*
1444-
* Returns a token with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) endpoint to complete the login process.
1444+
* Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
1445+
14451446
*
14461447
* @param {string} userId
14471448
* @param {number} length

tsup.config.js

-19
This file was deleted.

0 commit comments

Comments
 (0)