@forzalabs/remora 1.0.21 → 1.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.
Files changed (111) hide show
  1. package/actions/automap.js +26 -42
  2. package/actions/compile.js +27 -43
  3. package/actions/create_consumer.js +24 -40
  4. package/actions/create_producer.js +16 -32
  5. package/actions/debug.js +18 -34
  6. package/actions/deploy.js +30 -46
  7. package/actions/discover.js +13 -29
  8. package/actions/init.js +29 -45
  9. package/actions/mock.js +16 -32
  10. package/actions/run.js +34 -52
  11. package/actions/sample.js +42 -58
  12. package/index.js +38 -43
  13. package/package.json +4 -4
  14. package/workers/ExecutorWorker.js +18 -32
  15. package/Constants.js +0 -34
  16. package/core/Affirm.js +0 -42
  17. package/core/Algo.js +0 -160
  18. package/core/dste/DSTE.js +0 -113
  19. package/core/logger/DebugLogService.js +0 -48
  20. package/core/logger/DevelopmentLogService.js +0 -70
  21. package/core/logger/LocalLogService.js +0 -70
  22. package/core/logger/Logger.js +0 -54
  23. package/database/DatabaseEngine.js +0 -149
  24. package/database/DatabaseStructure.js +0 -27
  25. package/definitions/DatasetDefinitions.js +0 -2
  26. package/definitions/ExecutorDefinitions.js +0 -2
  27. package/definitions/ProcessENV.js +0 -2
  28. package/definitions/agents/DestinationDriver.js +0 -2
  29. package/definitions/agents/SourceDriver.js +0 -2
  30. package/definitions/cli.js +0 -2
  31. package/definitions/database/ApiKeys.js +0 -2
  32. package/definitions/database/Stored.js +0 -7
  33. package/definitions/database/UsageStat.js +0 -2
  34. package/definitions/database/User.js +0 -2
  35. package/definitions/json_schemas/consumer-schema.json +0 -1226
  36. package/definitions/json_schemas/producer-schema.json +0 -308
  37. package/definitions/json_schemas/project-schema.json +0 -100
  38. package/definitions/json_schemas/source-schema.json +0 -249
  39. package/definitions/requests/ConsumerRequest.js +0 -2
  40. package/definitions/requests/Developer.js +0 -2
  41. package/definitions/requests/Mapping.js +0 -2
  42. package/definitions/requests/ProducerRequest.js +0 -2
  43. package/definitions/requests/Request.js +0 -2
  44. package/definitions/resources/Compiled.js +0 -2
  45. package/definitions/resources/Consumer.js +0 -2
  46. package/definitions/resources/Environment.js +0 -2
  47. package/definitions/resources/Library.js +0 -2
  48. package/definitions/resources/Producer.js +0 -2
  49. package/definitions/resources/Project.js +0 -2
  50. package/definitions/resources/Schema.js +0 -2
  51. package/definitions/resources/Source.js +0 -2
  52. package/definitions/temp.js +0 -2
  53. package/definitions/transform/Transformations.js +0 -2
  54. package/drivers/DeltaShareDriver.js +0 -186
  55. package/drivers/DriverFactory.js +0 -72
  56. package/drivers/DriverHelper.js +0 -248
  57. package/drivers/HttpApiDriver.js +0 -208
  58. package/drivers/RedshiftDriver.js +0 -184
  59. package/drivers/files/LocalDestinationDriver.js +0 -146
  60. package/drivers/files/LocalSourceDriver.js +0 -405
  61. package/drivers/s3/S3DestinationDriver.js +0 -197
  62. package/drivers/s3/S3SourceDriver.js +0 -495
  63. package/engines/CryptoEngine.js +0 -75
  64. package/engines/Environment.js +0 -170
  65. package/engines/ProcessENVManager.js +0 -83
  66. package/engines/RandomEngine.js +0 -47
  67. package/engines/SecretManager.js +0 -23
  68. package/engines/UserManager.js +0 -66
  69. package/engines/ai/AutoMapperEngine.js +0 -37
  70. package/engines/ai/DeveloperEngine.js +0 -497
  71. package/engines/ai/LLM.js +0 -255
  72. package/engines/consumer/ConsumerManager.js +0 -218
  73. package/engines/consumer/ConsumerOnFinishManager.js +0 -202
  74. package/engines/dataset/Dataset.js +0 -824
  75. package/engines/dataset/DatasetManager.js +0 -211
  76. package/engines/dataset/DatasetRecord.js +0 -120
  77. package/engines/dataset/DatasetRecordPool.js +0 -77
  78. package/engines/execution/RequestExecutor.js +0 -67
  79. package/engines/parsing/CSVParser.js +0 -60
  80. package/engines/parsing/LineParser.js +0 -71
  81. package/engines/parsing/ParseCompression.js +0 -101
  82. package/engines/parsing/ParseHelper.js +0 -18
  83. package/engines/parsing/ParseManager.js +0 -54
  84. package/engines/parsing/XLSParser.js +0 -87
  85. package/engines/parsing/XMLParser.js +0 -115
  86. package/engines/producer/ProducerEngine.js +0 -127
  87. package/engines/producer/ProducerManager.js +0 -43
  88. package/engines/scheduler/CronScheduler.js +0 -222
  89. package/engines/scheduler/QueueManager.js +0 -314
  90. package/engines/schema/SchemaValidator.js +0 -67
  91. package/engines/transform/JoinEngine.js +0 -232
  92. package/engines/transform/TransformationEngine.js +0 -277
  93. package/engines/transform/TypeCaster.js +0 -59
  94. package/engines/usage/DataframeManager.js +0 -55
  95. package/engines/usage/UsageDataManager.js +0 -151
  96. package/engines/usage/UsageManager.js +0 -65
  97. package/engines/validation/Validator.js +0 -216
  98. package/executors/ConsumerExecutor.js +0 -280
  99. package/executors/Executor.js +0 -177
  100. package/executors/ExecutorOrchestrator.js +0 -331
  101. package/executors/ExecutorPerformance.js +0 -17
  102. package/executors/ExecutorProgress.js +0 -54
  103. package/executors/ExecutorScope.js +0 -52
  104. package/executors/OutputExecutor.js +0 -118
  105. package/executors/ProducerExecutor.js +0 -108
  106. package/helper/Helper.js +0 -149
  107. package/helper/Logger.js +0 -84
  108. package/helper/Runtime.js +0 -20
  109. package/helper/Settings.js +0 -13
  110. package/licencing/LicenceManager.js +0 -64
  111. package/settings.js +0 -12
@@ -1,170 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const path_1 = __importDefault(require("path"));
8
- const Affirm_1 = __importDefault(require("../core/Affirm"));
9
- const SchemaValidator_1 = __importDefault(require("./schema/SchemaValidator"));
10
- const Validator_1 = __importDefault(require("./validation/Validator"));
11
- const Constants_1 = __importDefault(require("../Constants"));
12
- const Logger_1 = __importDefault(require("../helper/Logger"));
13
- class EnvironmentClass {
14
- constructor() {
15
- this._env = null;
16
- this.init = (env) => {
17
- this._env = env;
18
- };
19
- this.load = (remoraPath) => {
20
- const envPath = path_1.default.join(remoraPath, 'remora');
21
- // Read and parse project.json
22
- const projectPath = path_1.default.join(envPath, 'project.json');
23
- if (!fs_1.default.existsSync(projectPath))
24
- throw new Error('Project configuration file not found');
25
- const projectConfig = JSON.parse(fs_1.default.readFileSync(projectPath, 'utf-8'));
26
- // Validate project schema
27
- const isValid = SchemaValidator_1.default.validate('project-schema', projectConfig);
28
- if (!isValid)
29
- throw new Error('Invalid project configuration');
30
- const loadConfigurations = (basePath, paths) => {
31
- const configs = [];
32
- for (const configPath of paths) {
33
- const fullPath = path_1.default.join(basePath, configPath);
34
- try {
35
- if (fs_1.default.statSync(fullPath).isDirectory()) {
36
- const files = fs_1.default.readdirSync(fullPath).filter(file => file.endsWith('.json'));
37
- for (const file of files) {
38
- const config = JSON.parse(fs_1.default.readFileSync(path_1.default.join(fullPath, file), 'utf-8'));
39
- configs.push(config);
40
- }
41
- }
42
- else {
43
- const config = JSON.parse(fs_1.default.readFileSync(fullPath, 'utf-8'));
44
- configs.push(config);
45
- }
46
- }
47
- catch (error) {
48
- throw new Error(`Error loading from ${path_1.default.resolve(remoraPath)} configuration from ${configPath}: ${error.message}`);
49
- }
50
- }
51
- return configs;
52
- };
53
- // Unload all the schemes other than the default ones, because otherwise the RW could keep loaded schemes not saved in the remora folder
54
- SchemaValidator_1.default.unloadSchemas();
55
- // Load all schemas first since they're needed for validation
56
- const schemas = loadConfigurations(envPath, projectConfig.schemas);
57
- schemas.forEach(schema => {
58
- SchemaValidator_1.default.addSchema(schema, schema.title);
59
- });
60
- // Load configurations with validation
61
- const sources = loadConfigurations(envPath, projectConfig.sources);
62
- sources.forEach(source => {
63
- if (!SchemaValidator_1.default.validate('source-schema', source))
64
- throw new Error(`Invalid source configuration: ${source.name}`);
65
- });
66
- const producers = loadConfigurations(envPath, projectConfig.producers);
67
- producers.forEach(producer => {
68
- if (!SchemaValidator_1.default.validate('producer-schema', producer))
69
- throw new Error(`Invalid producer configuration: ${producer.name}`);
70
- });
71
- const consumers = loadConfigurations(envPath, projectConfig.consumers);
72
- consumers.forEach(consumer => {
73
- if (!SchemaValidator_1.default.validate('consumer-schema', consumer))
74
- throw new Error(`Invalid consumer configuration: ${consumer.name}`);
75
- });
76
- // Load the project settings
77
- const envSettings = new Map(Object.entries(Object.assign({}, projectConfig.settings))
78
- .map(([key, value]) => [key, String(value)]));
79
- if (!envSettings.has('SQL_MAX_QUERY_ROWS'))
80
- envSettings.set('SQL_MAX_QUERY_ROWS', Constants_1.default.defaults.SQL_MAX_QUERY_ROWS.toString());
81
- if (!envSettings.has('STRING_MAX_CHARACTERS_LENGTH'))
82
- envSettings.set('STRING_MAX_CHARACTERS_LENGTH', Constants_1.default.defaults.STRING_MAX_CHARACTERS_LENGTH.toString());
83
- if (!envSettings.has('MAX_ITEMS_IN_MEMORY'))
84
- envSettings.set('MAX_ITEMS_IN_MEMORY', Constants_1.default.defaults.MAX_ITEMS_IN_MEMORY.toString());
85
- const debugMode = envSettings.get('DEBUG_MODE');
86
- try {
87
- if (debugMode && debugMode.length > 0 && JSON.parse(debugMode) === true)
88
- Logger_1.default.setLevel('debug');
89
- }
90
- catch (_a) {
91
- console.warn(`Invalid project setting "DEBUG_MODE" (${debugMode})`);
92
- }
93
- // Initialize environment
94
- this.init({
95
- settings: envSettings,
96
- sources,
97
- producers,
98
- consumers,
99
- schemas,
100
- sqlLibrary: [] // TODO: Add SQL library loading if needed
101
- });
102
- };
103
- this.get = (setting) => {
104
- return this._env.settings.get(setting);
105
- };
106
- this.getSource = (sourceName) => {
107
- (0, Affirm_1.default)(sourceName, 'Invalid source name');
108
- return this._env.sources.find(x => x.name === sourceName);
109
- };
110
- /**
111
- * A consumer can reference another consumer, in this case I need to keep digging to find the real producer
112
- */
113
- this.getFirstProducer = (producerName) => {
114
- (0, Affirm_1.default)(producerName, `Invalid producer name`);
115
- const prod = this._env.producers.find(x => x.name.toLocaleLowerCase() === producerName.toLowerCase());
116
- if (!prod) {
117
- const consumer = this.getConsumer(producerName);
118
- (0, Affirm_1.default)(consumer, `Invalid producer name`);
119
- return this.getFirstProducer(consumer.producers[0].name);
120
- }
121
- return prod;
122
- };
123
- this.getProducer = (producerName) => {
124
- (0, Affirm_1.default)(producerName, `Invalid producer name`);
125
- return this._env.producers.find(x => x.name.toLowerCase() === producerName.toLowerCase());
126
- };
127
- this.getConsumer = (consumerName) => {
128
- (0, Affirm_1.default)(consumerName, `Invalid consumer name`);
129
- return this._env.consumers.find(x => x.name.toLowerCase() === consumerName.toLowerCase());
130
- };
131
- this.getAllConsumers = () => {
132
- (0, Affirm_1.default)(this._env, 'Environment not initialized');
133
- return this._env.consumers || [];
134
- };
135
- this.getSchema = (schemaName) => {
136
- (0, Affirm_1.default)(schemaName, 'Invalid schema name');
137
- return this._env.schemas.find(x => x.title === schemaName);
138
- };
139
- this.getSqlInLibrary = (name) => {
140
- (0, Affirm_1.default)(name, `Invalid sql library item name`);
141
- return this._env.sqlLibrary.find(x => x.name === name);
142
- };
143
- this.validate = () => {
144
- (0, Affirm_1.default)(this._env, 'Invalid environment');
145
- let errors = [];
146
- try {
147
- errors = [...errors, ...Validator_1.default.validateSources(this._env.sources)];
148
- errors = [...errors, ...Validator_1.default.validateProducers(this._env.producers)];
149
- this._env.producers.forEach(prod => {
150
- const ce = Validator_1.default.validateProducer(prod);
151
- if (ce.length > 0)
152
- errors.push(`Producer "${prod.name}" errors:\n${ce.map(x => `\t-${x}\n`)}`);
153
- });
154
- errors = [...errors, ...Validator_1.default.validateConsumers(this._env.consumers)];
155
- this._env.consumers.forEach(cons => {
156
- const ce = Validator_1.default.validateConsumer(cons);
157
- if (ce.length > 0)
158
- errors.push(`Consumer "${cons.name}" errors:\n${ce.map(x => `\t-${x}\n`)}`);
159
- });
160
- }
161
- catch (e) {
162
- if (errors.length === 0)
163
- errors.push(`There was an error in the validation Environment. (error: ${e})`);
164
- }
165
- return errors;
166
- };
167
- }
168
- }
169
- const Environment = new EnvironmentClass();
170
- exports.default = Environment;
@@ -1,83 +0,0 @@
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;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const seedrandom_1 = __importDefault(require("seedrandom"));
7
- const Algo_1 = __importDefault(require("../core/Algo"));
8
- class RandomEngineClass {
9
- constructor() {
10
- this.rng = (min, max) => {
11
- const rng = Math.random;
12
- if (Algo_1.default.hasVal(min) || Algo_1.default.hasVal(max))
13
- return Math.floor(rng() * (max - min + 1)) + min;
14
- else
15
- return rng();
16
- };
17
- this.sRng = (seed, min, max) => {
18
- const rng = (0, seedrandom_1.default)(String(seed));
19
- if (Algo_1.default.hasVal(min) || Algo_1.default.hasVal(max))
20
- return Math.floor(rng() * (max - min + 1)) + min;
21
- else
22
- return rng();
23
- };
24
- this.rngDate = (min, max) => {
25
- let myMin = min;
26
- let myMax = max;
27
- if (!Algo_1.default.hasVal(min) && !Algo_1.default.hasVal(max)) {
28
- myMin = new Date('1900-01-01').getTime();
29
- myMax = new Date().getTime();
30
- }
31
- const randomNumber = this.rng(myMin, myMax);
32
- return new Date(randomNumber).toJSON();
33
- };
34
- this.sRngDate = (seed, min, max) => {
35
- let myMin = min;
36
- let myMax = max;
37
- if (!Algo_1.default.hasVal(min) && !Algo_1.default.hasVal(max)) {
38
- myMin = new Date('1900-01-01').getTime();
39
- myMax = new Date().getTime();
40
- }
41
- const randomNumber = this.sRng(seed, myMin, myMax);
42
- return new Date(randomNumber).toJSON();
43
- };
44
- }
45
- }
46
- const RandomEngine = new RandomEngineClass();
47
- exports.default = RandomEngine;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ProcessENVManager_1 = __importDefault(require("./ProcessENVManager"));
7
- class SecretManagerClass {
8
- constructor() {
9
- /**
10
- * If the value is a secret (or .env setting), replace it with the value inside the .env configuration file
11
- * Starts with "{" and ends with "}".
12
- * e.g. {AWS_ID}
13
- */
14
- this.replaceSecret = (value) => {
15
- if (!value || value.length <= 2 || !value.startsWith('{') || !value.endsWith('}'))
16
- return value;
17
- const parsedValue = value.slice(1, value.length - 1);
18
- return ProcessENVManager_1.default.getEnvVariable(parsedValue);
19
- };
20
- }
21
- }
22
- const SecretManager = new SecretManagerClass();
23
- exports.default = SecretManager;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const DatabaseEngine_1 = __importDefault(require("../database/DatabaseEngine"));
16
- const Helper_1 = __importDefault(require("../helper/Helper"));
17
- const Settings_1 = __importDefault(require("../helper/Settings"));
18
- class UserManagerClass {
19
- constructor() {
20
- this.getUser = () => {
21
- if (Helper_1.default.isDev())
22
- return DEV_USER;
23
- else
24
- return MOCK_USER;
25
- // TODO: figure out how to handle users
26
- };
27
- this.getRemoraWorkerUser = () => {
28
- const remora = {
29
- _id: '__remora_worker__',
30
- auth: { oid: '', provider: 'internal' },
31
- email: '',
32
- name: 'Remora Worker',
33
- roles: ['root'],
34
- _signature: '',
35
- lastLogin: new Date().toJSON()
36
- };
37
- return remora;
38
- };
39
- this.findOIDC = (oid) => __awaiter(this, void 0, void 0, function* () {
40
- return yield DatabaseEngine_1.default.findOne(Settings_1.default.db.collections.users, { 'auth.oid': oid });
41
- });
42
- this.update = (user) => __awaiter(this, void 0, void 0, function* () {
43
- return yield DatabaseEngine_1.default.upsert(Settings_1.default.db.collections.users, user._id, user);
44
- });
45
- }
46
- }
47
- const UserManager = new UserManagerClass();
48
- exports.default = UserManager;
49
- const DEV_USER = {
50
- _id: '__dev__',
51
- auth: { oid: '', provider: 'azure' },
52
- email: '',
53
- name: 'Dev',
54
- roles: ['admin'],
55
- _signature: '',
56
- lastLogin: new Date().toJSON()
57
- };
58
- const MOCK_USER = {
59
- _id: '__mock__',
60
- auth: { oid: '', provider: 'azure' },
61
- email: 'mock.user@email.com',
62
- name: 'Mock User',
63
- roles: ['user'],
64
- _signature: '',
65
- lastLogin: new Date().toJSON()
66
- };
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const Affirm_1 = __importDefault(require("../../core/Affirm"));
16
- const LLM_1 = __importDefault(require("./LLM"));
17
- class AutoMapperEngineClass {
18
- constructor() {
19
- /**
20
- * input: the first ten lines of the uploaded file
21
- * outputs: the selected schemas
22
- */
23
- this.map = (input, outputs, fileName, sources) => __awaiter(this, void 0, void 0, function* () {
24
- (0, Affirm_1.default)(input, 'Invalid input');
25
- (0, Affirm_1.default)(outputs, 'Invalid outputs');
26
- const llm = new LLM_1.default();
27
- const producersRes = yield llm.inferProducers(input, outputs, fileName, sources);
28
- const consumersRes = yield llm.inferConsumers(producersRes.producers, outputs);
29
- return {
30
- consumers: consumersRes.consumers,
31
- producers: producersRes.producers
32
- };
33
- });
34
- }
35
- }
36
- const AutoMapperEngine = new AutoMapperEngineClass();
37
- exports.default = AutoMapperEngine;