@forzalabs/remora 1.1.3 → 1.1.5

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 CHANGED
@@ -268,9 +268,6 @@ var ProcessENVManagerClass = class {
268
268
  */
269
269
  this.getEnvVariable = (variable) => {
270
270
  Affirm_default(variable, `Cannot read an undefined variable`);
271
- if (!this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES.includes(variable) || !this.ENVIRONMENT_VARIABLES.includes(variable)) {
272
- console.warn(`Trying reading an implemented: ${variable}`);
273
- }
274
271
  if (!import_process.default.env[variable] && this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES.includes(variable)) {
275
272
  throw new Error(`Missing necessary property for ${variable}`);
276
273
  } else if (!import_process.default.env[variable]) {
@@ -316,7 +313,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
316
313
 
317
314
  // ../../packages/constants/src/Constants.ts
318
315
  var CONSTANTS = {
319
- cliVersion: "1.1.3",
316
+ cliVersion: "1.1.5",
320
317
  backendVersion: 1,
321
318
  backendPort: 5088,
322
319
  workerVersion: 2,
@@ -452,7 +449,7 @@ var SchemaValidatorClass = class {
452
449
  return true;
453
450
  };
454
451
  this.loadInternalSchema = () => {
455
- const internalSchemaDir = import_path2.default.join(__dirname, "json_schemas");
452
+ const internalSchemaDir = this._findSchemaDir();
456
453
  const internalSchemas = [
457
454
  "project-schema",
458
455
  "source-schema",
@@ -466,6 +463,15 @@ var SchemaValidatorClass = class {
466
463
  });
467
464
  return true;
468
465
  };
466
+ this._findSchemaDir = () => {
467
+ let dir = __dirname;
468
+ for (let i = 0; i < 5; i++) {
469
+ const candidate = import_path2.default.join(dir, "json_schemas");
470
+ if (import_fs2.default.existsSync(candidate)) return candidate;
471
+ dir = import_path2.default.dirname(dir);
472
+ }
473
+ return import_path2.default.join(__dirname, "json_schemas");
474
+ };
469
475
  this.ajv = new import_ajv.default({
470
476
  allErrors: true,
471
477
  strict: true,
@@ -6940,6 +6946,7 @@ var UsageManagerClass = class {
6940
6946
  const now = DSTE_default.now();
6941
6947
  return `${consumer.name}_${now.getUTCFullYear()}_${now.getUTCMonth()}_${now.getUTCDate()}`.toLowerCase();
6942
6948
  };
6949
+ this._shouldSkipDb = () => Helper_default.isDev() || !process.env.MONGO_URI;
6943
6950
  this.startUsage = (consumer, details) => {
6944
6951
  const { user, invokedBy } = details;
6945
6952
  const newUsage = {
@@ -6953,7 +6960,7 @@ var UsageManagerClass = class {
6953
6960
  _signature: "",
6954
6961
  stats: null
6955
6962
  };
6956
- if (Helper_default.isDev()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6963
+ if (this._shouldSkipDb()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6957
6964
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, newUsage._id, newUsage);
6958
6965
  return { usageId: newUsage._id, usage: updateRes };
6959
6966
  };
@@ -6964,7 +6971,7 @@ var UsageManagerClass = class {
6964
6971
  finishedAt: DSTE_default.now(),
6965
6972
  stats
6966
6973
  };
6967
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6974
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6968
6975
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6969
6976
  return { usageId, usage: updateRes };
6970
6977
  };
@@ -6974,7 +6981,7 @@ var UsageManagerClass = class {
6974
6981
  error,
6975
6982
  finishedAt: DSTE_default.now()
6976
6983
  };
6977
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6984
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6978
6985
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6979
6986
  return { usageId, usage: updateRes };
6980
6987
  };
@@ -7641,7 +7648,6 @@ var ExecutorOrchestratorClass = class {
7641
7648
  else if (cProd.isOptional === true)
7642
7649
  continue;
7643
7650
  }
7644
- console.log("Starting operations on ", response.files[0].fullUri);
7645
7651
  const firstLine = (await DriverHelper_default.quickReadFile(response.files[0].fullUri, 1))[0];
7646
7652
  const header = ProducerExecutor_default.processHeader(firstLine, prod);
7647
7653
  const prodDimensions = ProducerExecutor_default.reconcileHeader(header, prod);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forzalabs/remora",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "A powerful CLI tool for seamless data translation.",
5
5
  "main": "index.js",
6
6
  "private": false,
@@ -260,9 +260,6 @@ var ProcessENVManagerClass = class {
260
260
  */
261
261
  this.getEnvVariable = (variable) => {
262
262
  Affirm_default(variable, `Cannot read an undefined variable`);
263
- if (!this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES.includes(variable) || !this.ENVIRONMENT_VARIABLES.includes(variable)) {
264
- console.warn(`Trying reading an implemented: ${variable}`);
265
- }
266
263
  if (!import_process.default.env[variable] && this.FOUNDAMENTAL_ENVIRONMENT_VARIABLES.includes(variable)) {
267
264
  throw new Error(`Missing necessary property for ${variable}`);
268
265
  } else if (!import_process.default.env[variable]) {
@@ -308,7 +305,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
308
305
 
309
306
  // ../../packages/constants/src/Constants.ts
310
307
  var CONSTANTS = {
311
- cliVersion: "1.1.3",
308
+ cliVersion: "1.1.5",
312
309
  backendVersion: 1,
313
310
  backendPort: 5088,
314
311
  workerVersion: 2,
@@ -444,7 +441,7 @@ var SchemaValidatorClass = class {
444
441
  return true;
445
442
  };
446
443
  this.loadInternalSchema = () => {
447
- const internalSchemaDir = import_path2.default.join(__dirname, "json_schemas");
444
+ const internalSchemaDir = this._findSchemaDir();
448
445
  const internalSchemas = [
449
446
  "project-schema",
450
447
  "source-schema",
@@ -458,6 +455,15 @@ var SchemaValidatorClass = class {
458
455
  });
459
456
  return true;
460
457
  };
458
+ this._findSchemaDir = () => {
459
+ let dir = __dirname;
460
+ for (let i = 0; i < 5; i++) {
461
+ const candidate = import_path2.default.join(dir, "json_schemas");
462
+ if (import_fs2.default.existsSync(candidate)) return candidate;
463
+ dir = import_path2.default.dirname(dir);
464
+ }
465
+ return import_path2.default.join(__dirname, "json_schemas");
466
+ };
461
467
  this.ajv = new import_ajv.default({
462
468
  allErrors: true,
463
469
  strict: true,
@@ -6542,6 +6548,7 @@ var UsageManagerClass = class {
6542
6548
  const now = DSTE_default.now();
6543
6549
  return `${consumer.name}_${now.getUTCFullYear()}_${now.getUTCMonth()}_${now.getUTCDate()}`.toLowerCase();
6544
6550
  };
6551
+ this._shouldSkipDb = () => Helper_default.isDev() || !process.env.MONGO_URI;
6545
6552
  this.startUsage = (consumer, details) => {
6546
6553
  const { user, invokedBy } = details;
6547
6554
  const newUsage = {
@@ -6555,7 +6562,7 @@ var UsageManagerClass = class {
6555
6562
  _signature: "",
6556
6563
  stats: null
6557
6564
  };
6558
- if (Helper_default.isDev()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6565
+ if (this._shouldSkipDb()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6559
6566
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, newUsage._id, newUsage);
6560
6567
  return { usageId: newUsage._id, usage: updateRes };
6561
6568
  };
@@ -6566,7 +6573,7 @@ var UsageManagerClass = class {
6566
6573
  finishedAt: DSTE_default.now(),
6567
6574
  stats
6568
6575
  };
6569
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6576
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6570
6577
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6571
6578
  return { usageId, usage: updateRes };
6572
6579
  };
@@ -6576,7 +6583,7 @@ var UsageManagerClass = class {
6576
6583
  error,
6577
6584
  finishedAt: DSTE_default.now()
6578
6585
  };
6579
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6586
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6580
6587
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6581
6588
  return { usageId, usage: updateRes };
6582
6589
  };
@@ -7381,7 +7388,6 @@ var ExecutorOrchestratorClass = class {
7381
7388
  else if (cProd.isOptional === true)
7382
7389
  continue;
7383
7390
  }
7384
- console.log("Starting operations on ", response.files[0].fullUri);
7385
7391
  const firstLine = (await DriverHelper_default.quickReadFile(response.files[0].fullUri, 1))[0];
7386
7392
  const header = ProducerExecutor_default.processHeader(firstLine, prod);
7387
7393
  const prodDimensions = ProducerExecutor_default.reconcileHeader(header, prod);