channel-worker 1.1.7 → 1.1.8
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/lib/api-client.js +0 -4
- package/lib/command-poller.js +2 -4
- package/lib/job-executor.js +3 -4
- package/package.json +1 -1
package/lib/api-client.js
CHANGED
|
@@ -54,10 +54,6 @@ class ApiClient {
|
|
|
54
54
|
return this.request('GET', `/channels/${channelId}`);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
async getMasterChannel(masterId) {
|
|
58
|
-
return this.request('GET', `/masters/${masterId}`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
57
|
// Settings
|
|
62
58
|
async getSetting(key) {
|
|
63
59
|
const data = await this.request('GET', `/settings/${key}`);
|
package/lib/command-poller.js
CHANGED
|
@@ -125,15 +125,13 @@ class CommandPoller {
|
|
|
125
125
|
extensionPath = uniqueExtPath;
|
|
126
126
|
console.log(`[commands] Extension dir: ${uniqueExtPath}`);
|
|
127
127
|
|
|
128
|
-
// Cleanup old dirs (keep
|
|
128
|
+
// Cleanup ALL old dirs (only keep current)
|
|
129
129
|
const parent = path.dirname(baseExtPath);
|
|
130
130
|
const baseName = path.basename(baseExtPath);
|
|
131
131
|
const oldDirs = fs.readdirSync(parent)
|
|
132
132
|
.filter(d => d.startsWith(baseName + '-') && d !== path.basename(uniqueExtPath))
|
|
133
133
|
.map(d => path.join(parent, d))
|
|
134
|
-
.filter(d => fs.statSync(d).isDirectory())
|
|
135
|
-
.sort()
|
|
136
|
-
.slice(0, -3);
|
|
134
|
+
.filter(d => { try { return fs.statSync(d).isDirectory(); } catch { return false; } });
|
|
137
135
|
for (const d of oldDirs) {
|
|
138
136
|
try { fs.rmSync(d, { recursive: true }); } catch {}
|
|
139
137
|
}
|
package/lib/job-executor.js
CHANGED
|
@@ -9,13 +9,12 @@ class JobExecutor {
|
|
|
9
9
|
console.log(`[executor] Starting job ${jobId} — ${job.flow_type} for channel ${job.channel_id}`);
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
|
-
// 1. Get channel
|
|
12
|
+
// 1. Get channel info
|
|
13
13
|
await this.updateStatus(jobId, 'sourcing');
|
|
14
14
|
const channel = await this.api.getChannel(job.channel_id);
|
|
15
|
-
const
|
|
16
|
-
const brandKit = master.brand_kit || {};
|
|
15
|
+
const brandKit = channel.brand_kit || {};
|
|
17
16
|
|
|
18
|
-
console.log(`[executor] Channel: ${channel.name} |
|
|
17
|
+
console.log(`[executor] Channel: ${channel.name} | Profile: ${channel.nst_profile_id}`);
|
|
19
18
|
|
|
20
19
|
// 2. Launch Nstbrowser profile
|
|
21
20
|
if (channel.nst_profile_id) {
|