n8n-nodes-qlik-cloud 1.2.4 → 1.2.5

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.
@@ -6,7 +6,7 @@ class QlikCloudOAuth2Api {
6
6
  constructor() {
7
7
  this.name = 'qlikCloudOAuth2Api';
8
8
  this.displayName = 'Qlik Cloud OAuth2 API';
9
- this.documentationUrl = 'https://qlik.dev/authenticate/';
9
+ this.documentationUrl = 'https://qlik.dev/authenticate/oauth/';
10
10
  this.extends = ['oAuth2Api'];
11
11
  this.properties = [
12
12
  {
@@ -11,8 +11,28 @@ async function qlikApiRequest(method, endpoint, body, qs, returnFullResponse = f
11
11
  message: `No credentials found for Qlik Cloud API (${authenticationMethod === 'oAuth2' ? 'OAuth2' : 'API Token'})`,
12
12
  });
13
13
  }
14
- const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
15
- const url = `${baseUrl}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`;
14
+ const rawBaseUrl = credentials.baseUrl;
15
+ if (!rawBaseUrl) {
16
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
17
+ message: 'Base URL is missing in the selected Qlik Cloud credentials',
18
+ });
19
+ }
20
+ let parsedBase;
21
+ try {
22
+ parsedBase = new URL(rawBaseUrl);
23
+ }
24
+ catch {
25
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
26
+ message: 'Base URL is not a valid URL. Expected format: https://{tenant}.{region}.qlikcloud.com',
27
+ });
28
+ }
29
+ if (parsedBase.protocol !== 'https:') {
30
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), {
31
+ message: 'Base URL must use https://',
32
+ });
33
+ }
34
+ const normalizedBaseUrl = `${parsedBase.origin}${parsedBase.pathname.replace(/\/+$/, '')}`;
35
+ const url = new URL(endpoint.startsWith('/') ? endpoint : `/${endpoint}`, `${normalizedBaseUrl}/`).toString();
16
36
  const baseHeaders = {
17
37
  'Content-Type': 'application/json',
18
38
  ...(extraOptions.headers || {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-qlik-cloud",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "n8n node for Qlik Cloud REST APIs integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -5,7 +5,7 @@ const DEFAULT_SCOPES = ['openid', 'profile', 'email', 'offline_access'];
5
5
  export class QlikCloudOAuth2Api implements ICredentialType {
6
6
  name = 'qlikCloudOAuth2Api';
7
7
  displayName = 'Qlik Cloud OAuth2 API';
8
- documentationUrl = 'https://qlik.dev/authenticate/';
8
+ documentationUrl = 'https://qlik.dev/authenticate/oauth/';
9
9
  extends = ['oAuth2Api'];
10
10
 
11
11
  properties: INodeProperties[] = [
@@ -24,8 +24,30 @@ export async function qlikApiRequest(
24
24
  } as any);
25
25
  }
26
26
 
27
- const baseUrl = (credentials.baseUrl as string).replace(/\/+$/, '');
28
- const url = `${baseUrl}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`;
27
+ const rawBaseUrl = credentials.baseUrl as string | undefined;
28
+ if (!rawBaseUrl) {
29
+ throw new NodeApiError(this.getNode(), {
30
+ message: 'Base URL is missing in the selected Qlik Cloud credentials',
31
+ } as any);
32
+ }
33
+
34
+ let parsedBase: URL;
35
+ try {
36
+ parsedBase = new URL(rawBaseUrl);
37
+ } catch {
38
+ throw new NodeApiError(this.getNode(), {
39
+ message: 'Base URL is not a valid URL. Expected format: https://{tenant}.{region}.qlikcloud.com',
40
+ } as any);
41
+ }
42
+
43
+ if (parsedBase.protocol !== 'https:') {
44
+ throw new NodeApiError(this.getNode(), {
45
+ message: 'Base URL must use https://',
46
+ } as any);
47
+ }
48
+
49
+ const normalizedBaseUrl = `${parsedBase.origin}${parsedBase.pathname.replace(/\/+$/, '')}`;
50
+ const url = new URL(endpoint.startsWith('/') ? endpoint : `/${endpoint}`, `${normalizedBaseUrl}/`).toString();
29
51
 
30
52
  const baseHeaders = {
31
53
  'Content-Type': 'application/json',
@@ -56,7 +78,11 @@ export async function qlikApiRequest(
56
78
 
57
79
  try {
58
80
  if (authenticationMethod === 'oAuth2') {
59
- return await this.helpers.httpRequestWithAuthentication.call(this, credentialType, options);
81
+ return await this.helpers.httpRequestWithAuthentication.call(
82
+ this,
83
+ credentialType,
84
+ options,
85
+ );
60
86
  }
61
87
 
62
88
  return await this.helpers.httpRequest(options);