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

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
@@ -977,6 +977,14 @@ var OBJECTIVE_CAMPAIGN_TYPES = {
977
977
  LEAD_GENERATION: ["SPONSORED_UPDATES", "SPONSORED_INMAILS"],
978
978
  ENGAGEMENT: ["SPONSORED_UPDATES", "DYNAMIC"]
979
979
  };
980
+ var ENTITY_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED", "CANCELED", "DRAFT", "COMPLETED"];
981
+ var CAMPAIGN_GROUP_STATUSES = [
982
+ "ACTIVE",
983
+ "PAUSED",
984
+ "ARCHIVED",
985
+ "CANCELED",
986
+ "DRAFT"
987
+ ];
980
988
  var STAGEABLE_CREATE_STATUSES = ["DRAFT", "ACTIVE", "PAUSED"];
981
989
  var CREATIVE_INTENDED_STATUSES = ["ACTIVE", "PAUSED", "DRAFT"];
982
990
  var CTA_TYPES = [
@@ -1104,7 +1112,7 @@ var targetingCriteriaSchema = z3.object({
1104
1112
  }).optional()
1105
1113
  });
1106
1114
  var stageableStatusSchema = z3.enum(STAGEABLE_CREATE_STATUSES);
1107
- var entityStatusSchema = z3.enum(["ACTIVE", "PAUSED", "ARCHIVED", "CANCELED", "DRAFT", "COMPLETED"]);
1115
+ var entityStatusSchema = z3.enum(ENTITY_STATUSES);
1108
1116
  function currencyMinimums(currencyCode) {
1109
1117
  return CURRENCY_MINIMUMS[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM;
1110
1118
  }
@@ -1118,7 +1126,7 @@ var campaignGroupUpdateSchema = z3.object({
1118
1126
  name: z3.string().min(1).max(LINKEDIN_LIMITS.campaignGroup.nameMax).optional(),
1119
1127
  runSchedule: runScheduleSchema.optional(),
1120
1128
  totalBudget: moneySchema.optional(),
1121
- status: entityStatusSchema.optional()
1129
+ status: z3.enum(CAMPAIGN_GROUP_STATUSES).optional()
1122
1130
  }).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
1123
1131
  var campaignFields = {
1124
1132
  name: z3.string().min(1).max(LINKEDIN_LIMITS.campaign.nameMax),
@@ -1819,16 +1827,17 @@ var linkedinDraftOpInputSchema = z3.discriminatedUnion("kind", [
1819
1827
  updateOp("leadForm.update", leadFormUpdateSchema)
1820
1828
  ]);
1821
1829
 
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"]
1830
+ // ../api/src/ads-linkedin/transitions.ts
1831
+ var CAMPAIGN_GROUP_TRANSITIONS = {
1832
+ DRAFT: ["ACTIVE", "PAUSED", "CANCELED", "ARCHIVED"],
1833
+ ACTIVE: ["PAUSED", "CANCELED", "ARCHIVED"],
1834
+ PAUSED: ["ACTIVE", "CANCELED", "ARCHIVED"],
1835
+ ARCHIVED: ["ACTIVE", "PAUSED"]
1836
+ };
1837
+ var CAMPAIGN_TRANSITIONS = {
1838
+ ...CAMPAIGN_GROUP_TRANSITIONS,
1839
+ ACTIVE: ["PAUSED", "CANCELED", "ARCHIVED", "COMPLETED"]
1827
1840
  };
1828
- function unsupportedLinkedinSearchStatuses(level, statuses) {
1829
- const accepted = LINKEDIN_SEARCH_STATUSES[level];
1830
- return statuses.filter((status) => !accepted.includes(status));
1831
- }
1832
1841
 
1833
1842
  // ../api/src/ads-linkedin/wire.ts
1834
1843
  import { z as z7 } from "zod";
@@ -19827,6 +19836,10 @@ Full guide: __tooling__/docs/tools/baker/ads-google.md`
19827
19836
  // src/commands/ads/linkedin/index.ts
19828
19837
  import { defineCommand as defineCommand53 } from "citty";
19829
19838
 
19839
+ // src/commands/ads/linkedin/write-shared.ts
19840
+ import { createHash } from "crypto";
19841
+ import { readFileSync as readFileSync5 } from "fs";
19842
+
19830
19843
  // src/commands/ads/linkedin/shared.ts
19831
19844
  var DAY_MS2 = 864e5;
19832
19845
  function handleLinkedinError(err) {
@@ -19919,48 +19932,18 @@ function daysAgoIso2(days) {
19919
19932
  function csvOrJson2(args5) {
19920
19933
  return args5.output ?? "json";
19921
19934
  }
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) {
19935
+ function resolveStatusFilter(args5) {
19945
19936
  if (args5["all-statuses"]) {
19946
19937
  return void 0;
19947
19938
  }
19948
19939
  const explicit = args5.statuses;
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);
19940
+ if (explicit) {
19941
+ return explicit.split(",").map((s) => s.trim().toUpperCase()).filter(Boolean);
19957
19942
  }
19958
- return statuses;
19943
+ return ["ACTIVE"];
19959
19944
  }
19960
19945
 
19961
19946
  // src/commands/ads/linkedin/write-shared.ts
19962
- import { createHash } from "crypto";
19963
- import { readFileSync as readFileSync5 } from "fs";
19964
19947
  var TOTAL_BUDGET_HELP = "Lifetime budget \u2014 on something already running it must exceed spend to date, or LinkedIn rejects it";
19965
19948
  function bareAccountId(args5) {
19966
19949
  const raw = resolveAccountIdArg2(args5);
@@ -20287,7 +20270,7 @@ registerSchema({
20287
20270
  "account-id": { type: "string", description: "Account ID", required: false },
20288
20271
  "account-urn": { type: "string", description: "Alias for --account-id", required: false },
20289
20272
  "all-statuses": { type: "boolean", description: "Drop the ACTIVE filter", required: false },
20290
- statuses: { type: "string", description: statusesArgDescription("campaignGroups"), required: false },
20273
+ statuses: { type: "string", description: "CSV of statuses", required: false },
20291
20274
  limit: { type: "string", description: "Max rows (default 500)", required: false },
20292
20275
  "no-cache": NO_CACHE_ARG,
20293
20276
  output: { type: "string", description: "json|csv|jsonl|md", required: false, default: "json" }
@@ -20301,7 +20284,7 @@ registerSchema({
20301
20284
  "account-urn": { type: "string", description: "Alias", required: false },
20302
20285
  "campaign-group-id": { type: "string", description: "Filter by campaign group", required: false },
20303
20286
  "all-statuses": { type: "boolean", description: "Drop the ACTIVE filter", required: false },
20304
- statuses: { type: "string", description: statusesArgDescription("campaigns"), required: false },
20287
+ statuses: { type: "string", description: "CSV of statuses", required: false },
20305
20288
  limit: { type: "string", description: "Max rows", required: false },
20306
20289
  "no-cache": NO_CACHE_ARG,
20307
20290
  output: { type: "string", description: "json|csv|jsonl|md", required: false, default: "json" }
@@ -20315,7 +20298,7 @@ registerSchema({
20315
20298
  "account-urn": { type: "string", description: "Alias", required: false },
20316
20299
  "campaign-id": { type: "string", description: "Filter by campaign", required: false },
20317
20300
  "all-statuses": { type: "boolean", description: "Drop the ACTIVE filter", required: false },
20318
- statuses: { type: "string", description: statusesArgDescription("creatives"), required: false },
20301
+ statuses: { type: "string", description: "CSV of statuses", required: false },
20319
20302
  fields: {
20320
20303
  type: "string",
20321
20304
  description: "CSV of dotted paths to return instead of the compact row, e.g. id,content.textAd.landingPage",
@@ -21107,7 +21090,7 @@ Example: baker ads linkedin campaign-groups update 635137195 --total-budget 8000
21107
21090
  end: { type: "string", description: "New run schedule end" },
21108
21091
  "total-budget": { type: "string", description: TOTAL_BUDGET_HELP },
21109
21092
  currency: { type: "string", description: "3-letter currency code (defaults to the ad account currency)" },
21110
- status: { type: "string", description: "ACTIVE|PAUSED|ARCHIVED|\u2026" },
21093
+ status: { type: "string", description: "ACTIVE|PAUSED|ARCHIVED|CANCELED|DRAFT (COMPLETED is campaigns only)" },
21111
21094
  file: { type: "string", description: "JSON file with fields to change" }
21112
21095
  },
21113
21096
  run: async ({ args: args5 }) => {
@@ -22684,7 +22667,7 @@ var listArgs = {
22684
22667
  "account-id": { type: "string", description: "Numeric account ID or urn:li:sponsoredAccount:N" },
22685
22668
  "account-urn": { type: "string", description: "Alias for --account-id" },
22686
22669
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
22687
- statuses: { type: "string", description: statusesArgDescription("campaignGroups") },
22670
+ statuses: { type: "string", description: "CSV of statuses (ACTIVE,PAUSED,ARCHIVED,COMPLETED,DRAFT)" },
22688
22671
  limit: { type: "string", description: "Max rows (default: 500)" },
22689
22672
  "no-cache": NO_CACHE_ARG,
22690
22673
  output: { type: "string", description: "json|csv|jsonl|md", default: "json" }
@@ -22699,7 +22682,7 @@ var campaignGroupsListCommand = defineCommand40({
22699
22682
  const accountId = resolveAccountIdArg2(args5);
22700
22683
  try {
22701
22684
  const params = { "account-id": accountId };
22702
- const statuses = resolveStatusFilter(args5, "campaignGroups");
22685
+ const statuses = resolveStatusFilter(args5);
22703
22686
  if (statuses) params.statuses = statuses.join(",");
22704
22687
  if (args5.limit) params.limit = String(args5.limit);
22705
22688
  if (args5["no-cache"]) params["skip-cache"] = "true";
@@ -22750,7 +22733,7 @@ var listArgs2 = {
22750
22733
  "account-urn": { type: "string", description: "Alias for --account-id" },
22751
22734
  "campaign-group-id": { type: "string", description: "Filter by campaign group" },
22752
22735
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
22753
- statuses: { type: "string", description: statusesArgDescription("campaigns") },
22736
+ statuses: { type: "string", description: "CSV of statuses" },
22754
22737
  limit: { type: "string", description: "Max rows (default: 500)" },
22755
22738
  "no-cache": NO_CACHE_ARG,
22756
22739
  output: { type: "string", description: "json|csv|jsonl|md", default: "json" }
@@ -22765,7 +22748,7 @@ var campaignsListCommand = defineCommand41({
22765
22748
  const accountId = resolveAccountIdArg2(args5);
22766
22749
  try {
22767
22750
  const params = { "account-id": accountId };
22768
- const statuses = resolveStatusFilter(args5, "campaigns");
22751
+ const statuses = resolveStatusFilter(args5);
22769
22752
  if (statuses) params.statuses = statuses.join(",");
22770
22753
  if (args5["campaign-group-id"]) params["campaign-group-id"] = String(args5["campaign-group-id"]);
22771
22754
  if (args5.limit) params.limit = String(args5.limit);
@@ -23085,7 +23068,7 @@ var listArgs3 = {
23085
23068
  "account-urn": { type: "string", description: "Alias for --account-id" },
23086
23069
  "campaign-id": { type: "string", description: "Filter by campaign ID" },
23087
23070
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
23088
- statuses: { type: "string", description: statusesArgDescription("creatives") },
23071
+ statuses: { type: "string", description: "CSV of intended statuses (ACTIVE,PAUSED,DRAFT,ARCHIVED)" },
23089
23072
  fields: {
23090
23073
  type: "string",
23091
23074
  description: "CSV of dotted paths to return instead of the compact row, e.g. id,content.textAd.landingPage"
@@ -23105,7 +23088,7 @@ var creativesListCommand = defineCommand44({
23105
23088
  const accountId = resolveAccountIdArg2(args5);
23106
23089
  try {
23107
23090
  const params = { "account-id": accountId };
23108
- const statuses = resolveStatusFilter(args5, "creatives");
23091
+ const statuses = resolveStatusFilter(args5);
23109
23092
  if (statuses) params.statuses = statuses.join(",");
23110
23093
  if (args5["campaign-id"]) params["campaign-id"] = String(args5["campaign-id"]);
23111
23094
  if (args5.limit) params.limit = String(args5.limit);