adspower-browser 2.0.4 → 2.0.5

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/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-browser-list '{}' # Or group_id?, limit?, page?, profile_id[]?, profile_no[]?, sort_type?, sort_order?, tag_ids?, tags_filter?, name?, name_filter?
145
+ 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?
146
146
  ads get-opened-browser # No params
147
147
  ```
148
148
 
@@ -214,4 +214,4 @@ copy the [`docker-compose.yml`](./docker-compose.yml)
214
214
  docker-compose -f ./docker-compose.yml up -d
215
215
 
216
216
  docker-compose exec adspower-cli /bin/bash
217
- ```
217
+ ```
package/cli/index.js CHANGED
@@ -670,8 +670,8 @@ var LOCAL_API_CONTRACTS = {
670
670
  path: "/api/v2/browser-profile/list",
671
671
  params: {
672
672
  group_id: { apiName: "group_id", location: "body" },
673
- limit: { apiName: "limit", location: "body" },
674
- page: { apiName: "page", location: "body" },
673
+ limit: { apiName: "limit", location: "body", default: 200 },
674
+ page: { apiName: "page", location: "body", default: 1 },
675
675
  profile_id: { apiName: "profile_id", location: "body" },
676
676
  profile_no: { apiName: "profile_no", location: "body" },
677
677
  sort_type: { apiName: "sort_type", location: "body" },
@@ -1287,6 +1287,9 @@ function toContractValue(value) {
1287
1287
  }
1288
1288
  return value;
1289
1289
  }
1290
+ function withContractDefault(value, defaultValue) {
1291
+ return value === void 0 ? defaultValue : value;
1292
+ }
1290
1293
  function buildRequestBodyFor(command, params) {
1291
1294
  const requestBody = {};
1292
1295
  const contract = LOCAL_API_CONTRACTS[command];
@@ -1294,7 +1297,7 @@ function buildRequestBodyFor(command, params) {
1294
1297
  if (config2.location !== "body") {
1295
1298
  return;
1296
1299
  }
1297
- const value = params[inputName];
1300
+ const value = withContractDefault(params[inputName], config2.default);
1298
1301
  if (value !== void 0) {
1299
1302
  requestBody[config2.apiName] = toContractValue(value);
1300
1303
  }
@@ -1308,7 +1311,7 @@ function buildQueryParamsFor(command, params) {
1308
1311
  if (config2.location !== "query") {
1309
1312
  return;
1310
1313
  }
1311
- const value = params[inputName];
1314
+ const value = withContractDefault(params[inputName], config2.default);
1312
1315
  if (value === void 0) {
1313
1316
  return;
1314
1317
  }
@@ -2326,8 +2329,8 @@ var schemas = {
2326
2329
  }).strict(),
2327
2330
  getBrowserListSchema: import_zod.z.object({
2328
2331
  group_id: import_zod.z.string().regex(/^\d+$/, "Group ID must be a numeric string").optional().describe("Query by group ID; searches all groups if empty"),
2329
- limit: import_zod.z.number().min(1).max(200).optional().describe("Profiles per page. Number of profiles returned per page, range 1 ~ 200, default is 50"),
2330
- page: import_zod.z.number().min(1).optional().describe("Page number for results, default is 1"),
2332
+ limit: import_zod.z.number().min(1).max(200).optional().describe("Profiles per page, range 1 ~ 200. If omitted the CLI sends limit=200; the Local API itself defaults to only 1, so always rely on this CLI default or pass an explicit value"),
2333
+ page: import_zod.z.number().min(1).optional().describe("Page number for results. If omitted the CLI sends page=1"),
2331
2334
  profile_id: nonEmptyStringArraySchema.optional().describe('Query by profile ID. Example: ["h1yynkm","h1yynks"]'),
2332
2335
  profile_no: nonEmptyStringArraySchema.optional().describe('Query by profile number. Example: ["123","124"]'),
2333
2336
  sort_type: import_zod.z.enum(["profile_no", "last_open_time", "created_time"]).optional().describe("Sort results by: profile_no, last_open_time, or created_time"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adspower-browser",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "main": "cli/index.js",
5
5
  "type": "commonjs",
6
6
  "bin": {