@lightdash/cli 1.107.1 → 1.108.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"previewProxy.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/previewProxy.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AA6CtE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAyBF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,SAAU;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,kBAAkB,CA+G7B,CAAC"}
1
+ {"version":3,"file":"previewProxy.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/previewProxy.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AA6CtE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAyBF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,SAAU;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,kBAAkB,CAqH7B,CAAC"}
@@ -100,6 +100,12 @@ const startPreviewProxy = (args) => {
100
100
  if (args.proxyAuthorization) {
101
101
  headers['proxy-authorization'] = args.proxyAuthorization;
102
102
  }
103
+ // The previewed app fetches the export's fileUrl directly from the
104
+ // local dev page, which carries no instance credentials — ask the
105
+ // backend for a SIGNED URL, same as the deployed app's bridge.
106
+ if ((0, common_1.isAppSdkScheduleDownloadRoute)(method, pathname)) {
107
+ headers[common_1.LightdashSignedDownloadHeader.toLowerCase()] = 'true';
108
+ }
103
109
  const upstreamReq = requestFn({
104
110
  protocol: upstream.protocol,
105
111
  hostname: upstream.hostname,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const common_1 = require("@lightdash/common");
4
5
  const http = tslib_1.__importStar(require("http"));
5
6
  const previewProxy_1 = require("./previewProxy");
6
7
  const PROJECT_UUID = 'proj-uuid-1';
@@ -89,6 +90,20 @@ describe('startPreviewProxy', () => {
89
90
  // …and the run-scoped nonce never travels upstream.
90
91
  expect(forwarded.headers[previewProxy_1.PREVIEW_PROXY_NONCE_HEADER]).toBeUndefined();
91
92
  });
93
+ it('stamps the signed-download header on schedule-download and nothing else', async () => {
94
+ await proxyFetch(`/api/v2/projects/${PROJECT_UUID}/query/some-query-uuid/schedule-download`, {
95
+ method: 'POST',
96
+ headers: {
97
+ 'content-type': 'application/json',
98
+ authorization: `ApiKey ${NONCE}`,
99
+ },
100
+ body: JSON.stringify({ type: 'csv' }),
101
+ });
102
+ await proxyFetch(`/api/v2/projects/${PROJECT_UUID}/query/some-query-uuid`);
103
+ expect(upstream.seen).toHaveLength(2);
104
+ expect(upstream.seen[0].headers[common_1.LightdashSignedDownloadHeader.toLowerCase()]).toBe('true');
105
+ expect(upstream.seen[1].headers[common_1.LightdashSignedDownloadHeader.toLowerCase()]).toBeUndefined();
106
+ });
92
107
  it('preserves the query string on result polling', async () => {
93
108
  const res = await proxyFetch(`/api/v2/projects/${PROJECT_UUID}/query/some-query-uuid?page=2&pageSize=500`);
94
109
  expect(res.status).toBe(200);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "1.107.1",
3
+ "version": "1.108.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,8 +41,8 @@
41
41
  "unique-names-generator": "4.7.1",
42
42
  "uuid": "11.1.1",
43
43
  "yaml": "2.8.3",
44
- "@lightdash/common": "1.107.1",
45
- "@lightdash/warehouses": "1.107.1"
44
+ "@lightdash/common": "1.108.0",
45
+ "@lightdash/warehouses": "1.108.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/inquirer": "8.2.4",