appwrite-cli 4.0.0 → 4.2.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.
@@ -0,0 +1,51 @@
1
+ const paginate = async (action, args = {}, limit = 100, wrapper = '') => {
2
+ let pageNumber = 0;
3
+ let results = [];
4
+ let total = 0;
5
+
6
+ while (true) {
7
+ const offset = pageNumber * limit;
8
+
9
+ // Merge the limit and offset into the args
10
+ const response = await action({
11
+ ...args,
12
+ queries: [
13
+ `limit(${limit})`,
14
+ `offset(${offset})`
15
+ ]
16
+ });
17
+
18
+ if (wrapper === '') {
19
+ if (response.length === 0) {
20
+ break;
21
+ }
22
+ results = results.concat(response);
23
+ } else {
24
+ if (response[wrapper].length === 0) {
25
+ break;
26
+ }
27
+ results = results.concat(response[wrapper]);
28
+ }
29
+
30
+ total = response.total;
31
+
32
+ if (results.length >= total) {
33
+ break;
34
+ }
35
+
36
+ pageNumber++;
37
+ }
38
+
39
+ if (wrapper === '') {
40
+ return results;
41
+ }
42
+
43
+ return {
44
+ [wrapper]: results,
45
+ total,
46
+ };
47
+ }
48
+
49
+ module.exports = {
50
+ paginate
51
+ };
package/lib/questions.js CHANGED
@@ -20,6 +20,7 @@ const getIgnores = (runtime) => {
20
20
  case 'kotlin':
21
21
  return ['build'];
22
22
  case 'node':
23
+ case 'bun':
23
24
  return ['node_modules', '.npm'];
24
25
  case 'php':
25
26
  return ['vendor'];
@@ -46,6 +47,8 @@ const getEntrypoint = (runtime) => {
46
47
  return 'src/main.ts';
47
48
  case 'node':
48
49
  return 'src/main.js';
50
+ case 'bun':
51
+ return 'src/main.ts';
49
52
  case 'php':
50
53
  return 'src/index.php';
51
54
  case 'python':
@@ -79,6 +82,8 @@ const getInstallCommand = (runtime) => {
79
82
  return "deno install";
80
83
  case 'node':
81
84
  return 'npm install';
85
+ case 'bun':
86
+ return 'bun install';
82
87
  case 'php':
83
88
  return 'composer install';
84
89
  case 'python':
@@ -304,13 +309,12 @@ const questionsDeployCollections = [
304
309
  if (collections.length === 0) {
305
310
  throw new Error("No collections found in the current directory. Run `appwrite init collection` to fetch all your collections.");
306
311
  }
307
- let choices = collections.map((collection, idx) => {
312
+ return collections.map(collection => {
308
313
  return {
309
314
  name: `${collection.name} (${collection['databaseId']} - ${collection['$id']})`,
310
315
  value: `${collection['databaseId']}|${collection['$id']}`
311
316
  }
312
- })
313
- return choices;
317
+ });
314
318
  }
315
319
  },
316
320
  {
@@ -330,13 +334,12 @@ const questionsDeployBuckets = [
330
334
  if (buckets.length === 0) {
331
335
  throw new Error("No buckets found in the current directory. Run `appwrite init bucket` to fetch all your buckets.");
332
336
  }
333
- let choices = buckets.map((bucket, idx) => {
337
+ return buckets.map(bucket => {
334
338
  return {
335
339
  name: `${bucket.name} (${bucket['$id']})`,
336
340
  value: bucket.$id
337
341
  }
338
- })
339
- return choices;
342
+ });
340
343
  }
341
344
  },
342
345
  {
@@ -354,7 +357,7 @@ const questionsGetEntrypoint = [
354
357
  default: null,
355
358
  validate(value) {
356
359
  if (!value) {
357
- return "Please enter your enrtypoint";
360
+ return "Please enter your entrypoint";
358
361
  }
359
362
  return true;
360
363
  }
@@ -371,13 +374,12 @@ const questionsDeployTeams = [
371
374
  if (teams.length === 0) {
372
375
  throw new Error("No teams found in the current directory. Run `appwrite init team` to fetch all your teams.");
373
376
  }
374
- let choices = teams.map((team, idx) => {
377
+ return teams.map(team => {
375
378
  return {
376
379
  name: `${team.name} (${team['$id']})`,
377
380
  value: team.$id
378
381
  }
379
- })
380
- return choices;
382
+ });
381
383
  }
382
384
  },
383
385
  {
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": "4.0.0",
5
+ "version": "4.2.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "index.js",
8
8
  "bin": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
5
5
  "homepage": "https://github.com/appwrite/sdk-for-cli",
6
6
  "license": "BSD-3-Clause",
7
7
  "architecture": {
8
8
  "64bit": {
9
- "url": "https://github.com/appwrite/sdk-for-cli/releases/download/4.0.0/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/4.2.0/appwrite-cli-win-x64.exe",
10
10
  "bin": [
11
11
  [
12
12
  "appwrite-cli-win-x64.exe",
@@ -15,7 +15,7 @@
15
15
  ]
16
16
  },
17
17
  "arm64": {
18
- "url": "https://github.com/appwrite/sdk-for-cli/releases/download/4.0.0/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/4.2.0/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",