@lightdash/cli 3.157.0 → 3.158.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.
- package/dist/.tsbuildinfo.build +1 -1
- package/dist/agentConnections/requestPolicy.d.ts.map +1 -1
- package/dist/agentConnections/requestPolicy.js +1 -0
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +31 -24
- package/dist/lightdash-config/index.d.ts +1 -0
- package/dist/lightdash-config/index.d.ts.map +1 -1
- package/dist/lightdash-config/index.js +20 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestPolicy.d.ts","sourceRoot":"","sources":["../../src/agentConnections/requestPolicy.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AAOF,eAAO,MAAM,cAAc,EAAE,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"requestPolicy.d.ts","sourceRoot":"","sources":["../../src/agentConnections/requestPolicy.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AAOF,eAAO,MAAM,cAAc,EAAE,SAAS,aAAa,EAqPlD,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,MAAM,OAAO,MAAM,KAAG,OAenE,CAAC;AAEF,eAAO,MAAM,yBAAyB,WAC1B,MAAM,OACT,MAAM,KACZ,IAKF,CAAC"}
|
|
@@ -24,6 +24,7 @@ exports.REQUEST_POLICY = [
|
|
|
24
24
|
route('PUT', '/api/v2/projects/:project/parameters', 'ParametersController.replaceParameters'),
|
|
25
25
|
route('PUT', '/api/v2/projects/:project/defaults', 'ProjectDefaultsController.replaceProjectDefaults'),
|
|
26
26
|
route('PUT', '/api/v1/projects/:project/table-groups', 'ProjectController.replaceProjectTableGroups'),
|
|
27
|
+
route('PUT', '/api/v1/projects/:project/project-context', 'ProjectController.replaceProjectContext'),
|
|
27
28
|
route('POST', '/api/v2/projects/:project/deploy', 'DeployController.startDeploySession'),
|
|
28
29
|
route('POST', '/api/v2/projects/:project/deploy/:session/batch', 'DeployController.addDeployBatch'),
|
|
29
30
|
route('POST', '/api/v2/projects/:project/deploy/:session/finalize', 'DeployController.finalizeDeploySession'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,OAAO,EACP,YAAY,EASZ,KAAK,eAAe,EACpB,KAAK,YAAY,EAGpB,MAAM,mBAAmB,CAAC;AAuB3B,OAAO,EAAE,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAa7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAkBF,eAAO,MAAM,eAAe,YACf,IAAI,CACT,oBAAoB,EACpB,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,CACrE,eACY,cAAc,mBACV,eAAe,GAAG,SAAS,KAC7C,OAAO,CAAC,YAAY,GAAG,SAAS,CA+BlC,CAAC;AAoWF,eAAO,MAAM,MAAM,aACL,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,WAC3B,UAAU,KACpB,OAAO,CAAC,IAAI,CA8Id,CAAC;AAiGF,eAAO,MAAM,aAAa,oBAA2B,oBAAoB,kBAgLxE,CAAC"}
|
package/dist/handlers/deploy.js
CHANGED
|
@@ -133,6 +133,32 @@ const replaceProjectTableGroups = async (projectUuid, lightdashProjectConfig) =>
|
|
|
133
133
|
body: JSON.stringify(lightdashProjectConfig.table_groups),
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
|
+
const replaceProjectContext = async (projectUuid, projectDir) => {
|
|
137
|
+
const projectContextYaml = await (0, lightdash_config_1.readProjectContextFile)(projectDir);
|
|
138
|
+
if (projectContextYaml === undefined) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const results = await (0, apiClient_1.lightdashApi)({
|
|
142
|
+
method: 'PUT',
|
|
143
|
+
url: `/api/v1/projects/${projectUuid}/project-context`,
|
|
144
|
+
body: JSON.stringify({ yaml: projectContextYaml }),
|
|
145
|
+
});
|
|
146
|
+
if (results.ingested) {
|
|
147
|
+
globalState_1.default.debug(`> Uploaded ${results.entryCount} project context entries`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
console.error(styles.warning('\nlightdash.project_context.yml was ignored: enable "Review AI agent turns" in the organization AI settings to use project context\n'));
|
|
151
|
+
};
|
|
152
|
+
// Explores are already deployed by the time these run, so a failure is
|
|
153
|
+
// reported but never fails the deploy.
|
|
154
|
+
const runPostDeployStep = async (label, step) => {
|
|
155
|
+
try {
|
|
156
|
+
await step();
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
console.error(styles.warning(`\nError replacing ${label}: ${(0, common_1.getErrorMessage)(e)}\n`));
|
|
160
|
+
}
|
|
161
|
+
};
|
|
136
162
|
const BATCH_UPLOAD_MAX_ATTEMPTS = 4;
|
|
137
163
|
const BATCH_UPLOAD_INITIAL_BACKOFF_MS = 500;
|
|
138
164
|
const BATCH_UPLOAD_MAX_BACKOFF_MS = 4000;
|
|
@@ -361,30 +387,11 @@ const deploy = async (explores, options) => {
|
|
|
361
387
|
throw error;
|
|
362
388
|
}
|
|
363
389
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
try {
|
|
371
|
-
await replaceProjectParameters(options.projectUuid, lightdashProjectConfig);
|
|
372
|
-
}
|
|
373
|
-
catch (e) {
|
|
374
|
-
console.error(styles.warning(`\nError replacing project parameters: ${(0, common_1.getErrorMessage)(e)}\n`));
|
|
375
|
-
}
|
|
376
|
-
try {
|
|
377
|
-
await replaceProjectDefaults(options.projectUuid, lightdashProjectConfig);
|
|
378
|
-
}
|
|
379
|
-
catch (e) {
|
|
380
|
-
console.error(styles.warning(`\nError replacing project defaults: ${(0, common_1.getErrorMessage)(e)}\n`));
|
|
381
|
-
}
|
|
382
|
-
try {
|
|
383
|
-
await replaceProjectTableGroups(options.projectUuid, lightdashProjectConfig);
|
|
384
|
-
}
|
|
385
|
-
catch (e) {
|
|
386
|
-
console.error(styles.warning(`\nError replacing project table groups: ${(0, common_1.getErrorMessage)(e)}\n`));
|
|
387
|
-
}
|
|
390
|
+
await runPostDeployStep('YAML tags', () => replaceProjectYamlTags(options.projectUuid, lightdashProjectConfig));
|
|
391
|
+
await runPostDeployStep('project parameters', () => replaceProjectParameters(options.projectUuid, lightdashProjectConfig));
|
|
392
|
+
await runPostDeployStep('project defaults', () => replaceProjectDefaults(options.projectUuid, lightdashProjectConfig));
|
|
393
|
+
await runPostDeployStep('project table groups', () => replaceProjectTableGroups(options.projectUuid, lightdashProjectConfig));
|
|
394
|
+
await runPostDeployStep('project context', () => replaceProjectContext(options.projectUuid, path_1.default.resolve(options.projectDir)));
|
|
388
395
|
};
|
|
389
396
|
exports.deploy = deploy;
|
|
390
397
|
const createNewProject = async (executionId, options) => {
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const readAndLoadLightdashProjectConfig: (projectDir: string, projectUuid?: string) => Promise<import("@lightdash/common").LightdashProjectConfig>;
|
|
2
|
+
export declare const readProjectContextFile: (projectDir: string) => Promise<string | undefined>;
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lightdash-config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lightdash-config/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,iCAAiC,eAC9B,MAAM,gBACJ,MAAM,gEAwCvB,CAAC;AAIF,eAAO,MAAM,sBAAsB,eACnB,MAAM,KACnB,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readAndLoadLightdashProjectConfig = void 0;
|
|
3
|
+
exports.readProjectContextFile = exports.readAndLoadLightdashProjectConfig = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@lightdash/common");
|
|
6
6
|
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
@@ -42,3 +42,22 @@ const readAndLoadLightdashProjectConfig = async (projectDir, projectUuid) => {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
exports.readAndLoadLightdashProjectConfig = readAndLoadLightdashProjectConfig;
|
|
45
|
+
// Returns the raw file so the server parses it with the same loader; parsing
|
|
46
|
+
// here surfaces a readable error without a round trip.
|
|
47
|
+
const readProjectContextFile = async (projectDir) => {
|
|
48
|
+
const filePath = path_1.default.join(projectDir, 'lightdash.project_context.yml');
|
|
49
|
+
let fileContents;
|
|
50
|
+
try {
|
|
51
|
+
fileContents = await promises_1.default.readFile(filePath, 'utf8');
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
if (e instanceof Error && 'code' in e && e.code === 'ENOENT') {
|
|
55
|
+
globalState_1.default.debug(`No lightdash.project_context.yml found in ${filePath}`);
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
(0, common_1.loadProjectContextFile)(fileContents);
|
|
61
|
+
return fileContents;
|
|
62
|
+
};
|
|
63
|
+
exports.readProjectContextFile = readProjectContextFile;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.158.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": "3.
|
|
26
|
-
"@lightdash/warehouses": "3.
|
|
25
|
+
"@lightdash/common": "3.158.1",
|
|
26
|
+
"@lightdash/warehouses": "3.158.1",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|