@okf/ootils 1.4.4 → 1.4.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/dist/node.js CHANGED
@@ -348,6 +348,7 @@ var require_MongoConnector = __commonJS({
348
348
  var MongoConnector3 = class _MongoConnector {
349
349
  constructor(options) {
350
350
  __publicField(this, "initiateConnectionEventListeners", (CLUSTER_NAME) => {
351
+ console.log("in initiate connection listeners");
351
352
  this.clusterConnections[CLUSTER_NAME].on("open", () => {
352
353
  console.log(`\u2705 Mongoose connection open to ${CLUSTER_NAME}`);
353
354
  });
@@ -430,12 +431,16 @@ var require_MongoConnector = __commonJS({
430
431
  `Missing CLUSTER_NAME or DB_URI for environment: ${connectToEnv}`
431
432
  );
432
433
  }
433
- this.clusterConnections[CLUSTER_NAME] = await mongoose5.createConnection(
434
- DB_URI,
435
- this.mongoOptions
436
- ).asPromise();
437
- console.log(`Connected to MongoDB: ${CLUSTER_NAME}`);
434
+ const connection = mongoose5.createConnection(DB_URI, this.mongoOptions);
435
+ this.clusterConnections[CLUSTER_NAME] = connection;
438
436
  this.initiateConnectionEventListeners(CLUSTER_NAME);
437
+ await new Promise((resolve, reject) => {
438
+ connection.once("open", () => {
439
+ console.log(`Connected to MongoDB: ${CLUSTER_NAME}`);
440
+ resolve();
441
+ });
442
+ connection.once("error", reject);
443
+ });
439
444
  })
440
445
  );
441
446
  return this.clusterConnections;
@@ -662,6 +667,7 @@ var require_WorkerManager = __commonJS({
662
667
  this.activeWorkers = [];
663
668
  }
664
669
  startAllWorkers() {
670
+ if (process.env.NODE_ENV !== "production") return this.activeWorkers;
665
671
  if (this.workers.length === 0) {
666
672
  console.log("No workers provided to start");
667
673
  return [];
@@ -985,6 +991,22 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
985
991
  // ...60 seconds (higher throughput for chunking)
986
992
  }
987
993
  }
994
+ },
995
+ AI_CATEGORIZE_QUEUE: {
996
+ queueConfig: {
997
+ defaultJobOptions: {
998
+ attempts: 3,
999
+ backoff: {
1000
+ type: "exponential",
1001
+ delay: 2e3
1002
+ },
1003
+ removeOnComplete: 50,
1004
+ removeOnFail: 100
1005
+ }
1006
+ },
1007
+ workerConfig: {
1008
+ concurrency: 1
1009
+ }
988
1010
  }
989
1011
  };
990
1012
  }
package/dist/node.mjs CHANGED
@@ -353,6 +353,7 @@ var require_MongoConnector = __commonJS({
353
353
  var MongoConnector3 = class _MongoConnector {
354
354
  constructor(options) {
355
355
  __publicField(this, "initiateConnectionEventListeners", (CLUSTER_NAME) => {
356
+ console.log("in initiate connection listeners");
356
357
  this.clusterConnections[CLUSTER_NAME].on("open", () => {
357
358
  console.log(`\u2705 Mongoose connection open to ${CLUSTER_NAME}`);
358
359
  });
@@ -435,12 +436,16 @@ var require_MongoConnector = __commonJS({
435
436
  `Missing CLUSTER_NAME or DB_URI for environment: ${connectToEnv}`
436
437
  );
437
438
  }
438
- this.clusterConnections[CLUSTER_NAME] = await mongoose5.createConnection(
439
- DB_URI,
440
- this.mongoOptions
441
- ).asPromise();
442
- console.log(`Connected to MongoDB: ${CLUSTER_NAME}`);
439
+ const connection = mongoose5.createConnection(DB_URI, this.mongoOptions);
440
+ this.clusterConnections[CLUSTER_NAME] = connection;
443
441
  this.initiateConnectionEventListeners(CLUSTER_NAME);
442
+ await new Promise((resolve, reject) => {
443
+ connection.once("open", () => {
444
+ console.log(`Connected to MongoDB: ${CLUSTER_NAME}`);
445
+ resolve();
446
+ });
447
+ connection.once("error", reject);
448
+ });
444
449
  })
445
450
  );
446
451
  return this.clusterConnections;
@@ -667,6 +672,7 @@ var require_WorkerManager = __commonJS({
667
672
  this.activeWorkers = [];
668
673
  }
669
674
  startAllWorkers() {
675
+ if (process.env.NODE_ENV !== "production") return this.activeWorkers;
670
676
  if (this.workers.length === 0) {
671
677
  console.log("No workers provided to start");
672
678
  return [];
@@ -990,6 +996,22 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
990
996
  // ...60 seconds (higher throughput for chunking)
991
997
  }
992
998
  }
999
+ },
1000
+ AI_CATEGORIZE_QUEUE: {
1001
+ queueConfig: {
1002
+ defaultJobOptions: {
1003
+ attempts: 3,
1004
+ backoff: {
1005
+ type: "exponential",
1006
+ delay: 2e3
1007
+ },
1008
+ removeOnComplete: 50,
1009
+ removeOnFail: 100
1010
+ }
1011
+ },
1012
+ workerConfig: {
1013
+ concurrency: 1
1014
+ }
993
1015
  }
994
1016
  };
995
1017
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.4.4",
6
+ "version": "1.4.5",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",