@motiadev/core 0.10.0-beta.153 → 0.11.0-beta.155-157586

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @motiadev/core
2
2
 
3
- Core functionality for the Motia framework, providing the foundation for building event-driven workflows.
3
+ Core functionality for Motia - Build production-grade backends with a single primitive.
4
4
 
5
5
  ## Installation
6
6
 
@@ -14,14 +14,16 @@ pnpm add @motiadev/core
14
14
 
15
15
  ## Overview
16
16
 
17
- `@motiadev/core` is the foundation of the Motia framework, providing:
17
+ `@motiadev/core` is the foundation of Motia, the unified backend framework for:
18
18
 
19
- - Event-driven architecture with pub/sub capabilities
20
- - Multi-language support (TypeScript, Python, Ruby)
21
- - State management
22
- - Cron job scheduling
23
- - API route handling
24
- - Logging infrastructure
19
+ - **API** endpoints with routing and validation
20
+ - **Background jobs** with built-in queues
21
+ - **Durable workflows** with state management
22
+ - **Agentic** AI workflows with streaming
23
+ - **State** management across all steps
24
+ - **Streaming** real-time data to clients
25
+ - **Logging** and observability infrastructure
26
+ - **Multi-language** support (TypeScript, Python, Ruby)
25
27
 
26
28
  ## Key Components
27
29
 
@@ -11,137 +11,35 @@ export declare const handlerBaseSchema: z.ZodObject<{
11
11
  ram: z.ZodNumber;
12
12
  timeout: z.ZodNumber;
13
13
  cpu: z.ZodOptional<z.ZodNumber>;
14
- }, "strip", z.ZodTypeAny, {
15
- ram: number;
16
- timeout: number;
17
- cpu?: number | undefined;
18
- }, {
19
- ram: number;
20
- timeout: number;
21
- cpu?: number | undefined;
22
- }>;
23
- export declare const handlerSchema: z.ZodEffects<z.ZodObject<{
14
+ }, z.core.$strip>;
15
+ export declare const handlerSchema: z.ZodObject<{
24
16
  ram: z.ZodOptional<z.ZodNumber>;
25
17
  timeout: z.ZodOptional<z.ZodNumber>;
26
18
  cpu: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
27
- }, "strip", z.ZodTypeAny, {
28
- ram?: number | undefined;
29
- timeout?: number | undefined;
30
- cpu?: number | undefined;
31
- }, {
32
- ram?: number | undefined;
33
- timeout?: number | undefined;
34
- cpu?: number | undefined;
35
- }>, {
36
- ram?: number | undefined;
37
- timeout?: number | undefined;
38
- cpu?: number | undefined;
39
- }, {
40
- ram?: number | undefined;
41
- timeout?: number | undefined;
42
- cpu?: number | undefined;
43
- }>;
19
+ }, z.core.$strip>;
44
20
  export declare const queueSchema: z.ZodObject<{
45
- type: z.ZodEnum<["standard", "fifo"]>;
21
+ type: z.ZodEnum<{
22
+ standard: "standard";
23
+ fifo: "fifo";
24
+ }>;
46
25
  visibilityTimeout: z.ZodNumber;
47
26
  maxRetries: z.ZodNumber;
48
27
  delaySeconds: z.ZodOptional<z.ZodNumber>;
49
- }, "strip", z.ZodTypeAny, {
50
- type: "standard" | "fifo";
51
- visibilityTimeout: number;
52
- maxRetries: number;
53
- delaySeconds?: number | undefined;
54
- }, {
55
- type: "standard" | "fifo";
56
- visibilityTimeout: number;
57
- maxRetries: number;
58
- delaySeconds?: number | undefined;
59
- }>;
60
- export declare const infrastructureSchema: z.ZodEffects<z.ZodObject<{
61
- handler: z.ZodOptional<z.ZodEffects<z.ZodObject<{
28
+ }, z.core.$strip>;
29
+ export declare const infrastructureSchema: z.ZodObject<{
30
+ handler: z.ZodOptional<z.ZodObject<{
62
31
  ram: z.ZodOptional<z.ZodNumber>;
63
32
  timeout: z.ZodOptional<z.ZodNumber>;
64
33
  cpu: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
65
- }, "strip", z.ZodTypeAny, {
66
- ram?: number | undefined;
67
- timeout?: number | undefined;
68
- cpu?: number | undefined;
69
- }, {
70
- ram?: number | undefined;
71
- timeout?: number | undefined;
72
- cpu?: number | undefined;
73
- }>, {
74
- ram?: number | undefined;
75
- timeout?: number | undefined;
76
- cpu?: number | undefined;
77
- }, {
78
- ram?: number | undefined;
79
- timeout?: number | undefined;
80
- cpu?: number | undefined;
81
- }>>;
34
+ }, z.core.$strip>>;
82
35
  queue: z.ZodOptional<z.ZodObject<{
83
- type: z.ZodOptional<z.ZodEnum<["standard", "fifo"]>>;
36
+ type: z.ZodOptional<z.ZodEnum<{
37
+ standard: "standard";
38
+ fifo: "fifo";
39
+ }>>;
84
40
  visibilityTimeout: z.ZodOptional<z.ZodNumber>;
85
41
  maxRetries: z.ZodOptional<z.ZodNumber>;
86
42
  delaySeconds: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
87
- }, "strip", z.ZodTypeAny, {
88
- type?: "standard" | "fifo" | undefined;
89
- visibilityTimeout?: number | undefined;
90
- maxRetries?: number | undefined;
91
- delaySeconds?: number | undefined;
92
- }, {
93
- type?: "standard" | "fifo" | undefined;
94
- visibilityTimeout?: number | undefined;
95
- maxRetries?: number | undefined;
96
- delaySeconds?: number | undefined;
97
- }>>;
98
- }, "strip", z.ZodTypeAny, {
99
- handler?: {
100
- ram?: number | undefined;
101
- timeout?: number | undefined;
102
- cpu?: number | undefined;
103
- } | undefined;
104
- queue?: {
105
- type?: "standard" | "fifo" | undefined;
106
- visibilityTimeout?: number | undefined;
107
- maxRetries?: number | undefined;
108
- delaySeconds?: number | undefined;
109
- } | undefined;
110
- }, {
111
- handler?: {
112
- ram?: number | undefined;
113
- timeout?: number | undefined;
114
- cpu?: number | undefined;
115
- } | undefined;
116
- queue?: {
117
- type?: "standard" | "fifo" | undefined;
118
- visibilityTimeout?: number | undefined;
119
- maxRetries?: number | undefined;
120
- delaySeconds?: number | undefined;
121
- } | undefined;
122
- }>, {
123
- handler?: {
124
- ram?: number | undefined;
125
- timeout?: number | undefined;
126
- cpu?: number | undefined;
127
- } | undefined;
128
- queue?: {
129
- type?: "standard" | "fifo" | undefined;
130
- visibilityTimeout?: number | undefined;
131
- maxRetries?: number | undefined;
132
- delaySeconds?: number | undefined;
133
- } | undefined;
134
- }, {
135
- handler?: {
136
- ram?: number | undefined;
137
- timeout?: number | undefined;
138
- cpu?: number | undefined;
139
- } | undefined;
140
- queue?: {
141
- type?: "standard" | "fifo" | undefined;
142
- visibilityTimeout?: number | undefined;
143
- maxRetries?: number | undefined;
144
- delaySeconds?: number | undefined;
145
- } | undefined;
146
- }>;
43
+ }, z.core.$strip>>;
44
+ }, z.core.$strip>;
147
45
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/infrastructure-validator/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAA;AAEV,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAevD,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBxD;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAU5B,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;EAexB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAStB,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe7B,CAAA"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/infrastructure-validator/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAA;AAEV,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAevD,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyBxD;AAED,eAAO,MAAM,iBAAiB;;;;iBAU5B,CAAA;AAEF,eAAO,MAAM,aAAa;;;;iBAexB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;iBAStB,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;iBAe7B,CAAA"}
@@ -11,7 +11,7 @@ const validateQueueConfig = (queueConfig) => {
11
11
  }
12
12
  catch (error) {
13
13
  if (error instanceof zod_1.z.ZodError) {
14
- const errors = error.errors.map((err) => ({
14
+ const errors = error.issues.map((err) => ({
15
15
  path: err.path.length > 0 ? err.path.join('.') : 'queue',
16
16
  message: err.message,
17
17
  }));
@@ -39,7 +39,7 @@ const validateInfrastructureConfig = (infrastructureConfig) => {
39
39
  }
40
40
  catch (error) {
41
41
  if (error instanceof zod_1.z.ZodError) {
42
- const errors = error.errors.map((err) => ({
42
+ const errors = error.issues.map((err) => ({
43
43
  path: err.path.length > 0 ? err.path.join('.') : 'infrastructure',
44
44
  message: err.message,
45
45
  }));
@@ -4,37 +4,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const node_path_1 = __importDefault(require("node:path"));
7
- const zod_to_json_schema_1 = __importDefault(require("zod-to-json-schema"));
8
- // Add ts-node registration before dynamic imports
7
+ const schema_utils_1 = require("../schema-utils");
9
8
  require('ts-node').register({
10
9
  transpileOnly: true,
11
10
  compilerOptions: { module: 'commonjs' },
12
11
  });
13
- function isZodSchema(value) {
14
- return Boolean(value && typeof value.safeParse === 'function' && value._def);
15
- }
16
12
  async function getConfig(filePath) {
17
13
  try {
18
14
  const module = require(node_path_1.default.resolve(filePath));
19
- // Check if the specified function exists in the module
20
15
  if (!module.config) {
21
16
  throw new Error(`Config not found in module ${filePath}`);
22
17
  }
23
- if (isZodSchema(module.config.input)) {
24
- module.config.input = (0, zod_to_json_schema_1.default)(module.config.input, { $refStrategy: 'none' });
18
+ if (module.config.input) {
19
+ const converted = (0, schema_utils_1.schemaToJsonSchema)(module.config.input);
20
+ if (converted) {
21
+ module.config.input = converted;
22
+ }
25
23
  }
26
- else if (isZodSchema(module.config.bodySchema)) {
27
- module.config.bodySchema = (0, zod_to_json_schema_1.default)(module.config.bodySchema, { $refStrategy: 'none' });
24
+ if (module.config.bodySchema) {
25
+ const converted = (0, schema_utils_1.schemaToJsonSchema)(module.config.bodySchema);
26
+ if (converted) {
27
+ module.config.bodySchema = converted;
28
+ }
28
29
  }
29
30
  if (module.config.responseSchema) {
30
31
  for (const [status, schema] of Object.entries(module.config.responseSchema)) {
31
- if (isZodSchema(schema)) {
32
- module.config.responseSchema[status] = (0, zod_to_json_schema_1.default)(schema, { $refStrategy: 'none' });
32
+ const converted = (0, schema_utils_1.schemaToJsonSchema)(schema);
33
+ if (converted) {
34
+ module.config.responseSchema[status] = converted;
33
35
  }
34
36
  }
35
37
  }
36
- if (isZodSchema(module.config.schema)) {
37
- module.config.schema = (0, zod_to_json_schema_1.default)(module.config.schema, { $refStrategy: 'none' });
38
+ if (module.config.schema) {
39
+ const converted = (0, schema_utils_1.schemaToJsonSchema)(module.config.schema);
40
+ if (converted) {
41
+ module.config.schema = converted;
42
+ }
38
43
  }
39
44
  process.send?.(module.config);
40
45
  process.exit(0);
@@ -0,0 +1,9 @@
1
+ import * as z from 'zod';
2
+ import type { StandardSchemaV1 } from 'zod/v4/core/standard-schema.cjs';
3
+ import type { JsonSchema } from './types/schema.types';
4
+ export type SchemaInput = StandardSchemaV1 | z.ZodType | JsonSchema | null | undefined;
5
+ export declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
6
+ export declare function isZodSchema(value: unknown): value is z.ZodType;
7
+ export declare function isJsonSchema(value: unknown): value is JsonSchema;
8
+ export declare function schemaToJsonSchema(schema: SchemaInput): JsonSchema | null;
9
+ //# sourceMappingURL=schema-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../../src/schema-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAStD,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,CAAC,CAAC,OAAO,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAA;AAEtF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAQ1E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,OAAO,CAS9D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAMhE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,CAqBzE"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.isStandardSchema = isStandardSchema;
37
+ exports.isZodSchema = isZodSchema;
38
+ exports.isJsonSchema = isJsonSchema;
39
+ exports.schemaToJsonSchema = schemaToJsonSchema;
40
+ const z = __importStar(require("zod"));
41
+ function isStandardSchema(value) {
42
+ if (!value || typeof value !== 'object') {
43
+ return false;
44
+ }
45
+ const schema = value;
46
+ return '~standard' in schema && schema['~standard'] !== null && typeof schema['~standard'] === 'object';
47
+ }
48
+ function isZodSchema(value) {
49
+ return Boolean(value &&
50
+ typeof value === 'object' &&
51
+ typeof value.safeParse === 'function' &&
52
+ '_zod' in value &&
53
+ typeof value._zod === 'object' &&
54
+ 'def' in value._zod);
55
+ }
56
+ function isJsonSchema(value) {
57
+ if (!value || typeof value !== 'object') {
58
+ return false;
59
+ }
60
+ const schema = value;
61
+ return typeof schema.type === 'string' || Array.isArray(schema.type) || 'properties' in schema;
62
+ }
63
+ function schemaToJsonSchema(schema) {
64
+ if (!schema) {
65
+ return null;
66
+ }
67
+ if (isZodSchema(schema)) {
68
+ return z.toJSONSchema(schema, { target: 'draft-7' });
69
+ }
70
+ if (isStandardSchema(schema)) {
71
+ if ('toJSON' in schema && typeof schema.toJSON === 'function') {
72
+ return schema.toJSON();
73
+ }
74
+ return null;
75
+ }
76
+ if (isJsonSchema(schema)) {
77
+ return schema;
78
+ }
79
+ return null;
80
+ }
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
5
5
  const schemas_1 = require("./infrastructure-validator/schemas");
6
6
  const objectSchema = zod_1.z.object({
7
7
  type: zod_1.z.literal('object'),
8
- properties: zod_1.z.record(zod_1.z.any()),
8
+ properties: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
9
9
  required: zod_1.z.array(zod_1.z.string()).optional(),
10
10
  additionalProperties: zod_1.z.boolean().optional(),
11
11
  description: zod_1.z.string().optional(),
@@ -121,8 +121,8 @@ const validateStep = (step) => {
121
121
  if (error instanceof zod_1.z.ZodError) {
122
122
  return {
123
123
  success: false,
124
- error: error.errors.map((err) => err.message).join(', '),
125
- errors: error.errors.map((err) => ({ path: err.path.join('.'), message: err.message })),
124
+ error: error.issues.map((err) => err.message).join(', '),
125
+ errors: error.issues.map((err) => ({ path: err.path.join('.'), message: err.message })),
126
126
  };
127
127
  }
128
128
  // Handle unexpected errors
@@ -12,7 +12,7 @@ exports.config = {
12
12
  flows: ['_system'],
13
13
  bodySchema: zod_1.z.object({
14
14
  topic: zod_1.z.string(),
15
- data: zod_1.z.record(zod_1.z.unknown()),
15
+ data: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
16
16
  }),
17
17
  };
18
18
  const handler = async (req, { emit, logger }) => {
@@ -11,7 +11,7 @@ export const config: ApiRouteConfig = {
11
11
  flows: ['_system'],
12
12
  bodySchema: z.object({
13
13
  topic: z.string(),
14
- data: z.record(z.unknown()),
14
+ data: z.record(z.string(), z.any()),
15
15
  }),
16
16
  }
17
17
 
@@ -1,3 +1,3 @@
1
- import { type JsonSchema } from './schema.types';
2
- export declare const generateTypeFromSchema: (schema: JsonSchema) => string;
1
+ import type { JSONSchema } from 'zod/v4/core';
2
+ export declare const generateTypeFromSchema: (schema: JSONSchema.BaseSchema) => string;
3
3
  //# sourceMappingURL=generate-type-from-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-type-from-schema.d.ts","sourceRoot":"","sources":["../../../src/types/generate-type-from-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEzD,eAAO,MAAM,sBAAsB,GAAI,QAAQ,UAAU,KAAG,MA6C3D,CAAA"}
1
+ {"version":3,"file":"generate-type-from-schema.d.ts","sourceRoot":"","sources":["../../../src/types/generate-type-from-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG7C,eAAO,MAAM,sBAAsB,GAAI,QAAQ,UAAU,CAAC,UAAU,KAAG,MAgDtE,CAAA"}
@@ -27,6 +27,9 @@ const generateTypeFromSchema = (schema) => {
27
27
  return `Record<string, ${propType}>`;
28
28
  }
29
29
  if (schema.type === 'string') {
30
+ if (schema.format === 'binary') {
31
+ return 'Buffer';
32
+ }
30
33
  return schema.enum && schema.enum.length > 0 // must have at least one enum value
31
34
  ? schema.enum.map((value) => `'${value}'`).join(' | ')
32
35
  : 'string';
@@ -1 +1 @@
1
- {"version":3,"file":"generate-types.d.ts","sourceRoot":"","sources":["../../../src/types/generate-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAM7C,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAA;AACvE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAExC,eAAO,MAAM,mBAAmB,GAAI,UAAU,WAAW,EAAE,SAAS,UAAU,KAAG,MAwBhF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,OAAO,IAAI,EAAE,EAAE,SAAS,OAAO,KAAG,WAsFxE,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,UAO1E,CAAA"}
1
+ {"version":3,"file":"generate-types.d.ts","sourceRoot":"","sources":["../../../src/types/generate-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAM7C,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAA;AACvE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAExC,eAAO,MAAM,mBAAmB,GAAI,UAAU,WAAW,EAAE,SAAS,UAAU,KAAG,MAwBhF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,OAAO,IAAI,EAAE,EAAE,SAAS,OAAO,KAAG,WAwFxE,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,UAO1E,CAAA"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateTypesFromStreams = exports.generateTypesFromSteps = exports.generateTypesString = void 0;
4
4
  const guards_1 = require("../guards");
5
+ const schema_utils_1 = require("../schema-utils");
5
6
  const generate_type_from_schema_1 = require("./generate-type-from-schema");
6
7
  const generate_types_from_response_1 = require("./generate-types-from-response");
7
8
  const merge_schemas_1 = require("./merge-schemas");
@@ -57,7 +58,9 @@ const generateTypesFromSteps = (steps, printer) => {
57
58
  }
58
59
  try {
59
60
  const input = step.config.input;
60
- const schema = existingSchema ? (0, merge_schemas_1.mergeSchemas)(existingSchema, input) : input;
61
+ const schema = existingSchema
62
+ ? (0, merge_schemas_1.mergeSchemas)(existingSchema, input)
63
+ : ((0, schema_utils_1.schemaToJsonSchema)(input) ?? input);
61
64
  topics[topic] = (0, generate_type_from_schema_1.generateTypeFromSchema)(schema);
62
65
  topicsSchemas[topic] = schema;
63
66
  }
@@ -1,4 +1,5 @@
1
+ import { type SchemaInput } from '../schema-utils';
1
2
  import { type JsonSchema } from './schema.types';
2
3
  export declare const isCompatible: (schema: JsonSchema, otherSchema: JsonSchema) => boolean;
3
- export declare const mergeSchemas: (schema: JsonSchema, otherSchema: JsonSchema) => JsonSchema;
4
+ export declare const mergeSchemas: (schema: SchemaInput, otherSchema: SchemaInput) => JsonSchema;
4
5
  //# sourceMappingURL=merge-schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-schemas.d.ts","sourceRoot":"","sources":["../../../src/types/merge-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,UAAU,EAAwC,MAAM,gBAAgB,CAAA;AAE/F,eAAO,MAAM,YAAY,GAAI,QAAQ,UAAU,EAAE,aAAa,UAAU,KAAG,OAgC1E,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,QAAQ,UAAU,EAAE,aAAa,UAAU,KAAG,UAgD1E,CAAA"}
1
+ {"version":3,"file":"merge-schemas.d.ts","sourceRoot":"","sources":["../../../src/types/merge-schemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AACnF,OAAO,EAAW,KAAK,UAAU,EAAmB,MAAM,gBAAgB,CAAA;AAM1E,eAAO,MAAM,YAAY,GAAI,QAAQ,UAAU,EAAE,aAAa,UAAU,KAAG,OAqD1E,CAAA;AAUD,eAAO,MAAM,YAAY,GAAI,QAAQ,WAAW,EAAE,aAAa,WAAW,KAAG,UA4F5E,CAAA"}
@@ -1,7 +1,45 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.mergeSchemas = exports.isCompatible = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const schema_utils_1 = require("../schema-utils");
4
39
  const schema_types_1 = require("./schema.types");
40
+ const isJsonSchema = (value) => {
41
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && typeof value !== 'boolean';
42
+ };
5
43
  const isCompatible = (schema, otherSchema) => {
6
44
  if ((0, schema_types_1.isAnyOf)(schema)) {
7
45
  return schema.anyOf.every((item) => (0, exports.isCompatible)(item, otherSchema));
@@ -10,66 +48,136 @@ const isCompatible = (schema, otherSchema) => {
10
48
  return otherSchema.anyOf.every((item) => (0, exports.isCompatible)(schema, item));
11
49
  }
12
50
  if (schema.type !== otherSchema.type) {
13
- return false; // different types
51
+ return false;
14
52
  }
15
53
  if (schema.type === 'array' && otherSchema.type === 'array') {
16
- return (0, exports.isCompatible)(schema.items, otherSchema.items);
54
+ if (!schema.items || !otherSchema.items) {
55
+ return schema.items === otherSchema.items;
56
+ }
57
+ if (Array.isArray(schema.items) || Array.isArray(otherSchema.items)) {
58
+ return false;
59
+ }
60
+ if (isJsonSchema(schema.items) && isJsonSchema(otherSchema.items)) {
61
+ return (0, exports.isCompatible)(schema.items, otherSchema.items);
62
+ }
63
+ return schema.items === otherSchema.items;
17
64
  }
18
65
  if (schema.type === 'object' && otherSchema.type === 'object') {
19
- const keysFromSchema = Object.keys(schema.properties);
20
- const keysFromOtherSchema = Object.keys(otherSchema.properties);
66
+ const schemaProps = schema.properties;
67
+ const otherSchemaProps = otherSchema.properties;
68
+ if (!schemaProps || !otherSchemaProps) {
69
+ return schemaProps === otherSchemaProps;
70
+ }
71
+ const keysFromSchema = Object.keys(schemaProps);
72
+ const keysFromOtherSchema = Object.keys(otherSchemaProps);
21
73
  const commonKeys = keysFromSchema.filter((key) => keysFromOtherSchema.includes(key));
22
74
  if (schema.required?.some((key) => !keysFromOtherSchema.includes(key))) {
23
- return false; // some required keys are not present in the other schema
75
+ return false;
24
76
  }
25
77
  else if (otherSchema.required?.some((key) => !keysFromSchema.includes(key))) {
26
- return false; // some required keys are not present in the schema
78
+ return false;
27
79
  }
28
80
  if (commonKeys.length > 0) {
29
- return commonKeys.every((key) => (0, exports.isCompatible)(schema.properties[key], otherSchema.properties[key]));
81
+ return commonKeys.every((key) => {
82
+ const prop1 = schemaProps[key];
83
+ const prop2 = otherSchemaProps[key];
84
+ if (isJsonSchema(prop1) && isJsonSchema(prop2)) {
85
+ return (0, exports.isCompatible)(prop1, prop2);
86
+ }
87
+ return prop1 === prop2;
88
+ });
30
89
  }
31
90
  }
32
91
  return true;
33
92
  };
34
93
  exports.isCompatible = isCompatible;
94
+ const mergeZodSchemas = (schema, otherSchema) => {
95
+ try {
96
+ return z.intersection(schema, otherSchema);
97
+ }
98
+ catch (error) {
99
+ throw new schema_types_1.JsonSchemaError(`Cannot merge Zod schemas: ${error instanceof Error ? error.message : 'Unknown error'}`);
100
+ }
101
+ };
35
102
  const mergeSchemas = (schema, otherSchema) => {
36
- if (!(0, exports.isCompatible)(schema, otherSchema)) {
103
+ if ((0, schema_utils_1.isZodSchema)(schema) && (0, schema_utils_1.isZodSchema)(otherSchema)) {
104
+ const mergedZodSchema = mergeZodSchemas(schema, otherSchema);
105
+ const jsonSchema = (0, schema_utils_1.schemaToJsonSchema)(mergedZodSchema);
106
+ if (!jsonSchema) {
107
+ throw new schema_types_1.JsonSchemaError('Failed to convert merged Zod schema to JSON Schema');
108
+ }
109
+ return jsonSchema;
110
+ }
111
+ const schemaJsonResult = (0, schema_utils_1.schemaToJsonSchema)(schema);
112
+ const otherSchemaJsonResult = (0, schema_utils_1.schemaToJsonSchema)(otherSchema);
113
+ if (!schemaJsonResult || !otherSchemaJsonResult) {
114
+ throw new schema_types_1.JsonSchemaError('Cannot merge schemas: failed to convert to JSON Schema');
115
+ }
116
+ const schemaJson = schemaJsonResult;
117
+ const otherSchemaJson = otherSchemaJsonResult;
118
+ if (!(0, exports.isCompatible)(schemaJson, otherSchemaJson)) {
37
119
  throw new schema_types_1.JsonSchemaError('Cannot merge schemas of different types');
38
120
  }
39
- if ((0, schema_types_1.isAnyOf)(schema)) {
121
+ if ((0, schema_types_1.isAnyOf)(schemaJson)) {
40
122
  return {
41
- anyOf: schema.anyOf.map((item) => (0, exports.mergeSchemas)(item, otherSchema)),
123
+ anyOf: schemaJson.anyOf.map((item) => (0, exports.mergeSchemas)(item, otherSchemaJson)),
42
124
  };
43
125
  }
44
- else if ((0, schema_types_1.isAnyOf)(otherSchema)) {
126
+ else if ((0, schema_types_1.isAnyOf)(otherSchemaJson)) {
45
127
  return {
46
- anyOf: otherSchema.anyOf.map((item) => (0, exports.mergeSchemas)(schema, item)),
128
+ anyOf: otherSchemaJson.anyOf.map((item) => (0, exports.mergeSchemas)(schemaJson, item)),
47
129
  };
48
130
  }
49
- if (schema.type === 'object' && otherSchema.type === 'object') {
50
- const mergedProperties = { ...schema.properties, ...otherSchema.properties };
51
- const otherSchemaKeys = Object.keys(otherSchema.properties).reduce((acc, key) => ({ ...acc, [key]: true }), {});
52
- for (const key in schema.properties) {
131
+ if (schemaJson.type === 'object' && otherSchemaJson.type === 'object') {
132
+ const schemaProps = schemaJson.properties;
133
+ const otherSchemaProps = otherSchemaJson.properties;
134
+ if (!schemaProps || !otherSchemaProps) {
135
+ throw new schema_types_1.JsonSchemaError('Cannot merge object schemas without properties');
136
+ }
137
+ const mergedProperties = { ...schemaProps, ...otherSchemaProps };
138
+ const otherSchemaKeys = Object.keys(otherSchemaProps).reduce((acc, key) => {
139
+ acc[key] = true;
140
+ return acc;
141
+ }, {});
142
+ for (const key in schemaProps) {
53
143
  if (otherSchemaKeys[key]) {
54
- mergedProperties[key] = (0, exports.mergeSchemas)(schema.properties[key], otherSchema.properties[key]);
144
+ const prop1 = schemaProps[key];
145
+ const prop2 = otherSchemaProps[key];
146
+ if (isJsonSchema(prop1) && isJsonSchema(prop2)) {
147
+ mergedProperties[key] = (0, exports.mergeSchemas)(prop1, prop2);
148
+ }
149
+ else {
150
+ mergedProperties[key] = prop2;
151
+ }
55
152
  }
56
153
  }
57
- const mergedRequired = new Set([...(schema.required ?? []), ...(otherSchema.required ?? [])]);
154
+ const schemaRequired = schemaJson.required;
155
+ const otherSchemaRequired = otherSchemaJson.required;
156
+ const mergedRequired = new Set([...(schemaRequired ?? []), ...(otherSchemaRequired ?? [])]);
58
157
  return {
59
158
  type: 'object',
60
159
  properties: mergedProperties,
61
160
  required: Array.from(mergedRequired),
62
161
  };
63
162
  }
64
- if (schema.type === 'array' && otherSchema.type === 'array') {
163
+ if (schemaJson.type === 'array' && otherSchemaJson.type === 'array') {
164
+ if (!schemaJson.items || !otherSchemaJson.items) {
165
+ throw new schema_types_1.JsonSchemaError('Cannot merge array schemas without items');
166
+ }
167
+ if (Array.isArray(schemaJson.items) || Array.isArray(otherSchemaJson.items)) {
168
+ throw new schema_types_1.JsonSchemaError('Cannot merge array schemas with array items');
169
+ }
170
+ if (!isJsonSchema(schemaJson.items) || !isJsonSchema(otherSchemaJson.items)) {
171
+ throw new schema_types_1.JsonSchemaError('Cannot merge array schemas with non-object items');
172
+ }
65
173
  return {
66
174
  type: 'array',
67
- items: (0, exports.mergeSchemas)(schema.items, otherSchema.items),
175
+ items: (0, exports.mergeSchemas)(schemaJson.items, otherSchemaJson.items),
68
176
  };
69
177
  }
70
178
  return {
71
- type: schema.type,
72
- description: schema.description ?? otherSchema.description,
179
+ type: schemaJson.type,
180
+ description: (schemaJson.description ?? otherSchemaJson.description),
73
181
  };
74
182
  };
75
183
  exports.mergeSchemas = mergeSchemas;
@@ -1,31 +1,9 @@
1
- export type JsonSchemaType = 'number' | 'boolean';
2
- export type JsonArray = {
3
- type: 'array';
4
- description?: string;
5
- items: JsonSchema;
6
- };
7
- export type JsonObject = {
8
- type: 'object';
9
- description?: string;
10
- properties: Record<string, JsonSchema>;
11
- required?: string[];
12
- additionalProperties?: JsonSchema;
13
- };
14
- export type JsonString = {
15
- type: 'string';
16
- description?: string;
17
- enum?: string[];
18
- };
19
- export type JsonAnyOf = {
20
- anyOf: JsonSchema[];
21
- };
22
- export type JsonProperty = {
23
- type: JsonSchemaType;
24
- description?: string;
25
- };
26
- export type JsonSchema = JsonArray | JsonObject | JsonString | JsonProperty | JsonAnyOf;
1
+ import type { JSONSchema } from 'zod/v4/core';
2
+ export type JsonSchema = JSONSchema.BaseSchema;
27
3
  export declare class JsonSchemaError extends Error {
28
4
  constructor(message: string);
29
5
  }
30
- export declare const isAnyOf: (schema: JsonSchema) => schema is JsonAnyOf;
6
+ export declare const isAnyOf: (schema: JsonSchema) => schema is JSONSchema.BaseSchema & {
7
+ anyOf: JSONSchema.BaseSchema[];
8
+ };
31
9
  //# sourceMappingURL=schema.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.types.d.ts","sourceRoot":"","sources":["../../../src/types/schema.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEjD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI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,CAAC,UAAU,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,CAAA;CAE9G,CAAA"}
@@ -1,8 +1,8 @@
1
- import type { ZodObject } from 'zod';
2
1
  import type { StreamFactory } from './streams/stream-factory';
2
+ import type { StepSchemaInput } from './types';
3
3
  export interface StreamConfig {
4
4
  name: string;
5
- schema: ZodObject<any>;
5
+ schema: StepSchemaInput;
6
6
  baseConfig: {
7
7
  storageType: 'default';
8
8
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"types-stream.d.ts","sourceRoot":"","sources":["../../src/types-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACtB,UAAU,EAAE;QAAE,WAAW,EAAE,SAAS,CAAA;KAAE,GAAG;QAAE,WAAW,EAAE,QAAQ,CAAC;QAAC,OAAO,EAAE,MAAM,WAAW,CAAC,GAAG,CAAC,CAAA;KAAE,CAAA;CACpG;AAED,MAAM,MAAM,uBAAuB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACtE,MAAM,MAAM,gBAAgB,CAAC,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAA;AAEnE,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,MAAM,MAAM,MAAM,CAAC,OAAO,SAAS,YAAY,GAAG,YAAY,IAAI;IAChE,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,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ject, z } from 'zod';
1
+ import type { ZodArray, ZodObject } from 'zod';
2
2
  import type { Logger } from './logger';
3
3
  import type { Tracer } from './observability';
4
+ import type { JsonSchema } from './types/schema.types';
4
5
  export * from './types/app-config-types';
5
6
  export type ZodInput = ZodObject<any> | ZodArray<any>;
7
+ export type StepSchemaInput = ZodInput | JsonSchema;
6
8
  export type InternalStateManager = {
7
9
  get<T>(groupId: string, key: string): Promise<T | null>;
8
10
  set<T>(groupId: string, key: string, value: T): Promise<T>;
@@ -54,7 +56,7 @@ export type EventConfig = {
54
56
  emits: Emit[];
55
57
  virtualEmits?: Emit[];
56
58
  virtualSubscribes?: string[];
57
- input: ZodInput;
59
+ input?: StepSchemaInput;
58
60
  flows?: string[];
59
61
  /**
60
62
  * Files to include in the step bundle.
@@ -88,8 +90,8 @@ export interface ApiRouteConfig {
88
90
  virtualSubscribes?: string[];
89
91
  flows?: string[];
90
92
  middleware?: ApiMiddleware<any, any, any>[];
91
- bodySchema?: ZodInput;
92
- responseSchema?: Record<number, ZodInput | ZodAny>;
93
+ bodySchema?: StepSchemaInput;
94
+ responseSchema?: Record<number, StepSchemaInput>;
93
95
  queryParams?: QueryParam[];
94
96
  /**
95
97
  * Files to include in the step bundle.
@@ -128,7 +130,7 @@ export type CronHandler<TEmitData = never> = (ctx: FlowContext<TEmitData>) => Pr
128
130
  /**
129
131
  * @deprecated Use `Handlers` instead.
130
132
  */
131
- export type StepHandler<T> = T extends EventConfig ? EventHandler<z.infer<T['input']>, {
133
+ export type StepHandler<T> = T extends EventConfig ? EventHandler<unknown, {
132
134
  topic: string;
133
135
  data: any;
134
136
  }> : T extends ApiRouteConfig ? ApiRouteHandler<any, ApiResponse<number, any>, {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACzD,OAA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","sourceRoot":"","sources":["../../src/validate-event-input.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAIvD,eAAO,MAAM,kBAAkB,GAAI,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,EAAE,OAAO,GAAG,SAyEnF,CAAA"}
1
+ {"version":3,"file":"validate-event-input.d.ts","sourceRoot":"","sources":["../../src/validate-event-input.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAIvD,eAAO,MAAM,kBAAkB,GAAI,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,EAAE,OAAO,GAAG,SAwEnF,CAAA"}
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.validateEventInput = void 0;
7
7
  const ajv_1 = __importDefault(require("ajv"));
8
- const zod_to_json_schema_1 = require("zod-to-json-schema");
9
8
  const logger_1 = require("./logger");
10
9
  const printer_1 = require("./printer");
10
+ const schema_utils_1 = require("./schema-utils");
11
11
  const ajv = new ajv_1.default({ allErrors: true, strict: false });
12
12
  const validateEventInput = (step, event, motia) => {
13
13
  const { data } = event;
@@ -22,10 +22,8 @@ const validateEventInput = (step, event, motia) => {
22
22
  let compiledSchema;
23
23
  const inputSchema = step.config.input;
24
24
  try {
25
- if (inputSchema && typeof inputSchema === 'object' && 'safeParse' in inputSchema) {
26
- compiledSchema = (0, zod_to_json_schema_1.zodToJsonSchema)(inputSchema, { target: 'jsonSchema7' });
27
- }
28
- else {
25
+ compiledSchema = (0, schema_utils_1.schemaToJsonSchema)(inputSchema);
26
+ if (!compiledSchema) {
29
27
  compiledSchema = inputSchema;
30
28
  }
31
29
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@motiadev/core",
3
3
  "description": "Core functionality for the Motia framework, providing the foundation for building event-driven workflows.",
4
4
  "main": "dist/index.js",
5
- "version": "0.10.0-beta.153",
5
+ "version": "0.11.0-beta.155-157586",
6
6
  "dependencies": {
7
7
  "@amplitude/analytics-node": "^1.3.8",
8
8
  "ajv": "^8.17.1",
@@ -15,8 +15,7 @@
15
15
  "tsconfig-paths": "^4.2.0",
16
16
  "uuid": "^11.1.0",
17
17
  "ws": "^8.18.2",
18
- "zod": "^3.24.1",
19
- "zod-to-json-schema": "^3.24.5"
18
+ "zod": "^4.1.12"
20
19
  },
21
20
  "devDependencies": {
22
21
  "@types/body-parser": "^1.19.5",