@malloy-publisher/server 0.0.382-dev → 0.2.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/README.docker.md +145 -20
- package/README.md +65 -12
- package/dist/app/api-doc.html +5 -0
- package/dist/app/api-doc.yaml +3903 -583
- package/dist/app/assets/EnvironmentPage-DiUgLuCH.js +1 -0
- package/dist/app/assets/HomePage-MhhjhnFj.js +1 -0
- package/dist/app/assets/LightMode-BEyvNUzT.js +1 -0
- package/dist/app/assets/MainPage-D4Cfee9o.js +2 -0
- package/dist/app/assets/MaterializationsPage-nGgGqwSN.js +1 -0
- package/dist/app/assets/ModelPage-DLAcEw-F.js +1 -0
- package/dist/app/assets/PackagePage-Df0ikH7w.js +1 -0
- package/dist/app/assets/RouteError-BFQwtroH.js +1 -0
- package/dist/app/assets/ThemeEditorPage-OoskoQYN.js +1 -0
- package/dist/app/assets/WorkbookPage-CpFgvUDC.js +1 -0
- package/dist/app/assets/{core-CjeTkq8O.es-BqRc6yhC.js → core-lb28vQkR.es-BoVSOc75.js} +1 -1
- package/dist/app/assets/github-dark-DenFmJkN.es-DHJKELXO.js +1 -0
- package/dist/app/assets/index-5eLCcNmP.css +1 -0
- package/dist/app/assets/index-6ypuFH6g.js +1774 -0
- package/dist/app/assets/index-B8pnU_V_.js +615 -0
- package/dist/app/assets/index-BImcHmVP.js +1 -0
- package/dist/app/assets/index-DSoCUF-f.js +2725 -0
- package/dist/app/assets/index-DfqzSItA.js +2 -0
- package/dist/app/assets/index-w_0OQJgZ.js +23 -0
- package/dist/app/index.html +8 -4
- package/dist/cpufeatures-1yrn0vtw.node +0 -0
- package/dist/default-publisher.config.json +23 -0
- package/dist/{instrumentation.js → instrumentation.mjs} +10631 -10573
- package/dist/package_load_worker.mjs +15219 -0
- package/dist/runtime/publisher.js +331 -0
- package/dist/{server.js → server.mjs} +115548 -49590
- package/dist/sshcrypto-vd2k5hq9.node +0 -0
- package/package.json +41 -28
- package/publisher.config.example.bigquery.json +33 -0
- package/publisher.config.example.duckdb.json +23 -0
- package/.eslintrc.json +0 -44
- package/.prettierignore +0 -1
- package/.prettierrc +0 -4
- package/build.ts +0 -38
- package/dist/app/assets/HomePage-Dn3E4CuB.js +0 -1
- package/dist/app/assets/MainPage-BzB3yoqi.js +0 -2
- package/dist/app/assets/ModelPage-C9O_sAXT.js +0 -1
- package/dist/app/assets/PackagePage-DcxKEjBX.js +0 -1
- package/dist/app/assets/ProjectPage-BDj307rF.js +0 -1
- package/dist/app/assets/RouteError-DAShbVCG.js +0 -1
- package/dist/app/assets/WorkbookPage-Cs_XYEaB.js +0 -1
- package/dist/app/assets/index-15BOvhp0.js +0 -456
- package/dist/app/assets/index-Bb2jqquW.js +0 -676
- package/dist/app/assets/index-CMlGQMcl.css +0 -1
- package/dist/app/assets/index-D68X76-7.js +0 -1276
- package/dist/app/assets/index.umd-DGBekgSu.js +0 -1145
- package/dxt/malloy_bridge.py +0 -354
- package/dxt/manifest.json +0 -22
- package/eslint.config.mjs +0 -76
- package/k6-tests/README.md +0 -144
- package/k6-tests/bun.lock +0 -797
- package/k6-tests/load-test/load-test-crud-connections.ts +0 -263
- package/k6-tests/load-test/load-test-crud-packages.ts +0 -461
- package/k6-tests/load-test/load-test-crud-projects.ts +0 -160
- package/k6-tests/load-test/load-test-crud.ts +0 -142
- package/k6-tests/load-test/load-test.ts +0 -784
- package/k6-tests/package.json +0 -27
- package/k6-tests/scripts/run-with-otel.sh +0 -50
- package/k6-tests/smoke-test/smoke-test.ts +0 -158
- package/k6-tests/tsconfig.json +0 -29
- package/k6-tests/utils/client_factory.ts +0 -128
- package/k6-tests/utils/common.ts +0 -489
- package/k6-tests/utils/logger.ts +0 -62
- package/k6-tests/utils/types.d.ts +0 -35
- package/malloy_mcp.dxt +0 -0
- package/publisher.config.json +0 -33
- package/src/config.spec.ts +0 -850
- package/src/config.ts +0 -305
- package/src/constants.ts +0 -10
- package/src/controller/compile.controller.ts +0 -35
- package/src/controller/connection.controller.ts +0 -515
- package/src/controller/database.controller.ts +0 -21
- package/src/controller/manifest.controller.ts +0 -29
- package/src/controller/materialization.controller.ts +0 -125
- package/src/controller/model.controller.ts +0 -107
- package/src/controller/package.controller.ts +0 -182
- package/src/controller/query.controller.ts +0 -60
- package/src/controller/watch-mode.controller.ts +0 -98
- package/src/data_styles.ts +0 -71
- package/src/dto/connection.dto.spec.ts +0 -131
- package/src/dto/connection.dto.ts +0 -174
- package/src/dto/index.ts +0 -2
- package/src/dto/package.dto.spec.ts +0 -42
- package/src/dto/package.dto.ts +0 -12
- package/src/dto/validate.spec.ts +0 -76
- package/src/dto/validate.ts +0 -31
- package/src/errors.ts +0 -116
- package/src/health.ts +0 -189
- package/src/instrumentation.ts +0 -148
- package/src/logger.ts +0 -154
- package/src/mcp/error_messages.ts +0 -199
- package/src/mcp/handler_utils.ts +0 -239
- package/src/mcp/mcp_constants.ts +0 -22
- package/src/mcp/prompts/handlers.ts +0 -84
- package/src/mcp/prompts/index.ts +0 -11
- package/src/mcp/prompts/prompt_definitions.ts +0 -160
- package/src/mcp/prompts/prompt_service.ts +0 -67
- package/src/mcp/prompts/utils.ts +0 -62
- package/src/mcp/resource_metadata.ts +0 -47
- package/src/mcp/resources/model_resource.ts +0 -153
- package/src/mcp/resources/notebook_resource.ts +0 -137
- package/src/mcp/resources/package_resource.ts +0 -370
- package/src/mcp/resources/project_resource.ts +0 -184
- package/src/mcp/resources/query_resource.ts +0 -117
- package/src/mcp/resources/source_resource.ts +0 -141
- package/src/mcp/resources/view_resource.ts +0 -136
- package/src/mcp/server.ts +0 -62
- package/src/mcp/tools/discovery_tools.ts +0 -258
- package/src/mcp/tools/execute_query_tool.ts +0 -265
- package/src/server.ts +0 -1195
- package/src/service/connection.spec.ts +0 -1331
- package/src/service/connection.ts +0 -1511
- package/src/service/connection_service.spec.ts +0 -641
- package/src/service/connection_service.ts +0 -181
- package/src/service/db_utils.spec.ts +0 -714
- package/src/service/db_utils.ts +0 -1227
- package/src/service/filter.spec.ts +0 -447
- package/src/service/filter.ts +0 -337
- package/src/service/filter_integration.spec.ts +0 -825
- package/src/service/gcs_s3_utils.ts +0 -427
- package/src/service/manifest_service.spec.ts +0 -201
- package/src/service/manifest_service.ts +0 -106
- package/src/service/materialization_service.spec.ts +0 -648
- package/src/service/materialization_service.ts +0 -929
- package/src/service/materialized_table_gc.spec.ts +0 -383
- package/src/service/materialized_table_gc.ts +0 -279
- package/src/service/model.spec.ts +0 -257
- package/src/service/model.ts +0 -1069
- package/src/service/package.spec.ts +0 -236
- package/src/service/package.ts +0 -463
- package/src/service/project.ts +0 -681
- package/src/service/project_compile.spec.ts +0 -197
- package/src/service/project_store.spec.ts +0 -859
- package/src/service/project_store.ts +0 -1531
- package/src/service/quoting.ts +0 -41
- package/src/service/resolve_project.ts +0 -13
- package/src/storage/BaseRepository.ts +0 -31
- package/src/storage/DatabaseInterface.ts +0 -180
- package/src/storage/StorageManager.mock.ts +0 -59
- package/src/storage/StorageManager.ts +0 -210
- package/src/storage/duckdb/ConnectionRepository.ts +0 -141
- package/src/storage/duckdb/DuckDBConnection.ts +0 -177
- package/src/storage/duckdb/DuckDBManifestStore.ts +0 -70
- package/src/storage/duckdb/DuckDBRepository.ts +0 -224
- package/src/storage/duckdb/ManifestRepository.ts +0 -119
- package/src/storage/duckdb/MaterializationRepository.ts +0 -249
- package/src/storage/duckdb/PackageRepository.ts +0 -135
- package/src/storage/duckdb/ProjectRepository.ts +0 -148
- package/src/storage/duckdb/manifest_store.spec.ts +0 -133
- package/src/storage/duckdb/schema.ts +0 -147
- package/src/storage/ducklake/DuckLakeManifestStore.ts +0 -146
- package/src/utils.ts +0 -13
- package/tests/fixtures/persist-test/data/orders.csv +0 -5
- package/tests/fixtures/persist-test/persist_test.malloy +0 -11
- package/tests/fixtures/persist-test/publisher.json +0 -5
- package/tests/fixtures/publisher.config.json +0 -15
- package/tests/harness/e2e.ts +0 -96
- package/tests/harness/mcp_test_setup.ts +0 -344
- package/tests/harness/mocks.ts +0 -37
- package/tests/harness/rest_e2e.ts +0 -68
- package/tests/harness/uris.ts +0 -31
- package/tests/integration/materialization/materialization_lifecycle.integration.spec.ts +0 -470
- package/tests/integration/mcp/mcp_execute_query_tool.integration.spec.ts +0 -434
- package/tests/integration/mcp/mcp_resource.integration.spec.ts +0 -663
- package/tests/integration/mcp/mcp_transport.integration.spec.ts +0 -122
- package/tests/integration/mcp/setup.spec.ts +0 -5
- package/tests/unit/duckdb/attached_databases.test.ts +0 -1132
- package/tests/unit/ducklake/ducklake.test.ts +0 -950
- package/tests/unit/mcp/prompt_definitions.test.ts +0 -102
- package/tests/unit/mcp/prompt_happy.test.ts +0 -51
- package/tsconfig.json +0 -32
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { components } from "../api";
|
|
2
|
-
import { ConnectionNotFoundError, FrozenConfigError } from "../errors";
|
|
3
|
-
import { logger } from "../logger";
|
|
4
|
-
import { createProjectConnections } from "./connection";
|
|
5
|
-
import { ProjectStore } from "./project_store";
|
|
6
|
-
|
|
7
|
-
type ApiConnection = components["schemas"]["Connection"];
|
|
8
|
-
|
|
9
|
-
export class ConnectionService {
|
|
10
|
-
private projectStore: ProjectStore;
|
|
11
|
-
|
|
12
|
-
constructor(projectStore: ProjectStore) {
|
|
13
|
-
this.projectStore = projectStore;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public async getConnection(projectName: string, connectionName: string) {
|
|
17
|
-
await this.projectStore.finishedInitialization;
|
|
18
|
-
|
|
19
|
-
const repository = this.projectStore.storageManager.getRepository();
|
|
20
|
-
const dbProject = await repository.getProjectByName(projectName);
|
|
21
|
-
|
|
22
|
-
if (!dbProject) {
|
|
23
|
-
throw new Error(`Project "${projectName}" not found in database`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const dbConnection = await repository.getConnectionByName(
|
|
27
|
-
dbProject.id,
|
|
28
|
-
connectionName,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
if (!dbConnection) {
|
|
32
|
-
throw new ConnectionNotFoundError(
|
|
33
|
-
`Connection "${connectionName}" not found in project "${projectName}"`,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return { dbProject, dbConnection, repository };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public async addConnection(
|
|
41
|
-
projectName: string,
|
|
42
|
-
connectionName: string,
|
|
43
|
-
connection: ApiConnection,
|
|
44
|
-
): Promise<void> {
|
|
45
|
-
await this.projectStore.finishedInitialization;
|
|
46
|
-
|
|
47
|
-
if (this.projectStore.publisherConfigIsFrozen) {
|
|
48
|
-
throw new FrozenConfigError();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
logger.info(
|
|
52
|
-
`Adding connection "${connectionName}" to project "${projectName}"`,
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
// Get database project and repository
|
|
56
|
-
const repository = this.projectStore.storageManager.getRepository();
|
|
57
|
-
const dbProject = await repository.getProjectByName(projectName);
|
|
58
|
-
|
|
59
|
-
if (!dbProject) {
|
|
60
|
-
throw new Error(`Project "${projectName}" not found in database`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Check if connection already exists in database
|
|
64
|
-
const existingDbConn = await repository.getConnectionByName(
|
|
65
|
-
dbProject.id,
|
|
66
|
-
connectionName!,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
if (existingDbConn) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
`Connection "${connectionName}" already exists in project "${projectName}".`,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Update in-memory connections
|
|
76
|
-
const project = await this.projectStore.getProject(projectName, false);
|
|
77
|
-
const existingConnections = project.listApiConnections();
|
|
78
|
-
|
|
79
|
-
const { malloyConnections, apiConnections } =
|
|
80
|
-
await createProjectConnections(
|
|
81
|
-
[...existingConnections, connection],
|
|
82
|
-
project.metadata.location || "",
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
project.updateConnections(malloyConnections, apiConnections);
|
|
86
|
-
|
|
87
|
-
await this.projectStore.addConnection(
|
|
88
|
-
connection,
|
|
89
|
-
dbProject.id,
|
|
90
|
-
repository,
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
logger.info(
|
|
94
|
-
`Successfully added connection "${connection.name}" to project "${projectName}"`,
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public async updateConnection(
|
|
99
|
-
projectName: string,
|
|
100
|
-
connectionName: string,
|
|
101
|
-
connection: Partial<ApiConnection>,
|
|
102
|
-
): Promise<void> {
|
|
103
|
-
await this.projectStore.finishedInitialization;
|
|
104
|
-
|
|
105
|
-
if (this.projectStore.publisherConfigIsFrozen) {
|
|
106
|
-
throw new FrozenConfigError();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
logger.info(
|
|
110
|
-
`Updating connection "${connectionName}" in project "${projectName}"`,
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const { dbProject, dbConnection, repository } = await this.getConnection(
|
|
114
|
-
projectName,
|
|
115
|
-
connectionName,
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
// Update in-memory connections
|
|
119
|
-
const project = await this.projectStore.getProject(projectName, false);
|
|
120
|
-
const existingConnections = project.listApiConnections();
|
|
121
|
-
|
|
122
|
-
const updatedConnection = {
|
|
123
|
-
...dbConnection.config,
|
|
124
|
-
...connection,
|
|
125
|
-
name: connectionName,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const updatedConnections = existingConnections.map((conn) =>
|
|
129
|
-
conn.name === connectionName ? updatedConnection : conn,
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
const { malloyConnections, apiConnections } =
|
|
133
|
-
await createProjectConnections(
|
|
134
|
-
updatedConnections,
|
|
135
|
-
project.metadata.location || "",
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
project.updateConnections(malloyConnections, apiConnections);
|
|
139
|
-
|
|
140
|
-
await this.projectStore.updateConnection(
|
|
141
|
-
updatedConnection,
|
|
142
|
-
dbProject.id,
|
|
143
|
-
repository,
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
logger.info(
|
|
147
|
-
`Successfully updated connection "${connectionName}" in project "${projectName}"`,
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public async deleteConnection(
|
|
152
|
-
projectName: string,
|
|
153
|
-
connectionName: string,
|
|
154
|
-
): Promise<void> {
|
|
155
|
-
await this.projectStore.finishedInitialization;
|
|
156
|
-
|
|
157
|
-
if (this.projectStore.publisherConfigIsFrozen) {
|
|
158
|
-
throw new FrozenConfigError();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
logger.info(
|
|
162
|
-
`Deleting connection "${connectionName}" from project "${projectName}"`,
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
const { dbConnection, repository } = await this.getConnection(
|
|
166
|
-
projectName,
|
|
167
|
-
connectionName,
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
// Update in-memory connections
|
|
171
|
-
const project = await this.projectStore.getProject(projectName, false);
|
|
172
|
-
await project.deleteConnection(connectionName);
|
|
173
|
-
|
|
174
|
-
// Delete from database
|
|
175
|
-
await repository.deleteConnection(dbConnection.id);
|
|
176
|
-
|
|
177
|
-
logger.info(
|
|
178
|
-
`Successfully deleted connection "${connectionName}" from project "${projectName}"`,
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
}
|