quidproquo-actionprocessor-node 0.0.221 → 0.0.223
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 -0
- package/lib/commonjs/actionProcessor/core/claudeAi/{ClaudeAiActionProcessor.js → getClaudeAiMessagesApiActionProcessor.js} +25 -19
- package/lib/commonjs/actionProcessor/core/claudeAi/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/claudeAi/index.js +17 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +2 -0
- package/lib/commonjs/{getActionProcessor → actionProcessor}/core/config/getConfigGetApplicationInfoActionProcessor.js +6 -4
- package/lib/commonjs/actionProcessor/core/config/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/config/index.js +17 -0
- package/lib/commonjs/actionProcessor/core/context/getContextListActionProcessor.d.ts +2 -0
- package/lib/commonjs/{getActionProcessor → actionProcessor}/core/context/getContextListActionProcessor.js +8 -6
- package/lib/commonjs/actionProcessor/core/context/getContextReadActionProcessor.d.ts +2 -0
- package/lib/commonjs/{getActionProcessor → actionProcessor}/core/context/getContextReadActionProcessor.js +8 -6
- package/lib/commonjs/actionProcessor/core/context/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/context/index.js +18 -0
- package/lib/commonjs/actionProcessor/core/customActions/getCustomActionActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/customActions/getCustomActionActionProcessor.js +31 -0
- package/lib/commonjs/actionProcessor/core/customActions/index.d.ts +1 -0
- package/lib/commonjs/{getActionProcessor → actionProcessor/core/customActions}/index.js +2 -1
- package/lib/commonjs/actionProcessor/core/date/getDateNowActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/date/getDateNowActionProcessor.js +24 -0
- package/lib/commonjs/actionProcessor/core/date/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/{error/ErrorActionProcessor.js → date/index.js} +5 -6
- package/lib/commonjs/actionProcessor/core/error/getErrorThrowErrorActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/error/getErrorThrowErrorActionProcessor.js +24 -0
- package/lib/commonjs/actionProcessor/core/error/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/{date/DateActionProcessor.js → error/index.js} +5 -6
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/guid/{GuidActionProcessor.js → getGuidNewActionProcessor.js} +11 -10
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewSortableActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/guid/getGuidNewSortableActionProcessor.js +25 -0
- package/lib/commonjs/actionProcessor/core/guid/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/guid/index.js +18 -0
- package/lib/commonjs/actionProcessor/core/index.d.ts +14 -13
- package/lib/commonjs/actionProcessor/core/index.js +51 -13
- package/lib/commonjs/actionProcessor/core/log/getLogCreateActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/log/getLogCreateActionProcessor.js +30 -0
- package/lib/commonjs/actionProcessor/core/log/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/{math/MathActionProcessor.js → log/index.js} +5 -6
- package/lib/commonjs/actionProcessor/core/math/getMathRandomNumberActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/math/getMathRandomNumberActionProcessor.js +24 -0
- package/lib/commonjs/actionProcessor/core/math/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/math/index.js +17 -0
- package/lib/commonjs/actionProcessor/core/network/getNetworkRequestActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/network/{NetworkActionProcessor.js → getNetworkRequestActionProcessor.js} +28 -22
- package/lib/commonjs/actionProcessor/core/network/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/network/index.js +17 -0
- package/lib/commonjs/actionProcessor/core/platform/getPlatformDelayActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/platform/getPlatformDelayActionProcessor.js +24 -0
- package/lib/commonjs/actionProcessor/core/platform/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/platform/index.js +17 -0
- package/lib/commonjs/actionProcessor/core/system/getSystemBatchActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/system/getSystemBatchActionProcessor.js +51 -0
- package/lib/commonjs/actionProcessor/core/system/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/{log/LogActionProcessor.js → system/index.js} +5 -12
- package/lib/commonjs/actionProcessor/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/index.js +15 -7
- package/lib/commonjs/actionProcessor/webserver/index.d.ts +2 -2
- package/lib/commonjs/actionProcessor/webserver/index.js +15 -4
- package/lib/commonjs/index.d.ts +0 -1
- package/lib/commonjs/index.js +0 -1
- package/lib/esm/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/claudeAi/getClaudeAiMessagesApiActionProcessor.js +26 -0
- package/lib/esm/actionProcessor/core/claudeAi/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/claudeAi/index.js +4 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +2 -0
- package/lib/esm/{getActionProcessor → actionProcessor}/core/config/getConfigGetApplicationInfoActionProcessor.js +3 -5
- package/lib/esm/actionProcessor/core/config/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/config/index.js +4 -0
- package/lib/esm/actionProcessor/core/context/getContextListActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/context/getContextListActionProcessor.js +9 -0
- package/lib/esm/actionProcessor/core/context/getContextReadActionProcessor.d.ts +2 -0
- package/lib/esm/{getActionProcessor → actionProcessor}/core/context/getContextReadActionProcessor.js +4 -6
- package/lib/esm/actionProcessor/core/context/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/context/index.js +6 -0
- package/lib/esm/actionProcessor/core/customActions/getCustomActionActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/customActions/getCustomActionActionProcessor.js +18 -0
- package/lib/esm/actionProcessor/core/customActions/index.d.ts +1 -0
- package/lib/esm/actionProcessor/core/customActions/index.js +2 -0
- package/lib/esm/actionProcessor/core/date/getDateNowActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/date/getDateNowActionProcessor.js +9 -0
- package/lib/esm/actionProcessor/core/date/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/date/index.js +4 -0
- package/lib/esm/actionProcessor/core/error/getErrorThrowErrorActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/error/getErrorThrowErrorActionProcessor.js +9 -0
- package/lib/esm/actionProcessor/core/error/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/error/index.js +4 -0
- package/lib/esm/actionProcessor/core/guid/getGuidNewActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/guid/getGuidNewActionProcessor.js +10 -0
- package/lib/esm/actionProcessor/core/guid/getGuidNewSortableActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/guid/getGuidNewSortableActionProcessor.js +10 -0
- package/lib/esm/actionProcessor/core/guid/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/guid/index.js +6 -0
- package/lib/esm/actionProcessor/core/index.d.ts +14 -13
- package/lib/esm/actionProcessor/core/index.js +37 -22
- package/lib/esm/actionProcessor/core/log/getLogCreateActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/log/getLogCreateActionProcessor.js +15 -0
- package/lib/esm/actionProcessor/core/log/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/log/index.js +4 -0
- package/lib/esm/actionProcessor/core/math/getMathRandomNumberActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/math/getMathRandomNumberActionProcessor.js +9 -0
- package/lib/esm/actionProcessor/core/math/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/math/index.js +4 -0
- package/lib/esm/actionProcessor/core/network/getNetworkRequestActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/network/{NetworkActionProcessor.js → getNetworkRequestActionProcessor.js} +24 -22
- package/lib/esm/actionProcessor/core/network/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/network/index.js +4 -0
- package/lib/esm/actionProcessor/core/platform/getPlatformDelayActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/platform/getPlatformDelayActionProcessor.js +9 -0
- package/lib/esm/actionProcessor/core/platform/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/platform/index.js +4 -0
- package/lib/esm/actionProcessor/core/system/getSystemBatchActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/core/system/getSystemBatchActionProcessor.js +36 -0
- package/lib/esm/actionProcessor/core/system/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/system/index.js +4 -0
- package/lib/esm/actionProcessor/index.d.ts +2 -2
- package/lib/esm/actionProcessor/index.js +2 -2
- package/lib/esm/actionProcessor/webserver/index.d.ts +2 -2
- package/lib/esm/actionProcessor/webserver/index.js +3 -4
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/package.json +3 -3
- package/lib/commonjs/actionProcessor/core/claudeAi/ClaudeAiActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/date/DateActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/error/ErrorActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/event/EventActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/event/EventActionProcessor.js +0 -4
- package/lib/commonjs/actionProcessor/core/guid/GuidActionProcessor.d.ts +0 -6
- package/lib/commonjs/actionProcessor/core/log/LogActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/math/MathActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/network/NetworkActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/platform/PlatformActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/platform/PlatformActionProcessor.js +0 -18
- package/lib/commonjs/actionProcessor/core/system/SystemActionProcessor.d.ts +0 -5
- package/lib/commonjs/actionProcessor/core/system/SystemActionProcessor.js +0 -45
- package/lib/commonjs/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.js +0 -3
- package/lib/commonjs/getActionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +0 -5
- package/lib/commonjs/getActionProcessor/core/config/index.d.ts +0 -5
- package/lib/commonjs/getActionProcessor/core/config/index.js +0 -7
- package/lib/commonjs/getActionProcessor/core/context/getContextListActionProcessor.d.ts +0 -5
- package/lib/commonjs/getActionProcessor/core/context/getContextReadActionProcessor.d.ts +0 -5
- package/lib/commonjs/getActionProcessor/core/context/index.d.ts +0 -6
- package/lib/commonjs/getActionProcessor/core/context/index.js +0 -8
- package/lib/commonjs/getActionProcessor/core/index.d.ts +0 -2
- package/lib/commonjs/getActionProcessor/core/index.js +0 -10
- package/lib/commonjs/getActionProcessor/index.d.ts +0 -1
- package/lib/esm/actionProcessor/core/claudeAi/ClaudeAiActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/claudeAi/ClaudeAiActionProcessor.js +0 -24
- package/lib/esm/actionProcessor/core/date/DateActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/date/DateActionProcessor.js +0 -7
- package/lib/esm/actionProcessor/core/error/ErrorActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/error/ErrorActionProcessor.js +0 -7
- package/lib/esm/actionProcessor/core/event/EventActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/core/event/EventActionProcessor.js +0 -2
- package/lib/esm/actionProcessor/core/guid/GuidActionProcessor.d.ts +0 -6
- package/lib/esm/actionProcessor/core/guid/GuidActionProcessor.js +0 -13
- package/lib/esm/actionProcessor/core/log/LogActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/log/LogActionProcessor.js +0 -13
- package/lib/esm/actionProcessor/core/math/MathActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/math/MathActionProcessor.js +0 -7
- package/lib/esm/actionProcessor/core/network/NetworkActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/platform/PlatformActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/platform/PlatformActionProcessor.js +0 -7
- package/lib/esm/actionProcessor/core/system/SystemActionProcessor.d.ts +0 -5
- package/lib/esm/actionProcessor/core/system/SystemActionProcessor.js +0 -34
- package/lib/esm/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.js +0 -1
- package/lib/esm/getActionProcessor/core/config/getConfigGetApplicationInfoActionProcessor.d.ts +0 -5
- package/lib/esm/getActionProcessor/core/config/index.d.ts +0 -5
- package/lib/esm/getActionProcessor/core/config/index.js +0 -4
- package/lib/esm/getActionProcessor/core/context/getContextListActionProcessor.d.ts +0 -5
- package/lib/esm/getActionProcessor/core/context/getContextListActionProcessor.js +0 -11
- package/lib/esm/getActionProcessor/core/context/getContextReadActionProcessor.d.ts +0 -5
- package/lib/esm/getActionProcessor/core/context/index.d.ts +0 -6
- package/lib/esm/getActionProcessor/core/context/index.js +0 -6
- package/lib/esm/getActionProcessor/core/index.d.ts +0 -2
- package/lib/esm/getActionProcessor/core/index.js +0 -2
- package/lib/esm/getActionProcessor/index.d.ts +0 -1
- package/lib/esm/getActionProcessor/index.js +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export * from './claudeAi';
|
|
3
|
+
export * from './date';
|
|
4
|
+
export * from './error';
|
|
5
|
+
export * from './guid';
|
|
6
|
+
export * from './log';
|
|
7
|
+
export * from './math';
|
|
8
|
+
export * from './network';
|
|
9
|
+
export * from './platform';
|
|
10
|
+
export * from './system';
|
|
11
|
+
export * from './config';
|
|
12
|
+
export * from './context';
|
|
13
|
+
export * from './customActions';
|
|
14
|
+
export declare const getCoreActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { getClaudeAiActionProcessor } from './claudeAi';
|
|
2
|
+
import { getDateActionProcessor } from './date';
|
|
3
|
+
import { getErrorActionProcessor } from './error';
|
|
4
|
+
import { getGuidProcessor } from './guid';
|
|
5
|
+
import { getLogActionProcessor } from './log';
|
|
6
|
+
import { getMathActionProcessor } from './math';
|
|
7
|
+
import { getNetworkActionProcessor } from './network';
|
|
8
|
+
import { getPlatformActionProcessor } from './platform';
|
|
9
|
+
import { getSystemActionProcessor } from './system';
|
|
10
|
+
import { getConfigActionProcessor } from './config';
|
|
11
|
+
import { getContextActionProcessor } from './context';
|
|
12
|
+
export * from './claudeAi';
|
|
13
|
+
export * from './date';
|
|
14
|
+
export * from './error';
|
|
15
|
+
export * from './guid';
|
|
16
|
+
export * from './log';
|
|
17
|
+
export * from './math';
|
|
18
|
+
export * from './network';
|
|
19
|
+
export * from './platform';
|
|
20
|
+
export * from './system';
|
|
21
|
+
export * from './config';
|
|
22
|
+
export * from './context';
|
|
23
|
+
// Custom actions is not done here, as it has to be done last after all
|
|
24
|
+
export * from './customActions';
|
|
25
|
+
export const getCoreActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
26
|
+
...(await getConfigActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
27
|
+
...(await getContextActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
28
|
+
...(await getClaudeAiActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
29
|
+
...(await getDateActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
30
|
+
...(await getErrorActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
31
|
+
...(await getGuidProcessor(qpqConfig, dynamicModuleLoader)),
|
|
32
|
+
...(await getLogActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
33
|
+
...(await getMathActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
34
|
+
...(await getNetworkActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
35
|
+
...(await getPlatformActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
36
|
+
...(await getSystemActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
37
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MathActionType, actionResult, } 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
|
+
});
|
|
@@ -107,26 +107,28 @@ const requestMethodMap = {
|
|
|
107
107
|
PATCH: processNetworkRequestPatch,
|
|
108
108
|
CONNECT: processNetworkRequestConnect,
|
|
109
109
|
};
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
[NetworkActionType.Request]: processNetworkRequest,
|
|
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
|
+
};
|
|
132
131
|
};
|
|
132
|
+
export const getNetworkRequestActionProcessor = async (qpqConfig) => ({
|
|
133
|
+
[NetworkActionType.Request]: getProcessNetworkRequest(qpqConfig),
|
|
134
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PlatformActionType, actionResult, } 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
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SystemActionType, actionResult, actionResultError, isErroredActionResult, processAction, resolveActionResult, resolveActionResultError, } 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
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './webserver';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './webserver';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export declare const getWebserverActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
export const getWebserverActionProcessor = async (qpqConfig) => ({
|
|
2
|
+
// Nothing yet
|
|
3
|
+
});
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.223",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@anthropic-ai/sdk": "^0.19.1",
|
|
33
33
|
"axios": "^1.2.1",
|
|
34
34
|
"mime-types": "^2.1.35",
|
|
35
|
-
"quidproquo-core": "0.0.
|
|
35
|
+
"quidproquo-core": "0.0.223",
|
|
36
36
|
"uuid": "^9.0.0",
|
|
37
37
|
"uuidv7": "^1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/mime-types": "^2.1.1",
|
|
41
41
|
"@types/uuid": "^9.0.0",
|
|
42
|
-
"quidproquo-tsconfig": "0.0.
|
|
42
|
+
"quidproquo-tsconfig": "0.0.223",
|
|
43
43
|
"typescript": "^4.9.3"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { GuidNewActionProcessor, GuidNewSortableActionProcessor } from 'quidproquo-core';
|
|
2
|
-
declare const _default: {
|
|
3
|
-
"@quidproquo-core/Guid/New": GuidNewActionProcessor;
|
|
4
|
-
"@quidproquo-core/Guid/NewSortable": GuidNewSortableActionProcessor;
|
|
5
|
-
};
|
|
6
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processPlatformDelay = ({ timeMs }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return new Promise((resolve) => setTimeout(() => resolve((0, quidproquo_core_1.actionResult)(undefined)), timeMs));
|
|
15
|
-
});
|
|
16
|
-
exports.default = {
|
|
17
|
-
[quidproquo_core_1.PlatformActionType.Delay]: processPlatformDelay,
|
|
18
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processBatch = (payload, session, actionProcessors, logger, updateSession) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
// console.log('~~~~~~~~~~~ RUNNING BATCH ~~~~~~~~~: ', payload);
|
|
15
|
-
const batchRes = yield Promise.all(payload.actions.map((a) => (0, quidproquo_core_1.processAction)(a, actionProcessors, session, logger, updateSession)));
|
|
16
|
-
// console.log('~~~~~~~~~~~ RESULT BATCH ~~~~~~~~~: ', batchRes);
|
|
17
|
-
// If there was an error, that does not want to be returned, throw that error back
|
|
18
|
-
const erroredBatchItem = batchRes.find((br, i) => (0, quidproquo_core_1.isErroredActionResult)(br) && !payload.actions[i].returnErrors);
|
|
19
|
-
if (erroredBatchItem) {
|
|
20
|
-
const error = (0, quidproquo_core_1.resolveActionResultError)(erroredBatchItem);
|
|
21
|
-
return (0, quidproquo_core_1.actionResultError)(error.errorType, error.errorText, error.errorStack);
|
|
22
|
-
}
|
|
23
|
-
// unwrap the values
|
|
24
|
-
return (0, quidproquo_core_1.actionResult)(batchRes.map((br, i) => {
|
|
25
|
-
// If we want to return errors, return the either result.
|
|
26
|
-
if (payload.actions[i].returnErrors) {
|
|
27
|
-
const isSuccess = !(0, quidproquo_core_1.isErroredActionResult)(br);
|
|
28
|
-
const result = isSuccess
|
|
29
|
-
? {
|
|
30
|
-
success: true,
|
|
31
|
-
result: (0, quidproquo_core_1.resolveActionResult)(br),
|
|
32
|
-
}
|
|
33
|
-
: {
|
|
34
|
-
success: false,
|
|
35
|
-
error: (0, quidproquo_core_1.resolveActionResultError)(br),
|
|
36
|
-
};
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
// return the resolved result
|
|
40
|
-
return (0, quidproquo_core_1.resolveActionResult)(br);
|
|
41
|
-
}));
|
|
42
|
-
});
|
|
43
|
-
exports.default = {
|
|
44
|
-
[quidproquo_core_1.SystemActionType.Batch]: processBatch,
|
|
45
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getConfigGetApplicationInfoActionProcessor_1 = __importDefault(require("./getConfigGetApplicationInfoActionProcessor"));
|
|
7
|
-
exports.default = (qpqConfig) => (Object.assign({}, (0, getConfigGetApplicationInfoActionProcessor_1.default)(qpqConfig)));
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
-
declare const _default: (qpqConfig: QPQConfig) => {
|
|
3
|
-
"@quidproquo-core/Context/Read": import("quidproquo-core").ContextReadActionProcessor<any>;
|
|
4
|
-
"@quidproquo-core/Context/List": import("quidproquo-core").ContextListActionProcessor;
|
|
5
|
-
};
|
|
6
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const getContextListActionProcessor_1 = __importDefault(require("./getContextListActionProcessor"));
|
|
7
|
-
const getContextReadActionProcessor_1 = __importDefault(require("./getContextReadActionProcessor"));
|
|
8
|
-
exports.default = (qpqConfig) => (Object.assign(Object.assign({}, (0, getContextListActionProcessor_1.default)(qpqConfig)), (0, getContextReadActionProcessor_1.default)(qpqConfig)));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getContextActionProcessor = exports.getConfigActionProcessor = void 0;
|
|
7
|
-
var config_1 = require("./config");
|
|
8
|
-
Object.defineProperty(exports, "getConfigActionProcessor", { enumerable: true, get: function () { return __importDefault(config_1).default; } });
|
|
9
|
-
var context_1 = require("./context");
|
|
10
|
-
Object.defineProperty(exports, "getContextActionProcessor", { enumerable: true, get: function () { return __importDefault(context_1).default; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './core';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Anthropic, { AuthenticationError } from '@anthropic-ai/sdk';
|
|
2
|
-
import { ErrorTypeEnum, actionResult, ClaudeAiActionType, actionResultError, } from 'quidproquo-core';
|
|
3
|
-
const processMessagesApi = async ({ body, apiKey }) => {
|
|
4
|
-
const anthropic = new Anthropic({ apiKey });
|
|
5
|
-
try {
|
|
6
|
-
const msg = await anthropic.messages.create(body);
|
|
7
|
-
return actionResult(msg);
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
console.log(error);
|
|
11
|
-
if (error instanceof AuthenticationError) {
|
|
12
|
-
return actionResultError(ErrorTypeEnum.Unauthorized, 'Invalid API key.');
|
|
13
|
-
}
|
|
14
|
-
else if (error instanceof Error) {
|
|
15
|
-
return actionResultError(ErrorTypeEnum.GenericError, error.message);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return actionResultError(ErrorTypeEnum.GenericError, 'An error occurred while processing your request.');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export default {
|
|
23
|
-
[ClaudeAiActionType.MessagesApi]: processMessagesApi,
|
|
24
|
-
};
|