clever-tools 3.8.2 → 3.8.3

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/bin/clever.js CHANGED
@@ -41,8 +41,9 @@ if (!updateNotifierExplicitFalse && !isRunThroughPackagedBinary) {
41
41
  pkg,
42
42
  tagsUrl: 'https://api.github.com/repos/CleverCloud/clever-tools/tags',
43
43
  }).notify({
44
+ isGlobal: true,
44
45
  getDetails () {
45
- const docsUrl = 'https://www.clever-cloud.com/doc/clever-tools/getting_started';
46
+ const docsUrl = 'https://github.com/CleverCloud/clever-tools/tree/master/docs#how-to-use-clever-tools';
46
47
  return `\nPlease follow this link to update your clever-tools:\n${docsUrl}`;
47
48
  },
48
49
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clever-tools",
3
- "version": "3.8.2",
3
+ "version": "3.8.3",
4
4
  "description": "Command Line Interface for Clever Cloud.",
5
5
  "main": "bin/clever.js",
6
6
  "keywords": [
@@ -70,8 +70,7 @@
70
70
  "mocha": "8.4.0",
71
71
  "pkg": "5.8.1",
72
72
  "rollup": "4.14.1",
73
- "semver": "7.3.5",
74
- "text-table": "0.2.0"
73
+ "semver": "7.3.5"
75
74
  },
76
75
  "overrides": {
77
76
  "pkg-fetch": "3.5.2"
@@ -117,6 +117,12 @@ function displayAddon (format, addon, providerName, message) {
117
117
  'Learn more about Materia KV on Clever Cloud: https://developers.clever-cloud.com/doc/addons/materia-kv/',
118
118
  ].join('\n'),
119
119
  },
120
+ metabase: {
121
+ status: 'tech preview',
122
+ postCreateInstructions: [
123
+ 'Learn more about Metabase on Clever Cloud: https://developers.clever-cloud.com/doc/addons/metabase/',
124
+ ].join('\n'),
125
+ },
120
126
  'addon-pulsar': {
121
127
  status: 'beta',
122
128
  postCreateInstructions: [
@@ -176,7 +182,17 @@ async function deleteAddon (params) {
176
182
  const { yes: skipConfirmation, org: orgaIdOrName } = params.options;
177
183
  const [addon] = params.args;
178
184
 
179
- const ownerId = await Organisation.getId(orgaIdOrName);
185
+ let ownerId = await Organisation.getId(orgaIdOrName);
186
+
187
+ if (ownerId == null && addon.addon_id != null) {
188
+ ownerId = await Addon.findOwnerId(ownerId, addon.addon_id);
189
+ }
190
+
191
+ if (ownerId == null && addon.addon_name != null) {
192
+ const foundAddon = await Addon.findByName(addon.addon_name);
193
+ ownerId = foundAddon.orgaId;
194
+ }
195
+
180
196
  await Addon.delete(ownerId, addon, skipConfirmation);
181
197
 
182
198
  Logger.println(`Addon ${addon.addon_id || addon.addon_name} successfully deleted`);
@@ -243,6 +243,22 @@ async function findById (addonId) {
243
243
  throw new Error(`Could not find add-on with ID: ${addonId}`);
244
244
  }
245
245
 
246
+ async function findByName (addonName) {
247
+ const { user, organisations } = await getSummary({}).then(sendToApi);
248
+ for (const orga of [user, ...organisations]) {
249
+ for (const simpleAddon of orga.addons) {
250
+ if (simpleAddon.name === addonName) {
251
+ const addon = await getAddon({ id: orga.id, addonId: simpleAddon.id }).then(sendToApi);
252
+ return {
253
+ ...addon,
254
+ orgaId: orga.id,
255
+ };
256
+ }
257
+ }
258
+ }
259
+ throw new Error(`Could not find add-on with name ${addonName}`);
260
+ }
261
+
246
262
  async function findOwnerId (org, addonId) {
247
263
 
248
264
  if (org != null && org.orga_id != null) {
@@ -305,6 +321,7 @@ module.exports = {
305
321
  delete: deleteAddon,
306
322
  findById,
307
323
  findOwnerId,
324
+ findByName,
308
325
  getProvider,
309
326
  getProviderInfos,
310
327
  link,