channel-worker 1.0.2 → 1.0.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/lib/nst-manager.js +6 -2
- package/package.json +1 -1
package/lib/nst-manager.js
CHANGED
|
@@ -20,9 +20,13 @@ class NstManager {
|
|
|
20
20
|
async findProfile(name) {
|
|
21
21
|
try {
|
|
22
22
|
const res = await this.client.profiles().getProfiles({ keyword: name });
|
|
23
|
-
const profiles = res?.data?.
|
|
23
|
+
const profiles = res?.data?.docs || res?.data?.list || [];
|
|
24
|
+
if (!Array.isArray(profiles)) {
|
|
25
|
+
console.log(`[nst] getProfiles response:`, JSON.stringify(res?.data).slice(0, 200));
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
24
28
|
const match = profiles.find(p => p.name === name);
|
|
25
|
-
return match?.profileId || match?.
|
|
29
|
+
return match?.profileId || match?._id || null;
|
|
26
30
|
} catch (err) {
|
|
27
31
|
console.error(`[nst] Error finding profile "${name}":`, err.message);
|
|
28
32
|
return null;
|