@couleetech/n8n-nodes-enlightenedmsp 1.2.5 → 1.2.6
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.
@@ -26,12 +26,21 @@ class EnlightenedMspGraphql {
|
|
26
26
|
required: true,
|
27
27
|
description: 'The API key for authentication',
|
28
28
|
},
|
29
|
+
{
|
30
|
+
displayName: 'User ID',
|
31
|
+
name: 'userId',
|
32
|
+
type: 'string',
|
33
|
+
default: '',
|
34
|
+
required: false,
|
35
|
+
description: 'Optional user ID for request authentication',
|
36
|
+
},
|
29
37
|
];
|
30
38
|
this.authenticate = {
|
31
39
|
type: 'generic',
|
32
40
|
properties: {
|
33
41
|
headers: {
|
34
42
|
'x-api-key': '={{$credentials.apiKey}}',
|
43
|
+
'x-api-user': '={{$credentials.userId}}',
|
35
44
|
},
|
36
45
|
},
|
37
46
|
};
|
@@ -3,11 +3,13 @@ import { AxiosInstance } from 'axios';
|
|
3
3
|
export declare abstract class GraphqlBase {
|
4
4
|
protected readonly endpoint: string;
|
5
5
|
protected readonly apiKey: string;
|
6
|
+
protected readonly userId?: string | undefined;
|
6
7
|
protected client: AxiosInstance;
|
7
|
-
constructor(endpoint: string, apiKey: string);
|
8
|
+
constructor(endpoint: string, apiKey: string, userId?: string | undefined);
|
8
9
|
protected executeGraphql(query: string, variables: Record<string, unknown>): Promise<any>;
|
9
10
|
static getCredentials(executeFunctions: IExecuteFunctions): Promise<{
|
10
11
|
endpoint: string;
|
11
12
|
apiKey: string;
|
13
|
+
userId?: string;
|
12
14
|
}>;
|
13
15
|
}
|
@@ -6,15 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GraphqlBase = void 0;
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
8
8
|
class GraphqlBase {
|
9
|
-
constructor(endpoint, apiKey) {
|
9
|
+
constructor(endpoint, apiKey, userId) {
|
10
10
|
this.endpoint = endpoint;
|
11
11
|
this.apiKey = apiKey;
|
12
|
+
this.userId = userId;
|
13
|
+
const headers = {
|
14
|
+
'Content-Type': 'application/json',
|
15
|
+
'x-api-key': apiKey,
|
16
|
+
};
|
17
|
+
if (userId) {
|
18
|
+
headers['x-api-user'] = userId;
|
19
|
+
}
|
12
20
|
this.client = axios_1.default.create({
|
13
21
|
baseURL: endpoint,
|
14
|
-
headers
|
15
|
-
'Content-Type': 'application/json',
|
16
|
-
'x-api-key': apiKey,
|
17
|
-
},
|
22
|
+
headers,
|
18
23
|
});
|
19
24
|
}
|
20
25
|
async executeGraphql(query, variables) {
|
@@ -44,6 +49,7 @@ class GraphqlBase {
|
|
44
49
|
return {
|
45
50
|
endpoint: credentials.endpoint,
|
46
51
|
apiKey: credentials.apiKey,
|
52
|
+
userId: credentials.userId,
|
47
53
|
};
|
48
54
|
}
|
49
55
|
}
|