@fluid-app/v2025-06-cli-commands 0.1.36 → 0.1.38

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/dist/index.mjs CHANGED
@@ -1899,21 +1899,24 @@ function parseBooleanOption(value, flag) {
1899
1899
  ].includes(normalized)) return false;
1900
1900
  throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
1901
1901
  }
1902
+ function parseArrayOption(value) {
1903
+ return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
1904
+ }
1902
1905
  function registerUsersProducts(parent, ctx) {
1903
1906
  const resource = parent.command("users-products").description("Users Products");
1904
- resource.command("list-user-products").description("List products").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--status <value>", "Filter by status. Supported values: 'active', 'draft', 'archived'.").option("--availability <value>", "Filter by availability. Supported values: 'All', 'in_stock'. If not specified, returns all products.").option("--search-query <value>", "Search products by title or variant SKU").option("--category-ids <value>", "Filter by category IDs").option("--collection-ids <value>", "Filter by collection IDs").option("--country-code <value>", "Filter by country codes").option("--bundle <value>", "Filter by bundle status. true returns only bundles, false returns only non-bundles.").option("--order-by <value>", "Sort results by specified field and direction (e.g. ['price', 'asc'])").action(async (opts) => {
1907
+ resource.command("list-user-products").description("List products").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--status <value>", "Filter by status. Supported values: 'active', 'draft', 'archived'. (comma-separated)").option("--availability <value>", "Filter by availability. Supported values: 'All', 'in_stock'. If not specified, returns all products. (comma-separated)").option("--search-query <value>", "Search products by title or variant SKU").option("--category-ids <value>", "Filter by category IDs (comma-separated)").option("--collection-ids <value>", "Filter by collection IDs (comma-separated)").option("--country-code <value>", "Filter by country codes (comma-separated)").option("--bundle <value>", "Filter by bundle status. true returns only bundles, false returns only non-bundles.").option("--order-by <value>", "Sort results by specified field and direction (e.g. ['price', 'asc']) (comma-separated)").action(async (opts) => {
1905
1908
  const client = await ctx.getClient();
1906
1909
  const params = {};
1907
1910
  if (opts.page !== void 0) params["page"] = Number(opts.page);
1908
1911
  if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
1909
- if (opts.status !== void 0) params["status[]"] = opts.status;
1910
- if (opts.availability !== void 0) params["availability[]"] = opts.availability;
1912
+ if (opts.status !== void 0) params["status[]"] = parseArrayOption(opts.status);
1913
+ if (opts.availability !== void 0) params["availability[]"] = parseArrayOption(opts.availability);
1911
1914
  if (opts.searchQuery !== void 0) params["search_query"] = opts.searchQuery;
1912
- if (opts.categoryIds !== void 0) params["category_ids[]"] = opts.categoryIds;
1913
- if (opts.collectionIds !== void 0) params["collection_ids[]"] = opts.collectionIds;
1914
- if (opts.countryCode !== void 0) params["country_code[]"] = opts.countryCode;
1915
+ if (opts.categoryIds !== void 0) params["category_ids[]"] = parseArrayOption(opts.categoryIds).map(Number);
1916
+ if (opts.collectionIds !== void 0) params["collection_ids[]"] = parseArrayOption(opts.collectionIds).map(Number);
1917
+ if (opts.countryCode !== void 0) params["country_code[]"] = parseArrayOption(opts.countryCode);
1915
1918
  if (opts.bundle !== void 0) params["bundle"] = parseBooleanOption(opts.bundle, "--bundle");
1916
- if (opts.orderBy !== void 0) params["order_by[]"] = opts.orderBy;
1919
+ if (opts.orderBy !== void 0) params["order_by[]"] = parseArrayOption(opts.orderBy);
1917
1920
  if (ctx.verbose) process.stderr.write("GET /api/users/v2025-06/products\n");
1918
1921
  const result = await client.get(`/api/users/v2025-06/products`, params);
1919
1922
  ctx.output(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-app/v2025-06-cli-commands",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "Auto-generated CLI commands for Fluid v2025-06 API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@fluid-app/fluid-cli": "0.1.34",
20
+ "@fluid-app/fluid-cli": "0.1.35",
21
21
  "commander": "^12.0.0"
22
22
  },
23
23
  "devDependencies": {
@@ -9,6 +9,10 @@ function parseBooleanOption(value: string, flag: string): boolean {
9
9
  throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
10
10
  }
11
11
 
12
+ function parseArrayOption(value: string): string[] {
13
+ return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
14
+ }
15
+
12
16
  export function registerUsersProducts(parent: Command, ctx: CommandContext): void {
13
17
  const resource = parent.command("users-products").description("Users Products");
14
18
 
@@ -17,27 +21,27 @@ export function registerUsersProducts(parent: Command, ctx: CommandContext): voi
17
21
  .description("List products")
18
22
  .option("--page <value>", "Page number for pagination")
19
23
  .option("--per-page <value>", "Number of records per page")
20
- .option("--status <value>", "Filter by status. Supported values: 'active', 'draft', 'archived'.")
21
- .option("--availability <value>", "Filter by availability. Supported values: 'All', 'in_stock'. If not specified, returns all products.")
24
+ .option("--status <value>", "Filter by status. Supported values: 'active', 'draft', 'archived'. (comma-separated)")
25
+ .option("--availability <value>", "Filter by availability. Supported values: 'All', 'in_stock'. If not specified, returns all products. (comma-separated)")
22
26
  .option("--search-query <value>", "Search products by title or variant SKU")
23
- .option("--category-ids <value>", "Filter by category IDs")
24
- .option("--collection-ids <value>", "Filter by collection IDs")
25
- .option("--country-code <value>", "Filter by country codes")
27
+ .option("--category-ids <value>", "Filter by category IDs (comma-separated)")
28
+ .option("--collection-ids <value>", "Filter by collection IDs (comma-separated)")
29
+ .option("--country-code <value>", "Filter by country codes (comma-separated)")
26
30
  .option("--bundle <value>", "Filter by bundle status. true returns only bundles, false returns only non-bundles.")
27
- .option("--order-by <value>", "Sort results by specified field and direction (e.g. ['price', 'asc'])")
31
+ .option("--order-by <value>", "Sort results by specified field and direction (e.g. ['price', 'asc']) (comma-separated)")
28
32
  .action(async (opts) => {
29
33
  const client = await ctx.getClient();
30
34
  const params: Record<string, unknown> = {};
31
35
  if (opts.page !== undefined) params["page"] = Number(opts.page);
32
36
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
33
- if (opts.status !== undefined) params["status[]"] = opts.status;
34
- if (opts.availability !== undefined) params["availability[]"] = opts.availability;
37
+ if (opts.status !== undefined) params["status[]"] = parseArrayOption(opts.status);
38
+ if (opts.availability !== undefined) params["availability[]"] = parseArrayOption(opts.availability);
35
39
  if (opts.searchQuery !== undefined) params["search_query"] = opts.searchQuery;
36
- if (opts.categoryIds !== undefined) params["category_ids[]"] = opts.categoryIds;
37
- if (opts.collectionIds !== undefined) params["collection_ids[]"] = opts.collectionIds;
38
- if (opts.countryCode !== undefined) params["country_code[]"] = opts.countryCode;
40
+ if (opts.categoryIds !== undefined) params["category_ids[]"] = parseArrayOption(opts.categoryIds).map(Number);
41
+ if (opts.collectionIds !== undefined) params["collection_ids[]"] = parseArrayOption(opts.collectionIds).map(Number);
42
+ if (opts.countryCode !== undefined) params["country_code[]"] = parseArrayOption(opts.countryCode);
39
43
  if (opts.bundle !== undefined) params["bundle"] = parseBooleanOption(opts.bundle, "--bundle");
40
- if (opts.orderBy !== undefined) params["order_by[]"] = opts.orderBy;
44
+ if (opts.orderBy !== undefined) params["order_by[]"] = parseArrayOption(opts.orderBy);
41
45
  if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/products` + "\n");
42
46
  const result = await client.get(`/api/users/v2025-06/products`, params);
43
47
  ctx.output(result);