quidproquo-actionprocessor-node 0.0.263 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/actionProcessor/core/index.d.ts +0 -12
- package/lib/commonjs/actionProcessor/core/index.js +6 -25
- package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js +1 -0
- 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.js +6 -7
- 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/utils.d.ts +2 -1
- package/lib/commonjs/dynamicActionProcessor/file/utils.js +11 -1
- package/lib/esm/actionProcessor/core/index.d.ts +0 -12
- package/lib/esm/actionProcessor/core/index.js +6 -35
- package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js +1 -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.js +7 -8
- 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/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.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/context/getContextListActionProcessor.js +0 -24
- package/lib/commonjs/actionProcessor/core/context/getContextReadActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/context/getContextReadActionProcessor.js +0 -27
- 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/error/index.js +0 -17
- 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/getMathRandomNumberActionProcessor.js +0 -24
- 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.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/network/getNetworkRequestActionProcessor.js +0 -153
- 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/core/system/index.d.ts +0 -2
- package/lib/commonjs/actionProcessor/core/system/index.js +0 -17
- 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.d.ts +0 -2
- 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.d.ts +0 -2
- package/lib/esm/actionProcessor/core/network/getNetworkRequestActionProcessor.js +0 -137
- 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,16 +1,4 @@
|
|
|
1
1
|
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export * from './claudeAi';
|
|
3
|
-
export * from './config';
|
|
4
|
-
export * from './context';
|
|
5
|
-
export * from './date';
|
|
6
|
-
export * from './error';
|
|
7
|
-
export * from './guid';
|
|
8
2
|
export * from './inlineFunction';
|
|
9
|
-
export * from './log';
|
|
10
|
-
export * from './math';
|
|
11
|
-
export * from './network';
|
|
12
|
-
export * from './platform';
|
|
13
3
|
export * from './stream';
|
|
14
|
-
export * from './system';
|
|
15
|
-
export * from './customActions';
|
|
16
4
|
export declare const getCoreActionProcessor: ActionProcessorListResolver;
|
|
@@ -24,35 +24,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getCoreActionProcessor = void 0;
|
|
27
|
-
const
|
|
28
|
-
const config_1 = require("./config");
|
|
29
|
-
const context_1 = require("./context");
|
|
30
|
-
const date_1 = require("./date");
|
|
31
|
-
const error_1 = require("./error");
|
|
32
|
-
const guid_1 = require("./guid");
|
|
27
|
+
const quidproquo_actionprocessor_js_1 = require("quidproquo-actionprocessor-js");
|
|
33
28
|
const inlineFunction_1 = require("./inlineFunction");
|
|
34
|
-
const log_1 = require("./log");
|
|
35
|
-
const math_1 = require("./math");
|
|
36
|
-
const network_1 = require("./network");
|
|
37
|
-
const platform_1 = require("./platform");
|
|
38
29
|
const stream_1 = require("./stream");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
__exportStar(require("./date"), exports);
|
|
44
|
-
__exportStar(require("./error"), exports);
|
|
45
|
-
__exportStar(require("./guid"), exports);
|
|
30
|
+
// The shared core processors (config, context, claudeAi, date, error, guid, log,
|
|
31
|
+
// math, network, platform, system, customActions) are owned by
|
|
32
|
+
// quidproquo-actionprocessor-js. Node builds on top of js and only adds the
|
|
33
|
+
// processors that need a Node runtime (stream, inlineFunction).
|
|
46
34
|
__exportStar(require("./inlineFunction"), exports);
|
|
47
|
-
__exportStar(require("./log"), exports);
|
|
48
|
-
__exportStar(require("./math"), exports);
|
|
49
|
-
__exportStar(require("./network"), exports);
|
|
50
|
-
__exportStar(require("./platform"), exports);
|
|
51
35
|
__exportStar(require("./stream"), exports);
|
|
52
|
-
__exportStar(require("./system"), exports);
|
|
53
|
-
// Custom actions is not done here, as it has to be done last after all
|
|
54
|
-
__exportStar(require("./customActions"), exports);
|
|
55
36
|
const getCoreActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
return (Object.assign(Object.assign(Object.assign(
|
|
37
|
+
return (Object.assign(Object.assign(Object.assign({}, (yield (0, quidproquo_actionprocessor_js_1.getCoreActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, stream_1.getStreamActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, inlineFunction_1.getInlineFunctionActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
57
38
|
});
|
|
58
39
|
exports.getCoreActionProcessor = getCoreActionProcessor;
|
package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js
CHANGED
|
@@ -27,6 +27,7 @@ const getProcessExecute = (qpqConfig) => {
|
|
|
27
27
|
}
|
|
28
28
|
const resolveStory = (0, quidproquo_core_1.createRuntime)(qpqConfig, {
|
|
29
29
|
context: session.context,
|
|
30
|
+
localContext: session.localContext,
|
|
30
31
|
depth: (session.depth || 0) + 1,
|
|
31
32
|
decodedAccessToken: session.decodedAccessToken,
|
|
32
33
|
correlation: session.correlation,
|
|
@@ -10,8 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getWebserverActionProcessor = void 0;
|
|
13
|
-
const
|
|
13
|
+
const quidproquo_actionprocessor_js_1 = require("quidproquo-actionprocessor-js");
|
|
14
|
+
// The shared webserver processors (dns, ...) are owned by quidproquo-actionprocessor-js.
|
|
15
|
+
// Node builds on top of js; it currently adds no node-specific webserver processors.
|
|
14
16
|
const getWebserverActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
return (Object.assign({}, (yield (0,
|
|
17
|
+
return (Object.assign({}, (yield (0, quidproquo_actionprocessor_js_1.getWebserverActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
16
18
|
});
|
|
17
19
|
exports.getWebserverActionProcessor = getWebserverActionProcessor;
|
|
@@ -47,13 +47,12 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileDelete = (qpqConfig, config) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepaths }) {
|
|
52
51
|
const deletedFiles = [];
|
|
53
52
|
const errors = [];
|
|
54
53
|
for (const filepath of filepaths) {
|
|
55
54
|
try {
|
|
56
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
55
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
57
56
|
yield fs.unlink(fullPath);
|
|
58
57
|
deletedFiles.push(filepath);
|
|
59
58
|
}
|
|
@@ -63,12 +62,16 @@ const getProcessFileDelete = (qpqConfig, config) => {
|
|
|
63
62
|
deletedFiles.push(filepath);
|
|
64
63
|
}
|
|
65
64
|
else {
|
|
66
|
-
errors.push(
|
|
65
|
+
errors.push({ filepath, error });
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
if (errors.length > 0 && deletedFiles.length === 0) {
|
|
71
|
-
|
|
70
|
+
// EACCES maps to the same typed error the S3 processor returns for AccessDenied
|
|
71
|
+
if (errors.some(({ error }) => error.code === 'EACCES')) {
|
|
72
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileDeleteErrorTypeEnum.AccessDenied, 'Access denied deleting files');
|
|
73
|
+
}
|
|
74
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Failed to delete files: ${errors.map(({ filepath, error }) => `Failed to delete ${filepath}: ${error.message}`).join(', ')}`);
|
|
72
75
|
}
|
|
73
76
|
return (0, quidproquo_core_1.actionResult)(deletedFiles);
|
|
74
77
|
});
|
|
@@ -47,16 +47,22 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileExists = (qpqConfig, config) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath }) {
|
|
52
51
|
try {
|
|
53
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
52
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
54
53
|
try {
|
|
55
54
|
yield fs.access(fullPath);
|
|
56
55
|
return (0, quidproquo_core_1.actionResult)(true);
|
|
57
56
|
}
|
|
58
|
-
catch (
|
|
59
|
-
|
|
57
|
+
catch (error) {
|
|
58
|
+
// Missing file is a definitive false; permission problems must surface.
|
|
59
|
+
if (error.code === 'ENOENT') {
|
|
60
|
+
return (0, quidproquo_core_1.actionResult)(false);
|
|
61
|
+
}
|
|
62
|
+
if (error.code === 'EACCES') {
|
|
63
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileExistsErrorTypeEnum.AccessDenied, `Access denied checking file existence: ${filepath}`);
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
catch (error) {
|
package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js
CHANGED
|
@@ -14,12 +14,11 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
14
14
|
const secureUrlUtils_1 = require("./secureUrlUtils");
|
|
15
15
|
const utils_1 = require("./utils");
|
|
16
16
|
const getProcessFileGenerateTemporarySecureUrl = (qpqConfig, config) => {
|
|
17
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
18
17
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, expirationMs }) {
|
|
19
18
|
try {
|
|
20
19
|
// Create a token for download
|
|
21
20
|
const token = (0, secureUrlUtils_1.createSecureUrlToken)({
|
|
22
|
-
fullFilepath: (0, utils_1.resolveFilePath)(config,
|
|
21
|
+
fullFilepath: (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath),
|
|
23
22
|
operation: 'download',
|
|
24
23
|
expiresAt: Date.now() + expirationMs,
|
|
25
24
|
}, config.secureUrlSecret);
|
|
@@ -14,13 +14,12 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
14
14
|
const secureUrlUtils_1 = require("./secureUrlUtils");
|
|
15
15
|
const utils_1 = require("./utils");
|
|
16
16
|
const getProcessFileGenerateTemporaryUploadSecureUrl = (qpqConfig, config) => {
|
|
17
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
18
17
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, expirationMs, contentType }) {
|
|
19
18
|
try {
|
|
20
19
|
const expiresAt = Date.now() + expirationMs;
|
|
21
20
|
// Create a token for upload
|
|
22
21
|
const token = (0, secureUrlUtils_1.createSecureUrlToken)({
|
|
23
|
-
fullFilepath: (0, utils_1.resolveFilePath)(config,
|
|
22
|
+
fullFilepath: (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath),
|
|
24
23
|
operation: 'upload',
|
|
25
24
|
expiresAt,
|
|
26
25
|
contentType,
|
|
@@ -48,10 +48,9 @@ const fs = __importStar(require("fs/promises"));
|
|
|
48
48
|
const path = __importStar(require("path"));
|
|
49
49
|
const utils_1 = require("./utils");
|
|
50
50
|
const getProcessFileListDirectory = (config) => (qpqConfig) => {
|
|
51
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
52
51
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, folderPath, maxFiles, pageToken }) {
|
|
53
52
|
try {
|
|
54
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
53
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, folderPath || '');
|
|
55
54
|
// Read all entries in the directory
|
|
56
55
|
const entries = yield fs.readdir(fullPath, { withFileTypes: true });
|
|
57
56
|
// Build file info list
|
|
@@ -80,13 +79,11 @@ const getProcessFileListDirectory = (config) => (qpqConfig) => {
|
|
|
80
79
|
return (0, quidproquo_core_1.actionResult)(result);
|
|
81
80
|
}
|
|
82
81
|
catch (error) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error listing directory: ${error.message}`);
|
|
82
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
83
|
+
ENOENT: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileListDirectoryErrorTypeEnum.DirectoryNotFound, `Directory not found: ${folderPath}`), // node fs code
|
|
84
|
+
ENOTDIR: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileListDirectoryErrorTypeEnum.NotADirectory, `Path is not a directory: ${folderPath}`), // node fs code
|
|
85
|
+
EACCES: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileListDirectoryErrorTypeEnum.AccessDenied, `Access denied listing directory: ${folderPath}`), // node fs code
|
|
86
|
+
});
|
|
90
87
|
}
|
|
91
88
|
});
|
|
92
89
|
};
|
package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js
CHANGED
|
@@ -48,10 +48,9 @@ const fs = __importStar(require("fs/promises"));
|
|
|
48
48
|
const path = __importStar(require("path"));
|
|
49
49
|
const utils_1 = require("./utils");
|
|
50
50
|
const getProcessFileReadBinaryContents = (config) => (qpqConfig) => {
|
|
51
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
52
51
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath }) {
|
|
53
52
|
try {
|
|
54
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
53
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
55
54
|
const buffer = yield fs.readFile(fullPath);
|
|
56
55
|
// Convert Buffer to QPQBinaryData
|
|
57
56
|
const binaryData = {
|
|
@@ -62,10 +61,9 @@ const getProcessFileReadBinaryContents = (config) => (qpqConfig) => {
|
|
|
62
61
|
return (0, quidproquo_core_1.actionResult)(binaryData);
|
|
63
62
|
}
|
|
64
63
|
catch (error) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error reading binary file: ${error.message}`);
|
|
64
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
65
|
+
ENOENT: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileReadBinaryContentsErrorTypeEnum.FileNotFound, `File not found: ${filepath}`), // node fs code
|
|
66
|
+
});
|
|
69
67
|
}
|
|
70
68
|
});
|
|
71
69
|
};
|
|
@@ -47,22 +47,18 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileReadObjectJson = (config) => (qpqConfig) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath }) {
|
|
52
51
|
try {
|
|
53
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
52
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
54
53
|
const content = yield fs.readFile(fullPath, 'utf8');
|
|
55
54
|
const jsonObject = JSON.parse(content);
|
|
56
55
|
return (0, quidproquo_core_1.actionResult)(jsonObject);
|
|
57
56
|
}
|
|
58
57
|
catch (error) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Invalid JSON in file: ${filepath}`);
|
|
64
|
-
}
|
|
65
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error reading JSON file: ${error.message}`);
|
|
58
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
59
|
+
ENOENT: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `File not found: ${filepath}`), // node fs code
|
|
60
|
+
SyntaxError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Invalid JSON in file: ${filepath}`), // JSON.parse failure
|
|
61
|
+
});
|
|
66
62
|
}
|
|
67
63
|
});
|
|
68
64
|
};
|
|
@@ -47,18 +47,16 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileReadTextContents = (qpqConfig, config) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath }) {
|
|
52
51
|
try {
|
|
53
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
52
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
54
53
|
const content = yield fs.readFile(fullPath, 'utf8');
|
|
55
54
|
return (0, quidproquo_core_1.actionResult)(content);
|
|
56
55
|
}
|
|
57
56
|
catch (error) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error reading file: ${error.message}`);
|
|
57
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
58
|
+
ENOENT: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `File not found: ${filepath}`), // node fs code
|
|
59
|
+
});
|
|
62
60
|
}
|
|
63
61
|
});
|
|
64
62
|
};
|
|
@@ -64,6 +64,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
64
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
65
|
exports.getFileStreamOpenActionProcessor = void 0;
|
|
66
66
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
67
|
+
const crypto_1 = require("crypto");
|
|
67
68
|
const fs = __importStar(require("fs"));
|
|
68
69
|
const utils_1 = require("./utils");
|
|
69
70
|
function textStreamIterator(stream) {
|
|
@@ -108,23 +109,21 @@ function binaryStreamIterator(stream) {
|
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
const getProcessFileStreamOpen = (qpqConfig, config) => {
|
|
111
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
112
112
|
return (_a, session_1, actionProcessors_1, logger_1, updateSession_1, dynamicModuleLoader_1, streamRegistry_1) => __awaiter(void 0, [_a, session_1, actionProcessors_1, logger_1, updateSession_1, dynamicModuleLoader_1, streamRegistry_1], void 0, function* ({ drive, filepath, encoding, chunkSize }, session, actionProcessors, logger, updateSession, dynamicModuleLoader, streamRegistry) {
|
|
113
113
|
try {
|
|
114
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
114
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
115
115
|
const isText = encoding === 'text';
|
|
116
116
|
const highWaterMark = chunkSize !== null && chunkSize !== void 0 ? chunkSize : 65536;
|
|
117
117
|
const readStream = fs.createReadStream(fullPath, isText ? { encoding: 'utf8', highWaterMark } : { highWaterMark });
|
|
118
|
-
const streamId = `file-${
|
|
118
|
+
const streamId = `file-${(0, crypto_1.randomUUID)()}`;
|
|
119
119
|
const iterator = isText ? textStreamIterator(readStream) : binaryStreamIterator(readStream);
|
|
120
120
|
streamRegistry.register(streamId, iterator);
|
|
121
121
|
return (0, quidproquo_core_1.actionResult)({ id: streamId, encoding });
|
|
122
122
|
}
|
|
123
123
|
catch (error) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error opening file stream: ${error.message}`);
|
|
124
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
125
|
+
ENOENT: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileStreamOpenErrorTypeEnum.FileNotFound, `File not found: ${filepath}`), // node fs code
|
|
126
|
+
});
|
|
128
127
|
}
|
|
129
128
|
});
|
|
130
129
|
};
|
package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js
CHANGED
|
@@ -47,18 +47,25 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileWriteBinaryContents = (config) => (qpqConfig) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, data }) {
|
|
52
51
|
try {
|
|
53
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
52
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
54
53
|
yield (0, utils_1.ensureParentDirectoryExists)(fullPath);
|
|
55
54
|
// Convert QPQBinaryData to Buffer
|
|
56
55
|
const buffer = Buffer.from(data.base64Data, 'base64');
|
|
57
56
|
yield fs.writeFile(fullPath, buffer);
|
|
57
|
+
if (data.mimetype || data.contentDisposition) {
|
|
58
|
+
yield fs.writeFile(`${fullPath}.qpqmeta.json`, JSON.stringify({
|
|
59
|
+
mimetype: data.mimetype,
|
|
60
|
+
contentDisposition: data.contentDisposition,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
58
63
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
59
64
|
}
|
|
60
65
|
catch (error) {
|
|
61
|
-
return (0, quidproquo_core_1.
|
|
66
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
67
|
+
EACCES: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileWriteBinaryContentsErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
|
|
68
|
+
});
|
|
62
69
|
}
|
|
63
70
|
});
|
|
64
71
|
};
|
|
@@ -47,17 +47,18 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileWriteObjectJson = (config) => (qpqConfig) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, data }) {
|
|
52
51
|
try {
|
|
53
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
52
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
54
53
|
yield (0, utils_1.ensureParentDirectoryExists)(fullPath);
|
|
55
54
|
const jsonString = JSON.stringify(data, null, 2);
|
|
56
55
|
yield fs.writeFile(fullPath, jsonString, 'utf8');
|
|
57
56
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
58
57
|
}
|
|
59
58
|
catch (error) {
|
|
60
|
-
return (0, quidproquo_core_1.
|
|
59
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
60
|
+
EACCES: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileWriteObjectJsonErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
|
|
61
|
+
});
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
};
|
|
@@ -47,16 +47,17 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
47
47
|
const fs = __importStar(require("fs/promises"));
|
|
48
48
|
const utils_1 = require("./utils");
|
|
49
49
|
const getProcessFileWriteTextContents = (qpqConfig, config) => {
|
|
50
|
-
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
50
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, data }) {
|
|
52
51
|
try {
|
|
53
|
-
const fullPath = (0, utils_1.resolveFilePath)(config,
|
|
52
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, qpqConfig, drive, filepath);
|
|
54
53
|
yield (0, utils_1.ensureParentDirectoryExists)(fullPath);
|
|
55
54
|
yield fs.writeFile(fullPath, data, 'utf8');
|
|
56
55
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
57
56
|
}
|
|
58
57
|
catch (error) {
|
|
59
|
-
return (0, quidproquo_core_1.
|
|
58
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
59
|
+
EACCES: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.FileWriteTextContentsErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
|
|
60
|
+
});
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QPQConfig } from 'quidproquo-core';
|
|
2
2
|
import { FileStorageConfig } from './types';
|
|
3
3
|
export declare const isStorageDriveNameValid: (drive: string, qpqConfig: QPQConfig) => boolean;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function resolveDriveServiceName(drive: string, qpqConfig: QPQConfig): string;
|
|
5
|
+
export declare function resolveFilePath(fileStorageConfig: FileStorageConfig, qpqConfig: QPQConfig, drive: string, filepath: string): string;
|
|
5
6
|
export declare const ensureDirectoryExists: (dirPath: string) => Promise<void>;
|
|
6
7
|
export declare const ensureParentDirectoryExists: (filePath: string) => Promise<void>;
|
|
@@ -43,6 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.ensureParentDirectoryExists = exports.ensureDirectoryExists = exports.isStorageDriveNameValid = void 0;
|
|
46
|
+
exports.resolveDriveServiceName = resolveDriveServiceName;
|
|
46
47
|
exports.resolveFilePath = resolveFilePath;
|
|
47
48
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
48
49
|
const fs = __importStar(require("fs/promises"));
|
|
@@ -56,7 +57,16 @@ const isStorageDriveNameValid = (drive, qpqConfig) => {
|
|
|
56
57
|
return true;
|
|
57
58
|
};
|
|
58
59
|
exports.isStorageDriveNameValid = isStorageDriveNameValid;
|
|
59
|
-
|
|
60
|
+
// Resolve the service that owns a drive's on-disk location. Drives declared with
|
|
61
|
+
// `owner.module` are shared across services, so every caller reads and writes
|
|
62
|
+
// under the owner's folder — mirroring how AWS resolves the bucket by owner.
|
|
63
|
+
function resolveDriveServiceName(drive, qpqConfig) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
const storageDrive = quidproquo_core_1.qpqCoreUtils.getStorageDriveByName(drive, qpqConfig);
|
|
66
|
+
return (_b = (_a = storageDrive === null || storageDrive === void 0 ? void 0 : storageDrive.owner) === null || _a === void 0 ? void 0 : _a.module) !== null && _b !== void 0 ? _b : quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
67
|
+
}
|
|
68
|
+
function resolveFilePath(fileStorageConfig, qpqConfig, drive, filepath) {
|
|
69
|
+
const service = resolveDriveServiceName(drive, qpqConfig);
|
|
60
70
|
const root = path.resolve(fileStorageConfig.storagePath, service, drive);
|
|
61
71
|
// Block absolute paths and null bytes outright
|
|
62
72
|
if (path.isAbsolute(filepath)) {
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
-
export * from './claudeAi';
|
|
3
|
-
export * from './config';
|
|
4
|
-
export * from './context';
|
|
5
|
-
export * from './date';
|
|
6
|
-
export * from './error';
|
|
7
|
-
export * from './guid';
|
|
8
2
|
export * from './inlineFunction';
|
|
9
|
-
export * from './log';
|
|
10
|
-
export * from './math';
|
|
11
|
-
export * from './network';
|
|
12
|
-
export * from './platform';
|
|
13
3
|
export * from './stream';
|
|
14
|
-
export * from './system';
|
|
15
|
-
export * from './customActions';
|
|
16
4
|
export declare const getCoreActionProcessor: ActionProcessorListResolver;
|
|
@@ -1,43 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getConfigActionProcessor } from './config';
|
|
3
|
-
import { getContextActionProcessor } from './context';
|
|
4
|
-
import { getDateActionProcessor } from './date';
|
|
5
|
-
import { getErrorActionProcessor } from './error';
|
|
6
|
-
import { getGuidProcessor } from './guid';
|
|
1
|
+
import { getCoreActionProcessor as getJsCoreActionProcessor } from 'quidproquo-actionprocessor-js';
|
|
7
2
|
import { getInlineFunctionActionProcessor } from './inlineFunction';
|
|
8
|
-
import { getLogActionProcessor } from './log';
|
|
9
|
-
import { getMathActionProcessor } from './math';
|
|
10
|
-
import { getNetworkActionProcessor } from './network';
|
|
11
|
-
import { getPlatformActionProcessor } from './platform';
|
|
12
3
|
import { getStreamActionProcessor } from './stream';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export * from './date';
|
|
18
|
-
export * from './error';
|
|
19
|
-
export * from './guid';
|
|
4
|
+
// The shared core processors (config, context, claudeAi, date, error, guid, log,
|
|
5
|
+
// math, network, platform, system, customActions) are owned by
|
|
6
|
+
// quidproquo-actionprocessor-js. Node builds on top of js and only adds the
|
|
7
|
+
// processors that need a Node runtime (stream, inlineFunction).
|
|
20
8
|
export * from './inlineFunction';
|
|
21
|
-
export * from './log';
|
|
22
|
-
export * from './math';
|
|
23
|
-
export * from './network';
|
|
24
|
-
export * from './platform';
|
|
25
9
|
export * from './stream';
|
|
26
|
-
export * from './system';
|
|
27
|
-
// Custom actions is not done here, as it has to be done last after all
|
|
28
|
-
export * from './customActions';
|
|
29
10
|
export const getCoreActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
30
|
-
...(await
|
|
31
|
-
...(await getContextActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
32
|
-
...(await getClaudeAiActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
33
|
-
...(await getDateActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
34
|
-
...(await getErrorActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
35
|
-
...(await getGuidProcessor(qpqConfig, dynamicModuleLoader)),
|
|
36
|
-
...(await getLogActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
37
|
-
...(await getMathActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
38
|
-
...(await getNetworkActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
39
|
-
...(await getPlatformActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
11
|
+
...(await getJsCoreActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
40
12
|
...(await getStreamActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
41
|
-
...(await getSystemActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
42
13
|
...(await getInlineFunctionActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
43
14
|
});
|
package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js
CHANGED
|
@@ -15,6 +15,7 @@ const getProcessExecute = (qpqConfig) => {
|
|
|
15
15
|
}
|
|
16
16
|
const resolveStory = createRuntime(qpqConfig, {
|
|
17
17
|
context: session.context,
|
|
18
|
+
localContext: session.localContext,
|
|
18
19
|
depth: (session.depth || 0) + 1,
|
|
19
20
|
decodedAccessToken: session.decodedAccessToken,
|
|
20
21
|
correlation: session.correlation,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getWebserverActionProcessor as getJsWebserverActionProcessor } from 'quidproquo-actionprocessor-js';
|
|
2
|
+
// The shared webserver processors (dns, ...) are owned by quidproquo-actionprocessor-js.
|
|
3
|
+
// Node builds on top of js; it currently adds no node-specific webserver processors.
|
|
2
4
|
export const getWebserverActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
3
|
-
...(await
|
|
5
|
+
...(await getJsWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
6
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType,
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType, FileDeleteErrorTypeEnum, } from 'quidproquo-core';
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
3
|
import { resolveFilePath } from './utils';
|
|
4
4
|
const getProcessFileDelete = (qpqConfig, config) => {
|
|
5
|
-
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
6
5
|
return async ({ drive, filepaths }) => {
|
|
7
6
|
const deletedFiles = [];
|
|
8
7
|
const errors = [];
|
|
9
8
|
for (const filepath of filepaths) {
|
|
10
9
|
try {
|
|
11
|
-
const fullPath = resolveFilePath(config,
|
|
10
|
+
const fullPath = resolveFilePath(config, qpqConfig, drive, filepath);
|
|
12
11
|
await fs.unlink(fullPath);
|
|
13
12
|
deletedFiles.push(filepath);
|
|
14
13
|
}
|
|
@@ -18,12 +17,16 @@ const getProcessFileDelete = (qpqConfig, config) => {
|
|
|
18
17
|
deletedFiles.push(filepath);
|
|
19
18
|
}
|
|
20
19
|
else {
|
|
21
|
-
errors.push(
|
|
20
|
+
errors.push({ filepath, error });
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
if (errors.length > 0 && deletedFiles.length === 0) {
|
|
26
|
-
|
|
25
|
+
// EACCES maps to the same typed error the S3 processor returns for AccessDenied
|
|
26
|
+
if (errors.some(({ error }) => error.code === 'EACCES')) {
|
|
27
|
+
return actionResultError(FileDeleteErrorTypeEnum.AccessDenied, 'Access denied deleting files');
|
|
28
|
+
}
|
|
29
|
+
return actionResultError(ErrorTypeEnum.GenericError, `Failed to delete files: ${errors.map(({ filepath, error }) => `Failed to delete ${filepath}: ${error.message}`).join(', ')}`);
|
|
27
30
|
}
|
|
28
31
|
return actionResult(deletedFiles);
|
|
29
32
|
};
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType,
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType, FileExistsErrorTypeEnum, } from 'quidproquo-core';
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
3
|
import { resolveFilePath } from './utils';
|
|
4
4
|
const getProcessFileExists = (qpqConfig, config) => {
|
|
5
|
-
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
6
5
|
return async ({ drive, filepath }) => {
|
|
7
6
|
try {
|
|
8
|
-
const fullPath = resolveFilePath(config,
|
|
7
|
+
const fullPath = resolveFilePath(config, qpqConfig, drive, filepath);
|
|
9
8
|
try {
|
|
10
9
|
await fs.access(fullPath);
|
|
11
10
|
return actionResult(true);
|
|
12
11
|
}
|
|
13
|
-
catch {
|
|
14
|
-
|
|
12
|
+
catch (error) {
|
|
13
|
+
// Missing file is a definitive false; permission problems must surface.
|
|
14
|
+
if (error.code === 'ENOENT') {
|
|
15
|
+
return actionResult(false);
|
|
16
|
+
}
|
|
17
|
+
if (error.code === 'EACCES') {
|
|
18
|
+
return actionResultError(FileExistsErrorTypeEnum.AccessDenied, `Access denied checking file existence: ${filepath}`);
|
|
19
|
+
}
|
|
20
|
+
throw error;
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
catch (error) {
|
package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType,
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType, } from 'quidproquo-core';
|
|
2
2
|
import { createSecureUrlToken, getSecureUrlBaseUrl } from './secureUrlUtils';
|
|
3
3
|
import { resolveFilePath } from './utils';
|
|
4
4
|
const getProcessFileGenerateTemporarySecureUrl = (qpqConfig, config) => {
|
|
5
|
-
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
6
5
|
return async ({ drive, filepath, expirationMs }) => {
|
|
7
6
|
try {
|
|
8
7
|
// Create a token for download
|
|
9
8
|
const token = createSecureUrlToken({
|
|
10
|
-
fullFilepath: resolveFilePath(config,
|
|
9
|
+
fullFilepath: resolveFilePath(config, qpqConfig, drive, filepath),
|
|
11
10
|
operation: 'download',
|
|
12
11
|
expiresAt: Date.now() + expirationMs,
|
|
13
12
|
}, config.secureUrlSecret);
|