quidproquo-actionprocessor-node 0.0.254 → 0.0.255
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/lib/commonjs/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.js +74 -64
- package/lib/commonjs/actionProcessor/core/claudeAi/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/claudeAi/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.js +30 -30
- package/lib/commonjs/actionProcessor/core/config/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/config/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/context/getContextListActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/context/getContextListActionProcessor.js +24 -24
- package/lib/commonjs/actionProcessor/core/context/getContextReadActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/context/getContextReadActionProcessor.js +27 -27
- package/lib/commonjs/actionProcessor/core/context/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/context/index.js +18 -18
- package/lib/commonjs/actionProcessor/core/customActions/getCustomActionActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/customActions/getCustomActionActionProcessor.js +58 -58
- package/lib/commonjs/actionProcessor/core/customActions/index.d.ts +1 -1
- package/lib/commonjs/actionProcessor/core/customActions/index.js +18 -18
- package/lib/commonjs/actionProcessor/core/date/getDateNowActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/date/getDateNowActionProcessor.js +24 -24
- package/lib/commonjs/actionProcessor/core/date/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/date/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/error/getErrorThrowErrorActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/error/getErrorThrowErrorActionProcessor.js +24 -24
- package/lib/commonjs/actionProcessor/core/error/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/error/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewActionProcessor.js +25 -25
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewSortableActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewSortableActionProcessor.js +25 -25
- package/lib/commonjs/actionProcessor/core/guid/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/guid/index.js +18 -18
- package/lib/commonjs/actionProcessor/core/index.d.ts +14 -14
- package/lib/commonjs/actionProcessor/core/index.js +54 -54
- package/lib/commonjs/actionProcessor/core/log/getLogCreateActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/log/getLogCreateActionProcessor.js +30 -30
- package/lib/commonjs/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.js +25 -25
- package/lib/commonjs/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.js +26 -26
- package/lib/commonjs/actionProcessor/core/log/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/log/index.js +19 -19
- package/lib/commonjs/actionProcessor/core/math/getMathRandomNumberActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/math/getMathRandomNumberActionProcessor.js +24 -24
- package/lib/commonjs/actionProcessor/core/math/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/math/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/network/getNetworkRequestActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/network/getNetworkRequestActionProcessor.js +150 -150
- package/lib/commonjs/actionProcessor/core/network/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/network/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/platform/getPlatformDelayActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/platform/getPlatformDelayActionProcessor.js +24 -24
- package/lib/commonjs/actionProcessor/core/platform/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/platform/index.js +17 -17
- package/lib/commonjs/actionProcessor/core/system/getSystemBatchActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/system/getSystemBatchActionProcessor.js +51 -51
- package/lib/commonjs/actionProcessor/core/system/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/core/system/index.js +17 -17
- package/lib/commonjs/actionProcessor/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/index.js +18 -18
- package/lib/commonjs/actionProcessor/webserver/dns/getDnsListActionProcessor.d.ts +2 -2
- package/lib/commonjs/actionProcessor/webserver/dns/getDnsListActionProcessor.js +26 -26
- package/lib/commonjs/actionProcessor/webserver/dns/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/webserver/dns/index.js +17 -17
- package/lib/commonjs/actionProcessor/webserver/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/webserver/index.js +17 -17
- package/lib/commonjs/index.d.ts +1 -1
- package/lib/commonjs/index.js +17 -17
- package/lib/esm/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.js +26 -26
- package/lib/esm/actionProcessor/core/claudeAi/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/claudeAi/index.js +4 -4
- package/lib/esm/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.js +15 -15
- package/lib/esm/actionProcessor/core/config/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/config/index.js +4 -4
- package/lib/esm/actionProcessor/core/context/getContextListActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/context/getContextListActionProcessor.js +9 -9
- package/lib/esm/actionProcessor/core/context/getContextReadActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/context/getContextReadActionProcessor.js +12 -12
- package/lib/esm/actionProcessor/core/context/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/context/index.js +6 -6
- package/lib/esm/actionProcessor/core/customActions/getCustomActionActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/customActions/getCustomActionActionProcessor.js +43 -43
- package/lib/esm/actionProcessor/core/customActions/index.d.ts +1 -1
- package/lib/esm/actionProcessor/core/customActions/index.js +2 -2
- package/lib/esm/actionProcessor/core/date/getDateNowActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/date/getDateNowActionProcessor.js +9 -9
- package/lib/esm/actionProcessor/core/date/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/date/index.js +4 -4
- package/lib/esm/actionProcessor/core/error/getErrorThrowErrorActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/error/getErrorThrowErrorActionProcessor.js +9 -9
- package/lib/esm/actionProcessor/core/error/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/error/index.js +4 -4
- package/lib/esm/actionProcessor/core/guid/getGuidNewActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/guid/getGuidNewActionProcessor.js +10 -10
- package/lib/esm/actionProcessor/core/guid/getGuidNewSortableActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/guid/getGuidNewSortableActionProcessor.js +10 -10
- package/lib/esm/actionProcessor/core/guid/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/guid/index.js +6 -6
- package/lib/esm/actionProcessor/core/index.d.ts +14 -14
- package/lib/esm/actionProcessor/core/index.js +37 -37
- package/lib/esm/actionProcessor/core/log/getLogCreateActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/log/getLogCreateActionProcessor.js +15 -15
- package/lib/esm/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.js +10 -10
- package/lib/esm/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.js +11 -11
- package/lib/esm/actionProcessor/core/log/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/log/index.js +8 -8
- package/lib/esm/actionProcessor/core/math/getMathRandomNumberActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/math/getMathRandomNumberActionProcessor.js +9 -9
- package/lib/esm/actionProcessor/core/math/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/math/index.js +4 -4
- package/lib/esm/actionProcessor/core/network/getNetworkRequestActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/network/getNetworkRequestActionProcessor.js +134 -134
- package/lib/esm/actionProcessor/core/network/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/network/index.js +4 -4
- package/lib/esm/actionProcessor/core/platform/getPlatformDelayActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/platform/getPlatformDelayActionProcessor.js +9 -9
- package/lib/esm/actionProcessor/core/platform/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/platform/index.js +4 -4
- package/lib/esm/actionProcessor/core/system/getSystemBatchActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/core/system/getSystemBatchActionProcessor.js +36 -36
- package/lib/esm/actionProcessor/core/system/index.d.ts +2 -2
- package/lib/esm/actionProcessor/core/system/index.js +4 -4
- package/lib/esm/actionProcessor/index.d.ts +2 -2
- package/lib/esm/actionProcessor/index.js +2 -2
- package/lib/esm/actionProcessor/webserver/dns/getDnsListActionProcessor.d.ts +2 -2
- package/lib/esm/actionProcessor/webserver/dns/getDnsListActionProcessor.js +11 -11
- package/lib/esm/actionProcessor/webserver/dns/index.d.ts +2 -2
- package/lib/esm/actionProcessor/webserver/dns/index.js +4 -4
- package/lib/esm/actionProcessor/webserver/index.d.ts +2 -2
- package/lib/esm/actionProcessor/webserver/index.js +4 -4
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/package.json +5 -5
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
import { actionResult, actionResultError, ErrorTypeEnum, NetworkActionType, } from 'quidproquo-core';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import { extension } from 'mime-types';
|
|
4
|
-
const getAxiosResponseType = (responseType) => {
|
|
5
|
-
if (responseType === 'binary') {
|
|
6
|
-
return 'arraybuffer';
|
|
7
|
-
}
|
|
8
|
-
return 'json';
|
|
9
|
-
};
|
|
10
|
-
const transformResponse = (payload, response) => {
|
|
11
|
-
if (payload.responseType === 'binary') {
|
|
12
|
-
const headers = response.headers || {};
|
|
13
|
-
const mimeType = headers['content-type'] || 'application/octet-stream';
|
|
14
|
-
const filename = headers['content-disposition']?.match(/filename="([^"]+)"/)?.[1] || `file.${extension(mimeType)}`;
|
|
15
|
-
return {
|
|
16
|
-
...response,
|
|
17
|
-
data: {
|
|
18
|
-
base64Data: Buffer.from(response.data).toString('base64'),
|
|
19
|
-
mimetype: mimeType,
|
|
20
|
-
filename,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return response;
|
|
25
|
-
};
|
|
26
|
-
const axiosInstance = axios.create({
|
|
27
|
-
timeout: 25000,
|
|
28
|
-
headers: {
|
|
29
|
-
// Fixes: https://github.com/axios/axios/issues/5346
|
|
30
|
-
'Accept-Encoding': 'gzip,deflate,compress',
|
|
31
|
-
},
|
|
32
|
-
validateStatus: () => true,
|
|
33
|
-
});
|
|
34
|
-
const processNetworkRequestGet = async (payload) => {
|
|
35
|
-
const response = await axiosInstance.get(payload.url, {
|
|
36
|
-
baseURL: payload.basePath,
|
|
37
|
-
headers: payload.headers,
|
|
38
|
-
params: payload.params,
|
|
39
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
40
|
-
});
|
|
41
|
-
return transformResponse(payload, response);
|
|
42
|
-
};
|
|
43
|
-
const processNetworkRequestPost = async (payload) => {
|
|
44
|
-
const response = await axiosInstance.post(payload.url, payload.body, {
|
|
45
|
-
baseURL: payload.basePath,
|
|
46
|
-
headers: payload.headers,
|
|
47
|
-
params: payload.params,
|
|
48
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
49
|
-
});
|
|
50
|
-
return transformResponse(payload, response);
|
|
51
|
-
};
|
|
52
|
-
const processNetworkRequestDelete = async (payload) => {
|
|
53
|
-
const response = await axiosInstance.delete(payload.url, {
|
|
54
|
-
baseURL: payload.basePath,
|
|
55
|
-
headers: payload.headers,
|
|
56
|
-
params: payload.params,
|
|
57
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
58
|
-
});
|
|
59
|
-
return transformResponse(payload, response);
|
|
60
|
-
};
|
|
61
|
-
const processNetworkRequestHead = async (payload) => {
|
|
62
|
-
const response = await axiosInstance.head(payload.url, {
|
|
63
|
-
baseURL: payload.basePath,
|
|
64
|
-
headers: payload.headers,
|
|
65
|
-
params: payload.params,
|
|
66
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
67
|
-
});
|
|
68
|
-
return transformResponse(payload, response);
|
|
69
|
-
};
|
|
70
|
-
const processNetworkRequestOptions = async (payload) => {
|
|
71
|
-
const response = await axiosInstance.options(payload.url, {
|
|
72
|
-
baseURL: payload.basePath,
|
|
73
|
-
headers: payload.headers,
|
|
74
|
-
params: payload.params,
|
|
75
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
76
|
-
});
|
|
77
|
-
return transformResponse(payload, response);
|
|
78
|
-
};
|
|
79
|
-
const processNetworkRequestPut = async (payload) => {
|
|
80
|
-
const response = await axiosInstance.put(payload.url, payload.body, {
|
|
81
|
-
baseURL: payload.basePath,
|
|
82
|
-
headers: payload.headers,
|
|
83
|
-
params: payload.params,
|
|
84
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
85
|
-
});
|
|
86
|
-
return transformResponse(payload, response);
|
|
87
|
-
};
|
|
88
|
-
const processNetworkRequestPatch = async (payload) => {
|
|
89
|
-
const response = await axiosInstance.patch(payload.url, payload.body, {
|
|
90
|
-
baseURL: payload.basePath,
|
|
91
|
-
headers: payload.headers,
|
|
92
|
-
params: payload.params,
|
|
93
|
-
responseType: getAxiosResponseType(payload.responseType),
|
|
94
|
-
});
|
|
95
|
-
return transformResponse(payload, response);
|
|
96
|
-
};
|
|
97
|
-
const processNetworkRequestConnect = async (payload) => {
|
|
98
|
-
throw new Error('Function not implemented.');
|
|
99
|
-
};
|
|
100
|
-
const requestMethodMap = {
|
|
101
|
-
GET: processNetworkRequestGet,
|
|
102
|
-
POST: processNetworkRequestPost,
|
|
103
|
-
DELETE: processNetworkRequestDelete,
|
|
104
|
-
HEAD: processNetworkRequestHead,
|
|
105
|
-
OPTIONS: processNetworkRequestOptions,
|
|
106
|
-
PUT: processNetworkRequestPut,
|
|
107
|
-
PATCH: processNetworkRequestPatch,
|
|
108
|
-
CONNECT: processNetworkRequestConnect,
|
|
109
|
-
};
|
|
110
|
-
const getProcessNetworkRequest = (qpqConfig) => {
|
|
111
|
-
return async (payload) => {
|
|
112
|
-
const requestMethod = requestMethodMap[payload.method];
|
|
113
|
-
if (!requestMethod) {
|
|
114
|
-
return actionResultError(ErrorTypeEnum.NotImplemented, `${payload.method}: Not implemented`);
|
|
115
|
-
}
|
|
116
|
-
console.log(payload.url);
|
|
117
|
-
try {
|
|
118
|
-
const response = await requestMethod(payload);
|
|
119
|
-
return actionResult({
|
|
120
|
-
headers: response.headers,
|
|
121
|
-
status: response.status,
|
|
122
|
-
statusText: response.statusText,
|
|
123
|
-
data: response.data,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
console.log(err);
|
|
128
|
-
return actionResultError(ErrorTypeEnum.GenericError, err.stack);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
export const getNetworkRequestActionProcessor = async (qpqConfig) => ({
|
|
133
|
-
[NetworkActionType.Request]: getProcessNetworkRequest(qpqConfig),
|
|
134
|
-
});
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, NetworkActionType, } from 'quidproquo-core';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { extension } from 'mime-types';
|
|
4
|
+
const getAxiosResponseType = (responseType) => {
|
|
5
|
+
if (responseType === 'binary') {
|
|
6
|
+
return 'arraybuffer';
|
|
7
|
+
}
|
|
8
|
+
return 'json';
|
|
9
|
+
};
|
|
10
|
+
const transformResponse = (payload, response) => {
|
|
11
|
+
if (payload.responseType === 'binary') {
|
|
12
|
+
const headers = response.headers || {};
|
|
13
|
+
const mimeType = headers['content-type'] || 'application/octet-stream';
|
|
14
|
+
const filename = headers['content-disposition']?.match(/filename="([^"]+)"/)?.[1] || `file.${extension(mimeType)}`;
|
|
15
|
+
return {
|
|
16
|
+
...response,
|
|
17
|
+
data: {
|
|
18
|
+
base64Data: Buffer.from(response.data).toString('base64'),
|
|
19
|
+
mimetype: mimeType,
|
|
20
|
+
filename,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return response;
|
|
25
|
+
};
|
|
26
|
+
const axiosInstance = axios.create({
|
|
27
|
+
timeout: 25000,
|
|
28
|
+
headers: {
|
|
29
|
+
// Fixes: https://github.com/axios/axios/issues/5346
|
|
30
|
+
'Accept-Encoding': 'gzip,deflate,compress',
|
|
31
|
+
},
|
|
32
|
+
validateStatus: () => true,
|
|
33
|
+
});
|
|
34
|
+
const processNetworkRequestGet = async (payload) => {
|
|
35
|
+
const response = await axiosInstance.get(payload.url, {
|
|
36
|
+
baseURL: payload.basePath,
|
|
37
|
+
headers: payload.headers,
|
|
38
|
+
params: payload.params,
|
|
39
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
40
|
+
});
|
|
41
|
+
return transformResponse(payload, response);
|
|
42
|
+
};
|
|
43
|
+
const processNetworkRequestPost = async (payload) => {
|
|
44
|
+
const response = await axiosInstance.post(payload.url, payload.body, {
|
|
45
|
+
baseURL: payload.basePath,
|
|
46
|
+
headers: payload.headers,
|
|
47
|
+
params: payload.params,
|
|
48
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
49
|
+
});
|
|
50
|
+
return transformResponse(payload, response);
|
|
51
|
+
};
|
|
52
|
+
const processNetworkRequestDelete = async (payload) => {
|
|
53
|
+
const response = await axiosInstance.delete(payload.url, {
|
|
54
|
+
baseURL: payload.basePath,
|
|
55
|
+
headers: payload.headers,
|
|
56
|
+
params: payload.params,
|
|
57
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
58
|
+
});
|
|
59
|
+
return transformResponse(payload, response);
|
|
60
|
+
};
|
|
61
|
+
const processNetworkRequestHead = async (payload) => {
|
|
62
|
+
const response = await axiosInstance.head(payload.url, {
|
|
63
|
+
baseURL: payload.basePath,
|
|
64
|
+
headers: payload.headers,
|
|
65
|
+
params: payload.params,
|
|
66
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
67
|
+
});
|
|
68
|
+
return transformResponse(payload, response);
|
|
69
|
+
};
|
|
70
|
+
const processNetworkRequestOptions = async (payload) => {
|
|
71
|
+
const response = await axiosInstance.options(payload.url, {
|
|
72
|
+
baseURL: payload.basePath,
|
|
73
|
+
headers: payload.headers,
|
|
74
|
+
params: payload.params,
|
|
75
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
76
|
+
});
|
|
77
|
+
return transformResponse(payload, response);
|
|
78
|
+
};
|
|
79
|
+
const processNetworkRequestPut = async (payload) => {
|
|
80
|
+
const response = await axiosInstance.put(payload.url, payload.body, {
|
|
81
|
+
baseURL: payload.basePath,
|
|
82
|
+
headers: payload.headers,
|
|
83
|
+
params: payload.params,
|
|
84
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
85
|
+
});
|
|
86
|
+
return transformResponse(payload, response);
|
|
87
|
+
};
|
|
88
|
+
const processNetworkRequestPatch = async (payload) => {
|
|
89
|
+
const response = await axiosInstance.patch(payload.url, payload.body, {
|
|
90
|
+
baseURL: payload.basePath,
|
|
91
|
+
headers: payload.headers,
|
|
92
|
+
params: payload.params,
|
|
93
|
+
responseType: getAxiosResponseType(payload.responseType),
|
|
94
|
+
});
|
|
95
|
+
return transformResponse(payload, response);
|
|
96
|
+
};
|
|
97
|
+
const processNetworkRequestConnect = async (payload) => {
|
|
98
|
+
throw new Error('Function not implemented.');
|
|
99
|
+
};
|
|
100
|
+
const requestMethodMap = {
|
|
101
|
+
GET: processNetworkRequestGet,
|
|
102
|
+
POST: processNetworkRequestPost,
|
|
103
|
+
DELETE: processNetworkRequestDelete,
|
|
104
|
+
HEAD: processNetworkRequestHead,
|
|
105
|
+
OPTIONS: processNetworkRequestOptions,
|
|
106
|
+
PUT: processNetworkRequestPut,
|
|
107
|
+
PATCH: processNetworkRequestPatch,
|
|
108
|
+
CONNECT: processNetworkRequestConnect,
|
|
109
|
+
};
|
|
110
|
+
const getProcessNetworkRequest = (qpqConfig) => {
|
|
111
|
+
return async (payload) => {
|
|
112
|
+
const requestMethod = requestMethodMap[payload.method];
|
|
113
|
+
if (!requestMethod) {
|
|
114
|
+
return actionResultError(ErrorTypeEnum.NotImplemented, `${payload.method}: Not implemented`);
|
|
115
|
+
}
|
|
116
|
+
console.log(payload.url);
|
|
117
|
+
try {
|
|
118
|
+
const response = await requestMethod(payload);
|
|
119
|
+
return actionResult({
|
|
120
|
+
headers: response.headers,
|
|
121
|
+
status: response.status,
|
|
122
|
+
statusText: response.statusText,
|
|
123
|
+
data: response.data,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
console.log(err);
|
|
128
|
+
return actionResultError(ErrorTypeEnum.GenericError, err.stack);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export const getNetworkRequestActionProcessor = async (qpqConfig) => ({
|
|
133
|
+
[NetworkActionType.Request]: getProcessNetworkRequest(qpqConfig),
|
|
134
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getNetworkActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getNetworkActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNetworkRequestActionProcessor } from './getNetworkRequestActionProcessor';
|
|
2
|
-
export const getNetworkActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
-
...(await getNetworkRequestActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
-
});
|
|
1
|
+
import { getNetworkRequestActionProcessor } from './getNetworkRequestActionProcessor';
|
|
2
|
+
export const getNetworkActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
+
...(await getNetworkRequestActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getPlatformDelayActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getPlatformDelayActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { actionResult, PlatformActionType, } from 'quidproquo-core';
|
|
2
|
-
const getProcessPlatformDelay = (qpqConfig) => {
|
|
3
|
-
return async ({ timeMs }) => {
|
|
4
|
-
return new Promise((resolve) => setTimeout(() => resolve(actionResult(undefined)), timeMs));
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
export const getPlatformDelayActionProcessor = async (qpqConfig) => ({
|
|
8
|
-
[PlatformActionType.Delay]: getProcessPlatformDelay(qpqConfig),
|
|
9
|
-
});
|
|
1
|
+
import { actionResult, PlatformActionType, } from 'quidproquo-core';
|
|
2
|
+
const getProcessPlatformDelay = (qpqConfig) => {
|
|
3
|
+
return async ({ timeMs }) => {
|
|
4
|
+
return new Promise((resolve) => setTimeout(() => resolve(actionResult(undefined)), timeMs));
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export const getPlatformDelayActionProcessor = async (qpqConfig) => ({
|
|
8
|
+
[PlatformActionType.Delay]: getProcessPlatformDelay(qpqConfig),
|
|
9
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getPlatformActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getPlatformActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPlatformDelayActionProcessor } from './getPlatformDelayActionProcessor';
|
|
2
|
-
export const getPlatformActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
-
...(await getPlatformDelayActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
-
});
|
|
1
|
+
import { getPlatformDelayActionProcessor } from './getPlatformDelayActionProcessor';
|
|
2
|
+
export const getPlatformActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
+
...(await getPlatformDelayActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getSystemBatchActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getSystemBatchActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { actionResult, actionResultError, isErroredActionResult, processAction, resolveActionResult, resolveActionResultError, SystemActionType, } from 'quidproquo-core';
|
|
2
|
-
const getProcessSystemBatch = (qpqConfig) => {
|
|
3
|
-
return async (payload, session, actionProcessors, logger, updateSession, dynamicModuleLoader) => {
|
|
4
|
-
// console.log('~~~~~~~~~~~ RUNNING BATCH ~~~~~~~~~: ', payload);
|
|
5
|
-
const batchRes = await Promise.all(payload.actions.map((a) => processAction(a, actionProcessors, session, logger, updateSession, dynamicModuleLoader)));
|
|
6
|
-
// console.log('~~~~~~~~~~~ RESULT BATCH ~~~~~~~~~: ', batchRes);
|
|
7
|
-
// If there was an error, that does not want to be returned, throw that error back
|
|
8
|
-
const erroredBatchItem = batchRes.find((br, i) => isErroredActionResult(br) && !payload.actions[i].returnErrors);
|
|
9
|
-
if (erroredBatchItem) {
|
|
10
|
-
const error = resolveActionResultError(erroredBatchItem);
|
|
11
|
-
return actionResultError(error.errorType, error.errorText, error.errorStack);
|
|
12
|
-
}
|
|
13
|
-
// unwrap the values
|
|
14
|
-
return actionResult(batchRes.map((br, i) => {
|
|
15
|
-
// If we want to return errors, return the either result.
|
|
16
|
-
if (payload.actions[i].returnErrors) {
|
|
17
|
-
const isSuccess = !isErroredActionResult(br);
|
|
18
|
-
const result = isSuccess
|
|
19
|
-
? {
|
|
20
|
-
success: true,
|
|
21
|
-
result: resolveActionResult(br),
|
|
22
|
-
}
|
|
23
|
-
: {
|
|
24
|
-
success: false,
|
|
25
|
-
error: resolveActionResultError(br),
|
|
26
|
-
};
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
// return the resolved result
|
|
30
|
-
return resolveActionResult(br);
|
|
31
|
-
}));
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export const getSystemBatchActionProcessor = async (qpqConfig) => ({
|
|
35
|
-
[SystemActionType.Batch]: getProcessSystemBatch(qpqConfig),
|
|
36
|
-
});
|
|
1
|
+
import { actionResult, actionResultError, isErroredActionResult, processAction, resolveActionResult, resolveActionResultError, SystemActionType, } from 'quidproquo-core';
|
|
2
|
+
const getProcessSystemBatch = (qpqConfig) => {
|
|
3
|
+
return async (payload, session, actionProcessors, logger, updateSession, dynamicModuleLoader) => {
|
|
4
|
+
// console.log('~~~~~~~~~~~ RUNNING BATCH ~~~~~~~~~: ', payload);
|
|
5
|
+
const batchRes = await Promise.all(payload.actions.map((a) => processAction(a, actionProcessors, session, logger, updateSession, dynamicModuleLoader)));
|
|
6
|
+
// console.log('~~~~~~~~~~~ RESULT BATCH ~~~~~~~~~: ', batchRes);
|
|
7
|
+
// If there was an error, that does not want to be returned, throw that error back
|
|
8
|
+
const erroredBatchItem = batchRes.find((br, i) => isErroredActionResult(br) && !payload.actions[i].returnErrors);
|
|
9
|
+
if (erroredBatchItem) {
|
|
10
|
+
const error = resolveActionResultError(erroredBatchItem);
|
|
11
|
+
return actionResultError(error.errorType, error.errorText, error.errorStack);
|
|
12
|
+
}
|
|
13
|
+
// unwrap the values
|
|
14
|
+
return actionResult(batchRes.map((br, i) => {
|
|
15
|
+
// If we want to return errors, return the either result.
|
|
16
|
+
if (payload.actions[i].returnErrors) {
|
|
17
|
+
const isSuccess = !isErroredActionResult(br);
|
|
18
|
+
const result = isSuccess
|
|
19
|
+
? {
|
|
20
|
+
success: true,
|
|
21
|
+
result: resolveActionResult(br),
|
|
22
|
+
}
|
|
23
|
+
: {
|
|
24
|
+
success: false,
|
|
25
|
+
error: resolveActionResultError(br),
|
|
26
|
+
};
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
// return the resolved result
|
|
30
|
+
return resolveActionResult(br);
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export const getSystemBatchActionProcessor = async (qpqConfig) => ({
|
|
35
|
+
[SystemActionType.Batch]: getProcessSystemBatch(qpqConfig),
|
|
36
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getSystemActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getSystemActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSystemBatchActionProcessor } from './getSystemBatchActionProcessor';
|
|
2
|
-
export const getSystemActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
-
...(await getSystemBatchActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
-
});
|
|
1
|
+
import { getSystemBatchActionProcessor } from './getSystemBatchActionProcessor';
|
|
2
|
+
export const getSystemActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
+
...(await getSystemBatchActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './core';
|
|
2
|
-
export * from './webserver';
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './webserver';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './core';
|
|
2
|
-
export * from './webserver';
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './webserver';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getDnsListActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getDnsListActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { actionResult } from 'quidproquo-core';
|
|
2
|
-
import { DnsActionType, qpqWebServerUtils } from 'quidproquo-webserver';
|
|
3
|
-
const getProcessDnsList = (qpqConfig) => {
|
|
4
|
-
return async () => {
|
|
5
|
-
const dnsList = qpqWebServerUtils.getDnsConfigs(qpqConfig).map((dc) => dc.dnsBase);
|
|
6
|
-
return actionResult(dnsList);
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export const getDnsListActionProcessor = async (qpqConfig) => ({
|
|
10
|
-
[DnsActionType.List]: getProcessDnsList(qpqConfig),
|
|
11
|
-
});
|
|
1
|
+
import { actionResult } from 'quidproquo-core';
|
|
2
|
+
import { DnsActionType, qpqWebServerUtils } from 'quidproquo-webserver';
|
|
3
|
+
const getProcessDnsList = (qpqConfig) => {
|
|
4
|
+
return async () => {
|
|
5
|
+
const dnsList = qpqWebServerUtils.getDnsConfigs(qpqConfig).map((dc) => dc.dnsBase);
|
|
6
|
+
return actionResult(dnsList);
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export const getDnsListActionProcessor = async (qpqConfig) => ({
|
|
10
|
+
[DnsActionType.List]: getProcessDnsList(qpqConfig),
|
|
11
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getDnsActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getDnsActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDnsListActionProcessor } from './getDnsListActionProcessor';
|
|
2
|
-
export const getDnsActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
-
...(await getDnsListActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
-
});
|
|
1
|
+
import { getDnsListActionProcessor } from './getDnsListActionProcessor';
|
|
2
|
+
export const getDnsActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
+
...(await getDnsListActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export declare const getWebserverActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getWebserverActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDnsActionProcessor } from './dns';
|
|
2
|
-
export const getWebserverActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
-
...(await getDnsActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
-
});
|
|
1
|
+
import { getDnsActionProcessor } from './dns';
|
|
2
|
+
export const getWebserverActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
+
...(await getDnsActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
|
+
});
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './actionProcessor';
|
|
1
|
+
export * from './actionProcessor';
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './actionProcessor';
|
|
1
|
+
export * from './actionProcessor';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.255",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"@anthropic-ai/sdk": "^0.19.1",
|
|
36
36
|
"axios": "^1.2.1",
|
|
37
37
|
"mime-types": "^2.1.35",
|
|
38
|
-
"quidproquo-core": "0.0.
|
|
39
|
-
"quidproquo-webserver": "0.0.
|
|
38
|
+
"quidproquo-core": "0.0.255",
|
|
39
|
+
"quidproquo-webserver": "0.0.255",
|
|
40
40
|
"uuid": "^9.0.0",
|
|
41
41
|
"uuidv7": "^1.0.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/mime-types": "^2.1.1",
|
|
45
45
|
"@types/uuid": "^9.0.0",
|
|
46
|
-
"quidproquo-tsconfig": "0.0.
|
|
47
|
-
"typescript": "^
|
|
46
|
+
"quidproquo-tsconfig": "0.0.255",
|
|
47
|
+
"typescript": "^5.8.2"
|
|
48
48
|
}
|
|
49
49
|
}
|