siluzan-tso-cli 1.1.47-beta.2 → 1.1.47-beta.3

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 CHANGED
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
51
51
  siluzan-tso init --force # 强制覆盖已存在文件
52
52
  ```
53
53
 
54
- > **注意**:当前为测试版(1.1.47-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.47-beta.3),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -105841,7 +105841,15 @@ function register5(program2) {
105841
105841
  // src/commands/list-accounts/_shared.ts
105842
105842
  init_dist();
105843
105843
  init_auth();
105844
- function shouldExposeScopeActivatedSources() {
105844
+ var SCOPE_ACTIVATION_BYPASSED_HEADER = "x-scope-activation-bypassed";
105845
+ function isScopeActivationBypassed(headers) {
105846
+ if (!headers) return false;
105847
+ const raw = headers[SCOPE_ACTIVATION_BYPASSED_HEADER] ?? headers["X-Scope-Activation-Bypassed"];
105848
+ const v = raw?.trim().toLowerCase();
105849
+ return v === "1" || v === "true" || v === "yes";
105850
+ }
105851
+ function shouldExposeScopeActivatedSources(bypassed = false) {
105852
+ if (bypassed) return false;
105845
105853
  return resolveCompanySourceType() === "Ctaiad";
105846
105854
  }
105847
105855
  var VALID_MEDIA_TYPES = [
@@ -105966,7 +105974,7 @@ async function fetchTikTokAccountByMediaCustomerId(config, mediaCustomerId, verb
105966
105974
  const match = items2.find((it) => String(it.ma?.mediaCustomerId ?? "") === id);
105967
105975
  return match ?? null;
105968
105976
  }
105969
- function stripListAccountsEnrichmentFields(item) {
105977
+ function stripListAccountsEnrichmentFields(item, exposeScopeActivatedSources = shouldExposeScopeActivatedSources()) {
105970
105978
  delete item.ma.remainingAccountBudget;
105971
105979
  delete item.ma.platformStatus;
105972
105980
  delete item.ma.aritScore;
@@ -105982,7 +105990,7 @@ function stripListAccountsEnrichmentFields(item) {
105982
105990
  ]) {
105983
105991
  delete maExt[key];
105984
105992
  }
105985
- if (!shouldExposeScopeActivatedSources()) {
105993
+ if (!exposeScopeActivatedSources) {
105986
105994
  delete item.ma.scopeActivatedSources;
105987
105995
  delete maExt["scopeActivatedSources"];
105988
105996
  }
@@ -106087,8 +106095,8 @@ var COL_GOOGLE_BASE = [
106087
106095
  { key: "shared", header: "\u5206\u4EAB" }
106088
106096
  ];
106089
106097
  var COL_GOOGLE_PACKAGE = { key: "packageStatus", header: "\u5957\u9910\u6FC0\u6D3B" };
106090
- function googleTableColumns() {
106091
- if (!shouldExposeScopeActivatedSources()) return COL_GOOGLE_BASE;
106098
+ function googleTableColumns(exposePackage = shouldExposeScopeActivatedSources()) {
106099
+ if (!exposePackage) return COL_GOOGLE_BASE;
106092
106100
  const authIdx = COL_GOOGLE_BASE.findIndex((c) => c.key === "authStatus");
106093
106101
  const cols = [...COL_GOOGLE_BASE];
106094
106102
  cols.splice(authIdx + 1, 0, COL_GOOGLE_PACKAGE);
@@ -106262,8 +106270,7 @@ function printTikTokTable(items2, tableOpts) {
106262
106270
  });
106263
106271
  printCliTable(rows, COL_TIKTOK, tableOpts);
106264
106272
  }
106265
- function printGoogleTable(items2, tableOpts) {
106266
- const exposePackage = shouldExposeScopeActivatedSources();
106273
+ function printGoogleTable(items2, tableOpts, exposePackage = shouldExposeScopeActivatedSources()) {
106267
106274
  const rows = items2.map((item) => {
106268
106275
  const ma = item.ma;
106269
106276
  const platformStatus = ma.platformStatus ?? "-";
@@ -106289,7 +106296,7 @@ function printGoogleTable(items2, tableOpts) {
106289
106296
  }
106290
106297
  return row;
106291
106298
  });
106292
- printCliTable(rows, googleTableColumns(), tableOpts);
106299
+ printCliTable(rows, googleTableColumns(exposePackage), tableOpts);
106293
106300
  }
106294
106301
  var COL_DEFAULT_WITH_MEDIA = [
106295
106302
  { key: "mediaType", header: "\u5A92\u4F53\u7C7B\u578B" },
@@ -106364,6 +106371,7 @@ async function runListAccounts(opts) {
106364
106371
  const platformCfg = opts.media ? PLATFORM_CONFIG[opts.media] : null;
106365
106372
  let items2;
106366
106373
  let total;
106374
+ let scopeActivationBypassed = false;
106367
106375
  if (platformCfg) {
106368
106376
  const params = new URLSearchParams();
106369
106377
  for (const [k, v] of Object.entries(platformCfg.fixedParams)) {
@@ -106380,6 +106388,7 @@ async function runListAccounts(opts) {
106380
106388
  try {
106381
106389
  const res = await apiFetchWithHeaders2(url, config, {}, opts.verbose);
106382
106390
  items2 = res.data ?? [];
106391
+ scopeActivationBypassed = isScopeActivationBypassed(res.headers);
106383
106392
  const hit = res.headers["s-total-hits"];
106384
106393
  if (hit !== void 0) total = parseInt(hit, 10) || void 0;
106385
106394
  } catch (err) {
@@ -106389,22 +106398,22 @@ async function runListAccounts(opts) {
106389
106398
  process.exit(1);
106390
106399
  }
106391
106400
  } else {
106392
- let res;
106393
106401
  try {
106394
- res = await apiFetch2(url, config, {}, opts.verbose);
106402
+ const res = await apiFetchWithHeaders2(url, config, {}, opts.verbose);
106403
+ items2 = Array.isArray(res.data?.mas) ? res.data.mas : [];
106404
+ total = typeof res.data?.total === "number" ? res.data.total : void 0;
106405
+ scopeActivationBypassed = isScopeActivationBypassed(res.headers);
106406
+ if (opts.media === "TikTok") {
106407
+ mergeTikTokAdList(items2, res.data?.adList);
106408
+ } else if (opts.media === "MetaAd") {
106409
+ mergeMetaFacebookAdList(items2, res.data?.adList);
106410
+ }
106395
106411
  } catch (err) {
106396
106412
  console.error(`
106397
106413
  \u274C \u67E5\u8BE2\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}
106398
106414
  `);
106399
106415
  process.exit(1);
106400
106416
  }
106401
- items2 = Array.isArray(res?.mas) ? res.mas : [];
106402
- total = typeof res?.total === "number" ? res.total : void 0;
106403
- if (opts.media === "TikTok") {
106404
- mergeTikTokAdList(items2, res.adList);
106405
- } else if (opts.media === "MetaAd") {
106406
- mergeMetaFacebookAdList(items2, res.adList);
106407
- }
106408
106417
  }
106409
106418
  } else {
106410
106419
  const params = new URLSearchParams();
@@ -106416,6 +106425,7 @@ async function runListAccounts(opts) {
106416
106425
  try {
106417
106426
  const res = await apiFetchWithHeaders2(url, config, {}, opts.verbose);
106418
106427
  items2 = res.data ?? [];
106428
+ scopeActivationBypassed = isScopeActivationBypassed(res.headers);
106419
106429
  const hit = res.headers["s-total-hits"];
106420
106430
  if (hit !== void 0) total = parseInt(hit, 10) || void 0;
106421
106431
  } catch (err) {
@@ -106425,9 +106435,10 @@ async function runListAccounts(opts) {
106425
106435
  process.exit(1);
106426
106436
  }
106427
106437
  }
106438
+ const exposeScopeActivated = shouldExposeScopeActivatedSources(scopeActivationBypassed);
106428
106439
  if (items2.length > 0) {
106429
106440
  for (const item of items2) {
106430
- stripListAccountsEnrichmentFields(item);
106441
+ stripListAccountsEnrichmentFields(item, exposeScopeActivated);
106431
106442
  }
106432
106443
  }
106433
106444
  const oauthFailWarning = (() => {
@@ -106469,7 +106480,7 @@ async function runListAccounts(opts) {
106469
106480
  const isKwai = opts.media === "Kwai";
106470
106481
  const tableBorderOpts = opts.unicode ? { plain: false } : void 0;
106471
106482
  if (isGoogle) {
106472
- printGoogleTable(items2, tableBorderOpts);
106483
+ printGoogleTable(items2, tableBorderOpts, exposeScopeActivated);
106473
106484
  } else if (isYandex) {
106474
106485
  printYandexTable(items2, tableBorderOpts);
106475
106486
  } else if (isTikTok) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.47-beta.2",
4
- "publishedAt": 1787276448425
3
+ "version": "1.1.47-beta.3",
4
+ "publishedAt": 1787282369500
5
5
  }
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  $PKG_NAME = 'siluzan-tso-cli'
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- $PKG_VERSION = '1.1.47-beta.2'
12
+ $PKG_VERSION = '1.1.47-beta.3'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
@@ -9,7 +9,7 @@ set -euo pipefail
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  readonly PKG_NAME="siluzan-tso-cli"
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- readonly PKG_VERSION="1.1.47-beta.2"
12
+ readonly PKG_VERSION="1.1.47-beta.3"
13
13
  readonly CLI_BIN="siluzan-tso"
14
14
  readonly SKILL_LABEL="Siluzan TSO"
15
15
  readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.47-beta.2",
3
+ "version": "1.1.47-beta.3",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",