@lightdash/cli 2.562.0 → 2.563.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.
- package/dist/.tsbuildinfo.build +1 -1
- package/dist/agentConnectionConnectOption.d.ts +8 -0
- package/dist/agentConnectionConnectOption.d.ts.map +1 -0
- package/dist/agentConnectionConnectOption.js +39 -0
- package/dist/agentConnectionOption.d.ts +3 -0
- package/dist/agentConnectionOption.d.ts.map +1 -0
- package/dist/agentConnectionOption.js +48 -0
- package/dist/agentConnections/agentTokenProvider.d.ts +13 -0
- package/dist/agentConnections/agentTokenProvider.d.ts.map +1 -0
- package/dist/agentConnections/agentTokenProvider.js +294 -0
- package/dist/agentConnections/apiUrl.d.ts +4 -0
- package/dist/agentConnections/apiUrl.d.ts.map +1 -0
- package/dist/agentConnections/apiUrl.js +37 -0
- package/dist/agentConnections/commandPolicy.d.ts +14 -0
- package/dist/agentConnections/commandPolicy.d.ts.map +1 -0
- package/dist/agentConnections/commandPolicy.js +108 -0
- package/dist/agentConnections/configLock.d.ts +12 -0
- package/dist/agentConnections/configLock.d.ts.map +1 -0
- package/dist/agentConnections/configLock.js +191 -0
- package/dist/agentConnections/connectInputs.d.ts +20 -0
- package/dist/agentConnections/connectInputs.d.ts.map +1 -0
- package/dist/agentConnections/connectInputs.js +49 -0
- package/dist/agentConnections/fixtures.d.ts +3 -0
- package/dist/agentConnections/fixtures.d.ts.map +1 -0
- package/dist/agentConnections/fixtures.js +36 -0
- package/dist/agentConnections/initialToken.d.ts +26 -0
- package/dist/agentConnections/initialToken.d.ts.map +1 -0
- package/dist/agentConnections/initialToken.js +93 -0
- package/dist/agentConnections/lifecycle.d.ts +17 -0
- package/dist/agentConnections/lifecycle.d.ts.map +1 -0
- package/dist/agentConnections/lifecycle.js +44 -0
- package/dist/agentConnections/personalRecovery.d.ts +27 -0
- package/dist/agentConnections/personalRecovery.d.ts.map +1 -0
- package/dist/agentConnections/personalRecovery.js +71 -0
- package/dist/agentConnections/projectSelection.d.ts +4 -0
- package/dist/agentConnections/projectSelection.d.ts.map +1 -0
- package/dist/agentConnections/projectSelection.js +48 -0
- package/dist/agentConnections/providerProcess.fixture.d.ts +2 -0
- package/dist/agentConnections/providerProcess.fixture.d.ts.map +1 -0
- package/dist/agentConnections/providerProcess.fixture.js +19 -0
- package/dist/agentConnections/requestPolicy.d.ts +11 -0
- package/dist/agentConnections/requestPolicy.d.ts.map +1 -0
- package/dist/agentConnections/requestPolicy.js +76 -0
- package/dist/agentConnections/schema.d.ts +66 -0
- package/dist/agentConnections/schema.d.ts.map +1 -0
- package/dist/agentConnections/schema.js +184 -0
- package/dist/agentConnections/statusResponse.d.ts +10 -0
- package/dist/agentConnections/statusResponse.d.ts.map +1 -0
- package/dist/agentConnections/statusResponse.js +146 -0
- package/dist/agentConnections/store.d.ts +36 -0
- package/dist/agentConnections/store.d.ts.map +1 -0
- package/dist/agentConnections/store.js +275 -0
- package/dist/agentConnections/warehouseStatus.d.ts +30 -0
- package/dist/agentConnections/warehouseStatus.d.ts.map +1 -0
- package/dist/agentConnections/warehouseStatus.js +184 -0
- package/dist/analytics/analytics.d.ts.map +1 -1
- package/dist/analytics/analytics.js +4 -0
- package/dist/config.d.ts +3 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/credentials.d.ts +27 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +161 -0
- package/dist/dbt/models.d.ts.map +1 -1
- package/dist/dbt/models.js +45 -14
- package/dist/handlers/agentAccess.d.ts.map +1 -1
- package/dist/handlers/agentAccess.js +9 -1
- package/dist/handlers/agentConnect.d.ts.map +1 -1
- package/dist/handlers/agentConnect.js +2 -0
- package/dist/handlers/agentConnectionConnect.d.ts +5 -0
- package/dist/handlers/agentConnectionConnect.d.ts.map +1 -0
- package/dist/handlers/agentConnectionConnect.js +371 -0
- package/dist/handlers/agentConnectionStatus.d.ts +7 -0
- package/dist/handlers/agentConnectionStatus.d.ts.map +1 -0
- package/dist/handlers/agentConnectionStatus.js +228 -0
- package/dist/handlers/agentRevoke.d.ts +7 -0
- package/dist/handlers/agentRevoke.d.ts.map +1 -0
- package/dist/handlers/agentRevoke.js +144 -0
- package/dist/handlers/agentStatus.d.ts +4 -1
- package/dist/handlers/agentStatus.d.ts.map +1 -1
- package/dist/handlers/agentStatus.js +7 -0
- package/dist/handlers/apps/createApp.d.ts.map +1 -1
- package/dist/handlers/apps/createApp.js +2 -0
- package/dist/handlers/apps/preview.d.ts.map +1 -1
- package/dist/handlers/apps/preview.js +6 -0
- package/dist/handlers/apps/previewProxy.d.ts.map +1 -1
- package/dist/handlers/apps/previewProxy.js +2 -0
- package/dist/handlers/apps/validate.d.ts.map +1 -1
- package/dist/handlers/apps/validate.js +20 -8
- package/dist/handlers/compile.d.ts.map +1 -1
- package/dist/handlers/compile.js +3 -0
- package/dist/handlers/connectSnowflake.d.ts.map +1 -1
- package/dist/handlers/connectSnowflake.js +2 -0
- package/dist/handlers/createProject.d.ts.map +1 -1
- package/dist/handlers/createProject.js +2 -0
- package/dist/handlers/dbt/apiClient.d.ts +4 -2
- package/dist/handlers/dbt/apiClient.d.ts.map +1 -1
- package/dist/handlers/dbt/apiClient.js +138 -4
- package/dist/handlers/dbt/compile.d.ts.map +1 -1
- package/dist/handlers/dbt/compile.js +13 -2
- package/dist/handlers/dbt/getDbtProfileTargetName.d.ts.map +1 -1
- package/dist/handlers/dbt/getDbtProfileTargetName.js +12 -4
- package/dist/handlers/dbt/getDbtVersion.d.ts.map +1 -1
- package/dist/handlers/dbt/getDbtVersion.js +12 -4
- package/dist/handlers/dbt/getWarehouseClient.d.ts.map +1 -1
- package/dist/handlers/dbt/getWarehouseClient.js +15 -5
- package/dist/handlers/dbt/refresh.d.ts.map +1 -1
- package/dist/handlers/dbt/refresh.js +2 -0
- package/dist/handlers/dbt/run.d.ts.map +1 -1
- package/dist/handlers/dbt/run.js +10 -3
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +17 -1
- package/dist/handlers/diagnostics.d.ts.map +1 -1
- package/dist/handlers/diagnostics.js +2 -0
- package/dist/handlers/download.d.ts.map +1 -1
- package/dist/handlers/download.js +19 -5
- package/dist/handlers/exportChartImage.d.ts.map +1 -1
- package/dist/handlers/exportChartImage.js +2 -0
- package/dist/handlers/generateExposures.d.ts.map +1 -1
- package/dist/handlers/generateExposures.js +4 -1
- package/dist/handlers/getProject.d.ts.map +1 -1
- package/dist/handlers/getProject.js +25 -1
- package/dist/handlers/listProjects.d.ts.map +1 -1
- package/dist/handlers/listProjects.js +2 -0
- package/dist/handlers/login/connectionBrowser.d.ts +2 -0
- package/dist/handlers/login/connectionBrowser.d.ts.map +1 -0
- package/dist/handlers/login/connectionBrowser.js +22 -0
- package/dist/handlers/login/loopback.d.ts +15 -0
- package/dist/handlers/login/loopback.d.ts.map +1 -0
- package/dist/handlers/login/loopback.js +135 -0
- package/dist/handlers/login/oauth.d.ts.map +1 -1
- package/dist/handlers/login/oauth.js +16 -3
- package/dist/handlers/login/pat.d.ts.map +1 -1
- package/dist/handlers/login/pat.js +2 -0
- package/dist/handlers/login.d.ts.map +1 -1
- package/dist/handlers/login.js +8 -1
- package/dist/handlers/oauthLogin.d.ts.map +1 -1
- package/dist/handlers/oauthLogin.js +2 -0
- package/dist/handlers/ordinary/harness.mocks.d.ts +42 -0
- package/dist/handlers/ordinary/harness.mocks.d.ts.map +1 -0
- package/dist/handlers/ordinary/harness.mocks.js +180 -0
- package/dist/handlers/preAggregateAudit.d.ts.map +1 -1
- package/dist/handlers/preAggregateAudit.js +2 -0
- package/dist/handlers/preview.d.ts.map +1 -1
- package/dist/handlers/preview.js +4 -0
- package/dist/handlers/renameHandler.d.ts.map +1 -1
- package/dist/handlers/renameHandler.js +2 -0
- package/dist/handlers/renameProject.d.ts.map +1 -1
- package/dist/handlers/renameProject.js +2 -0
- package/dist/handlers/resolveProjectFlag.d.ts.map +1 -1
- package/dist/handlers/resolveProjectFlag.js +5 -0
- package/dist/handlers/runChart.d.ts.map +1 -1
- package/dist/handlers/runChart.js +7 -2
- package/dist/handlers/selectProject.d.ts.map +1 -1
- package/dist/handlers/selectProject.js +5 -0
- package/dist/handlers/setProject.d.ts.map +1 -1
- package/dist/handlers/setProject.js +5 -0
- package/dist/handlers/setWarehouse.d.ts.map +1 -1
- package/dist/handlers/setWarehouse.js +2 -0
- package/dist/handlers/slugUpdate.d.ts.map +1 -1
- package/dist/handlers/slugUpdate.js +2 -0
- package/dist/handlers/sourceSelection.d.ts.map +1 -1
- package/dist/handlers/sourceSelection.js +13 -2
- package/dist/handlers/sql.d.ts.map +1 -1
- package/dist/handlers/sql.js +7 -2
- package/dist/handlers/utils.d.ts +3 -0
- package/dist/handlers/utils.d.ts.map +1 -1
- package/dist/handlers/utils.js +39 -0
- package/dist/handlers/validate.d.ts.map +1 -1
- package/dist/handlers/validate.js +2 -0
- package/dist/handlers/warehouseCatalog.d.ts.map +1 -1
- package/dist/handlers/warehouseCatalog.js +7 -2
- package/dist/index.js +43 -3
- package/dist/lightdash-config/index.d.ts.map +1 -1
- package/dist/lightdash-config/index.js +4 -1
- package/package.json +3 -3
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentRevokeHandler = void 0;
|
|
4
|
+
const lifecycle_1 = require("../agentConnections/lifecycle");
|
|
5
|
+
const personalRecovery_1 = require("../agentConnections/personalRecovery");
|
|
6
|
+
const statusResponse_1 = require("../agentConnections/statusResponse");
|
|
7
|
+
const store_1 = require("../agentConnections/store");
|
|
8
|
+
const config_1 = require("../config");
|
|
9
|
+
const credentials_1 = require("../credentials");
|
|
10
|
+
const apiClient_1 = require("./dbt/apiClient");
|
|
11
|
+
const agentRevokeHandler = async (options) => {
|
|
12
|
+
if (options.human && (0, credentials_1.getAgentConnectionSelection)() !== null)
|
|
13
|
+
throw new Error('--human and a global agent selection conflict. Remove --agent-connection and unset LIGHTDASH_AGENT_CONNECTION.');
|
|
14
|
+
const selection = (0, lifecycle_1.selectLifecycleSlot)(options.name);
|
|
15
|
+
return (0, credentials_1.runWithAgentConnectionSelection)(options.human ? null : selection, async () => {
|
|
16
|
+
const config = await (0, config_1.getConfig)({ readOnly: true });
|
|
17
|
+
const recover = options.human
|
|
18
|
+
? (0, personalRecovery_1.capturePersonalRecovery)(config)
|
|
19
|
+
: null;
|
|
20
|
+
const key = (0, lifecycle_1.connectionKey)(config, options.name);
|
|
21
|
+
const store = new store_1.AgentConnectionStore();
|
|
22
|
+
let slot = null;
|
|
23
|
+
let confirmed = false;
|
|
24
|
+
let localRemoved = false;
|
|
25
|
+
let error = null;
|
|
26
|
+
let recovery = null;
|
|
27
|
+
try {
|
|
28
|
+
if (key === null)
|
|
29
|
+
throw new Error('This connection requires a matching instance, person and organisation.');
|
|
30
|
+
slot = await store.readSlot(key);
|
|
31
|
+
if (slot === null)
|
|
32
|
+
throw new Error('No agent connection credential. Run lightdash agent connect.');
|
|
33
|
+
if (options.human) {
|
|
34
|
+
if (!recover)
|
|
35
|
+
throw new personalRecovery_1.PersonalRecoveryError();
|
|
36
|
+
recovery = recover(slot);
|
|
37
|
+
const response = await recovery.fetch({
|
|
38
|
+
method: 'GET',
|
|
39
|
+
url: '/api/v1/user',
|
|
40
|
+
body: undefined,
|
|
41
|
+
signal: AbortSignal.timeout(15_000),
|
|
42
|
+
});
|
|
43
|
+
const value = await response.json();
|
|
44
|
+
const envelope = (0, statusResponse_1.responseRecord)(value);
|
|
45
|
+
const person = (0, statusResponse_1.responseRecord)(envelope.results);
|
|
46
|
+
if (envelope.status !== 'ok' ||
|
|
47
|
+
person.userUuid !== slot.personUuid ||
|
|
48
|
+
person.organizationUuid !== slot.organizationUuid)
|
|
49
|
+
throw new personalRecovery_1.PersonalRecoveryError();
|
|
50
|
+
}
|
|
51
|
+
else if (Date.parse(slot.tokens.accessTokenExpiresAt) <=
|
|
52
|
+
Date.now() ||
|
|
53
|
+
Date.parse(slot.grantExpiresAt) <= Date.now()) {
|
|
54
|
+
throw new Error(lifecycle_1.revocationRecovery);
|
|
55
|
+
}
|
|
56
|
+
const original = slot;
|
|
57
|
+
await store.withLock(async (locked) => {
|
|
58
|
+
const current = await locked.readSlot(original);
|
|
59
|
+
if (!(0, lifecycle_1.sameGeneration)(current, original))
|
|
60
|
+
throw new Error('The local connection changed. Run the command again.');
|
|
61
|
+
await locked.saveSlot({
|
|
62
|
+
...current,
|
|
63
|
+
revokeState: {
|
|
64
|
+
kind: 'unconfirmed',
|
|
65
|
+
attemptedAt: new Date().toISOString(),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
const response = recovery
|
|
70
|
+
? await recovery.fetch({
|
|
71
|
+
method: 'DELETE',
|
|
72
|
+
url: `/api/v2/user/agent-connections/${slot.grantUuid}`,
|
|
73
|
+
body: undefined,
|
|
74
|
+
signal: AbortSignal.timeout(15_000),
|
|
75
|
+
})
|
|
76
|
+
: await (0, apiClient_1.lightdashRawApi)({
|
|
77
|
+
method: 'DELETE',
|
|
78
|
+
url: `/api/v2/user/agent-connections/${slot.grantUuid}`,
|
|
79
|
+
body: undefined,
|
|
80
|
+
signal: AbortSignal.timeout(15_000),
|
|
81
|
+
lifecycle: {
|
|
82
|
+
kind: 'revoke',
|
|
83
|
+
grantUuid: slot.grantUuid,
|
|
84
|
+
generation: slot.tokens.generation,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const value = await response.json();
|
|
88
|
+
const checked = (0, statusResponse_1.connectionResponse)(value, slot, false);
|
|
89
|
+
if (checked.lastReported.status !== 'revoked' ||
|
|
90
|
+
checked.lastReported.revokedAt === null)
|
|
91
|
+
throw new Error('Revocation was not confirmed.');
|
|
92
|
+
confirmed = true;
|
|
93
|
+
localRemoved = await store.removeSlotIfUnchanged(slot);
|
|
94
|
+
if (!localRemoved)
|
|
95
|
+
error =
|
|
96
|
+
'The server confirmed revocation, but the local slot changed and was kept.';
|
|
97
|
+
}
|
|
98
|
+
catch (failure) {
|
|
99
|
+
if (confirmed)
|
|
100
|
+
error =
|
|
101
|
+
'The server confirmed revocation, but the local credential could not be removed.';
|
|
102
|
+
else if (slot === null)
|
|
103
|
+
error =
|
|
104
|
+
key === null
|
|
105
|
+
? 'This connection requires a matching instance, person and organisation.'
|
|
106
|
+
: 'No valid agent connection credential was found. Run lightdash agent connect.';
|
|
107
|
+
else if (!options.human &&
|
|
108
|
+
((failure instanceof lifecycle_1.AgentConnectionRequestError &&
|
|
109
|
+
failure.state === 'rejected') ||
|
|
110
|
+
Date.parse(slot.tokens.accessTokenExpiresAt) <=
|
|
111
|
+
Date.now() ||
|
|
112
|
+
Date.parse(slot.grantExpiresAt) <= Date.now()))
|
|
113
|
+
error = lifecycle_1.revocationRecovery;
|
|
114
|
+
else
|
|
115
|
+
error =
|
|
116
|
+
options.human &&
|
|
117
|
+
failure instanceof personalRecovery_1.PersonalRecoveryError
|
|
118
|
+
? 'The personal CLI login does not match this connection person and organisation.'
|
|
119
|
+
: 'Revocation was not confirmed. The local slot was kept.';
|
|
120
|
+
}
|
|
121
|
+
const result = {
|
|
122
|
+
version: 1,
|
|
123
|
+
slot: options.name,
|
|
124
|
+
grantUuid: slot?.grantUuid ?? null,
|
|
125
|
+
confirmed,
|
|
126
|
+
localRemoved,
|
|
127
|
+
settingsUrl: config.context?.serverUrl
|
|
128
|
+
? (0, lifecycle_1.settingsUrl)(slot?.instanceUrl ?? config.context.serverUrl)
|
|
129
|
+
: null,
|
|
130
|
+
error,
|
|
131
|
+
};
|
|
132
|
+
if (options.json)
|
|
133
|
+
console.log(JSON.stringify(result));
|
|
134
|
+
else if (confirmed && localRemoved)
|
|
135
|
+
console.error(`Agent connection revoked: ${options.name}. Local credential removed.`);
|
|
136
|
+
else {
|
|
137
|
+
console.error(error);
|
|
138
|
+
if (result.settingsUrl)
|
|
139
|
+
console.error(`Settings: ${result.settingsUrl}`);
|
|
140
|
+
}
|
|
141
|
+
process.exitCode = confirmed && localRemoved ? 0 : 1;
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
exports.agentRevokeHandler = agentRevokeHandler;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { type AgentOptions } from './agentAccess';
|
|
2
|
-
export declare const agentStatusHandler: (options: AgentOptions
|
|
2
|
+
export declare const agentStatusHandler: (options: AgentOptions & {
|
|
3
|
+
name?: string;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
}) => Promise<void>;
|
|
3
6
|
//# sourceMappingURL=agentStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentStatus.d.ts","sourceRoot":"","sources":["../../src/handlers/agentStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agentStatus.d.ts","sourceRoot":"","sources":["../../src/handlers/agentStatus.ts"],"names":[],"mappings":"AAGA,OAAO,EAIH,KAAK,YAAY,EACpB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,kBAAkB,YAClB,YAAY,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAC1D,OAAO,CAAC,IAAI,CA8Cd,CAAC"}
|
|
@@ -3,9 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.agentStatusHandler = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const config_1 = require("../config");
|
|
6
|
+
const credentials_1 = require("../credentials");
|
|
6
7
|
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
|
7
8
|
const agentAccess_1 = require("./agentAccess");
|
|
8
9
|
const agentStatusHandler = async (options) => {
|
|
10
|
+
if (options.name !== undefined || (0, credentials_1.getAgentConnectionSelection)() !== null) {
|
|
11
|
+
const { agentConnectionStatusHandler } = await Promise.resolve().then(() => tslib_1.__importStar(require('./agentConnectionStatus')));
|
|
12
|
+
return agentConnectionStatusHandler(options);
|
|
13
|
+
}
|
|
14
|
+
if (options.json === true)
|
|
15
|
+
throw new Error('--json is only available for an agent connection. Use it with --name <slot>.');
|
|
9
16
|
globalState_1.default.setVerbose(options.verbose);
|
|
10
17
|
const access = await (0, agentAccess_1.getAgentAccess)(await (0, agentAccess_1.resolveAgentProject)(options.project));
|
|
11
18
|
if (access.refusal === null && access.identity === 'connected_person') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/createApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACxB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/createApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACxB,MAAM,mBAAmB,CAAC;AAyB3B,MAAM,MAAM,uBAAuB,GAAG;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAKF,eAAO,MAAM,6BAA6B,EAAE,gBA4B3C,CAAC;AAEF,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,iBAAiB,YAC1B,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,CACL,CAAC;AAEX,eAAO,MAAM,mBAAmB,SACtB,MAAM,iBACG,MAAM,KACtB,MAWF,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,IAAI,CAAC;IACV,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,KAAG,eAaF,CAAC;AAqLH,eAAO,MAAM,gBAAgB,SACnB,MAAM,WACH,uBAAuB,KACjC,OAAO,CAAC,IAAI,CA0Id,CAAC"}
|
|
@@ -9,6 +9,7 @@ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
|
9
9
|
const path = tslib_1.__importStar(require("path"));
|
|
10
10
|
const analytics_1 = require("../../analytics/analytics");
|
|
11
11
|
const config_1 = require("../../config");
|
|
12
|
+
const credentials_1 = require("../../credentials");
|
|
12
13
|
const env_1 = require("../../env");
|
|
13
14
|
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
|
14
15
|
const styles = tslib_1.__importStar(require("../../styles"));
|
|
@@ -223,6 +224,7 @@ const installDependenciesAndShadcn = async (appDir, withShadcn) => {
|
|
|
223
224
|
], shadcnOptions);
|
|
224
225
|
};
|
|
225
226
|
const createAppHandler = async (name, options) => {
|
|
227
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
226
228
|
const startTime = Date.now();
|
|
227
229
|
let success = false;
|
|
228
230
|
globalState_1.default.setVerbose(options.verbose);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,eAAe,EACvB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/preview.ts"],"names":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tB,KAAG,OAAO,CAAC,IAAI,CAwEf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAAU;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB,KAAG,MACgT,CAAC;AAErT,eAAO,MAAM,uBAAuB,SAAgB;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,KAAG,OAAO,CAAC,OAAO,CAoBlB,CAAC;AAKF,eAAO,MAAM,6BAA6B,WAC9B,MAAM,KACf,OAAO,CAAC,OAAO,CAmBjB,CAAC;AAkBF,KAAK,kBAAkB,GAAG;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,QACtB,MAAM,GAAG,SAAS,KACxB,MAAM,GAAG,SASX,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAClB,MAAM,GAAG,SAAS,WAClB,kBAAkB,KAC5B,OAAO,CAAC,IAAI,CA8Id,CAAC"}
|
|
@@ -9,6 +9,7 @@ const fs_1 = require("fs");
|
|
|
9
9
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const config_1 = require("../../config");
|
|
12
|
+
const credentials_1 = require("../../credentials");
|
|
12
13
|
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
|
13
14
|
const styles = tslib_1.__importStar(require("../../styles"));
|
|
14
15
|
const apiClient_1 = require("../dbt/apiClient");
|
|
@@ -24,6 +25,7 @@ const previewProxy_1 = require("./previewProxy");
|
|
|
24
25
|
* project- and route-limited capability; it is not a Lightdash credential.
|
|
25
26
|
*/
|
|
26
27
|
const buildPreviewChildEnv = (args) => {
|
|
28
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
27
29
|
const parentEnv = args.parentEnv ?? process.env;
|
|
28
30
|
const passthroughKeys = [
|
|
29
31
|
'APPDATA',
|
|
@@ -70,6 +72,7 @@ const buildPreviewChildEnv = (args) => {
|
|
|
70
72
|
};
|
|
71
73
|
exports.buildPreviewChildEnv = buildPreviewChildEnv;
|
|
72
74
|
const fetchBrowserImageOrigins = async (args) => {
|
|
75
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
73
76
|
const linkedSlugs = new Set((args.manifest.externalConnections ?? []).map(({ connectionSlug }) => connectionSlug));
|
|
74
77
|
if (linkedSlugs.size === 0)
|
|
75
78
|
return [];
|
|
@@ -201,6 +204,7 @@ const readDirectPackages = async (appDir) => {
|
|
|
201
204
|
* defaulting to No) before anything is downloaded to this machine.
|
|
202
205
|
*/
|
|
203
206
|
const ensureNodeModules = async (args) => {
|
|
207
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
204
208
|
if (await hasNodeModules(args.appDir))
|
|
205
209
|
return;
|
|
206
210
|
const interactive = !globalState_1.default.isNonInteractive() &&
|
|
@@ -268,6 +272,7 @@ exports.ensureNodeModules = ensureNodeModules;
|
|
|
268
272
|
const projectNotFoundMessage = (args) => `Project ${args.projectUuid} was not found on ${args.serverUrl} (or you don't have access). This app belongs to a different project or instance than the one you're logged into — run 'lightdash login <url>' for the server the app was downloaded from, or pass --project to preview against another project.`;
|
|
269
273
|
exports.projectNotFoundMessage = projectNotFoundMessage;
|
|
270
274
|
const preflightPreviewRequest = async (args) => {
|
|
275
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
271
276
|
const fetchFn = args.fetchFn ?? fetch;
|
|
272
277
|
try {
|
|
273
278
|
const res = await fetchFn(new URL(args.apiPath, args.serverUrl), {
|
|
@@ -334,6 +339,7 @@ const resolvePreviewPort = (raw) => {
|
|
|
334
339
|
};
|
|
335
340
|
exports.resolvePreviewPort = resolvePreviewPort;
|
|
336
341
|
const appsPreviewHandler = async (pathArg, options) => {
|
|
342
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
337
343
|
globalState_1.default.setVerbose(options.verbose);
|
|
338
344
|
const devServerPort = (0, exports.resolvePreviewPort)(options.port);
|
|
339
345
|
const config = await (0, config_1.getConfig)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewProxy.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/previewProxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"previewProxy.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/previewProxy.ts"],"names":[],"mappings":"AAcA,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,CAsH7B,CAAC"}
|
|
@@ -6,6 +6,7 @@ const common_1 = require("@lightdash/common");
|
|
|
6
6
|
const crypto_1 = require("crypto");
|
|
7
7
|
const http = tslib_1.__importStar(require("http"));
|
|
8
8
|
const https = tslib_1.__importStar(require("https"));
|
|
9
|
+
const credentials_1 = require("../../credentials");
|
|
9
10
|
// Per-run shared secret between the browser, Vite, and the CLI proxy. Vite
|
|
10
11
|
// forwards the browser's scoped Authorization value and adds this header;
|
|
11
12
|
// both must match before the durable credential is attached upstream.
|
|
@@ -64,6 +65,7 @@ const secretsMatch = (actual, expected) => {
|
|
|
64
65
|
* app folder or pass it to the vite process/browser.
|
|
65
66
|
*/
|
|
66
67
|
const startPreviewProxy = (args) => {
|
|
68
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
67
69
|
const upstream = new URL(args.upstreamUrl);
|
|
68
70
|
const requestFn = upstream.protocol === 'https:' ? https.request : http.request;
|
|
69
71
|
const server = http.createServer((req, res) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAiBH,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAEpB,KAAK,qBAAqB,EAC7B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAiBH,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAEpB,KAAK,qBAAqB,EAC7B,MAAM,mBAAmB,CAAC;AA2B3B,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC7B,OAAO,GACP,QAAQ,GACR,cAAc,GACd,qBAAqB,GACrB,UAAU,GACV,gBAAgB,GAChB,oBAAoB,GACpB,cAAc,CAAC;AAErB,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,O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AAG,MAKxD,CAAC;AAiBF,yFAAyF;AACzF,eAAO,MAAM,wBAAwB,YACxB,oBAAoB,CAAC,SAAS,CAAC,KACzC,MAQF,CAAC;AAQF,eAAO,MAAM,yBAAyB,WAC1B,oBAAoB,wBAE7B,MAkDF,CAAC;AAEF,eAAO,MAAM,wBAAwB,WACzB,oBAAoB,KAC7B,MAKM,CAAC;AAEV,eAAO,MAAM,mBAAmB,aAClB,MAAM,EAAE,GAAG,SAAS,WACrB,mBAAmB,KAC7B,OAAO,CAAC,IAAI,CAoDd,CAAC"}
|
|
@@ -9,6 +9,7 @@ const os = tslib_1.__importStar(require("os"));
|
|
|
9
9
|
const p_limit_1 = tslib_1.__importDefault(require("p-limit"));
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const config_1 = require("../../config");
|
|
12
|
+
const credentials_1 = require("../../credentials");
|
|
12
13
|
const env_1 = require("../../env");
|
|
13
14
|
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
|
14
15
|
const styles = tslib_1.__importStar(require("../../styles"));
|
|
@@ -136,13 +137,22 @@ const validateDependencies = async (appDir) => {
|
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
139
|
const runDataAppBuildCommand = async (command) => {
|
|
139
|
-
await (0,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
await ((0, credentials_1.getAgentConnectionSelection)() !== null
|
|
141
|
+
? (0, execa_1.default)(command.command, command.args, {
|
|
142
|
+
cwd: command.cwd,
|
|
143
|
+
localDir: command.preferLocal ? command.cwd : undefined,
|
|
144
|
+
preferLocal: command.preferLocal,
|
|
145
|
+
timeout: command.timeoutMs,
|
|
146
|
+
extendEnv: false,
|
|
147
|
+
env: await (0, credentials_1.getAgentConnectionChildEnvironment)(command.env),
|
|
148
|
+
})
|
|
149
|
+
: (0, execa_1.default)(command.command, command.args, {
|
|
150
|
+
cwd: command.cwd,
|
|
151
|
+
env: command.env,
|
|
152
|
+
localDir: command.preferLocal ? command.cwd : undefined,
|
|
153
|
+
preferLocal: command.preferLocal,
|
|
154
|
+
timeout: command.timeoutMs,
|
|
155
|
+
}));
|
|
146
156
|
};
|
|
147
157
|
const commandFailureOutput = (error) => {
|
|
148
158
|
const commandError = typeof error === 'object' && error !== null
|
|
@@ -512,7 +522,9 @@ const appsValidateHandler = async (pathArgs, options) => {
|
|
|
512
522
|
...new Set(paths.map((appPath) => path.resolve(process.cwd(), appPath))),
|
|
513
523
|
];
|
|
514
524
|
const liveProjectUuid = options.live
|
|
515
|
-
? (await (0,
|
|
525
|
+
? (await ((0, credentials_1.getAgentConnectionSelection)() === null
|
|
526
|
+
? (0, config_1.getConfig)()
|
|
527
|
+
: (0, config_1.getConfig)({ readOnly: true }).then(async (currentConfig) => (await Promise.resolve().then(() => tslib_1.__importStar(require('../../agentConnections/projectSelection')))).configWithAgentProject(currentConfig)))).context?.project
|
|
516
528
|
: undefined;
|
|
517
529
|
const liveIndexes = new Map();
|
|
518
530
|
const loadLiveIndex = (projectUuid) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,OAAO,EACP,YAAY,EAgBf,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,OAAO,EACP,YAAY,EAgBf,MAAM,mBAAmB,CAAC;AAsB3B,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,CAAC;IACrC,iBAAiB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,YACvB,OAAO,GAAG,YAAY,KAChC,OAIW,CAAC;AAEf,eAAO,MAAM,0BAA0B,YAC1B,OAAO,GAAG,YAAY,KAChC,OAAO,GAAG,YAiBZ,CAAC;AAgTF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,oBAAoB,CA8b9B,CAAC;AAEF,eAAO,MAAM,OAAO,YACP,qBAAqB,KAC/B,OAAO,CAAC,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,CACO,CAAC;AAE7C,eAAO,MAAM,cAAc,oBACN,qBAAqB,kBAmCzC,CAAC"}
|
package/dist/handlers/compile.js
CHANGED
|
@@ -7,6 +7,7 @@ const warehouses_1 = require("@lightdash/warehouses");
|
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
9
|
const analytics_1 = require("../analytics/analytics");
|
|
10
|
+
const credentials_1 = require("../credentials");
|
|
10
11
|
const context_1 = require("../dbt/context");
|
|
11
12
|
const manifest_1 = require("../dbt/manifest");
|
|
12
13
|
const validation_1 = require("../dbt/validation");
|
|
@@ -294,6 +295,8 @@ const compileProject = async (options) => {
|
|
|
294
295
|
isAutomaticServerManifest = true;
|
|
295
296
|
}
|
|
296
297
|
catch (error) {
|
|
298
|
+
if ((0, credentials_1.getAgentConnectionSelection)() !== null)
|
|
299
|
+
throw error;
|
|
297
300
|
if (error instanceof common_1.LightdashError &&
|
|
298
301
|
error.statusCode === 404) {
|
|
299
302
|
console.info(styles.info('No server manifest found; continuing with the preview manifest'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectSnowflake.d.ts","sourceRoot":"","sources":["../../src/handlers/connectSnowflake.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,0BAA0B,EAIlC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEH,wBAAwB,EAG3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAwB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connectSnowflake.d.ts","sourceRoot":"","sources":["../../src/handlers/connectSnowflake.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,0BAA0B,EAIlC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEH,wBAAwB,EAG3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAwB,MAAM,YAAY,CAAC;AAKlD,MAAM,MAAM,uBAAuB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,yBAAyB,GAAG,IAAI,CACjC,wBAAwB,EACtB,2BAA2B,GAC3B,+BAA+B,GAC/B,qBAAqB,GACrB,uBAAuB,GACvB,0BAA0B,GAC1B,+BAA+B,GAC/B,kBAAkB,GAClB,oBAAoB,CACzB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,4BAA4B,GAAG;IAChC,sBAAsB,EAAE,CACpB,WAAW,EAAE,0BAA0B,KACtC,yBAAyB,CAAC;IAC/B,eAAe,EAAE,MAAM,gBAAgB,CAAC;IACxC,KAAK,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AA6XF,eAAO,MAAM,uBAAuB,YACvB,uBAAuB,iBAClB,4BAA4B,KAC3C,OAAO,CAAC,IAAI,CAyEd,CAAC"}
|
|
@@ -7,6 +7,7 @@ const warehouses_1 = require("@lightdash/warehouses");
|
|
|
7
7
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
8
8
|
const node_crypto_1 = require("node:crypto");
|
|
9
9
|
const analytics_1 = require("../analytics/analytics");
|
|
10
|
+
const credentials_1 = require("../credentials");
|
|
10
11
|
const PAT_EXPIRY_DAYS = 365;
|
|
11
12
|
const PAT_NETWORK_POLICY_BYPASS_MINUTES = 60;
|
|
12
13
|
const KEY_VERIFICATION_ATTEMPTS = 3;
|
|
@@ -258,6 +259,7 @@ const createDurableCredential = async (authorizationCodeCredentials, warehouseCl
|
|
|
258
259
|
}
|
|
259
260
|
};
|
|
260
261
|
const connectSnowflakeHandler = async (options, dependencies = defaultDependencies) => {
|
|
262
|
+
(0, credentials_1.refuseAgentConnection)();
|
|
261
263
|
await analytics_1.LightdashAnalytics.track({
|
|
262
264
|
event: 'connect_snowflake.started',
|
|
263
265
|
properties: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProject.d.ts","sourceRoot":"","sources":["../../src/handlers/createProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,+BAA+B,EAI/B,WAAW,EAGX,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EAExB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"createProject.d.ts","sourceRoot":"","sources":["../../src/handlers/createProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,+BAA+B,EAI/B,WAAW,EAGX,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EAExB,MAAM,mBAAmB,CAAC;AAkE3B,eAAO,MAAM,kCAAkC,SACrC,MAAM,KACb,OAAO,CAAC,MAAM,CAyChB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,+BAA+B,CAAC;IACrD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAqDF,KAAK,+BAA+B,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,8BAA8B,GAAG;IAClC,WAAW,EAAE,0BAA0B,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,oCAAoC,YACpC,+BAA+B,KACzC,OAAO,CAAC,8BAA8B,GAAG,IAAI,CA2F/C,CAAC;AAEF,eAAO,MAAM,aAAa,YACb,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,GAAG,SAAS,CA6H7C,CAAC"}
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("@lightdash/common");
|
|
6
6
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
+
const commandPolicy_1 = require("../agentConnections/commandPolicy");
|
|
8
9
|
const config_1 = require("../config");
|
|
9
10
|
const context_1 = require("../dbt/context");
|
|
10
11
|
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
|
@@ -188,6 +189,7 @@ const loadWarehouseCredentialsFromProfiles = async (options) => {
|
|
|
188
189
|
};
|
|
189
190
|
exports.loadWarehouseCredentialsFromProfiles = loadWarehouseCredentialsFromProfiles;
|
|
190
191
|
const createProject = async (options) => {
|
|
192
|
+
(0, commandPolicy_1.assertAgentCommandAllowed)('deploy', { create: true });
|
|
191
193
|
await (0, apiClient_1.checkProjectCreationPermission)(options.upstreamProjectUuid, options.type);
|
|
192
194
|
// Resolve organization credentials early before doing any heavy work
|
|
193
195
|
let organizationWarehouseCredentialsUuid;
|
|
@@ -5,13 +5,15 @@ type LightdashApiProps = {
|
|
|
5
5
|
url: string;
|
|
6
6
|
body: BodyInit | undefined;
|
|
7
7
|
signal?: AbortSignal;
|
|
8
|
+
safeToRetry?: boolean;
|
|
8
9
|
};
|
|
9
10
|
type LightdashRawApiProps = LightdashApiProps & {
|
|
11
|
+
lifecycle?: import('../../agentConnections/lifecycle').LifecycleOperation;
|
|
10
12
|
headers?: Record<string, string>;
|
|
11
13
|
};
|
|
12
14
|
export declare const setGzipEnabled: (enabled: boolean) => void;
|
|
13
|
-
export declare const lightdashRawApi: ({ method, url, body, headers: requestHeaders, signal, }: LightdashRawApiProps) => Promise<Response>;
|
|
14
|
-
export declare const lightdashApi: <T extends ApiResponse['results']>({ method, url, body, signal, }: LightdashApiProps) => Promise<T>;
|
|
15
|
+
export declare const lightdashRawApi: ({ method, url, body, headers: requestHeaders, signal, safeToRetry, lifecycle, }: LightdashRawApiProps) => Promise<Response>;
|
|
16
|
+
export declare const lightdashApi: <T extends ApiResponse['results']>({ method, url, body, signal, safeToRetry, }: LightdashApiProps) => Promise<T>;
|
|
15
17
|
export declare const getUserContext: () => Promise<LightdashUserWithAbilityRules>;
|
|
16
18
|
export type ContentAsCodeUploadPermissions = {
|
|
17
19
|
charts: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/apiClient.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,WAAW,EAIX,WAAW,EAEX,KAAK,6BAA6B,EAGrC,MAAM,mBAAmB,CAAC;AAC3B,OAAc,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/apiClient.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,WAAW,EAIX,WAAW,EAEX,KAAK,6BAA6B,EAGrC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