@motiadev/core 0.8.2-beta.140-957262 → 0.8.2-beta.140-111855
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/dist/index.d.ts +18 -13
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -24
- package/dist/jest.config.d.ts +1 -0
- package/dist/jest.config.d.ts.map +1 -0
- package/dist/src/analytics/utils.d.ts +1 -0
- package/dist/src/analytics/utils.d.ts.map +1 -0
- package/dist/src/analytics/utils.js +3 -4
- package/dist/src/call-step-file.d.ts +6 -4
- package/dist/src/call-step-file.d.ts.map +1 -0
- package/dist/src/call-step-file.js +24 -4
- package/dist/src/config.d.ts +2 -1
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.types.d.ts +2 -1
- package/dist/src/config.types.d.ts.map +1 -0
- package/dist/src/cron-handler.d.ts +3 -2
- package/dist/src/cron-handler.d.ts.map +1 -0
- package/dist/src/cron-handler.js +0 -1
- package/dist/src/endpoints/analytics-endpoint.d.ts +2 -1
- package/dist/src/endpoints/analytics-endpoint.d.ts.map +1 -0
- package/dist/src/endpoints/flows-config-endpoint.d.ts +3 -2
- package/dist/src/endpoints/flows-config-endpoint.d.ts.map +1 -0
- package/dist/src/endpoints/flows-endpoint.d.ts +2 -1
- package/dist/src/endpoints/flows-endpoint.d.ts.map +1 -0
- package/dist/src/endpoints/flows-endpoint.js +1 -1
- package/dist/src/endpoints/step-endpoint.d.ts +3 -2
- package/dist/src/endpoints/step-endpoint.d.ts.map +1 -0
- package/dist/src/event-manager.d.ts +4 -2
- package/dist/src/event-manager.d.ts.map +1 -0
- package/dist/src/event-manager.js +14 -9
- package/dist/src/generate-trace-id.d.ts +1 -0
- package/dist/src/generate-trace-id.d.ts.map +1 -0
- package/dist/src/get-step-config.d.ts +3 -2
- package/dist/src/get-step-config.d.ts.map +1 -0
- package/dist/src/get-step-language.d.ts +1 -0
- package/dist/src/get-step-language.d.ts.map +1 -0
- package/dist/src/guards.d.ts +2 -1
- package/dist/src/guards.d.ts.map +1 -0
- package/dist/src/helper/flows-helper.d.ts +3 -2
- package/dist/src/helper/flows-helper.d.ts.map +1 -0
- package/dist/src/helper/flows-helper.js +4 -3
- package/dist/src/infrastructure-validator/defaults.d.ts +4 -0
- package/dist/src/infrastructure-validator/defaults.d.ts.map +1 -0
- package/dist/src/infrastructure-validator/defaults.js +16 -0
- package/dist/src/infrastructure-validator/index.d.ts +4 -0
- package/dist/src/infrastructure-validator/index.d.ts.map +1 -0
- package/dist/src/infrastructure-validator/index.js +13 -0
- package/dist/src/infrastructure-validator/schemas.d.ts +147 -0
- package/dist/src/infrastructure-validator/schemas.d.ts.map +1 -0
- package/dist/src/infrastructure-validator/schemas.js +100 -0
- package/dist/src/infrastructure-validator/types.d.ts +21 -0
- package/dist/src/infrastructure-validator/types.d.ts.map +1 -0
- package/dist/src/infrastructure-validator/types.js +2 -0
- package/dist/src/infrastructure-validator/validations.d.ts +4 -0
- package/dist/src/infrastructure-validator/validations.d.ts.map +1 -0
- package/dist/src/infrastructure-validator/validations.js +62 -0
- package/dist/src/locked-data.d.ts +6 -4
- package/dist/src/locked-data.d.ts.map +1 -0
- package/dist/src/locked-data.js +9 -6
- package/dist/src/logger-factory.d.ts +3 -2
- package/dist/src/logger-factory.d.ts.map +1 -0
- package/dist/src/logger.d.ts +1 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +0 -2
- package/dist/src/mermaid-generator.d.ts +2 -1
- package/dist/src/mermaid-generator.d.ts.map +1 -0
- package/dist/src/motia.d.ts +24 -5
- package/dist/src/motia.d.ts.map +1 -0
- package/dist/src/motia.js +2 -0
- package/dist/src/node/get-config.d.ts +1 -0
- package/dist/src/node/get-config.d.ts.map +1 -0
- package/dist/src/node/get-config.js +6 -8
- package/dist/src/node/logger.d.ts +2 -1
- package/dist/src/node/logger.d.ts.map +1 -0
- package/dist/src/node/middleware-compose.d.ts +1 -0
- package/dist/src/node/middleware-compose.d.ts.map +1 -0
- package/dist/src/node/middleware-compose.js +0 -2
- package/dist/src/node/node-runner.d.ts +1 -0
- package/dist/src/node/node-runner.d.ts.map +1 -0
- package/dist/src/node/node-runner.js +0 -4
- package/dist/src/node/rpc-state-manager.d.ts +3 -2
- package/dist/src/node/rpc-state-manager.d.ts.map +1 -0
- package/dist/src/node/rpc.d.ts +1 -0
- package/dist/src/node/rpc.d.ts.map +1 -0
- package/dist/src/observability/create-trace.d.ts +3 -2
- package/dist/src/observability/create-trace.d.ts.map +1 -0
- package/dist/src/observability/index.d.ts +4 -3
- package/dist/src/observability/index.d.ts.map +1 -0
- package/dist/src/observability/no-tracer.d.ts +2 -1
- package/dist/src/observability/no-tracer.d.ts.map +1 -0
- package/dist/src/observability/stream-tracer.d.ts +6 -5
- package/dist/src/observability/stream-tracer.d.ts.map +1 -0
- package/dist/src/observability/trace-manager.d.ts +3 -2
- package/dist/src/observability/trace-manager.d.ts.map +1 -0
- package/dist/src/observability/trace-stream-adapter.d.ts +2 -1
- package/dist/src/observability/trace-stream-adapter.d.ts.map +1 -0
- package/dist/src/observability/tracer.d.ts +7 -6
- package/dist/src/observability/tracer.d.ts.map +1 -0
- package/dist/src/observability/types.d.ts +2 -1
- package/dist/src/observability/types.d.ts.map +1 -0
- package/dist/src/pretty-print.d.ts +1 -0
- package/dist/src/pretty-print.d.ts.map +1 -0
- package/dist/src/pretty-print.js +0 -3
- package/dist/src/printer.d.ts +12 -3
- package/dist/src/printer.d.ts.map +1 -0
- package/dist/src/printer.js +22 -0
- package/dist/src/process-communication/communication-config.d.ts +2 -1
- package/dist/src/process-communication/communication-config.d.ts.map +1 -0
- package/dist/src/process-communication/process-manager.d.ts +5 -4
- package/dist/src/process-communication/process-manager.d.ts.map +1 -0
- package/dist/src/process-communication/process-manager.js +1 -1
- package/dist/src/process-communication/rpc-processor-interface.d.ts +1 -0
- package/dist/src/process-communication/rpc-processor-interface.d.ts.map +1 -0
- package/dist/src/queue-manager.d.ts +44 -0
- package/dist/src/queue-manager.d.ts.map +1 -0
- package/dist/src/queue-manager.js +266 -0
- package/dist/src/ruby/get-ruby-config.d.ts +2 -1
- package/dist/src/ruby/get-ruby-config.d.ts.map +1 -0
- package/dist/src/server.d.ts +11 -9
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +40 -13
- package/dist/src/socket-server.d.ts +2 -1
- package/dist/src/socket-server.d.ts.map +1 -0
- package/dist/src/state/adapters/default-state-adapter.d.ts +2 -1
- package/dist/src/state/adapters/default-state-adapter.d.ts.map +1 -0
- package/dist/src/state/adapters/memory-state-adapter.d.ts +2 -1
- package/dist/src/state/adapters/memory-state-adapter.d.ts.map +1 -0
- package/dist/src/state/adapters/utils.d.ts +2 -1
- package/dist/src/state/adapters/utils.d.ts.map +1 -0
- package/dist/src/state/create-state-adapter.d.ts +2 -1
- package/dist/src/state/create-state-adapter.d.ts.map +1 -0
- package/dist/src/state/state-adapter.d.ts +2 -1
- package/dist/src/state/state-adapter.d.ts.map +1 -0
- package/dist/src/step-handler-rpc-processor.d.ts +3 -2
- package/dist/src/step-handler-rpc-processor.d.ts.map +1 -0
- package/dist/src/step-handler-rpc-processor.js +0 -2
- package/dist/src/step-handler-rpc-stdin-processor.d.ts +3 -2
- package/dist/src/step-handler-rpc-stdin-processor.d.ts.map +1 -0
- package/dist/src/step-handler-rpc-stdin-processor.js +0 -1
- package/dist/src/step-handlers.d.ts +5 -3
- package/dist/src/step-handlers.d.ts.map +1 -0
- package/dist/src/step-handlers.js +49 -26
- package/dist/src/step-validator.d.ts +2 -1
- package/dist/src/step-validator.d.ts.map +1 -0
- package/dist/src/step-validator.js +2 -0
- package/dist/src/steps/emit.step.d.ts +2 -1
- package/dist/src/steps/emit.step.d.ts.map +1 -0
- package/dist/src/steps/emit.step.ts +1 -1
- package/dist/src/steps/index.d.ts +2 -1
- package/dist/src/steps/index.d.ts.map +1 -0
- package/dist/src/streams/adapters/file-stream-adapter.d.ts +2 -1
- package/dist/src/streams/adapters/file-stream-adapter.d.ts.map +1 -0
- package/dist/src/streams/adapters/memory-stream-adapter.d.ts +1 -0
- package/dist/src/streams/adapters/memory-stream-adapter.d.ts.map +1 -0
- package/dist/src/streams/adapters/stream-adapter.d.ts +2 -1
- package/dist/src/streams/adapters/stream-adapter.d.ts.map +1 -0
- package/dist/src/streams/adapters/stream-adapter.js +0 -1
- package/dist/src/streams/flows-config-stream.d.ts +2 -1
- package/dist/src/streams/flows-config-stream.d.ts.map +1 -0
- package/dist/src/streams/flows-config-stream.js +1 -2
- package/dist/src/streams/flows-stream.d.ts +3 -2
- package/dist/src/streams/flows-stream.d.ts.map +1 -0
- package/dist/src/streams/flows-stream.js +5 -3
- package/dist/src/streams/logs-stream.d.ts +1 -0
- package/dist/src/streams/logs-stream.d.ts.map +1 -0
- package/dist/src/streams/stream-factory.d.ts +2 -1
- package/dist/src/streams/stream-factory.d.ts.map +1 -0
- package/dist/src/types/app-config-types.d.ts +6 -8
- package/dist/src/types/app-config-types.d.ts.map +1 -0
- package/dist/src/types/flows-config-types.d.ts +1 -0
- package/dist/src/types/flows-config-types.d.ts.map +1 -0
- package/dist/src/types/flows-types.d.ts +2 -1
- package/dist/src/types/flows-types.d.ts.map +1 -0
- package/dist/src/types/generate-type-from-schema.d.ts +2 -1
- package/dist/src/types/generate-type-from-schema.d.ts.map +1 -0
- package/dist/src/types/generate-types-from-response.d.ts +2 -1
- package/dist/src/types/generate-types-from-response.d.ts.map +1 -0
- package/dist/src/types/generate-types.d.ts +4 -3
- package/dist/src/types/generate-types.d.ts.map +1 -0
- package/dist/src/types/generate-types.js +12 -2
- package/dist/src/types/merge-schemas.d.ts +2 -1
- package/dist/src/types/merge-schemas.d.ts.map +1 -0
- package/dist/src/types/schema.types.d.ts +1 -0
- package/dist/src/types/schema.types.d.ts.map +1 -0
- package/dist/src/types-stream.d.ts +3 -2
- package/dist/src/types-stream.d.ts.map +1 -0
- package/dist/src/types.d.ts +27 -7
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils.d.ts +2 -1
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/validate-event-input.d.ts +3 -0
- package/dist/src/validate-event-input.d.ts.map +1 -0
- package/dist/src/validate-event-input.js +74 -0
- package/package.json +5 -4
- package/dist/src/endpoints/api-endpoints.d.ts +0 -2
- package/dist/src/endpoints/api-endpoints.js +0 -72
- package/dist/src/endpoints/state-endpoints.d.ts +0 -3
- package/dist/src/endpoints/state-endpoints.js +0 -42
- package/dist/src/endpoints/trace-endpoint.d.ts +0 -3
- package/dist/src/endpoints/trace-endpoint.js +0 -10
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AWS_LAMBDA_LIMITS: {
|
|
3
|
+
readonly MIN_RAM_MB: 128;
|
|
4
|
+
readonly MAX_RAM_MB: 10240;
|
|
5
|
+
readonly MIN_TIMEOUT_SECONDS: 1;
|
|
6
|
+
readonly MAX_TIMEOUT_SECONDS: 900;
|
|
7
|
+
};
|
|
8
|
+
export declare const AWS_LAMBDA_CPU_RATIO: Record<number, number>;
|
|
9
|
+
export declare function getProportionalCpu(ramMb: number): number;
|
|
10
|
+
export declare const handlerBaseSchema: z.ZodObject<{
|
|
11
|
+
ram: z.ZodNumber;
|
|
12
|
+
timeout: z.ZodNumber;
|
|
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<{
|
|
24
|
+
ram: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
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
|
+
}>;
|
|
44
|
+
export declare const queueSchema: z.ZodObject<{
|
|
45
|
+
type: z.ZodEnum<["standard", "fifo"]>;
|
|
46
|
+
visibilityTimeout: z.ZodNumber;
|
|
47
|
+
maxRetries: z.ZodNumber;
|
|
48
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
type: "fifo" | "standard";
|
|
51
|
+
visibilityTimeout: number;
|
|
52
|
+
maxRetries: number;
|
|
53
|
+
delaySeconds?: number | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
type: "fifo" | "standard";
|
|
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<{
|
|
62
|
+
ram: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
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
|
+
}>>;
|
|
82
|
+
queue: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
type: z.ZodOptional<z.ZodEnum<["standard", "fifo"]>>;
|
|
84
|
+
visibilityTimeout: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
delaySeconds: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
type?: "fifo" | "standard" | undefined;
|
|
89
|
+
visibilityTimeout?: number | undefined;
|
|
90
|
+
maxRetries?: number | undefined;
|
|
91
|
+
delaySeconds?: number | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
type?: "fifo" | "standard" | 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?: "fifo" | "standard" | 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?: "fifo" | "standard" | 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?: "fifo" | "standard" | 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?: "fifo" | "standard" | undefined;
|
|
142
|
+
visibilityTimeout?: number | undefined;
|
|
143
|
+
maxRetries?: number | undefined;
|
|
144
|
+
delaySeconds?: number | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
}>;
|
|
147
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.infrastructureSchema = exports.queueSchema = exports.handlerSchema = exports.handlerBaseSchema = exports.AWS_LAMBDA_CPU_RATIO = exports.AWS_LAMBDA_LIMITS = void 0;
|
|
4
|
+
exports.getProportionalCpu = getProportionalCpu;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.AWS_LAMBDA_LIMITS = {
|
|
7
|
+
MIN_RAM_MB: 128,
|
|
8
|
+
MAX_RAM_MB: 10240,
|
|
9
|
+
MIN_TIMEOUT_SECONDS: 1,
|
|
10
|
+
MAX_TIMEOUT_SECONDS: 900,
|
|
11
|
+
};
|
|
12
|
+
exports.AWS_LAMBDA_CPU_RATIO = {
|
|
13
|
+
128: 0.0625,
|
|
14
|
+
256: 0.125,
|
|
15
|
+
512: 0.25,
|
|
16
|
+
1024: 0.5,
|
|
17
|
+
1536: 0.75,
|
|
18
|
+
2048: 1,
|
|
19
|
+
3008: 1.5,
|
|
20
|
+
4096: 2,
|
|
21
|
+
5120: 2.5,
|
|
22
|
+
6144: 3,
|
|
23
|
+
7168: 3.5,
|
|
24
|
+
8192: 4,
|
|
25
|
+
9216: 4.5,
|
|
26
|
+
10240: 5,
|
|
27
|
+
};
|
|
28
|
+
function getProportionalCpu(ramMb) {
|
|
29
|
+
const ramValues = Object.keys(exports.AWS_LAMBDA_CPU_RATIO)
|
|
30
|
+
.map(Number)
|
|
31
|
+
.sort((a, b) => a - b);
|
|
32
|
+
const exact = exports.AWS_LAMBDA_CPU_RATIO[ramMb];
|
|
33
|
+
if (exact !== undefined) {
|
|
34
|
+
return exact;
|
|
35
|
+
}
|
|
36
|
+
for (let i = 0; i < ramValues.length - 1; i++) {
|
|
37
|
+
const lower = ramValues[i];
|
|
38
|
+
const upper = ramValues[i + 1];
|
|
39
|
+
if (ramMb > lower && ramMb < upper) {
|
|
40
|
+
const lowerCpu = exports.AWS_LAMBDA_CPU_RATIO[lower];
|
|
41
|
+
const upperCpu = exports.AWS_LAMBDA_CPU_RATIO[upper];
|
|
42
|
+
const ratio = (ramMb - lower) / (upper - lower);
|
|
43
|
+
return lowerCpu + (upperCpu - lowerCpu) * ratio;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return ramMb <= ramValues[0]
|
|
47
|
+
? exports.AWS_LAMBDA_CPU_RATIO[ramValues[0]]
|
|
48
|
+
: exports.AWS_LAMBDA_CPU_RATIO[ramValues[ramValues.length - 1]];
|
|
49
|
+
}
|
|
50
|
+
exports.handlerBaseSchema = zod_1.z.object({
|
|
51
|
+
ram: zod_1.z
|
|
52
|
+
.number()
|
|
53
|
+
.min(exports.AWS_LAMBDA_LIMITS.MIN_RAM_MB, `RAM must be at least ${exports.AWS_LAMBDA_LIMITS.MIN_RAM_MB} MB`)
|
|
54
|
+
.max(exports.AWS_LAMBDA_LIMITS.MAX_RAM_MB, `RAM cannot exceed ${exports.AWS_LAMBDA_LIMITS.MAX_RAM_MB} MB`),
|
|
55
|
+
timeout: zod_1.z
|
|
56
|
+
.number()
|
|
57
|
+
.min(exports.AWS_LAMBDA_LIMITS.MIN_TIMEOUT_SECONDS, `Timeout must be at least ${exports.AWS_LAMBDA_LIMITS.MIN_TIMEOUT_SECONDS}s`)
|
|
58
|
+
.max(exports.AWS_LAMBDA_LIMITS.MAX_TIMEOUT_SECONDS, `Timeout cannot exceed ${exports.AWS_LAMBDA_LIMITS.MAX_TIMEOUT_SECONDS}s`),
|
|
59
|
+
cpu: zod_1.z.number().optional(),
|
|
60
|
+
});
|
|
61
|
+
exports.handlerSchema = exports.handlerBaseSchema.partial().superRefine((handler, ctx) => {
|
|
62
|
+
if (handler.cpu === undefined || handler.ram === undefined) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const expectedCpu = getProportionalCpu(handler.ram);
|
|
66
|
+
const tolerance = 0.1;
|
|
67
|
+
if (Math.abs(handler.cpu - expectedCpu) > tolerance) {
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
70
|
+
path: ['handler', 'cpu'],
|
|
71
|
+
message: `CPU (${handler.cpu} vCPU) is not proportional to RAM (${handler.ram} MB). Expected approximately ${expectedCpu.toFixed(2)} vCPU`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
exports.queueSchema = zod_1.z.object({
|
|
76
|
+
type: zod_1.z.enum(['standard', 'fifo']),
|
|
77
|
+
visibilityTimeout: zod_1.z.number(),
|
|
78
|
+
maxRetries: zod_1.z.number().min(0, 'maxRetries cannot be negative'),
|
|
79
|
+
delaySeconds: zod_1.z
|
|
80
|
+
.number()
|
|
81
|
+
.min(0, 'delaySeconds cannot be negative')
|
|
82
|
+
.max(900, 'delaySeconds cannot exceed 900 seconds (15 minutes)')
|
|
83
|
+
.optional(),
|
|
84
|
+
});
|
|
85
|
+
exports.infrastructureSchema = zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
handler: exports.handlerSchema.optional(),
|
|
88
|
+
queue: exports.queueSchema.partial().optional(),
|
|
89
|
+
})
|
|
90
|
+
.superRefine((config, ctx) => {
|
|
91
|
+
if (config.queue?.visibilityTimeout !== undefined && config.handler?.timeout !== undefined) {
|
|
92
|
+
if (config.queue.visibilityTimeout <= config.handler.timeout) {
|
|
93
|
+
ctx.addIssue({
|
|
94
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
95
|
+
path: ['queue', 'visibilityTimeout'],
|
|
96
|
+
message: `Visibility timeout (${config.queue.visibilityTimeout}s) must be greater than handler timeout (${config.handler.timeout}s) to prevent premature message redelivery`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type InfrastructureValidationError = {
|
|
2
|
+
path: string;
|
|
3
|
+
message: string;
|
|
4
|
+
};
|
|
5
|
+
export type InfrastructureValidationResult = {
|
|
6
|
+
success: true;
|
|
7
|
+
} | {
|
|
8
|
+
success: false;
|
|
9
|
+
errors?: InfrastructureValidationError[];
|
|
10
|
+
};
|
|
11
|
+
export type QueueValidationError = {
|
|
12
|
+
path: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
export type QueueValidationResult = {
|
|
16
|
+
success: true;
|
|
17
|
+
} | {
|
|
18
|
+
success: false;
|
|
19
|
+
errors?: QueueValidationError[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/infrastructure-validator/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,8BAA8B,GACtC;IACE,OAAO,EAAE,IAAI,CAAA;CACd,GACD;IACE,OAAO,EAAE,KAAK,CAAA;IACd,MAAM,CAAC,EAAE,6BAA6B,EAAE,CAAA;CACzC,CAAA;AAEL,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAC7B;IACE,OAAO,EAAE,IAAI,CAAA;CACd,GACD;IACE,OAAO,EAAE,KAAK,CAAA;IACd,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAChC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfrastructureValidationResult, QueueValidationResult } from './types';
|
|
2
|
+
export declare const validateQueueConfig: (queueConfig: unknown) => QueueValidationResult;
|
|
3
|
+
export declare const validateInfrastructureConfig: (infrastructureConfig: unknown) => InfrastructureValidationResult;
|
|
4
|
+
//# sourceMappingURL=validations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../../src/infrastructure-validator/validations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,8BAA8B,EAE9B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,mBAAmB,GAAI,aAAa,OAAO,KAAG,qBA6B1D,CAAA;AACD,eAAO,MAAM,4BAA4B,GAAI,sBAAsB,OAAO,KAAG,8BA4B5E,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateInfrastructureConfig = exports.validateQueueConfig = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("./schemas");
|
|
6
|
+
const validateQueueConfig = (queueConfig) => {
|
|
7
|
+
try {
|
|
8
|
+
const schema = schemas_1.queueSchema;
|
|
9
|
+
schema.parse(queueConfig);
|
|
10
|
+
return { success: true };
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
14
|
+
const errors = error.errors.map((err) => ({
|
|
15
|
+
path: err.path.length > 0 ? err.path.join('.') : 'queue',
|
|
16
|
+
message: err.message,
|
|
17
|
+
}));
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
errors,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
success: false,
|
|
25
|
+
errors: [
|
|
26
|
+
{
|
|
27
|
+
path: 'queue',
|
|
28
|
+
message: `Unexpected validation error: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.validateQueueConfig = validateQueueConfig;
|
|
35
|
+
const validateInfrastructureConfig = (infrastructureConfig) => {
|
|
36
|
+
try {
|
|
37
|
+
schemas_1.infrastructureSchema.parse(infrastructureConfig);
|
|
38
|
+
return { success: true };
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
42
|
+
const errors = error.errors.map((err) => ({
|
|
43
|
+
path: err.path.length > 0 ? err.path.join('.') : 'infrastructure',
|
|
44
|
+
message: err.message,
|
|
45
|
+
}));
|
|
46
|
+
return {
|
|
47
|
+
success: false,
|
|
48
|
+
errors,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
errors: [
|
|
54
|
+
{
|
|
55
|
+
path: 'infrastructure',
|
|
56
|
+
message: `Unexpected validation error: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.validateInfrastructureConfig = validateInfrastructureConfig;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Printer } from './printer';
|
|
2
|
-
import { StreamFactory } from './streams/stream-factory';
|
|
3
|
-
import { ApiRouteConfig, CronConfig, EventConfig, Flow, Step } from './types';
|
|
4
|
-
import { Stream } from './types-stream';
|
|
1
|
+
import type { Printer } from './printer';
|
|
2
|
+
import type { StreamFactory } from './streams/stream-factory';
|
|
3
|
+
import type { ApiRouteConfig, CronConfig, EventConfig, Flow, Step } from './types';
|
|
4
|
+
import type { Stream } from './types-stream';
|
|
5
5
|
type FlowEvent = 'flow-created' | 'flow-removed' | 'flow-updated';
|
|
6
6
|
type StepEvent = 'step-created' | 'step-removed' | 'step-updated';
|
|
7
7
|
type StreamEvent = 'stream-created' | 'stream-removed' | 'stream-updated';
|
|
@@ -26,6 +26,7 @@ export declare class LockedData {
|
|
|
26
26
|
on(event: FlowEvent, handler: (flowName: string) => void): void;
|
|
27
27
|
onStep(event: StepEvent, handler: (step: Step) => void): void;
|
|
28
28
|
onStream(event: StreamEvent, handler: (stream: Stream) => void): void;
|
|
29
|
+
getActiveSteps(): Step[];
|
|
29
30
|
eventSteps(): Step<EventConfig>[];
|
|
30
31
|
apiSteps(): Step<ApiRouteConfig>[];
|
|
31
32
|
cronSteps(): Step<CronConfig>[];
|
|
@@ -60,3 +61,4 @@ export declare class LockedData {
|
|
|
60
61
|
private createStreamAdapter;
|
|
61
62
|
}
|
|
62
63
|
export {};
|
|
64
|
+
//# sourceMappingURL=locked-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locked-data.d.ts","sourceRoot":"","sources":["../../src/locked-data.ts"],"names":[],"mappings":"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"}
|
package/dist/src/locked-data.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.LockedData = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const guards_1 = require("./guards");
|
|
10
|
+
const motia_1 = require("./motia");
|
|
10
11
|
const step_validator_1 = require("./step-validator");
|
|
11
12
|
const file_stream_adapter_1 = require("./streams/adapters/file-stream-adapter");
|
|
12
13
|
const memory_stream_adapter_1 = require("./streams/adapters/memory-stream-adapter");
|
|
@@ -56,22 +57,24 @@ class LockedData {
|
|
|
56
57
|
onStream(event, handler) {
|
|
57
58
|
this.streamHandlers[event].push(handler);
|
|
58
59
|
}
|
|
60
|
+
getActiveSteps() {
|
|
61
|
+
return this.activeSteps.filter((step) => !step.config.flows?.includes(motia_1.PLUGIN_FLOW_ID));
|
|
62
|
+
}
|
|
59
63
|
eventSteps() {
|
|
60
|
-
return this.
|
|
64
|
+
return this.getActiveSteps().filter(guards_1.isEventStep);
|
|
61
65
|
}
|
|
62
66
|
apiSteps() {
|
|
63
|
-
return this.
|
|
67
|
+
return this.getActiveSteps().filter(guards_1.isApiStep);
|
|
64
68
|
}
|
|
65
69
|
cronSteps() {
|
|
66
|
-
return this.
|
|
70
|
+
return this.getActiveSteps().filter(guards_1.isCronStep);
|
|
67
71
|
}
|
|
68
72
|
pythonSteps() {
|
|
69
|
-
return this.
|
|
73
|
+
return this.getActiveSteps().filter((step) => step.filePath.endsWith('.py'));
|
|
70
74
|
}
|
|
71
75
|
tsSteps() {
|
|
72
|
-
return this.
|
|
76
|
+
return this.getActiveSteps().filter((step) => step.filePath.endsWith('.ts'));
|
|
73
77
|
}
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
78
|
getStreams() {
|
|
76
79
|
const streams = {};
|
|
77
80
|
for (const [key, value] of Object.entries(this.streams)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from './logger';
|
|
2
|
-
import { StreamAdapter } from './streams/adapters/stream-adapter';
|
|
3
|
-
import { Log } from './streams/logs-stream';
|
|
2
|
+
import type { StreamAdapter } from './streams/adapters/stream-adapter';
|
|
3
|
+
import type { Log } from './streams/logs-stream';
|
|
4
4
|
type CreateLogger = {
|
|
5
5
|
traceId: string;
|
|
6
6
|
flows?: string[];
|
|
@@ -16,3 +16,4 @@ export declare class BaseLoggerFactory implements LoggerFactory {
|
|
|
16
16
|
create({ stepName, traceId, flows }: CreateLogger): Logger;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
19
|
+
//# sourceMappingURL=logger-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-factory.d.ts","sourceRoot":"","sources":["../../src/logger-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAEhD,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,CAAA;CACvC;AAED,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADT,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC;IAGhD,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,YAAY,GAAG,MAAM;CAiB3D"}
|
package/dist/src/logger.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;AAE9E,qBAAa,MAAM;IAYf,QAAQ,CAAC,SAAS,EAAE,OAAO;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAbhC;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;gBAGnC,SAAS,GAAE,OAAe,EAClB,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAClC,aAAa,GAAE,WAAW,EAAO;IAGpD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAI5C,OAAO,CAAC,IAAI;IASZ,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IAMpC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IAIrC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IAMrC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IAMpC,GAAG,CAAC,IAAI,EAAE,GAAG;IAIb,WAAW,CAAC,QAAQ,EAAE,WAAW;CAGlC;AAED,eAAO,MAAM,YAAY,QAAe,CAAA"}
|
package/dist/src/logger.js
CHANGED
|
@@ -24,7 +24,6 @@ class Logger {
|
|
|
24
24
|
child(meta) {
|
|
25
25
|
return new Logger(this.isVerbose, { ...this.meta, ...meta }, this.coreListeners);
|
|
26
26
|
}
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
27
|
_log(level, msg, args) {
|
|
29
28
|
const time = Date.now();
|
|
30
29
|
const meta = { ...this.meta, ...(args ?? {}) };
|
|
@@ -50,7 +49,6 @@ class Logger {
|
|
|
50
49
|
this._log('warn', message, args);
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
52
|
log(args) {
|
|
55
53
|
this._log(args.level ?? 'info', args.msg, args);
|
|
56
54
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mermaid-generator.d.ts","sourceRoot":"","sources":["../../src/mermaid-generator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAqM/C,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM;6BAkBpB,UAAU,KAAG,IAAI;CA0BlD,CAAA"}
|
package/dist/src/motia.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { Express } from 'express';
|
|
2
|
+
import type { LockedData } from './locked-data';
|
|
3
|
+
import type { LoggerFactory } from './logger-factory';
|
|
4
|
+
import type { TracerFactory } from './observability';
|
|
5
|
+
import type { Printer } from './printer';
|
|
6
|
+
import type { QueueManager } from './queue-manager';
|
|
7
|
+
import type { StateAdapter } from './state/state-adapter';
|
|
8
|
+
import type { ApiResponse, ApiRouteConfig, ApiRouteHandler, EventManager, InternalStateManager } from './types';
|
|
6
9
|
export type Motia = {
|
|
7
10
|
loggerFactory: LoggerFactory;
|
|
8
11
|
eventManager: EventManager;
|
|
@@ -10,4 +13,20 @@ export type Motia = {
|
|
|
10
13
|
lockedData: LockedData;
|
|
11
14
|
printer: Printer;
|
|
12
15
|
tracerFactory: TracerFactory;
|
|
16
|
+
queueManager: QueueManager;
|
|
17
|
+
app: Express;
|
|
18
|
+
stateAdapter: StateAdapter;
|
|
13
19
|
};
|
|
20
|
+
export type PluginApiConfig = {
|
|
21
|
+
method: ApiRouteConfig['method'];
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
export type UnregisterMotiaPluginApi = () => void;
|
|
25
|
+
export type MotiaPluginContext = {
|
|
26
|
+
state: StateAdapter;
|
|
27
|
+
lockedData: LockedData;
|
|
28
|
+
tracerFactory: TracerFactory;
|
|
29
|
+
registerApi: <TRequestBody = unknown, TResponseBody extends ApiResponse<number, unknown> = ApiResponse<number, unknown>, TEmitData = never>(config: PluginApiConfig, handler: ApiRouteHandler<TRequestBody, TResponseBody, TEmitData>) => UnregisterMotiaPluginApi;
|
|
30
|
+
};
|
|
31
|
+
export declare const PLUGIN_FLOW_ID = "_plugin";
|
|
32
|
+
//# sourceMappingURL=motia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motia.d.ts","sourceRoot":"","sources":["../../src/motia.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE/G,MAAM,MAAM,KAAK,GAAG;IAClB,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,oBAAoB,CAAA;IAC3B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;IAE1B,GAAG,EAAE,OAAO,CAAA;IACZ,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,IAAI,CAAA;AAEjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,YAAY,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,CACX,YAAY,GAAG,OAAO,EACtB,aAAa,SAAS,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EACjF,SAAS,GAAG,KAAK,EAEjB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,CAAC,KAC7D,wBAAwB,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,cAAc,YAAY,CAAA"}
|
package/dist/src/motia.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-config.d.ts","sourceRoot":"","sources":["../../../src/node/get-config.ts"],"names":[],"mappings":""}
|
|
@@ -3,10 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
7
7
|
const zod_to_json_schema_1 = __importDefault(require("zod-to-json-schema"));
|
|
8
8
|
// Add ts-node registration before dynamic imports
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
10
9
|
require('ts-node').register({
|
|
11
10
|
transpileOnly: true,
|
|
12
11
|
compilerOptions: { module: 'commonjs' },
|
|
@@ -16,27 +15,26 @@ function isZodSchema(value) {
|
|
|
16
15
|
}
|
|
17
16
|
async function getConfig(filePath) {
|
|
18
17
|
try {
|
|
19
|
-
|
|
20
|
-
const module = require(path_1.default.resolve(filePath));
|
|
18
|
+
const module = require(node_path_1.default.resolve(filePath));
|
|
21
19
|
// Check if the specified function exists in the module
|
|
22
20
|
if (!module.config) {
|
|
23
21
|
throw new Error(`Config not found in module ${filePath}`);
|
|
24
22
|
}
|
|
25
23
|
if (isZodSchema(module.config.input)) {
|
|
26
|
-
module.config.input = (0, zod_to_json_schema_1.default)(module.config.input);
|
|
24
|
+
module.config.input = (0, zod_to_json_schema_1.default)(module.config.input, { $refStrategy: 'none' });
|
|
27
25
|
}
|
|
28
26
|
else if (isZodSchema(module.config.bodySchema)) {
|
|
29
|
-
module.config.bodySchema = (0, zod_to_json_schema_1.default)(module.config.bodySchema);
|
|
27
|
+
module.config.bodySchema = (0, zod_to_json_schema_1.default)(module.config.bodySchema, { $refStrategy: 'none' });
|
|
30
28
|
}
|
|
31
29
|
if (module.config.responseSchema) {
|
|
32
30
|
for (const [status, schema] of Object.entries(module.config.responseSchema)) {
|
|
33
31
|
if (isZodSchema(schema)) {
|
|
34
|
-
module.config.responseSchema[status] = (0, zod_to_json_schema_1.default)(schema);
|
|
32
|
+
module.config.responseSchema[status] = (0, zod_to_json_schema_1.default)(schema, { $refStrategy: 'none' });
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
if (isZodSchema(module.config.schema)) {
|
|
39
|
-
module.config.schema = (0, zod_to_json_schema_1.default)(module.config.schema);
|
|
37
|
+
module.config.schema = (0, zod_to_json_schema_1.default)(module.config.schema, { $refStrategy: 'none' });
|
|
40
38
|
}
|
|
41
39
|
process.send?.(module.config);
|
|
42
40
|
process.exit(0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpcSender } from './rpc';
|
|
1
|
+
import type { RpcSender } from './rpc';
|
|
2
2
|
export declare class Logger {
|
|
3
3
|
private readonly traceId;
|
|
4
4
|
private readonly flows;
|
|
@@ -10,3 +10,4 @@ export declare class Logger {
|
|
|
10
10
|
debug(message: string, args?: Record<string, unknown>): void;
|
|
11
11
|
warn(message: string, args?: Record<string, unknown>): void;
|
|
12
12
|
}
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/node/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,SAAS;IAGpC,OAAO,CAAC,IAAI;IAwBZ,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI3D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAG5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-compose.d.ts","sourceRoot":"","sources":["../../../src/node/middleware-compose.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,GAAI,GAAG,aAAa,GAAG,EAAE,MACvC,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,SAAS,MAAM,OAAO,CAAC,GAAG,CAAC,KAAG,OAAO,CAAC,GAAG,CAQ5E,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.composeMiddleware = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
4
|
const composeMiddleware = (...middlewares) => {
|
|
6
5
|
return async (req, ctx, handler) => {
|
|
7
6
|
const composedHandler = middlewares.reduceRight((nextHandler, middleware) => () => middleware(req, ctx, nextHandler), handler);
|
|
@@ -9,4 +8,3 @@ const composeMiddleware = (...middlewares) => {
|
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
10
|
exports.composeMiddleware = composeMiddleware;
|
|
12
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runner.d.ts","sourceRoot":"","sources":["../../../src/node/node-runner.ts"],"names":[],"mappings":""}
|