channel-worker 1.3.2 → 1.3.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.
Files changed (2) hide show
  1. package/lib/nst-manager.js +15 -7
  2. package/package.json +1 -1
@@ -49,13 +49,21 @@ class NstManager {
49
49
  const match = profiles.find(p => p.name?.toLowerCase() === name.toLowerCase());
50
50
  if (match) return match.profileId || match._id;
51
51
 
52
- // Fallback: fetch profiles via local API with exact name search
53
- const rawRes = await fetch(`http://localhost:8848/api/v2/profiles/?keyword=${encodeURIComponent(name)}&limit=100`, {
54
- headers: { 'x-api-key': this.apiKey },
55
- });
56
- const rawData = await rawRes.json();
57
- const allProfiles = rawData?.data?.docs || rawData?.data || [];
58
- console.log(`[nst] Fallback search for "${name}": found ${allProfiles.length} profiles`);
52
+ // Fallback: fetch ALL profiles via local API (paginate if needed)
53
+ let allProfiles = [];
54
+ let page = 1;
55
+ while (true) {
56
+ const rawRes = await fetch(`http://localhost:8848/api/v2/profiles/?keyword=${encodeURIComponent(name)}&page=${page}&limit=100`, {
57
+ headers: { 'x-api-key': this.apiKey },
58
+ });
59
+ const rawData = await rawRes.json();
60
+ const docs = rawData?.data?.docs || rawData?.data || [];
61
+ allProfiles = allProfiles.concat(docs);
62
+ const totalPages = rawData?.data?.totalPage || rawData?.data?.totalPages || 1;
63
+ if (page >= totalPages || docs.length === 0) break;
64
+ page++;
65
+ }
66
+ console.log(`[nst] Fallback search for "${name}": found ${allProfiles.length} profiles, names: [${allProfiles.map(p => p.name).join(', ')}]`);
59
67
  const fallback = allProfiles.find(p => p.name?.toLowerCase() === name.toLowerCase());
60
68
  if (fallback) return fallback.profileId || fallback._id;
61
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {