@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.
Files changed (99) hide show
  1. package/dist/app/api-doc.yaml +213 -214
  2. package/dist/app/assets/EnvironmentPage-1j6QDWAy.js +1 -0
  3. package/dist/app/assets/HomePage-DMop21VG.js +1 -0
  4. package/dist/app/assets/MainPage-BbE8ETz1.js +2 -0
  5. package/dist/app/assets/ModelPage-D2jvfe3t.js +1 -0
  6. package/dist/app/assets/PackagePage-BbnhGoD3.js +1 -0
  7. package/dist/app/assets/{RouteError-DefbDO7F.js → RouteError-D3LGEZ3i.js} +1 -1
  8. package/dist/app/assets/WorkbookPage-DttVIj4u.js +1 -0
  9. package/dist/app/assets/{core-BrfQApxh.es-DnvCX4oH.js → core-w79IMXAG.es-Bd0UlzOL.js} +1 -1
  10. package/dist/app/assets/{index-Bu0ub036.js → index-5K9YjIxF.js} +117 -117
  11. package/dist/app/assets/{index-CkzK3JIl.js → index-C513UodQ.js} +1 -1
  12. package/dist/app/assets/{index-CoA6HIGS.js → index-DIgzgp69.js} +1 -1
  13. package/dist/app/assets/{index.umd-B6Ms2PpL.js → index.umd-BMeMPq_9.js} +1 -1
  14. package/dist/app/index.html +1 -1
  15. package/dist/server.mjs +1328 -1304
  16. package/package.json +1 -1
  17. package/publisher.config.json +2 -2
  18. package/src/config.spec.ts +74 -66
  19. package/src/config.ts +50 -47
  20. package/src/controller/compile.controller.ts +10 -7
  21. package/src/controller/connection.controller.ts +79 -58
  22. package/src/controller/database.controller.ts +10 -7
  23. package/src/controller/manifest.controller.ts +23 -14
  24. package/src/controller/materialization.controller.ts +14 -14
  25. package/src/controller/model.controller.ts +35 -20
  26. package/src/controller/package.controller.ts +83 -49
  27. package/src/controller/query.controller.ts +11 -8
  28. package/src/controller/watch-mode.controller.ts +35 -29
  29. package/src/errors.ts +2 -2
  30. package/src/mcp/error_messages.ts +2 -2
  31. package/src/mcp/handler_utils.ts +23 -20
  32. package/src/mcp/mcp_constants.ts +1 -1
  33. package/src/mcp/prompts/handlers.ts +3 -3
  34. package/src/mcp/prompts/prompt_service.ts +5 -5
  35. package/src/mcp/prompts/utils.ts +12 -12
  36. package/src/mcp/resource_metadata.ts +3 -3
  37. package/src/mcp/resources/environment_resource.ts +187 -0
  38. package/src/mcp/resources/model_resource.ts +19 -17
  39. package/src/mcp/resources/notebook_resource.ts +13 -13
  40. package/src/mcp/resources/package_resource.ts +30 -27
  41. package/src/mcp/resources/query_resource.ts +15 -10
  42. package/src/mcp/resources/source_resource.ts +10 -10
  43. package/src/mcp/resources/view_resource.ts +11 -11
  44. package/src/mcp/server.ts +16 -14
  45. package/src/mcp/tools/discovery_tools.ts +67 -49
  46. package/src/mcp/tools/execute_query_tool.ts +14 -14
  47. package/src/server.ts +175 -159
  48. package/src/service/connection.spec.ts +158 -133
  49. package/src/service/connection.ts +42 -39
  50. package/src/service/connection_config.spec.ts +13 -11
  51. package/src/service/connection_config.ts +28 -19
  52. package/src/service/connection_service.spec.ts +63 -43
  53. package/src/service/connection_service.ts +106 -89
  54. package/src/service/{project.ts → environment.ts} +92 -77
  55. package/src/service/{project_compile.spec.ts → environment_compile.spec.ts} +1 -1
  56. package/src/service/{project_store.spec.ts → environment_store.spec.ts} +99 -85
  57. package/src/service/{project_store.ts → environment_store.ts} +368 -326
  58. package/src/service/manifest_service.spec.ts +15 -15
  59. package/src/service/manifest_service.ts +26 -21
  60. package/src/service/materialization_service.spec.ts +93 -59
  61. package/src/service/materialization_service.ts +71 -62
  62. package/src/service/materialized_table_gc.spec.ts +15 -15
  63. package/src/service/materialized_table_gc.ts +3 -3
  64. package/src/service/model.ts +2 -2
  65. package/src/service/package.spec.ts +2 -2
  66. package/src/service/package.ts +23 -21
  67. package/src/service/resolve_environment.ts +15 -0
  68. package/src/storage/DatabaseInterface.ts +34 -25
  69. package/src/storage/StorageManager.mock.ts +3 -3
  70. package/src/storage/StorageManager.ts +24 -23
  71. package/src/storage/duckdb/ConnectionRepository.ts +13 -11
  72. package/src/storage/duckdb/DuckDBConnection.ts +1 -1
  73. package/src/storage/duckdb/DuckDBManifestStore.ts +6 -6
  74. package/src/storage/duckdb/DuckDBRepository.ts +47 -47
  75. package/src/storage/duckdb/{ProjectRepository.ts → EnvironmentRepository.ts} +35 -35
  76. package/src/storage/duckdb/ManifestRepository.ts +21 -20
  77. package/src/storage/duckdb/MaterializationRepository.ts +31 -28
  78. package/src/storage/duckdb/PackageRepository.ts +11 -11
  79. package/src/storage/duckdb/manifest_store.spec.ts +2 -2
  80. package/src/storage/duckdb/schema.ts +20 -20
  81. package/src/storage/ducklake/DuckLakeManifestStore.ts +14 -14
  82. package/tests/fixtures/publisher.config.json +1 -1
  83. package/tests/harness/e2e.ts +1 -1
  84. package/tests/harness/mcp_test_setup.ts +1 -1
  85. package/tests/harness/mocks.ts +10 -8
  86. package/tests/integration/materialization/materialization_lifecycle.integration.spec.ts +4 -4
  87. package/tests/integration/mcp/mcp_execute_query_tool.integration.spec.ts +27 -48
  88. package/tests/integration/mcp/mcp_resource.integration.spec.ts +26 -35
  89. package/tests/unit/duckdb/attached_databases.test.ts +51 -33
  90. package/tests/unit/ducklake/ducklake.test.ts +24 -22
  91. package/tests/unit/mcp/prompt_happy.test.ts +8 -8
  92. package/dist/app/assets/HomePage-DbZS0N7G.js +0 -1
  93. package/dist/app/assets/MainPage-CBuWkbmr.js +0 -2
  94. package/dist/app/assets/ModelPage-Bt37smot.js +0 -1
  95. package/dist/app/assets/PackagePage-DLZe50WG.js +0 -1
  96. package/dist/app/assets/ProjectPage-FQTEPXP4.js +0 -1
  97. package/dist/app/assets/WorkbookPage-CkAo16ar.js +0 -1
  98. package/src/mcp/resources/project_resource.ts +0 -184
  99. package/src/service/resolve_project.ts +0 -13
@@ -1,29 +1,38 @@
1
+ import { EnvironmentStore } from "../service/environment_store";
1
2
  import { ManifestService } from "../service/manifest_service";
2
- import { ProjectStore } from "../service/project_store";
3
- import { resolveProjectId } from "../service/resolve_project";
3
+ import { resolveEnvironmentId } from "../service/resolve_environment";
4
4
 
5
5
  export class ManifestController {
6
6
  constructor(
7
- private projectStore: ProjectStore,
7
+ private environmentStore: EnvironmentStore,
8
8
  private manifestService: ManifestService,
9
9
  ) {}
10
10
 
11
- async getManifest(projectName: string, packageName: string) {
12
- const repository = this.projectStore.storageManager.getRepository();
13
- const projectId = await resolveProjectId(repository, projectName);
11
+ async getManifest(environmentName: string, packageName: string) {
12
+ const repository = this.environmentStore.storageManager.getRepository();
13
+ const environmentId = await resolveEnvironmentId(
14
+ repository,
15
+ environmentName,
16
+ );
14
17
  // Verify the package exists so we return 404 instead of an empty manifest.
15
- const project = await this.projectStore.getProject(projectName, false);
16
- await project.getPackage(packageName, false);
17
- return this.manifestService.getManifest(projectId, packageName);
18
+ const environment = await this.environmentStore.getEnvironment(
19
+ environmentName,
20
+ false,
21
+ );
22
+ await environment.getPackage(packageName, false);
23
+ return this.manifestService.getManifest(environmentId, packageName);
18
24
  }
19
25
 
20
- async reloadManifest(projectName: string, packageName: string) {
21
- const repository = this.projectStore.storageManager.getRepository();
22
- const projectId = await resolveProjectId(repository, projectName);
26
+ async reloadManifest(environmentName: string, packageName: string) {
27
+ const repository = this.environmentStore.storageManager.getRepository();
28
+ const environmentId = await resolveEnvironmentId(
29
+ repository,
30
+ environmentName,
31
+ );
23
32
  return this.manifestService.reloadManifest(
24
- projectId,
33
+ environmentId,
25
34
  packageName,
26
- projectName,
35
+ environmentName,
27
36
  );
28
37
  }
29
38
  }
@@ -5,13 +5,13 @@ export class MaterializationController {
5
5
  constructor(private materializationService: MaterializationService) {}
6
6
 
7
7
  async createMaterialization(
8
- projectName: string,
8
+ environmentName: string,
9
9
  packageName: string,
10
10
  body: Record<string, unknown>,
11
11
  ) {
12
12
  const options = this.validateCreateBody(body);
13
13
  return this.materializationService.createMaterialization(
14
- projectName,
14
+ environmentName,
15
15
  packageName,
16
16
  options,
17
17
  );
@@ -38,73 +38,73 @@ export class MaterializationController {
38
38
  }
39
39
 
40
40
  async startMaterialization(
41
- projectName: string,
41
+ environmentName: string,
42
42
  packageName: string,
43
43
  materializationId: string,
44
44
  ) {
45
45
  return this.materializationService.startMaterialization(
46
- projectName,
46
+ environmentName,
47
47
  packageName,
48
48
  materializationId,
49
49
  );
50
50
  }
51
51
 
52
52
  async stopMaterialization(
53
- projectName: string,
53
+ environmentName: string,
54
54
  packageName: string,
55
55
  materializationId: string,
56
56
  ) {
57
57
  return this.materializationService.stopMaterialization(
58
- projectName,
58
+ environmentName,
59
59
  packageName,
60
60
  materializationId,
61
61
  );
62
62
  }
63
63
 
64
64
  async listMaterializations(
65
- projectName: string,
65
+ environmentName: string,
66
66
  packageName: string,
67
67
  options?: { limit?: number; offset?: number },
68
68
  ) {
69
69
  return this.materializationService.listMaterializations(
70
- projectName,
70
+ environmentName,
71
71
  packageName,
72
72
  options,
73
73
  );
74
74
  }
75
75
 
76
76
  async getMaterialization(
77
- projectName: string,
77
+ environmentName: string,
78
78
  packageName: string,
79
79
  materializationId: string,
80
80
  ) {
81
81
  return this.materializationService.getMaterialization(
82
- projectName,
82
+ environmentName,
83
83
  packageName,
84
84
  materializationId,
85
85
  );
86
86
  }
87
87
 
88
88
  async deleteMaterialization(
89
- projectName: string,
89
+ environmentName: string,
90
90
  packageName: string,
91
91
  materializationId: string,
92
92
  ) {
93
93
  return this.materializationService.deleteMaterialization(
94
- projectName,
94
+ environmentName,
95
95
  packageName,
96
96
  materializationId,
97
97
  );
98
98
  }
99
99
 
100
100
  async teardownPackage(
101
- projectName: string,
101
+ environmentName: string,
102
102
  packageName: string,
103
103
  body: Record<string, unknown>,
104
104
  ) {
105
105
  const options = this.validateTeardownBody(body);
106
106
  return this.materializationService.teardownPackage(
107
- projectName,
107
+ environmentName,
108
108
  packageName,
109
109
  options,
110
110
  );
@@ -1,6 +1,6 @@
1
1
  import { components } from "../api";
2
2
  import { ModelNotFoundError } from "../errors";
3
- import { ProjectStore } from "../service/project_store";
3
+ import { EnvironmentStore } from "../service/environment_store";
4
4
  import type { FilterParams } from "../service/filter";
5
5
 
6
6
  type ApiNotebook = components["schemas"]["Notebook"];
@@ -8,38 +8,47 @@ type ApiModel = components["schemas"]["Model"];
8
8
  type ApiCompiledModel = components["schemas"]["CompiledModel"];
9
9
  type ApiRawNotebook = components["schemas"]["RawNotebook"];
10
10
  export class ModelController {
11
- private projectStore: ProjectStore;
11
+ private environmentStore: EnvironmentStore;
12
12
 
13
- constructor(projectStore: ProjectStore) {
14
- this.projectStore = projectStore;
13
+ constructor(environmentStore: EnvironmentStore) {
14
+ this.environmentStore = environmentStore;
15
15
  }
16
16
 
17
17
  public async listModels(
18
- projectName: string,
18
+ environmentName: string,
19
19
  packageName: string,
20
20
  ): Promise<ApiModel[]> {
21
- const project = await this.projectStore.getProject(projectName, false);
22
- const p = await project.getPackage(packageName, false);
21
+ const environment = await this.environmentStore.getEnvironment(
22
+ environmentName,
23
+ false,
24
+ );
25
+ const p = await environment.getPackage(packageName, false);
23
26
  return p.listModels();
24
27
  }
25
28
 
26
29
  public async listNotebooks(
27
- projectName: string,
30
+ environmentName: string,
28
31
  packageName: string,
29
32
  ): Promise<ApiNotebook[]> {
30
- const project = await this.projectStore.getProject(projectName, false);
31
- const p = await project.getPackage(packageName, false);
33
+ const environment = await this.environmentStore.getEnvironment(
34
+ environmentName,
35
+ false,
36
+ );
37
+ const p = await environment.getPackage(packageName, false);
32
38
  return p.listNotebooks();
33
39
  }
34
40
 
35
41
  public async getModel(
36
- projectName: string,
42
+ environmentName: string,
37
43
  packageName: string,
38
44
  modelPath: string,
39
45
  ): Promise<ApiCompiledModel> {
40
46
  try {
41
- const project = await this.projectStore.getProject(projectName, false);
42
- const p = await project.getPackage(packageName, false);
47
+ const environment = await this.environmentStore.getEnvironment(
48
+ environmentName,
49
+ false,
50
+ );
51
+ const p = await environment.getPackage(packageName, false);
43
52
  const model = p.getModel(modelPath);
44
53
  if (!model) {
45
54
  throw new ModelNotFoundError(`${modelPath} does not exist`);
@@ -55,18 +64,21 @@ export class ModelController {
55
64
  }
56
65
  // Wrap other errors with more context
57
66
  throw new Error(
58
- `Failed to get model ${modelPath} from package ${packageName} in project ${projectName}: ${error}`,
67
+ `Failed to get model ${modelPath} from package ${packageName} in environment ${environmentName}: ${error}`,
59
68
  );
60
69
  }
61
70
  }
62
71
 
63
72
  public async getNotebook(
64
- projectName: string,
73
+ environmentName: string,
65
74
  packageName: string,
66
75
  notebookPath: string,
67
76
  ): Promise<ApiRawNotebook> {
68
- const project = await this.projectStore.getProject(projectName, false);
69
- const p = await project.getPackage(packageName, false);
77
+ const environment = await this.environmentStore.getEnvironment(
78
+ environmentName,
79
+ false,
80
+ );
81
+ const p = await environment.getPackage(packageName, false);
70
82
  const model = p.getModel(notebookPath);
71
83
  if (!model) {
72
84
  throw new ModelNotFoundError(`${notebookPath} does not exist`);
@@ -79,7 +91,7 @@ export class ModelController {
79
91
  }
80
92
 
81
93
  public async executeNotebookCell(
82
- projectName: string,
94
+ environmentName: string,
83
95
  packageName: string,
84
96
  notebookPath: string,
85
97
  cellIndex: number,
@@ -92,8 +104,11 @@ export class ModelController {
92
104
  result?: string;
93
105
  newSources?: string[];
94
106
  }> {
95
- const project = await this.projectStore.getProject(projectName, false);
96
- const p = await project.getPackage(packageName, false);
107
+ const environment = await this.environmentStore.getEnvironment(
108
+ environmentName,
109
+ false,
110
+ );
111
+ const p = await environment.getPackage(packageName, false);
97
112
  const model = p.getModel(notebookPath);
98
113
  if (!model) {
99
114
  throw new ModelNotFoundError(`${notebookPath} does not exist`);
@@ -3,59 +3,78 @@ import { components } from "../api";
3
3
  import { PUBLISHER_DATA_DIR } from "../constants";
4
4
  import { BadRequestError, FrozenConfigError } from "../errors";
5
5
  import { logger } from "../logger";
6
+ import { EnvironmentStore } from "../service/environment_store";
6
7
  import { ManifestService } from "../service/manifest_service";
7
- import { ProjectStore } from "../service/project_store";
8
8
 
9
9
  type ApiPackage = components["schemas"]["Package"];
10
10
 
11
11
  export class PackageController {
12
- private projectStore: ProjectStore;
12
+ private environmentStore: EnvironmentStore;
13
13
  private manifestService: ManifestService;
14
14
 
15
- constructor(projectStore: ProjectStore, manifestService: ManifestService) {
16
- this.projectStore = projectStore;
15
+ constructor(
16
+ environmentStore: EnvironmentStore,
17
+ manifestService: ManifestService,
18
+ ) {
19
+ this.environmentStore = environmentStore;
17
20
  this.manifestService = manifestService;
18
21
  }
19
22
 
20
- public async listPackages(projectName: string): Promise<ApiPackage[]> {
21
- const project = await this.projectStore.getProject(projectName, false);
22
- return project.listPackages();
23
+ public async listPackages(environmentName: string): Promise<ApiPackage[]> {
24
+ const environment = await this.environmentStore.getEnvironment(
25
+ environmentName,
26
+ false,
27
+ );
28
+ return environment.listPackages();
23
29
  }
24
30
 
25
31
  public async getPackage(
26
- projectName: string,
32
+ environmentName: string,
27
33
  packageName: string,
28
34
  reload: boolean,
29
35
  ): Promise<ApiPackage> {
30
- const project = await this.projectStore.getProject(projectName, false);
31
- const _package = await project.getPackage(packageName, reload);
36
+ const environment = await this.environmentStore.getEnvironment(
37
+ environmentName,
38
+ false,
39
+ );
40
+ const _package = await environment.getPackage(packageName, reload);
32
41
  const packageLocation = _package.getPackageMetadata().location;
33
42
  if (reload && packageLocation) {
34
- await this.downloadPackage(projectName, packageName, packageLocation);
43
+ await this.downloadPackage(
44
+ environmentName,
45
+ packageName,
46
+ packageLocation,
47
+ );
35
48
  }
36
49
  return _package.getPackageMetadata();
37
50
  }
38
51
 
39
52
  async addPackage(
40
- projectName: string,
53
+ environmentName: string,
41
54
  body: ApiPackage,
42
55
  options?: { autoLoadManifest?: boolean },
43
56
  ) {
44
- if (this.projectStore.publisherConfigIsFrozen) {
57
+ if (this.environmentStore.publisherConfigIsFrozen) {
45
58
  throw new FrozenConfigError();
46
59
  }
47
60
  if (!body.name) {
48
61
  throw new BadRequestError("Package name is required");
49
62
  }
50
- const project = await this.projectStore.getProject(projectName, false);
63
+ const environment = await this.environmentStore.getEnvironment(
64
+ environmentName,
65
+ false,
66
+ );
51
67
  if (body.location) {
52
- await this.downloadPackage(projectName, body.name, body.location);
68
+ await this.downloadPackage(environmentName, body.name, body.location);
53
69
  }
54
- const result = await project.addPackage(body.name);
55
- await this.projectStore.addPackageToDatabase(projectName, body.name);
70
+ const result = await environment.addPackage(body.name);
71
+ await this.environmentStore.addPackageToDatabase(
72
+ environmentName,
73
+ body.name,
74
+ );
56
75
 
57
76
  if (options?.autoLoadManifest === true) {
58
- await this.tryLoadExistingManifest(projectName, body.name);
77
+ await this.tryLoadExistingManifest(environmentName, body.name);
59
78
  }
60
79
 
61
80
  return result;
@@ -67,47 +86,52 @@ export class PackageController {
67
86
  * persist references resolve to the materialized tables immediately.
68
87
  */
69
88
  private async tryLoadExistingManifest(
70
- projectName: string,
89
+ environmentName: string,
71
90
  packageName: string,
72
91
  ): Promise<void> {
73
92
  try {
74
- const repository = this.projectStore.storageManager.getRepository();
75
- const dbProject = await repository.getProjectByName(projectName);
76
- if (!dbProject) return;
93
+ const repository =
94
+ this.environmentStore.storageManager.getRepository();
95
+ const dbEnvironment =
96
+ await repository.getEnvironmentByName(environmentName);
97
+ if (!dbEnvironment) return;
77
98
 
78
99
  const manifest = await this.manifestService.getManifest(
79
- dbProject.id,
100
+ dbEnvironment.id,
80
101
  packageName,
81
102
  );
82
103
  if (Object.keys(manifest.entries).length === 0) return;
83
104
 
84
105
  await this.manifestService.reloadManifest(
85
- dbProject.id,
106
+ dbEnvironment.id,
86
107
  packageName,
87
- projectName,
108
+ environmentName,
88
109
  );
89
110
  logger.info("Auto-loaded existing manifest for added package", {
90
- projectName,
111
+ environmentName,
91
112
  packageName,
92
113
  entryCount: Object.keys(manifest.entries).length,
93
114
  });
94
115
  } catch (error) {
95
116
  logger.warn("Failed to auto-load manifest for package", {
96
- projectName,
117
+ environmentName,
97
118
  packageName,
98
119
  error,
99
120
  });
100
121
  }
101
122
  }
102
123
 
103
- public async deletePackage(projectName: string, packageName: string) {
104
- if (this.projectStore.publisherConfigIsFrozen) {
124
+ public async deletePackage(environmentName: string, packageName: string) {
125
+ if (this.environmentStore.publisherConfigIsFrozen) {
105
126
  throw new FrozenConfigError();
106
127
  }
107
- const project = await this.projectStore.getProject(projectName, false);
108
- const result = await project.deletePackage(packageName);
109
- await this.projectStore.deletePackageFromDatabase(
110
- projectName,
128
+ const environment = await this.environmentStore.getEnvironment(
129
+ environmentName,
130
+ false,
131
+ );
132
+ const result = await environment.deletePackage(packageName);
133
+ await this.environmentStore.deletePackageFromDatabase(
134
+ environmentName,
111
135
  packageName,
112
136
  );
113
137
 
@@ -115,32 +139,42 @@ export class PackageController {
115
139
  }
116
140
 
117
141
  public async updatePackage(
118
- projectName: string,
142
+ environmentName: string,
119
143
  packageName: string,
120
144
  body: ApiPackage,
121
145
  ) {
122
- if (this.projectStore.publisherConfigIsFrozen) {
146
+ if (this.environmentStore.publisherConfigIsFrozen) {
123
147
  throw new FrozenConfigError();
124
148
  }
125
- const project = await this.projectStore.getProject(projectName, false);
149
+ const environment = await this.environmentStore.getEnvironment(
150
+ environmentName,
151
+ false,
152
+ );
126
153
  if (body.location) {
127
- await this.downloadPackage(projectName, packageName, body.location);
154
+ await this.downloadPackage(
155
+ environmentName,
156
+ packageName,
157
+ body.location,
158
+ );
128
159
  }
129
- const result = await project.updatePackage(packageName, body);
130
- await this.projectStore.addPackageToDatabase(projectName, packageName);
160
+ const result = await environment.updatePackage(packageName, body);
161
+ await this.environmentStore.addPackageToDatabase(
162
+ environmentName,
163
+ packageName,
164
+ );
131
165
 
132
166
  return result;
133
167
  }
134
168
 
135
169
  private async downloadPackage(
136
- projectName: string,
170
+ environmentName: string,
137
171
  packageName: string,
138
172
  packageLocation: string,
139
173
  ) {
140
174
  const absoluteTargetPath = path.join(
141
- this.projectStore.serverRootPath,
175
+ this.environmentStore.serverRootPath,
142
176
  PUBLISHER_DATA_DIR,
143
- projectName,
177
+ environmentName,
144
178
  packageName,
145
179
  );
146
180
  const isCompressedFile = packageLocation.endsWith(".zip");
@@ -148,21 +182,21 @@ export class PackageController {
148
182
  packageLocation.startsWith("https://") ||
149
183
  packageLocation.startsWith("git@")
150
184
  ) {
151
- await this.projectStore.downloadGitHubDirectory(
185
+ await this.environmentStore.downloadGitHubDirectory(
152
186
  packageLocation,
153
187
  absoluteTargetPath,
154
188
  );
155
189
  } else if (packageLocation.startsWith("gs://")) {
156
- await this.projectStore.downloadGcsDirectory(
190
+ await this.environmentStore.downloadGcsDirectory(
157
191
  packageLocation,
158
- projectName,
192
+ environmentName,
159
193
  absoluteTargetPath,
160
194
  isCompressedFile,
161
195
  );
162
196
  } else if (packageLocation.startsWith("s3://")) {
163
- await this.projectStore.downloadS3Directory(
197
+ await this.environmentStore.downloadS3Directory(
164
198
  packageLocation,
165
- projectName,
199
+ environmentName,
166
200
  absoluteTargetPath,
167
201
  isCompressedFile,
168
202
  );
@@ -171,10 +205,10 @@ export class PackageController {
171
205
  if (packageLocation.startsWith("/")) {
172
206
  // Absolute paths from the publisher.config could be placed outside of /etc/publisher,
173
207
  // so we need to mount them on the right place.
174
- await this.projectStore.mountLocalDirectory(
208
+ await this.environmentStore.mountLocalDirectory(
175
209
  packageLocation,
176
210
  absoluteTargetPath,
177
- projectName,
211
+ environmentName,
178
212
  packageName,
179
213
  );
180
214
  }
@@ -2,7 +2,7 @@ import { validateRenderTags } from "@malloydata/render-validator";
2
2
  import { components } from "../api";
3
3
  import { API_PREFIX } from "../constants";
4
4
  import { ModelNotFoundError } from "../errors";
5
- import { ProjectStore } from "../service/project_store";
5
+ import { EnvironmentStore } from "../service/environment_store";
6
6
  import type { FilterParams } from "../service/filter";
7
7
 
8
8
  type ApiQuery = components["schemas"]["QueryResult"];
@@ -16,14 +16,14 @@ function bigIntReplacer(_key: string, value: unknown): unknown {
16
16
  }
17
17
 
18
18
  export class QueryController {
19
- private projectStore: ProjectStore;
19
+ private environmentStore: EnvironmentStore;
20
20
 
21
- constructor(projectStore: ProjectStore) {
22
- this.projectStore = projectStore;
21
+ constructor(environmentStore: EnvironmentStore) {
22
+ this.environmentStore = environmentStore;
23
23
  }
24
24
 
25
25
  public async getQuery(
26
- projectName: string,
26
+ environmentName: string,
27
27
  packageName: string,
28
28
  modelPath: string,
29
29
  sourceName: string,
@@ -33,8 +33,11 @@ export class QueryController {
33
33
  filterParams?: FilterParams,
34
34
  bypassFilters?: boolean,
35
35
  ): Promise<ApiQuery> {
36
- const project = await this.projectStore.getProject(projectName, false);
37
- const p = await project.getPackage(packageName, false);
36
+ const environment = await this.environmentStore.getEnvironment(
37
+ environmentName,
38
+ false,
39
+ );
40
+ const p = await environment.getPackage(packageName, false);
38
41
  const model = p.getModel(modelPath);
39
42
 
40
43
  if (!model) {
@@ -52,7 +55,7 @@ export class QueryController {
52
55
  result: compactJson
53
56
  ? JSON.stringify(compactResult, bigIntReplacer)
54
57
  : JSON.stringify(result),
55
- resource: `${API_PREFIX}/projects/${projectName}/packages/${packageName}/models/${modelPath}/query`,
58
+ resource: `${API_PREFIX}/environments/${environmentName}/packages/${packageName}/models/${modelPath}/query`,
56
59
  renderLogs: renderLogs.length > 0 ? renderLogs : undefined,
57
60
  } as ApiQuery;
58
61
  }