semola 0.6.0 → 0.6.2
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 +19 -5
- package/dist/index-DISN0WKZ.d.mts +78 -0
- package/dist/lib/api/index.cjs +1 -537
- package/dist/lib/api/index.d.cts +1 -271
- package/dist/lib/api/index.d.mts +100 -164
- package/dist/lib/api/index.mjs +1 -535
- package/dist/lib/cache/index.cjs +1 -99
- package/dist/lib/cache/index.d.cts +1 -27
- package/dist/lib/cache/index.mjs +1 -98
- package/dist/lib/cli/index.cjs +3 -0
- package/dist/lib/cli/index.d.cts +1 -0
- package/dist/lib/cli/index.d.mts +90 -0
- package/dist/lib/cli/index.mjs +3 -0
- package/dist/lib/cron/index.cjs +1 -735
- package/dist/lib/cron/index.d.cts +1 -146
- package/dist/lib/cron/index.d.mts +99 -36
- package/dist/lib/cron/index.mjs +1 -726
- package/dist/lib/errors/index.cjs +1 -30
- package/dist/lib/errors/index.d.cts +1 -13
- package/dist/lib/errors/index.mjs +1 -26
- package/dist/lib/i18n/index.cjs +1 -42
- package/dist/lib/i18n/index.d.cts +1 -28
- package/dist/lib/i18n/index.d.mts +2 -2
- package/dist/lib/i18n/index.mjs +1 -41
- package/dist/lib/logging/index.cjs +1 -388
- package/dist/lib/logging/index.d.cts +1 -108
- package/dist/lib/logging/index.mjs +1 -374
- package/dist/lib/orm/index.cjs +1 -1642
- package/dist/lib/orm/index.d.cts +1 -402
- package/dist/lib/orm/index.d.mts +27 -25
- package/dist/lib/orm/index.mjs +1 -1630
- package/dist/lib/policy/index.cjs +1 -285
- package/dist/lib/policy/index.d.cts +1 -77
- package/dist/lib/policy/index.d.mts +1 -1
- package/dist/lib/policy/index.mjs +1 -265
- package/dist/lib/prompts/index.cjs +6 -769
- package/dist/lib/prompts/index.d.cts +1 -75
- package/dist/lib/prompts/index.mjs +6 -762
- package/dist/lib/pubsub/index.cjs +1 -141
- package/dist/lib/pubsub/index.d.cts +1 -26
- package/dist/lib/pubsub/index.mjs +1 -140
- package/dist/lib/queue/index.cjs +1 -212
- package/dist/lib/queue/index.d.cts +1 -81
- package/dist/lib/queue/index.mjs +1 -209
- package/dist/lib/workflow/index.cjs +1 -537
- package/dist/lib/workflow/index.d.cts +1 -150
- package/dist/lib/workflow/index.d.mts +0 -1
- package/dist/lib/workflow/index.mjs +1 -527
- package/dist/rolldown-runtime-CMqjfN_6.cjs +1 -0
- package/package.json +17 -5
- package/dist/chunk-CKQMccvm.cjs +0 -28
|
@@ -1,150 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type WorkflowStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
3
|
-
type StepSnapshot = {
|
|
4
|
-
name: string;
|
|
5
|
-
completedAt: number;
|
|
6
|
-
};
|
|
7
|
-
type WorkflowExecution<TInput, TResult> = {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
status: WorkflowStatus;
|
|
11
|
-
input: TInput;
|
|
12
|
-
result: TResult | null;
|
|
13
|
-
error: string | null;
|
|
14
|
-
createdAt: number;
|
|
15
|
-
updatedAt: number;
|
|
16
|
-
completedAt: number | null;
|
|
17
|
-
failedAt: number | null;
|
|
18
|
-
cancelledAt: number | null;
|
|
19
|
-
steps: StepSnapshot[];
|
|
20
|
-
};
|
|
21
|
-
type StepHandler<TInput, TStep> = (input: TInput, signal: AbortSignal) => TStep | Promise<TStep>;
|
|
22
|
-
type WorkflowHandlerContext<TInput> = {
|
|
23
|
-
input: TInput;
|
|
24
|
-
executionId: string;
|
|
25
|
-
signal: AbortSignal;
|
|
26
|
-
step: <TStep>(name: string, handler: StepHandler<TInput, TStep>) => Promise<TStep>;
|
|
27
|
-
};
|
|
28
|
-
type SerializeValue<T> = (value: T) => string;
|
|
29
|
-
type DeserializeValue<T> = (raw: string) => T;
|
|
30
|
-
type WorkflowStepErrorRecord = {
|
|
31
|
-
attempt: number;
|
|
32
|
-
error: string;
|
|
33
|
-
timestamp: number;
|
|
34
|
-
};
|
|
35
|
-
type WorkflowStepRetryContext<TInput> = {
|
|
36
|
-
executionId: string;
|
|
37
|
-
input: TInput;
|
|
38
|
-
stepName: string;
|
|
39
|
-
error: string;
|
|
40
|
-
attempt: number;
|
|
41
|
-
nextRetryDelayMs: number;
|
|
42
|
-
retriesRemaining: number;
|
|
43
|
-
};
|
|
44
|
-
type WorkflowStepErrorContext<TInput> = {
|
|
45
|
-
executionId: string;
|
|
46
|
-
input: TInput;
|
|
47
|
-
stepName: string;
|
|
48
|
-
error: string;
|
|
49
|
-
totalAttempts: number;
|
|
50
|
-
errorHistory: WorkflowStepErrorRecord[];
|
|
51
|
-
};
|
|
52
|
-
type WorkflowHooks<TInput, TResult> = {
|
|
53
|
-
onStart?: (context: {
|
|
54
|
-
executionId: string;
|
|
55
|
-
input: TInput;
|
|
56
|
-
}) => void | Promise<void>;
|
|
57
|
-
onRetry?: (context: WorkflowStepRetryContext<TInput>) => void | Promise<void>;
|
|
58
|
-
onError?: (context: WorkflowStepErrorContext<TInput>) => void | Promise<void>;
|
|
59
|
-
onComplete?: (context: {
|
|
60
|
-
executionId: string;
|
|
61
|
-
input: TInput;
|
|
62
|
-
result: TResult;
|
|
63
|
-
}) => void | Promise<void>;
|
|
64
|
-
onCancel?: (context: {
|
|
65
|
-
executionId: string;
|
|
66
|
-
input: TInput;
|
|
67
|
-
}) => void | Promise<void>;
|
|
68
|
-
};
|
|
69
|
-
type WorkflowRetryBackoff = {
|
|
70
|
-
baseDelay?: number;
|
|
71
|
-
multiplier?: number;
|
|
72
|
-
maxDelay?: number;
|
|
73
|
-
};
|
|
74
|
-
type WorkflowOptions<TInput, TResult> = {
|
|
75
|
-
name: string;
|
|
76
|
-
redis: Bun.RedisClient;
|
|
77
|
-
handler: (context: WorkflowHandlerContext<TInput>) => TResult | Promise<TResult>;
|
|
78
|
-
retries?: number;
|
|
79
|
-
retryBackoff?: WorkflowRetryBackoff;
|
|
80
|
-
hooks?: WorkflowHooks<TInput, TResult>;
|
|
81
|
-
lockTTL?: number;
|
|
82
|
-
serializeInput?: SerializeValue<TInput>;
|
|
83
|
-
deserializeInput?: DeserializeValue<TInput>;
|
|
84
|
-
serializeResult?: SerializeValue<TResult>;
|
|
85
|
-
deserializeResult?: DeserializeValue<TResult>;
|
|
86
|
-
serializeStepOutput?: SerializeValue<unknown>;
|
|
87
|
-
deserializeStepOutput?: DeserializeValue<unknown>;
|
|
88
|
-
};
|
|
89
|
-
type WorkflowStartOptions = {
|
|
90
|
-
executionId?: string;
|
|
91
|
-
};
|
|
92
|
-
type WorkflowStartResult = {
|
|
93
|
-
executionId: string;
|
|
94
|
-
status: WorkflowStatus;
|
|
95
|
-
};
|
|
96
|
-
type WorkflowCancelResult = {
|
|
97
|
-
status: WorkflowStatus;
|
|
98
|
-
executionId: string;
|
|
99
|
-
updatedAt: number;
|
|
100
|
-
cancelledAt: number;
|
|
101
|
-
createdAt: number;
|
|
102
|
-
};
|
|
103
|
-
type WorkflowMeta = {
|
|
104
|
-
status: string;
|
|
105
|
-
input: string;
|
|
106
|
-
result: string;
|
|
107
|
-
error: string;
|
|
108
|
-
createdAt: string;
|
|
109
|
-
updatedAt: string;
|
|
110
|
-
completedAt: string;
|
|
111
|
-
failedAt: string;
|
|
112
|
-
cancelledAt: string;
|
|
113
|
-
steps: string;
|
|
114
|
-
};
|
|
115
|
-
type WorkflowMetaField = keyof WorkflowMeta;
|
|
116
|
-
type Workflow<TInput, TResult> = {
|
|
117
|
-
start: (input: TInput, options?: WorkflowStartOptions) => Promise<WorkflowStartResult>;
|
|
118
|
-
run: (input: TInput, options?: WorkflowStartOptions) => Promise<TResult | null>;
|
|
119
|
-
resume: (executionId: string) => Promise<WorkflowStartResult>;
|
|
120
|
-
get: (executionId: string) => Promise<WorkflowExecution<TInput, TResult>>;
|
|
121
|
-
cancel: (executionId: string) => Promise<WorkflowCancelResult>;
|
|
122
|
-
};
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/lib/workflow/errors.d.ts
|
|
125
|
-
declare class WorkflowError extends Error {
|
|
126
|
-
constructor(message: string);
|
|
127
|
-
}
|
|
128
|
-
declare class NotFoundError extends Error {
|
|
129
|
-
constructor(message: string);
|
|
130
|
-
}
|
|
131
|
-
declare class StateError extends Error {
|
|
132
|
-
constructor(message: string);
|
|
133
|
-
}
|
|
134
|
-
declare class SerializationError extends Error {
|
|
135
|
-
constructor(message: string);
|
|
136
|
-
}
|
|
137
|
-
declare class ExecutionError extends Error {
|
|
138
|
-
constructor(message: string);
|
|
139
|
-
}
|
|
140
|
-
declare class LockError extends Error {
|
|
141
|
-
constructor(message: string);
|
|
142
|
-
}
|
|
143
|
-
declare class CancelledError extends Error {
|
|
144
|
-
constructor(message: string);
|
|
145
|
-
}
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/lib/workflow/index.d.ts
|
|
148
|
-
declare const defineWorkflow: <TInput, TResult = void>(options: WorkflowOptions<TInput, TResult>) => Workflow<TInput, TResult>;
|
|
149
|
-
//#endregion
|
|
150
|
-
export { CancelledError, ExecutionError, LockError, NotFoundError, SerializationError, StateError, type StepHandler, type Workflow, WorkflowError, type WorkflowExecution, type WorkflowHandlerContext, type WorkflowHooks, type WorkflowMeta, type WorkflowMetaField, type WorkflowOptions, type WorkflowRetryBackoff, type WorkflowStartOptions, type WorkflowStartResult, type WorkflowStatus, type WorkflowStepErrorContext, type WorkflowStepErrorRecord, type WorkflowStepRetryContext, defineWorkflow };
|
|
1
|
+
export type * from './index.d.mts'
|
|
@@ -115,7 +115,6 @@ type WorkflowMeta = {
|
|
|
115
115
|
type WorkflowMetaField = keyof WorkflowMeta;
|
|
116
116
|
type Workflow<TInput, TResult> = {
|
|
117
117
|
start: (input: TInput, options?: WorkflowStartOptions) => Promise<WorkflowStartResult>;
|
|
118
|
-
run: (input: TInput, options?: WorkflowStartOptions) => Promise<TResult | null>;
|
|
119
118
|
resume: (executionId: string) => Promise<WorkflowStartResult>;
|
|
120
119
|
get: (executionId: string) => Promise<WorkflowExecution<TInput, TResult>>;
|
|
121
120
|
cancel: (executionId: string) => Promise<WorkflowCancelResult>;
|