@reporting-bi/cli 0.1.12 → 0.1.14
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/index.js +163 -88
- package/package.json +32 -32
package/dist/index.js
CHANGED
|
@@ -2533,11 +2533,11 @@ var require_lib = __commonJS({
|
|
|
2533
2533
|
"../../.yarn/cache/qs-npm-6.15.0-2165244317-ff341078a7.zip/node_modules/qs/lib/index.js"(exports2, module2) {
|
|
2534
2534
|
"use strict";
|
|
2535
2535
|
var stringify = require_stringify();
|
|
2536
|
-
var
|
|
2536
|
+
var parse6 = require_parse();
|
|
2537
2537
|
var formats = require_formats();
|
|
2538
2538
|
module2.exports = {
|
|
2539
2539
|
formats,
|
|
2540
|
-
parse:
|
|
2540
|
+
parse: parse6,
|
|
2541
2541
|
stringify
|
|
2542
2542
|
};
|
|
2543
2543
|
}
|
|
@@ -6089,24 +6089,24 @@ var require_fast_uri = __commonJS({
|
|
|
6089
6089
|
function normalize(uri, options) {
|
|
6090
6090
|
if (typeof uri === "string") {
|
|
6091
6091
|
uri = /** @type {T} */
|
|
6092
|
-
serialize(
|
|
6092
|
+
serialize(parse6(uri, options), options);
|
|
6093
6093
|
} else if (typeof uri === "object") {
|
|
6094
6094
|
uri = /** @type {T} */
|
|
6095
|
-
|
|
6095
|
+
parse6(serialize(uri, options), options);
|
|
6096
6096
|
}
|
|
6097
6097
|
return uri;
|
|
6098
6098
|
}
|
|
6099
6099
|
function resolve8(baseURI, relativeURI, options) {
|
|
6100
6100
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
6101
|
-
const resolved = resolveComponent(
|
|
6101
|
+
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
6102
6102
|
schemelessOptions.skipEscape = true;
|
|
6103
6103
|
return serialize(resolved, schemelessOptions);
|
|
6104
6104
|
}
|
|
6105
6105
|
function resolveComponent(base, relative6, options, skipNormalization) {
|
|
6106
6106
|
const target = {};
|
|
6107
6107
|
if (!skipNormalization) {
|
|
6108
|
-
base =
|
|
6109
|
-
relative6 =
|
|
6108
|
+
base = parse6(serialize(base, options), options);
|
|
6109
|
+
relative6 = parse6(serialize(relative6, options), options);
|
|
6110
6110
|
}
|
|
6111
6111
|
options = options || {};
|
|
6112
6112
|
if (!options.tolerant && relative6.scheme) {
|
|
@@ -6158,13 +6158,13 @@ var require_fast_uri = __commonJS({
|
|
|
6158
6158
|
function equal(uriA, uriB, options) {
|
|
6159
6159
|
if (typeof uriA === "string") {
|
|
6160
6160
|
uriA = unescape(uriA);
|
|
6161
|
-
uriA = serialize(normalizeComponentEncoding(
|
|
6161
|
+
uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
|
|
6162
6162
|
} else if (typeof uriA === "object") {
|
|
6163
6163
|
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
6164
6164
|
}
|
|
6165
6165
|
if (typeof uriB === "string") {
|
|
6166
6166
|
uriB = unescape(uriB);
|
|
6167
|
-
uriB = serialize(normalizeComponentEncoding(
|
|
6167
|
+
uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
|
|
6168
6168
|
} else if (typeof uriB === "object") {
|
|
6169
6169
|
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
6170
6170
|
}
|
|
@@ -6233,7 +6233,7 @@ var require_fast_uri = __commonJS({
|
|
|
6233
6233
|
return uriTokens.join("");
|
|
6234
6234
|
}
|
|
6235
6235
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
6236
|
-
function
|
|
6236
|
+
function parse6(uri, opts) {
|
|
6237
6237
|
const options = Object.assign({}, opts);
|
|
6238
6238
|
const parsed = {
|
|
6239
6239
|
scheme: void 0,
|
|
@@ -6327,7 +6327,7 @@ var require_fast_uri = __commonJS({
|
|
|
6327
6327
|
resolveComponent,
|
|
6328
6328
|
equal,
|
|
6329
6329
|
serialize,
|
|
6330
|
-
parse:
|
|
6330
|
+
parse: parse6
|
|
6331
6331
|
};
|
|
6332
6332
|
module2.exports = fastUri;
|
|
6333
6333
|
module2.exports.default = fastUri;
|
|
@@ -9536,13 +9536,23 @@ var ReportingAuthClient = class {
|
|
|
9536
9536
|
}
|
|
9537
9537
|
return tokenInfo;
|
|
9538
9538
|
}
|
|
9539
|
+
/**
|
|
9540
|
+
* Revokes the session. A SAML2 session answers with `logout_url` - the caller navigates there so
|
|
9541
|
+
* the identity provider session ends too; every other session answers with an empty body.
|
|
9542
|
+
*/
|
|
9539
9543
|
async logout() {
|
|
9540
|
-
await this.fetchWithAuth(`${this.options.serviceUrl}/revoke`, {
|
|
9544
|
+
const response = await this.fetchWithAuth(`${this.options.serviceUrl}/revoke`, {
|
|
9541
9545
|
method: "GET",
|
|
9542
9546
|
headers: {
|
|
9543
9547
|
"Content-Type": "application/json"
|
|
9544
9548
|
}
|
|
9545
9549
|
});
|
|
9550
|
+
const text2 = response.ok ? await response.text() : "";
|
|
9551
|
+
try {
|
|
9552
|
+
return text2 ? JSON.parse(text2) : {};
|
|
9553
|
+
} catch {
|
|
9554
|
+
return {};
|
|
9555
|
+
}
|
|
9546
9556
|
}
|
|
9547
9557
|
redirectToLogin() {
|
|
9548
9558
|
if (typeof window === "undefined") throw new Error("Not in browser environment");
|
|
@@ -9757,13 +9767,13 @@ var Service = class extends EventTarget {
|
|
|
9757
9767
|
throw new ServiceException({ data: error48, url: response.url });
|
|
9758
9768
|
}
|
|
9759
9769
|
}
|
|
9760
|
-
async handleResponse(response,
|
|
9770
|
+
async handleResponse(response, parse6) {
|
|
9761
9771
|
if (!response.ok) {
|
|
9762
9772
|
await this.handleError(response);
|
|
9763
9773
|
return null;
|
|
9764
9774
|
}
|
|
9765
9775
|
const contentType = response.headers.get("Content-Type");
|
|
9766
|
-
if (contentType?.includes("application/json") &&
|
|
9776
|
+
if (contentType?.includes("application/json") && parse6 !== false) {
|
|
9767
9777
|
return await response.json();
|
|
9768
9778
|
} else {
|
|
9769
9779
|
return await response.text();
|
|
@@ -9921,6 +9931,12 @@ var CLIENT_SECRET = "48481427819bb41798bd74fa109c90b184ca4d64d20e60dfbe8430299f0
|
|
|
9921
9931
|
var EXIT_LOGIN_REQUIRED = 2;
|
|
9922
9932
|
var LOGIN_REQUIRED_MARKER = "rpbi: login_required";
|
|
9923
9933
|
var SPID_MARKER = "rpbi: spid";
|
|
9934
|
+
function readSqlInput(flags) {
|
|
9935
|
+
if (flags.stdin) return fs2.readFileSync(0, "utf-8");
|
|
9936
|
+
if (flags.file) return fs2.readFileSync(flags.file, "utf-8");
|
|
9937
|
+
if (flags.sql) return flags.sql;
|
|
9938
|
+
return void 0;
|
|
9939
|
+
}
|
|
9924
9940
|
var LoginRequiredError = class extends Error {
|
|
9925
9941
|
constructor(domain2, detail) {
|
|
9926
9942
|
super(`Session expired. Run "rpbi login ${domain2}" again.`);
|
|
@@ -10270,6 +10286,29 @@ function output(data, flags) {
|
|
|
10270
10286
|
console.log(data);
|
|
10271
10287
|
}
|
|
10272
10288
|
}
|
|
10289
|
+
function outputParseResult(result, flags) {
|
|
10290
|
+
const errors = result?.errors ?? [];
|
|
10291
|
+
if (flags.json) {
|
|
10292
|
+
output({ errors }, flags);
|
|
10293
|
+
return;
|
|
10294
|
+
}
|
|
10295
|
+
if (errors.length === 0) {
|
|
10296
|
+
console.log("No syntax errors.");
|
|
10297
|
+
return;
|
|
10298
|
+
}
|
|
10299
|
+
for (const error48 of errors) {
|
|
10300
|
+
console.log(error48.line ? `Line ${error48.line}: ${error48.error}` : `${error48.error}`);
|
|
10301
|
+
}
|
|
10302
|
+
process.exitCode = 1;
|
|
10303
|
+
}
|
|
10304
|
+
function errorMessage(err) {
|
|
10305
|
+
const data = err?.data;
|
|
10306
|
+
return data?.message || data?.error || (err instanceof Error ? err.message : String(err));
|
|
10307
|
+
}
|
|
10308
|
+
function fail(err, context3) {
|
|
10309
|
+
console.error(context3 ? `${context3}: ${errorMessage(err)}` : errorMessage(err));
|
|
10310
|
+
process.exit(1);
|
|
10311
|
+
}
|
|
10273
10312
|
|
|
10274
10313
|
// src/commands/accounting.ts
|
|
10275
10314
|
async function fetchAccountingName(accountingId) {
|
|
@@ -11821,12 +11860,7 @@ async function content(id, flags) {
|
|
|
11821
11860
|
}
|
|
11822
11861
|
async function exec2(id, flags) {
|
|
11823
11862
|
const service = await createService("etl", { cwd: flags.dir || "." });
|
|
11824
|
-
|
|
11825
|
-
if (flags.file) {
|
|
11826
|
-
body = fs8.readFileSync(flags.file, "utf-8");
|
|
11827
|
-
} else if (flags.sql) {
|
|
11828
|
-
body = flags.sql;
|
|
11829
|
-
}
|
|
11863
|
+
const body = readSqlInput(flags);
|
|
11830
11864
|
if (flags.output) {
|
|
11831
11865
|
const response = await service.postRaw(`exec/${id}`, body, {
|
|
11832
11866
|
csv_delimiter: " ",
|
|
@@ -11852,6 +11886,12 @@ async function exec2(id, flags) {
|
|
|
11852
11886
|
process.stdout.write(result || "");
|
|
11853
11887
|
}
|
|
11854
11888
|
}
|
|
11889
|
+
async function parse(id, flags) {
|
|
11890
|
+
const service = await createService("etl", { cwd: flags.dir || "." });
|
|
11891
|
+
const body = readSqlInput(flags) ?? await service.get(`threads/${id}/content`, void 0, { parseResponse: false }) ?? "";
|
|
11892
|
+
const result = await service.post(`parse/${id}`, body).catch((err) => fail(err, "Parse failed"));
|
|
11893
|
+
outputParseResult(result, flags);
|
|
11894
|
+
}
|
|
11855
11895
|
async function abort2(spid, flags) {
|
|
11856
11896
|
const service = await createService("etl", { cwd: flags.dir || "." });
|
|
11857
11897
|
const result = await service.get(`abort/${spid}`);
|
|
@@ -11874,11 +11914,11 @@ async function params(id, flags) {
|
|
|
11874
11914
|
if (flags.save) {
|
|
11875
11915
|
const data = JSON.parse(fs8.readFileSync(flags.save, "utf-8"));
|
|
11876
11916
|
data.id_thread ??= parseInt(id);
|
|
11877
|
-
const result = await service.post(`threads/${id}/parameters`, data);
|
|
11917
|
+
const result = await service.post(`threads/${id}/parameters`, data).catch((err) => fail(err, "Parameter not saved"));
|
|
11878
11918
|
await refreshYaml();
|
|
11879
11919
|
output(result, flags);
|
|
11880
11920
|
} else if (flags.delete) {
|
|
11881
|
-
await service.delete(`threads/${id}/parameters/${flags.delete}`);
|
|
11921
|
+
await service.delete(`threads/${id}/parameters/${flags.delete}`).catch((err) => fail(err, "Parameter not deleted"));
|
|
11882
11922
|
await refreshYaml();
|
|
11883
11923
|
console.log(`Parameter ${flags.delete} deleted.`);
|
|
11884
11924
|
} else {
|
|
@@ -11906,10 +11946,16 @@ async function etl(args) {
|
|
|
11906
11946
|
return content(rest[0], flags);
|
|
11907
11947
|
case "exec":
|
|
11908
11948
|
if (!rest[0]) {
|
|
11909
|
-
console.error('Usage: rpbi etl exec <id> [--file path] [--sql "..."]');
|
|
11949
|
+
console.error('Usage: rpbi etl exec <id> [--file path] [--sql "..."] [--stdin]');
|
|
11910
11950
|
process.exit(1);
|
|
11911
11951
|
}
|
|
11912
11952
|
return exec2(rest[0], flags);
|
|
11953
|
+
case "parse":
|
|
11954
|
+
if (!rest[0]) {
|
|
11955
|
+
console.error('Usage: rpbi etl parse <id> [--file path] [--sql "..."] [--stdin]');
|
|
11956
|
+
process.exit(1);
|
|
11957
|
+
}
|
|
11958
|
+
return parse(rest[0], flags);
|
|
11913
11959
|
case "abort":
|
|
11914
11960
|
if (!rest[0]) {
|
|
11915
11961
|
console.error("Usage: rpbi etl abort <spid>");
|
|
@@ -11939,7 +11985,7 @@ async function etl(args) {
|
|
|
11939
11985
|
case "watch":
|
|
11940
11986
|
return watch4(flags);
|
|
11941
11987
|
default:
|
|
11942
|
-
console.log("Usage: rpbi etl <list|get|content|exec|abort|search|params|pull|push|context|status|watch> [options]");
|
|
11988
|
+
console.log("Usage: rpbi etl <list|get|content|exec|parse|abort|search|params|pull|push|context|status|watch> [options]");
|
|
11943
11989
|
break;
|
|
11944
11990
|
}
|
|
11945
11991
|
}
|
|
@@ -12321,12 +12367,7 @@ async function doc(id, flags) {
|
|
|
12321
12367
|
}
|
|
12322
12368
|
async function exec3(id, flags) {
|
|
12323
12369
|
const service = await createService("deployment", { cwd: flags.dir || "." });
|
|
12324
|
-
|
|
12325
|
-
if (flags.file) {
|
|
12326
|
-
body = fs10.readFileSync(flags.file, "utf-8");
|
|
12327
|
-
} else if (flags.sql) {
|
|
12328
|
-
body = flags.sql;
|
|
12329
|
-
}
|
|
12370
|
+
const body = readSqlInput(flags);
|
|
12330
12371
|
const params3 = {};
|
|
12331
12372
|
if (flags.database) params3.database = flags.database;
|
|
12332
12373
|
if (flags.output) {
|
|
@@ -12349,6 +12390,20 @@ async function exec3(id, flags) {
|
|
|
12349
12390
|
process.stdout.write(result || "");
|
|
12350
12391
|
}
|
|
12351
12392
|
}
|
|
12393
|
+
async function parse2(id, flags) {
|
|
12394
|
+
let body = readSqlInput(flags);
|
|
12395
|
+
if (body === void 0) {
|
|
12396
|
+
if (!id) {
|
|
12397
|
+
console.error('Usage: rpbi deployment parse [<id>] [--file path] [--sql "..."] [--stdin]');
|
|
12398
|
+
process.exit(1);
|
|
12399
|
+
}
|
|
12400
|
+
const deploymentService = await createService("deployment", { cwd: flags.dir || "." });
|
|
12401
|
+
body = await deploymentService.get(`threads/${id}/content`, void 0, { parseResponse: false }) ?? "";
|
|
12402
|
+
}
|
|
12403
|
+
const service = await createService("server", { cwd: flags.dir || "." });
|
|
12404
|
+
const result = await service.post("parse", body).catch((err) => fail(err, "Parse failed"));
|
|
12405
|
+
outputParseResult(result, flags);
|
|
12406
|
+
}
|
|
12352
12407
|
async function deployment(args) {
|
|
12353
12408
|
const { positional, flags } = parseArgs(args);
|
|
12354
12409
|
const [subcommand, ...rest] = positional;
|
|
@@ -12375,10 +12430,12 @@ async function deployment(args) {
|
|
|
12375
12430
|
return doc(rest[0], flags);
|
|
12376
12431
|
case "exec":
|
|
12377
12432
|
if (!rest[0]) {
|
|
12378
|
-
console.error('Usage: rpbi deployment exec <id> [--file path] [--sql "..."] [--database all]');
|
|
12433
|
+
console.error('Usage: rpbi deployment exec <id> [--file path] [--sql "..."] [--stdin] [--database all]');
|
|
12379
12434
|
process.exit(1);
|
|
12380
12435
|
}
|
|
12381
12436
|
return exec3(rest[0], flags);
|
|
12437
|
+
case "parse":
|
|
12438
|
+
return parse2(rest[0], flags);
|
|
12382
12439
|
case "pull":
|
|
12383
12440
|
return pull3(flags);
|
|
12384
12441
|
case "push":
|
|
@@ -12388,7 +12445,7 @@ async function deployment(args) {
|
|
|
12388
12445
|
case "watch":
|
|
12389
12446
|
return watch5(flags);
|
|
12390
12447
|
default:
|
|
12391
|
-
console.log("Usage: rpbi deployment <list|get|content|doc|exec|pull|push|status|watch> [options]");
|
|
12448
|
+
console.log("Usage: rpbi deployment <list|get|content|doc|exec|parse|pull|push|status|watch> [options]");
|
|
12392
12449
|
break;
|
|
12393
12450
|
}
|
|
12394
12451
|
}
|
|
@@ -12852,11 +12909,11 @@ async function params2(id, flags) {
|
|
|
12852
12909
|
if (flags.save) {
|
|
12853
12910
|
const data = JSON.parse(fs12.readFileSync(flags.save, "utf-8"));
|
|
12854
12911
|
data.id_thread ??= parseInt(id);
|
|
12855
|
-
const result = await service.post("parameters", data);
|
|
12912
|
+
const result = await service.post("parameters", data).catch((err) => fail(err, "Parameter not saved"));
|
|
12856
12913
|
await refreshMeta();
|
|
12857
12914
|
output(result, flags);
|
|
12858
12915
|
} else if (flags.delete) {
|
|
12859
|
-
await service.delete(`parameters/${flags.delete}`);
|
|
12916
|
+
await service.delete(`parameters/${flags.delete}`).catch((err) => fail(err, "Parameter not deleted"));
|
|
12860
12917
|
await refreshMeta();
|
|
12861
12918
|
console.log(`Parameter ${flags.delete} deleted.`);
|
|
12862
12919
|
} else {
|
|
@@ -12913,12 +12970,7 @@ async function deps(flags) {
|
|
|
12913
12970
|
}
|
|
12914
12971
|
async function exec4(id, flags) {
|
|
12915
12972
|
const service = await createService("extensions", { cwd: flags.dir || "." });
|
|
12916
|
-
|
|
12917
|
-
if (flags.file) {
|
|
12918
|
-
body = fs12.readFileSync(flags.file, "utf-8");
|
|
12919
|
-
} else if (flags.sql) {
|
|
12920
|
-
body = flags.sql;
|
|
12921
|
-
}
|
|
12973
|
+
const body = readSqlInput(flags);
|
|
12922
12974
|
if (flags.output) {
|
|
12923
12975
|
const response = await service.postRaw(`exec/${id}`, body, {
|
|
12924
12976
|
csv_delimiter: " ",
|
|
@@ -12944,6 +12996,12 @@ async function exec4(id, flags) {
|
|
|
12944
12996
|
process.stdout.write(result || "");
|
|
12945
12997
|
}
|
|
12946
12998
|
}
|
|
12999
|
+
async function parse3(id, flags) {
|
|
13000
|
+
const service = await createService("extensions", { cwd: flags.dir || "." });
|
|
13001
|
+
const body = readSqlInput(flags) ?? await service.get(`queryContent/${id}`, void 0, { parseResponse: false }) ?? "";
|
|
13002
|
+
const result = await service.post(`parse/${id}`, body).catch((err) => fail(err, "Parse failed"));
|
|
13003
|
+
outputParseResult(result, flags);
|
|
13004
|
+
}
|
|
12947
13005
|
async function abort3(spid, flags) {
|
|
12948
13006
|
const service = await createService("extensions", { cwd: flags.dir || "." });
|
|
12949
13007
|
const result = await service.get(`abort/${spid}`);
|
|
@@ -12967,10 +13025,16 @@ async function ext(args) {
|
|
|
12967
13025
|
return content3(rest[0], flags);
|
|
12968
13026
|
case "exec":
|
|
12969
13027
|
if (!rest[0]) {
|
|
12970
|
-
console.error('Usage: rpbi ext exec <query_id> [--file path] [--sql "..."]');
|
|
13028
|
+
console.error('Usage: rpbi ext exec <query_id> [--file path] [--sql "..."] [--stdin]');
|
|
12971
13029
|
process.exit(1);
|
|
12972
13030
|
}
|
|
12973
13031
|
return exec4(rest[0], flags);
|
|
13032
|
+
case "parse":
|
|
13033
|
+
if (!rest[0]) {
|
|
13034
|
+
console.error('Usage: rpbi ext parse <query_id> [--file path] [--sql "..."] [--stdin]');
|
|
13035
|
+
process.exit(1);
|
|
13036
|
+
}
|
|
13037
|
+
return parse3(rest[0], flags);
|
|
12974
13038
|
case "abort":
|
|
12975
13039
|
if (!rest[0]) {
|
|
12976
13040
|
console.error("Usage: rpbi ext abort <spid>");
|
|
@@ -12994,7 +13058,7 @@ async function ext(args) {
|
|
|
12994
13058
|
case "watch":
|
|
12995
13059
|
return watch6(flags);
|
|
12996
13060
|
default:
|
|
12997
|
-
console.log("Usage: rpbi ext <projects|resources|queries|content|exec|abort|params|deps|pull|push|status|watch> [options]");
|
|
13061
|
+
console.log("Usage: rpbi ext <projects|resources|queries|content|exec|parse|abort|params|deps|pull|push|status|watch> [options]");
|
|
12998
13062
|
break;
|
|
12999
13063
|
}
|
|
13000
13064
|
}
|
|
@@ -13711,15 +13775,15 @@ var makeIssue = (params3) => {
|
|
|
13711
13775
|
message: issueData.message
|
|
13712
13776
|
};
|
|
13713
13777
|
}
|
|
13714
|
-
let
|
|
13778
|
+
let errorMessage2 = "";
|
|
13715
13779
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
13716
13780
|
for (const map2 of maps) {
|
|
13717
|
-
|
|
13781
|
+
errorMessage2 = map2(fullIssue, { data, defaultError: errorMessage2 }).message;
|
|
13718
13782
|
}
|
|
13719
13783
|
return {
|
|
13720
13784
|
...issueData,
|
|
13721
13785
|
path: fullPath,
|
|
13722
|
-
message:
|
|
13786
|
+
message: errorMessage2
|
|
13723
13787
|
};
|
|
13724
13788
|
};
|
|
13725
13789
|
function addIssueToContext(ctx, issueData) {
|
|
@@ -17475,7 +17539,7 @@ __export(core_exports2, {
|
|
|
17475
17539
|
isValidJWT: () => isValidJWT2,
|
|
17476
17540
|
locales: () => locales_exports,
|
|
17477
17541
|
meta: () => meta,
|
|
17478
|
-
parse: () =>
|
|
17542
|
+
parse: () => parse4,
|
|
17479
17543
|
parseAsync: () => parseAsync,
|
|
17480
17544
|
prettifyError: () => prettifyError,
|
|
17481
17545
|
process: () => process2,
|
|
@@ -18398,7 +18462,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
18398
18462
|
}
|
|
18399
18463
|
return result.value;
|
|
18400
18464
|
};
|
|
18401
|
-
var
|
|
18465
|
+
var parse4 = /* @__PURE__ */ _parse($ZodRealError);
|
|
18402
18466
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params3) => {
|
|
18403
18467
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
18404
18468
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -21071,10 +21135,10 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def2) =>
|
|
|
21071
21135
|
throw new Error("implement() must be called with a function");
|
|
21072
21136
|
}
|
|
21073
21137
|
return function(...args) {
|
|
21074
|
-
const parsedArgs = inst._def.input ?
|
|
21138
|
+
const parsedArgs = inst._def.input ? parse4(inst._def.input, args) : args;
|
|
21075
21139
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
21076
21140
|
if (inst._def.output) {
|
|
21077
|
-
return
|
|
21141
|
+
return parse4(inst._def.output, result);
|
|
21078
21142
|
}
|
|
21079
21143
|
return result;
|
|
21080
21144
|
};
|
|
@@ -28845,7 +28909,7 @@ var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def2) => {
|
|
|
28845
28909
|
$ZodType.init(inst, def2);
|
|
28846
28910
|
inst.def = def2;
|
|
28847
28911
|
inst.type = def2.type;
|
|
28848
|
-
inst.parse = (data, params3) =>
|
|
28912
|
+
inst.parse = (data, params3) => parse4(inst, data, params3, { callee: inst.parse });
|
|
28849
28913
|
inst.safeParse = (data, params3) => safeParse(inst, data, params3);
|
|
28850
28914
|
inst.parseAsync = async (data, params3) => parseAsync(inst, data, params3, { callee: inst.parseAsync });
|
|
28851
28915
|
inst.safeParseAsync = async (data, params3) => safeParseAsync(inst, data, params3);
|
|
@@ -29207,7 +29271,7 @@ __export(external_exports3, {
|
|
|
29207
29271
|
object: () => object2,
|
|
29208
29272
|
optional: () => optional,
|
|
29209
29273
|
overwrite: () => _overwrite,
|
|
29210
|
-
parse: () =>
|
|
29274
|
+
parse: () => parse5,
|
|
29211
29275
|
parseAsync: () => parseAsync2,
|
|
29212
29276
|
partialRecord: () => partialRecord,
|
|
29213
29277
|
pipe: () => pipe,
|
|
@@ -29552,7 +29616,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
29552
29616
|
});
|
|
29553
29617
|
|
|
29554
29618
|
// ../../.yarn/cache/zod-npm-4.3.6-a096e305e6-860d25a81a.zip/node_modules/zod/v4/classic/parse.js
|
|
29555
|
-
var
|
|
29619
|
+
var parse5 = /* @__PURE__ */ _parse(ZodRealError);
|
|
29556
29620
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
29557
29621
|
var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
29558
29622
|
var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
@@ -29595,7 +29659,7 @@ var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def2) => {
|
|
|
29595
29659
|
reg.add(inst, meta3);
|
|
29596
29660
|
return inst;
|
|
29597
29661
|
};
|
|
29598
|
-
inst.parse = (data, params3) =>
|
|
29662
|
+
inst.parse = (data, params3) => parse5(inst, data, params3, { callee: inst.parse });
|
|
29599
29663
|
inst.safeParse = (data, params3) => safeParse3(inst, data, params3);
|
|
29600
29664
|
inst.parseAsync = async (data, params3) => parseAsync2(inst, data, params3, { callee: inst.parseAsync });
|
|
29601
29665
|
inst.safeParseAsync = async (data, params3) => safeParseAsync3(inst, data, params3);
|
|
@@ -32751,19 +32815,19 @@ var getRefs = (options) => {
|
|
|
32751
32815
|
};
|
|
32752
32816
|
|
|
32753
32817
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
32754
|
-
function addErrorMessage(res, key,
|
|
32818
|
+
function addErrorMessage(res, key, errorMessage2, refs) {
|
|
32755
32819
|
if (!refs?.errorMessages)
|
|
32756
32820
|
return;
|
|
32757
|
-
if (
|
|
32821
|
+
if (errorMessage2) {
|
|
32758
32822
|
res.errorMessage = {
|
|
32759
32823
|
...res.errorMessage,
|
|
32760
|
-
[key]:
|
|
32824
|
+
[key]: errorMessage2
|
|
32761
32825
|
};
|
|
32762
32826
|
}
|
|
32763
32827
|
}
|
|
32764
|
-
function setResponseValueAndErrors(res, key, value,
|
|
32828
|
+
function setResponseValueAndErrors(res, key, value, errorMessage2, refs) {
|
|
32765
32829
|
res[key] = value;
|
|
32766
|
-
addErrorMessage(res, key,
|
|
32830
|
+
addErrorMessage(res, key, errorMessage2, refs);
|
|
32767
32831
|
}
|
|
32768
32832
|
|
|
32769
32833
|
// ../../.yarn/__virtual__/zod-to-json-schema-virtual-00ec010bf6/0/cache/zod-to-json-schema-npm-3.25.1-850d9216b4-711b30e34d.zip/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
@@ -34074,8 +34138,8 @@ var Protocol = class {
|
|
|
34074
34138
|
if (queuedMessage.type === "response") {
|
|
34075
34139
|
resolver(message);
|
|
34076
34140
|
} else {
|
|
34077
|
-
const
|
|
34078
|
-
const error48 = new McpError(
|
|
34141
|
+
const errorMessage2 = message;
|
|
34142
|
+
const error48 = new McpError(errorMessage2.error.code, errorMessage2.error.message, errorMessage2.error.data);
|
|
34079
34143
|
resolver(error48);
|
|
34080
34144
|
}
|
|
34081
34145
|
} else {
|
|
@@ -35228,23 +35292,23 @@ var Server = class extends Protocol {
|
|
|
35228
35292
|
const wrappedHandler = async (request, extra) => {
|
|
35229
35293
|
const validatedRequest = safeParse2(CallToolRequestSchema, request);
|
|
35230
35294
|
if (!validatedRequest.success) {
|
|
35231
|
-
const
|
|
35232
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${
|
|
35295
|
+
const errorMessage2 = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
35296
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage2}`);
|
|
35233
35297
|
}
|
|
35234
35298
|
const { params: params3 } = validatedRequest.data;
|
|
35235
35299
|
const result = await Promise.resolve(handler(request, extra));
|
|
35236
35300
|
if (params3.task) {
|
|
35237
35301
|
const taskValidationResult = safeParse2(CreateTaskResultSchema, result);
|
|
35238
35302
|
if (!taskValidationResult.success) {
|
|
35239
|
-
const
|
|
35240
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${
|
|
35303
|
+
const errorMessage2 = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
35304
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage2}`);
|
|
35241
35305
|
}
|
|
35242
35306
|
return taskValidationResult.data;
|
|
35243
35307
|
}
|
|
35244
35308
|
const validationResult = safeParse2(CallToolResultSchema, result);
|
|
35245
35309
|
if (!validationResult.success) {
|
|
35246
|
-
const
|
|
35247
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${
|
|
35310
|
+
const errorMessage2 = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
35311
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage2}`);
|
|
35248
35312
|
}
|
|
35249
35313
|
return validationResult.data;
|
|
35250
35314
|
};
|
|
@@ -35738,12 +35802,12 @@ var McpServer = class {
|
|
|
35738
35802
|
* @param errorMessage - The error message.
|
|
35739
35803
|
* @returns The tool error result.
|
|
35740
35804
|
*/
|
|
35741
|
-
createToolError(
|
|
35805
|
+
createToolError(errorMessage2) {
|
|
35742
35806
|
return {
|
|
35743
35807
|
content: [
|
|
35744
35808
|
{
|
|
35745
35809
|
type: "text",
|
|
35746
|
-
text:
|
|
35810
|
+
text: errorMessage2
|
|
35747
35811
|
}
|
|
35748
35812
|
],
|
|
35749
35813
|
isError: true
|
|
@@ -35761,8 +35825,8 @@ var McpServer = class {
|
|
|
35761
35825
|
const parseResult = await safeParseAsync2(schemaToParse, args);
|
|
35762
35826
|
if (!parseResult.success) {
|
|
35763
35827
|
const error48 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
35764
|
-
const
|
|
35765
|
-
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${
|
|
35828
|
+
const errorMessage2 = getParseErrorMessage(error48);
|
|
35829
|
+
throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage2}`);
|
|
35766
35830
|
}
|
|
35767
35831
|
return parseResult.data;
|
|
35768
35832
|
}
|
|
@@ -35786,8 +35850,8 @@ var McpServer = class {
|
|
|
35786
35850
|
const parseResult = await safeParseAsync2(outputObj, result.structuredContent);
|
|
35787
35851
|
if (!parseResult.success) {
|
|
35788
35852
|
const error48 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
35789
|
-
const
|
|
35790
|
-
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${
|
|
35853
|
+
const errorMessage2 = getParseErrorMessage(error48);
|
|
35854
|
+
throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage2}`);
|
|
35791
35855
|
}
|
|
35792
35856
|
}
|
|
35793
35857
|
/**
|
|
@@ -35999,8 +36063,8 @@ var McpServer = class {
|
|
|
35999
36063
|
const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
|
|
36000
36064
|
if (!parseResult.success) {
|
|
36001
36065
|
const error48 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
36002
|
-
const
|
|
36003
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${
|
|
36066
|
+
const errorMessage2 = getParseErrorMessage(error48);
|
|
36067
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage2}`);
|
|
36004
36068
|
}
|
|
36005
36069
|
const args = parseResult.data;
|
|
36006
36070
|
const cb = prompt.callback;
|
|
@@ -36524,7 +36588,7 @@ async function mcp() {
|
|
|
36524
36588
|
setMcpMode();
|
|
36525
36589
|
const server = new McpServer({
|
|
36526
36590
|
name: "reporting-bi",
|
|
36527
|
-
version: "0.1.
|
|
36591
|
+
version: "0.1.14"
|
|
36528
36592
|
});
|
|
36529
36593
|
server.tool(
|
|
36530
36594
|
"status",
|
|
@@ -36860,10 +36924,18 @@ async function mcp() {
|
|
|
36860
36924
|
server.tool(
|
|
36861
36925
|
"wiki_search",
|
|
36862
36926
|
"Search wiki pages",
|
|
36863
|
-
{
|
|
36927
|
+
{
|
|
36928
|
+
query: external_exports3.string().describe("Search query"),
|
|
36929
|
+
semantic: external_exports3.boolean().optional().describe("Also return pages semantically close to the query (needs a vector model configured on the server; results then carry a similarity score)"),
|
|
36930
|
+
...ListParams
|
|
36931
|
+
},
|
|
36864
36932
|
async (params3) => {
|
|
36865
36933
|
const service = await createService("wiki");
|
|
36866
|
-
const result = await service.get("search", {
|
|
36934
|
+
const result = await service.get("search", {
|
|
36935
|
+
...toRequestParams(params3),
|
|
36936
|
+
q: params3.query,
|
|
36937
|
+
...params3.semantic ? { mode: "semantic" } : {}
|
|
36938
|
+
});
|
|
36867
36939
|
return json2(result || []);
|
|
36868
36940
|
}
|
|
36869
36941
|
);
|
|
@@ -37057,8 +37129,8 @@ async function checkForUpdate() {
|
|
|
37057
37129
|
saveUpdateCheck({ lastCheck: now });
|
|
37058
37130
|
const latest = await fetchLatestVersion();
|
|
37059
37131
|
if (!latest) return;
|
|
37060
|
-
if (!isNewer(latest, "0.1.
|
|
37061
|
-
console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.
|
|
37132
|
+
if (!isNewer(latest, "0.1.14")) return;
|
|
37133
|
+
console.error(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.1.14"} \u2192 ${latest}...\x1B[0m`);
|
|
37062
37134
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: ["ignore", 2, 2] });
|
|
37063
37135
|
console.error(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37064
37136
|
} catch {
|
|
@@ -37070,11 +37142,11 @@ async function forceUpdate() {
|
|
|
37070
37142
|
console.error("Could not fetch latest version from npm.");
|
|
37071
37143
|
process.exit(1);
|
|
37072
37144
|
}
|
|
37073
|
-
if (!isNewer(latest, "0.1.
|
|
37074
|
-
console.log(`Already up to date (${"0.1.
|
|
37145
|
+
if (!isNewer(latest, "0.1.14")) {
|
|
37146
|
+
console.log(`Already up to date (${"0.1.14"}).`);
|
|
37075
37147
|
return;
|
|
37076
37148
|
}
|
|
37077
|
-
console.log(`Updating ${PACKAGE_NAME} ${"0.1.
|
|
37149
|
+
console.log(`Updating ${PACKAGE_NAME} ${"0.1.14"} \u2192 ${latest}...`);
|
|
37078
37150
|
(0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
|
|
37079
37151
|
console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
|
|
37080
37152
|
saveUpdateCheck({ lastCheck: Date.now() });
|
|
@@ -37110,10 +37182,11 @@ ETL:
|
|
|
37110
37182
|
etl list List all threads
|
|
37111
37183
|
etl get <id> Get thread metadata
|
|
37112
37184
|
etl content <id> Get thread SQL content (plain text)
|
|
37113
|
-
etl exec <id> [--sql "..."|--file f] Execute thread (optionally with custom SQL)
|
|
37185
|
+
etl exec <id> [--sql "..."|--file f|--stdin] Execute thread (optionally with custom SQL)
|
|
37186
|
+
etl parse <id> [--sql "..."|--file f|--stdin] Syntax check (set parseonly) of the thread or the given SQL; exit 1 on errors (--json: {errors}, exit 0)
|
|
37114
37187
|
etl abort <spid> Abort a running exec (exec reports "rpbi: spid <n>" on stderr)
|
|
37115
37188
|
etl search <query> Search threads
|
|
37116
|
-
etl params <id> [--save <json>|--delete <idz>] List, save or delete thread parameters
|
|
37189
|
+
etl params <id> [--save <json>|--delete <idz>] List, save or delete thread parameters (save creates, or updates when the JSON carries "idz"; a name already declared alongside is refused)
|
|
37117
37190
|
etl pull [--dir <path>] [--no-context] Pull all ETL threads, parameters, metadata & schema to local files
|
|
37118
37191
|
etl push [files...] [--dir <path>] [--force] Push modified/new .sql files back to server
|
|
37119
37192
|
etl status [--dir <path>] [--remote] [--json] Show local changes (--remote compares with server)
|
|
@@ -37125,7 +37198,8 @@ Deployment (requires the "deployment" right):
|
|
|
37125
37198
|
deployment get <id> Get thread metadata
|
|
37126
37199
|
deployment content <id> Get thread SQL content (plain text)
|
|
37127
37200
|
deployment doc <id> Get thread documentation (markdown)
|
|
37128
|
-
deployment exec <id> [--sql "..."|--file f] [--database all] Execute thread (optionally with custom SQL)
|
|
37201
|
+
deployment exec <id> [--sql "..."|--file f|--stdin] [--database all] Execute thread (optionally with custom SQL)
|
|
37202
|
+
deployment parse [<id>] [--sql "..."|--file f|--stdin] Syntax check (set parseonly, no placeholder replacement) of the thread or the given SQL
|
|
37129
37203
|
deployment pull [--dir <path>] Pull all deployment threads (.sql) & docs (.md) to local files
|
|
37130
37204
|
deployment push [files...] [--dir <path>] [--force] Push modified/new files back to server
|
|
37131
37205
|
deployment status [--dir <path>] [--remote] [--json] Show local changes (--remote compares with server)
|
|
@@ -37136,9 +37210,10 @@ Extensions (requires the "custom.define" right):
|
|
|
37136
37210
|
ext resources List resources
|
|
37137
37211
|
ext queries List queries
|
|
37138
37212
|
ext content <id> [--query] Get resource content (--query for query SQL)
|
|
37139
|
-
ext exec <query_id> [--sql "..."|--file f] Execute query (optionally with custom SQL)
|
|
37213
|
+
ext exec <query_id> [--sql "..."|--file f|--stdin] Execute query (optionally with custom SQL)
|
|
37214
|
+
ext parse <query_id> [--sql "..."|--file f|--stdin] Syntax check (set parseonly) of the query or the given SQL; exit 1 on errors (--json: {errors}, exit 0)
|
|
37140
37215
|
ext abort <spid> Abort a running exec (exec reports "rpbi: spid <n>" on stderr)
|
|
37141
|
-
ext params <query_id> [--save <json>|--delete <idz>] List, save or delete query parameters
|
|
37216
|
+
ext params <query_id> [--save <json>|--delete <idz>] List, save or delete query parameters (save creates, or updates when the JSON carries "idz"; a name already declared alongside is refused)
|
|
37142
37217
|
ext deps --project <id>|--query <id>|--resource <id> List SQL dependencies (resource \u2194 query links)
|
|
37143
37218
|
ext deps --query <id> --add <resource_id> Link a query to a resource (or --resource <id> --add <query_id>)
|
|
37144
37219
|
ext deps --remove <idz> Unlink a dependency
|
|
@@ -37262,7 +37337,7 @@ Examples:
|
|
|
37262
37337
|
(async () => {
|
|
37263
37338
|
const [command, ...args] = process.argv.slice(2);
|
|
37264
37339
|
if (command === "--version" || command === "-v") {
|
|
37265
|
-
console.log("0.1.
|
|
37340
|
+
console.log("0.1.14");
|
|
37266
37341
|
return;
|
|
37267
37342
|
}
|
|
37268
37343
|
await checkForUpdate();
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
2
|
+
"name": "@reporting-bi/cli",
|
|
3
|
+
"version": "0.1.14",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"description": "Reporting.bi CLI — command-line interface for the Reporting.bi platform",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"rpbi": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/index.js"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "yarn node build.mjs",
|
|
15
|
+
"watch": "yarn build --watch",
|
|
16
|
+
"rpbi": "yarn node dist/index.js",
|
|
17
|
+
"deploy-installers": "node -e \"const fs=require('fs');fs.cpSync('install.sh','../rp-static/install-cli.sh');fs.cpSync('install.ps1','../rp-static/install-cli.ps1')\"",
|
|
18
|
+
"release": "yarn node -e \"const p=require('./package.json');const v=p.version.split('.');v[2]++;p.version=v.join('.');require('fs').writeFileSync('package.json',JSON.stringify(p,null,'\\t')+'\\n')\" && yarn build && git add package.json && git commit -m \"rp-cli v$(yarn node -p \"require('./package.json').version\")\" && git push && yarn npm publish --access public"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "1.26.0",
|
|
22
|
+
"@reporting/rp-auth-client-v2": "^0.0.1",
|
|
23
|
+
"@reporting/rp-client": "^0.0.1",
|
|
24
|
+
"@reporting/rp-types": "^0.0.3",
|
|
25
|
+
"@types/node": "^18.11.18",
|
|
26
|
+
"esbuild": "^0.25.1",
|
|
27
|
+
"typescript": "^5.9.3",
|
|
28
|
+
"zod": "^4.3.6"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
}
|
|
33
|
+
}
|