appwrite-cli 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +0 -1
- package/README.md +3 -3
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +2 -2
- package/lib/commands/account.js +2 -2
- package/lib/commands/avatars.js +1 -1
- package/lib/commands/database.js +3 -3
- package/lib/commands/functions.js +44 -36
- package/lib/commands/health.js +1 -1
- package/lib/commands/locale.js +1 -1
- package/lib/commands/projects.js +1 -1
- package/lib/commands/storage.js +45 -34
- package/lib/commands/teams.js +1 -1
- package/lib/commands/users.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
|
8
8
|
|
|
9
|
-
**This SDK is compatible with Appwrite server version
|
|
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).**
|
|
10
10
|
|
|
11
11
|
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)
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ appwrite -v
|
|
32
|
-
0.
|
|
32
|
+
0.16.0
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Install using prebuilt binaries
|
|
@@ -58,7 +58,7 @@ $ iwr -useb https://appwrite.io/cli/install.ps1 | iex
|
|
|
58
58
|
Once the installation completes, you can verify your install using
|
|
59
59
|
```
|
|
60
60
|
$ appwrite -v
|
|
61
|
-
0.
|
|
61
|
+
0.16.0
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## Getting Started
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# You can use "View source" of this page to see the full script.
|
|
14
14
|
|
|
15
15
|
# REPO
|
|
16
|
-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/0.
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/0.
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/0.16.0/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/0.16.0/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
# Appwrite download directory
|
|
20
20
|
$APPWRITE_DOWNLOAD_DIR = Join-Path -Path $env:TEMP -ChildPath "appwrite.exe"
|
package/install.sh
CHANGED
|
@@ -97,7 +97,7 @@ printSuccess() {
|
|
|
97
97
|
downloadBinary() {
|
|
98
98
|
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
|
|
99
99
|
|
|
100
|
-
GITHUB_LATEST_VERSION="0.
|
|
100
|
+
GITHUB_LATEST_VERSION="0.16.0"
|
|
101
101
|
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
|
|
102
102
|
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
|
|
103
103
|
|
package/lib/client.js
CHANGED
|
@@ -11,8 +11,8 @@ class Client {
|
|
|
11
11
|
this.endpoint = 'https://HOSTNAME/v1';
|
|
12
12
|
this.headers = {
|
|
13
13
|
'content-type': '',
|
|
14
|
-
'x-sdk-version': 'appwrite:cli:0.
|
|
15
|
-
'User-Agent' : `AppwriteCLI/0.
|
|
14
|
+
'x-sdk-version': 'appwrite:cli:0.16.0',
|
|
15
|
+
'User-Agent' : `AppwriteCLI/0.16.0 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
16
16
|
'X-Appwrite-Response-Format' : '0.13.0',
|
|
17
17
|
};
|
|
18
18
|
}
|
package/lib/commands/account.js
CHANGED
|
@@ -234,7 +234,7 @@ const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined})
|
|
|
234
234
|
|
|
235
235
|
/** Body Params */
|
|
236
236
|
if (typeof prefs !== 'undefined') {
|
|
237
|
-
payload['prefs'] = prefs;
|
|
237
|
+
payload['prefs'] = JSON.parse(prefs);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
let response = undefined;
|
|
@@ -782,4 +782,4 @@ module.exports = {
|
|
|
782
782
|
accountDeleteSession,
|
|
783
783
|
accountCreateVerification,
|
|
784
784
|
accountUpdateVerification
|
|
785
|
-
};
|
|
785
|
+
};
|
package/lib/commands/avatars.js
CHANGED
package/lib/commands/database.js
CHANGED
|
@@ -648,7 +648,7 @@ const databaseCreateDocument = async ({ collectionId, documentId, data, read, wr
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
if (typeof data !== 'undefined') {
|
|
651
|
-
payload['data'] = data;
|
|
651
|
+
payload['data'] = JSON.parse(data);
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
if (typeof read !== 'undefined') {
|
|
@@ -703,7 +703,7 @@ const databaseUpdateDocument = async ({ collectionId, documentId, data, read, wr
|
|
|
703
703
|
|
|
704
704
|
/** Body Params */
|
|
705
705
|
if (typeof data !== 'undefined') {
|
|
706
|
-
payload['data'] = data;
|
|
706
|
+
payload['data'] = JSON.parse(data);
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
if (typeof read !== 'undefined') {
|
|
@@ -1235,4 +1235,4 @@ module.exports = {
|
|
|
1235
1235
|
databaseListCollectionLogs,
|
|
1236
1236
|
databaseGetUsage,
|
|
1237
1237
|
databaseGetCollectionUsage
|
|
1238
|
-
};
|
|
1238
|
+
};
|
|
@@ -84,7 +84,7 @@ const functionsCreate = async ({ functionId, name, execute, runtime, vars, event
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (typeof vars !== 'undefined') {
|
|
87
|
-
payload['vars'] = vars;
|
|
87
|
+
payload['vars'] = JSON.parse(vars);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
if (typeof events !== 'undefined') {
|
|
@@ -169,7 +169,7 @@ const functionsUpdate = async ({ functionId, name, execute, vars, events, schedu
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
if (typeof vars !== 'undefined') {
|
|
172
|
-
payload['vars'] = vars;
|
|
172
|
+
payload['vars'] = JSON.parse(vars);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
if (typeof events !== 'undefined') {
|
|
@@ -287,6 +287,7 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
|
|
|
287
287
|
let archivePath = fs.realpathSync('code.tar.gz')
|
|
288
288
|
if (typeof archivePath !== 'undefined') {
|
|
289
289
|
payload['code'] = archivePath;
|
|
290
|
+
code = archivePath;
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
if (typeof activate !== 'undefined') {
|
|
@@ -301,46 +302,53 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
|
|
|
301
302
|
|
|
302
303
|
response = await client.call('post', path, {
|
|
303
304
|
'content-type': 'multipart/form-data',
|
|
304
|
-
}, payload)
|
|
305
|
+
}, payload).catch(err => {
|
|
306
|
+
fs.unlinkSync(archivePath);
|
|
307
|
+
throw err
|
|
308
|
+
});
|
|
305
309
|
} else {
|
|
306
310
|
const streamFilePath = payload['code'];
|
|
307
311
|
let id = undefined;
|
|
308
312
|
|
|
313
|
+
let counter = 0;
|
|
309
314
|
const totalCounters = Math.ceil(size / libClient.CHUNK_SIZE);
|
|
310
315
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
316
|
+
const headers = {
|
|
317
|
+
'content-type': 'multipart/form-data',
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
for (counter; counter < totalCounters; counter++) {
|
|
322
|
+
const start = (counter * libClient.CHUNK_SIZE);
|
|
323
|
+
const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
|
|
324
|
+
|
|
325
|
+
headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
|
|
326
|
+
|
|
327
|
+
if (id) {
|
|
328
|
+
headers['x-appwrite-id'] = id;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const stream = fs.createReadStream(streamFilePath, {
|
|
332
|
+
start,
|
|
333
|
+
end
|
|
334
|
+
});
|
|
335
|
+
payload['code'] = stream;
|
|
336
|
+
|
|
337
|
+
response = await client.call('post', path, headers, payload);
|
|
338
|
+
|
|
339
|
+
if (!id) {
|
|
340
|
+
id = response['$id'];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (onProgress !== null) {
|
|
344
|
+
onProgress({
|
|
345
|
+
$id: response['$id'],
|
|
346
|
+
progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
|
|
347
|
+
sizeUploaded: end+1,
|
|
348
|
+
chunksTotal: response['chunksTotal'],
|
|
349
|
+
chunksUploaded: response['chunksUploaded']
|
|
326
350
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
response = await client.call('post', path, headers, payload);
|
|
330
|
-
|
|
331
|
-
if (!id) {
|
|
332
|
-
id = response['$id'];
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (onProgress !== null) {
|
|
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
|
-
});
|
|
343
|
-
}
|
|
351
|
+
}
|
|
344
352
|
}
|
|
345
353
|
}
|
|
346
354
|
|
|
@@ -699,4 +707,4 @@ module.exports = {
|
|
|
699
707
|
functionsCreateExecution,
|
|
700
708
|
functionsGetExecution,
|
|
701
709
|
functionsGetUsage
|
|
702
|
-
};
|
|
710
|
+
};
|
package/lib/commands/health.js
CHANGED
package/lib/commands/locale.js
CHANGED
package/lib/commands/projects.js
CHANGED
package/lib/commands/storage.js
CHANGED
|
@@ -303,46 +303,57 @@ const storageCreateFile = async ({ bucketId, fileId, file, read, write, parseOut
|
|
|
303
303
|
|
|
304
304
|
response = await client.call('post', path, {
|
|
305
305
|
'content-type': 'multipart/form-data',
|
|
306
|
-
}, payload)
|
|
306
|
+
}, payload)
|
|
307
307
|
} else {
|
|
308
308
|
const streamFilePath = payload['file'];
|
|
309
309
|
let id = undefined;
|
|
310
310
|
|
|
311
|
+
let counter = 0;
|
|
311
312
|
const totalCounters = Math.ceil(size / libClient.CHUNK_SIZE);
|
|
312
313
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
314
|
+
const headers = {
|
|
315
|
+
'content-type': 'multipart/form-data',
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
if(fileId != 'unique()') {
|
|
319
|
+
try {
|
|
320
|
+
response = await client.call('get', path + '/' + fileId, headers);
|
|
321
|
+
counter = response.chunksUploaded;
|
|
322
|
+
} catch(e) {
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
for (counter; counter < totalCounters; counter++) {
|
|
327
|
+
const start = (counter * libClient.CHUNK_SIZE);
|
|
328
|
+
const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
|
|
329
|
+
|
|
330
|
+
headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
|
|
331
|
+
|
|
332
|
+
if (id) {
|
|
333
|
+
headers['x-appwrite-id'] = id;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const stream = fs.createReadStream(streamFilePath, {
|
|
337
|
+
start,
|
|
338
|
+
end
|
|
339
|
+
});
|
|
340
|
+
payload['file'] = stream;
|
|
341
|
+
|
|
342
|
+
response = await client.call('post', path, headers, payload);
|
|
343
|
+
|
|
344
|
+
if (!id) {
|
|
345
|
+
id = response['$id'];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (onProgress !== null) {
|
|
349
|
+
onProgress({
|
|
350
|
+
$id: response['$id'],
|
|
351
|
+
progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
|
|
352
|
+
sizeUploaded: end+1,
|
|
353
|
+
chunksTotal: response['chunksTotal'],
|
|
354
|
+
chunksUploaded: response['chunksUploaded']
|
|
328
355
|
});
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
response = await client.call('post', path, headers, payload);
|
|
332
|
-
|
|
333
|
-
if (!id) {
|
|
334
|
-
id = response['$id'];
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (onProgress !== null) {
|
|
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
|
-
});
|
|
345
|
-
}
|
|
356
|
+
}
|
|
346
357
|
}
|
|
347
358
|
}
|
|
348
359
|
|
|
@@ -752,4 +763,4 @@ module.exports = {
|
|
|
752
763
|
storageGetFileView,
|
|
753
764
|
storageGetUsage,
|
|
754
765
|
storageGetBucketUsage
|
|
755
|
-
};
|
|
766
|
+
};
|
package/lib/commands/teams.js
CHANGED
package/lib/commands/users.js
CHANGED
|
@@ -285,7 +285,7 @@ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undef
|
|
|
285
285
|
|
|
286
286
|
/** Body Params */
|
|
287
287
|
if (typeof prefs !== 'undefined') {
|
|
288
|
-
payload['prefs'] = prefs;
|
|
288
|
+
payload['prefs'] = JSON.parse(prefs);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
let response = undefined;
|
|
@@ -539,4 +539,4 @@ module.exports = {
|
|
|
539
539
|
usersDeleteSession,
|
|
540
540
|
usersUpdateStatus,
|
|
541
541
|
usersUpdateVerification
|
|
542
|
-
};
|
|
542
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "appwrite-cli",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"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": "0.
|
|
5
|
+
"version": "0.16.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"windows-arm64": "pkg -t node16-win-arm64 -o build/appwrite-cli-win-arm64.exe package.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"axios": "^0.
|
|
25
|
+
"axios": "^0.26.1",
|
|
26
26
|
"chalk": "4.1.2",
|
|
27
27
|
"cli-table3": "^0.6.1",
|
|
28
|
-
"commander": "^
|
|
28
|
+
"commander": "^9.0.0",
|
|
29
29
|
"form-data": "^4.0.0",
|
|
30
|
-
"inquirer": "^8.2.
|
|
30
|
+
"inquirer": "^8.2.1",
|
|
31
31
|
"tar": "^6.1.11"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|