@occam-scaly/scaly-cli 0.2.2 → 0.2.4

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/lib/scaly-api.js CHANGED
@@ -232,11 +232,12 @@ const QUERIES = {
232
232
  }
233
233
  `,
234
234
  listAddOnsByName: `
235
- query ListAddOnsByName($name: String!) {
235
+ query ListAddOnsByName($name: String!, $accountId: String!) {
236
236
  listAddOns(
237
237
  where: {
238
238
  AND: [
239
239
  { name: { equals: $name } }
240
+ { accountId: { equals: $accountId } }
240
241
  { isDeleted: { equals: false } }
241
242
  ]
242
243
  }
@@ -342,8 +343,11 @@ async function findAccountBySlug(slug) {
342
343
  }
343
344
  }
344
345
 
345
- async function findAddOnByName(name) {
346
- const data = await graphqlRequest(QUERIES.listAddOnsByName, { name });
346
+ async function findAddOnByName({ name, accountId }) {
347
+ const data = await graphqlRequest(QUERIES.listAddOnsByName, {
348
+ name,
349
+ accountId
350
+ });
347
351
  return data?.listAddOns || [];
348
352
  }
349
353
 
package/lib/scaly-plan.js CHANGED
@@ -32,7 +32,15 @@ function mapAddOnType(type) {
32
32
  const t = String(type || '').toLowerCase();
33
33
  if (t === 'database') return 'DATABASE';
34
34
  if (t === 'storage' || t === 'storage_s3' || t === 's3') return 'STORAGE_S3';
35
- if (t === 'cognito' || t === 'userpool' || t === 'user_pool')
35
+ if (
36
+ t === 'cognito' ||
37
+ t === 'userpool' ||
38
+ t === 'user_pool' ||
39
+ t === 'usergroups' ||
40
+ t === 'user_groups' ||
41
+ t === 'user-groups' ||
42
+ t === 'auth'
43
+ )
36
44
  return 'COGNITO';
37
45
  if (t === 'cname') return 'CNAME';
38
46
  return null;
@@ -266,7 +274,7 @@ async function buildPlan({ config, env, appName }) {
266
274
 
267
275
  let currentAddOn = null;
268
276
  try {
269
- const list = await api.findAddOnByName(addOn.name);
277
+ const list = await api.findAddOnByName({ name: addOn.name, accountId });
270
278
  currentAddOn = list?.[0] || null;
271
279
  if (list.length > 1) {
272
280
  warnings.push(
@@ -275,8 +283,9 @@ async function buildPlan({ config, env, appName }) {
275
283
  }
276
284
  } catch (err) {
277
285
  addOnReadable = false;
286
+ const msg = String(err && err.message ? err.message : err);
278
287
  warnings.push(
279
- 'Unable to read add-ons from the API (auth/permissions). Add-on planning is skipped for now.'
288
+ `Unable to read add-ons from the API (auth/permissions): ${msg}`
280
289
  );
281
290
  break;
282
291
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occam-scaly/scaly-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Scaly CLI (auth + project config helpers)",
5
5
  "bin": {
6
6
  "scaly": "./bin/scaly.js"