appwrite-cli 12.0.0 → 13.0.0-rc.1

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.
Files changed (283) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +145 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/lib/client.d.ts +89 -0
  8. package/dist/lib/client.d.ts.map +1 -0
  9. package/dist/lib/client.js +227 -0
  10. package/dist/lib/client.js.map +1 -0
  11. package/dist/lib/commands/account.d.ts +379 -0
  12. package/dist/lib/commands/account.d.ts.map +1 -0
  13. package/dist/lib/commands/account.js +1228 -0
  14. package/dist/lib/commands/account.js.map +1 -0
  15. package/dist/lib/commands/console.d.ts +20 -0
  16. package/dist/lib/commands/console.d.ts.map +1 -0
  17. package/dist/lib/commands/console.js +78 -0
  18. package/dist/lib/commands/console.js.map +1 -0
  19. package/dist/lib/commands/databases.d.ts +732 -0
  20. package/dist/lib/commands/databases.d.ts.map +1 -0
  21. package/dist/lib/commands/databases.js +2196 -0
  22. package/dist/lib/commands/databases.js.map +1 -0
  23. package/dist/lib/commands/functions.d.ts +310 -0
  24. package/dist/lib/commands/functions.d.ts.map +1 -0
  25. package/dist/lib/commands/functions.js +1100 -0
  26. package/dist/lib/commands/functions.js.map +1 -0
  27. package/dist/lib/commands/generic.d.ts +17 -0
  28. package/dist/lib/commands/generic.d.ts.map +1 -0
  29. package/dist/lib/commands/generic.js +279 -0
  30. package/dist/lib/commands/generic.js.map +1 -0
  31. package/dist/lib/commands/graphql.d.ts +19 -0
  32. package/dist/lib/commands/graphql.d.ts.map +1 -0
  33. package/dist/lib/commands/graphql.js +77 -0
  34. package/dist/lib/commands/graphql.js.map +1 -0
  35. package/dist/lib/commands/health.d.ts +153 -0
  36. package/dist/lib/commands/health.d.ts.map +1 -0
  37. package/dist/lib/commands/health.js +464 -0
  38. package/dist/lib/commands/health.js.map +1 -0
  39. package/dist/lib/commands/init.d.ts +3 -0
  40. package/dist/lib/commands/init.d.ts.map +1 -0
  41. package/dist/lib/commands/init.js +518 -0
  42. package/dist/lib/commands/init.js.map +1 -0
  43. package/dist/lib/commands/locale.d.ts +53 -0
  44. package/dist/lib/commands/locale.d.ts.map +1 -0
  45. package/dist/lib/commands/locale.js +165 -0
  46. package/dist/lib/commands/locale.js.map +1 -0
  47. package/dist/lib/commands/messaging.d.ts +588 -0
  48. package/dist/lib/commands/messaging.d.ts.map +1 -0
  49. package/dist/lib/commands/messaging.js +2042 -0
  50. package/dist/lib/commands/messaging.js.map +1 -0
  51. package/dist/lib/commands/migrations.d.ts +150 -0
  52. package/dist/lib/commands/migrations.d.ts.map +1 -0
  53. package/dist/lib/commands/migrations.js +524 -0
  54. package/dist/lib/commands/migrations.js.map +1 -0
  55. package/dist/lib/commands/organizations.d.ts +11 -0
  56. package/dist/lib/commands/organizations.d.ts.map +1 -0
  57. package/dist/lib/commands/organizations.js +31 -0
  58. package/dist/lib/commands/organizations.js.map +1 -0
  59. package/dist/lib/commands/project.d.ts +53 -0
  60. package/dist/lib/commands/project.d.ts.map +1 -0
  61. package/dist/lib/commands/project.js +176 -0
  62. package/dist/lib/commands/project.js.map +1 -0
  63. package/dist/lib/commands/projects.d.ts +516 -0
  64. package/dist/lib/commands/projects.d.ts.map +1 -0
  65. package/dist/lib/commands/projects.js +1590 -0
  66. package/dist/lib/commands/projects.js.map +1 -0
  67. package/dist/lib/commands/proxy.d.ts +71 -0
  68. package/dist/lib/commands/proxy.d.ts.map +1 -0
  69. package/dist/lib/commands/proxy.js +240 -0
  70. package/dist/lib/commands/proxy.js.map +1 -0
  71. package/dist/lib/commands/pull.d.ts +8 -0
  72. package/dist/lib/commands/pull.d.ts.map +1 -0
  73. package/dist/lib/commands/pull.js +455 -0
  74. package/dist/lib/commands/pull.js.map +1 -0
  75. package/dist/lib/commands/push.d.ts +4 -0
  76. package/dist/lib/commands/push.d.ts.map +1 -0
  77. package/dist/lib/commands/push.js +2154 -0
  78. package/dist/lib/commands/push.js.map +1 -0
  79. package/dist/lib/commands/run.d.ts +3 -0
  80. package/dist/lib/commands/run.d.ts.map +1 -0
  81. package/dist/lib/commands/run.js +287 -0
  82. package/dist/lib/commands/run.js.map +1 -0
  83. package/dist/lib/commands/sites.d.ts +296 -0
  84. package/dist/lib/commands/sites.d.ts.map +1 -0
  85. package/dist/lib/commands/sites.js +1046 -0
  86. package/dist/lib/commands/sites.js.map +1 -0
  87. package/dist/lib/commands/storage.d.ts +170 -0
  88. package/dist/lib/commands/storage.d.ts.map +1 -0
  89. package/dist/lib/commands/storage.js +651 -0
  90. package/dist/lib/commands/storage.js.map +1 -0
  91. package/dist/lib/commands/tables-db.d.ts +728 -0
  92. package/dist/lib/commands/tables-db.d.ts.map +1 -0
  93. package/dist/lib/commands/tables-db.js +2198 -0
  94. package/dist/lib/commands/tables-db.js.map +1 -0
  95. package/dist/lib/commands/teams.d.ts +129 -0
  96. package/dist/lib/commands/teams.d.ts.map +1 -0
  97. package/dist/lib/commands/teams.js +403 -0
  98. package/dist/lib/commands/teams.js.map +1 -0
  99. package/dist/lib/commands/tokens.d.ts +48 -0
  100. package/dist/lib/commands/tokens.d.ts.map +1 -0
  101. package/dist/lib/commands/tokens.js +156 -0
  102. package/dist/lib/commands/tokens.js.map +1 -0
  103. package/dist/lib/commands/types.d.ts +3 -0
  104. package/dist/lib/commands/types.d.ts.map +1 -0
  105. package/dist/lib/commands/types.js +155 -0
  106. package/dist/lib/commands/types.js.map +1 -0
  107. package/dist/lib/commands/update.d.ts +3 -0
  108. package/dist/lib/commands/update.d.ts.map +1 -0
  109. package/dist/lib/commands/update.js +202 -0
  110. package/dist/lib/commands/update.js.map +1 -0
  111. package/dist/lib/commands/users.d.ts +382 -0
  112. package/dist/lib/commands/users.d.ts.map +1 -0
  113. package/dist/lib/commands/users.js +1195 -0
  114. package/dist/lib/commands/users.js.map +1 -0
  115. package/dist/lib/commands/vcs.d.ts +92 -0
  116. package/dist/lib/commands/vcs.d.ts.map +1 -0
  117. package/dist/lib/commands/vcs.js +276 -0
  118. package/dist/lib/commands/vcs.js.map +1 -0
  119. package/dist/lib/config.d.ts +118 -0
  120. package/dist/lib/config.d.ts.map +1 -0
  121. package/{lib → dist/lib}/config.js +204 -325
  122. package/dist/lib/config.js.map +1 -0
  123. package/dist/lib/emulation/docker.d.ts +15 -0
  124. package/dist/lib/emulation/docker.d.ts.map +1 -0
  125. package/dist/lib/emulation/docker.js +220 -0
  126. package/dist/lib/emulation/docker.js.map +1 -0
  127. package/dist/lib/emulation/utils.d.ts +29 -0
  128. package/dist/lib/emulation/utils.d.ts.map +1 -0
  129. package/dist/lib/emulation/utils.js +168 -0
  130. package/dist/lib/emulation/utils.js.map +1 -0
  131. package/dist/lib/exception.d.ts +8 -0
  132. package/dist/lib/exception.d.ts.map +1 -0
  133. package/dist/lib/exception.js +16 -0
  134. package/dist/lib/exception.js.map +1 -0
  135. package/dist/lib/id.d.ts +7 -0
  136. package/dist/lib/id.d.ts.map +1 -0
  137. package/dist/lib/id.js +32 -0
  138. package/dist/lib/id.js.map +1 -0
  139. package/dist/lib/paginate.d.ts +10 -0
  140. package/dist/lib/paginate.d.ts.map +1 -0
  141. package/{lib → dist/lib}/paginate.js +9 -15
  142. package/dist/lib/paginate.js.map +1 -0
  143. package/dist/lib/parser.d.ts +18 -0
  144. package/dist/lib/parser.d.ts.map +1 -0
  145. package/dist/lib/parser.js +237 -0
  146. package/dist/lib/parser.js.map +1 -0
  147. package/dist/lib/questions.d.ts +59 -0
  148. package/dist/lib/questions.d.ts.map +1 -0
  149. package/dist/lib/questions.js +995 -0
  150. package/dist/lib/questions.js.map +1 -0
  151. package/dist/lib/sdks.d.ts +4 -0
  152. package/dist/lib/sdks.d.ts.map +1 -0
  153. package/dist/lib/sdks.js +51 -0
  154. package/dist/lib/sdks.js.map +1 -0
  155. package/dist/lib/spinner.d.ts +28 -0
  156. package/dist/lib/spinner.d.ts.map +1 -0
  157. package/{lib → dist/lib}/spinner.js +34 -45
  158. package/dist/lib/spinner.js.map +1 -0
  159. package/dist/lib/type-generation/attribute.d.ts +17 -0
  160. package/dist/lib/type-generation/attribute.d.ts.map +1 -0
  161. package/dist/lib/type-generation/attribute.js +19 -0
  162. package/dist/lib/type-generation/attribute.js.map +1 -0
  163. package/dist/lib/type-generation/languages/csharp.d.ts +7 -0
  164. package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -0
  165. package/dist/lib/type-generation/languages/csharp.js +180 -0
  166. package/dist/lib/type-generation/languages/csharp.js.map +1 -0
  167. package/dist/lib/type-generation/languages/dart.d.ts +8 -0
  168. package/dist/lib/type-generation/languages/dart.d.ts.map +1 -0
  169. package/dist/lib/type-generation/languages/dart.js +197 -0
  170. package/dist/lib/type-generation/languages/dart.js.map +1 -0
  171. package/dist/lib/type-generation/languages/java.d.ts +7 -0
  172. package/dist/lib/type-generation/languages/java.d.ts.map +1 -0
  173. package/dist/lib/type-generation/languages/java.js +140 -0
  174. package/dist/lib/type-generation/languages/java.js.map +1 -0
  175. package/dist/lib/type-generation/languages/javascript.d.ts +9 -0
  176. package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -0
  177. package/dist/lib/type-generation/languages/javascript.js +108 -0
  178. package/dist/lib/type-generation/languages/javascript.js.map +1 -0
  179. package/dist/lib/type-generation/languages/kotlin.d.ts +7 -0
  180. package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -0
  181. package/dist/lib/type-generation/languages/kotlin.js +95 -0
  182. package/dist/lib/type-generation/languages/kotlin.js.map +1 -0
  183. package/dist/lib/type-generation/languages/language.d.ts +43 -0
  184. package/dist/lib/type-generation/languages/language.d.ts.map +1 -0
  185. package/dist/lib/type-generation/languages/language.js +82 -0
  186. package/dist/lib/type-generation/languages/language.js.map +1 -0
  187. package/dist/lib/type-generation/languages/php.d.ts +7 -0
  188. package/dist/lib/type-generation/languages/php.d.ts.map +1 -0
  189. package/dist/lib/type-generation/languages/php.js +116 -0
  190. package/dist/lib/type-generation/languages/php.js.map +1 -0
  191. package/dist/lib/type-generation/languages/swift.d.ts +7 -0
  192. package/dist/lib/type-generation/languages/swift.d.ts.map +1 -0
  193. package/dist/lib/type-generation/languages/swift.js +179 -0
  194. package/dist/lib/type-generation/languages/swift.js.map +1 -0
  195. package/dist/lib/type-generation/languages/typescript.d.ts +9 -0
  196. package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -0
  197. package/dist/lib/type-generation/languages/typescript.js +112 -0
  198. package/dist/lib/type-generation/languages/typescript.js.map +1 -0
  199. package/dist/lib/types.d.ts +133 -0
  200. package/dist/lib/types.d.ts.map +1 -0
  201. package/dist/lib/types.js +3 -0
  202. package/dist/lib/types.js.map +1 -0
  203. package/dist/lib/utils.d.ts +15 -0
  204. package/dist/lib/utils.d.ts.map +1 -0
  205. package/{lib → dist/lib}/utils.js +74 -120
  206. package/dist/lib/utils.js.map +1 -0
  207. package/dist/lib/validations.d.ts +2 -0
  208. package/dist/lib/validations.d.ts.map +1 -0
  209. package/dist/lib/validations.js +20 -0
  210. package/dist/lib/validations.js.map +1 -0
  211. package/docs/examples/databases/upsert-document.md +1 -2
  212. package/index.ts +152 -0
  213. package/install.ps1 +2 -5
  214. package/install.sh +1 -2
  215. package/lib/client.ts +259 -0
  216. package/lib/commands/{account.js → account.ts} +410 -664
  217. package/lib/commands/console.ts +112 -0
  218. package/lib/commands/{databases.js → databases.ts} +818 -1136
  219. package/lib/commands/{functions.js → functions.ts} +381 -526
  220. package/lib/commands/{generic.js → generic.ts} +47 -39
  221. package/lib/commands/graphql.ts +110 -0
  222. package/lib/commands/{health.js → health.ts} +168 -284
  223. package/lib/commands/{init.js → init.ts} +68 -66
  224. package/lib/commands/{locale.js → locale.ts} +75 -121
  225. package/lib/commands/{messaging.js → messaging.ts} +699 -937
  226. package/lib/commands/{migrations.js → migrations.ts} +182 -258
  227. package/lib/commands/organizations.ts +46 -0
  228. package/lib/commands/{project.js → project.ts} +75 -111
  229. package/lib/commands/{projects.js → projects.ts} +587 -843
  230. package/lib/commands/{proxy.js → proxy.ts} +94 -140
  231. package/lib/commands/{pull.js → pull.ts} +54 -44
  232. package/lib/commands/{push.js → push.ts} +235 -191
  233. package/lib/commands/{run.js → run.ts} +61 -55
  234. package/lib/commands/{sites.js → sites.ts} +364 -504
  235. package/lib/commands/{storage.js → storage.ts} +216 -292
  236. package/lib/commands/{tables-db.js → tables-db.ts} +817 -1126
  237. package/lib/commands/{teams.js → teams.ts} +162 -236
  238. package/lib/commands/{tokens.js → tokens.ts} +70 -99
  239. package/lib/commands/{types.js → types.ts} +37 -35
  240. package/lib/commands/{update.js → update.ts} +25 -27
  241. package/lib/commands/{users.js → users.ts} +426 -644
  242. package/lib/commands/{vcs.js → vcs.ts} +122 -173
  243. package/lib/config.ts +854 -0
  244. package/lib/emulation/{docker.js → docker.ts} +39 -38
  245. package/lib/emulation/utils.ts +193 -0
  246. package/lib/exception.ts +20 -0
  247. package/lib/{id.js → id.ts} +5 -5
  248. package/lib/paginate.ts +63 -0
  249. package/lib/parser.ts +238 -0
  250. package/lib/{questions.js → questions.ts} +148 -156
  251. package/lib/sdks.ts +55 -0
  252. package/lib/spinner.ts +118 -0
  253. package/lib/type-generation/attribute.ts +17 -0
  254. package/lib/type-generation/languages/{csharp.js → csharp.ts} +59 -48
  255. package/lib/type-generation/languages/{dart.js → dart.ts} +91 -80
  256. package/lib/type-generation/languages/{java.js → java.ts} +58 -47
  257. package/lib/type-generation/languages/javascript.ts +111 -0
  258. package/lib/type-generation/languages/kotlin.ts +96 -0
  259. package/lib/type-generation/languages/language.ts +119 -0
  260. package/lib/type-generation/languages/{php.js → php.ts} +55 -48
  261. package/lib/type-generation/languages/{swift.js → swift.ts} +59 -48
  262. package/lib/type-generation/languages/typescript.ts +116 -0
  263. package/lib/types.ts +150 -0
  264. package/lib/utils.ts +322 -0
  265. package/lib/validations.ts +17 -0
  266. package/package.json +21 -12
  267. package/scoop/appwrite.config.json +3 -3
  268. package/tsconfig.json +30 -0
  269. package/index.js +0 -147
  270. package/lib/client.js +0 -254
  271. package/lib/commands/console.js +0 -127
  272. package/lib/commands/graphql.js +0 -126
  273. package/lib/commands/organizations.js +0 -48
  274. package/lib/emulation/utils.js +0 -186
  275. package/lib/exception.js +0 -9
  276. package/lib/parser.js +0 -250
  277. package/lib/sdks.js +0 -60
  278. package/lib/type-generation/attribute.js +0 -16
  279. package/lib/type-generation/languages/javascript.js +0 -102
  280. package/lib/type-generation/languages/kotlin.js +0 -85
  281. package/lib/type-generation/languages/language.js +0 -125
  282. package/lib/type-generation/languages/typescript.js +0 -107
  283. package/lib/validations.js +0 -17
@@ -1,31 +1,27 @@
1
- const fs = require('fs');
2
- const pathLib = require('path');
3
- const tar = require("tar");
4
- const ignore = require("ignore");
5
- const { promisify } = require('util');
6
- const libClient = require('../client.js');
7
- const { getAllFiles, showConsoleLink } = require('../utils.js');
8
- const { Command } = require('commander');
9
- const { sdkForProject, sdkForConsole } = require('../sdks')
10
- const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
11
- const { localConfig, globalConfig } = require("../config");
12
- const { File } = require('undici');
13
- const { ReadableStream } = require('stream/web');
14
-
15
- /**
16
- * @param {fs.ReadStream} readStream
17
- * @returns {ReadableStream}
18
- */
19
- function convertReadStreamToReadableStream(readStream) {
1
+ import fs = require('fs');
2
+ import pathLib = require('path');
3
+ import tar = require('tar');
4
+ import ignore = require('ignore');
5
+ import { promisify } from 'util';
6
+ import Client from '../client';
7
+ import { getAllFiles, showConsoleLink } from '../utils';
8
+ import { Command } from 'commander';
9
+ import { sdkForProject, sdkForConsole } from '../sdks';
10
+ import { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } from '../parser';
11
+ import { localConfig, globalConfig } from '../config';
12
+ import { File } from 'undici';
13
+ import { ReadableStream } from 'stream/web';
14
+
15
+ function convertReadStreamToReadableStream(readStream: fs.ReadStream): ReadableStream {
20
16
  return new ReadableStream({
21
17
  start(controller) {
22
- readStream.on("data", (chunk) => {
18
+ readStream.on("data", (chunk: Buffer) => {
23
19
  controller.enqueue(chunk);
24
20
  });
25
21
  readStream.on("end", () => {
26
22
  controller.close();
27
23
  });
28
- readStream.on("error", (err) => {
24
+ readStream.on("error", (err: Error) => {
29
25
  controller.error(err);
30
26
  });
31
27
  },
@@ -35,24 +31,21 @@ function convertReadStreamToReadableStream(readStream) {
35
31
  });
36
32
  }
37
33
 
38
- const storage = new Command("storage").description(commandDescriptions['storage'] ?? '').configureHelp({
34
+ export const storage = new Command("storage").description(commandDescriptions['storage'] ?? '').configureHelp({
39
35
  helpWidth: process.stdout.columns || 80
40
36
  })
41
37
 
42
- /**
43
- * @typedef {Object} StorageListBucketsRequestParams
44
- * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
45
- * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
- * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
47
- * @property {boolean} overrideForCli
48
- * @property {boolean} parseOutput
49
- * @property {libClient | undefined} sdk
50
- */
51
-
52
- /**
53
- * @param {StorageListBucketsRequestParams} params
54
- */
55
- const storageListBuckets = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
38
+ interface StorageListBucketsRequestParams {
39
+ queries?: string[];
40
+ search?: string;
41
+ total?: boolean;
42
+ overrideForCli?: boolean;
43
+ parseOutput?: boolean;
44
+ sdk?: Client;
45
+ console?: boolean;
46
+ }
47
+
48
+ export const storageListBuckets = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: StorageListBucketsRequestParams): Promise<any> => {
56
49
  let client = !sdk ? await sdkForProject() :
57
50
  sdk;
58
51
  let apiPath = '/storage/buckets';
@@ -73,7 +66,7 @@ const storageListBuckets = async ({queries,search,total,parseOutput = true, over
73
66
  }, payload);
74
67
 
75
68
  if (parseOutput) {
76
- if(console) {
69
+ if(showConsole) {
77
70
  showConsoleLink('storage', 'listBuckets');
78
71
  } else {
79
72
  parse(response)
@@ -83,28 +76,24 @@ const storageListBuckets = async ({queries,search,total,parseOutput = true, over
83
76
  return response;
84
77
 
85
78
  }
86
- /**
87
- * @typedef {Object} StorageCreateBucketRequestParams
88
- * @property {string} bucketId Unique Id. Choose a custom ID or generate a random ID with &#039;ID.unique()&#039;. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
89
- * @property {string} name Bucket name
90
- * @property {string[]} permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
91
- * @property {boolean} fileSecurity Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
92
- * @property {boolean} enabled Is bucket enabled? When set to &#039;disabled&#039;, users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
93
- * @property {number} maximumFileSize Maximum file size allowed in bytes. Maximum allowed value is 30MB.
94
- * @property {string[]} allowedFileExtensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
95
- * @property {Compression} compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it&#039;s enabled
96
- * @property {boolean} encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it&#039;s enabled
97
- * @property {boolean} antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it&#039;s enabled
98
- * @property {boolean} transformations Are image transformations enabled?
99
- * @property {boolean} overrideForCli
100
- * @property {boolean} parseOutput
101
- * @property {libClient | undefined} sdk
102
- */
103
-
104
- /**
105
- * @param {StorageCreateBucketRequestParams} params
106
- */
107
- const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,transformations,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
79
+ interface StorageCreateBucketRequestParams {
80
+ bucketId: string;
81
+ name: string;
82
+ permissions?: string[];
83
+ fileSecurity?: boolean;
84
+ enabled?: boolean;
85
+ maximumFileSize?: number;
86
+ allowedFileExtensions?: string[];
87
+ compression?: Compression;
88
+ encryption?: boolean;
89
+ antivirus?: boolean;
90
+ transformations?: boolean;
91
+ overrideForCli?: boolean;
92
+ parseOutput?: boolean;
93
+ sdk?: Client;
94
+ }
95
+
96
+ export const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,transformations,parseOutput = true, overrideForCli = false, sdk = undefined}: StorageCreateBucketRequestParams): Promise<any> => {
108
97
  let client = !sdk ? await sdkForProject() :
109
98
  sdk;
110
99
  let apiPath = '/storage/buckets';
@@ -158,18 +147,15 @@ const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabl
158
147
  return response;
159
148
 
160
149
  }
161
- /**
162
- * @typedef {Object} StorageGetBucketRequestParams
163
- * @property {string} bucketId Bucket unique ID.
164
- * @property {boolean} overrideForCli
165
- * @property {boolean} parseOutput
166
- * @property {libClient | undefined} sdk
167
- */
168
-
169
- /**
170
- * @param {StorageGetBucketRequestParams} params
171
- */
172
- const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
150
+ interface StorageGetBucketRequestParams {
151
+ bucketId: string;
152
+ overrideForCli?: boolean;
153
+ parseOutput?: boolean;
154
+ sdk?: Client;
155
+ console?: boolean;
156
+ }
157
+
158
+ export const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: StorageGetBucketRequestParams): Promise<any> => {
173
159
  let client = !sdk ? await sdkForProject() :
174
160
  sdk;
175
161
  let apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
@@ -181,7 +167,7 @@ const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = f
181
167
  }, payload);
182
168
 
183
169
  if (parseOutput) {
184
- if(console) {
170
+ if(showConsole) {
185
171
  showConsoleLink('storage', 'getBucket', bucketId);
186
172
  } else {
187
173
  parse(response)
@@ -191,28 +177,24 @@ const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = f
191
177
  return response;
192
178
 
193
179
  }
194
- /**
195
- * @typedef {Object} StorageUpdateBucketRequestParams
196
- * @property {string} bucketId Bucket unique ID.
197
- * @property {string} name Bucket name
198
- * @property {string[]} permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
199
- * @property {boolean} fileSecurity Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
200
- * @property {boolean} enabled Is bucket enabled? When set to &#039;disabled&#039;, users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
201
- * @property {number} maximumFileSize Maximum file size allowed in bytes. Maximum allowed value is 30MB.
202
- * @property {string[]} allowedFileExtensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
203
- * @property {Compression} compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it&#039;s enabled
204
- * @property {boolean} encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it&#039;s enabled
205
- * @property {boolean} antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it&#039;s enabled
206
- * @property {boolean} transformations Are image transformations enabled?
207
- * @property {boolean} overrideForCli
208
- * @property {boolean} parseOutput
209
- * @property {libClient | undefined} sdk
210
- */
211
-
212
- /**
213
- * @param {StorageUpdateBucketRequestParams} params
214
- */
215
- const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,transformations,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
180
+ interface StorageUpdateBucketRequestParams {
181
+ bucketId: string;
182
+ name: string;
183
+ permissions?: string[];
184
+ fileSecurity?: boolean;
185
+ enabled?: boolean;
186
+ maximumFileSize?: number;
187
+ allowedFileExtensions?: string[];
188
+ compression?: Compression;
189
+ encryption?: boolean;
190
+ antivirus?: boolean;
191
+ transformations?: boolean;
192
+ overrideForCli?: boolean;
193
+ parseOutput?: boolean;
194
+ sdk?: Client;
195
+ }
196
+
197
+ export const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,transformations,parseOutput = true, overrideForCli = false, sdk = undefined}: StorageUpdateBucketRequestParams): Promise<any> => {
216
198
  let client = !sdk ? await sdkForProject() :
217
199
  sdk;
218
200
  let apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
@@ -263,18 +245,14 @@ const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabl
263
245
  return response;
264
246
 
265
247
  }
266
- /**
267
- * @typedef {Object} StorageDeleteBucketRequestParams
268
- * @property {string} bucketId Bucket unique ID.
269
- * @property {boolean} overrideForCli
270
- * @property {boolean} parseOutput
271
- * @property {libClient | undefined} sdk
272
- */
273
-
274
- /**
275
- * @param {StorageDeleteBucketRequestParams} params
276
- */
277
- const storageDeleteBucket = async ({bucketId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
248
+ interface StorageDeleteBucketRequestParams {
249
+ bucketId: string;
250
+ overrideForCli?: boolean;
251
+ parseOutput?: boolean;
252
+ sdk?: Client;
253
+ }
254
+
255
+ export const storageDeleteBucket = async ({bucketId,parseOutput = true, overrideForCli = false, sdk = undefined}: StorageDeleteBucketRequestParams): Promise<any> => {
278
256
  let client = !sdk ? await sdkForProject() :
279
257
  sdk;
280
258
  let apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
@@ -293,21 +271,18 @@ const storageDeleteBucket = async ({bucketId,parseOutput = true, overrideForCli
293
271
  return response;
294
272
 
295
273
  }
296
- /**
297
- * @typedef {Object} StorageListFilesRequestParams
298
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
299
- * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
300
- * @property {string} search Search term to filter your list results. Max length: 256 chars.
301
- * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
302
- * @property {boolean} overrideForCli
303
- * @property {boolean} parseOutput
304
- * @property {libClient | undefined} sdk
305
- */
306
-
307
- /**
308
- * @param {StorageListFilesRequestParams} params
309
- */
310
- const storageListFiles = async ({bucketId,queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
274
+ interface StorageListFilesRequestParams {
275
+ bucketId: string;
276
+ queries?: string[];
277
+ search?: string;
278
+ total?: boolean;
279
+ overrideForCli?: boolean;
280
+ parseOutput?: boolean;
281
+ sdk?: Client;
282
+ console?: boolean;
283
+ }
284
+
285
+ export const storageListFiles = async ({bucketId,queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: StorageListFilesRequestParams): Promise<any> => {
311
286
  let client = !sdk ? await sdkForProject() :
312
287
  sdk;
313
288
  let apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
@@ -328,7 +303,7 @@ const storageListFiles = async ({bucketId,queries,search,total,parseOutput = tru
328
303
  }, payload);
329
304
 
330
305
  if (parseOutput) {
331
- if(console) {
306
+ if(showConsole) {
332
307
  showConsoleLink('storage', 'listFiles', bucketId);
333
308
  } else {
334
309
  parse(response)
@@ -338,22 +313,18 @@ const storageListFiles = async ({bucketId,queries,search,total,parseOutput = tru
338
313
  return response;
339
314
 
340
315
  }
341
- /**
342
- * @typedef {Object} StorageCreateFileRequestParams
343
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
344
- * @property {string} fileId File ID. Choose a custom ID or generate a random ID with &#039;ID.unique()&#039;. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
345
- * @property {string} file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
346
- * @property {string[]} permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
347
- * @property {boolean} overrideForCli
348
- * @property {boolean} parseOutput
349
- * @property {libClient | undefined} sdk
350
- * @property {CallableFunction} onProgress
351
- */
352
-
353
- /**
354
- * @param {StorageCreateFileRequestParams} params
355
- */
356
- const storageCreateFile = async ({bucketId,fileId,file,permissions,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}) => {
316
+ interface StorageCreateFileRequestParams {
317
+ bucketId: string;
318
+ fileId: string;
319
+ file: string;
320
+ permissions?: string[];
321
+ overrideForCli?: boolean;
322
+ parseOutput?: boolean;
323
+ sdk?: Client;
324
+ onProgress?: (progress: number) => void;
325
+ }
326
+
327
+ export const storageCreateFile = async ({bucketId,fileId,file,permissions,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}: StorageCreateFileRequestParams): Promise<any> => {
357
328
  let client = !sdk ? await sdkForProject() :
358
329
  sdk;
359
330
  let apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
@@ -470,19 +441,16 @@ const storageCreateFile = async ({bucketId,fileId,file,permissions,parseOutput =
470
441
 
471
442
  return response;
472
443
  }
473
- /**
474
- * @typedef {Object} StorageGetFileRequestParams
475
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
476
- * @property {string} fileId File ID.
477
- * @property {boolean} overrideForCli
478
- * @property {boolean} parseOutput
479
- * @property {libClient | undefined} sdk
480
- */
481
-
482
- /**
483
- * @param {StorageGetFileRequestParams} params
484
- */
485
- const storageGetFile = async ({bucketId,fileId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
444
+ interface StorageGetFileRequestParams {
445
+ bucketId: string;
446
+ fileId: string;
447
+ overrideForCli?: boolean;
448
+ parseOutput?: boolean;
449
+ sdk?: Client;
450
+ console?: boolean;
451
+ }
452
+
453
+ export const storageGetFile = async ({bucketId,fileId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: StorageGetFileRequestParams): Promise<any> => {
486
454
  let client = !sdk ? await sdkForProject() :
487
455
  sdk;
488
456
  let apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
@@ -494,7 +462,7 @@ const storageGetFile = async ({bucketId,fileId,parseOutput = true, overrideForCl
494
462
  }, payload);
495
463
 
496
464
  if (parseOutput) {
497
- if(console) {
465
+ if(showConsole) {
498
466
  showConsoleLink('storage', 'getFile', bucketId, fileId);
499
467
  } else {
500
468
  parse(response)
@@ -504,21 +472,17 @@ const storageGetFile = async ({bucketId,fileId,parseOutput = true, overrideForCl
504
472
  return response;
505
473
 
506
474
  }
507
- /**
508
- * @typedef {Object} StorageUpdateFileRequestParams
509
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
510
- * @property {string} fileId File unique ID.
511
- * @property {string} name Name of the file
512
- * @property {string[]} permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
513
- * @property {boolean} overrideForCli
514
- * @property {boolean} parseOutput
515
- * @property {libClient | undefined} sdk
516
- */
517
-
518
- /**
519
- * @param {StorageUpdateFileRequestParams} params
520
- */
521
- const storageUpdateFile = async ({bucketId,fileId,name,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
475
+ interface StorageUpdateFileRequestParams {
476
+ bucketId: string;
477
+ fileId: string;
478
+ name?: string;
479
+ permissions?: string[];
480
+ overrideForCli?: boolean;
481
+ parseOutput?: boolean;
482
+ sdk?: Client;
483
+ }
484
+
485
+ export const storageUpdateFile = async ({bucketId,fileId,name,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}: StorageUpdateFileRequestParams): Promise<any> => {
522
486
  let client = !sdk ? await sdkForProject() :
523
487
  sdk;
524
488
  let apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
@@ -544,19 +508,15 @@ const storageUpdateFile = async ({bucketId,fileId,name,permissions,parseOutput =
544
508
  return response;
545
509
 
546
510
  }
547
- /**
548
- * @typedef {Object} StorageDeleteFileRequestParams
549
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
550
- * @property {string} fileId File ID.
551
- * @property {boolean} overrideForCli
552
- * @property {boolean} parseOutput
553
- * @property {libClient | undefined} sdk
554
- */
555
-
556
- /**
557
- * @param {StorageDeleteFileRequestParams} params
558
- */
559
- const storageDeleteFile = async ({bucketId,fileId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
511
+ interface StorageDeleteFileRequestParams {
512
+ bucketId: string;
513
+ fileId: string;
514
+ overrideForCli?: boolean;
515
+ parseOutput?: boolean;
516
+ sdk?: Client;
517
+ }
518
+
519
+ export const storageDeleteFile = async ({bucketId,fileId,parseOutput = true, overrideForCli = false, sdk = undefined}: StorageDeleteFileRequestParams): Promise<any> => {
560
520
  let client = !sdk ? await sdkForProject() :
561
521
  sdk;
562
522
  let apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
@@ -575,21 +535,17 @@ const storageDeleteFile = async ({bucketId,fileId,parseOutput = true, overrideFo
575
535
  return response;
576
536
 
577
537
  }
578
- /**
579
- * @typedef {Object} StorageGetFileDownloadRequestParams
580
- * @property {string} bucketId Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
581
- * @property {string} fileId File ID.
582
- * @property {string} token File token for accessing this file.
583
- * @property {boolean} overrideForCli
584
- * @property {boolean} parseOutput
585
- * @property {libClient | undefined} sdk
586
- * @property {string} destination
587
- */
588
-
589
- /**
590
- * @param {StorageGetFileDownloadRequestParams} params
591
- */
592
- const storageGetFileDownload = async ({bucketId,fileId,token,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => {
538
+ interface StorageGetFileDownloadRequestParams {
539
+ bucketId: string;
540
+ fileId: string;
541
+ token?: string;
542
+ overrideForCli?: boolean;
543
+ parseOutput?: boolean;
544
+ sdk?: Client;
545
+ destination?: string;
546
+ }
547
+
548
+ export const storageGetFileDownload = async ({bucketId,fileId,token,parseOutput = true, overrideForCli = false, sdk = undefined, destination}: StorageGetFileDownloadRequestParams): Promise<any> => {
593
549
  let client = !sdk ? await sdkForProject() :
594
550
  sdk;
595
551
  let apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
@@ -621,32 +577,28 @@ const storageGetFileDownload = async ({bucketId,fileId,token,parseOutput = true,
621
577
  return response;
622
578
 
623
579
  }
624
- /**
625
- * @typedef {Object} StorageGetFilePreviewRequestParams
626
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
627
- * @property {string} fileId File ID
628
- * @property {number} width Resize preview image width, Pass an integer between 0 to 4000.
629
- * @property {number} height Resize preview image height, Pass an integer between 0 to 4000.
630
- * @property {ImageGravity} gravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
631
- * @property {number} quality Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
632
- * @property {number} borderWidth Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
633
- * @property {string} borderColor Preview image border color. Use a valid HEX color, no # is needed for prefix.
634
- * @property {number} borderRadius Preview image border radius in pixels. Pass an integer between 0 to 4000.
635
- * @property {number} opacity Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
636
- * @property {number} rotation Preview image rotation in degrees. Pass an integer between -360 and 360.
637
- * @property {string} background Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
638
- * @property {ImageFormat} output Output format type (jpeg, jpg, png, gif and webp).
639
- * @property {string} token File token for accessing this file.
640
- * @property {boolean} overrideForCli
641
- * @property {boolean} parseOutput
642
- * @property {libClient | undefined} sdk
643
- * @property {string} destination
644
- */
645
-
646
- /**
647
- * @param {StorageGetFilePreviewRequestParams} params
648
- */
649
- const storageGetFilePreview = async ({bucketId,fileId,width,height,gravity,quality,borderWidth,borderColor,borderRadius,opacity,rotation,background,output,token,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => {
580
+ interface StorageGetFilePreviewRequestParams {
581
+ bucketId: string;
582
+ fileId: string;
583
+ width?: number;
584
+ height?: number;
585
+ gravity?: ImageGravity;
586
+ quality?: number;
587
+ borderWidth?: number;
588
+ borderColor?: string;
589
+ borderRadius?: number;
590
+ opacity?: number;
591
+ rotation?: number;
592
+ background?: string;
593
+ output?: ImageFormat;
594
+ token?: string;
595
+ overrideForCli?: boolean;
596
+ parseOutput?: boolean;
597
+ sdk?: Client;
598
+ destination?: string;
599
+ }
600
+
601
+ export const storageGetFilePreview = async ({bucketId,fileId,width,height,gravity,quality,borderWidth,borderColor,borderRadius,opacity,rotation,background,output,token,parseOutput = true, overrideForCli = false, sdk = undefined, destination}: StorageGetFilePreviewRequestParams): Promise<any> => {
650
602
  let client = !sdk ? await sdkForProject() :
651
603
  sdk;
652
604
  let apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
@@ -711,21 +663,17 @@ const storageGetFilePreview = async ({bucketId,fileId,width,height,gravity,quali
711
663
  return response;
712
664
 
713
665
  }
714
- /**
715
- * @typedef {Object} StorageGetFileViewRequestParams
716
- * @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
717
- * @property {string} fileId File ID.
718
- * @property {string} token File token for accessing this file.
719
- * @property {boolean} overrideForCli
720
- * @property {boolean} parseOutput
721
- * @property {libClient | undefined} sdk
722
- * @property {string} destination
723
- */
724
-
725
- /**
726
- * @param {StorageGetFileViewRequestParams} params
727
- */
728
- const storageGetFileView = async ({bucketId,fileId,token,parseOutput = true, overrideForCli = false, sdk = undefined, destination}) => {
666
+ interface StorageGetFileViewRequestParams {
667
+ bucketId: string;
668
+ fileId: string;
669
+ token?: string;
670
+ overrideForCli?: boolean;
671
+ parseOutput?: boolean;
672
+ sdk?: Client;
673
+ destination?: string;
674
+ }
675
+
676
+ export const storageGetFileView = async ({bucketId,fileId,token,parseOutput = true, overrideForCli = false, sdk = undefined, destination}: StorageGetFileViewRequestParams): Promise<any> => {
729
677
  let client = !sdk ? await sdkForProject() :
730
678
  sdk;
731
679
  let apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
@@ -757,18 +705,14 @@ const storageGetFileView = async ({bucketId,fileId,token,parseOutput = true, ove
757
705
  return response;
758
706
 
759
707
  }
760
- /**
761
- * @typedef {Object} StorageGetUsageRequestParams
762
- * @property {UsageRange} range Date range.
763
- * @property {boolean} overrideForCli
764
- * @property {boolean} parseOutput
765
- * @property {libClient | undefined} sdk
766
- */
767
-
768
- /**
769
- * @param {StorageGetUsageRequestParams} params
770
- */
771
- const storageGetUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
708
+ interface StorageGetUsageRequestParams {
709
+ range?: UsageRange;
710
+ overrideForCli?: boolean;
711
+ parseOutput?: boolean;
712
+ sdk?: Client;
713
+ }
714
+
715
+ export const storageGetUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined}: StorageGetUsageRequestParams): Promise<any> => {
772
716
  let client = !sdk ? await sdkForProject() :
773
717
  sdk;
774
718
  let apiPath = '/storage/usage';
@@ -789,19 +733,16 @@ const storageGetUsage = async ({range,parseOutput = true, overrideForCli = false
789
733
  return response;
790
734
 
791
735
  }
792
- /**
793
- * @typedef {Object} StorageGetBucketUsageRequestParams
794
- * @property {string} bucketId Bucket ID.
795
- * @property {UsageRange} range Date range.
796
- * @property {boolean} overrideForCli
797
- * @property {boolean} parseOutput
798
- * @property {libClient | undefined} sdk
799
- */
800
-
801
- /**
802
- * @param {StorageGetBucketUsageRequestParams} params
803
- */
804
- const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
736
+ interface StorageGetBucketUsageRequestParams {
737
+ bucketId: string;
738
+ range?: UsageRange;
739
+ overrideForCli?: boolean;
740
+ parseOutput?: boolean;
741
+ sdk?: Client;
742
+ console?: boolean;
743
+ }
744
+
745
+ export const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: StorageGetBucketUsageRequestParams): Promise<any> => {
805
746
  let client = !sdk ? await sdkForProject() :
806
747
  sdk;
807
748
  let apiPath = '/storage/{bucketId}/usage'.replace('{bucketId}', bucketId);
@@ -816,7 +757,7 @@ const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrid
816
757
  }, payload);
817
758
 
818
759
  if (parseOutput) {
819
- if(console) {
760
+ if(showConsole) {
820
761
  showConsoleLink('storage', 'getBucketUsage', bucketId);
821
762
  } else {
822
763
  parse(response)
@@ -831,7 +772,7 @@ storage
831
772
  .description(`Get a list of all the storage buckets. You can use the query params to filter your results.`)
832
773
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations`)
833
774
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
834
- .option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
775
+ .option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
835
776
  .option(`--console`, `Get the resource console url`)
836
777
  .action(actionRunner(storageListBuckets))
837
778
 
@@ -841,14 +782,14 @@ storage
841
782
  .requiredOption(`--bucket-id <bucket-id>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
842
783
  .requiredOption(`--name <name>`, `Bucket name`)
843
784
  .option(`--permissions [permissions...]`, `An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
844
- .option(`--file-security [value]`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
845
- .option(`--enabled [value]`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
785
+ .option(`--file-security [value]`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value: string | undefined) => value === undefined ? true : parseBool(value))
786
+ .option(`--enabled [value]`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
846
787
  .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
847
788
  .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
848
789
  .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
849
- .option(`--encryption [value]`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
850
- .option(`--antivirus [value]`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
851
- .option(`--transformations [value]`, `Are image transformations enabled?`, (value) => value === undefined ? true : parseBool(value))
790
+ .option(`--encryption [value]`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, (value: string | undefined) => value === undefined ? true : parseBool(value))
791
+ .option(`--antivirus [value]`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, (value: string | undefined) => value === undefined ? true : parseBool(value))
792
+ .option(`--transformations [value]`, `Are image transformations enabled?`, (value: string | undefined) => value === undefined ? true : parseBool(value))
852
793
  .action(actionRunner(storageCreateBucket))
853
794
 
854
795
  storage
@@ -864,14 +805,14 @@ storage
864
805
  .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`)
865
806
  .requiredOption(`--name <name>`, `Bucket name`)
866
807
  .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
867
- .option(`--file-security [value]`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
868
- .option(`--enabled [value]`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
808
+ .option(`--file-security [value]`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value: string | undefined) => value === undefined ? true : parseBool(value))
809
+ .option(`--enabled [value]`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
869
810
  .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
870
811
  .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
871
812
  .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
872
- .option(`--encryption [value]`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
873
- .option(`--antivirus [value]`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
874
- .option(`--transformations [value]`, `Are image transformations enabled?`, (value) => value === undefined ? true : parseBool(value))
813
+ .option(`--encryption [value]`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, (value: string | undefined) => value === undefined ? true : parseBool(value))
814
+ .option(`--antivirus [value]`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, (value: string | undefined) => value === undefined ? true : parseBool(value))
815
+ .option(`--transformations [value]`, `Are image transformations enabled?`, (value: string | undefined) => value === undefined ? true : parseBool(value))
875
816
  .action(actionRunner(storageUpdateBucket))
876
817
 
877
818
  storage
@@ -886,7 +827,7 @@ storage
886
827
  .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
887
828
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded`)
888
829
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
889
- .option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
830
+ .option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
890
831
  .option(`--console`, `Get the resource console url`)
891
832
  .action(actionRunner(storageListFiles))
892
833
 
@@ -975,21 +916,4 @@ storage
975
916
  .option(`--console`, `Get the resource console url`)
976
917
  .action(actionRunner(storageGetBucketUsage))
977
918
 
978
- module.exports = {
979
- storage,
980
- storageListBuckets,
981
- storageCreateBucket,
982
- storageGetBucket,
983
- storageUpdateBucket,
984
- storageDeleteBucket,
985
- storageListFiles,
986
- storageCreateFile,
987
- storageGetFile,
988
- storageUpdateFile,
989
- storageDeleteFile,
990
- storageGetFileDownload,
991
- storageGetFilePreview,
992
- storageGetFileView,
993
- storageGetUsage,
994
- storageGetBucketUsage
995
- };
919
+