@get-dx/cli 0.5.3 → 0.5.5

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/dist/cli.js CHANGED
@@ -10,11 +10,9 @@ import { workflowRunsCommand } from "./commands/workflowRuns.js";
10
10
  import { workflowsCommand } from "./commands/workflows.js";
11
11
  import { handleError } from "./commandHelpers.js";
12
12
  import cliPackage from "../package.json" with { type: "json" };
13
- import { handleTemporaryBaseUrlMigration } from "./config.js";
14
13
  import { checkForNewVersion, performUpdate, promptVersionUpdate, } from "./versionCheck.js";
15
14
  export async function run(argv = process.argv) {
16
15
  try {
17
- handleTemporaryBaseUrlMigration(argv);
18
16
  const program = createProgram();
19
17
  if (argv.length <= 2) {
20
18
  program.outputHelp();
@@ -329,8 +329,20 @@ async function readYamlStdin() {
329
329
  });
330
330
  }
331
331
  function buildCreateReportPayload(raw) {
332
- const { id: _id, ...rest } = parseYamlObject(raw);
333
- 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;
334
346
  }
335
347
  function buildUpdateReportPayload(id, raw) {
336
348
  return { ...parseYamlObject(raw), id };
@@ -353,6 +365,7 @@ function studioReportToYaml(report) {
353
365
  edit_access_type: report.edit_access_type,
354
366
  editor_emails: [],
355
367
  tiles: report.tiles.map((tile) => ({
368
+ id: tile.id,
356
369
  title: tile.title,
357
370
  sql: tile.sql,
358
371
  chart_type: tile.chart_type,
package/dist/config.js CHANGED
@@ -45,64 +45,6 @@ export function persistVersionPromptSelection(prompt) {
45
45
  }
46
46
  writeConfig(config);
47
47
  }
48
- /**
49
- * Responsible for handling the migration from `baseUrl` to `apiBaseUrl` and `webBaseUrl`,
50
- * so the upgrade to 0.3.x will be non-breaking for `cloud` and `dedicated` deployments.
51
- *
52
- * `managed` deployments will encounter an error and will have to reauthenticate.
53
- *
54
- * TODO: delete after 2026-07-01.
55
- */
56
- export function handleTemporaryBaseUrlMigration(argv) {
57
- if (!process.env.VITEST) {
58
- // Running tests - we don't want our permanent tests to exercise this logic
59
- return;
60
- }
61
- const COMMANDS_TO_SKIP_MIGRATION = ["login", "logout", "init"];
62
- if (COMMANDS_TO_SKIP_MIGRATION.some((command) => argv.includes(command))) {
63
- // Logging in or logging out: we need to ignore the current config file's contents
64
- return;
65
- }
66
- const configPath = getConfigPath();
67
- if (!fs.existsSync(configPath)) {
68
- // No config file, no need to migrate
69
- return;
70
- }
71
- const content = fs.readFileSync(configPath, "utf8");
72
- const raw = JSON.parse(content);
73
- const api = raw.apiBaseUrl;
74
- const web = raw.webBaseUrl;
75
- if (api !== undefined && web !== undefined) {
76
- // Already migrated, no need to do anything
77
- return;
78
- }
79
- if (raw.baseUrl) {
80
- // Legacy baseUrl is present, migrate to apiBaseUrl and webBaseUrl
81
- const apiBaseUrl = raw.baseUrl;
82
- let webBaseUrl;
83
- if (apiBaseUrl.endsWith(".getdx.com")) {
84
- // Migrate `cloud`
85
- webBaseUrl = "https://app.getdx.com";
86
- writeConfig({
87
- apiBaseUrl: normalizeUrl(apiBaseUrl),
88
- webBaseUrl: normalizeUrl(webBaseUrl),
89
- });
90
- return;
91
- }
92
- const dedicatedMatch = apiBaseUrl.match(/^api\.(.+)\.getdx\.io$/);
93
- if (dedicatedMatch) {
94
- // Migrate `dedicated`
95
- webBaseUrl = `https://${dedicatedMatch[1]}.getdx.io`;
96
- writeConfig({
97
- apiBaseUrl: normalizeUrl(apiBaseUrl),
98
- webBaseUrl: normalizeUrl(webBaseUrl),
99
- });
100
- return;
101
- }
102
- // Unable to automatically migrate `managed`
103
- throw new CliError("Your on-disk DX CLI config is missing apiBaseUrl and webBaseUrl. Run `dx auth logout`, then login again via `dx init` or `dx auth login`.");
104
- }
105
- }
106
48
  export function writeConfig(config) {
107
49
  fs.mkdirSync(getConfigDir(), { recursive: true });
108
50
  fs.writeFileSync(getConfigPath(), JSON.stringify(config, null, 2) + "\n", "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-dx/cli",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "DX CLI",
5
5
  "author": "DX <developers@getdx.com>",
6
6
  "bugs": {