siluzan-tso-cli 1.1.40-beta.4 → 1.1.40-beta.5
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.40-beta.
|
|
54
|
+
> **注意**:当前为测试版(1.1.40-beta.5),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
|
|
55
55
|
|
|
56
56
|
| 助手 | 建议 `--ai` |
|
|
57
57
|
| ----------------------- | ------------------------------------ |
|
package/dist/index.js
CHANGED
|
@@ -2296,16 +2296,13 @@ function buildSiluzanClientIdentityHeaders() {
|
|
|
2296
2296
|
const client = getSiluzanClientProduct();
|
|
2297
2297
|
const runtime = resolveSiluzanClientRuntime();
|
|
2298
2298
|
const version = getSiluzanSkillVersion();
|
|
2299
|
-
|
|
2299
|
+
return {
|
|
2300
2300
|
"X-Siluzan-Client": client,
|
|
2301
2301
|
"X-Siluzan-Runtime": runtime,
|
|
2302
2302
|
"X-Siluzan-Skill-Version": version,
|
|
2303
|
+
"X-Company-Source-Type": SILUZAN_AGENT_COMPANY_SOURCE_TYPE,
|
|
2303
2304
|
"User-Agent": `${client}/${version}`
|
|
2304
2305
|
};
|
|
2305
|
-
if (runtime === "siluzan_agent") {
|
|
2306
|
-
headers["X-Company-Source-Type"] = SILUZAN_AGENT_COMPANY_SOURCE_TYPE;
|
|
2307
|
-
}
|
|
2308
|
-
return headers;
|
|
2309
2306
|
}
|
|
2310
2307
|
function isPerfEnabled() {
|
|
2311
2308
|
const v = process.env.SILUZAN_HTTP_PERF;
|
|
@@ -2332,6 +2329,19 @@ function rawRequest(url, options) {
|
|
|
2332
2329
|
...buildSiluzanClientIdentityHeaders(),
|
|
2333
2330
|
...options.headers
|
|
2334
2331
|
};
|
|
2332
|
+
if (process.env.SILUZAN_DEBUG_HEADERS === "1" || process.env.SILUZAN_DEBUG_HEADERS === "true") {
|
|
2333
|
+
try {
|
|
2334
|
+
process.stderr.write(
|
|
2335
|
+
`[SILUZAN_DEBUG_HEADERS] ${method} ${url}
|
|
2336
|
+
X-Company-Source-Type=${headers["X-Company-Source-Type"] ?? "(missing)"}
|
|
2337
|
+
X-Siluzan-Runtime=${headers["X-Siluzan-Runtime"] ?? "(missing)"}
|
|
2338
|
+
X-Siluzan-Client=${headers["X-Siluzan-Client"] ?? "(missing)"}
|
|
2339
|
+
X-Siluzan-Skill-Version=${headers["X-Siluzan-Skill-Version"] ?? "(missing)"}
|
|
2340
|
+
`
|
|
2341
|
+
);
|
|
2342
|
+
} catch {
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2335
2345
|
const reqOpts = {
|
|
2336
2346
|
hostname: parsed.hostname,
|
|
2337
2347
|
port: parsed.port || (isHttps ? 443 : 80),
|
|
@@ -4474,56 +4484,6 @@ var init_currency_display = __esm({
|
|
|
4474
4484
|
}
|
|
4475
4485
|
});
|
|
4476
4486
|
|
|
4477
|
-
// src/utils/media-customer-id.ts
|
|
4478
|
-
function stripMediaCustomerIdDecorators(raw) {
|
|
4479
|
-
return raw.trim().replace(/[\s-]+/g, "");
|
|
4480
|
-
}
|
|
4481
|
-
function looksLikeNumericMediaCustomerId(raw) {
|
|
4482
|
-
return /^\d+$/.test(stripMediaCustomerIdDecorators(raw));
|
|
4483
|
-
}
|
|
4484
|
-
function normalizeNumericMediaCustomerId(raw) {
|
|
4485
|
-
if (!looksLikeNumericMediaCustomerId(raw)) return null;
|
|
4486
|
-
return stripMediaCustomerIdDecorators(raw);
|
|
4487
|
-
}
|
|
4488
|
-
function looksLikeEntityIdUuid(raw) {
|
|
4489
|
-
return ENTITY_ID_UUID_RE.test(raw.trim());
|
|
4490
|
-
}
|
|
4491
|
-
function warnIfAccountIdsLookLikeEntityId(ids, command) {
|
|
4492
|
-
const bad = ids.map((id) => id.trim()).filter((id) => id && looksLikeEntityIdUuid(id));
|
|
4493
|
-
if (bad.length === 0) return;
|
|
4494
|
-
console.error(
|
|
4495
|
-
`
|
|
4496
|
-
\u26A0\uFE0F ${command} \u7684 -a/--accounts \u6536\u5230\u7591\u4F3C entityId/UUID\uFF1A${bad.join(", ")}
|
|
4497
|
-
\u672C\u547D\u4EE4\u9700\u8981 mediaCustomerId\uFF08list-accounts \u7684 ma.mediaCustomerId\uFF1BYandex \u5F62\u5982 porg-\u2026\uFF09\u3002
|
|
4498
|
-
\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
|
|
4499
|
-
`
|
|
4500
|
-
);
|
|
4501
|
-
}
|
|
4502
|
-
function parseNumericMediaCustomerIds(input) {
|
|
4503
|
-
if (!input || !input.trim()) return [];
|
|
4504
|
-
const seen = /* @__PURE__ */ new Set();
|
|
4505
|
-
const out = [];
|
|
4506
|
-
for (const raw of input.split(",")) {
|
|
4507
|
-
const piece = raw.trim();
|
|
4508
|
-
if (!piece) continue;
|
|
4509
|
-
const id = normalizeNumericMediaCustomerId(piece);
|
|
4510
|
-
if (!id) {
|
|
4511
|
-
throw new Error(`mediaCustomerId \u5FC5\u987B\u4E3A\u7EAF\u6570\u5B57\uFF08\u53EF\u542B\u8FDE\u5B57\u7B26\uFF09\uFF1A${piece}`);
|
|
4512
|
-
}
|
|
4513
|
-
if (seen.has(id)) continue;
|
|
4514
|
-
seen.add(id);
|
|
4515
|
-
out.push(id);
|
|
4516
|
-
}
|
|
4517
|
-
return out;
|
|
4518
|
-
}
|
|
4519
|
-
var ENTITY_ID_UUID_RE;
|
|
4520
|
-
var init_media_customer_id = __esm({
|
|
4521
|
-
"src/utils/media-customer-id.ts"() {
|
|
4522
|
-
"use strict";
|
|
4523
|
-
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;
|
|
4524
|
-
}
|
|
4525
|
-
});
|
|
4526
|
-
|
|
4527
4487
|
// src/utils/balance.ts
|
|
4528
4488
|
function fmt(d) {
|
|
4529
4489
|
return d.toISOString().slice(0, 10);
|
|
@@ -4830,6 +4790,56 @@ var init_balance = __esm({
|
|
|
4830
4790
|
}
|
|
4831
4791
|
});
|
|
4832
4792
|
|
|
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
|
+
|
|
4833
4843
|
// src/utils/media-account-batch.ts
|
|
4834
4844
|
function mediaAccountDataBatchSize(media) {
|
|
4835
4845
|
switch (media) {
|
|
@@ -105703,6 +105713,12 @@ var VALID_MEDIA_TYPES = [
|
|
|
105703
105713
|
"BingV2",
|
|
105704
105714
|
"Kwai"
|
|
105705
105715
|
];
|
|
105716
|
+
function applyListAccountsSearchKeyword(params, keyword) {
|
|
105717
|
+
const kw = (keyword ?? "").trim();
|
|
105718
|
+
if (kw) {
|
|
105719
|
+
params.set("keyword", kw);
|
|
105720
|
+
}
|
|
105721
|
+
}
|
|
105706
105722
|
var PLATFORM_CONFIG = {
|
|
105707
105723
|
Google: {
|
|
105708
105724
|
path: "/query/media-account/",
|
|
@@ -106161,7 +106177,6 @@ function wrapListJson(params) {
|
|
|
106161
106177
|
}
|
|
106162
106178
|
|
|
106163
106179
|
// src/commands/list-accounts/main.ts
|
|
106164
|
-
init_media_customer_id();
|
|
106165
106180
|
async function runListAccounts(opts) {
|
|
106166
106181
|
let config = loadConfig(opts.token);
|
|
106167
106182
|
if (opts.refreshDp) {
|
|
@@ -106191,14 +106206,7 @@ async function runListAccounts(opts) {
|
|
|
106191
106206
|
if (platformCfg.responseType === "array" && opts.status && opts.status !== "all") {
|
|
106192
106207
|
params.set("status", opts.status);
|
|
106193
106208
|
}
|
|
106194
|
-
|
|
106195
|
-
const numericId = normalizeNumericMediaCustomerId(opts.keyword);
|
|
106196
|
-
if (numericId) {
|
|
106197
|
-
params.set(platformCfg.idSearchParam, numericId);
|
|
106198
|
-
} else {
|
|
106199
|
-
params.set("mediaCustomerName", opts.keyword.trim());
|
|
106200
|
-
}
|
|
106201
|
-
}
|
|
106209
|
+
applyListAccountsSearchKeyword(params, opts.keyword);
|
|
106202
106210
|
const url = `${config.apiBaseUrl}${platformCfg.path}?${params}`;
|
|
106203
106211
|
if (platformCfg.responseType === "array") {
|
|
106204
106212
|
try {
|
|
@@ -106232,9 +106240,7 @@ async function runListAccounts(opts) {
|
|
|
106232
106240
|
}
|
|
106233
106241
|
} else {
|
|
106234
106242
|
const params = new URLSearchParams();
|
|
106235
|
-
|
|
106236
|
-
params.set("keyword", normalizeNumericMediaCustomerId(opts.keyword) ?? opts.keyword.trim());
|
|
106237
|
-
}
|
|
106243
|
+
applyListAccountsSearchKeyword(params, opts.keyword);
|
|
106238
106244
|
if (opts.status && opts.status !== "all") params.set("status", opts.status);
|
|
106239
106245
|
params.set("pageNo", String(page));
|
|
106240
106246
|
params.set("pageSize", String(pageSize));
|
package/dist/skill/_meta.json
CHANGED
|
@@ -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>` |
|
|
20
|
+
| `-k, --keyword <text>` | 统一模糊搜索:账户名称 **或** ID(含 Google CID 带横杠);透传 Sammamish `keyword` |
|
|
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-beta.
|
|
12
|
+
$PKG_VERSION = '1.1.40-beta.5'
|
|
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.40-beta.
|
|
12
|
+
readonly PKG_VERSION="1.1.40-beta.5"
|
|
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"
|