siluzan-tso-cli 1.1.75-beta.1 → 1.1.75-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.75-beta.
|
|
54
|
+
> **注意**:当前为测试版(1.1.75-beta.3),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
|
|
55
55
|
|
|
56
56
|
| 助手 | 建议 `--ai` |
|
|
57
57
|
| ----------------------- | ------------------------------------ |
|
package/dist/index.js
CHANGED
|
@@ -129046,7 +129046,7 @@ async function loadSharp() {
|
|
|
129046
129046
|
}
|
|
129047
129047
|
}
|
|
129048
129048
|
async function convertOne(sharpFn, inputPath, outputPath, spec, quality) {
|
|
129049
|
-
let
|
|
129049
|
+
let pipeline2 = sharpFn(inputPath).resize(spec.width, spec.height, {
|
|
129050
129050
|
fit: spec.fit,
|
|
129051
129051
|
position: "centre",
|
|
129052
129052
|
background: { r: 255, g: 255, b: 255, alpha: 1 },
|
|
@@ -129054,11 +129054,11 @@ async function convertOne(sharpFn, inputPath, outputPath, spec, quality) {
|
|
|
129054
129054
|
});
|
|
129055
129055
|
const ext = extname(outputPath).toLowerCase();
|
|
129056
129056
|
if (ext === ".png") {
|
|
129057
|
-
|
|
129057
|
+
pipeline2 = pipeline2.png({ compressionLevel: 6 });
|
|
129058
129058
|
} else {
|
|
129059
|
-
|
|
129059
|
+
pipeline2 = pipeline2.jpeg({ quality, mozjpeg: true });
|
|
129060
129060
|
}
|
|
129061
|
-
await
|
|
129061
|
+
await pipeline2.toFile(outputPath);
|
|
129062
129062
|
}
|
|
129063
129063
|
async function runAdPmaxImageConvert(opts) {
|
|
129064
129064
|
const { input, inputMarketing, inputSquare, inputLogo } = opts;
|
|
@@ -134072,6 +134072,8 @@ async function runMetaAdVideoUpload(opts) {
|
|
|
134072
134072
|
import { createWriteStream } from "fs";
|
|
134073
134073
|
import { mkdir as mkdir7, rename as rename2, rm as rm3, writeFile as writeFile7 } from "fs/promises";
|
|
134074
134074
|
import { dirname as dirname15, join as join14 } from "path";
|
|
134075
|
+
import { Readable } from "stream";
|
|
134076
|
+
import { pipeline } from "stream/promises";
|
|
134075
134077
|
var MAX_MEDIA_BATCH = 50;
|
|
134076
134078
|
var MAX_IMAGE_BYTES = 30 * 1024 * 1024;
|
|
134077
134079
|
var MAX_VIDEO_BYTES = 512 * 1024 * 1024;
|
|
@@ -134175,34 +134177,41 @@ async function downloadPublicFile(fileUrl, dest, maxBytes) {
|
|
|
134175
134177
|
const headParts = [];
|
|
134176
134178
|
let headLen = 0;
|
|
134177
134179
|
let total = 0;
|
|
134178
|
-
|
|
134179
|
-
|
|
134180
|
-
|
|
134181
|
-
|
|
134182
|
-
|
|
134183
|
-
|
|
134184
|
-
|
|
134185
|
-
|
|
134186
|
-
|
|
134187
|
-
|
|
134188
|
-
|
|
134189
|
-
|
|
134190
|
-
|
|
134191
|
-
|
|
134192
|
-
|
|
134193
|
-
|
|
134180
|
+
const source = new Readable({
|
|
134181
|
+
async read() {
|
|
134182
|
+
try {
|
|
134183
|
+
const { done, value } = await reader.read();
|
|
134184
|
+
if (done) {
|
|
134185
|
+
this.push(null);
|
|
134186
|
+
return;
|
|
134187
|
+
}
|
|
134188
|
+
const chunk = Buffer.from(value);
|
|
134189
|
+
total += chunk.length;
|
|
134190
|
+
if (total > maxBytes) {
|
|
134191
|
+
this.destroy(new Error(`\u6587\u4EF6\u8D85\u8FC7 ${maxBytes} \u5B57\u8282`));
|
|
134192
|
+
return;
|
|
134193
|
+
}
|
|
134194
|
+
if (headLen < 16) {
|
|
134195
|
+
headParts.push(chunk.subarray(0, 16 - headLen));
|
|
134196
|
+
headLen += chunk.length;
|
|
134197
|
+
}
|
|
134198
|
+
this.push(chunk);
|
|
134199
|
+
} catch (err) {
|
|
134200
|
+
this.destroy(err instanceof Error ? err : new Error(String(err)));
|
|
134194
134201
|
}
|
|
134195
134202
|
}
|
|
134196
|
-
|
|
134197
|
-
|
|
134198
|
-
|
|
134199
|
-
ws.end(() => resolve27());
|
|
134200
|
-
});
|
|
134203
|
+
});
|
|
134204
|
+
try {
|
|
134205
|
+
await pipeline(source, ws);
|
|
134201
134206
|
} catch (err) {
|
|
134202
|
-
|
|
134203
|
-
await rm3(dest, { force: true });
|
|
134207
|
+
await reader.cancel().catch(() => void 0);
|
|
134208
|
+
await rm3(dest, { force: true }).catch(() => void 0);
|
|
134204
134209
|
throw err;
|
|
134205
134210
|
}
|
|
134211
|
+
if (total < 1) {
|
|
134212
|
+
await rm3(dest, { force: true }).catch(() => void 0);
|
|
134213
|
+
throw new Error("\u6587\u4EF6\u4E3A\u7A7A");
|
|
134214
|
+
}
|
|
134206
134215
|
return {
|
|
134207
134216
|
bytes: total,
|
|
134208
134217
|
contentType: response.headers.get("content-type"),
|
|
@@ -134311,20 +134320,25 @@ async function runMetaAdMediaDownload(opts) {
|
|
|
134311
134320
|
await mkdir7(outDir, { recursive: true });
|
|
134312
134321
|
await writeFile7(join14(outDir, "manifest.json"), `${JSON.stringify(manifest, null, 2)}
|
|
134313
134322
|
`, "utf8");
|
|
134323
|
+
const missingCount = missingImages.length + missingVideos.length;
|
|
134324
|
+
const incomplete = missingCount > 0 || failed.length > 0;
|
|
134325
|
+
if (incomplete) process.exitCode = 1;
|
|
134314
134326
|
if (await emitMetaJson(opts, "meta-ad-media-download", "meta-ad media-download", manifest, digits, {
|
|
134315
134327
|
images: images.length,
|
|
134316
134328
|
videos: videos.length,
|
|
134317
|
-
missing:
|
|
134329
|
+
missing: missingCount,
|
|
134318
134330
|
failed: failed.length
|
|
134319
134331
|
})) {
|
|
134320
134332
|
return;
|
|
134321
134333
|
}
|
|
134322
|
-
|
|
134323
|
-
|
|
134324
|
-
\
|
|
134334
|
+
const summary = `\u56FE\u7247 ${images.length}\uFF0C\u89C6\u9891 ${videos.length}\uFF0C\u7F3A\u5931 ${missingCount}\uFF0C\u5931\u8D25 ${failed.length}`;
|
|
134335
|
+
console.log(incomplete ? `
|
|
134336
|
+
\u672A\u5B8C\u6210\u3002${summary}
|
|
134325
134337
|
\u76EE\u5F55 ${outDir}
|
|
134326
|
-
`
|
|
134327
|
-
|
|
134338
|
+
` : `
|
|
134339
|
+
\u2705 ${summary}
|
|
134340
|
+
\u76EE\u5F55 ${outDir}
|
|
134341
|
+
`);
|
|
134328
134342
|
}
|
|
134329
134343
|
async function saveNamedFile(fileUrl, dir, id, kind, maxBytes) {
|
|
134330
134344
|
const temp = join14(dir, `${id}.part`);
|
|
@@ -154962,7 +154976,7 @@ var GAP_ACTIONS = {
|
|
|
154962
154976
|
"google.remove-custom-audience": google("DELETE", "/custom-audiences/{account}/{id}", { needsId: true, needsBody: false }),
|
|
154963
154977
|
"google.goal": google("POST", "/goals/{account}"),
|
|
154964
154978
|
"google.campaign-goal-config": google("POST", "/campaign-goal-configs/{account}"),
|
|
154965
|
-
"google.remove-campaign-goal-config": google("DELETE", "/campaign-goal-configs/{account}/{id}", { needsId: true, needsBody: false }),
|
|
154979
|
+
"google.remove-campaign-goal-config": google("DELETE", "/campaign-goal-configs/{account}/{id}/{parent}", { needsId: true, needsParent: true, needsBody: false }),
|
|
154966
154980
|
"google.keyword-plan": google("POST", "/keyword-plans/{account}"),
|
|
154967
154981
|
"google.remove-keyword-plan": google("DELETE", "/keyword-plans/{account}/{id}", { needsId: true, needsBody: false }),
|
|
154968
154982
|
"google.keyword-plan-campaign": google("POST", "/keyword-plans/{account}/campaigns"),
|
package/dist/skill/_meta.json
CHANGED
|
@@ -842,7 +842,7 @@ siluzan-tso ad-gap --action google.end-experiment --account 123 --id 100 --commi
|
|
|
842
842
|
| `google.remove-auto-assets` | `campaignId` `assetId`。两个都要有,官方要求素材字段 |
|
|
843
843
|
| `google.goal` | `goalType`(`CustomerRetention` `NewCustomerAcquisition` `LoyaltyRetention`)。`additionalValue` 和 `valueMultiplier` 只能填一个,金额用账户币种 |
|
|
844
844
|
| `google.campaign-goal-config` | `campaignId` `goalId` `goalType`。这是新目标模型,和 `google.conversion-goal-campaign-config` 不是同一个服务 |
|
|
845
|
-
| `google.remove-campaign-goal-config` | `--id`
|
|
845
|
+
| `google.remove-campaign-goal-config` | `--id` 为系列,`--parent` 为目标,无正文 |
|
|
846
846
|
| `google.keyword-plan` | `name`。可选 `forecastInterval`,空着按 `NextMonth`。这是保存计划,不是关键词想法 |
|
|
847
847
|
| `google.remove-keyword-plan` | `--id`,无正文 |
|
|
848
848
|
| `google.keyword-plan-campaign` | `planId` `name` `cpcBid` `languageIds` `geoTargetIds`。可选 `network`,空着按 `GoogleSearch`。金额用元 |
|
|
@@ -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.75-beta.
|
|
12
|
+
$PKG_VERSION = '1.1.75-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.75-beta.
|
|
12
|
+
readonly PKG_VERSION="1.1.75-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"
|