@speedkit/cli 4.27.2 → 4.28.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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/services/onboarding/dashboard/index.js +40 -1
- package/dist/services/query-builder/query-builder-service.d.ts +18 -2
- package/dist/services/query-builder/query-builder-service.js +26 -10
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [4.28.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.27.2...v4.28.0) (2026-09-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **onboarding:** adapt apiEndpoint for devtools ([5d2b5eb](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/5d2b5ebfa8c14f2bfd680efb33c79bd169e4a64f))
|
|
7
|
+
|
|
1
8
|
## [4.27.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.27.1...v4.27.2) (2026-09-11)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -2,6 +2,38 @@ import { BaqendResponse } from "../browser/baqend-response.js";
|
|
|
2
2
|
import { safe } from "../../../helpers/safe.js";
|
|
3
3
|
import json2Csv from "json2csv";
|
|
4
4
|
import { AthenaBucket } from "../../athena/index.js";
|
|
5
|
+
/** A query option the caller left out, or the number it set. */
|
|
6
|
+
function readNumber(params, name) {
|
|
7
|
+
const raw = params.get(name);
|
|
8
|
+
if (raw === null || raw.trim() === "") {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const value = Number(raw);
|
|
12
|
+
return Number.isFinite(value) ? value : undefined;
|
|
13
|
+
}
|
|
14
|
+
/** A query option the caller left out, or the flag it set. */
|
|
15
|
+
function readFlag(params, name) {
|
|
16
|
+
const raw = params.get(name);
|
|
17
|
+
if (raw === null) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return raw !== "false" && raw !== "0";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The query options carried on the url. An option that is not there stays
|
|
24
|
+
* undefined so the value the command line was started with keeps applying —
|
|
25
|
+
* the editor sends what it shows, and it shows nothing until it has asked.
|
|
26
|
+
*/
|
|
27
|
+
function readQueryOverrides(params) {
|
|
28
|
+
return {
|
|
29
|
+
bySet: readFlag(params, "bySet"),
|
|
30
|
+
days: readNumber(params, "days"),
|
|
31
|
+
excludeNoindex: readFlag(params, "excludeNoindex"),
|
|
32
|
+
excludeSuspicious: readFlag(params, "excludeSuspicious"),
|
|
33
|
+
hardNavigationsOnly: readFlag(params, "hardNavigationsOnly"),
|
|
34
|
+
minImpressions: readNumber(params, "minImpressions"),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
5
37
|
export class Dashboard {
|
|
6
38
|
customerConfig;
|
|
7
39
|
parameterQueryBuilder;
|
|
@@ -28,7 +60,14 @@ export class Dashboard {
|
|
|
28
60
|
return this.createBaqendResponse(requestOrigin, "unsupported method");
|
|
29
61
|
}
|
|
30
62
|
if (url.pathname.startsWith("/query/create")) {
|
|
31
|
-
|
|
63
|
+
const overrides = readQueryOverrides(url.searchParams);
|
|
64
|
+
return this.createBaqendResponse(requestOrigin,
|
|
65
|
+
// The options travel back with the query: the editor offering them
|
|
66
|
+
// has no other way to learn what the command line already set.
|
|
67
|
+
JSON.stringify({
|
|
68
|
+
query: this.parameterQueryBuilder.query(overrides),
|
|
69
|
+
options: this.parameterQueryBuilder.resolvedOptions(overrides),
|
|
70
|
+
}), "application/json; charset=UTF-8");
|
|
32
71
|
}
|
|
33
72
|
if (url.pathname.startsWith("/query/execute")) {
|
|
34
73
|
const postData = request.postData;
|
|
@@ -2,6 +2,14 @@ import { QueryBuilderContext } from "./query-builder-model.js";
|
|
|
2
2
|
import { ParsedRuleSets } from "./rules/index.js";
|
|
3
3
|
import { CliServiceInterface } from "../cli/index.js";
|
|
4
4
|
import { AthenaService } from "../athena/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* The options a caller may set per query instead of per command — what the
|
|
7
|
+
* onboarding dashboard's query editor offers. Everything else a query is built
|
|
8
|
+
* from (the app, its rule sets, the catalog) is fixed for the process.
|
|
9
|
+
*/
|
|
10
|
+
export type QueryOverrides = Pick<QueryBuilderContext, "bySet" | "days" | "excludeNoindex" | "excludeSuspicious" | "hardNavigationsOnly" | "minImpressions">;
|
|
11
|
+
/** {@link QueryOverrides} with every default filled in. */
|
|
12
|
+
export type ResolvedQueryOptions = Required<QueryOverrides>;
|
|
5
13
|
export declare class QueryBuilderService {
|
|
6
14
|
private context;
|
|
7
15
|
private ruleSets;
|
|
@@ -17,8 +25,16 @@ export declare class QueryBuilderService {
|
|
|
17
25
|
* directly instead of exporting it (e.g. `auto-prewarm`).
|
|
18
26
|
*/
|
|
19
27
|
execute<T>(): Promise<T[]>;
|
|
20
|
-
/** The query as SQL. */
|
|
21
|
-
query(): string;
|
|
28
|
+
/** The query as SQL, optionally shaped by per-call overrides. */
|
|
29
|
+
query(overrides?: QueryOverrides): string;
|
|
30
|
+
/**
|
|
31
|
+
* The options a query would be built with right now, the defaults filled in.
|
|
32
|
+
*
|
|
33
|
+
* A caller that offers the options for editing — the onboarding dashboard —
|
|
34
|
+
* has to show what they currently are, and only the service knows which of
|
|
35
|
+
* them the command line left to a default.
|
|
36
|
+
*/
|
|
37
|
+
resolvedOptions(overrides?: QueryOverrides): ResolvedQueryOptions;
|
|
22
38
|
private build;
|
|
23
39
|
/**
|
|
24
40
|
* Points out where the query is not exactly what the config says — a rule
|
|
@@ -92,29 +92,45 @@ export class QueryBuilderService {
|
|
|
92
92
|
async execute() {
|
|
93
93
|
return this.runQuery(this.query());
|
|
94
94
|
}
|
|
95
|
-
/** The query as SQL. */
|
|
96
|
-
query() {
|
|
97
|
-
return this.build().sql;
|
|
95
|
+
/** The query as SQL, optionally shaped by per-call overrides. */
|
|
96
|
+
query(overrides = {}) {
|
|
97
|
+
return this.build(overrides).sql;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
/**
|
|
100
|
+
* The options a query would be built with right now, the defaults filled in.
|
|
101
|
+
*
|
|
102
|
+
* A caller that offers the options for editing — the onboarding dashboard —
|
|
103
|
+
* has to show what they currently are, and only the service knows which of
|
|
104
|
+
* them the command line left to a default.
|
|
105
|
+
*/
|
|
106
|
+
resolvedOptions(overrides = {}) {
|
|
107
|
+
return {
|
|
108
|
+
bySet: overrides.bySet ?? this.context.bySet ?? false,
|
|
109
|
+
days: overrides.days ??
|
|
110
|
+
this.context.days ??
|
|
111
|
+
DEFAULT_QUERY_DAYS[this.context.queryType],
|
|
112
|
+
excludeNoindex: overrides.excludeNoindex ?? this.context.excludeNoindex ?? false,
|
|
113
|
+
excludeSuspicious: overrides.excludeSuspicious ?? this.context.excludeSuspicious ?? false,
|
|
114
|
+
hardNavigationsOnly: overrides.hardNavigationsOnly ??
|
|
115
|
+
this.context.hardNavigationsOnly ??
|
|
116
|
+
false,
|
|
117
|
+
minImpressions: overrides.minImpressions ?? this.context.minImpressions ?? 1,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
build(overrides = {}) {
|
|
100
121
|
const input = {
|
|
101
122
|
app: this.context.app,
|
|
102
123
|
catalog: this.context.catalog,
|
|
103
|
-
bySet: this.context.bySet,
|
|
104
124
|
count: this.context.count,
|
|
105
|
-
days: this.context.days ?? DEFAULT_QUERY_DAYS[this.context.queryType],
|
|
106
125
|
devices: this.context.devices,
|
|
107
126
|
excludeNotFound: this.context.excludeNotFound,
|
|
108
|
-
excludeNoindex: this.context.excludeNoindex,
|
|
109
|
-
excludeSuspicious: this.context.excludeSuspicious,
|
|
110
|
-
hardNavigationsOnly: this.context.hardNavigationsOnly,
|
|
111
127
|
hosts: this.context.hosts,
|
|
112
128
|
limit: this.context.limit,
|
|
113
129
|
match: this.context.match,
|
|
114
130
|
minHits: this.context.minHits,
|
|
115
|
-
minImpressions: this.context.minImpressions,
|
|
116
131
|
ruleSets: this.ruleSets,
|
|
117
132
|
variations: this.context.variations,
|
|
133
|
+
...this.resolvedOptions(overrides),
|
|
118
134
|
};
|
|
119
135
|
return this.context.queryType === QueryType.prewarm
|
|
120
136
|
? buildPrewarmQuery(input)
|
package/oclif.manifest.json
CHANGED