@get-dx/cli 0.5.2 → 0.5.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.
@@ -275,6 +275,7 @@ function renderStudioReport(report) {
275
275
  ui.dl([
276
276
  ui.dli("URL", ui.link(report.url)),
277
277
  ui.dli("Description", formatOptionalText(report.description)),
278
+ ui.dli("Owner", formatOwner(report.owner)),
278
279
  ui.dli("View access", formatViewAccessType(report.view_access_type)),
279
280
  ui.dli("Edit access", formatEditAccessType(report.edit_access_type)),
280
281
  ui.dli("Tiles", report.tiles.length.toString()),
@@ -328,8 +329,20 @@ async function readYamlStdin() {
328
329
  });
329
330
  }
330
331
  function buildCreateReportPayload(raw) {
331
- const { id: _id, ...rest } = parseYamlObject(raw);
332
- return rest;
332
+ const { id: _id, tiles, ...rest } = parseYamlObject(raw);
333
+ const payload = rest;
334
+ if (Array.isArray(tiles)) {
335
+ // A new report always gets fresh tiles, so drop any tile IDs carried over
336
+ // from an `init --id` scaffold (those IDs belong to the source report).
337
+ payload.tiles = tiles.map((tile) => {
338
+ if (!tile || typeof tile !== "object") {
339
+ return tile;
340
+ }
341
+ const { id: _tileId, ...tileRest } = tile;
342
+ return tileRest;
343
+ });
344
+ }
345
+ return payload;
333
346
  }
334
347
  function buildUpdateReportPayload(id, raw) {
335
348
  return { ...parseYamlObject(raw), id };
@@ -352,6 +365,7 @@ function studioReportToYaml(report) {
352
365
  edit_access_type: report.edit_access_type,
353
366
  editor_emails: [],
354
367
  tiles: report.tiles.map((tile) => ({
368
+ id: tile.id,
355
369
  title: tile.title,
356
370
  sql: tile.sql,
357
371
  chart_type: tile.chart_type,
@@ -373,6 +387,11 @@ function formatTileTitle(tile) {
373
387
  function formatOptionalText(value) {
374
388
  return value && value.trim().length > 0 ? value : ui.dim("(None)");
375
389
  }
390
+ function formatOwner(owner) {
391
+ if (!owner)
392
+ return ui.dim("(None)");
393
+ return `${owner.name} (${owner.email})`;
394
+ }
376
395
  function formatViewAccessType(value) {
377
396
  switch (value) {
378
397
  case "owner_and_direct_url_only":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-dx/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "DX CLI",
5
5
  "author": "DX <developers@getdx.com>",
6
6
  "bugs": {