@treatwell/moleculer-essentials 1.2.0 → 1.2.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var lodashEs = require('lodash-es');
3
+ var esToolkit = require('es-toolkit');
4
4
  var v4 = require('zod/v4');
5
5
  var bson = require('bson');
6
6
  var dateFns = require('date-fns');
@@ -45,7 +45,7 @@ function omitFields(schema, fields, refName) {
45
45
  ...schema,
46
46
  [SCHEMA_REF_NAME]: refName,
47
47
  required: schema.required.filter((f) => !fields.includes(f)),
48
- properties: lodashEs.omit(schema.properties, fields)
48
+ properties: esToolkit.omit(schema.properties, fields)
49
49
  };
50
50
  }
51
51
  function pickFields(schema, fields, refName) {
@@ -68,7 +68,7 @@ function pickFields(schema, fields, refName) {
68
68
  ...schema,
69
69
  [SCHEMA_REF_NAME]: refName,
70
70
  required: schema.required.filter((f) => fields.includes(f)),
71
- properties: lodashEs.pick(schema.properties, fields)
71
+ properties: esToolkit.pick(schema.properties, fields)
72
72
  };
73
73
  }
74
74
  function optionalExceptFields(schema, fields, refName) {
@@ -1,4 +1,4 @@
1
- import { omit, pick } from 'lodash-es';
1
+ import { omit, pick } from 'es-toolkit';
2
2
  import { z as z$1 } from 'zod/v4';
3
3
  import { ObjectId } from 'bson';
4
4
  import { parseISO } from 'date-fns';
package/dist/index.cjs CHANGED
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BUXfgQp5.cjs');
3
+ var index = require('./index-CjA1_Io7.cjs');
4
4
  var v4 = require('zod/v4');
5
5
  var _2019_js = require('ajv/dist/2019.js');
6
6
  var moleculer = require('moleculer');
7
7
  var addFormats = require('ajv-formats');
8
8
  var addKeywords = require('ajv-keywords');
9
- var lodashEs = require('lodash-es');
9
+ var esToolkit = require('es-toolkit');
10
10
  var dateFns = require('date-fns');
11
11
  var bson = require('bson');
12
12
  var index$1 = require('./index-82e1CXJX.cjs');
13
+ var compat = require('es-toolkit/compat');
13
14
  var http = require('http');
14
15
  var pino = require('pino');
15
16
  var node_os = require('node:os');
@@ -63,12 +64,12 @@ class RefExtractor {
63
64
  if (!this.refs.has(schemaRefName)) {
64
65
  this.refs.set(schemaRefName, null);
65
66
  }
66
- const newSchema2 = walk(lodashEs.omit(curr, [index.SCHEMA_REF_NAME, "nullable"]), ref);
67
+ const newSchema2 = walk(esToolkit.omit(curr, [index.SCHEMA_REF_NAME, "nullable"]), ref);
67
68
  const registeredSchema = this.refs.get(schemaRefName);
68
69
  if (registeredSchema === null) {
69
70
  this.refs.set(schemaRefName, newSchema2);
70
71
  this.onNewRef(schemaRefName, newSchema2);
71
- } else if (!lodashEs.isEqual(newSchema2, registeredSchema)) {
72
+ } else if (!esToolkit.isEqual(newSchema2, registeredSchema)) {
72
73
  this.onError(
73
74
  `Schema ${schemaRefName} is already defined with different content`,
74
75
  { registeredSchema, newSchema: newSchema2 }
@@ -145,7 +146,7 @@ function generateOpenAPISpec({
145
146
  services,
146
147
  getSecuritySchemes
147
148
  }) {
148
- services.forEach((svc) => lodashEs.merge(doc, svc.settings?.openapi));
149
+ services.forEach((svc) => esToolkit.merge(doc, svc.settings?.openapi));
149
150
  const extractor = new OpenAPIExtractor(doc);
150
151
  if (doc.components?.schemas) {
151
152
  const { schemas } = doc.components;
@@ -555,7 +556,7 @@ class LeafTransformerBase {
555
556
 
556
557
  class CoerceArrayTransformer extends LeafTransformerBase {
557
558
  beforeTransformer = (val) => {
558
- if (lodashEs.isArray(val) || val === null) {
559
+ if (Array.isArray(val) || val === null) {
559
560
  return val;
560
561
  }
561
562
  return [val];
@@ -573,11 +574,11 @@ class DateTransformer extends LeafTransformerBase {
573
574
  return val;
574
575
  };
575
576
  afterTransformer = (val) => {
576
- if (!lodashEs.isString(val)) {
577
+ if (typeof val !== "string") {
577
578
  return val;
578
579
  }
579
580
  const date = dateFns.parseISO(val);
580
- if (lodashEs.isNaN(date.getTime())) {
581
+ if (Number.isNaN(date.getTime())) {
581
582
  return val;
582
583
  }
583
584
  return date;
@@ -595,7 +596,7 @@ class ObjectIdTransformer extends LeafTransformerBase {
595
596
  return val;
596
597
  };
597
598
  afterTransformer = (val) => {
598
- if (lodashEs.isString(val) && /^[a-f\d]{24}$/i.test(val)) {
599
+ if (typeof val === "string" && /^[a-f\d]{24}$/i.test(val)) {
599
600
  return new bson.ObjectId(val);
600
601
  }
601
602
  return val;
@@ -612,7 +613,7 @@ function applyTransform(parent, dataKey, transformer, transformField, index) {
612
613
  const transformLevel = transformField[index];
613
614
  switch (transformLevel.type) {
614
615
  case "this": {
615
- if (!lodashEs.isPlainObject(parent) && !lodashEs.isArray(parent)) {
616
+ if (!esToolkit.isPlainObject(parent) && !Array.isArray(parent)) {
616
617
  return;
617
618
  }
618
619
  if (parent.hasOwnProperty(dataKey)) {
@@ -621,7 +622,7 @@ function applyTransform(parent, dataKey, transformer, transformField, index) {
621
622
  break;
622
623
  }
623
624
  case "access":
624
- if (!lodashEs.isPlainObject(parent[dataKey])) {
625
+ if (!esToolkit.isPlainObject(parent[dataKey])) {
625
626
  return;
626
627
  }
627
628
  applyTransform(
@@ -638,7 +639,7 @@ function applyTransform(parent, dataKey, transformer, transformField, index) {
638
639
  }
639
640
  break;
640
641
  case "loop": {
641
- if (!lodashEs.isArray(parent[dataKey])) {
642
+ if (!Array.isArray(parent[dataKey])) {
642
643
  return;
643
644
  }
644
645
  const cast = parent[dataKey];
@@ -744,7 +745,7 @@ class AjvValidator extends moleculer.Validators.Base {
744
745
  });
745
746
  validator.addFormat("object-id", {
746
747
  type: "string",
747
- validate: lodashEs.constant(true)
748
+ validate: () => true
748
749
  });
749
750
  }
750
751
  }
@@ -1108,11 +1109,11 @@ function getMetadataFromService(svc) {
1108
1109
  const res = {
1109
1110
  name: svc.name || "unknown"
1110
1111
  };
1111
- lodashEs.defaultsDeep(res, svc.metadata);
1112
+ compat.defaultsDeep(res, svc.metadata);
1112
1113
  svc.mixins?.forEach((mixin) => {
1113
- lodashEs.defaultsDeep(res, mixin.metadata);
1114
+ compat.defaultsDeep(res, mixin.metadata);
1114
1115
  mixin.mixins?.forEach((m) => {
1115
- lodashEs.defaultsDeep(res, getMetadataFromService(m));
1116
+ compat.defaultsDeep(res, getMetadataFromService(m));
1116
1117
  });
1117
1118
  });
1118
1119
  return res;
@@ -1125,7 +1126,7 @@ const DEFAULT_OPTIONS = {
1125
1126
  liveness: { path: "/live" }
1126
1127
  };
1127
1128
  function HealthCheckMiddleware(_opts) {
1128
- const opts = lodashEs.defaultsDeep(_opts, DEFAULT_OPTIONS);
1129
+ const opts = compat.defaultsDeep(_opts, DEFAULT_OPTIONS);
1129
1130
  let state = "down";
1130
1131
  let server;
1131
1132
  function handler(req, res) {
@@ -1293,7 +1294,7 @@ function flattenTags(obj, convertToString = false, path = "") {
1293
1294
  return Object.keys(obj).reduce((res, k) => {
1294
1295
  const o = obj[k];
1295
1296
  const pp = (path ? `${path}.` : "") + k;
1296
- if (lodashEs.isObject(o)) {
1297
+ if (compat.isObject(o)) {
1297
1298
  if ("toHexString" in o) {
1298
1299
  res[pp] = o.toString();
1299
1300
  } else {
@@ -1312,7 +1313,7 @@ class NewrelicTraceExporter extends moleculer.TracerExporters.Base {
1312
1313
  defaultTags = {};
1313
1314
  constructor(opts) {
1314
1315
  super(opts);
1315
- this.opts = lodashEs.defaultsDeep(this.opts, {
1316
+ this.opts = compat.defaultsDeep(this.opts, {
1316
1317
  baseURL: process.env.NEW_RELIC_TRACE_API_URL || "https://trace-api.newrelic.com",
1317
1318
  batchSize: 1e3,
1318
1319
  insertKey: "",
@@ -1330,7 +1331,7 @@ class NewrelicTraceExporter extends moleculer.TracerExporters.Base {
1330
1331
  this.timer = setInterval(() => this.flush(), this.opts.interval * 1e3);
1331
1332
  this.timer.unref();
1332
1333
  }
1333
- this.defaultTags = lodashEs.isFunction(this.opts.defaultTags) ? this.opts.defaultTags.call(this, tracer) : this.opts.defaultTags;
1334
+ this.defaultTags = typeof this.opts.defaultTags === "function" ? this.opts.defaultTags.call(this, tracer) : this.opts.defaultTags;
1334
1335
  if (this.defaultTags) {
1335
1336
  this.defaultTags = flattenTags(this.defaultTags, true);
1336
1337
  }
@@ -1430,7 +1431,7 @@ class NewrelicMetricsReporter extends moleculer.MetricReporters.Base {
1430
1431
  defaultTags = {};
1431
1432
  constructor(opts) {
1432
1433
  super(opts);
1433
- this.opts = lodashEs.defaultsDeep(this.opts, {
1434
+ this.opts = compat.defaultsDeep(this.opts, {
1434
1435
  baseURL: process.env.NEW_RELIC_METRICS_API_URL || "https://metric-api.newrelic.com",
1435
1436
  insertKey: "",
1436
1437
  interval: 10
@@ -1445,7 +1446,7 @@ class NewrelicMetricsReporter extends moleculer.MetricReporters.Base {
1445
1446
  this.timer = setInterval(() => this.flush(), this.opts.interval * 1e3);
1446
1447
  this.timer.unref();
1447
1448
  }
1448
- const defaultTags = lodashEs.isFunction(this.opts.defaultTags) ? this.opts.defaultTags.call(this, registry) : this.opts.defaultTags;
1449
+ const defaultTags = typeof this.opts.defaultTags === "function" ? this.opts.defaultTags.call(this, registry) : this.opts.defaultTags;
1449
1450
  if (defaultTags) {
1450
1451
  this.defaultTags = flattenTags(defaultTags, true);
1451
1452
  }
package/dist/index.mjs CHANGED
@@ -1,15 +1,16 @@
1
- import { S as SCHEMA_REF_NAME, z as zodToOpenAPISchema, o as omitFields, G as GetOpenApiParamsSchema, V as ValidationErrorSchema, F as FileTooBigSchema, a as FileNotExistSchema, U as UnauthorizedErrorSchema, b as ServerErrorSchema, C as COERCE_ARRAY_ATTRIBUTE } from './index-BmVULkqf.mjs';
2
- export { D as DATE_TYPE, E as EMPTY_OBJECT_SCHEMA, O as OBJECTID_TYPE, c as addFieldsToSchema, f as composeSchemas, j as createOpenAPIResponses, e as optionalExceptFields, d as optionalFields, p as pickFields, t as toPartialSchema, i as zodCoerceArray, g as zodDate, h as zodObjectId } from './index-BmVULkqf.mjs';
1
+ import { S as SCHEMA_REF_NAME, z as zodToOpenAPISchema, o as omitFields, G as GetOpenApiParamsSchema, V as ValidationErrorSchema, F as FileTooBigSchema, a as FileNotExistSchema, U as UnauthorizedErrorSchema, b as ServerErrorSchema, C as COERCE_ARRAY_ATTRIBUTE } from './index-yStjjADK.mjs';
2
+ export { D as DATE_TYPE, E as EMPTY_OBJECT_SCHEMA, O as OBJECTID_TYPE, c as addFieldsToSchema, f as composeSchemas, j as createOpenAPIResponses, e as optionalExceptFields, d as optionalFields, p as pickFields, t as toPartialSchema, i as zodCoerceArray, g as zodDate, h as zodObjectId } from './index-yStjjADK.mjs';
3
3
  import { ZodType, ZodObject, ZodOptional, z } from 'zod/v4';
4
4
  import { Ajv2019 } from 'ajv/dist/2019.js';
5
5
  import { Validators, Errors, Context, ServiceBroker, Service, TracerExporters, MetricReporters } from 'moleculer';
6
6
  import addFormats from 'ajv-formats';
7
7
  import addKeywords from 'ajv-keywords';
8
- import { omit, isEqual, merge, isArray, isString, isNaN, isPlainObject, constant, defaultsDeep, isObject, isFunction } from 'lodash-es';
8
+ import { omit, isEqual, merge, isPlainObject } from 'es-toolkit';
9
9
  import { parseISO } from 'date-fns';
10
10
  import { ObjectId } from 'bson';
11
11
  import { w as wrapMixin } from './index-DNJWwcZu.mjs';
12
12
  export { a as wrapService } from './index-DNJWwcZu.mjs';
13
+ import { defaultsDeep, isObject } from 'es-toolkit/compat';
13
14
  import http, { STATUS_CODES } from 'http';
14
15
  import { pino } from 'pino';
15
16
  import { hostname } from 'node:os';
@@ -555,7 +556,7 @@ class LeafTransformerBase {
555
556
 
556
557
  class CoerceArrayTransformer extends LeafTransformerBase {
557
558
  beforeTransformer = (val) => {
558
- if (isArray(val) || val === null) {
559
+ if (Array.isArray(val) || val === null) {
559
560
  return val;
560
561
  }
561
562
  return [val];
@@ -573,11 +574,11 @@ class DateTransformer extends LeafTransformerBase {
573
574
  return val;
574
575
  };
575
576
  afterTransformer = (val) => {
576
- if (!isString(val)) {
577
+ if (typeof val !== "string") {
577
578
  return val;
578
579
  }
579
580
  const date = parseISO(val);
580
- if (isNaN(date.getTime())) {
581
+ if (Number.isNaN(date.getTime())) {
581
582
  return val;
582
583
  }
583
584
  return date;
@@ -595,7 +596,7 @@ class ObjectIdTransformer extends LeafTransformerBase {
595
596
  return val;
596
597
  };
597
598
  afterTransformer = (val) => {
598
- if (isString(val) && /^[a-f\d]{24}$/i.test(val)) {
599
+ if (typeof val === "string" && /^[a-f\d]{24}$/i.test(val)) {
599
600
  return new ObjectId(val);
600
601
  }
601
602
  return val;
@@ -612,7 +613,7 @@ function applyTransform(parent, dataKey, transformer, transformField, index) {
612
613
  const transformLevel = transformField[index];
613
614
  switch (transformLevel.type) {
614
615
  case "this": {
615
- if (!isPlainObject(parent) && !isArray(parent)) {
616
+ if (!isPlainObject(parent) && !Array.isArray(parent)) {
616
617
  return;
617
618
  }
618
619
  if (parent.hasOwnProperty(dataKey)) {
@@ -638,7 +639,7 @@ function applyTransform(parent, dataKey, transformer, transformField, index) {
638
639
  }
639
640
  break;
640
641
  case "loop": {
641
- if (!isArray(parent[dataKey])) {
642
+ if (!Array.isArray(parent[dataKey])) {
642
643
  return;
643
644
  }
644
645
  const cast = parent[dataKey];
@@ -744,7 +745,7 @@ class AjvValidator extends Validators.Base {
744
745
  });
745
746
  validator.addFormat("object-id", {
746
747
  type: "string",
747
- validate: constant(true)
748
+ validate: () => true
748
749
  });
749
750
  }
750
751
  }
@@ -1330,7 +1331,7 @@ class NewrelicTraceExporter extends TracerExporters.Base {
1330
1331
  this.timer = setInterval(() => this.flush(), this.opts.interval * 1e3);
1331
1332
  this.timer.unref();
1332
1333
  }
1333
- this.defaultTags = isFunction(this.opts.defaultTags) ? this.opts.defaultTags.call(this, tracer) : this.opts.defaultTags;
1334
+ this.defaultTags = typeof this.opts.defaultTags === "function" ? this.opts.defaultTags.call(this, tracer) : this.opts.defaultTags;
1334
1335
  if (this.defaultTags) {
1335
1336
  this.defaultTags = flattenTags(this.defaultTags, true);
1336
1337
  }
@@ -1445,7 +1446,7 @@ class NewrelicMetricsReporter extends MetricReporters.Base {
1445
1446
  this.timer = setInterval(() => this.flush(), this.opts.interval * 1e3);
1446
1447
  this.timer.unref();
1447
1448
  }
1448
- const defaultTags = isFunction(this.opts.defaultTags) ? this.opts.defaultTags.call(this, registry) : this.opts.defaultTags;
1449
+ const defaultTags = typeof this.opts.defaultTags === "function" ? this.opts.defaultTags.call(this, registry) : this.opts.defaultTags;
1449
1450
  if (defaultTags) {
1450
1451
  this.defaultTags = flattenTags(defaultTags, true);
1451
1452
  }
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var v4 = require('zod/v4');
4
- var index = require('../index-BUXfgQp5.cjs');
4
+ var index = require('../index-CjA1_Io7.cjs');
5
5
  var moleculer = require('moleculer');
6
- var lodashEs = require('lodash-es');
6
+ var esToolkit = require('es-toolkit');
7
7
  var mongodb = require('mongodb');
8
8
  var index$1 = require('../index-82e1CXJX.cjs');
9
9
  var mixins_globalStore_mixin = require('./global-store.mixin.cjs');
10
+ var compat = require('es-toolkit/compat');
10
11
  require('bson');
11
12
  require('date-fns');
12
13
  require('zod');
@@ -835,14 +836,14 @@ function isIndexEqual(dbIdx, idx) {
835
836
  if (!dbIdx.collation || !opts?.collation) {
836
837
  return false;
837
838
  }
838
- if (!lodashEs.isMatch(dbIdx.collation, opts.collation)) {
839
+ if (!compat.isMatch(dbIdx.collation, opts.collation)) {
839
840
  return false;
840
841
  }
841
842
  }
842
843
  if (Boolean(dbIdx.sparse) !== Boolean(opts?.sparse)) {
843
844
  return false;
844
845
  }
845
- return dbIdx.expireAfterSeconds === opts?.expireAfterSeconds && dbIdx.unique === opts?.unique && lodashEs.isEqual(dbIdx.partialFilterExpression, opts?.partialFilterExpression);
846
+ return dbIdx.expireAfterSeconds === opts?.expireAfterSeconds && dbIdx.unique === opts?.unique && compat.isEqual(dbIdx.partialFilterExpression, opts?.partialFilterExpression);
846
847
  }
847
848
  function isOnAtlas() {
848
849
  return (MONGO_URL || MONGODB_URL).includes(".mongodb.net");
@@ -945,7 +946,7 @@ async function getIndexesDifference(collection, declaredIndexes = [], declaredSe
945
946
  });
946
947
  } else {
947
948
  const [dbIdx] = searchIndexes.splice(dbIdxPos, 1);
948
- if (!lodashEs.isEqual(dbIdx.latestDefinition, idx)) {
949
+ if (!esToolkit.isEqual(dbIdx.latestDefinition, idx)) {
949
950
  states.push({
950
951
  type: "searchIndex",
951
952
  name,
@@ -1115,18 +1116,18 @@ function filterObjectFields(obj, fields) {
1115
1116
  return obj;
1116
1117
  }
1117
1118
  let res = obj;
1118
- const [fieldsRemove, fieldsAdd] = lodashEs.partition(
1119
+ const [fieldsRemove, fieldsAdd] = esToolkit.partition(
1119
1120
  fields || [],
1120
1121
  (f) => f.startsWith("-")
1121
1122
  );
1122
1123
  if (fieldsRemove.length) {
1123
- res = lodashEs.omit(
1124
+ res = esToolkit.omit(
1124
1125
  res,
1125
1126
  fieldsRemove.map((f) => f.substring(1))
1126
1127
  );
1127
1128
  }
1128
1129
  if (fieldsAdd.length) {
1129
- res = lodashEs.pick(res, fieldsAdd);
1130
+ res = esToolkit.pick(res, fieldsAdd);
1130
1131
  }
1131
1132
  return res;
1132
1133
  }
@@ -1,10 +1,11 @@
1
1
  import { ZodType, z, ZodObject } from 'zod/v4';
2
- import { o as omitFields, d as optionalFields, S as SCHEMA_REF_NAME, O as OBJECTID_TYPE, C as COERCE_ARRAY_ATTRIBUTE, h as zodObjectId, i as zodCoerceArray, j as createOpenAPIResponses } from '../index-BmVULkqf.mjs';
2
+ import { o as omitFields, d as optionalFields, S as SCHEMA_REF_NAME, O as OBJECTID_TYPE, C as COERCE_ARRAY_ATTRIBUTE, h as zodObjectId, i as zodCoerceArray, j as createOpenAPIResponses } from '../index-yStjjADK.mjs';
3
3
  import { Errors } from 'moleculer';
4
- import { isMatch, isEqual, partition, omit, pick } from 'lodash-es';
4
+ import { isEqual as isEqual$1, partition, omit, pick } from 'es-toolkit';
5
5
  import { MongoClient } from 'mongodb';
6
6
  import { w as wrapMixin } from '../index-DNJWwcZu.mjs';
7
7
  import { GlobalStoreMixin } from './global-store.mixin.mjs';
8
+ import { isMatch, isEqual } from 'es-toolkit/compat';
8
9
  import 'bson';
9
10
  import 'date-fns';
10
11
  import 'zod';
@@ -943,7 +944,7 @@ async function getIndexesDifference(collection, declaredIndexes = [], declaredSe
943
944
  });
944
945
  } else {
945
946
  const [dbIdx] = searchIndexes.splice(dbIdxPos, 1);
946
- if (!isEqual(dbIdx.latestDefinition, idx)) {
947
+ if (!isEqual$1(dbIdx.latestDefinition, idx)) {
947
948
  states.push({
948
949
  type: "searchIndex",
949
950
  name,
@@ -2,7 +2,6 @@
2
2
 
3
3
  var moleculer = require('moleculer');
4
4
  var bullmq = require('bullmq');
5
- var lodashEs = require('lodash-es');
6
5
  var index = require('../index-82e1CXJX.cjs');
7
6
  var mixins_globalStore_mixin = require('./global-store.mixin.cjs');
8
7
  var ioredis = require('ioredis');
@@ -81,7 +80,7 @@ function QueueClient(queueName, opts) {
81
80
  `Queue client '${queueName}' already exists on service '${this.name}'`
82
81
  );
83
82
  }
84
- const key = lodashEs.isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
83
+ const key = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
85
84
  this[kKey] = key;
86
85
  let connection = this.getFromStore("redis", key);
87
86
  if (!connection) {
@@ -163,7 +162,7 @@ function QueueEventsClient(queueName, opts) {
163
162
  `Queue client '${queueName}' already exists on service '${this.name}'`
164
163
  );
165
164
  }
166
- const key = lodashEs.isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
165
+ const key = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
167
166
  this[kKey] = key;
168
167
  let connection = this.getFromStore("redis", key);
169
168
  if (!connection) {
@@ -214,7 +213,7 @@ function QueueFlowProducerMixin(opts) {
214
213
  `Queue Flow producer already exists on service '${this.name}'`
215
214
  );
216
215
  }
217
- const url = lodashEs.isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
216
+ const url = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
218
217
  const connection = createRedisConnection(url);
219
218
  this.$flowProducer = new bullmq.FlowProducer({ connection, ...opts });
220
219
  this[kConnection$1] = connection;
@@ -259,7 +258,7 @@ function QueueStaticRepeatableJobs(queueName, jobs, opts) {
259
258
  mixins: [mixins_globalStore_mixin.GlobalStoreMixin()],
260
259
  methods: {
261
260
  async registerRepeatableJobs() {
262
- const key = lodashEs.isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
261
+ const key = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
263
262
  this[kKey] = key;
264
263
  let connection = this.getFromStore("redis", key);
265
264
  if (!connection) {
@@ -384,7 +383,7 @@ function QueueWorker(queueName, opts, processorOptions = {}) {
384
383
  `A QueueWorker mixin was already on service '${this.name}'`
385
384
  );
386
385
  }
387
- const url = lodashEs.isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
386
+ const url = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
388
387
  const connection = createRedisConnection(url);
389
388
  const worker = new bullmq.Worker(queueName, this.processJob.bind(this), {
390
389
  connection,
@@ -1,6 +1,5 @@
1
1
  import { Errors } from 'moleculer';
2
2
  import { Queue, QueueEvents, FlowProducer, Worker } from 'bullmq';
3
- import { isFunction } from 'lodash-es';
4
3
  import { w as wrapMixin } from '../index-DNJWwcZu.mjs';
5
4
  import { GlobalStoreMixin } from './global-store.mixin.mjs';
6
5
  import { Redis } from 'ioredis';
@@ -79,7 +78,7 @@ function QueueClient(queueName, opts) {
79
78
  `Queue client '${queueName}' already exists on service '${this.name}'`
80
79
  );
81
80
  }
82
- const key = isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
81
+ const key = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
83
82
  this[kKey] = key;
84
83
  let connection = this.getFromStore("redis", key);
85
84
  if (!connection) {
@@ -161,7 +160,7 @@ function QueueEventsClient(queueName, opts) {
161
160
  `Queue client '${queueName}' already exists on service '${this.name}'`
162
161
  );
163
162
  }
164
- const key = isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
163
+ const key = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
165
164
  this[kKey] = key;
166
165
  let connection = this.getFromStore("redis", key);
167
166
  if (!connection) {
@@ -212,7 +211,7 @@ function QueueFlowProducerMixin(opts) {
212
211
  `Queue Flow producer already exists on service '${this.name}'`
213
212
  );
214
213
  }
215
- const url = isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
214
+ const url = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
216
215
  const connection = createRedisConnection(url);
217
216
  this.$flowProducer = new FlowProducer({ connection, ...opts });
218
217
  this[kConnection$1] = connection;
@@ -257,7 +256,7 @@ function QueueStaticRepeatableJobs(queueName, jobs, opts) {
257
256
  mixins: [GlobalStoreMixin()],
258
257
  methods: {
259
258
  async registerRepeatableJobs() {
260
- const key = isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
259
+ const key = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
261
260
  this[kKey] = key;
262
261
  let connection = this.getFromStore("redis", key);
263
262
  if (!connection) {
@@ -382,7 +381,7 @@ function QueueWorker(queueName, opts, processorOptions = {}) {
382
381
  `A QueueWorker mixin was already on service '${this.name}'`
383
382
  );
384
383
  }
385
- const url = isFunction(opts.brokerURL) ? await opts.brokerURL(this) : opts.brokerURL;
384
+ const url = typeof opts.brokerURL === "function" ? await opts.brokerURL(this) : opts.brokerURL;
386
385
  const connection = createRedisConnection(url);
387
386
  const worker = new Worker(queueName, this.processJob.bind(this), {
388
387
  connection,
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/treatwell/moleculer-essentials"
8
8
  },
9
- "version": "1.2.0",
9
+ "version": "1.2.1",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
12
12
  "types": "./dist/index.d.cts",
@@ -108,7 +108,7 @@
108
108
  "ajv-keywords": "^5.1.0",
109
109
  "bson": "^6.2.0",
110
110
  "date-fns": "^2.21.3",
111
- "lodash-es": "^4.17.21",
111
+ "es-toolkit": "^1.39.10",
112
112
  "pino": "^9.9.0",
113
113
  "pino-pretty": "^13.1.1"
114
114
  },
@@ -152,7 +152,6 @@
152
152
  "@treatwell/eslint-plugin-moleculer": "^1.1.0",
153
153
  "@tsconfig/node-lts": "^22.0.2",
154
154
  "@types/jsonwebtoken": "^9.0.10",
155
- "@types/lodash-es": "^4.17.12",
156
155
  "@types/node": "^24.3.0",
157
156
  "@types/redlock": "^4.0.7",
158
157
  "bullmq": "^5.12.10",