@adobe/spacecat-shared-gpt-client 1.2.0 → 1.2.2

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.2.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.2.1...@adobe/spacecat-shared-gpt-client-v1.2.2) (2024-05-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add logs ([#231](https://github.com/adobe/spacecat-shared/issues/231)) ([1777bb3](https://github.com/adobe/spacecat-shared/commit/1777bb331726086040b00aadbf82835cff8385df))
7
+
8
+ # [@adobe/spacecat-shared-gpt-client-v1.2.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.2.0...@adobe/spacecat-shared-gpt-client-v1.2.1) (2024-05-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#228](https://github.com/adobe/spacecat-shared/issues/228)) ([ef2ab41](https://github.com/adobe/spacecat-shared/commit/ef2ab41a9175ec5ba8ec7e2830898e9db01fb2b6))
14
+
1
15
  # [@adobe/spacecat-shared-gpt-client-v1.2.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.1.9...@adobe/spacecat-shared-gpt-client-v1.2.0) (2024-05-08)
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.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Shared modules of the Spacecat Services - GPT Client",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "chai": "4.4.1",
40
- "chai-as-promised": "7.1.1",
40
+ "chai-as-promised": "7.1.2",
41
41
  "nock": "13.5.4",
42
- "sinon": "17.0.1",
42
+ "sinon": "17.0.2",
43
43
  "sinon-chai": "3.7.0",
44
44
  "typescript": "5.4.5"
45
45
  }
@@ -98,14 +98,18 @@ export default class FirefallClient {
98
98
  });
99
99
 
100
100
  const url = createUrl(`${this.config.apiEndpoint}/v2/capability_execution/job`);
101
+ const headers = {
102
+ 'Content-Type': 'application/json',
103
+ Authorization: `Bearer ${apiAuth}`,
104
+ 'x-api-key': this.config.apiKey,
105
+ 'x-gw-ims-org-id': this.config.imsOrg,
106
+ };
107
+
108
+ this.log.info(`URL: ${url}, Headers: ${JSON.stringify(headers)}`);
109
+
101
110
  const response = await httpFetch(url, {
102
111
  method: 'POST',
103
- headers: {
104
- 'Content-Type': 'application/json',
105
- Authorization: `Bearer ${apiAuth}`,
106
- 'x-api-key': this.config.apiKey,
107
- 'x-gw-ims-org-id': this.config.imsOrg,
108
- },
112
+ headers,
109
113
  body,
110
114
  });
111
115
 
@@ -126,15 +130,20 @@ export default class FirefallClient {
126
130
  (resolve) => { setTimeout(resolve, this.config.pollInterval); },
127
131
  ); // Wait for 2 seconds before polling
128
132
 
133
+ const url = `${this.config.apiEndpoint}/v2/capability_execution/job/${jobId}`;
134
+ const headers = {
135
+ Authorization: `Bearer ${apiAuth}`,
136
+ 'x-api-key': this.config.apiKey,
137
+ 'x-gw-ims-org-id': this.config.imsOrg,
138
+ };
139
+
140
+ this.log.info(`URL: ${url}, Headers: ${JSON.stringify(headers)}`);
141
+
129
142
  const response = await httpFetch(
130
- createUrl(`${this.config.apiEndpoint}/v2/capability_execution/job/${jobId}`),
143
+ createUrl(url),
131
144
  {
132
145
  method: 'GET',
133
- headers: {
134
- Authorization: `Bearer ${apiAuth}`,
135
- 'x-api-key': this.config.apiKey,
136
- 'x-gw-ims-org-id': this.config.imsOrg,
137
- },
146
+ headers,
138
147
  },
139
148
  );
140
149