@adobe/spacecat-shared-gpt-client 1.6.6 → 1.6.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-gpt-client-v1.6.8](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.6.7...@adobe/spacecat-shared-gpt-client-v1.6.8) (2025-11-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * make genvar call using http fetch ([#1086](https://github.com/adobe/spacecat-shared/issues/1086)) ([fe5844f](https://github.com/adobe/spacecat-shared/commit/fe5844fd97c9fc06a71b9d2c3404183c6bebd6fe))
7
+
8
+ # [@adobe/spacecat-shared-gpt-client-v1.6.7](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.6.6...@adobe/spacecat-shared-gpt-client-v1.6.7) (2025-10-28)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * remove cyclic deps in shared ([#1053](https://github.com/adobe/spacecat-shared/issues/1053)) ([acbbc93](https://github.com/adobe/spacecat-shared/commit/acbbc93f8c961fdef55edb5e7947958456538586))
14
+
1
15
  # [@adobe/spacecat-shared-gpt-client-v1.6.6](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.6.5...@adobe/spacecat-shared-gpt-client-v1.6.6) (2025-10-25)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-gpt-client",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "Shared modules of the Spacecat Services - GPT Client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "@adobe/fetch": "4.2.3",
38
38
  "@adobe/helix-universal": "5.2.3",
39
- "@adobe/spacecat-shared-ims-client": "1.5.3",
40
- "@adobe/spacecat-shared-utils": "1.26.4"
39
+ "@adobe/spacecat-shared-ims-client": "1.9.0",
40
+ "@adobe/spacecat-shared-utils": "1.66.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "chai": "6.2.0",
@@ -10,15 +10,14 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { createUrl } from '@adobe/fetch';
13
+ import { createUrl, timeoutSignal } from '@adobe/fetch';
14
14
  import { ImsClient } from '@adobe/spacecat-shared-ims-client';
15
15
  import {
16
16
  hasText, isNonEmptyObject,
17
17
  isValidUrl,
18
- tracingFetch,
19
18
  } from '@adobe/spacecat-shared-utils';
20
19
 
21
- import { sanitizeHeaders } from '../utils.js';
20
+ import { fetch as httpFetch, sanitizeHeaders } from '../utils.js';
22
21
 
23
22
  export default class GenvarClient {
24
23
  static createFrom(context) {
@@ -90,20 +89,27 @@ export default class GenvarClient {
90
89
 
91
90
  let response;
92
91
  let responseJsonObj;
92
+ const startTime = process.hrtime.bigint();
93
+ const signal = timeoutSignal(15000);
93
94
  try {
94
- response = await tracingFetch(url, {
95
+ response = await httpFetch(url, {
95
96
  method: 'POST',
96
97
  headers,
97
98
  body,
99
+ signal,
98
100
  });
101
+ this.#logDuration('Genvar Job submit took ms: ', startTime);
99
102
  if (!response.ok) {
100
103
  const errorMessage = await response.text();
101
104
  throw new Error(`Job submission failed with status code ${response.status} and error: ${errorMessage}`);
102
105
  }
103
106
  responseJsonObj = await response.json();
104
107
  } catch (err) {
108
+ this.#logDuration('Genvar Job submit failed. Time taken: ', startTime);
105
109
  this.log.error(`Genvar Job submit failed with error: ${err.message}`);
106
110
  throw err;
111
+ } finally {
112
+ signal.clear();
107
113
  }
108
114
  return responseJsonObj;
109
115
  }
@@ -126,12 +132,14 @@ export default class GenvarClient {
126
132
  this.log.debug(`[Genvar API Call] URL: ${url}, Headers: ${JSON.stringify(sanitizeHeaders(headers))}`);
127
133
 
128
134
  let response;
135
+ const signal = timeoutSignal(15000);
129
136
  try {
130
- response = await tracingFetch(
137
+ response = await httpFetch(
131
138
  createUrl(url),
132
139
  {
133
140
  method: 'GET',
134
141
  headers,
142
+ signal,
135
143
  },
136
144
  );
137
145
  if (!response.ok) {
@@ -141,6 +149,8 @@ export default class GenvarClient {
141
149
  } catch (err) {
142
150
  this.log.error(`Genvar Job poll failed with error: ${err.message}`);
143
151
  throw err;
152
+ } finally {
153
+ signal.clear();
144
154
  }
145
155
  } while (jobStatusResponse.status === 'running');
146
156