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 functions = new Command("functions").description(commandDescriptions['functions'] ?? '').configureHelp({
34
+ export const functions = new Command("functions").description(commandDescriptions['functions'] ?? '').configureHelp({
39
35
  helpWidth: process.stdout.columns || 80
40
36
  })
41
37
 
42
- /**
43
- * @typedef {Object} FunctionsListRequestParams
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: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
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 {FunctionsListRequestParams} params
54
- */
55
- const functionsList = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
38
+ interface FunctionsListRequestParams {
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 functionsList = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListRequestParams): Promise<any> => {
56
49
  let client = !sdk ? await sdkForProject() :
57
50
  sdk;
58
51
  let apiPath = '/functions';
@@ -73,7 +66,7 @@ const functionsList = async ({queries,search,total,parseOutput = true, overrideF
73
66
  }, payload);
74
67
 
75
68
  if (parseOutput) {
76
- if(console) {
69
+ if(showConsole) {
77
70
  showConsoleLink('functions', 'list');
78
71
  } else {
79
72
  parse(response)
@@ -83,35 +76,31 @@ const functionsList = async ({queries,search,total,parseOutput = true, overrideF
83
76
  return response;
84
77
 
85
78
  }
86
- /**
87
- * @typedef {Object} FunctionsCreateRequestParams
88
- * @property {string} functionId Function 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 Function name. Max length: 128 chars.
90
- * @property {Runtime} runtime Execution runtime.
91
- * @property {string[]} execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
92
- * @property {string[]} events Events list. Maximum of 100 events are allowed.
93
- * @property {string} schedule Schedule CRON syntax.
94
- * @property {number} timeout Function maximum execution time in seconds.
95
- * @property {boolean} enabled Is function enabled? When set to &#039;disabled&#039;, users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
96
- * @property {boolean} logging When disabled, executions will exclude logs and errors, and will be slightly faster.
97
- * @property {string} entrypoint Entrypoint File. This path is relative to the &quot;providerRootDirectory&quot;.
98
- * @property {string} commands Build Commands.
99
- * @property {string[]} scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
100
- * @property {string} installationId Appwrite Installation ID for VCS (Version Control System) deployment.
101
- * @property {string} providerRepositoryId Repository ID of the repo linked to the function.
102
- * @property {string} providerBranch Production branch for the repo linked to the function.
103
- * @property {boolean} providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
104
- * @property {string} providerRootDirectory Path to function code in the linked repo.
105
- * @property {string} specification Runtime specification for the function and builds.
106
- * @property {boolean} overrideForCli
107
- * @property {boolean} parseOutput
108
- * @property {libClient | undefined} sdk
109
- */
110
-
111
- /**
112
- * @param {FunctionsCreateRequestParams} params
113
- */
114
- const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
79
+ interface FunctionsCreateRequestParams {
80
+ functionId: string;
81
+ name: string;
82
+ runtime: Runtime;
83
+ execute?: string[];
84
+ events?: string[];
85
+ schedule?: string;
86
+ timeout?: number;
87
+ enabled?: boolean;
88
+ logging?: boolean;
89
+ entrypoint?: string;
90
+ commands?: string;
91
+ scopes?: string[];
92
+ installationId?: string;
93
+ providerRepositoryId?: string;
94
+ providerBranch?: string;
95
+ providerSilentMode?: boolean;
96
+ providerRootDirectory?: string;
97
+ specification?: string;
98
+ overrideForCli?: boolean;
99
+ parseOutput?: boolean;
100
+ sdk?: Client;
101
+ }
102
+
103
+ export const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateRequestParams): Promise<any> => {
115
104
  let client = !sdk ? await sdkForProject() :
116
105
  sdk;
117
106
  let apiPath = '/functions';
@@ -187,17 +176,13 @@ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,
187
176
  return response;
188
177
 
189
178
  }
190
- /**
191
- * @typedef {Object} FunctionsListRuntimesRequestParams
192
- * @property {boolean} overrideForCli
193
- * @property {boolean} parseOutput
194
- * @property {libClient | undefined} sdk
195
- */
196
-
197
- /**
198
- * @param {FunctionsListRuntimesRequestParams} params
199
- */
200
- const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false, sdk = undefined}) => {
179
+ interface FunctionsListRuntimesRequestParams {
180
+ overrideForCli?: boolean;
181
+ parseOutput?: boolean;
182
+ sdk?: Client;
183
+ }
184
+
185
+ export const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsListRuntimesRequestParams): Promise<any> => {
201
186
  let client = !sdk ? await sdkForProject() :
202
187
  sdk;
203
188
  let apiPath = '/functions/runtimes';
@@ -215,17 +200,14 @@ const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false
215
200
  return response;
216
201
 
217
202
  }
218
- /**
219
- * @typedef {Object} FunctionsListSpecificationsRequestParams
220
- * @property {boolean} overrideForCli
221
- * @property {boolean} parseOutput
222
- * @property {libClient | undefined} sdk
223
- */
224
-
225
- /**
226
- * @param {FunctionsListSpecificationsRequestParams} params
227
- */
228
- const functionsListSpecifications = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
203
+ interface FunctionsListSpecificationsRequestParams {
204
+ overrideForCli?: boolean;
205
+ parseOutput?: boolean;
206
+ sdk?: Client;
207
+ console?: boolean;
208
+ }
209
+
210
+ export const functionsListSpecifications = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListSpecificationsRequestParams): Promise<any> => {
229
211
  let client = !sdk ? await sdkForProject() :
230
212
  sdk;
231
213
  let apiPath = '/functions/specifications';
@@ -237,7 +219,7 @@ const functionsListSpecifications = async ({parseOutput = true, overrideForCli =
237
219
  }, payload);
238
220
 
239
221
  if (parseOutput) {
240
- if(console) {
222
+ if(showConsole) {
241
223
  showConsoleLink('functions', 'listSpecifications');
242
224
  } else {
243
225
  parse(response)
@@ -247,22 +229,19 @@ const functionsListSpecifications = async ({parseOutput = true, overrideForCli =
247
229
  return response;
248
230
 
249
231
  }
250
- /**
251
- * @typedef {Object} FunctionsListTemplatesRequestParams
252
- * @property {string[]} runtimes List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.
253
- * @property {string[]} useCases List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.
254
- * @property {number} limit Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.
255
- * @property {number} offset Offset the list of returned templates. Maximum offset is 5000.
256
- * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
257
- * @property {boolean} overrideForCli
258
- * @property {boolean} parseOutput
259
- * @property {libClient | undefined} sdk
260
- */
261
-
262
- /**
263
- * @param {FunctionsListTemplatesRequestParams} params
264
- */
265
- const functionsListTemplates = async ({runtimes,useCases,limit,offset,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
232
+ interface FunctionsListTemplatesRequestParams {
233
+ runtimes?: string[];
234
+ useCases?: string[];
235
+ limit?: number;
236
+ offset?: number;
237
+ total?: boolean;
238
+ overrideForCli?: boolean;
239
+ parseOutput?: boolean;
240
+ sdk?: Client;
241
+ console?: boolean;
242
+ }
243
+
244
+ export const functionsListTemplates = async ({runtimes,useCases,limit,offset,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListTemplatesRequestParams): Promise<any> => {
266
245
  let client = !sdk ? await sdkForProject() :
267
246
  sdk;
268
247
  let apiPath = '/functions/templates';
@@ -289,7 +268,7 @@ const functionsListTemplates = async ({runtimes,useCases,limit,offset,total,pars
289
268
  }, payload);
290
269
 
291
270
  if (parseOutput) {
292
- if(console) {
271
+ if(showConsole) {
293
272
  showConsoleLink('functions', 'listTemplates');
294
273
  } else {
295
274
  parse(response)
@@ -299,18 +278,15 @@ const functionsListTemplates = async ({runtimes,useCases,limit,offset,total,pars
299
278
  return response;
300
279
 
301
280
  }
302
- /**
303
- * @typedef {Object} FunctionsGetTemplateRequestParams
304
- * @property {string} templateId Template ID.
305
- * @property {boolean} overrideForCli
306
- * @property {boolean} parseOutput
307
- * @property {libClient | undefined} sdk
308
- */
309
-
310
- /**
311
- * @param {FunctionsGetTemplateRequestParams} params
312
- */
313
- const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
281
+ interface FunctionsGetTemplateRequestParams {
282
+ templateId: string;
283
+ overrideForCli?: boolean;
284
+ parseOutput?: boolean;
285
+ sdk?: Client;
286
+ console?: boolean;
287
+ }
288
+
289
+ export const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetTemplateRequestParams): Promise<any> => {
314
290
  let client = !sdk ? await sdkForProject() :
315
291
  sdk;
316
292
  let apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId);
@@ -322,7 +298,7 @@ const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForC
322
298
  }, payload);
323
299
 
324
300
  if (parseOutput) {
325
- if(console) {
301
+ if(showConsole) {
326
302
  showConsoleLink('functions', 'getTemplate', templateId);
327
303
  } else {
328
304
  parse(response)
@@ -332,18 +308,15 @@ const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForC
332
308
  return response;
333
309
 
334
310
  }
335
- /**
336
- * @typedef {Object} FunctionsListUsageRequestParams
337
- * @property {UsageRange} range Date range.
338
- * @property {boolean} overrideForCli
339
- * @property {boolean} parseOutput
340
- * @property {libClient | undefined} sdk
341
- */
342
-
343
- /**
344
- * @param {FunctionsListUsageRequestParams} params
345
- */
346
- const functionsListUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
311
+ interface FunctionsListUsageRequestParams {
312
+ range?: UsageRange;
313
+ overrideForCli?: boolean;
314
+ parseOutput?: boolean;
315
+ sdk?: Client;
316
+ console?: boolean;
317
+ }
318
+
319
+ export const functionsListUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListUsageRequestParams): Promise<any> => {
347
320
  let client = !sdk ? await sdkForProject() :
348
321
  sdk;
349
322
  let apiPath = '/functions/usage';
@@ -358,7 +331,7 @@ const functionsListUsage = async ({range,parseOutput = true, overrideForCli = fa
358
331
  }, payload);
359
332
 
360
333
  if (parseOutput) {
361
- if(console) {
334
+ if(showConsole) {
362
335
  showConsoleLink('functions', 'listUsage');
363
336
  } else {
364
337
  parse(response)
@@ -368,18 +341,15 @@ const functionsListUsage = async ({range,parseOutput = true, overrideForCli = fa
368
341
  return response;
369
342
 
370
343
  }
371
- /**
372
- * @typedef {Object} FunctionsGetRequestParams
373
- * @property {string} functionId Function ID.
374
- * @property {boolean} overrideForCli
375
- * @property {boolean} parseOutput
376
- * @property {libClient | undefined} sdk
377
- */
378
-
379
- /**
380
- * @param {FunctionsGetRequestParams} params
381
- */
382
- const functionsGet = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
344
+ interface FunctionsGetRequestParams {
345
+ functionId: string;
346
+ overrideForCli?: boolean;
347
+ parseOutput?: boolean;
348
+ sdk?: Client;
349
+ console?: boolean;
350
+ }
351
+
352
+ export const functionsGet = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetRequestParams): Promise<any> => {
383
353
  let client = !sdk ? await sdkForProject() :
384
354
  sdk;
385
355
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
@@ -391,7 +361,7 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
391
361
  }, payload);
392
362
 
393
363
  if (parseOutput) {
394
- if(console) {
364
+ if(showConsole) {
395
365
  showConsoleLink('functions', 'get', functionId);
396
366
  } else {
397
367
  parse(response)
@@ -401,35 +371,31 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
401
371
  return response;
402
372
 
403
373
  }
404
- /**
405
- * @typedef {Object} FunctionsUpdateRequestParams
406
- * @property {string} functionId Function ID.
407
- * @property {string} name Function name. Max length: 128 chars.
408
- * @property {Runtime} runtime Execution runtime.
409
- * @property {string[]} execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
410
- * @property {string[]} events Events list. Maximum of 100 events are allowed.
411
- * @property {string} schedule Schedule CRON syntax.
412
- * @property {number} timeout Maximum execution time in seconds.
413
- * @property {boolean} enabled Is function enabled? When set to &#039;disabled&#039;, users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
414
- * @property {boolean} logging When disabled, executions will exclude logs and errors, and will be slightly faster.
415
- * @property {string} entrypoint Entrypoint File. This path is relative to the &quot;providerRootDirectory&quot;.
416
- * @property {string} commands Build Commands.
417
- * @property {string[]} scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
418
- * @property {string} installationId Appwrite Installation ID for VCS (Version Controle System) deployment.
419
- * @property {string} providerRepositoryId Repository ID of the repo linked to the function
420
- * @property {string} providerBranch Production branch for the repo linked to the function
421
- * @property {boolean} providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
422
- * @property {string} providerRootDirectory Path to function code in the linked repo.
423
- * @property {string} specification Runtime specification for the function and builds.
424
- * @property {boolean} overrideForCli
425
- * @property {boolean} parseOutput
426
- * @property {libClient | undefined} sdk
427
- */
428
-
429
- /**
430
- * @param {FunctionsUpdateRequestParams} params
431
- */
432
- const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
374
+ interface FunctionsUpdateRequestParams {
375
+ functionId: string;
376
+ name: string;
377
+ runtime?: Runtime;
378
+ execute?: string[];
379
+ events?: string[];
380
+ schedule?: string;
381
+ timeout?: number;
382
+ enabled?: boolean;
383
+ logging?: boolean;
384
+ entrypoint?: string;
385
+ commands?: string;
386
+ scopes?: string[];
387
+ installationId?: string;
388
+ providerRepositoryId?: string;
389
+ providerBranch?: string;
390
+ providerSilentMode?: boolean;
391
+ providerRootDirectory?: string;
392
+ specification?: string;
393
+ overrideForCli?: boolean;
394
+ parseOutput?: boolean;
395
+ sdk?: Client;
396
+ }
397
+
398
+ export const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateRequestParams): Promise<any> => {
433
399
  let client = !sdk ? await sdkForProject() :
434
400
  sdk;
435
401
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
@@ -502,18 +468,14 @@ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,
502
468
  return response;
503
469
 
504
470
  }
505
- /**
506
- * @typedef {Object} FunctionsDeleteRequestParams
507
- * @property {string} functionId Function ID.
508
- * @property {boolean} overrideForCli
509
- * @property {boolean} parseOutput
510
- * @property {libClient | undefined} sdk
511
- */
512
-
513
- /**
514
- * @param {FunctionsDeleteRequestParams} params
515
- */
516
- const functionsDelete = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
471
+ interface FunctionsDeleteRequestParams {
472
+ functionId: string;
473
+ overrideForCli?: boolean;
474
+ parseOutput?: boolean;
475
+ sdk?: Client;
476
+ }
477
+
478
+ export const functionsDelete = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteRequestParams): Promise<any> => {
517
479
  let client = !sdk ? await sdkForProject() :
518
480
  sdk;
519
481
  let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
@@ -532,19 +494,15 @@ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli =
532
494
  return response;
533
495
 
534
496
  }
535
- /**
536
- * @typedef {Object} FunctionsUpdateFunctionDeploymentRequestParams
537
- * @property {string} functionId Function ID.
538
- * @property {string} deploymentId Deployment ID.
539
- * @property {boolean} overrideForCli
540
- * @property {boolean} parseOutput
541
- * @property {libClient | undefined} sdk
542
- */
543
-
544
- /**
545
- * @param {FunctionsUpdateFunctionDeploymentRequestParams} params
546
- */
547
- const functionsUpdateFunctionDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
497
+ interface FunctionsUpdateFunctionDeploymentRequestParams {
498
+ functionId: string;
499
+ deploymentId: string;
500
+ overrideForCli?: boolean;
501
+ parseOutput?: boolean;
502
+ sdk?: Client;
503
+ }
504
+
505
+ export const functionsUpdateFunctionDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateFunctionDeploymentRequestParams): Promise<any> => {
548
506
  let client = !sdk ? await sdkForProject() :
549
507
  sdk;
550
508
  let apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId);
@@ -566,21 +524,18 @@ const functionsUpdateFunctionDeployment = async ({functionId,deploymentId,parseO
566
524
  return response;
567
525
 
568
526
  }
569
- /**
570
- * @typedef {Object} FunctionsListDeploymentsRequestParams
571
- * @property {string} functionId Function ID.
572
- * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
573
- * @property {string} search Search term to filter your list results. Max length: 256 chars.
574
- * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
575
- * @property {boolean} overrideForCli
576
- * @property {boolean} parseOutput
577
- * @property {libClient | undefined} sdk
578
- */
579
-
580
- /**
581
- * @param {FunctionsListDeploymentsRequestParams} params
582
- */
583
- const functionsListDeployments = async ({functionId,queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
527
+ interface FunctionsListDeploymentsRequestParams {
528
+ functionId: string;
529
+ queries?: string[];
530
+ search?: string;
531
+ total?: boolean;
532
+ overrideForCli?: boolean;
533
+ parseOutput?: boolean;
534
+ sdk?: Client;
535
+ console?: boolean;
536
+ }
537
+
538
+ export const functionsListDeployments = async ({functionId,queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListDeploymentsRequestParams): Promise<any> => {
584
539
  let client = !sdk ? await sdkForProject() :
585
540
  sdk;
586
541
  let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
@@ -601,7 +556,7 @@ const functionsListDeployments = async ({functionId,queries,search,total,parseOu
601
556
  }, payload);
602
557
 
603
558
  if (parseOutput) {
604
- if(console) {
559
+ if(showConsole) {
605
560
  showConsoleLink('functions', 'listDeployments', functionId);
606
561
  } else {
607
562
  parse(response)
@@ -611,23 +566,19 @@ const functionsListDeployments = async ({functionId,queries,search,total,parseOu
611
566
  return response;
612
567
 
613
568
  }
614
- /**
615
- * @typedef {Object} FunctionsCreateDeploymentRequestParams
616
- * @property {string} functionId Function ID.
617
- * @property {string} code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
618
- * @property {boolean} activate Automatically activate the deployment when it is finished building.
619
- * @property {string} entrypoint Entrypoint File.
620
- * @property {string} commands Build Commands.
621
- * @property {boolean} overrideForCli
622
- * @property {boolean} parseOutput
623
- * @property {libClient | undefined} sdk
624
- * @property {CallableFunction} onProgress
625
- */
626
-
627
- /**
628
- * @param {FunctionsCreateDeploymentRequestParams} params
629
- */
630
- const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,commands,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}) => {
569
+ interface FunctionsCreateDeploymentRequestParams {
570
+ functionId: string;
571
+ code: string;
572
+ activate: boolean;
573
+ entrypoint?: string;
574
+ commands?: string;
575
+ overrideForCli?: boolean;
576
+ parseOutput?: boolean;
577
+ sdk?: Client;
578
+ onProgress?: (progress: number) => void;
579
+ }
580
+
581
+ export const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,commands,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}: FunctionsCreateDeploymentRequestParams): Promise<any> => {
631
582
  let client = !sdk ? await sdkForProject() :
632
583
  sdk;
633
584
  let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
@@ -775,20 +726,16 @@ const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,co
775
726
 
776
727
  return response;
777
728
  }
778
- /**
779
- * @typedef {Object} FunctionsCreateDuplicateDeploymentRequestParams
780
- * @property {string} functionId Function ID.
781
- * @property {string} deploymentId Deployment ID.
782
- * @property {string} buildId Build unique ID.
783
- * @property {boolean} overrideForCli
784
- * @property {boolean} parseOutput
785
- * @property {libClient | undefined} sdk
786
- */
787
-
788
- /**
789
- * @param {FunctionsCreateDuplicateDeploymentRequestParams} params
790
- */
791
- const functionsCreateDuplicateDeployment = async ({functionId,deploymentId,buildId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
729
+ interface FunctionsCreateDuplicateDeploymentRequestParams {
730
+ functionId: string;
731
+ deploymentId: string;
732
+ buildId?: string;
733
+ overrideForCli?: boolean;
734
+ parseOutput?: boolean;
735
+ sdk?: Client;
736
+ }
737
+
738
+ export const functionsCreateDuplicateDeployment = async ({functionId,deploymentId,buildId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateDuplicateDeploymentRequestParams): Promise<any> => {
792
739
  let client = !sdk ? await sdkForProject() :
793
740
  sdk;
794
741
  let apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId);
@@ -813,24 +760,20 @@ const functionsCreateDuplicateDeployment = async ({functionId,deploymentId,build
813
760
  return response;
814
761
 
815
762
  }
816
- /**
817
- * @typedef {Object} FunctionsCreateTemplateDeploymentRequestParams
818
- * @property {string} functionId Function ID.
819
- * @property {string} repository Repository name of the template.
820
- * @property {string} owner The name of the owner of the template.
821
- * @property {string} rootDirectory Path to function code in the template repo.
822
- * @property {TemplateReferenceType} type Type for the reference provided. Can be commit, branch, or tag
823
- * @property {string} reference Reference value, can be a commit hash, branch name, or release tag
824
- * @property {boolean} activate Automatically activate the deployment when it is finished building.
825
- * @property {boolean} overrideForCli
826
- * @property {boolean} parseOutput
827
- * @property {libClient | undefined} sdk
828
- */
829
-
830
- /**
831
- * @param {FunctionsCreateTemplateDeploymentRequestParams} params
832
- */
833
- const functionsCreateTemplateDeployment = async ({functionId,repository,owner,rootDirectory,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
763
+ interface FunctionsCreateTemplateDeploymentRequestParams {
764
+ functionId: string;
765
+ repository: string;
766
+ owner: string;
767
+ rootDirectory: string;
768
+ type: TemplateReferenceType;
769
+ reference: string;
770
+ activate?: boolean;
771
+ overrideForCli?: boolean;
772
+ parseOutput?: boolean;
773
+ sdk?: Client;
774
+ }
775
+
776
+ export const functionsCreateTemplateDeployment = async ({functionId,repository,owner,rootDirectory,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateTemplateDeploymentRequestParams): Promise<any> => {
834
777
  let client = !sdk ? await sdkForProject() :
835
778
  sdk;
836
779
  let apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId);
@@ -867,21 +810,17 @@ const functionsCreateTemplateDeployment = async ({functionId,repository,owner,ro
867
810
  return response;
868
811
 
869
812
  }
870
- /**
871
- * @typedef {Object} FunctionsCreateVcsDeploymentRequestParams
872
- * @property {string} functionId Function ID.
873
- * @property {VCSReferenceType} type Type of reference passed. Allowed values are: branch, commit
874
- * @property {string} reference VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
875
- * @property {boolean} activate Automatically activate the deployment when it is finished building.
876
- * @property {boolean} overrideForCli
877
- * @property {boolean} parseOutput
878
- * @property {libClient | undefined} sdk
879
- */
880
-
881
- /**
882
- * @param {FunctionsCreateVcsDeploymentRequestParams} params
883
- */
884
- const functionsCreateVcsDeployment = async ({functionId,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
813
+ interface FunctionsCreateVcsDeploymentRequestParams {
814
+ functionId: string;
815
+ type: VCSReferenceType;
816
+ reference: string;
817
+ activate?: boolean;
818
+ overrideForCli?: boolean;
819
+ parseOutput?: boolean;
820
+ sdk?: Client;
821
+ }
822
+
823
+ export const functionsCreateVcsDeployment = async ({functionId,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateVcsDeploymentRequestParams): Promise<any> => {
885
824
  let client = !sdk ? await sdkForProject() :
886
825
  sdk;
887
826
  let apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId);
@@ -909,19 +848,16 @@ const functionsCreateVcsDeployment = async ({functionId,type,reference,activate,
909
848
  return response;
910
849
 
911
850
  }
912
- /**
913
- * @typedef {Object} FunctionsGetDeploymentRequestParams
914
- * @property {string} functionId Function ID.
915
- * @property {string} deploymentId Deployment ID.
916
- * @property {boolean} overrideForCli
917
- * @property {boolean} parseOutput
918
- * @property {libClient | undefined} sdk
919
- */
920
-
921
- /**
922
- * @param {FunctionsGetDeploymentRequestParams} params
923
- */
924
- const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
851
+ interface FunctionsGetDeploymentRequestParams {
852
+ functionId: string;
853
+ deploymentId: string;
854
+ overrideForCli?: boolean;
855
+ parseOutput?: boolean;
856
+ sdk?: Client;
857
+ console?: boolean;
858
+ }
859
+
860
+ export const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetDeploymentRequestParams): Promise<any> => {
925
861
  let client = !sdk ? await sdkForProject() :
926
862
  sdk;
927
863
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
@@ -933,7 +869,7 @@ const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = tru
933
869
  }, payload);
934
870
 
935
871
  if (parseOutput) {
936
- if(console) {
872
+ if(showConsole) {
937
873
  showConsoleLink('functions', 'getDeployment', functionId, deploymentId);
938
874
  } else {
939
875
  parse(response)
@@ -943,19 +879,15 @@ const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = tru
943
879
  return response;
944
880
 
945
881
  }
946
- /**
947
- * @typedef {Object} FunctionsDeleteDeploymentRequestParams
948
- * @property {string} functionId Function ID.
949
- * @property {string} deploymentId Deployment ID.
950
- * @property {boolean} overrideForCli
951
- * @property {boolean} parseOutput
952
- * @property {libClient | undefined} sdk
953
- */
954
-
955
- /**
956
- * @param {FunctionsDeleteDeploymentRequestParams} params
957
- */
958
- const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
882
+ interface FunctionsDeleteDeploymentRequestParams {
883
+ functionId: string;
884
+ deploymentId: string;
885
+ overrideForCli?: boolean;
886
+ parseOutput?: boolean;
887
+ sdk?: Client;
888
+ }
889
+
890
+ export const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteDeploymentRequestParams): Promise<any> => {
959
891
  let client = !sdk ? await sdkForProject() :
960
892
  sdk;
961
893
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
@@ -974,21 +906,18 @@ const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput =
974
906
  return response;
975
907
 
976
908
  }
977
- /**
978
- * @typedef {Object} FunctionsGetDeploymentDownloadRequestParams
979
- * @property {string} functionId Function ID.
980
- * @property {string} deploymentId Deployment ID.
981
- * @property {DeploymentDownloadType} type Deployment file to download. Can be: &quot;source&quot;, &quot;output&quot;.
982
- * @property {boolean} overrideForCli
983
- * @property {boolean} parseOutput
984
- * @property {libClient | undefined} sdk
985
- * @property {string} destination
986
- */
987
-
988
- /**
989
- * @param {FunctionsGetDeploymentDownloadRequestParams} params
990
- */
991
- const functionsGetDeploymentDownload = async ({functionId,deploymentId,type,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console}) => {
909
+ interface FunctionsGetDeploymentDownloadRequestParams {
910
+ functionId: string;
911
+ deploymentId: string;
912
+ type?: DeploymentDownloadType;
913
+ overrideForCli?: boolean;
914
+ parseOutput?: boolean;
915
+ sdk?: Client;
916
+ destination?: string;
917
+ console?: boolean;
918
+ }
919
+
920
+ export const functionsGetDeploymentDownload = async ({functionId,deploymentId,type,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console: showConsole}: FunctionsGetDeploymentDownloadRequestParams): Promise<any> => {
992
921
  let client = !sdk ? await sdkForProject() :
993
922
  sdk;
994
923
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
@@ -1014,7 +943,7 @@ const functionsGetDeploymentDownload = async ({functionId,deploymentId,type,pars
1014
943
 
1015
944
  fs.writeFileSync(destination, response);
1016
945
  if (parseOutput) {
1017
- if(console) {
946
+ if(showConsole) {
1018
947
  showConsoleLink('functions', 'getDeploymentDownload', functionId, deploymentId);
1019
948
  } else {
1020
949
  parse(response)
@@ -1024,19 +953,15 @@ const functionsGetDeploymentDownload = async ({functionId,deploymentId,type,pars
1024
953
  return response;
1025
954
 
1026
955
  }
1027
- /**
1028
- * @typedef {Object} FunctionsUpdateDeploymentStatusRequestParams
1029
- * @property {string} functionId Function ID.
1030
- * @property {string} deploymentId Deployment ID.
1031
- * @property {boolean} overrideForCli
1032
- * @property {boolean} parseOutput
1033
- * @property {libClient | undefined} sdk
1034
- */
1035
-
1036
- /**
1037
- * @param {FunctionsUpdateDeploymentStatusRequestParams} params
1038
- */
1039
- const functionsUpdateDeploymentStatus = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
956
+ interface FunctionsUpdateDeploymentStatusRequestParams {
957
+ functionId: string;
958
+ deploymentId: string;
959
+ overrideForCli?: boolean;
960
+ parseOutput?: boolean;
961
+ sdk?: Client;
962
+ }
963
+
964
+ export const functionsUpdateDeploymentStatus = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateDeploymentStatusRequestParams): Promise<any> => {
1040
965
  let client = !sdk ? await sdkForProject() :
1041
966
  sdk;
1042
967
  let apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
@@ -1055,20 +980,17 @@ const functionsUpdateDeploymentStatus = async ({functionId,deploymentId,parseOut
1055
980
  return response;
1056
981
 
1057
982
  }
1058
- /**
1059
- * @typedef {Object} FunctionsListExecutionsRequestParams
1060
- * @property {string} functionId Function ID.
1061
- * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
1062
- * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
1063
- * @property {boolean} overrideForCli
1064
- * @property {boolean} parseOutput
1065
- * @property {libClient | undefined} sdk
1066
- */
1067
-
1068
- /**
1069
- * @param {FunctionsListExecutionsRequestParams} params
1070
- */
1071
- const functionsListExecutions = async ({functionId,queries,total,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
983
+ interface FunctionsListExecutionsRequestParams {
984
+ functionId: string;
985
+ queries?: string[];
986
+ total?: boolean;
987
+ overrideForCli?: boolean;
988
+ parseOutput?: boolean;
989
+ sdk?: Client;
990
+ console?: boolean;
991
+ }
992
+
993
+ export const functionsListExecutions = async ({functionId,queries,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListExecutionsRequestParams): Promise<any> => {
1072
994
  let client = !sdk ? await sdkForProject() :
1073
995
  sdk;
1074
996
  let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
@@ -1086,7 +1008,7 @@ const functionsListExecutions = async ({functionId,queries,total,parseOutput = t
1086
1008
  }, payload);
1087
1009
 
1088
1010
  if (parseOutput) {
1089
- if(console) {
1011
+ if(showConsole) {
1090
1012
  showConsoleLink('functions', 'listExecutions', functionId);
1091
1013
  } else {
1092
1014
  parse(response)
@@ -1096,24 +1018,20 @@ const functionsListExecutions = async ({functionId,queries,total,parseOutput = t
1096
1018
  return response;
1097
1019
 
1098
1020
  }
1099
- /**
1100
- * @typedef {Object} FunctionsCreateExecutionRequestParams
1101
- * @property {string} functionId Function ID.
1102
- * @property {string} body HTTP body of execution. Default value is empty string.
1103
- * @property {boolean} async Execute code in the background. Default value is false.
1104
- * @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
1105
- * @property {ExecutionMethod} method HTTP method of execution. Default value is POST.
1106
- * @property {object} headers HTTP headers of execution. Defaults to empty.
1107
- * @property {string} scheduledAt Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
1108
- * @property {boolean} overrideForCli
1109
- * @property {boolean} parseOutput
1110
- * @property {libClient | undefined} sdk
1111
- */
1112
-
1113
- /**
1114
- * @param {FunctionsCreateExecutionRequestParams} params
1115
- */
1116
- const functionsCreateExecution = async ({functionId,body,async,xpath,method,headers,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1021
+ interface FunctionsCreateExecutionRequestParams {
1022
+ functionId: string;
1023
+ body?: string;
1024
+ async?: boolean;
1025
+ xpath?: string;
1026
+ method?: ExecutionMethod;
1027
+ headers?: object;
1028
+ scheduledAt?: string;
1029
+ overrideForCli?: boolean;
1030
+ parseOutput?: boolean;
1031
+ sdk?: Client;
1032
+ }
1033
+
1034
+ export const functionsCreateExecution = async ({functionId,body,async,xpath,method,headers,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateExecutionRequestParams): Promise<any> => {
1117
1035
  let client = !sdk ? await sdkForProject() :
1118
1036
  sdk;
1119
1037
  let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
@@ -1150,19 +1068,16 @@ const functionsCreateExecution = async ({functionId,body,async,xpath,method,head
1150
1068
  return response;
1151
1069
 
1152
1070
  }
1153
- /**
1154
- * @typedef {Object} FunctionsGetExecutionRequestParams
1155
- * @property {string} functionId Function ID.
1156
- * @property {string} executionId Execution ID.
1157
- * @property {boolean} overrideForCli
1158
- * @property {boolean} parseOutput
1159
- * @property {libClient | undefined} sdk
1160
- */
1161
-
1162
- /**
1163
- * @param {FunctionsGetExecutionRequestParams} params
1164
- */
1165
- const functionsGetExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1071
+ interface FunctionsGetExecutionRequestParams {
1072
+ functionId: string;
1073
+ executionId: string;
1074
+ overrideForCli?: boolean;
1075
+ parseOutput?: boolean;
1076
+ sdk?: Client;
1077
+ console?: boolean;
1078
+ }
1079
+
1080
+ export const functionsGetExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetExecutionRequestParams): Promise<any> => {
1166
1081
  let client = !sdk ? await sdkForProject() :
1167
1082
  sdk;
1168
1083
  let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
@@ -1174,7 +1089,7 @@ const functionsGetExecution = async ({functionId,executionId,parseOutput = true,
1174
1089
  }, payload);
1175
1090
 
1176
1091
  if (parseOutput) {
1177
- if(console) {
1092
+ if(showConsole) {
1178
1093
  showConsoleLink('functions', 'getExecution', functionId, executionId);
1179
1094
  } else {
1180
1095
  parse(response)
@@ -1184,19 +1099,15 @@ const functionsGetExecution = async ({functionId,executionId,parseOutput = true,
1184
1099
  return response;
1185
1100
 
1186
1101
  }
1187
- /**
1188
- * @typedef {Object} FunctionsDeleteExecutionRequestParams
1189
- * @property {string} functionId Function ID.
1190
- * @property {string} executionId Execution ID.
1191
- * @property {boolean} overrideForCli
1192
- * @property {boolean} parseOutput
1193
- * @property {libClient | undefined} sdk
1194
- */
1195
-
1196
- /**
1197
- * @param {FunctionsDeleteExecutionRequestParams} params
1198
- */
1199
- const functionsDeleteExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1102
+ interface FunctionsDeleteExecutionRequestParams {
1103
+ functionId: string;
1104
+ executionId: string;
1105
+ overrideForCli?: boolean;
1106
+ parseOutput?: boolean;
1107
+ sdk?: Client;
1108
+ }
1109
+
1110
+ export const functionsDeleteExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteExecutionRequestParams): Promise<any> => {
1200
1111
  let client = !sdk ? await sdkForProject() :
1201
1112
  sdk;
1202
1113
  let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
@@ -1215,19 +1126,15 @@ const functionsDeleteExecution = async ({functionId,executionId,parseOutput = tr
1215
1126
  return response;
1216
1127
 
1217
1128
  }
1218
- /**
1219
- * @typedef {Object} FunctionsGetUsageRequestParams
1220
- * @property {string} functionId Function ID.
1221
- * @property {UsageRange} range Date range.
1222
- * @property {boolean} overrideForCli
1223
- * @property {boolean} parseOutput
1224
- * @property {libClient | undefined} sdk
1225
- */
1226
-
1227
- /**
1228
- * @param {FunctionsGetUsageRequestParams} params
1229
- */
1230
- const functionsGetUsage = async ({functionId,range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1129
+ interface FunctionsGetUsageRequestParams {
1130
+ functionId: string;
1131
+ range?: UsageRange;
1132
+ overrideForCli?: boolean;
1133
+ parseOutput?: boolean;
1134
+ sdk?: Client;
1135
+ }
1136
+
1137
+ export const functionsGetUsage = async ({functionId,range,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsGetUsageRequestParams): Promise<any> => {
1231
1138
  let client = !sdk ? await sdkForProject() :
1232
1139
  sdk;
1233
1140
  let apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
@@ -1248,18 +1155,14 @@ const functionsGetUsage = async ({functionId,range,parseOutput = true, overrideF
1248
1155
  return response;
1249
1156
 
1250
1157
  }
1251
- /**
1252
- * @typedef {Object} FunctionsListVariablesRequestParams
1253
- * @property {string} functionId Function unique ID.
1254
- * @property {boolean} overrideForCli
1255
- * @property {boolean} parseOutput
1256
- * @property {libClient | undefined} sdk
1257
- */
1258
-
1259
- /**
1260
- * @param {FunctionsListVariablesRequestParams} params
1261
- */
1262
- const functionsListVariables = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1158
+ interface FunctionsListVariablesRequestParams {
1159
+ functionId: string;
1160
+ overrideForCli?: boolean;
1161
+ parseOutput?: boolean;
1162
+ sdk?: Client;
1163
+ }
1164
+
1165
+ export const functionsListVariables = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsListVariablesRequestParams): Promise<any> => {
1263
1166
  let client = !sdk ? await sdkForProject() :
1264
1167
  sdk;
1265
1168
  let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
@@ -1277,21 +1180,17 @@ const functionsListVariables = async ({functionId,parseOutput = true, overrideFo
1277
1180
  return response;
1278
1181
 
1279
1182
  }
1280
- /**
1281
- * @typedef {Object} FunctionsCreateVariableRequestParams
1282
- * @property {string} functionId Function unique ID.
1283
- * @property {string} key Variable key. Max length: 255 chars.
1284
- * @property {string} value Variable value. Max length: 8192 chars.
1285
- * @property {boolean} secret Secret variables can be updated or deleted, but only functions can read them during build and runtime.
1286
- * @property {boolean} overrideForCli
1287
- * @property {boolean} parseOutput
1288
- * @property {libClient | undefined} sdk
1289
- */
1290
-
1291
- /**
1292
- * @param {FunctionsCreateVariableRequestParams} params
1293
- */
1294
- const functionsCreateVariable = async ({functionId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1183
+ interface FunctionsCreateVariableRequestParams {
1184
+ functionId: string;
1185
+ key: string;
1186
+ value: string;
1187
+ secret?: boolean;
1188
+ overrideForCli?: boolean;
1189
+ parseOutput?: boolean;
1190
+ sdk?: Client;
1191
+ }
1192
+
1193
+ export const functionsCreateVariable = async ({functionId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateVariableRequestParams): Promise<any> => {
1295
1194
  let client = !sdk ? await sdkForProject() :
1296
1195
  sdk;
1297
1196
  let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
@@ -1319,19 +1218,15 @@ const functionsCreateVariable = async ({functionId,key,value,secret,parseOutput
1319
1218
  return response;
1320
1219
 
1321
1220
  }
1322
- /**
1323
- * @typedef {Object} FunctionsGetVariableRequestParams
1324
- * @property {string} functionId Function unique ID.
1325
- * @property {string} variableId Variable unique ID.
1326
- * @property {boolean} overrideForCli
1327
- * @property {boolean} parseOutput
1328
- * @property {libClient | undefined} sdk
1329
- */
1330
-
1331
- /**
1332
- * @param {FunctionsGetVariableRequestParams} params
1333
- */
1334
- const functionsGetVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1221
+ interface FunctionsGetVariableRequestParams {
1222
+ functionId: string;
1223
+ variableId: string;
1224
+ overrideForCli?: boolean;
1225
+ parseOutput?: boolean;
1226
+ sdk?: Client;
1227
+ }
1228
+
1229
+ export const functionsGetVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsGetVariableRequestParams): Promise<any> => {
1335
1230
  let client = !sdk ? await sdkForProject() :
1336
1231
  sdk;
1337
1232
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
@@ -1349,22 +1244,18 @@ const functionsGetVariable = async ({functionId,variableId,parseOutput = true, o
1349
1244
  return response;
1350
1245
 
1351
1246
  }
1352
- /**
1353
- * @typedef {Object} FunctionsUpdateVariableRequestParams
1354
- * @property {string} functionId Function unique ID.
1355
- * @property {string} variableId Variable unique ID.
1356
- * @property {string} key Variable key. Max length: 255 chars.
1357
- * @property {string} value Variable value. Max length: 8192 chars.
1358
- * @property {boolean} secret Secret variables can be updated or deleted, but only functions can read them during build and runtime.
1359
- * @property {boolean} overrideForCli
1360
- * @property {boolean} parseOutput
1361
- * @property {libClient | undefined} sdk
1362
- */
1363
-
1364
- /**
1365
- * @param {FunctionsUpdateVariableRequestParams} params
1366
- */
1367
- const functionsUpdateVariable = async ({functionId,variableId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1247
+ interface FunctionsUpdateVariableRequestParams {
1248
+ functionId: string;
1249
+ variableId: string;
1250
+ key: string;
1251
+ value?: string;
1252
+ secret?: boolean;
1253
+ overrideForCli?: boolean;
1254
+ parseOutput?: boolean;
1255
+ sdk?: Client;
1256
+ }
1257
+
1258
+ export const functionsUpdateVariable = async ({functionId,variableId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateVariableRequestParams): Promise<any> => {
1368
1259
  let client = !sdk ? await sdkForProject() :
1369
1260
  sdk;
1370
1261
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
@@ -1392,19 +1283,15 @@ const functionsUpdateVariable = async ({functionId,variableId,key,value,secret,p
1392
1283
  return response;
1393
1284
 
1394
1285
  }
1395
- /**
1396
- * @typedef {Object} FunctionsDeleteVariableRequestParams
1397
- * @property {string} functionId Function unique ID.
1398
- * @property {string} variableId Variable unique ID.
1399
- * @property {boolean} overrideForCli
1400
- * @property {boolean} parseOutput
1401
- * @property {libClient | undefined} sdk
1402
- */
1403
-
1404
- /**
1405
- * @param {FunctionsDeleteVariableRequestParams} params
1406
- */
1407
- const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1286
+ interface FunctionsDeleteVariableRequestParams {
1287
+ functionId: string;
1288
+ variableId: string;
1289
+ overrideForCli?: boolean;
1290
+ parseOutput?: boolean;
1291
+ sdk?: Client;
1292
+ }
1293
+
1294
+ export const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteVariableRequestParams): Promise<any> => {
1408
1295
  let client = !sdk ? await sdkForProject() :
1409
1296
  sdk;
1410
1297
  let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
@@ -1428,7 +1315,7 @@ functions
1428
1315
  .description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
1429
1316
  .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, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId`)
1430
1317
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1431
- .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))
1318
+ .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))
1432
1319
  .option(`--console`, `Get the resource console url`)
1433
1320
  .action(actionRunner(functionsList))
1434
1321
 
@@ -1442,15 +1329,15 @@ functions
1442
1329
  .option(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
1443
1330
  .option(`--schedule <schedule>`, `Schedule CRON syntax.`)
1444
1331
  .option(`--timeout <timeout>`, `Function maximum execution time in seconds.`, parseInteger)
1445
- .option(`--enabled [value]`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
1446
- .option(`--logging [value]`, `When disabled, executions will exclude logs and errors, and will be slightly faster.`, (value) => value === undefined ? true : parseBool(value))
1332
+ .option(`--enabled [value]`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1333
+ .option(`--logging [value]`, `When disabled, executions will exclude logs and errors, and will be slightly faster.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1447
1334
  .option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
1448
1335
  .option(`--commands <commands>`, `Build Commands.`)
1449
1336
  .option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
1450
1337
  .option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
1451
1338
  .option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function.`)
1452
1339
  .option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function.`)
1453
- .option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, (value) => value === undefined ? true : parseBool(value))
1340
+ .option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1454
1341
  .option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
1455
1342
  .option(`--specification <specification>`, `Runtime specification for the function and builds.`)
1456
1343
  .action(actionRunner(functionsCreate))
@@ -1473,7 +1360,7 @@ functions
1473
1360
  .option(`--use-cases [use-cases...]`, `List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.`)
1474
1361
  .option(`--limit <limit>`, `Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.`, parseInteger)
1475
1362
  .option(`--offset <offset>`, `Offset the list of returned templates. Maximum offset is 5000.`, parseInteger)
1476
- .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))
1363
+ .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))
1477
1364
  .option(`--console`, `Get the resource console url`)
1478
1365
  .action(actionRunner(functionsListTemplates))
1479
1366
 
@@ -1508,15 +1395,15 @@ functions
1508
1395
  .option(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
1509
1396
  .option(`--schedule <schedule>`, `Schedule CRON syntax.`)
1510
1397
  .option(`--timeout <timeout>`, `Maximum execution time in seconds.`, parseInteger)
1511
- .option(`--enabled [value]`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
1512
- .option(`--logging [value]`, `When disabled, executions will exclude logs and errors, and will be slightly faster.`, (value) => value === undefined ? true : parseBool(value))
1398
+ .option(`--enabled [value]`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1399
+ .option(`--logging [value]`, `When disabled, executions will exclude logs and errors, and will be slightly faster.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1513
1400
  .option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
1514
1401
  .option(`--commands <commands>`, `Build Commands.`)
1515
1402
  .option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
1516
1403
  .option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`)
1517
1404
  .option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function`)
1518
1405
  .option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`)
1519
- .option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, (value) => value === undefined ? true : parseBool(value))
1406
+ .option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1520
1407
  .option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
1521
1408
  .option(`--specification <specification>`, `Runtime specification for the function and builds.`)
1522
1409
  .action(actionRunner(functionsUpdate))
@@ -1540,7 +1427,7 @@ functions
1540
1427
  .requiredOption(`--function-id <function-id>`, `Function ID.`)
1541
1428
  .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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type`)
1542
1429
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1543
- .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))
1430
+ .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))
1544
1431
  .option(`--console`, `Get the resource console url`)
1545
1432
  .action(actionRunner(functionsListDeployments))
1546
1433
 
@@ -1549,7 +1436,7 @@ functions
1549
1436
  .description(`Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). Use the "command" param to set the entrypoint used to execute your code.`)
1550
1437
  .requiredOption(`--function-id <function-id>`, `Function ID.`)
1551
1438
  .requiredOption(`--code <code>`, `Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.`)
1552
- .requiredOption(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
1439
+ .requiredOption(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1553
1440
  .option(`--entrypoint <entrypoint>`, `Entrypoint File.`)
1554
1441
  .option(`--commands <commands>`, `Build Commands.`)
1555
1442
  .action(actionRunner(functionsCreateDeployment))
@@ -1571,7 +1458,7 @@ functions
1571
1458
  .requiredOption(`--root-directory <root-directory>`, `Path to function code in the template repo.`)
1572
1459
  .requiredOption(`--type <type>`, `Type for the reference provided. Can be commit, branch, or tag`)
1573
1460
  .requiredOption(`--reference <reference>`, `Reference value, can be a commit hash, branch name, or release tag`)
1574
- .option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
1461
+ .option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1575
1462
  .action(actionRunner(functionsCreateTemplateDeployment))
1576
1463
 
1577
1464
  functions
@@ -1580,7 +1467,7 @@ functions
1580
1467
  .requiredOption(`--function-id <function-id>`, `Function ID.`)
1581
1468
  .requiredOption(`--type <type>`, `Type of reference passed. Allowed values are: branch, commit`)
1582
1469
  .requiredOption(`--reference <reference>`, `VCS reference to create deployment from. Depending on type this can be: branch name, commit hash`)
1583
- .option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
1470
+ .option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1584
1471
  .action(actionRunner(functionsCreateVcsDeployment))
1585
1472
 
1586
1473
  functions
@@ -1620,7 +1507,7 @@ functions
1620
1507
  .description(`Get a list of all the current user function execution logs. You can use the query params to filter your results.`)
1621
1508
  .requiredOption(`--function-id <function-id>`, `Function ID.`)
1622
1509
  .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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId`)
1623
- .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))
1510
+ .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))
1624
1511
  .option(`--console`, `Get the resource console url`)
1625
1512
  .action(actionRunner(functionsListExecutions))
1626
1513
 
@@ -1629,7 +1516,7 @@ functions
1629
1516
  .description(`Trigger a function execution. The returned object will return you the current execution status. You can ping the 'Get Execution' endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.`)
1630
1517
  .requiredOption(`--function-id <function-id>`, `Function ID.`)
1631
1518
  .option(`--body <body>`, `HTTP body of execution. Default value is empty string.`)
1632
- .option(`--async [value]`, `Execute code in the background. Default value is false.`, (value) => value === undefined ? true : parseBool(value))
1519
+ .option(`--async [value]`, `Execute code in the background. Default value is false.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1633
1520
  .option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
1634
1521
  .option(`--method <method>`, `HTTP method of execution. Default value is POST.`)
1635
1522
  .option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
@@ -1670,7 +1557,7 @@ functions
1670
1557
  .requiredOption(`--function-id <function-id>`, `Function unique ID.`)
1671
1558
  .requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
1672
1559
  .requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`)
1673
- .option(`--secret [value]`, `Secret variables can be updated or deleted, but only functions can read them during build and runtime.`, (value) => value === undefined ? true : parseBool(value))
1560
+ .option(`--secret [value]`, `Secret variables can be updated or deleted, but only functions can read them during build and runtime.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1674
1561
  .action(actionRunner(functionsCreateVariable))
1675
1562
 
1676
1563
  functions
@@ -1687,7 +1574,7 @@ functions
1687
1574
  .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
1688
1575
  .requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
1689
1576
  .option(`--value <value>`, `Variable value. Max length: 8192 chars.`)
1690
- .option(`--secret [value]`, `Secret variables can be updated or deleted, but only functions can read them during build and runtime.`, (value) => value === undefined ? true : parseBool(value))
1577
+ .option(`--secret [value]`, `Secret variables can be updated or deleted, but only functions can read them during build and runtime.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
1691
1578
  .action(actionRunner(functionsUpdateVariable))
1692
1579
 
1693
1580
  functions
@@ -1697,36 +1584,4 @@ functions
1697
1584
  .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
1698
1585
  .action(actionRunner(functionsDeleteVariable))
1699
1586
 
1700
- module.exports = {
1701
- functions,
1702
- functionsList,
1703
- functionsCreate,
1704
- functionsListRuntimes,
1705
- functionsListSpecifications,
1706
- functionsListTemplates,
1707
- functionsGetTemplate,
1708
- functionsListUsage,
1709
- functionsGet,
1710
- functionsUpdate,
1711
- functionsDelete,
1712
- functionsUpdateFunctionDeployment,
1713
- functionsListDeployments,
1714
- functionsCreateDeployment,
1715
- functionsCreateDuplicateDeployment,
1716
- functionsCreateTemplateDeployment,
1717
- functionsCreateVcsDeployment,
1718
- functionsGetDeployment,
1719
- functionsDeleteDeployment,
1720
- functionsGetDeploymentDownload,
1721
- functionsUpdateDeploymentStatus,
1722
- functionsListExecutions,
1723
- functionsCreateExecution,
1724
- functionsGetExecution,
1725
- functionsDeleteExecution,
1726
- functionsGetUsage,
1727
- functionsListVariables,
1728
- functionsCreateVariable,
1729
- functionsGetVariable,
1730
- functionsUpdateVariable,
1731
- functionsDeleteVariable
1732
- };
1587
+