@forzalabs/remora 1.1.4 → 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
@@ -313,7 +313,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
313
313
 
314
314
  // ../../packages/constants/src/Constants.ts
315
315
  var CONSTANTS = {
316
- cliVersion: "1.1.4",
316
+ cliVersion: "1.1.5",
317
317
  backendVersion: 1,
318
318
  backendPort: 5088,
319
319
  workerVersion: 2,
@@ -449,7 +449,7 @@ var SchemaValidatorClass = class {
449
449
  return true;
450
450
  };
451
451
  this.loadInternalSchema = () => {
452
- const internalSchemaDir = import_path2.default.join(__dirname, "json_schemas");
452
+ const internalSchemaDir = this._findSchemaDir();
453
453
  const internalSchemas = [
454
454
  "project-schema",
455
455
  "source-schema",
@@ -463,6 +463,15 @@ var SchemaValidatorClass = class {
463
463
  });
464
464
  return true;
465
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
+ };
466
475
  this.ajv = new import_ajv.default({
467
476
  allErrors: true,
468
477
  strict: true,
@@ -6937,6 +6946,7 @@ var UsageManagerClass = class {
6937
6946
  const now = DSTE_default.now();
6938
6947
  return `${consumer.name}_${now.getUTCFullYear()}_${now.getUTCMonth()}_${now.getUTCDate()}`.toLowerCase();
6939
6948
  };
6949
+ this._shouldSkipDb = () => Helper_default.isDev() || !process.env.MONGO_URI;
6940
6950
  this.startUsage = (consumer, details) => {
6941
6951
  const { user, invokedBy } = details;
6942
6952
  const newUsage = {
@@ -6950,7 +6960,7 @@ var UsageManagerClass = class {
6950
6960
  _signature: "",
6951
6961
  stats: null
6952
6962
  };
6953
- if (Helper_default.isDev()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6963
+ if (this._shouldSkipDb()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6954
6964
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, newUsage._id, newUsage);
6955
6965
  return { usageId: newUsage._id, usage: updateRes };
6956
6966
  };
@@ -6961,7 +6971,7 @@ var UsageManagerClass = class {
6961
6971
  finishedAt: DSTE_default.now(),
6962
6972
  stats
6963
6973
  };
6964
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6974
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6965
6975
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6966
6976
  return { usageId, usage: updateRes };
6967
6977
  };
@@ -6971,7 +6981,7 @@ var UsageManagerClass = class {
6971
6981
  error,
6972
6982
  finishedAt: DSTE_default.now()
6973
6983
  };
6974
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6984
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6975
6985
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6976
6986
  return { usageId, usage: updateRes };
6977
6987
  };
@@ -7638,7 +7648,6 @@ var ExecutorOrchestratorClass = class {
7638
7648
  else if (cProd.isOptional === true)
7639
7649
  continue;
7640
7650
  }
7641
- console.log("Starting operations on ", response.files[0].fullUri);
7642
7651
  const firstLine = (await DriverHelper_default.quickReadFile(response.files[0].fullUri, 1))[0];
7643
7652
  const header = ProducerExecutor_default.processHeader(firstLine, prod);
7644
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.4",
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,
@@ -305,7 +305,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
305
305
 
306
306
  // ../../packages/constants/src/Constants.ts
307
307
  var CONSTANTS = {
308
- cliVersion: "1.1.4",
308
+ cliVersion: "1.1.5",
309
309
  backendVersion: 1,
310
310
  backendPort: 5088,
311
311
  workerVersion: 2,
@@ -441,7 +441,7 @@ var SchemaValidatorClass = class {
441
441
  return true;
442
442
  };
443
443
  this.loadInternalSchema = () => {
444
- const internalSchemaDir = import_path2.default.join(__dirname, "json_schemas");
444
+ const internalSchemaDir = this._findSchemaDir();
445
445
  const internalSchemas = [
446
446
  "project-schema",
447
447
  "source-schema",
@@ -455,6 +455,15 @@ var SchemaValidatorClass = class {
455
455
  });
456
456
  return true;
457
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
+ };
458
467
  this.ajv = new import_ajv.default({
459
468
  allErrors: true,
460
469
  strict: true,
@@ -6539,6 +6548,7 @@ var UsageManagerClass = class {
6539
6548
  const now = DSTE_default.now();
6540
6549
  return `${consumer.name}_${now.getUTCFullYear()}_${now.getUTCMonth()}_${now.getUTCDate()}`.toLowerCase();
6541
6550
  };
6551
+ this._shouldSkipDb = () => Helper_default.isDev() || !process.env.MONGO_URI;
6542
6552
  this.startUsage = (consumer, details) => {
6543
6553
  const { user, invokedBy } = details;
6544
6554
  const newUsage = {
@@ -6552,7 +6562,7 @@ var UsageManagerClass = class {
6552
6562
  _signature: "",
6553
6563
  stats: null
6554
6564
  };
6555
- if (Helper_default.isDev()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6565
+ if (this._shouldSkipDb()) return { usageId: newUsage._id, usage: Promise.resolve(newUsage) };
6556
6566
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, newUsage._id, newUsage);
6557
6567
  return { usageId: newUsage._id, usage: updateRes };
6558
6568
  };
@@ -6563,7 +6573,7 @@ var UsageManagerClass = class {
6563
6573
  finishedAt: DSTE_default.now(),
6564
6574
  stats
6565
6575
  };
6566
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6576
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6567
6577
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6568
6578
  return { usageId, usage: updateRes };
6569
6579
  };
@@ -6573,7 +6583,7 @@ var UsageManagerClass = class {
6573
6583
  error,
6574
6584
  finishedAt: DSTE_default.now()
6575
6585
  };
6576
- if (Helper_default.isDev()) return { usageId: null, usage: Promise.resolve(update) };
6586
+ if (this._shouldSkipDb()) return { usageId: null, usage: Promise.resolve(update) };
6577
6587
  const updateRes = DatabaseEngine_default.upsert(Settings_default.db.collections.usage, usageId, update);
6578
6588
  return { usageId, usage: updateRes };
6579
6589
  };
@@ -7378,7 +7388,6 @@ var ExecutorOrchestratorClass = class {
7378
7388
  else if (cProd.isOptional === true)
7379
7389
  continue;
7380
7390
  }
7381
- console.log("Starting operations on ", response.files[0].fullUri);
7382
7391
  const firstLine = (await DriverHelper_default.quickReadFile(response.files[0].fullUri, 1))[0];
7383
7392
  const header = ProducerExecutor_default.processHeader(firstLine, prod);
7384
7393
  const prodDimensions = ProducerExecutor_default.reconcileHeader(header, prod);