@common-stack/store-mongo 7.2.1-alpha.20 → 7.2.1-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/module.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
8
8
|
import type { ServiceSchema } from 'moleculer';
|
|
9
|
-
import { Moleculer } from './
|
|
9
|
+
import { Moleculer } from './moleculerEventHandler';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Exclude base service CRUD methods and lifecycle methods
|
|
@@ -868,7 +868,7 @@ export interface TypedServiceSchema extends ServiceSchema {
|
|
|
868
868
|
/**
|
|
869
869
|
* Extend Moleculer namespace with action generation utilities
|
|
870
870
|
*/
|
|
871
|
-
declare module './
|
|
871
|
+
declare module './moleculerEventHandler' {
|
|
872
872
|
export namespace Moleculer {
|
|
873
873
|
/**
|
|
874
874
|
* ADVANCED AUTO-GENERATED configuration with full control
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// from package: store-mongo
|
|
1
2
|
/**
|
|
2
3
|
* Converts Zod schemas to Moleculer parameter validation schemas
|
|
3
4
|
*
|
|
@@ -26,7 +27,7 @@ import { z } from 'zod';
|
|
|
26
27
|
* ```
|
|
27
28
|
*/
|
|
28
29
|
export function zodToMoleculerParams(zodSchema: z.ZodObject<any>): Record<string, any> {
|
|
29
|
-
const shape = zodSchema
|
|
30
|
+
const { shape } = zodSchema;
|
|
30
31
|
const result: Record<string, any> = {};
|
|
31
32
|
|
|
32
33
|
for (const [key, value] of Object.entries(shape)) {
|
|
@@ -42,7 +43,7 @@ export function zodToMoleculerParams(zodSchema: z.ZodObject<any>): Record<string
|
|
|
42
43
|
function zodTypeToMoleculer(zodType: z.ZodTypeAny): any {
|
|
43
44
|
// Handle optional types
|
|
44
45
|
if (zodType instanceof z.ZodOptional) {
|
|
45
|
-
const innerType = zodTypeToMoleculer(zodType.
|
|
46
|
+
const innerType = zodTypeToMoleculer(zodType.def.innerType as z.ZodTypeAny);
|
|
46
47
|
if (typeof innerType === 'string') {
|
|
47
48
|
return { type: innerType, optional: true };
|
|
48
49
|
}
|
|
@@ -51,7 +52,7 @@ function zodTypeToMoleculer(zodType: z.ZodTypeAny): any {
|
|
|
51
52
|
|
|
52
53
|
// Handle nullable types
|
|
53
54
|
if (zodType instanceof z.ZodNullable) {
|
|
54
|
-
return zodTypeToMoleculer(zodType.
|
|
55
|
+
return zodTypeToMoleculer(zodType.def.innerType as z.ZodTypeAny);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
// Primitive types
|
|
@@ -74,7 +75,7 @@ function zodTypeToMoleculer(zodType: z.ZodTypeAny): any {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
// Enum types
|
|
77
|
-
if (zodType instanceof z.
|
|
78
|
+
if (zodType instanceof z.ZodEnum || zodType.type === 'enum') {
|
|
78
79
|
return 'string'; // Moleculer doesn't have enum type, use string
|
|
79
80
|
}
|
|
80
81
|
|
|
@@ -85,10 +86,10 @@ function zodTypeToMoleculer(zodType: z.ZodTypeAny): any {
|
|
|
85
86
|
|
|
86
87
|
// Union types - use the first non-undefined/null type
|
|
87
88
|
if (zodType instanceof z.ZodUnion) {
|
|
88
|
-
const options = zodType.
|
|
89
|
+
const { options } = zodType.def;
|
|
89
90
|
for (const option of options) {
|
|
90
91
|
if (!(option instanceof z.ZodUndefined) && !(option instanceof z.ZodNull)) {
|
|
91
|
-
return zodTypeToMoleculer(option);
|
|
92
|
+
return zodTypeToMoleculer(option as z.ZodTypeAny);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
return 'any';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/store-mongo",
|
|
3
|
-
"version": "7.2.1-alpha.
|
|
3
|
+
"version": "7.2.1-alpha.25",
|
|
4
4
|
"description": "Sample core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d91749dc28ce303e6e02fa6db7c82cbb67b603c5",
|
|
62
62
|
"typescript": {
|
|
63
63
|
"definition": "lib/index.d.ts"
|
|
64
64
|
}
|