@lightdash/common 3.57.0 → 3.58.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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/ee/AiAgent/adminTypes.d.ts +2 -0
- package/dist/cjs/ee/AiAgent/adminTypes.d.ts.map +1 -1
- package/dist/cjs/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +12 -12
- package/dist/cjs/ee/AiAgent/schemas/tools/index.d.ts +0 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/index.js +0 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/index.js.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.d.ts +0 -3
- package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.d.ts.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.js +2 -13
- package/dist/cjs/ee/AiAgent/schemas/tools/toolDefinitions.js.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.d.ts +0 -8
- package/dist/cjs/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.d.ts.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.js +0 -12
- package/dist/cjs/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.js.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/visualizations/index.d.ts +2 -4
- package/dist/cjs/ee/AiAgent/schemas/visualizations/index.d.ts.map +1 -1
- package/dist/cjs/ee/AiAgent/schemas/visualizations/index.js +0 -3
- package/dist/cjs/ee/AiAgent/schemas/visualizations/index.js.map +1 -1
- package/dist/cjs/ee/AiAgent/utils.d.ts +25 -25
- package/dist/cjs/featureFlags/previewFeatureFlags.d.ts.map +1 -1
- package/dist/cjs/featureFlags/previewFeatureFlags.js +0 -4
- package/dist/cjs/featureFlags/previewFeatureFlags.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/api.d.ts +1 -2
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/api.js.map +1 -1
- package/dist/cjs/types/featureFlags.d.ts +0 -46
- package/dist/cjs/types/featureFlags.d.ts.map +1 -1
- package/dist/cjs/types/featureFlags.js +0 -46
- package/dist/cjs/types/featureFlags.js.map +1 -1
- package/dist/cjs/types/projects.d.ts +5 -0
- package/dist/cjs/types/projects.d.ts.map +1 -1
- package/dist/cjs/types/projects.js +17 -1
- package/dist/cjs/types/projects.js.map +1 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/ee/AiAgent/adminTypes.d.ts +2 -0
- package/dist/esm/ee/AiAgent/adminTypes.d.ts.map +1 -1
- package/dist/esm/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +25 -25
- package/dist/esm/ee/AiAgent/schemas/tools/index.d.ts +0 -1
- package/dist/esm/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/tools/index.js +0 -1
- package/dist/esm/ee/AiAgent/schemas/tools/index.js.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.d.ts +0 -3
- package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.d.ts.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.js +0 -11
- package/dist/esm/ee/AiAgent/schemas/tools/toolDefinitions.js.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.d.ts +0 -8
- package/dist/esm/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.d.ts.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.js +0 -12
- package/dist/esm/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.js.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/visualizations/index.d.ts +2 -4
- package/dist/esm/ee/AiAgent/schemas/visualizations/index.d.ts.map +1 -1
- package/dist/esm/ee/AiAgent/schemas/visualizations/index.js +0 -3
- package/dist/esm/ee/AiAgent/schemas/visualizations/index.js.map +1 -1
- package/dist/esm/ee/AiAgent/utils.d.ts +28 -28
- package/dist/esm/featureFlags/previewFeatureFlags.d.ts.map +1 -1
- package/dist/esm/featureFlags/previewFeatureFlags.js +0 -4
- package/dist/esm/featureFlags/previewFeatureFlags.js.map +1 -1
- package/dist/esm/index.d.ts +1 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/api.d.ts +1 -2
- package/dist/esm/types/api.d.ts.map +1 -1
- package/dist/esm/types/api.js.map +1 -1
- package/dist/esm/types/featureFlags.d.ts +0 -46
- package/dist/esm/types/featureFlags.d.ts.map +1 -1
- package/dist/esm/types/featureFlags.js +0 -46
- package/dist/esm/types/featureFlags.js.map +1 -1
- package/dist/esm/types/projects.d.ts +5 -0
- package/dist/esm/types/projects.d.ts.map +1 -1
- package/dist/esm/types/projects.js +15 -0
- package/dist/esm/types/projects.js.map +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/ee/AiAgent/adminTypes.d.ts +2 -0
- package/dist/types/ee/AiAgent/adminTypes.d.ts.map +1 -1
- package/dist/types/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +25 -25
- package/dist/types/ee/AiAgent/schemas/tools/index.d.ts +0 -1
- package/dist/types/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
- package/dist/types/ee/AiAgent/schemas/tools/index.js +0 -1
- package/dist/types/ee/AiAgent/schemas/tools/index.js.map +1 -1
- package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.d.ts +0 -3
- package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.d.ts.map +1 -1
- package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.js +0 -11
- package/dist/types/ee/AiAgent/schemas/tools/toolDefinitions.js.map +1 -1
- package/dist/types/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.d.ts +0 -8
- package/dist/types/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.d.ts.map +1 -1
- package/dist/types/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.js +0 -12
- package/dist/types/ee/AiAgent/schemas/tools/toolGetProjectInfoArgs.js.map +1 -1
- package/dist/types/ee/AiAgent/schemas/visualizations/index.d.ts +2 -4
- package/dist/types/ee/AiAgent/schemas/visualizations/index.d.ts.map +1 -1
- package/dist/types/ee/AiAgent/schemas/visualizations/index.js +0 -3
- package/dist/types/ee/AiAgent/schemas/visualizations/index.js.map +1 -1
- package/dist/types/ee/AiAgent/utils.d.ts +28 -28
- package/dist/types/featureFlags/previewFeatureFlags.d.ts.map +1 -1
- package/dist/types/featureFlags/previewFeatureFlags.js +0 -4
- package/dist/types/featureFlags/previewFeatureFlags.js.map +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/types/api.d.ts +1 -2
- package/dist/types/types/api.d.ts.map +1 -1
- package/dist/types/types/api.js.map +1 -1
- package/dist/types/types/featureFlags.d.ts +0 -46
- package/dist/types/types/featureFlags.d.ts.map +1 -1
- package/dist/types/types/featureFlags.js +0 -46
- package/dist/types/types/featureFlags.js.map +1 -1
- package/dist/types/types/projects.d.ts +5 -0
- package/dist/types/types/projects.d.ts.map +1 -1
- package/dist/types/types/projects.js +15 -0
- package/dist/types/types/projects.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.d.ts +0 -63
- package/dist/cjs/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.d.ts.map +0 -1
- package/dist/cjs/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.js +0 -54
- package/dist/cjs/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.js.map +0 -1
- package/dist/cjs/types/projectCiStatus.d.ts +0 -27
- package/dist/cjs/types/projectCiStatus.d.ts.map +0 -1
- package/dist/cjs/types/projectCiStatus.js +0 -3
- package/dist/cjs/types/projectCiStatus.js.map +0 -1
- package/dist/cjs/utils/previewDeployWorkflow.d.ts +0 -73
- package/dist/cjs/utils/previewDeployWorkflow.d.ts.map +0 -1
- package/dist/cjs/utils/previewDeployWorkflow.js +0 -192
- package/dist/cjs/utils/previewDeployWorkflow.js.map +0 -1
- package/dist/esm/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.d.ts +0 -63
- package/dist/esm/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.d.ts.map +0 -1
- package/dist/esm/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.js +0 -51
- package/dist/esm/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.js.map +0 -1
- package/dist/esm/types/projectCiStatus.d.ts +0 -27
- package/dist/esm/types/projectCiStatus.d.ts.map +0 -1
- package/dist/esm/types/projectCiStatus.js +0 -2
- package/dist/esm/types/projectCiStatus.js.map +0 -1
- package/dist/esm/utils/previewDeployWorkflow.d.ts +0 -73
- package/dist/esm/utils/previewDeployWorkflow.d.ts.map +0 -1
- package/dist/esm/utils/previewDeployWorkflow.js +0 -185
- package/dist/esm/utils/previewDeployWorkflow.js.map +0 -1
- package/dist/types/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.d.ts +0 -63
- package/dist/types/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.d.ts.map +0 -1
- package/dist/types/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.js +0 -51
- package/dist/types/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.js.map +0 -1
- package/dist/types/types/projectCiStatus.d.ts +0 -27
- package/dist/types/types/projectCiStatus.d.ts.map +0 -1
- package/dist/types/types/projectCiStatus.js +0 -2
- package/dist/types/types/projectCiStatus.js.map +0 -1
- package/dist/types/utils/previewDeployWorkflow.d.ts +0 -73
- package/dist/types/utils/previewDeployWorkflow.d.ts.map +0 -1
- package/dist/types/utils/previewDeployWorkflow.js +0 -185
- package/dist/types/utils/previewDeployWorkflow.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolSetupPreviewDeployArgs.js","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACjD,qMAAqM;IACrM,8MAA8M;IAC9M,kGAAkG;IAClG,gHAAgH;CACnH,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE7D,MAAM,oCAAoC,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACxE,CAAC,CAAC,MAAM,CAAC;QACL,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;QAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC/B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;KAC7B,CAAC;CACL,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6CAA6C,GAAG,CAAC,CAAC,MAAM,CAAC;IAClE,WAAW,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CAAC,qDAAqD,CAAC;IACpE,UAAU,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CACL,qEAAqE,CACxE;IACL,OAAO,EAAE,CAAC;SACL,KAAK,CACF,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QACxD,KAAK,EAAE,CAAC;aACH,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACL,kGAAkG,CACrG;QACL,WAAW,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,CAAC,8BAA8B,CAAC;KAChD,CAAC,CACL;SACA,QAAQ,CACL,yFAAyF,CAC5F;CACR,CAAC,CAAC;AAEH,6EAA6E;AAC7E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,oCAAoC;IAC9C,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC;QACvB,6CAA6C;QAC7C,gCAAgC;KACnC,CAAC;CACL,CAAC,CAAC;AAcH,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CACpE,oBAAoB,EACpB,kCAAkC,CAAC,KAAK,CAAC,QAAQ,CACpD,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-project record of whether a project's git repo has Lightdash CI/CD set
|
|
3
|
-
* up. Populated as a secondary task of the AI writeback sandbox agent: while it
|
|
4
|
-
* has the repo cloned it scans `.github/workflows/` for a Lightdash
|
|
5
|
-
* preview-deploy workflow and persists the result so we don't re-scan a project
|
|
6
|
-
* that already has it set up.
|
|
7
|
-
*/
|
|
8
|
-
export type ProjectCiStatus = {
|
|
9
|
-
projectUuid: string;
|
|
10
|
-
hasPreviewDeployWorkflow: boolean;
|
|
11
|
-
/** Path of the detected workflow file, or null when none was found. */
|
|
12
|
-
workflowPath: string | null;
|
|
13
|
-
/** Repo HEAD commit the scan ran against, for debugging staleness. */
|
|
14
|
-
detectedCommitSha: string | null;
|
|
15
|
-
checkedAt: Date;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* CI status for a project, or null when the project has never been scanned
|
|
19
|
-
* (e.g. no AI writeback has run yet). A null result means "unknown", which is
|
|
20
|
-
* distinct from a record with `hasPreviewDeployWorkflow: false` ("scanned, no
|
|
21
|
-
* preview workflow").
|
|
22
|
-
*/
|
|
23
|
-
export type ApiProjectCiStatusResponse = {
|
|
24
|
-
status: 'ok';
|
|
25
|
-
results: ProjectCiStatus | null;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=projectCiStatus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectCiStatus.d.ts","sourceRoot":"","sources":["../../../src/types/projectCiStatus.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,wBAAwB,EAAE,OAAO,CAAC;IAClC,uEAAuE;IACvE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,IAAI,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACrC,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;CACnC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectCiStatus.js","sourceRoot":"","sources":["../../../src/types/projectCiStatus.ts"],"names":[],"mappings":""}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detection and generation of Lightdash "preview project" GitHub Actions.
|
|
3
|
-
*
|
|
4
|
-
* Lightdash ships a canonical CI workflow (the `lightdash/cli-actions`
|
|
5
|
-
* `start-preview.yml` / `close-preview.yml` pair) that spins up a temporary
|
|
6
|
-
* preview project for every pull request and tears it down on close. The AI
|
|
7
|
-
* writeback sandbox agent detects whether a repo already has this set up and,
|
|
8
|
-
* if not, offers to open a PR adding it.
|
|
9
|
-
*
|
|
10
|
-
* Everything here is pure so it can be unit-tested without a sandbox or
|
|
11
|
-
* database: detection takes the workflow files as `{ path, content }` and the
|
|
12
|
-
* generators take only the project identity.
|
|
13
|
-
*/
|
|
14
|
-
/** A single file read out of a repo, used for detection. */
|
|
15
|
-
export type WorkflowFile = {
|
|
16
|
-
path: string;
|
|
17
|
-
content: string;
|
|
18
|
-
};
|
|
19
|
-
export type PreviewDeployDetection = {
|
|
20
|
-
hasPreviewDeployWorkflow: boolean;
|
|
21
|
-
/** Path of the first matching workflow file, or null when none matched. */
|
|
22
|
-
workflowPath: string | null;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Substrings that, when found in a `.github/workflows` file, indicate the repo
|
|
26
|
-
* already deploys Lightdash preview projects. `lightdash deploy` is
|
|
27
|
-
* deliberately excluded — that is a production deploy, not a preview.
|
|
28
|
-
*/
|
|
29
|
-
export declare const PREVIEW_DEPLOY_WORKFLOW_MARKERS: readonly ['lightdash start-preview', 'start-preview', 'lightdash stop-preview', 'stop-preview', 'lightdash preview', 'lightdash-deploy-action'];
|
|
30
|
-
/** True for `.github/workflows/*.yml|*.yaml` paths (tolerates a `./` prefix). */
|
|
31
|
-
export declare const isWorkflowFile: (path: string) => boolean;
|
|
32
|
-
export declare const detectPreviewDeployWorkflow: (files: WorkflowFile[]) => PreviewDeployDetection;
|
|
33
|
-
/**
|
|
34
|
-
* A GitHub Actions secret the preview workflow needs. `value` is non-null when
|
|
35
|
-
* Lightdash can pre-fill it (project UUID, instance URL); null means the user
|
|
36
|
-
* must supply it themselves — the sandbox never holds real warehouse secrets.
|
|
37
|
-
*/
|
|
38
|
-
export type PreviewDeploySecret = {
|
|
39
|
-
name: string;
|
|
40
|
-
value: string | null;
|
|
41
|
-
description: string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Result of opening the preview-deploy setup pull request. `secrets` are the
|
|
45
|
-
* GitHub Actions secrets the user must add for the workflow to run, with the
|
|
46
|
-
* values Lightdash can pre-fill already populated.
|
|
47
|
-
*/
|
|
48
|
-
export type PreviewDeploySetupResult = {
|
|
49
|
-
prUrl: string;
|
|
50
|
-
projectName: string;
|
|
51
|
-
repository: string;
|
|
52
|
-
secrets: PreviewDeploySecret[];
|
|
53
|
-
};
|
|
54
|
-
export declare const getPreviewDeploySecrets: ({ projectUuid, siteUrl, }: {
|
|
55
|
-
projectUuid: string;
|
|
56
|
-
siteUrl: string;
|
|
57
|
-
}) => PreviewDeploySecret[];
|
|
58
|
-
/**
|
|
59
|
-
* Generate the canonical Lightdash preview-on-PR workflow pair.
|
|
60
|
-
*
|
|
61
|
-
* @param projectSubPath dbt project directory within the repo (repo root when
|
|
62
|
-
* null) — passed to the CLI as `--project-dir`.
|
|
63
|
-
* @param cliVersion the `@lightdash/cli` version to pin. Pass the Lightdash
|
|
64
|
-
* instance's own version (`VERSION`): every Lightdash package releases in
|
|
65
|
-
* lockstep, so the instance version is the CLI version that matches it — this
|
|
66
|
-
* keeps the pin reproducible, compatible, and self-updating with the instance
|
|
67
|
-
* instead of frozen at a literal that rots.
|
|
68
|
-
*/
|
|
69
|
-
export declare const generatePreviewDeployWorkflowFiles: ({ projectSubPath, cliVersion, }: {
|
|
70
|
-
projectSubPath: string | null;
|
|
71
|
-
cliVersion: string;
|
|
72
|
-
}) => WorkflowFile[];
|
|
73
|
-
//# sourceMappingURL=previewDeployWorkflow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"previewDeployWorkflow.d.ts","sourceRoot":"","sources":["../../../src/utils/previewDeployWorkflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4DAA4D;AAC5D,MAAM,MAAM,Y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
|
-
* Lightdash ships a canonical CI workflow (the `lightdash/cli-actions`
|
|
5
|
-
* `start-preview.yml` / `close-preview.yml` pair) that spins up a temporary
|
|
6
|
-
* preview project for every pull request and tears it down on close. The AI
|
|
7
|
-
* writeback sandbox agent detects whether a repo already has this set up and,
|
|
8
|
-
* if not, offers to open a PR adding it.
|
|
9
|
-
*
|
|
10
|
-
* Everything here is pure so it can be unit-tested without a sandbox or
|
|
11
|
-
* database: detection takes the workflow files as `{ path, content }` and the
|
|
12
|
-
* generators take only the project identity.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Substrings that, when found in a `.github/workflows` file, indicate the repo
|
|
16
|
-
* already deploys Lightdash preview projects. `lightdash deploy` is
|
|
17
|
-
* deliberately excluded — that is a production deploy, not a preview.
|
|
18
|
-
*/
|
|
19
|
-
export const PREVIEW_DEPLOY_WORKFLOW_MARKERS = [
|
|
20
|
-
'lightdash start-preview',
|
|
21
|
-
'start-preview',
|
|
22
|
-
'lightdash stop-preview',
|
|
23
|
-
'stop-preview',
|
|
24
|
-
'lightdash preview',
|
|
25
|
-
'lightdash-deploy-action',
|
|
26
|
-
];
|
|
27
|
-
const WORKFLOWS_DIR = '.github/workflows/';
|
|
28
|
-
/** True for `.github/workflows/*.yml|*.yaml` paths (tolerates a `./` prefix). */
|
|
29
|
-
export const isWorkflowFile = (path) => {
|
|
30
|
-
const normalized = path.replace(/^\.\//, '');
|
|
31
|
-
return (normalized.startsWith(WORKFLOWS_DIR) &&
|
|
32
|
-
(normalized.endsWith('.yml') || normalized.endsWith('.yaml')));
|
|
33
|
-
};
|
|
34
|
-
export const detectPreviewDeployWorkflow = (files) => {
|
|
35
|
-
const match = files.find((file) => isWorkflowFile(file.path) &&
|
|
36
|
-
PREVIEW_DEPLOY_WORKFLOW_MARKERS.some((marker) => file.content.includes(marker)));
|
|
37
|
-
return {
|
|
38
|
-
hasPreviewDeployWorkflow: match !== undefined,
|
|
39
|
-
workflowPath: match?.path ?? null,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export const getPreviewDeploySecrets = ({ projectUuid, siteUrl, }) => {
|
|
43
|
-
const baseUrl = siteUrl.replace(/\/+$/, '');
|
|
44
|
-
return [
|
|
45
|
-
{
|
|
46
|
-
name: 'LIGHTDASH_URL',
|
|
47
|
-
value: siteUrl,
|
|
48
|
-
description: 'The base URL of your Lightdash instance.',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'LIGHTDASH_PROJECT',
|
|
52
|
-
value: projectUuid,
|
|
53
|
-
description: 'The UUID of the Lightdash project to base preview projects on.',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: 'LIGHTDASH_API_KEY',
|
|
57
|
-
value: null,
|
|
58
|
-
description: `A Lightdash personal access token — create one at ${baseUrl}/generalSettings/personalAccessTokens. Lightdash cannot create this for you.`,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'DBT_PROFILES',
|
|
62
|
-
value: null,
|
|
63
|
-
description: 'A dbt profiles.yml with your warehouse connection. Lightdash never stores your warehouse password, so you must add this yourself.',
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
};
|
|
67
|
-
const PREVIEW_WORKFLOW_PATH = `${WORKFLOWS_DIR}start-preview.yml`;
|
|
68
|
-
const CLOSE_WORKFLOW_PATH = `${WORKFLOWS_DIR}close-preview.yml`;
|
|
69
|
-
// Third-party actions are pinned to a full commit SHA (with a version comment)
|
|
70
|
-
// rather than a floating tag — these workflows run with the repo's warehouse +
|
|
71
|
-
// Lightdash secrets in scope, so a retagged/compromised action is a real
|
|
72
|
-
// supply-chain risk. SHAs match the pins Lightdash uses in its own CI.
|
|
73
|
-
const CHECKOUT_ACTION = 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2';
|
|
74
|
-
const SETUP_NODE_ACTION = 'actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6';
|
|
75
|
-
const GITHUB_SCRIPT_ACTION = 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8';
|
|
76
|
-
/**
|
|
77
|
-
* Generate the canonical Lightdash preview-on-PR workflow pair.
|
|
78
|
-
*
|
|
79
|
-
* @param projectSubPath dbt project directory within the repo (repo root when
|
|
80
|
-
* null) — passed to the CLI as `--project-dir`.
|
|
81
|
-
* @param cliVersion the `@lightdash/cli` version to pin. Pass the Lightdash
|
|
82
|
-
* instance's own version (`VERSION`): every Lightdash package releases in
|
|
83
|
-
* lockstep, so the instance version is the CLI version that matches it — this
|
|
84
|
-
* keeps the pin reproducible, compatible, and self-updating with the instance
|
|
85
|
-
* instead of frozen at a literal that rots.
|
|
86
|
-
*/
|
|
87
|
-
export const generatePreviewDeployWorkflowFiles = ({ projectSubPath, cliVersion, }) => {
|
|
88
|
-
const projectDir = projectSubPath && projectSubPath !== '' ? projectSubPath : '.';
|
|
89
|
-
const startPreview = `name: lightdash-start-preview
|
|
90
|
-
on:
|
|
91
|
-
pull_request:
|
|
92
|
-
types: [opened, synchronize, reopened]
|
|
93
|
-
# contents:read for checkout; pull-requests:write to post the preview link
|
|
94
|
-
# comment. Both must be listed — an omitted scope defaults to none.
|
|
95
|
-
permissions:
|
|
96
|
-
contents: read
|
|
97
|
-
pull-requests: write
|
|
98
|
-
concurrency:
|
|
99
|
-
group: lightdash-preview-\${{ github.ref }}
|
|
100
|
-
cancel-in-progress: true
|
|
101
|
-
jobs:
|
|
102
|
-
start-preview:
|
|
103
|
-
runs-on: ubuntu-latest
|
|
104
|
-
timeout-minutes: 15
|
|
105
|
-
env:
|
|
106
|
-
PROJECT_DIR: ${projectDir}
|
|
107
|
-
steps:
|
|
108
|
-
- uses: ${CHECKOUT_ACTION}
|
|
109
|
-
- uses: ${SETUP_NODE_ACTION}
|
|
110
|
-
with:
|
|
111
|
-
node-version: '24.x'
|
|
112
|
-
- name: Install Lightdash CLI
|
|
113
|
-
run: npm install -g @lightdash/cli@${cliVersion}
|
|
114
|
-
- name: Write dbt profiles
|
|
115
|
-
run: echo "$DBT_PROFILES" > profiles.yml
|
|
116
|
-
env:
|
|
117
|
-
DBT_PROFILES: \${{ secrets.DBT_PROFILES }}
|
|
118
|
-
- name: Create preview project
|
|
119
|
-
id: preview
|
|
120
|
-
run: lightdash start-preview --project-dir "$PROJECT_DIR" --profiles-dir . --name "\${GITHUB_HEAD_REF}"
|
|
121
|
-
env:
|
|
122
|
-
LIGHTDASH_URL: \${{ secrets.LIGHTDASH_URL }}
|
|
123
|
-
LIGHTDASH_PROJECT: \${{ secrets.LIGHTDASH_PROJECT }}
|
|
124
|
-
LIGHTDASH_API_KEY: \${{ secrets.LIGHTDASH_API_KEY }}
|
|
125
|
-
- name: Comment preview link on PR
|
|
126
|
-
if: steps.preview.outputs.url != ''
|
|
127
|
-
uses: ${GITHUB_SCRIPT_ACTION}
|
|
128
|
-
env:
|
|
129
|
-
PREVIEW_URL: \${{ steps.preview.outputs.url }}
|
|
130
|
-
with:
|
|
131
|
-
script: |
|
|
132
|
-
const marker = '<!-- lightdash-preview -->';
|
|
133
|
-
const body = marker + '\\n:zap: Your Lightdash preview project is ready: ' + process.env.PREVIEW_URL;
|
|
134
|
-
const { data: comments } = await github.rest.issues.listComments({
|
|
135
|
-
owner: context.repo.owner,
|
|
136
|
-
repo: context.repo.repo,
|
|
137
|
-
issue_number: context.issue.number,
|
|
138
|
-
});
|
|
139
|
-
const existing = comments.find((c) => c.body && c.body.includes(marker));
|
|
140
|
-
if (existing) {
|
|
141
|
-
await github.rest.issues.updateComment({
|
|
142
|
-
owner: context.repo.owner,
|
|
143
|
-
repo: context.repo.repo,
|
|
144
|
-
comment_id: existing.id,
|
|
145
|
-
body,
|
|
146
|
-
});
|
|
147
|
-
} else {
|
|
148
|
-
await github.rest.issues.createComment({
|
|
149
|
-
owner: context.repo.owner,
|
|
150
|
-
repo: context.repo.repo,
|
|
151
|
-
issue_number: context.issue.number,
|
|
152
|
-
body,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
`;
|
|
156
|
-
const closePreview = `name: lightdash-close-preview
|
|
157
|
-
on:
|
|
158
|
-
pull_request:
|
|
159
|
-
types: [closed]
|
|
160
|
-
permissions:
|
|
161
|
-
contents: read
|
|
162
|
-
jobs:
|
|
163
|
-
close-preview:
|
|
164
|
-
runs-on: ubuntu-latest
|
|
165
|
-
timeout-minutes: 15
|
|
166
|
-
steps:
|
|
167
|
-
- uses: ${CHECKOUT_ACTION}
|
|
168
|
-
- uses: ${SETUP_NODE_ACTION}
|
|
169
|
-
with:
|
|
170
|
-
node-version: '24.x'
|
|
171
|
-
- name: Install Lightdash CLI
|
|
172
|
-
run: npm install -g @lightdash/cli@${cliVersion}
|
|
173
|
-
- name: Delete preview project
|
|
174
|
-
run: lightdash stop-preview --name "\${GITHUB_HEAD_REF}"
|
|
175
|
-
env:
|
|
176
|
-
LIGHTDASH_URL: \${{ secrets.LIGHTDASH_URL }}
|
|
177
|
-
LIGHTDASH_PROJECT: \${{ secrets.LIGHTDASH_PROJECT }}
|
|
178
|
-
LIGHTDASH_API_KEY: \${{ secrets.LIGHTDASH_API_KEY }}
|
|
179
|
-
`;
|
|
180
|
-
return [
|
|
181
|
-
{ path: PREVIEW_WORKFLOW_PATH, content: startPreview },
|
|
182
|
-
{ path: CLOSE_WORKFLOW_PATH, content: closePreview },
|
|
183
|
-
];
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=previewDeployWorkflow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"previewDeployWorkflow.js","sourceRoot":"","sources":["../../../src/utils/previewDeployWorkflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAcH;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC3C,yBAAyB;IACzB,eAAe;IACf,wBAAwB;IACxB,cAAc;IACd,mBAAmB;IACnB,yBAAyB;CACnB,CAAC;AAEX,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C,iFA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c;YACpB,KAAK,EAAE,IAAI;YACX,WAAW,EACP,mIAAmI;SAC1I;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,GAAG,aAAa,mBAAmB,CAAC;AAClE,MAAM,mBAAmB,GAAG,GAAG,aAAa,mBAAmB,CAAC;AAEhE,+EAA+E;AAC/E,+EAA+E;AAC/E,yEAAyE;AACzE,uEAAuE;AACvE,MAAM,eAAe,GACjB,oEAAoE,CAAC;AACzE,MAAM,iBAAiB,GACnB,kEAAkE,CAAC;AACvE,MAAM,oBAAoB,GACtB,qEAAqE,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,EAC/C,cAAc,EACd,UAAU,GAIb,EAAkB,EAAE;IACjB,MAAM,UAAU,GACZ,cAAc,IAAI,cAAc,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;IAEnE,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;qBAiBJ,UAAU;;gBAEf,eAAe;gBACf,iBAAiB;;;;6CAIY,UAAU;;;;;;;;;;;;;;gBAcvC,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnC,CAAC;IAEE,MAAM,YAAY,GAAG;;;;;;;;;;;gBAWT,eAAe;gBACf,iBAAiB;;;;6CAIY,UAAU;;;;;;;CAOtD,CAAC;IAEE,OAAO;QACH,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,YAAY,EAAE;QACtD,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,YAAY,EAAE;KACvD,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const TOOL_SETUP_PREVIEW_DEPLOY_DESCRIPTION: string;
|
|
3
|
-
export declare const toolSetupPreviewDeployArgsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
4
|
-
export declare const toolSetupPreviewDeployStructuredContentSchema: z.ZodObject<{
|
|
5
|
-
projectName: z.ZodString;
|
|
6
|
-
repository: z.ZodString;
|
|
7
|
-
secrets: z.ZodArray<z.ZodObject<{
|
|
8
|
-
name: z.ZodString;
|
|
9
|
-
value: z.ZodNullable<z.ZodString>;
|
|
10
|
-
description: z.ZodString;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export declare const toolSetupPreviewDeployOutputSchema: z.ZodObject<{
|
|
14
|
-
result: z.ZodString;
|
|
15
|
-
metadata: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
16
|
-
status: z.ZodLiteral<"success">;
|
|
17
|
-
prUrl: z.ZodNullable<z.ZodString>;
|
|
18
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
-
status: z.ZodLiteral<"error">;
|
|
20
|
-
}, z.core.$strip>], "status">;
|
|
21
|
-
structuredContent: z.ZodUnion<readonly [z.ZodObject<{
|
|
22
|
-
projectName: z.ZodString;
|
|
23
|
-
repository: z.ZodString;
|
|
24
|
-
secrets: z.ZodArray<z.ZodObject<{
|
|
25
|
-
name: z.ZodString;
|
|
26
|
-
value: z.ZodNullable<z.ZodString>;
|
|
27
|
-
description: z.ZodString;
|
|
28
|
-
}, z.core.$strip>>;
|
|
29
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
-
refusal: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
31
|
-
code: z.ZodLiteral<"ai_access_refused">;
|
|
32
|
-
reason: z.ZodString;
|
|
33
|
-
message: z.ZodString;
|
|
34
|
-
action: z.ZodNullable<z.ZodString>;
|
|
35
|
-
settingsUrl: z.ZodNullable<z.ZodString>;
|
|
36
|
-
connectUrl: z.ZodNullable<z.ZodString>;
|
|
37
|
-
capability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
-
policyLayer: z.ZodOptional<z.ZodString>;
|
|
39
|
-
operation: z.ZodOptional<z.ZodString>;
|
|
40
|
-
policyVersion: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
projectUuid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
-
}, z.core.$strip>>>;
|
|
43
|
-
error: z.ZodString;
|
|
44
|
-
}, z.core.$strip>]>;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
export type ToolSetupPreviewDeployArgs = z.infer<typeof toolSetupPreviewDeployArgsSchema>;
|
|
47
|
-
export type ToolSetupPreviewDeployStructuredContent = z.infer<typeof toolSetupPreviewDeployStructuredContentSchema>;
|
|
48
|
-
export type ToolSetupPreviewDeployOutput = z.infer<typeof toolSetupPreviewDeployOutputSchema>;
|
|
49
|
-
export declare const isToolSetupPreviewDeployResult: <T extends {
|
|
50
|
-
toolType: string;
|
|
51
|
-
toolName: string;
|
|
52
|
-
metadata: unknown;
|
|
53
|
-
}>(result: T) => result is T & {
|
|
54
|
-
toolType: 'built-in';
|
|
55
|
-
toolName: "setupPreviewDeploy";
|
|
56
|
-
metadata: {
|
|
57
|
-
status: "success";
|
|
58
|
-
prUrl: string | null;
|
|
59
|
-
} | {
|
|
60
|
-
status: "error";
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=toolSetupPreviewDeployArgs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolSetupPreviewDeployArgs.d.ts","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qCAAqC,QAKvC,CAAC;AAEZ,eAAO,MAAM,gCAAgC,gCAAe,CAAC;AAY7D,eAAO,MAAM,6CAA6C;;;;;;;;iBA2BxD,CAAC;AAIH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO7C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,gCAAgC,CAC1C,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,6CAA6C,CACvD,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,kCAAkC,CAC5C,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;CAG1C,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { toolErrorStructuredContentSchema } from '../outputMetadata';
|
|
3
|
-
import { makeBuiltInToolResultGuard } from './builtInToolResultGuard';
|
|
4
|
-
export const TOOL_SETUP_PREVIEW_DEPLOY_DESCRIPTION = [
|
|
5
|
-
"Open a pull request that adds the Lightdash preview-deploy GitHub Actions workflow to this project's repository: each pull request then gets a temporary preview project, torn down when it closes.",
|
|
6
|
-
'Call it when the user asks to set up preview deploys ("deploy a preview project for each PR") or accepts your offer after getProjectInfo reports no preview-deploy workflow; no earlier writeback is needed.',
|
|
7
|
-
'It automates GitHub Actions only; on other CI, tell the user preview deploys are set up by hand.',
|
|
8
|
-
'It takes no arguments (the repository and dbt sub-folder are resolved server-side) and can take a few minutes.',
|
|
9
|
-
].join(' ');
|
|
10
|
-
export const toolSetupPreviewDeployArgsSchema = z.object({});
|
|
11
|
-
const toolSetupPreviewDeployMetadataSchema = z.discriminatedUnion('status', [
|
|
12
|
-
z.object({
|
|
13
|
-
status: z.literal('success'),
|
|
14
|
-
prUrl: z.string().nullable(),
|
|
15
|
-
}),
|
|
16
|
-
z.object({
|
|
17
|
-
status: z.literal('error'),
|
|
18
|
-
}),
|
|
19
|
-
]);
|
|
20
|
-
export const toolSetupPreviewDeployStructuredContentSchema = z.object({
|
|
21
|
-
projectName: z
|
|
22
|
-
.string()
|
|
23
|
-
.describe('Lightdash project the preview deploys are based on.'),
|
|
24
|
-
repository: z
|
|
25
|
-
.string()
|
|
26
|
-
.describe('GitHub repository (owner/name) the pull request was opened against.'),
|
|
27
|
-
secrets: z
|
|
28
|
-
.array(z.object({
|
|
29
|
-
name: z.string().describe('GitHub Actions secret name.'),
|
|
30
|
-
value: z
|
|
31
|
-
.string()
|
|
32
|
-
.nullable()
|
|
33
|
-
.describe('Pre-filled value to present to the user verbatim; null when the user must provide it themselves.'),
|
|
34
|
-
description: z
|
|
35
|
-
.string()
|
|
36
|
-
.describe('What the secret is used for.'),
|
|
37
|
-
}))
|
|
38
|
-
.describe('GitHub Actions secrets the user must add to the repository before the workflow can run.'),
|
|
39
|
-
});
|
|
40
|
-
// Hand-rolled rather than `structuredToolOutputSchema`: that helper takes an
|
|
41
|
-
// object metadata schema and this tool's metadata is a discriminated union.
|
|
42
|
-
export const toolSetupPreviewDeployOutputSchema = z.object({
|
|
43
|
-
result: z.string(),
|
|
44
|
-
metadata: toolSetupPreviewDeployMetadataSchema,
|
|
45
|
-
structuredContent: z.union([
|
|
46
|
-
toolSetupPreviewDeployStructuredContentSchema,
|
|
47
|
-
toolErrorStructuredContentSchema,
|
|
48
|
-
]),
|
|
49
|
-
});
|
|
50
|
-
export const isToolSetupPreviewDeployResult = makeBuiltInToolResultGuard('setupPreviewDeploy', toolSetupPreviewDeployOutputSchema.shape.metadata);
|
|
51
|
-
//# sourceMappingURL=toolSetupPreviewDeployArgs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolSetupPreviewDeployArgs.js","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolSetupPreviewDeployArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACjD,qMAAqM;I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E,oCAAoC;IAC9C,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC;QACvB,6CAA6C;QAC7C,gCAAgC;KACnC,CAAC;CACL,CAAC,CAAC;AAcH,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CACpE,oBAAoB,EACpB,kCAAkC,CAAC,KAAK,CAAC,QAAQ,CACpD,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-project record of whether a project's git repo has Lightdash CI/CD set
|
|
3
|
-
* up. Populated as a secondary task of the AI writeback sandbox agent: while it
|
|
4
|
-
* has the repo cloned it scans `.github/workflows/` for a Lightdash
|
|
5
|
-
* preview-deploy workflow and persists the result so we don't re-scan a project
|
|
6
|
-
* that already has it set up.
|
|
7
|
-
*/
|
|
8
|
-
export type ProjectCiStatus = {
|
|
9
|
-
projectUuid: string;
|
|
10
|
-
hasPreviewDeployWorkflow: boolean;
|
|
11
|
-
/** Path of the detected workflow file, or null when none was found. */
|
|
12
|
-
workflowPath: string | null;
|
|
13
|
-
/** Repo HEAD commit the scan ran against, for debugging staleness. */
|
|
14
|
-
detectedCommitSha: string | null;
|
|
15
|
-
checkedAt: Date;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* CI status for a project, or null when the project has never been scanned
|
|
19
|
-
* (e.g. no AI writeback has run yet). A null result means "unknown", which is
|
|
20
|
-
* distinct from a record with `hasPreviewDeployWorkflow: false` ("scanned, no
|
|
21
|
-
* preview workflow").
|
|
22
|
-
*/
|
|
23
|
-
export type ApiProjectCiStatusResponse = {
|
|
24
|
-
status: 'ok';
|
|
25
|
-
results: ProjectCiStatus | null;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=projectCiStatus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectCiStatus.d.ts","sourceRoot":"","sources":["../../../src/types/projectCiStatus.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,wBAAwB,EAAE,OAAO,CAAC;IAClC,uEAAuE;IACvE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,IAAI,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACrC,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;CACnC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectCiStatus.js","sourceRoot":"","sources":["../../../src/types/projectCiStatus.ts"],"names":[],"mappings":""}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detection and generation of Lightdash "preview project" GitHub Actions.
|
|
3
|
-
*
|
|
4
|
-
* Lightdash ships a canonical CI workflow (the `lightdash/cli-actions`
|
|
5
|
-
* `start-preview.yml` / `close-preview.yml` pair) that spins up a temporary
|
|
6
|
-
* preview project for every pull request and tears it down on close. The AI
|
|
7
|
-
* writeback sandbox agent detects whether a repo already has this set up and,
|
|
8
|
-
* if not, offers to open a PR adding it.
|
|
9
|
-
*
|
|
10
|
-
* Everything here is pure so it can be unit-tested without a sandbox or
|
|
11
|
-
* database: detection takes the workflow files as `{ path, content }` and the
|
|
12
|
-
* generators take only the project identity.
|
|
13
|
-
*/
|
|
14
|
-
/** A single file read out of a repo, used for detection. */
|
|
15
|
-
export type WorkflowFile = {
|
|
16
|
-
path: string;
|
|
17
|
-
content: string;
|
|
18
|
-
};
|
|
19
|
-
export type PreviewDeployDetection = {
|
|
20
|
-
hasPreviewDeployWorkflow: boolean;
|
|
21
|
-
/** Path of the first matching workflow file, or null when none matched. */
|
|
22
|
-
workflowPath: string | null;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Substrings that, when found in a `.github/workflows` file, indicate the repo
|
|
26
|
-
* already deploys Lightdash preview projects. `lightdash deploy` is
|
|
27
|
-
* deliberately excluded — that is a production deploy, not a preview.
|
|
28
|
-
*/
|
|
29
|
-
export declare const PREVIEW_DEPLOY_WORKFLOW_MARKERS: readonly ['lightdash start-preview', 'start-preview', 'lightdash stop-preview', 'stop-preview', 'lightdash preview', 'lightdash-deploy-action'];
|
|
30
|
-
/** True for `.github/workflows/*.yml|*.yaml` paths (tolerates a `./` prefix). */
|
|
31
|
-
export declare const isWorkflowFile: (path: string) => boolean;
|
|
32
|
-
export declare const detectPreviewDeployWorkflow: (files: WorkflowFile[]) => PreviewDeployDetection;
|
|
33
|
-
/**
|
|
34
|
-
* A GitHub Actions secret the preview workflow needs. `value` is non-null when
|
|
35
|
-
* Lightdash can pre-fill it (project UUID, instance URL); null means the user
|
|
36
|
-
* must supply it themselves — the sandbox never holds real warehouse secrets.
|
|
37
|
-
*/
|
|
38
|
-
export type PreviewDeploySecret = {
|
|
39
|
-
name: string;
|
|
40
|
-
value: string | null;
|
|
41
|
-
description: string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Result of opening the preview-deploy setup pull request. `secrets` are the
|
|
45
|
-
* GitHub Actions secrets the user must add for the workflow to run, with the
|
|
46
|
-
* values Lightdash can pre-fill already populated.
|
|
47
|
-
*/
|
|
48
|
-
export type PreviewDeploySetupResult = {
|
|
49
|
-
prUrl: string;
|
|
50
|
-
projectName: string;
|
|
51
|
-
repository: string;
|
|
52
|
-
secrets: PreviewDeploySecret[];
|
|
53
|
-
};
|
|
54
|
-
export declare const getPreviewDeploySecrets: ({ projectUuid, siteUrl, }: {
|
|
55
|
-
projectUuid: string;
|
|
56
|
-
siteUrl: string;
|
|
57
|
-
}) => PreviewDeploySecret[];
|
|
58
|
-
/**
|
|
59
|
-
* Generate the canonical Lightdash preview-on-PR workflow pair.
|
|
60
|
-
*
|
|
61
|
-
* @param projectSubPath dbt project directory within the repo (repo root when
|
|
62
|
-
* null) — passed to the CLI as `--project-dir`.
|
|
63
|
-
* @param cliVersion the `@lightdash/cli` version to pin. Pass the Lightdash
|
|
64
|
-
* instance's own version (`VERSION`): every Lightdash package releases in
|
|
65
|
-
* lockstep, so the instance version is the CLI version that matches it — this
|
|
66
|
-
* keeps the pin reproducible, compatible, and self-updating with the instance
|
|
67
|
-
* instead of frozen at a literal that rots.
|
|
68
|
-
*/
|
|
69
|
-
export declare const generatePreviewDeployWorkflowFiles: ({ projectSubPath, cliVersion, }: {
|
|
70
|
-
projectSubPath: string | null;
|
|
71
|
-
cliVersion: string;
|
|
72
|
-
}) => WorkflowFile[];
|
|
73
|
-
//# sourceMappingURL=previewDeployWorkflow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"previewDeployWorkflow.d.ts","sourceRoot":"","sources":["../../../src/utils/previewDeployWorkflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4DAA4D;AAC5D,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,wBAAwB,EAAE,OAAO,CAAC;IAClC,2EAA2E;IAC3E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,YACxC,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,mBAAmB,EACnB,yBAAyB,CACnB,CAAC;AAIX,iFAAiF;AACjF,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,OAM7C,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAC7B,YAAY,EAAE,KACtB,sBAYF,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,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