@pmate/cli 0.35.13 → 0.36.0
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.d.ts +1 -0
- package/dist/index.js +15 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18934,7 +18934,7 @@ async function queryDeveloperLogs(input, fetcher = fetch) {
|
|
|
18934
18934
|
if (!Number.isSafeInteger(input.page) || input.page < 0) throw new Error("Invalid log page");
|
|
18935
18935
|
if (input.sinceMs !== void 0 && (!Number.isSafeInteger(input.sinceMs) || input.sinceMs < 0)) throw new Error("Invalid log time");
|
|
18936
18936
|
if (input.keyword && input.keyword.length > 256) throw new Error("Log search must be at most 256 characters");
|
|
18937
|
-
const params = new URLSearchParams({ service: input.service, page: String(input.page), topic: input.topic ?? "application" });
|
|
18937
|
+
const params = new URLSearchParams({ service: input.service, page: String(input.page), category: input.category ?? "app", topic: input.topic ?? (input.category === "web" ? "pv" : "application") });
|
|
18938
18938
|
if (input.environment) params.set("environment", input.environment);
|
|
18939
18939
|
if (input.fields) params.set("fields", JSON.stringify(input.fields));
|
|
18940
18940
|
if (input.keyword) params.set("keyword", input.keyword);
|
|
@@ -20014,6 +20014,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20014
20014
|
service: `${namespace}:${appName}`,
|
|
20015
20015
|
page: options.page,
|
|
20016
20016
|
keyword: options.search,
|
|
20017
|
+
category: options.category,
|
|
20017
20018
|
topic: options.topic,
|
|
20018
20019
|
fields: options.fields,
|
|
20019
20020
|
environment: options.envName,
|
|
@@ -20705,8 +20706,8 @@ var ServiceRuntimeRunner = class {
|
|
|
20705
20706
|
}
|
|
20706
20707
|
};
|
|
20707
20708
|
function resolveLogChainId(env = process.env) {
|
|
20708
|
-
if (env.APP_LOG_CHAIN_ID && env.APP_LOG_CHAIN_ID !== "
|
|
20709
|
-
return "
|
|
20709
|
+
if (env.APP_LOG_CHAIN_ID && env.APP_LOG_CHAIN_ID !== "app-logs") throw new Error("Logs require log chain");
|
|
20710
|
+
return "app-logs";
|
|
20710
20711
|
}
|
|
20711
20712
|
function shellQuote2(value) {
|
|
20712
20713
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
@@ -20918,7 +20919,7 @@ var ServiceCommandHandler = class {
|
|
|
20918
20919
|
}
|
|
20919
20920
|
case "log": {
|
|
20920
20921
|
if (args.app) {
|
|
20921
|
-
const result = await queryDeveloperLogs({ app: args.app, service: `${args.namespace}:${args.name}`, page: args.page, keyword: args.search, sinceMs: args.sinceMs, topic: args.topic, fields: args.fields, environment: args.env });
|
|
20922
|
+
const result = await queryDeveloperLogs({ app: args.app, service: `${args.namespace}:${args.name}`, page: args.page, keyword: args.search, sinceMs: args.sinceMs, category: args.category, topic: args.topic, fields: args.fields, environment: args.env });
|
|
20922
20923
|
console.log(JSON.stringify(result, null, args.json ? void 0 : 2));
|
|
20923
20924
|
return;
|
|
20924
20925
|
}
|
|
@@ -20930,6 +20931,7 @@ var ServiceCommandHandler = class {
|
|
|
20930
20931
|
search: args.search,
|
|
20931
20932
|
follow: args.follow,
|
|
20932
20933
|
envName: args.env,
|
|
20934
|
+
category: args.category,
|
|
20933
20935
|
topic: args.topic,
|
|
20934
20936
|
fields: args.fields,
|
|
20935
20937
|
sinceMs: args.sinceMs,
|
|
@@ -24212,6 +24214,13 @@ function parseServiceArgs(tokens) {
|
|
|
24212
24214
|
while (rest.length > 0) {
|
|
24213
24215
|
const token = rest.shift();
|
|
24214
24216
|
switch (token) {
|
|
24217
|
+
case "--category": {
|
|
24218
|
+
if (action !== "log") throw new Error(`Unknown service ${action} option: ${token}`);
|
|
24219
|
+
const value = rest.shift();
|
|
24220
|
+
if (value !== "app" && value !== "web") throw new Error("Invalid --category");
|
|
24221
|
+
logFilters.category = value;
|
|
24222
|
+
break;
|
|
24223
|
+
}
|
|
24215
24224
|
case "--topic": {
|
|
24216
24225
|
if (action !== "log") throw new Error(`Unknown service ${action} option: ${token}`);
|
|
24217
24226
|
const value = requireValue4(rest, token);
|
|
@@ -24965,7 +24974,7 @@ function parseLogsArgs(input) {
|
|
|
24965
24974
|
const params = {}, fields = {};
|
|
24966
24975
|
let json = false, actorProfileId;
|
|
24967
24976
|
if (rest[0] && !rest[0].startsWith("--")) params.service = parseNamespacedRef(rest.shift(), { entityLabel: "service" }).fullId;
|
|
24968
|
-
const keys = { "--metric": "metric", "--topic": "topic", "--env": "environment", "--search": "keyword", "--group-by": "groupBy", "--interval": "interval", "--timezone": "timezone", "--request-id": "requestId", "--page": "page" };
|
|
24977
|
+
const keys = { "--category": "category", "--metric": "metric", "--topic": "topic", "--env": "environment", "--search": "keyword", "--group-by": "groupBy", "--interval": "interval", "--timezone": "timezone", "--request-id": "requestId", "--page": "page" };
|
|
24969
24978
|
const times = { "--from": "from", "--to": "to", "--compare-from": "compareFrom", "--compare-to": "compareTo" };
|
|
24970
24979
|
while (rest.length) {
|
|
24971
24980
|
const flag = rest.shift();
|
|
@@ -24997,6 +25006,7 @@ function parseLogsArgs(input) {
|
|
|
24997
25006
|
} else if (keys[flag]) params[keys[flag]] = value;
|
|
24998
25007
|
else throw Error(`Unknown log option: ${flag}`);
|
|
24999
25008
|
}
|
|
25009
|
+
if (params.category && !["app", "web"].includes(params.category)) throw Error("Invalid --category");
|
|
25000
25010
|
if (tool !== "schema" && !params.service) throw Error("Service reference required");
|
|
25001
25011
|
if (tool === "schema" && (Object.keys(params).length || Object.keys(fields).length)) throw Error("logs schema only accepts --json");
|
|
25002
25012
|
if (tool === "aggregate" || tool === "compare") {
|