@malloy-publisher/server 0.0.204 → 0.0.206
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 +10 -1
- package/dist/app/api-doc.yaml +494 -397
- package/dist/app/assets/{EnvironmentPage-CX06cjOF.js → EnvironmentPage-BYwBeC2F.js} +1 -1
- package/dist/app/assets/HomePage-ivu4vdpj.js +1 -0
- package/dist/app/assets/{MainPage-nUJ9YatG.js → MainPage-B2DnHEDU.js} +2 -2
- package/dist/app/assets/MaterializationsPage-BZEuwF9P.js +1 -0
- package/dist/app/assets/ModelPage-Dpu3bfPg.js +1 -0
- package/dist/app/assets/{PackagePage-BaEVdEAG.js → PackagePage-B8PwcRHt.js} +1 -1
- package/dist/app/assets/{RouteError-BShQjZio.js → RouteError-BhbywAeC.js} +1 -1
- package/dist/app/assets/{WorkbookPage-CBn6ZjJW.js → WorkbookPage-C-JXsJG0.js} +1 -1
- package/dist/app/assets/{core-DECXYL4E.es-OaRfXwuQ.js → core-pPlPr7jK.es-CNEOlxKB.js} +1 -1
- package/dist/app/assets/{index-BLfPC1gy.js → index-BHEm8Egc.js} +1 -1
- package/dist/app/assets/{index-Dy3YhAZQ.js → index-BsvDrV14.js} +1 -1
- package/dist/app/assets/{index-DqiJ0bWp.js → index-ChR1fKR2.js} +134 -134
- package/dist/app/assets/{index.umd-DAN9K8yC.js → index.umd-BVLPYNuj.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/instrumentation.mjs +18 -8
- package/dist/package_load_worker.mjs +19 -2
- package/dist/runtime/publisher.js +318 -0
- package/dist/server.mjs +1703 -1443
- package/package.json +5 -4
- package/scripts/bake-duckdb-extensions.js +104 -0
- package/src/constants.ts +12 -0
- package/src/controller/materialization.controller.ts +79 -35
- package/src/controller/package.controller.spec.ts +179 -0
- package/src/controller/package.controller.ts +60 -73
- package/src/controller/watch-mode.controller.ts +176 -46
- package/src/dto/package.dto.ts +16 -1
- package/src/errors.spec.ts +33 -0
- package/src/errors.ts +18 -0
- package/src/health.spec.ts +34 -1
- package/src/instrumentation.ts +33 -17
- package/src/materialization_metrics.ts +66 -0
- package/src/mcp/error_messages.spec.ts +35 -0
- package/src/mcp/error_messages.ts +14 -1
- package/src/mcp/handler_utils.ts +12 -0
- package/src/package_load/package_load_pool.ts +7 -1
- package/src/package_load/package_load_worker.ts +44 -4
- package/src/package_load/protocol.ts +7 -1
- package/src/runtime/publisher.js +318 -0
- package/src/server-old.ts +7 -149
- package/src/server.ts +488 -190
- package/src/service/authorize_integration.spec.ts +163 -2
- package/src/service/compile_authorize.spec.ts +85 -0
- package/src/service/environment.ts +270 -12
- package/src/service/environment_store.spec.ts +0 -81
- package/src/service/environment_store.ts +142 -34
- package/src/service/explore_visibility.spec.ts +434 -0
- package/src/service/exports_probe.spec.ts +107 -0
- package/src/service/manifest_loader.spec.ts +99 -0
- package/src/service/manifest_loader.ts +95 -0
- package/src/service/materialization_service.spec.ts +324 -512
- package/src/service/materialization_service.ts +816 -656
- package/src/service/model.ts +444 -13
- package/src/service/package.spec.ts +14 -2
- package/src/service/package.ts +271 -20
- package/src/service/package_rollback.spec.ts +190 -0
- package/src/service/package_worker_path.spec.ts +223 -0
- package/src/service/query_boundary.spec.ts +470 -0
- package/src/storage/DatabaseInterface.ts +35 -57
- package/src/storage/StorageManager.mock.ts +0 -9
- package/src/storage/StorageManager.ts +7 -290
- package/src/storage/duckdb/DuckDBConnection.ts +70 -124
- package/src/storage/duckdb/DuckDBRepository.ts +2 -35
- package/src/storage/duckdb/MaterializationRepository.ts +52 -27
- package/src/storage/duckdb/schema.ts +4 -20
- package/tests/fixtures/authorize-compile/model.malloy +9 -0
- package/tests/fixtures/authorize-compile/publisher.json +4 -0
- package/tests/fixtures/html-pages-nopublic/model.malloy +1 -0
- package/tests/fixtures/html-pages-nopublic/publisher.json +5 -0
- package/tests/fixtures/html-pages-test/data.csv +3 -0
- package/tests/fixtures/html-pages-test/public/assets/app.css +3 -0
- package/tests/fixtures/html-pages-test/public/data.json +1 -0
- package/tests/fixtures/html-pages-test/public/index.html +9 -0
- package/tests/fixtures/html-pages-test/public/sub/page2.html +9 -0
- package/tests/fixtures/html-pages-test/publisher.json +5 -0
- package/tests/fixtures/html-pages-test/report.malloy +1 -0
- package/tests/integration/authorize/compile_authorize_http.integration.spec.ts +92 -0
- package/tests/integration/duckdb_storage/duckdb_storage.integration.spec.ts +138 -0
- package/tests/integration/html_pages/html_pages.integration.spec.ts +378 -0
- package/tests/integration/materialization/manifest_binding.integration.spec.ts +175 -0
- package/tests/integration/materialization/materialization_lifecycle.integration.spec.ts +277 -266
- package/tests/integration/watch-mode/watch_mode.integration.spec.ts +421 -0
- package/tests/unit/duckdb/attached_databases.test.ts +111 -0
- package/tests/unit/duckdb/duckdb_connection.test.ts +181 -0
- package/tests/unit/duckdb/legacy_schema_migration.test.ts +7 -4
- package/tests/unit/duckdb/repositories.test.ts +208 -0
- package/dist/app/assets/HomePage-CNFt_eUU.js +0 -1
- package/dist/app/assets/MaterializationsPage-B5goxVXW.js +0 -1
- package/dist/app/assets/ModelPage-Ba7Xh4lL.js +0 -1
- package/src/controller/manifest.controller.ts +0 -38
- package/src/service/manifest_service.spec.ts +0 -206
- package/src/service/manifest_service.ts +0 -117
- package/src/service/materialized_table_gc.spec.ts +0 -384
- package/src/service/materialized_table_gc.ts +0 -231
- package/src/storage/duckdb/DuckDBManifestStore.ts +0 -70
- package/src/storage/duckdb/ManifestRepository.ts +0 -120
- package/src/storage/duckdb/manifest_store.spec.ts +0 -133
- package/src/storage/ducklake/DuckLakeManifestStore.ts +0 -155
- package/tests/unit/storage/StorageManager.test.ts +0 -166
package/src/server-old.ts
CHANGED
|
@@ -30,7 +30,6 @@ import { ParsedQs } from "qs";
|
|
|
30
30
|
import { CompileController } from "./controller/compile.controller";
|
|
31
31
|
import { ConnectionController } from "./controller/connection.controller";
|
|
32
32
|
import { DatabaseController } from "./controller/database.controller";
|
|
33
|
-
import { ManifestController } from "./controller/manifest.controller";
|
|
34
33
|
import { MaterializationController } from "./controller/materialization.controller";
|
|
35
34
|
import { ModelController } from "./controller/model.controller";
|
|
36
35
|
import { PackageController } from "./controller/package.controller";
|
|
@@ -57,7 +56,6 @@ export interface LegacyControllerSet {
|
|
|
57
56
|
queryController: QueryController;
|
|
58
57
|
compileController: CompileController;
|
|
59
58
|
materializationController: MaterializationController;
|
|
60
|
-
manifestController: ManifestController;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
// ─── response/body field mappers ───────────────────────────────────────────
|
|
@@ -97,7 +95,6 @@ export function registerLegacyRoutes(
|
|
|
97
95
|
queryController,
|
|
98
96
|
compileController,
|
|
99
97
|
materializationController,
|
|
100
|
-
manifestController,
|
|
101
98
|
} = controllers;
|
|
102
99
|
|
|
103
100
|
// body-parser is already registered on the main app for `${API_PREFIX}/*`
|
|
@@ -379,26 +376,7 @@ export function registerLegacyRoutes(
|
|
|
379
376
|
},
|
|
380
377
|
);
|
|
381
378
|
|
|
382
|
-
// sqlSource (
|
|
383
|
-
app.get(
|
|
384
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/connections/:connectionName/sqlSource`,
|
|
385
|
-
async (req, res) => {
|
|
386
|
-
try {
|
|
387
|
-
res.status(200).json(
|
|
388
|
-
await connectionController.getConnectionSqlSource(
|
|
389
|
-
req.params.projectName,
|
|
390
|
-
req.params.connectionName,
|
|
391
|
-
req.query.sqlStatement as string,
|
|
392
|
-
),
|
|
393
|
-
);
|
|
394
|
-
} catch (error) {
|
|
395
|
-
logger.error(error);
|
|
396
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
397
|
-
res.status(status).json(json);
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
);
|
|
401
|
-
|
|
379
|
+
// sqlSource (POST), per-project + per-package
|
|
402
380
|
app.post(
|
|
403
381
|
`${LEGACY_API_PREFIX}/projects/:projectName/connections/:connectionName/sqlSource`,
|
|
404
382
|
async (req, res) => {
|
|
@@ -418,26 +396,6 @@ export function registerLegacyRoutes(
|
|
|
418
396
|
},
|
|
419
397
|
);
|
|
420
398
|
|
|
421
|
-
app.get(
|
|
422
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/connections/:connectionName/sqlSource`,
|
|
423
|
-
async (req, res) => {
|
|
424
|
-
try {
|
|
425
|
-
res.status(200).json(
|
|
426
|
-
await connectionController.getConnectionSqlSource(
|
|
427
|
-
req.params.projectName,
|
|
428
|
-
req.params.connectionName,
|
|
429
|
-
req.query.sqlStatement as string,
|
|
430
|
-
req.params.packageName,
|
|
431
|
-
),
|
|
432
|
-
);
|
|
433
|
-
} catch (error) {
|
|
434
|
-
logger.error(error);
|
|
435
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
436
|
-
res.status(status).json(json);
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
);
|
|
440
|
-
|
|
441
399
|
app.post(
|
|
442
400
|
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/connections/:connectionName/sqlSource`,
|
|
443
401
|
async (req, res) => {
|
|
@@ -567,48 +525,7 @@ export function registerLegacyRoutes(
|
|
|
567
525
|
},
|
|
568
526
|
);
|
|
569
527
|
|
|
570
|
-
//
|
|
571
|
-
app.get(
|
|
572
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/connections/:connectionName/temporaryTable`,
|
|
573
|
-
queryConcurrency(),
|
|
574
|
-
async (req, res) => {
|
|
575
|
-
try {
|
|
576
|
-
res.status(200).json(
|
|
577
|
-
await connectionController.getConnectionTemporaryTable(
|
|
578
|
-
req.params.projectName,
|
|
579
|
-
req.params.connectionName,
|
|
580
|
-
req.query.sqlStatement as string,
|
|
581
|
-
),
|
|
582
|
-
);
|
|
583
|
-
} catch (error) {
|
|
584
|
-
logger.error(error);
|
|
585
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
586
|
-
res.status(status).json(json);
|
|
587
|
-
}
|
|
588
|
-
},
|
|
589
|
-
);
|
|
590
|
-
|
|
591
|
-
app.get(
|
|
592
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/connections/:connectionName/temporaryTable`,
|
|
593
|
-
queryConcurrency(),
|
|
594
|
-
async (req, res) => {
|
|
595
|
-
try {
|
|
596
|
-
res.status(200).json(
|
|
597
|
-
await connectionController.getConnectionTemporaryTable(
|
|
598
|
-
req.params.projectName,
|
|
599
|
-
req.params.connectionName,
|
|
600
|
-
req.query.sqlStatement as string,
|
|
601
|
-
req.params.packageName,
|
|
602
|
-
),
|
|
603
|
-
);
|
|
604
|
-
} catch (error) {
|
|
605
|
-
logger.error(error);
|
|
606
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
607
|
-
res.status(status).json(json);
|
|
608
|
-
}
|
|
609
|
-
},
|
|
610
|
-
);
|
|
611
|
-
|
|
528
|
+
// sqlTemporaryTable (POST), per-project + per-package
|
|
612
529
|
app.post(
|
|
613
530
|
`${LEGACY_API_PREFIX}/projects/:projectName/connections/:connectionName/sqlTemporaryTable`,
|
|
614
531
|
queryConcurrency(),
|
|
@@ -674,11 +591,9 @@ export function registerLegacyRoutes(
|
|
|
674
591
|
`${LEGACY_API_PREFIX}/projects/:projectName/packages`,
|
|
675
592
|
async (req, res) => {
|
|
676
593
|
try {
|
|
677
|
-
const autoLoadManifest = req.query.autoLoadManifest === "true";
|
|
678
594
|
const _package = await packageController.addPackage(
|
|
679
595
|
req.params.projectName,
|
|
680
596
|
req.body,
|
|
681
|
-
{ autoLoadManifest },
|
|
682
597
|
);
|
|
683
598
|
res.status(200).json(_package?.getPackageMetadata());
|
|
684
599
|
} catch (error) {
|
|
@@ -1024,34 +939,18 @@ export function registerLegacyRoutes(
|
|
|
1024
939
|
},
|
|
1025
940
|
);
|
|
1026
941
|
|
|
1027
|
-
app.post(
|
|
1028
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/materializations/teardown`,
|
|
1029
|
-
async (req, res) => {
|
|
1030
|
-
try {
|
|
1031
|
-
const result = await materializationController.teardownPackage(
|
|
1032
|
-
req.params.projectName,
|
|
1033
|
-
req.params.packageName,
|
|
1034
|
-
req.body || {},
|
|
1035
|
-
);
|
|
1036
|
-
res.status(200).json(result);
|
|
1037
|
-
} catch (error) {
|
|
1038
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
1039
|
-
res.status(status).json(json);
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1042
|
-
);
|
|
1043
|
-
|
|
1044
942
|
app.post(
|
|
1045
943
|
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/materializations/:materializationId`,
|
|
1046
944
|
async (req, res) => {
|
|
1047
945
|
try {
|
|
1048
946
|
const action = req.query.action;
|
|
1049
|
-
if (action === "
|
|
947
|
+
if (action === "build") {
|
|
1050
948
|
const build =
|
|
1051
|
-
await materializationController.
|
|
949
|
+
await materializationController.buildMaterialization(
|
|
1052
950
|
req.params.projectName,
|
|
1053
951
|
req.params.packageName,
|
|
1054
952
|
req.params.materializationId,
|
|
953
|
+
req.body || {},
|
|
1055
954
|
);
|
|
1056
955
|
res.status(202).json(remapMaterializationResponse(build));
|
|
1057
956
|
} else if (action === "stop") {
|
|
@@ -1064,7 +963,7 @@ export function registerLegacyRoutes(
|
|
|
1064
963
|
res.status(200).json(remapMaterializationResponse(build));
|
|
1065
964
|
} else {
|
|
1066
965
|
throw new BadRequestError(
|
|
1067
|
-
`Unsupported action '${String(action ?? "")}'. Expected '
|
|
966
|
+
`Unsupported action '${String(action ?? "")}'. Expected 'build' or 'stop'.`,
|
|
1068
967
|
);
|
|
1069
968
|
}
|
|
1070
969
|
} catch (error) {
|
|
@@ -1082,6 +981,7 @@ export function registerLegacyRoutes(
|
|
|
1082
981
|
req.params.projectName,
|
|
1083
982
|
req.params.packageName,
|
|
1084
983
|
req.params.materializationId,
|
|
984
|
+
{ dropTables: req.query.dropTables === "true" },
|
|
1085
985
|
);
|
|
1086
986
|
res.status(204).send();
|
|
1087
987
|
} catch (error) {
|
|
@@ -1091,48 +991,6 @@ export function registerLegacyRoutes(
|
|
|
1091
991
|
},
|
|
1092
992
|
);
|
|
1093
993
|
|
|
1094
|
-
// ── manifest ────────────────────────────────────────────────────────────
|
|
1095
|
-
app.get(
|
|
1096
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/manifest`,
|
|
1097
|
-
async (req, res) => {
|
|
1098
|
-
try {
|
|
1099
|
-
const manifest = await manifestController.getManifest(
|
|
1100
|
-
req.params.projectName,
|
|
1101
|
-
req.params.packageName,
|
|
1102
|
-
);
|
|
1103
|
-
res.status(200).json(manifest);
|
|
1104
|
-
} catch (error) {
|
|
1105
|
-
logger.error("Get manifest error", { error });
|
|
1106
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
1107
|
-
res.status(status).json(json);
|
|
1108
|
-
}
|
|
1109
|
-
},
|
|
1110
|
-
);
|
|
1111
|
-
|
|
1112
|
-
app.post(
|
|
1113
|
-
`${LEGACY_API_PREFIX}/projects/:projectName/packages/:packageName/manifest`,
|
|
1114
|
-
async (req, res) => {
|
|
1115
|
-
try {
|
|
1116
|
-
const action = req.query.action;
|
|
1117
|
-
if (action === "reload") {
|
|
1118
|
-
const manifest = await manifestController.reloadManifest(
|
|
1119
|
-
req.params.projectName,
|
|
1120
|
-
req.params.packageName,
|
|
1121
|
-
);
|
|
1122
|
-
res.status(200).json(manifest);
|
|
1123
|
-
} else {
|
|
1124
|
-
throw new BadRequestError(
|
|
1125
|
-
`Unsupported action '${String(action ?? "")}'. Expected 'reload'.`,
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
} catch (error) {
|
|
1129
|
-
logger.error("Manifest action error", { error });
|
|
1130
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
1131
|
-
res.status(status).json(json);
|
|
1132
|
-
}
|
|
1133
|
-
},
|
|
1134
|
-
);
|
|
1135
|
-
|
|
1136
994
|
logger.info(
|
|
1137
995
|
"Legacy /projects/* routes registered for backwards compatibility",
|
|
1138
996
|
);
|