@bigid/apps-infrastructure-node-js 1.220.1 → 1.229.1
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/README.md +0 -3
- package/lib/services/actionsHubService.d.ts +2 -1
- package/lib/services/actionsHubService.js +4 -2
- package/lib/services/bigidProxyService.d.ts +1 -1
- package/lib/services/bigidProxyService.js +1 -1
- package/log/app.log +8 -8
- package/package.json +3 -3
- package/src/services/actionsHubService.ts +3 -0
- package/src/services/bigidProxyService.ts +38 -20
package/README.md
CHANGED
|
@@ -32,9 +32,6 @@ BIGID_REFRESH_TOKEN - refresh token that will be used to execute api calls
|
|
|
32
32
|
|
|
33
33
|
###Multi tenant mode
|
|
34
34
|
BIGID_BASE_URL - bigid url
|
|
35
|
-
|
|
36
35
|
AUTH0_DOMAIN - auth0 domain where the application configured - will be provided by BigID's application framework team
|
|
37
|
-
|
|
38
36
|
CLIENT_ID - client id of the application in auth0 - will be provided by BigID's application framework team
|
|
39
|
-
|
|
40
37
|
CLIENT_SECRET - client secret of the application - will be provided by BigID's application framework team
|
|
@@ -22,13 +22,14 @@ export declare const getCommandsRegistrations: (accessToken?: string) => Promise
|
|
|
22
22
|
*
|
|
23
23
|
* @param {string} actionName - the action name to be executed.
|
|
24
24
|
* @param {string} command - the command to be executed.
|
|
25
|
+
* @param {string} applicationName - the application name that the command to be triggered belongs to
|
|
25
26
|
* @param {string} requestorAppName - the app name of the execution requestor.
|
|
26
27
|
* @param {string} webhookEndpoint - the endpoint of the requestor app to receive execution status messages.
|
|
27
28
|
* @param {Record<string, any>} params - the relevant params of the action to be executed.
|
|
28
29
|
* @param {string} accessToken -- the access token from BigId.
|
|
29
30
|
* @return {Promise<string>} execution id of the executed action.
|
|
30
31
|
*/
|
|
31
|
-
export declare const executeCommand: (actionName: string, command: string, requestorAppName?: string, webhookEndpoint?: string, params?: Record<string, any>[], accessToken?: string) => Promise<string>;
|
|
32
|
+
export declare const executeCommand: (actionName: string, command: string, applicationName?: string, requestorAppName?: string, webhookEndpoint?: string, params?: Record<string, any>[], accessToken?: string) => Promise<string>;
|
|
32
33
|
/**
|
|
33
34
|
* use this method to poll an execution status from the action-center.
|
|
34
35
|
*
|
|
@@ -36,17 +36,19 @@ exports.getCommandsRegistrations = getCommandsRegistrations;
|
|
|
36
36
|
*
|
|
37
37
|
* @param {string} actionName - the action name to be executed.
|
|
38
38
|
* @param {string} command - the command to be executed.
|
|
39
|
+
* @param {string} applicationName - the application name that the command to be triggered belongs to
|
|
39
40
|
* @param {string} requestorAppName - the app name of the execution requestor.
|
|
40
41
|
* @param {string} webhookEndpoint - the endpoint of the requestor app to receive execution status messages.
|
|
41
42
|
* @param {Record<string, any>} params - the relevant params of the action to be executed.
|
|
42
43
|
* @param {string} accessToken -- the access token from BigId.
|
|
43
44
|
* @return {Promise<string>} execution id of the executed action.
|
|
44
45
|
*/
|
|
45
|
-
const executeCommand = (actionName, command, requestorAppName, webhookEndpoint, params, accessToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const executeCommand = (actionName, command, applicationName, requestorAppName, webhookEndpoint, params, accessToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
47
|
try {
|
|
47
48
|
const bigidToken = accessToken || (yield (0, tokenUtil_1.getBigidAccessToken)());
|
|
48
49
|
const { data: { executionId }, } = yield (0, bigidProxyService_1.doCallToUrl)(bigidToken, bigidProxyService_1.RequestMethod.POST, `${process.env.BIGID_BASE_URL}/api/v1/action-center/general-commands/execute`, Object.assign({ actionName,
|
|
49
|
-
command,
|
|
50
|
+
command,
|
|
51
|
+
applicationName, feedbackRequestorDetails: requestorAppName && webhookEndpoint
|
|
50
52
|
? {
|
|
51
53
|
requestorAppName,
|
|
52
54
|
requestorFeedbackEndpoint: webhookEndpoint,
|
|
@@ -38,7 +38,7 @@ export declare const executeHttpDelete: (executionContext: ExecutionContext, end
|
|
|
38
38
|
export declare const executePost: (requestMethod: RequestMethod, baseUrl: string | undefined, bodyJson: Record<string, any>, additionalHeaderFields?: Record<string, any>) => Promise<any>;
|
|
39
39
|
export declare const uploadAttachment: (executionContext: ExecutionContext, filePathToUpload: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
40
|
export declare const getAppStorage: (executionContext: ExecutionContext) => Promise<any>;
|
|
41
|
-
export declare const getValueFromAppStorage: (executionContext: ExecutionContext, key: string) => Promise<string>;
|
|
41
|
+
export declare const getValueFromAppStorage: (executionContext: ExecutionContext, key: string) => Promise<string | null>;
|
|
42
42
|
export declare const deleteKeyFromAppStorage: (executionContext: ExecutionContext, key: string) => Promise<void>;
|
|
43
43
|
export declare const sendBiEvent: (executionContext: ExecutionContext, eventType: string, data: Object) => Promise<any>;
|
|
44
44
|
export declare const saveInStorage: (executionContext: ExecutionContext, keyToStore: any, valueToStore: any) => Promise<void>;
|
|
@@ -74,7 +74,7 @@ function callBigIdApi(executionContext, requestMethod, endpoint, options) {
|
|
|
74
74
|
const updateActionStatusToBigID = (executionContext, actionResponseDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
75
|
return yield callBigIdApi(executionContext, RequestMethod.PUT, executionContext.updateResultCallback, {
|
|
76
76
|
bodyJson: actionResponseDetails,
|
|
77
|
-
useEndpointWithoutBigIdBasePath: true
|
|
77
|
+
useEndpointWithoutBigIdBasePath: true,
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
exports.updateActionStatusToBigID = updateActionStatusToBigID;
|
package/log/app.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[2025-
|
|
2
|
-
[2025-
|
|
3
|
-
[2025-
|
|
4
|
-
[2025-
|
|
5
|
-
[2025-
|
|
6
|
-
[2025-
|
|
7
|
-
[2025-
|
|
8
|
-
[2025-
|
|
1
|
+
[2025-05-25T08:22:45.856] [INFO] default - --> bigid-proxy::callBigIdApi: [get] endpoint: https://bigid-ui:9090/api/v1/id_connections
|
|
2
|
+
[2025-05-25T08:22:45.872] [INFO] default - <-- bigid-proxy::callBigIdApi: https://bigid-ui:9090/api/v1/id_connections success
|
|
3
|
+
[2025-05-25T08:22:45.876] [INFO] default - --> bigid-proxy::callBigIdApi: [post] endpoint: https://bigid-ui:9090/api/v1/id_connections
|
|
4
|
+
[2025-05-25T08:22:45.881] [INFO] default - <-- bigid-proxy::callBigIdApi: https://bigid-ui:9090/api/v1/id_connections success
|
|
5
|
+
[2025-05-25T08:22:45.883] [INFO] default - --> bigid-proxy::callBigIdApi: [put] endpoint: https://bigid-ui:9090/api/v1/id_connections
|
|
6
|
+
[2025-05-25T08:22:45.888] [INFO] default - <-- bigid-proxy::callBigIdApi: https://bigid-ui:9090/api/v1/id_connections success
|
|
7
|
+
[2025-05-25T08:22:45.889] [INFO] default - --> bigid-proxy::callBigIdApi: [delete] endpoint: https://bigid-ui:9090/api/v1/id_connections
|
|
8
|
+
[2025-05-25T08:22:45.893] [INFO] default - <-- bigid-proxy::callBigIdApi: https://bigid-ui:9090/api/v1/id_connections success
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigid/apps-infrastructure-node-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.229.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@types/jsonwebtoken": "^9.0.7",
|
|
39
|
-
"axios": "1.
|
|
39
|
+
"axios": "1.8.2",
|
|
40
40
|
"express": "4.21.0",
|
|
41
41
|
"follow-redirects": "1.15.6",
|
|
42
42
|
"form-data": "^4.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"jsonwebtoken": "^9.0.2",
|
|
45
45
|
"log4js": "^6.4.0",
|
|
46
46
|
"minimatch": "3.0.5",
|
|
47
|
-
"mocha": "
|
|
47
|
+
"mocha": "^11.0.0",
|
|
48
48
|
"node-schedule": "2.1.1",
|
|
49
49
|
"ts-node": "10.9.1"
|
|
50
50
|
}
|
|
@@ -42,6 +42,7 @@ export const getCommandsRegistrations = async (accessToken?: string): Promise<Co
|
|
|
42
42
|
*
|
|
43
43
|
* @param {string} actionName - the action name to be executed.
|
|
44
44
|
* @param {string} command - the command to be executed.
|
|
45
|
+
* @param {string} applicationName - the application name that the command to be triggered belongs to
|
|
45
46
|
* @param {string} requestorAppName - the app name of the execution requestor.
|
|
46
47
|
* @param {string} webhookEndpoint - the endpoint of the requestor app to receive execution status messages.
|
|
47
48
|
* @param {Record<string, any>} params - the relevant params of the action to be executed.
|
|
@@ -51,6 +52,7 @@ export const getCommandsRegistrations = async (accessToken?: string): Promise<Co
|
|
|
51
52
|
export const executeCommand = async (
|
|
52
53
|
actionName: string,
|
|
53
54
|
command: string,
|
|
55
|
+
applicationName?: string,
|
|
54
56
|
requestorAppName?: string,
|
|
55
57
|
webhookEndpoint?: string,
|
|
56
58
|
params?: Record<string, any>[],
|
|
@@ -67,6 +69,7 @@ export const executeCommand = async (
|
|
|
67
69
|
{
|
|
68
70
|
actionName,
|
|
69
71
|
command,
|
|
72
|
+
applicationName,
|
|
70
73
|
feedbackRequestorDetails:
|
|
71
74
|
requestorAppName && webhookEndpoint
|
|
72
75
|
? {
|
|
@@ -82,7 +82,13 @@ async function callBigIdApi(
|
|
|
82
82
|
options: BigIdApiRequestOptions,
|
|
83
83
|
) {
|
|
84
84
|
const url = options?.useEndpointWithoutBigIdBasePath ? endpoint : executionContext.bigidBaseUrl + endpoint;
|
|
85
|
-
return await doCallToUrl(
|
|
85
|
+
return await doCallToUrl(
|
|
86
|
+
executionContext.bigidToken,
|
|
87
|
+
requestMethod,
|
|
88
|
+
url,
|
|
89
|
+
options?.bodyJson,
|
|
90
|
+
options?.additionalHeaderFields,
|
|
91
|
+
);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
/**
|
|
@@ -95,15 +101,10 @@ export const updateActionStatusToBigID = async (
|
|
|
95
101
|
executionContext: ExecutionContext,
|
|
96
102
|
actionResponseDetails: ActionResponseDetails,
|
|
97
103
|
) =>
|
|
98
|
-
await callBigIdApi(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
bodyJson: actionResponseDetails,
|
|
104
|
-
useEndpointWithoutBigIdBasePath: true
|
|
105
|
-
}
|
|
106
|
-
);
|
|
104
|
+
await callBigIdApi(executionContext, RequestMethod.PUT, executionContext.updateResultCallback, {
|
|
105
|
+
bodyJson: actionResponseDetails,
|
|
106
|
+
useEndpointWithoutBigIdBasePath: true,
|
|
107
|
+
});
|
|
107
108
|
|
|
108
109
|
/**
|
|
109
110
|
*
|
|
@@ -111,32 +112,46 @@ export const updateActionStatusToBigID = async (
|
|
|
111
112
|
* @param endpoint - the endpoint in BigID, used for GET request. e.g - {BigIDBaseUrl}/ds_connections
|
|
112
113
|
* @return - String containing the response from BigID
|
|
113
114
|
*/
|
|
114
|
-
export const executeHttpGet = async (
|
|
115
|
-
|
|
115
|
+
export const executeHttpGet = async (
|
|
116
|
+
executionContext: ExecutionContext,
|
|
117
|
+
endpoint: string,
|
|
118
|
+
additionalHeaderFields?: Record<string, any>,
|
|
119
|
+
) => await callBigIdApi(executionContext, RequestMethod.GET, endpoint, { additionalHeaderFields });
|
|
116
120
|
|
|
117
121
|
/**
|
|
118
122
|
* the endpoint in BigID, used for POST requests. e.g - {BigIDBaseUrl}/scan
|
|
119
123
|
*/
|
|
120
|
-
export const executeHttpPost = async (
|
|
121
|
-
|
|
124
|
+
export const executeHttpPost = async (
|
|
125
|
+
executionContext: ExecutionContext,
|
|
126
|
+
endpoint: string,
|
|
127
|
+
obj: any,
|
|
128
|
+
additionalHeaderFields?: Record<string, any>,
|
|
129
|
+
) => await callBigIdApi(executionContext, RequestMethod.POST, endpoint, { bodyJson: obj, additionalHeaderFields });
|
|
122
130
|
|
|
123
131
|
/**
|
|
124
132
|
* the endpoint in BigID, used for POST requests. e.g - {BigIDBaseUrl}/scan
|
|
125
133
|
*/
|
|
126
|
-
export const executeHttpPut = async (
|
|
127
|
-
|
|
134
|
+
export const executeHttpPut = async (
|
|
135
|
+
executionContext: ExecutionContext,
|
|
136
|
+
endpoint: string,
|
|
137
|
+
obj: any,
|
|
138
|
+
additionalHeaderFields?: Record<string, any>,
|
|
139
|
+
) => await callBigIdApi(executionContext, RequestMethod.PUT, endpoint, { bodyJson: obj, additionalHeaderFields });
|
|
128
140
|
|
|
129
141
|
/**
|
|
130
142
|
* the endpoint in BigID, used for DELETE requests.
|
|
131
143
|
*/
|
|
132
|
-
export const executeHttpDelete = async (
|
|
133
|
-
|
|
144
|
+
export const executeHttpDelete = async (
|
|
145
|
+
executionContext: ExecutionContext,
|
|
146
|
+
endpoint: string,
|
|
147
|
+
additionalHeaderFields?: Record<string, any>,
|
|
148
|
+
) => await callBigIdApi(executionContext, RequestMethod.DELETE, endpoint, { additionalHeaderFields });
|
|
134
149
|
|
|
135
150
|
export const executePost = async (
|
|
136
151
|
requestMethod: RequestMethod,
|
|
137
152
|
baseUrl: string | undefined,
|
|
138
153
|
bodyJson: Record<string, any>,
|
|
139
|
-
additionalHeaderFields?: Record<string, any
|
|
154
|
+
additionalHeaderFields?: Record<string, any>,
|
|
140
155
|
) => {
|
|
141
156
|
try {
|
|
142
157
|
const url = baseUrl + 'api/v1/sessions';
|
|
@@ -188,7 +203,10 @@ export const uploadAttachment = (executionContext: ExecutionContext, filePathToU
|
|
|
188
203
|
export const getAppStorage = (executionContext: ExecutionContext) =>
|
|
189
204
|
executeHttpGet(executionContext, `tpa/${executionContext.tpaId}/storage`);
|
|
190
205
|
|
|
191
|
-
export const getValueFromAppStorage = async (
|
|
206
|
+
export const getValueFromAppStorage = async (
|
|
207
|
+
executionContext: ExecutionContext,
|
|
208
|
+
key: string,
|
|
209
|
+
): Promise<string | null> => {
|
|
192
210
|
const { data } = await executeHttpGet(executionContext, `tpa/${executionContext.tpaId}/storage/key/${key}`);
|
|
193
211
|
return data === 'Key not found' ? null : data?.value;
|
|
194
212
|
};
|