openzca 0.1.29 → 0.1.30

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/dist/cli.js +44 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3394,13 +3394,53 @@ group.command("members <groupId>").option("-j, --json", "JSON output").descripti
3394
3394
  if (!groupInfo) {
3395
3395
  throw new Error(`Group not found: ${groupId}`);
3396
3396
  }
3397
- const ids = groupInfo.memberIds ?? [];
3397
+ const normalizeMemberId = (value) => {
3398
+ if (typeof value === "number" && Number.isFinite(value)) {
3399
+ return String(Math.trunc(value));
3400
+ }
3401
+ if (typeof value !== "string") return "";
3402
+ const trimmed = value.trim();
3403
+ if (!trimmed) return "";
3404
+ return trimmed.replace(/_\d+$/, "");
3405
+ };
3406
+ const idsFromMemberIds = Array.isArray(groupInfo.memberIds) ? groupInfo.memberIds.map((id) => normalizeMemberId(id)).filter(Boolean) : [];
3407
+ const memVerList = groupInfo.memVerList;
3408
+ const idsFromMemVerList = Array.isArray(memVerList) ? memVerList.map((id) => normalizeMemberId(id)).filter(Boolean) : [];
3409
+ const currentMems = Array.isArray(groupInfo.currentMems) ? groupInfo.currentMems : [];
3410
+ const currentMemberMap = /* @__PURE__ */ new Map();
3411
+ for (const member of currentMems) {
3412
+ const userId = normalizeMemberId(member.id);
3413
+ if (!userId) continue;
3414
+ currentMemberMap.set(userId, {
3415
+ displayName: member.dName?.trim() || member.zaloName?.trim() || "",
3416
+ zaloName: member.zaloName?.trim() || ""
3417
+ });
3418
+ }
3419
+ const ids = Array.from(
3420
+ /* @__PURE__ */ new Set([
3421
+ ...idsFromMemberIds,
3422
+ ...idsFromMemVerList,
3423
+ ...Array.from(currentMemberMap.keys())
3424
+ ])
3425
+ );
3398
3426
  const profiles = ids.length > 0 ? await api.getGroupMembersInfo(ids) : { profiles: {} };
3399
- const profileMap = profiles.profiles;
3427
+ const rawProfileMap = profiles.profiles;
3428
+ const profileMap = /* @__PURE__ */ new Map();
3429
+ for (const [key, profile] of Object.entries(rawProfileMap)) {
3430
+ if (!profile) continue;
3431
+ const normalizedKey = normalizeMemberId(key);
3432
+ if (normalizedKey && !profileMap.has(normalizedKey)) {
3433
+ profileMap.set(normalizedKey, profile);
3434
+ }
3435
+ const profileId = normalizeMemberId(profile.id);
3436
+ if (profileId && !profileMap.has(profileId)) {
3437
+ profileMap.set(profileId, profile);
3438
+ }
3439
+ }
3400
3440
  const rows = ids.map((id) => ({
3401
3441
  userId: id,
3402
- displayName: profileMap[id]?.displayName ?? "",
3403
- zaloName: profileMap[id]?.zaloName ?? ""
3442
+ displayName: profileMap.get(id)?.displayName ?? currentMemberMap.get(id)?.displayName ?? "",
3443
+ zaloName: profileMap.get(id)?.zaloName ?? currentMemberMap.get(id)?.zaloName ?? ""
3404
3444
  }));
3405
3445
  if (opts.json) {
3406
3446
  output(rows, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzca",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "Open-source zca-compatible CLI to integrate Zalo with OpenClaw",
5
5
  "type": "module",
6
6
  "bin": {