apiblaze 0.21.64 → 0.21.65
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 +92 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__
|
|
|
34
34
|
var version;
|
|
35
35
|
var init_package = __esm({
|
|
36
36
|
"package.json"() {
|
|
37
|
-
version = "0.21.
|
|
37
|
+
version = "0.21.65";
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -7072,7 +7072,7 @@ __export(agent_exports, {
|
|
|
7072
7072
|
});
|
|
7073
7073
|
async function callAgent(messages, teamId) {
|
|
7074
7074
|
const token = getAccessToken();
|
|
7075
|
-
const res = await fetch(`${
|
|
7075
|
+
const res = await fetch(`${DASHBOARD_BASE7}/api/cli/agent`, {
|
|
7076
7076
|
method: "POST",
|
|
7077
7077
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
7078
7078
|
body: JSON.stringify({ messages: messages.slice(-20), tools: toolCatalogue(), team_id: teamId })
|
|
@@ -7167,7 +7167,7 @@ async function runAgent(opts) {
|
|
|
7167
7167
|
}
|
|
7168
7168
|
console.log(import_chalk25.default.dim("\nBye."));
|
|
7169
7169
|
}
|
|
7170
|
-
var import_chalk25, import_ora9,
|
|
7170
|
+
var import_chalk25, import_ora9, DASHBOARD_BASE7, MAX_TOOL_STEPS;
|
|
7171
7171
|
var init_agent = __esm({
|
|
7172
7172
|
"src/commands/agent.ts"() {
|
|
7173
7173
|
"use strict";
|
|
@@ -7181,7 +7181,7 @@ var init_agent = __esm({
|
|
|
7181
7181
|
init_types();
|
|
7182
7182
|
init_problem();
|
|
7183
7183
|
init_brand();
|
|
7184
|
-
|
|
7184
|
+
DASHBOARD_BASE7 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
7185
7185
|
MAX_TOOL_STEPS = 6;
|
|
7186
7186
|
}
|
|
7187
7187
|
});
|
|
@@ -7719,7 +7719,7 @@ var init_exercise = __esm({
|
|
|
7719
7719
|
// src/commands/connector-exercise.ts
|
|
7720
7720
|
var connector_exercise_exports = {};
|
|
7721
7721
|
__export(connector_exercise_exports, {
|
|
7722
|
-
DASHBOARD_BASE: () =>
|
|
7722
|
+
DASHBOARD_BASE: () => DASHBOARD_BASE8,
|
|
7723
7723
|
RUN_HEADER: () => RUN_HEADER,
|
|
7724
7724
|
RUN_META_KEY: () => RUN_META_KEY,
|
|
7725
7725
|
reportLink: () => reportLink,
|
|
@@ -7727,7 +7727,7 @@ __export(connector_exercise_exports, {
|
|
|
7727
7727
|
runConnectorExercise: () => runConnectorExercise
|
|
7728
7728
|
});
|
|
7729
7729
|
function reportLink(projectId, apiVersion = "1.0.0") {
|
|
7730
|
-
return `${
|
|
7730
|
+
return `${DASHBOARD_BASE8}/directory/${encodeURIComponent(projectId)}/${encodeURIComponent(apiVersion)}`;
|
|
7731
7731
|
}
|
|
7732
7732
|
async function confirm(message, interactive2) {
|
|
7733
7733
|
if (!interactive2) return false;
|
|
@@ -7900,20 +7900,30 @@ async function runConnectorAnswers(project, opts = {}) {
|
|
|
7900
7900
|
const current = await producer(caller, { method: "POST", path: `${projectPath2(proj2)}/directory-report`, body: { probe: false }, summary: "Current answers" });
|
|
7901
7901
|
const have = current.target?.metadata?.portalAnswers ?? {};
|
|
7902
7902
|
const { default: inquirer3 } = await import("inquirer");
|
|
7903
|
+
const saveNow = async (part) => {
|
|
7904
|
+
try {
|
|
7905
|
+
await producer(caller, { method: "PATCH", path: projectPath2(proj2), body: part, summary: "Save an answer" });
|
|
7906
|
+
} catch (e) {
|
|
7907
|
+
console.log(import_chalk27.default.yellow(` not saved: ${e instanceof Error ? e.message : String(e)}`));
|
|
7908
|
+
}
|
|
7909
|
+
};
|
|
7903
7910
|
for (const q of QUESTIONS) {
|
|
7904
7911
|
if (answers[q.field] !== void 0) continue;
|
|
7905
7912
|
const existing = typeof have[q.field] === "string" ? String(have[q.field]) : "";
|
|
7906
7913
|
if (existing.length >= (q.min ?? 1)) continue;
|
|
7907
7914
|
const a = await inquirer3.prompt([{ type: "input", name: "value", message: q.message, default: existing || void 0, validate: (v) => v.trim().length >= (q.min ?? 1) ? true : `${q.min ?? 1}+ characters` }]);
|
|
7908
7915
|
answers[q.field] = a.value.trim();
|
|
7916
|
+
await saveNow({ directory_portal_answers: { [q.field]: a.value.trim() } });
|
|
7909
7917
|
}
|
|
7910
7918
|
if (answers.access === void 0 && !have.access) {
|
|
7911
7919
|
const a = await inquirer3.prompt([{ type: "list", name: "value", message: "What the tools do:", choices: ["read", "write", "both"] }]);
|
|
7912
7920
|
answers.access = a.value;
|
|
7921
|
+
await saveNow({ directory_portal_answers: { access: a.value } });
|
|
7913
7922
|
}
|
|
7914
7923
|
if (answers.categories === void 0 && !(Array.isArray(have.categories) && have.categories.length)) {
|
|
7915
7924
|
const a = await inquirer3.prompt([{ type: "input", name: "value", message: "Category suggestions (1\u20135, comma-separated; you pick the closest in the portal):", validate: (v) => v.trim() ? true : "one at least" }]);
|
|
7916
7925
|
answers.categories = a.value.split(",").map((c) => c.trim()).filter(Boolean).slice(0, 5);
|
|
7926
|
+
await saveNow({ directory_portal_answers: { categories: answers.categories } });
|
|
7917
7927
|
}
|
|
7918
7928
|
if (!meta.data_handling && !current.target?.metadata?.dataHandling) {
|
|
7919
7929
|
const a = await inquirer3.prompt([
|
|
@@ -7921,14 +7931,17 @@ async function runConnectorAnswers(project, opts = {}) {
|
|
|
7921
7931
|
{ type: "input", name: "statement", message: "The permission you hold (who granted what, and when; goes into portal step 7):", when: (ans) => ans.mode === "proxied", validate: (v) => v.trim().length >= 20 ? true : "a sentence, please" }
|
|
7922
7932
|
]);
|
|
7923
7933
|
meta.data_handling = { mode: a.mode, ...a.statement?.trim() ? { statement: a.statement.trim() } : {} };
|
|
7934
|
+
await saveNow({ directory_metadata: { data_handling: meta.data_handling } });
|
|
7924
7935
|
}
|
|
7925
7936
|
if (!meta.health_data && !current.target?.metadata?.healthData) {
|
|
7926
7937
|
const a = await inquirer3.prompt([{ type: "confirm", name: "value", message: "Do the tools handle health data?", default: false }]);
|
|
7927
7938
|
meta.health_data = a.value ? "yes" : "no";
|
|
7939
|
+
await saveNow({ directory_metadata: { health_data: meta.health_data } });
|
|
7928
7940
|
}
|
|
7929
7941
|
if (!meta.sponsored_content && !current.target?.metadata?.sponsoredContent) {
|
|
7930
7942
|
const a = await inquirer3.prompt([{ type: "confirm", name: "value", message: "Do tool results carry sponsored content?", default: false }]);
|
|
7931
7943
|
meta.sponsored_content = a.value ? "yes" : "no";
|
|
7944
|
+
await saveNow({ directory_metadata: { sponsored_content: meta.sponsored_content } });
|
|
7932
7945
|
}
|
|
7933
7946
|
}
|
|
7934
7947
|
const body = {};
|
|
@@ -7948,7 +7961,7 @@ async function runConnectorAnswers(project, opts = {}) {
|
|
|
7948
7961
|
console.log(import_chalk27.default.green(` \u2713 recorded: ${Object.keys({ ...answers, ...meta }).join(", ")}`));
|
|
7949
7962
|
console.log(import_chalk27.default.dim(` ${r.rendered.headline}`));
|
|
7950
7963
|
}
|
|
7951
|
-
var import_chalk27, import_fs6, import_os3, import_path5, import_child_process6,
|
|
7964
|
+
var import_chalk27, import_fs6, import_os3, import_path5, import_child_process6, DASHBOARD_BASE8, RUN_META_KEY, RUN_HEADER, projectPath2, QUESTIONS;
|
|
7952
7965
|
var init_connector_exercise = __esm({
|
|
7953
7966
|
"src/commands/connector-exercise.ts"() {
|
|
7954
7967
|
"use strict";
|
|
@@ -7964,7 +7977,7 @@ var init_connector_exercise = __esm({
|
|
|
7964
7977
|
init_exercise();
|
|
7965
7978
|
init_brand();
|
|
7966
7979
|
init_external_mcp();
|
|
7967
|
-
|
|
7980
|
+
DASHBOARD_BASE8 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
7968
7981
|
RUN_META_KEY = "com.apiblaze/run";
|
|
7969
7982
|
RUN_HEADER = "apiblaze-directory-run";
|
|
7970
7983
|
projectPath2 = (p) => `/projects/${encodeURIComponent(p.projectId)}/${encodeURIComponent(p.apiVersion)}`;
|
|
@@ -11578,6 +11591,31 @@ Not ready: ${lines.length} blocker${lines.length === 1 ? "" : "s"} (${r.rendered
|
|
|
11578
11591
|
process.exit(1);
|
|
11579
11592
|
}
|
|
11580
11593
|
|
|
11594
|
+
// src/lib/op-call.ts
|
|
11595
|
+
init_auth();
|
|
11596
|
+
init_trace();
|
|
11597
|
+
init_types();
|
|
11598
|
+
var DASHBOARD_BASE6 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
11599
|
+
async function opCall(call3) {
|
|
11600
|
+
const token = getAccessToken();
|
|
11601
|
+
const res = await fetch(`${DASHBOARD_BASE6}/api/cli/op`, {
|
|
11602
|
+
method: "POST",
|
|
11603
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
11604
|
+
body: JSON.stringify({ path: call3.path, method: call3.method, body: call3.body })
|
|
11605
|
+
});
|
|
11606
|
+
let data = null;
|
|
11607
|
+
try {
|
|
11608
|
+
data = await res.json();
|
|
11609
|
+
} catch {
|
|
11610
|
+
}
|
|
11611
|
+
recordCall({ method: call3.method, path: call3.path, body: call3.body, status: res.status, summary: call3.summary });
|
|
11612
|
+
if (!res.ok) {
|
|
11613
|
+
const msg = data?.details ?? data?.error ?? res.statusText;
|
|
11614
|
+
throw new ApiError(res.status, typeof msg === "string" ? msg : JSON.stringify(msg), data);
|
|
11615
|
+
}
|
|
11616
|
+
return data;
|
|
11617
|
+
}
|
|
11618
|
+
|
|
11581
11619
|
// src/commands/connector.ts
|
|
11582
11620
|
var import_fs8 = __toESM(require("fs"));
|
|
11583
11621
|
var import_path6 = __toESM(require("path"));
|
|
@@ -12219,21 +12257,19 @@ async function runConnector(target2, opts) {
|
|
|
12219
12257
|
}
|
|
12220
12258
|
r = await fetchDirectoryReport(caller, proj2, { platforms });
|
|
12221
12259
|
}
|
|
12222
|
-
if (
|
|
12223
|
-
|
|
12260
|
+
if (interactive2 && r.report.results.some((x) => ANSWER_RULES.includes(x.id) && !x.pass)) {
|
|
12261
|
+
const { runConnectorAnswers: runConnectorAnswers2 } = await Promise.resolve().then(() => (init_connector_exercise(), connector_exercise_exports));
|
|
12262
|
+
say(import_chalk30.default.bold(" The review answers the portal asks for (saved as you go):"));
|
|
12263
|
+
await runConnectorAnswers2(proj2.projectName, { team: opts.team, apiversion: opts.apiversion });
|
|
12264
|
+
r = await fetchDirectoryReport(caller, proj2, { platforms });
|
|
12265
|
+
}
|
|
12266
|
+
if (!readyExcept(r, platforms, [SNAPSHOT_RULE, ...EVIDENCE_RULES])) {
|
|
12224
12267
|
if (!domain2.active && domain2.hostname && !json) {
|
|
12225
12268
|
console.error(import_chalk30.default.yellow(`
|
|
12226
12269
|
${domain2.hostname} is not active yet. Once the CNAME is in place, run again: ${B.cli} connector ${proj2.projectName}`));
|
|
12227
12270
|
}
|
|
12228
|
-
|
|
12271
|
+
exitWithReport(r, proj2, platforms, json);
|
|
12229
12272
|
}
|
|
12230
|
-
r = await fetchDirectoryReport(caller, proj2, { platforms, refreshSnapshot: true, publishedUrl: r.report.project.publishedUrl ?? null });
|
|
12231
|
-
const packet = await producer(caller, { method: "GET", path: `${projectPath3(proj2)}/directory-packet`, summary: "Submission packet" });
|
|
12232
|
-
const dir = opts.out ?? process.cwd();
|
|
12233
|
-
const mdPath = import_path6.default.join(dir, `connector-packet-${proj2.projectId}.md`);
|
|
12234
|
-
const jsonPath = import_path6.default.join(dir, `connector-packet-${proj2.projectId}.json`);
|
|
12235
|
-
import_fs8.default.writeFileSync(mdPath, packet.markdown, { mode: 384 });
|
|
12236
|
-
import_fs8.default.writeFileSync(jsonPath, JSON.stringify(packet.json, null, 2) + "\n", { mode: 384 });
|
|
12237
12273
|
if (opts.exercise !== false) {
|
|
12238
12274
|
let run2 = !!opts.yes;
|
|
12239
12275
|
if (interactive2) {
|
|
@@ -12246,6 +12282,14 @@ async function runConnector(target2, opts) {
|
|
|
12246
12282
|
r = await fetchDirectoryReport(caller, proj2, { platforms, publishedUrl: r.report.project.publishedUrl ?? null });
|
|
12247
12283
|
}
|
|
12248
12284
|
}
|
|
12285
|
+
if (!readyExceptSnapshot(r, platforms)) exitWithReport(r, proj2, platforms, json);
|
|
12286
|
+
r = await fetchDirectoryReport(caller, proj2, { platforms, refreshSnapshot: true, publishedUrl: r.report.project.publishedUrl ?? null });
|
|
12287
|
+
const packet = await producer(caller, { method: "GET", path: `${projectPath3(proj2)}/directory-packet`, summary: "Submission packet" });
|
|
12288
|
+
const dir = opts.out ?? process.cwd();
|
|
12289
|
+
const mdPath = import_path6.default.join(dir, `connector-packet-${proj2.projectId}.md`);
|
|
12290
|
+
const jsonPath = import_path6.default.join(dir, `connector-packet-${proj2.projectId}.json`);
|
|
12291
|
+
import_fs8.default.writeFileSync(mdPath, packet.markdown, { mode: 384 });
|
|
12292
|
+
import_fs8.default.writeFileSync(jsonPath, JSON.stringify(packet.json, null, 2) + "\n", { mode: 384 });
|
|
12249
12293
|
if (json) {
|
|
12250
12294
|
process.stdout.write(JSON.stringify({ ready: true, project: proj2.projectId, headline: r.rendered.headline, report: r.report, packet: { markdown: mdPath, json: jsonPath }, portals: PORTALS, ...reviewer ? { reviewer } : {} }) + "\n");
|
|
12251
12295
|
return;
|
|
@@ -12264,6 +12308,23 @@ async function runConnector(target2, opts) {
|
|
|
12264
12308
|
console.log(import_chalk30.default.dim(` ${r.report.disclaimer}`));
|
|
12265
12309
|
}
|
|
12266
12310
|
var SNAPSHOT_RULE = "LISTING_SNAPSHOT_MATCH";
|
|
12311
|
+
var ANSWER_RULES = ["PORTAL_ANSWERS_COMPLETE", "HEALTH_SPONSORED_DECLARED", "API_OWNERSHIP_DOMAIN"];
|
|
12312
|
+
var EVIDENCE_RULES = ["TOOL_EXERCISED_EACH", "TOOL_ERROR_PATH_EACH", "REVIEWER_ACCOUNT_POPULATED", "TESTED_IN_CLAUDE_OR_INSPECTOR", "TESTED_FROM_CLAUDE", "EXAMPLE_PROMPTS_WORK", "OAUTH_FLOW_COMPLETED"];
|
|
12313
|
+
function exitWithReport(r, proj2, platforms, json) {
|
|
12314
|
+
if (json) {
|
|
12315
|
+
process.stdout.write(JSON.stringify({ ready: false, project: proj2.projectId, headline: r.rendered.headline, report: r.report }) + "\n");
|
|
12316
|
+
process.exit(1);
|
|
12317
|
+
}
|
|
12318
|
+
printReport(r, false);
|
|
12319
|
+
const want = platforms;
|
|
12320
|
+
const blocking = r.report.results.filter((x) => !x.pass && x.severity === "block" && !x.unverified && x.platforms.some((p) => want.includes(p)));
|
|
12321
|
+
const first = blocking.find((x) => x.id !== SNAPSHOT_RULE) ?? blocking[0];
|
|
12322
|
+
console.error(import_chalk30.default.red(`
|
|
12323
|
+
Not ready: ${blocking.length} blocker${blocking.length === 1 ? "" : "s"} (${blocking.map((x) => x.id).join(", ")}).`));
|
|
12324
|
+
if (first) console.error(` Next: ${first.fix ?? first.message ?? first.title}`);
|
|
12325
|
+
console.error(import_chalk30.default.dim(` Report page: ${DASHBOARD_BASE6}/directory/${encodeURIComponent(proj2.projectId)}/${encodeURIComponent(proj2.apiVersion)}`));
|
|
12326
|
+
process.exit(1);
|
|
12327
|
+
}
|
|
12267
12328
|
var TOOL_DESC_RULE = "TOOL_DESC_NONEMPTY_SPECIFIC";
|
|
12268
12329
|
var UTILITY_PATH = /(health|ping|status|openapi|swagger|docs|spec|whoami|version)/i;
|
|
12269
12330
|
var SPECIFIC_MIN = 12;
|
|
@@ -12323,10 +12384,13 @@ async function fixToolDescriptions(proj2, environment, interactive2, say) {
|
|
|
12323
12384
|
return true;
|
|
12324
12385
|
}
|
|
12325
12386
|
function readyExceptSnapshot(r, platforms) {
|
|
12387
|
+
return readyExcept(r, platforms, [SNAPSHOT_RULE]);
|
|
12388
|
+
}
|
|
12389
|
+
function readyExcept(r, platforms, ignore) {
|
|
12326
12390
|
if (isReady(r, platforms)) return true;
|
|
12327
12391
|
const want = platforms ?? r.report.platformsRequested ?? ["claude", "chatgpt"];
|
|
12328
12392
|
const blocking = r.report.results.filter((x) => !x.pass && x.severity === "block" && x.platforms.some((p) => want.includes(p)));
|
|
12329
|
-
return blocking.length > 0 && blocking.every((x) => x.id
|
|
12393
|
+
return blocking.length > 0 && blocking.every((x) => ignore.includes(x.id) && (x.id !== SNAPSHOT_RULE || /no listing snapshot/i.test(x.message ?? "")));
|
|
12330
12394
|
}
|
|
12331
12395
|
async function probeConventionalUrls(apexDomain, fetchFn = headStatus) {
|
|
12332
12396
|
if (!apexDomain) return {};
|
|
@@ -14295,7 +14359,7 @@ var import_fs12 = require("fs");
|
|
|
14295
14359
|
init_admin();
|
|
14296
14360
|
init_auth();
|
|
14297
14361
|
init_resolve();
|
|
14298
|
-
var
|
|
14362
|
+
var DASHBOARD_BASE9 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
14299
14363
|
async function runExport(projectArg, versionArg, opts) {
|
|
14300
14364
|
const token = getAccessToken();
|
|
14301
14365
|
if (!token) throw new Error("Not authenticated. Run `apiblaze login` first.");
|
|
@@ -14333,7 +14397,7 @@ async function runExport(projectArg, versionArg, opts) {
|
|
|
14333
14397
|
}
|
|
14334
14398
|
process.stdout.write("\n");
|
|
14335
14399
|
const outFile = opts.out || `apiblaze-export-${projectId}-${version2}-${target2}.zip`;
|
|
14336
|
-
const res = await fetch(`${
|
|
14400
|
+
const res = await fetch(`${DASHBOARD_BASE9}/api/cli/admin/download`, {
|
|
14337
14401
|
method: "POST",
|
|
14338
14402
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
14339
14403
|
body: JSON.stringify({ path: `${statusPath}?download=1` })
|
|
@@ -16099,7 +16163,7 @@ var import_ora20 = __toESM(require("ora"));
|
|
|
16099
16163
|
init_admin();
|
|
16100
16164
|
init_resolve();
|
|
16101
16165
|
init_brand();
|
|
16102
|
-
var
|
|
16166
|
+
var DASHBOARD_BASE10 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
16103
16167
|
var TOPUP_MIN_USD = 10;
|
|
16104
16168
|
var TOPUP_MAX_USD = 1e3;
|
|
16105
16169
|
var money = (cents2) => typeof cents2 === "number" ? `$${usdStr(cents2)}` : "\u2014";
|
|
@@ -16161,7 +16225,7 @@ async function runBillingBalance(opts) {
|
|
|
16161
16225
|
console.log("");
|
|
16162
16226
|
}
|
|
16163
16227
|
function walletUrl(teamId) {
|
|
16164
|
-
return teamId ? `${
|
|
16228
|
+
return teamId ? `${DASHBOARD_BASE10}/topup?teamId=${encodeURIComponent(teamId)}` : `${DASHBOARD_BASE10}/account?section=wallet`;
|
|
16165
16229
|
}
|
|
16166
16230
|
async function runBillingTopup(amount, opts) {
|
|
16167
16231
|
const usd2 = Number(amount);
|
|
@@ -18736,7 +18800,7 @@ init_tenant_choice();
|
|
|
18736
18800
|
init_resolve();
|
|
18737
18801
|
init_types();
|
|
18738
18802
|
init_paging();
|
|
18739
|
-
var
|
|
18803
|
+
var DASHBOARD_BASE11 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
18740
18804
|
var IAM_BASE = process.env.APIBLAZE_IAM_BASE || "https://iam.apiblaze.com";
|
|
18741
18805
|
async function resolveTransport(opts) {
|
|
18742
18806
|
const producer2 = loadCredentials();
|
|
@@ -18760,7 +18824,7 @@ async function resolveTransport(opts) {
|
|
|
18760
18824
|
return {
|
|
18761
18825
|
tenant: tenant2,
|
|
18762
18826
|
call: async (path19, method = "GET", body) => {
|
|
18763
|
-
const res = await fetch(`${
|
|
18827
|
+
const res = await fetch(`${DASHBOARD_BASE11}/api/cli/iam`, {
|
|
18764
18828
|
method: "POST",
|
|
18765
18829
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
18766
18830
|
body: JSON.stringify({ tenant: tenant2, path: path19, method, body })
|
|
@@ -19636,31 +19700,6 @@ async function runOriginsRemove(origin, opts) {
|
|
|
19636
19700
|
var import_chalk77 = __toESM(require("chalk"));
|
|
19637
19701
|
init_auth();
|
|
19638
19702
|
|
|
19639
|
-
// src/lib/op-call.ts
|
|
19640
|
-
init_auth();
|
|
19641
|
-
init_trace();
|
|
19642
|
-
init_types();
|
|
19643
|
-
var DASHBOARD_BASE11 = process.env.APIBLAZE_DASHBOARD_BASE || "https://dashboard.apiblaze.com";
|
|
19644
|
-
async function opCall(call3) {
|
|
19645
|
-
const token = getAccessToken();
|
|
19646
|
-
const res = await fetch(`${DASHBOARD_BASE11}/api/cli/op`, {
|
|
19647
|
-
method: "POST",
|
|
19648
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
19649
|
-
body: JSON.stringify({ path: call3.path, method: call3.method, body: call3.body })
|
|
19650
|
-
});
|
|
19651
|
-
let data = null;
|
|
19652
|
-
try {
|
|
19653
|
-
data = await res.json();
|
|
19654
|
-
} catch {
|
|
19655
|
-
}
|
|
19656
|
-
recordCall({ method: call3.method, path: call3.path, body: call3.body, status: res.status, summary: call3.summary });
|
|
19657
|
-
if (!res.ok) {
|
|
19658
|
-
const msg = data?.details ?? data?.error ?? res.statusText;
|
|
19659
|
-
throw new ApiError(res.status, typeof msg === "string" ? msg : JSON.stringify(msg), data);
|
|
19660
|
-
}
|
|
19661
|
-
return data;
|
|
19662
|
-
}
|
|
19663
|
-
|
|
19664
19703
|
// src/commands/op-money.ts
|
|
19665
19704
|
var import_chalk70 = __toESM(require("chalk"));
|
|
19666
19705
|
init_admin();
|
|
@@ -19749,8 +19788,8 @@ function lastLedgerSendAtMs(st) {
|
|
|
19749
19788
|
const v = st.lastLedgerSendAtMs !== void 0 ? st.lastLedgerSendAtMs : st.lastFlushAtMs;
|
|
19750
19789
|
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
19751
19790
|
}
|
|
19752
|
-
var walletPage = (ba) => `${
|
|
19753
|
-
var incidentPage = () => `${
|
|
19791
|
+
var walletPage = (ba) => `${DASHBOARD_BASE6}/operator/wallets/${encodeURIComponent(ba)}`;
|
|
19792
|
+
var incidentPage = () => `${DASHBOARD_BASE6}/operator/incident`;
|
|
19754
19793
|
var WALLET_MUTATIONS = {
|
|
19755
19794
|
"freeze": "a reason (required, \u2264 500 chars). Sets frozen; epoch++ recalls every shard \u2014 serving stops within seconds.",
|
|
19756
19795
|
"unfreeze": "a reason (required, \u2264 500 chars).",
|
|
@@ -19764,7 +19803,7 @@ var WALLET_MUTATIONS = {
|
|
|
19764
19803
|
function opWalletMutation(action2, ref, opts) {
|
|
19765
19804
|
const need = WALLET_MUTATIONS[action2];
|
|
19766
19805
|
const target2 = ref ?? "<wallet>";
|
|
19767
|
-
const url = ref && !isTeamId(ref) ? walletPage(ref) : `${
|
|
19806
|
+
const url = ref && !isTeamId(ref) ? walletPage(ref) : `${DASHBOARD_BASE6}/operator/wallets`;
|
|
19768
19807
|
if (opts.json) return void console.log(JSON.stringify({ action: action2, wallet: ref ?? null, dashboard_only: true, url, requires: need ?? "a reason" }));
|
|
19769
19808
|
console.log(import_chalk70.default.yellow(`
|
|
19770
19809
|
\`op wallet ${action2}\` is dashboard-only \u2014 it writes an operator_audit row with YOUR reason before touching the root.`));
|