quidproquo-actionprocessor-node 0.0.256 → 0.0.258
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/dynamicActionProcessor/file/getFileDeleteActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileDeleteActionProcessor.js +81 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileExistsActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileExistsActionProcessor.js +72 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js +41 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +44 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.js +25 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js +98 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js +77 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js +74 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js +70 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js +70 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js +69 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.d.ts +3 -0
- package/lib/commonjs/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js +68 -0
- package/lib/commonjs/dynamicActionProcessor/file/index.d.ts +6 -0
- package/lib/commonjs/dynamicActionProcessor/file/index.js +48 -0
- package/lib/commonjs/dynamicActionProcessor/file/secureUrlUtils.d.ts +10 -0
- package/lib/commonjs/dynamicActionProcessor/file/secureUrlUtils.js +84 -0
- package/lib/commonjs/dynamicActionProcessor/file/types.d.ts +6 -0
- package/lib/commonjs/dynamicActionProcessor/file/types.js +2 -0
- package/lib/commonjs/dynamicActionProcessor/file/utils.d.ts +6 -0
- package/lib/commonjs/dynamicActionProcessor/file/utils.js +90 -0
- package/lib/commonjs/dynamicActionProcessor/index.d.ts +1 -0
- package/lib/commonjs/dynamicActionProcessor/index.js +17 -0
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +1 -0
- package/lib/esm/dynamicActionProcessor/file/getFileDeleteActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileDeleteActionProcessor.js +33 -0
- package/lib/esm/dynamicActionProcessor/file/getFileExistsActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileExistsActionProcessor.js +24 -0
- package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js +26 -0
- package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +29 -0
- package/lib/esm/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.js +10 -0
- package/lib/esm/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js +50 -0
- package/lib/esm/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js +29 -0
- package/lib/esm/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js +26 -0
- package/lib/esm/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js +22 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js +22 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js +21 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.d.ts +3 -0
- package/lib/esm/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js +20 -0
- package/lib/esm/dynamicActionProcessor/file/index.d.ts +6 -0
- package/lib/esm/dynamicActionProcessor/file/index.js +32 -0
- package/lib/esm/dynamicActionProcessor/file/secureUrlUtils.d.ts +10 -0
- package/lib/esm/dynamicActionProcessor/file/secureUrlUtils.js +45 -0
- package/lib/esm/dynamicActionProcessor/file/types.d.ts +6 -0
- package/lib/esm/dynamicActionProcessor/file/types.js +1 -0
- package/lib/esm/dynamicActionProcessor/file/utils.d.ts +6 -0
- package/lib/esm/dynamicActionProcessor/file/utils.js +41 -0
- package/lib/esm/dynamicActionProcessor/index.d.ts +1 -0
- package/lib/esm/dynamicActionProcessor/index.js +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.getFileWriteBinaryContentsActionProcessor = void 0;
|
|
46
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
47
|
+
const fs = __importStar(require("fs/promises"));
|
|
48
|
+
const utils_1 = require("./utils");
|
|
49
|
+
const getProcessFileWriteBinaryContents = (config) => (qpqConfig) => {
|
|
50
|
+
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, data }) {
|
|
52
|
+
try {
|
|
53
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, serviceName, drive, filepath);
|
|
54
|
+
yield (0, utils_1.ensureParentDirectoryExists)(fullPath);
|
|
55
|
+
// Convert QPQBinaryData to Buffer
|
|
56
|
+
const buffer = Buffer.from(data.base64Data, 'base64');
|
|
57
|
+
yield fs.writeFile(fullPath, buffer);
|
|
58
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error writing binary file: ${error.message}`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const getFileWriteBinaryContentsActionProcessor = (config) => (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
return ({
|
|
67
|
+
[quidproquo_core_1.FileActionType.WriteBinaryContents]: getProcessFileWriteBinaryContents(config)(qpqConfig),
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
exports.getFileWriteBinaryContentsActionProcessor = getFileWriteBinaryContentsActionProcessor;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.getFileWriteObjectJsonActionProcessor = void 0;
|
|
46
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
47
|
+
const fs = __importStar(require("fs/promises"));
|
|
48
|
+
const utils_1 = require("./utils");
|
|
49
|
+
const getProcessFileWriteObjectJson = (config) => (qpqConfig) => {
|
|
50
|
+
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, data }) {
|
|
52
|
+
try {
|
|
53
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, serviceName, drive, filepath);
|
|
54
|
+
yield (0, utils_1.ensureParentDirectoryExists)(fullPath);
|
|
55
|
+
const jsonString = JSON.stringify(data, null, 2);
|
|
56
|
+
yield fs.writeFile(fullPath, jsonString, 'utf8');
|
|
57
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error writing JSON file: ${error.message}`);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const getFileWriteObjectJsonActionProcessor = (config) => (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
return ({
|
|
66
|
+
[quidproquo_core_1.FileActionType.WriteObjectJson]: getProcessFileWriteObjectJson(config)(qpqConfig),
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
exports.getFileWriteObjectJsonActionProcessor = getFileWriteObjectJsonActionProcessor;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.getFileWriteTextContentsActionProcessor = void 0;
|
|
46
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
47
|
+
const fs = __importStar(require("fs/promises"));
|
|
48
|
+
const utils_1 = require("./utils");
|
|
49
|
+
const getProcessFileWriteTextContents = (qpqConfig, config) => {
|
|
50
|
+
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
51
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ drive, filepath, data }) {
|
|
52
|
+
try {
|
|
53
|
+
const fullPath = (0, utils_1.resolveFilePath)(config, serviceName, drive, filepath);
|
|
54
|
+
yield (0, utils_1.ensureParentDirectoryExists)(fullPath);
|
|
55
|
+
yield fs.writeFile(fullPath, data, 'utf8');
|
|
56
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, `Error writing file: ${error.message}`);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const getFileWriteTextContentsActionProcessor = (config) => (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
return ({
|
|
65
|
+
[quidproquo_core_1.FileActionType.WriteTextContents]: getProcessFileWriteTextContents(qpqConfig, config),
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
exports.getFileWriteTextContentsActionProcessor = getFileWriteTextContentsActionProcessor;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
import { FileStorageConfig } from './types';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export declare const getFileActionProcessor: (fileStorageConfig: FileStorageConfig) => ActionProcessorListResolver;
|
|
5
|
+
export * from "./secureUrlUtils";
|
|
6
|
+
export * from "./utils";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getFileActionProcessor = void 0;
|
|
27
|
+
const getFileDeleteActionProcessor_1 = require("./getFileDeleteActionProcessor");
|
|
28
|
+
const getFileExistsActionProcessor_1 = require("./getFileExistsActionProcessor");
|
|
29
|
+
const getFileGenerateTemporarySecureUrlActionProcessor_1 = require("./getFileGenerateTemporarySecureUrlActionProcessor");
|
|
30
|
+
const getFileGenerateTemporaryUploadSecureUrlActionProcessor_1 = require("./getFileGenerateTemporaryUploadSecureUrlActionProcessor");
|
|
31
|
+
const getFileIsColdStorageActionProcessor_1 = require("./getFileIsColdStorageActionProcessor");
|
|
32
|
+
const getFileListDirectoryActionProcessor_1 = require("./getFileListDirectoryActionProcessor");
|
|
33
|
+
const getFileReadBinaryContentsActionProcessor_1 = require("./getFileReadBinaryContentsActionProcessor");
|
|
34
|
+
const getFileReadObjectJsonActionProcessor_1 = require("./getFileReadObjectJsonActionProcessor");
|
|
35
|
+
const getFileReadTextContentsActionProcessor_1 = require("./getFileReadTextContentsActionProcessor");
|
|
36
|
+
const getFileWriteBinaryContentsActionProcessor_1 = require("./getFileWriteBinaryContentsActionProcessor");
|
|
37
|
+
const getFileWriteObjectJsonActionProcessor_1 = require("./getFileWriteObjectJsonActionProcessor");
|
|
38
|
+
const getFileWriteTextContentsActionProcessor_1 = require("./getFileWriteTextContentsActionProcessor");
|
|
39
|
+
__exportStar(require("./types"), exports);
|
|
40
|
+
// Main export that accepts configuration
|
|
41
|
+
const getFileActionProcessor = (fileStorageConfig) => {
|
|
42
|
+
return (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (yield (0, getFileReadTextContentsActionProcessor_1.getFileReadTextContentsActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileWriteTextContentsActionProcessor_1.getFileWriteTextContentsActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileReadObjectJsonActionProcessor_1.getFileReadObjectJsonActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileWriteObjectJsonActionProcessor_1.getFileWriteObjectJsonActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileReadBinaryContentsActionProcessor_1.getFileReadBinaryContentsActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileWriteBinaryContentsActionProcessor_1.getFileWriteBinaryContentsActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileListDirectoryActionProcessor_1.getFileListDirectoryActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileExistsActionProcessor_1.getFileExistsActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileDeleteActionProcessor_1.getFileDeleteActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileGenerateTemporarySecureUrlActionProcessor_1.getFileGenerateTemporarySecureUrlActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileGenerateTemporaryUploadSecureUrlActionProcessor_1.getFileGenerateTemporaryUploadSecureUrlActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))), (yield (0, getFileIsColdStorageActionProcessor_1.getFileIsColdStorageActionProcessor)(fileStorageConfig)(qpqConfig, dynamicModuleLoader))));
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.getFileActionProcessor = getFileActionProcessor;
|
|
47
|
+
__exportStar(require("./secureUrlUtils"), exports);
|
|
48
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileStorageConfig } from './types';
|
|
2
|
+
export interface SecureUrlToken {
|
|
3
|
+
fullFilepath: string;
|
|
4
|
+
operation: 'download' | 'upload';
|
|
5
|
+
expiresAt: number;
|
|
6
|
+
contentType?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const createSecureUrlToken: (token: SecureUrlToken, secret: string) => string;
|
|
9
|
+
export declare const verifySecureUrlToken: (tokenString: string, secret: string) => SecureUrlToken | null;
|
|
10
|
+
export declare const getSecureUrlBaseUrl: (config: FileStorageConfig) => string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getSecureUrlBaseUrl = exports.verifySecureUrlToken = exports.createSecureUrlToken = void 0;
|
|
37
|
+
const crypto = __importStar(require("crypto"));
|
|
38
|
+
// Create a signed token for secure URLs
|
|
39
|
+
const createSecureUrlToken = (token, secret) => {
|
|
40
|
+
const payload = JSON.stringify(token);
|
|
41
|
+
const payloadBase64 = Buffer.from(payload).toString('base64url');
|
|
42
|
+
// Create HMAC signature
|
|
43
|
+
const signature = crypto
|
|
44
|
+
.createHmac('sha256', secret)
|
|
45
|
+
.update(payloadBase64)
|
|
46
|
+
.digest('base64url');
|
|
47
|
+
// Return token as payload.signature
|
|
48
|
+
return `${payloadBase64}.${signature}`;
|
|
49
|
+
};
|
|
50
|
+
exports.createSecureUrlToken = createSecureUrlToken;
|
|
51
|
+
// Verify and decode a signed token
|
|
52
|
+
const verifySecureUrlToken = (tokenString, secret) => {
|
|
53
|
+
try {
|
|
54
|
+
const [payloadBase64, signature] = tokenString.split('.');
|
|
55
|
+
if (!payloadBase64 || !signature) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
// Verify signature
|
|
59
|
+
const expectedSignature = crypto
|
|
60
|
+
.createHmac('sha256', secret)
|
|
61
|
+
.update(payloadBase64)
|
|
62
|
+
.digest('base64url');
|
|
63
|
+
if (signature !== expectedSignature) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
// Decode payload
|
|
67
|
+
const payload = Buffer.from(payloadBase64, 'base64url').toString();
|
|
68
|
+
const token = JSON.parse(payload);
|
|
69
|
+
// Check expiration
|
|
70
|
+
if (token.expiresAt < Date.now()) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return token;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.verifySecureUrlToken = verifySecureUrlToken;
|
|
80
|
+
// Get the secure URL base URL
|
|
81
|
+
const getSecureUrlBaseUrl = (config) => {
|
|
82
|
+
return `http://${config.secureUrlHost}:${config.secureUrlPort}`;
|
|
83
|
+
};
|
|
84
|
+
exports.getSecureUrlBaseUrl = getSecureUrlBaseUrl;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { FileStorageConfig } from './types';
|
|
3
|
+
export declare const isStorageDriveNameValid: (drive: string, qpqConfig: QPQConfig) => boolean;
|
|
4
|
+
export declare function resolveFilePath(fileStorageConfig: FileStorageConfig, service: string, drive: string, filepath: string): string;
|
|
5
|
+
export declare const ensureDirectoryExists: (dirPath: string) => Promise<void>;
|
|
6
|
+
export declare const ensureParentDirectoryExists: (filePath: string) => Promise<void>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ensureParentDirectoryExists = exports.ensureDirectoryExists = exports.isStorageDriveNameValid = void 0;
|
|
46
|
+
exports.resolveFilePath = resolveFilePath;
|
|
47
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
48
|
+
const fs = __importStar(require("fs/promises"));
|
|
49
|
+
const path = __importStar(require("path"));
|
|
50
|
+
// Resolve a drive name to a filesystem path
|
|
51
|
+
const isStorageDriveNameValid = (drive, qpqConfig) => {
|
|
52
|
+
const storageDrive = quidproquo_core_1.qpqCoreUtils.getStorageDrives(qpqConfig).find((d) => d.storageDrive === drive);
|
|
53
|
+
if (!storageDrive) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
exports.isStorageDriveNameValid = isStorageDriveNameValid;
|
|
59
|
+
function resolveFilePath(fileStorageConfig, service, drive, filepath) {
|
|
60
|
+
const root = path.resolve(fileStorageConfig.storagePath, service, drive);
|
|
61
|
+
// Block absolute paths and null bytes outright
|
|
62
|
+
if (path.isAbsolute(filepath)) {
|
|
63
|
+
throw new Error('Absolute paths are not allowed.');
|
|
64
|
+
}
|
|
65
|
+
// Check for null to prevent directory traversal attacks in native libs
|
|
66
|
+
if (filepath.includes('\0')) {
|
|
67
|
+
throw new Error('Invalid path.');
|
|
68
|
+
}
|
|
69
|
+
// Normalize user input (collapses ., .., slashes)
|
|
70
|
+
const cleaned = path.normalize(filepath);
|
|
71
|
+
// Resolve against the root
|
|
72
|
+
const target = path.resolve(root, cleaned);
|
|
73
|
+
// Ensure target stays within root
|
|
74
|
+
const rel = path.relative(root, target);
|
|
75
|
+
if (rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel))) {
|
|
76
|
+
return target;
|
|
77
|
+
}
|
|
78
|
+
throw new Error('Invalid file path: escapes drive root.');
|
|
79
|
+
}
|
|
80
|
+
// Ensure a directory exists
|
|
81
|
+
const ensureDirectoryExists = (dirPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
yield fs.mkdir(dirPath, { recursive: true });
|
|
83
|
+
});
|
|
84
|
+
exports.ensureDirectoryExists = ensureDirectoryExists;
|
|
85
|
+
// Ensure the parent directory of a file exists
|
|
86
|
+
const ensureParentDirectoryExists = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
+
const parentDir = path.dirname(filePath);
|
|
88
|
+
yield (0, exports.ensureDirectoryExists)(parentDir);
|
|
89
|
+
});
|
|
90
|
+
exports.ensureParentDirectoryExists = ensureParentDirectoryExists;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./file"), exports);
|
package/lib/commonjs/index.d.ts
CHANGED
package/lib/commonjs/index.js
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType, qpqCoreUtils, } from 'quidproquo-core';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
|
+
import { resolveFilePath } from './utils';
|
|
4
|
+
const getProcessFileDelete = (qpqConfig, config) => {
|
|
5
|
+
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
6
|
+
return async ({ drive, filepaths }) => {
|
|
7
|
+
const deletedFiles = [];
|
|
8
|
+
const errors = [];
|
|
9
|
+
for (const filepath of filepaths) {
|
|
10
|
+
try {
|
|
11
|
+
const fullPath = resolveFilePath(config, serviceName, drive, filepath);
|
|
12
|
+
await fs.unlink(fullPath);
|
|
13
|
+
deletedFiles.push(filepath);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
// If file doesn't exist, consider it successfully deleted
|
|
17
|
+
if (error.code === 'ENOENT') {
|
|
18
|
+
deletedFiles.push(filepath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
errors.push(`Failed to delete ${filepath}: ${error.message}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (errors.length > 0 && deletedFiles.length === 0) {
|
|
26
|
+
return actionResultError(ErrorTypeEnum.GenericError, `Failed to delete files: ${errors.join(', ')}`);
|
|
27
|
+
}
|
|
28
|
+
return actionResult(deletedFiles);
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const getFileDeleteActionProcessor = (config) => async (qpqConfig) => ({
|
|
32
|
+
[FileActionType.Delete]: getProcessFileDelete(qpqConfig, config),
|
|
33
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType, qpqCoreUtils, } from 'quidproquo-core';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
|
+
import { resolveFilePath } from './utils';
|
|
4
|
+
const getProcessFileExists = (qpqConfig, config) => {
|
|
5
|
+
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
6
|
+
return async ({ drive, filepath }) => {
|
|
7
|
+
try {
|
|
8
|
+
const fullPath = resolveFilePath(config, serviceName, drive, filepath);
|
|
9
|
+
try {
|
|
10
|
+
await fs.access(fullPath);
|
|
11
|
+
return actionResult(true);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return actionResult(false);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return actionResultError(ErrorTypeEnum.GenericError, `Error checking file existence: ${error.message}`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export const getFileExistsActionProcessor = (config) => async (qpqConfig) => ({
|
|
23
|
+
[FileActionType.Exists]: getProcessFileExists(qpqConfig, config),
|
|
24
|
+
});
|
package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { actionResult, actionResultError, ErrorTypeEnum, FileActionType, qpqCoreUtils, } from 'quidproquo-core';
|
|
2
|
+
import { createSecureUrlToken, getSecureUrlBaseUrl } from './secureUrlUtils';
|
|
3
|
+
import { resolveFilePath } from './utils';
|
|
4
|
+
const getProcessFileGenerateTemporarySecureUrl = (qpqConfig, config) => {
|
|
5
|
+
const serviceName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
6
|
+
return async ({ drive, filepath, expirationMs }) => {
|
|
7
|
+
try {
|
|
8
|
+
// Create a token for download
|
|
9
|
+
const token = createSecureUrlToken({
|
|
10
|
+
fullFilepath: resolveFilePath(config, serviceName, drive, filepath),
|
|
11
|
+
operation: 'download',
|
|
12
|
+
expiresAt: Date.now() + expirationMs,
|
|
13
|
+
}, config.secureUrlSecret);
|
|
14
|
+
// Build the secure URL
|
|
15
|
+
const baseUrl = getSecureUrlBaseUrl(config);
|
|
16
|
+
const url = `${baseUrl}/secure-download?token=${token}`;
|
|
17
|
+
return actionResult(url);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return actionResultError(ErrorTypeEnum.GenericError, `Unable to generate temporary secure URL: ${error.message}`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export const getFileGenerateTemporarySecureUrlActionProcessor = (config) => async (qpqConfig) => ({
|
|
25
|
+
[FileActionType.GenerateTemporarySecureUrl]: getProcessFileGenerateTemporarySecureUrl(qpqConfig, config),
|
|
26
|
+
});
|