@erdoai/cli 0.81.0 → 0.82.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.
Files changed (2) hide show
  1. package/dist/index.js +25 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -342,13 +342,18 @@ var ErdoClient = class {
342
342
  );
343
343
  }
344
344
  // Creates the container — a sub-account under the manager's MCC plus the
345
- // delegated connection inside the managed org. `replaceCurrentAccount` is the
346
- // one input with consequences: provisioning refuses outright when the org is
347
- // already running campaigns in another account, and passing this accepts that
348
- // those campaigns are left behind, so the key is sent only when it is asked
349
- // for rather than as a `false` the server has to read.
345
+ // delegated connection inside the managed org. `customerId` switches the call
346
+ // from creating an account to adopting one that already sits directly under
347
+ // the manager, which is the only way to attach a sub-account somebody made by
348
+ // hand: Google Ads cannot delete an account, so creating a second one beside
349
+ // it is permanent. `replaceCurrentAccount` is the one input with consequences:
350
+ // provisioning refuses outright when the org is already running campaigns in
351
+ // another account, and passing this accepts that those campaigns are left
352
+ // behind, so the key is sent only when it is asked for rather than as a
353
+ // `false` the server has to read.
350
354
  provisionManagedOrganizationAdsContainer(slug, input) {
351
355
  const body = {};
356
+ if (input.customerId) body.customer_id = input.customerId;
352
357
  if (input.descriptiveName) body.descriptive_name = input.descriptiveName;
353
358
  if (input.currencyCode) body.currency_code = input.currencyCode;
354
359
  if (input.timeZone) body.time_zone = input.timeZone;
@@ -2153,6 +2158,9 @@ function printAdsContainer(c) {
2153
2158
  managed.command("ads-container <orgSlug>").description(
2154
2159
  "Read the Google Ads account a managed org runs its campaigns in, or --provision one under your manager account"
2155
2160
  ).option("--provision", "create the account and the org's delegated google_ads connection instead of reading them").option(
2161
+ "--adopt <customerId>",
2162
+ "with --provision: connect an existing client account already sitting directly under your manager account instead of creating a new one \u2014 for a sub-account created by hand in the Google Ads UI"
2163
+ ).option(
2156
2164
  "--replace-current-account",
2157
2165
  "with --provision: go ahead even though the org already runs campaigns in another account. Google Ads cannot move a campaign, so those campaigns stay behind and have to be rebuilt"
2158
2166
  ).option("--name <descriptiveName>", "display name for the new account (default: the org's name and slug)").option("--currency <code>", "ISO currency code for the new account, e.g. USD").option("--time-zone <tz>", "IANA time zone for the new account, e.g. America/New_York").action(
@@ -2161,6 +2169,16 @@ managed.command("ads-container <orgSlug>").description(
2161
2169
  if (opts.replaceCurrentAccount && !opts.provision) {
2162
2170
  fail(new Error("--replace-current-account only applies with --provision"));
2163
2171
  }
2172
+ if (opts.adopt && !opts.provision) {
2173
+ fail(new Error("--adopt only applies with --provision"));
2174
+ }
2175
+ if (opts.adopt && (opts.name || opts.currency || opts.timeZone)) {
2176
+ fail(
2177
+ new Error(
2178
+ "--adopt takes an account that already exists, so --name, --currency and --time-zone do not apply \u2014 they describe an account being created"
2179
+ )
2180
+ );
2181
+ }
2164
2182
  const api = new ErdoClient();
2165
2183
  if (!opts.provision) {
2166
2184
  try {
@@ -2178,13 +2196,14 @@ managed.command("ads-container <orgSlug>").description(
2178
2196
  return;
2179
2197
  }
2180
2198
  const c = await api.provisionManagedOrganizationAdsContainer(orgSlug, {
2199
+ customerId: opts.adopt,
2181
2200
  descriptiveName: opts.name,
2182
2201
  currencyCode: opts.currency,
2183
2202
  timeZone: opts.timeZone,
2184
2203
  replaceCurrentAccount: opts.replaceCurrentAccount
2185
2204
  });
2186
2205
  console.log(
2187
- c.already_provisioned ? `Google Ads container already existed for ${c.org_slug}` : `Created Google Ads container for ${c.org_slug}`
2206
+ c.already_provisioned ? `Google Ads container already existed for ${c.org_slug}` : c.adopted ? `Adopted Google Ads account ${c.customer_id} as the container for ${c.org_slug}` : `Created Google Ads container for ${c.org_slug}`
2188
2207
  );
2189
2208
  printAdsContainer(c);
2190
2209
  const leftBehind = c.previous_campaign_count ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.81.0",
3
+ "version": "0.82.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {