@malloy-publisher/server 0.0.126 → 0.0.128

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/server",
3
3
  "description": "Malloy Publisher Server",
4
- "version": "0.0.126",
4
+ "version": "0.0.128",
5
5
  "main": "dist/server.js",
6
6
  "bin": {
7
7
  "malloy-publisher": "dist/server.js"
@@ -1,12 +1,12 @@
1
- import "reflect-metadata";
1
+ import { Type } from "class-transformer";
2
2
  import {
3
- IsOptional,
4
- IsString,
5
3
  IsEnum,
6
4
  IsNumber,
5
+ IsOptional,
6
+ IsString,
7
7
  ValidateNested,
8
8
  } from "class-validator";
9
- import { Type } from "class-transformer";
9
+ import "reflect-metadata";
10
10
  import { ApiConnection } from "../service/model";
11
11
 
12
12
  export class PostgresConnectionDto {
@@ -137,6 +137,10 @@ export class TrinoConnectionDto {
137
137
  @IsOptional()
138
138
  @IsString()
139
139
  password?: string;
140
+
141
+ @IsOptional()
142
+ @IsString()
143
+ peakaKey?: string;
140
144
  }
141
145
 
142
146
  export class ConnectionDto implements ApiConnection {
@@ -37,29 +37,46 @@ function validateAndBuildTrinoConfig(
37
37
  trinoConfig.server = `${trinoConfig.server}:${trinoConfig.port}`;
38
38
  }
39
39
 
40
- if (trinoConfig.server?.startsWith("http://")) {
41
- return {
42
- server: trinoConfig.server,
43
- port: trinoConfig.port,
44
- catalog: trinoConfig.catalog,
45
- schema: trinoConfig.schema,
46
- user: trinoConfig.user,
40
+ // Build base config
41
+ const baseConfig: {
42
+ server: string;
43
+ port?: number;
44
+ catalog?: string;
45
+ schema?: string;
46
+ user?: string;
47
+ password?: string;
48
+ extraConfig?: Record<string, unknown>;
49
+ } = {
50
+ server: trinoConfig.server,
51
+ port: trinoConfig.port,
52
+ catalog: trinoConfig.catalog,
53
+ schema: trinoConfig.schema,
54
+ user: trinoConfig.user,
55
+ };
56
+
57
+ if (trinoConfig.peakaKey) {
58
+ baseConfig.extraConfig = {
59
+ extraCredential: {
60
+ peakaKey: trinoConfig.peakaKey,
61
+ },
47
62
  };
63
+ delete baseConfig.password;
48
64
  } else if (
49
65
  trinoConfig.server?.startsWith("https://") &&
50
66
  trinoConfig.password
51
67
  ) {
52
- return {
53
- server: trinoConfig.server,
54
- port: trinoConfig.port,
55
- catalog: trinoConfig.catalog,
56
- schema: trinoConfig.schema,
57
- user: trinoConfig.user,
58
- password: trinoConfig.password,
59
- };
68
+ // Only add password if no peakaKey and HTTPS connection
69
+ baseConfig.password = trinoConfig.password;
70
+ }
71
+
72
+ if (trinoConfig.server?.startsWith("http://")) {
73
+ delete baseConfig.password;
74
+ return baseConfig;
75
+ } else if (trinoConfig.server?.startsWith("https://")) {
76
+ return baseConfig;
60
77
  } else {
61
78
  throw new Error(
62
- `Invalid Trino connection: expected "http://server:port" (no password) or "https://server:port" (with username and password).`,
79
+ `Invalid Trino connection: expected "http://server:port" or "https://server:port".`,
63
80
  );
64
81
  }
65
82
  }
@@ -313,7 +313,13 @@ export async function getTablesForSchema(
313
313
  // Fetch all table sources in parallel
314
314
  const tableSourcePromises = tableNames.map(async (tableName) => {
315
315
  try {
316
- const tablePath = `${schemaName}.${tableName}`;
316
+ let tablePath: string;
317
+
318
+ if (connection.type === "trino") {
319
+ tablePath = `${connection.trinoConnection?.catalog}.${schemaName}.${tableName}`;
320
+ } else {
321
+ tablePath = `${schemaName}.${tableName}`;
322
+ }
317
323
 
318
324
  logger.info(
319
325
  `Processing table: ${tableName} in schema: ${schemaName}`,
@@ -1 +0,0 @@
1
- import{q as a,t as n,j as e,D as o,G as c}from"./index-CgZNfVij.js";function j(){const r=a(),{projectName:s}=n();if(s){const t=o({projectName:s});return e.jsx(c,{onSelectPackage:r,resourceUri:t})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{j as default};