adspower-browser 2.1.2-beta.1 → 2.1.2-beta.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 (3) hide show
  1. package/README.MD +12 -1
  2. package/cli/index.js +253 -4
  3. package/package.json +1 -1
package/README.MD CHANGED
@@ -142,7 +142,7 @@ ads close-browser <profile_id> # Or JSON: profile_id? | profil
142
142
  ads create-browser '{"group_id":"0","user_proxy_config":{"proxy_soft":"no_proxy"},...}' # group_id + account field required; proxy optional (defaults to no_proxy; proxyid takes priority over user_proxy_config when both given)
143
143
  ads update-browser '{"profile_id":"...",...}' # profile_id required
144
144
  ads delete-browser '{"profile_id":["..."]}' # profile_id required
145
- ads get-recycle-bin-list '{}' # page?, limit? (1-100, default 1). Last 30 days only
145
+ ads get-recycle-bin-list '{}' # page?, limit? (1-100). Omit either to use the Local API backend default. Last 30 days only
146
146
  ads restore-recycle-bin '{"profile_id":"...","group_id":"123"}' # profile_id or profile_no, group_id required
147
147
  ads get-browser-list '{}' # CLI defaults to page=1,limit=200. Or group_id?, limit?, page?, profile_id[]?, profile_no[]?, sort_type?, sort_order?, tag_ids?, tags_filter?, name?, name_filter?
148
148
  ads get-opened-browser # No params
@@ -170,6 +170,17 @@ ads update-group '{"group_id":"1","group_name":"New Name"}' # group_id + grou
170
170
  ads get-group-list '{}' # group_name?, page_size?, page?
171
171
  ```
172
172
 
173
+ ### Member
174
+
175
+ ```bash
176
+ ads create-member '{"user_group_id":"...","email":"alice@example.com","password":"password1","identity":4}' # identity: 2 admin, 3 manager, 4 staff; manager optional; member only for identity 3
177
+ ads update-member '{"user_id":"...","name":"Alice"}' # omit to keep; empty name/manager/remark/member/authorized_group can clear; do not empty email or identity
178
+ ads reset-member-password '{"user_id":"..."}' # unbind_phone?: 0|1; new_password is in the response
179
+ ads delete-member '{"user_id":"..."}' # permanent, not recoverable
180
+ ads get-member-list '{}' # user_group_id?, user_id[]?, email[]?, page?, limit? (default 50, max 200)
181
+ ads get-member-group-list '{}' # page?, limit? (default 50, max 200)
182
+ ```
183
+
173
184
  ### Application (categories)
174
185
 
175
186
  ```bash
package/cli/index.js CHANGED
@@ -614,8 +614,8 @@ var LOCAL_API_CONTRACTS = {
614
614
  method: "POST",
615
615
  path: "/api/v2/browser-profile/recycle-bin/list",
616
616
  params: {
617
- page: { apiName: "page", location: "body", default: 1 },
618
- limit: { apiName: "limit", location: "body", default: 1 }
617
+ page: { apiName: "page", location: "body" },
618
+ limit: { apiName: "limit", location: "body" }
619
619
  }
620
620
  },
621
621
  "restore-recycle-bin": {
@@ -745,6 +745,73 @@ var LOCAL_API_CONTRACTS = {
745
745
  page_size: { apiName: "page_size", location: "query" }
746
746
  }
747
747
  },
748
+ "create-member": {
749
+ method: "POST",
750
+ path: "/api/v2/user/create",
751
+ params: {
752
+ user_group_id: { apiName: "user_group_id", location: "body" },
753
+ name: { apiName: "name", location: "body" },
754
+ email: { apiName: "email", location: "body" },
755
+ password: { apiName: "password", location: "body" },
756
+ identity: { apiName: "identity", location: "body" },
757
+ manager: { apiName: "manager", location: "body" },
758
+ member: { apiName: "member", location: "body" },
759
+ authorized_group: { apiName: "authorized_group", location: "body" },
760
+ profile_limit: { apiName: "profile_limit", location: "body" },
761
+ remark: { apiName: "remark", location: "body" }
762
+ }
763
+ },
764
+ "update-member": {
765
+ method: "POST",
766
+ path: "/api/v2/user/update",
767
+ params: {
768
+ user_id: { apiName: "user_id", location: "body" },
769
+ user_group_id: { apiName: "user_group_id", location: "body" },
770
+ name: { apiName: "name", location: "body" },
771
+ email: { apiName: "email", location: "body" },
772
+ identity: { apiName: "identity", location: "body" },
773
+ manager: { apiName: "manager", location: "body" },
774
+ member: { apiName: "member", location: "body" },
775
+ authorized_group: { apiName: "authorized_group", location: "body" },
776
+ group_update_type: { apiName: "group_update_type", location: "body" },
777
+ profile_limit: { apiName: "profile_limit", location: "body" },
778
+ remark: { apiName: "remark", location: "body" }
779
+ }
780
+ },
781
+ "reset-member-password": {
782
+ method: "POST",
783
+ path: "/api/v2/user/reset_password",
784
+ params: {
785
+ user_id: { apiName: "user_id", location: "body" },
786
+ unbind_phone: { apiName: "unbind_phone", location: "body" }
787
+ }
788
+ },
789
+ "delete-member": {
790
+ method: "POST",
791
+ path: "/api/v2/user/delete",
792
+ params: {
793
+ user_id: { apiName: "user_id", location: "body" }
794
+ }
795
+ },
796
+ "get-member-list": {
797
+ method: "GET",
798
+ path: "/api/v2/user/list",
799
+ params: {
800
+ user_group_id: { apiName: "user_group_id", location: "query" },
801
+ user_id: { apiName: "user_id", location: "query" },
802
+ email: { apiName: "email", location: "query" },
803
+ page: { apiName: "page", location: "query" },
804
+ limit: { apiName: "limit", location: "query" }
805
+ }
806
+ },
807
+ "get-member-group-list": {
808
+ method: "GET",
809
+ path: "/api/v2/user-group/list",
810
+ params: {
811
+ page: { apiName: "page", location: "query" },
812
+ limit: { apiName: "limit", location: "query" }
813
+ }
814
+ },
748
815
  "create-proxy": {
749
816
  method: "POST",
750
817
  path: "/api/v2/proxy-list/create",
@@ -917,6 +984,12 @@ var API_ENDPOINTS = {
917
984
  GET_GROUP_LIST: LOCAL_API_CONTRACTS["get-group-list"].path,
918
985
  CREATE_GROUP: LOCAL_API_CONTRACTS["create-group"].path,
919
986
  UPDATE_GROUP: LOCAL_API_CONTRACTS["update-group"].path,
987
+ CREATE_MEMBER: LOCAL_API_CONTRACTS["create-member"].path,
988
+ UPDATE_MEMBER: LOCAL_API_CONTRACTS["update-member"].path,
989
+ RESET_MEMBER_PASSWORD: LOCAL_API_CONTRACTS["reset-member-password"].path,
990
+ DELETE_MEMBER: LOCAL_API_CONTRACTS["delete-member"].path,
991
+ GET_MEMBER_LIST: LOCAL_API_CONTRACTS["get-member-list"].path,
992
+ GET_MEMBER_GROUP_LIST: LOCAL_API_CONTRACTS["get-member-group-list"].path,
920
993
  GET_APPLICATION_LIST: LOCAL_API_CONTRACTS["get-application-list"].path,
921
994
  GET_TAG_LIST: LOCAL_API_CONTRACTS["get-tag-list"].path,
922
995
  CREATE_TAG: LOCAL_API_CONTRACTS["create-tag"].path,
@@ -1074,6 +1147,42 @@ var TOOL_INTENT_BY_NAME = {
1074
1147
  triggersEn: "list groups, search group name",
1075
1148
  triggersZh: "\u5206\u7EC4\u5217\u8868,\u67E5\u7EC4\u540D"
1076
1149
  },
1150
+ "create-member": {
1151
+ intentEn: "Create a team member (admin / manager / staff).",
1152
+ intentZh: "\u65B0\u5EFA\u56E2\u961F\u6210\u5458\uFF08\u7BA1\u7406\u5458 / \u7ECF\u7406 / \u5458\u5DE5\uFF09\u3002",
1153
+ triggersEn: "create member, add user, invite teammate, new staff",
1154
+ triggersZh: "\u521B\u5EFA\u6210\u5458,\u6DFB\u52A0\u7528\u6237,\u9080\u8BF7\u540C\u4E8B,\u65B0\u5EFA\u5458\u5DE5"
1155
+ },
1156
+ "update-member": {
1157
+ intentEn: "Update an existing team member (role, groups, profile limit).",
1158
+ intentZh: "\u7F16\u8F91\u5DF2\u6709\u56E2\u961F\u6210\u5458\uFF08\u8EAB\u4EFD\u3001\u6388\u6743\u5206\u7EC4\u3001\u73AF\u5883\u989D\u5EA6\u7B49\uFF09\u3002",
1159
+ triggersEn: "edit member, change role, update staff, authorized group",
1160
+ triggersZh: "\u7F16\u8F91\u6210\u5458,\u6539\u8EAB\u4EFD,\u66F4\u65B0\u7528\u6237,\u6388\u6743\u5206\u7EC4"
1161
+ },
1162
+ "reset-member-password": {
1163
+ intentEn: "Reset a team member password; new_password is returned in the response.",
1164
+ intentZh: "\u91CD\u7F6E\u6210\u5458\u5BC6\u7801\uFF0C\u6210\u529F\u54CD\u5E94\u91CC\u8FD4\u56DE\u660E\u6587 new_password\u3002",
1165
+ triggersEn: "reset password, new password, unbind phone",
1166
+ triggersZh: "\u91CD\u7F6E\u5BC6\u7801,\u6539\u5BC6\u7801,\u89E3\u7ED1\u624B\u673A"
1167
+ },
1168
+ "delete-member": {
1169
+ intentEn: "Permanently delete a team member by user_id. Hard delete, not recoverable.",
1170
+ intentZh: "\u6309 user_id \u5F7B\u5E95\u5220\u9664\u56E2\u961F\u6210\u5458\uFF0C\u4E0D\u53EF\u6062\u590D\u3002",
1171
+ triggersEn: "remove member, delete user, delete staff, hard delete",
1172
+ triggersZh: "\u5220\u9664\u6210\u5458,\u79FB\u9664\u7528\u6237,\u5220\u5458\u5DE5,\u5F7B\u5E95\u5220\u9664"
1173
+ },
1174
+ "get-member-list": {
1175
+ intentEn: "List or search team members (pagination, user_id, email).",
1176
+ intentZh: "\u5206\u9875/\u6761\u4EF6\u67E5\u8BE2\u56E2\u961F\u6210\u5458\u5217\u8868\u3002",
1177
+ triggersEn: "list members, search users, query staff, member list",
1178
+ triggersZh: "\u6210\u5458\u5217\u8868,\u67E5\u8BE2\u7528\u6237,\u641C\u7D22\u5458\u5DE5,\u5217\u51FA\u6210\u5458"
1179
+ },
1180
+ "get-member-group-list": {
1181
+ intentEn: "List member groups / roles with pagination.",
1182
+ intentZh: "\u5206\u9875\u67E5\u8BE2\u6210\u5458\u5206\u7EC4\uFF08\u89D2\u8272\uFF09\u5217\u8868\u3002",
1183
+ triggersEn: "member groups, user groups, role list",
1184
+ triggersZh: "\u6210\u5458\u5206\u7EC4,\u7528\u6237\u7EC4,\u89D2\u8272\u5217\u8868"
1185
+ },
1077
1186
  "check-status": {
1078
1187
  intentEn: "Check Local API availability on this machine.",
1079
1188
  intentZh: "\u68C0\u6D4B\u672C\u673A Local API \u662F\u5426\u53EF\u7528\u3002",
@@ -1595,6 +1704,73 @@ var groupHandlers = {
1595
1704
  }
1596
1705
  };
1597
1706
 
1707
+ // ../core/src/handlers/member.ts
1708
+ function serializeMemberListQuery(params) {
1709
+ const queryParams = { ...params };
1710
+ if (Array.isArray(params.user_id)) {
1711
+ queryParams.user_id = JSON.stringify(params.user_id);
1712
+ }
1713
+ if (Array.isArray(params.email)) {
1714
+ queryParams.email = JSON.stringify(params.email);
1715
+ }
1716
+ return queryParams;
1717
+ }
1718
+ var memberHandlers = {
1719
+ async createMember(params) {
1720
+ const requestBody = buildRequestBodyFor("create-member", params);
1721
+ const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.CREATE_MEMBER}`, requestBody);
1722
+ if (response.data.code === 0) {
1723
+ return JSON.stringify(response.data.data, null, 2);
1724
+ }
1725
+ throw new Error(response.data.msg);
1726
+ },
1727
+ async updateMember(params) {
1728
+ const requestBody = buildRequestBodyFor("update-member", params);
1729
+ const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.UPDATE_MEMBER}`, requestBody);
1730
+ if (response.data.code === 0) {
1731
+ return JSON.stringify(response.data.data, null, 2);
1732
+ }
1733
+ throw new Error(response.data.msg);
1734
+ },
1735
+ async resetMemberPassword(params) {
1736
+ const requestBody = buildRequestBodyFor("reset-member-password", params);
1737
+ const response = await getApiClient().post(
1738
+ `${getLocalApiBase()}${API_ENDPOINTS.RESET_MEMBER_PASSWORD}`,
1739
+ requestBody
1740
+ );
1741
+ if (response.data.code === 0) {
1742
+ return JSON.stringify(response.data.data, null, 2);
1743
+ }
1744
+ throw new Error(response.data.msg);
1745
+ },
1746
+ async deleteMember(params) {
1747
+ const requestBody = buildRequestBodyFor("delete-member", params);
1748
+ const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.DELETE_MEMBER}`, requestBody);
1749
+ if (response.data.code === 0) {
1750
+ return JSON.stringify(response.data.data, null, 2);
1751
+ }
1752
+ throw new Error(response.data.msg);
1753
+ },
1754
+ async getMemberList(params) {
1755
+ const query = buildQueryParamsFor("get-member-list", serializeMemberListQuery(params));
1756
+ const response = await getApiClient().get(`${getLocalApiBase()}${API_ENDPOINTS.GET_MEMBER_LIST}`, { params: query });
1757
+ if (response.data.code === 0) {
1758
+ return JSON.stringify(response.data.data, null, 2);
1759
+ }
1760
+ throw new Error(response.data.msg);
1761
+ },
1762
+ async getMemberGroupList(params) {
1763
+ const query = buildQueryParamsFor("get-member-group-list", params);
1764
+ const response = await getApiClient().get(`${getLocalApiBase()}${API_ENDPOINTS.GET_MEMBER_GROUP_LIST}`, {
1765
+ params: query
1766
+ });
1767
+ if (response.data.code === 0) {
1768
+ return JSON.stringify(response.data.data, null, 2);
1769
+ }
1770
+ throw new Error(response.data.msg);
1771
+ }
1772
+ };
1773
+
1598
1774
  // ../core/src/handlers/application.ts
1599
1775
  var applicationHandlers = {
1600
1776
  async checkStatus() {
@@ -2390,8 +2566,8 @@ var schemas = {
2390
2566
  profile_id: import_zod.z.array(import_zod.z.string()).describe("The profile ids of the browsers to delete, it is required when you want to delete the browser")
2391
2567
  }).strict(),
2392
2568
  getRecycleBinListSchema: import_zod.z.object({
2393
- page: import_zod.z.number().int().min(1).optional().describe("Page number. Defaults to 1. Only profiles deleted in the last 30 days and visible to the caller are returned."),
2394
- limit: import_zod.z.number().int().min(1).max(100).optional().describe("Profiles per page, range 1-100. Defaults to 1 when omitted.")
2569
+ page: import_zod.z.number().int().min(1).optional().describe("Page number. Omit to use the Local API backend default. Only profiles deleted in the last 30 days and visible to the caller are returned."),
2570
+ limit: import_zod.z.number().int().min(1).max(100).optional().describe("Profiles per page, range 1-100. Omit to use the Local API backend default.")
2395
2571
  }).strict(),
2396
2572
  restoreRecycleBinSchema: import_zod.z.object({
2397
2573
  profile_id: import_zod.z.string().optional().describe("Profile ID in the recycle bin. Either profile_id or profile_no is required. If both are provided, profile_id takes priority."),
@@ -2460,6 +2636,49 @@ var schemas = {
2460
2636
  page_size: import_zod.z.number().optional().describe("The size of the page, max is 100, default is 10"),
2461
2637
  page: import_zod.z.number().optional().describe("The page of the group, default is 1")
2462
2638
  }).strict(),
2639
+ createMemberSchema: import_zod.z.object({
2640
+ user_group_id: import_zod.z.string().max(50).describe("Member group / role id. Use get-member-group-list to obtain it"),
2641
+ name: import_zod.z.string().max(50).optional().describe("Member display name, max 50 characters"),
2642
+ email: import_zod.z.string().max(70).describe("Member email, max 70 characters"),
2643
+ password: import_zod.z.string().min(8).max(50).describe("Login password in plaintext, 8 to 50 characters. The Local API hashes it before storing"),
2644
+ identity: import_zod.z.union([import_zod.z.literal(2), import_zod.z.literal(3), import_zod.z.literal(4)]).describe("Role type: 2 admin, 3 manager, 4 staff"),
2645
+ manager: import_zod.z.string().max(15).optional().describe("Direct manager user_id. Optional even when identity is 4 (staff); omit for no manager. Only staff may send this field"),
2646
+ member: import_zod.z.array(import_zod.z.string()).max(300).optional().describe("Direct subordinate user_id list, max 300. Only for identity 3 (manager). Do not send for admin (2); the Local API will reject it"),
2647
+ authorized_group: import_zod.z.array(import_zod.z.string()).max(1500).optional().describe("Authorized browser group ids, max 1500. Empty array means no groups"),
2648
+ profile_limit: import_zod.z.number().optional().describe("Profile quota for this member"),
2649
+ remark: import_zod.z.string().max(100).optional().describe("Remark, max 100 characters")
2650
+ }).strict(),
2651
+ updateMemberSchema: import_zod.z.object({
2652
+ user_id: import_zod.z.string().max(50).describe("Member user_id to update"),
2653
+ user_group_id: import_zod.z.string().max(50).optional().describe("Member group / role id"),
2654
+ name: import_zod.z.string().max(50).optional().describe("Member display name, max 50 characters. Empty string clears the name. Omit to keep unchanged"),
2655
+ email: import_zod.z.string().max(70).optional().describe("Member email, max 70 characters. Omit to keep unchanged. Do not send empty string; it will fail validation"),
2656
+ identity: import_zod.z.union([import_zod.z.literal(2), import_zod.z.literal(3), import_zod.z.literal(4)]).optional().describe("Role type: 2 admin, 3 manager, 4 staff. Omit to keep unchanged. Do not send empty; it will fail validation"),
2657
+ manager: import_zod.z.string().max(15).optional().describe("Direct manager user_id. Empty string clears the manager. Omit to keep unchanged. Only staff may send this field"),
2658
+ member: import_zod.z.array(import_zod.z.string()).max(300).optional().describe("Direct subordinate user_id list, max 300. Only for identity 3 (manager). Empty array clears subordinates. Do not send for admin (2)"),
2659
+ authorized_group: import_zod.z.array(import_zod.z.string()).max(1500).optional().describe("Authorized browser group ids, max 1500. Omit to keep current groups. Empty array plus group_update_type 1 (default) replaces/clears; 2 appends/keeps"),
2660
+ group_update_type: import_zod.z.union([import_zod.z.literal(1), import_zod.z.literal(2)]).optional().describe("How authorized_group is applied: 1 replace (default), 2 append"),
2661
+ profile_limit: import_zod.z.number().optional().describe("Profile quota for this member"),
2662
+ remark: import_zod.z.string().max(100).optional().describe("Remark, max 100 characters. Empty string clears the remark. Omit to keep unchanged")
2663
+ }).strict(),
2664
+ resetMemberPasswordSchema: import_zod.z.object({
2665
+ user_id: import_zod.z.string().max(50).describe("Member user_id whose password will be reset"),
2666
+ unbind_phone: import_zod.z.union([import_zod.z.literal(0), import_zod.z.literal(1)]).optional().describe("Whether to unbind the member phone: 1 unbind, 0 keep. Default 0")
2667
+ }).strict(),
2668
+ deleteMemberSchema: import_zod.z.object({
2669
+ user_id: import_zod.z.string().max(50).describe("Member user_id to permanently delete. Hard delete, not recoverable, does not go to recycle bin")
2670
+ }).strict(),
2671
+ getMemberListSchema: import_zod.z.object({
2672
+ user_group_id: import_zod.z.string().max(50).optional().describe("Filter by member group / role id"),
2673
+ user_id: import_zod.z.array(import_zod.z.string()).max(50).optional().describe('Filter by member user_id list, max 50. Example: ["1001","1002"]'),
2674
+ email: import_zod.z.array(import_zod.z.string()).max(50).optional().describe('Filter by member email list, max 50. Example: ["a@b.com"]'),
2675
+ page: import_zod.z.number().int().min(1).max(2e4).optional().describe("Page number, default 1, max 20000"),
2676
+ limit: import_zod.z.number().int().min(1).max(200).optional().describe("Page size, default 50, max 200. Omitting limit returns 50 rows")
2677
+ }).strict(),
2678
+ getMemberGroupListSchema: import_zod.z.object({
2679
+ page: import_zod.z.number().int().min(1).max(2e4).optional().describe("Page number, default 1, max 20000"),
2680
+ limit: import_zod.z.number().int().min(1).max(200).optional().describe("Page size, default 50, max 200. Omitting limit returns 50 rows")
2681
+ }).strict(),
2463
2682
  getApplicationListSchema: import_zod.z.object({
2464
2683
  category_id: import_zod.z.string().optional().describe("Extension category_id"),
2465
2684
  page: import_zod.z.number().optional().describe("Page number, default 1"),
@@ -2770,6 +2989,36 @@ var STATELESS_HANDLERS = {
2770
2989
  description: buildCliCommandDescription("get-group-list", "Get the list of groups"),
2771
2990
  paramsDescription: schemaParamsDescription(schemas.getGroupListSchema, "get-group-list")
2772
2991
  },
2992
+ "create-member": {
2993
+ fn: memberHandlers.createMember,
2994
+ description: buildCliCommandDescription("create-member", "Create a team member"),
2995
+ paramsDescription: schemaParamsDescription(schemas.createMemberSchema, "create-member")
2996
+ },
2997
+ "update-member": {
2998
+ fn: memberHandlers.updateMember,
2999
+ description: buildCliCommandDescription("update-member", "Update a team member"),
3000
+ paramsDescription: schemaParamsDescription(schemas.updateMemberSchema, "update-member")
3001
+ },
3002
+ "reset-member-password": {
3003
+ fn: memberHandlers.resetMemberPassword,
3004
+ description: buildCliCommandDescription("reset-member-password", "Reset a team member password"),
3005
+ paramsDescription: schemaParamsDescription(schemas.resetMemberPasswordSchema, "reset-member-password")
3006
+ },
3007
+ "delete-member": {
3008
+ fn: memberHandlers.deleteMember,
3009
+ description: buildCliCommandDescription("delete-member", "Permanently delete a team member"),
3010
+ paramsDescription: schemaParamsDescription(schemas.deleteMemberSchema, "delete-member")
3011
+ },
3012
+ "get-member-list": {
3013
+ fn: memberHandlers.getMemberList,
3014
+ description: buildCliCommandDescription("get-member-list", "Get the list of team members"),
3015
+ paramsDescription: schemaParamsDescription(schemas.getMemberListSchema, "get-member-list")
3016
+ },
3017
+ "get-member-group-list": {
3018
+ fn: memberHandlers.getMemberGroupList,
3019
+ description: buildCliCommandDescription("get-member-group-list", "Get the list of member groups"),
3020
+ paramsDescription: schemaParamsDescription(schemas.getMemberGroupListSchema, "get-member-group-list")
3021
+ },
2773
3022
  "check-status": {
2774
3023
  fn: applicationHandlers.checkStatus,
2775
3024
  description: buildCliCommandDescription(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adspower-browser",
3
- "version": "2.1.2-beta.1",
3
+ "version": "2.1.2-beta.3",
4
4
  "main": "cli/index.js",
5
5
  "type": "commonjs",
6
6
  "bin": {