@malloy-publisher/server 0.18.7 → 0.18.8
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 +18 -18
- package/README.md +2 -2
- package/dist/admin-api-doc.yaml +10 -41
- package/dist/app/api-doc.yaml +292 -136
- package/dist/app/assets/{EnvironmentPage-nfT0sfcF.js → EnvironmentPage-B9eJXM9R.js} +1 -1
- package/dist/app/assets/{HomePage-CLVuGwtd.js → HomePage-CUCq65Mm.js} +1 -1
- package/dist/app/assets/{MainPage-BPN92PmE.js → MainPage-DMCpsSwG.js} +1 -1
- package/dist/app/assets/{ModelPage-BtYHo01_.js → ModelPage-CRpHJTqZ.js} +2 -2
- package/dist/app/assets/{PackagePage-BYTMF_z7.js → PackagePage-CrgssVfP.js} +1 -1
- package/dist/app/assets/PackageSplatRoute-Dh1u1dZ4.js +2 -0
- package/dist/app/assets/{RenderedResult-BkBdGb49.es-BeM14Cw6.js → RenderedResult-DW_0pVGi.es-CQe3gbdA.js} +3 -3
- package/dist/app/assets/{RouteError-O8rWhL-e.js → RouteError-C11mhFOT.js} +1 -1
- package/dist/app/assets/{ThemeEditorPage-BPlQ20Nk.js → ThemeEditorPage-CQdYTEul.js} +1 -1
- package/dist/app/assets/{ToggleButtonGroup-ZFDdg4WD.js → ToggleButtonGroup-CPXIFQqB.js} +1 -1
- package/dist/app/assets/{documentRoutes-D2CHPd13.js → documentRoutes-DarwM5Zm.js} +1 -1
- package/dist/app/assets/{editPageMounted-CK5o2lS_.js → editPageMounted-DmeRc7t9.js} +2 -2
- package/dist/app/assets/{index-BvIvG2Vi.js → index-BNAHVKoh.js} +1 -1
- package/dist/app/assets/{index-Dd4jjg8n.js → index-BX1A_FPA.js} +109 -109
- package/dist/app/assets/{index-w9WgUNKi.js → index-C0mf24Mk.js} +1 -1
- package/dist/app/assets/{index-m8b6Cq0X.js → index-CHCSj9_S.js} +1 -1
- package/dist/app/assets/{index.es-c9W9AVnk.js → index.es-B1q1T-14.js} +10 -10
- package/dist/app/assets/usePackageLinkNavigate-iOWW_Iek.js +1 -0
- package/dist/app/assets/{usePackageRoute-DZUIBpcE.js → usePackageRoute-BNCiKCRB.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/instrumentation.mjs +171 -88
- package/dist/package_load_worker.mjs +1226 -660
- package/dist/server.mjs +5992 -2644
- package/package.json +1 -1
- package/dist/app/assets/PackageSplatRoute-M9_ZKB-f.js +0 -2
- package/dist/app/assets/usePackageLinkNavigate-DFEdCQJt.js +0 -1
package/README.docker.md
CHANGED
|
@@ -178,25 +178,25 @@ All flags exposed by `bin/malloy-publisher --help` have an equivalent env var, s
|
|
|
178
178
|
|---|---|---|---|
|
|
179
179
|
| `PUBLISHER_PORT` | `--port <n>` | `4000` | REST API port. |
|
|
180
180
|
| `PUBLISHER_HOST` | `--host <h>` | `0.0.0.0` | REST bind address, and the fallback for MCP. |
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
181
|
+
| `PUBLISHER_MCP_HOST` | `--mcp-host <h>` | `127.0.0.1` | MCP bind address. Takes precedence over `PUBLISHER_HOST`. |
|
|
182
|
+
| `PUBLISHER_MCP_CORS_ORIGINS` | | (none) | Comma-separated origins allowed cross-origin access to MCP; `*` allows any. Unset means none. |
|
|
183
|
+
| `PUBLISHER_MCP_PORT` | `--mcp-port <n>` | `4040` | MCP API port. |
|
|
184
184
|
| `PUBLISHER_MCP_CONFIG_FILE_ENABLED` | `--mcp-config-file-enabled`, `--no-mcp-config-file-enabled` | `false` **in this image** | Whether the server writes a `.mcp.json` into its working directory on startup. That file exists so an AI agent opened in that directory finds the server; nothing starts an agent session inside the container, and the git-working-tree guard that would normally cover `/publisher` cannot fire because `.dockerignore` excludes `.git`. Left on, every boot would create a file there, which matters if you bind-mount a project directory at `/publisher`. Pass `-e PUBLISHER_MCP_CONFIG_FILE_ENABLED=true` to turn it back on. Images before this one set the deprecated `PUBLISHER_NO_MCP_CONFIG=1` instead, so `-e PUBLISHER_NO_MCP_CONFIG=` no longer turns it on, and `-e PUBLISHER_NO_MCP_CONFIG=0` now fails startup, since it disagrees with the image's own value. Note this is one of the env vars the image sets for you: `docker run -e PUBLISHER_MCP_CONFIG_FILE_ENABLED` (no `=`) and a Compose `environment:` entry with no value both *delete* it when the host does not have it set, which re-enables the write. |
|
|
185
185
|
| `PUBLISHER_ROOT` | `--root <path>` | `.` (cwd) at the server level; `/publisher` by the bundled CMD | Directory the server treats as its working dir. The image's CMD passes `--root /publisher` explicitly so the zero-arg `npx` bundled-default trigger doesn't fire inside the container. A flag wins over a variable, so to use another directory, override CMD rather than set `PUBLISHER_ROOT`; the deprecated `SERVER_ROOT` set to anything but `/publisher` fails startup, since it disagrees with the CMD's `--root`. If you override CMD with your own entrypoint, pass `--root` or set `PUBLISHER_ROOT` yourself to keep this behaviour. |
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
186
|
+
| `PUBLISHER_CONFIG` | `--config <path>` | unset | Absolute path to a `publisher.config.json`. Wins over `<PUBLISHER_ROOT>/publisher.config.json`. Use this if you want to mount your config somewhere other than `/publisher/`. |
|
|
187
|
+
| `PUBLISHER_INITIALIZE_STORAGE` | `--init` | `false` | Wipes `publisher_data/` and re-syncs it from the config on boot. A first boot with empty storage loads the config automatically, so set this only to reset state or resync after the on-disk config has drifted from `publisher_data/`. Re-initializing discards any state there that isn't reproducible from the config. See [configuration.md](../../docs/configuration.md#environment-variables--cli-flags). |
|
|
188
|
+
| `PUBLISHER_SHUTDOWN_DRAIN_DURATION_SECONDS` | `--shutdown-drain-duration-seconds <s>` | `0` | On SIGTERM, how long to keep serving requests (readiness flips to not-ready immediately) before closing server sockets. Set this to your typical request duration to avoid 502s from K8s rolling deploys. |
|
|
189
|
+
| `PUBLISHER_SHUTDOWN_GRACEFUL_CLOSE_TIMEOUT_SECONDS` | `--shutdown-graceful-close-timeout-seconds <s>` | `0` | Additional grace period after server close before `process.exit`. |
|
|
190
190
|
| `GOOGLE_APPLICATION_CREDENTIALS` | — | unset | Path inside the container to a GCP service-account JSON. Required for BigQuery-backed environments. Personal user credentials don't work inside the container — use a service account. |
|
|
191
|
-
| `
|
|
192
|
-
| `PUBLISHER_MEMORY_HIGH_WATER_FRACTION` | — | `0.8` | Fraction of `
|
|
191
|
+
| `PUBLISHER_MEMORY_MAX_BYTES` | — | unset (disabled) | Resident-set-size (RSS) cap in bytes. When set, the in-process **memory governor** polls RSS on `PUBLISHER_MEMORY_CHECK_INTERVAL_MS` and rejects new package loads and new queries with **HTTP 503** once RSS crosses the high-water mark. Designed to keep the pod under its k8s `resources.limits.memory` instead of getting OOM-killed. Set this to roughly `0.7 × resources.limits.memory` so the back-pressure band has headroom for traffic spikes and per-request DuckDB scratch. |
|
|
192
|
+
| `PUBLISHER_MEMORY_HIGH_WATER_FRACTION` | — | `0.8` | Fraction of `PUBLISHER_MEMORY_MAX_BYTES` at which back-pressure activates. Must be in `(0, 1)` and strictly greater than the low-water fraction. |
|
|
193
193
|
| `PUBLISHER_MEMORY_LOW_WATER_FRACTION` | — | `0.7` | Fraction at which back-pressure clears. The gap between low and high gives hysteresis so the governor doesn't flap on every GC cycle. |
|
|
194
194
|
| `PUBLISHER_MEMORY_CHECK_INTERVAL_MS` | — | `5000` | How often the governor samples RSS. Minimum `100`. Smaller values catch spikes faster but burn a few extra microseconds per tick. |
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
195
|
+
| `PUBLISHER_MEMORY_BACKPRESSURE_ENABLED` | — | `true` | When `false`, the governor still samples RSS and emits metrics but never flips the back-pressure flag. Useful for a monitoring-only rollout before enabling the 503 behaviour. |
|
|
196
|
+
| `PUBLISHER_RETRIEVAL_EMBEDDING_API_KEY` | — | _unset_ | Turns on embedding closeness in `get_context`'s search; sent as a bearer token to the embedding endpoint. Unset: `get_context` ranks by keyword and stored values only. Entity names, annotation text, and query strings are sent to the endpoint when enabled; see "How get_context searches" in `docs/configuration.md`. |
|
|
197
|
+
| `PUBLISHER_RETRIEVAL_EMBEDDING_MODEL` | — | `text-embedding-3-small` | Embedding model name. |
|
|
198
|
+
| `PUBLISHER_RETRIEVAL_EMBEDDING_BASE_URL` | — | `https://api.openai.com/v1` | Base URL of an OpenAI-compatible embeddings API. |
|
|
199
|
+
| `PUBLISHER_RETRIEVAL_EMBEDDING_DIMENSIONS` | — | _unset_ | Optional `dimensions` request parameter; omitted when unset. |
|
|
200
200
|
|
|
201
201
|
### Kubernetes: turn off service links
|
|
202
202
|
|
|
@@ -204,7 +204,7 @@ Kubernetes gives every pod a `<SERVICE>_PORT=tcp://<ip>:<port>` variable, and a
|
|
|
204
204
|
|
|
205
205
|
### Memory governor
|
|
206
206
|
|
|
207
|
-
When `
|
|
207
|
+
When `PUBLISHER_MEMORY_MAX_BYTES` is unset, the governor is **disabled** and the server's behaviour is identical to prior versions. When it's set, the governor:
|
|
208
208
|
|
|
209
209
|
- Periodically samples `process.memoryUsage().rss`.
|
|
210
210
|
- Once RSS crosses the high-water mark, **any code path that would allocate a new package into memory returns HTTP 503**, and new queries are rejected the same way. The package gate sits at the single choke point inside `Environment.getPackage` / `Environment.addPackage`, so it covers every controller that touches a not-yet-loaded package — including lazy loads on cache miss from `ModelController`, `ConnectionController`, `QueryController`, `DatabaseController`, etc. — not just the explicit `POST /packages` and `?reload=true` paths.
|
|
@@ -233,16 +233,16 @@ resources:
|
|
|
233
233
|
limits:
|
|
234
234
|
memory: 4Gi
|
|
235
235
|
env:
|
|
236
|
-
- name:
|
|
236
|
+
- name: PUBLISHER_MEMORY_MAX_BYTES
|
|
237
237
|
# 2.8Gi — back-pressure activates at ~2.24Gi, clears at ~1.96Gi,
|
|
238
238
|
# leaving ~1.2Gi of headroom under the 4Gi k8s hard limit for
|
|
239
239
|
# in-flight DuckDB scratch and JS heap spikes.
|
|
240
240
|
value: "3006477107"
|
|
241
|
-
- name:
|
|
241
|
+
- name: PUBLISHER_MEMORY_BACKPRESSURE_ENABLED
|
|
242
242
|
value: "true"
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
If you want a soft-launch where the governor reports but doesn't act, deploy first with `
|
|
245
|
+
If you want a soft-launch where the governor reports but doesn't act, deploy first with `PUBLISHER_MEMORY_BACKPRESSURE_ENABLED=false`, watch the `publisher_process_rss_bytes` series for a week, then enable.
|
|
246
246
|
|
|
247
247
|
## BigQuery credentials
|
|
248
248
|
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Run bare like that, the package comes with a small sample dataset, so there is s
|
|
|
23
23
|
**Existing directory of models?** Write a `publisher.config.json` beside a package directory that holds a `publisher.json`, then run the server pointing at it:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npx @malloy-publisher/server --
|
|
26
|
+
npx @malloy-publisher/server --root . --watch-env local
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```json
|
|
@@ -51,7 +51,7 @@ Poll `curl -s http://localhost:4000/api/v0/status` until `operationalState` is `
|
|
|
51
51
|
|
|
52
52
|
## Configuration
|
|
53
53
|
|
|
54
|
-
Two example configs ship in the npm package, beside this README: [`publisher.config.example.duckdb.json`](./publisher.config.example.duckdb.json) (the GitHub-hosted sample packages, no connection block) and [`publisher.config.example.bigquery.json`](./publisher.config.example.bigquery.json) (adds a BigQuery connection). Copy either one to `publisher.config.json` and point `--
|
|
54
|
+
Two example configs ship in the npm package, beside this README: [`publisher.config.example.duckdb.json`](./publisher.config.example.duckdb.json) (the GitHub-hosted sample packages, no connection block) and [`publisher.config.example.bigquery.json`](./publisher.config.example.bigquery.json) (adds a BigQuery connection). Copy either one to `publisher.config.json` and point `--root` at its directory.
|
|
55
55
|
|
|
56
56
|
In a clone, the live `publisher.config.json` lives in this directory, and the repository root contains a symlink (`/publisher.config.json` → `./packages/server/publisher.config.json`) so that running the server from either location picks up the same config. Edit one and you've edited both.
|
|
57
57
|
|
package/dist/admin-api-doc.yaml
CHANGED
|
@@ -339,21 +339,11 @@ paths:
|
|
|
339
339
|
summary: Create or replace a table from a source
|
|
340
340
|
description: |
|
|
341
341
|
The schema may not be the one a storage destination builds into
|
|
342
|
-
(`409 SCHEMA_IS_DESTINATION`, below)
|
|
342
|
+
(`409 SCHEMA_IS_DESTINATION`, below).
|
|
343
343
|
|
|
344
344
|
Writes the table from `source`: one CSV, Parquet, Excel or JSON object
|
|
345
|
-
under the catalog's data path, the only location the session can read
|
|
346
|
-
|
|
347
|
-
copy: from another catalog, attached read-only as its own owner, or
|
|
348
|
-
from within this one). A missing source catalog, schema or table is
|
|
349
|
-
`404 SOURCE_NOT_FOUND`; a source catalog owned by a role the configured
|
|
350
|
-
role cannot act as is `409 CATALOG_OWNER_UNSUPPORTED`; and a copy from an
|
|
351
|
-
encrypted catalog into an unencrypted one is refused (`400
|
|
352
|
-
INVALID_REQUEST`), since it would write the rows unencrypted. A copy
|
|
353
|
-
keeps the source table's partition spec and writes its rows in
|
|
354
|
-
partition order; a partitioned table copied onto itself is refused
|
|
355
|
-
(`400 INVALID_REQUEST`). Either way
|
|
356
|
-
the bytes are rewritten as the catalog's own Parquet, never registered
|
|
345
|
+
under the catalog's data path, the only location the session can read.
|
|
346
|
+
The bytes are rewritten as the catalog's own Parquet, never registered
|
|
357
347
|
in place and never left as rows in the catalog database, so an
|
|
358
348
|
encrypted catalog stays encrypted. One DuckLake transaction:
|
|
359
349
|
a reader sees the old table or the new one. A file the reader refuses
|
|
@@ -406,7 +396,7 @@ paths:
|
|
|
406
396
|
$ref: "#/components/responses/NotFound"
|
|
407
397
|
"409":
|
|
408
398
|
description: |
|
|
409
|
-
|
|
399
|
+
The schema is the one a storage destination of an environment on this server builds into in this catalog (`SCHEMA_IS_DESTINATION`)
|
|
410
400
|
content:
|
|
411
401
|
application/json:
|
|
412
402
|
schema:
|
|
@@ -424,7 +414,7 @@ paths:
|
|
|
424
414
|
schema:
|
|
425
415
|
$ref: "#/components/schemas/Error"
|
|
426
416
|
"503":
|
|
427
|
-
description: No catalog database is configured (`CATALOG_DATABASE_NOT_CONFIGURED`), or this server is already running a load or
|
|
417
|
+
description: No catalog database is configured (`CATALOG_DATABASE_NOT_CONFIGURED`), or this server is already running a load or table write (`LOAD_BUSY`); the write was refused, not queued, so retry
|
|
428
418
|
content:
|
|
429
419
|
application/json:
|
|
430
420
|
schema:
|
|
@@ -522,7 +512,7 @@ paths:
|
|
|
522
512
|
|
|
523
513
|
One table loads at a time, across every replica of this server (a
|
|
524
514
|
Postgres advisory lock in the catalog database), and one load runs at a
|
|
525
|
-
time on this server (the same slot a table PUT
|
|
515
|
+
time on this server (the same slot a table PUT takes). A
|
|
526
516
|
load that finds either busy is refused with `503 LOAD_BUSY` and nothing
|
|
527
517
|
written, never queued: retry it. A load whose lock is lost before it
|
|
528
518
|
commits rolls back and answers the same. A load first ends any
|
|
@@ -943,7 +933,7 @@ components:
|
|
|
943
933
|
schema:
|
|
944
934
|
$ref: "#/components/schemas/Error"
|
|
945
935
|
NotFound:
|
|
946
|
-
description: No such catalog (`CATALOG_NOT_FOUND`), schema (`SCHEMA_NOT_FOUND`) or table (`TABLE_NOT_FOUND`),
|
|
936
|
+
description: No such catalog (`CATALOG_NOT_FOUND`), schema (`SCHEMA_NOT_FOUND`) or table (`TABLE_NOT_FOUND`), or no such load (`LOAD_NOT_FOUND`)
|
|
947
937
|
content:
|
|
948
938
|
application/json:
|
|
949
939
|
schema:
|
|
@@ -1122,9 +1112,7 @@ components:
|
|
|
1122
1112
|
required: [source]
|
|
1123
1113
|
properties:
|
|
1124
1114
|
source:
|
|
1125
|
-
|
|
1126
|
-
- $ref: "#/components/schemas/ObjectSource"
|
|
1127
|
-
- $ref: "#/components/schemas/CatalogTableSource"
|
|
1115
|
+
$ref: "#/components/schemas/ObjectSource"
|
|
1128
1116
|
|
|
1129
1117
|
ObjectSource:
|
|
1130
1118
|
type: object
|
|
@@ -1152,24 +1140,6 @@ components:
|
|
|
1152
1140
|
additionalProperties: false
|
|
1153
1141
|
additionalProperties: false
|
|
1154
1142
|
|
|
1155
|
-
CatalogTableSource:
|
|
1156
|
-
type: object
|
|
1157
|
-
required: [catalog, schema, table]
|
|
1158
|
-
description: |
|
|
1159
|
-
A table of a catalog in the same catalog database: the target catalog
|
|
1160
|
-
itself, or another one the configured role can act as the owner of.
|
|
1161
|
-
Added for one migration, moving an orchestrator's tables out of its
|
|
1162
|
-
legacy per-organization catalogs into per-database ones without
|
|
1163
|
-
rebuilding them; it can be removed once those legacy catalogs are dropped.
|
|
1164
|
-
properties:
|
|
1165
|
-
catalog:
|
|
1166
|
-
$ref: "#/components/schemas/Identifier"
|
|
1167
|
-
schema:
|
|
1168
|
-
$ref: "#/components/schemas/Identifier"
|
|
1169
|
-
table:
|
|
1170
|
-
$ref: "#/components/schemas/Identifier"
|
|
1171
|
-
additionalProperties: false
|
|
1172
|
-
|
|
1173
1143
|
LoadRequest:
|
|
1174
1144
|
type: object
|
|
1175
1145
|
required: [mode, objects]
|
|
@@ -1397,7 +1367,7 @@ components:
|
|
|
1397
1367
|
Machine-readable: CATALOG_NOT_FOUND, CATALOG_EXISTS,
|
|
1398
1368
|
CATALOG_DATABASE_NOT_CONFIGURED, CATALOG_OWNER_UNSUPPORTED,
|
|
1399
1369
|
CATALOG_SETTING_UNREADABLE, SCHEMA_NOT_FOUND, TABLE_NOT_FOUND,
|
|
1400
|
-
|
|
1370
|
+
TABLE_EXISTS, OBJECT_OUTSIDE_DATA_PATH,
|
|
1401
1371
|
INVALID_REQUEST, SCHEMA_EXISTS, SCHEMA_RESERVED,
|
|
1402
1372
|
SCHEMA_IS_DESTINATION, LOAD_BUSY,
|
|
1403
1373
|
LOAD_CONFLICT, LOAD_COLUMN_MISMATCH, LOAD_DELETE_LIMIT_EXCEEDED,
|
|
@@ -1418,8 +1388,7 @@ components:
|
|
|
1418
1388
|
sets none) that a storage destination of an environment on this
|
|
1419
1389
|
server builds into in this catalog, which Publisher builds; the
|
|
1420
1390
|
message names the environment and the destination, and tables you
|
|
1421
|
-
write belong in another schema. A table DELETE there is allowed
|
|
1422
|
-
a copy may read its source from it. A connection's
|
|
1391
|
+
write belong in another schema. A table DELETE there is allowed. A connection's
|
|
1423
1392
|
`destinationSchema` is not a destination's. The check reads the
|
|
1424
1393
|
environments the server has loaded, so an admin-only listener, with
|
|
1425
1394
|
no environments, a server still loading its environments, and an
|