quidproquo-actionprocessor-node 0.0.262 → 0.1.0
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/index.d.ts +2 -12
- package/lib/commonjs/actionProcessor/core/index.js +10 -25
- package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js +47 -0
- package/lib/commonjs/actionProcessor/core/{network/getNetworkRequestActionProcessor.d.ts → inlineFunction/index.d.ts} +1 -1
- package/lib/commonjs/actionProcessor/core/{error → inlineFunction}/index.js +5 -5
- package/lib/commonjs/actionProcessor/core/{context/getContextReadActionProcessor.d.ts → stream/getStreamCloseActionProcessor.d.ts} +1 -1
- package/lib/commonjs/actionProcessor/core/{context/getContextReadActionProcessor.js → stream/getStreamCloseActionProcessor.js} +8 -10
- package/lib/commonjs/actionProcessor/core/stream/getStreamReadActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/{math/getMathRandomNumberActionProcessor.js → stream/getStreamReadActionProcessor.js} +8 -7
- package/lib/commonjs/actionProcessor/core/{system → stream}/index.d.ts +1 -1
- package/lib/commonjs/actionProcessor/core/{system → stream}/index.js +6 -5
- package/lib/commonjs/actionProcessor/webserver/index.js +4 -2
- package/lib/commonjs/dynamicActionProcessor/file/getFileDeleteActionProcessor.js +7 -4
- package/lib/commonjs/dynamicActionProcessor/file/getFileExistsActionProcessor.js +10 -4
- package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js +1 -2
- package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +1 -2
- package/lib/commonjs/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js +6 -9
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js +4 -6
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js +5 -9
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js +4 -6
- package/lib/commonjs/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.js +135 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js +10 -3
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js +4 -3
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js +4 -3
- package/lib/commonjs/dynamicActionProcessor/file/index.js +2 -1
- package/lib/commonjs/dynamicActionProcessor/file/utils.d.ts +2 -1
- package/lib/commonjs/dynamicActionProcessor/file/utils.js +11 -1
- package/lib/esm/actionProcessor/core/index.d.ts +2 -12
- package/lib/esm/actionProcessor/core/index.js +12 -35
- package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js +32 -0
- package/lib/esm/actionProcessor/core/{network/getNetworkRequestActionProcessor.d.ts → inlineFunction/index.d.ts} +1 -1
- package/lib/esm/actionProcessor/core/inlineFunction/index.js +4 -0
- package/lib/{commonjs/actionProcessor/core/context/getContextListActionProcessor.d.ts → esm/actionProcessor/core/stream/getStreamCloseActionProcessor.d.ts} +1 -1
- package/lib/esm/actionProcessor/core/stream/getStreamCloseActionProcessor.js +10 -0
- package/lib/esm/actionProcessor/core/stream/getStreamReadActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/stream/getStreamReadActionProcessor.js +10 -0
- package/lib/esm/actionProcessor/core/{config → stream}/index.d.ts +1 -1
- package/lib/esm/actionProcessor/core/stream/index.js +6 -0
- package/lib/esm/actionProcessor/webserver/index.js +4 -2
- package/lib/esm/dynamicActionProcessor/file/getFileDeleteActionProcessor.js +8 -5
- package/lib/esm/dynamicActionProcessor/file/getFileExistsActionProcessor.js +11 -5
- package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js +2 -3
- package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +2 -3
- package/lib/esm/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js +7 -10
- package/lib/esm/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js +5 -7
- package/lib/esm/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js +6 -10
- package/lib/esm/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js +5 -7
- package/lib/esm/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.js +37 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js +11 -4
- package/lib/esm/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js +5 -4
- package/lib/esm/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js +5 -4
- package/lib/esm/dynamicActionProcessor/file/index.js +2 -0
- package/lib/esm/dynamicActionProcessor/file/utils.d.ts +2 -1
- package/lib/esm/dynamicActionProcessor/file/utils.js +9 -1
- package/package.json +5 -9
- package/lib/commonjs/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.js +0 -74
- package/lib/commonjs/actionProcessor/core/claudeAi/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/claudeAi/index.js +0 -17
- package/lib/commonjs/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.js +0 -30
- package/lib/commonjs/actionProcessor/core/config/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/config/index.js +0 -17
- package/lib/commonjs/actionProcessor/core/context/getContextListActionProcessor.js +0 -24
- package/lib/commonjs/actionProcessor/core/context/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/context/index.js +0 -18
- package/lib/commonjs/actionProcessor/core/customActions/getCustomActionActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/customActions/getCustomActionActionProcessor.js +0 -58
- package/lib/commonjs/actionProcessor/core/customActions/index.d.ts +0 -1
- package/lib/commonjs/actionProcessor/core/customActions/index.js +0 -18
- package/lib/commonjs/actionProcessor/core/date/getDateNowActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/date/getDateNowActionProcessor.js +0 -24
- package/lib/commonjs/actionProcessor/core/date/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/date/index.js +0 -17
- package/lib/commonjs/actionProcessor/core/error/getErrorThrowErrorActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/error/getErrorThrowErrorActionProcessor.js +0 -24
- package/lib/commonjs/actionProcessor/core/error/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewActionProcessor.js +0 -25
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewSortableActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewSortableActionProcessor.js +0 -25
- package/lib/commonjs/actionProcessor/core/guid/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/guid/index.js +0 -18
- package/lib/commonjs/actionProcessor/core/log/getLogCreateActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/log/getLogCreateActionProcessor.js +0 -30
- package/lib/commonjs/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.js +0 -25
- package/lib/commonjs/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.js +0 -26
- package/lib/commonjs/actionProcessor/core/log/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/log/index.js +0 -19
- package/lib/commonjs/actionProcessor/core/math/getMathRandomNumberActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/math/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/math/index.js +0 -17
- package/lib/commonjs/actionProcessor/core/network/getNetworkRequestActionProcessor.js +0 -150
- package/lib/commonjs/actionProcessor/core/network/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/network/index.js +0 -17
- package/lib/commonjs/actionProcessor/core/platform/getPlatformDelayActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/platform/getPlatformDelayActionProcessor.js +0 -24
- package/lib/commonjs/actionProcessor/core/platform/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/platform/index.js +0 -17
- package/lib/commonjs/actionProcessor/core/system/getSystemBatchActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/system/getSystemBatchActionProcessor.js +0 -51
- package/lib/commonjs/actionProcessor/webserver/dns/getDnsListActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/webserver/dns/getDnsListActionProcessor.js +0 -26
- package/lib/commonjs/actionProcessor/webserver/dns/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/webserver/dns/index.js +0 -17
- package/lib/esm/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.js +0 -26
- package/lib/esm/actionProcessor/core/claudeAi/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/claudeAi/index.js +0 -4
- package/lib/esm/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.js +0 -15
- package/lib/esm/actionProcessor/core/config/index.js +0 -4
- package/lib/esm/actionProcessor/core/context/getContextListActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/context/getContextListActionProcessor.js +0 -9
- package/lib/esm/actionProcessor/core/context/getContextReadActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/context/getContextReadActionProcessor.js +0 -12
- package/lib/esm/actionProcessor/core/context/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/context/index.js +0 -6
- package/lib/esm/actionProcessor/core/customActions/getCustomActionActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/customActions/getCustomActionActionProcessor.js +0 -43
- package/lib/esm/actionProcessor/core/customActions/index.d.ts +0 -1
- package/lib/esm/actionProcessor/core/customActions/index.js +0 -2
- package/lib/esm/actionProcessor/core/date/getDateNowActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/date/getDateNowActionProcessor.js +0 -9
- package/lib/esm/actionProcessor/core/date/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/date/index.js +0 -4
- package/lib/esm/actionProcessor/core/error/getErrorThrowErrorActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/error/getErrorThrowErrorActionProcessor.js +0 -9
- package/lib/esm/actionProcessor/core/error/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/error/index.js +0 -4
- package/lib/esm/actionProcessor/core/guid/getGuidNewActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/guid/getGuidNewActionProcessor.js +0 -10
- package/lib/esm/actionProcessor/core/guid/getGuidNewSortableActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/guid/getGuidNewSortableActionProcessor.js +0 -10
- package/lib/esm/actionProcessor/core/guid/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/guid/index.js +0 -6
- package/lib/esm/actionProcessor/core/log/getLogCreateActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/log/getLogCreateActionProcessor.js +0 -15
- package/lib/esm/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/log/getLogDisableEventHistoryActionProcessor.js +0 -10
- package/lib/esm/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/log/getLogTemplateLiteralActionProcessor.js +0 -11
- package/lib/esm/actionProcessor/core/log/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/log/index.js +0 -8
- package/lib/esm/actionProcessor/core/math/getMathRandomNumberActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/math/getMathRandomNumberActionProcessor.js +0 -9
- package/lib/esm/actionProcessor/core/math/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/math/index.js +0 -4
- package/lib/esm/actionProcessor/core/network/getNetworkRequestActionProcessor.js +0 -134
- package/lib/esm/actionProcessor/core/network/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/network/index.js +0 -4
- package/lib/esm/actionProcessor/core/platform/getPlatformDelayActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/platform/getPlatformDelayActionProcessor.js +0 -9
- package/lib/esm/actionProcessor/core/platform/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/platform/index.js +0 -4
- package/lib/esm/actionProcessor/core/system/getSystemBatchActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/system/getSystemBatchActionProcessor.js +0 -36
- package/lib/esm/actionProcessor/core/system/index.d.ts +0 -2
- package/lib/esm/actionProcessor/core/system/index.js +0 -4
- package/lib/esm/actionProcessor/webserver/dns/getDnsListActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/webserver/dns/getDnsListActionProcessor.js +0 -11
- package/lib/esm/actionProcessor/webserver/dns/index.d.ts +0 -2
- package/lib/esm/actionProcessor/webserver/dns/index.js +0 -4
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { actionResultError, ErrorActionType, } from 'quidproquo-core';
|
|
2
|
-
const getProcessErrorThrowError = (qpqConfig) => {
|
|
3
|
-
return async ({ errorStack, errorText, errorType }) => {
|
|
4
|
-
return actionResultError(errorType, errorText, errorStack);
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
export const getErrorThrowErrorActionProcessor = async (qpqConfig) => ({
|
|
8
|
-
[ErrorActionType.ThrowError]: getProcessErrorThrowError(qpqConfig),
|
|
9
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { actionResult, GuidActionType } from 'quidproquo-core';
|
|
2
|
-
import { v4 as uuidV4 } from 'uuid';
|
|
3
|
-
const getProcessGuidNew = (qpqConfig) => {
|
|
4
|
-
return async () => {
|
|
5
|
-
return actionResult(uuidV4());
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export const getGuidNewActionProcessor = async (qpqConfig) => ({
|
|
9
|
-
[GuidActionType.New]: getProcessGuidNew(qpqConfig),
|
|
10
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { actionResult, GuidActionType, } from 'quidproquo-core';
|
|
2
|
-
import { uuidv7 } from 'uuidv7';
|
|
3
|
-
const getProcessGuidNewSortable = (qpqConfig) => {
|
|
4
|
-
return async () => {
|
|
5
|
-
return actionResult(uuidv7());
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export const getGuidNewSortableActionProcessor = async (qpqConfig) => ({
|
|
9
|
-
[GuidActionType.NewSortable]: getProcessGuidNewSortable(qpqConfig),
|
|
10
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { getGuidNewActionProcessor } from './getGuidNewActionProcessor';
|
|
2
|
-
import { getGuidNewSortableActionProcessor } from './getGuidNewSortableActionProcessor';
|
|
3
|
-
export const getGuidProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
4
|
-
...(await getGuidNewActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
5
|
-
...(await getGuidNewSortableActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
6
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { actionResult, LogActionType } from 'quidproquo-core';
|
|
2
|
-
const getProcessLogCreate = (qpqConfig) => {
|
|
3
|
-
return async ({ msg, logLevel, data }) => {
|
|
4
|
-
if (data) {
|
|
5
|
-
console.log(`${logLevel}: ${msg}`, data);
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
console.log(`${logLevel}: ${msg}`);
|
|
9
|
-
}
|
|
10
|
-
return actionResult(void 0);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export const getLogCreateActionProcessor = async (qpqConfig) => ({
|
|
14
|
-
[LogActionType.Create]: getProcessLogCreate(qpqConfig),
|
|
15
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { actionResult, LogActionType, } from 'quidproquo-core';
|
|
2
|
-
const getProcessLogDisableEventHistory = (qpqConfig) => {
|
|
3
|
-
return async ({ enable, reason }, session, _actionProcessors, logger) => {
|
|
4
|
-
await logger.enableLogs(enable, reason, session.correlation || '');
|
|
5
|
-
return actionResult(void 0);
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export const getLogDisableEventHistoryActionProcessor = async (qpqConfig) => ({
|
|
9
|
-
[LogActionType.DisableEventHistory]: getProcessLogDisableEventHistory(qpqConfig),
|
|
10
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { actionResult, decomposedStringToString, LogActionType, } from 'quidproquo-core';
|
|
2
|
-
const getProcessLogTemplateLiteral = (qpqConfig) => {
|
|
3
|
-
return async ({ messageParts }) => {
|
|
4
|
-
const message = decomposedStringToString(messageParts);
|
|
5
|
-
console.log(message);
|
|
6
|
-
return actionResult(void 0);
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export const getLogTemplateLiteralActionProcessor = async (qpqConfig) => ({
|
|
10
|
-
[LogActionType.TemplateLiteral]: getProcessLogTemplateLiteral(qpqConfig),
|
|
11
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { getLogCreateActionProcessor } from './getLogCreateActionProcessor';
|
|
2
|
-
import { getLogDisableEventHistoryActionProcessor } from './getLogDisableEventHistoryActionProcessor';
|
|
3
|
-
import { getLogTemplateLiteralActionProcessor } from './getLogTemplateLiteralActionProcessor';
|
|
4
|
-
export const getLogActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
5
|
-
...(await getLogCreateActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
6
|
-
...(await getLogDisableEventHistoryActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
7
|
-
...(await getLogTemplateLiteralActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
8
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { actionResult, MathActionType, } from 'quidproquo-core';
|
|
2
|
-
const getProcessMathRandomNumber = (qpqConfig) => {
|
|
3
|
-
return async () => {
|
|
4
|
-
return actionResult(Math.random());
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
export const getMathRandomNumberActionProcessor = async (qpqConfig) => ({
|
|
8
|
-
[MathActionType.RandomNumber]: getProcessMathRandomNumber(qpqConfig),
|
|
9
|
-
});
|
|
@@ -1,134 +0,0 @@
|
|
|
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,9 +0,0 @@
|
|
|
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,36 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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
|
-
});
|