siluzan-tso-cli 1.1.40 → 1.1.41

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/index.js CHANGED
@@ -4484,6 +4484,56 @@ var init_currency_display = __esm({
4484
4484
  }
4485
4485
  });
4486
4486
 
4487
+ // src/utils/media-customer-id.ts
4488
+ function stripMediaCustomerIdDecorators(raw) {
4489
+ return raw.trim().replace(/[\s-]+/g, "");
4490
+ }
4491
+ function looksLikeNumericMediaCustomerId(raw) {
4492
+ return /^\d+$/.test(stripMediaCustomerIdDecorators(raw));
4493
+ }
4494
+ function normalizeNumericMediaCustomerId(raw) {
4495
+ if (!looksLikeNumericMediaCustomerId(raw)) return null;
4496
+ return stripMediaCustomerIdDecorators(raw);
4497
+ }
4498
+ function looksLikeEntityIdUuid(raw) {
4499
+ return ENTITY_ID_UUID_RE.test(raw.trim());
4500
+ }
4501
+ function warnIfAccountIdsLookLikeEntityId(ids, command) {
4502
+ const bad = ids.map((id) => id.trim()).filter((id) => id && looksLikeEntityIdUuid(id));
4503
+ if (bad.length === 0) return;
4504
+ console.error(
4505
+ `
4506
+ \u26A0\uFE0F ${command} \u7684 -a/--accounts \u6536\u5230\u7591\u4F3C entityId/UUID\uFF1A${bad.join(", ")}
4507
+ \u672C\u547D\u4EE4\u9700\u8981 mediaCustomerId\uFF08list-accounts \u7684 ma.mediaCustomerId\uFF1BYandex \u5F62\u5982 porg-\u2026\uFF09\u3002
4508
+ \u8BF7\u5148 list-accounts -m <\u5A92\u4F53> -k <\u5A92\u4F53\u8D26\u6237\u53F7> \u6838\u5BF9\u540E\u518D\u91CD\u8BD5\uFF1B\u52FF\u636E\u6B64\u76F4\u63A5 reauth\u3002
4509
+ `
4510
+ );
4511
+ }
4512
+ function parseNumericMediaCustomerIds(input) {
4513
+ if (!input || !input.trim()) return [];
4514
+ const seen = /* @__PURE__ */ new Set();
4515
+ const out = [];
4516
+ for (const raw of input.split(",")) {
4517
+ const piece = raw.trim();
4518
+ if (!piece) continue;
4519
+ const id = normalizeNumericMediaCustomerId(piece);
4520
+ if (!id) {
4521
+ throw new Error(`mediaCustomerId \u5FC5\u987B\u4E3A\u7EAF\u6570\u5B57\uFF08\u53EF\u542B\u8FDE\u5B57\u7B26\uFF09\uFF1A${piece}`);
4522
+ }
4523
+ if (seen.has(id)) continue;
4524
+ seen.add(id);
4525
+ out.push(id);
4526
+ }
4527
+ return out;
4528
+ }
4529
+ var ENTITY_ID_UUID_RE;
4530
+ var init_media_customer_id = __esm({
4531
+ "src/utils/media-customer-id.ts"() {
4532
+ "use strict";
4533
+ ENTITY_ID_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4534
+ }
4535
+ });
4536
+
4487
4537
  // src/utils/balance.ts
4488
4538
  function fmt(d) {
4489
4539
  return d.toISOString().slice(0, 10);
@@ -4790,56 +4840,6 @@ var init_balance = __esm({
4790
4840
  }
4791
4841
  });
4792
4842
 
4793
- // src/utils/media-customer-id.ts
4794
- function stripMediaCustomerIdDecorators(raw) {
4795
- return raw.trim().replace(/[\s-]+/g, "");
4796
- }
4797
- function looksLikeNumericMediaCustomerId(raw) {
4798
- return /^\d+$/.test(stripMediaCustomerIdDecorators(raw));
4799
- }
4800
- function normalizeNumericMediaCustomerId(raw) {
4801
- if (!looksLikeNumericMediaCustomerId(raw)) return null;
4802
- return stripMediaCustomerIdDecorators(raw);
4803
- }
4804
- function looksLikeEntityIdUuid(raw) {
4805
- return ENTITY_ID_UUID_RE.test(raw.trim());
4806
- }
4807
- function warnIfAccountIdsLookLikeEntityId(ids, command) {
4808
- const bad = ids.map((id) => id.trim()).filter((id) => id && looksLikeEntityIdUuid(id));
4809
- if (bad.length === 0) return;
4810
- console.error(
4811
- `
4812
- \u26A0\uFE0F ${command} \u7684 -a/--accounts \u6536\u5230\u7591\u4F3C entityId/UUID\uFF1A${bad.join(", ")}
4813
- \u672C\u547D\u4EE4\u9700\u8981 mediaCustomerId\uFF08list-accounts \u7684 ma.mediaCustomerId\uFF1BYandex \u5F62\u5982 porg-\u2026\uFF09\u3002
4814
- \u8BF7\u5148 list-accounts -m <\u5A92\u4F53> -k <\u5A92\u4F53\u8D26\u6237\u53F7> \u6838\u5BF9\u540E\u518D\u91CD\u8BD5\uFF1B\u52FF\u636E\u6B64\u76F4\u63A5 reauth\u3002
4815
- `
4816
- );
4817
- }
4818
- function parseNumericMediaCustomerIds(input) {
4819
- if (!input || !input.trim()) return [];
4820
- const seen = /* @__PURE__ */ new Set();
4821
- const out = [];
4822
- for (const raw of input.split(",")) {
4823
- const piece = raw.trim();
4824
- if (!piece) continue;
4825
- const id = normalizeNumericMediaCustomerId(piece);
4826
- if (!id) {
4827
- throw new Error(`mediaCustomerId \u5FC5\u987B\u4E3A\u7EAF\u6570\u5B57\uFF08\u53EF\u542B\u8FDE\u5B57\u7B26\uFF09\uFF1A${piece}`);
4828
- }
4829
- if (seen.has(id)) continue;
4830
- seen.add(id);
4831
- out.push(id);
4832
- }
4833
- return out;
4834
- }
4835
- var ENTITY_ID_UUID_RE;
4836
- var init_media_customer_id = __esm({
4837
- "src/utils/media-customer-id.ts"() {
4838
- "use strict";
4839
- ENTITY_ID_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4840
- }
4841
- });
4842
-
4843
4843
  // src/utils/media-account-batch.ts
4844
4844
  function mediaAccountDataBatchSize(media) {
4845
4845
  switch (media) {
@@ -105715,12 +105715,6 @@ var VALID_MEDIA_TYPES = [
105715
105715
  "BingV2",
105716
105716
  "Kwai"
105717
105717
  ];
105718
- function applyListAccountsSearchKeyword(params, keyword) {
105719
- const kw = (keyword ?? "").trim();
105720
- if (kw) {
105721
- params.set("keyword", kw);
105722
- }
105723
- }
105724
105718
  var PLATFORM_CONFIG = {
105725
105719
  Google: {
105726
105720
  path: "/query/media-account/",
@@ -106179,6 +106173,7 @@ function wrapListJson(params) {
106179
106173
  }
106180
106174
 
106181
106175
  // src/commands/list-accounts/main.ts
106176
+ init_media_customer_id();
106182
106177
  async function runListAccounts(opts) {
106183
106178
  let config = loadConfig(opts.token);
106184
106179
  if (opts.refreshDp) {
@@ -106208,7 +106203,14 @@ async function runListAccounts(opts) {
106208
106203
  if (platformCfg.responseType === "array" && opts.status && opts.status !== "all") {
106209
106204
  params.set("status", opts.status);
106210
106205
  }
106211
- applyListAccountsSearchKeyword(params, opts.keyword);
106206
+ if (opts.keyword) {
106207
+ const numericId = normalizeNumericMediaCustomerId(opts.keyword);
106208
+ if (numericId) {
106209
+ params.set(platformCfg.idSearchParam, numericId);
106210
+ } else {
106211
+ params.set("mediaCustomerName", opts.keyword.trim());
106212
+ }
106213
+ }
106212
106214
  const url = `${config.apiBaseUrl}${platformCfg.path}?${params}`;
106213
106215
  if (platformCfg.responseType === "array") {
106214
106216
  try {
@@ -106242,7 +106244,9 @@ async function runListAccounts(opts) {
106242
106244
  }
106243
106245
  } else {
106244
106246
  const params = new URLSearchParams();
106245
- applyListAccountsSearchKeyword(params, opts.keyword);
106247
+ if (opts.keyword) {
106248
+ params.set("keyword", normalizeNumericMediaCustomerId(opts.keyword) ?? opts.keyword.trim());
106249
+ }
106246
106250
  if (opts.status && opts.status !== "all") params.set("status", opts.status);
106247
106251
  params.set("pageNo", String(page));
106248
106252
  params.set("pageSize", String(pageSize));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.40",
4
- "publishedAt": 1785723587990
3
+ "version": "1.1.41",
4
+ "publishedAt": 1785727642749
5
5
  }
@@ -17,7 +17,7 @@ siluzan-tso list-accounts [选项]
17
17
  | 选项 | 说明 |
18
18
  | ----------------------- | -------------------------------------------------------------------------------- | ---------------------- |
19
19
  | `-m, --media <type>` | 媒体类型(留空查全部):`Google \| TikTok \| Yandex \| MetaAd \| BingV2 \| Kwai` |
20
- | `-k, --keyword <text>` | 统一模糊搜索:账户名称 **或** ID(含 Google CID 带横杠);透传 Sammamish `keyword` |
20
+ | `-k, --keyword <text>` | 按账户名称或 ID 搜索 |
21
21
  | `-s, --status <status>` | 账户状态:`normal \| invalid \| all`(默认 all) |
22
22
  | `-p, --page <n>` | 页码(默认 1) |
23
23
  | `--page-size <n>` | 每页数量(默认 20) |
@@ -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.40'
12
+ $PKG_VERSION = '1.1.41'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli'
@@ -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.40"
12
+ readonly PKG_VERSION="1.1.41"
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.40",
3
+ "version": "1.1.41",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",