Skip to content

Commit 30da60a

Browse files
feat: support for 0.13.0
1 parent fadb5e8 commit 30da60a

5 files changed

Lines changed: 21 additions & 17 deletions

File tree

README.md

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

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-0.12.3-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-0.13.0-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)
88

9-
**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
9+
**This SDK is compatible with Appwrite server version 0.13.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
1010

1111
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1212

install.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,7 @@ printSuccess() {
9797
downloadBinary() {
9898
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
9999

100-
printf "${GREEN}🚦 Fetching latest version ... ${NC}\n"
101-
res=$(curl -L -s -H 'Accept: application/json' https://github.com/$GITHUB_REPOSITORY_NAME/releases/latest)
102-
if [[ "$res" == *"error"* ]]; then
103-
printf "${RED}❌ There was an error. Try again later.${NC} \n"
104-
exit 1
105-
fi
106-
printSuccess
107-
108-
GITHUB_LATEST_VERSION=$( echo $res | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
100+
GITHUB_LATEST_VERSION="0.15.0"
109101
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
110102
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
111103

lib/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Client {
1313
'content-type': '',
1414
'x-sdk-version': 'appwrite:cli:0.15.0',
1515
'User-Agent' : `AppwriteCLI/0.15.0 (${os.type()} ${os.version()}; ${os.arch()})`,
16-
'X-Appwrite-Response-Format' : '0.12.0',
16+
'X-Appwrite-Response-Format' : '0.13.0',
1717
};
1818
}
1919

@@ -151,7 +151,7 @@ class Client {
151151
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
152152
}
153153

154-
headers = Object.assign(this.headers, headers);
154+
headers = Object.assign({}, this.headers, headers);
155155

156156
let contentType = headers["content-type"].toLowerCase();
157157

lib/commands/functions.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ const functionsListDeployments = async ({ functionId, search, limit, offset, cur
261261
const functionsCreateDeployment = async ({ functionId, entrypoint, code, activate, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
262262
/* @param {string} functionId */
263263
/* @param {string} entrypoint */
264-
/* @param {File} code */
264+
/* @param {string} code */
265265
/* @param {boolean} activate */
266266

267267
let client = !sdk ? await sdkForProject() : sdk;
@@ -333,7 +333,13 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
333333
}
334334

335335
if (onProgress !== null) {
336-
onProgress(Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100);
336+
onProgress({
337+
$id: response['$id'],
338+
progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
339+
sizeUploaded: end+1,
340+
chunksTotal: response['chunksTotal'],
341+
chunksUploaded: response['chunksUploaded']
342+
});
337343
}
338344
}
339345
}

lib/commands/storage.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ const storageListFiles = async ({ bucketId, search, limit, offset, cursor, curso
269269
const storageCreateFile = async ({ bucketId, fileId, file, read, write, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
270270
/* @param {string} bucketId */
271271
/* @param {string} fileId */
272-
/* @param {File} file */
272+
/* @param {string} file */
273273
/* @param {string[]} read */
274274
/* @param {string[]} write */
275275

@@ -335,7 +335,13 @@ const storageCreateFile = async ({ bucketId, fileId, file, read, write, parseOut
335335
}
336336

337337
if (onProgress !== null) {
338-
onProgress(Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100);
338+
onProgress({
339+
$id: response['$id'],
340+
progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
341+
sizeUploaded: end+1,
342+
chunksTotal: response['chunksTotal'],
343+
chunksUploaded: response['chunksUploaded']
344+
});
339345
}
340346
}
341347
}

0 commit comments

Comments
 (0)