channel-worker 1.0.14 → 1.0.15

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 +12 -4
  2. package/package.json +1 -1
@@ -37,8 +37,8 @@ class NstManager {
37
37
  // Find profile by name, return profileId
38
38
  async findProfile(name) {
39
39
  try {
40
+ // Try SDK first
40
41
  const res = await this.client.profiles().getProfiles({ keyword: name });
41
- // Response: { data: { docs: [...], totalDocs, ... } }
42
42
  let profiles = [];
43
43
  if (res?.data?.docs && Array.isArray(res.data.docs)) {
44
44
  profiles = res.data.docs;
@@ -47,9 +47,17 @@ class NstManager {
47
47
  }
48
48
 
49
49
  const match = profiles.find(p => p.name === name);
50
- if (match) {
51
- return match.profileId || match._id;
52
- }
50
+ if (match) return match.profileId || match._id;
51
+
52
+ // Fallback: fetch all profiles via local API
53
+ const rawRes = await fetch('http://localhost:8848/api/v2/profiles/', {
54
+ headers: { 'x-api-key': this.apiKey },
55
+ });
56
+ const rawData = await rawRes.json();
57
+ const allProfiles = rawData?.data?.docs || rawData?.data || [];
58
+ const fallback = allProfiles.find(p => p.name === name);
59
+ if (fallback) return fallback.profileId || fallback._id;
60
+
53
61
  return null;
54
62
  } catch (err) {
55
63
  console.error(`[nst] Error finding profile "${name}":`, err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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": {