appwrite-cli 6.2.2 → 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 (111) hide show
  1. package/README.md +8 -7
  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/update-float-attribute.md +2 -2
  8. package/docs/examples/databases/update-integer-attribute.md +2 -2
  9. package/docs/examples/databases/upsert-document.md +6 -0
  10. package/docs/examples/databases/upsert-documents.md +4 -0
  11. package/docs/examples/functions/{create-build.md → create-duplicate-deployment.md} +1 -1
  12. package/docs/examples/functions/create-template-deployment.md +7 -0
  13. package/docs/examples/functions/create-variable.md +2 -1
  14. package/docs/examples/functions/create-vcs-deployment.md +5 -0
  15. package/docs/examples/functions/create.md +0 -4
  16. package/docs/examples/functions/get-deployment-download.md +2 -1
  17. package/docs/examples/functions/get-usage.md +1 -0
  18. package/docs/examples/functions/list-executions.md +0 -1
  19. package/docs/examples/functions/list-usage.md +2 -0
  20. package/docs/examples/functions/{update-deployment-build.md → update-deployment-status.md} +1 -1
  21. package/docs/examples/functions/{update-deployment.md → update-function-deployment.md} +1 -1
  22. package/docs/examples/functions/update-variable.md +1 -0
  23. package/docs/examples/health/get-queue-stats-resources.md +2 -0
  24. package/docs/examples/migrations/create-csv-migration.md +4 -0
  25. package/docs/examples/project/create-variable.md +2 -1
  26. package/docs/examples/project/update-variable.md +1 -0
  27. package/docs/examples/projects/create-dev-key.md +4 -0
  28. package/docs/examples/projects/delete-dev-key.md +3 -0
  29. package/docs/examples/projects/get-dev-key.md +3 -0
  30. package/docs/examples/projects/list-dev-keys.md +3 -0
  31. package/docs/examples/projects/update-dev-key.md +5 -0
  32. package/docs/examples/proxy/create-a-p-i-rule.md +2 -0
  33. package/docs/examples/proxy/create-function-rule.md +4 -0
  34. package/docs/examples/proxy/create-redirect-rule.md +4 -0
  35. package/docs/examples/proxy/create-site-rule.md +4 -0
  36. package/docs/examples/sites/create-deployment.md +7 -0
  37. package/docs/examples/sites/create-duplicate-deployment.md +3 -0
  38. package/docs/examples/sites/create-template-deployment.md +7 -0
  39. package/docs/examples/sites/create-variable.md +5 -0
  40. package/docs/examples/sites/create-vcs-deployment.md +5 -0
  41. package/docs/examples/sites/create.md +19 -0
  42. package/docs/examples/sites/delete-deployment.md +3 -0
  43. package/docs/examples/sites/delete-log.md +3 -0
  44. package/docs/examples/sites/delete-variable.md +3 -0
  45. package/docs/examples/sites/delete.md +2 -0
  46. package/docs/examples/sites/get-deployment-download.md +4 -0
  47. package/docs/examples/sites/get-deployment.md +3 -0
  48. package/docs/examples/sites/get-log.md +3 -0
  49. package/docs/examples/sites/get-template.md +2 -0
  50. package/docs/examples/sites/get-usage.md +3 -0
  51. package/docs/examples/sites/get-variable.md +3 -0
  52. package/docs/examples/sites/get.md +2 -0
  53. package/docs/examples/sites/list-deployments.md +4 -0
  54. package/docs/examples/sites/list-frameworks.md +1 -0
  55. package/docs/examples/sites/list-logs.md +3 -0
  56. package/docs/examples/sites/list-specifications.md +1 -0
  57. package/docs/examples/sites/list-templates.md +5 -0
  58. package/docs/examples/sites/list-usage.md +2 -0
  59. package/docs/examples/sites/list-variables.md +2 -0
  60. package/docs/examples/sites/list.md +3 -0
  61. package/docs/examples/sites/update-deployment-status.md +3 -0
  62. package/docs/examples/sites/update-site-deployment.md +3 -0
  63. package/docs/examples/sites/update-variable.md +6 -0
  64. package/docs/examples/sites/update.md +19 -0
  65. package/docs/examples/storage/get-file-download.md +2 -1
  66. package/docs/examples/storage/get-file-preview.md +1 -0
  67. package/docs/examples/storage/get-file-view.md +2 -1
  68. package/docs/examples/tokens/create-file-token.md +4 -0
  69. package/docs/examples/tokens/delete.md +2 -0
  70. package/docs/examples/tokens/get.md +2 -0
  71. package/docs/examples/tokens/list.md +4 -0
  72. package/docs/examples/tokens/update.md +3 -0
  73. package/docs/examples/users/list-memberships.md +3 -1
  74. package/docs/examples/vcs/create-repository-detection.md +1 -0
  75. package/docs/examples/vcs/list-repositories.md +1 -0
  76. package/index.js +4 -0
  77. package/install.ps1 +2 -2
  78. package/install.sh +1 -1
  79. package/lib/client.js +12 -5
  80. package/lib/commands/account.js +7 -17
  81. package/lib/commands/avatars.js +9 -16
  82. package/lib/commands/console.js +50 -1
  83. package/lib/commands/databases.js +294 -62
  84. package/lib/commands/functions.js +244 -146
  85. package/lib/commands/generic.js +1 -1
  86. package/lib/commands/health.js +15 -73
  87. package/lib/commands/init.js +191 -0
  88. package/lib/commands/locale.js +0 -8
  89. package/lib/commands/messaging.js +38 -51
  90. package/lib/commands/migrations.js +56 -11
  91. package/lib/commands/project.js +12 -5
  92. package/lib/commands/projects.js +246 -27
  93. package/lib/commands/proxy.js +160 -19
  94. package/lib/commands/pull.js +124 -1
  95. package/lib/commands/push.js +338 -5
  96. package/lib/commands/sites.js +1663 -0
  97. package/lib/commands/storage.js +28 -22
  98. package/lib/commands/teams.js +2 -8
  99. package/lib/commands/tokens.js +261 -0
  100. package/lib/commands/users.js +15 -17
  101. package/lib/commands/vcs.js +60 -53
  102. package/lib/config.js +50 -0
  103. package/lib/parser.js +2 -1
  104. package/lib/questions.js +110 -1
  105. package/lib/utils.js +7 -1
  106. package/package.json +1 -1
  107. package/scoop/appwrite.json +3 -3
  108. package/docs/examples/functions/get-function-usage.md +0 -3
  109. package/docs/examples/health/get-queue-usage-dump.md +0 -2
  110. package/docs/examples/health/get-queue.md +0 -1
  111. package/docs/examples/proxy/create-rule.md +0 -4
@@ -66,7 +66,6 @@ const projectsList = async ({queries,search,parseOutput = true, overrideForCli =
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) {
@@ -183,7 +182,6 @@ const projectsGet = async ({projectId,parseOutput = true, overrideForCli = false
183
182
  let response = undefined;
184
183
 
185
184
  response = await client.call('get', apiPath, {
186
- 'content-type': 'application/json',
187
185
  }, payload);
188
186
 
189
187
  if (parseOutput) {
@@ -734,6 +732,190 @@ const projectsUpdateAuthStatus = async ({projectId,method,status,parseOutput = t
734
732
 
735
733
  }
736
734
 
735
+ /**
736
+ * @typedef {Object} ProjectsListDevKeysRequestParams
737
+ * @property {string} projectId Project unique ID.
738
+ * @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: accessedAt, expire
739
+ * @property {boolean} overrideForCli
740
+ * @property {boolean} parseOutput
741
+ * @property {libClient | undefined} sdk
742
+ */
743
+
744
+ /**
745
+ * @param {ProjectsListDevKeysRequestParams} params
746
+ */
747
+ const projectsListDevKeys = async ({projectId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
748
+ let client = !sdk ? await sdkForConsole() :
749
+ sdk;
750
+ let apiPath = '/projects/{projectId}/dev-keys'.replace('{projectId}', projectId);
751
+ let payload = {};
752
+ if (typeof queries !== 'undefined') {
753
+ payload['queries'] = queries;
754
+ }
755
+
756
+ let response = undefined;
757
+
758
+ response = await client.call('get', apiPath, {
759
+ }, payload);
760
+
761
+ if (parseOutput) {
762
+ if(console) {
763
+ showConsoleLink('projects', 'listDevKeys', projectId);
764
+ } else {
765
+ parse(response)
766
+ }
767
+ }
768
+
769
+ return response;
770
+
771
+ }
772
+
773
+ /**
774
+ * @typedef {Object} ProjectsCreateDevKeyRequestParams
775
+ * @property {string} projectId Project unique ID.
776
+ * @property {string} name Key name. Max length: 128 chars.
777
+ * @property {string} expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
778
+ * @property {boolean} overrideForCli
779
+ * @property {boolean} parseOutput
780
+ * @property {libClient | undefined} sdk
781
+ */
782
+
783
+ /**
784
+ * @param {ProjectsCreateDevKeyRequestParams} params
785
+ */
786
+ const projectsCreateDevKey = async ({projectId,name,expire,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
787
+ let client = !sdk ? await sdkForConsole() :
788
+ sdk;
789
+ let apiPath = '/projects/{projectId}/dev-keys'.replace('{projectId}', projectId);
790
+ let payload = {};
791
+ if (typeof name !== 'undefined') {
792
+ payload['name'] = name;
793
+ }
794
+ if (typeof expire !== 'undefined') {
795
+ payload['expire'] = expire;
796
+ }
797
+
798
+ let response = undefined;
799
+
800
+ response = await client.call('post', apiPath, {
801
+ 'content-type': 'application/json',
802
+ }, payload);
803
+
804
+ if (parseOutput) {
805
+ parse(response)
806
+ }
807
+
808
+ return response;
809
+
810
+ }
811
+
812
+ /**
813
+ * @typedef {Object} ProjectsGetDevKeyRequestParams
814
+ * @property {string} projectId Project unique ID.
815
+ * @property {string} keyId Key unique ID.
816
+ * @property {boolean} overrideForCli
817
+ * @property {boolean} parseOutput
818
+ * @property {libClient | undefined} sdk
819
+ */
820
+
821
+ /**
822
+ * @param {ProjectsGetDevKeyRequestParams} params
823
+ */
824
+ const projectsGetDevKey = async ({projectId,keyId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
825
+ let client = !sdk ? await sdkForConsole() :
826
+ sdk;
827
+ let apiPath = '/projects/{projectId}/dev-keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
828
+ let payload = {};
829
+
830
+ let response = undefined;
831
+
832
+ response = await client.call('get', apiPath, {
833
+ }, payload);
834
+
835
+ if (parseOutput) {
836
+ if(console) {
837
+ showConsoleLink('projects', 'getDevKey', projectId, keyId);
838
+ } else {
839
+ parse(response)
840
+ }
841
+ }
842
+
843
+ return response;
844
+
845
+ }
846
+
847
+ /**
848
+ * @typedef {Object} ProjectsUpdateDevKeyRequestParams
849
+ * @property {string} projectId Project unique ID.
850
+ * @property {string} keyId Key unique ID.
851
+ * @property {string} name Key name. Max length: 128 chars.
852
+ * @property {string} expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
853
+ * @property {boolean} overrideForCli
854
+ * @property {boolean} parseOutput
855
+ * @property {libClient | undefined} sdk
856
+ */
857
+
858
+ /**
859
+ * @param {ProjectsUpdateDevKeyRequestParams} params
860
+ */
861
+ const projectsUpdateDevKey = async ({projectId,keyId,name,expire,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
862
+ let client = !sdk ? await sdkForConsole() :
863
+ sdk;
864
+ let apiPath = '/projects/{projectId}/dev-keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
865
+ let payload = {};
866
+ if (typeof name !== 'undefined') {
867
+ payload['name'] = name;
868
+ }
869
+ if (typeof expire !== 'undefined') {
870
+ payload['expire'] = expire;
871
+ }
872
+
873
+ let response = undefined;
874
+
875
+ response = await client.call('put', apiPath, {
876
+ 'content-type': 'application/json',
877
+ }, payload);
878
+
879
+ if (parseOutput) {
880
+ parse(response)
881
+ }
882
+
883
+ return response;
884
+
885
+ }
886
+
887
+ /**
888
+ * @typedef {Object} ProjectsDeleteDevKeyRequestParams
889
+ * @property {string} projectId Project unique ID.
890
+ * @property {string} keyId Key unique ID.
891
+ * @property {boolean} overrideForCli
892
+ * @property {boolean} parseOutput
893
+ * @property {libClient | undefined} sdk
894
+ */
895
+
896
+ /**
897
+ * @param {ProjectsDeleteDevKeyRequestParams} params
898
+ */
899
+ const projectsDeleteDevKey = async ({projectId,keyId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
900
+ let client = !sdk ? await sdkForConsole() :
901
+ sdk;
902
+ let apiPath = '/projects/{projectId}/dev-keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
903
+ let payload = {};
904
+
905
+ let response = undefined;
906
+
907
+ response = await client.call('delete', apiPath, {
908
+ 'content-type': 'application/json',
909
+ }, payload);
910
+
911
+ if (parseOutput) {
912
+ parse(response)
913
+ }
914
+
915
+ return response;
916
+
917
+ }
918
+
737
919
  /**
738
920
  * @typedef {Object} ProjectsCreateJWTRequestParams
739
921
  * @property {string} projectId Project unique ID.
@@ -794,7 +976,6 @@ const projectsListKeys = async ({projectId,parseOutput = true, overrideForCli =
794
976
  let response = undefined;
795
977
 
796
978
  response = await client.call('get', apiPath, {
797
- 'content-type': 'application/json',
798
979
  }, payload);
799
980
 
800
981
  if (parseOutput) {
@@ -874,7 +1055,6 @@ const projectsGetKey = async ({projectId,keyId,parseOutput = true, overrideForCl
874
1055
  let response = undefined;
875
1056
 
876
1057
  response = await client.call('get', apiPath, {
877
- 'content-type': 'application/json',
878
1058
  }, payload);
879
1059
 
880
1060
  if (parseOutput) {
@@ -1033,7 +1213,6 @@ const projectsListPlatforms = async ({projectId,parseOutput = true, overrideForC
1033
1213
  let response = undefined;
1034
1214
 
1035
1215
  response = await client.call('get', apiPath, {
1036
- 'content-type': 'application/json',
1037
1216
  }, payload);
1038
1217
 
1039
1218
  if (parseOutput) {
@@ -1120,7 +1299,6 @@ const projectsGetPlatform = async ({projectId,platformId,parseOutput = true, ove
1120
1299
  let response = undefined;
1121
1300
 
1122
1301
  response = await client.call('get', apiPath, {
1123
- 'content-type': 'application/json',
1124
1302
  }, payload);
1125
1303
 
1126
1304
  if (parseOutput) {
@@ -1481,7 +1659,6 @@ const projectsGetEmailTemplate = async ({projectId,type,locale,parseOutput = tru
1481
1659
  let response = undefined;
1482
1660
 
1483
1661
  response = await client.call('get', apiPath, {
1484
- 'content-type': 'application/json',
1485
1662
  }, payload);
1486
1663
 
1487
1664
  if (parseOutput) {
@@ -1600,7 +1777,6 @@ const projectsGetSmsTemplate = async ({projectId,type,locale,parseOutput = true,
1600
1777
  let response = undefined;
1601
1778
 
1602
1779
  response = await client.call('get', apiPath, {
1603
- 'content-type': 'application/json',
1604
1780
  }, payload);
1605
1781
 
1606
1782
  if (parseOutput) {
@@ -1701,7 +1877,6 @@ const projectsListWebhooks = async ({projectId,parseOutput = true, overrideForCl
1701
1877
  let response = undefined;
1702
1878
 
1703
1879
  response = await client.call('get', apiPath, {
1704
- 'content-type': 'application/json',
1705
1880
  }, payload);
1706
1881
 
1707
1882
  if (parseOutput) {
@@ -1797,7 +1972,6 @@ const projectsGetWebhook = async ({projectId,webhookId,parseOutput = true, overr
1797
1972
  let response = undefined;
1798
1973
 
1799
1974
  response = await client.call('get', apiPath, {
1800
- 'content-type': 'application/json',
1801
1975
  }, payload);
1802
1976
 
1803
1977
  if (parseOutput) {
@@ -1997,14 +2171,14 @@ projects
1997
2171
  .description(`Update the status of a specific API type. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime.`)
1998
2172
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
1999
2173
  .requiredOption(`--api <api>`, `API name.`)
2000
- .requiredOption(`--status <status>`, `API status.`, parseBool)
2174
+ .requiredOption(`--status [value]`, `API status.`, (value) => value === undefined ? true : parseBool(value))
2001
2175
  .action(actionRunner(projectsUpdateApiStatus))
2002
2176
 
2003
2177
  projects
2004
2178
  .command(`update-api-status-all`)
2005
2179
  .description(`Update the status of all API types. Use this endpoint to enable or disable API types such as REST, GraphQL and Realtime all at once.`)
2006
2180
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2007
- .requiredOption(`--status <status>`, `API status.`, parseBool)
2181
+ .requiredOption(`--status [value]`, `API status.`, (value) => value === undefined ? true : parseBool(value))
2008
2182
  .action(actionRunner(projectsUpdateApiStatusAll))
2009
2183
 
2010
2184
  projects
@@ -2032,9 +2206,9 @@ projects
2032
2206
  .command(`update-memberships-privacy`)
2033
2207
  .description(`Update project membership privacy settings. Use this endpoint to control what user information is visible to other team members, such as user name, email, and MFA status. `)
2034
2208
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2035
- .requiredOption(`--user-name <user-name>`, `Set to true to show userName to members of a team.`, parseBool)
2036
- .requiredOption(`--user-email <user-email>`, `Set to true to show email to members of a team.`, parseBool)
2037
- .requiredOption(`--mfa <mfa>`, `Set to true to show mfa to members of a team.`, parseBool)
2209
+ .requiredOption(`--user-name [value]`, `Set to true to show userName to members of a team.`, (value) => value === undefined ? true : parseBool(value))
2210
+ .requiredOption(`--user-email [value]`, `Set to true to show email to members of a team.`, (value) => value === undefined ? true : parseBool(value))
2211
+ .requiredOption(`--mfa [value]`, `Set to true to show mfa to members of a team.`, (value) => value === undefined ? true : parseBool(value))
2038
2212
  .action(actionRunner(projectsUpdateMembershipsPrivacy))
2039
2213
 
2040
2214
  projects
@@ -2048,7 +2222,7 @@ projects
2048
2222
  .command(`update-auth-password-dictionary`)
2049
2223
  .description(`Enable or disable checking user passwords against common passwords dictionary. This helps ensure users don't use common and insecure passwords. `)
2050
2224
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2051
- .requiredOption(`--enabled <enabled>`, `Set whether or not to enable checking user's password against most commonly used passwords. Default is false.`, parseBool)
2225
+ .requiredOption(`--enabled [value]`, `Set whether or not to enable checking user's password against most commonly used passwords. Default is false.`, (value) => value === undefined ? true : parseBool(value))
2052
2226
  .action(actionRunner(projectsUpdateAuthPasswordDictionary))
2053
2227
 
2054
2228
  projects
@@ -2062,14 +2236,14 @@ projects
2062
2236
  .command(`update-personal-data-check`)
2063
2237
  .description(`Enable or disable checking user passwords against their personal data. This helps prevent users from using personal information in their passwords. `)
2064
2238
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2065
- .requiredOption(`--enabled <enabled>`, `Set whether or not to check a password for similarity with personal data. Default is false.`, parseBool)
2239
+ .requiredOption(`--enabled [value]`, `Set whether or not to check a password for similarity with personal data. Default is false.`, (value) => value === undefined ? true : parseBool(value))
2066
2240
  .action(actionRunner(projectsUpdatePersonalDataCheck))
2067
2241
 
2068
2242
  projects
2069
2243
  .command(`update-session-alerts`)
2070
2244
  .description(`Enable or disable session email alerts. When enabled, users will receive email notifications when new sessions are created.`)
2071
2245
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2072
- .requiredOption(`--alerts <alerts>`, `Set to true to enable session emails.`, parseBool)
2246
+ .requiredOption(`--alerts [value]`, `Set to true to enable session emails.`, (value) => value === undefined ? true : parseBool(value))
2073
2247
  .action(actionRunner(projectsUpdateSessionAlerts))
2074
2248
 
2075
2249
  projects
@@ -2077,9 +2251,49 @@ projects
2077
2251
  .description(`Update the status of a specific authentication method. Use this endpoint to enable or disable different authentication methods such as email, magic urls or sms in your project. `)
2078
2252
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2079
2253
  .requiredOption(`--method <method>`, `Auth Method. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone`)
2080
- .requiredOption(`--status <status>`, `Set the status of this auth method.`, parseBool)
2254
+ .requiredOption(`--status [value]`, `Set the status of this auth method.`, (value) => value === undefined ? true : parseBool(value))
2081
2255
  .action(actionRunner(projectsUpdateAuthStatus))
2082
2256
 
2257
+ projects
2258
+ .command(`list-dev-keys`)
2259
+ .description(`List all the project\'s dev keys. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development.'`)
2260
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2261
+ .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: accessedAt, expire`)
2262
+ .option(`--console`, `Get the resource console url`)
2263
+ .action(actionRunner(projectsListDevKeys))
2264
+
2265
+ projects
2266
+ .command(`create-dev-key`)
2267
+ .description(`Create a new project dev key. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development. Strictly meant for development purposes only.`)
2268
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2269
+ .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
2270
+ .requiredOption(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.`)
2271
+ .action(actionRunner(projectsCreateDevKey))
2272
+
2273
+ projects
2274
+ .command(`get-dev-key`)
2275
+ .description(`Get a project\'s dev key by its unique ID. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development.`)
2276
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2277
+ .requiredOption(`--key-id <key-id>`, `Key unique ID.`)
2278
+ .option(`--console`, `Get the resource console url`)
2279
+ .action(actionRunner(projectsGetDevKey))
2280
+
2281
+ projects
2282
+ .command(`update-dev-key`)
2283
+ .description(`Update a project\'s dev key by its unique ID. Use this endpoint to update a project\'s dev key name or expiration time.'`)
2284
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2285
+ .requiredOption(`--key-id <key-id>`, `Key unique ID.`)
2286
+ .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
2287
+ .requiredOption(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.`)
2288
+ .action(actionRunner(projectsUpdateDevKey))
2289
+
2290
+ projects
2291
+ .command(`delete-dev-key`)
2292
+ .description(`Delete a project\'s dev key by its unique ID. Once deleted, the key will no longer allow bypassing of rate limits and better logging of errors.`)
2293
+ .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2294
+ .requiredOption(`--key-id <key-id>`, `Key unique ID.`)
2295
+ .action(actionRunner(projectsDeleteDevKey))
2296
+
2083
2297
  projects
2084
2298
  .command(`create-jwt`)
2085
2299
  .description(`Create a new JWT token. This token can be used to authenticate users with custom scopes and expiration time. `)
@@ -2136,7 +2350,7 @@ projects
2136
2350
  .requiredOption(`--provider <provider>`, `Provider Name`)
2137
2351
  .option(`--app-id <app-id>`, `Provider app ID. Max length: 256 chars.`)
2138
2352
  .option(`--secret <secret>`, `Provider secret key. Max length: 512 chars.`)
2139
- .option(`--enabled <enabled>`, `Provider status. Set to 'false' to disable new session creation.`, parseBool)
2353
+ .option(`--enabled [value]`, `Provider status. Set to 'false' to disable new session creation.`, (value) => value === undefined ? true : parseBool(value))
2140
2354
  .action(actionRunner(projectsUpdateOAuth2))
2141
2355
 
2142
2356
  projects
@@ -2188,21 +2402,21 @@ projects
2188
2402
  .description(`Update the status of a specific service. Use this endpoint to enable or disable a service in your project. `)
2189
2403
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2190
2404
  .requiredOption(`--service <service>`, `Service name.`)
2191
- .requiredOption(`--status <status>`, `Service status.`, parseBool)
2405
+ .requiredOption(`--status [value]`, `Service status.`, (value) => value === undefined ? true : parseBool(value))
2192
2406
  .action(actionRunner(projectsUpdateServiceStatus))
2193
2407
 
2194
2408
  projects
2195
2409
  .command(`update-service-status-all`)
2196
2410
  .description(`Update the status of all services. Use this endpoint to enable or disable all optional services at once. `)
2197
2411
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2198
- .requiredOption(`--status <status>`, `Service status.`, parseBool)
2412
+ .requiredOption(`--status [value]`, `Service status.`, (value) => value === undefined ? true : parseBool(value))
2199
2413
  .action(actionRunner(projectsUpdateServiceStatusAll))
2200
2414
 
2201
2415
  projects
2202
2416
  .command(`update-smtp`)
2203
2417
  .description(`Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. `)
2204
2418
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2205
- .requiredOption(`--enabled <enabled>`, `Enable custom SMTP service`, parseBool)
2419
+ .requiredOption(`--enabled [value]`, `Enable custom SMTP service`, (value) => value === undefined ? true : parseBool(value))
2206
2420
  .option(`--sender-name <sender-name>`, `Name of the email sender`)
2207
2421
  .option(`--sender-email <sender-email>`, `Email of the sender`)
2208
2422
  .option(`--reply-to <reply-to>`, `Reply to email`)
@@ -2303,8 +2517,8 @@ projects
2303
2517
  .requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
2304
2518
  .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
2305
2519
  .requiredOption(`--url <url>`, `Webhook URL.`)
2306
- .requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
2307
- .option(`--enabled <enabled>`, `Enable or disable a webhook.`, parseBool)
2520
+ .requiredOption(`--security [value]`, `Certificate verification, false for disabled or true for enabled.`, (value) => value === undefined ? true : parseBool(value))
2521
+ .option(`--enabled [value]`, `Enable or disable a webhook.`, (value) => value === undefined ? true : parseBool(value))
2308
2522
  .option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`)
2309
2523
  .option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`)
2310
2524
  .action(actionRunner(projectsCreateWebhook))
@@ -2325,8 +2539,8 @@ projects
2325
2539
  .requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
2326
2540
  .requiredOption(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
2327
2541
  .requiredOption(`--url <url>`, `Webhook URL.`)
2328
- .requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
2329
- .option(`--enabled <enabled>`, `Enable or disable a webhook.`, parseBool)
2542
+ .requiredOption(`--security [value]`, `Certificate verification, false for disabled or true for enabled.`, (value) => value === undefined ? true : parseBool(value))
2543
+ .option(`--enabled [value]`, `Enable or disable a webhook.`, (value) => value === undefined ? true : parseBool(value))
2330
2544
  .option(`--http-user <http-user>`, `Webhook HTTP user. Max length: 256 chars.`)
2331
2545
  .option(`--http-pass <http-pass>`, `Webhook HTTP password. Max length: 256 chars.`)
2332
2546
  .action(actionRunner(projectsUpdateWebhook))
@@ -2364,6 +2578,11 @@ module.exports = {
2364
2578
  projectsUpdatePersonalDataCheck,
2365
2579
  projectsUpdateSessionAlerts,
2366
2580
  projectsUpdateAuthStatus,
2581
+ projectsListDevKeys,
2582
+ projectsCreateDevKey,
2583
+ projectsGetDevKey,
2584
+ projectsUpdateDevKey,
2585
+ projectsDeleteDevKey,
2367
2586
  projectsCreateJWT,
2368
2587
  projectsListKeys,
2369
2588
  projectsCreateKey,
@@ -41,7 +41,7 @@ const proxy = new Command("proxy").description(commandDescriptions['proxy'] ?? '
41
41
 
42
42
  /**
43
43
  * @typedef {Object} ProxyListRulesRequestParams
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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, resourceType, resourceId, url
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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch
45
45
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
46
  * @property {boolean} overrideForCli
47
47
  * @property {boolean} parseOutput
@@ -66,6 +66,39 @@ const proxyListRules = async ({queries,search,parseOutput = true, overrideForCli
66
66
  let response = undefined;
67
67
 
68
68
  response = await client.call('get', apiPath, {
69
+ }, payload);
70
+
71
+ if (parseOutput) {
72
+ parse(response)
73
+ }
74
+
75
+ return response;
76
+
77
+ }
78
+
79
+ /**
80
+ * @typedef {Object} ProxyCreateAPIRuleRequestParams
81
+ * @property {string} domain Domain name.
82
+ * @property {boolean} overrideForCli
83
+ * @property {boolean} parseOutput
84
+ * @property {libClient | undefined} sdk
85
+ */
86
+
87
+ /**
88
+ * @param {ProxyCreateAPIRuleRequestParams} params
89
+ */
90
+ const proxyCreateAPIRule = async ({domain,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
91
+ let client = !sdk ? await sdkForProject() :
92
+ sdk;
93
+ let apiPath = '/proxy/rules/api';
94
+ let payload = {};
95
+ if (typeof domain !== 'undefined') {
96
+ payload['domain'] = domain;
97
+ }
98
+
99
+ let response = undefined;
100
+
101
+ response = await client.call('post', apiPath, {
69
102
  'content-type': 'application/json',
70
103
  }, payload);
71
104
 
@@ -78,31 +111,115 @@ const proxyListRules = async ({queries,search,parseOutput = true, overrideForCli
78
111
  }
79
112
 
80
113
  /**
81
- * @typedef {Object} ProxyCreateRuleRequestParams
114
+ * @typedef {Object} ProxyCreateFunctionRuleRequestParams
82
115
  * @property {string} domain Domain name.
83
- * @property {ResourceType} resourceType Action definition for the rule. Possible values are &quot;api&quot;, &quot;function&quot;
84
- * @property {string} resourceId ID of resource for the action type. If resourceType is &quot;api&quot;, leave empty. If resourceType is &quot;function&quot;, provide ID of the function.
116
+ * @property {string} functionId ID of function to be executed.
117
+ * @property {string} branch Name of VCS branch to deploy changes automatically
85
118
  * @property {boolean} overrideForCli
86
119
  * @property {boolean} parseOutput
87
120
  * @property {libClient | undefined} sdk
88
121
  */
89
122
 
90
123
  /**
91
- * @param {ProxyCreateRuleRequestParams} params
124
+ * @param {ProxyCreateFunctionRuleRequestParams} params
92
125
  */
93
- const proxyCreateRule = async ({domain,resourceType,resourceId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
126
+ const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
94
127
  let client = !sdk ? await sdkForProject() :
95
128
  sdk;
96
- let apiPath = '/proxy/rules';
129
+ let apiPath = '/proxy/rules/function';
130
+ let payload = {};
131
+ if (typeof domain !== 'undefined') {
132
+ payload['domain'] = domain;
133
+ }
134
+ if (typeof functionId !== 'undefined') {
135
+ payload['functionId'] = functionId;
136
+ }
137
+ if (typeof branch !== 'undefined') {
138
+ payload['branch'] = branch;
139
+ }
140
+
141
+ let response = undefined;
142
+
143
+ response = await client.call('post', apiPath, {
144
+ 'content-type': 'application/json',
145
+ }, payload);
146
+
147
+ if (parseOutput) {
148
+ parse(response)
149
+ }
150
+
151
+ return response;
152
+
153
+ }
154
+
155
+ /**
156
+ * @typedef {Object} ProxyCreateRedirectRuleRequestParams
157
+ * @property {string} domain Domain name.
158
+ * @property {string} url Target URL of redirection
159
+ * @property {StatusCode} statusCode Status code of redirection
160
+ * @property {boolean} overrideForCli
161
+ * @property {boolean} parseOutput
162
+ * @property {libClient | undefined} sdk
163
+ */
164
+
165
+ /**
166
+ * @param {ProxyCreateRedirectRuleRequestParams} params
167
+ */
168
+ const proxyCreateRedirectRule = async ({domain,url,statusCode,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
169
+ let client = !sdk ? await sdkForProject() :
170
+ sdk;
171
+ let apiPath = '/proxy/rules/redirect';
172
+ let payload = {};
173
+ if (typeof domain !== 'undefined') {
174
+ payload['domain'] = domain;
175
+ }
176
+ if (typeof url !== 'undefined') {
177
+ payload['url'] = url;
178
+ }
179
+ if (typeof statusCode !== 'undefined') {
180
+ payload['statusCode'] = statusCode;
181
+ }
182
+
183
+ let response = undefined;
184
+
185
+ response = await client.call('post', apiPath, {
186
+ 'content-type': 'application/json',
187
+ }, payload);
188
+
189
+ if (parseOutput) {
190
+ parse(response)
191
+ }
192
+
193
+ return response;
194
+
195
+ }
196
+
197
+ /**
198
+ * @typedef {Object} ProxyCreateSiteRuleRequestParams
199
+ * @property {string} domain Domain name.
200
+ * @property {string} siteId ID of site to be executed.
201
+ * @property {string} branch Name of VCS branch to deploy changes automatically
202
+ * @property {boolean} overrideForCli
203
+ * @property {boolean} parseOutput
204
+ * @property {libClient | undefined} sdk
205
+ */
206
+
207
+ /**
208
+ * @param {ProxyCreateSiteRuleRequestParams} params
209
+ */
210
+ const proxyCreateSiteRule = async ({domain,siteId,branch,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
211
+ let client = !sdk ? await sdkForProject() :
212
+ sdk;
213
+ let apiPath = '/proxy/rules/site';
97
214
  let payload = {};
98
215
  if (typeof domain !== 'undefined') {
99
216
  payload['domain'] = domain;
100
217
  }
101
- if (typeof resourceType !== 'undefined') {
102
- payload['resourceType'] = resourceType;
218
+ if (typeof siteId !== 'undefined') {
219
+ payload['siteId'] = siteId;
103
220
  }
104
- if (typeof resourceId !== 'undefined') {
105
- payload['resourceId'] = resourceId;
221
+ if (typeof branch !== 'undefined') {
222
+ payload['branch'] = branch;
106
223
  }
107
224
 
108
225
  let response = undefined;
@@ -139,7 +256,6 @@ const proxyGetRule = async ({ruleId,parseOutput = true, overrideForCli = false,
139
256
  let response = undefined;
140
257
 
141
258
  response = await client.call('get', apiPath, {
142
- 'content-type': 'application/json',
143
259
  }, payload);
144
260
 
145
261
  if (parseOutput) {
@@ -215,17 +331,39 @@ const proxyUpdateRuleVerification = async ({ruleId,parseOutput = true, overrideF
215
331
  proxy
216
332
  .command(`list-rules`)
217
333
  .description(`Get a list of all the proxy rules. You can use the query params to filter your results.`)
218
- .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, resourceType, resourceId, url`)
334
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch`)
219
335
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
220
336
  .action(actionRunner(proxyListRules))
221
337
 
222
338
  proxy
223
- .command(`create-rule`)
224
- .description(`Create a new proxy rule.`)
339
+ .command(`create-api-rule`)
340
+ .description(`Create a new proxy rule for serving Appwrite's API on custom domain.`)
341
+ .requiredOption(`--domain <domain>`, `Domain name.`)
342
+ .action(actionRunner(proxyCreateAPIRule))
343
+
344
+ proxy
345
+ .command(`create-function-rule`)
346
+ .description(`Create a new proxy rule for executing Appwrite Function on custom domain.`)
347
+ .requiredOption(`--domain <domain>`, `Domain name.`)
348
+ .requiredOption(`--function-id <function-id>`, `ID of function to be executed.`)
349
+ .option(`--branch <branch>`, `Name of VCS branch to deploy changes automatically`)
350
+ .action(actionRunner(proxyCreateFunctionRule))
351
+
352
+ proxy
353
+ .command(`create-redirect-rule`)
354
+ .description(`Create a new proxy rule for to redirect from custom domain to another domain.`)
355
+ .requiredOption(`--domain <domain>`, `Domain name.`)
356
+ .requiredOption(`--url <url>`, `Target URL of redirection`)
357
+ .requiredOption(`--status-code <status-code>`, `Status code of redirection`)
358
+ .action(actionRunner(proxyCreateRedirectRule))
359
+
360
+ proxy
361
+ .command(`create-site-rule`)
362
+ .description(`Create a new proxy rule for serving Appwrite Site on custom domain.`)
225
363
  .requiredOption(`--domain <domain>`, `Domain name.`)
226
- .requiredOption(`--resource-type <resource-type>`, `Action definition for the rule. Possible values are "api", "function"`)
227
- .option(`--resource-id <resource-id>`, `ID of resource for the action type. If resourceType is "api", leave empty. If resourceType is "function", provide ID of the function.`)
228
- .action(actionRunner(proxyCreateRule))
364
+ .requiredOption(`--site-id <site-id>`, `ID of site to be executed.`)
365
+ .option(`--branch <branch>`, `Name of VCS branch to deploy changes automatically`)
366
+ .action(actionRunner(proxyCreateSiteRule))
229
367
 
230
368
  proxy
231
369
  .command(`get-rule`)
@@ -248,7 +386,10 @@ proxy
248
386
  module.exports = {
249
387
  proxy,
250
388
  proxyListRules,
251
- proxyCreateRule,
389
+ proxyCreateAPIRule,
390
+ proxyCreateFunctionRule,
391
+ proxyCreateRedirectRule,
392
+ proxyCreateSiteRule,
252
393
  proxyGetRule,
253
394
  proxyDeleteRule,
254
395
  proxyUpdateRuleVerification