@treatwell/moleculer-essentials 1.0.2-beta.3 → 1.1.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.
@@ -323,12 +323,7 @@ const ValidationErrorSchema = {
323
323
  ]
324
324
  }
325
325
  };
326
- const GetOpenApiParamsSchema = {
327
- type: "object",
328
- additionalProperties: false,
329
- required: [],
330
- properties: { kind: { type: "string" } }
331
- };
326
+ const GetOpenApiParamsSchema = v4.z.object({ kind: v4.z.string().optional() });
332
327
 
333
328
  function createOpenAPIResponses(model, description = "") {
334
329
  const isZodType = model instanceof v4.z.ZodType;
@@ -321,12 +321,7 @@ const ValidationErrorSchema = {
321
321
  ]
322
322
  }
323
323
  };
324
- const GetOpenApiParamsSchema = {
325
- type: "object",
326
- additionalProperties: false,
327
- required: [],
328
- properties: { kind: { type: "string" } }
329
- };
324
+ const GetOpenApiParamsSchema = z$1.object({ kind: z$1.string().optional() });
330
325
 
331
326
  function createOpenAPIResponses(model, description = "") {
332
327
  const isZodType = model instanceof z$1.ZodType;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CXpoxJ9R.cjs');
3
+ var index = require('./index-BUXfgQp5.cjs');
4
4
  var v4 = require('zod/v4');
5
5
  var _2019_js = require('ajv/dist/2019.js');
6
6
  var moleculer = require('moleculer');
@@ -1022,7 +1022,53 @@ function createServiceBroker(opts = {}) {
1022
1022
  ),
1023
1023
  ServiceFactory,
1024
1024
  ContextFactory,
1025
- internalServices: false,
1025
+ // Change the internal services actions to use Zod validation
1026
+ // instead of the default `fastest-validator` schemas
1027
+ // @ts-expect-error Moleculer types doesn't support zod validators
1028
+ internalServices: {
1029
+ $node: {
1030
+ actions: {
1031
+ list: {
1032
+ params: v4.z.object({ withServices: v4.z.boolean(), onlyAvailable: v4.z.boolean() }).partial()
1033
+ },
1034
+ services: {
1035
+ params: v4.z.object({
1036
+ onlyLocal: v4.z.boolean(),
1037
+ skipInternal: v4.z.boolean(),
1038
+ withActions: v4.z.boolean(),
1039
+ withEvents: v4.z.boolean(),
1040
+ onlyAvailable: v4.z.boolean(),
1041
+ grouping: v4.z.boolean().default(true)
1042
+ }).partial()
1043
+ },
1044
+ actions: {
1045
+ params: v4.z.object({
1046
+ onlyLocal: v4.z.boolean(),
1047
+ skipInternal: v4.z.boolean(),
1048
+ withEndpoints: v4.z.boolean(),
1049
+ onlyAvailable: v4.z.boolean()
1050
+ }).partial()
1051
+ },
1052
+ events: {
1053
+ params: v4.z.object({
1054
+ onlyLocal: v4.z.boolean(),
1055
+ skipInternal: v4.z.boolean(),
1056
+ withEndpoints: v4.z.boolean(),
1057
+ onlyAvailable: v4.z.boolean()
1058
+ }).partial()
1059
+ },
1060
+ health: { params: v4.z.object({}) },
1061
+ options: { params: v4.z.object({}) },
1062
+ metrics: {
1063
+ params: v4.z.object({
1064
+ types: v4.z.union([v4.z.string(), v4.z.array(v4.z.string())]),
1065
+ includes: v4.z.union([v4.z.string(), v4.z.array(v4.z.string())]),
1066
+ excludes: v4.z.union([v4.z.string(), v4.z.array(v4.z.string())])
1067
+ }).partial()
1068
+ }
1069
+ }
1070
+ }
1071
+ },
1026
1072
  ...opts
1027
1073
  });
1028
1074
  }
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
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-Lfmmf1DE.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-Lfmmf1DE.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-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';
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';
@@ -1022,7 +1022,53 @@ function createServiceBroker(opts = {}) {
1022
1022
  ),
1023
1023
  ServiceFactory,
1024
1024
  ContextFactory,
1025
- internalServices: false,
1025
+ // Change the internal services actions to use Zod validation
1026
+ // instead of the default `fastest-validator` schemas
1027
+ // @ts-expect-error Moleculer types doesn't support zod validators
1028
+ internalServices: {
1029
+ $node: {
1030
+ actions: {
1031
+ list: {
1032
+ params: z.object({ withServices: z.boolean(), onlyAvailable: z.boolean() }).partial()
1033
+ },
1034
+ services: {
1035
+ params: z.object({
1036
+ onlyLocal: z.boolean(),
1037
+ skipInternal: z.boolean(),
1038
+ withActions: z.boolean(),
1039
+ withEvents: z.boolean(),
1040
+ onlyAvailable: z.boolean(),
1041
+ grouping: z.boolean().default(true)
1042
+ }).partial()
1043
+ },
1044
+ actions: {
1045
+ params: z.object({
1046
+ onlyLocal: z.boolean(),
1047
+ skipInternal: z.boolean(),
1048
+ withEndpoints: z.boolean(),
1049
+ onlyAvailable: z.boolean()
1050
+ }).partial()
1051
+ },
1052
+ events: {
1053
+ params: z.object({
1054
+ onlyLocal: z.boolean(),
1055
+ skipInternal: z.boolean(),
1056
+ withEndpoints: z.boolean(),
1057
+ onlyAvailable: z.boolean()
1058
+ }).partial()
1059
+ },
1060
+ health: { params: z.object({}) },
1061
+ options: { params: z.object({}) },
1062
+ metrics: {
1063
+ params: z.object({
1064
+ types: z.union([z.string(), z.array(z.string())]),
1065
+ includes: z.union([z.string(), z.array(z.string())]),
1066
+ excludes: z.union([z.string(), z.array(z.string())])
1067
+ }).partial()
1068
+ }
1069
+ }
1070
+ }
1071
+ },
1026
1072
  ...opts
1027
1073
  });
1028
1074
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var v4 = require('zod/v4');
4
- var index = require('../index-CXpoxJ9R.cjs');
4
+ var index = require('../index-BUXfgQp5.cjs');
5
5
  var moleculer = require('moleculer');
6
6
  var lodashEs = require('lodash-es');
7
7
  var mongodb = require('mongodb');
@@ -1,5 +1,5 @@
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-Lfmmf1DE.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-BmVULkqf.mjs';
3
3
  import { Errors } from 'moleculer';
4
4
  import { isMatch, isEqual, partition, omit, pick } from 'lodash-es';
5
5
  import { MongoClient } from 'mongodb';
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.0.2-beta.3",
9
+ "version": "1.1.0-beta.1",
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
12
12
  "types": "./dist/index.d.cts",
@@ -158,6 +158,8 @@
158
158
  "bullmq": "^5.12.10",
159
159
  "eslint": "^9.33.0",
160
160
  "eslint-config-prettier": "^10.1.8",
161
+ "eslint-import-resolver-typescript": "^4.4.4",
162
+ "eslint-plugin-import": "^2.32.0",
161
163
  "eslint-plugin-prettier": "^5.5.4",
162
164
  "ioredis": "^5.2.3",
163
165
  "jiti": "^2.5.1",