@lightdash/cli 2.228.1 → 2.229.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 -0
- package/package.json +4 -4
- package/dist/.tsbuildinfo +0 -1
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -72
- package/dist/dbt/context.test.d.ts +0 -2
- package/dist/dbt/context.test.d.ts.map +0 -1
- package/dist/dbt/context.test.js +0 -152
- package/dist/dbt/manifest.test.d.ts +0 -2
- package/dist/dbt/manifest.test.d.ts.map +0 -1
- package/dist/dbt/manifest.test.js +0 -170
- package/dist/dbt/models.test.d.ts +0 -2
- package/dist/dbt/models.test.d.ts.map +0 -1
- package/dist/dbt/models.test.js +0 -139
- package/dist/dbt/profiles.test.d.ts +0 -2
- package/dist/dbt/profiles.test.d.ts.map +0 -1
- package/dist/dbt/profiles.test.js +0 -50
- package/dist/dbt/targets/athena.test.d.ts +0 -2
- package/dist/dbt/targets/athena.test.d.ts.map +0 -1
- package/dist/dbt/targets/athena.test.js +0 -78
- package/dist/dbt/targets/duckdb.test.d.ts +0 -2
- package/dist/dbt/targets/duckdb.test.d.ts.map +0 -1
- package/dist/dbt/targets/duckdb.test.js +0 -149
- package/dist/dbt/targets/redshift.test.d.ts +0 -2
- package/dist/dbt/targets/redshift.test.d.ts.map +0 -1
- package/dist/dbt/targets/redshift.test.js +0 -198
- package/dist/dbt/templating.test.d.ts +0 -2
- package/dist/dbt/templating.test.d.ts.map +0 -1
- package/dist/dbt/templating.test.js +0 -51
- package/dist/dbt/validation.test.d.ts +0 -2
- package/dist/dbt/validation.test.d.ts.map +0 -1
- package/dist/dbt/validation.test.js +0 -67
- package/dist/handlers/apps/appCodeFiles.test.d.ts +0 -2
- package/dist/handlers/apps/appCodeFiles.test.d.ts.map +0 -1
- package/dist/handlers/apps/appCodeFiles.test.js +0 -391
- package/dist/handlers/apps/appsDownload.test.d.ts +0 -2
- package/dist/handlers/apps/appsDownload.test.d.ts.map +0 -1
- package/dist/handlers/apps/appsDownload.test.js +0 -639
- package/dist/handlers/apps/build.test.d.ts +0 -2
- package/dist/handlers/apps/build.test.d.ts.map +0 -1
- package/dist/handlers/apps/build.test.js +0 -252
- package/dist/handlers/apps/createApp.test.d.ts +0 -2
- package/dist/handlers/apps/createApp.test.d.ts.map +0 -1
- package/dist/handlers/apps/createApp.test.js +0 -340
- package/dist/handlers/apps/pathContainment.test.d.ts +0 -2
- package/dist/handlers/apps/pathContainment.test.d.ts.map +0 -1
- package/dist/handlers/apps/pathContainment.test.js +0 -66
- package/dist/handlers/apps/preview.test.d.ts +0 -2
- package/dist/handlers/apps/preview.test.d.ts.map +0 -1
- package/dist/handlers/apps/preview.test.js +0 -353
- package/dist/handlers/apps/previewProxy.test.d.ts +0 -2
- package/dist/handlers/apps/previewProxy.test.d.ts.map +0 -1
- package/dist/handlers/apps/previewProxy.test.js +0 -178
- package/dist/handlers/apps/scaffolding.test.d.ts +0 -2
- package/dist/handlers/apps/scaffolding.test.d.ts.map +0 -1
- package/dist/handlers/apps/scaffolding.test.js +0 -151
- package/dist/handlers/apps/uploadRetry.test.d.ts +0 -2
- package/dist/handlers/apps/uploadRetry.test.d.ts.map +0 -1
- package/dist/handlers/apps/uploadRetry.test.js +0 -103
- package/dist/handlers/apps/validate.test.d.ts +0 -2
- package/dist/handlers/apps/validate.test.d.ts.map +0 -1
- package/dist/handlers/apps/validate.test.js +0 -526
- package/dist/handlers/compile.test.d.ts +0 -2
- package/dist/handlers/compile.test.d.ts.map +0 -1
- package/dist/handlers/compile.test.js +0 -151
- package/dist/handlers/compileProject.test.d.ts +0 -2
- package/dist/handlers/compileProject.test.d.ts.map +0 -1
- package/dist/handlers/compileProject.test.js +0 -637
- package/dist/handlers/compileWarehouseColumnValidation.test.d.ts +0 -2
- package/dist/handlers/compileWarehouseColumnValidation.test.d.ts.map +0 -1
- package/dist/handlers/compileWarehouseColumnValidation.test.js +0 -493
- package/dist/handlers/connectSnowflake.test.d.ts +0 -2
- package/dist/handlers/connectSnowflake.test.d.ts.map +0 -1
- package/dist/handlers/connectSnowflake.test.js +0 -320
- package/dist/handlers/contentAsCode/fileNames.test.d.ts +0 -2
- package/dist/handlers/contentAsCode/fileNames.test.d.ts.map +0 -1
- package/dist/handlers/contentAsCode/fileNames.test.js +0 -79
- package/dist/handlers/contentAsCode/registry.test.d.ts +0 -2
- package/dist/handlers/contentAsCode/registry.test.d.ts.map +0 -1
- package/dist/handlers/contentAsCode/registry.test.js +0 -18
- package/dist/handlers/contentAsCode/resource.test.d.ts +0 -2
- package/dist/handlers/contentAsCode/resource.test.d.ts.map +0 -1
- package/dist/handlers/contentAsCode/resource.test.js +0 -121
- package/dist/handlers/dbt/getDbtVersion.test.d.ts +0 -2
- package/dist/handlers/dbt/getDbtVersion.test.d.ts.map +0 -1
- package/dist/handlers/dbt/getDbtVersion.test.js +0 -106
- package/dist/handlers/deploy.test.d.ts +0 -2
- package/dist/handlers/deploy.test.d.ts.map +0 -1
- package/dist/handlers/deploy.test.js +0 -244
- package/dist/handlers/download.test.d.ts +0 -2
- package/dist/handlers/download.test.d.ts.map +0 -1
- package/dist/handlers/download.test.js +0 -1739
- package/dist/handlers/exportChartImage.test.d.ts +0 -2
- package/dist/handlers/exportChartImage.test.d.ts.map +0 -1
- package/dist/handlers/exportChartImage.test.js +0 -55
- package/dist/handlers/homepagesAsCode.test.d.ts +0 -2
- package/dist/handlers/homepagesAsCode.test.d.ts.map +0 -1
- package/dist/handlers/homepagesAsCode.test.js +0 -72
- package/dist/handlers/lint.test.d.ts +0 -2
- package/dist/handlers/lint.test.d.ts.map +0 -1
- package/dist/handlers/lint.test.js +0 -221
- package/dist/handlers/login.test.d.ts +0 -2
- package/dist/handlers/login.test.d.ts.map +0 -1
- package/dist/handlers/login.test.js +0 -24
- package/dist/handlers/metadataFile.test.d.ts +0 -2
- package/dist/handlers/metadataFile.test.d.ts.map +0 -1
- package/dist/handlers/metadataFile.test.js +0 -46
- package/dist/handlers/organizationContent/customRoles.test.d.ts +0 -2
- package/dist/handlers/organizationContent/customRoles.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/customRoles.test.js +0 -179
- package/dist/handlers/organizationContent/groups.test.d.ts +0 -2
- package/dist/handlers/organizationContent/groups.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/groups.test.js +0 -135
- package/dist/handlers/organizationContent/index.test.d.ts +0 -2
- package/dist/handlers/organizationContent/index.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/index.test.js +0 -212
- package/dist/handlers/organizationContent/themes.test.d.ts +0 -2
- package/dist/handlers/organizationContent/themes.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/themes.test.js +0 -180
- package/dist/handlers/organizationContent/users.test.d.ts +0 -2
- package/dist/handlers/organizationContent/users.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/users.test.js +0 -155
- package/dist/handlers/preAggregateAudit.test.d.ts +0 -2
- package/dist/handlers/preAggregateAudit.test.d.ts.map +0 -1
- package/dist/handlers/preAggregateAudit.test.js +0 -102
- package/dist/handlers/renameHandler.test.d.ts +0 -2
- package/dist/handlers/renameHandler.test.d.ts.map +0 -1
- package/dist/handlers/renameHandler.test.js +0 -189
- package/dist/handlers/resolveProjectFlag.test.d.ts +0 -2
- package/dist/handlers/resolveProjectFlag.test.d.ts.map +0 -1
- package/dist/handlers/resolveProjectFlag.test.js +0 -48
- package/dist/handlers/selectProject.test.d.ts +0 -2
- package/dist/handlers/selectProject.test.d.ts.map +0 -1
- package/dist/handlers/selectProject.test.js +0 -224
- package/dist/handlers/setProject.test.d.ts +0 -2
- package/dist/handlers/setProject.test.d.ts.map +0 -1
- package/dist/handlers/setProject.test.js +0 -63
- package/dist/handlers/slugUpdate.test.d.ts +0 -2
- package/dist/handlers/slugUpdate.test.d.ts.map +0 -1
- package/dist/handlers/slugUpdate.test.js +0 -265
- package/dist/handlers/timestampConversion.test.d.ts +0 -2
- package/dist/handlers/timestampConversion.test.d.ts.map +0 -1
- package/dist/handlers/timestampConversion.test.js +0 -87
- package/dist/handlers/upgradeCheck.test.d.ts +0 -2
- package/dist/handlers/upgradeCheck.test.d.ts.map +0 -1
- package/dist/handlers/upgradeCheck.test.js +0 -227
- package/dist/handlers/validate.test.d.ts +0 -2
- package/dist/handlers/validate.test.d.ts.map +0 -1
- package/dist/handlers/validate.test.js +0 -318
- package/dist/handlers/validateSpaceFilter.test.d.ts +0 -2
- package/dist/handlers/validateSpaceFilter.test.d.ts.map +0 -1
- package/dist/handlers/validateSpaceFilter.test.js +0 -79
- package/dist/handlers/warehouseConnection.test.d.ts +0 -2
- package/dist/handlers/warehouseConnection.test.d.ts.map +0 -1
- package/dist/handlers/warehouseConnection.test.js +0 -75
- package/dist/lightdash-config/lightdash-config.test.d.ts +0 -2
- package/dist/lightdash-config/lightdash-config.test.d.ts.map +0 -1
- package/dist/lightdash-config/lightdash-config.test.js +0 -69
- package/dist/prompts/fuzzySearchPrompt.test.d.ts +0 -2
- package/dist/prompts/fuzzySearchPrompt.test.d.ts.map +0 -1
- package/dist/prompts/fuzzySearchPrompt.test.js +0 -53
- package/dist/refsArgument.test.d.ts +0 -2
- package/dist/refsArgument.test.d.ts.map +0 -1
- package/dist/refsArgument.test.js +0 -42
- package/dist/releaseSafety/index.test.d.ts +0 -2
- package/dist/releaseSafety/index.test.d.ts.map +0 -1
- package/dist/releaseSafety/index.test.js +0 -154
- package/dist/releaseSafety/version.test.d.ts +0 -2
- package/dist/releaseSafety/version.test.d.ts.map +0 -1
- package/dist/releaseSafety/version.test.js +0 -22
- package/dist/skills.test.d.ts +0 -2
- package/dist/skills.test.d.ts.map +0 -1
- package/dist/skills.test.js +0 -112
- package/dist/terminal/contentAsCodeOutput.test.d.ts +0 -2
- package/dist/terminal/contentAsCodeOutput.test.d.ts.map +0 -1
- package/dist/terminal/contentAsCodeOutput.test.js +0 -231
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@lightdash/common");
|
|
4
|
-
const athena_1 = require("./athena");
|
|
5
|
-
describe('convertAthenaSchema', () => {
|
|
6
|
-
test('should parse access key authentication when keys are present', () => {
|
|
7
|
-
const target = {
|
|
8
|
-
type: 'athena',
|
|
9
|
-
region_name: 'us-east-1',
|
|
10
|
-
database: 'AwsDataCatalog',
|
|
11
|
-
schema: 'default',
|
|
12
|
-
s3_staging_dir: 's3://test-results/',
|
|
13
|
-
aws_access_key_id: 'AKIATEST',
|
|
14
|
-
aws_secret_access_key: 'SECRETTEST',
|
|
15
|
-
};
|
|
16
|
-
expect((0, athena_1.convertAthenaSchema)(target)).toEqual({
|
|
17
|
-
type: common_1.WarehouseTypes.ATHENA,
|
|
18
|
-
region: 'us-east-1',
|
|
19
|
-
database: 'AwsDataCatalog',
|
|
20
|
-
schema: 'default',
|
|
21
|
-
s3StagingDir: 's3://test-results/',
|
|
22
|
-
s3DataDir: undefined,
|
|
23
|
-
authenticationType: common_1.AthenaAuthenticationType.ACCESS_KEY,
|
|
24
|
-
accessKeyId: 'AKIATEST',
|
|
25
|
-
secretAccessKey: 'SECRETTEST',
|
|
26
|
-
workGroup: undefined,
|
|
27
|
-
threads: undefined,
|
|
28
|
-
numRetries: undefined,
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
test('should parse iam role authentication when keys are missing', () => {
|
|
32
|
-
const target = {
|
|
33
|
-
type: 'athena',
|
|
34
|
-
region_name: 'us-east-1',
|
|
35
|
-
database: 'AwsDataCatalog',
|
|
36
|
-
schema: 'default',
|
|
37
|
-
s3_staging_dir: 's3://test-results/',
|
|
38
|
-
};
|
|
39
|
-
expect((0, athena_1.convertAthenaSchema)(target)).toEqual({
|
|
40
|
-
type: common_1.WarehouseTypes.ATHENA,
|
|
41
|
-
region: 'us-east-1',
|
|
42
|
-
database: 'AwsDataCatalog',
|
|
43
|
-
schema: 'default',
|
|
44
|
-
s3StagingDir: 's3://test-results/',
|
|
45
|
-
s3DataDir: undefined,
|
|
46
|
-
authenticationType: common_1.AthenaAuthenticationType.IAM_ROLE,
|
|
47
|
-
accessKeyId: undefined,
|
|
48
|
-
secretAccessKey: undefined,
|
|
49
|
-
workGroup: undefined,
|
|
50
|
-
threads: undefined,
|
|
51
|
-
numRetries: undefined,
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
test('should forward aws_session_token as sessionToken for temporary STS credentials', () => {
|
|
55
|
-
const target = {
|
|
56
|
-
type: 'athena',
|
|
57
|
-
region_name: 'us-east-1',
|
|
58
|
-
database: 'AwsDataCatalog',
|
|
59
|
-
schema: 'default',
|
|
60
|
-
s3_staging_dir: 's3://test-results/',
|
|
61
|
-
aws_access_key_id: 'ASIATEST',
|
|
62
|
-
aws_secret_access_key: 'SECRETTEST',
|
|
63
|
-
aws_session_token: 'SESSIONTOKENTEST',
|
|
64
|
-
};
|
|
65
|
-
expect((0, athena_1.convertAthenaSchema)(target)).toMatchObject({
|
|
66
|
-
authenticationType: common_1.AthenaAuthenticationType.ACCESS_KEY,
|
|
67
|
-
accessKeyId: 'ASIATEST',
|
|
68
|
-
secretAccessKey: 'SECRETTEST',
|
|
69
|
-
sessionToken: 'SESSIONTOKENTEST',
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
test('should throw parse error for invalid Athena target', () => {
|
|
73
|
-
expect(() => (0, athena_1.convertAthenaSchema)({
|
|
74
|
-
type: 'athena',
|
|
75
|
-
region_name: 'us-east-1',
|
|
76
|
-
})).toThrow(common_1.ParseError);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duckdb.test.d.ts","sourceRoot":"","sources":["../../../src/dbt/targets/duckdb.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@lightdash/common");
|
|
4
|
-
const duckdb_1 = require("./duckdb");
|
|
5
|
-
describe('convertDuckdbSchema', () => {
|
|
6
|
-
test('should parse MotherDuck duckdb targets', () => {
|
|
7
|
-
expect((0, duckdb_1.convertDuckdbSchema)({
|
|
8
|
-
type: 'duckdb',
|
|
9
|
-
path: 'md:analytics',
|
|
10
|
-
schema: 'main',
|
|
11
|
-
threads: 4,
|
|
12
|
-
settings: {
|
|
13
|
-
motherduck_token: 'motherduck_token',
|
|
14
|
-
},
|
|
15
|
-
})).toEqual({
|
|
16
|
-
type: common_1.WarehouseTypes.DUCKDB,
|
|
17
|
-
connectionType: common_1.DuckdbConnectionType.MOTHERDUCK,
|
|
18
|
-
database: 'analytics',
|
|
19
|
-
schema: 'main',
|
|
20
|
-
token: 'motherduck_token',
|
|
21
|
-
threads: 4,
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
test('should parse MotherDuck duckdb targets with token in path query string', () => {
|
|
25
|
-
expect((0, duckdb_1.convertDuckdbSchema)({
|
|
26
|
-
type: 'duckdb',
|
|
27
|
-
path: 'md:analytics?motherduck_token=motherduck_token',
|
|
28
|
-
schema: 'main',
|
|
29
|
-
threads: 4,
|
|
30
|
-
})).toEqual({
|
|
31
|
-
type: common_1.WarehouseTypes.DUCKDB,
|
|
32
|
-
connectionType: common_1.DuckdbConnectionType.MOTHERDUCK,
|
|
33
|
-
database: 'analytics',
|
|
34
|
-
schema: 'main',
|
|
35
|
-
token: 'motherduck_token',
|
|
36
|
-
threads: 4,
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
test('should reject duckdb targets that are neither MotherDuck nor DuckLake', () => {
|
|
40
|
-
expect(() => (0, duckdb_1.convertDuckdbSchema)({
|
|
41
|
-
type: 'duckdb',
|
|
42
|
-
path: 'analytics.duckdb',
|
|
43
|
-
schema: 'main',
|
|
44
|
-
})).toThrow(common_1.ParseError);
|
|
45
|
-
});
|
|
46
|
-
test('should require a MotherDuck token', () => {
|
|
47
|
-
expect(() => (0, duckdb_1.convertDuckdbSchema)({
|
|
48
|
-
type: 'duckdb',
|
|
49
|
-
path: 'md:analytics',
|
|
50
|
-
schema: 'main',
|
|
51
|
-
})).toThrow(common_1.ParseError);
|
|
52
|
-
});
|
|
53
|
-
test('should parse a DuckLake target with postgres catalog and S3 data path', () => {
|
|
54
|
-
expect((0, duckdb_1.convertDuckdbSchema)({
|
|
55
|
-
type: 'duckdb',
|
|
56
|
-
path: ':memory:',
|
|
57
|
-
schema: 'main',
|
|
58
|
-
threads: 4,
|
|
59
|
-
attach: [
|
|
60
|
-
{
|
|
61
|
-
path: 'ducklake:ld_ducklake',
|
|
62
|
-
alias: 'ducklake',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
secrets: [
|
|
66
|
-
{
|
|
67
|
-
name: 'ld_ducklake_catalog',
|
|
68
|
-
type: 'postgres',
|
|
69
|
-
host: 'pg.example.com',
|
|
70
|
-
port: 5432,
|
|
71
|
-
database: 'catalog',
|
|
72
|
-
user: 'ducklake_user',
|
|
73
|
-
password: 'p@ss',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 'ld_ducklake_data',
|
|
77
|
-
type: 's3',
|
|
78
|
-
scope: 's3://my-bucket/path/',
|
|
79
|
-
region: 'us-east-1',
|
|
80
|
-
key_id: 'AKIAEXAMPLE',
|
|
81
|
-
secret: 'SECRETEXAMPLE',
|
|
82
|
-
url_style: 'vhost',
|
|
83
|
-
use_ssl: true,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'ld_ducklake',
|
|
87
|
-
type: 'ducklake',
|
|
88
|
-
data_path: 's3://my-bucket/path/',
|
|
89
|
-
metadata_parameters: {
|
|
90
|
-
TYPE: 'postgres',
|
|
91
|
-
SECRET: 'ld_ducklake_catalog',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
})).toEqual({
|
|
96
|
-
type: common_1.WarehouseTypes.DUCKDB,
|
|
97
|
-
connectionType: common_1.DuckdbConnectionType.DUCKLAKE,
|
|
98
|
-
schema: 'main',
|
|
99
|
-
catalogAlias: 'ducklake',
|
|
100
|
-
threads: 4,
|
|
101
|
-
catalog: {
|
|
102
|
-
type: common_1.DucklakeCatalogType.POSTGRES,
|
|
103
|
-
host: 'pg.example.com',
|
|
104
|
-
port: 5432,
|
|
105
|
-
database: 'catalog',
|
|
106
|
-
user: 'ducklake_user',
|
|
107
|
-
password: 'p@ss',
|
|
108
|
-
},
|
|
109
|
-
dataPath: {
|
|
110
|
-
type: common_1.DucklakeDataPathType.S3,
|
|
111
|
-
url: 's3://my-bucket/path/',
|
|
112
|
-
endpoint: undefined,
|
|
113
|
-
region: 'us-east-1',
|
|
114
|
-
accessKeyId: 'AKIAEXAMPLE',
|
|
115
|
-
secretAccessKey: 'SECRETEXAMPLE',
|
|
116
|
-
forcePathStyle: false,
|
|
117
|
-
useSsl: true,
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
test('should parse a DuckLake target with SQLite catalog and local data path', () => {
|
|
122
|
-
expect((0, duckdb_1.convertDuckdbSchema)({
|
|
123
|
-
type: 'duckdb',
|
|
124
|
-
path: ':memory:',
|
|
125
|
-
schema: 'main',
|
|
126
|
-
attach: [
|
|
127
|
-
{
|
|
128
|
-
path: 'ducklake:sqlite:/tmp/ducklake.sqlite',
|
|
129
|
-
alias: 'ducklake',
|
|
130
|
-
options: { data_path: '/tmp/ducklake-data' },
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
})).toEqual({
|
|
134
|
-
type: common_1.WarehouseTypes.DUCKDB,
|
|
135
|
-
connectionType: common_1.DuckdbConnectionType.DUCKLAKE,
|
|
136
|
-
schema: 'main',
|
|
137
|
-
catalogAlias: 'ducklake',
|
|
138
|
-
threads: undefined,
|
|
139
|
-
catalog: {
|
|
140
|
-
type: common_1.DucklakeCatalogType.SQLITE,
|
|
141
|
-
path: '/tmp/ducklake.sqlite',
|
|
142
|
-
},
|
|
143
|
-
dataPath: {
|
|
144
|
-
type: common_1.DucklakeDataPathType.LOCAL,
|
|
145
|
-
path: '/tmp/ducklake-data',
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redshift.test.d.ts","sourceRoot":"","sources":["../../../src/dbt/targets/redshift.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
4
|
-
const common_1 = require("@lightdash/common");
|
|
5
|
-
const redshift_1 = require("./redshift");
|
|
6
|
-
vi.mock('@aws-sdk/credential-providers', () => ({
|
|
7
|
-
fromIni: vi.fn(),
|
|
8
|
-
fromNodeProviderChain: vi.fn(),
|
|
9
|
-
}));
|
|
10
|
-
const mockedFromIni = vi.mocked(credential_providers_1.fromIni);
|
|
11
|
-
const mockedFromNodeProviderChain = vi.mocked(credential_providers_1.fromNodeProviderChain);
|
|
12
|
-
// Build a credential provider (the thunk fromIni/fromNodeProviderChain return)
|
|
13
|
-
// that resolves to the given AWS credentials.
|
|
14
|
-
const providerResolving = (credentials) => vi.fn().mockResolvedValue(credentials);
|
|
15
|
-
// ...or rejects, the way the SDK does when nothing in the chain resolves
|
|
16
|
-
// (e.g. an expired SSO session, or no credentials at all).
|
|
17
|
-
const providerRejecting = (message) => vi.fn().mockRejectedValue(new Error(message));
|
|
18
|
-
describe('convertRedshiftSchema', () => {
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
vi.resetAllMocks();
|
|
21
|
-
});
|
|
22
|
-
test('should parse password authentication', async () => {
|
|
23
|
-
const target = {
|
|
24
|
-
type: 'redshift',
|
|
25
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
26
|
-
user: 'analytics',
|
|
27
|
-
password: 'secret',
|
|
28
|
-
port: 5439,
|
|
29
|
-
dbname: 'dev',
|
|
30
|
-
schema: 'public',
|
|
31
|
-
};
|
|
32
|
-
expect(await (0, redshift_1.convertRedshiftSchema)(target)).toEqual({
|
|
33
|
-
type: common_1.WarehouseTypes.REDSHIFT,
|
|
34
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
35
|
-
user: 'analytics',
|
|
36
|
-
password: 'secret',
|
|
37
|
-
port: 5439,
|
|
38
|
-
dbname: 'dev',
|
|
39
|
-
schema: 'public',
|
|
40
|
-
keepalivesIdle: undefined,
|
|
41
|
-
sslmode: undefined,
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
test('should resolve IAM credentials from the default AWS chain for a provisioned cluster', async () => {
|
|
45
|
-
mockedFromNodeProviderChain.mockReturnValue(providerResolving({
|
|
46
|
-
accessKeyId: 'test-access-key-id-value',
|
|
47
|
-
secretAccessKey: 'super-secret-access-key',
|
|
48
|
-
}));
|
|
49
|
-
const target = {
|
|
50
|
-
type: 'redshift',
|
|
51
|
-
method: 'iam',
|
|
52
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
53
|
-
cluster_id: 'my-cluster',
|
|
54
|
-
user: 'analytics',
|
|
55
|
-
region: 'us-east-1',
|
|
56
|
-
port: 5439,
|
|
57
|
-
dbname: 'dev',
|
|
58
|
-
schema: 'public',
|
|
59
|
-
autocreate: true,
|
|
60
|
-
};
|
|
61
|
-
expect(await (0, redshift_1.convertRedshiftSchema)(target)).toEqual({
|
|
62
|
-
type: common_1.WarehouseTypes.REDSHIFT,
|
|
63
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
64
|
-
user: 'analytics',
|
|
65
|
-
port: 5439,
|
|
66
|
-
dbname: 'dev',
|
|
67
|
-
schema: 'public',
|
|
68
|
-
keepalivesIdle: undefined,
|
|
69
|
-
sslmode: undefined,
|
|
70
|
-
authenticationType: common_1.RedshiftAuthenticationType.IAM,
|
|
71
|
-
region: 'us-east-1',
|
|
72
|
-
isServerless: false,
|
|
73
|
-
clusterIdentifier: 'my-cluster',
|
|
74
|
-
accessKeyId: 'test-access-key-id-value',
|
|
75
|
-
secretAccessKey: 'super-secret-access-key',
|
|
76
|
-
autoCreate: true,
|
|
77
|
-
});
|
|
78
|
-
// No named profile -> resolve via the default provider chain.
|
|
79
|
-
expect(mockedFromNodeProviderChain).toHaveBeenCalledTimes(1);
|
|
80
|
-
expect(mockedFromIni).not.toHaveBeenCalled();
|
|
81
|
-
});
|
|
82
|
-
test('should resolve a named iam_profile via fromIni and forward a session token for serverless (derived from host)', async () => {
|
|
83
|
-
mockedFromIni.mockReturnValue(providerResolving({
|
|
84
|
-
accessKeyId: 'test-access-key-id-value',
|
|
85
|
-
secretAccessKey: 'super-secret-access-key',
|
|
86
|
-
sessionToken: 'temporary-session-token',
|
|
87
|
-
}));
|
|
88
|
-
const target = {
|
|
89
|
-
type: 'redshift',
|
|
90
|
-
method: 'iam',
|
|
91
|
-
host: 'my-wg.123.us-east-1.redshift-serverless.amazonaws.com',
|
|
92
|
-
iam_profile: 'my-sso-profile',
|
|
93
|
-
region: 'us-east-1',
|
|
94
|
-
port: 5439,
|
|
95
|
-
dbname: 'dev',
|
|
96
|
-
schema: 'public',
|
|
97
|
-
};
|
|
98
|
-
expect(await (0, redshift_1.convertRedshiftSchema)(target)).toEqual({
|
|
99
|
-
type: common_1.WarehouseTypes.REDSHIFT,
|
|
100
|
-
host: 'my-wg.123.us-east-1.redshift-serverless.amazonaws.com',
|
|
101
|
-
user: '',
|
|
102
|
-
port: 5439,
|
|
103
|
-
dbname: 'dev',
|
|
104
|
-
schema: 'public',
|
|
105
|
-
keepalivesIdle: undefined,
|
|
106
|
-
sslmode: undefined,
|
|
107
|
-
authenticationType: common_1.RedshiftAuthenticationType.IAM,
|
|
108
|
-
region: 'us-east-1',
|
|
109
|
-
isServerless: true,
|
|
110
|
-
workgroupName: 'my-wg',
|
|
111
|
-
accessKeyId: 'test-access-key-id-value',
|
|
112
|
-
secretAccessKey: 'super-secret-access-key',
|
|
113
|
-
sessionToken: 'temporary-session-token',
|
|
114
|
-
autoCreate: undefined,
|
|
115
|
-
});
|
|
116
|
-
// The dbt "iam_profile" is passed straight through to fromIni so we
|
|
117
|
-
// resolve the exact identity dbt would use (matching its precedence).
|
|
118
|
-
expect(mockedFromIni).toHaveBeenCalledWith({
|
|
119
|
-
profile: 'my-sso-profile',
|
|
120
|
-
});
|
|
121
|
-
expect(mockedFromNodeProviderChain).not.toHaveBeenCalled();
|
|
122
|
-
});
|
|
123
|
-
test('should warn when forwarding temporary (expiring) credentials', async () => {
|
|
124
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
125
|
-
const expiration = new Date('2026-07-07T12:00:00.000Z');
|
|
126
|
-
mockedFromNodeProviderChain.mockReturnValue(providerResolving({
|
|
127
|
-
accessKeyId: 'test-access-key-id-value',
|
|
128
|
-
secretAccessKey: 'super-secret-access-key',
|
|
129
|
-
sessionToken: 'temporary-session-token',
|
|
130
|
-
expiration,
|
|
131
|
-
}));
|
|
132
|
-
await (0, redshift_1.convertRedshiftSchema)({
|
|
133
|
-
type: 'redshift',
|
|
134
|
-
method: 'iam',
|
|
135
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
136
|
-
cluster_id: 'my-cluster',
|
|
137
|
-
user: 'analytics',
|
|
138
|
-
region: 'us-east-1',
|
|
139
|
-
port: 5439,
|
|
140
|
-
dbname: 'dev',
|
|
141
|
-
schema: 'public',
|
|
142
|
-
});
|
|
143
|
-
expect(warnSpy).toHaveBeenCalledTimes(1);
|
|
144
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining(expiration.toISOString()));
|
|
145
|
-
warnSpy.mockRestore();
|
|
146
|
-
});
|
|
147
|
-
test('should throw when IAM target is missing a region', async () => {
|
|
148
|
-
await expect((0, redshift_1.convertRedshiftSchema)({
|
|
149
|
-
type: 'redshift',
|
|
150
|
-
method: 'iam',
|
|
151
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
152
|
-
cluster_id: 'my-cluster',
|
|
153
|
-
user: 'analytics',
|
|
154
|
-
port: 5439,
|
|
155
|
-
dbname: 'dev',
|
|
156
|
-
schema: 'public',
|
|
157
|
-
})).rejects.toThrow(common_1.ParseError);
|
|
158
|
-
});
|
|
159
|
-
test('should throw a clear error when the default AWS credential chain resolves nothing', async () => {
|
|
160
|
-
mockedFromNodeProviderChain.mockReturnValue(providerRejecting('Could not load credentials from any providers'));
|
|
161
|
-
await expect((0, redshift_1.convertRedshiftSchema)({
|
|
162
|
-
type: 'redshift',
|
|
163
|
-
method: 'iam',
|
|
164
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
165
|
-
cluster_id: 'my-cluster',
|
|
166
|
-
user: 'analytics',
|
|
167
|
-
region: 'us-east-1',
|
|
168
|
-
port: 5439,
|
|
169
|
-
dbname: 'dev',
|
|
170
|
-
schema: 'public',
|
|
171
|
-
})).rejects.toThrow(common_1.ParseError);
|
|
172
|
-
});
|
|
173
|
-
test('should throw an error naming the profile and "aws sso login" when a named profile cannot be resolved', async () => {
|
|
174
|
-
mockedFromIni.mockReturnValue(providerRejecting('Token for sso-session shared-aws-profile is expired'));
|
|
175
|
-
await expect((0, redshift_1.convertRedshiftSchema)({
|
|
176
|
-
type: 'redshift',
|
|
177
|
-
method: 'iam',
|
|
178
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
179
|
-
cluster_id: 'my-cluster',
|
|
180
|
-
user: 'analytics',
|
|
181
|
-
region: 'us-east-1',
|
|
182
|
-
iam_profile: 'shared-aws-profile',
|
|
183
|
-
port: 5439,
|
|
184
|
-
dbname: 'dev',
|
|
185
|
-
schema: 'public',
|
|
186
|
-
})).rejects.toThrow(/aws sso login --profile shared-aws-profile/);
|
|
187
|
-
});
|
|
188
|
-
test('should throw when password target has no password', async () => {
|
|
189
|
-
await expect((0, redshift_1.convertRedshiftSchema)({
|
|
190
|
-
type: 'redshift',
|
|
191
|
-
host: 'cluster.abc.us-east-1.redshift.amazonaws.com',
|
|
192
|
-
user: 'analytics',
|
|
193
|
-
port: 5439,
|
|
194
|
-
dbname: 'dev',
|
|
195
|
-
schema: 'public',
|
|
196
|
-
})).rejects.toThrow(common_1.ParseError);
|
|
197
|
-
});
|
|
198
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templating.test.d.ts","sourceRoot":"","sources":["../../src/dbt/templating.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const templating_1 = require("./templating");
|
|
4
|
-
describe('Templating', () => {
|
|
5
|
-
const { env, argv } = process;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
vi.resetModules();
|
|
8
|
-
process.env = { ...env };
|
|
9
|
-
process.argv = { ...argv };
|
|
10
|
-
});
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
process.env = env;
|
|
13
|
-
process.argv = argv;
|
|
14
|
-
});
|
|
15
|
-
describe('renderProfilesYml', () => {
|
|
16
|
-
describe('env_var()', () => {
|
|
17
|
-
test('should not escape values', () => {
|
|
18
|
-
process.env.SPAN = '<span>';
|
|
19
|
-
expect((0, templating_1.renderProfilesYml)("{{ env_var('SPAN') }}")).toBe('<span>');
|
|
20
|
-
process.env.WINDOWS_PATH = 'C:\\example';
|
|
21
|
-
expect((0, templating_1.renderProfilesYml)("{{ env_var('WINDOWS_PATH') }}")).toBe('C:\\example');
|
|
22
|
-
});
|
|
23
|
-
test('should convert env_var functions and return env var values', () => {
|
|
24
|
-
process.env.DBT_USER = 'test';
|
|
25
|
-
expect((0, templating_1.renderProfilesYml)("{{ env_var('DBT_USER') }}")).toBe('test');
|
|
26
|
-
process.env.DBT_ENV_SECRET_HOST_DOMAIN = 'domain';
|
|
27
|
-
process.env.DBT_ENV_SECRET_HOST_PATH = 'host_path';
|
|
28
|
-
expect((0, templating_1.renderProfilesYml)("www.{{ env_var('DBT_ENV_SECRET_HOST_DOMAIN') }}.com/{{ env_var('DBT_ENV_SECRET_HOST_PATH') }}")).toBe('www.domain.com/host_path');
|
|
29
|
-
});
|
|
30
|
-
test('should convert env_var function with number conversion', () => {
|
|
31
|
-
process.env.REDSHIFT_PORT = '2000';
|
|
32
|
-
expect((0, templating_1.renderProfilesYml)("{{ env_var('REDSHIFT_PORT') | as_number}}")).toBe('2000');
|
|
33
|
-
});
|
|
34
|
-
test('should convert env_var function and fallback to default value', () => {
|
|
35
|
-
expect((0, templating_1.renderProfilesYml)("{{ env_var('DBT_USER', 'default_value') }}")).toBe('default_value');
|
|
36
|
-
});
|
|
37
|
-
test('should convert env_var function and fallback to default value using keyword default', () => {
|
|
38
|
-
expect((0, templating_1.renderProfilesYml)("{{ env_var('DBT_USER', default='default_value') }}")).toBe('default_value');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe('var()', () => {
|
|
42
|
-
test('should convert var functions and return env var values', () => {
|
|
43
|
-
process.argv = [
|
|
44
|
-
'--vars',
|
|
45
|
-
'{"domain": "domain", "host_path": "host_path"}',
|
|
46
|
-
];
|
|
47
|
-
expect((0, templating_1.renderProfilesYml)("www.{{ var('domain') }}.com/{{ var('host_path') }}")).toBe('www.domain.com/host_path');
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.test.d.ts","sourceRoot":"","sources":["../../src/dbt/validation.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@lightdash/common");
|
|
4
|
-
const validation_1 = require("@lightdash/common/dbt/validation");
|
|
5
|
-
const validation_2 = require("./validation");
|
|
6
|
-
const makeModel = (name) => ({
|
|
7
|
-
unique_id: `model.test.${name}`,
|
|
8
|
-
name,
|
|
9
|
-
resource_type: 'model',
|
|
10
|
-
database: 'database',
|
|
11
|
-
columns: { id: { name: 'id', meta: {} } },
|
|
12
|
-
meta: {},
|
|
13
|
-
});
|
|
14
|
-
describe('validateDbtModel', () => {
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
vi.restoreAllMocks();
|
|
17
|
-
});
|
|
18
|
-
test('directs served manifest validation failures to a project redeploy', async () => {
|
|
19
|
-
const validationMessage = 'Model "served_orders" from dbt source "server": Field at model root must have required property \'original_file_path\'. Update this field in your dbt model, then deploy again.';
|
|
20
|
-
const invalidValidator = Object.assign(vi.fn().mockReturnValue(false), {
|
|
21
|
-
errors: [],
|
|
22
|
-
});
|
|
23
|
-
vi.spyOn(validation_1.ManifestValidator, 'getValidator').mockReturnValue(invalidValidator);
|
|
24
|
-
vi.spyOn(validation_1.ManifestValidator, 'formatAjvErrors').mockReturnValue(validationMessage);
|
|
25
|
-
const servedModel = makeModel('served_orders');
|
|
26
|
-
const localModel = makeModel('local_orders');
|
|
27
|
-
const result = await (0, validation_2.validateDbtModel)('postgres', common_1.DbtManifestVersion.V11, [servedModel, localModel], new Set([servedModel.unique_id]));
|
|
28
|
-
const servedMessage = result.invalid[0].errors[0].message;
|
|
29
|
-
const localMessage = result.invalid[1].errors[0].message;
|
|
30
|
-
expect(servedMessage).toContain('The served manifest is outdated.');
|
|
31
|
-
expect(servedMessage).toContain('Redeploy the Lightdash project, then try again.');
|
|
32
|
-
expect(servedMessage).not.toContain('Update this field in your dbt model');
|
|
33
|
-
expect(localMessage).toContain('Update this field in your dbt model');
|
|
34
|
-
});
|
|
35
|
-
test('keeps valid v12 models when column config metadata is invalid', async () => {
|
|
36
|
-
const validModel = makeModel('valid_orders');
|
|
37
|
-
const invalidModel = {
|
|
38
|
-
...makeModel('invalid_orders'),
|
|
39
|
-
columns: {
|
|
40
|
-
amount: {
|
|
41
|
-
name: 'amount',
|
|
42
|
-
config: {
|
|
43
|
-
meta: {
|
|
44
|
-
metrics: {
|
|
45
|
-
total_amount: {
|
|
46
|
-
type: 'sum',
|
|
47
|
-
default_time_dimension: {
|
|
48
|
-
field: { created_at: null },
|
|
49
|
-
interval: 'DAY',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
const result = await (0, validation_2.validateDbtModel)('postgres', common_1.DbtManifestVersion.V12, [validModel, invalidModel]);
|
|
59
|
-
expect(result.valid.map(({ name }) => name)).toEqual(['valid_orders']);
|
|
60
|
-
expect(result.invalid).toMatchObject([
|
|
61
|
-
{
|
|
62
|
-
name: 'invalid_orders',
|
|
63
|
-
errors: [{ type: common_1.InlineErrorType.METADATA_PARSE_ERROR }],
|
|
64
|
-
},
|
|
65
|
-
]);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appCodeFiles.test.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/appCodeFiles.test.ts"],"names":[],"mappings":""}
|