@koda-sl/baker-cli 0.22.0-dev.ecc541fb → 0.24.0-dev.55a07065
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 +65 -9
- package/dist/cli.js +1 -1
- package/dist/commands/actions/create.d.ts +0 -5
- package/dist/commands/actions/create.d.ts.map +1 -1
- package/dist/commands/actions/create.js +0 -15
- package/dist/commands/actions/create.js.map +1 -1
- package/dist/commands/actions/update.d.ts +0 -5
- package/dist/commands/actions/update.d.ts.map +1 -1
- package/dist/commands/actions/update.js +3 -14
- package/dist/commands/actions/update.js.map +1 -1
- package/dist/commands/ads/index.d.ts.map +1 -1
- package/dist/commands/ads/index.js +8 -2
- package/dist/commands/ads/index.js.map +1 -1
- package/dist/commands/ads/meta/account.d.ts +11 -0
- package/dist/commands/ads/meta/account.d.ts.map +1 -0
- package/dist/commands/ads/meta/account.js +32 -0
- package/dist/commands/ads/meta/account.js.map +1 -0
- package/dist/commands/ads/meta/accounts.d.ts +20 -0
- package/dist/commands/ads/meta/accounts.d.ts.map +1 -0
- package/dist/commands/ads/meta/accounts.js +55 -0
- package/dist/commands/ads/meta/accounts.js.map +1 -0
- package/dist/commands/ads/meta/activities.d.ts +24 -0
- package/dist/commands/ads/meta/activities.d.ts.map +1 -0
- package/dist/commands/ads/meta/activities.js +44 -0
- package/dist/commands/ads/meta/activities.js.map +1 -0
- package/dist/commands/ads/meta/ads.d.ts +32 -0
- package/dist/commands/ads/meta/ads.d.ts.map +1 -0
- package/dist/commands/ads/meta/ads.js +54 -0
- package/dist/commands/ads/meta/ads.js.map +1 -0
- package/dist/commands/ads/meta/adsets.d.ts +28 -0
- package/dist/commands/ads/meta/adsets.d.ts.map +1 -0
- package/dist/commands/ads/meta/adsets.js +47 -0
- package/dist/commands/ads/meta/adsets.js.map +1 -0
- package/dist/commands/ads/meta/audiences.d.ts +20 -0
- package/dist/commands/ads/meta/audiences.d.ts.map +1 -0
- package/dist/commands/ads/meta/audiences.js +41 -0
- package/dist/commands/ads/meta/audiences.js.map +1 -0
- package/dist/commands/ads/meta/businesses.d.ts +12 -0
- package/dist/commands/ads/meta/businesses.d.ts.map +1 -0
- package/dist/commands/ads/meta/businesses.js +35 -0
- package/dist/commands/ads/meta/businesses.js.map +1 -0
- package/dist/commands/ads/meta/campaigns.d.ts +24 -0
- package/dist/commands/ads/meta/campaigns.d.ts.map +1 -0
- package/dist/commands/ads/meta/campaigns.js +48 -0
- package/dist/commands/ads/meta/campaigns.js.map +1 -0
- package/dist/commands/ads/meta/catalogs.d.ts +17 -0
- package/dist/commands/ads/meta/catalogs.d.ts.map +1 -0
- package/dist/commands/ads/meta/catalogs.js +37 -0
- package/dist/commands/ads/meta/catalogs.js.map +1 -0
- package/dist/commands/ads/meta/creatives.d.ts +24 -0
- package/dist/commands/ads/meta/creatives.d.ts.map +1 -0
- package/dist/commands/ads/meta/creatives.js +51 -0
- package/dist/commands/ads/meta/creatives.js.map +1 -0
- package/dist/commands/ads/meta/currency.d.ts +11 -0
- package/dist/commands/ads/meta/currency.d.ts.map +1 -0
- package/dist/commands/ads/meta/currency.js +31 -0
- package/dist/commands/ads/meta/currency.js.map +1 -0
- package/dist/commands/ads/meta/high-demand-periods.d.ts +17 -0
- package/dist/commands/ads/meta/high-demand-periods.d.ts.map +1 -0
- package/dist/commands/ads/meta/high-demand-periods.js +33 -0
- package/dist/commands/ads/meta/high-demand-periods.js.map +1 -0
- package/dist/commands/ads/meta/images.d.ts +24 -0
- package/dist/commands/ads/meta/images.d.ts.map +1 -0
- package/dist/commands/ads/meta/images.js +45 -0
- package/dist/commands/ads/meta/images.js.map +1 -0
- package/dist/commands/ads/meta/index.d.ts +2 -0
- package/dist/commands/ads/meta/index.d.ts.map +1 -0
- package/dist/commands/ads/meta/index.js +76 -0
- package/dist/commands/ads/meta/index.js.map +1 -0
- package/dist/commands/ads/meta/insights.d.ts +81 -0
- package/dist/commands/ads/meta/insights.d.ts.map +1 -0
- package/dist/commands/ads/meta/insights.js +178 -0
- package/dist/commands/ads/meta/insights.js.map +1 -0
- package/dist/commands/ads/meta/labels.d.ts +16 -0
- package/dist/commands/ads/meta/labels.d.ts.map +1 -0
- package/dist/commands/ads/meta/labels.js +34 -0
- package/dist/commands/ads/meta/labels.js.map +1 -0
- package/dist/commands/ads/meta/pixels.d.ts +33 -0
- package/dist/commands/ads/meta/pixels.d.ts.map +1 -0
- package/dist/commands/ads/meta/pixels.js +69 -0
- package/dist/commands/ads/meta/pixels.js.map +1 -0
- package/dist/commands/ads/meta/presets.d.ts +18 -0
- package/dist/commands/ads/meta/presets.d.ts.map +1 -0
- package/dist/commands/ads/meta/presets.js +110 -0
- package/dist/commands/ads/meta/presets.js.map +1 -0
- package/dist/commands/ads/meta/preview.d.ts +32 -0
- package/dist/commands/ads/meta/preview.d.ts.map +1 -0
- package/dist/commands/ads/meta/preview.js +90 -0
- package/dist/commands/ads/meta/preview.js.map +1 -0
- package/dist/commands/ads/meta/shared.d.ts +12 -0
- package/dist/commands/ads/meta/shared.d.ts.map +1 -0
- package/dist/commands/ads/meta/shared.js +59 -0
- package/dist/commands/ads/meta/shared.js.map +1 -0
- package/dist/commands/ads/meta/studies.d.ts +24 -0
- package/dist/commands/ads/meta/studies.d.ts.map +1 -0
- package/dist/commands/ads/meta/studies.js +56 -0
- package/dist/commands/ads/meta/studies.js.map +1 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -0
- package/dist/env.js.map +1 -1
- package/dist/error-handler.d.ts +1 -1
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +3 -0
- package/dist/error-handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const adsetsCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly "campaign-id": {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Filter to one campaign";
|
|
9
|
+
};
|
|
10
|
+
readonly "effective-status": {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Comma-separated effective_status filter";
|
|
13
|
+
};
|
|
14
|
+
readonly limit: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: "Max rows (default 1000)";
|
|
17
|
+
};
|
|
18
|
+
readonly "skip-cache": {
|
|
19
|
+
readonly type: "boolean";
|
|
20
|
+
readonly description: "Bypass server-side cache";
|
|
21
|
+
};
|
|
22
|
+
readonly output: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Output format";
|
|
25
|
+
readonly default: "json";
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=adsets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adsets.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/adsets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCxB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const adsetsCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "adsets",
|
|
8
|
+
description: `List ad sets in a Meta ad account, optionally scoped to one campaign.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
baker ads meta adsets --account-id act_123
|
|
12
|
+
baker ads meta adsets --campaign-id 6123456789 --effective-status ACTIVE`,
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
16
|
+
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
17
|
+
"effective-status": { type: "string", description: "Comma-separated effective_status filter" },
|
|
18
|
+
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
19
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
20
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
21
|
+
},
|
|
22
|
+
run: async ({ args }) => {
|
|
23
|
+
const accountId = resolveAccountIdArg(args);
|
|
24
|
+
try {
|
|
25
|
+
const params = { "account-id": accountId };
|
|
26
|
+
if (args["campaign-id"])
|
|
27
|
+
params["campaign-id"] = args["campaign-id"];
|
|
28
|
+
if (args["effective-status"])
|
|
29
|
+
params["effective-status"] = args["effective-status"];
|
|
30
|
+
if (args.limit)
|
|
31
|
+
params.limit = args.limit;
|
|
32
|
+
if (args["skip-cache"])
|
|
33
|
+
params["skip-cache"] = "true";
|
|
34
|
+
const data = await apiGet("/api/ads/meta/adsets", params);
|
|
35
|
+
const fmt = csvOrJson(args);
|
|
36
|
+
if (fmt !== "json") {
|
|
37
|
+
writeAdsOutput(data, fmt);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
writeAdsJson({ ok: true, data });
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
handleMetaError(err);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=adsets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adsets.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/adsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,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AAM,CAAiC,sBAAsB,EAAE,MAAM,CAAC,CAAC;YAC1F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const audiencesCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly limit: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Max rows";
|
|
9
|
+
};
|
|
10
|
+
readonly "skip-cache": {
|
|
11
|
+
readonly type: "boolean";
|
|
12
|
+
readonly description: "Bypass server-side cache";
|
|
13
|
+
};
|
|
14
|
+
readonly output: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: "Output format";
|
|
17
|
+
readonly default: "json";
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=audiences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audiences.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/audiences.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAgC3B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const audiencesCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "audiences",
|
|
8
|
+
description: `List custom audiences for a Meta ad account. Includes lookalikes, website-pixel audiences,
|
|
9
|
+
customer-file audiences, etc. Note: Meta hides exact size when count < 1000 (privacy).
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
baker ads meta audiences --account-id act_123`,
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
16
|
+
limit: { type: "string", description: "Max rows" },
|
|
17
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
18
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
19
|
+
},
|
|
20
|
+
run: async ({ args }) => {
|
|
21
|
+
const accountId = resolveAccountIdArg(args);
|
|
22
|
+
try {
|
|
23
|
+
const params = { "account-id": accountId };
|
|
24
|
+
if (args.limit)
|
|
25
|
+
params.limit = args.limit;
|
|
26
|
+
if (args["skip-cache"])
|
|
27
|
+
params["skip-cache"] = "true";
|
|
28
|
+
const data = await apiGet("/api/ads/meta/audiences", params);
|
|
29
|
+
const fmt = csvOrJson(args);
|
|
30
|
+
if (fmt !== "json") {
|
|
31
|
+
writeAdsOutput(data, fmt);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
writeAdsJson({ ok: true, data });
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
handleMetaError(err);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=audiences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audiences.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAA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C1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const businessesCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "skip-cache": {
|
|
3
|
+
readonly type: "boolean";
|
|
4
|
+
readonly description: "Bypass server-side cache";
|
|
5
|
+
};
|
|
6
|
+
readonly output: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Output format";
|
|
9
|
+
readonly default: "json";
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=businesses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"businesses.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/businesses.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;;;EA2B5B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError } from "./shared.js";
|
|
5
|
+
export const businessesCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "businesses",
|
|
8
|
+
description: `List Meta Business Manager accounts the connected user has access to. Required for ad-studies and product-catalogs commands.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
baker ads meta businesses`,
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
15
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
16
|
+
},
|
|
17
|
+
run: async ({ args }) => {
|
|
18
|
+
try {
|
|
19
|
+
const params = {};
|
|
20
|
+
if (args["skip-cache"])
|
|
21
|
+
params["skip-cache"] = "true";
|
|
22
|
+
const data = await apiGet("/api/ads/meta/businesses", params);
|
|
23
|
+
const fmt = csvOrJson(args);
|
|
24
|
+
if (fmt !== "json") {
|
|
25
|
+
writeAdsOutput(data, fmt);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
writeAdsJson({ ok: true, data });
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
handleMetaError(err);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=businesses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"businesses.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/businesses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;IAC7C,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE;;;4BAGW;KACzB;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,0BAA0B,EAAE,MAAM,CAAC,CAAC;YAC9F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const campaignsCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly "effective-status": {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Comma-separated effective_status filter";
|
|
9
|
+
};
|
|
10
|
+
readonly limit: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Max rows (default 1000)";
|
|
13
|
+
};
|
|
14
|
+
readonly "skip-cache": {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly description: "Bypass server-side cache";
|
|
17
|
+
};
|
|
18
|
+
readonly output: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Output format";
|
|
21
|
+
readonly default: "json";
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=campaigns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/campaigns.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAsC3B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const campaignsCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "campaigns",
|
|
8
|
+
description: `List campaigns for a Meta ad account.
|
|
9
|
+
|
|
10
|
+
Note: in Meta's API, "campaign" is what we'd call a campaign group. Status uses effective_status (filterable),
|
|
11
|
+
which can be ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
baker ads meta campaigns --account-id act_123
|
|
15
|
+
baker ads meta campaigns --account-id act_123 --effective-status ACTIVE,PAUSED
|
|
16
|
+
baker ads meta campaigns --account-id act_123 --output csv`,
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
20
|
+
"effective-status": { type: "string", description: "Comma-separated effective_status filter" },
|
|
21
|
+
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
22
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
23
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
24
|
+
},
|
|
25
|
+
run: async ({ args }) => {
|
|
26
|
+
const accountId = resolveAccountIdArg(args);
|
|
27
|
+
try {
|
|
28
|
+
const params = { "account-id": accountId };
|
|
29
|
+
if (args["effective-status"])
|
|
30
|
+
params["effective-status"] = args["effective-status"];
|
|
31
|
+
if (args.limit)
|
|
32
|
+
params.limit = args.limit;
|
|
33
|
+
if (args["skip-cache"])
|
|
34
|
+
params["skip-cache"] = "true";
|
|
35
|
+
const data = await apiGet("/api/ads/meta/campaigns", params);
|
|
36
|
+
const fmt = csvOrJson(args);
|
|
37
|
+
if (fmt !== "json") {
|
|
38
|
+
writeAdsOutput(data, fmt);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
writeAdsJson({ ok: true, data });
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
handleMetaError(err);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=campaigns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE;;;;;;;;6DAQ4C;KAC1D;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACnE,kBAAkB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;QAC9F,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE;QACjE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACnE,IAAI,IAAI,CAAC,kBAAkB,CAAC;gBAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAW,CAAC;YAC9F,IAAI,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;YACpD,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,yBAAyB,EAAE,MAAM,CAAC,CAAC;YAC7F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const catalogsCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "business-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta Business Manager ID";
|
|
5
|
+
readonly required: true;
|
|
6
|
+
};
|
|
7
|
+
readonly "skip-cache": {
|
|
8
|
+
readonly type: "boolean";
|
|
9
|
+
readonly description: "Bypass server-side cache";
|
|
10
|
+
};
|
|
11
|
+
readonly output: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Output format";
|
|
14
|
+
readonly default: "json";
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=catalogs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogs.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/catalogs.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EA6B1B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError } from "./shared.js";
|
|
5
|
+
export const catalogsCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "catalogs",
|
|
8
|
+
description: `List product catalogs owned by a Meta Business. Vertical (commerce, hotels, vehicles, etc.)
|
|
9
|
+
is immutable once set.
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
baker ads meta catalogs --business-id 1234567890`,
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
"business-id": { type: "string", description: "Meta Business Manager ID", required: true },
|
|
16
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
17
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
18
|
+
},
|
|
19
|
+
run: async ({ args }) => {
|
|
20
|
+
try {
|
|
21
|
+
const params = { "business-id": args["business-id"] };
|
|
22
|
+
if (args["skip-cache"])
|
|
23
|
+
params["skip-cache"] = "true";
|
|
24
|
+
const data = await apiGet("/api/ads/meta/catalogs", params);
|
|
25
|
+
const fmt = csvOrJson(args);
|
|
26
|
+
if (fmt !== "json") {
|
|
27
|
+
writeAdsOutput(data, fmt);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
writeAdsJson({ ok: true, data });
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
handleMetaError(err);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=catalogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogs.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/catalogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;IAC3C,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;;;;mDAIkC;KAChD;IACD,IAAI,EAAE;QACJ,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1F,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,CAAW,EAAE,CAAC;YACxF,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,wBAAwB,EAAE,MAAM,CAAC,CAAC;YAC5F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const creativesCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID (required if no --creative-id)";
|
|
5
|
+
};
|
|
6
|
+
readonly "creative-id": {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Single creative ID";
|
|
9
|
+
};
|
|
10
|
+
readonly limit: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Max rows (default 500)";
|
|
13
|
+
};
|
|
14
|
+
readonly "skip-cache": {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly description: "Bypass server-side cache";
|
|
17
|
+
};
|
|
18
|
+
readonly output: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Output format";
|
|
21
|
+
readonly default: "json";
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=creatives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creatives.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/creatives.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAyC3B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const creativesCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "creatives",
|
|
8
|
+
description: `List ad creatives in an account, or fetch a single creative by ID.
|
|
9
|
+
|
|
10
|
+
Important: Meta creatives are effectively immutable once attached to an ad. Editing copy/image/CTA = create
|
|
11
|
+
a new creative + reattach. Bake this into any agentic edit workflow.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
baker ads meta creatives --account-id act_123
|
|
15
|
+
baker ads meta creatives --creative-id 23842... # fetch one`,
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
"account-id": { type: "string", description: "Meta ad account ID (required if no --creative-id)" },
|
|
19
|
+
"creative-id": { type: "string", description: "Single creative ID" },
|
|
20
|
+
limit: { type: "string", description: "Max rows (default 500)" },
|
|
21
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
22
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
23
|
+
},
|
|
24
|
+
run: async ({ args }) => {
|
|
25
|
+
try {
|
|
26
|
+
const params = {};
|
|
27
|
+
if (args["creative-id"]) {
|
|
28
|
+
params["creative-id"] = args["creative-id"];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const accountId = resolveAccountIdArg(args);
|
|
32
|
+
params["account-id"] = accountId;
|
|
33
|
+
}
|
|
34
|
+
if (args.limit)
|
|
35
|
+
params.limit = args.limit;
|
|
36
|
+
if (args["skip-cache"])
|
|
37
|
+
params["skip-cache"] = "true";
|
|
38
|
+
const data = await apiGet("/api/ads/meta/creatives", params);
|
|
39
|
+
const fmt = csvOrJson(args);
|
|
40
|
+
if (Array.isArray(data) && fmt !== "json") {
|
|
41
|
+
writeAdsOutput(data, fmt);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
writeAdsJson({ ok: true, data });
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
handleMetaError(err);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=creatives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creatives.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/creatives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE;;;;;;;gEAO+C;KAC7D;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mDAAmD,EAAE;QAClG,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACpE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;QAChE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBACxB,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAW,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;gBAC5C,MAAM,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;YACnC,CAAC;YACD,IAAI,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;YACpD,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAU,yBAAyB,EAAE,MAAM,CAAC,CAAC;YACtE,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBAC1C,cAAc,CAAC,IAAsC,EAAE,GAAG,CAAC,CAAC;gBAC5D,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const currencyCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly "skip-cache": {
|
|
7
|
+
readonly type: "boolean";
|
|
8
|
+
readonly description: "Bypass server-side cache";
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/currency.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;;;;EA0B1B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson } from "../output.js";
|
|
4
|
+
import { handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const currencyCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "currency",
|
|
8
|
+
description: `Lookup the currency + timezone for a Meta ad account. Lightweight wrapper around the account detail endpoint, cached 1 day.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
baker ads meta currency --account-id act_123`,
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
15
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
16
|
+
},
|
|
17
|
+
run: async ({ args }) => {
|
|
18
|
+
const accountId = resolveAccountIdArg(args);
|
|
19
|
+
try {
|
|
20
|
+
const params = { "account-id": accountId };
|
|
21
|
+
if (args["skip-cache"])
|
|
22
|
+
params["skip-cache"] = "true";
|
|
23
|
+
const data = await apiGet("/api/ads/meta/currency", params);
|
|
24
|
+
writeAdsJson({ ok: true, data });
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
handleMetaError(err);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=currency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;IAC3C,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;;;+CAG8B;KAC5C;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACnE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;KAC3E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACnE,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CACvB,wBAAwB,EACxB,MAAM,CACP,CAAC;YACF,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const highDemandPeriodsCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "campaign-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta campaign ID";
|
|
5
|
+
readonly required: true;
|
|
6
|
+
};
|
|
7
|
+
readonly "skip-cache": {
|
|
8
|
+
readonly type: "boolean";
|
|
9
|
+
readonly description: "Bypass server-side cache";
|
|
10
|
+
};
|
|
11
|
+
readonly output: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Output format";
|
|
14
|
+
readonly default: "json";
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=high-demand-periods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"high-demand-periods.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/high-demand-periods.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;EAyBnC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError } from "./shared.js";
|
|
5
|
+
export const highDemandPeriodsCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "high-demand-periods",
|
|
8
|
+
description: `List scheduled budget bumps (e.g. Black Friday windows) on a campaign.`,
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
"campaign-id": { type: "string", description: "Meta campaign ID", required: true },
|
|
12
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
13
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
14
|
+
},
|
|
15
|
+
run: async ({ args }) => {
|
|
16
|
+
try {
|
|
17
|
+
const params = { "campaign-id": args["campaign-id"] };
|
|
18
|
+
if (args["skip-cache"])
|
|
19
|
+
params["skip-cache"] = "true";
|
|
20
|
+
const data = await apiGet("/api/ads/meta/high-demand-periods", params);
|
|
21
|
+
const fmt = csvOrJson(args);
|
|
22
|
+
if (fmt !== "json") {
|
|
23
|
+
writeAdsOutput(data, fmt);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
writeAdsJson({ ok: true, data });
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
handleMetaError(err);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=high-demand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CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const imagesCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly hash: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Filter to one image hash";
|
|
9
|
+
};
|
|
10
|
+
readonly limit: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Max rows (default 500)";
|
|
13
|
+
};
|
|
14
|
+
readonly "skip-cache": {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly description: "Bypass server-side cache";
|
|
17
|
+
};
|
|
18
|
+
readonly output: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Output format";
|
|
21
|
+
readonly default: "json";
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/images.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;EAmCxB,CAAC"}
|