@forzalabs/remora 1.1.6 → 1.1.7
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/index.js +84 -77
- package/package.json +1 -1
- package/workers/ExecutorWorker.js +86 -77
package/index.js
CHANGED
|
@@ -13306,14 +13306,27 @@ var Logger = class {
|
|
|
13306
13306
|
constructor() {
|
|
13307
13307
|
this.setLevel = (level) => this._level = level;
|
|
13308
13308
|
this.enableFileLogging = (folder, file) => {
|
|
13309
|
+
this._fileLoggingFolder = folder;
|
|
13310
|
+
this._fileLoggingFile = file;
|
|
13309
13311
|
FileLogService_default.enable(folder, file);
|
|
13310
13312
|
console.log(`Enabled file logger.`);
|
|
13311
13313
|
};
|
|
13314
|
+
this.getConfig = () => ({
|
|
13315
|
+
level: this._level,
|
|
13316
|
+
fileLogging: FileLogService_default._enabled ? { folder: this._fileLoggingFolder, file: this._fileLoggingFile } : void 0
|
|
13317
|
+
});
|
|
13318
|
+
this.initFromConfig = (config) => {
|
|
13319
|
+
this._level = config.level;
|
|
13320
|
+
if (config.fileLogging)
|
|
13321
|
+
this.enableFileLogging(config.fileLogging.folder, config.fileLogging.file);
|
|
13322
|
+
};
|
|
13312
13323
|
this.log = (message, level) => {
|
|
13313
13324
|
const myLevel = level ?? this._level;
|
|
13314
13325
|
if (myLevel !== "debug") return;
|
|
13315
|
-
|
|
13316
|
-
|
|
13326
|
+
if (FileLogService_default._enabled)
|
|
13327
|
+
FileLogService_default.write("DEBUG", String(message));
|
|
13328
|
+
else
|
|
13329
|
+
console.log(import_chalk.default.cyanBright("DEBUG"), message);
|
|
13317
13330
|
};
|
|
13318
13331
|
this.info = (message) => {
|
|
13319
13332
|
console.info(message);
|
|
@@ -13448,7 +13461,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
13448
13461
|
|
|
13449
13462
|
// ../../packages/constants/src/Constants.ts
|
|
13450
13463
|
var CONSTANTS = {
|
|
13451
|
-
cliVersion: "1.1.
|
|
13464
|
+
cliVersion: "1.1.7",
|
|
13452
13465
|
backendVersion: 1,
|
|
13453
13466
|
backendPort: 5088,
|
|
13454
13467
|
workerVersion: 2,
|
|
@@ -18646,85 +18659,73 @@ var DeveloperEngineClass = class {
|
|
|
18646
18659
|
const record = {};
|
|
18647
18660
|
for (const dimension of dimensions) {
|
|
18648
18661
|
if (dimension.sourceFilename) continue;
|
|
18649
|
-
|
|
18662
|
+
const key = dimension.alias || dimension.name;
|
|
18663
|
+
record[key] = this.generateMockValue(dimension, i);
|
|
18650
18664
|
}
|
|
18651
18665
|
records.push(record);
|
|
18652
18666
|
}
|
|
18653
18667
|
return records;
|
|
18654
18668
|
};
|
|
18655
18669
|
this.generateMockValue = (dimension, index) => {
|
|
18656
|
-
const { name, type } = dimension;
|
|
18670
|
+
const { name, type, format: format2, pk } = dimension;
|
|
18657
18671
|
const nameLower = name.toLowerCase();
|
|
18658
|
-
if (
|
|
18672
|
+
if (pk) {
|
|
18673
|
+
if (type === "number") return index + 1;
|
|
18659
18674
|
return `${index + 1}`;
|
|
18660
18675
|
}
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18676
|
+
const contextual = this.generateContextualValue(nameLower, type, index);
|
|
18677
|
+
if (contextual !== void 0) return contextual;
|
|
18678
|
+
return this.generateValueByType(type, index, format2);
|
|
18679
|
+
};
|
|
18680
|
+
this.generateContextualValue = (nameLower, type, index) => {
|
|
18681
|
+
if (type === "string") {
|
|
18682
|
+
if (this.matchesPattern(nameLower, ["id", "identifier", "key", "pk"]))
|
|
18683
|
+
return `${index + 1}`;
|
|
18684
|
+
if (this.matchesPattern(nameLower, ["first_name", "firstname", "fname", "given_name"]))
|
|
18685
|
+
return this.pickRandom(["John", "Jane", "Michael", "Sarah", "David", "Emily", "Robert", "Lisa", "James", "Mary"]);
|
|
18686
|
+
if (this.matchesPattern(nameLower, ["last_name", "lastname", "lname", "surname", "family_name"]))
|
|
18687
|
+
return this.pickRandom(["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Martinez", "Wilson"]);
|
|
18688
|
+
if (this.matchesPattern(nameLower, ["name", "full_name", "fullname"])) {
|
|
18689
|
+
const firstNames = ["John", "Jane", "Michael", "Sarah", "David", "Emily"];
|
|
18690
|
+
const lastNames = ["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia"];
|
|
18691
|
+
return `${this.pickRandom(firstNames)} ${this.pickRandom(lastNames)}`;
|
|
18692
|
+
}
|
|
18693
|
+
if (this.matchesPattern(nameLower, ["email", "mail"]))
|
|
18694
|
+
return `user${index + 1}@example.com`;
|
|
18695
|
+
if (this.matchesPattern(nameLower, ["phone", "telephone", "mobile", "cell"]))
|
|
18696
|
+
return `555-${String(Math.floor(Math.random() * 900) + 100).padStart(3, "0")}-${String(Math.floor(Math.random() * 9e3) + 1e3).padStart(4, "0")}`;
|
|
18697
|
+
if (this.matchesPattern(nameLower, ["address", "street", "addr"])) {
|
|
18698
|
+
const streets = ["Main St", "Oak Ave", "Elm Dr", "Pine Rd", "Maple Ln", "Cedar Blvd"];
|
|
18699
|
+
return `${Math.floor(Math.random() * 9999) + 1} ${this.pickRandom(streets)}`;
|
|
18700
|
+
}
|
|
18701
|
+
if (this.matchesPattern(nameLower, ["city", "town"]))
|
|
18702
|
+
return this.pickRandom(["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio", "San Diego"]);
|
|
18703
|
+
if (this.matchesPattern(nameLower, ["state", "province"]))
|
|
18704
|
+
return this.pickRandom(["CA", "TX", "FL", "NY", "PA", "IL", "OH", "GA", "NC", "MI"]);
|
|
18705
|
+
if (this.matchesPattern(nameLower, ["zip", "postal", "zipcode"]))
|
|
18706
|
+
return String(Math.floor(Math.random() * 9e4) + 1e4);
|
|
18707
|
+
if (this.matchesPattern(nameLower, ["country"]))
|
|
18708
|
+
return this.pickRandom(["USA", "Canada", "UK", "Germany", "France", "Australia"]);
|
|
18709
|
+
if (this.matchesPattern(nameLower, ["sex", "gender"]))
|
|
18710
|
+
return this.pickRandom(["M", "F", "Male", "Female"]);
|
|
18711
|
+
if (this.matchesPattern(nameLower, ["status"]))
|
|
18712
|
+
return this.pickRandom(["active", "inactive", "pending", "completed", "cancelled"]);
|
|
18713
|
+
if (this.matchesPattern(nameLower, ["type", "category"]))
|
|
18714
|
+
return this.pickRandom(["TypeA", "TypeB", "TypeC", "TypeD"]);
|
|
18715
|
+
if (this.matchesPattern(nameLower, ["description", "desc", "notes", "comment"]))
|
|
18716
|
+
return `Sample description for record ${index + 1}`;
|
|
18717
|
+
}
|
|
18718
|
+
if (type === "number") {
|
|
18719
|
+
if (this.matchesPattern(nameLower, ["age", "years"]))
|
|
18720
|
+
return Math.floor(Math.random() * 80) + 18;
|
|
18721
|
+
if (this.matchesPattern(nameLower, ["amount", "price", "cost", "total", "balance"]))
|
|
18722
|
+
return parseFloat((Math.random() * 1e3).toFixed(2));
|
|
18723
|
+
if (this.matchesPattern(nameLower, ["quantity", "count", "qty"]))
|
|
18724
|
+
return Math.floor(Math.random() * 100) + 1;
|
|
18725
|
+
if (this.matchesPattern(nameLower, ["id", "identifier", "key", "pk"]))
|
|
18726
|
+
return index + 1;
|
|
18690
18727
|
}
|
|
18691
|
-
|
|
18692
|
-
return this.pickRandom(["USA", "Canada", "UK", "Germany", "France", "Australia"]);
|
|
18693
|
-
}
|
|
18694
|
-
if (this.matchesPattern(nameLower, ["age", "years"])) {
|
|
18695
|
-
return Math.floor(Math.random() * 80) + 18;
|
|
18696
|
-
}
|
|
18697
|
-
if (this.matchesPattern(nameLower, ["sex", "gender"])) {
|
|
18698
|
-
return this.pickRandom(["M", "F", "Male", "Female"]);
|
|
18699
|
-
}
|
|
18700
|
-
if (this.matchesPattern(nameLower, ["birth", "dob", "birthdate"])) {
|
|
18701
|
-
const year = Math.floor(Math.random() * 60) + 1940;
|
|
18702
|
-
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, "0");
|
|
18703
|
-
const day = String(Math.floor(Math.random() * 28) + 1).padStart(2, "0");
|
|
18704
|
-
return `${year}-${month}-${day}`;
|
|
18705
|
-
}
|
|
18706
|
-
if (this.matchesPattern(nameLower, ["date", "created", "updated", "timestamp"])) {
|
|
18707
|
-
const year = Math.floor(Math.random() * 5) + 2020;
|
|
18708
|
-
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, "0");
|
|
18709
|
-
const day = String(Math.floor(Math.random() * 28) + 1).padStart(2, "0");
|
|
18710
|
-
return `${year}-${month}-${day}`;
|
|
18711
|
-
}
|
|
18712
|
-
if (this.matchesPattern(nameLower, ["amount", "price", "cost", "total", "balance"])) {
|
|
18713
|
-
return (Math.random() * 1e3).toFixed(2);
|
|
18714
|
-
}
|
|
18715
|
-
if (this.matchesPattern(nameLower, ["quantity", "count", "qty"])) {
|
|
18716
|
-
return Math.floor(Math.random() * 100) + 1;
|
|
18717
|
-
}
|
|
18718
|
-
if (this.matchesPattern(nameLower, ["status"])) {
|
|
18719
|
-
return this.pickRandom(["active", "inactive", "pending", "completed", "cancelled"]);
|
|
18720
|
-
}
|
|
18721
|
-
if (this.matchesPattern(nameLower, ["type", "category"])) {
|
|
18722
|
-
return this.pickRandom(["TypeA", "TypeB", "TypeC", "TypeD"]);
|
|
18723
|
-
}
|
|
18724
|
-
if (this.matchesPattern(nameLower, ["description", "desc", "notes", "comment"])) {
|
|
18725
|
-
return `Sample description for record ${index + 1}`;
|
|
18726
|
-
}
|
|
18727
|
-
return this.generateValueByType(type, index);
|
|
18728
|
+
return void 0;
|
|
18728
18729
|
};
|
|
18729
18730
|
this.matchesPattern = (fieldName, patterns) => {
|
|
18730
18731
|
return patterns.some((pattern) => fieldName.includes(pattern));
|
|
@@ -18732,7 +18733,7 @@ var DeveloperEngineClass = class {
|
|
|
18732
18733
|
this.pickRandom = (arr) => {
|
|
18733
18734
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
18734
18735
|
};
|
|
18735
|
-
this.generateValueByType = (type, index) => {
|
|
18736
|
+
this.generateValueByType = (type, index, format2) => {
|
|
18736
18737
|
switch (type) {
|
|
18737
18738
|
case "string":
|
|
18738
18739
|
return `value_${index + 1}`;
|
|
@@ -18742,9 +18743,14 @@ var DeveloperEngineClass = class {
|
|
|
18742
18743
|
return Math.random() > 0.5;
|
|
18743
18744
|
case "datetime": {
|
|
18744
18745
|
const year = Math.floor(Math.random() * 5) + 2020;
|
|
18745
|
-
const month =
|
|
18746
|
-
const day =
|
|
18747
|
-
|
|
18746
|
+
const month = Math.floor(Math.random() * 12) + 1;
|
|
18747
|
+
const day = Math.floor(Math.random() * 28) + 1;
|
|
18748
|
+
const hour = Math.floor(Math.random() * 24);
|
|
18749
|
+
const minute = Math.floor(Math.random() * 60);
|
|
18750
|
+
const second = Math.floor(Math.random() * 60);
|
|
18751
|
+
const date = (0, import_dayjs2.default)(new Date(year, month - 1, day, hour, minute, second));
|
|
18752
|
+
if (format2) return date.format(format2);
|
|
18753
|
+
return date.format("YYYY-MM-DD");
|
|
18748
18754
|
}
|
|
18749
18755
|
default:
|
|
18750
18756
|
return `value_${index + 1}`;
|
|
@@ -20606,7 +20612,8 @@ var ExecutorOrchestratorClass = class {
|
|
|
20606
20612
|
prodDimensions,
|
|
20607
20613
|
workerId,
|
|
20608
20614
|
scope,
|
|
20609
|
-
options
|
|
20615
|
+
options,
|
|
20616
|
+
loggerConfig: Logger_default.getConfig()
|
|
20610
20617
|
};
|
|
20611
20618
|
_progress.register((currentWorkerIndex + 1).toString(), prod.name, fileIndex, totalFiles);
|
|
20612
20619
|
scope.workersId.push(workerId);
|
package/package.json
CHANGED
|
@@ -13300,14 +13300,27 @@ var Logger = class {
|
|
|
13300
13300
|
constructor() {
|
|
13301
13301
|
this.setLevel = (level) => this._level = level;
|
|
13302
13302
|
this.enableFileLogging = (folder, file) => {
|
|
13303
|
+
this._fileLoggingFolder = folder;
|
|
13304
|
+
this._fileLoggingFile = file;
|
|
13303
13305
|
FileLogService_default.enable(folder, file);
|
|
13304
13306
|
console.log(`Enabled file logger.`);
|
|
13305
13307
|
};
|
|
13308
|
+
this.getConfig = () => ({
|
|
13309
|
+
level: this._level,
|
|
13310
|
+
fileLogging: FileLogService_default._enabled ? { folder: this._fileLoggingFolder, file: this._fileLoggingFile } : void 0
|
|
13311
|
+
});
|
|
13312
|
+
this.initFromConfig = (config) => {
|
|
13313
|
+
this._level = config.level;
|
|
13314
|
+
if (config.fileLogging)
|
|
13315
|
+
this.enableFileLogging(config.fileLogging.folder, config.fileLogging.file);
|
|
13316
|
+
};
|
|
13306
13317
|
this.log = (message, level) => {
|
|
13307
13318
|
const myLevel = level ?? this._level;
|
|
13308
13319
|
if (myLevel !== "debug") return;
|
|
13309
|
-
|
|
13310
|
-
|
|
13320
|
+
if (FileLogService_default._enabled)
|
|
13321
|
+
FileLogService_default.write("DEBUG", String(message));
|
|
13322
|
+
else
|
|
13323
|
+
console.log(import_chalk.default.cyanBright("DEBUG"), message);
|
|
13311
13324
|
};
|
|
13312
13325
|
this.info = (message) => {
|
|
13313
13326
|
console.info(message);
|
|
@@ -13442,7 +13455,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
13442
13455
|
|
|
13443
13456
|
// ../../packages/constants/src/Constants.ts
|
|
13444
13457
|
var CONSTANTS = {
|
|
13445
|
-
cliVersion: "1.1.
|
|
13458
|
+
cliVersion: "1.1.7",
|
|
13446
13459
|
backendVersion: 1,
|
|
13447
13460
|
backendPort: 5088,
|
|
13448
13461
|
workerVersion: 2,
|
|
@@ -17988,85 +18001,73 @@ var DeveloperEngineClass = class {
|
|
|
17988
18001
|
const record = {};
|
|
17989
18002
|
for (const dimension of dimensions) {
|
|
17990
18003
|
if (dimension.sourceFilename) continue;
|
|
17991
|
-
|
|
18004
|
+
const key = dimension.alias || dimension.name;
|
|
18005
|
+
record[key] = this.generateMockValue(dimension, i);
|
|
17992
18006
|
}
|
|
17993
18007
|
records.push(record);
|
|
17994
18008
|
}
|
|
17995
18009
|
return records;
|
|
17996
18010
|
};
|
|
17997
18011
|
this.generateMockValue = (dimension, index) => {
|
|
17998
|
-
const { name, type } = dimension;
|
|
18012
|
+
const { name, type, format: format2, pk } = dimension;
|
|
17999
18013
|
const nameLower = name.toLowerCase();
|
|
18000
|
-
if (
|
|
18014
|
+
if (pk) {
|
|
18015
|
+
if (type === "number") return index + 1;
|
|
18001
18016
|
return `${index + 1}`;
|
|
18002
18017
|
}
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18018
|
+
const contextual = this.generateContextualValue(nameLower, type, index);
|
|
18019
|
+
if (contextual !== void 0) return contextual;
|
|
18020
|
+
return this.generateValueByType(type, index, format2);
|
|
18021
|
+
};
|
|
18022
|
+
this.generateContextualValue = (nameLower, type, index) => {
|
|
18023
|
+
if (type === "string") {
|
|
18024
|
+
if (this.matchesPattern(nameLower, ["id", "identifier", "key", "pk"]))
|
|
18025
|
+
return `${index + 1}`;
|
|
18026
|
+
if (this.matchesPattern(nameLower, ["first_name", "firstname", "fname", "given_name"]))
|
|
18027
|
+
return this.pickRandom(["John", "Jane", "Michael", "Sarah", "David", "Emily", "Robert", "Lisa", "James", "Mary"]);
|
|
18028
|
+
if (this.matchesPattern(nameLower, ["last_name", "lastname", "lname", "surname", "family_name"]))
|
|
18029
|
+
return this.pickRandom(["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Martinez", "Wilson"]);
|
|
18030
|
+
if (this.matchesPattern(nameLower, ["name", "full_name", "fullname"])) {
|
|
18031
|
+
const firstNames = ["John", "Jane", "Michael", "Sarah", "David", "Emily"];
|
|
18032
|
+
const lastNames = ["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia"];
|
|
18033
|
+
return `${this.pickRandom(firstNames)} ${this.pickRandom(lastNames)}`;
|
|
18034
|
+
}
|
|
18035
|
+
if (this.matchesPattern(nameLower, ["email", "mail"]))
|
|
18036
|
+
return `user${index + 1}@example.com`;
|
|
18037
|
+
if (this.matchesPattern(nameLower, ["phone", "telephone", "mobile", "cell"]))
|
|
18038
|
+
return `555-${String(Math.floor(Math.random() * 900) + 100).padStart(3, "0")}-${String(Math.floor(Math.random() * 9e3) + 1e3).padStart(4, "0")}`;
|
|
18039
|
+
if (this.matchesPattern(nameLower, ["address", "street", "addr"])) {
|
|
18040
|
+
const streets = ["Main St", "Oak Ave", "Elm Dr", "Pine Rd", "Maple Ln", "Cedar Blvd"];
|
|
18041
|
+
return `${Math.floor(Math.random() * 9999) + 1} ${this.pickRandom(streets)}`;
|
|
18042
|
+
}
|
|
18043
|
+
if (this.matchesPattern(nameLower, ["city", "town"]))
|
|
18044
|
+
return this.pickRandom(["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio", "San Diego"]);
|
|
18045
|
+
if (this.matchesPattern(nameLower, ["state", "province"]))
|
|
18046
|
+
return this.pickRandom(["CA", "TX", "FL", "NY", "PA", "IL", "OH", "GA", "NC", "MI"]);
|
|
18047
|
+
if (this.matchesPattern(nameLower, ["zip", "postal", "zipcode"]))
|
|
18048
|
+
return String(Math.floor(Math.random() * 9e4) + 1e4);
|
|
18049
|
+
if (this.matchesPattern(nameLower, ["country"]))
|
|
18050
|
+
return this.pickRandom(["USA", "Canada", "UK", "Germany", "France", "Australia"]);
|
|
18051
|
+
if (this.matchesPattern(nameLower, ["sex", "gender"]))
|
|
18052
|
+
return this.pickRandom(["M", "F", "Male", "Female"]);
|
|
18053
|
+
if (this.matchesPattern(nameLower, ["status"]))
|
|
18054
|
+
return this.pickRandom(["active", "inactive", "pending", "completed", "cancelled"]);
|
|
18055
|
+
if (this.matchesPattern(nameLower, ["type", "category"]))
|
|
18056
|
+
return this.pickRandom(["TypeA", "TypeB", "TypeC", "TypeD"]);
|
|
18057
|
+
if (this.matchesPattern(nameLower, ["description", "desc", "notes", "comment"]))
|
|
18058
|
+
return `Sample description for record ${index + 1}`;
|
|
18059
|
+
}
|
|
18060
|
+
if (type === "number") {
|
|
18061
|
+
if (this.matchesPattern(nameLower, ["age", "years"]))
|
|
18062
|
+
return Math.floor(Math.random() * 80) + 18;
|
|
18063
|
+
if (this.matchesPattern(nameLower, ["amount", "price", "cost", "total", "balance"]))
|
|
18064
|
+
return parseFloat((Math.random() * 1e3).toFixed(2));
|
|
18065
|
+
if (this.matchesPattern(nameLower, ["quantity", "count", "qty"]))
|
|
18066
|
+
return Math.floor(Math.random() * 100) + 1;
|
|
18067
|
+
if (this.matchesPattern(nameLower, ["id", "identifier", "key", "pk"]))
|
|
18068
|
+
return index + 1;
|
|
18032
18069
|
}
|
|
18033
|
-
|
|
18034
|
-
return this.pickRandom(["USA", "Canada", "UK", "Germany", "France", "Australia"]);
|
|
18035
|
-
}
|
|
18036
|
-
if (this.matchesPattern(nameLower, ["age", "years"])) {
|
|
18037
|
-
return Math.floor(Math.random() * 80) + 18;
|
|
18038
|
-
}
|
|
18039
|
-
if (this.matchesPattern(nameLower, ["sex", "gender"])) {
|
|
18040
|
-
return this.pickRandom(["M", "F", "Male", "Female"]);
|
|
18041
|
-
}
|
|
18042
|
-
if (this.matchesPattern(nameLower, ["birth", "dob", "birthdate"])) {
|
|
18043
|
-
const year = Math.floor(Math.random() * 60) + 1940;
|
|
18044
|
-
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, "0");
|
|
18045
|
-
const day = String(Math.floor(Math.random() * 28) + 1).padStart(2, "0");
|
|
18046
|
-
return `${year}-${month}-${day}`;
|
|
18047
|
-
}
|
|
18048
|
-
if (this.matchesPattern(nameLower, ["date", "created", "updated", "timestamp"])) {
|
|
18049
|
-
const year = Math.floor(Math.random() * 5) + 2020;
|
|
18050
|
-
const month = String(Math.floor(Math.random() * 12) + 1).padStart(2, "0");
|
|
18051
|
-
const day = String(Math.floor(Math.random() * 28) + 1).padStart(2, "0");
|
|
18052
|
-
return `${year}-${month}-${day}`;
|
|
18053
|
-
}
|
|
18054
|
-
if (this.matchesPattern(nameLower, ["amount", "price", "cost", "total", "balance"])) {
|
|
18055
|
-
return (Math.random() * 1e3).toFixed(2);
|
|
18056
|
-
}
|
|
18057
|
-
if (this.matchesPattern(nameLower, ["quantity", "count", "qty"])) {
|
|
18058
|
-
return Math.floor(Math.random() * 100) + 1;
|
|
18059
|
-
}
|
|
18060
|
-
if (this.matchesPattern(nameLower, ["status"])) {
|
|
18061
|
-
return this.pickRandom(["active", "inactive", "pending", "completed", "cancelled"]);
|
|
18062
|
-
}
|
|
18063
|
-
if (this.matchesPattern(nameLower, ["type", "category"])) {
|
|
18064
|
-
return this.pickRandom(["TypeA", "TypeB", "TypeC", "TypeD"]);
|
|
18065
|
-
}
|
|
18066
|
-
if (this.matchesPattern(nameLower, ["description", "desc", "notes", "comment"])) {
|
|
18067
|
-
return `Sample description for record ${index + 1}`;
|
|
18068
|
-
}
|
|
18069
|
-
return this.generateValueByType(type, index);
|
|
18070
|
+
return void 0;
|
|
18070
18071
|
};
|
|
18071
18072
|
this.matchesPattern = (fieldName, patterns) => {
|
|
18072
18073
|
return patterns.some((pattern) => fieldName.includes(pattern));
|
|
@@ -18074,7 +18075,7 @@ var DeveloperEngineClass = class {
|
|
|
18074
18075
|
this.pickRandom = (arr) => {
|
|
18075
18076
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
18076
18077
|
};
|
|
18077
|
-
this.generateValueByType = (type, index) => {
|
|
18078
|
+
this.generateValueByType = (type, index, format2) => {
|
|
18078
18079
|
switch (type) {
|
|
18079
18080
|
case "string":
|
|
18080
18081
|
return `value_${index + 1}`;
|
|
@@ -18084,9 +18085,14 @@ var DeveloperEngineClass = class {
|
|
|
18084
18085
|
return Math.random() > 0.5;
|
|
18085
18086
|
case "datetime": {
|
|
18086
18087
|
const year = Math.floor(Math.random() * 5) + 2020;
|
|
18087
|
-
const month =
|
|
18088
|
-
const day =
|
|
18089
|
-
|
|
18088
|
+
const month = Math.floor(Math.random() * 12) + 1;
|
|
18089
|
+
const day = Math.floor(Math.random() * 28) + 1;
|
|
18090
|
+
const hour = Math.floor(Math.random() * 24);
|
|
18091
|
+
const minute = Math.floor(Math.random() * 60);
|
|
18092
|
+
const second = Math.floor(Math.random() * 60);
|
|
18093
|
+
const date = (0, import_dayjs2.default)(new Date(year, month - 1, day, hour, minute, second));
|
|
18094
|
+
if (format2) return date.format(format2);
|
|
18095
|
+
return date.format("YYYY-MM-DD");
|
|
18090
18096
|
}
|
|
18091
18097
|
default:
|
|
18092
18098
|
return `value_${index + 1}`;
|
|
@@ -20365,7 +20371,8 @@ var ExecutorOrchestratorClass = class {
|
|
|
20365
20371
|
prodDimensions,
|
|
20366
20372
|
workerId,
|
|
20367
20373
|
scope,
|
|
20368
|
-
options
|
|
20374
|
+
options,
|
|
20375
|
+
loggerConfig: Logger_default.getConfig()
|
|
20369
20376
|
};
|
|
20370
20377
|
_progress.register((currentWorkerIndex + 1).toString(), prod.name, fileIndex, totalFiles);
|
|
20371
20378
|
scope.workersId.push(workerId);
|
|
@@ -20580,6 +20587,8 @@ var ExecutorOrchestrator = new ExecutorOrchestratorClass();
|
|
|
20580
20587
|
import_dotenv.default.configDotenv();
|
|
20581
20588
|
var run = async (workerData) => {
|
|
20582
20589
|
Environment_default.load("./");
|
|
20590
|
+
if (workerData.loggerConfig)
|
|
20591
|
+
Logger_default.initFromConfig(workerData.loggerConfig);
|
|
20583
20592
|
try {
|
|
20584
20593
|
const {
|
|
20585
20594
|
workerId,
|