@koda-sl/baker-cli 0.846.0 → 0.849.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/README.md +6 -1
- package/dist/{accounts-S7CRQTBB.js → accounts-PVPBCV3W.js} +3 -3
- package/dist/{ads-47ISOFKG.js → ads-NXIIU57V.js} +3 -3
- package/dist/{analytics-IXZHQ2ZZ.js → analytics-MZ5A66JO.js} +13 -13
- package/dist/{changes-JOJR4K4H.js → changes-SGLPIZL6.js} +3 -3
- package/dist/{chunk-LSNLFNDJ.js → chunk-37NXS55Q.js} +2 -2
- package/dist/{chunk-3OZTT3XC.js → chunk-D4GVSSL3.js} +2 -2
- package/dist/{chunk-KR2OWPYB.js → chunk-HGEG5AJW.js} +73 -19
- package/dist/chunk-HGEG5AJW.js.map +1 -0
- package/dist/{chunk-V34Q2PYJ.js → chunk-HORX3JLB.js} +2 -2
- package/dist/{chunk-52V3VGQI.js → chunk-MGHAKUDW.js} +38 -5
- package/dist/chunk-MGHAKUDW.js.map +1 -0
- package/dist/{chunk-5TKGCYSU.js → chunk-OQQN2UJS.js} +2 -2
- package/dist/{chunk-ZWLYPZWW.js → chunk-SCK7U53A.js} +3 -3
- package/dist/{chunk-SXZ537Q2.js → chunk-STWMK24H.js} +2 -2
- package/dist/{chunk-PNOKIJFM.js → chunk-T7GAC2WG.js} +8 -2
- package/dist/chunk-T7GAC2WG.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/{currency-GMVPN52V.js → currency-L2VCDEKG.js} +3 -3
- package/dist/{funnel-UFYTP7LR.js → funnel-YR3ROIPN.js} +3 -3
- package/dist/{google-RX4QDXLD.js → google-RRNBSRIF.js} +22 -13
- package/dist/google-RRNBSRIF.js.map +1 -0
- package/dist/{lookup-VGSMSP7E.js → lookup-IAY43D6F.js} +4 -4
- package/dist/{performance-LYCO7VAB.js → performance-3L7J4KQG.js} +5 -4
- package/dist/performance-3L7J4KQG.js.map +1 -0
- package/dist/{plan-JS42ZMCZ.js → plan-LVTD6FZI.js} +3 -3
- package/dist/{query-6UXOYBET.js → query-ZIV5EBKY.js} +4 -4
- package/dist/{questionnaire-S7UADGOY.js → questionnaire-7Y4QYVC6.js} +3 -3
- package/dist/{search-terms-ZE364HEC.js → search-terms-32OOCXD7.js} +2 -2
- package/dist/{sends-WF4IKUFF.js → sends-TCVUTCLV.js} +66 -16
- package/dist/sends-TCVUTCLV.js.map +1 -0
- package/dist/{sources-OVLH6OZ2.js → sources-RA2KD7VO.js} +4 -4
- package/dist/{unstage-JZAIRBVA.js → unstage-6QVKZITE.js} +3 -3
- package/dist/{url-options-JK525H2M.js → url-options-HQWSPLSF.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-52V3VGQI.js.map +0 -1
- package/dist/chunk-KR2OWPYB.js.map +0 -1
- package/dist/chunk-PNOKIJFM.js.map +0 -1
- package/dist/google-RX4QDXLD.js.map +0 -1
- package/dist/performance-LYCO7VAB.js.map +0 -1
- package/dist/sends-WF4IKUFF.js.map +0 -1
- /package/dist/{accounts-S7CRQTBB.js.map → accounts-PVPBCV3W.js.map} +0 -0
- /package/dist/{ads-47ISOFKG.js.map → ads-NXIIU57V.js.map} +0 -0
- /package/dist/{analytics-IXZHQ2ZZ.js.map → analytics-MZ5A66JO.js.map} +0 -0
- /package/dist/{changes-JOJR4K4H.js.map → changes-SGLPIZL6.js.map} +0 -0
- /package/dist/{chunk-LSNLFNDJ.js.map → chunk-37NXS55Q.js.map} +0 -0
- /package/dist/{chunk-3OZTT3XC.js.map → chunk-D4GVSSL3.js.map} +0 -0
- /package/dist/{chunk-V34Q2PYJ.js.map → chunk-HORX3JLB.js.map} +0 -0
- /package/dist/{chunk-5TKGCYSU.js.map → chunk-OQQN2UJS.js.map} +0 -0
- /package/dist/{chunk-ZWLYPZWW.js.map → chunk-SCK7U53A.js.map} +0 -0
- /package/dist/{chunk-SXZ537Q2.js.map → chunk-STWMK24H.js.map} +0 -0
- /package/dist/{currency-GMVPN52V.js.map → currency-L2VCDEKG.js.map} +0 -0
- /package/dist/{funnel-UFYTP7LR.js.map → funnel-YR3ROIPN.js.map} +0 -0
- /package/dist/{lookup-VGSMSP7E.js.map → lookup-IAY43D6F.js.map} +0 -0
- /package/dist/{plan-JS42ZMCZ.js.map → plan-LVTD6FZI.js.map} +0 -0
- /package/dist/{query-6UXOYBET.js.map → query-ZIV5EBKY.js.map} +0 -0
- /package/dist/{questionnaire-S7UADGOY.js.map → questionnaire-7Y4QYVC6.js.map} +0 -0
- /package/dist/{search-terms-ZE364HEC.js.map → search-terms-32OOCXD7.js.map} +0 -0
- /package/dist/{sources-OVLH6OZ2.js.map → sources-RA2KD7VO.js.map} +0 -0
- /package/dist/{unstage-JZAIRBVA.js.map → unstage-6QVKZITE.js.map} +0 -0
- /package/dist/{url-options-JK525H2M.js.map → url-options-HQWSPLSF.js.map} +0 -0
package/README.md
CHANGED
|
@@ -451,6 +451,8 @@ Brand, competitor and non-brand are read per search term and keyword by Baker's
|
|
|
451
451
|
|
|
452
452
|
Compact by default; `--full` returns every field. `overview` prints each platform's and currency's headline — spend, results, result value, cost per result, ROAS and their change against the settled days before — plus goals and open alerts; the other metrics, the daily trend and the data status are `--full`'s, and the days in between are `trend`. `entity` prints its 10 newest changes; when it loaded more, `changesRead` says how many (the read loads at most 100 of its own and 100 inside it, so there can be more), `--full` prints them all and `changes --entity-ids <id>` (or `--campaign-ids <id>`) with the `--start`/`--end` its hint names (the read loads changes up to today, past its window) pages through every one. Errors with `ADS_NOT_CONNECTED` (and a `fix`) when no ad platform is connected.
|
|
453
453
|
|
|
454
|
+
`trend --group-by campaign` or `--group-by ad_account` prints each row's `name` beside its `group` id (the name the platform holds now), so naming a group takes no other read; the `__other` row, which sums the campaigns past `--limit`, has no name.
|
|
455
|
+
|
|
454
456
|
`search-terms` and `breakdown` are compact too; `--full` returns every row and field. `brand-split`, `impression-share`, `keyword-quality` and `google-report` read Google Ads only and no longer take `--platforms`; `entity` and `diagnose` are about one entity and no longer take `--platforms` or `--campaign-ids`. On `tracking` and `landings`, `--ad-account-ids` and `--campaign-ids` narrow only the ad numbers, never the visits.
|
|
455
457
|
|
|
456
458
|
A call the command cannot run stops with an `INVALID_ARGS` envelope naming the flag, before anything is read: a missing required argument, an unknown subcommand, a stray positional, or a flag passed with nothing in it (`--ad-account-ids ","`, `--landing ""`) — an empty list would otherwise read everything. A `--currency` Baker has no exchange rate for is refused with a `fix` pointing at `baker ads performance currency` (`canShowIn`), or `native`.
|
|
@@ -734,7 +736,7 @@ Failures a read can carry on from: `BUDGET_EXCEEDED` (the backend ran out of the
|
|
|
734
736
|
| `age-performance` / `gender-performance` | Results by age range / gender per ad group | LAST_30_DAYS |
|
|
735
737
|
| `ai-max-search-terms` | AI Max search terms with the headline and landing page used | LAST_30_DAYS |
|
|
736
738
|
| `bidding-strategy-performance` | Portfolio bidding strategies: type, status, targets and metrics | LAST_30_DAYS |
|
|
737
|
-
| `conversion-tags` | Website and call conversions'
|
|
739
|
+
| `conversion-tags` | Website and call conversions' `send_to` (`AW-<id>/<label>`); `--full` adds the Google tag and event snippet | — |
|
|
738
740
|
| `account-budget` | The account budget in force now: limit after adjustments, served, funds left (`ACCOUNT_FUNDS`), pending change, budgets waiting for approval | — |
|
|
739
741
|
| `account-budget-history` | Every account budget, ended and cancelled ones too | — |
|
|
740
742
|
| `recommendations` | Google's open recommendations with impact | — |
|
|
@@ -882,6 +884,8 @@ baker ads google keyword-lists list --customer-id 1234567890 --members
|
|
|
882
884
|
|
|
883
885
|
Lists exist for `campaigns`, `budgets`, `ad-groups`, `keywords`, `negative-keywords` (`--level campaign|adGroup`), `keyword-lists` (`--members` for the terms), `ads`, `assets`, `asset-groups`, `audiences`, `conversions`, `bidding-strategies`, `labels`, `campaign-criteria`, `ad-group-criteria`, `ad-group-bid-modifiers` and `account-exclusions`.
|
|
884
886
|
|
|
887
|
+
`conversions list` (and `query --preset conversion-actions`) answers the question it is nearly always asked — which label is which action — as a Markdown table of each action's id, `send_to` (`AW-<id>/<label>`) and name, the name cut at 40 characters; `-` means the action has no website tag. Seven actions fit in under 1KB. `--full`, `--output json` or `--fields` prints every column (type, category, origin, status, primary or secondary, counting) as asked (on `query`, `--full` adds the tag snippets too), and `--out` files keep every column.
|
|
888
|
+
|
|
885
889
|
---
|
|
886
890
|
|
|
887
891
|
### `baker ads google keywords discover`
|
|
@@ -2118,6 +2122,7 @@ baker analytics sites --add example.com # and every subdomain of it — applie
|
|
|
2118
2122
|
baker analytics website-tag # the tag for a site Baker does not publish, with the key in it
|
|
2119
2123
|
baker analytics sends # where each system event is sent, and what happened to each upload
|
|
2120
2124
|
baker analytics sends --history # when each send was set up, and whether its integration was removed
|
|
2125
|
+
baker analytics sends --platform meta # only what goes to Meta: its sends, tags, parameters and each event's match there
|
|
2121
2126
|
baker analytics sends --set --source-event page:deal_won --platform meta --tag <tagId> --event Purchase # staged; spends budget once published
|
|
2122
2127
|
baker analytics sends --set --source-event page:deal_won --platform meta --tag <tagId> --event Purchase --parameter content_name={{properties.plan}} # with an extra Meta custom_data parameter
|
|
2123
2128
|
baker analytics sends --uploads s1 --failed # the uploads Meta refused, each with the event and Meta's own words
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
} from "./chunk-6AUTRWTB.js";
|
|
8
8
|
import {
|
|
9
9
|
serverFailure
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-D4GVSSL3.js";
|
|
11
|
+
import "./chunk-MGHAKUDW.js";
|
|
12
12
|
import "./chunk-ZVMOABEC.js";
|
|
13
13
|
import {
|
|
14
14
|
cacheGet,
|
|
@@ -119,4 +119,4 @@ Examples:
|
|
|
119
119
|
export {
|
|
120
120
|
accountsCommand
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=accounts-
|
|
122
|
+
//# sourceMappingURL=accounts-PVPBCV3W.js.map
|
|
@@ -33,16 +33,16 @@ Examples:
|
|
|
33
33
|
Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedin|x|chatgpt|performance|terms)`
|
|
34
34
|
},
|
|
35
35
|
subCommands: {
|
|
36
|
-
google: () => import("./google-
|
|
36
|
+
google: () => import("./google-RRNBSRIF.js").then((m) => m.googleCommand),
|
|
37
37
|
meta: () => import("./meta-2ZQ3CWLF.js").then((m) => m.metaCommand),
|
|
38
38
|
linkedin: () => import("./linkedin-AN3XZMLI.js").then((m) => m.linkedinCommand),
|
|
39
39
|
x: () => import("./x-KBTEQOBL.js").then((m) => m.xCommand),
|
|
40
40
|
chatgpt: () => import("./chatgpt-HBHB7HCD.js").then((m) => m.chatgptCommand),
|
|
41
|
-
performance: () => import("./performance-
|
|
41
|
+
performance: () => import("./performance-3L7J4KQG.js").then((m) => m.performanceCommand),
|
|
42
42
|
terms: () => import("./terms-J33CD7MY.js").then((m) => m.termsCommand)
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
export {
|
|
46
46
|
adsCommand
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=ads-
|
|
48
|
+
//# sourceMappingURL=ads-NXIIU57V.js.map
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
serverFeedFields,
|
|
16
16
|
withheldBreakdownHint,
|
|
17
17
|
writeAnalyticsReport
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OQQN2UJS.js";
|
|
19
19
|
import {
|
|
20
20
|
flowDataPath,
|
|
21
21
|
flowExists,
|
|
@@ -25,23 +25,23 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
peopleArgs,
|
|
27
27
|
peopleLimitError
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-SCK7U53A.js";
|
|
29
29
|
import {
|
|
30
30
|
INGEST_ARRIVALS_MAX,
|
|
31
31
|
eventIngestUrl,
|
|
32
32
|
ingestBrief
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-37NXS55Q.js";
|
|
34
34
|
import {
|
|
35
35
|
ConversionArgsError,
|
|
36
36
|
conversionsWrite,
|
|
37
37
|
parseConversionsArgs
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-HORX3JLB.js";
|
|
39
39
|
import {
|
|
40
40
|
TAG_MANAGER_TIMEOUT_MS
|
|
41
41
|
} from "./chunk-ZWANN4QQ.js";
|
|
42
42
|
import {
|
|
43
43
|
analyticsErrorEnvelope
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-STWMK24H.js";
|
|
45
45
|
import {
|
|
46
46
|
companyNameKey
|
|
47
47
|
} from "./chunk-AYKV2B6X.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
isAdPlatform,
|
|
65
65
|
isBookkeepingRow,
|
|
66
66
|
rowMatchKeys
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-T7GAC2WG.js";
|
|
68
68
|
import "./chunk-5TURKO4J.js";
|
|
69
69
|
import {
|
|
70
70
|
withWindowSpellings
|
|
@@ -2759,22 +2759,22 @@ Full guide: __tooling__/docs/tools/baker/analytics.md`
|
|
|
2759
2759
|
tags: tagsCommand,
|
|
2760
2760
|
events: eventsCommand,
|
|
2761
2761
|
feed: feedCommand,
|
|
2762
|
-
lookup: () => import("./lookup-
|
|
2762
|
+
lookup: () => import("./lookup-IAY43D6F.js").then((m) => m.lookupCommand),
|
|
2763
2763
|
devices: devicesCommand,
|
|
2764
2764
|
ads: adsCommand,
|
|
2765
2765
|
conversions: conversionsCommand,
|
|
2766
|
-
sends: () => import("./sends-
|
|
2766
|
+
sends: () => import("./sends-TCVUTCLV.js").then((m) => m.sendsCommand),
|
|
2767
2767
|
map: mapCommand,
|
|
2768
|
-
unstage: () => import("./unstage-
|
|
2768
|
+
unstage: () => import("./unstage-6QVKZITE.js").then((m) => m.unstageCommand),
|
|
2769
2769
|
tracking: trackingCommand,
|
|
2770
2770
|
arrivals: arrivalsCommand,
|
|
2771
2771
|
"sending-events": sendingEventsCommand,
|
|
2772
|
-
sources: () => import("./sources-
|
|
2772
|
+
sources: () => import("./sources-RA2KD7VO.js").then((m) => m.sourcesCommand),
|
|
2773
2773
|
"website-tag": websiteTagCommand,
|
|
2774
2774
|
debug: debugCommand,
|
|
2775
2775
|
sites: sitesCommand,
|
|
2776
|
-
plan: () => import("./plan-
|
|
2777
|
-
questionnaire: () => import("./questionnaire-
|
|
2776
|
+
plan: () => import("./plan-LVTD6FZI.js").then((m) => m.planCommand),
|
|
2777
|
+
questionnaire: () => import("./questionnaire-7Y4QYVC6.js").then((m) => m.questionnaireCommand),
|
|
2778
2778
|
presets: presetsCommand
|
|
2779
2779
|
}
|
|
2780
2780
|
});
|
|
@@ -2788,4 +2788,4 @@ export {
|
|
|
2788
2788
|
requestBody,
|
|
2789
2789
|
sendingEventsAddress
|
|
2790
2790
|
};
|
|
2791
|
-
//# sourceMappingURL=analytics-
|
|
2791
|
+
//# sourceMappingURL=analytics-MZ5A66JO.js.map
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
cappedChangesHint,
|
|
7
7
|
parseApiError,
|
|
8
8
|
resolveChangesWindow
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-D4GVSSL3.js";
|
|
10
|
+
import "./chunk-MGHAKUDW.js";
|
|
11
11
|
import {
|
|
12
12
|
CHANGES_MAX_LIMIT,
|
|
13
13
|
CHANGE_RESOURCE_TYPES,
|
|
@@ -285,4 +285,4 @@ Examples:
|
|
|
285
285
|
export {
|
|
286
286
|
changesCommand
|
|
287
287
|
};
|
|
288
|
-
//# sourceMappingURL=changes-
|
|
288
|
+
//# sourceMappingURL=changes-SGLPIZL6.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-GRQ2AXDX.js";
|
|
5
5
|
import {
|
|
6
6
|
EVENT_ITEMS_MAX
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T7GAC2WG.js";
|
|
8
8
|
import {
|
|
9
9
|
EVENT_INGEST_BATCH_MAX,
|
|
10
10
|
EVENT_INGEST_BODY_MAX_BYTES,
|
|
@@ -476,4 +476,4 @@ export {
|
|
|
476
476
|
eventIngestUrl,
|
|
477
477
|
ingestBrief
|
|
478
478
|
};
|
|
479
|
-
//# sourceMappingURL=chunk-
|
|
479
|
+
//# sourceMappingURL=chunk-37NXS55Q.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PRESETS,
|
|
3
3
|
equivalentBetween
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MGHAKUDW.js";
|
|
5
5
|
import {
|
|
6
6
|
CHANGES_MAX_LIMIT,
|
|
7
7
|
CHANGE_RESOURCE_TYPES,
|
|
@@ -860,4 +860,4 @@ export {
|
|
|
860
860
|
serverFailure,
|
|
861
861
|
parseApiError
|
|
862
862
|
};
|
|
863
|
-
//# sourceMappingURL=chunk-
|
|
863
|
+
//# sourceMappingURL=chunk-D4GVSSL3.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
NO_OR_EXPLANATION,
|
|
11
11
|
listFieldGuidance,
|
|
12
12
|
parseApiError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-D4GVSSL3.js";
|
|
14
14
|
import {
|
|
15
15
|
PRESETS,
|
|
16
16
|
SERVING_CHAINS,
|
|
@@ -21,8 +21,9 @@ import {
|
|
|
21
21
|
isCampaignScoped,
|
|
22
22
|
isDuringLiteral,
|
|
23
23
|
isInventoryPreset,
|
|
24
|
-
isSearchable
|
|
25
|
-
|
|
24
|
+
isSearchable,
|
|
25
|
+
leanRows
|
|
26
|
+
} from "./chunk-MGHAKUDW.js";
|
|
26
27
|
import {
|
|
27
28
|
withWindowSpellings
|
|
28
29
|
} from "./chunk-74QGFUZL.js";
|
|
@@ -59,6 +60,29 @@ import {
|
|
|
59
60
|
// src/commands/ads/google/query.ts
|
|
60
61
|
import { appendFileSync, existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
61
62
|
import { resolve } from "path";
|
|
63
|
+
|
|
64
|
+
// ../api/src/ads-google/conversion-tags.ts
|
|
65
|
+
var TAG_SNIPPETS_FIELD = "conversion_action.tag_snippets";
|
|
66
|
+
var SEND_TO_FIELD = "conversion_action.send_to";
|
|
67
|
+
var SEND_TO_PATTERN = /AW-\d+\/[\w-]+/;
|
|
68
|
+
function snippetSendTo(snippets) {
|
|
69
|
+
if (!Array.isArray(snippets)) return void 0;
|
|
70
|
+
for (const snippet of snippets) {
|
|
71
|
+
const text = typeof snippet?.eventSnippet === "string" ? snippet.eventSnippet : "";
|
|
72
|
+
const sendTo = SEND_TO_PATTERN.exec(text)?.[0];
|
|
73
|
+
if (sendTo !== void 0) return sendTo;
|
|
74
|
+
}
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
function withSendTo(row, keepSnippets) {
|
|
78
|
+
if (!(TAG_SNIPPETS_FIELD in row)) return row;
|
|
79
|
+
const sendTo = snippetSendTo(row[TAG_SNIPPETS_FIELD]);
|
|
80
|
+
if (sendTo === void 0) return row;
|
|
81
|
+
const { [TAG_SNIPPETS_FIELD]: snippets, ...rest } = row;
|
|
82
|
+
return { ...rest, [SEND_TO_FIELD]: sendTo, ...keepSnippets ? { [TAG_SNIPPETS_FIELD]: snippets } : {} };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/commands/ads/google/query.ts
|
|
62
86
|
import { defineCommand } from "citty";
|
|
63
87
|
import { parse as parseCsv } from "csv-parse/sync";
|
|
64
88
|
import { quote as quoteShell } from "shell-quote";
|
|
@@ -779,9 +803,8 @@ registerSchema({
|
|
|
779
803
|
},
|
|
780
804
|
output: {
|
|
781
805
|
type: "string",
|
|
782
|
-
description: "Output format: json|csv|jsonl|md",
|
|
806
|
+
description: "Output format: json|csv|jsonl|md. Default json, except --preset conversion-actions (and conversions list), which answers with an md table of each action's id, send_to and name unless a format, --fields or --full is asked for.",
|
|
783
807
|
required: false,
|
|
784
|
-
default: "json",
|
|
785
808
|
enum: ["json", "csv", "jsonl", "md"]
|
|
786
809
|
},
|
|
787
810
|
fields: {
|
|
@@ -792,7 +815,7 @@ registerSchema({
|
|
|
792
815
|
"no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false },
|
|
793
816
|
full: {
|
|
794
817
|
type: "boolean",
|
|
795
|
-
description: "Include the field description glossary in the JSON envelope. Off by default \u2014 rows already carry the data; only ask for this when you need a field's meaning explained.",
|
|
818
|
+
description: "Include the field description glossary in the JSON envelope, and a conversion action's tag_snippets whole (the Google tag and event snippet to put on a site) beside its send_to. Off by default \u2014 rows already carry the data, and a conversion action reads as its send_to (AW-<id>/<label>) alone; only ask for this when you need a field's meaning explained or the code itself.",
|
|
796
819
|
required: false
|
|
797
820
|
}
|
|
798
821
|
}
|
|
@@ -802,12 +825,15 @@ function extractFields(rows) {
|
|
|
802
825
|
foldObservedFields(rows, keys);
|
|
803
826
|
return [...keys];
|
|
804
827
|
}
|
|
805
|
-
function resultColumns(gaql, rows) {
|
|
828
|
+
function resultColumns(gaql, rows, keepSnippets = false) {
|
|
806
829
|
const observed = extractFields(rows);
|
|
807
830
|
const columns = observed.includes("level") ? ["level"] : [];
|
|
808
831
|
for (const field of parseSelectedFields(gaql)) {
|
|
809
832
|
const leaves = observed.filter((key) => key.startsWith(`${field}.`));
|
|
810
|
-
|
|
833
|
+
if (field === TAG_SNIPPETS_FIELD) {
|
|
834
|
+
columns.push(SEND_TO_FIELD);
|
|
835
|
+
if (keepSnippets || observed.includes(field)) columns.push(field);
|
|
836
|
+
} else columns.push(...leaves.length > 0 ? leaves : [field]);
|
|
811
837
|
}
|
|
812
838
|
for (const key of observed) columns.push(key);
|
|
813
839
|
return [...new Set(columns)];
|
|
@@ -815,7 +841,7 @@ function resultColumns(gaql, rows) {
|
|
|
815
841
|
function isCsvPath(filePath) {
|
|
816
842
|
return filePath.split(".").pop()?.toLowerCase() === "csv";
|
|
817
843
|
}
|
|
818
|
-
function fileColumnsFor(file, gaql, rows, append) {
|
|
844
|
+
function fileColumnsFor(file, gaql, rows, append, keepSnippets) {
|
|
819
845
|
if (append && isCsvPath(file.target) && existsSync(file.partial)) {
|
|
820
846
|
const [header] = parseCsv(readFileSync(file.partial, "utf-8"), {
|
|
821
847
|
relax_column_count: true,
|
|
@@ -824,7 +850,7 @@ function fileColumnsFor(file, gaql, rows, append) {
|
|
|
824
850
|
});
|
|
825
851
|
if (header && header.length > 0) return header;
|
|
826
852
|
}
|
|
827
|
-
return resultColumns(gaql, rows);
|
|
853
|
+
return resultColumns(gaql, rows, keepSnippets);
|
|
828
854
|
}
|
|
829
855
|
function writeRowsToFile(filePath, target, rows, fields, append) {
|
|
830
856
|
if (isCsvPath(target)) {
|
|
@@ -981,8 +1007,14 @@ function writeNarrowed(envelope, fields) {
|
|
|
981
1007
|
function pickColumns(row, columns) {
|
|
982
1008
|
return Object.fromEntries(columns.filter((column) => column in row).map((column) => [column, row[column]]));
|
|
983
1009
|
}
|
|
984
|
-
function
|
|
1010
|
+
function leanView(args) {
|
|
1011
|
+
if (args.full || args.output !== void 0 || requestedFields(args) || typeof args.preset !== "string")
|
|
1012
|
+
return void 0;
|
|
1013
|
+
return getPreset(args.preset)?.lean;
|
|
1014
|
+
}
|
|
1015
|
+
function outputResults(readRows, fieldDescs, warnings, args, cached, read) {
|
|
985
1016
|
const format = args.output || "json";
|
|
1017
|
+
const rows = readRows.map((row) => withSendTo(row, Boolean(args.full)));
|
|
986
1018
|
const allWarnings = [
|
|
987
1019
|
...warnings,
|
|
988
1020
|
...completenessWarnings({
|
|
@@ -992,7 +1024,14 @@ function outputResults(rows, fieldDescs, warnings, args, cached, read) {
|
|
|
992
1024
|
})
|
|
993
1025
|
];
|
|
994
1026
|
const fields = requestedFields(args);
|
|
995
|
-
const
|
|
1027
|
+
const lean = leanView(args);
|
|
1028
|
+
if (lean) {
|
|
1029
|
+
writeRows("md", leanRows(lean, rows), lean.columns, allWarnings);
|
|
1030
|
+
writeLine(`> ${lean.note} Every column, as JSON: --output json.`);
|
|
1031
|
+
if (read.nextCursor) writeLine(`> Next page: the same command plus --cursor ${read.nextCursor}`);
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
const columns = resultColumns(read.gaql, rows, Boolean(args.full));
|
|
996
1035
|
const chosen = fields ? chosenColumns(columns, fields) : { columns, unmatched: [] };
|
|
997
1036
|
const unmatched = chosen.unmatched.length > 0 ? [
|
|
998
1037
|
{
|
|
@@ -1204,6 +1243,7 @@ function unobservedFields(gaql, observed) {
|
|
|
1204
1243
|
if (field.endsWith(".resource_name")) return false;
|
|
1205
1244
|
if (observed.has(field)) return false;
|
|
1206
1245
|
if (unionPartners(field).some((partner) => observed.has(partner))) return false;
|
|
1246
|
+
if (field === TAG_SNIPPETS_FIELD) return false;
|
|
1207
1247
|
return ![...observed].some((key) => key.startsWith(`${field}.`));
|
|
1208
1248
|
});
|
|
1209
1249
|
}
|
|
@@ -1379,10 +1419,11 @@ async function readPages(gaql, body, args, servingOptions, file, progress) {
|
|
|
1379
1419
|
foldConvertingRows(rows, convertingRows);
|
|
1380
1420
|
if (file) {
|
|
1381
1421
|
const shouldAppend = args.append || progress.rowsRead > 0;
|
|
1382
|
-
|
|
1383
|
-
|
|
1422
|
+
const written = rows.map((row) => withSendTo(row, Boolean(args.full)));
|
|
1423
|
+
fileColumns ??= fileColumnsFor(file, gaql, written, shouldAppend, Boolean(args.full));
|
|
1424
|
+
writeRowsToFile(file.partial, file.target, written, fileColumns, shouldAppend);
|
|
1384
1425
|
keywordLimits = collectKeywordLimits(rows, servingOptions, keywordLimits);
|
|
1385
|
-
foldObservedFields(
|
|
1426
|
+
foldObservedFields(written, observedFields);
|
|
1386
1427
|
budgetRows = budgetRows.concat(rows.filter(isBudgetRow));
|
|
1387
1428
|
moneySample ??= moneyExample(rows);
|
|
1388
1429
|
} else {
|
|
@@ -1582,7 +1623,7 @@ function handleQueryError(thrown, finalQuery, levels, customerId, limit, args) {
|
|
|
1582
1623
|
envelope.error.fix = conflictFix(envelope.error.fix, finalQuery, levels, customerId, limit, args);
|
|
1583
1624
|
}
|
|
1584
1625
|
if (thrown instanceof StoppedRead) {
|
|
1585
|
-
const partial = partialReadFor(thrown.partial, err);
|
|
1626
|
+
const partial = printedPartial(partialReadFor(thrown.partial, err), Boolean(args.full));
|
|
1586
1627
|
envelope.error.partial = partial;
|
|
1587
1628
|
envelope.error.fix.explanation += ` ${partialReadAdvice(partial)}`;
|
|
1588
1629
|
if (partial.cursor) {
|
|
@@ -1632,11 +1673,16 @@ function rerunRead(gaql, levels, args) {
|
|
|
1632
1673
|
function rerunCommand(read, customerId, limit, args, extra) {
|
|
1633
1674
|
const words = ["baker", "ads", "google", "query", ...read, "--customer-id", customerId, "--limit", String(limit)];
|
|
1634
1675
|
if (args.all) words.push("--all");
|
|
1676
|
+
if (args.full) words.push("--full");
|
|
1635
1677
|
if (typeof args.output === "string" && args.output !== "json") words.push("--output", args.output);
|
|
1636
1678
|
const company = optionalTargetCompany();
|
|
1637
1679
|
if (company) words.push("--company", company);
|
|
1638
1680
|
return quoteShell([...words, ...extra]);
|
|
1639
1681
|
}
|
|
1682
|
+
function printedPartial(partial, keepSnippets) {
|
|
1683
|
+
if (!("data" in partial)) return partial;
|
|
1684
|
+
return { ...partial, data: partial.data.map((row) => withSendTo(row, keepSnippets)) };
|
|
1685
|
+
}
|
|
1640
1686
|
function partialReadFor(partial, err) {
|
|
1641
1687
|
if (err instanceof ApiError && err.code === "CONFLICT") {
|
|
1642
1688
|
const { cursor: _unresumable, ...rest } = partial;
|
|
@@ -1769,14 +1815,22 @@ Examples:
|
|
|
1769
1815
|
description: "Append to file; with --cursor, carries on a stopped read in the <file>.partial it left",
|
|
1770
1816
|
required: false
|
|
1771
1817
|
},
|
|
1772
|
-
output: {
|
|
1818
|
+
output: {
|
|
1819
|
+
type: "string",
|
|
1820
|
+
description: "Format: json|csv|jsonl|md (default json; --preset conversion-actions: an md table of id, send_to and name unless a format, --fields or --full is asked for)",
|
|
1821
|
+
required: false
|
|
1822
|
+
},
|
|
1773
1823
|
fields: {
|
|
1774
1824
|
type: "string",
|
|
1775
1825
|
description: "Only these columns, comma-separated (--fields campaign.name,campaign.status); every format",
|
|
1776
1826
|
required: false
|
|
1777
1827
|
},
|
|
1778
1828
|
"no-cache": { type: "boolean", description: "Skip cache", required: false },
|
|
1779
|
-
full: {
|
|
1829
|
+
full: {
|
|
1830
|
+
type: "boolean",
|
|
1831
|
+
description: "Include the field description glossary, and conversion tag snippets whole beside their send_to",
|
|
1832
|
+
required: false
|
|
1833
|
+
}
|
|
1780
1834
|
}),
|
|
1781
1835
|
run: async ({ args }) => {
|
|
1782
1836
|
if (args["list-presets"]) {
|
|
@@ -1826,4 +1880,4 @@ export {
|
|
|
1826
1880
|
runQuery,
|
|
1827
1881
|
queryCommand
|
|
1828
1882
|
};
|
|
1829
|
-
//# sourceMappingURL=chunk-
|
|
1883
|
+
//# sourceMappingURL=chunk-HGEG5AJW.js.map
|