@reactionary/hcl 0.9.6 → 0.9.8

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/core/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  class HclClient {
2
2
  constructor(config) {
3
3
  this.config = config;
4
- const origin = config.apiUrl.replace(/\/+$/, "");
4
+ const origin = (config.searchApiUrl ?? config.apiUrl).replace(/\/+$/, "");
5
5
  const apiPath = "/search/resources/api/v2";
6
6
  this.baseUrl = `${origin}${apiPath}`;
7
7
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@reactionary/hcl",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
7
7
  "dependencies": {
8
- "@reactionary/core": "0.9.6",
8
+ "@reactionary/core": "0.9.8",
9
9
  "zod": "4.1.9",
10
10
  "vitest": "^4.0.9",
11
11
  "@nx/vite": "22.4.5"
@@ -16,6 +16,9 @@ const HclConfigurationSchema = z.looseObject({
16
16
  apiUrl: z.string().meta({
17
17
  description: "The base origin URL for the HCL Commerce server (e.g. https://example.com)."
18
18
  }),
19
+ searchApiUrl: z.string().optional().meta({
20
+ description: "The base origin URL for the HCL Commerce Search API server, if different from apiUrl."
21
+ }),
19
22
  storeId: z.string().meta({ description: "The HCL Commerce store identifier." }),
20
23
  catalogId: z.string().optional().meta({ description: "The HCL Commerce catalog identifier." }),
21
24
  /**
@@ -1,6 +1,7 @@
1
1
  import * as z from 'zod';
2
2
  export declare const HclConfigurationSchema: z.ZodObject<{
3
3
  apiUrl: z.ZodString;
4
+ searchApiUrl: z.ZodOptional<z.ZodString>;
4
5
  storeId: z.ZodString;
5
6
  catalogId: z.ZodOptional<z.ZodString>;
6
7
  /**
@@ -8,11 +8,16 @@ import {
8
8
  HclConfigurationSchema
9
9
  } from "../schema/configuration.schema.js";
10
10
  function getHclTestConfiguration() {
11
- return HclConfigurationSchema.parse({
11
+ const config = HclConfigurationSchema.parse({
12
12
  apiUrl: process.env["HCL_API_URL"],
13
+ searchApiUrl: process.env["HCL_SEARCH_API_URL"] || void 0,
13
14
  storeId: process.env["HCL_STORE_ID"],
14
15
  catalogId: process.env["HCL_CATALOG_ID"] || void 0
15
16
  });
17
+ if (!config.searchApiUrl) {
18
+ config.searchApiUrl = config.apiUrl;
19
+ }
20
+ return config;
16
21
  }
17
22
  function createHclClient(contextOverrides = {}) {
18
23
  const context = { ...createInitialRequestContext(), ...contextOverrides };