@malloy-publisher/server 0.0.190 → 0.0.192
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/build.ts +7 -3
- package/dist/app/api-doc.yaml +9 -2
- package/dist/app/assets/{HomePage-Dn3E4CuB.js → HomePage-H1OH-VW5.js} +1 -1
- package/dist/app/assets/{MainPage-BzB3yoqi.js → MainPage-GL06aMke.js} +1 -1
- package/dist/app/assets/{ModelPage-C9O_sAXT.js → ModelPage-Crau5hgZ.js} +1 -1
- package/dist/app/assets/{PackagePage-DcxKEjBX.js → PackagePage-CbubRhgE.js} +1 -1
- package/dist/app/assets/{ProjectPage-BDj307rF.js → ProjectPage-DUlJkYJ4.js} +1 -1
- package/dist/app/assets/{RouteError-DAShbVCG.js → RouteError-DrNXNihc.js} +1 -1
- package/dist/app/assets/{WorkbookPage-Cs_XYEaB.js → WorkbookPage-CBBv7n5U.js} +1 -1
- package/dist/app/assets/{core-CjeTkq8O.es-BqRc6yhC.js → core-Dzx75uJR.es-DwnFZnyO.js} +1 -1
- package/dist/app/assets/{index-D68X76-7.js → index-CzjyS9cx.js} +1 -1
- package/dist/app/assets/{index-Bb2jqquW.js → index-HHdhLUpv.js} +1 -1
- package/dist/app/assets/{index-15BOvhp0.js → index-d5rvmoZ7.js} +4 -4
- package/dist/app/assets/{index.umd-DGBekgSu.js → index.umd-CetYIBQY.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/{instrumentation.js → instrumentation.mjs} +10481 -10519
- package/dist/{server.js → server.mjs} +14939 -15012
- package/package.json +6 -6
- package/src/mcp/prompts/handlers.ts +1 -1
- package/src/server.ts +22 -17
- package/src/service/model.ts +7 -3
- package/src/storage/duckdb/DuckDBConnection.ts +1 -1
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloy-publisher/server",
|
|
3
3
|
"description": "Malloy Publisher Server",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"main": "dist/server.
|
|
4
|
+
"version": "0.0.192",
|
|
5
|
+
"main": "dist/server.mjs",
|
|
6
6
|
"bin": {
|
|
7
|
-
"malloy-publisher": "dist/server.
|
|
7
|
+
"malloy-publisher": "dist/server.mjs"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"test:integration": "bun test --timeout 100000 tests",
|
|
20
20
|
"build": "bun generate-api-types && bun build:app && NODE_ENV=production bun run build.ts",
|
|
21
21
|
"build:server-only": "bun generate-api-types && NODE_ENV=production bun run build.ts",
|
|
22
|
-
"start": "NODE_ENV=production
|
|
23
|
-
"start:init": "NODE_ENV=production
|
|
22
|
+
"start": "NODE_ENV=production bun run ./dist/server.mjs",
|
|
23
|
+
"start:init": "NODE_ENV=production bun run ./dist/server.mjs --init",
|
|
24
24
|
"start:dev": "NODE_ENV=development bun --watch src/server.ts",
|
|
25
25
|
"start:dev:init": "NODE_ENV=development bun --watch src/server.ts --init",
|
|
26
|
-
"start:instrumented": "
|
|
26
|
+
"start:instrumented": "bun --preload ./dist/instrumentation.mjs ./dist/server.mjs",
|
|
27
27
|
"lint": "bunx eslint \"./src/**/*.ts\"",
|
|
28
28
|
"format": "bunx prettier --write '**/*.{ts,tsx}'",
|
|
29
29
|
"build:app": "cd ../app && NODE_ENV=production bunx vite build",
|
package/src/server.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
// Pre-load the instrumentation module; the instrumentation module must be loaded before the other imports.
|
|
2
|
-
import "./instrumentation";
|
|
3
|
-
import {
|
|
4
|
-
getPrometheusMetricsHandler,
|
|
5
|
-
httpMetricsMiddleware,
|
|
6
|
-
} from "./instrumentation";
|
|
7
|
-
|
|
8
2
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
9
|
-
import
|
|
3
|
+
import bodyParser from "body-parser";
|
|
10
4
|
import cors from "cors";
|
|
11
5
|
import express from "express";
|
|
12
6
|
import * as http from "http";
|
|
13
7
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
14
8
|
import { AddressInfo } from "net";
|
|
15
9
|
import * as path from "path";
|
|
10
|
+
import { ParsedQs } from "qs";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
16
12
|
import { CompileController } from "./controller/compile.controller";
|
|
17
13
|
import { ConnectionController } from "./controller/connection.controller";
|
|
18
14
|
import { DatabaseController } from "./controller/database.controller";
|
|
@@ -30,6 +26,11 @@ import {
|
|
|
30
26
|
registerHealthEndpoints,
|
|
31
27
|
registerSignalHandlers,
|
|
32
28
|
} from "./health";
|
|
29
|
+
import "./instrumentation";
|
|
30
|
+
import {
|
|
31
|
+
getPrometheusMetricsHandler,
|
|
32
|
+
httpMetricsMiddleware,
|
|
33
|
+
} from "./instrumentation";
|
|
33
34
|
import { logger, loggerMiddleware } from "./logger";
|
|
34
35
|
|
|
35
36
|
import { ManifestController } from "./controller/manifest.controller";
|
|
@@ -120,15 +121,10 @@ const SHUTDOWN_DRAIN_DURATION_SECONDS = Number(
|
|
|
120
121
|
const SHUTDOWN_GRACEFUL_CLOSE_TIMEOUT_SECONDS = Number(
|
|
121
122
|
process.env.SHUTDOWN_GRACEFUL_CLOSE_TIMEOUT_SECONDS || 0,
|
|
122
123
|
);
|
|
123
|
-
// Find the app directory
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
ROOT = path.join(path.dirname(require.main.filename), "app");
|
|
128
|
-
} else {
|
|
129
|
-
// Fallback to current script directory
|
|
130
|
-
ROOT = path.join(path.dirname(process.argv[1] || __filename), "app");
|
|
131
|
-
}
|
|
124
|
+
// Find the app directory relative to this bundled server file.
|
|
125
|
+
// Works under both ESM (import.meta.url) and when invoked via NPX.
|
|
126
|
+
const __filename_esm = fileURLToPath(import.meta.url);
|
|
127
|
+
const ROOT = path.join(path.dirname(__filename_esm), "app");
|
|
132
128
|
const SERVER_ROOT = path.resolve(process.cwd(), process.env.SERVER_ROOT || ".");
|
|
133
129
|
const API_PREFIX = "/api/v0";
|
|
134
130
|
const isDevelopment = process.env["NODE_ENV"] === "development";
|
|
@@ -596,12 +592,21 @@ app.post(
|
|
|
596
592
|
`${API_PREFIX}/projects/:projectName/connections/:connectionName/sqlQuery`,
|
|
597
593
|
async (req, res) => {
|
|
598
594
|
try {
|
|
595
|
+
let options: string | ParsedQs | (string | ParsedQs)[] | undefined;
|
|
596
|
+
|
|
597
|
+
// Support both body and query parameters for options for backwards compatibility
|
|
598
|
+
// TODO: To be removed in the future
|
|
599
|
+
if (req.body?.options) {
|
|
600
|
+
options = req.body.options;
|
|
601
|
+
} else {
|
|
602
|
+
options = req.query.options;
|
|
603
|
+
}
|
|
599
604
|
res.status(200).json(
|
|
600
605
|
await connectionController.getConnectionQueryData(
|
|
601
606
|
req.params.projectName,
|
|
602
607
|
req.params.connectionName,
|
|
603
608
|
req.body.sqlStatement as string,
|
|
604
|
-
|
|
609
|
+
options as string,
|
|
605
610
|
),
|
|
606
611
|
);
|
|
607
612
|
} catch (error) {
|
package/src/service/model.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
MalloySQLParser,
|
|
23
23
|
MalloySQLStatementType,
|
|
24
24
|
} from "@malloydata/malloy-sql";
|
|
25
|
-
import
|
|
25
|
+
import { createRequire } from "module";
|
|
26
26
|
import { DataStyles } from "@malloydata/render";
|
|
27
27
|
import { metrics } from "@opentelemetry/api";
|
|
28
28
|
import * as fs from "fs/promises";
|
|
@@ -45,9 +45,9 @@ import { BuildManifest } from "../storage/DatabaseInterface";
|
|
|
45
45
|
import { URL_READER } from "../utils";
|
|
46
46
|
import {
|
|
47
47
|
buildFilterClause,
|
|
48
|
+
FilterValidationError,
|
|
48
49
|
injectFilterRefinement,
|
|
49
50
|
parseFilters,
|
|
50
|
-
FilterValidationError,
|
|
51
51
|
type FilterDefinition,
|
|
52
52
|
type FilterParams,
|
|
53
53
|
} from "./filter";
|
|
@@ -65,7 +65,11 @@ export type PostgresConnection = components["schemas"]["PostgresConnection"];
|
|
|
65
65
|
export type BigqueryConnection = components["schemas"]["BigqueryConnection"];
|
|
66
66
|
export type TrinoConnection = components["schemas"]["TrinoConnection"];
|
|
67
67
|
|
|
68
|
-
const MALLOY_VERSION =
|
|
68
|
+
const MALLOY_VERSION = (
|
|
69
|
+
createRequire(import.meta.url)("@malloydata/malloy/package.json") as {
|
|
70
|
+
version: string;
|
|
71
|
+
}
|
|
72
|
+
).version;
|
|
69
73
|
|
|
70
74
|
export type ModelType = "model" | "notebook";
|
|
71
75
|
|
package/tsconfig.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ESNext", // Specifies the JavaScript version to target when transpiling code.
|
|
4
4
|
"lib": ["ESNext", "DOM", "DOM.Iterable"], // Specifies the libraries available for the code.
|
|
5
|
-
"module": "
|
|
5
|
+
"module": "ESNext", // Emits ESM syntax; Bun bundler handles final module format.
|
|
6
6
|
"skipLibCheck": true, // Skips type checking of declaration files.
|
|
7
7
|
"useDefineForClassFields": true, // Enables the use of 'define' for class fields.
|
|
8
8
|
"experimentalDecorators": true,
|