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,25 +31,21 @@ function convertReadStreamToReadableStream(readStream) {
35
31
  });
36
32
  }
37
33
 
38
- const vcs = new Command("vcs").description(commandDescriptions['vcs'] ?? '').configureHelp({
34
+ export const vcs = new Command("vcs").description(commandDescriptions['vcs'] ?? '').configureHelp({
39
35
  helpWidth: process.stdout.columns || 80
40
36
  })
41
37
 
42
- /**
43
- * @typedef {Object} VcsCreateRepositoryDetectionRequestParams
44
- * @property {string} installationId Installation Id
45
- * @property {string} providerRepositoryId Repository Id
46
- * @property {VCSDetectionType} type Detector type. Must be one of the following: runtime, framework
47
- * @property {string} providerRootDirectory Path to Root Directory
48
- * @property {boolean} overrideForCli
49
- * @property {boolean} parseOutput
50
- * @property {libClient | undefined} sdk
51
- */
52
-
53
- /**
54
- * @param {VcsCreateRepositoryDetectionRequestParams} params
55
- */
56
- const vcsCreateRepositoryDetection = async ({installationId,providerRepositoryId,type,providerRootDirectory,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
38
+ interface VcsCreateRepositoryDetectionRequestParams {
39
+ installationId: string;
40
+ providerRepositoryId: string;
41
+ type: VCSDetectionType;
42
+ providerRootDirectory?: string;
43
+ overrideForCli?: boolean;
44
+ parseOutput?: boolean;
45
+ sdk?: Client;
46
+ }
47
+
48
+ export const vcsCreateRepositoryDetection = async ({installationId,providerRepositoryId,type,providerRootDirectory,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsCreateRepositoryDetectionRequestParams): Promise<any> => {
57
49
  let client = !sdk ? await sdkForProject() :
58
50
  sdk;
59
51
  let apiPath = '/vcs/github/installations/{installationId}/detections'.replace('{installationId}', installationId);
@@ -81,20 +73,17 @@ const vcsCreateRepositoryDetection = async ({installationId,providerRepositoryId
81
73
  return response;
82
74
 
83
75
  }
84
- /**
85
- * @typedef {Object} VcsListRepositoriesRequestParams
86
- * @property {string} installationId Installation Id
87
- * @property {VCSDetectionType} type Detector type. Must be one of the following: runtime, framework
88
- * @property {string} search Search term to filter your list results. Max length: 256 chars.
89
- * @property {boolean} overrideForCli
90
- * @property {boolean} parseOutput
91
- * @property {libClient | undefined} sdk
92
- */
93
-
94
- /**
95
- * @param {VcsListRepositoriesRequestParams} params
96
- */
97
- const vcsListRepositories = async ({installationId,type,search,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
76
+ interface VcsListRepositoriesRequestParams {
77
+ installationId: string;
78
+ type: VCSDetectionType;
79
+ search?: string;
80
+ queries?: string[];
81
+ overrideForCli?: boolean;
82
+ parseOutput?: boolean;
83
+ sdk?: Client;
84
+ }
85
+
86
+ export const vcsListRepositories = async ({installationId,type,search,queries,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsListRepositoriesRequestParams): Promise<any> => {
98
87
  let client = !sdk ? await sdkForProject() :
99
88
  sdk;
100
89
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories'.replace('{installationId}', installationId);
@@ -105,6 +94,9 @@ const vcsListRepositories = async ({installationId,type,search,parseOutput = tru
105
94
  if (typeof search !== 'undefined') {
106
95
  payload['search'] = search;
107
96
  }
97
+ if (typeof queries !== 'undefined') {
98
+ payload['queries'] = queries;
99
+ }
108
100
 
109
101
  let response = undefined;
110
102
 
@@ -118,20 +110,16 @@ const vcsListRepositories = async ({installationId,type,search,parseOutput = tru
118
110
  return response;
119
111
 
120
112
  }
121
- /**
122
- * @typedef {Object} VcsCreateRepositoryRequestParams
123
- * @property {string} installationId Installation Id
124
- * @property {string} name Repository name (slug)
125
- * @property {boolean} xprivate Mark repository public or private
126
- * @property {boolean} overrideForCli
127
- * @property {boolean} parseOutput
128
- * @property {libClient | undefined} sdk
129
- */
130
-
131
- /**
132
- * @param {VcsCreateRepositoryRequestParams} params
133
- */
134
- const vcsCreateRepository = async ({installationId,name,xprivate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
113
+ interface VcsCreateRepositoryRequestParams {
114
+ installationId: string;
115
+ name: string;
116
+ xprivate: boolean;
117
+ overrideForCli?: boolean;
118
+ parseOutput?: boolean;
119
+ sdk?: Client;
120
+ }
121
+
122
+ export const vcsCreateRepository = async ({installationId,name,xprivate,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsCreateRepositoryRequestParams): Promise<any> => {
135
123
  let client = !sdk ? await sdkForProject() :
136
124
  sdk;
137
125
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories'.replace('{installationId}', installationId);
@@ -156,19 +144,15 @@ const vcsCreateRepository = async ({installationId,name,xprivate,parseOutput = t
156
144
  return response;
157
145
 
158
146
  }
159
- /**
160
- * @typedef {Object} VcsGetRepositoryRequestParams
161
- * @property {string} installationId Installation Id
162
- * @property {string} providerRepositoryId Repository Id
163
- * @property {boolean} overrideForCli
164
- * @property {boolean} parseOutput
165
- * @property {libClient | undefined} sdk
166
- */
167
-
168
- /**
169
- * @param {VcsGetRepositoryRequestParams} params
170
- */
171
- const vcsGetRepository = async ({installationId,providerRepositoryId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
147
+ interface VcsGetRepositoryRequestParams {
148
+ installationId: string;
149
+ providerRepositoryId: string;
150
+ overrideForCli?: boolean;
151
+ parseOutput?: boolean;
152
+ sdk?: Client;
153
+ }
154
+
155
+ export const vcsGetRepository = async ({installationId,providerRepositoryId,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsGetRepositoryRequestParams): Promise<any> => {
172
156
  let client = !sdk ? await sdkForProject() :
173
157
  sdk;
174
158
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
@@ -186,19 +170,15 @@ const vcsGetRepository = async ({installationId,providerRepositoryId,parseOutput
186
170
  return response;
187
171
 
188
172
  }
189
- /**
190
- * @typedef {Object} VcsListRepositoryBranchesRequestParams
191
- * @property {string} installationId Installation Id
192
- * @property {string} providerRepositoryId Repository Id
193
- * @property {boolean} overrideForCli
194
- * @property {boolean} parseOutput
195
- * @property {libClient | undefined} sdk
196
- */
197
-
198
- /**
199
- * @param {VcsListRepositoryBranchesRequestParams} params
200
- */
201
- const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
173
+ interface VcsListRepositoryBranchesRequestParams {
174
+ installationId: string;
175
+ providerRepositoryId: string;
176
+ overrideForCli?: boolean;
177
+ parseOutput?: boolean;
178
+ sdk?: Client;
179
+ }
180
+
181
+ export const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsListRepositoryBranchesRequestParams): Promise<any> => {
202
182
  let client = !sdk ? await sdkForProject() :
203
183
  sdk;
204
184
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/branches'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
@@ -216,21 +196,17 @@ const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,pa
216
196
  return response;
217
197
 
218
198
  }
219
- /**
220
- * @typedef {Object} VcsGetRepositoryContentsRequestParams
221
- * @property {string} installationId Installation Id
222
- * @property {string} providerRepositoryId Repository Id
223
- * @property {string} providerRootDirectory Path to get contents of nested directory
224
- * @property {string} providerReference Git reference (branch, tag, commit) to get contents from
225
- * @property {boolean} overrideForCli
226
- * @property {boolean} parseOutput
227
- * @property {libClient | undefined} sdk
228
- */
229
-
230
- /**
231
- * @param {VcsGetRepositoryContentsRequestParams} params
232
- */
233
- const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,providerRootDirectory,providerReference,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
199
+ interface VcsGetRepositoryContentsRequestParams {
200
+ installationId: string;
201
+ providerRepositoryId: string;
202
+ providerRootDirectory?: string;
203
+ providerReference?: string;
204
+ overrideForCli?: boolean;
205
+ parseOutput?: boolean;
206
+ sdk?: Client;
207
+ }
208
+
209
+ export const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,providerRootDirectory,providerReference,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsGetRepositoryContentsRequestParams): Promise<any> => {
234
210
  let client = !sdk ? await sdkForProject() :
235
211
  sdk;
236
212
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/contents'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
@@ -254,20 +230,16 @@ const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,pro
254
230
  return response;
255
231
 
256
232
  }
257
- /**
258
- * @typedef {Object} VcsUpdateExternalDeploymentsRequestParams
259
- * @property {string} installationId Installation Id
260
- * @property {string} repositoryId VCS Repository Id
261
- * @property {string} providerPullRequestId GitHub Pull Request Id
262
- * @property {boolean} overrideForCli
263
- * @property {boolean} parseOutput
264
- * @property {libClient | undefined} sdk
265
- */
266
-
267
- /**
268
- * @param {VcsUpdateExternalDeploymentsRequestParams} params
269
- */
270
- const vcsUpdateExternalDeployments = async ({installationId,repositoryId,providerPullRequestId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
233
+ interface VcsUpdateExternalDeploymentsRequestParams {
234
+ installationId: string;
235
+ repositoryId: string;
236
+ providerPullRequestId: string;
237
+ overrideForCli?: boolean;
238
+ parseOutput?: boolean;
239
+ sdk?: Client;
240
+ }
241
+
242
+ export const vcsUpdateExternalDeployments = async ({installationId,repositoryId,providerPullRequestId,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsUpdateExternalDeploymentsRequestParams): Promise<any> => {
271
243
  let client = !sdk ? await sdkForProject() :
272
244
  sdk;
273
245
  let apiPath = '/vcs/github/installations/{installationId}/repositories/{repositoryId}'.replace('{installationId}', installationId).replace('{repositoryId}', repositoryId);
@@ -289,20 +261,16 @@ const vcsUpdateExternalDeployments = async ({installationId,repositoryId,provide
289
261
  return response;
290
262
 
291
263
  }
292
- /**
293
- * @typedef {Object} VcsListInstallationsRequestParams
294
- * @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: provider, organization
295
- * @property {string} search Search term to filter your list results. Max length: 256 chars.
296
- * @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
297
- * @property {boolean} overrideForCli
298
- * @property {boolean} parseOutput
299
- * @property {libClient | undefined} sdk
300
- */
301
-
302
- /**
303
- * @param {VcsListInstallationsRequestParams} params
304
- */
305
- const vcsListInstallations = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
264
+ interface VcsListInstallationsRequestParams {
265
+ queries?: string[];
266
+ search?: string;
267
+ total?: boolean;
268
+ overrideForCli?: boolean;
269
+ parseOutput?: boolean;
270
+ sdk?: Client;
271
+ }
272
+
273
+ export const vcsListInstallations = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsListInstallationsRequestParams): Promise<any> => {
306
274
  let client = !sdk ? await sdkForProject() :
307
275
  sdk;
308
276
  let apiPath = '/vcs/installations';
@@ -329,18 +297,14 @@ const vcsListInstallations = async ({queries,search,total,parseOutput = true, ov
329
297
  return response;
330
298
 
331
299
  }
332
- /**
333
- * @typedef {Object} VcsGetInstallationRequestParams
334
- * @property {string} installationId Installation Id
335
- * @property {boolean} overrideForCli
336
- * @property {boolean} parseOutput
337
- * @property {libClient | undefined} sdk
338
- */
339
-
340
- /**
341
- * @param {VcsGetInstallationRequestParams} params
342
- */
343
- const vcsGetInstallation = async ({installationId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
300
+ interface VcsGetInstallationRequestParams {
301
+ installationId: string;
302
+ overrideForCli?: boolean;
303
+ parseOutput?: boolean;
304
+ sdk?: Client;
305
+ }
306
+
307
+ export const vcsGetInstallation = async ({installationId,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsGetInstallationRequestParams): Promise<any> => {
344
308
  let client = !sdk ? await sdkForProject() :
345
309
  sdk;
346
310
  let apiPath = '/vcs/installations/{installationId}'.replace('{installationId}', installationId);
@@ -358,18 +322,14 @@ const vcsGetInstallation = async ({installationId,parseOutput = true, overrideFo
358
322
  return response;
359
323
 
360
324
  }
361
- /**
362
- * @typedef {Object} VcsDeleteInstallationRequestParams
363
- * @property {string} installationId Installation Id
364
- * @property {boolean} overrideForCli
365
- * @property {boolean} parseOutput
366
- * @property {libClient | undefined} sdk
367
- */
368
-
369
- /**
370
- * @param {VcsDeleteInstallationRequestParams} params
371
- */
372
- const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
325
+ interface VcsDeleteInstallationRequestParams {
326
+ installationId: string;
327
+ overrideForCli?: boolean;
328
+ parseOutput?: boolean;
329
+ sdk?: Client;
330
+ }
331
+
332
+ export const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrideForCli = false, sdk = undefined}: VcsDeleteInstallationRequestParams): Promise<any> => {
373
333
  let client = !sdk ? await sdkForProject() :
374
334
  sdk;
375
335
  let apiPath = '/vcs/installations/{installationId}'.replace('{installationId}', installationId);
@@ -403,6 +363,7 @@ vcs
403
363
  .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
404
364
  .requiredOption(`--type <type>`, `Detector type. Must be one of the following: runtime, framework`)
405
365
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
366
+ .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). Only supported methods are limit and offset`)
406
367
  .action(actionRunner(vcsListRepositories))
407
368
 
408
369
  vcs
@@ -410,7 +371,7 @@ vcs
410
371
  .description(`Create a new GitHub repository through your installation. This endpoint allows you to create either a public or private repository by specifying a name and visibility setting. The repository will be created under your GitHub user account or organization, depending on your installation type. The GitHub installation must be properly configured and have the necessary permissions for repository creation.`)
411
372
  .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
412
373
  .requiredOption(`--name <name>`, `Repository name (slug)`)
413
- .requiredOption(`--xprivate [value]`, `Mark repository public or private`, (value) => value === undefined ? true : parseBool(value))
374
+ .requiredOption(`--xprivate [value]`, `Mark repository public or private`, (value: string | undefined) => value === undefined ? true : parseBool(value))
414
375
  .action(actionRunner(vcsCreateRepository))
415
376
 
416
377
  vcs
@@ -449,7 +410,7 @@ vcs
449
410
  .description(`List all VCS installations configured for the current project. This endpoint returns a list of installations including their provider, organization, and other configuration details. `)
450
411
  .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: provider, organization`)
451
412
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
452
- .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))
413
+ .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))
453
414
  .action(actionRunner(vcsListInstallations))
454
415
 
455
416
  vcs
@@ -464,16 +425,4 @@ vcs
464
425
  .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
465
426
  .action(actionRunner(vcsDeleteInstallation))
466
427
 
467
- module.exports = {
468
- vcs,
469
- vcsCreateRepositoryDetection,
470
- vcsListRepositories,
471
- vcsCreateRepository,
472
- vcsGetRepository,
473
- vcsListRepositoryBranches,
474
- vcsGetRepositoryContents,
475
- vcsUpdateExternalDeployments,
476
- vcsListInstallations,
477
- vcsGetInstallation,
478
- vcsDeleteInstallation
479
- };
428
+