@treatwell/moleculer-essentials 1.2.3 → 1.3.0-beta.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,9 +1,8 @@
1
1
  import { omit, pick } from 'es-toolkit';
2
- import { z as z$1 } from 'zod/v4';
3
- import 'es-toolkit/compat';
4
2
  import { ObjectId } from 'bson';
5
3
  import { parseISO } from 'date-fns';
6
- import { z } from 'zod';
4
+ import { z } from 'zod/v4';
5
+ import 'es-toolkit/compat';
7
6
 
8
7
  const COERCE_ARRAY_ATTRIBUTE = "x-coerce-array";
9
8
  const SCHEMA_REF_NAME = "$id";
@@ -239,6 +238,18 @@ const zodObjectId = z.transform((val) => {
239
238
  function zodCoerceArray(element, params) {
240
239
  return z.transform((val) => !Array.isArray(val) && val !== void 0 ? [val] : val).pipe(z.array(element, params));
241
240
  }
241
+ function _isZodType(schema) {
242
+ if (!schema || typeof schema !== "object") {
243
+ return false;
244
+ }
245
+ return "_zod" in schema;
246
+ }
247
+ function isZodSchema(schema, type) {
248
+ if (!_isZodType(schema)) {
249
+ return false;
250
+ }
251
+ return type ? schema.type === type : true;
252
+ }
242
253
 
243
254
  const ServerErrorSchema = {
244
255
  type: "object",
@@ -322,10 +333,9 @@ const ValidationErrorSchema = {
322
333
  ]
323
334
  }
324
335
  };
325
- const GetOpenApiParamsSchema = z$1.object({ kind: z$1.string().optional() });
336
+ const GetOpenApiParamsSchema = z.object({ kind: z.string().optional() });
326
337
 
327
338
  function createOpenAPIResponses(model, description = "") {
328
- const isZodType = model instanceof z$1.ZodType;
329
339
  return {
330
340
  responses: {
331
341
  "200": {
@@ -335,8 +345,8 @@ function createOpenAPIResponses(model, description = "") {
335
345
  // @ts-expect-error Moleculer will clone this object using lodash,
336
346
  // losing the zod class instance. By using a function, we ensure
337
347
  // that clone doesn't break the zod instance
338
- zodInstance: isZodType ? () => model : void 0,
339
- schema: isZodType ? void 0 : model
348
+ zodInstance: isZodSchema(model) ? () => model : void 0,
349
+ schema: isZodSchema(model) ? void 0 : model
340
350
  }
341
351
  }
342
352
  }
@@ -344,4 +354,4 @@ function createOpenAPIResponses(model, description = "") {
344
354
  };
345
355
  }
346
356
 
347
- export { COERCE_ARRAY_ATTRIBUTE as C, DATE_TYPE as D, EMPTY_OBJECT_SCHEMA as E, FileTooBigSchema as F, GetOpenApiParamsSchema as G, OBJECTID_TYPE as O, SCHEMA_REF_NAME as S, UnauthorizedErrorSchema as U, ValidationErrorSchema as V, FileNotExistSchema as a, ServerErrorSchema as b, addFieldsToSchema as c, optionalFields as d, optionalExceptFields as e, composeSchemas as f, zodDate as g, zodObjectId as h, zodCoerceArray as i, createOpenAPIResponses as j, omitFields as o, pickFields as p, toPartialSchema as t, zodToOpenAPISchema as z };
357
+ export { COERCE_ARRAY_ATTRIBUTE as C, DATE_TYPE as D, EMPTY_OBJECT_SCHEMA as E, FileTooBigSchema as F, GetOpenApiParamsSchema as G, OBJECTID_TYPE as O, SCHEMA_REF_NAME as S, UnauthorizedErrorSchema as U, ValidationErrorSchema as V, FileNotExistSchema as a, ServerErrorSchema as b, addFieldsToSchema as c, optionalFields as d, optionalExceptFields as e, composeSchemas as f, zodDate as g, zodObjectId as h, isZodSchema as i, zodCoerceArray as j, createOpenAPIResponses as k, omitFields as o, pickFields as p, toPartialSchema as t, zodToOpenAPISchema as z };
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var esToolkit = require('es-toolkit');
4
- var v4 = require('zod/v4');
5
- require('es-toolkit/compat');
6
4
  var bson = require('bson');
7
5
  var dateFns = require('date-fns');
8
- var zod = require('zod');
6
+ var v4 = require('zod/v4');
7
+ require('es-toolkit/compat');
9
8
 
10
9
  const COERCE_ARRAY_ATTRIBUTE = "x-coerce-array";
11
10
  const SCHEMA_REF_NAME = "$id";
@@ -179,7 +178,7 @@ function deepRefReplacer(obj, extractor, currentId = "") {
179
178
  }
180
179
  }
181
180
  function zodToOpenAPISchema(schema, extractor) {
182
- const res = zod.z.toJSONSchema(schema, {
181
+ const res = v4.z.toJSONSchema(schema, {
183
182
  io: "input",
184
183
  unrepresentable: "any",
185
184
  override: ({ zodSchema, jsonSchema }) => {
@@ -219,7 +218,7 @@ function zodToOpenAPISchema(schema, extractor) {
219
218
  }
220
219
  return res;
221
220
  }
222
- const zodDate = zod.z.transform((val) => {
221
+ const zodDate = v4.z.transform((val) => {
223
222
  if (typeof val === "string") {
224
223
  const date = dateFns.parseISO(val);
225
224
  if (!Number.isNaN(date.getTime())) {
@@ -227,19 +226,31 @@ const zodDate = zod.z.transform((val) => {
227
226
  }
228
227
  }
229
228
  return val;
230
- }).pipe(zod.z.date());
229
+ }).pipe(v4.z.date());
231
230
  const OBJECT_ID_PATTERN = /^[a-f\d]{24}$/i;
232
231
  function isObjectId(val) {
233
232
  return val instanceof bson.ObjectId;
234
233
  }
235
- const zodObjectId = zod.z.transform((val) => {
234
+ const zodObjectId = v4.z.transform((val) => {
236
235
  if (typeof val === "string" && OBJECT_ID_PATTERN.test(val)) {
237
236
  return new bson.ObjectId(val);
238
237
  }
239
238
  return val;
240
- }).pipe(zod.z.custom(isObjectId, { abort: true })).meta({ id: "ObjectId" });
239
+ }).pipe(v4.z.custom(isObjectId, { abort: true })).meta({ id: "ObjectId" });
241
240
  function zodCoerceArray(element, params) {
242
- return zod.z.transform((val) => !Array.isArray(val) && val !== void 0 ? [val] : val).pipe(zod.z.array(element, params));
241
+ return v4.z.transform((val) => !Array.isArray(val) && val !== void 0 ? [val] : val).pipe(v4.z.array(element, params));
242
+ }
243
+ function _isZodType(schema) {
244
+ if (!schema || typeof schema !== "object") {
245
+ return false;
246
+ }
247
+ return "_zod" in schema;
248
+ }
249
+ function isZodSchema(schema, type) {
250
+ if (!_isZodType(schema)) {
251
+ return false;
252
+ }
253
+ return type ? schema.type === type : true;
243
254
  }
244
255
 
245
256
  const ServerErrorSchema = {
@@ -327,7 +338,6 @@ const ValidationErrorSchema = {
327
338
  const GetOpenApiParamsSchema = v4.z.object({ kind: v4.z.string().optional() });
328
339
 
329
340
  function createOpenAPIResponses(model, description = "") {
330
- const isZodType = model instanceof v4.z.ZodType;
331
341
  return {
332
342
  responses: {
333
343
  "200": {
@@ -337,8 +347,8 @@ function createOpenAPIResponses(model, description = "") {
337
347
  // @ts-expect-error Moleculer will clone this object using lodash,
338
348
  // losing the zod class instance. By using a function, we ensure
339
349
  // that clone doesn't break the zod instance
340
- zodInstance: isZodType ? () => model : void 0,
341
- schema: isZodType ? void 0 : model
350
+ zodInstance: isZodSchema(model) ? () => model : void 0,
351
+ schema: isZodSchema(model) ? void 0 : model
342
352
  }
343
353
  }
344
354
  }
@@ -360,6 +370,7 @@ exports.ValidationErrorSchema = ValidationErrorSchema;
360
370
  exports.addFieldsToSchema = addFieldsToSchema;
361
371
  exports.composeSchemas = composeSchemas;
362
372
  exports.createOpenAPIResponses = createOpenAPIResponses;
373
+ exports.isZodSchema = isZodSchema;
363
374
  exports.omitFields = omitFields;
364
375
  exports.optionalExceptFields = optionalExceptFields;
365
376
  exports.optionalFields = optionalFields;
@@ -347,8 +347,6 @@ interface CustomActionSchema<T = unknown> {
347
347
  hooks?: ActionHooks;
348
348
  params?: unknown;
349
349
  disableTransforms?: boolean;
350
- rateLimiter?: string;
351
- rateLimiterCountTowardDefault?: boolean;
352
350
  openAPINames?: string[] | null;
353
351
  openapi?: OperationObject;
354
352
  bodySchemaRefName?: string;
@@ -468,19 +466,20 @@ type ServiceEventSchema = ServiceEvent & {
468
466
  /**
469
467
  * This type represent what is accessible from the `this` in a service file.
470
468
  */
471
- type ServiceThis<Settings, Methods, Mixins, AdditionalProperties> = {
469
+ type ServiceThis<Settings, Methods, Mixins> = {
472
470
  actions: never;
473
471
  settings: Settings;
474
- } & Methods & AdditionalProperties & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
472
+ } & Methods & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
475
473
  /**
476
474
  * Type used for injecting `this` in an object.
477
475
  */
478
- type ObjectServiceThis<T, Settings, Methods, Mixins, AdditionalProperties> = T & ThisType<ServiceThis<Settings, Methods, Mixins, AdditionalProperties>>;
476
+ type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceThis<Settings, Methods, Mixins>>;
479
477
  /**
480
478
  * Type used for injecting `this` in a simple function.
481
479
  */
482
- type CallbackServiceThis<Return, Settings, Methods, Mixins, AdditionalProperties, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins, AdditionalProperties>, ...params: Parameters) => Return;
483
- interface CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties> {
480
+ type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins>, ...params: Parameters) => Return;
481
+
482
+ interface CustomServiceSchema<Settings, Methods, Mixins> {
484
483
  name: string;
485
484
  version?: string | number;
486
485
  dependencies?: OptionallyArray<string | ServiceDependency>;
@@ -488,14 +487,14 @@ interface CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties> {
488
487
  settings?: Settings;
489
488
  hooks?: ServiceHooks;
490
489
  mixins?: Mixins;
491
- methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins, AdditionalProperties>;
492
- actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins, AdditionalProperties>>;
493
- events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins, AdditionalProperties>>;
494
- created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins, AdditionalProperties>>;
495
- started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, AdditionalProperties>>;
496
- stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, AdditionalProperties>>;
497
- merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, AdditionalProperties, [
498
- CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties>
490
+ methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins>;
491
+ actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins>>;
492
+ events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins>>;
493
+ created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins>>;
494
+ started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
495
+ stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
496
+ merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
497
+ CustomServiceSchema<Settings, Methods, Mixins>
499
498
  ]>>;
500
499
  }
501
500
 
@@ -529,5 +528,5 @@ declare module 'pino' {
529
528
  }
530
529
  }
531
530
 
532
- export { createLogger as Q, createLoggerConfig as U, defaultLogger as W, ZodValidator as Z, AjvValidator as d, ContextFactory as i };
533
- export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
531
+ export { createLogger as W, createLoggerConfig as X, defaultLogger as Y, ZodValidator as Z, AjvValidator as d, ContextFactory as i };
532
+ export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ObjectServiceThis as Q, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, CallbackServiceThis as U, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
@@ -347,8 +347,6 @@ interface CustomActionSchema<T = unknown> {
347
347
  hooks?: ActionHooks;
348
348
  params?: unknown;
349
349
  disableTransforms?: boolean;
350
- rateLimiter?: string;
351
- rateLimiterCountTowardDefault?: boolean;
352
350
  openAPINames?: string[] | null;
353
351
  openapi?: OperationObject;
354
352
  bodySchemaRefName?: string;
@@ -468,19 +466,20 @@ type ServiceEventSchema = ServiceEvent & {
468
466
  /**
469
467
  * This type represent what is accessible from the `this` in a service file.
470
468
  */
471
- type ServiceThis<Settings, Methods, Mixins, AdditionalProperties> = {
469
+ type ServiceThis<Settings, Methods, Mixins> = {
472
470
  actions: never;
473
471
  settings: Settings;
474
- } & Methods & AdditionalProperties & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
472
+ } & Methods & Service & UnionToIntersection<Unpacked<Mixins>>['methods'] & Record<string | symbol, unknown>;
475
473
  /**
476
474
  * Type used for injecting `this` in an object.
477
475
  */
478
- type ObjectServiceThis<T, Settings, Methods, Mixins, AdditionalProperties> = T & ThisType<ServiceThis<Settings, Methods, Mixins, AdditionalProperties>>;
476
+ type ObjectServiceThis<T, Settings, Methods, Mixins> = T & ThisType<ServiceThis<Settings, Methods, Mixins>>;
479
477
  /**
480
478
  * Type used for injecting `this` in a simple function.
481
479
  */
482
- type CallbackServiceThis<Return, Settings, Methods, Mixins, AdditionalProperties, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins, AdditionalProperties>, ...params: Parameters) => Return;
483
- interface CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties> {
480
+ type CallbackServiceThis<Return, Settings, Methods, Mixins, Parameters extends unknown[] = []> = (this: ServiceThis<Settings, Methods, Mixins>, ...params: Parameters) => Return;
481
+
482
+ interface CustomServiceSchema<Settings, Methods, Mixins> {
484
483
  name: string;
485
484
  version?: string | number;
486
485
  dependencies?: OptionallyArray<string | ServiceDependency>;
@@ -488,14 +487,14 @@ interface CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties> {
488
487
  settings?: Settings;
489
488
  hooks?: ServiceHooks;
490
489
  mixins?: Mixins;
491
- methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins, AdditionalProperties>;
492
- actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins, AdditionalProperties>>;
493
- events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins, AdditionalProperties>>;
494
- created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins, AdditionalProperties>>;
495
- started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, AdditionalProperties>>;
496
- stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, AdditionalProperties>>;
497
- merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, AdditionalProperties, [
498
- CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties>
490
+ methods?: ObjectServiceThis<Methods, Settings, Methods, Mixins>;
491
+ actions?: Record<string, ObjectServiceThis<CustomActionSchema, Settings, Methods, Mixins>>;
492
+ events?: Record<string, ObjectServiceThis<ServiceEventSchema, Settings, Methods, Mixins>>;
493
+ created?: OptionallyArray<CallbackServiceThis<void, Settings, Methods, Mixins>>;
494
+ started?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
495
+ stopped?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins>>;
496
+ merged?: OptionallyArray<CallbackServiceThis<Promise<void> | void, Settings, Methods, Mixins, [
497
+ CustomServiceSchema<Settings, Methods, Mixins>
499
498
  ]>>;
500
499
  }
501
500
 
@@ -529,5 +528,5 @@ declare module 'pino' {
529
528
  }
530
529
  }
531
530
 
532
- export { createLogger as Q, createLoggerConfig as U, defaultLogger as W, ZodValidator as Z, AjvValidator as d, ContextFactory as i };
533
- export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
531
+ export { createLogger as W, createLoggerConfig as X, defaultLogger as Y, ZodValidator as Z, AjvValidator as d, ContextFactory as i };
532
+ export type { Alias as A, SecuritySchemeObject as B, CustomActionSchema as C, Document as D, ExternalDocumentationObject as E, CallbackObject as F, ComponentsObject as G, HeaderObject as H, InfoObject as I, JSONSchemaType as J, TagObject as K, LicenseObject as L, MediaTypeObject as M, PathItemObject as N, OperationObject as O, PropertiesSchema as P, ObjectServiceThis as Q, ReferenceObject as R, SomeJSONSchema as S, Transformer as T, CallbackServiceThis as U, ValidationSchema as V, CustomServiceSchema as a, SchemaObject as b, RequiredMembers as c, Transform as e, TransformLevel as f, TransformMap as g, TransformField as h, ContactObject as j, ServerVariableObject as k, ServerObject as l, PathsObject as m, ParameterObject as n, ParameterBaseObject as o, ExampleObject as p, EncodingObject as q, RequestBodyObject as r, LinkObject as s, ResponseObject as t, ResponsesObject as u, SecurityRequirementObject as v, HttpSecurityScheme as w, ApiKeySecurityScheme as x, OAuth2SecurityScheme as y, OpenIdSecurityScheme as z };
package/dist/index.cjs CHANGED
@@ -1,20 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BuNrZnJ4.cjs');
4
- var v4 = require('zod/v4');
5
- var _2019_js = require('ajv/dist/2019.js');
3
+ var index = require('./index-CjPjJvVl.cjs');
4
+ var _2019_ts = require('ajv/dist/2019.ts');
6
5
  var moleculer = require('moleculer');
7
6
  var addFormats = require('ajv-formats');
8
7
  var addKeywords = require('ajv-keywords');
9
8
  var esToolkit = require('es-toolkit');
10
9
  var dateFns = require('date-fns');
11
10
  var bson = require('bson');
11
+ var v4 = require('zod/v4');
12
12
  var index$1 = require('./index-82e1CXJX.cjs');
13
13
  var compat = require('es-toolkit/compat');
14
14
  var http = require('http');
15
15
  var pino = require('pino');
16
16
  var node_os = require('node:os');
17
- require('zod');
18
17
 
19
18
  function getSchemaFromMoleculer(schema) {
20
19
  if (!schema) {
@@ -191,7 +190,7 @@ function createOperationFromAlias(alias, extractor, url) {
191
190
  extractor.setMeta({ url, alias });
192
191
  const pathParams = url.match(/{(\w+)}/g) || [];
193
192
  const params = getSchemaFromMoleculer(alias.action.params);
194
- if (params instanceof v4.ZodType) {
193
+ if (index.isZodSchema(params)) {
195
194
  ({ parameters, requestBody } = createOperationFromZodParams(
196
195
  params,
197
196
  pathParams,
@@ -306,7 +305,7 @@ function createOperationFromAjvParams(params, pathParams, alias, extractor) {
306
305
  function createOperationFromZodParams(params, pathParams, alias, extractor) {
307
306
  const parameters = [];
308
307
  let requestBody;
309
- if (!(params instanceof v4.ZodObject)) {
308
+ if (!index.isZodSchema(params, "object")) {
310
309
  throw new Error(
311
310
  `Expected params to be an ZodObject in ${alias.actionName}`
312
311
  );
@@ -330,7 +329,7 @@ function createOperationFromZodParams(params, pathParams, alias, extractor) {
330
329
  in: "query",
331
330
  name: key,
332
331
  schema: index.zodToOpenAPISchema(val, extractor),
333
- required: !(val instanceof v4.ZodOptional)
332
+ required: !index.isZodSchema(val, "optional")
334
333
  }))
335
334
  );
336
335
  } else if (params) {
@@ -745,7 +744,7 @@ class AjvValidator extends moleculer.Validators.Base {
745
744
  this.zodValidator = zodValidator;
746
745
  this.modes = /* @__PURE__ */ new Map();
747
746
  for (const [mode, ajvOpts] of Object.entries(opts)) {
748
- const validator = new _2019_js.Ajv2019(ajvOpts);
747
+ const validator = new _2019_ts.Ajv2019(ajvOpts);
749
748
  this.modes.set(mode, {
750
749
  validator,
751
750
  extractor: new AjvExtractor(validator)
@@ -763,7 +762,7 @@ class AjvValidator extends moleculer.Validators.Base {
763
762
  }
764
763
  }
765
764
  validate(params, schema) {
766
- if (schema instanceof v4.ZodType) {
765
+ if (index.isZodSchema(schema)) {
767
766
  if (!this.zodValidator) {
768
767
  throw new Error("No validator to handle zod schemas");
769
768
  }
@@ -861,7 +860,7 @@ ${(errors || []).map(
861
860
  if (!schema) {
862
861
  return handler;
863
862
  }
864
- if (schema instanceof v4.ZodType) {
863
+ if (index.isZodSchema(schema)) {
865
864
  return zodMiddleware.localAction(
866
865
  handler,
867
866
  action
@@ -878,7 +877,7 @@ ${(errors || []).map(
878
877
  if (!schema) {
879
878
  return handler;
880
879
  }
881
- if (schema instanceof v4.ZodType) {
880
+ if (index.isZodSchema(schema)) {
882
881
  return zodMiddleware.localEvent(
883
882
  handler,
884
883
  event
@@ -1602,6 +1601,7 @@ exports.SCHEMA_REF_NAME = index.SCHEMA_REF_NAME;
1602
1601
  exports.addFieldsToSchema = index.addFieldsToSchema;
1603
1602
  exports.composeSchemas = index.composeSchemas;
1604
1603
  exports.createOpenAPIResponses = index.createOpenAPIResponses;
1604
+ exports.isZodSchema = index.isZodSchema;
1605
1605
  exports.omitFields = index.omitFields;
1606
1606
  exports.optionalExceptFields = index.optionalExceptFields;
1607
1607
  exports.optionalFields = index.optionalFields;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
- import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-IHCgtNKZ.cjs';
2
- export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator, Q as createLogger, U as createLoggerConfig, W as defaultLogger } from './index-IHCgtNKZ.cjs';
1
+ import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-TXVFWos4.cjs';
2
+ export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, U as InternalCallbackServiceThis, Q as InternalObjectServiceThis, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator, W as createLogger, X as createLoggerConfig, Y as defaultLogger } from './index-TXVFWos4.cjs';
3
3
  import { ObjectId } from 'bson';
4
- import { ZodType, z as z$1 } from 'zod';
5
- import { z } from 'zod/v4';
4
+ import { z, ZodType } from 'zod/v4';
6
5
  import { Ajv2019 } from 'ajv/dist/2019.js';
7
6
  import * as Moleculer from 'moleculer';
8
7
  import { Context, ServiceSchema, ServiceSettingSchema, Service, ServiceBroker, BrokerOptions, Middleware, TracerExporters, LoggerInstance, Tracer, Span, MetricReporters, MetricRegistry, MetricReporterOptions } from 'moleculer';
@@ -132,7 +131,7 @@ declare function OpenAPIMixin(options: OpenAPIMixinOptions): Partial<CustomServi
132
131
  * Generate the OpenAPI schema for the specified kind.
133
132
  */
134
133
  generateSchema(ctx: Context, kind?: string): Promise<Document>;
135
- }, unknown, unknown>>;
134
+ }, unknown>>;
136
135
 
137
136
  /**
138
137
  * This class walks through a JSON schema and extracts all the refs.
@@ -174,9 +173,10 @@ declare function createOpenAPIResponses(model: OpenAPIResponses, description?: s
174
173
  * For this, you should use helpers provided by this package.
175
174
  */
176
175
  declare function zodToOpenAPISchema(schema: ZodType, extractor: OpenAPIExtractor): SchemaObject | ReferenceObject;
177
- declare const zodDate: z$1.ZodPipe<z$1.ZodTransform<unknown, unknown>, z$1.ZodDate>;
178
- declare const zodObjectId: z$1.ZodPipe<z$1.ZodTransform<unknown, unknown>, z$1.ZodCustom<ObjectId, ObjectId>>;
179
- declare function zodCoerceArray<T extends ZodType>(element: T, params?: Parameters<typeof z$1.array>[1]): z$1.ZodPipe<z$1.ZodTransform<any[] | undefined, unknown>, z$1.ZodArray<T>>;
176
+ declare const zodDate: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDate>;
177
+ declare const zodObjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCustom<ObjectId, ObjectId>>;
178
+ declare function zodCoerceArray<T extends ZodType>(element: T, params?: Parameters<typeof z.array>[1]): z.ZodPipe<z.ZodTransform<any[] | undefined, unknown>, z.ZodArray<T>>;
179
+ declare function isZodSchema<S extends z.ZodType>(schema: unknown, type?: S['type']): schema is S;
180
180
 
181
181
  declare class AjvExtractor extends RefExtractor {
182
182
  private readonly ajv;
@@ -199,7 +199,7 @@ declare class AjvExtractor extends RefExtractor {
199
199
  *
200
200
  * For now, only methods are typed.
201
201
  */
202
- declare function wrapMixin<Settings, Methods, Mixins, AdditionalProperties>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties>>): typeof svc;
202
+ declare function wrapMixin<Settings, Methods, Mixins>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins>>): typeof svc;
203
203
  /**
204
204
  * This function is a NO-OP and is only useful for Typescript types.
205
205
  * Using Generic arguments allows TS to infer types directly from the object
@@ -208,7 +208,7 @@ declare function wrapMixin<Settings, Methods, Mixins, AdditionalProperties>(svc:
208
208
  * For the wrapService fn, it will return a moleculer ServiceSchema that will stripe
209
209
  * out every smart typing of methods. This should never be used inside a mixin.
210
210
  */
211
- declare function wrapService<Settings, Methods, Mixins, AdditionalProperties>(svc: CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties>): ServiceSchema;
211
+ declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): ServiceSchema;
212
212
 
213
213
  /**
214
214
  * This class replace the default Service class in Moleculer to:
@@ -365,5 +365,5 @@ declare class NewrelicMetricsReporter extends MetricReporters.Base {
365
365
  generateMetricsPayload(): unknown[];
366
366
  }
367
367
 
368
- export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, NewrelicMetricsReporter, NewrelicTraceExporter, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
368
+ export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, NewrelicMetricsReporter, NewrelicTraceExporter, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
369
369
  export type { OpenAPIMixinOptions, OpenAPIResponses, Selector };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,7 @@
1
- import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-IHCgtNKZ.mjs';
2
- export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator, Q as createLogger, U as createLoggerConfig, W as defaultLogger } from './index-IHCgtNKZ.mjs';
1
+ import { J as JSONSchemaType, S as SomeJSONSchema, C as CustomActionSchema, A as Alias, a as CustomServiceSchema, D as Document, b as SchemaObject, O as OperationObject, R as ReferenceObject } from './index-TXVFWos4.mjs';
2
+ export { d as AjvValidator, x as ApiKeySecurityScheme, F as CallbackObject, G as ComponentsObject, j as ContactObject, i as ContextFactory, q as EncodingObject, p as ExampleObject, E as ExternalDocumentationObject, H as HeaderObject, w as HttpSecurityScheme, I as InfoObject, U as InternalCallbackServiceThis, Q as InternalObjectServiceThis, L as LicenseObject, s as LinkObject, M as MediaTypeObject, y as OAuth2SecurityScheme, z as OpenIdSecurityScheme, o as ParameterBaseObject, n as ParameterObject, N as PathItemObject, m as PathsObject, P as PropertiesSchema, r as RequestBodyObject, c as RequiredMembers, t as ResponseObject, u as ResponsesObject, v as SecurityRequirementObject, B as SecuritySchemeObject, l as ServerObject, k as ServerVariableObject, K as TagObject, e as Transform, h as TransformField, f as TransformLevel, g as TransformMap, T as Transformer, V as ValidationSchema, Z as ZodValidator, W as createLogger, X as createLoggerConfig, Y as defaultLogger } from './index-TXVFWos4.mjs';
3
3
  import { ObjectId } from 'bson';
4
- import { ZodType, z as z$1 } from 'zod';
5
- import { z } from 'zod/v4';
4
+ import { z, ZodType } from 'zod/v4';
6
5
  import { Ajv2019 } from 'ajv/dist/2019.js';
7
6
  import * as Moleculer from 'moleculer';
8
7
  import { Context, ServiceSchema, ServiceSettingSchema, Service, ServiceBroker, BrokerOptions, Middleware, TracerExporters, LoggerInstance, Tracer, Span, MetricReporters, MetricRegistry, MetricReporterOptions } from 'moleculer';
@@ -132,7 +131,7 @@ declare function OpenAPIMixin(options: OpenAPIMixinOptions): Partial<CustomServi
132
131
  * Generate the OpenAPI schema for the specified kind.
133
132
  */
134
133
  generateSchema(ctx: Context, kind?: string): Promise<Document>;
135
- }, unknown, unknown>>;
134
+ }, unknown>>;
136
135
 
137
136
  /**
138
137
  * This class walks through a JSON schema and extracts all the refs.
@@ -174,9 +173,10 @@ declare function createOpenAPIResponses(model: OpenAPIResponses, description?: s
174
173
  * For this, you should use helpers provided by this package.
175
174
  */
176
175
  declare function zodToOpenAPISchema(schema: ZodType, extractor: OpenAPIExtractor): SchemaObject | ReferenceObject;
177
- declare const zodDate: z$1.ZodPipe<z$1.ZodTransform<unknown, unknown>, z$1.ZodDate>;
178
- declare const zodObjectId: z$1.ZodPipe<z$1.ZodTransform<unknown, unknown>, z$1.ZodCustom<ObjectId, ObjectId>>;
179
- declare function zodCoerceArray<T extends ZodType>(element: T, params?: Parameters<typeof z$1.array>[1]): z$1.ZodPipe<z$1.ZodTransform<any[] | undefined, unknown>, z$1.ZodArray<T>>;
176
+ declare const zodDate: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDate>;
177
+ declare const zodObjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCustom<ObjectId, ObjectId>>;
178
+ declare function zodCoerceArray<T extends ZodType>(element: T, params?: Parameters<typeof z.array>[1]): z.ZodPipe<z.ZodTransform<any[] | undefined, unknown>, z.ZodArray<T>>;
179
+ declare function isZodSchema<S extends z.ZodType>(schema: unknown, type?: S['type']): schema is S;
180
180
 
181
181
  declare class AjvExtractor extends RefExtractor {
182
182
  private readonly ajv;
@@ -199,7 +199,7 @@ declare class AjvExtractor extends RefExtractor {
199
199
  *
200
200
  * For now, only methods are typed.
201
201
  */
202
- declare function wrapMixin<Settings, Methods, Mixins, AdditionalProperties>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties>>): typeof svc;
202
+ declare function wrapMixin<Settings, Methods, Mixins>(svc: Partial<CustomServiceSchema<Settings, Methods, Mixins>>): typeof svc;
203
203
  /**
204
204
  * This function is a NO-OP and is only useful for Typescript types.
205
205
  * Using Generic arguments allows TS to infer types directly from the object
@@ -208,7 +208,7 @@ declare function wrapMixin<Settings, Methods, Mixins, AdditionalProperties>(svc:
208
208
  * For the wrapService fn, it will return a moleculer ServiceSchema that will stripe
209
209
  * out every smart typing of methods. This should never be used inside a mixin.
210
210
  */
211
- declare function wrapService<Settings, Methods, Mixins, AdditionalProperties>(svc: CustomServiceSchema<Settings, Methods, Mixins, AdditionalProperties>): ServiceSchema;
211
+ declare function wrapService<Settings, Methods, Mixins>(svc: CustomServiceSchema<Settings, Methods, Mixins>): ServiceSchema;
212
212
 
213
213
  /**
214
214
  * This class replace the default Service class in Moleculer to:
@@ -365,5 +365,5 @@ declare class NewrelicMetricsReporter extends MetricReporters.Base {
365
365
  generateMetricsPayload(): unknown[];
366
366
  }
367
367
 
368
- export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, NewrelicMetricsReporter, NewrelicTraceExporter, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
368
+ export { AjvExtractor, Alias, COERCE_ARRAY_ATTRIBUTE, CustomActionSchema, CustomServiceSchema, DATE_TYPE, Document, EMPTY_OBJECT_SCHEMA, HealthCheckMiddleware, JSONSchemaType, NewrelicMetricsReporter, NewrelicTraceExporter, OBJECTID_TYPE, OpenAPIExtractor, OpenAPIMixin, OperationObject, RefExtractor, ReferenceObject, SCHEMA_REF_NAME, SchemaObject, ServiceFactory, SomeJSONSchema, addFieldsToSchema, composeSchemas, createOpenAPIResponses, createServiceBroker, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, optionalExceptFields, optionalFields, pickFields, toPartialSchema, wrapMixin, wrapService, zodCoerceArray, zodDate, zodObjectId, zodToOpenAPISchema };
369
369
  export type { OpenAPIMixinOptions, OpenAPIResponses, Selector };
package/dist/index.mjs CHANGED
@@ -1,20 +1,19 @@
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-DAz9xV2z.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-DAz9xV2z.mjs';
3
- import { ZodType, ZodObject, ZodOptional, z } from 'zod/v4';
4
- import { Ajv2019 } from 'ajv/dist/2019.js';
1
+ import { S as SCHEMA_REF_NAME, i as isZodSchema, 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-B6AujuxZ.mjs';
2
+ export { D as DATE_TYPE, E as EMPTY_OBJECT_SCHEMA, O as OBJECTID_TYPE, c as addFieldsToSchema, f as composeSchemas, k as createOpenAPIResponses, e as optionalExceptFields, d as optionalFields, p as pickFields, t as toPartialSchema, j as zodCoerceArray, g as zodDate, h as zodObjectId } from './index-B6AujuxZ.mjs';
3
+ import { Ajv2019 } from 'ajv/dist/2019.ts';
5
4
  import { Validators, Errors, Context, ServiceBroker, Service, TracerExporters, MetricReporters } from 'moleculer';
6
5
  import addFormats from 'ajv-formats';
7
6
  import addKeywords from 'ajv-keywords';
8
7
  import { omit, isEqual, isPlainObject } from 'es-toolkit';
9
8
  import { parseISO } from 'date-fns';
10
9
  import { ObjectId } from 'bson';
10
+ import { z } from 'zod/v4';
11
11
  import { w as wrapMixin } from './index-DNJWwcZu.mjs';
12
12
  export { a as wrapService } from './index-DNJWwcZu.mjs';
13
13
  import { merge, defaultsDeep, isObject } from 'es-toolkit/compat';
14
14
  import http, { STATUS_CODES } from 'http';
15
15
  import { pino } from 'pino';
16
16
  import { hostname } from 'node:os';
17
- import 'zod';
18
17
 
19
18
  function getSchemaFromMoleculer(schema) {
20
19
  if (!schema) {
@@ -191,7 +190,7 @@ function createOperationFromAlias(alias, extractor, url) {
191
190
  extractor.setMeta({ url, alias });
192
191
  const pathParams = url.match(/{(\w+)}/g) || [];
193
192
  const params = getSchemaFromMoleculer(alias.action.params);
194
- if (params instanceof ZodType) {
193
+ if (isZodSchema(params)) {
195
194
  ({ parameters, requestBody } = createOperationFromZodParams(
196
195
  params,
197
196
  pathParams,
@@ -306,7 +305,7 @@ function createOperationFromAjvParams(params, pathParams, alias, extractor) {
306
305
  function createOperationFromZodParams(params, pathParams, alias, extractor) {
307
306
  const parameters = [];
308
307
  let requestBody;
309
- if (!(params instanceof ZodObject)) {
308
+ if (!isZodSchema(params, "object")) {
310
309
  throw new Error(
311
310
  `Expected params to be an ZodObject in ${alias.actionName}`
312
311
  );
@@ -330,7 +329,7 @@ function createOperationFromZodParams(params, pathParams, alias, extractor) {
330
329
  in: "query",
331
330
  name: key,
332
331
  schema: zodToOpenAPISchema(val, extractor),
333
- required: !(val instanceof ZodOptional)
332
+ required: !isZodSchema(val, "optional")
334
333
  }))
335
334
  );
336
335
  } else if (params) {
@@ -763,7 +762,7 @@ class AjvValidator extends Validators.Base {
763
762
  }
764
763
  }
765
764
  validate(params, schema) {
766
- if (schema instanceof ZodType) {
765
+ if (isZodSchema(schema)) {
767
766
  if (!this.zodValidator) {
768
767
  throw new Error("No validator to handle zod schemas");
769
768
  }
@@ -861,7 +860,7 @@ ${(errors || []).map(
861
860
  if (!schema) {
862
861
  return handler;
863
862
  }
864
- if (schema instanceof ZodType) {
863
+ if (isZodSchema(schema)) {
865
864
  return zodMiddleware.localAction(
866
865
  handler,
867
866
  action
@@ -878,7 +877,7 @@ ${(errors || []).map(
878
877
  if (!schema) {
879
878
  return handler;
880
879
  }
881
- if (schema instanceof ZodType) {
880
+ if (isZodSchema(schema)) {
882
881
  return zodMiddleware.localEvent(
883
882
  handler,
884
883
  event
@@ -1594,4 +1593,4 @@ class NewrelicMetricsReporter extends MetricReporters.Base {
1594
1593
  }
1595
1594
  }
1596
1595
 
1597
- export { AjvExtractor, AjvValidator, COERCE_ARRAY_ATTRIBUTE, ContextFactory, HealthCheckMiddleware, NewrelicMetricsReporter, NewrelicTraceExporter, OpenAPIExtractor, OpenAPIMixin, RefExtractor, SCHEMA_REF_NAME, ServiceFactory, ZodValidator, createLogger, createLoggerConfig, createServiceBroker, defaultLogger, getMetadataFromService, isServiceSelected, omitFields, wrapMixin, zodToOpenAPISchema };
1596
+ export { AjvExtractor, AjvValidator, COERCE_ARRAY_ATTRIBUTE, ContextFactory, HealthCheckMiddleware, NewrelicMetricsReporter, NewrelicTraceExporter, OpenAPIExtractor, OpenAPIMixin, RefExtractor, SCHEMA_REF_NAME, ServiceFactory, ZodValidator, createLogger, createLoggerConfig, createServiceBroker, defaultLogger, getMetadataFromService, isServiceSelected, isZodSchema, omitFields, wrapMixin, zodToOpenAPISchema };
@@ -1,16 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var v4 = require('zod/v4');
4
- var index = require('../index-BuNrZnJ4.cjs');
3
+ var index = require('../index-CjPjJvVl.cjs');
5
4
  var moleculer = require('moleculer');
6
5
  var esToolkit = require('es-toolkit');
6
+ var v4 = require('zod/v4');
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
10
  var compat = require('es-toolkit/compat');
11
11
  require('bson');
12
12
  require('date-fns');
13
- require('zod');
14
13
 
15
14
  const { MoleculerClientError } = moleculer.Errors;
16
15
  class EntityNotFoundError extends MoleculerClientError {
@@ -324,7 +323,7 @@ function parseAndValidateQuery(validator, schema, sQuery) {
324
323
  return {};
325
324
  }
326
325
  let query = parseStringifiedQuery(sQuery);
327
- if (schema instanceof v4.ZodType) {
326
+ if (index.isZodSchema(schema)) {
328
327
  query = validator.validate(query, schema);
329
328
  } else {
330
329
  validator.validate(query, schema);
@@ -338,7 +337,7 @@ class ZodActionSchemaFactory {
338
337
  this.opts = opts;
339
338
  const { schema, tenantField } = opts;
340
339
  if (schema) {
341
- if (!(schema instanceof v4.ZodObject)) {
340
+ if (!index.isZodSchema(schema, "object")) {
342
341
  throw new Error("Schema must be a ZodObject");
343
342
  }
344
343
  if (tenantField) {
@@ -361,7 +360,7 @@ class ZodActionSchemaFactory {
361
360
  return this.schemaWithDbFields;
362
361
  }
363
362
  const { timestamps, schema, schemaName } = this.opts;
364
- if (!schema || !(schema instanceof v4.ZodObject)) {
363
+ if (!index.isZodSchema(schema, "object")) {
365
364
  throw new Error("Schema is not a ZodObject");
366
365
  }
367
366
  let res = schema.required({ _id: true });
@@ -463,7 +462,7 @@ class ZodActionSchemaFactory {
463
462
  createCreateParams(params) {
464
463
  const { schema } = this.opts;
465
464
  const { allowClientId } = params;
466
- if (!schema || !(schema instanceof v4.ZodObject)) {
465
+ if (!index.isZodSchema(schema, "object")) {
467
466
  throw new Error("Schema is not a ZodObject");
468
467
  }
469
468
  if (allowClientId) {
@@ -473,7 +472,7 @@ class ZodActionSchemaFactory {
473
472
  }
474
473
  createUpdateParams() {
475
474
  const { tenantField, schema } = this.opts;
476
- if (!schema || !(schema instanceof v4.ZodObject)) {
475
+ if (!index.isZodSchema(schema, "object")) {
477
476
  throw new Error("Schema is not a ZodObject");
478
477
  }
479
478
  const mask = { _id: true };
@@ -516,7 +515,7 @@ const PUBLISHABLE_ACTIONS = [
516
515
  ];
517
516
  function createActions(opts) {
518
517
  const actions = {};
519
- const factory = opts.actions?.schemaFactory || (opts.actions?.schema instanceof v4.ZodType ? new ZodActionSchemaFactory({
518
+ const factory = opts.actions?.schemaFactory || (index.isZodSchema(opts.actions?.schema) ? new ZodActionSchemaFactory({
520
519
  schemaName: opts.actions.schemaName,
521
520
  schema: opts.actions.schema,
522
521
  timestamps: opts.timestamps,
@@ -1,7 +1,7 @@
1
1
  import { Document, WithoutId, InferIdType, ObjectId, Filter, WithId, OptionalId, FindOptions, CountDocumentsOptions, FindOneAndUpdateOptions, BulkWriteOptions, UpdateOptions, FindOneAndReplaceOptions, FindOneAndDeleteOptions, DeleteOptions, CollationOptions, CreateCollectionOptions, MongoClient, CollectionOptions, Collection, UpdateFilter, FindCursor, UpdateResult } from 'mongodb';
2
2
  import { ActionVisibility, BaseValidator, Errors, Context } from 'moleculer';
3
3
  import { ZodType, ZodObject } from 'zod/v4';
4
- import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
4
+ import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
5
5
  import { Readable } from 'stream';
6
6
  import 'bson';
7
7
  import 'ajv/dist/2019.js';
@@ -503,7 +503,7 @@ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown>
503
503
  getFromStore(storeName: string, key: string): MongoClient | null;
504
504
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
505
505
  setClientToStore(storeName: string, key: string, client: MongoClient, onClose: () => Promise<void> | void): void;
506
- }, unknown, unknown>>[], unknown>>;
506
+ }, unknown>>[]>>;
507
507
 
508
508
  declare const MoleculerClientError: typeof Errors.MoleculerClientError;
509
509
  declare class EntityNotFoundError extends MoleculerClientError {
@@ -800,7 +800,7 @@ declare const DATABASE_INDEXES_MIXIN_SYNC_EVENT = "database-indexes-mixin.sync";
800
800
  declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): Partial<CustomServiceSchema<unknown, {
801
801
  _syncIndexes({ dropIndexes, createIndexes, }: SyncIndexesOptions): Promise<void>;
802
802
  _createIndexFromState(col: Collection, state: IndexState): Promise<void>;
803
- }, unknown, unknown>>;
803
+ }, unknown>>;
804
804
 
805
805
  declare function getDefaultIndexName(key: Record<string, 1 | -1>): string;
806
806
  declare function isIndexNameEqual(dbIdx: MongoIndex, idx: IndexTuple): boolean;
@@ -937,7 +937,7 @@ declare function DatabaseMethodsMixin<TSchema extends Document & {
937
937
  * WARNING: Do not send any events. You'll have to send an event yourself.
938
938
  */
939
939
  _deleteMany(query: Filter<TSchema>, params: TenantParams<TSchema, TenantField>, options?: DatabaseDeleteManyOptions): Promise<number>;
940
- }, unknown, unknown>>;
940
+ }, unknown>>;
941
941
 
942
942
  export { AjvActionSchemaFactory, DATABASE_INDEXES_MIXIN_SYNC_EVENT, DatabaseConnectionMixin, DatabaseIndexesMixin, DatabaseMethodsMixin, EntityNotFoundError, IndexStatus, QueryOp, ZodActionSchemaFactory, addQueryOps, addZodQueryOps, createActions, getDefaultIndexName, getIndexesDifference, getQueryFromList, isIndexEqual, isIndexNameEqual, isOnAtlas, optimizeQuery, optionalMongoId, parseAndValidateQuery, parseStringifiedQuery, removeMongoId, shouldAutoCreateIndexes, shouldAutoDropIndexes };
943
943
  export type { ActionCountParamsOptions, ActionCreateParamsOptions, ActionGetParamsOptions, ActionListParamsOptions, ActionSchemaFactory, ActionSchemaFactoryOptions, DatabaseActionCountInternalParams, DatabaseActionCountParams, DatabaseActionCreateParams, DatabaseActionEntityResult, DatabaseActionFindParams, DatabaseActionFindResult, DatabaseActionGetInternalParams, DatabaseActionGetParams, DatabaseActionInternalNames, DatabaseActionListParams, DatabaseActionListResult, DatabaseActionNames, DatabaseActionOptions, DatabaseActionPublishedNames, DatabaseActionRemoveParams, DatabaseActionUpdateParams, DatabaseConnectionOptions, DatabaseCountOptions, DatabaseDeleteManyOptions, DatabaseDeleteOneOptions, DatabaseEventDelete, DatabaseEventInsert, DatabaseEventUpdate, DatabaseFindOptions, DatabaseIndexesOptions, DatabaseInsertManyOptions, DatabaseInsertOneOptions, DatabaseMethodsOptions, DatabaseReplaceOneOptions, DatabaseSoftDeleteScope, DatabaseUpdateManyOptions, DatabaseUpdateOneOptions, IndexState, IndexTuple, KeyString, ListSearchIndex, MongoIndex, SearchIndexCustomAnalyzers, SearchIndexDefinition, SearchIndexField, SearchIndexFieldString, SyncIndexesOptions, TenantParams, WithDbFields, WithOptionalId };
@@ -1,7 +1,7 @@
1
1
  import { Document, WithoutId, InferIdType, ObjectId, Filter, WithId, OptionalId, FindOptions, CountDocumentsOptions, FindOneAndUpdateOptions, BulkWriteOptions, UpdateOptions, FindOneAndReplaceOptions, FindOneAndDeleteOptions, DeleteOptions, CollationOptions, CreateCollectionOptions, MongoClient, CollectionOptions, Collection, UpdateFilter, FindCursor, UpdateResult } from 'mongodb';
2
2
  import { ActionVisibility, BaseValidator, Errors, Context } from 'moleculer';
3
3
  import { ZodType, ZodObject } from 'zod/v4';
4
- import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
4
+ import { V as ValidationSchema, J as JSONSchemaType, C as CustomActionSchema, a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
5
5
  import { Readable } from 'stream';
6
6
  import 'bson';
7
7
  import 'ajv/dist/2019.js';
@@ -503,7 +503,7 @@ declare function DatabaseConnectionMixin<TSchema extends Record<string, unknown>
503
503
  getFromStore(storeName: string, key: string): MongoClient | null;
504
504
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
505
505
  setClientToStore(storeName: string, key: string, client: MongoClient, onClose: () => Promise<void> | void): void;
506
- }, unknown, unknown>>[], unknown>>;
506
+ }, unknown>>[]>>;
507
507
 
508
508
  declare const MoleculerClientError: typeof Errors.MoleculerClientError;
509
509
  declare class EntityNotFoundError extends MoleculerClientError {
@@ -800,7 +800,7 @@ declare const DATABASE_INDEXES_MIXIN_SYNC_EVENT = "database-indexes-mixin.sync";
800
800
  declare function DatabaseIndexesMixin(opts: DatabaseIndexesOptions): Partial<CustomServiceSchema<unknown, {
801
801
  _syncIndexes({ dropIndexes, createIndexes, }: SyncIndexesOptions): Promise<void>;
802
802
  _createIndexFromState(col: Collection, state: IndexState): Promise<void>;
803
- }, unknown, unknown>>;
803
+ }, unknown>>;
804
804
 
805
805
  declare function getDefaultIndexName(key: Record<string, 1 | -1>): string;
806
806
  declare function isIndexNameEqual(dbIdx: MongoIndex, idx: IndexTuple): boolean;
@@ -937,7 +937,7 @@ declare function DatabaseMethodsMixin<TSchema extends Document & {
937
937
  * WARNING: Do not send any events. You'll have to send an event yourself.
938
938
  */
939
939
  _deleteMany(query: Filter<TSchema>, params: TenantParams<TSchema, TenantField>, options?: DatabaseDeleteManyOptions): Promise<number>;
940
- }, unknown, unknown>>;
940
+ }, unknown>>;
941
941
 
942
942
  export { AjvActionSchemaFactory, DATABASE_INDEXES_MIXIN_SYNC_EVENT, DatabaseConnectionMixin, DatabaseIndexesMixin, DatabaseMethodsMixin, EntityNotFoundError, IndexStatus, QueryOp, ZodActionSchemaFactory, addQueryOps, addZodQueryOps, createActions, getDefaultIndexName, getIndexesDifference, getQueryFromList, isIndexEqual, isIndexNameEqual, isOnAtlas, optimizeQuery, optionalMongoId, parseAndValidateQuery, parseStringifiedQuery, removeMongoId, shouldAutoCreateIndexes, shouldAutoDropIndexes };
943
943
  export type { ActionCountParamsOptions, ActionCreateParamsOptions, ActionGetParamsOptions, ActionListParamsOptions, ActionSchemaFactory, ActionSchemaFactoryOptions, DatabaseActionCountInternalParams, DatabaseActionCountParams, DatabaseActionCreateParams, DatabaseActionEntityResult, DatabaseActionFindParams, DatabaseActionFindResult, DatabaseActionGetInternalParams, DatabaseActionGetParams, DatabaseActionInternalNames, DatabaseActionListParams, DatabaseActionListResult, DatabaseActionNames, DatabaseActionOptions, DatabaseActionPublishedNames, DatabaseActionRemoveParams, DatabaseActionUpdateParams, DatabaseConnectionOptions, DatabaseCountOptions, DatabaseDeleteManyOptions, DatabaseDeleteOneOptions, DatabaseEventDelete, DatabaseEventInsert, DatabaseEventUpdate, DatabaseFindOptions, DatabaseIndexesOptions, DatabaseInsertManyOptions, DatabaseInsertOneOptions, DatabaseMethodsOptions, DatabaseReplaceOneOptions, DatabaseSoftDeleteScope, DatabaseUpdateManyOptions, DatabaseUpdateOneOptions, IndexState, IndexTuple, KeyString, ListSearchIndex, MongoIndex, SearchIndexCustomAnalyzers, SearchIndexDefinition, SearchIndexField, SearchIndexFieldString, SyncIndexesOptions, TenantParams, WithDbFields, WithOptionalId };
@@ -1,14 +1,13 @@
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-DAz9xV2z.mjs';
1
+ import { o as omitFields, d as optionalFields, S as SCHEMA_REF_NAME, O as OBJECTID_TYPE, C as COERCE_ARRAY_ATTRIBUTE, i as isZodSchema, h as zodObjectId, j as zodCoerceArray, k as createOpenAPIResponses } from '../index-B6AujuxZ.mjs';
3
2
  import { Errors } from 'moleculer';
4
3
  import { isEqual as isEqual$1 } from 'es-toolkit';
4
+ import { z } from 'zod/v4';
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
8
  import { isMatch, isEqual } from 'es-toolkit/compat';
9
9
  import 'bson';
10
10
  import 'date-fns';
11
- import 'zod';
12
11
 
13
12
  const { MoleculerClientError } = Errors;
14
13
  class EntityNotFoundError extends MoleculerClientError {
@@ -322,7 +321,7 @@ function parseAndValidateQuery(validator, schema, sQuery) {
322
321
  return {};
323
322
  }
324
323
  let query = parseStringifiedQuery(sQuery);
325
- if (schema instanceof ZodType) {
324
+ if (isZodSchema(schema)) {
326
325
  query = validator.validate(query, schema);
327
326
  } else {
328
327
  validator.validate(query, schema);
@@ -336,7 +335,7 @@ class ZodActionSchemaFactory {
336
335
  this.opts = opts;
337
336
  const { schema, tenantField } = opts;
338
337
  if (schema) {
339
- if (!(schema instanceof ZodObject)) {
338
+ if (!isZodSchema(schema, "object")) {
340
339
  throw new Error("Schema must be a ZodObject");
341
340
  }
342
341
  if (tenantField) {
@@ -359,7 +358,7 @@ class ZodActionSchemaFactory {
359
358
  return this.schemaWithDbFields;
360
359
  }
361
360
  const { timestamps, schema, schemaName } = this.opts;
362
- if (!schema || !(schema instanceof ZodObject)) {
361
+ if (!isZodSchema(schema, "object")) {
363
362
  throw new Error("Schema is not a ZodObject");
364
363
  }
365
364
  let res = schema.required({ _id: true });
@@ -461,7 +460,7 @@ class ZodActionSchemaFactory {
461
460
  createCreateParams(params) {
462
461
  const { schema } = this.opts;
463
462
  const { allowClientId } = params;
464
- if (!schema || !(schema instanceof ZodObject)) {
463
+ if (!isZodSchema(schema, "object")) {
465
464
  throw new Error("Schema is not a ZodObject");
466
465
  }
467
466
  if (allowClientId) {
@@ -471,7 +470,7 @@ class ZodActionSchemaFactory {
471
470
  }
472
471
  createUpdateParams() {
473
472
  const { tenantField, schema } = this.opts;
474
- if (!schema || !(schema instanceof ZodObject)) {
473
+ if (!isZodSchema(schema, "object")) {
475
474
  throw new Error("Schema is not a ZodObject");
476
475
  }
477
476
  const mask = { _id: true };
@@ -514,7 +513,7 @@ const PUBLISHABLE_ACTIONS = [
514
513
  ];
515
514
  function createActions(opts) {
516
515
  const actions = {};
517
- const factory = opts.actions?.schemaFactory || (opts.actions?.schema instanceof ZodType ? new ZodActionSchemaFactory({
516
+ const factory = opts.actions?.schemaFactory || (isZodSchema(opts.actions?.schema) ? new ZodActionSchemaFactory({
518
517
  schemaName: opts.actions.schemaName,
519
518
  schema: opts.actions.schema,
520
519
  timestamps: opts.timestamps,
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
2
2
  import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
3
3
  import 'moleculer';
4
4
  import 'bson';
@@ -26,7 +26,7 @@ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge,
26
26
  getEncryptorCmm(): NodeCachingMaterialsManager;
27
27
  encrypt(plainData: Buffer | string): Promise<Buffer>;
28
28
  decrypt(encryptedData: Uint8Array | string): Promise<Buffer>;
29
- }, unknown, unknown>>;
29
+ }, unknown>>;
30
30
 
31
31
  export { EncryptorMixin, kCmm };
32
32
  export type { EncryptorMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
2
2
  import { buildClient, NodeCachingMaterialsManager } from '@aws-crypto/client-node';
3
3
  import 'moleculer';
4
4
  import 'bson';
@@ -26,7 +26,7 @@ declare function EncryptorMixin({ keyId, cacheMaxMessagesEncrypted, cacheMaxAge,
26
26
  getEncryptorCmm(): NodeCachingMaterialsManager;
27
27
  encrypt(plainData: Buffer | string): Promise<Buffer>;
28
28
  decrypt(encryptedData: Uint8Array | string): Promise<Buffer>;
29
- }, unknown, unknown>>;
29
+ }, unknown>>;
30
30
 
31
31
  export { EncryptorMixin, kCmm };
32
32
  export type { EncryptorMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
2
2
  import 'moleculer';
3
3
  import 'bson';
4
4
  import 'zod/v4';
@@ -35,6 +35,6 @@ declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<un
35
35
  * Set the client in global store.
36
36
  */
37
37
  setClientToStore(storeName: string, key: string, client: T, onClose: Wrapper<T>["onClose"]): void;
38
- }, unknown, unknown>>;
38
+ }, unknown>>;
39
39
 
40
40
  export { GlobalStoreMixin };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
2
2
  import 'moleculer';
3
3
  import 'bson';
4
4
  import 'zod/v4';
@@ -35,6 +35,6 @@ declare function GlobalStoreMixin<T = unknown>(): Partial<CustomServiceSchema<un
35
35
  * Set the client in global store.
36
36
  */
37
37
  setClientToStore(storeName: string, key: string, client: T, onClose: Wrapper<T>["onClose"]): void;
38
- }, unknown, unknown>>;
38
+ }, unknown>>;
39
39
 
40
40
  export { GlobalStoreMixin };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
2
2
  import { SignOptions, PrivateKey, VerifyOptions, JwtHeader, SigningKeyCallback } from 'jsonwebtoken';
3
3
  import { Options, JwksClient } from 'jwks-rsa';
4
4
  import { Context } from 'moleculer';
@@ -21,7 +21,7 @@ type JwtSignerMixinSettings = {
21
21
  };
22
22
  declare function JwtSignerMixin(opts: JwtSignerMixinSettings): Partial<CustomServiceSchema<unknown, {
23
23
  generateJwt(payload?: string | Buffer | object): Promise<string>;
24
- }, unknown, unknown>>;
24
+ }, unknown>>;
25
25
  type JwtVerifierMixinSettings = {
26
26
  jwksOptions: Options;
27
27
  validClaim: VerifyOptions;
@@ -38,7 +38,7 @@ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<Custo
38
38
  */
39
39
  verifyJwt(token: string): Promise<void>;
40
40
  verifyAuthorizationHeader(ctx: Context, value: string | undefined): Promise<void>;
41
- }, unknown, unknown>>;
41
+ }, unknown>>;
42
42
 
43
43
  export { JwtSignerMixin, JwtVerifierMixin };
44
44
  export type { JwtSignerMixinSettings, JwtVerifierMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
2
2
  import { SignOptions, PrivateKey, VerifyOptions, JwtHeader, SigningKeyCallback } from 'jsonwebtoken';
3
3
  import { Options, JwksClient } from 'jwks-rsa';
4
4
  import { Context } from 'moleculer';
@@ -21,7 +21,7 @@ type JwtSignerMixinSettings = {
21
21
  };
22
22
  declare function JwtSignerMixin(opts: JwtSignerMixinSettings): Partial<CustomServiceSchema<unknown, {
23
23
  generateJwt(payload?: string | Buffer | object): Promise<string>;
24
- }, unknown, unknown>>;
24
+ }, unknown>>;
25
25
  type JwtVerifierMixinSettings = {
26
26
  jwksOptions: Options;
27
27
  validClaim: VerifyOptions;
@@ -38,7 +38,7 @@ declare function JwtVerifierMixin(opts: JwtVerifierMixinSettings): Partial<Custo
38
38
  */
39
39
  verifyJwt(token: string): Promise<void>;
40
40
  verifyAuthorizationHeader(ctx: Context, value: string | undefined): Promise<void>;
41
- }, unknown, unknown>>;
41
+ }, unknown>>;
42
42
 
43
43
  export { JwtSignerMixin, JwtVerifierMixin };
44
44
  export type { JwtSignerMixinSettings, JwtVerifierMixinSettings };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
2
2
  import { Redis } from 'ioredis';
3
3
  import { QueueOptions, Queue, JobsOptions, Job, QueueEventsOptions, QueueEvents, QueueBaseOptions, FlowProducer, RepeatOptions, WorkerOptions, Worker } from 'bullmq';
4
4
  import { Service } from 'moleculer';
@@ -43,7 +43,7 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
43
43
  getFromStore(storeName: string, key: string): Redis | null;
44
44
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
45
45
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
46
- }, unknown, unknown>>[], unknown>>;
46
+ }, unknown>>[]>>;
47
47
 
48
48
  /**
49
49
  * This Mixin add the capability to wait on a job.
@@ -77,14 +77,14 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
77
77
  getFromStore(storeName: string, key: string): Redis | null;
78
78
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
79
79
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
80
- }, unknown, unknown>>[], unknown>>;
80
+ }, unknown>>[]>>;
81
81
 
82
82
  /**
83
83
  * This Mixin add the capability to launch a BullMQ flows.
84
84
  */
85
85
  declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
86
86
  getFlowProducer(): FlowProducer;
87
- }, unknown, unknown>>;
87
+ }, unknown>>;
88
88
 
89
89
  type RepeatableJob = {
90
90
  name: string;
@@ -111,7 +111,7 @@ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJo
111
111
  getFromStore(storeName: string, key: string): Redis | null;
112
112
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
113
113
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
114
- }, unknown, unknown>>[], unknown>>;
114
+ }, unknown>>[]>>;
115
115
 
116
116
  type JobMeta = {
117
117
  job?: Job;
@@ -145,7 +145,7 @@ declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOp
145
145
  getWorker(): Worker;
146
146
  processJob(job: Job, token?: string): Promise<any>;
147
147
  _processJob(job: Job, token?: string): Promise<any>;
148
- }, unknown, unknown>>;
148
+ }, unknown>>;
149
149
 
150
150
  export { QueueClient, QueueEventsClient, QueueFlowProducerMixin, QueueStaticRepeatableJobs, QueueWorker };
151
151
  export type { JobMeta, JobProcessorOptions, QueueMixinOptions, QueueStaticRepeatableJobsOptions, RepeatableJob };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
2
2
  import { Redis } from 'ioredis';
3
3
  import { QueueOptions, Queue, JobsOptions, Job, QueueEventsOptions, QueueEvents, QueueBaseOptions, FlowProducer, RepeatOptions, WorkerOptions, Worker } from 'bullmq';
4
4
  import { Service } from 'moleculer';
@@ -43,7 +43,7 @@ declare function QueueClient<N extends string>(queueName: N, opts: WithoutConnec
43
43
  getFromStore(storeName: string, key: string): Redis | null;
44
44
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
45
45
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
46
- }, unknown, unknown>>[], unknown>>;
46
+ }, unknown>>[]>>;
47
47
 
48
48
  /**
49
49
  * This Mixin add the capability to wait on a job.
@@ -77,14 +77,14 @@ declare function QueueEventsClient<N extends string>(queueName: N, opts: Without
77
77
  getFromStore(storeName: string, key: string): Redis | null;
78
78
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
79
79
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
80
- }, unknown, unknown>>[], unknown>>;
80
+ }, unknown>>[]>>;
81
81
 
82
82
  /**
83
83
  * This Mixin add the capability to launch a BullMQ flows.
84
84
  */
85
85
  declare function QueueFlowProducerMixin(opts: WithoutConnection<QueueBaseOptions> & QueueMixinOptions): Partial<CustomServiceSchema<unknown, {
86
86
  getFlowProducer(): FlowProducer;
87
- }, unknown, unknown>>;
87
+ }, unknown>>;
88
88
 
89
89
  type RepeatableJob = {
90
90
  name: string;
@@ -111,7 +111,7 @@ declare function QueueStaticRepeatableJobs(queueName: string, jobs: RepeatableJo
111
111
  getFromStore(storeName: string, key: string): Redis | null;
112
112
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
113
113
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
114
- }, unknown, unknown>>[], unknown>>;
114
+ }, unknown>>[]>>;
115
115
 
116
116
  type JobMeta = {
117
117
  job?: Job;
@@ -145,7 +145,7 @@ declare function QueueWorker(queueName: string, opts: WithoutConnection<WorkerOp
145
145
  getWorker(): Worker;
146
146
  processJob(job: Job, token?: string): Promise<any>;
147
147
  _processJob(job: Job, token?: string): Promise<any>;
148
- }, unknown, unknown>>;
148
+ }, unknown>>;
149
149
 
150
150
  export { QueueClient, QueueEventsClient, QueueFlowProducerMixin, QueueStaticRepeatableJobs, QueueWorker };
151
151
  export type { JobMeta, JobProcessorOptions, QueueMixinOptions, QueueStaticRepeatableJobsOptions, RepeatableJob };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
2
2
  import { RedisOptions, Redis } from 'ioredis';
3
3
  import { Service } from 'moleculer';
4
4
  import 'bson';
@@ -22,7 +22,7 @@ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }
22
22
  getFromStore(storeName: string, key: string): Redis | null;
23
23
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
24
24
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
25
- }, unknown, unknown>>[], unknown>>;
25
+ }, unknown>>[]>>;
26
26
 
27
27
  export { RedisMixin };
28
28
  export type { RedisMixinOptions };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
2
2
  import { RedisOptions, Redis } from 'ioredis';
3
3
  import { Service } from 'moleculer';
4
4
  import 'bson';
@@ -22,7 +22,7 @@ declare function RedisMixin(options: AllowedOptions, { reuseClient, getOptions }
22
22
  getFromStore(storeName: string, key: string): Redis | null;
23
23
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
24
24
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
25
- }, unknown, unknown>>[], unknown>>;
25
+ }, unknown>>[]>>;
26
26
 
27
27
  export { RedisMixin };
28
28
  export type { RedisMixinOptions };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.cjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.cjs';
2
2
  import { Service } from 'moleculer';
3
3
  import { RedisOptions, Redis } from 'ioredis';
4
4
  import Redlock from 'redlock';
@@ -25,7 +25,7 @@ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOpt
25
25
  getFromStore(storeName: string, key: string): Redis | null;
26
26
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
27
27
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
28
- }, unknown, unknown>>[], unknown>>;
28
+ }, unknown>>[]>>;
29
29
 
30
30
  export { RedlockMixin };
31
31
  export type { RedlockMixinOptions };
@@ -1,4 +1,4 @@
1
- import { a as CustomServiceSchema } from '../index-IHCgtNKZ.mjs';
1
+ import { a as CustomServiceSchema } from '../index-TXVFWos4.mjs';
2
2
  import { Service } from 'moleculer';
3
3
  import { RedisOptions, Redis } from 'ioredis';
4
4
  import Redlock from 'redlock';
@@ -25,7 +25,7 @@ declare function RedlockMixin(options: AllowedOptions, { reuseClient, redLockOpt
25
25
  getFromStore(storeName: string, key: string): Redis | null;
26
26
  removeServiceFromStore(storeName: string, key: string): Promise<boolean>;
27
27
  setClientToStore(storeName: string, key: string, client: Redis, onClose: () => Promise<void> | void): void;
28
- }, unknown, unknown>>[], unknown>>;
28
+ }, unknown>>[]>>;
29
29
 
30
30
  export { RedlockMixin };
31
31
  export type { RedlockMixinOptions };
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.3",
9
+ "version": "1.3.0-beta.1",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
12
12
  "types": "./dist/index.d.cts",
@@ -108,9 +108,9 @@
108
108
  "ajv-keywords": "^5.1.0",
109
109
  "bson": "^6.2.0",
110
110
  "date-fns": "^2.21.3",
111
- "es-toolkit": "^1.39.10",
112
- "pino": "^9.9.0",
113
- "pino-pretty": "^13.1.1"
111
+ "es-toolkit": "^1.42.0",
112
+ "pino": "^9.14.0",
113
+ "pino-pretty": "^13.1.2"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@aws-crypto/client-node": "^4.2.1",
@@ -148,33 +148,33 @@
148
148
  },
149
149
  "devDependencies": {
150
150
  "@aws-crypto/client-node": "^4.2.1",
151
- "@eslint/js": "^9.34.0",
152
- "@treatwell/eslint-plugin-moleculer": "^1.1.0",
153
- "@tsconfig/node-lts": "^22.0.2",
151
+ "@eslint/js": "^9.39.1",
152
+ "@treatwell/eslint-plugin-moleculer": "^1.1.2",
153
+ "@tsconfig/node-lts": "^22.0.4",
154
154
  "@types/jsonwebtoken": "^9.0.10",
155
- "@types/node": "^24.3.0",
156
- "@types/redlock": "^4.0.7",
157
- "bullmq": "^5.12.10",
158
- "eslint": "^9.34.0",
155
+ "@types/node": "^24.10.1",
156
+ "@types/redlock": "^4.0.8",
157
+ "bullmq": "^5.59.0",
158
+ "eslint": "^9.39.1",
159
159
  "eslint-config-prettier": "^10.1.8",
160
160
  "eslint-import-resolver-typescript": "^4.4.4",
161
161
  "eslint-plugin-import": "^2.32.0",
162
162
  "eslint-plugin-prettier": "^5.5.4",
163
- "ioredis": "^5.2.3",
164
- "jiti": "^2.5.1",
163
+ "ioredis": "^5.8.2",
164
+ "jiti": "^2.6.1",
165
165
  "jsonwebtoken": "^9.0.2",
166
- "jwks-rsa": "^3.0.1",
167
- "moleculer": "^0.14.33",
168
- "mongodb": "^6.15.0",
169
- "mongodb-memory-server": "^10.2.0",
170
- "pkgroll": "^2.15.3",
166
+ "jwks-rsa": "^3.2.0",
167
+ "moleculer": "^0.14.35",
168
+ "mongodb": "^6.21.0",
169
+ "mongodb-memory-server": "^10.3.0",
170
+ "pkgroll": "^2.21.3",
171
171
  "prettier": "^3.6.2",
172
172
  "redlock": "^4.2.0",
173
- "semantic-release": "^24.2.7",
174
- "typescript": "~5.9.2",
175
- "typescript-eslint": "^8.41.0",
176
- "vitest": "^3.2.4",
177
- "zod": "^4.1.5"
173
+ "semantic-release": "^25.0.2",
174
+ "typescript": "~5.9.3",
175
+ "typescript-eslint": "^8.48.0",
176
+ "vitest": "^4.0.13",
177
+ "zod": "^4.1.13"
178
178
  },
179
179
  "files": [
180
180
  "dist"