@malloy-publisher/server 0.0.196-dev → 0.0.197-dev
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/app/api-doc.yaml +213 -214
- package/dist/app/assets/EnvironmentPage-1j6QDWAy.js +1 -0
- package/dist/app/assets/HomePage-DMop21VG.js +1 -0
- package/dist/app/assets/MainPage-BbE8ETz1.js +2 -0
- package/dist/app/assets/ModelPage-D2jvfe3t.js +1 -0
- package/dist/app/assets/PackagePage-BbnhGoD3.js +1 -0
- package/dist/app/assets/{RouteError-DefbDO7F.js → RouteError-D3LGEZ3i.js} +1 -1
- package/dist/app/assets/WorkbookPage-DttVIj4u.js +1 -0
- package/dist/app/assets/{core-BrfQApxh.es-DnvCX4oH.js → core-w79IMXAG.es-Bd0UlzOL.js} +1 -1
- package/dist/app/assets/{index-Bu0ub036.js → index-5K9YjIxF.js} +117 -117
- package/dist/app/assets/{index-CkzK3JIl.js → index-C513UodQ.js} +1 -1
- package/dist/app/assets/{index-CoA6HIGS.js → index-DIgzgp69.js} +1 -1
- package/dist/app/assets/{index.umd-B6Ms2PpL.js → index.umd-BMeMPq_9.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/server.mjs +1328 -1304
- package/package.json +1 -1
- package/publisher.config.json +2 -2
- package/src/config.spec.ts +74 -66
- package/src/config.ts +50 -47
- package/src/controller/compile.controller.ts +10 -7
- package/src/controller/connection.controller.ts +79 -58
- package/src/controller/database.controller.ts +10 -7
- package/src/controller/manifest.controller.ts +23 -14
- package/src/controller/materialization.controller.ts +14 -14
- package/src/controller/model.controller.ts +35 -20
- package/src/controller/package.controller.ts +83 -49
- package/src/controller/query.controller.ts +11 -8
- package/src/controller/watch-mode.controller.ts +35 -29
- package/src/errors.ts +2 -2
- package/src/mcp/error_messages.ts +2 -2
- package/src/mcp/handler_utils.ts +23 -20
- package/src/mcp/mcp_constants.ts +1 -1
- package/src/mcp/prompts/handlers.ts +3 -3
- package/src/mcp/prompts/prompt_service.ts +5 -5
- package/src/mcp/prompts/utils.ts +12 -12
- package/src/mcp/resource_metadata.ts +3 -3
- package/src/mcp/resources/environment_resource.ts +187 -0
- package/src/mcp/resources/model_resource.ts +19 -17
- package/src/mcp/resources/notebook_resource.ts +13 -13
- package/src/mcp/resources/package_resource.ts +30 -27
- package/src/mcp/resources/query_resource.ts +15 -10
- package/src/mcp/resources/source_resource.ts +10 -10
- package/src/mcp/resources/view_resource.ts +11 -11
- package/src/mcp/server.ts +16 -14
- package/src/mcp/tools/discovery_tools.ts +67 -49
- package/src/mcp/tools/execute_query_tool.ts +14 -14
- package/src/server.ts +175 -159
- package/src/service/connection.spec.ts +158 -133
- package/src/service/connection.ts +42 -39
- package/src/service/connection_config.spec.ts +13 -11
- package/src/service/connection_config.ts +28 -19
- package/src/service/connection_service.spec.ts +63 -43
- package/src/service/connection_service.ts +106 -89
- package/src/service/{project.ts → environment.ts} +92 -77
- package/src/service/{project_compile.spec.ts → environment_compile.spec.ts} +1 -1
- package/src/service/{project_store.spec.ts → environment_store.spec.ts} +99 -85
- package/src/service/{project_store.ts → environment_store.ts} +368 -326
- package/src/service/manifest_service.spec.ts +15 -15
- package/src/service/manifest_service.ts +26 -21
- package/src/service/materialization_service.spec.ts +93 -59
- package/src/service/materialization_service.ts +71 -62
- package/src/service/materialized_table_gc.spec.ts +15 -15
- package/src/service/materialized_table_gc.ts +3 -3
- package/src/service/model.ts +2 -2
- package/src/service/package.spec.ts +2 -2
- package/src/service/package.ts +23 -21
- package/src/service/resolve_environment.ts +15 -0
- package/src/storage/DatabaseInterface.ts +34 -25
- package/src/storage/StorageManager.mock.ts +3 -3
- package/src/storage/StorageManager.ts +24 -23
- package/src/storage/duckdb/ConnectionRepository.ts +13 -11
- package/src/storage/duckdb/DuckDBConnection.ts +1 -1
- package/src/storage/duckdb/DuckDBManifestStore.ts +6 -6
- package/src/storage/duckdb/DuckDBRepository.ts +47 -47
- package/src/storage/duckdb/{ProjectRepository.ts → EnvironmentRepository.ts} +35 -35
- package/src/storage/duckdb/ManifestRepository.ts +21 -20
- package/src/storage/duckdb/MaterializationRepository.ts +31 -28
- package/src/storage/duckdb/PackageRepository.ts +11 -11
- package/src/storage/duckdb/manifest_store.spec.ts +2 -2
- package/src/storage/duckdb/schema.ts +20 -20
- package/src/storage/ducklake/DuckLakeManifestStore.ts +14 -14
- package/tests/fixtures/publisher.config.json +1 -1
- package/tests/harness/e2e.ts +1 -1
- package/tests/harness/mcp_test_setup.ts +1 -1
- package/tests/harness/mocks.ts +10 -8
- package/tests/integration/materialization/materialization_lifecycle.integration.spec.ts +4 -4
- package/tests/integration/mcp/mcp_execute_query_tool.integration.spec.ts +27 -48
- package/tests/integration/mcp/mcp_resource.integration.spec.ts +26 -35
- package/tests/unit/duckdb/attached_databases.test.ts +51 -33
- package/tests/unit/ducklake/ducklake.test.ts +24 -22
- package/tests/unit/mcp/prompt_happy.test.ts +8 -8
- package/dist/app/assets/HomePage-DbZS0N7G.js +0 -1
- package/dist/app/assets/MainPage-CBuWkbmr.js +0 -2
- package/dist/app/assets/ModelPage-Bt37smot.js +0 -1
- package/dist/app/assets/PackagePage-DLZe50WG.js +0 -1
- package/dist/app/assets/ProjectPage-FQTEPXP4.js +0 -1
- package/dist/app/assets/WorkbookPage-CkAo16ar.js +0 -1
- package/src/mcp/resources/project_resource.ts +0 -184
- package/src/service/resolve_project.ts +0 -13
package/src/server.ts
CHANGED
|
@@ -36,9 +36,9 @@ import { logger, loggerMiddleware } from "./logger";
|
|
|
36
36
|
import { ManifestController } from "./controller/manifest.controller";
|
|
37
37
|
import { MaterializationController } from "./controller/materialization.controller";
|
|
38
38
|
import { initializeMcpServer } from "./mcp/server";
|
|
39
|
+
import { EnvironmentStore } from "./service/environment_store";
|
|
39
40
|
import { ManifestService } from "./service/manifest_service";
|
|
40
41
|
import { MaterializationService } from "./service/materialization_service";
|
|
41
|
-
import { ProjectStore } from "./service/project_store";
|
|
42
42
|
|
|
43
43
|
/** Normalize an Express query param into a string[] or undefined. */
|
|
44
44
|
export function normalizeQueryArray(value: unknown): string[] | undefined {
|
|
@@ -132,24 +132,27 @@ const isDevelopment = process.env["NODE_ENV"] === "development";
|
|
|
132
132
|
export const app = express();
|
|
133
133
|
app.use(loggerMiddleware);
|
|
134
134
|
app.use(httpMetricsMiddleware);
|
|
135
|
-
const
|
|
136
|
-
const manifestService = new ManifestService(
|
|
137
|
-
const watchModeController = new WatchModeController(
|
|
138
|
-
const connectionController = new ConnectionController(
|
|
139
|
-
const modelController = new ModelController(
|
|
140
|
-
const packageController = new PackageController(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
135
|
+
const environmentStore = new EnvironmentStore(SERVER_ROOT);
|
|
136
|
+
const manifestService = new ManifestService(environmentStore);
|
|
137
|
+
const watchModeController = new WatchModeController(environmentStore);
|
|
138
|
+
const connectionController = new ConnectionController(environmentStore);
|
|
139
|
+
const modelController = new ModelController(environmentStore);
|
|
140
|
+
const packageController = new PackageController(
|
|
141
|
+
environmentStore,
|
|
142
|
+
manifestService,
|
|
143
|
+
);
|
|
144
|
+
const databaseController = new DatabaseController(environmentStore);
|
|
145
|
+
const queryController = new QueryController(environmentStore);
|
|
146
|
+
const compileController = new CompileController(environmentStore);
|
|
144
147
|
const materializationService = new MaterializationService(
|
|
145
|
-
|
|
148
|
+
environmentStore,
|
|
146
149
|
manifestService,
|
|
147
150
|
);
|
|
148
151
|
const materializationController = new MaterializationController(
|
|
149
152
|
materializationService,
|
|
150
153
|
);
|
|
151
154
|
const manifestController = new ManifestController(
|
|
152
|
-
|
|
155
|
+
environmentStore,
|
|
153
156
|
manifestService,
|
|
154
157
|
);
|
|
155
158
|
|
|
@@ -181,7 +184,7 @@ mcpApp.all(MCP_ENDPOINT, async (req, res) => {
|
|
|
181
184
|
});
|
|
182
185
|
};
|
|
183
186
|
|
|
184
|
-
const requestMcpServer = initializeMcpServer(
|
|
187
|
+
const requestMcpServer = initializeMcpServer(environmentStore);
|
|
185
188
|
await requestMcpServer.connect(transport);
|
|
186
189
|
|
|
187
190
|
res.on("close", () => {
|
|
@@ -300,7 +303,7 @@ app.use(drainingGuard);
|
|
|
300
303
|
|
|
301
304
|
app.get(`${API_PREFIX}/status`, async (_req, res) => {
|
|
302
305
|
try {
|
|
303
|
-
const status = await
|
|
306
|
+
const status = await environmentStore.getStatus();
|
|
304
307
|
res.status(200).json(status);
|
|
305
308
|
} catch (error) {
|
|
306
309
|
logger.error("Error getting status", { error });
|
|
@@ -313,9 +316,9 @@ app.get(`${API_PREFIX}/watch-mode/status`, watchModeController.getWatchStatus);
|
|
|
313
316
|
app.post(`${API_PREFIX}/watch-mode/start`, watchModeController.startWatching);
|
|
314
317
|
app.post(`${API_PREFIX}/watch-mode/stop`, watchModeController.stopWatchMode);
|
|
315
318
|
|
|
316
|
-
app.get(`${API_PREFIX}/
|
|
319
|
+
app.get(`${API_PREFIX}/environments`, async (_req, res) => {
|
|
317
320
|
try {
|
|
318
|
-
res.status(200).json(await
|
|
321
|
+
res.status(200).json(await environmentStore.listEnvironments());
|
|
319
322
|
} catch (error) {
|
|
320
323
|
logger.error(error);
|
|
321
324
|
const { json, status } = internalErrorToHttpError(error as Error);
|
|
@@ -323,11 +326,11 @@ app.get(`${API_PREFIX}/projects`, async (_req, res) => {
|
|
|
323
326
|
}
|
|
324
327
|
});
|
|
325
328
|
|
|
326
|
-
app.post(`${API_PREFIX}/
|
|
329
|
+
app.post(`${API_PREFIX}/environments`, async (req, res) => {
|
|
327
330
|
try {
|
|
328
|
-
logger.info("Adding
|
|
329
|
-
const
|
|
330
|
-
res.status(200).json(await
|
|
331
|
+
logger.info("Adding environment", { body: req.body });
|
|
332
|
+
const environment = await environmentStore.addEnvironment(req.body);
|
|
333
|
+
res.status(200).json(await environment.serialize());
|
|
331
334
|
} catch (error) {
|
|
332
335
|
logger.error(error);
|
|
333
336
|
const { json, status } = internalErrorToHttpError(error as Error);
|
|
@@ -335,24 +338,13 @@ app.post(`${API_PREFIX}/projects`, async (req, res) => {
|
|
|
335
338
|
}
|
|
336
339
|
});
|
|
337
340
|
|
|
338
|
-
app.get(`${API_PREFIX}/
|
|
341
|
+
app.get(`${API_PREFIX}/environments/:environmentName`, async (req, res) => {
|
|
339
342
|
try {
|
|
340
|
-
const
|
|
341
|
-
req.params.
|
|
343
|
+
const environment = await environmentStore.getEnvironment(
|
|
344
|
+
req.params.environmentName,
|
|
342
345
|
req.query.reload === "true",
|
|
343
346
|
);
|
|
344
|
-
res.status(200).json(await
|
|
345
|
-
} catch (error) {
|
|
346
|
-
logger.error(error);
|
|
347
|
-
const { json, status } = internalErrorToHttpError(error as Error);
|
|
348
|
-
res.status(status).json(json);
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
app.patch(`${API_PREFIX}/projects/:projectName`, async (req, res) => {
|
|
353
|
-
try {
|
|
354
|
-
const project = await projectStore.updateProject(req.body);
|
|
355
|
-
res.status(200).json(await project.serialize());
|
|
347
|
+
res.status(200).json(await environment.serialize());
|
|
356
348
|
} catch (error) {
|
|
357
349
|
logger.error(error);
|
|
358
350
|
const { json, status } = internalErrorToHttpError(error as Error);
|
|
@@ -360,10 +352,10 @@ app.patch(`${API_PREFIX}/projects/:projectName`, async (req, res) => {
|
|
|
360
352
|
}
|
|
361
353
|
});
|
|
362
354
|
|
|
363
|
-
app.
|
|
355
|
+
app.patch(`${API_PREFIX}/environments/:environmentName`, async (req, res) => {
|
|
364
356
|
try {
|
|
365
|
-
const
|
|
366
|
-
res.status(200).json(await
|
|
357
|
+
const environment = await environmentStore.updateEnvironment(req.body);
|
|
358
|
+
res.status(200).json(await environment.serialize());
|
|
367
359
|
} catch (error) {
|
|
368
360
|
logger.error(error);
|
|
369
361
|
const { json, status } = internalErrorToHttpError(error as Error);
|
|
@@ -371,11 +363,12 @@ app.delete(`${API_PREFIX}/projects/:projectName`, async (req, res) => {
|
|
|
371
363
|
}
|
|
372
364
|
});
|
|
373
365
|
|
|
374
|
-
app.
|
|
366
|
+
app.delete(`${API_PREFIX}/environments/:environmentName`, async (req, res) => {
|
|
375
367
|
try {
|
|
376
|
-
|
|
377
|
-
|
|
368
|
+
const environment = await environmentStore.deleteEnvironment(
|
|
369
|
+
req.params.environmentName,
|
|
378
370
|
);
|
|
371
|
+
res.status(200).json(await environment?.serialize());
|
|
379
372
|
} catch (error) {
|
|
380
373
|
logger.error(error);
|
|
381
374
|
const { json, status } = internalErrorToHttpError(error as Error);
|
|
@@ -384,12 +377,29 @@ app.get(`${API_PREFIX}/projects/:projectName/connections`, async (req, res) => {
|
|
|
384
377
|
});
|
|
385
378
|
|
|
386
379
|
app.get(
|
|
387
|
-
`${API_PREFIX}/
|
|
380
|
+
`${API_PREFIX}/environments/:environmentName/connections`,
|
|
381
|
+
async (req, res) => {
|
|
382
|
+
try {
|
|
383
|
+
res.status(200).json(
|
|
384
|
+
await connectionController.listConnections(
|
|
385
|
+
req.params.environmentName,
|
|
386
|
+
),
|
|
387
|
+
);
|
|
388
|
+
} catch (error) {
|
|
389
|
+
logger.error(error);
|
|
390
|
+
const { json, status } = internalErrorToHttpError(error as Error);
|
|
391
|
+
res.status(status).json(json);
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
app.get(
|
|
397
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName`,
|
|
388
398
|
async (req, res) => {
|
|
389
399
|
try {
|
|
390
400
|
res.status(200).json(
|
|
391
401
|
await connectionController.getConnection(
|
|
392
|
-
req.params.
|
|
402
|
+
req.params.environmentName,
|
|
393
403
|
req.params.connectionName,
|
|
394
404
|
),
|
|
395
405
|
);
|
|
@@ -402,11 +412,11 @@ app.get(
|
|
|
402
412
|
);
|
|
403
413
|
|
|
404
414
|
app.post(
|
|
405
|
-
`${API_PREFIX}/
|
|
415
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName`,
|
|
406
416
|
async (req, res) => {
|
|
407
417
|
try {
|
|
408
418
|
const result = await connectionController.addConnection(
|
|
409
|
-
req.params.
|
|
419
|
+
req.params.environmentName,
|
|
410
420
|
req.params.connectionName,
|
|
411
421
|
req.body,
|
|
412
422
|
);
|
|
@@ -420,11 +430,11 @@ app.post(
|
|
|
420
430
|
);
|
|
421
431
|
|
|
422
432
|
app.patch(
|
|
423
|
-
`${API_PREFIX}/
|
|
433
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName`,
|
|
424
434
|
async (req, res) => {
|
|
425
435
|
try {
|
|
426
436
|
const result = await connectionController.updateConnection(
|
|
427
|
-
req.params.
|
|
437
|
+
req.params.environmentName,
|
|
428
438
|
req.params.connectionName,
|
|
429
439
|
req.body,
|
|
430
440
|
);
|
|
@@ -438,11 +448,11 @@ app.patch(
|
|
|
438
448
|
);
|
|
439
449
|
|
|
440
450
|
app.delete(
|
|
441
|
-
`${API_PREFIX}/
|
|
451
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName`,
|
|
442
452
|
async (req, res) => {
|
|
443
453
|
try {
|
|
444
454
|
const result = await connectionController.deleteConnection(
|
|
445
|
-
req.params.
|
|
455
|
+
req.params.environmentName,
|
|
446
456
|
req.params.connectionName,
|
|
447
457
|
);
|
|
448
458
|
res.status(200).json(result);
|
|
@@ -467,12 +477,12 @@ app.post(`${API_PREFIX}/connections/test`, async (req, res) => {
|
|
|
467
477
|
});
|
|
468
478
|
|
|
469
479
|
app.get(
|
|
470
|
-
`${API_PREFIX}/
|
|
480
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/schemas`,
|
|
471
481
|
async (req, res) => {
|
|
472
482
|
try {
|
|
473
483
|
res.status(200).json(
|
|
474
484
|
await connectionController.listSchemas(
|
|
475
|
-
req.params.
|
|
485
|
+
req.params.environmentName,
|
|
476
486
|
req.params.connectionName,
|
|
477
487
|
),
|
|
478
488
|
);
|
|
@@ -485,12 +495,12 @@ app.get(
|
|
|
485
495
|
);
|
|
486
496
|
|
|
487
497
|
app.get(
|
|
488
|
-
`${API_PREFIX}/
|
|
498
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/schemas/:schemaName/tables`,
|
|
489
499
|
async (req, res) => {
|
|
490
500
|
logger.info("req.params", { params: req.params });
|
|
491
501
|
try {
|
|
492
502
|
const results = await connectionController.listTables(
|
|
493
|
-
req.params.
|
|
503
|
+
req.params.environmentName,
|
|
494
504
|
req.params.connectionName,
|
|
495
505
|
req.params.schemaName,
|
|
496
506
|
normalizeQueryArray(req.query.tableNames),
|
|
@@ -505,12 +515,12 @@ app.get(
|
|
|
505
515
|
);
|
|
506
516
|
|
|
507
517
|
app.get(
|
|
508
|
-
`${API_PREFIX}/
|
|
518
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/schemas/:schemaName/tables/:tablePath`,
|
|
509
519
|
async (req, res) => {
|
|
510
520
|
logger.info("req.params", { params: req.params });
|
|
511
521
|
try {
|
|
512
522
|
const results = await connectionController.getTable(
|
|
513
|
-
req.params.
|
|
523
|
+
req.params.environmentName,
|
|
514
524
|
req.params.connectionName,
|
|
515
525
|
req.params.schemaName,
|
|
516
526
|
req.params.tablePath,
|
|
@@ -528,12 +538,12 @@ app.get(
|
|
|
528
538
|
// `duckdb` is per-package; non-`duckdb` names fall through to the
|
|
529
539
|
// project's connection registry via the package's MalloyConfig wrapper.
|
|
530
540
|
app.get(
|
|
531
|
-
`${API_PREFIX}/
|
|
541
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/schemas`,
|
|
532
542
|
async (req, res) => {
|
|
533
543
|
try {
|
|
534
544
|
res.status(200).json(
|
|
535
545
|
await connectionController.listSchemas(
|
|
536
|
-
req.params.
|
|
546
|
+
req.params.environmentName,
|
|
537
547
|
req.params.connectionName,
|
|
538
548
|
req.params.packageName,
|
|
539
549
|
),
|
|
@@ -547,12 +557,12 @@ app.get(
|
|
|
547
557
|
);
|
|
548
558
|
|
|
549
559
|
app.get(
|
|
550
|
-
`${API_PREFIX}/
|
|
560
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/schemas/:schemaName/tables`,
|
|
551
561
|
async (req, res) => {
|
|
552
562
|
try {
|
|
553
563
|
res.status(200).json(
|
|
554
564
|
await connectionController.listTables(
|
|
555
|
-
req.params.
|
|
565
|
+
req.params.environmentName,
|
|
556
566
|
req.params.connectionName,
|
|
557
567
|
req.params.schemaName,
|
|
558
568
|
normalizeQueryArray(req.query.tableNames),
|
|
@@ -568,12 +578,12 @@ app.get(
|
|
|
568
578
|
);
|
|
569
579
|
|
|
570
580
|
app.get(
|
|
571
|
-
`${API_PREFIX}/
|
|
581
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/schemas/:schemaName/tables/:tablePath`,
|
|
572
582
|
async (req, res) => {
|
|
573
583
|
try {
|
|
574
584
|
res.status(200).json(
|
|
575
585
|
await connectionController.getTable(
|
|
576
|
-
req.params.
|
|
586
|
+
req.params.environmentName,
|
|
577
587
|
req.params.connectionName,
|
|
578
588
|
req.params.schemaName,
|
|
579
589
|
req.params.tablePath,
|
|
@@ -589,15 +599,15 @@ app.get(
|
|
|
589
599
|
);
|
|
590
600
|
|
|
591
601
|
/**
|
|
592
|
-
* @deprecated Use /
|
|
602
|
+
* @deprecated Use /environments/:environmentName/connections/:connectionName/sqlSource POST method instead
|
|
593
603
|
*/
|
|
594
604
|
app.get(
|
|
595
|
-
`${API_PREFIX}/
|
|
605
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/sqlSource`,
|
|
596
606
|
async (req, res) => {
|
|
597
607
|
try {
|
|
598
608
|
res.status(200).json(
|
|
599
609
|
await connectionController.getConnectionSqlSource(
|
|
600
|
-
req.params.
|
|
610
|
+
req.params.environmentName,
|
|
601
611
|
req.params.connectionName,
|
|
602
612
|
req.query.sqlStatement as string,
|
|
603
613
|
),
|
|
@@ -611,12 +621,12 @@ app.get(
|
|
|
611
621
|
);
|
|
612
622
|
|
|
613
623
|
app.post(
|
|
614
|
-
`${API_PREFIX}/
|
|
624
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/sqlSource`,
|
|
615
625
|
async (req, res) => {
|
|
616
626
|
try {
|
|
617
627
|
res.status(200).json(
|
|
618
628
|
await connectionController.getConnectionSqlSource(
|
|
619
|
-
req.params.
|
|
629
|
+
req.params.environmentName,
|
|
620
630
|
req.params.connectionName,
|
|
621
631
|
req.body.sqlStatement as string,
|
|
622
632
|
),
|
|
@@ -631,12 +641,12 @@ app.post(
|
|
|
631
641
|
|
|
632
642
|
// Per-package versions
|
|
633
643
|
app.get(
|
|
634
|
-
`${API_PREFIX}/
|
|
644
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/sqlSource`,
|
|
635
645
|
async (req, res) => {
|
|
636
646
|
try {
|
|
637
647
|
res.status(200).json(
|
|
638
648
|
await connectionController.getConnectionSqlSource(
|
|
639
|
-
req.params.
|
|
649
|
+
req.params.environmentName,
|
|
640
650
|
req.params.connectionName,
|
|
641
651
|
req.query.sqlStatement as string,
|
|
642
652
|
req.params.packageName,
|
|
@@ -651,12 +661,12 @@ app.get(
|
|
|
651
661
|
);
|
|
652
662
|
|
|
653
663
|
app.post(
|
|
654
|
-
`${API_PREFIX}/
|
|
664
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/sqlSource`,
|
|
655
665
|
async (req, res) => {
|
|
656
666
|
try {
|
|
657
667
|
res.status(200).json(
|
|
658
668
|
await connectionController.getConnectionSqlSource(
|
|
659
|
-
req.params.
|
|
669
|
+
req.params.environmentName,
|
|
660
670
|
req.params.connectionName,
|
|
661
671
|
req.body.sqlStatement as string,
|
|
662
672
|
req.params.packageName,
|
|
@@ -671,15 +681,15 @@ app.post(
|
|
|
671
681
|
);
|
|
672
682
|
|
|
673
683
|
/**
|
|
674
|
-
* @deprecated Use /
|
|
684
|
+
* @deprecated Use /environments/:environmentName/connections/:connectionName/sqlQuery POST method instead
|
|
675
685
|
*/
|
|
676
686
|
app.get(
|
|
677
|
-
`${API_PREFIX}/
|
|
687
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/queryData`,
|
|
678
688
|
async (req, res) => {
|
|
679
689
|
try {
|
|
680
690
|
res.status(200).json(
|
|
681
691
|
await connectionController.getConnectionQueryData(
|
|
682
|
-
req.params.
|
|
692
|
+
req.params.environmentName,
|
|
683
693
|
req.params.connectionName,
|
|
684
694
|
req.query.sqlStatement as string,
|
|
685
695
|
req.query.options as string,
|
|
@@ -694,15 +704,15 @@ app.get(
|
|
|
694
704
|
);
|
|
695
705
|
|
|
696
706
|
/**
|
|
697
|
-
* @deprecated Use /
|
|
707
|
+
* @deprecated Use /environments/:environmentName/packages/:packageName/connections/:connectionName/sqlQuery
|
|
698
708
|
*/
|
|
699
709
|
app.get(
|
|
700
|
-
`${API_PREFIX}/
|
|
710
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/queryData`,
|
|
701
711
|
async (req, res) => {
|
|
702
712
|
try {
|
|
703
713
|
res.status(200).json(
|
|
704
714
|
await connectionController.getConnectionQueryData(
|
|
705
|
-
req.params.
|
|
715
|
+
req.params.environmentName,
|
|
706
716
|
req.params.connectionName,
|
|
707
717
|
req.query.sqlStatement as string,
|
|
708
718
|
req.query.options as string,
|
|
@@ -718,7 +728,7 @@ app.get(
|
|
|
718
728
|
);
|
|
719
729
|
|
|
720
730
|
app.post(
|
|
721
|
-
`${API_PREFIX}/
|
|
731
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/sqlQuery`,
|
|
722
732
|
async (req, res) => {
|
|
723
733
|
try {
|
|
724
734
|
let options: string | ParsedQs | (string | ParsedQs)[] | undefined;
|
|
@@ -732,7 +742,7 @@ app.post(
|
|
|
732
742
|
}
|
|
733
743
|
res.status(200).json(
|
|
734
744
|
await connectionController.getConnectionQueryData(
|
|
735
|
-
req.params.
|
|
745
|
+
req.params.environmentName,
|
|
736
746
|
req.params.connectionName,
|
|
737
747
|
req.body.sqlStatement as string,
|
|
738
748
|
options as string,
|
|
@@ -747,7 +757,7 @@ app.post(
|
|
|
747
757
|
);
|
|
748
758
|
|
|
749
759
|
app.post(
|
|
750
|
-
`${API_PREFIX}/
|
|
760
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/sqlQuery`,
|
|
751
761
|
async (req, res) => {
|
|
752
762
|
try {
|
|
753
763
|
let options: string | ParsedQs | (string | ParsedQs)[] | undefined;
|
|
@@ -758,7 +768,7 @@ app.post(
|
|
|
758
768
|
}
|
|
759
769
|
res.status(200).json(
|
|
760
770
|
await connectionController.getConnectionQueryData(
|
|
761
|
-
req.params.
|
|
771
|
+
req.params.environmentName,
|
|
762
772
|
req.params.connectionName,
|
|
763
773
|
req.body.sqlStatement as string,
|
|
764
774
|
options as string,
|
|
@@ -774,15 +784,15 @@ app.post(
|
|
|
774
784
|
);
|
|
775
785
|
|
|
776
786
|
/**
|
|
777
|
-
* @deprecated Use
|
|
787
|
+
* @deprecated Use environments/:environmentName/connections/:connectionName/sqlTemporaryTable POST method instead
|
|
778
788
|
*/
|
|
779
789
|
app.get(
|
|
780
|
-
`${API_PREFIX}/
|
|
790
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/temporaryTable`,
|
|
781
791
|
async (req, res) => {
|
|
782
792
|
try {
|
|
783
793
|
res.status(200).json(
|
|
784
794
|
await connectionController.getConnectionTemporaryTable(
|
|
785
|
-
req.params.
|
|
795
|
+
req.params.environmentName,
|
|
786
796
|
req.params.connectionName,
|
|
787
797
|
req.query.sqlStatement as string,
|
|
788
798
|
),
|
|
@@ -796,15 +806,15 @@ app.get(
|
|
|
796
806
|
);
|
|
797
807
|
|
|
798
808
|
/**
|
|
799
|
-
* @deprecated Use /
|
|
809
|
+
* @deprecated Use /environments/:environmentName/packages/:packageName/connections/:connectionName/sqlTemporaryTable
|
|
800
810
|
*/
|
|
801
811
|
app.get(
|
|
802
|
-
`${API_PREFIX}/
|
|
812
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/temporaryTable`,
|
|
803
813
|
async (req, res) => {
|
|
804
814
|
try {
|
|
805
815
|
res.status(200).json(
|
|
806
816
|
await connectionController.getConnectionTemporaryTable(
|
|
807
|
-
req.params.
|
|
817
|
+
req.params.environmentName,
|
|
808
818
|
req.params.connectionName,
|
|
809
819
|
req.query.sqlStatement as string,
|
|
810
820
|
req.params.packageName,
|
|
@@ -819,12 +829,12 @@ app.get(
|
|
|
819
829
|
);
|
|
820
830
|
|
|
821
831
|
app.post(
|
|
822
|
-
`${API_PREFIX}/
|
|
832
|
+
`${API_PREFIX}/environments/:environmentName/connections/:connectionName/sqlTemporaryTable`,
|
|
823
833
|
async (req, res) => {
|
|
824
834
|
try {
|
|
825
835
|
res.status(200).json(
|
|
826
836
|
await connectionController.getConnectionTemporaryTable(
|
|
827
|
-
req.params.
|
|
837
|
+
req.params.environmentName,
|
|
828
838
|
req.params.connectionName,
|
|
829
839
|
req.body.sqlStatement as string,
|
|
830
840
|
),
|
|
@@ -838,12 +848,12 @@ app.post(
|
|
|
838
848
|
);
|
|
839
849
|
|
|
840
850
|
app.post(
|
|
841
|
-
`${API_PREFIX}/
|
|
851
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/connections/:connectionName/sqlTemporaryTable`,
|
|
842
852
|
async (req, res) => {
|
|
843
853
|
try {
|
|
844
854
|
res.status(200).json(
|
|
845
855
|
await connectionController.getConnectionTemporaryTable(
|
|
846
|
-
req.params.
|
|
856
|
+
req.params.environmentName,
|
|
847
857
|
req.params.connectionName,
|
|
848
858
|
req.body.sqlStatement as string,
|
|
849
859
|
req.params.packageName,
|
|
@@ -857,41 +867,47 @@ app.post(
|
|
|
857
867
|
},
|
|
858
868
|
);
|
|
859
869
|
|
|
860
|
-
app.get(
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
870
|
+
app.get(
|
|
871
|
+
`${API_PREFIX}/environments/:environmentName/packages`,
|
|
872
|
+
async (req, res) => {
|
|
873
|
+
if (req.query.versionId) {
|
|
874
|
+
setVersionIdError(res);
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
865
877
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
878
|
+
try {
|
|
879
|
+
res.status(200).json(
|
|
880
|
+
await packageController.listPackages(req.params.environmentName),
|
|
881
|
+
);
|
|
882
|
+
} catch (error) {
|
|
883
|
+
logger.error(error);
|
|
884
|
+
const { json, status } = internalErrorToHttpError(error as Error);
|
|
885
|
+
res.status(status).json(json);
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
);
|
|
876
889
|
|
|
877
|
-
app.post(
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
req.
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
app.post(
|
|
891
|
+
`${API_PREFIX}/environments/:environmentName/packages`,
|
|
892
|
+
async (req, res) => {
|
|
893
|
+
try {
|
|
894
|
+
const autoLoadManifest = req.query.autoLoadManifest === "true";
|
|
895
|
+
const _package = await packageController.addPackage(
|
|
896
|
+
req.params.environmentName,
|
|
897
|
+
req.body,
|
|
898
|
+
{ autoLoadManifest },
|
|
899
|
+
);
|
|
900
|
+
res.status(200).json(_package?.getPackageMetadata());
|
|
901
|
+
} catch (error) {
|
|
902
|
+
logger.error(error);
|
|
903
|
+
const { json, status } = internalErrorToHttpError(error as Error);
|
|
904
|
+
res.status(status).json(json);
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
);
|
|
892
908
|
|
|
893
909
|
app.get(
|
|
894
|
-
`${API_PREFIX}/
|
|
910
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName`,
|
|
895
911
|
async (req, res) => {
|
|
896
912
|
if (req.query.versionId) {
|
|
897
913
|
setVersionIdError(res);
|
|
@@ -901,7 +917,7 @@ app.get(
|
|
|
901
917
|
try {
|
|
902
918
|
res.status(200).json(
|
|
903
919
|
await packageController.getPackage(
|
|
904
|
-
req.params.
|
|
920
|
+
req.params.environmentName,
|
|
905
921
|
req.params.packageName,
|
|
906
922
|
req.query.reload === "true",
|
|
907
923
|
),
|
|
@@ -915,12 +931,12 @@ app.get(
|
|
|
915
931
|
);
|
|
916
932
|
|
|
917
933
|
app.patch(
|
|
918
|
-
`${API_PREFIX}/
|
|
934
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName`,
|
|
919
935
|
async (req, res) => {
|
|
920
936
|
try {
|
|
921
937
|
res.status(200).json(
|
|
922
938
|
await packageController.updatePackage(
|
|
923
|
-
req.params.
|
|
939
|
+
req.params.environmentName,
|
|
924
940
|
req.params.packageName,
|
|
925
941
|
req.body,
|
|
926
942
|
),
|
|
@@ -934,12 +950,12 @@ app.patch(
|
|
|
934
950
|
);
|
|
935
951
|
|
|
936
952
|
app.delete(
|
|
937
|
-
`${API_PREFIX}/
|
|
953
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName`,
|
|
938
954
|
async (req, res) => {
|
|
939
955
|
try {
|
|
940
956
|
res.status(200).json(
|
|
941
957
|
await packageController.deletePackage(
|
|
942
|
-
req.params.
|
|
958
|
+
req.params.environmentName,
|
|
943
959
|
req.params.packageName,
|
|
944
960
|
),
|
|
945
961
|
);
|
|
@@ -952,7 +968,7 @@ app.delete(
|
|
|
952
968
|
);
|
|
953
969
|
|
|
954
970
|
app.get(
|
|
955
|
-
`${API_PREFIX}/
|
|
971
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/models`,
|
|
956
972
|
async (req, res) => {
|
|
957
973
|
if (req.query.versionId) {
|
|
958
974
|
setVersionIdError(res);
|
|
@@ -962,7 +978,7 @@ app.get(
|
|
|
962
978
|
try {
|
|
963
979
|
res.status(200).json(
|
|
964
980
|
await modelController.listModels(
|
|
965
|
-
req.params.
|
|
981
|
+
req.params.environmentName,
|
|
966
982
|
req.params.packageName,
|
|
967
983
|
),
|
|
968
984
|
);
|
|
@@ -975,7 +991,7 @@ app.get(
|
|
|
975
991
|
);
|
|
976
992
|
|
|
977
993
|
app.get(
|
|
978
|
-
`${API_PREFIX}/
|
|
994
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/models/*?`,
|
|
979
995
|
async (req, res) => {
|
|
980
996
|
if (req.query.versionId) {
|
|
981
997
|
setVersionIdError(res);
|
|
@@ -987,7 +1003,7 @@ app.get(
|
|
|
987
1003
|
const modelPath = (req.params as Record<string, string>)["0"];
|
|
988
1004
|
res.status(200).json(
|
|
989
1005
|
await modelController.getModel(
|
|
990
|
-
req.params.
|
|
1006
|
+
req.params.environmentName,
|
|
991
1007
|
req.params.packageName,
|
|
992
1008
|
modelPath,
|
|
993
1009
|
),
|
|
@@ -1001,7 +1017,7 @@ app.get(
|
|
|
1001
1017
|
);
|
|
1002
1018
|
|
|
1003
1019
|
app.get(
|
|
1004
|
-
`${API_PREFIX}/
|
|
1020
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/notebooks`,
|
|
1005
1021
|
async (req, res) => {
|
|
1006
1022
|
if (req.query.versionId) {
|
|
1007
1023
|
setVersionIdError(res);
|
|
@@ -1011,7 +1027,7 @@ app.get(
|
|
|
1011
1027
|
try {
|
|
1012
1028
|
res.status(200).json(
|
|
1013
1029
|
await modelController.listNotebooks(
|
|
1014
|
-
req.params.
|
|
1030
|
+
req.params.environmentName,
|
|
1015
1031
|
req.params.packageName,
|
|
1016
1032
|
),
|
|
1017
1033
|
);
|
|
@@ -1026,7 +1042,7 @@ app.get(
|
|
|
1026
1042
|
// Execute notebook cell route must come BEFORE the general get notebook route
|
|
1027
1043
|
// to avoid the wildcard matching incorrectly
|
|
1028
1044
|
app.get(
|
|
1029
|
-
`${API_PREFIX}/
|
|
1045
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/notebooks/*/cells/:cellIndex`,
|
|
1030
1046
|
async (req, res) => {
|
|
1031
1047
|
if (req.query.versionId) {
|
|
1032
1048
|
setVersionIdError(res);
|
|
@@ -1062,7 +1078,7 @@ app.get(
|
|
|
1062
1078
|
|
|
1063
1079
|
res.status(200).json(
|
|
1064
1080
|
await modelController.executeNotebookCell(
|
|
1065
|
-
req.params.
|
|
1081
|
+
req.params.environmentName,
|
|
1066
1082
|
req.params.packageName,
|
|
1067
1083
|
notebookPath,
|
|
1068
1084
|
cellIndex,
|
|
@@ -1079,7 +1095,7 @@ app.get(
|
|
|
1079
1095
|
);
|
|
1080
1096
|
|
|
1081
1097
|
app.get(
|
|
1082
|
-
`${API_PREFIX}/
|
|
1098
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/notebooks/*?`,
|
|
1083
1099
|
async (req, res) => {
|
|
1084
1100
|
if (req.query.versionId) {
|
|
1085
1101
|
setVersionIdError(res);
|
|
@@ -1091,7 +1107,7 @@ app.get(
|
|
|
1091
1107
|
const notebookPath = (req.params as Record<string, string>)["0"];
|
|
1092
1108
|
res.status(200).json(
|
|
1093
1109
|
await modelController.getNotebook(
|
|
1094
|
-
req.params.
|
|
1110
|
+
req.params.environmentName,
|
|
1095
1111
|
req.params.packageName,
|
|
1096
1112
|
notebookPath,
|
|
1097
1113
|
),
|
|
@@ -1105,7 +1121,7 @@ app.get(
|
|
|
1105
1121
|
);
|
|
1106
1122
|
|
|
1107
1123
|
app.post(
|
|
1108
|
-
`${API_PREFIX}/
|
|
1124
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/models/*?/query`,
|
|
1109
1125
|
async (req, res) => {
|
|
1110
1126
|
if (req.body.versionId) {
|
|
1111
1127
|
setVersionIdError(res);
|
|
@@ -1117,7 +1133,7 @@ app.post(
|
|
|
1117
1133
|
const modelPath = (req.params as Record<string, string>)["0"];
|
|
1118
1134
|
res.status(200).json(
|
|
1119
1135
|
await queryController.getQuery(
|
|
1120
|
-
req.params.
|
|
1136
|
+
req.params.environmentName,
|
|
1121
1137
|
req.params.packageName,
|
|
1122
1138
|
modelPath,
|
|
1123
1139
|
req.body.sourceName as string,
|
|
@@ -1139,7 +1155,7 @@ app.post(
|
|
|
1139
1155
|
);
|
|
1140
1156
|
|
|
1141
1157
|
app.get(
|
|
1142
|
-
`${API_PREFIX}/
|
|
1158
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/databases`,
|
|
1143
1159
|
async (req, res) => {
|
|
1144
1160
|
if (req.query.versionId) {
|
|
1145
1161
|
setVersionIdError(res);
|
|
@@ -1149,7 +1165,7 @@ app.get(
|
|
|
1149
1165
|
try {
|
|
1150
1166
|
res.status(200).json(
|
|
1151
1167
|
await databaseController.listDatabases(
|
|
1152
|
-
req.params.
|
|
1168
|
+
req.params.environmentName,
|
|
1153
1169
|
req.params.packageName,
|
|
1154
1170
|
),
|
|
1155
1171
|
);
|
|
@@ -1162,11 +1178,11 @@ app.get(
|
|
|
1162
1178
|
);
|
|
1163
1179
|
|
|
1164
1180
|
app.post(
|
|
1165
|
-
`${API_PREFIX}/
|
|
1181
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/models/:modelName/compile`,
|
|
1166
1182
|
async (req, res) => {
|
|
1167
1183
|
try {
|
|
1168
1184
|
const result = await compileController.compile(
|
|
1169
|
-
req.params.
|
|
1185
|
+
req.params.environmentName,
|
|
1170
1186
|
req.params.packageName,
|
|
1171
1187
|
req.params.modelName,
|
|
1172
1188
|
req.body.source,
|
|
@@ -1184,11 +1200,11 @@ app.post(
|
|
|
1184
1200
|
// ==================== MATERIALIZATION ROUTES ====================
|
|
1185
1201
|
|
|
1186
1202
|
app.post(
|
|
1187
|
-
`${API_PREFIX}/
|
|
1203
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/materializations`,
|
|
1188
1204
|
async (req, res) => {
|
|
1189
1205
|
try {
|
|
1190
1206
|
const build = await materializationController.createMaterialization(
|
|
1191
|
-
req.params.
|
|
1207
|
+
req.params.environmentName,
|
|
1192
1208
|
req.params.packageName,
|
|
1193
1209
|
req.body || {},
|
|
1194
1210
|
);
|
|
@@ -1201,7 +1217,7 @@ app.post(
|
|
|
1201
1217
|
);
|
|
1202
1218
|
|
|
1203
1219
|
app.get(
|
|
1204
|
-
`${API_PREFIX}/
|
|
1220
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/materializations`,
|
|
1205
1221
|
async (req, res) => {
|
|
1206
1222
|
try {
|
|
1207
1223
|
const limit = req.query.limit
|
|
@@ -1211,7 +1227,7 @@ app.get(
|
|
|
1211
1227
|
? parseInt(req.query.offset as string, 10)
|
|
1212
1228
|
: undefined;
|
|
1213
1229
|
const builds = await materializationController.listMaterializations(
|
|
1214
|
-
req.params.
|
|
1230
|
+
req.params.environmentName,
|
|
1215
1231
|
req.params.packageName,
|
|
1216
1232
|
{ limit, offset },
|
|
1217
1233
|
);
|
|
@@ -1224,11 +1240,11 @@ app.get(
|
|
|
1224
1240
|
);
|
|
1225
1241
|
|
|
1226
1242
|
app.get(
|
|
1227
|
-
`${API_PREFIX}/
|
|
1243
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/materializations/:materializationId`,
|
|
1228
1244
|
async (req, res) => {
|
|
1229
1245
|
try {
|
|
1230
1246
|
const build = await materializationController.getMaterialization(
|
|
1231
|
-
req.params.
|
|
1247
|
+
req.params.environmentName,
|
|
1232
1248
|
req.params.packageName,
|
|
1233
1249
|
req.params.materializationId,
|
|
1234
1250
|
);
|
|
@@ -1241,11 +1257,11 @@ app.get(
|
|
|
1241
1257
|
);
|
|
1242
1258
|
|
|
1243
1259
|
app.post(
|
|
1244
|
-
`${API_PREFIX}/
|
|
1260
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/materializations/teardown`,
|
|
1245
1261
|
async (req, res) => {
|
|
1246
1262
|
try {
|
|
1247
1263
|
const result = await materializationController.teardownPackage(
|
|
1248
|
-
req.params.
|
|
1264
|
+
req.params.environmentName,
|
|
1249
1265
|
req.params.packageName,
|
|
1250
1266
|
req.body || {},
|
|
1251
1267
|
);
|
|
@@ -1258,20 +1274,20 @@ app.post(
|
|
|
1258
1274
|
);
|
|
1259
1275
|
|
|
1260
1276
|
app.post(
|
|
1261
|
-
`${API_PREFIX}/
|
|
1277
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/materializations/:materializationId`,
|
|
1262
1278
|
async (req, res) => {
|
|
1263
1279
|
try {
|
|
1264
1280
|
const action = req.query.action;
|
|
1265
1281
|
if (action === "start") {
|
|
1266
1282
|
const build = await materializationController.startMaterialization(
|
|
1267
|
-
req.params.
|
|
1283
|
+
req.params.environmentName,
|
|
1268
1284
|
req.params.packageName,
|
|
1269
1285
|
req.params.materializationId,
|
|
1270
1286
|
);
|
|
1271
1287
|
res.status(202).json(build);
|
|
1272
1288
|
} else if (action === "stop") {
|
|
1273
1289
|
const build = await materializationController.stopMaterialization(
|
|
1274
|
-
req.params.
|
|
1290
|
+
req.params.environmentName,
|
|
1275
1291
|
req.params.packageName,
|
|
1276
1292
|
req.params.materializationId,
|
|
1277
1293
|
);
|
|
@@ -1289,11 +1305,11 @@ app.post(
|
|
|
1289
1305
|
);
|
|
1290
1306
|
|
|
1291
1307
|
app.delete(
|
|
1292
|
-
`${API_PREFIX}/
|
|
1308
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/materializations/:materializationId`,
|
|
1293
1309
|
async (req, res) => {
|
|
1294
1310
|
try {
|
|
1295
1311
|
await materializationController.deleteMaterialization(
|
|
1296
|
-
req.params.
|
|
1312
|
+
req.params.environmentName,
|
|
1297
1313
|
req.params.packageName,
|
|
1298
1314
|
req.params.materializationId,
|
|
1299
1315
|
);
|
|
@@ -1308,11 +1324,11 @@ app.delete(
|
|
|
1308
1324
|
// ==================== MANIFEST ROUTES ====================
|
|
1309
1325
|
|
|
1310
1326
|
app.get(
|
|
1311
|
-
`${API_PREFIX}/
|
|
1327
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/manifest`,
|
|
1312
1328
|
async (req, res) => {
|
|
1313
1329
|
try {
|
|
1314
1330
|
const manifest = await manifestController.getManifest(
|
|
1315
|
-
req.params.
|
|
1331
|
+
req.params.environmentName,
|
|
1316
1332
|
req.params.packageName,
|
|
1317
1333
|
);
|
|
1318
1334
|
res.status(200).json(manifest);
|
|
@@ -1325,13 +1341,13 @@ app.get(
|
|
|
1325
1341
|
);
|
|
1326
1342
|
|
|
1327
1343
|
app.post(
|
|
1328
|
-
`${API_PREFIX}/
|
|
1344
|
+
`${API_PREFIX}/environments/:environmentName/packages/:packageName/manifest`,
|
|
1329
1345
|
async (req, res) => {
|
|
1330
1346
|
try {
|
|
1331
1347
|
const action = req.query.action;
|
|
1332
1348
|
if (action === "reload") {
|
|
1333
1349
|
const manifest = await manifestController.reloadManifest(
|
|
1334
|
-
req.params.
|
|
1350
|
+
req.params.environmentName,
|
|
1335
1351
|
req.params.packageName,
|
|
1336
1352
|
);
|
|
1337
1353
|
res.status(200).json(manifest);
|