appwrite-cli 6.0.0-rc.3 → 6.0.0-rc.5

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.
@@ -1,4 +1,5 @@
1
1
  const Tail = require('tail').Tail;
2
+ const { parse: parseDotenv } = require('dotenv');
2
3
  const chalk = require('chalk');
3
4
  const ignore = require("ignore");
4
5
  const tar = require("tar");
@@ -80,6 +81,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
80
81
  entrypoint: func.entrypoint,
81
82
  path: func.path,
82
83
  commands: func.commands,
84
+ scopes: func.scopes ?? []
83
85
  };
84
86
 
85
87
  drawTable([settings]);
@@ -110,7 +112,9 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
110
112
  fs.writeFileSync(errorsPath, '');
111
113
  }
112
114
 
115
+ const userVariables = {};
113
116
  const variables = {};
117
+
114
118
  if(!noVariables) {
115
119
  try {
116
120
  const { variables: remoteVariables } = await paginate(functionsListVariables, {
@@ -120,12 +124,24 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
120
124
 
121
125
  remoteVariables.forEach((v) => {
122
126
  variables[v.key] = v.value;
127
+ userVariables[v.key] = v.value;
123
128
  });
124
129
  } catch(err) {
125
130
  warn("Remote variables not fetched. Production environment variables will not be avaiable. Reason: " + err.message);
126
131
  }
127
132
  }
128
133
 
134
+ const functionPath = path.join(process.cwd(), func.path);
135
+ const envPath = path.join(functionPath, '.env');
136
+ if(fs.existsSync(envPath)) {
137
+ const env = parseDotenv(fs.readFileSync(envPath).toString() ?? '');
138
+
139
+ Object.keys(env).forEach((key) => {
140
+ variables[key] = env[key];
141
+ userVariables[key] = env[key];
142
+ });
143
+ }
144
+
129
145
  variables['APPWRITE_FUNCTION_API_ENDPOINT'] = globalConfig.getFrom('endpoint');
130
146
  variables['APPWRITE_FUNCTION_ID'] = func.$id;
131
147
  variables['APPWRITE_FUNCTION_NAME'] = func.name;
@@ -148,6 +164,13 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
148
164
  headers['x-appwrite-user-jwt'] = JwtManager.userJwt ?? '';
149
165
  variables['OPEN_RUNTIMES_HEADERS'] = JSON.stringify(headers);
150
166
 
167
+ if(Object.keys(userVariables).length > 0) {
168
+ drawTable(Object.keys(userVariables).map((key) => ({
169
+ key,
170
+ value: userVariables[key].split("").filter((_, i) => i < 16).map(() => "*").join("")
171
+ })));
172
+ }
173
+
151
174
  await dockerPull(func);
152
175
 
153
176
  new Tail(logsPath).on("line", function(data) {
@@ -158,10 +181,27 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
158
181
  });
159
182
 
160
183
  if(!noReload) {
184
+ const ignorer = ignore();
185
+ ignorer.add('.appwrite');
186
+ ignorer.add('code.tar.gz');
187
+
188
+ if (func.ignore) {
189
+ ignorer.add(func.ignore);
190
+ } else if (fs.existsSync(path.join(functionPath, '.gitignore'))) {
191
+ ignorer.add(fs.readFileSync(path.join(functionPath, '.gitignore')).toString());
192
+ }
193
+
161
194
  chokidar.watch('.', {
162
195
  cwd: path.join(process.cwd(), func.path),
163
196
  ignoreInitial: true,
164
- ignored: [ ...(func.ignore ?? []), 'code.tar.gz', '.appwrite', '.appwrite/', '.appwrite/*', '.appwrite/**', '.appwrite/*.*', '.appwrite/**/*.*' ]
197
+ ignored: (xpath) => {
198
+ const relativePath = path.relative(functionPath, xpath);
199
+
200
+ if(!relativePath) {
201
+ return false;
202
+ }
203
+ return ignorer.ignores(relativePath);
204
+ }
165
205
  }).on('all', async (_event, filePath) => {
166
206
  Queue.push(filePath);
167
207
  });
@@ -187,7 +227,6 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
187
227
  } else {
188
228
  log('Hot-swapping function.. Files with change are ' + files.join(', '));
189
229
 
190
- const functionPath = path.join(process.cwd(), func.path);
191
230
  const hotSwapPath = path.join(functionPath, '.appwrite/hot-swap');
192
231
  const buildPath = path.join(functionPath, '.appwrite/build.tar.gz');
193
232
 
@@ -201,6 +240,7 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
201
240
 
202
241
  await tar
203
242
  .extract({
243
+ keep: true,
204
244
  gzip: true,
205
245
  sync: true,
206
246
  cwd: hotSwapPath,
@@ -211,6 +251,8 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
211
251
  ignorer.add('.appwrite');
212
252
  if (func.ignore) {
213
253
  ignorer.add(func.ignore);
254
+ } else if (fs.existsSync(path.join(functionPath, '.gitignore'))) {
255
+ ignorer.add(fs.readFileSync(path.join(functionPath, '.gitignore')).toString());
214
256
  }
215
257
 
216
258
  const filesToCopy = getAllFiles(functionPath).map((file) => path.relative(functionPath, file)).filter((file) => !ignorer.ignores(file));
@@ -237,8 +279,6 @@ const runFunction = async ({ port, functionId, noVariables, noReload, userId } =
237
279
  file: buildPath
238
280
  }, ['.']);
239
281
 
240
- fs.rmSync(hotSwapPath, { recursive: true, force: true });
241
-
242
282
  await dockerStart(func, variables, port);
243
283
  }
244
284
  } catch(err) {
@@ -278,11 +318,11 @@ run
278
318
  .command("function")
279
319
  .alias("functions")
280
320
  .description("Run functions in the current directory.")
281
- .option(`--functionId <functionId>`, `Function ID`)
321
+ .option(`--function-id <function-id>`, `ID of function to run`)
282
322
  .option(`--port <port>`, `Local port`)
283
- .option(`--userId <userId>`, `ID of user to impersonate`)
284
- .option(`--noVariables`, `Prevent pulling variables from function settings`)
285
- .option(`--noReload`, `Prevent live reloading of server when changes are made to function files`)
323
+ .option(`--user-id <user-id>`, `ID of user to impersonate`)
324
+ .option(`--no-variables`, `Prevent pulling variables from function settings`)
325
+ .option(`--no-reload`, `Prevent live reloading of server when changes are made to function files`)
286
326
  .action(actionRunner(runFunction));
287
327
 
288
328
  module.exports = {
@@ -838,7 +838,7 @@ const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrid
838
838
  }
839
839
 
840
840
  storage
841
- .command(`listBuckets`)
841
+ .command(`list-buckets`)
842
842
  .description(`Get a list of all the storage buckets. You can use the query params to filter your results.`)
843
843
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus`)
844
844
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
@@ -846,110 +846,110 @@ storage
846
846
  .action(actionRunner(storageListBuckets))
847
847
 
848
848
  storage
849
- .command(`createBucket`)
849
+ .command(`create-bucket`)
850
850
  .description(`Create a new storage bucket.`)
851
- .requiredOption(`--bucketId <bucketId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
851
+ .requiredOption(`--bucket-id <bucket-id>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
852
852
  .requiredOption(`--name <name>`, `Bucket name`)
853
853
  .option(`--permissions [permissions...]`, `An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
854
- .option(`--fileSecurity <fileSecurity>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool)
854
+ .option(`--file-security <file-security>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool)
855
855
  .option(`--enabled <enabled>`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, parseBool)
856
- .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
857
- .option(`--allowedFileExtensions [allowedFileExtensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
856
+ .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
857
+ .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
858
858
  .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
859
859
  .option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool)
860
860
  .option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool)
861
861
  .action(actionRunner(storageCreateBucket))
862
862
 
863
863
  storage
864
- .command(`getBucket`)
864
+ .command(`get-bucket`)
865
865
  .description(`Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.`)
866
- .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`)
866
+ .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`)
867
867
  .option(`--console`, `Get the resource console url`)
868
868
  .action(actionRunner(storageGetBucket))
869
869
 
870
870
  storage
871
- .command(`updateBucket`)
871
+ .command(`update-bucket`)
872
872
  .description(`Update a storage bucket by its unique ID.`)
873
- .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`)
873
+ .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`)
874
874
  .requiredOption(`--name <name>`, `Bucket name`)
875
875
  .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
876
- .option(`--fileSecurity <fileSecurity>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool)
876
+ .option(`--file-security <file-security>`, `Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).`, parseBool)
877
877
  .option(`--enabled <enabled>`, `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`, parseBool)
878
- .option(`--maximumFileSize <maximumFileSize>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
879
- .option(`--allowedFileExtensions [allowedFileExtensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
878
+ .option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger)
879
+ .option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`)
880
880
  .option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
881
881
  .option(`--encryption <encryption>`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, parseBool)
882
882
  .option(`--antivirus <antivirus>`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, parseBool)
883
883
  .action(actionRunner(storageUpdateBucket))
884
884
 
885
885
  storage
886
- .command(`deleteBucket`)
886
+ .command(`delete-bucket`)
887
887
  .description(`Delete a storage bucket by its unique ID.`)
888
- .requiredOption(`--bucketId <bucketId>`, `Bucket unique ID.`)
888
+ .requiredOption(`--bucket-id <bucket-id>`, `Bucket unique ID.`)
889
889
  .action(actionRunner(storageDeleteBucket))
890
890
 
891
891
  storage
892
- .command(`listFiles`)
892
+ .command(`list-files`)
893
893
  .description(`Get a list of all the user files. You can use the query params to filter your results.`)
894
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
894
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
895
895
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded`)
896
896
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
897
897
  .option(`--console`, `Get the resource console url`)
898
898
  .action(actionRunner(storageListFiles))
899
899
 
900
900
  storage
901
- .command(`createFile`)
901
+ .command(`create-file`)
902
902
  .description(`Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of '5MB'. The 'content-range' header values should always be in bytes. When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in 'x-appwrite-id' header to allow the server to know that the partial upload is for the existing file and not for a new one. If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. `)
903
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
904
- .requiredOption(`--fileId <fileId>`, `File ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
903
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
904
+ .requiredOption(`--file-id <file-id>`, `File ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
905
905
  .requiredOption(`--file <file>`, `Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).`)
906
906
  .option(`--permissions [permissions...]`, `An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
907
907
  .action(actionRunner(storageCreateFile))
908
908
 
909
909
  storage
910
- .command(`getFile`)
910
+ .command(`get-file`)
911
911
  .description(`Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.`)
912
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
913
- .requiredOption(`--fileId <fileId>`, `File ID.`)
912
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
913
+ .requiredOption(`--file-id <file-id>`, `File ID.`)
914
914
  .option(`--console`, `Get the resource console url`)
915
915
  .action(actionRunner(storageGetFile))
916
916
 
917
917
  storage
918
- .command(`updateFile`)
918
+ .command(`update-file`)
919
919
  .description(`Update a file by its unique ID. Only users with write permissions have access to update this resource.`)
920
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
921
- .requiredOption(`--fileId <fileId>`, `File unique ID.`)
920
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
921
+ .requiredOption(`--file-id <file-id>`, `File unique ID.`)
922
922
  .option(`--name <name>`, `Name of the file`)
923
923
  .option(`--permissions [permissions...]`, `An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
924
924
  .action(actionRunner(storageUpdateFile))
925
925
 
926
926
  storage
927
- .command(`deleteFile`)
927
+ .command(`delete-file`)
928
928
  .description(`Delete a file by its unique ID. Only users with write permissions have access to delete this resource.`)
929
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
930
- .requiredOption(`--fileId <fileId>`, `File ID.`)
929
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
930
+ .requiredOption(`--file-id <file-id>`, `File ID.`)
931
931
  .action(actionRunner(storageDeleteFile))
932
932
 
933
933
  storage
934
- .command(`getFileDownload`)
934
+ .command(`get-file-download`)
935
935
  .description(`Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.`)
936
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
937
- .requiredOption(`--fileId <fileId>`, `File ID.`)
936
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
937
+ .requiredOption(`--file-id <file-id>`, `File ID.`)
938
938
  .requiredOption(`--destination <path>`, `output file path.`)
939
939
  .action(actionRunner(storageGetFileDownload))
940
940
 
941
941
  storage
942
- .command(`getFilePreview`)
942
+ .command(`get-file-preview`)
943
943
  .description(`Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.`)
944
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
945
- .requiredOption(`--fileId <fileId>`, `File ID`)
944
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
945
+ .requiredOption(`--file-id <file-id>`, `File ID`)
946
946
  .option(`--width <width>`, `Resize preview image width, Pass an integer between 0 to 4000.`, parseInteger)
947
947
  .option(`--height <height>`, `Resize preview image height, Pass an integer between 0 to 4000.`, parseInteger)
948
948
  .option(`--gravity <gravity>`, `Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right`)
949
949
  .option(`--quality <quality>`, `Preview image quality. Pass an integer between 0 to 100. Defaults to 100.`, parseInteger)
950
- .option(`--borderWidth <borderWidth>`, `Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.`, parseInteger)
951
- .option(`--borderColor <borderColor>`, `Preview image border color. Use a valid HEX color, no # is needed for prefix.`)
952
- .option(`--borderRadius <borderRadius>`, `Preview image border radius in pixels. Pass an integer between 0 to 4000.`, parseInteger)
950
+ .option(`--border-width <border-width>`, `Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.`, parseInteger)
951
+ .option(`--border-color <border-color>`, `Preview image border color. Use a valid HEX color, no # is needed for prefix.`)
952
+ .option(`--border-radius <border-radius>`, `Preview image border radius in pixels. Pass an integer between 0 to 4000.`, parseInteger)
953
953
  .option(`--opacity <opacity>`, `Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.`, parseInteger)
954
954
  .option(`--rotation <rotation>`, `Preview image rotation in degrees. Pass an integer between -360 and 360.`, parseInteger)
955
955
  .option(`--background <background>`, `Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.`)
@@ -958,23 +958,23 @@ storage
958
958
  .action(actionRunner(storageGetFilePreview))
959
959
 
960
960
  storage
961
- .command(`getFileView`)
961
+ .command(`get-file-view`)
962
962
  .description(`Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.`)
963
- .requiredOption(`--bucketId <bucketId>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
964
- .requiredOption(`--fileId <fileId>`, `File ID.`)
963
+ .requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).`)
964
+ .requiredOption(`--file-id <file-id>`, `File ID.`)
965
965
  .requiredOption(`--destination <path>`, `output file path.`)
966
966
  .action(actionRunner(storageGetFileView))
967
967
 
968
968
  storage
969
- .command(`getUsage`)
969
+ .command(`get-usage`)
970
970
  .description(``)
971
971
  .option(`--range <range>`, `Date range.`)
972
972
  .action(actionRunner(storageGetUsage))
973
973
 
974
974
  storage
975
- .command(`getBucketUsage`)
975
+ .command(`get-bucket-usage`)
976
976
  .description(``)
977
- .requiredOption(`--bucketId <bucketId>`, `Bucket ID.`)
977
+ .requiredOption(`--bucket-id <bucket-id>`, `Bucket ID.`)
978
978
  .option(`--range <range>`, `Date range.`)
979
979
  .option(`--console`, `Get the resource console url`)
980
980
  .action(actionRunner(storageGetBucketUsage))
@@ -587,7 +587,7 @@ teams
587
587
  teams
588
588
  .command(`create`)
589
589
  .description(`Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.`)
590
- .requiredOption(`--teamId <teamId>`, `Team ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
590
+ .requiredOption(`--team-id <team-id>`, `Team ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
591
591
  .requiredOption(`--name <name>`, `Team name. Max length: 128 chars.`)
592
592
  .option(`--roles [roles...]`, `Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
593
593
  .action(actionRunner(teamsCreate))
@@ -595,91 +595,91 @@ teams
595
595
  teams
596
596
  .command(`get`)
597
597
  .description(`Get a team by its ID. All team members have read access for this resource.`)
598
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
598
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
599
599
  .option(`--console`, `Get the resource console url`)
600
600
  .action(actionRunner(teamsGet))
601
601
 
602
602
  teams
603
- .command(`updateName`)
603
+ .command(`update-name`)
604
604
  .description(`Update the team's name by its unique ID.`)
605
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
605
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
606
606
  .requiredOption(`--name <name>`, `New team name. Max length: 128 chars.`)
607
607
  .action(actionRunner(teamsUpdateName))
608
608
 
609
609
  teams
610
610
  .command(`delete`)
611
611
  .description(`Delete a team using its ID. Only team members with the owner role can delete the team.`)
612
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
612
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
613
613
  .action(actionRunner(teamsDelete))
614
614
 
615
615
  teams
616
- .command(`listLogs`)
616
+ .command(`list-logs`)
617
617
  .description(`Get the team activity logs list by its unique ID.`)
618
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
618
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
619
619
  .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`)
620
620
  .action(actionRunner(teamsListLogs))
621
621
 
622
622
  teams
623
- .command(`listMemberships`)
623
+ .command(`list-memberships`)
624
624
  .description(`Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.`)
625
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
625
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
626
626
  .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`)
627
627
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
628
628
  .action(actionRunner(teamsListMemberships))
629
629
 
630
630
  teams
631
- .command(`createMembership`)
631
+ .command(`create-membership`)
632
632
  .description(`Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. Use the 'url' parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. `)
633
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
633
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
634
634
  .requiredOption(`--roles [roles...]`, `Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
635
635
  .option(`--email <email>`, `Email of the new team member.`)
636
- .option(`--userId <userId>`, `ID of the user to be added to a team.`)
636
+ .option(`--user-id <user-id>`, `ID of the user to be added to a team.`)
637
637
  .option(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
638
638
  .option(`--url <url>`, `URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
639
639
  .option(`--name <name>`, `Name of the new team member. Max length: 128 chars.`)
640
640
  .action(actionRunner(teamsCreateMembership))
641
641
 
642
642
  teams
643
- .command(`getMembership`)
643
+ .command(`get-membership`)
644
644
  .description(`Get a team member by the membership unique id. All team members have read access for this resource.`)
645
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
646
- .requiredOption(`--membershipId <membershipId>`, `Membership ID.`)
645
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
646
+ .requiredOption(`--membership-id <membership-id>`, `Membership ID.`)
647
647
  .action(actionRunner(teamsGetMembership))
648
648
 
649
649
  teams
650
- .command(`updateMembership`)
650
+ .command(`update-membership`)
651
651
  .description(`Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). `)
652
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
653
- .requiredOption(`--membershipId <membershipId>`, `Membership ID.`)
652
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
653
+ .requiredOption(`--membership-id <membership-id>`, `Membership ID.`)
654
654
  .requiredOption(`--roles [roles...]`, `An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.`)
655
655
  .action(actionRunner(teamsUpdateMembership))
656
656
 
657
657
  teams
658
- .command(`deleteMembership`)
658
+ .command(`delete-membership`)
659
659
  .description(`This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.`)
660
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
661
- .requiredOption(`--membershipId <membershipId>`, `Membership ID.`)
660
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
661
+ .requiredOption(`--membership-id <membership-id>`, `Membership ID.`)
662
662
  .action(actionRunner(teamsDeleteMembership))
663
663
 
664
664
  teams
665
- .command(`updateMembershipStatus`)
665
+ .command(`update-membership-status`)
666
666
  .description(`Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. If the request is successful, a session for the user is automatically created. `)
667
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
668
- .requiredOption(`--membershipId <membershipId>`, `Membership ID.`)
669
- .requiredOption(`--userId <userId>`, `User ID.`)
667
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
668
+ .requiredOption(`--membership-id <membership-id>`, `Membership ID.`)
669
+ .requiredOption(`--user-id <user-id>`, `User ID.`)
670
670
  .requiredOption(`--secret <secret>`, `Secret key.`)
671
671
  .action(actionRunner(teamsUpdateMembershipStatus))
672
672
 
673
673
  teams
674
- .command(`getPrefs`)
674
+ .command(`get-prefs`)
675
675
  .description(`Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).`)
676
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
676
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
677
677
  .action(actionRunner(teamsGetPrefs))
678
678
 
679
679
  teams
680
- .command(`updatePrefs`)
680
+ .command(`update-prefs`)
681
681
  .description(`Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.`)
682
- .requiredOption(`--teamId <teamId>`, `Team ID.`)
682
+ .requiredOption(`--team-id <team-id>`, `Team ID.`)
683
683
  .requiredOption(`--prefs <prefs>`, `Prefs key-value JSON object.`)
684
684
  .action(actionRunner(teamsUpdatePrefs))
685
685