@lightdash/cli 2.567.0 → 2.568.1

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":"agentConnectionConnect.d.ts","sourceRoot":"","sources":["../../src/handlers/agentConnectionConnect.ts"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,wBAAwB,EAChC,MAAM,mCAAmC,CAAC;AA+F3C,eAAO,MAAM,6BAA6B,YAC7B,wBAAwB,iBACnB;IAAE,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,KAGnE,OAAO,CAAC,IAAI,CA0Xd,CAAC"}
1
+ {"version":3,"file":"agentConnectionConnect.d.ts","sourceRoot":"","sources":["../../src/handlers/agentConnectionConnect.ts"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,wBAAwB,EAChC,MAAM,mCAAmC,CAAC;AAyG3C,eAAO,MAAM,6BAA6B,YAC7B,wBAAwB,iBACnB;IAAE,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,KAGnE,OAAO,CAAC,IAAI,CA+Xd,CAAC"}
@@ -24,6 +24,13 @@ const existingConnection = 'The server returned the existing agent connection in
24
24
  const unchanged = 'No agent connection credential was saved. Your personal CLI login is unchanged.';
25
25
  class ApprovalStartError extends Error {
26
26
  }
27
+ const approvalAvailabilityError = (code) => {
28
+ if (code === 'agent_connections_unavailable')
29
+ return new ApprovalStartError('Agent connections are not available on this server yet.');
30
+ if (code === 'agent_identity_disabled')
31
+ return new ApprovalStartError('Agent connections are disabled on this server. Ask an administrator to enable agent identity.');
32
+ return null;
33
+ };
27
34
  const requestResults = async (response) => {
28
35
  if ([404, 405].includes(response.status))
29
36
  throw new ApprovalStartError('Agent connections are not available on this server yet.');
@@ -41,10 +48,9 @@ const requestResults = async (response) => {
41
48
  const error = typeof envelope.error === 'object' && envelope.error !== null
42
49
  ? (0, statusResponse_1.responseRecord)(envelope.error)
43
50
  : {};
44
- if (error.code === 'agent_connections_unavailable')
45
- throw new ApprovalStartError('Agent connections are not available on this server yet.');
46
- if (error.code === 'agent_identity_disabled')
47
- throw new ApprovalStartError('Agent connections are disabled on this server. Ask an administrator to enable agent identity.');
51
+ const availabilityError = approvalAvailabilityError(error.code);
52
+ if (availabilityError !== null)
53
+ throw availabilityError;
48
54
  if (response.status === 403)
49
55
  throw new ApprovalStartError('The server refused agent connection approval. Check your permissions with an administrator.');
50
56
  throw new ApprovalStartError(couldNotStart);
@@ -340,7 +346,12 @@ const agentConnectionConnectHandler = async (options, dependencies = {
340
346
  return;
341
347
  }
342
348
  let message = couldNotStart;
343
- if (error instanceof ApprovalStartError ||
349
+ const availabilityError = error instanceof loopback_1.ConnectionCallbackError
350
+ ? approvalAvailabilityError(error.code)
351
+ : null;
352
+ if (availabilityError !== null)
353
+ message = availabilityError.message;
354
+ else if (error instanceof ApprovalStartError ||
344
355
  error instanceof personalRecovery_1.PersonalRecoveryError ||
345
356
  error instanceof initialToken_1.ConnectionProofError)
346
357
  message = error.message;
@@ -2,6 +2,10 @@ export type ConnectionCallback = {
2
2
  code: string;
3
3
  grantUuid: string | null;
4
4
  };
5
+ export declare class ConnectionCallbackError extends Error {
6
+ readonly code: 'agent_connections_unavailable' | 'agent_identity_disabled' | null;
7
+ constructor(code: string);
8
+ }
5
9
  export declare const createConnectionLoopback: ({ port, state, issuer, signal, }: {
6
10
  port: number;
7
11
  state: string;
@@ -1 +1 @@
1
- {"version":3,"file":"loopback.d.ts","sourceRoot":"","sources":["../../../src/handlers/login/loopback.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC5E,eAAO,MAAM,wBAAwB,qCAKlC;IACC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;CACvB;;;;EA2IA,CAAC"}
1
+ {"version":3,"file":"loopback.d.ts","sourceRoot":"","sources":["../../../src/handlers/login/loopback.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC5E,qBAAa,uBAAwB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EACP,+BAA+B,GAC/B,yBAAyB,GACzB,IAAI,CAAC;IAEX,YAAY,IAAI,EAAE,MAAM,EAOvB;CACJ;AACD,eAAO,MAAM,wBAAwB,qCAKlC;IACC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;CACvB;;;;EAsIA,CAAC"}
@@ -1,7 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createConnectionLoopback = void 0;
3
+ exports.createConnectionLoopback = exports.ConnectionCallbackError = void 0;
4
4
  const http_1 = require("http");
5
+ class ConnectionCallbackError extends Error {
6
+ code;
7
+ constructor(code) {
8
+ super('Agent connection approval was denied. No credential was saved.');
9
+ this.code =
10
+ code === 'agent_connections_unavailable' ||
11
+ code === 'agent_identity_disabled'
12
+ ? code
13
+ : null;
14
+ }
15
+ }
16
+ exports.ConnectionCallbackError = ConnectionCallbackError;
5
17
  const createConnectionLoopback = async ({ port, state, issuer, signal, }) => {
6
18
  let settled = false;
7
19
  let resolveResult = () => { };
@@ -61,7 +73,7 @@ const createConnectionLoopback = async ({ port, state, issuer, signal, }) => {
61
73
  });
62
74
  res.end('You can return to the CLI.');
63
75
  if (error !== null)
64
- rejectResult(new Error('Agent connection approval was denied. No credential was saved.'));
76
+ rejectResult(new ConnectionCallbackError(error));
65
77
  else
66
78
  resolveResult({ code: code, grantUuid: params.get('grant_uuid') });
67
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "2.567.0",
3
+ "version": "2.568.1",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,8 +22,8 @@
22
22
  "@actions/core": "1.11.1",
23
23
  "@aws-sdk/credential-providers": "3.995.0",
24
24
  "@casl/ability": "6.8.0",
25
- "@lightdash/common": "2.567.0",
26
- "@lightdash/warehouses": "2.567.0",
25
+ "@lightdash/common": "2.568.1",
26
+ "@lightdash/warehouses": "2.568.1",
27
27
  "@sidvind/better-ajv-errors": "7.0.0",
28
28
  "@types/columnify": "1.5.1",
29
29
  "ajv": "8.18.0",