appwrite-cli 6.2.3 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +4 -4
  2. package/docs/examples/console/get-resource.md +3 -0
  3. package/docs/examples/databases/create-documents.md +4 -0
  4. package/docs/examples/databases/create-index.md +1 -0
  5. package/docs/examples/databases/delete-documents.md +4 -0
  6. package/docs/examples/databases/update-documents.md +5 -0
  7. package/docs/examples/databases/upsert-document.md +6 -0
  8. package/docs/examples/databases/upsert-documents.md +4 -0
  9. package/docs/examples/functions/{create-build.md → create-duplicate-deployment.md} +1 -1
  10. package/docs/examples/functions/create-template-deployment.md +7 -0
  11. package/docs/examples/functions/create-variable.md +2 -1
  12. package/docs/examples/functions/create-vcs-deployment.md +5 -0
  13. package/docs/examples/functions/create.md +0 -4
  14. package/docs/examples/functions/get-deployment-download.md +2 -1
  15. package/docs/examples/functions/get-usage.md +1 -0
  16. package/docs/examples/functions/list-executions.md +0 -1
  17. package/docs/examples/functions/list-usage.md +2 -0
  18. package/docs/examples/functions/{update-deployment-build.md → update-deployment-status.md} +1 -1
  19. package/docs/examples/functions/{update-deployment.md → update-function-deployment.md} +1 -1
  20. package/docs/examples/functions/update-variable.md +1 -0
  21. package/docs/examples/migrations/create-csv-migration.md +4 -0
  22. package/docs/examples/project/create-variable.md +2 -1
  23. package/docs/examples/project/update-variable.md +1 -0
  24. package/docs/examples/projects/create-dev-key.md +4 -0
  25. package/docs/examples/projects/delete-dev-key.md +3 -0
  26. package/docs/examples/projects/get-dev-key.md +3 -0
  27. package/docs/examples/projects/list-dev-keys.md +3 -0
  28. package/docs/examples/projects/update-dev-key.md +5 -0
  29. package/docs/examples/proxy/create-a-p-i-rule.md +2 -0
  30. package/docs/examples/proxy/create-function-rule.md +4 -0
  31. package/docs/examples/proxy/create-redirect-rule.md +4 -0
  32. package/docs/examples/proxy/create-site-rule.md +4 -0
  33. package/docs/examples/sites/create-deployment.md +7 -0
  34. package/docs/examples/sites/create-duplicate-deployment.md +3 -0
  35. package/docs/examples/sites/create-template-deployment.md +7 -0
  36. package/docs/examples/sites/create-variable.md +5 -0
  37. package/docs/examples/sites/create-vcs-deployment.md +5 -0
  38. package/docs/examples/sites/create.md +19 -0
  39. package/docs/examples/sites/delete-deployment.md +3 -0
  40. package/docs/examples/sites/delete-log.md +3 -0
  41. package/docs/examples/sites/delete-variable.md +3 -0
  42. package/docs/examples/sites/delete.md +2 -0
  43. package/docs/examples/sites/get-deployment-download.md +4 -0
  44. package/docs/examples/sites/get-deployment.md +3 -0
  45. package/docs/examples/sites/get-log.md +3 -0
  46. package/docs/examples/sites/get-template.md +2 -0
  47. package/docs/examples/sites/get-usage.md +3 -0
  48. package/docs/examples/sites/get-variable.md +3 -0
  49. package/docs/examples/sites/get.md +2 -0
  50. package/docs/examples/sites/list-deployments.md +4 -0
  51. package/docs/examples/sites/list-frameworks.md +1 -0
  52. package/docs/examples/sites/list-logs.md +3 -0
  53. package/docs/examples/sites/list-specifications.md +1 -0
  54. package/docs/examples/sites/list-templates.md +5 -0
  55. package/docs/examples/sites/list-usage.md +2 -0
  56. package/docs/examples/sites/list-variables.md +2 -0
  57. package/docs/examples/sites/list.md +3 -0
  58. package/docs/examples/sites/update-deployment-status.md +3 -0
  59. package/docs/examples/sites/update-site-deployment.md +3 -0
  60. package/docs/examples/sites/update-variable.md +6 -0
  61. package/docs/examples/sites/update.md +19 -0
  62. package/docs/examples/storage/get-file-download.md +2 -1
  63. package/docs/examples/storage/get-file-preview.md +1 -0
  64. package/docs/examples/storage/get-file-view.md +2 -1
  65. package/docs/examples/tokens/create-file-token.md +4 -0
  66. package/docs/examples/tokens/delete.md +2 -0
  67. package/docs/examples/tokens/get.md +2 -0
  68. package/docs/examples/tokens/list.md +4 -0
  69. package/docs/examples/tokens/update.md +3 -0
  70. package/docs/examples/users/list-memberships.md +3 -1
  71. package/docs/examples/vcs/create-repository-detection.md +1 -0
  72. package/docs/examples/vcs/list-repositories.md +1 -0
  73. package/index.js +4 -0
  74. package/install.ps1 +2 -2
  75. package/install.sh +1 -1
  76. package/lib/client.js +8 -4
  77. package/lib/commands/account.js +7 -17
  78. package/lib/commands/avatars.js +7 -14
  79. package/lib/commands/console.js +50 -1
  80. package/lib/commands/databases.js +287 -55
  81. package/lib/commands/functions.js +244 -146
  82. package/lib/commands/generic.js +1 -1
  83. package/lib/commands/health.js +0 -63
  84. package/lib/commands/init.js +191 -0
  85. package/lib/commands/locale.js +0 -8
  86. package/lib/commands/messaging.js +38 -51
  87. package/lib/commands/migrations.js +50 -5
  88. package/lib/commands/project.js +12 -5
  89. package/lib/commands/projects.js +246 -27
  90. package/lib/commands/proxy.js +160 -19
  91. package/lib/commands/pull.js +124 -1
  92. package/lib/commands/push.js +338 -5
  93. package/lib/commands/sites.js +1663 -0
  94. package/lib/commands/storage.js +28 -22
  95. package/lib/commands/teams.js +2 -8
  96. package/lib/commands/tokens.js +261 -0
  97. package/lib/commands/users.js +15 -17
  98. package/lib/commands/vcs.js +60 -53
  99. package/lib/config.js +50 -0
  100. package/lib/parser.js +2 -1
  101. package/lib/questions.js +110 -1
  102. package/package.json +1 -1
  103. package/scoop/appwrite.json +3 -3
  104. package/docs/examples/functions/get-function-usage.md +0 -3
  105. package/docs/examples/health/get-queue-stats-usage-dump.md +0 -2
  106. package/docs/examples/proxy/create-rule.md +0 -4
@@ -66,7 +66,6 @@ const usersList = async ({queries,search,parseOutput = true, overrideForCli = fa
66
66
  let response = undefined;
67
67
 
68
68
  response = await client.call('get', apiPath, {
69
- 'content-type': 'application/json',
70
69
  }, payload);
71
70
 
72
71
  if (parseOutput) {
@@ -250,7 +249,6 @@ const usersListIdentities = async ({queries,search,parseOutput = true, overrideF
250
249
  let response = undefined;
251
250
 
252
251
  response = await client.call('get', apiPath, {
253
- 'content-type': 'application/json',
254
252
  }, payload);
255
253
 
256
254
  if (parseOutput) {
@@ -581,7 +579,6 @@ const usersGetUsage = async ({range,parseOutput = true, overrideForCli = false,
581
579
  let response = undefined;
582
580
 
583
581
  response = await client.call('get', apiPath, {
584
- 'content-type': 'application/json',
585
582
  }, payload);
586
583
 
587
584
  if (parseOutput) {
@@ -612,7 +609,6 @@ const usersGet = async ({userId,parseOutput = true, overrideForCli = false, sdk
612
609
  let response = undefined;
613
610
 
614
611
  response = await client.call('get', apiPath, {
615
- 'content-type': 'application/json',
616
612
  }, payload);
617
613
 
618
614
  if (parseOutput) {
@@ -792,7 +788,6 @@ const usersListLogs = async ({userId,queries,parseOutput = true, overrideForCli
792
788
  let response = undefined;
793
789
 
794
790
  response = await client.call('get', apiPath, {
795
- 'content-type': 'application/json',
796
791
  }, payload);
797
792
 
798
793
  if (parseOutput) {
@@ -806,6 +801,8 @@ const usersListLogs = async ({userId,queries,parseOutput = true, overrideForCli
806
801
  /**
807
802
  * @typedef {Object} UsersListMembershipsRequestParams
808
803
  * @property {string} userId User ID.
804
+ * @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: userId, teamId, invited, joined, confirm, roles
805
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
809
806
  * @property {boolean} overrideForCli
810
807
  * @property {boolean} parseOutput
811
808
  * @property {libClient | undefined} sdk
@@ -814,16 +811,21 @@ const usersListLogs = async ({userId,queries,parseOutput = true, overrideForCli
814
811
  /**
815
812
  * @param {UsersListMembershipsRequestParams} params
816
813
  */
817
- const usersListMemberships = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
814
+ const usersListMemberships = async ({userId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
818
815
  let client = !sdk ? await sdkForProject() :
819
816
  sdk;
820
817
  let apiPath = '/users/{userId}/memberships'.replace('{userId}', userId);
821
818
  let payload = {};
819
+ if (typeof queries !== 'undefined') {
820
+ payload['queries'] = queries;
821
+ }
822
+ if (typeof search !== 'undefined') {
823
+ payload['search'] = search;
824
+ }
822
825
 
823
826
  let response = undefined;
824
827
 
825
828
  response = await client.call('get', apiPath, {
826
- 'content-type': 'application/json',
827
829
  }, payload);
828
830
 
829
831
  if (parseOutput) {
@@ -921,7 +923,6 @@ const usersListMfaFactors = async ({userId,parseOutput = true, overrideForCli =
921
923
  let response = undefined;
922
924
 
923
925
  response = await client.call('get', apiPath, {
924
- 'content-type': 'application/json',
925
926
  }, payload);
926
927
 
927
928
  if (parseOutput) {
@@ -952,7 +953,6 @@ const usersGetMfaRecoveryCodes = async ({userId,parseOutput = true, overrideForC
952
953
  let response = undefined;
953
954
 
954
955
  response = await client.call('get', apiPath, {
955
- 'content-type': 'application/json',
956
956
  }, payload);
957
957
 
958
958
  if (parseOutput) {
@@ -1150,7 +1150,6 @@ const usersGetPrefs = async ({userId,parseOutput = true, overrideForCli = false,
1150
1150
  let response = undefined;
1151
1151
 
1152
1152
  response = await client.call('get', apiPath, {
1153
- 'content-type': 'application/json',
1154
1153
  }, payload);
1155
1154
 
1156
1155
  if (parseOutput) {
@@ -1216,7 +1215,6 @@ const usersListSessions = async ({userId,parseOutput = true, overrideForCli = fa
1216
1215
  let response = undefined;
1217
1216
 
1218
1217
  response = await client.call('get', apiPath, {
1219
- 'content-type': 'application/json',
1220
1218
  }, payload);
1221
1219
 
1222
1220
  if (parseOutput) {
@@ -1384,7 +1382,6 @@ const usersListTargets = async ({userId,queries,parseOutput = true, overrideForC
1384
1382
  let response = undefined;
1385
1383
 
1386
1384
  response = await client.call('get', apiPath, {
1387
- 'content-type': 'application/json',
1388
1385
  }, payload);
1389
1386
 
1390
1387
  if (parseOutput) {
@@ -1467,7 +1464,6 @@ const usersGetTarget = async ({userId,targetId,parseOutput = true, overrideForCl
1467
1464
  let response = undefined;
1468
1465
 
1469
1466
  response = await client.call('get', apiPath, {
1470
- 'content-type': 'application/json',
1471
1467
  }, payload);
1472
1468
 
1473
1469
  if (parseOutput) {
@@ -1818,13 +1814,15 @@ users
1818
1814
  .command(`list-memberships`)
1819
1815
  .description(`Get the user membership list by its unique ID.`)
1820
1816
  .requiredOption(`--user-id <user-id>`, `User ID.`)
1817
+ .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: userId, teamId, invited, joined, confirm, roles`)
1818
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1821
1819
  .action(actionRunner(usersListMemberships))
1822
1820
 
1823
1821
  users
1824
1822
  .command(`update-mfa`)
1825
1823
  .description(`Enable or disable MFA on a user account.`)
1826
1824
  .requiredOption(`--user-id <user-id>`, `User ID.`)
1827
- .requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool)
1825
+ .requiredOption(`--mfa [value]`, `Enable or disable MFA.`, (value) => value === undefined ? true : parseBool(value))
1828
1826
  .action(actionRunner(usersUpdateMfa))
1829
1827
 
1830
1828
  users
@@ -1922,7 +1920,7 @@ users
1922
1920
  .command(`update-status`)
1923
1921
  .description(`Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.`)
1924
1922
  .requiredOption(`--user-id <user-id>`, `User ID.`)
1925
- .requiredOption(`--status <status>`, `User Status. To activate the user pass 'true' and to block the user pass 'false'.`, parseBool)
1923
+ .requiredOption(`--status [value]`, `User Status. To activate the user pass 'true' and to block the user pass 'false'.`, (value) => value === undefined ? true : parseBool(value))
1926
1924
  .action(actionRunner(usersUpdateStatus))
1927
1925
 
1928
1926
  users
@@ -1979,14 +1977,14 @@ users
1979
1977
  .command(`update-email-verification`)
1980
1978
  .description(`Update the user email verification status by its unique ID.`)
1981
1979
  .requiredOption(`--user-id <user-id>`, `User ID.`)
1982
- .requiredOption(`--email-verification <email-verification>`, `User email verification status.`, parseBool)
1980
+ .requiredOption(`--email-verification [value]`, `User email verification status.`, (value) => value === undefined ? true : parseBool(value))
1983
1981
  .action(actionRunner(usersUpdateEmailVerification))
1984
1982
 
1985
1983
  users
1986
1984
  .command(`update-phone-verification`)
1987
1985
  .description(`Update the user phone verification status by its unique ID.`)
1988
1986
  .requiredOption(`--user-id <user-id>`, `User ID.`)
1989
- .requiredOption(`--phone-verification <phone-verification>`, `User phone verification status.`, parseBool)
1987
+ .requiredOption(`--phone-verification [value]`, `User phone verification status.`, (value) => value === undefined ? true : parseBool(value))
1990
1988
  .action(actionRunner(usersUpdatePhoneVerification))
1991
1989
 
1992
1990
  module.exports = {
@@ -39,9 +39,53 @@ const vcs = new Command("vcs").description(commandDescriptions['vcs'] ?? '').con
39
39
  helpWidth: process.stdout.columns || 80
40
40
  })
41
41
 
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}) => {
57
+ let client = !sdk ? await sdkForProject() :
58
+ sdk;
59
+ let apiPath = '/vcs/github/installations/{installationId}/detections'.replace('{installationId}', installationId);
60
+ let payload = {};
61
+ if (typeof providerRepositoryId !== 'undefined') {
62
+ payload['providerRepositoryId'] = providerRepositoryId;
63
+ }
64
+ if (typeof type !== 'undefined') {
65
+ payload['type'] = type;
66
+ }
67
+ if (typeof providerRootDirectory !== 'undefined') {
68
+ payload['providerRootDirectory'] = providerRootDirectory;
69
+ }
70
+
71
+ let response = undefined;
72
+
73
+ response = await client.call('post', apiPath, {
74
+ 'content-type': 'application/json',
75
+ }, payload);
76
+
77
+ if (parseOutput) {
78
+ parse(response)
79
+ }
80
+
81
+ return response;
82
+
83
+ }
84
+
42
85
  /**
43
86
  * @typedef {Object} VcsListRepositoriesRequestParams
44
87
  * @property {string} installationId Installation Id
88
+ * @property {VCSDetectionType} type Detector type. Must be one of the following: runtime, framework
45
89
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
90
  * @property {boolean} overrideForCli
47
91
  * @property {boolean} parseOutput
@@ -51,11 +95,14 @@ const vcs = new Command("vcs").description(commandDescriptions['vcs'] ?? '').con
51
95
  /**
52
96
  * @param {VcsListRepositoriesRequestParams} params
53
97
  */
54
- const vcsListRepositories = async ({installationId,search,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
98
+ const vcsListRepositories = async ({installationId,type,search,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
55
99
  let client = !sdk ? await sdkForProject() :
56
100
  sdk;
57
101
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories'.replace('{installationId}', installationId);
58
102
  let payload = {};
103
+ if (typeof type !== 'undefined') {
104
+ payload['type'] = type;
105
+ }
59
106
  if (typeof search !== 'undefined') {
60
107
  payload['search'] = search;
61
108
  }
@@ -63,7 +110,6 @@ const vcsListRepositories = async ({installationId,search,parseOutput = true, ov
63
110
  let response = undefined;
64
111
 
65
112
  response = await client.call('get', apiPath, {
66
- 'content-type': 'application/json',
67
113
  }, payload);
68
114
 
69
115
  if (parseOutput) {
@@ -134,7 +180,6 @@ const vcsGetRepository = async ({installationId,providerRepositoryId,parseOutput
134
180
  let response = undefined;
135
181
 
136
182
  response = await client.call('get', apiPath, {
137
- 'content-type': 'application/json',
138
183
  }, payload);
139
184
 
140
185
  if (parseOutput) {
@@ -166,7 +211,6 @@ const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,pa
166
211
  let response = undefined;
167
212
 
168
213
  response = await client.call('get', apiPath, {
169
- 'content-type': 'application/json',
170
214
  }, payload);
171
215
 
172
216
  if (parseOutput) {
@@ -202,43 +246,6 @@ const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,pro
202
246
  let response = undefined;
203
247
 
204
248
  response = await client.call('get', apiPath, {
205
- 'content-type': 'application/json',
206
- }, payload);
207
-
208
- if (parseOutput) {
209
- parse(response)
210
- }
211
-
212
- return response;
213
-
214
- }
215
-
216
- /**
217
- * @typedef {Object} VcsCreateRepositoryDetectionRequestParams
218
- * @property {string} installationId Installation Id
219
- * @property {string} providerRepositoryId Repository Id
220
- * @property {string} providerRootDirectory Path to Root Directory
221
- * @property {boolean} overrideForCli
222
- * @property {boolean} parseOutput
223
- * @property {libClient | undefined} sdk
224
- */
225
-
226
- /**
227
- * @param {VcsCreateRepositoryDetectionRequestParams} params
228
- */
229
- const vcsCreateRepositoryDetection = async ({installationId,providerRepositoryId,providerRootDirectory,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
230
- let client = !sdk ? await sdkForProject() :
231
- sdk;
232
- let apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/detection'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
233
- let payload = {};
234
- if (typeof providerRootDirectory !== 'undefined') {
235
- payload['providerRootDirectory'] = providerRootDirectory;
236
- }
237
-
238
- let response = undefined;
239
-
240
- response = await client.call('post', apiPath, {
241
- 'content-type': 'application/json',
242
249
  }, payload);
243
250
 
244
251
  if (parseOutput) {
@@ -312,7 +319,6 @@ const vcsListInstallations = async ({queries,search,parseOutput = true, override
312
319
  let response = undefined;
313
320
 
314
321
  response = await client.call('get', apiPath, {
315
- 'content-type': 'application/json',
316
322
  }, payload);
317
323
 
318
324
  if (parseOutput) {
@@ -343,7 +349,6 @@ const vcsGetInstallation = async ({installationId,parseOutput = true, overrideFo
343
349
  let response = undefined;
344
350
 
345
351
  response = await client.call('get', apiPath, {
346
- 'content-type': 'application/json',
347
352
  }, payload);
348
353
 
349
354
  if (parseOutput) {
@@ -385,10 +390,20 @@ const vcsDeleteInstallation = async ({installationId,parseOutput = true, overrid
385
390
 
386
391
  }
387
392
 
393
+ vcs
394
+ .command(`create-repository-detection`)
395
+ .description(`Analyze a GitHub repository to automatically detect the programming language and runtime environment. This endpoint scans the repository's files and language statistics to determine the appropriate runtime settings for your function. The GitHub installation must be properly configured and the repository must be accessible through your installation for this endpoint to work.`)
396
+ .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
397
+ .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`)
398
+ .requiredOption(`--type <type>`, `Detector type. Must be one of the following: runtime, framework`)
399
+ .option(`--provider-root-directory <provider-root-directory>`, `Path to Root Directory`)
400
+ .action(actionRunner(vcsCreateRepositoryDetection))
401
+
388
402
  vcs
389
403
  .command(`list-repositories`)
390
404
  .description(`Get a list of GitHub repositories available through your installation. This endpoint returns repositories with their basic information, detected runtime environments, and latest push dates. You can optionally filter repositories using a search term. Each repository's runtime is automatically detected based on its contents and language statistics. The GitHub installation must be properly configured for this endpoint to work.`)
391
405
  .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
406
+ .requiredOption(`--type <type>`, `Detector type. Must be one of the following: runtime, framework`)
392
407
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
393
408
  .action(actionRunner(vcsListRepositories))
394
409
 
@@ -397,7 +412,7 @@ vcs
397
412
  .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.`)
398
413
  .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
399
414
  .requiredOption(`--name <name>`, `Repository name (slug)`)
400
- .requiredOption(`--xprivate <xprivate>`, `Mark repository public or private`, parseBool)
415
+ .requiredOption(`--xprivate [value]`, `Mark repository public or private`, (value) => value === undefined ? true : parseBool(value))
401
416
  .action(actionRunner(vcsCreateRepository))
402
417
 
403
418
  vcs
@@ -422,14 +437,6 @@ vcs
422
437
  .option(`--provider-root-directory <provider-root-directory>`, `Path to get contents of nested directory`)
423
438
  .action(actionRunner(vcsGetRepositoryContents))
424
439
 
425
- vcs
426
- .command(`create-repository-detection`)
427
- .description(`Analyze a GitHub repository to automatically detect the programming language and runtime environment. This endpoint scans the repository's files and language statistics to determine the appropriate runtime settings for your function. The GitHub installation must be properly configured and the repository must be accessible through your installation for this endpoint to work.`)
428
- .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
429
- .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`)
430
- .option(`--provider-root-directory <provider-root-directory>`, `Path to Root Directory`)
431
- .action(actionRunner(vcsCreateRepositoryDetection))
432
-
433
440
  vcs
434
441
  .command(`update-external-deployments`)
435
442
  .description(`Authorize and create deployments for a GitHub pull request in your project. This endpoint allows external contributions by creating deployments from pull requests, enabling preview environments for code review. The pull request must be open and not previously authorized. The GitHub installation must be properly configured and have access to both the repository and pull request for this endpoint to work.`)
@@ -459,12 +466,12 @@ vcs
459
466
 
460
467
  module.exports = {
461
468
  vcs,
469
+ vcsCreateRepositoryDetection,
462
470
  vcsListRepositories,
463
471
  vcsCreateRepository,
464
472
  vcsGetRepository,
465
473
  vcsListRepositoryBranches,
466
474
  vcsGetRepositoryContents,
467
- vcsCreateRepositoryDetection,
468
475
  vcsUpdateExternalDeployments,
469
476
  vcsListInstallations,
470
477
  vcsGetInstallation,
package/lib/config.js CHANGED
@@ -5,6 +5,7 @@ const process = require("process");
5
5
  const JSONbig = require("json-bigint")({ storeAsString: false });
6
6
 
7
7
  const KeysVars = new Set(["key", "value"]);
8
+ const KeysSite = new Set(["path", "$id", "name", "enabled", "logging", "timeout", "framework", "buildRuntime", "adapter", "installCommand", "buildCommand", "outputDirectory", "fallbackFile", "specification", "vars"]);
8
9
  const KeysFunction = new Set(["path", "$id", "execute", "name", "enabled", "logging", "runtime", "specification", "scopes", "events", "schedule", "timeout", "entrypoint", "commands", "vars"]);
9
10
  const KeysDatabase = new Set(["$id", "name", "enabled"]);
10
11
  const KeysCollection = new Set(["$id", "$permissions", "databaseId", "name", "enabled", "documentSecurity", "attributes", "indexes"]);
@@ -149,6 +150,53 @@ class Local extends Config {
149
150
  return _path.dirname(this.path)
150
151
  }
151
152
 
153
+ getSites() {
154
+ if (!this.has("sites")) {
155
+ return [];
156
+ }
157
+ return this.get("sites");
158
+ }
159
+
160
+ getSite($id) {
161
+ if (!this.has("sites")) {
162
+ return {};
163
+ }
164
+
165
+ let sites = this.get("sites");
166
+ for (let i = 0; i < sites.length; i++) {
167
+ if (sites[i]['$id'] == $id) {
168
+ return sites[i];
169
+ }
170
+ }
171
+
172
+ return {};
173
+ }
174
+
175
+ addSite(props) {
176
+ props = whitelistKeys(props, KeysSite, {
177
+ vars: KeysVars
178
+ });
179
+
180
+ if (!this.has("sites")) {
181
+ this.set("sites", []);
182
+ }
183
+
184
+ let sites = this.get("sites");
185
+ for (let i = 0; i < sites.length; i++) {
186
+ if (sites[i]['$id'] == props['$id']) {
187
+ sites[i] = {
188
+ ...sites[i],
189
+ ...props
190
+ };
191
+ this.set("sites", sites);
192
+ return;
193
+ }
194
+ }
195
+
196
+ sites.push(props);
197
+ this.set("sites", sites);
198
+ }
199
+
152
200
  getFunctions() {
153
201
  if (!this.has("functions")) {
154
202
  return [];
@@ -440,6 +488,7 @@ class Local extends Config {
440
488
  storage: projectSettings.serviceStatusForStorage,
441
489
  teams: projectSettings.serviceStatusForTeams,
442
490
  users: projectSettings.serviceStatusForUsers,
491
+ sites: projectSettings.serviceStatusForSites,
443
492
  functions: projectSettings.serviceStatusForFunctions,
444
493
  graphql: projectSettings.serviceStatusForGraphql,
445
494
  messaging: projectSettings.serviceStatusForMessaging,
@@ -636,6 +685,7 @@ module.exports = {
636
685
  localConfig: new Local(),
637
686
  globalConfig: new Global(),
638
687
  KeysAttributes,
688
+ KeysSite,
639
689
  KeysFunction,
640
690
  KeysTopics,
641
691
  KeysStorage,
package/lib/parser.js CHANGED
@@ -120,7 +120,7 @@ const parseError = (err) => {
120
120
  } catch {
121
121
  }
122
122
 
123
- const version = '6.2.3';
123
+ const version = '7.0.0';
124
124
  const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
125
125
  const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
126
126
 
@@ -211,6 +211,7 @@ const commandDescriptions = {
211
211
  "health": `The health command allows you to both validate and monitor your Appwrite server's health.`,
212
212
  "pull": `The pull command helps you pull your Appwrite project, functions, collections, buckets, teams, and messaging-topics`,
213
213
  "locale": `The locale command allows you to customize your app based on your users' location.`,
214
+ "sites": `The sites command allows you to view, create and manage your Appwrite Sites.`,
214
215
  "storage": `The storage command allows you to manage your project files.`,
215
216
  "teams": `The teams command allows you to group users of your project to enable them to share read and write access to your project resources.`,
216
217
  "users": `The users command allows you to manage your project users.`,
package/lib/questions.js CHANGED
@@ -13,6 +13,7 @@ const { isPortTaken } = require('./utils');
13
13
  const { databasesList } = require('./commands/databases');
14
14
  const { checkDeployConditions } = require('./utils');
15
15
  const JSONbig = require("json-bigint")({ storeAsString: false });
16
+ const { sitesListFrameworks, sitesListSpecifications, sitesList } = require('./commands/sites');
16
17
 
17
18
  const whenOverride = (answers) => answers.override === undefined ? true : answers.override;
18
19
 
@@ -269,6 +270,36 @@ const questionsPullFunctionsCode = [
269
270
  },
270
271
  ];
271
272
 
273
+ const questionsPullSites = [
274
+ {
275
+ type: "checkbox",
276
+ name: "sites",
277
+ message: "Which sites would you like to pull?",
278
+ validate: (value) => validateRequired('site', value),
279
+ choices: async () => {
280
+ const { sites } = await paginate(sitesList, { parseOutput: false }, 100, 'sites');
281
+
282
+ if (sites.length === 0) {
283
+ throw "We couldn't find any sites in your Appwrite project";
284
+ }
285
+ return sites.map(site => {
286
+ return {
287
+ name: `${site.name} (${site.$id})`,
288
+ value: { ...site }
289
+ }
290
+ });
291
+ }
292
+ }
293
+ ];
294
+
295
+ const questionsPullSitesCode = [
296
+ {
297
+ type: "confirm",
298
+ name: "override",
299
+ message: "Do you want to pull source code of the latest deployment?"
300
+ },
301
+ ];
302
+
272
303
  const questionsCreateFunction = [
273
304
  {
274
305
  type: "input",
@@ -627,6 +658,7 @@ const questionsInitResources = [
627
658
  message: "Which resource would you create?",
628
659
  choices: [
629
660
  { name: 'Function', value: 'function' },
661
+ { name: 'Site', value: 'site' },
630
662
  { name: 'Collection', value: 'collection' },
631
663
  { name: 'Bucket', value: 'bucket' },
632
664
  { name: 'Team', value: 'team' },
@@ -635,6 +667,27 @@ const questionsInitResources = [
635
667
  }
636
668
  ];
637
669
 
670
+ const questionsPushSites = [
671
+ {
672
+ type: "checkbox",
673
+ name: "sites",
674
+ message: "Which sites would you like to push?",
675
+ validate: (value) => validateRequired('site', value),
676
+ when: () => localConfig.getSites().length > 0,
677
+ choices: () => {
678
+ let sites = localConfig.getSites();
679
+ checkDeployConditions(localConfig)
680
+ let choices = sites.map((site, idx) => {
681
+ return {
682
+ name: `${site.name} (${site.$id})`,
683
+ value: site.$id
684
+ }
685
+ })
686
+ return choices;
687
+ }
688
+ },
689
+ ];
690
+
638
691
  const questionsPushFunctions = [
639
692
  {
640
693
  type: "checkbox",
@@ -842,6 +895,58 @@ const questionsRunFunctions = [
842
895
  }
843
896
  ];
844
897
 
898
+ const questionsCreateSite = [
899
+ {
900
+ type: "input",
901
+ name: "name",
902
+ message: "What would you like to name your site?",
903
+ default: "My Awesome Site"
904
+ },
905
+ {
906
+ type: "input",
907
+ name: "id",
908
+ message: "What ID would you like to have for your site?",
909
+ default: "unique()"
910
+ },
911
+ {
912
+ type: "list",
913
+ name: "framework",
914
+ message: "What framework would you like to use?",
915
+ choices: async () => {
916
+ let response = await sitesListFrameworks({
917
+ parseOutput: false
918
+ });
919
+ let frameworks = response["frameworks"];
920
+ let choices = frameworks.map((framework) => {
921
+ return {
922
+ name: `${framework.name} (${framework.key})`,
923
+ value: framework,
924
+ }
925
+ });
926
+ return choices;
927
+ },
928
+ },
929
+ {
930
+ type: "list",
931
+ name: "specification",
932
+ message: "What specification would you like to use?",
933
+ choices: async () => {
934
+ let response = await sitesListSpecifications({
935
+ parseOutput: false
936
+ });
937
+ let specifications = response["specifications"];
938
+ let choices = specifications.map((spec) => {
939
+ return {
940
+ name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
941
+ value: spec.slug,
942
+ disabled: spec.enabled === false ? 'Upgrade to use' : false
943
+ }
944
+ });
945
+ return choices;
946
+ },
947
+ }
948
+ ];
949
+
845
950
  module.exports = {
846
951
  questionsInitProject,
847
952
  questionsInitProjectAutopull,
@@ -852,12 +957,15 @@ module.exports = {
852
957
  questionsCreateMessagingTopic,
853
958
  questionsPullFunctions,
854
959
  questionsPullFunctionsCode,
960
+ questionsPullSites,
961
+ questionsPullSitesCode,
855
962
  questionsLogin,
856
963
  questionsPullResources,
857
964
  questionsLogout,
858
965
  questionsPullCollection,
859
966
  questionsPushResources,
860
967
  questionsPushFunctions,
968
+ questionsPushSites,
861
969
  questionsPushCollections,
862
970
  questionsPushBuckets,
863
971
  questionsPushMessagingTopics,
@@ -870,5 +978,6 @@ module.exports = {
870
978
  questionsInitResources,
871
979
  questionsCreateTeam,
872
980
  questionPushChanges,
873
- questionPushChangesConfirmation
981
+ questionPushChangesConfirmation,
982
+ questionsCreateSite
874
983
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "appwrite-cli",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "6.2.3",
5
+ "version": "7.0.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "index.js",
8
8
  "bin": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
3
- "version": "6.2.3",
3
+ "version": "7.0.0",
4
4
  "description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
5
5
  "homepage": "https://github.com/appwrite/sdk-for-cli",
6
6
  "license": "BSD-3-Clause",
7
7
  "architecture": {
8
8
  "64bit": {
9
- "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.3/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/7.0.0/appwrite-cli-win-x64.exe",
10
10
  "bin": [
11
11
  [
12
12
  "appwrite-cli-win-x64.exe",
@@ -15,7 +15,7 @@
15
15
  ]
16
16
  },
17
17
  "arm64": {
18
- "url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.3/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/7.0.0/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",
@@ -1,3 +0,0 @@
1
- appwrite functions getFunctionUsage \
2
- --functionId <FUNCTION_ID> \
3
-
@@ -1,2 +0,0 @@
1
- appwrite health getQueueStatsUsageDump \
2
-
@@ -1,4 +0,0 @@
1
- appwrite proxy createRule \
2
- --domain '' \
3
- --resourceType api \
4
-