adspower-browser 2.1.1 → 2.1.2

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 +11 -0
  2. package/cli/index.js +249 -0
  3. package/package.json +1 -1
package/README.MD CHANGED
@@ -168,6 +168,17 @@ ads update-group '{"group_id":"1","group_name":"New Name"}' # group_id + grou
168
168
  ads get-group-list '{}' # group_name?, page_size?, page?
169
169
  ```
170
170
 
171
+ ### Member
172
+
173
+ ```bash
174
+ ads create-member '{"user_group_id":"...","email":"alice@example.com","password":"password1","identity":4}' # identity: 2 admin, 3 manager, 4 staff
175
+ ads update-member '{"user_id":"...","name":"Alice"}' # omit authorized_group to keep groups; [] + group_update_type 1 clears
176
+ ads reset-member-password '{"user_id":"..."}' # unbind_phone?: 0|1; new_password is in the response
177
+ ads delete-member '{"user_id":"..."}'
178
+ ads get-member-list '{}' # user_group_id?, user_id[]?, email[]?, page?, limit? (default 1)
179
+ ads get-member-group-list '{}' # page?, limit? (default 1)
180
+ ```
181
+
171
182
  ### Application (categories)
172
183
 
173
184
  ```bash
package/cli/index.js CHANGED
@@ -728,6 +728,73 @@ var LOCAL_API_CONTRACTS = {
728
728
  page_size: { apiName: "page_size", location: "query" }
729
729
  }
730
730
  },
731
+ "create-member": {
732
+ method: "POST",
733
+ path: "/api/v2/user/create",
734
+ params: {
735
+ user_group_id: { apiName: "user_group_id", location: "body" },
736
+ name: { apiName: "name", location: "body" },
737
+ email: { apiName: "email", location: "body" },
738
+ password: { apiName: "password", location: "body" },
739
+ identity: { apiName: "identity", location: "body" },
740
+ manager: { apiName: "manager", location: "body" },
741
+ member: { apiName: "member", location: "body" },
742
+ authorized_group: { apiName: "authorized_group", location: "body" },
743
+ profile_limit: { apiName: "profile_limit", location: "body" },
744
+ remark: { apiName: "remark", location: "body" }
745
+ }
746
+ },
747
+ "update-member": {
748
+ method: "POST",
749
+ path: "/api/v2/user/update",
750
+ params: {
751
+ user_id: { apiName: "user_id", location: "body" },
752
+ user_group_id: { apiName: "user_group_id", location: "body" },
753
+ name: { apiName: "name", location: "body" },
754
+ email: { apiName: "email", location: "body" },
755
+ identity: { apiName: "identity", location: "body" },
756
+ manager: { apiName: "manager", location: "body" },
757
+ member: { apiName: "member", location: "body" },
758
+ authorized_group: { apiName: "authorized_group", location: "body" },
759
+ group_update_type: { apiName: "group_update_type", location: "body" },
760
+ profile_limit: { apiName: "profile_limit", location: "body" },
761
+ remark: { apiName: "remark", location: "body" }
762
+ }
763
+ },
764
+ "reset-member-password": {
765
+ method: "POST",
766
+ path: "/api/v2/user/reset_password",
767
+ params: {
768
+ user_id: { apiName: "user_id", location: "body" },
769
+ unbind_phone: { apiName: "unbind_phone", location: "body" }
770
+ }
771
+ },
772
+ "delete-member": {
773
+ method: "POST",
774
+ path: "/api/v2/user/delete",
775
+ params: {
776
+ user_id: { apiName: "user_id", location: "body" }
777
+ }
778
+ },
779
+ "get-member-list": {
780
+ method: "GET",
781
+ path: "/api/v2/user/list",
782
+ params: {
783
+ user_group_id: { apiName: "user_group_id", location: "query" },
784
+ user_id: { apiName: "user_id", location: "query" },
785
+ email: { apiName: "email", location: "query" },
786
+ page: { apiName: "page", location: "query" },
787
+ limit: { apiName: "limit", location: "query" }
788
+ }
789
+ },
790
+ "get-member-group-list": {
791
+ method: "GET",
792
+ path: "/api/v2/user-group/list",
793
+ params: {
794
+ page: { apiName: "page", location: "query" },
795
+ limit: { apiName: "limit", location: "query" }
796
+ }
797
+ },
731
798
  "create-proxy": {
732
799
  method: "POST",
733
800
  path: "/api/v2/proxy-list/create",
@@ -898,6 +965,12 @@ var API_ENDPOINTS = {
898
965
  GET_GROUP_LIST: LOCAL_API_CONTRACTS["get-group-list"].path,
899
966
  CREATE_GROUP: LOCAL_API_CONTRACTS["create-group"].path,
900
967
  UPDATE_GROUP: LOCAL_API_CONTRACTS["update-group"].path,
968
+ CREATE_MEMBER: LOCAL_API_CONTRACTS["create-member"].path,
969
+ UPDATE_MEMBER: LOCAL_API_CONTRACTS["update-member"].path,
970
+ RESET_MEMBER_PASSWORD: LOCAL_API_CONTRACTS["reset-member-password"].path,
971
+ DELETE_MEMBER: LOCAL_API_CONTRACTS["delete-member"].path,
972
+ GET_MEMBER_LIST: LOCAL_API_CONTRACTS["get-member-list"].path,
973
+ GET_MEMBER_GROUP_LIST: LOCAL_API_CONTRACTS["get-member-group-list"].path,
901
974
  GET_APPLICATION_LIST: LOCAL_API_CONTRACTS["get-application-list"].path,
902
975
  GET_TAG_LIST: LOCAL_API_CONTRACTS["get-tag-list"].path,
903
976
  CREATE_TAG: LOCAL_API_CONTRACTS["create-tag"].path,
@@ -1043,6 +1116,42 @@ var TOOL_INTENT_BY_NAME = {
1043
1116
  triggersEn: "list groups, search group name",
1044
1117
  triggersZh: "\u5206\u7EC4\u5217\u8868,\u67E5\u7EC4\u540D"
1045
1118
  },
1119
+ "create-member": {
1120
+ intentEn: "Create a team member (admin / manager / staff).",
1121
+ intentZh: "\u65B0\u5EFA\u56E2\u961F\u6210\u5458\uFF08\u7BA1\u7406\u5458 / \u7ECF\u7406 / \u5458\u5DE5\uFF09\u3002",
1122
+ triggersEn: "create member, add user, invite teammate, new staff",
1123
+ triggersZh: "\u521B\u5EFA\u6210\u5458,\u6DFB\u52A0\u7528\u6237,\u9080\u8BF7\u540C\u4E8B,\u65B0\u5EFA\u5458\u5DE5"
1124
+ },
1125
+ "update-member": {
1126
+ intentEn: "Update an existing team member (role, groups, profile limit).",
1127
+ 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",
1128
+ triggersEn: "edit member, change role, update staff, authorized group",
1129
+ triggersZh: "\u7F16\u8F91\u6210\u5458,\u6539\u8EAB\u4EFD,\u66F4\u65B0\u7528\u6237,\u6388\u6743\u5206\u7EC4"
1130
+ },
1131
+ "reset-member-password": {
1132
+ intentEn: "Reset a team member password; new_password is returned in the response.",
1133
+ intentZh: "\u91CD\u7F6E\u6210\u5458\u5BC6\u7801\uFF0C\u6210\u529F\u54CD\u5E94\u91CC\u8FD4\u56DE\u660E\u6587 new_password\u3002",
1134
+ triggersEn: "reset password, new password, unbind phone",
1135
+ triggersZh: "\u91CD\u7F6E\u5BC6\u7801,\u6539\u5BC6\u7801,\u89E3\u7ED1\u624B\u673A"
1136
+ },
1137
+ "delete-member": {
1138
+ intentEn: "Delete a team member by user_id.",
1139
+ intentZh: "\u6309 user_id \u5220\u9664\u56E2\u961F\u6210\u5458\u3002",
1140
+ triggersEn: "remove member, delete user, delete staff",
1141
+ triggersZh: "\u5220\u9664\u6210\u5458,\u79FB\u9664\u7528\u6237,\u5220\u5458\u5DE5"
1142
+ },
1143
+ "get-member-list": {
1144
+ intentEn: "List or search team members (pagination, user_id, email).",
1145
+ intentZh: "\u5206\u9875/\u6761\u4EF6\u67E5\u8BE2\u56E2\u961F\u6210\u5458\u5217\u8868\u3002",
1146
+ triggersEn: "list members, search users, query staff, member list",
1147
+ triggersZh: "\u6210\u5458\u5217\u8868,\u67E5\u8BE2\u7528\u6237,\u641C\u7D22\u5458\u5DE5,\u5217\u51FA\u6210\u5458"
1148
+ },
1149
+ "get-member-group-list": {
1150
+ intentEn: "List member groups / roles with pagination.",
1151
+ intentZh: "\u5206\u9875\u67E5\u8BE2\u6210\u5458\u5206\u7EC4\uFF08\u89D2\u8272\uFF09\u5217\u8868\u3002",
1152
+ triggersEn: "member groups, user groups, role list",
1153
+ triggersZh: "\u6210\u5458\u5206\u7EC4,\u7528\u6237\u7EC4,\u89D2\u8272\u5217\u8868"
1154
+ },
1046
1155
  "check-status": {
1047
1156
  intentEn: "Check Local API availability on this machine.",
1048
1157
  intentZh: "\u68C0\u6D4B\u672C\u673A Local API \u662F\u5426\u53EF\u7528\u3002",
@@ -1544,6 +1653,73 @@ var groupHandlers = {
1544
1653
  }
1545
1654
  };
1546
1655
 
1656
+ // ../core/src/handlers/member.ts
1657
+ function serializeMemberListQuery(params) {
1658
+ const queryParams = { ...params };
1659
+ if (Array.isArray(params.user_id)) {
1660
+ queryParams.user_id = JSON.stringify(params.user_id);
1661
+ }
1662
+ if (Array.isArray(params.email)) {
1663
+ queryParams.email = JSON.stringify(params.email);
1664
+ }
1665
+ return queryParams;
1666
+ }
1667
+ var memberHandlers = {
1668
+ async createMember(params) {
1669
+ const requestBody = buildRequestBodyFor("create-member", params);
1670
+ const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.CREATE_MEMBER}`, requestBody);
1671
+ if (response.data.code === 0) {
1672
+ return JSON.stringify(response.data.data, null, 2);
1673
+ }
1674
+ throw new Error(response.data.msg);
1675
+ },
1676
+ async updateMember(params) {
1677
+ const requestBody = buildRequestBodyFor("update-member", params);
1678
+ const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.UPDATE_MEMBER}`, requestBody);
1679
+ if (response.data.code === 0) {
1680
+ return JSON.stringify(response.data.data, null, 2);
1681
+ }
1682
+ throw new Error(response.data.msg);
1683
+ },
1684
+ async resetMemberPassword(params) {
1685
+ const requestBody = buildRequestBodyFor("reset-member-password", params);
1686
+ const response = await getApiClient().post(
1687
+ `${getLocalApiBase()}${API_ENDPOINTS.RESET_MEMBER_PASSWORD}`,
1688
+ requestBody
1689
+ );
1690
+ if (response.data.code === 0) {
1691
+ return JSON.stringify(response.data.data, null, 2);
1692
+ }
1693
+ throw new Error(response.data.msg);
1694
+ },
1695
+ async deleteMember(params) {
1696
+ const requestBody = buildRequestBodyFor("delete-member", params);
1697
+ const response = await getApiClient().post(`${getLocalApiBase()}${API_ENDPOINTS.DELETE_MEMBER}`, requestBody);
1698
+ if (response.data.code === 0) {
1699
+ return JSON.stringify(response.data.data, null, 2);
1700
+ }
1701
+ throw new Error(response.data.msg);
1702
+ },
1703
+ async getMemberList(params) {
1704
+ const query = buildQueryParamsFor("get-member-list", serializeMemberListQuery(params));
1705
+ const response = await getApiClient().get(`${getLocalApiBase()}${API_ENDPOINTS.GET_MEMBER_LIST}`, { params: query });
1706
+ if (response.data.code === 0) {
1707
+ return JSON.stringify(response.data.data, null, 2);
1708
+ }
1709
+ throw new Error(response.data.msg);
1710
+ },
1711
+ async getMemberGroupList(params) {
1712
+ const query = buildQueryParamsFor("get-member-group-list", params);
1713
+ const response = await getApiClient().get(`${getLocalApiBase()}${API_ENDPOINTS.GET_MEMBER_GROUP_LIST}`, {
1714
+ params: query
1715
+ });
1716
+ if (response.data.code === 0) {
1717
+ return JSON.stringify(response.data.data, null, 2);
1718
+ }
1719
+ throw new Error(response.data.msg);
1720
+ }
1721
+ };
1722
+
1547
1723
  // ../core/src/handlers/application.ts
1548
1724
  var applicationHandlers = {
1549
1725
  async checkStatus() {
@@ -2398,6 +2574,49 @@ var schemas = {
2398
2574
  page_size: import_zod.z.number().optional().describe("The size of the page, max is 100, default is 10"),
2399
2575
  page: import_zod.z.number().optional().describe("The page of the group, default is 1")
2400
2576
  }).strict(),
2577
+ createMemberSchema: import_zod.z.object({
2578
+ user_group_id: import_zod.z.string().max(50).describe("Member group / role id. Use get-member-group-list to obtain it"),
2579
+ name: import_zod.z.string().max(50).optional().describe("Member display name, max 50 characters"),
2580
+ email: import_zod.z.string().max(70).describe("Member email, max 70 characters"),
2581
+ 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"),
2582
+ 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"),
2583
+ manager: import_zod.z.string().max(15).optional().describe("Direct manager user_id. Required when identity is 4 (staff)"),
2584
+ member: import_zod.z.array(import_zod.z.string()).max(300).optional().describe("Direct subordinate user_id list, max 300. Used when identity is 2 or 3"),
2585
+ 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"),
2586
+ profile_limit: import_zod.z.number().optional().describe("Profile quota for this member"),
2587
+ remark: import_zod.z.string().max(100).optional().describe("Remark, max 100 characters")
2588
+ }).strict(),
2589
+ updateMemberSchema: import_zod.z.object({
2590
+ user_id: import_zod.z.string().max(50).describe("Member user_id to update"),
2591
+ user_group_id: import_zod.z.string().max(50).optional().describe("Member group / role id"),
2592
+ name: import_zod.z.string().max(50).optional().describe("Member display name, max 50 characters. Empty string clears the name"),
2593
+ email: import_zod.z.string().max(70).optional().describe("Member email, max 70 characters"),
2594
+ 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"),
2595
+ manager: import_zod.z.string().max(15).optional().describe("Direct manager user_id. Empty string clears the manager"),
2596
+ member: import_zod.z.array(import_zod.z.string()).max(300).optional().describe("Direct subordinate user_id list, max 300. Empty array clears subordinates"),
2597
+ 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"),
2598
+ 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"),
2599
+ profile_limit: import_zod.z.number().optional().describe("Profile quota for this member"),
2600
+ remark: import_zod.z.string().max(100).optional().describe("Remark, max 100 characters. Empty string clears the remark")
2601
+ }).strict(),
2602
+ resetMemberPasswordSchema: import_zod.z.object({
2603
+ user_id: import_zod.z.string().max(50).describe("Member user_id whose password will be reset"),
2604
+ 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")
2605
+ }).strict(),
2606
+ deleteMemberSchema: import_zod.z.object({
2607
+ user_id: import_zod.z.string().max(50).describe("Member user_id to delete")
2608
+ }).strict(),
2609
+ getMemberListSchema: import_zod.z.object({
2610
+ user_group_id: import_zod.z.string().max(50).optional().describe("Filter by member group / role id"),
2611
+ 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"]'),
2612
+ email: import_zod.z.array(import_zod.z.string()).max(50).optional().describe('Filter by member email list, max 50. Example: ["a@b.com"]'),
2613
+ page: import_zod.z.number().int().min(1).max(1e7).optional().describe("Page number, default 1"),
2614
+ limit: import_zod.z.number().int().min(1).max(2e3).optional().describe("Page size, default 1, max 2000")
2615
+ }).strict(),
2616
+ getMemberGroupListSchema: import_zod.z.object({
2617
+ page: import_zod.z.number().int().min(1).max(1e7).optional().describe("Page number, default 1"),
2618
+ limit: import_zod.z.number().int().min(1).max(2e3).optional().describe("Page size, default 1, max 2000")
2619
+ }).strict(),
2401
2620
  getApplicationListSchema: import_zod.z.object({
2402
2621
  category_id: import_zod.z.string().optional().describe("Extension category_id"),
2403
2622
  page: import_zod.z.number().optional().describe("Page number, default 1"),
@@ -2698,6 +2917,36 @@ var STATELESS_HANDLERS = {
2698
2917
  description: buildCliCommandDescription("get-group-list", "Get the list of groups"),
2699
2918
  paramsDescription: schemaParamsDescription(schemas.getGroupListSchema, "get-group-list")
2700
2919
  },
2920
+ "create-member": {
2921
+ fn: memberHandlers.createMember,
2922
+ description: buildCliCommandDescription("create-member", "Create a team member"),
2923
+ paramsDescription: schemaParamsDescription(schemas.createMemberSchema, "create-member")
2924
+ },
2925
+ "update-member": {
2926
+ fn: memberHandlers.updateMember,
2927
+ description: buildCliCommandDescription("update-member", "Update a team member"),
2928
+ paramsDescription: schemaParamsDescription(schemas.updateMemberSchema, "update-member")
2929
+ },
2930
+ "reset-member-password": {
2931
+ fn: memberHandlers.resetMemberPassword,
2932
+ description: buildCliCommandDescription("reset-member-password", "Reset a team member password"),
2933
+ paramsDescription: schemaParamsDescription(schemas.resetMemberPasswordSchema, "reset-member-password")
2934
+ },
2935
+ "delete-member": {
2936
+ fn: memberHandlers.deleteMember,
2937
+ description: buildCliCommandDescription("delete-member", "Delete a team member"),
2938
+ paramsDescription: schemaParamsDescription(schemas.deleteMemberSchema, "delete-member")
2939
+ },
2940
+ "get-member-list": {
2941
+ fn: memberHandlers.getMemberList,
2942
+ description: buildCliCommandDescription("get-member-list", "Get the list of team members"),
2943
+ paramsDescription: schemaParamsDescription(schemas.getMemberListSchema, "get-member-list")
2944
+ },
2945
+ "get-member-group-list": {
2946
+ fn: memberHandlers.getMemberGroupList,
2947
+ description: buildCliCommandDescription("get-member-group-list", "Get the list of member groups"),
2948
+ paramsDescription: schemaParamsDescription(schemas.getMemberGroupListSchema, "get-member-group-list")
2949
+ },
2701
2950
  "check-status": {
2702
2951
  fn: applicationHandlers.checkStatus,
2703
2952
  description: buildCliCommandDescription(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adspower-browser",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "main": "cli/index.js",
5
5
  "type": "commonjs",
6
6
  "bin": {