@stemy/backend 3.1.4 → 3.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.
@@ -2415,7 +2415,7 @@
2415
2415
  this.jobs = this.jobTypes.reduce(function (res, jobType) {
2416
2416
  var jobName = getConstructorName(jobType);
2417
2417
  res[jobName] = function (jobParams, uniqueId) {
2418
- var job = _this.resolveJobInstance(jobType, jobParams);
2418
+ var job = _this.resolveJobInstance(jobType, jobParams, uniqueId);
2419
2419
  var messageBridge = {
2420
2420
  sendMessage: function (message, params) {
2421
2421
  params.uniqueId = uniqueId;
@@ -2596,18 +2596,24 @@
2596
2596
  this.apiPull.on("message", function (name, args) {
2597
2597
  var message = name.toString("utf8");
2598
2598
  var params = JSON.parse((args === null || args === void 0 ? void 0 : args.toString("utf8")) || "{}");
2599
- console.log("Received a message from worker: \"" + colorize(message, exports.ConsoleColor.FgCyan) + "\" with args: " + jsonHighlight(params) + "\n\n");
2599
+ var paramTypes = Object.keys(params).reduce(function (res, key) {
2600
+ res[key] = getType(params[key]);
2601
+ return res;
2602
+ }, {});
2603
+ console.log("Received a message from worker: \"" + colorize(message, exports.ConsoleColor.FgCyan) + "\" with args: " + jsonHighlight(paramTypes) + "\n\n");
2600
2604
  _this.messages.next({ message: message, params: params });
2601
2605
  });
2602
2606
  console.log("API consumer bound to port: " + backPort);
2603
2607
  }
2604
2608
  return this.tryResolve(jobType, params);
2605
2609
  };
2606
- JobManager.prototype.resolveJobInstance = function (jobType, params) {
2610
+ JobManager.prototype.resolveJobInstance = function (jobType, params, uniqueId) {
2611
+ if (uniqueId === void 0) { uniqueId = ""; }
2607
2612
  var container = this.container.createChildContainer();
2608
2613
  Object.keys(params).map(function (name) {
2609
2614
  container.register(name, { useValue: params[name] });
2610
2615
  });
2616
+ container.register("uniqueId", { useValue: uniqueId });
2611
2617
  container.register(jobType, jobType);
2612
2618
  return container.resolve(jobType);
2613
2619
  };
@@ -6072,6 +6078,8 @@
6072
6078
  diContainer = parent.createChildContainer();
6073
6079
  allProviders.forEach(function (provider) {
6074
6080
  if (isType(provider)) {
6081
+ if (tsyringe.container.isRegistered(provider))
6082
+ return;
6075
6083
  diContainer.register(provider, provider);
6076
6084
  return;
6077
6085
  }