@dataparade/cli 0.0.20 → 0.0.21

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,61 +1,63 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const run_upload_1 = require("../../../src/upload/run-upload");
4
- jest.mock("../../../src/platform-api/upload-client", () => ({
4
+ jest.mock('../../../src/platform-api/upload-client', () => ({
5
5
  cliUploadAnonymousPreview: jest.fn(),
6
6
  cliUploadPreview: jest.fn(),
7
7
  }));
8
- jest.mock("../../../src/platform-api/telemetry-client", () => ({
8
+ jest.mock('../../../src/platform-api/telemetry-client', () => ({
9
9
  reportCliUsageEvent: jest.fn().mockResolvedValue(undefined),
10
10
  }));
11
- jest.mock("../../../src/upload/build-preview-url", () => ({
11
+ jest.mock('../../../src/upload/build-preview-url', () => ({
12
12
  buildAnonymousCliPreviewUrl: jest.fn((token) => `https://app.example/preview/cli/${token}`),
13
13
  buildImportPreviewUrl: jest.fn((draftId) => `https://app.example/dashboard?importDraft=${draftId}`),
14
14
  }));
15
15
  const upload_client_1 = require("../../../src/platform-api/upload-client");
16
16
  const telemetry_client_1 = require("../../../src/platform-api/telemetry-client");
17
- describe("runDataflowUpload anonymous path", () => {
18
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => undefined);
17
+ describe('runDataflowUpload anonymous path', () => {
18
+ const logSpy = jest.spyOn(console, 'log').mockImplementation(() => undefined);
19
19
  afterEach(() => {
20
20
  jest.clearAllMocks();
21
21
  });
22
22
  afterAll(() => {
23
23
  logSpy.mockRestore();
24
24
  });
25
- it("passes scanJobId to anonymous upload and mentions claim quota", async () => {
25
+ it('passes scanJobId to anonymous upload and mentions claim quota', async () => {
26
26
  upload_client_1.cliUploadAnonymousPreview.mockResolvedValue({
27
- claimToken: "claim-1",
27
+ claimToken: 'claim-1',
28
28
  expiresAt: new Date().toISOString(),
29
- projectName: "Proj",
29
+ projectName: 'Proj',
30
30
  });
31
31
  const result = await (0, run_upload_1.runDataflowUpload)({
32
- dataflow: { schemaVersion: "1.0" },
33
- projectName: "Proj",
34
- scanJobId: "job-anon-1",
35
- logPrefix: "[scan]",
32
+ dataflow: { schemaVersion: '1.0' },
33
+ projectName: 'Proj',
34
+ scanJobId: 'job-anon-1',
35
+ logPrefix: '[scan]',
36
36
  });
37
37
  expect(upload_client_1.cliUploadAnonymousPreview).toHaveBeenCalledWith({
38
- dataflow: { schemaVersion: "1.0" },
39
- projectName: "Proj",
40
- scanJobId: "job-anon-1",
38
+ dataflow: { schemaVersion: '1.0' },
39
+ projectName: 'Proj',
40
+ scanJobId: 'job-anon-1',
41
41
  cliUsageSessionId: undefined,
42
- command: "scan",
42
+ command: 'scan',
43
43
  });
44
44
  expect(upload_client_1.cliUploadPreview).not.toHaveBeenCalled();
45
- expect(result.previewUrl).toContain("claim-1");
46
- expect(logSpy).toHaveBeenCalledWith(expect.stringContaining("Claiming this preview after signup uses 1 scan slot"));
47
- expect(logSpy).toHaveBeenCalledWith(expect.stringContaining("platform AI tokens"));
45
+ expect(result.previewUrl).toContain('claim-1');
46
+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('[scan] Preview ready:'));
47
+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining(result.previewUrl));
48
+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('You can view the diagram now. Claiming it to your account uses 1 scan slot'));
49
+ expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('platform AI tokens'));
48
50
  });
49
- it("reports upload_failed and rethrows", async () => {
50
- upload_client_1.cliUploadAnonymousPreview.mockRejectedValue(new Error("network down"));
51
+ it('reports upload_failed and rethrows', async () => {
52
+ upload_client_1.cliUploadAnonymousPreview.mockRejectedValue(new Error('network down'));
51
53
  await expect((0, run_upload_1.runDataflowUpload)({
52
- dataflow: { schemaVersion: "1.0" },
53
- cliUsageSessionId: "11111111-1111-4111-8111-111111111111",
54
- logPrefix: "[scan]",
55
- })).rejects.toThrow("network down");
54
+ dataflow: { schemaVersion: '1.0' },
55
+ cliUsageSessionId: '11111111-1111-4111-8111-111111111111',
56
+ logPrefix: '[scan]',
57
+ })).rejects.toThrow('network down');
56
58
  expect(telemetry_client_1.reportCliUsageEvent).toHaveBeenCalledWith(expect.objectContaining({
57
- event: "upload_failed",
58
- errorCode: "upload_failed",
59
+ event: 'upload_failed',
60
+ errorCode: 'upload_failed',
59
61
  }));
60
62
  });
61
63
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -54,6 +54,7 @@
54
54
  "eval:models": "pnpm exec node dist/src/evals/run-model-matrix.js"
55
55
  },
56
56
  "dependencies": {
57
+ "@clack/prompts": "^1.8.1",
57
58
  "@dataparade/scanner": "github:DataParade-io/scanner#e66e1bcaef55b61214d170c617df529bd300fc89",
58
59
  "@sentry/node": "^10.38.0",
59
60
  "commander": "^12.1.0",