@boltic/cli 1.0.30 → 1.0.31

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.
@@ -1,9 +1,27 @@
1
1
  import axios from "axios";
2
2
  import FormData from "form-data";
3
3
  import fs from "fs";
4
+ import https from "https";
4
5
  import { handleError } from "../helper/error.js";
5
6
  import { logApi } from "../helper/verbose.js";
6
7
 
8
+ const getHttpsAgentForUrl = (baseUrl) => {
9
+ try {
10
+ const host = new URL(baseUrl).hostname;
11
+ if (
12
+ host.endsWith("fcz0.de") ||
13
+ host.endsWith("uat.fcz0.de") ||
14
+ host.endsWith("fyndx1.de") ||
15
+ process.env.BOLTCI_INSECURE_TLS === "true"
16
+ ) {
17
+ return new https.Agent({ rejectUnauthorized: false });
18
+ }
19
+ } catch (_) {
20
+ // ignore URL parse errors and fall back to default agent
21
+ }
22
+ return undefined;
23
+ };
24
+
7
25
  const getIntegrationGroups = async (apiUrl, accountId, token, session) => {
8
26
  if (!token || !session || !accountId) {
9
27
  console.error(
@@ -26,6 +44,7 @@ const getIntegrationGroups = async (apiUrl, accountId, token, session) => {
26
44
  Authorization: `Bearer ${token}`,
27
45
  Cookie: session,
28
46
  },
47
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
29
48
  };
30
49
 
31
50
  const response = await axios(axiosOptions);
@@ -58,6 +77,7 @@ const listAllIntegrations = async (apiUrl, token, accountId, session) => {
58
77
  Authorization: `Bearer ${token}`,
59
78
  Cookie: session,
60
79
  },
80
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
61
81
  };
62
82
 
63
83
  const response = await axios(axiosOptions);
@@ -93,6 +113,7 @@ const saveIntegration = async (
93
113
  Authorization: `Bearer ${token}`,
94
114
  Cookie: session,
95
115
  },
116
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
96
117
  });
97
118
  return response.data.data;
98
119
  } catch (error) {
@@ -120,6 +141,7 @@ const editIntegration = async (apiUrl, token, accountId, session, payload) => {
120
141
  Authorization: `Bearer ${token}`,
121
142
  Cookie: session,
122
143
  },
144
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
123
145
  });
124
146
 
125
147
  return response.data.data;
@@ -154,6 +176,7 @@ const updateIntegration = async (
154
176
  Authorization: `Bearer ${token}`,
155
177
  Cookie: session,
156
178
  },
179
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
157
180
  });
158
181
  return response.data.data;
159
182
  } catch (error) {
@@ -186,6 +209,7 @@ const getIntegrationById = async (
186
209
  Authorization: `Bearer ${token}`,
187
210
  Cookie: session,
188
211
  },
212
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
189
213
  });
190
214
  return response.data.data;
191
215
  } catch (error) {
@@ -218,6 +242,7 @@ const getAuthenticationByIntegrationId = async (
218
242
  Authorization: `Bearer ${token}`,
219
243
  Cookie: session,
220
244
  },
245
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
221
246
  });
222
247
  return response.data.data;
223
248
  } catch (error) {
@@ -250,6 +275,7 @@ const getWebhooksByIntegrationId = async (
250
275
  Authorization: `Bearer ${token}`,
251
276
  Cookie: session,
252
277
  },
278
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
253
279
  });
254
280
  return response.data.data;
255
281
  } catch (error) {
@@ -281,6 +307,7 @@ const getConfigurationByIntegrationId = async (
281
307
  Authorization: `Bearer ${token}`,
282
308
  Cookie: session,
283
309
  },
310
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
284
311
  });
285
312
  return response.data.data;
286
313
  } catch (error) {
@@ -313,6 +340,7 @@ const syncIntegration = async (
313
340
  Authorization: `Bearer ${token}`,
314
341
  Cookie: session,
315
342
  },
343
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
316
344
  });
317
345
  return response.data.data;
318
346
  } catch (error) {
@@ -345,6 +373,7 @@ const sendIntegrationForReview = async (
345
373
  Authorization: `Bearer ${token}`,
346
374
  Cookie: session,
347
375
  },
376
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
348
377
  });
349
378
  return response.data.data;
350
379
  } catch (error) {
@@ -373,6 +402,7 @@ const purgeCache = async (apiUrl, token, accountId, session, integration) => {
373
402
  Authorization: `Bearer ${token}`,
374
403
  Cookie: session,
375
404
  },
405
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
376
406
  });
377
407
  return response.data;
378
408
  } catch (error) {
@@ -398,6 +428,7 @@ const pullIntegration = async (apiUrl, token, accountId, session, id) => {
398
428
  Authorization: `Bearer ${token}`,
399
429
  Cookie: session,
400
430
  },
431
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
401
432
  });
402
433
 
403
434
  return response.data.data;
@@ -439,6 +470,7 @@ const uploadFileToCloud = async (
439
470
  Authorization: `Bearer ${token}`,
440
471
  Cookie: session,
441
472
  },
473
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
442
474
  }
443
475
  );
444
476
 
package/api/login.js CHANGED
@@ -1,6 +1,24 @@
1
1
  import axios from "axios";
2
+ import https from "https";
2
3
  import { handleError } from "../helper/error.js";
3
4
 
5
+ const getHttpsAgentForUrl = (baseUrl) => {
6
+ try {
7
+ const host = new URL(baseUrl).hostname;
8
+ if (
9
+ host.endsWith("fcz0.de") ||
10
+ host.endsWith("uat.fcz0.de") ||
11
+ host.endsWith("fyndx1.de") ||
12
+ process.env.BOLTCI_INSECURE_TLS === "true"
13
+ ) {
14
+ return new https.Agent({ rejectUnauthorized: false });
15
+ }
16
+ } catch (_) {
17
+ // ignore URL parse errors and fall back to default agent
18
+ }
19
+ return undefined;
20
+ };
21
+
4
22
  const getProductAccounts = async (consoleUrl, token, orgId) => {
5
23
  try {
6
24
  const response = await axios({
@@ -9,6 +27,7 @@ const getProductAccounts = async (consoleUrl, token, orgId) => {
9
27
  headers: {
10
28
  Cookie: `fc.session=${token}`,
11
29
  },
30
+ httpsAgent: getHttpsAgentForUrl(consoleUrl),
12
31
  });
13
32
  return response;
14
33
  } catch (error) {
@@ -24,6 +43,7 @@ const getCliSession = async (apiUrl, requestCode) => {
24
43
  headers: {
25
44
  "Content-Type": "application/json",
26
45
  },
46
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
27
47
  });
28
48
  return response;
29
49
  } catch (error) {
@@ -40,6 +60,7 @@ const getCliBearerToken = async (name, apiUrl, account_id, session) => {
40
60
  "Content-Type": "application/json",
41
61
  Cookie: `${name}.session=${session}`,
42
62
  },
63
+ httpsAgent: getHttpsAgentForUrl(apiUrl),
43
64
  });
44
65
  return response;
45
66
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boltic/cli",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "A powerful CLI tool for managing Boltic Workflow integrations - create, sync, test, and publish integrations with ease",
5
5
  "main": "index.js",
6
6
  "bin": {