@viu/emporix-sdk 4.7.2 → 4.8.0

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.cjs CHANGED
@@ -1247,7 +1247,7 @@ var HttpClient = class {
1247
1247
  };
1248
1248
 
1249
1249
  // package.json
1250
- var version = "4.7.2";
1250
+ var version = "4.8.0";
1251
1251
 
1252
1252
  // src/version.ts
1253
1253
  var SDK_VERSION = version;
@@ -2165,11 +2165,36 @@ var CategoryService = class {
2165
2165
  * `"PRODUCT"` filter behind {@link productsIn} worked fine.
2166
2166
  * {@link childCategories} hits `/categories/{id}/subcategories` and answers
2167
2167
  * **404** for a tree root. One call gives you the whole hierarchy.
2168
+ *
2169
+ * To filter by category type, category ids or publication, use {@link listTrees}.
2168
2170
  */
2169
2171
  async tree(auth2 = ANON2) {
2172
+ return this.listTrees({}, auth2);
2173
+ }
2174
+ /**
2175
+ * The category trees, filtered (`GET /category-trees`). Default auth: anonymous.
2176
+ * {@link tree} is this call without filters.
2177
+ *
2178
+ * - `categoryIds` goes out comma-joined, because the HTTP layer sends one value
2179
+ * per key. Emporix reads `a,b` like the repeated `categoryIds=a&categoryIds=b`;
2180
+ * both were probed on `viu` on 2026-10-27. An empty list matches nothing and
2181
+ * sends no request.
2182
+ * - `showUnpublished` needs `category.category_read_unpublished`. An anonymous
2183
+ * token does not carry it, and Emporix answers **403**.
2184
+ * - Filter by `type` with care. On `viu` on 2026-10-27, 27 trees built from
2185
+ * categories that all read `STANDARD` came back for neither `STANDARD` nor
2186
+ * `CLASSIFICATION`, only unfiltered.
2187
+ */
2188
+ async listTrees(params = {}, auth2 = ANON2) {
2189
+ if (params.categoryIds?.length === 0) return [];
2170
2190
  return this.ctx.http.request({
2171
2191
  method: "GET",
2172
2192
  path: `/category/${this.ctx.tenant}/category-trees`,
2193
+ query: {
2194
+ type: params.type,
2195
+ categoryIds: params.categoryIds?.join(","),
2196
+ showUnpublished: params.showUnpublished
2197
+ },
2173
2198
  auth: auth2
2174
2199
  });
2175
2200
  }