@gscdump/analysis 1.0.2 → 1.0.3
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/_chunks/default-registry.d.mts +5 -0
- package/dist/_chunks/default-registry.mjs +5183 -0
- package/dist/_chunks/errors.d.mts +52 -0
- package/dist/_chunks/index.d.mts +89 -0
- package/dist/_chunks/index2.d.mts +37 -0
- package/dist/_chunks/report.mjs +1710 -0
- package/dist/_chunks/scoring.mjs +15 -0
- package/dist/_chunks/source.mjs +60 -0
- package/dist/default-registry.d.mts +2 -8
- package/dist/default-registry.mjs +2 -4892
- package/dist/errors.d.mts +1 -51
- package/dist/index.d.mts +7 -154
- package/dist/index.mjs +8 -7025
- package/dist/report/index.d.mts +1 -116
- package/dist/report/index.mjs +1 -1771
- package/dist/source/index.d.mts +2 -0
- package/dist/source/index.mjs +2 -0
- package/package.json +9 -4
package/dist/report/index.d.mts
CHANGED
|
@@ -1,117 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Result } from "gscdump/result";
|
|
3
|
-
import { AnalyzerRegistry } from "@gscdump/engine/analyzer";
|
|
4
|
-
import { AnalysisQuerySource } from "@gscdump/engine/source";
|
|
5
|
-
interface FormatReportOptions {
|
|
6
|
-
/** Cap findings rendered per section. Defaults to all (already bounded by report). */
|
|
7
|
-
maxFindingsPerSection?: number;
|
|
8
|
-
}
|
|
9
|
-
declare function formatReport(report: ReportResult, opts?: FormatReportOptions): string;
|
|
10
|
-
declare const REPORTS: readonly DefinedReport<ReportParams>[];
|
|
11
|
-
declare const defaultReportRegistry: import("@gscdump/engine/report").ReportRegistry;
|
|
12
|
-
/**
|
|
13
|
-
* `resolveTarget()` — stub day-one resolver. Future versions can wire in
|
|
14
|
-
* fuzzy matching / embedding similarity / a manifest cache without
|
|
15
|
-
* changing the contract.
|
|
16
|
-
*
|
|
17
|
-
* Today: case-insensitive exact match, falling back to substring (LIKE %x%)
|
|
18
|
-
* over a caller-supplied candidate list.
|
|
19
|
-
*/
|
|
20
|
-
type ResolveTargetKind = 'page' | 'query';
|
|
21
|
-
interface ResolveTargetInput {
|
|
22
|
-
kind: ResolveTargetKind;
|
|
23
|
-
input: string;
|
|
24
|
-
/**
|
|
25
|
-
* Pool to resolve against. Empty pool ⇒ caller trusts the input verbatim
|
|
26
|
-
* (resolver returns it as `exact`). Useful when the caller doesn't have
|
|
27
|
-
* a candidate list yet but knows the value is correct.
|
|
28
|
-
*/
|
|
29
|
-
candidates?: readonly string[];
|
|
30
|
-
}
|
|
31
|
-
interface ResolveTargetResult {
|
|
32
|
-
/** Best exact match from `candidates` (case-insensitive), or trusted input when no candidates were supplied. */
|
|
33
|
-
exact: string | null;
|
|
34
|
-
/** All candidates that include the input as a substring (case-insensitive). Includes `exact` if matched. */
|
|
35
|
-
matches: string[];
|
|
36
|
-
/** True when no candidates matched at all. */
|
|
37
|
-
unresolved: boolean;
|
|
38
|
-
}
|
|
39
|
-
declare function resolveTarget(opts: ResolveTargetInput): ResolveTargetResult;
|
|
40
|
-
type AnalysisError = {
|
|
41
|
-
kind: 'missing-report-param';
|
|
42
|
-
report: string;
|
|
43
|
-
param: string;
|
|
44
|
-
message: string;
|
|
45
|
-
} | {
|
|
46
|
-
kind: 'missing-comparison-window';
|
|
47
|
-
report: string;
|
|
48
|
-
message: string;
|
|
49
|
-
} | {
|
|
50
|
-
kind: 'missing-brand-terms';
|
|
51
|
-
message: string;
|
|
52
|
-
} | {
|
|
53
|
-
kind: 'unknown-report';
|
|
54
|
-
report: string;
|
|
55
|
-
available: readonly string[];
|
|
56
|
-
message: string;
|
|
57
|
-
} | {
|
|
58
|
-
kind: 'unknown-analyzer';
|
|
59
|
-
analyzer: string;
|
|
60
|
-
message: string;
|
|
61
|
-
} | {
|
|
62
|
-
kind: 'required-step-failed';
|
|
63
|
-
report: string;
|
|
64
|
-
stepKey: string;
|
|
65
|
-
stepError: string;
|
|
66
|
-
message: string;
|
|
67
|
-
cause?: unknown;
|
|
68
|
-
};
|
|
69
|
-
interface RunReportOptions<P extends ReportParams = ReportParams> {
|
|
70
|
-
source: AnalysisQuerySource;
|
|
71
|
-
analyzers: AnalyzerRegistry;
|
|
72
|
-
ctx: ReportContext<P>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* `Result`-returning core for {@link runReport}. Models the one
|
|
76
|
-
* caller-actionable failure of a structurally-valid report run: a required
|
|
77
|
-
* step's analyzer threw (`required-step-failed`, with the underlying error as
|
|
78
|
-
* `cause`). Hosts can map that to a 4xx/partial response instead of catching an
|
|
79
|
-
* untyped `Error`.
|
|
80
|
-
*
|
|
81
|
-
* Steps execute in parallel via `Promise.all`. The report's `reduce` is invoked
|
|
82
|
-
* with a results bag that only contains successful steps — sections that
|
|
83
|
-
* depended on a failed step should set their own `coverage: 'partial'` (the
|
|
84
|
-
* runtime additionally marks `meta.degraded` when any step errored).
|
|
85
|
-
*
|
|
86
|
-
* The report's own `plan()` param-validation throws (`--target` etc.) are
|
|
87
|
-
* defects from this core's perspective and still propagate; those are modelled
|
|
88
|
-
* at the report-definition boundary, not here.
|
|
89
|
-
*/
|
|
90
|
-
declare function runReportResult<P extends ReportParams = ReportParams>(report: DefinedReport<P>, opts: RunReportOptions<P>): Promise<Result<ReportResult, AnalysisError>>;
|
|
91
|
-
/**
|
|
92
|
-
* Throwing wrapper over {@link runReportResult}, preserving the historical
|
|
93
|
-
* call-site ergonomics (a required-step failure rejects). The thrown message is
|
|
94
|
-
* kept verbatim (`runReport(id): required step "k" failed: ...`) so existing
|
|
95
|
-
* assertions hold; the typed `AnalysisError` is reachable via `.analysisError`
|
|
96
|
-
* and the original failure via `.cause`.
|
|
97
|
-
*/
|
|
98
|
-
declare function runReport<P extends ReportParams = ReportParams>(report: DefinedReport<P>, opts: RunReportOptions<P>): Promise<ReportResult>;
|
|
99
|
-
interface DryRunReportResult {
|
|
100
|
-
steps: {
|
|
101
|
-
key: string;
|
|
102
|
-
type: string;
|
|
103
|
-
estRowsScanned?: number;
|
|
104
|
-
}[];
|
|
105
|
-
windowResolved: {
|
|
106
|
-
start: string;
|
|
107
|
-
end: string;
|
|
108
|
-
days: number;
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Plan-only preview. v1 doesn't compute row estimates — analyzer-level
|
|
113
|
-
* cost models don't exist yet — so `estRowsScanned` is left undefined.
|
|
114
|
-
* Useful right now only as an "is this report wired up correctly?" check.
|
|
115
|
-
*/
|
|
116
|
-
declare function dryRunReport<P extends ReportParams = ReportParams>(report: DefinedReport<P>, ctx: ReportContext<P>): Promise<DryRunReportResult>;
|
|
1
|
+
import { DryRunReportResult, FormatReportOptions, REPORTS, ResolveTargetInput, ResolveTargetKind, ResolveTargetResult, RunReportOptions, defaultReportRegistry, dryRunReport, formatReport, resolveTarget, runReport, runReportResult } from "../_chunks/index.mjs";
|
|
117
2
|
export { type DryRunReportResult, type FormatReportOptions, REPORTS, type ResolveTargetInput, type ResolveTargetKind, type ResolveTargetResult, type RunReportOptions, defaultReportRegistry, dryRunReport, formatReport, resolveTarget, runReport, runReportResult };
|