@canonry/canonry 7.51.5 → 7.52.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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +8 -0
- package/assets/assets/{AccessControls-B5TqDgeq.js → AccessControls-CteIuEGI.js} +1 -1
- package/assets/assets/{AuditHistoryPanel-DgxiizOW.js → AuditHistoryPanel-DqJGiLsf.js} +1 -1
- package/assets/assets/{BacklinksPage-Ay6pdphx.js → BacklinksPage-DotWEPQt.js} +1 -1
- package/assets/assets/{HistoryPage-B11eFH21.js → HistoryPage-aOd198dT.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-CuaKVK8x.js +4 -0
- package/assets/assets/{ProjectPage-DoY0hftd.js → ProjectPage-O9oufMgi.js} +4 -4
- package/assets/assets/{RunsPage-BPBmuQAS.js → RunsPage-DIXMrc-N.js} +1 -1
- package/assets/assets/{SettingsPage-ClKnP8xy.js → SettingsPage-BuGb6AGa.js} +1 -1
- package/assets/assets/SiteHealthSection-CweaKjCo.js +2 -0
- package/assets/assets/TrafficPage-B7MaQalp.js +40 -0
- package/assets/assets/{TrafficSourceDetailPage-DQu0YNt2.js → TrafficSourceDetailPage-BPtjnF9s.js} +1 -1
- package/assets/assets/{card-DYMyvhB9.js → card-DoV-8Txo.js} +1 -1
- package/assets/assets/{extract-error-message-BRM1I_3L.js → extract-error-message-DKQJJlZ-.js} +1 -1
- package/assets/assets/{format-helpers-DrkFERj3.js → format-helpers-BWnMmkiO.js} +1 -1
- package/assets/assets/index-Z63c4PeO.js +39 -0
- package/assets/assets/{query-client-gRFnU4VF.js → query-client-vB35tVTz.js} +1 -1
- package/assets/assets/{react-query-lH82FULK.js → react-query-BI0567qs.js} +1 -1
- package/assets/assets/{react-sigma_core.esm.min-D09H4byP.js → react-sigma_core.esm.min-hGyOC4V_.js} +1 -1
- package/assets/assets/{service-Cx0HSnE9.js → service-c4YvpVKX.js} +1 -1
- package/assets/index.html +6 -6
- package/dist/ads-MREK2AGL.js +544 -0
- package/dist/agent-4RUZ3MC4.js +70 -0
- package/dist/agent-ask-YLTYBEYH.js +139 -0
- package/dist/agent-conversations-QA6IKDGR.js +52 -0
- package/dist/agent-memory-MEQAJOB3.js +92 -0
- package/dist/agent-providers-AXYPDJHL.js +55 -0
- package/dist/agent-transcript-SMNQNYCD.js +77 -0
- package/dist/analytics-4OR64IGV.js +240 -0
- package/dist/apply-CQXCFXAH.js +175 -0
- package/dist/backfill-TMXCNVOB.js +41 -0
- package/dist/backlinks-6KFAQGYV.js +303 -0
- package/dist/bing-HFCACTAC.js +418 -0
- package/dist/bootstrap-SQVQXOJC.js +326 -0
- package/dist/cdp-IACL7EXU.js +162 -0
- package/dist/chunk-4MJYGB56.js +124 -0
- package/dist/chunk-5N6245R7.js +1160 -0
- package/dist/chunk-6BPZHNDC.js +617 -0
- package/dist/chunk-6GO5VVAC.js +15 -0
- package/dist/chunk-7244X3K6.js +609 -0
- package/dist/chunk-7XE2IRBG.js +204 -0
- package/dist/chunk-AOJU5LKX.js +8 -0
- package/dist/chunk-AWCWIQAU.js +2686 -0
- package/dist/{chunk-JBZZEIM2.js → chunk-BBOHY2DQ.js} +2 -13
- package/dist/{chunk-AZFPA7JV.js → chunk-BU3VAG5J.js} +6 -4
- package/dist/{chunk-4YCGZGA3.js → chunk-BYOK6Z4F.js} +2 -2
- package/dist/chunk-DSNSD5J3.js +971 -0
- package/dist/chunk-EGIZNSDA.js +94 -0
- package/dist/chunk-ELCLGWUT.js +83 -0
- package/dist/chunk-FC4XND45.js +38 -0
- package/dist/chunk-GNKOBKPW.js +58 -0
- package/dist/chunk-HEGXGCGL.js +524 -0
- package/dist/chunk-I6KNMZ77.js +232 -0
- package/dist/{chunk-HLVEB5TB.js → chunk-IIOEAJTV.js} +7 -5
- package/dist/chunk-ILDT4LPB.js +1273 -0
- package/dist/chunk-JY3RLZGB.js +30 -0
- package/dist/{chunk-PLYJX67A.js → chunk-K5I45PZI.js} +8084 -13939
- package/dist/chunk-KXAOMTXN.js +1034 -0
- package/dist/chunk-LK2BG6EX.js +145 -0
- package/dist/chunk-MJNUSPO4.js +15 -0
- package/dist/chunk-MKAC7HKH.js +9178 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-SFMWHPMX.js → chunk-O4RMPA6H.js} +13765 -13737
- package/dist/chunk-O77IBNVO.js +8264 -0
- package/dist/chunk-OFL4PTYU.js +644 -0
- package/dist/chunk-QLPLENDT.js +133 -0
- package/dist/chunk-R2J4SNKF.js +78 -0
- package/dist/{chunk-KEATAHXH.js → chunk-RVUCY4ZV.js} +358 -581
- package/dist/chunk-SNFBJKAW.js +530 -0
- package/dist/chunk-TALC5DX5.js +420 -0
- package/dist/chunk-TSENU4GG.js +18 -0
- package/dist/{chunk-HAHXPJQ5.js → chunk-V5D4XNWV.js} +16 -1684
- package/dist/chunk-VJWDBFSL.js +69 -0
- package/dist/chunk-XEBKF4N5.js +8 -0
- package/dist/chunk-Y4GK7GCV.js +15376 -0
- package/dist/{chunk-A3WSAAQS.js → chunk-YSEC6TIB.js} +7917 -33199
- package/dist/chunk-Z7IUAJOF.js +13 -0
- package/dist/citations-NSBBWRZ4.js +106 -0
- package/dist/{cli-catalog-MO6Z2CIZ.js → cli-catalog-OFWJMNMD.js} +5 -3
- package/dist/cli-commands-WVBL337U.js +19 -0
- package/dist/cli.js +35 -29
- package/dist/competitor-V4OHORBC.js +561 -0
- package/dist/content-RUXRI5IC.js +257 -0
- package/dist/dashboard-JXB2YAQJ.js +71 -0
- package/dist/demo-55ZNUOXU.js +75 -0
- package/dist/{demo-server-GIWDJGJX.js → demo-server-XO7PHM4I.js} +22 -9
- package/dist/discover-JJQ564HS.js +372 -0
- package/dist/discover-eval-KLEKZ6U4.js +282 -0
- package/dist/doctor-JAMQZCMZ.js +152 -0
- package/dist/evidence-YRSB7GFE.js +57 -0
- package/dist/export-cmd-MHML4OYU.js +49 -0
- package/dist/ga-LSXPE2MN.js +911 -0
- package/dist/gbp-RMKMLOC7.js +370 -0
- package/dist/google-JQ4T6JTQ.js +946 -0
- package/dist/google-marketing-J6SEODYC.js +403 -0
- package/dist/health-cmd-MV2JM2C3.js +64 -0
- package/dist/history-SRRH7A2E.js +90 -0
- package/dist/index.d.ts +43 -4
- package/dist/index.js +29 -6
- package/dist/init-ZJZFUERV.js +432 -0
- package/dist/insights-PMMGNWZH.js +63 -0
- package/dist/intelligence-service-KCSU6ZUJ.js +15 -0
- package/dist/keys-TS7NZANS.js +116 -0
- package/dist/keyword-VNCKDUGC.js +164 -0
- package/dist/logs-VH3WOTZJ.js +30 -0
- package/dist/mcp-DG2RROB3.js +14 -0
- package/dist/mcp.js +14 -5
- package/dist/measurement-plan-4T35TUGG.js +42 -0
- package/dist/notify-BWHUSKL7.js +125 -0
- package/dist/organic-evidence-QX4SXXJP.js +53 -0
- package/dist/overview-7IHUTKUV.js +213 -0
- package/dist/project-JXLSWDE2.js +460 -0
- package/dist/query-S75EL25H.js +211 -0
- package/dist/research-KFTV3IP4.js +200 -0
- package/dist/results-export-GTKVBU34.js +27 -0
- package/dist/run-26HDIRHF.js +31 -0
- package/dist/schedule-N6G4SVHQ.js +177 -0
- package/dist/search-MI32EPYM.js +42 -0
- package/dist/serve-XLGE42AG.js +598 -0
- package/dist/session-W5DXWIYM.js +47 -0
- package/dist/settings-T7WI2UVE.js +107 -0
- package/dist/skills-F3WPKPTK.js +33 -0
- package/dist/snapshot-PD3EAVEX.js +538 -0
- package/dist/src-XDUXMJC3.js +316 -0
- package/dist/status-PUH7JFZ4.js +126 -0
- package/dist/support-ARF4HER7.js +24 -0
- package/dist/technical-aeo-AUFWWJIP.js +625 -0
- package/dist/telemetry-XBYT7G2K.js +118 -0
- package/dist/tools-GVHIRWSN.js +41 -0
- package/dist/traffic-B3HW2ZWG.js +1295 -0
- package/dist/users-M5HNQZYI.js +170 -0
- package/dist/visibility-stats-Y7GJKMHN.js +241 -0
- package/dist/wordpress-GCIURYPN.js +600 -0
- package/package.json +1 -1
- package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +0 -4
- package/assets/assets/SiteHealthSection-PWjKMmEn.js +0 -2
- package/assets/assets/TrafficPage-DkfGiJXR.js +0 -40
- package/assets/assets/index-CG1Jox52.js +0 -39
- package/dist/chunk-4QQYYRHV.js +0 -23082
- package/dist/cli-commands-FOJR3HHU.js +0 -15
- package/dist/intelligence-service-XQCNWAPL.js +0 -9
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-V5D4XNWV.js";
|
|
4
|
+
import "./chunk-OFL4PTYU.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
EXIT_USER_ERROR
|
|
12
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
13
|
+
import {
|
|
14
|
+
CheckScopes,
|
|
15
|
+
CheckStatuses
|
|
16
|
+
} from "./chunk-O4RMPA6H.js";
|
|
17
|
+
import "./chunk-MLKGABMK.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/doctor.ts
|
|
20
|
+
async function doctorCommand(opts) {
|
|
21
|
+
if (opts.all) {
|
|
22
|
+
await runDoctorAll(opts);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const client = createApiClient();
|
|
26
|
+
const report = await client.runDoctor({
|
|
27
|
+
project: opts.project,
|
|
28
|
+
checkIds: opts.checks,
|
|
29
|
+
...opts.reportMonth ? { reportMonth: opts.reportMonth } : {}
|
|
30
|
+
});
|
|
31
|
+
if (opts.format === "json") {
|
|
32
|
+
console.log(JSON.stringify(report, null, 2));
|
|
33
|
+
} else if (opts.format === "jsonl") {
|
|
34
|
+
emitJsonl(report.checks.map((check) => ({ project: report.project, ...check })));
|
|
35
|
+
} else {
|
|
36
|
+
printHumanReport(report);
|
|
37
|
+
}
|
|
38
|
+
if (report.summary.fail > 0) {
|
|
39
|
+
throw new CliError({
|
|
40
|
+
code: "DOCTOR_CHECKS_FAILED",
|
|
41
|
+
message: `${report.summary.fail} check${report.summary.fail === 1 ? "" : "s"} failed`,
|
|
42
|
+
exitCode: EXIT_USER_ERROR,
|
|
43
|
+
details: {
|
|
44
|
+
scope: report.scope,
|
|
45
|
+
project: report.project,
|
|
46
|
+
failed: report.checks.filter((c) => c.status === CheckStatuses.fail).map((c) => c.id)
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function runDoctorAll(opts) {
|
|
52
|
+
const client = createApiClient();
|
|
53
|
+
const projects = await client.listProjects();
|
|
54
|
+
const [globalReport, ...projectReports] = await Promise.all([
|
|
55
|
+
client.runDoctor({ checkIds: opts.checks, ...opts.reportMonth ? { reportMonth: opts.reportMonth } : {} }),
|
|
56
|
+
...projects.map((p) => client.runDoctor({ project: p.name, checkIds: opts.checks, ...opts.reportMonth ? { reportMonth: opts.reportMonth } : {} }))
|
|
57
|
+
]);
|
|
58
|
+
const byKey = { __global__: globalReport };
|
|
59
|
+
projects.forEach((p, i) => {
|
|
60
|
+
byKey[p.name] = projectReports[i];
|
|
61
|
+
});
|
|
62
|
+
if (opts.format === "json") {
|
|
63
|
+
console.log(JSON.stringify(byKey, null, 2));
|
|
64
|
+
} else if (opts.format === "jsonl") {
|
|
65
|
+
const scopes = ["__global__", ...projects.map((p) => p.name)];
|
|
66
|
+
emitJsonl(scopes.flatMap((key) => {
|
|
67
|
+
const project = key === "__global__" ? null : key;
|
|
68
|
+
return byKey[key].checks.map((check) => ({ project, ...check }));
|
|
69
|
+
}));
|
|
70
|
+
} else {
|
|
71
|
+
printAllHumanReport(byKey, projects.map((p) => p.name));
|
|
72
|
+
}
|
|
73
|
+
const totalFail = globalReport.summary.fail + projectReports.reduce((s, r) => s + r.summary.fail, 0);
|
|
74
|
+
if (totalFail > 0) {
|
|
75
|
+
const failedByScope = {};
|
|
76
|
+
if (globalReport.summary.fail > 0) {
|
|
77
|
+
failedByScope.__global__ = globalReport.checks.filter((c) => c.status === CheckStatuses.fail).map((c) => c.id);
|
|
78
|
+
}
|
|
79
|
+
projects.forEach((p, i) => {
|
|
80
|
+
const failed = projectReports[i].checks.filter((c) => c.status === CheckStatuses.fail).map((c) => c.id);
|
|
81
|
+
if (failed.length > 0) failedByScope[p.name] = failed;
|
|
82
|
+
});
|
|
83
|
+
throw new CliError({
|
|
84
|
+
code: "DOCTOR_CHECKS_FAILED",
|
|
85
|
+
message: `${totalFail} check${totalFail === 1 ? "" : "s"} failed across ${Object.keys(failedByScope).length} scope${Object.keys(failedByScope).length === 1 ? "" : "s"}`,
|
|
86
|
+
exitCode: EXIT_USER_ERROR,
|
|
87
|
+
details: { failed: failedByScope }
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function printAllHumanReport(byKey, projectNames) {
|
|
92
|
+
const scopes = ["__global__", ...projectNames];
|
|
93
|
+
console.log(`
|
|
94
|
+
canonry doctor \u2014 all scopes (${scopes.length})
|
|
95
|
+
`);
|
|
96
|
+
for (const key of scopes) {
|
|
97
|
+
const report = byKey[key];
|
|
98
|
+
const label = key === "__global__" ? "global" : `project "${key}"`;
|
|
99
|
+
const s = report.summary;
|
|
100
|
+
const tag = s.fail > 0 ? "[FAIL]" : s.warn > 0 ? "[WARN]" : "[OK] ";
|
|
101
|
+
console.log(` ${tag} ${label.padEnd(28)} ${s.ok} ok, ${s.warn} warn, ${s.fail} fail, ${s.skipped} skipped`);
|
|
102
|
+
if (s.fail > 0 || s.warn > 0) {
|
|
103
|
+
const attentionIds = report.checks.filter((c) => c.status === CheckStatuses.fail || c.status === CheckStatuses.warn).map((c) => `${c.id}: ${c.summary}`);
|
|
104
|
+
for (const line of attentionIds) {
|
|
105
|
+
console.log(` \u2717 ${line}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
console.log();
|
|
110
|
+
}
|
|
111
|
+
function statusBadge(status) {
|
|
112
|
+
switch (status) {
|
|
113
|
+
case CheckStatuses.ok:
|
|
114
|
+
return "[ok] ";
|
|
115
|
+
case CheckStatuses.warn:
|
|
116
|
+
return "[warn] ";
|
|
117
|
+
case CheckStatuses.fail:
|
|
118
|
+
return "[fail] ";
|
|
119
|
+
case CheckStatuses.skipped:
|
|
120
|
+
return "[skip] ";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function printHumanReport(report) {
|
|
124
|
+
const header = report.scope === CheckScopes.project && report.project ? `canonry doctor \u2014 project "${report.project}"` : "canonry doctor \u2014 global";
|
|
125
|
+
console.log(`
|
|
126
|
+
${header}`);
|
|
127
|
+
console.log(`(${report.summary.ok} ok, ${report.summary.warn} warn, ${report.summary.fail} fail, ${report.summary.skipped} skipped \u2014 ${report.durationMs}ms)
|
|
128
|
+
`);
|
|
129
|
+
if (report.checks.length === 0) {
|
|
130
|
+
console.log("No checks matched the requested filter.");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
134
|
+
for (const check of report.checks) {
|
|
135
|
+
const bucket = grouped.get(check.category) ?? [];
|
|
136
|
+
bucket.push(check);
|
|
137
|
+
grouped.set(check.category, bucket);
|
|
138
|
+
}
|
|
139
|
+
for (const [category, checks] of grouped) {
|
|
140
|
+
console.log(`${category.toUpperCase()}`);
|
|
141
|
+
for (const check of checks) {
|
|
142
|
+
console.log(` ${statusBadge(check.status)}${check.id} \u2014 ${check.summary}`);
|
|
143
|
+
if (check.remediation) {
|
|
144
|
+
console.log(` \u2192 ${check.remediation}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
console.log();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
doctorCommand
|
|
152
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-V5D4XNWV.js";
|
|
4
|
+
import "./chunk-OFL4PTYU.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import "./chunk-HGMYEDAQ.js";
|
|
10
|
+
import {
|
|
11
|
+
CitationStates
|
|
12
|
+
} from "./chunk-O4RMPA6H.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
14
|
+
|
|
15
|
+
// src/commands/evidence.ts
|
|
16
|
+
function getClient() {
|
|
17
|
+
return createApiClient();
|
|
18
|
+
}
|
|
19
|
+
async function showEvidence(project, format) {
|
|
20
|
+
const client = getClient();
|
|
21
|
+
const timeline = await client.getTimeline(project);
|
|
22
|
+
if (format === "json") {
|
|
23
|
+
const enriched = timeline.map((entry) => ({
|
|
24
|
+
...entry,
|
|
25
|
+
cited: entry.runs[entry.runs.length - 1]?.citationState === CitationStates.cited
|
|
26
|
+
}));
|
|
27
|
+
console.log(JSON.stringify(enriched, null, 2));
|
|
28
|
+
return;
|
|
29
|
+
} else if (format === "jsonl") {
|
|
30
|
+
emitJsonl(timeline.map((entry) => ({
|
|
31
|
+
project,
|
|
32
|
+
...entry,
|
|
33
|
+
cited: entry.runs[entry.runs.length - 1]?.citationState === CitationStates.cited
|
|
34
|
+
})));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (timeline.length === 0) {
|
|
38
|
+
console.log('No query evidence yet. Trigger a run first with "canonry run".');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
console.log(`Evidence: ${project}
|
|
42
|
+
`);
|
|
43
|
+
for (const entry of timeline) {
|
|
44
|
+
const latest = entry.runs[entry.runs.length - 1];
|
|
45
|
+
if (!latest) continue;
|
|
46
|
+
const state = latest.citationState === CitationStates.cited ? "\u2713 cited" : "\u2717 not-cited";
|
|
47
|
+
const transition = latest.transition !== latest.citationState ? ` (${latest.transition})` : "";
|
|
48
|
+
console.log(` ${state}${transition} ${entry.query}`);
|
|
49
|
+
}
|
|
50
|
+
console.log(`
|
|
51
|
+
Queries: ${timeline.length}`);
|
|
52
|
+
const cited = timeline.filter((e) => e.runs[e.runs.length - 1]?.citationState === CitationStates.cited).length;
|
|
53
|
+
console.log(` Cited: ${cited} / ${timeline.length}`);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
showEvidence
|
|
57
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-V5D4XNWV.js";
|
|
4
|
+
import "./chunk-OFL4PTYU.js";
|
|
5
|
+
import "./chunk-AOJU5LKX.js";
|
|
6
|
+
import {
|
|
7
|
+
isEndpointMissing,
|
|
8
|
+
isMachineFormat
|
|
9
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
10
|
+
import {
|
|
11
|
+
isRedactedNotificationUrl
|
|
12
|
+
} from "./chunk-O4RMPA6H.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
14
|
+
|
|
15
|
+
// src/commands/export-cmd.ts
|
|
16
|
+
import { stringify } from "yaml";
|
|
17
|
+
async function exportProject(project, opts) {
|
|
18
|
+
const client = createApiClient();
|
|
19
|
+
const data = opts.includeSecrets ? await client.getExport(project, { includeSecrets: true }) : await client.getExport(project);
|
|
20
|
+
if (data.spec.notifications?.some((notification) => isRedactedNotificationUrl(notification.url))) {
|
|
21
|
+
console.error("Notification webhook URLs are redacted. Use --include-secrets with administrator authority to export them.");
|
|
22
|
+
}
|
|
23
|
+
if (opts.includeResults) {
|
|
24
|
+
const results = await loadLatestRunForExport(client, project);
|
|
25
|
+
if (results) data.results = results;
|
|
26
|
+
}
|
|
27
|
+
if (isMachineFormat(opts.format)) {
|
|
28
|
+
console.log(JSON.stringify(data, null, 2));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
console.log(stringify(data));
|
|
32
|
+
}
|
|
33
|
+
async function loadLatestRunForExport(client, project) {
|
|
34
|
+
try {
|
|
35
|
+
const latest = await client.getLatestRun(project);
|
|
36
|
+
return latest.run ?? null;
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (!isEndpointMissing(err)) throw err;
|
|
39
|
+
}
|
|
40
|
+
const runs = await client.listRuns(project);
|
|
41
|
+
if (runs.length === 0) return null;
|
|
42
|
+
const latestRun = runs.reduce(
|
|
43
|
+
(current, candidate) => candidate.createdAt > current.createdAt ? candidate : current
|
|
44
|
+
);
|
|
45
|
+
return client.getRun(latestRun.id);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
exportProject
|
|
49
|
+
};
|