@malloy-publisher/server 0.0.198-dev6 → 0.0.199

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/server.mjs CHANGED
@@ -237482,6 +237482,17 @@ function initializeMcpServer(environmentStore) {
237482
237482
  init_errors();
237483
237483
  init_logger();
237484
237484
  var import_body_parser = __toESM(require_body_parser(), 1);
237485
+
237486
+ // src/query_param_utils.ts
237487
+ function normalizeQueryArray(value) {
237488
+ if (value === undefined || value === null)
237489
+ return;
237490
+ if (Array.isArray(value))
237491
+ return value.map(String);
237492
+ return [String(value)];
237493
+ }
237494
+
237495
+ // src/server-old.ts
237485
237496
  var LEGACY_API_PREFIX = "/api/v0";
237486
237497
  function remapMaterializationResponse(mat) {
237487
237498
  if (!mat || typeof mat !== "object")
@@ -238802,13 +238813,6 @@ class PackageMemoryGovernor {
238802
238813
  }
238803
238814
 
238804
238815
  // src/server.ts
238805
- function normalizeQueryArray(value) {
238806
- if (value === undefined || value === null)
238807
- return;
238808
- if (Array.isArray(value))
238809
- return value.map(String);
238810
- return [String(value)];
238811
- }
238812
238816
  function parseArgs() {
238813
238817
  const args = process.argv.slice(2);
238814
238818
  let sawServerRoot = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/server",
3
3
  "description": "Malloy Publisher Server",
4
- "version": "0.0.198-dev6",
4
+ "version": "0.0.199",
5
5
  "main": "dist/server.mjs",
6
6
  "bin": {
7
7
  "malloy-publisher": "dist/server.mjs"
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Express query-param normalization helpers.
3
+ *
4
+ * Kept in a standalone file (no transitive imports) so unit specs can
5
+ * exercise them without dragging in `server.ts` — which transitively
6
+ * constructs `EnvironmentStore` and kicks off an async storage init
7
+ * (clone of `malloy-samples`, package downloads, ...). When that init
8
+ * runs in a `bun test` process it races the test runner's exit and
9
+ * leaves a partially-populated `publisher_data/` on disk, which the
10
+ * next process (integration tests) then trips over.
11
+ */
12
+
13
+ /** Normalize an Express query param into a string[] or undefined. */
14
+ export function normalizeQueryArray(value: unknown): string[] | undefined {
15
+ if (value === undefined || value === null) return undefined;
16
+ if (Array.isArray(value)) return value.map(String);
17
+ return [String(value)];
18
+ }
package/src/server-old.ts CHANGED
@@ -41,7 +41,7 @@ import {
41
41
  NotImplementedError,
42
42
  } from "./errors";
43
43
  import { logger } from "./logger";
44
- import { normalizeQueryArray } from "./server";
44
+ import { normalizeQueryArray } from "./query_param_utils";
45
45
  import { EnvironmentStore } from "./service/environment_store";
46
46
 
47
47
  const LEGACY_API_PREFIX = "/api/v0";
package/src/server.ts CHANGED
@@ -42,14 +42,10 @@ import { registerLegacyRoutes } from "./server-old";
42
42
  import { EnvironmentStore } from "./service/environment_store";
43
43
  import { ManifestService } from "./service/manifest_service";
44
44
  import { MaterializationService } from "./service/materialization_service";
45
+ import { normalizeQueryArray } from "./query_param_utils";
45
46
  import { PackageMemoryGovernor } from "./service/package_memory_governor";
46
47
 
47
- /** Normalize an Express query param into a string[] or undefined. */
48
- export function normalizeQueryArray(value: unknown): string[] | undefined {
49
- if (value === undefined || value === null) return undefined;
50
- if (Array.isArray(value)) return value.map(String);
51
- return [String(value)];
52
- }
48
+ export { normalizeQueryArray } from "./query_param_utils";
53
49
 
54
50
  // Parse command line arguments
55
51
  function parseArgs() {
@@ -123,10 +119,12 @@ function parseArgs() {
123
119
  // Zero-config invocation (`npx @malloy-publisher/server`) opts in to
124
120
  // the bundled DuckDB-only sample config so the Quick Start works
125
121
  // without any flags. Any explicit --server_root or --config disables
126
- // this — the user told us where to look. Skip in NODE_ENV=test so
127
- // specs that import this module for utility helpers (e.g.
128
- // db_utils.spec.ts -> normalizeQueryArray) don't get the bundled
129
- // default leaked into their EnvironmentStore construction.
122
+ // this — the user told us where to look. Skip in NODE_ENV=test as a
123
+ // belt-and-suspenders so any spec that ends up evaluating this
124
+ // module doesn't accidentally pin the EnvironmentStore to the
125
+ // bundled malloy-samples config; query-param helpers have been
126
+ // moved to `./query_param_utils` precisely so unit specs no longer
127
+ // need to import this module at all.
130
128
  if (!sawServerRoot && !sawConfig && process.env.NODE_ENV !== "test") {
131
129
  process.env.PUBLISHER_USE_BUNDLED_DEFAULT = "true";
132
130
  }
@@ -12,7 +12,7 @@ mock.module("@google-cloud/bigquery", () => ({
12
12
  }));
13
13
 
14
14
  import { Connection } from "@malloydata/malloy";
15
- import { normalizeQueryArray } from "../server";
15
+ import { normalizeQueryArray } from "../query_param_utils";
16
16
  import {
17
17
  extractErrorDataFromError,
18
18
  getSchemasForConnection,