@koda-sl/baker-cli 0.366.0 → 0.367.0-dev.7e4c749ba

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/cli.js CHANGED
@@ -69,7 +69,7 @@ import {
69
69
  validateCanvasDeep,
70
70
  withoutCastName,
71
71
  ytDlpBlockSignal
72
- } from "./chunk-AI4HWQVN.js";
72
+ } from "./chunk-K2IKLMCM.js";
73
73
  import {
74
74
  csvOrJson,
75
75
  daysAgoIso,
@@ -1819,6 +1819,17 @@ var linkedinDraftOpInputSchema = z3.discriminatedUnion("kind", [
1819
1819
  updateOp("leadForm.update", leadFormUpdateSchema)
1820
1820
  ]);
1821
1821
 
1822
+ // ../api/src/ads-linkedin/search-statuses.ts
1823
+ var LINKEDIN_SEARCH_STATUSES = {
1824
+ campaignGroups: ["ACTIVE", "PAUSED", "ARCHIVED", "CANCELED", "DRAFT", "PENDING_DELETION", "REMOVED"],
1825
+ campaigns: ["ACTIVE", "PAUSED", "ARCHIVED", "COMPLETED", "CANCELED", "DRAFT", "PENDING_DELETION", "REMOVED"],
1826
+ creatives: ["ACTIVE", "PAUSED", "ARCHIVED", "CANCELED", "DRAFT", "PENDING_DELETION", "REMOVED"]
1827
+ };
1828
+ function unsupportedLinkedinSearchStatuses(level, statuses) {
1829
+ const accepted = LINKEDIN_SEARCH_STATUSES[level];
1830
+ return statuses.filter((status) => !accepted.includes(status));
1831
+ }
1832
+
1822
1833
  // ../api/src/ads-linkedin/wire.ts
1823
1834
  import { z as z7 } from "zod";
1824
1835
 
@@ -19816,10 +19827,6 @@ Full guide: __tooling__/docs/tools/baker/ads-google.md`
19816
19827
  // src/commands/ads/linkedin/index.ts
19817
19828
  import { defineCommand as defineCommand53 } from "citty";
19818
19829
 
19819
- // src/commands/ads/linkedin/write-shared.ts
19820
- import { createHash } from "crypto";
19821
- import { readFileSync as readFileSync5 } from "fs";
19822
-
19823
19830
  // src/commands/ads/linkedin/shared.ts
19824
19831
  var DAY_MS2 = 864e5;
19825
19832
  function handleLinkedinError(err) {
@@ -19912,18 +19919,48 @@ function daysAgoIso2(days) {
19912
19919
  function csvOrJson2(args5) {
19913
19920
  return args5.output ?? "json";
19914
19921
  }
19915
- function resolveStatusFilter(args5) {
19922
+ function statusesArgDescription(level) {
19923
+ return `CSV of statuses (${LINKEDIN_SEARCH_STATUSES[level].join(",")})`;
19924
+ }
19925
+ function statusFilterError(level, statuses) {
19926
+ const unsupported = unsupportedLinkedinSearchStatuses(level, statuses);
19927
+ if (unsupported.length === 0) {
19928
+ return null;
19929
+ }
19930
+ const accepted = LINKEDIN_SEARCH_STATUSES[level].join(",");
19931
+ return {
19932
+ ok: false,
19933
+ error: {
19934
+ code: "INVALID_STATUS",
19935
+ message: `LinkedIn does not accept status ${unsupported.join(", ")} for this listing.`,
19936
+ fix: {
19937
+ action: "retry_with_flag",
19938
+ explanation: `Re-run with --statuses from ${accepted}, or --all-statuses to drop the filter.`
19939
+ },
19940
+ retryable: false
19941
+ }
19942
+ };
19943
+ }
19944
+ function resolveStatusFilter(args5, level) {
19916
19945
  if (args5["all-statuses"]) {
19917
19946
  return void 0;
19918
19947
  }
19919
19948
  const explicit = args5.statuses;
19920
- if (explicit) {
19921
- return explicit.split(",").map((s) => s.trim().toUpperCase()).filter(Boolean);
19949
+ if (!explicit) {
19950
+ return ["ACTIVE"];
19951
+ }
19952
+ const statuses = explicit.split(",").map((s) => s.trim().toUpperCase()).filter(Boolean);
19953
+ const error = statusFilterError(level, statuses);
19954
+ if (error) {
19955
+ writeAdsJson(error);
19956
+ process.exit(1);
19922
19957
  }
19923
- return ["ACTIVE"];
19958
+ return statuses;
19924
19959
  }
19925
19960
 
19926
19961
  // src/commands/ads/linkedin/write-shared.ts
19962
+ import { createHash } from "crypto";
19963
+ import { readFileSync as readFileSync5 } from "fs";
19927
19964
  var TOTAL_BUDGET_HELP = "Lifetime budget \u2014 on something already running it must exceed spend to date, or LinkedIn rejects it";
19928
19965
  function bareAccountId(args5) {
19929
19966
  const raw = resolveAccountIdArg2(args5);
@@ -20250,7 +20287,7 @@ registerSchema({
20250
20287
  "account-id": { type: "string", description: "Account ID", required: false },
20251
20288
  "account-urn": { type: "string", description: "Alias for --account-id", required: false },
20252
20289
  "all-statuses": { type: "boolean", description: "Drop the ACTIVE filter", required: false },
20253
- statuses: { type: "string", description: "CSV of statuses", required: false },
20290
+ statuses: { type: "string", description: statusesArgDescription("campaignGroups"), required: false },
20254
20291
  limit: { type: "string", description: "Max rows (default 500)", required: false },
20255
20292
  "no-cache": NO_CACHE_ARG,
20256
20293
  output: { type: "string", description: "json|csv|jsonl|md", required: false, default: "json" }
@@ -20264,7 +20301,7 @@ registerSchema({
20264
20301
  "account-urn": { type: "string", description: "Alias", required: false },
20265
20302
  "campaign-group-id": { type: "string", description: "Filter by campaign group", required: false },
20266
20303
  "all-statuses": { type: "boolean", description: "Drop the ACTIVE filter", required: false },
20267
- statuses: { type: "string", description: "CSV of statuses", required: false },
20304
+ statuses: { type: "string", description: statusesArgDescription("campaigns"), required: false },
20268
20305
  limit: { type: "string", description: "Max rows", required: false },
20269
20306
  "no-cache": NO_CACHE_ARG,
20270
20307
  output: { type: "string", description: "json|csv|jsonl|md", required: false, default: "json" }
@@ -20278,7 +20315,7 @@ registerSchema({
20278
20315
  "account-urn": { type: "string", description: "Alias", required: false },
20279
20316
  "campaign-id": { type: "string", description: "Filter by campaign", required: false },
20280
20317
  "all-statuses": { type: "boolean", description: "Drop the ACTIVE filter", required: false },
20281
- statuses: { type: "string", description: "CSV of statuses", required: false },
20318
+ statuses: { type: "string", description: statusesArgDescription("creatives"), required: false },
20282
20319
  fields: {
20283
20320
  type: "string",
20284
20321
  description: "CSV of dotted paths to return instead of the compact row, e.g. id,content.textAd.landingPage",
@@ -22647,7 +22684,7 @@ var listArgs = {
22647
22684
  "account-id": { type: "string", description: "Numeric account ID or urn:li:sponsoredAccount:N" },
22648
22685
  "account-urn": { type: "string", description: "Alias for --account-id" },
22649
22686
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
22650
- statuses: { type: "string", description: "CSV of statuses (ACTIVE,PAUSED,ARCHIVED,COMPLETED,DRAFT)" },
22687
+ statuses: { type: "string", description: statusesArgDescription("campaignGroups") },
22651
22688
  limit: { type: "string", description: "Max rows (default: 500)" },
22652
22689
  "no-cache": NO_CACHE_ARG,
22653
22690
  output: { type: "string", description: "json|csv|jsonl|md", default: "json" }
@@ -22662,7 +22699,7 @@ var campaignGroupsListCommand = defineCommand40({
22662
22699
  const accountId = resolveAccountIdArg2(args5);
22663
22700
  try {
22664
22701
  const params = { "account-id": accountId };
22665
- const statuses = resolveStatusFilter(args5);
22702
+ const statuses = resolveStatusFilter(args5, "campaignGroups");
22666
22703
  if (statuses) params.statuses = statuses.join(",");
22667
22704
  if (args5.limit) params.limit = String(args5.limit);
22668
22705
  if (args5["no-cache"]) params["skip-cache"] = "true";
@@ -22713,7 +22750,7 @@ var listArgs2 = {
22713
22750
  "account-urn": { type: "string", description: "Alias for --account-id" },
22714
22751
  "campaign-group-id": { type: "string", description: "Filter by campaign group" },
22715
22752
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
22716
- statuses: { type: "string", description: "CSV of statuses" },
22753
+ statuses: { type: "string", description: statusesArgDescription("campaigns") },
22717
22754
  limit: { type: "string", description: "Max rows (default: 500)" },
22718
22755
  "no-cache": NO_CACHE_ARG,
22719
22756
  output: { type: "string", description: "json|csv|jsonl|md", default: "json" }
@@ -22728,7 +22765,7 @@ var campaignsListCommand = defineCommand41({
22728
22765
  const accountId = resolveAccountIdArg2(args5);
22729
22766
  try {
22730
22767
  const params = { "account-id": accountId };
22731
- const statuses = resolveStatusFilter(args5);
22768
+ const statuses = resolveStatusFilter(args5, "campaigns");
22732
22769
  if (statuses) params.statuses = statuses.join(",");
22733
22770
  if (args5["campaign-group-id"]) params["campaign-group-id"] = String(args5["campaign-group-id"]);
22734
22771
  if (args5.limit) params.limit = String(args5.limit);
@@ -23048,7 +23085,7 @@ var listArgs3 = {
23048
23085
  "account-urn": { type: "string", description: "Alias for --account-id" },
23049
23086
  "campaign-id": { type: "string", description: "Filter by campaign ID" },
23050
23087
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
23051
- statuses: { type: "string", description: "CSV of intended statuses (ACTIVE,PAUSED,DRAFT,ARCHIVED)" },
23088
+ statuses: { type: "string", description: statusesArgDescription("creatives") },
23052
23089
  fields: {
23053
23090
  type: "string",
23054
23091
  description: "CSV of dotted paths to return instead of the compact row, e.g. id,content.textAd.landingPage"
@@ -23068,7 +23105,7 @@ var creativesListCommand = defineCommand44({
23068
23105
  const accountId = resolveAccountIdArg2(args5);
23069
23106
  try {
23070
23107
  const params = { "account-id": accountId };
23071
- const statuses = resolveStatusFilter(args5);
23108
+ const statuses = resolveStatusFilter(args5, "creatives");
23072
23109
  if (statuses) params.statuses = statuses.join(",");
23073
23110
  if (args5["campaign-id"]) params["campaign-id"] = String(args5["campaign-id"]);
23074
23111
  if (args5.limit) params.limit = String(args5.limit);