@malloy-publisher/server 0.9.4 → 0.9.6
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 +121 -13
- package/dist/app/assets/{EnvironmentPage-uo3igcP9.js → EnvironmentPage-wGTml4WZ.js} +1 -1
- package/dist/app/assets/{HomePage-0OQVchl4.js → HomePage-BPFJHBxN.js} +1 -1
- package/dist/app/assets/{MainPage-D4SOACdm.js → MainPage-CNLgQje2.js} +1 -1
- package/dist/app/assets/{ModelPage-B5CpdEDl.js → ModelPage-Br6I_s4J.js} +2 -2
- package/dist/app/assets/{PackagePage-BzUfTQKy.js → PackagePage-B6lmG1Uq.js} +1 -1
- package/dist/app/assets/{RenderedResult-DwB0-9Yx.es-1MzhmBXH.js → RenderedResult-BUb2Xvr2.es-17Y63pbB.js} +14 -2
- package/dist/app/assets/{RouteError-BXcrPjvD.js → RouteError-B4yUUZFj.js} +1 -1
- package/dist/app/assets/{ThemeEditorPage-FpYg5NPt.js → ThemeEditorPage-CjK8EVnV.js} +1 -1
- package/dist/app/assets/{ToggleButtonGroup-Vkkjsbxx.js → ToggleButtonGroup-BKiI79mw.js} +1 -1
- package/dist/app/assets/{documentRoutes-BWHzvbNO.js → documentRoutes-D_78AAbq.js} +1 -1
- package/dist/app/assets/{index-DFvJYp4Q.js → index-B3woRPfQ.js} +1 -1
- package/dist/app/assets/{index-BZEvIUf-.js → index-BIqIsMFr.js} +100 -100
- package/dist/app/assets/{index-CprgMbE_.js → index-CfX148tj.js} +1 -1
- package/dist/app/assets/{index-NVPzfbUZ.js → index-dQ3jNgKw.js} +1 -1
- package/dist/app/assets/index.es-Bhhg6pWY.js +195 -0
- package/dist/app/index.html +1 -1
- package/dist/package_load_worker.mjs +134 -70
- package/dist/runtime/publisher.js +1 -1
- package/dist/server.mjs +3497 -2814
- package/dist/sshcrypto-cqb52edz.node +0 -0
- package/package.json +1 -1
- package/dist/app/assets/index.es-D2Ts8adM.js +0 -195
package/dist/app/index.html
CHANGED
|
@@ -16,7 +16,7 @@ SPDX-License-Identifier: MIT
|
|
|
16
16
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
17
17
|
/>
|
|
18
18
|
<title>Malloy Publisher</title>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-BIqIsMFr.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
@@ -1108,10 +1108,14 @@ var require_recursive_readdir = __commonJS((exports, module) => {
|
|
|
1108
1108
|
|
|
1109
1109
|
// src/constants.ts
|
|
1110
1110
|
import os from "os";
|
|
1111
|
+
import path from "path";
|
|
1112
|
+
function installRecordPath(environmentPath, packageName) {
|
|
1113
|
+
return path.join(environmentPath, PACKAGE_INSTALL_RECORDS_DIR, `${packageName}.json`);
|
|
1114
|
+
}
|
|
1111
1115
|
function normalizeModelPath(p) {
|
|
1112
1116
|
return p.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
1113
1117
|
}
|
|
1114
|
-
var API_PREFIX = "/api/v0", README_NAME = "README.md", PUBLISHER_CONFIG_NAME = "publisher.config.json", PACKAGE_MANIFEST_NAME = "publisher.json", MODEL_FILE_SUFFIX = ".malloy", NOTEBOOK_FILE_SUFFIX = ".malloynb", INDEX_MODEL_NAME = "index.malloy", DEFAULT_QUERY_ROW_LIMIT = 1000, DEFAULT_MAX_QUERY_ROWS = 1e5, DEFAULT_MAX_RESPONSE_BYTES = 50000000, DEFAULT_QUERY_TIMEOUT_MS = 300000, DEFAULT_MAX_CONCURRENT_QUERIES = 32, TEMP_DIR_PATH, PUBLISHER_DATA_DIR = "publisher_data";
|
|
1118
|
+
var API_PREFIX = "/api/v0", README_NAME = "README.md", PUBLISHER_CONFIG_NAME = "publisher.config.json", PACKAGE_MANIFEST_NAME = "publisher.json", PACKAGE_INSTALL_RECORDS_DIR = ".install-records", MODEL_FILE_SUFFIX = ".malloy", NOTEBOOK_FILE_SUFFIX = ".malloynb", INDEX_MODEL_NAME = "index.malloy", DEFAULT_QUERY_ROW_LIMIT = 1000, DEFAULT_MAX_QUERY_ROWS = 1e5, DEFAULT_MAX_RESPONSE_BYTES = 50000000, DEFAULT_QUERY_TIMEOUT_MS = 300000, DEFAULT_MAX_CONCURRENT_QUERIES = 32, DEFAULT_POSTGRES_POOL_MAX = 5, TEMP_DIR_PATH, PUBLISHER_DATA_DIR = "publisher_data";
|
|
1115
1119
|
var init_constants = __esm(() => {
|
|
1116
1120
|
TEMP_DIR_PATH = os.tmpdir();
|
|
1117
1121
|
});
|
|
@@ -11028,7 +11032,7 @@ var require_tail_file = __commonJS((exports, module) => {
|
|
|
11028
11032
|
// ../../node_modules/winston/lib/winston/transports/file.js
|
|
11029
11033
|
var require_file = __commonJS((exports, module) => {
|
|
11030
11034
|
var fs = __require("fs");
|
|
11031
|
-
var
|
|
11035
|
+
var path2 = __require("path");
|
|
11032
11036
|
var asyncSeries = require_series();
|
|
11033
11037
|
var zlib = __require("zlib");
|
|
11034
11038
|
var { MESSAGE } = require_triple_beam();
|
|
@@ -11053,14 +11057,14 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11053
11057
|
this._onError = this._onError.bind(this);
|
|
11054
11058
|
if (options.filename || options.dirname) {
|
|
11055
11059
|
throwIf("filename or dirname", "stream");
|
|
11056
|
-
this._basename = this.filename = options.filename ?
|
|
11057
|
-
this.dirname = options.dirname ||
|
|
11060
|
+
this._basename = this.filename = options.filename ? path2.basename(options.filename) : "winston.log";
|
|
11061
|
+
this.dirname = options.dirname || path2.dirname(options.filename);
|
|
11058
11062
|
this.options = options.options || { flags: "a" };
|
|
11059
11063
|
} else if (options.stream) {
|
|
11060
11064
|
console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream");
|
|
11061
11065
|
throwIf("stream", "filename", "maxsize");
|
|
11062
11066
|
this._dest = this._stream.pipe(this._setupStream(options.stream));
|
|
11063
|
-
this.dirname =
|
|
11067
|
+
this.dirname = path2.dirname(this._dest.path);
|
|
11064
11068
|
} else {
|
|
11065
11069
|
throw new Error("Cannot log to file without filename or stream.");
|
|
11066
11070
|
}
|
|
@@ -11190,7 +11194,7 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11190
11194
|
options = {};
|
|
11191
11195
|
}
|
|
11192
11196
|
options = normalizeQuery(options);
|
|
11193
|
-
const file =
|
|
11197
|
+
const file = path2.join(this.dirname, this.filename);
|
|
11194
11198
|
let buff = "";
|
|
11195
11199
|
let results = [];
|
|
11196
11200
|
let row = 0;
|
|
@@ -11290,7 +11294,7 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11290
11294
|
}
|
|
11291
11295
|
}
|
|
11292
11296
|
stream(options = {}) {
|
|
11293
|
-
const file =
|
|
11297
|
+
const file = path2.join(this.dirname, this.filename);
|
|
11294
11298
|
const stream = new Stream;
|
|
11295
11299
|
const tail = {
|
|
11296
11300
|
file,
|
|
@@ -11333,7 +11337,7 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11333
11337
|
}
|
|
11334
11338
|
stat(callback) {
|
|
11335
11339
|
const target = this._getFile();
|
|
11336
|
-
const fullpath =
|
|
11340
|
+
const fullpath = path2.join(this.dirname, target);
|
|
11337
11341
|
fs.stat(fullpath, (err, stat) => {
|
|
11338
11342
|
if (err && err.code === "ENOENT") {
|
|
11339
11343
|
debug("ENOENT ok", fullpath);
|
|
@@ -11394,7 +11398,7 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11394
11398
|
}
|
|
11395
11399
|
}
|
|
11396
11400
|
_createStream(source) {
|
|
11397
|
-
const fullpath =
|
|
11401
|
+
const fullpath = path2.join(this.dirname, this.filename);
|
|
11398
11402
|
debug("create stream start", fullpath, this.options);
|
|
11399
11403
|
const dest = fs.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
|
|
11400
11404
|
debug("file open ok", fullpath);
|
|
@@ -11414,13 +11418,13 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11414
11418
|
}
|
|
11415
11419
|
_incFile(callback) {
|
|
11416
11420
|
debug("_incFile", this.filename);
|
|
11417
|
-
const ext =
|
|
11418
|
-
const basename =
|
|
11421
|
+
const ext = path2.extname(this._basename);
|
|
11422
|
+
const basename = path2.basename(this._basename, ext);
|
|
11419
11423
|
const tasks = [];
|
|
11420
11424
|
if (this.zippedArchive) {
|
|
11421
11425
|
tasks.push(function(cb) {
|
|
11422
11426
|
const num = this._created > 0 && !this.tailable ? this._created : "";
|
|
11423
|
-
this._compressFile(
|
|
11427
|
+
this._compressFile(path2.join(this.dirname, `${basename}${num}${ext}`), path2.join(this.dirname, `${basename}${num}${ext}.gz`), cb);
|
|
11424
11428
|
}.bind(this));
|
|
11425
11429
|
}
|
|
11426
11430
|
tasks.push(function(cb) {
|
|
@@ -11434,8 +11438,8 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11434
11438
|
asyncSeries(tasks, callback);
|
|
11435
11439
|
}
|
|
11436
11440
|
_getFile() {
|
|
11437
|
-
const ext =
|
|
11438
|
-
const basename =
|
|
11441
|
+
const ext = path2.extname(this._basename);
|
|
11442
|
+
const basename = path2.basename(this._basename, ext);
|
|
11439
11443
|
const isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
|
|
11440
11444
|
return !this.tailable && this._created ? `${basename}${isRotation}${ext}` : `${basename}${ext}`;
|
|
11441
11445
|
}
|
|
@@ -11447,7 +11451,7 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11447
11451
|
const isOldest = oldest !== 0 ? oldest : "";
|
|
11448
11452
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
11449
11453
|
const filePath = `${basename}${isOldest}${ext}${isZipped}`;
|
|
11450
|
-
const target =
|
|
11454
|
+
const target = path2.join(this.dirname, filePath);
|
|
11451
11455
|
fs.unlink(target, callback);
|
|
11452
11456
|
}
|
|
11453
11457
|
_checkMaxFilesTailable(ext, basename, callback) {
|
|
@@ -11459,18 +11463,18 @@ var require_file = __commonJS((exports, module) => {
|
|
|
11459
11463
|
for (let x = this.maxFiles - 1;x > 1; x--) {
|
|
11460
11464
|
tasks.push(function(i, cb) {
|
|
11461
11465
|
let fileName = `${basename}${i - 1}${ext}${isZipped}`;
|
|
11462
|
-
const tmppath =
|
|
11466
|
+
const tmppath = path2.join(this.dirname, fileName);
|
|
11463
11467
|
fs.exists(tmppath, (exists) => {
|
|
11464
11468
|
if (!exists) {
|
|
11465
11469
|
return cb(null);
|
|
11466
11470
|
}
|
|
11467
11471
|
fileName = `${basename}${i}${ext}${isZipped}`;
|
|
11468
|
-
fs.rename(tmppath,
|
|
11472
|
+
fs.rename(tmppath, path2.join(this.dirname, fileName), cb);
|
|
11469
11473
|
});
|
|
11470
11474
|
}.bind(this, x));
|
|
11471
11475
|
}
|
|
11472
11476
|
asyncSeries(tasks, () => {
|
|
11473
|
-
fs.rename(
|
|
11477
|
+
fs.rename(path2.join(this.dirname, `${basename}${ext}${isZipped}`), path2.join(this.dirname, `${basename}1${ext}${isZipped}`), callback);
|
|
11474
11478
|
});
|
|
11475
11479
|
}
|
|
11476
11480
|
_compressFile(src, dest, callback) {
|
|
@@ -11552,9 +11556,9 @@ var require_http = __commonJS((exports, module) => {
|
|
|
11552
11556
|
};
|
|
11553
11557
|
const auth = options.params.auth || null;
|
|
11554
11558
|
delete options.params.auth;
|
|
11555
|
-
const
|
|
11559
|
+
const path2 = options.params.path || null;
|
|
11556
11560
|
delete options.params.path;
|
|
11557
|
-
this._request(options, auth,
|
|
11561
|
+
this._request(options, auth, path2, (err, res, body) => {
|
|
11558
11562
|
if (res && res.statusCode !== 200) {
|
|
11559
11563
|
err = new Error(`Invalid HTTP Status Code: ${res.statusCode}`);
|
|
11560
11564
|
}
|
|
@@ -11577,12 +11581,12 @@ var require_http = __commonJS((exports, module) => {
|
|
|
11577
11581
|
method: "stream",
|
|
11578
11582
|
params: options
|
|
11579
11583
|
};
|
|
11580
|
-
const
|
|
11584
|
+
const path2 = options.params.path || null;
|
|
11581
11585
|
delete options.params.path;
|
|
11582
11586
|
const auth = options.params.auth || null;
|
|
11583
11587
|
delete options.params.auth;
|
|
11584
11588
|
let buff = "";
|
|
11585
|
-
const req = this._request(options, auth,
|
|
11589
|
+
const req = this._request(options, auth, path2);
|
|
11586
11590
|
stream.destroy = () => req.destroy();
|
|
11587
11591
|
req.on("data", (data) => {
|
|
11588
11592
|
data = (buff + data).split(/\n+/);
|
|
@@ -11600,40 +11604,40 @@ var require_http = __commonJS((exports, module) => {
|
|
|
11600
11604
|
req.on("error", (err) => stream.emit("error", err));
|
|
11601
11605
|
return stream;
|
|
11602
11606
|
}
|
|
11603
|
-
_request(options, auth,
|
|
11607
|
+
_request(options, auth, path2, callback) {
|
|
11604
11608
|
options = options || {};
|
|
11605
11609
|
auth = auth || this.auth;
|
|
11606
|
-
|
|
11610
|
+
path2 = path2 || this.path || "";
|
|
11607
11611
|
if (this.batch) {
|
|
11608
|
-
this._doBatch(options, callback, auth,
|
|
11612
|
+
this._doBatch(options, callback, auth, path2);
|
|
11609
11613
|
} else {
|
|
11610
|
-
this._doRequest(options, callback, auth,
|
|
11614
|
+
this._doRequest(options, callback, auth, path2);
|
|
11611
11615
|
}
|
|
11612
11616
|
}
|
|
11613
|
-
_doBatch(options, callback, auth,
|
|
11617
|
+
_doBatch(options, callback, auth, path2) {
|
|
11614
11618
|
this.batchOptions.push(options);
|
|
11615
11619
|
if (this.batchOptions.length === 1) {
|
|
11616
11620
|
const me = this;
|
|
11617
11621
|
this.batchCallback = callback;
|
|
11618
11622
|
this.batchTimeoutID = setTimeout(function() {
|
|
11619
11623
|
me.batchTimeoutID = -1;
|
|
11620
|
-
me._doBatchRequest(me.batchCallback, auth,
|
|
11624
|
+
me._doBatchRequest(me.batchCallback, auth, path2);
|
|
11621
11625
|
}, this.batchInterval);
|
|
11622
11626
|
}
|
|
11623
11627
|
if (this.batchOptions.length === this.batchCount) {
|
|
11624
|
-
this._doBatchRequest(this.batchCallback, auth,
|
|
11628
|
+
this._doBatchRequest(this.batchCallback, auth, path2);
|
|
11625
11629
|
}
|
|
11626
11630
|
}
|
|
11627
|
-
_doBatchRequest(callback, auth,
|
|
11631
|
+
_doBatchRequest(callback, auth, path2) {
|
|
11628
11632
|
if (this.batchTimeoutID > 0) {
|
|
11629
11633
|
clearTimeout(this.batchTimeoutID);
|
|
11630
11634
|
this.batchTimeoutID = -1;
|
|
11631
11635
|
}
|
|
11632
11636
|
const batchOptionsCopy = this.batchOptions.slice();
|
|
11633
11637
|
this.batchOptions = [];
|
|
11634
|
-
this._doRequest(batchOptionsCopy, callback, auth,
|
|
11638
|
+
this._doRequest(batchOptionsCopy, callback, auth, path2);
|
|
11635
11639
|
}
|
|
11636
|
-
_doRequest(options, callback, auth,
|
|
11640
|
+
_doRequest(options, callback, auth, path2) {
|
|
11637
11641
|
const headers = Object.assign({}, this.headers);
|
|
11638
11642
|
if (auth && auth.bearer) {
|
|
11639
11643
|
headers.Authorization = `Bearer ${auth.bearer}`;
|
|
@@ -11643,7 +11647,7 @@ var require_http = __commonJS((exports, module) => {
|
|
|
11643
11647
|
method: "POST",
|
|
11644
11648
|
host: this.host,
|
|
11645
11649
|
port: this.port,
|
|
11646
|
-
path: `/${
|
|
11650
|
+
path: `/${path2.replace(/^\//, "")}`,
|
|
11647
11651
|
headers,
|
|
11648
11652
|
auth: auth && auth.username && auth.password ? `${auth.username}:${auth.password}` : "",
|
|
11649
11653
|
agent: this.agent
|
|
@@ -13082,13 +13086,13 @@ function messageWithFilesystemCause(error) {
|
|
|
13082
13086
|
return `${message}: ${describeFilesystemAccessFailure(access)}`;
|
|
13083
13087
|
}
|
|
13084
13088
|
function errnoWireFields(error) {
|
|
13085
|
-
const { code, syscall, path } = error;
|
|
13089
|
+
const { code, syscall, path: path2 } = error;
|
|
13086
13090
|
if (typeof code !== "string")
|
|
13087
13091
|
return;
|
|
13088
13092
|
return {
|
|
13089
13093
|
code,
|
|
13090
13094
|
...typeof syscall === "string" ? { syscall } : {},
|
|
13091
|
-
...typeof
|
|
13095
|
+
...typeof path2 === "string" ? { path: path2 } : {}
|
|
13092
13096
|
};
|
|
13093
13097
|
}
|
|
13094
13098
|
function internalErrorToHttpError(error, { log = true } = {}) {
|
|
@@ -13195,7 +13199,7 @@ function toQueryTextProblem(problem) {
|
|
|
13195
13199
|
...problem.at ? { at: { range: problem.at.range } } : {}
|
|
13196
13200
|
};
|
|
13197
13201
|
}
|
|
13198
|
-
var GENERIC_INTERNAL_MESSAGE = "Internal server error.", GENERIC_UPSTREAM_MESSAGE = "Upstream connection error.", MAX_LOGGED_DETAIL_CHARS = 2000, FILESYSTEM_ACCESS_DESCRIPTIONS, NotImplementedError, BadRequestError, InvalidArgumentError, CompileRefusedError, RenderTagRefusedError, UnparseableTextError, EnvironmentNotFoundError, PackageNotFoundError, ModelNotFoundError, DashboardNotFoundError, ConnectionNotFoundError, TableNotFoundError, ConnectionError, DestinationNotFoundError, ConnectionAuthError, UnsupportedCatalogFormatError, ModelCompilationError, PackageManifestError, MaterializationEligibilityError, PublisherConfigError, ServerConfigurationError, FrozenConfigError, AccessDeniedError, QueryCompileError, NotQueryableError, OffSurfaceError, MaterializationNotFoundError, MaterializationConflictError, WriteConflictError, WriteRolledBackError, WriteVerifyError, InvalidStateTransitionError, ServiceUnavailableError, PayloadTooLargeError, ResponseUnserializableError, QueryTimeoutError;
|
|
13202
|
+
var GENERIC_INTERNAL_MESSAGE = "Internal server error.", GENERIC_UPSTREAM_MESSAGE = "Upstream connection error.", MAX_LOGGED_DETAIL_CHARS = 2000, FILESYSTEM_ACCESS_DESCRIPTIONS, NotImplementedError, BadRequestError, InvalidArgumentError, CompileRefusedError, RenderTagRefusedError, UnparseableTextError, EnvironmentNotFoundError, PackageNotFoundError, ModelNotFoundError, DashboardNotFoundError, ConnectionNotFoundError, TableNotFoundError, ConnectionError, ConnectionPoolExhaustedError, DestinationNotFoundError, ConnectionAuthError, UnsupportedCatalogFormatError, ModelCompilationError, PackageManifestError, MaterializationEligibilityError, ChainedUpstreamMissingError, ChainedShapeNotCarriedError, PublisherConfigError, ServerConfigurationError, FrozenConfigError, AccessDeniedError, QueryCompileError, NotQueryableError, OffSurfaceError, MaterializationNotFoundError, MaterializationConflictError, WriteConflictError, WriteRolledBackError, WriteVerifyError, InvalidStateTransitionError, ServiceUnavailableError, PackageAdmissionRefusedError, PayloadTooLargeError, ResponseUnserializableError, QueryTimeoutError;
|
|
13199
13203
|
var init_errors = __esm(() => {
|
|
13200
13204
|
init_constants();
|
|
13201
13205
|
init_logger();
|
|
@@ -13264,6 +13268,12 @@ var init_errors = __esm(() => {
|
|
|
13264
13268
|
this.callerSafe = options?.callerSafe ?? false;
|
|
13265
13269
|
}
|
|
13266
13270
|
};
|
|
13271
|
+
ConnectionPoolExhaustedError = class ConnectionPoolExhaustedError extends ConnectionError {
|
|
13272
|
+
constructor(message) {
|
|
13273
|
+
super(message, { callerSafe: true });
|
|
13274
|
+
this.name = "ConnectionPoolExhaustedError";
|
|
13275
|
+
}
|
|
13276
|
+
};
|
|
13267
13277
|
DestinationNotFoundError = class DestinationNotFoundError extends Error {
|
|
13268
13278
|
constructor(message) {
|
|
13269
13279
|
super(message);
|
|
@@ -13298,6 +13308,20 @@ var init_errors = __esm(() => {
|
|
|
13298
13308
|
this.reason = error.reason;
|
|
13299
13309
|
}
|
|
13300
13310
|
};
|
|
13311
|
+
ChainedUpstreamMissingError = class ChainedUpstreamMissingError extends Error {
|
|
13312
|
+
missing;
|
|
13313
|
+
constructor(missing, detail) {
|
|
13314
|
+
super(detail);
|
|
13315
|
+
this.name = "ChainedUpstreamMissingError";
|
|
13316
|
+
this.missing = missing;
|
|
13317
|
+
}
|
|
13318
|
+
};
|
|
13319
|
+
ChainedShapeNotCarriedError = class ChainedShapeNotCarriedError extends Error {
|
|
13320
|
+
constructor(detail) {
|
|
13321
|
+
super(detail);
|
|
13322
|
+
this.name = "ChainedShapeNotCarriedError";
|
|
13323
|
+
}
|
|
13324
|
+
};
|
|
13301
13325
|
PublisherConfigError = class PublisherConfigError extends Error {
|
|
13302
13326
|
constructor(configName, cause) {
|
|
13303
13327
|
super(`Could not read ${configName}: ${cause instanceof Error ? cause.message : String(cause)}. Fix the file, or move it aside to fall back to the bundled default.`);
|
|
@@ -13378,6 +13402,8 @@ var init_errors = __esm(() => {
|
|
|
13378
13402
|
super(message, options);
|
|
13379
13403
|
}
|
|
13380
13404
|
};
|
|
13405
|
+
PackageAdmissionRefusedError = class PackageAdmissionRefusedError extends ServiceUnavailableError {
|
|
13406
|
+
};
|
|
13381
13407
|
PayloadTooLargeError = class PayloadTooLargeError extends Error {
|
|
13382
13408
|
constructor(message) {
|
|
13383
13409
|
super(message);
|
|
@@ -14006,6 +14032,32 @@ var init_error_wire = __esm(() => {
|
|
|
14006
14032
|
init_errors();
|
|
14007
14033
|
});
|
|
14008
14034
|
|
|
14035
|
+
// src/service/translator_error.ts
|
|
14036
|
+
import { MalloyError as MalloyError3 } from "@malloydata/malloy";
|
|
14037
|
+
function translatorInvariantProblem(error) {
|
|
14038
|
+
if (!(error instanceof Error) || error instanceof MalloyError3) {
|
|
14039
|
+
return;
|
|
14040
|
+
}
|
|
14041
|
+
const topFrame = (error.stack ?? "").split(`
|
|
14042
|
+
`).find((line) => line.trimStart().startsWith("at "));
|
|
14043
|
+
if (!topFrame || !TRANSLATOR_FRAME.test(topFrame))
|
|
14044
|
+
return;
|
|
14045
|
+
const hint = error.message === RANGE_COMPARISON_MESSAGE ? " This comes from comparing a date or timestamp to a date literal such as " + "@2025 with `~`, which Malloy cannot compile. Use `=` to match the whole " + "year, month or day (`order_date = @2025`), or an explicit range " + "(`order_date ? @2025-01-01 to @2026-01-01`)." : "";
|
|
14046
|
+
return {
|
|
14047
|
+
code: "translator-error",
|
|
14048
|
+
severity: "error",
|
|
14049
|
+
message: `Malloy could not compile this query: ${error.message}.` + hint
|
|
14050
|
+
};
|
|
14051
|
+
}
|
|
14052
|
+
function translatorMalloyError(error) {
|
|
14053
|
+
const problem = translatorInvariantProblem(error);
|
|
14054
|
+
return problem ? new MalloyError3(problem.message, [problem]) : undefined;
|
|
14055
|
+
}
|
|
14056
|
+
var TRANSLATOR_FRAME, RANGE_COMPARISON_MESSAGE = "mysterious error in range computation";
|
|
14057
|
+
var init_translator_error = __esm(() => {
|
|
14058
|
+
TRANSLATOR_FRAME = /[\\/]@malloydata[\\/]malloy[\\/]dist[\\/]lang[\\/]/;
|
|
14059
|
+
});
|
|
14060
|
+
|
|
14009
14061
|
// src/service/annotations.ts
|
|
14010
14062
|
import { Annotations } from "@malloydata/malloy";
|
|
14011
14063
|
function isReservedRoute(route) {
|
|
@@ -14398,16 +14450,16 @@ import {
|
|
|
14398
14450
|
isJoined,
|
|
14399
14451
|
isSourceDef
|
|
14400
14452
|
} from "@malloydata/malloy";
|
|
14401
|
-
function resolveFieldUsagePath(struct,
|
|
14453
|
+
function resolveFieldUsagePath(struct, path2) {
|
|
14402
14454
|
let current = struct;
|
|
14403
|
-
for (let i = 0;i <
|
|
14404
|
-
const seg =
|
|
14455
|
+
for (let i = 0;i < path2.length - 1; i++) {
|
|
14456
|
+
const seg = path2[i];
|
|
14405
14457
|
const joinField = (current.fields ?? []).find((f) => (f.as || f.name) === seg && isJoined(f) && (isSourceDef(f) || f.type === "record" || f.type === "array"));
|
|
14406
14458
|
if (!joinField)
|
|
14407
14459
|
return;
|
|
14408
14460
|
current = joinField;
|
|
14409
14461
|
}
|
|
14410
|
-
const leaf =
|
|
14462
|
+
const leaf = path2[path2.length - 1];
|
|
14411
14463
|
const field = (current.fields ?? []).find((f) => (f.as || f.name) === leaf);
|
|
14412
14464
|
return field ? { struct: current, field } : undefined;
|
|
14413
14465
|
}
|
|
@@ -14895,10 +14947,10 @@ function assertAuthorizeGrammarValid(modelDef, authorizeMap, authorizeOwnNotes,
|
|
|
14895
14947
|
}
|
|
14896
14948
|
}
|
|
14897
14949
|
}
|
|
14898
|
-
function fanoutSegment(struct,
|
|
14950
|
+
function fanoutSegment(struct, path2) {
|
|
14899
14951
|
let current = struct;
|
|
14900
|
-
for (let i = 0;i <
|
|
14901
|
-
const seg =
|
|
14952
|
+
for (let i = 0;i < path2.length - 1; i++) {
|
|
14953
|
+
const seg = path2[i];
|
|
14902
14954
|
const field = (current.fields ?? []).find((f) => (f.as ?? f.name) === seg);
|
|
14903
14955
|
if (!field)
|
|
14904
14956
|
return { segment: seg, reason: "unresolved" };
|
|
@@ -15863,16 +15915,16 @@ function parseMotly(texts) {
|
|
|
15863
15915
|
const after = parseBounded(rescued);
|
|
15864
15916
|
return { tag: after.tag, errors: [...envErrors, ...after.messages] };
|
|
15865
15917
|
}
|
|
15866
|
-
function tagText(tag, ...
|
|
15918
|
+
function tagText(tag, ...path2) {
|
|
15867
15919
|
try {
|
|
15868
|
-
return tag?.text(...
|
|
15920
|
+
return tag?.text(...path2);
|
|
15869
15921
|
} catch {
|
|
15870
15922
|
return;
|
|
15871
15923
|
}
|
|
15872
15924
|
}
|
|
15873
|
-
function tagNumeric(tag, ...
|
|
15925
|
+
function tagNumeric(tag, ...path2) {
|
|
15874
15926
|
try {
|
|
15875
|
-
const raw = tagText(tag, ...
|
|
15927
|
+
const raw = tagText(tag, ...path2);
|
|
15876
15928
|
if (raw === undefined)
|
|
15877
15929
|
return;
|
|
15878
15930
|
const DECIMAL = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
@@ -23262,8 +23314,8 @@ var require_dist = __commonJS((exports) => {
|
|
|
23262
23314
|
import {
|
|
23263
23315
|
isSourceDef as isSourceDef4
|
|
23264
23316
|
} from "@malloydata/malloy";
|
|
23265
|
-
function presentText(tag, ...
|
|
23266
|
-
const raw = tagText(tag, ...
|
|
23317
|
+
function presentText(tag, ...path2) {
|
|
23318
|
+
const raw = tagText(tag, ...path2);
|
|
23267
23319
|
return raw !== undefined && raw.trim() !== "" ? raw : undefined;
|
|
23268
23320
|
}
|
|
23269
23321
|
function readGivenControlSpec(annotationTexts2) {
|
|
@@ -23627,8 +23679,8 @@ function readDrillTag(annotations) {
|
|
|
23627
23679
|
function isString(value) {
|
|
23628
23680
|
return value !== undefined;
|
|
23629
23681
|
}
|
|
23630
|
-
function tagTextArray(tag, ...
|
|
23631
|
-
const items = tag?.array(...
|
|
23682
|
+
function tagTextArray(tag, ...path2) {
|
|
23683
|
+
const items = tag?.array(...path2);
|
|
23632
23684
|
return items?.map((item) => tagText(item)).filter(isString);
|
|
23633
23685
|
}
|
|
23634
23686
|
function resolveTileGivens(tile, facts) {
|
|
@@ -24507,10 +24559,10 @@ var init_source_extraction = __esm(() => {
|
|
|
24507
24559
|
|
|
24508
24560
|
// src/utils.ts
|
|
24509
24561
|
import * as fs2 from "fs";
|
|
24510
|
-
import * as
|
|
24562
|
+
import * as path3 from "path";
|
|
24511
24563
|
import { fileURLToPath } from "url";
|
|
24512
24564
|
function ignoreDotfiles(file) {
|
|
24513
|
-
return
|
|
24565
|
+
return path3.basename(file).startsWith(".");
|
|
24514
24566
|
}
|
|
24515
24567
|
function errMessage(err) {
|
|
24516
24568
|
return err instanceof Error ? err.message : String(err);
|
|
@@ -24519,11 +24571,11 @@ var URL_READER;
|
|
|
24519
24571
|
var init_utils = __esm(() => {
|
|
24520
24572
|
URL_READER = {
|
|
24521
24573
|
readURL: (url) => {
|
|
24522
|
-
let
|
|
24574
|
+
let path4 = url.toString();
|
|
24523
24575
|
if (url.protocol == "file:") {
|
|
24524
|
-
|
|
24576
|
+
path4 = fileURLToPath(url);
|
|
24525
24577
|
}
|
|
24526
|
-
return fs2.promises.readFile(
|
|
24578
|
+
return fs2.promises.readFile(path4, "utf8");
|
|
24527
24579
|
}
|
|
24528
24580
|
};
|
|
24529
24581
|
});
|
|
@@ -24534,6 +24586,7 @@ init_authorize_metrics();
|
|
|
24534
24586
|
init_data_styles();
|
|
24535
24587
|
init_errors();
|
|
24536
24588
|
init_error_wire();
|
|
24589
|
+
init_translator_error();
|
|
24537
24590
|
init_authorize();
|
|
24538
24591
|
init_gate_classification();
|
|
24539
24592
|
init_gate_dimension();
|
|
@@ -24550,7 +24603,7 @@ import {
|
|
|
24550
24603
|
MalloySQLStatementType
|
|
24551
24604
|
} from "@malloydata/malloy-sql";
|
|
24552
24605
|
import * as fs3 from "fs";
|
|
24553
|
-
import * as
|
|
24606
|
+
import * as path4 from "path";
|
|
24554
24607
|
import { parentPort, threadId } from "node:worker_threads";
|
|
24555
24608
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
|
|
24556
24609
|
|
|
@@ -24741,7 +24794,7 @@ var QUERYABLE_SOURCES_DEPRECATION = `"queryableSources" in publisher.json does n
|
|
|
24741
24794
|
init_errors();
|
|
24742
24795
|
import { createHash } from "crypto";
|
|
24743
24796
|
import * as fs from "fs";
|
|
24744
|
-
import * as
|
|
24797
|
+
import * as path2 from "path";
|
|
24745
24798
|
var PACKAGE_REPRESENTATIONS = ["single", "facets"];
|
|
24746
24799
|
var KEYPHRASE_MODES = ["auto", "never", "always"];
|
|
24747
24800
|
var REFINE_LEVEL_NAMES = ["LOW", "MEDIUM", "HIGH"];
|
|
@@ -24797,17 +24850,17 @@ function describe(value) {
|
|
|
24797
24850
|
return JSON.stringify(value) ?? "nothing";
|
|
24798
24851
|
}
|
|
24799
24852
|
function stepsOutside(within) {
|
|
24800
|
-
return within === ".." || within.startsWith(`..${
|
|
24853
|
+
return within === ".." || within.startsWith(`..${path2.sep}`) || path2.isAbsolute(within);
|
|
24801
24854
|
}
|
|
24802
24855
|
function resolvePromptPath(packageRoot, rel, promptKey = "keyphrase") {
|
|
24803
24856
|
const key = `retrieval.prompts.${promptKey}`;
|
|
24804
24857
|
const fix = `Fix: use a path inside the package, e.g. "prompts/${promptKey}.md".`;
|
|
24805
|
-
if (rel.includes("\x00") ||
|
|
24858
|
+
if (rel.includes("\x00") || path2.isAbsolute(rel) || /^[A-Za-z]:[\\/]/.test(rel) || rel.startsWith("\\")) {
|
|
24806
24859
|
fail(`Invalid publisher.json ${key}: ${describe(rel)} is an absolute path. ${fix}`);
|
|
24807
24860
|
}
|
|
24808
|
-
const root =
|
|
24809
|
-
const resolved =
|
|
24810
|
-
const within =
|
|
24861
|
+
const root = path2.resolve(packageRoot);
|
|
24862
|
+
const resolved = path2.resolve(root, rel);
|
|
24863
|
+
const within = path2.relative(root, resolved);
|
|
24811
24864
|
if (within === "" || stepsOutside(within)) {
|
|
24812
24865
|
fail(`Invalid publisher.json ${key}: ${describe(rel)} resolves outside the package directory. ${fix}`);
|
|
24813
24866
|
}
|
|
@@ -24932,7 +24985,7 @@ async function readPromptFile(packageRoot, key, rel) {
|
|
|
24932
24985
|
fs.promises.realpath(packageRoot),
|
|
24933
24986
|
fs.promises.realpath(file)
|
|
24934
24987
|
]);
|
|
24935
|
-
const within =
|
|
24988
|
+
const within = path2.relative(realRoot, realFile);
|
|
24936
24989
|
if (stepsOutside(within)) {
|
|
24937
24990
|
fail(`Invalid publisher.json ${at}: ${describe(rel)} resolves outside the package directory through a link. ` + `Fix: copy the file into the package.`);
|
|
24938
24991
|
}
|
|
@@ -25166,7 +25219,7 @@ function makeWorkerUrlReader(job) {
|
|
|
25166
25219
|
readURL: async (url) => {
|
|
25167
25220
|
if (url.protocol === "file:") {
|
|
25168
25221
|
const filePath = fileURLToPath2(url);
|
|
25169
|
-
if (job.replacement &&
|
|
25222
|
+
if (job.replacement && path4.resolve(filePath) === path4.resolve(job.packagePath, job.replacement.modelPath)) {
|
|
25170
25223
|
return job.replacement.source;
|
|
25171
25224
|
}
|
|
25172
25225
|
return fs3.promises.readFile(filePath, "utf8");
|
|
@@ -25218,8 +25271,18 @@ function buildWorkerMalloyConfig(job) {
|
|
|
25218
25271
|
}));
|
|
25219
25272
|
return config;
|
|
25220
25273
|
}
|
|
25274
|
+
async function readInstallRecord(packagePath) {
|
|
25275
|
+
try {
|
|
25276
|
+
const raw = await fs3.promises.readFile(installRecordPath(path4.dirname(packagePath), path4.basename(packagePath)), "utf8");
|
|
25277
|
+
const record = JSON.parse(raw);
|
|
25278
|
+
const location = typeof record === "object" && record !== null ? record.location : undefined;
|
|
25279
|
+
return typeof location === "string" && location !== "" ? location : undefined;
|
|
25280
|
+
} catch {
|
|
25281
|
+
return;
|
|
25282
|
+
}
|
|
25283
|
+
}
|
|
25221
25284
|
async function readPackageMetadata(packagePath, modelPaths) {
|
|
25222
|
-
const manifestPath =
|
|
25285
|
+
const manifestPath = path4.join(packagePath, PACKAGE_MANIFEST_NAME);
|
|
25223
25286
|
const contents = await fs3.promises.readFile(manifestPath, "utf8");
|
|
25224
25287
|
let parsed;
|
|
25225
25288
|
try {
|
|
@@ -25246,6 +25309,7 @@ async function readPackageMetadata(packagePath, modelPaths) {
|
|
|
25246
25309
|
return {
|
|
25247
25310
|
name: parsed.name,
|
|
25248
25311
|
description: parsed.description,
|
|
25312
|
+
location: await readInstallRecord(packagePath),
|
|
25249
25313
|
explores: explores.explores,
|
|
25250
25314
|
queryableSources: parsed.queryableSources === "all" ? "all" : "declared",
|
|
25251
25315
|
manifestLocation: typeof parsed.manifestLocation === "string" ? parsed.manifestLocation : null,
|
|
@@ -25257,7 +25321,7 @@ async function readPackageMetadata(packagePath, modelPaths) {
|
|
|
25257
25321
|
}
|
|
25258
25322
|
async function listPackageFiles(packagePath) {
|
|
25259
25323
|
const files = await import_recursive_readdir.default(packagePath, [ignoreDotfiles]);
|
|
25260
|
-
return files.map((full) =>
|
|
25324
|
+
return files.map((full) => path4.relative(packagePath, full).replace(/\\/g, "/")).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
25261
25325
|
}
|
|
25262
25326
|
function filterModelPaths(allRelative) {
|
|
25263
25327
|
return allRelative.filter((p) => p.endsWith(MODEL_FILE_SUFFIX) || p.endsWith(NOTEBOOK_FILE_SUFFIX));
|
|
@@ -25326,7 +25390,7 @@ function buildRuntimeForModel(job, malloyConfig) {
|
|
|
25326
25390
|
}
|
|
25327
25391
|
async function compileMalloyModel(job, malloyConfig, modelPath) {
|
|
25328
25392
|
const compileStart = performance.now();
|
|
25329
|
-
const fullPath =
|
|
25393
|
+
const fullPath = path4.join(job.packagePath, modelPath);
|
|
25330
25394
|
const modelURL = pathToFileURL(fullPath);
|
|
25331
25395
|
const importBaseURL = new URL(".", modelURL);
|
|
25332
25396
|
const { runtime, urlReader, textFor } = buildRuntimeForModel(job, malloyConfig);
|
|
@@ -25391,7 +25455,7 @@ async function compileMalloyModel(job, malloyConfig, modelPath) {
|
|
|
25391
25455
|
}
|
|
25392
25456
|
async function compileNotebookModel(job, malloyConfig, modelPath) {
|
|
25393
25457
|
const compileStart = performance.now();
|
|
25394
|
-
const fullPath =
|
|
25458
|
+
const fullPath = path4.join(job.packagePath, modelPath);
|
|
25395
25459
|
const modelURL = pathToFileURL(fullPath);
|
|
25396
25460
|
const importBaseURL = new URL(".", modelURL);
|
|
25397
25461
|
const { runtime, urlReader } = buildRuntimeForModel(job, malloyConfig);
|
|
@@ -25536,7 +25600,7 @@ async function compileOneModel(job, malloyConfig, modelPath) {
|
|
|
25536
25600
|
return {
|
|
25537
25601
|
modelPath,
|
|
25538
25602
|
modelType,
|
|
25539
|
-
compilationError: serializeError(error)
|
|
25603
|
+
compilationError: serializeError(translatorMalloyError(error) ?? error)
|
|
25540
25604
|
};
|
|
25541
25605
|
}
|
|
25542
25606
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// opts: { environment?, package?, sourceName?, queryName?, filterParams?,
|
|
12
12
|
// bypassFilters?, givens? }. givens is a name→value map bound as
|
|
13
13
|
// Malloy given: runtime parameters for this query (safe parameterization,
|
|
14
|
-
// not string interpolation) — see the malloy-html-data-
|
|
14
|
+
// not string interpolation) — see the malloy-html-data-apps skill (reference/runtime.md).
|
|
15
15
|
// - Publisher.embed(selector, { src, height?, token? })
|
|
16
16
|
// - Publisher.context ({ environment, package } inferred from URL)
|
|
17
17
|
// - Publisher.setToken(token) (override Bearer token; default uses cookies)
|