@get-dx/cli 0.3.6 → 0.3.8

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.
@@ -19,6 +19,7 @@ export function entitiesCommand() {
19
19
  .option("--name <name>", "Display name of the entity")
20
20
  .option("--description <desc>", "Description of the entity")
21
21
  .option("--owner-team-ids <ids>", "Comma-separated owner team IDs")
22
+ .option("--owner-user-emails <emails>", "Comma-separated owner user emails")
22
23
  .option("--owner-user-ids <ids>", "Comma-separated owner user IDs")
23
24
  .option("--property <kv>", "Set a property value as key=value. Repeat for multiple properties.", (val, prev) => [...prev, val], [])
24
25
  .option("--alias <kv>", "Set an alias value as key=value. Repeat for multiple aliases.", (val, prev) => [...prev, val], [])
@@ -57,12 +58,9 @@ export function entitiesCommand() {
57
58
  type: options.type,
58
59
  name: options.name,
59
60
  description: options.description,
60
- owner_team_ids: options.ownerTeamIds
61
- ?.split(",")
62
- .map((s) => s.trim()),
63
- owner_user_ids: options.ownerUserIds
64
- ?.split(",")
65
- .map((s) => s.trim()),
61
+ owner_team_ids: parseCommaSeparatedValues(options.ownerTeamIds),
62
+ owner_user_emails: parseCommaSeparatedValues(options.ownerUserEmails),
63
+ owner_user_ids: parseCommaSeparatedValues(options.ownerUserIds),
66
64
  ...resolvedValues,
67
65
  });
68
66
  if (runtime.context.json) {
@@ -103,6 +101,7 @@ export function entitiesCommand() {
103
101
  .option("--name <name>", "Display name of the entity")
104
102
  .option("--description <desc>", "Description of the entity")
105
103
  .option("--owner-team-ids <ids>", "Comma-separated owner team IDs")
104
+ .option("--owner-user-emails <emails>", "Comma-separated owner user emails")
106
105
  .option("--owner-user-ids <ids>", "Comma-separated owner user IDs")
107
106
  .option("--property <kv>", "Set a property value as key=value. Repeat for multiple properties. Use value null to remove a property.", (val, prev) => [...prev, val], [])
108
107
  .option("--alias <kv>", "Set an alias value as key=value. Repeat for multiple aliases. Use value null to remove an alias.", (val, prev) => [...prev, val], [])
@@ -146,6 +145,7 @@ export function entitiesCommand() {
146
145
  .option("--name <name>", "Display name of the entity")
147
146
  .option("--description <desc>", "Description of the entity")
148
147
  .option("--owner-team-ids <ids>", "Comma-separated owner team IDs")
148
+ .option("--owner-user-emails <emails>", "Comma-separated owner user emails")
149
149
  .option("--owner-user-ids <ids>", "Comma-separated owner user IDs")
150
150
  .option("--property <kv>", "Set a property value as key=value. Repeat for multiple properties. Use value null to remove a property.", (val, prev) => [...prev, val], [])
151
151
  .option("--alias <kv>", "Set an alias value as key=value. Repeat for multiple aliases. Use value null to remove an alias.", (val, prev) => [...prev, val], [])
@@ -300,8 +300,10 @@ export function entitiesCommand() {
300
300
  .command("scorecards")
301
301
  .description("Get the current scorecard report for an entity")
302
302
  .argument("<identifier>", "Entity identifier")
303
+ .option("--check-ids <ids>", "Comma-separated check IDs to filter the report to")
303
304
  .option("--cursor <cursor>", "Cursor for the next page of results")
304
305
  .option("--limit <n>", "Max scorecards per page (default is 50)", (value) => parsePositiveIntOption(value, "--limit"))
306
+ .option("--only-failing", "Return only checks that are not passing (exempted failing checks are still included)")
305
307
  .addHelpText("afterAll", createExampleText([
306
308
  {
307
309
  label: "Get scorecards for the `login-frontend` entity",
@@ -315,12 +317,22 @@ export function entitiesCommand() {
315
317
  label: "Fetch the next page of scorecards",
316
318
  command: "dx catalog entities scorecards login-frontend --cursor xuvkgfq9t0ty",
317
319
  },
320
+ {
321
+ label: "Show only checks that are not passing",
322
+ command: "dx catalog entities scorecards login-frontend --only-failing",
323
+ },
324
+ {
325
+ label: "Filter the report to specific checks",
326
+ command: "dx catalog entities scorecards login-frontend --check-ids NDQ,NTU",
327
+ },
318
328
  ]))
319
329
  .action(wrapAction(async (identifier, options, command) => {
320
330
  const runtime = await buildRuntime(getContext(command));
321
331
  const response = await getEntityScorecards(runtime, identifier, {
332
+ check_ids: parseCommaSeparatedValues(options.checkIds),
322
333
  cursor: options.cursor,
323
334
  limit: options.limit,
335
+ only_failing: options.onlyFailing,
324
336
  });
325
337
  if (runtime.context.json) {
326
338
  renderJson(response);
@@ -383,11 +395,18 @@ async function upsertEntity(runtime, identifier, params) {
383
395
  return response.body;
384
396
  }
385
397
  async function getEntityScorecards(runtime, identifier, params) {
386
- const query = { identifier };
398
+ const query = {
399
+ identifier,
400
+ };
387
401
  if (params.cursor !== undefined)
388
402
  query.cursor = params.cursor;
389
403
  if (params.limit !== undefined)
390
404
  query.limit = params.limit;
405
+ if (params.only_failing)
406
+ query.only_failing = true;
407
+ if (params.check_ids !== undefined && params.check_ids.length > 0) {
408
+ query.check_ids = params.check_ids.join(",");
409
+ }
391
410
  const response = await request(runtime, "/catalog.entities.scorecards", {
392
411
  method: "GET",
393
412
  query,
@@ -585,11 +604,12 @@ function getEntityMutationOptionValues(options) {
585
604
  return {
586
605
  name: options.name,
587
606
  description: options.description,
588
- owner_team_ids: parseCommaSeparatedIds(options.ownerTeamIds),
589
- owner_user_ids: parseCommaSeparatedIds(options.ownerUserIds),
607
+ owner_team_ids: parseCommaSeparatedValues(options.ownerTeamIds),
608
+ owner_user_emails: parseCommaSeparatedValues(options.ownerUserEmails),
609
+ owner_user_ids: parseCommaSeparatedValues(options.ownerUserIds),
590
610
  };
591
611
  }
592
- function parseCommaSeparatedIds(value) {
612
+ function parseCommaSeparatedValues(value) {
593
613
  if (value === undefined) {
594
614
  return undefined;
595
615
  }
@@ -610,6 +630,8 @@ function buildEntityMutationBody(identifier, params) {
610
630
  body.description = params.description;
611
631
  if (params.owner_team_ids?.length)
612
632
  body.owner_team_ids = params.owner_team_ids;
633
+ if (params.owner_user_emails?.length)
634
+ body.owner_user_emails = params.owner_user_emails;
613
635
  if (params.owner_user_ids?.length)
614
636
  body.owner_user_ids = params.owner_user_ids;
615
637
  if (params.properties !== undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-dx/cli",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "DX CLI",
5
5
  "author": "DX <developers@getdx.com>",
6
6
  "bugs": {