@magda/scripts 0.0.60-alpha.6 → 0.0.60-dt.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.
package/create-api-key.js CHANGED
@@ -105,12 +105,12 @@ function printResult(result) {
105
105
 
106
106
  if (!keys || !keys.rows || !keys.rows.length) {
107
107
  throw new Error(
108
- `Cannot any api keys for user id: ${options.userId}`
108
+ `Cannot find any api keys for user id: ${options.userId}`
109
109
  );
110
110
  }
111
111
 
112
112
  printResult(keys);
113
- } else {
113
+ } else if (options.create) {
114
114
  // --- create a new API key
115
115
  const newKey = await generateAPIKey(API_KEY_LENGTH);
116
116
  const keyHash = await bcrypt.hash(newKey, SALT_ROUNDS);
@@ -128,6 +128,10 @@ function printResult(result) {
128
128
  );
129
129
  console.log(` API key: ${newKey}`);
130
130
  console.log(`API key ID: ${apiKeyId}`);
131
+ } else {
132
+ throw new Error(
133
+ "When userId is supplied, either -l or -c switch must be set."
134
+ );
131
135
  }
132
136
  } else {
133
137
  // --- list all users
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magda/scripts",
3
- "version": "0.0.60-alpha.6",
3
+ "version": "0.0.60-dt.0",
4
4
  "description": "Scripts for building, running, and deploying MAGDA",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {