@forzalabs/remora 1.0.18 → 1.0.20
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/Constants.js +1 -1
- package/actions/deploy.js +3 -2
- package/actions/run.js +2 -1
- package/database/DatabaseEngine.js +2 -1
- package/definitions/ProcessENV.js +2 -0
- package/definitions/json_schemas/producer-schema.json +13 -0
- package/drivers/files/LocalSourceDriver.js +6 -6
- package/engines/CryptoEngine.js +2 -1
- package/engines/ProcessENVManager.js +83 -0
- package/engines/SecretManager.js +5 -1
- package/engines/ai/LLM.js +2 -1
- package/engines/parsing/LineParser.js +1 -1
- package/engines/parsing/ParseCompression.js +24 -11
- package/engines/scheduler/QueueManager.js +6 -5
- package/executors/ExecutorOrchestrator.js +4 -2
- package/helper/Helper.js +5 -1
- package/index.js +2 -1
- package/package.json +1 -1
package/Constants.js
CHANGED
package/actions/deploy.js
CHANGED
|
@@ -18,6 +18,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
18
18
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const Constants_1 = __importDefault(require("../Constants"));
|
|
21
|
+
const ProcessENVManager_1 = __importDefault(require("../engines/ProcessENVManager"));
|
|
21
22
|
const deploy = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
console.log(chalk_1.default.blue.bold(`🚀 Deploying to ${options.env}...`));
|
|
23
24
|
try {
|
|
@@ -50,14 +51,14 @@ const deploy = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
50
51
|
try {
|
|
51
52
|
// Read the zip file as a buffer
|
|
52
53
|
const zipBuffer = fs_1.default.readFileSync(tempZipPath);
|
|
53
|
-
const host =
|
|
54
|
+
const host = ProcessENVManager_1.default.getEnvVariable('REMORA_WORKER_HOST');
|
|
54
55
|
const version = Constants_1.default.workerVersion;
|
|
55
56
|
const workerAPI = `${host}/cli/v${version}/uploaddeployment`;
|
|
56
57
|
const formData = new FormData();
|
|
57
58
|
// @ts-ignore
|
|
58
59
|
const blob = new Blob([zipBuffer], { type: 'application/zip' });
|
|
59
60
|
formData.append('remora_config', blob, 'temp_deployment.zip'); // Updated to match the actual file name
|
|
60
|
-
const apiKey =
|
|
61
|
+
const apiKey = ProcessENVManager_1.default.getEnvVariable('REMORA_LICENCE_KEY');
|
|
61
62
|
if (!apiKey)
|
|
62
63
|
throw new Error('REMORA_LICENCE_KEY environment variable is not set');
|
|
63
64
|
const response = yield fetch(workerAPI, {
|
package/actions/run.js
CHANGED
|
@@ -19,6 +19,7 @@ const compile_1 = require("./compile");
|
|
|
19
19
|
const Helper_1 = __importDefault(require("../helper/Helper"));
|
|
20
20
|
const LicenceManager_1 = __importDefault(require("../licencing/LicenceManager"));
|
|
21
21
|
const ExecutorOrchestrator_1 = __importDefault(require("../executors/ExecutorOrchestrator"));
|
|
22
|
+
const ProcessENVManager_1 = __importDefault(require("../engines/ProcessENVManager"));
|
|
22
23
|
const run = (consumerName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
24
|
try {
|
|
24
25
|
(0, compile_1.compile)();
|
|
@@ -49,7 +50,7 @@ const run = (consumerName, options) => __awaiter(void 0, void 0, void 0, functio
|
|
|
49
50
|
for (let i = 0; i < consumersToExecute.length; i++) {
|
|
50
51
|
const consumer = consumersToExecute[i];
|
|
51
52
|
try {
|
|
52
|
-
const remoraLicenceKey =
|
|
53
|
+
const remoraLicenceKey = ProcessENVManager_1.default.getEnvVariable('REMORA_LICENCE_KEY');
|
|
53
54
|
const check = LicenceManager_1.default.validate(remoraLicenceKey);
|
|
54
55
|
if (!check.valid) {
|
|
55
56
|
console.error(`Invalid Remora licence key, the product is not active: remember to set "REMORA_LICENCE_KEY" environment variable.`);
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const mongodb_1 = require("mongodb");
|
|
16
16
|
const Helper_1 = __importDefault(require("../helper/Helper"));
|
|
17
17
|
const Settings_1 = __importDefault(require("../helper/Settings"));
|
|
18
|
+
const ProcessENVManager_1 = __importDefault(require("../engines/ProcessENVManager"));
|
|
18
19
|
class DatabaseEngineClass {
|
|
19
20
|
constructor() {
|
|
20
21
|
this.MAX_TRY_CONNECTION = 3;
|
|
@@ -23,7 +24,7 @@ class DatabaseEngineClass {
|
|
|
23
24
|
// WARNING: this was changed during the deployment to ECS...
|
|
24
25
|
// I've reverted it, but maybe it needs to be changed or looked into...
|
|
25
26
|
var _a;
|
|
26
|
-
this._uri = ((_a =
|
|
27
|
+
this._uri = ((_a = ProcessENVManager_1.default.getEnvVariable('MONGO_URI')) !== null && _a !== void 0 ? _a : Helper_1.default.isDev())
|
|
27
28
|
? 'mongodb://mongo:27017/remora'
|
|
28
29
|
: 'mongodb://localhost:27017/remora';
|
|
29
30
|
this._client = new mongodb_1.MongoClient(this._uri);
|
|
@@ -118,6 +118,15 @@
|
|
|
118
118
|
},
|
|
119
119
|
"settings": {
|
|
120
120
|
"type": "object",
|
|
121
|
+
"compressionType": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"enum": [
|
|
124
|
+
"GZ",
|
|
125
|
+
"TAR",
|
|
126
|
+
"ZIP"
|
|
127
|
+
],
|
|
128
|
+
"description": "The compression type used from the file to read"
|
|
129
|
+
},
|
|
121
130
|
"description": "Settings for the producer",
|
|
122
131
|
"properties": {
|
|
123
132
|
"sqlTable": {
|
|
@@ -200,6 +209,10 @@
|
|
|
200
209
|
{
|
|
201
210
|
"name": "email",
|
|
202
211
|
"type": "string",
|
|
212
|
+
"format": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "Format for datetype of the source ('YYYYMMDD', 'DD-MM-YYYY')"
|
|
215
|
+
},
|
|
203
216
|
"classification": [
|
|
204
217
|
"PII",
|
|
205
218
|
"GDPR"
|
|
@@ -386,17 +386,17 @@ class LocalSourceDriver {
|
|
|
386
386
|
const allFileKeys = this.listFiles(fileKey);
|
|
387
387
|
const allFilePaths = [];
|
|
388
388
|
for (const fileKey of allFileKeys) {
|
|
389
|
-
const
|
|
390
|
-
ExecutorScope_1.default.ensurePath(
|
|
391
|
-
yield ParseCompression_1.default.decompressToFile(compressionType, fileKey, this._path,
|
|
389
|
+
const executionPath = ExecutorScope_1.default.getProducerPath(scope, producer, fileKey);
|
|
390
|
+
ExecutorScope_1.default.ensurePath(executionPath);
|
|
391
|
+
const localPath = yield ParseCompression_1.default.decompressToFile(compressionType, fileKey, this._path, executionPath);
|
|
392
392
|
allFilePaths.push(localPath);
|
|
393
393
|
}
|
|
394
394
|
return { files: allFilePaths.map(x => ({ fullUri: x })) };
|
|
395
395
|
}
|
|
396
396
|
else {
|
|
397
|
-
const
|
|
398
|
-
ExecutorScope_1.default.ensurePath(
|
|
399
|
-
yield ParseCompression_1.default.decompressToFile(compressionType, fileKey, this._path,
|
|
397
|
+
const executionPath = ExecutorScope_1.default.getProducerPath(scope, producer, fileKey);
|
|
398
|
+
ExecutorScope_1.default.ensurePath(executionPath);
|
|
399
|
+
const localPath = yield ParseCompression_1.default.decompressToFile(compressionType, fileKey, this._path, executionPath);
|
|
400
400
|
return { files: [{ fullUri: localPath }] };
|
|
401
401
|
}
|
|
402
402
|
});
|
package/engines/CryptoEngine.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const crypto_1 = __importDefault(require("crypto"));
|
|
7
7
|
const Algo_1 = __importDefault(require("../core/Algo"));
|
|
8
8
|
const RandomEngine_1 = __importDefault(require("./RandomEngine"));
|
|
9
|
+
const ProcessENVManager_1 = __importDefault(require("./ProcessENVManager"));
|
|
9
10
|
class CryptoEngineClass {
|
|
10
11
|
constructor() {
|
|
11
12
|
var _a;
|
|
@@ -67,7 +68,7 @@ class CryptoEngineClass {
|
|
|
67
68
|
throw new Error(`This type doesn't exist`);
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
|
-
this._salt = (_a =
|
|
71
|
+
this._salt = (_a = ProcessENVManager_1.default.getEnvVariable('REMORA_SALT')) !== null && _a !== void 0 ? _a : '';
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
const CryptoEngine = new CryptoEngineClass();
|
|
@@ -0,0 +1,83 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const process_1 = __importDefault(require("process"));
|
|
41
|
+
const Affirm_1 = __importDefault(require("../core/Affirm"));
|
|
42
|
+
class ProcessENVManagerClass {
|
|
43
|
+
constructor() {
|
|
44
|
+
/**
|
|
45
|
+
* All the variables foundamental for operativity of remora
|
|
46
|
+
*/
|
|
47
|
+
this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES = ['REMORA_LICENCE_KEY'];
|
|
48
|
+
/**
|
|
49
|
+
* All the variables that are not foundamental for the operativity of remora
|
|
50
|
+
*/
|
|
51
|
+
this.ENVIRONMENT_VARIABLES = ['REMORA_KEY_SECRET_FILE', 'REMORA_WORKERS_PATH', 'ADMIN_JWT_SECRET_FILE', 'JWT_SECRET_FILE', 'ROOT_TEMP_PASSWORD_FILE', 'REMORA_WORKER_HOST', 'MONGO_URI', 'REMORA_SALT', 'OPENAI_API_KEY', 'AWS_DEFAULT_REGION', 'AWS_ACCOUNT_ID', 'AWS_ACCESS_KEY_ID', 'AWS_SESSION_TOKEN', 'NODE_ENV'];
|
|
52
|
+
/**
|
|
53
|
+
* get the value of an environment variable and give an error/warn if not implemented.
|
|
54
|
+
* @param variable the string text of the environment varible desired
|
|
55
|
+
* @returns the value of environment variable
|
|
56
|
+
*/
|
|
57
|
+
this.getEnvVariable = (variable) => {
|
|
58
|
+
(0, Affirm_1.default)(variable, `Cannot read an undefined variable`);
|
|
59
|
+
if (!this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES.includes(variable) && !this.ENVIRONMENT_VARIABLES.includes(variable)) {
|
|
60
|
+
console.warn(`Trying to read a variable that is not implemented: ${variable}`);
|
|
61
|
+
}
|
|
62
|
+
if (!process_1.default.env[variable] && this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES.includes(variable)) {
|
|
63
|
+
throw new Error(`Missing necessary property for ${variable}`);
|
|
64
|
+
}
|
|
65
|
+
else if (!process_1.default.env[variable]) {
|
|
66
|
+
// give a warn if it's not neccessary for the operativity of remora
|
|
67
|
+
console.warn(`Missing property for ${variable}`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
// checks if the property is a path of the docker secrets manager
|
|
71
|
+
if (process_1.default.env[variable]) {
|
|
72
|
+
if (process_1.default.env[variable].includes('run/secrets/') && process_1.default.env[variable]) {
|
|
73
|
+
return fs.readFileSync(process_1.default.env[variable], 'utf-8');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return process_1.default.env[variable];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const ProcessENVManager = new ProcessENVManagerClass();
|
|
83
|
+
exports.default = ProcessENVManager;
|
package/engines/SecretManager.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ProcessENVManager_1 = __importDefault(require("./ProcessENVManager"));
|
|
3
7
|
class SecretManagerClass {
|
|
4
8
|
constructor() {
|
|
5
9
|
/**
|
|
@@ -11,7 +15,7 @@ class SecretManagerClass {
|
|
|
11
15
|
if (!value || value.length <= 2 || !value.startsWith('{') || !value.endsWith('}'))
|
|
12
16
|
return value;
|
|
13
17
|
const parsedValue = value.slice(1, value.length - 1);
|
|
14
|
-
return
|
|
18
|
+
return ProcessENVManager_1.default.getEnvVariable(parsedValue);
|
|
15
19
|
};
|
|
16
20
|
}
|
|
17
21
|
}
|
package/engines/ai/LLM.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const openai_1 = __importDefault(require("openai"));
|
|
16
16
|
const zod_1 = require("openai/helpers/zod");
|
|
17
17
|
const zod_2 = require("zod");
|
|
18
|
+
const ProcessENVManager_1 = __importDefault(require("../ProcessENVManager"));
|
|
18
19
|
const baseProducersSystemPrompt = `
|
|
19
20
|
# TASK
|
|
20
21
|
You are an agent tasked with creating the mapping between an INPUT DATA SPEC and one or more OUTPUT DATA SPEC.
|
|
@@ -247,7 +248,7 @@ class LLM {
|
|
|
247
248
|
return finalDraft;
|
|
248
249
|
});
|
|
249
250
|
this._client = new openai_1.default({
|
|
250
|
-
apiKey:
|
|
251
|
+
apiKey: ProcessENVManager_1.default.getEnvVariable('OPENAI_API_KEY')
|
|
251
252
|
});
|
|
252
253
|
}
|
|
253
254
|
}
|
|
@@ -23,7 +23,7 @@ class LineParserClass {
|
|
|
23
23
|
counter = performance.now();
|
|
24
24
|
const value = {};
|
|
25
25
|
for (const dim of dimensions) {
|
|
26
|
-
value[dim.name] = TypeCaster_1.default.cast(parts[dim.index], dim.prodDimension.type);
|
|
26
|
+
value[dim.name] = TypeCaster_1.default.cast(parts[dim.index], dim.prodDimension.type, dim.prodDimension.format);
|
|
27
27
|
}
|
|
28
28
|
tracker.measure('process-line:cast&build-record', performance.now() - counter);
|
|
29
29
|
return value;
|
|
@@ -52,29 +52,42 @@ const path_1 = __importDefault(require("path"));
|
|
|
52
52
|
const promises_1 = require("stream/promises");
|
|
53
53
|
class ParseCompressionClass {
|
|
54
54
|
constructor() {
|
|
55
|
-
this.decompressToFile = (compressionType, fileKey, standardPath,
|
|
55
|
+
this.decompressToFile = (compressionType, fileKey, standardPath, executionPath) => __awaiter(this, void 0, void 0, function* () {
|
|
56
56
|
// Ensure the directory for the file exists
|
|
57
|
-
const fileDir = path_1.default.dirname(
|
|
57
|
+
const fileDir = path_1.default.dirname(executionPath);
|
|
58
58
|
if (!fs.existsSync(fileDir)) {
|
|
59
59
|
fs.mkdirSync(fileDir, { recursive: true });
|
|
60
60
|
}
|
|
61
61
|
switch (compressionType === null || compressionType === void 0 ? void 0 : compressionType.toUpperCase()) {
|
|
62
62
|
case 'ZIP':
|
|
63
|
-
case 'TAR':
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
case 'TAR': {
|
|
64
|
+
this._warningPossibleConvertionError(compressionType, fileKey);
|
|
65
|
+
yield (0, decompress_1.default)(path_1.default.join(standardPath, fileKey), executionPath);
|
|
66
|
+
return executionPath;
|
|
67
|
+
}
|
|
68
|
+
case 'GZ': {
|
|
69
|
+
this._warningPossibleConvertionError(compressionType, fileKey);
|
|
70
|
+
yield this._gzipFile(fileKey, standardPath, executionPath);
|
|
71
|
+
return executionPath;
|
|
72
|
+
}
|
|
69
73
|
case null:
|
|
70
|
-
case undefined:
|
|
74
|
+
case undefined: {
|
|
75
|
+
if (fileKey.includes('.zip') || fileKey.includes('.tar') || fileKey.includes('.gz'))
|
|
76
|
+
console.log(`The file ${fileKey} seems to use a compressionType while there are no producer settings for compressionType `);
|
|
71
77
|
// No decompression needed for request
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
return path_1.default.join(standardPath, fileKey);
|
|
79
|
+
}
|
|
80
|
+
default: {
|
|
74
81
|
// throw an error if the request ask for an unsupported compression type
|
|
75
82
|
throw new Error(`this compression type it has not been implemented ${compressionType}`);
|
|
83
|
+
}
|
|
76
84
|
}
|
|
77
85
|
});
|
|
86
|
+
this._warningPossibleConvertionError = (compression, fileKey) => {
|
|
87
|
+
if (!fileKey.split('.').includes(compression.toLowerCase()) && compression) {
|
|
88
|
+
console.warn(`The compressionType ${compression.toUpperCase()} seems different to the file compression of ${fileKey}`);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
78
91
|
this._gzipFile = (fileKey, standardPath, localPath) => __awaiter(this, void 0, void 0, function* () {
|
|
79
92
|
const fileContents = fs.createReadStream(path_1.default.join(standardPath, fileKey));
|
|
80
93
|
const unzip = zlib_1.default.createGunzip();
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
16
16
|
const Environment_1 = __importDefault(require("../Environment"));
|
|
17
|
+
const ProcessENVManager_1 = __importDefault(require("../ProcessENVManager"));
|
|
17
18
|
const SecretManager_1 = __importDefault(require("../SecretManager"));
|
|
18
19
|
const ExecutorOrchestrator_1 = __importDefault(require("../../executors/ExecutorOrchestrator"));
|
|
19
20
|
const settings_1 = require("../../settings");
|
|
@@ -100,8 +101,8 @@ class QueueManager {
|
|
|
100
101
|
let queueUrl = triggerValue;
|
|
101
102
|
// If it's not a full URL, construct it
|
|
102
103
|
if (!queueUrl.startsWith('https://')) {
|
|
103
|
-
const region = (metadata === null || metadata === void 0 ? void 0 : metadata.region) ||
|
|
104
|
-
const accountId = (metadata === null || metadata === void 0 ? void 0 : metadata.accountId) ||
|
|
104
|
+
const region = (metadata === null || metadata === void 0 ? void 0 : metadata.region) || ProcessENVManager_1.default.getEnvVariable('AWS_DEFAULT_REGION') || 'us-east-1';
|
|
105
|
+
const accountId = (metadata === null || metadata === void 0 ? void 0 : metadata.accountId) || ProcessENVManager_1.default.getEnvVariable('AWS_ACCOUNT_ID');
|
|
105
106
|
if (!accountId) {
|
|
106
107
|
throw new Error('AWS Account ID is required for queue trigger. Set it in metadata.accountId or AWS_ACCOUNT_ID environment variable');
|
|
107
108
|
}
|
|
@@ -112,9 +113,9 @@ class QueueManager {
|
|
|
112
113
|
const region = (metadata === null || metadata === void 0 ? void 0 : metadata.region) || (urlParts === null || urlParts === void 0 ? void 0 : urlParts[1]) || 'us-east-1';
|
|
113
114
|
// Get credentials from metadata or environment
|
|
114
115
|
let credentials;
|
|
115
|
-
const accessKeyId = (metadata === null || metadata === void 0 ? void 0 : metadata.accessKeyId) ||
|
|
116
|
-
const secretAccessKey = (metadata === null || metadata === void 0 ? void 0 : metadata.secretAccessKey) ||
|
|
117
|
-
const sessionToken = (metadata === null || metadata === void 0 ? void 0 : metadata.sessionToken) ||
|
|
116
|
+
const accessKeyId = (metadata === null || metadata === void 0 ? void 0 : metadata.accessKeyId) || ProcessENVManager_1.default.getEnvVariable('AWS_ACCESS_KEY_ID');
|
|
117
|
+
const secretAccessKey = (metadata === null || metadata === void 0 ? void 0 : metadata.secretAccessKey) || ProcessENVManager_1.default.getEnvVariable('AWS_SECRET_ACCESS_KEY');
|
|
118
|
+
const sessionToken = (metadata === null || metadata === void 0 ? void 0 : metadata.sessionToken) || ProcessENVManager_1.default.getEnvVariable('AWS_SESSION_TOKEN');
|
|
118
119
|
if (accessKeyId && secretAccessKey) {
|
|
119
120
|
credentials = {
|
|
120
121
|
accessKeyId: SecretManager_1.default.replaceSecret(accessKeyId),
|
|
@@ -33,6 +33,7 @@ const ExecutorProgress_1 = __importDefault(require("./ExecutorProgress"));
|
|
|
33
33
|
const Algo_1 = __importDefault(require("../core/Algo"));
|
|
34
34
|
const ConsumerOnFinishManager_1 = __importDefault(require("../engines/consumer/ConsumerOnFinishManager"));
|
|
35
35
|
const ExecutorScope_1 = __importDefault(require("./ExecutorScope"));
|
|
36
|
+
const ProcessENVManager_1 = __importDefault(require("../engines/ProcessENVManager"));
|
|
36
37
|
class ExecutorOrchestratorClass {
|
|
37
38
|
constructor() {
|
|
38
39
|
this.init = () => {
|
|
@@ -75,6 +76,7 @@ class ExecutorOrchestratorClass {
|
|
|
75
76
|
else if (cProd.isOptional === true)
|
|
76
77
|
continue;
|
|
77
78
|
}
|
|
79
|
+
console.log('Starting operations on ', response.files[0].fullUri);
|
|
78
80
|
// Extract the dimensions for this producer just once
|
|
79
81
|
const firstLine = (yield DriverHelper_1.default.quickReadFile(response.files[0].fullUri, 1))[0];
|
|
80
82
|
const header = ProducerExecutor_1.default.processHeader(firstLine, prod);
|
|
@@ -234,9 +236,9 @@ class ExecutorOrchestratorClass {
|
|
|
234
236
|
this._getWorkerPath = () => {
|
|
235
237
|
// Get the current file's directory
|
|
236
238
|
const currentDir = __dirname;
|
|
237
|
-
if (
|
|
239
|
+
if (ProcessENVManager_1.default.getEnvVariable('NODE_ENV') === 'dev' || ProcessENVManager_1.default.getEnvVariable('NODE_ENV') === 'development')
|
|
238
240
|
return path_1.default.resolve('./.build/workers');
|
|
239
|
-
const forcedPath =
|
|
241
|
+
const forcedPath = ProcessENVManager_1.default.getEnvVariable('REMORA_WORKERS_PATH');
|
|
240
242
|
if (forcedPath && forcedPath.length > 0)
|
|
241
243
|
return path_1.default.join(__dirname, forcedPath);
|
|
242
244
|
// Check if we're in a published npm package (no .build in path)
|
package/helper/Helper.js
CHANGED
|
@@ -32,12 +32,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
const fs = __importStar(require("fs"));
|
|
37
40
|
const path = __importStar(require("path"));
|
|
38
41
|
const uuid_1 = require("uuid");
|
|
42
|
+
const ProcessENVManager_1 = __importDefault(require("../engines/ProcessENVManager"));
|
|
39
43
|
const Helper = {
|
|
40
|
-
isDev: () =>
|
|
44
|
+
isDev: () => ProcessENVManager_1.default.getEnvVariable('NODE_ENV') !== 'production',
|
|
41
45
|
uuid: () => (0, uuid_1.v4)(),
|
|
42
46
|
asError: (error) => error instanceof Error ? error : new Error(error),
|
|
43
47
|
readFile: (directory) => {
|
package/index.js
CHANGED
|
@@ -20,10 +20,11 @@ const Runtime_1 = __importDefault(require("./helper/Runtime"));
|
|
|
20
20
|
const automap_1 = require("./actions/automap");
|
|
21
21
|
const sample_1 = require("./actions/sample");
|
|
22
22
|
const mock_1 = require("./actions/mock");
|
|
23
|
+
const ProcessENVManager_1 = __importDefault(require("./engines/ProcessENVManager"));
|
|
23
24
|
dotenv_1.default.configDotenv();
|
|
24
25
|
const program = new commander_1.Command();
|
|
25
26
|
// Validate the remora licence
|
|
26
|
-
const remoraLicenceKey =
|
|
27
|
+
const remoraLicenceKey = ProcessENVManager_1.default.getEnvVariable('REMORA_LICENCE_KEY');
|
|
27
28
|
const check = LicenceManager_1.default.validate(remoraLicenceKey);
|
|
28
29
|
if (!check.valid) {
|
|
29
30
|
console.error(`Invalid Remora licence key, the product is not active: remember to set "REMORA_LICENCE_KEY" environment variable.`);
|