@kellanjs/actioncraft 0.0.2 → 0.2.0
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 +1263 -1
- package/dist/actioncraft-error.d.ts +23 -0
- package/dist/actioncraft-error.js +60 -0
- package/dist/actioncraft-error.js.map +1 -0
- package/dist/actioncraft-prev.d.ts +93 -0
- package/dist/actioncraft-prev.js +387 -0
- package/dist/actioncraft-prev.js.map +1 -0
- package/dist/actioncraft.d.ts +94 -40
- package/dist/actioncraft.js +337 -68
- package/dist/actioncraft.js.map +1 -1
- package/dist/api.d.ts +49 -0
- package/dist/api.js +84 -0
- package/dist/api.js.map +1 -0
- package/dist/classes/action-builder.d.ts +59 -0
- package/dist/classes/action-builder.js +95 -0
- package/dist/classes/action-builder.js.map +1 -0
- package/dist/classes/craft-builder.d.ts +66 -0
- package/dist/classes/craft-builder.js +129 -0
- package/dist/classes/craft-builder.js.map +1 -0
- package/dist/classes/crafter.d.ts +66 -0
- package/dist/classes/crafter.js +129 -0
- package/dist/classes/crafter.js.map +1 -0
- package/dist/classes/error.d.ts +23 -0
- package/dist/classes/error.js +60 -0
- package/dist/classes/error.js.map +1 -0
- package/dist/classes/executor/callbacks.d.ts +6 -0
- package/dist/classes/executor/callbacks.js +20 -0
- package/dist/classes/executor/callbacks.js.map +1 -0
- package/dist/classes/executor/errors.d.ts +29 -0
- package/dist/classes/executor/errors.js +114 -0
- package/dist/classes/executor/errors.js.map +1 -0
- package/dist/classes/executor/executor.d.ts +68 -0
- package/dist/classes/executor/executor.js +391 -0
- package/dist/classes/executor/executor.js.map +1 -0
- package/dist/classes/executor/logging.d.ts +2 -0
- package/dist/classes/executor/logging.js +8 -0
- package/dist/classes/executor/logging.js.map +1 -0
- package/dist/classes/executor/transformation.d.ts +17 -0
- package/dist/classes/executor/transformation.js +43 -0
- package/dist/classes/executor/transformation.js.map +1 -0
- package/dist/classes/executor/validation.d.ts +16 -0
- package/dist/classes/executor/validation.js +70 -0
- package/dist/classes/executor/validation.js.map +1 -0
- package/dist/classes/executor.d.ts +64 -0
- package/dist/classes/executor.js +354 -0
- package/dist/classes/executor.js.map +1 -0
- package/dist/classes/internal.d.ts +10 -0
- package/dist/classes/internal.js +5 -0
- package/dist/classes/internal.js.map +1 -0
- package/dist/core/errors.d.ts +2 -2
- package/dist/core/errors.js +5 -5
- package/dist/core/errors.js.map +1 -1
- package/dist/core/logging.d.ts +1 -1
- package/dist/core/transformation.d.ts +2 -2
- package/dist/core/validation.d.ts +4 -4
- package/dist/core/validation.js +14 -14
- package/dist/core/validation.js.map +1 -1
- package/dist/craft.d.ts +29 -0
- package/dist/craft.js +62 -0
- package/dist/craft.js.map +1 -0
- package/dist/error.d.ts +21 -6
- package/dist/error.js +59 -10
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/initial.d.ts +14 -0
- package/dist/initial.js +47 -0
- package/dist/initial.js.map +1 -0
- package/dist/types/actions.d.ts +67 -25
- package/dist/types/builder.d.ts +92 -0
- package/dist/types/builder.js +2 -0
- package/dist/types/builder.js.map +1 -0
- package/dist/types/config.d.ts +4 -0
- package/dist/types/crafter.d.ts +87 -0
- package/dist/types/crafter.js +2 -0
- package/dist/types/crafter.js.map +1 -0
- package/dist/types/errors.d.ts +26 -18
- package/dist/types/inference.d.ts +41 -8
- package/dist/types/result.d.ts +8 -14
- package/dist/types/result.js +36 -4
- package/dist/types/result.js.map +1 -1
- package/dist/types/schemas.d.ts +7 -7
- package/dist/types/shared.d.ts +17 -7
- package/dist/utils.d.ts +30 -6
- package/dist/utils.js +68 -8
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import {} from "../../types/errors.js";
|
|
2
|
+
import { err, isOk, isResultOk, isResultErr, isErr, } from "../../types/result.js";
|
|
3
|
+
import { INTERNAL } from "../internal.js";
|
|
4
|
+
import { safeExecuteCallback } from "./callbacks.js";
|
|
5
|
+
import { createUnhandledErrorResult, createImplicitReturnErrorResult, NO_INPUT_SCHEMA_ERROR, } from "./errors.js";
|
|
6
|
+
import { log } from "./logging.js";
|
|
7
|
+
import { serializeRawInput, convertToClientError } from "./transformation.js";
|
|
8
|
+
import { validateInput, validateBindArgs, validateOutput, } from "./validation.js";
|
|
9
|
+
import { unstable_rethrow } from "next/navigation.js";
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// EXECUTOR CLASS - Build and execute your action
|
|
12
|
+
// ============================================================================
|
|
13
|
+
export class Executor {
|
|
14
|
+
_config;
|
|
15
|
+
_schemas;
|
|
16
|
+
_errors;
|
|
17
|
+
_callbacks;
|
|
18
|
+
_handler;
|
|
19
|
+
_actionId;
|
|
20
|
+
constructor(builder) {
|
|
21
|
+
this._config = builder[INTERNAL]().config;
|
|
22
|
+
this._schemas = builder[INTERNAL]().schemas;
|
|
23
|
+
this._errors = builder[INTERNAL]().errors;
|
|
24
|
+
this._callbacks = builder[INTERNAL]().callbacks;
|
|
25
|
+
this._handler = builder[INTERNAL]().handler;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Builds and returns the final executable server action.
|
|
29
|
+
*/
|
|
30
|
+
craft() {
|
|
31
|
+
if (!this._handler) {
|
|
32
|
+
throw new Error("A handler implementation is required");
|
|
33
|
+
}
|
|
34
|
+
// Generate a unique ID for this action instance
|
|
35
|
+
this._actionId = this._generateActionId();
|
|
36
|
+
const craftedAction = (...args) => {
|
|
37
|
+
return this._runAction(args);
|
|
38
|
+
};
|
|
39
|
+
// Attach $validate method to the action for simple client-side validation
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
craftedAction.$validate = async (input) => {
|
|
42
|
+
return this._validateInputOnly(input);
|
|
43
|
+
};
|
|
44
|
+
// Attach the action's config and ID for runtime inspection
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
craftedAction.__ac_config = this._config;
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
craftedAction.__ac_id = this._actionId;
|
|
49
|
+
return craftedAction;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generates a unique identifier for this action instance.
|
|
53
|
+
*/
|
|
54
|
+
_generateActionId() {
|
|
55
|
+
return crypto.randomUUID();
|
|
56
|
+
}
|
|
57
|
+
// --------------------------------------------------------------------------
|
|
58
|
+
// ACTION EXECUTION
|
|
59
|
+
// --------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* Orchestrates action execution (validation, business logic, callbacks, and result formatting.)
|
|
62
|
+
*/
|
|
63
|
+
async _runAction(args) {
|
|
64
|
+
// We know these exist because craft() creates/verifies them
|
|
65
|
+
const handler = this._handler;
|
|
66
|
+
const actionId = this._actionId;
|
|
67
|
+
const actionName = this._config.actionName;
|
|
68
|
+
// Extract bindArgs, prevState, and input from the raw args
|
|
69
|
+
const { bindArgs: rawBindArgs, prevState, input: rawInput, } = this._extractActionArgs(args);
|
|
70
|
+
// Check for custom error handler
|
|
71
|
+
const handleThrownErrorFn = this._config.handleThrownError
|
|
72
|
+
? (error) => err(this._config.handleThrownError(error), actionId)
|
|
73
|
+
: null;
|
|
74
|
+
// Track validation state for error handling
|
|
75
|
+
let validatedInput = undefined;
|
|
76
|
+
let validatedBindArgs = undefined;
|
|
77
|
+
try {
|
|
78
|
+
// Execute onStart callback before any processing
|
|
79
|
+
await this._executeOnStartCallback({
|
|
80
|
+
actionId,
|
|
81
|
+
actionName,
|
|
82
|
+
rawInput,
|
|
83
|
+
rawBindArgs,
|
|
84
|
+
prevState,
|
|
85
|
+
validatedInput: undefined,
|
|
86
|
+
validatedBindArgs: undefined,
|
|
87
|
+
});
|
|
88
|
+
// Validate input and return on failure
|
|
89
|
+
const inputValidation = await this._validateInput(rawInput);
|
|
90
|
+
if (!isOk(inputValidation)) {
|
|
91
|
+
await this._executeResultCallbacks(inputValidation, {
|
|
92
|
+
actionId,
|
|
93
|
+
actionName,
|
|
94
|
+
rawInput,
|
|
95
|
+
rawBindArgs,
|
|
96
|
+
prevState,
|
|
97
|
+
validatedInput,
|
|
98
|
+
validatedBindArgs,
|
|
99
|
+
});
|
|
100
|
+
return this._toActionResult(inputValidation, rawInput);
|
|
101
|
+
}
|
|
102
|
+
// Update validation state
|
|
103
|
+
validatedInput = inputValidation.value;
|
|
104
|
+
// Validate bound arguments and return on failure
|
|
105
|
+
const bindArgsValidation = await this._validateBindArgs(rawBindArgs);
|
|
106
|
+
if (!isOk(bindArgsValidation)) {
|
|
107
|
+
await this._executeResultCallbacks(bindArgsValidation, {
|
|
108
|
+
actionId,
|
|
109
|
+
actionName,
|
|
110
|
+
rawInput,
|
|
111
|
+
rawBindArgs,
|
|
112
|
+
prevState,
|
|
113
|
+
validatedInput,
|
|
114
|
+
validatedBindArgs,
|
|
115
|
+
});
|
|
116
|
+
return this._toActionResult(bindArgsValidation, rawInput);
|
|
117
|
+
}
|
|
118
|
+
// Update validation state
|
|
119
|
+
validatedBindArgs = bindArgsValidation.value;
|
|
120
|
+
// Execute the user's action handler
|
|
121
|
+
const handlerResult = await handler({
|
|
122
|
+
input: inputValidation.value,
|
|
123
|
+
bindArgs: bindArgsValidation.value,
|
|
124
|
+
errors: this._buildErrorFunctions(),
|
|
125
|
+
metadata: {
|
|
126
|
+
actionId,
|
|
127
|
+
actionName,
|
|
128
|
+
rawInput,
|
|
129
|
+
rawBindArgs,
|
|
130
|
+
prevState,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
// Return on `undefined` (implicit return error)
|
|
134
|
+
if (handlerResult === undefined) {
|
|
135
|
+
const implicitReturnError = createImplicitReturnErrorResult(actionId, actionName);
|
|
136
|
+
await this._executeResultCallbacks(implicitReturnError, {
|
|
137
|
+
actionId,
|
|
138
|
+
actionName,
|
|
139
|
+
rawInput,
|
|
140
|
+
rawBindArgs,
|
|
141
|
+
prevState,
|
|
142
|
+
validatedInput,
|
|
143
|
+
validatedBindArgs,
|
|
144
|
+
});
|
|
145
|
+
return this._toActionResult(implicitReturnError, rawInput);
|
|
146
|
+
}
|
|
147
|
+
let finalResult;
|
|
148
|
+
// Process different return types from the action
|
|
149
|
+
if (isResultErr(handlerResult)) {
|
|
150
|
+
// Ensure error result has correct action ID
|
|
151
|
+
finalResult = this._ensureResultActionId(handlerResult);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const outputData = isResultOk(handlerResult)
|
|
155
|
+
? handlerResult.value
|
|
156
|
+
: handlerResult;
|
|
157
|
+
finalResult = await this._validateOutput(outputData);
|
|
158
|
+
}
|
|
159
|
+
// Execute callbacks and return final result
|
|
160
|
+
await this._executeResultCallbacks(finalResult, {
|
|
161
|
+
actionId,
|
|
162
|
+
actionName,
|
|
163
|
+
rawInput,
|
|
164
|
+
rawBindArgs,
|
|
165
|
+
prevState,
|
|
166
|
+
validatedInput,
|
|
167
|
+
validatedBindArgs,
|
|
168
|
+
});
|
|
169
|
+
// Use validated input for the values field on a successful run
|
|
170
|
+
const inputForValues = isOk(finalResult)
|
|
171
|
+
? this._schemas.inputSchema
|
|
172
|
+
? inputValidation.value
|
|
173
|
+
: rawInput
|
|
174
|
+
: rawInput;
|
|
175
|
+
return this._toActionResult(finalResult, inputForValues);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
// Re-throw Next.js framework errors
|
|
179
|
+
unstable_rethrow(error);
|
|
180
|
+
// Handle unexpected thrown errors
|
|
181
|
+
try {
|
|
182
|
+
const errorResult = this._handleThrownError(error, handleThrownErrorFn);
|
|
183
|
+
await this._executeResultCallbacks(errorResult, {
|
|
184
|
+
actionId,
|
|
185
|
+
actionName,
|
|
186
|
+
rawInput,
|
|
187
|
+
rawBindArgs,
|
|
188
|
+
prevState,
|
|
189
|
+
validatedInput,
|
|
190
|
+
validatedBindArgs,
|
|
191
|
+
});
|
|
192
|
+
return this._toActionResult(errorResult, rawInput);
|
|
193
|
+
}
|
|
194
|
+
catch (handlerError) {
|
|
195
|
+
// If we catch another error here, then we're done
|
|
196
|
+
log(this._config.logger, "warn", "Error handling failure - both primary error and error handler threw", { primaryError: error, handlerError });
|
|
197
|
+
return this._toActionResult(createUnhandledErrorResult(actionId, actionName), rawInput);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Extracts bind arguments, previous state, and input from raw action arguments.
|
|
203
|
+
*/
|
|
204
|
+
_extractActionArgs(args) {
|
|
205
|
+
const numBindSchemas = this._schemas.bindSchemas?.length ?? 0;
|
|
206
|
+
if (this._config.useActionState) {
|
|
207
|
+
return {
|
|
208
|
+
bindArgs: args.slice(0, numBindSchemas),
|
|
209
|
+
prevState: args[numBindSchemas],
|
|
210
|
+
input: args[numBindSchemas + 1],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
// For regular actions (non-useActionState), the input is the first argument after bind args
|
|
214
|
+
// If there are no bind schemas, the input is the first argument (args[0])
|
|
215
|
+
return {
|
|
216
|
+
bindArgs: args.slice(0, numBindSchemas),
|
|
217
|
+
// When useActionState is disabled the prevState parameter is never
|
|
218
|
+
// present, so we cast to never (or undefined) to satisfy the type.
|
|
219
|
+
prevState: undefined,
|
|
220
|
+
input: args[numBindSchemas],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// --------------------------------------------------------------------------
|
|
224
|
+
// RESULT TRANSFORMATION
|
|
225
|
+
// --------------------------------------------------------------------------
|
|
226
|
+
/**
|
|
227
|
+
* Transforms internal Result objects to client-facing action result format.
|
|
228
|
+
*/
|
|
229
|
+
_toActionResult(result, inputForValues) {
|
|
230
|
+
// Convert internal errors to client-facing errors
|
|
231
|
+
const clientResult = isOk(result)
|
|
232
|
+
? result
|
|
233
|
+
: err(convertToClientError(result.error), this._actionId);
|
|
234
|
+
// Handle useActionState format (always returns StatefulApiResult)
|
|
235
|
+
if (this._config.useActionState) {
|
|
236
|
+
if (isOk(clientResult)) {
|
|
237
|
+
const successValues = this._schemas.inputSchema
|
|
238
|
+
? inputForValues
|
|
239
|
+
: serializeRawInput(inputForValues);
|
|
240
|
+
return {
|
|
241
|
+
success: true,
|
|
242
|
+
data: clientResult.value,
|
|
243
|
+
values: successValues,
|
|
244
|
+
__ac_id: this._actionId,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
success: false,
|
|
249
|
+
error: clientResult.error,
|
|
250
|
+
values: serializeRawInput(inputForValues),
|
|
251
|
+
__ac_id: this._actionId,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
const format = this._config.resultFormat ?? "api";
|
|
255
|
+
// Return functional format if configured
|
|
256
|
+
if (format === "functional") {
|
|
257
|
+
return clientResult;
|
|
258
|
+
}
|
|
259
|
+
// Default API format
|
|
260
|
+
if (isOk(clientResult)) {
|
|
261
|
+
return {
|
|
262
|
+
success: true,
|
|
263
|
+
data: clientResult.value,
|
|
264
|
+
__ac_id: this._actionId,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
success: false,
|
|
269
|
+
error: clientResult.error,
|
|
270
|
+
__ac_id: this._actionId,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
// --------------------------------------------------------------------------
|
|
274
|
+
// ERROR HANDLING
|
|
275
|
+
// --------------------------------------------------------------------------
|
|
276
|
+
/**
|
|
277
|
+
* Handles uncaught exceptions during action execution.
|
|
278
|
+
*/
|
|
279
|
+
_handleThrownError(error, customHandler) {
|
|
280
|
+
const caughtErrorResult = customHandler
|
|
281
|
+
? customHandler(error)
|
|
282
|
+
: createUnhandledErrorResult(this._actionId, this._config.actionName);
|
|
283
|
+
return caughtErrorResult;
|
|
284
|
+
}
|
|
285
|
+
// --------------------------------------------------------------------------
|
|
286
|
+
// VALIDATION
|
|
287
|
+
// --------------------------------------------------------------------------
|
|
288
|
+
/**
|
|
289
|
+
* Validates input using the shared helper.
|
|
290
|
+
*/
|
|
291
|
+
_validateInput(rawInput) {
|
|
292
|
+
return validateInput(this._schemas, this._config, rawInput, this._actionId, this._config.actionName);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Validates bound arguments using the configured bind schemas.
|
|
296
|
+
*/
|
|
297
|
+
_validateBindArgs(bindArgs) {
|
|
298
|
+
return validateBindArgs(this._schemas, this._config, bindArgs, this._actionId, this._config.actionName);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Validates output data using the configured output schema.
|
|
302
|
+
*/
|
|
303
|
+
_validateOutput(data) {
|
|
304
|
+
return validateOutput(this._schemas, this._config, data, this._actionId, this._config.actionName);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Validates input data only (used by the $validate method).
|
|
308
|
+
*/
|
|
309
|
+
async _validateInputOnly(input) {
|
|
310
|
+
// If no input schema, return error indicating validation cannot be performed
|
|
311
|
+
if (!this._schemas.inputSchema) {
|
|
312
|
+
return {
|
|
313
|
+
success: false,
|
|
314
|
+
error: NO_INPUT_SCHEMA_ERROR,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
const validationResult = await this._validateInput(input);
|
|
318
|
+
if (isOk(validationResult)) {
|
|
319
|
+
return {
|
|
320
|
+
success: true,
|
|
321
|
+
data: validationResult.value,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
// Convert internal error to client-facing error
|
|
326
|
+
const clientError = convertToClientError(validationResult.error);
|
|
327
|
+
return { success: false, error: clientError };
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// --------------------------------------------------------------------------
|
|
331
|
+
// CALLBACKS
|
|
332
|
+
// --------------------------------------------------------------------------
|
|
333
|
+
/**
|
|
334
|
+
* Executes the onStart callback if defined.
|
|
335
|
+
*/
|
|
336
|
+
async _executeOnStartCallback(metadata) {
|
|
337
|
+
const callbacks = this._callbacks;
|
|
338
|
+
if (callbacks.onStart) {
|
|
339
|
+
await safeExecuteCallback(() => callbacks.onStart({ metadata }), "onStart", (level, msg, details) => log(this._config.logger, level, msg, details));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Executes result-based lifecycle callbacks (onSuccess, onError, onSettled).
|
|
344
|
+
*/
|
|
345
|
+
async _executeResultCallbacks(result, metadata) {
|
|
346
|
+
const callbacks = this._callbacks;
|
|
347
|
+
// Success path
|
|
348
|
+
if (isOk(result)) {
|
|
349
|
+
await safeExecuteCallback(callbacks.onSuccess
|
|
350
|
+
? () => callbacks.onSuccess({ data: result.value, metadata })
|
|
351
|
+
: undefined, "onSuccess", (level, msg, details) => log(this._config.logger, level, msg, details));
|
|
352
|
+
}
|
|
353
|
+
// Error path
|
|
354
|
+
if (isErr(result)) {
|
|
355
|
+
await safeExecuteCallback(callbacks.onError
|
|
356
|
+
? () => callbacks.onError({ error: result.error, metadata })
|
|
357
|
+
: undefined, "onError", (level, msg, details) => log(this._config.logger, level, msg, details));
|
|
358
|
+
}
|
|
359
|
+
// onSettled always runs, regardless of result
|
|
360
|
+
const finalResult = this._toActionResult(result);
|
|
361
|
+
await safeExecuteCallback(callbacks.onSettled
|
|
362
|
+
? () => callbacks.onSettled({ result: finalResult, metadata })
|
|
363
|
+
: undefined, "onSettled", (level, msg, details) => log(this._config.logger, level, msg, details));
|
|
364
|
+
}
|
|
365
|
+
// --------------------------------------------------------------------------
|
|
366
|
+
// UTILITY METHODS
|
|
367
|
+
// --------------------------------------------------------------------------
|
|
368
|
+
/**
|
|
369
|
+
* Ensures a Result object has the correct action ID.
|
|
370
|
+
*/
|
|
371
|
+
_ensureResultActionId(result) {
|
|
372
|
+
if (!result.__ac_id || result.__ac_id === "unknown") {
|
|
373
|
+
return {
|
|
374
|
+
...result,
|
|
375
|
+
__ac_id: this._actionId,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
return result;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Creates error functions that return a Result object when called by the action handler.
|
|
382
|
+
*/
|
|
383
|
+
_buildErrorFunctions() {
|
|
384
|
+
const errorFns = {};
|
|
385
|
+
for (const [key, errorDefFn] of Object.entries(this._errors)) {
|
|
386
|
+
errorFns[key] = ((...args) => err(errorDefFn(...args), this._actionId));
|
|
387
|
+
}
|
|
388
|
+
return errorFns;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/classes/executor/executor.ts"],"names":[],"mappings":"AAeA,OAAO,EAIN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,WAAW,EACX,KAAK,GACN,MAAM,uBAAuB,CAAC;AAS/B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,+EAA+E;AAC/E,iDAAiD;AACjD,+EAA+E;AAE/E,MAAM,OAAO,QAAQ;IAOF,OAAO,CAAU;IACjB,QAAQ,CAAW;IACnB,OAAO,CAAU;IACjB,UAAU,CAAa;IACvB,QAAQ,CAA8C;IAC/D,SAAS,CAAU;IAE3B,YACE,OAAoE;QAEpE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC;QAC1C,IAAI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MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7D,QAAQ,CAAC,GAAoB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAC5C,GAAG,CACD,UAAU,CAAC,GAAG,IAAI,CAAC,EACnB,IAAI,CAAC,SAAU,CAChB,CAA2C,CAAC;QACjD,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/classes/executor/logging.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,CACjB,MAAwB,EACxB,KAAuB,EACvB,OAAe,EACf,OAAiB;IAEjB,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,IAAI,EAAE;QAAE,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InferSerializedErrorValues } from "../../types/actions.js";
|
|
2
|
+
import type { Schemas } from "../../types/builder.js";
|
|
3
|
+
import type { Config, Errors } from "../../types/builder.js";
|
|
4
|
+
import type { PossibleErrors, AllPossibleErrors } from "../../types/errors.js";
|
|
5
|
+
import type { InferRawInput, InferValidatedInput } from "../../types/schemas.js";
|
|
6
|
+
/**
|
|
7
|
+
* Converts input to a serializable format for the `values` field in action results.
|
|
8
|
+
*
|
|
9
|
+
* If the input is `FormData`, it is flattened into a plain object so that it can
|
|
10
|
+
* be safely JSON-serialized. Otherwise, the input is returned as-is.
|
|
11
|
+
*/
|
|
12
|
+
export declare function serializeRawInput<TSchemas extends Schemas>(input: InferRawInput<TSchemas> | InferValidatedInput<TSchemas> | undefined): InferSerializedErrorValues<TSchemas>;
|
|
13
|
+
/**
|
|
14
|
+
* Converts internal error objects into client-facing errors, hiding
|
|
15
|
+
* implementation details that should not leak outside the server.
|
|
16
|
+
*/
|
|
17
|
+
export declare function convertToClientError<TErrors extends Errors, TConfig extends Config, TSchemas extends Schemas>(internalError: AllPossibleErrors<TErrors, TConfig, TSchemas>): PossibleErrors<TErrors, TConfig, TSchemas>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { INTERNAL_ERROR_TYPES } from "../../types/errors.js";
|
|
2
|
+
import { UNHANDLED_ERROR } from "./errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts input to a serializable format for the `values` field in action results.
|
|
5
|
+
*
|
|
6
|
+
* If the input is `FormData`, it is flattened into a plain object so that it can
|
|
7
|
+
* be safely JSON-serialized. Otherwise, the input is returned as-is.
|
|
8
|
+
*/
|
|
9
|
+
export function serializeRawInput(input) {
|
|
10
|
+
if (input instanceof FormData) {
|
|
11
|
+
const valueMap = new Map();
|
|
12
|
+
for (const [key, value] of input.entries()) {
|
|
13
|
+
// Ignore React server-action meta-fields
|
|
14
|
+
if (key.startsWith("$ACTION"))
|
|
15
|
+
continue;
|
|
16
|
+
const stringValue = typeof value === "string" ? value : value.name || "[File]";
|
|
17
|
+
if (!valueMap.has(key))
|
|
18
|
+
valueMap.set(key, []);
|
|
19
|
+
valueMap.get(key).push(stringValue);
|
|
20
|
+
}
|
|
21
|
+
// Collapse single-item arrays
|
|
22
|
+
const serialized = {};
|
|
23
|
+
for (const [key, values] of valueMap.entries()) {
|
|
24
|
+
serialized[key] = values.length === 1 ? values[0] : values;
|
|
25
|
+
}
|
|
26
|
+
return serialized;
|
|
27
|
+
}
|
|
28
|
+
// Non-FormData inputs are assumed to already be serialisable
|
|
29
|
+
return input;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Converts internal error objects into client-facing errors, hiding
|
|
33
|
+
* implementation details that should not leak outside the server.
|
|
34
|
+
*/
|
|
35
|
+
export function convertToClientError(internalError) {
|
|
36
|
+
if (internalError.type === INTERNAL_ERROR_TYPES.IMPLICIT_RETURN ||
|
|
37
|
+
internalError.type === INTERNAL_ERROR_TYPES.OUTPUT_VALIDATION ||
|
|
38
|
+
internalError.type === INTERNAL_ERROR_TYPES.INTERNAL_LOGIC) {
|
|
39
|
+
return UNHANDLED_ERROR;
|
|
40
|
+
}
|
|
41
|
+
return internalError;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=transformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformation.js","sourceRoot":"","sources":["../../../src/classes/executor/transformation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAK7D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA0E;IAE1E,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;QAE7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC3C,yCAAyC;YACzC,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;gBAAE,SAAS;YAExC,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC;YAE7D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC9C,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;QAED,8BAA8B;QAC9B,MAAM,UAAU,GAAsC,EAAE,CAAC;QACzD,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;YAC/C,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9D,CAAC;QAED,OAAO,UAAkD,CAAC;IAC5D,CAAC;IAED,6DAA6D;IAC7D,OAAO,KAA6C,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAKlC,aAA4D;IAE5D,IACE,aAAa,CAAC,IAAI,KAAK,oBAAoB,CAAC,eAAe;QAC3D,aAAa,CAAC,IAAI,KAAK,oBAAoB,CAAC,iBAAiB;QAC7D,aAAa,CAAC,IAAI,KAAK,oBAAoB,CAAC,cAAc,EAC1D,CAAC;QACD,OAAO,eAA6D,CAAC;IACvE,CAAC;IACD,OAAO,aAA2D,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config, Schemas, Errors } from "../../types/builder.js";
|
|
2
|
+
import type { AllPossibleErrors } from "../../types/errors.js";
|
|
3
|
+
import type { Result } from "../../types/result.js";
|
|
4
|
+
import type { InferValidatedInput, InferRawInput, InferValidatedBindArgs, InferRawBindArgs } from "../../types/schemas.js";
|
|
5
|
+
/**
|
|
6
|
+
* Validate input using the configured input schema.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateInput<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors>(schemas: TSchemas, config: TConfig, rawInput: InferRawInput<TSchemas> | undefined, actionId: string, actionName?: string): Promise<Result<InferValidatedInput<TSchemas>, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;
|
|
9
|
+
/**
|
|
10
|
+
* Validate bound arguments using configured bind schemas.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateBindArgs<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors>(schemas: TSchemas, config: TConfig, bindArgs: InferRawBindArgs<TSchemas>, actionId: string, actionName?: string): Promise<Result<InferValidatedBindArgs<TSchemas>, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;
|
|
13
|
+
/**
|
|
14
|
+
* Validate action output using configured output schema.
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateOutput<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors, TData>(schemas: TSchemas, config: TConfig, data: TData, actionId: string, actionName?: string): Promise<Result<TData, AllPossibleErrors<TErrors, TConfig, TSchemas>>>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { standardParse } from "../../standard-schema.js";
|
|
2
|
+
import { INTERNAL_ERROR_TYPES, EXTERNAL_ERROR_TYPES, } from "../../types/errors.js";
|
|
3
|
+
import { ok, err } from "../../types/result.js";
|
|
4
|
+
import { createValidationError, createInternalLogicError, formatValidationIssues, } from "./errors.js";
|
|
5
|
+
/**
|
|
6
|
+
* Validate input using the configured input schema.
|
|
7
|
+
*/
|
|
8
|
+
export async function validateInput(schemas, config, rawInput, actionId, actionName) {
|
|
9
|
+
if (!schemas.inputSchema) {
|
|
10
|
+
return ok(undefined, actionId);
|
|
11
|
+
}
|
|
12
|
+
const result = await standardParse(schemas.inputSchema, rawInput);
|
|
13
|
+
if (Array.isArray(result.issues) && result.issues.length > 0) {
|
|
14
|
+
const format = config.validationErrorFormat ?? "flattened";
|
|
15
|
+
const baseError = formatValidationIssues(result.issues, format);
|
|
16
|
+
const inputValidationError = createValidationError(EXTERNAL_ERROR_TYPES.INPUT_VALIDATION, "Input validation failed", baseError, actionName);
|
|
17
|
+
return err(inputValidationError, actionId);
|
|
18
|
+
}
|
|
19
|
+
if (!result.issues && "value" in result) {
|
|
20
|
+
return ok(result.value, actionId);
|
|
21
|
+
}
|
|
22
|
+
// Should never happen
|
|
23
|
+
const logicErr = createInternalLogicError("Unexpected validation state in input validation: neither success nor failure");
|
|
24
|
+
return err(logicErr, actionId);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validate bound arguments using configured bind schemas.
|
|
28
|
+
*/
|
|
29
|
+
export async function validateBindArgs(schemas, config, bindArgs, actionId, actionName) {
|
|
30
|
+
if (!schemas.bindSchemas) {
|
|
31
|
+
return ok([], actionId);
|
|
32
|
+
}
|
|
33
|
+
const validated = [];
|
|
34
|
+
for (let i = 0; i < schemas.bindSchemas.length; i++) {
|
|
35
|
+
const schema = schemas.bindSchemas[i];
|
|
36
|
+
const arg = bindArgs[i];
|
|
37
|
+
const result = await standardParse(schema, arg);
|
|
38
|
+
if (Array.isArray(result.issues) && result.issues.length > 0) {
|
|
39
|
+
const format = config.validationErrorFormat ?? "flattened";
|
|
40
|
+
const baseError = formatValidationIssues(result.issues, format);
|
|
41
|
+
const bindError = createValidationError(EXTERNAL_ERROR_TYPES.BIND_ARGS_VALIDATION, "Bind arguments validation failed", baseError, actionName);
|
|
42
|
+
return err(bindError, actionId);
|
|
43
|
+
}
|
|
44
|
+
if ("value" in result) {
|
|
45
|
+
validated.push(result.value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return ok(validated, actionId);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validate action output using configured output schema.
|
|
52
|
+
*/
|
|
53
|
+
export async function validateOutput(schemas, config, data, actionId, actionName) {
|
|
54
|
+
if (!schemas.outputSchema) {
|
|
55
|
+
return ok(data, actionId);
|
|
56
|
+
}
|
|
57
|
+
const result = await standardParse(schemas.outputSchema, data);
|
|
58
|
+
if (Array.isArray(result.issues) && result.issues.length > 0) {
|
|
59
|
+
const format = config.validationErrorFormat ?? "flattened";
|
|
60
|
+
const baseError = formatValidationIssues(result.issues, format);
|
|
61
|
+
const outputError = createValidationError(INTERNAL_ERROR_TYPES.OUTPUT_VALIDATION, "Output validation failed", baseError, actionName);
|
|
62
|
+
return err(outputError, actionId);
|
|
63
|
+
}
|
|
64
|
+
if (!result.issues && "value" in result) {
|
|
65
|
+
return ok(result.value, actionId);
|
|
66
|
+
}
|
|
67
|
+
const logicErr = createInternalLogicError("Unexpected validation state in output validation: neither success nor failure");
|
|
68
|
+
return err(logicErr, actionId);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/classes/executor/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAOhD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAKjC,OAAiB,EACjB,MAAe,EACf,QAA6C,EAC7C,QAAgB,EAChB,UAAmB;IAOnB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC,SAA0C,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAElE,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,qBAAqB,IAAI,WAAW,CAAC;QAC3D,MAAM,SAAS,GAAG,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEhE,MAAM,oBAAoB,GAAG,qBAAqB,CAGhD,oBAAoB,CAAC,gBAAgB,EACrC,yBAAyB,EACzB,SAAS,EACT,UAAU,CACX,CAAC;QAEF,OAAO,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAGxC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,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C;IACF,OAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAG5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CraftedAction } from "../types/actions.js";
|
|
2
|
+
import type { CrafterConfig, CrafterSchemas, CrafterErrors, CrafterCallbacks } from "../types/crafter.js";
|
|
3
|
+
import type { Crafter } from "./crafter.js";
|
|
4
|
+
export declare class Executor<TConfig extends CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors, TCallbacks extends CrafterCallbacks<TConfig, TSchemas, TErrors, TData>, TData> {
|
|
5
|
+
private readonly _config;
|
|
6
|
+
private readonly _schemas;
|
|
7
|
+
private readonly _errors;
|
|
8
|
+
private readonly _callbacks;
|
|
9
|
+
private readonly _handler?;
|
|
10
|
+
private _actionId?;
|
|
11
|
+
constructor(crafter: Crafter<TConfig, TSchemas, TErrors, TCallbacks, TData>);
|
|
12
|
+
/**
|
|
13
|
+
* Builds and returns the final executable server action.
|
|
14
|
+
*/
|
|
15
|
+
craft(): CraftedAction<TConfig, TSchemas, TErrors, TData>;
|
|
16
|
+
/**
|
|
17
|
+
* Generates a unique identifier for this action instance.
|
|
18
|
+
*/
|
|
19
|
+
private _generateActionId;
|
|
20
|
+
/**
|
|
21
|
+
* Orchestrates action execution (validation, business logic, callbacks, and result formatting.)
|
|
22
|
+
*/
|
|
23
|
+
private _runAction;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts bind arguments, previous state, and input from raw action arguments.
|
|
26
|
+
*/
|
|
27
|
+
private _extractActionArgs;
|
|
28
|
+
/**
|
|
29
|
+
* Transforms internal Result objects to client-facing action result format.
|
|
30
|
+
*/
|
|
31
|
+
private _toActionResult;
|
|
32
|
+
/**
|
|
33
|
+
* Handles uncaught exceptions during action execution.
|
|
34
|
+
*/
|
|
35
|
+
private _handleThrownError;
|
|
36
|
+
/**
|
|
37
|
+
* Validates input using the shared helper.
|
|
38
|
+
*/
|
|
39
|
+
private _validateInput;
|
|
40
|
+
/**
|
|
41
|
+
* Validates bound arguments using the configured bind schemas.
|
|
42
|
+
*/
|
|
43
|
+
private _validateBindArgs;
|
|
44
|
+
/**
|
|
45
|
+
* Validates output data using the configured output schema.
|
|
46
|
+
*/
|
|
47
|
+
private _validateOutput;
|
|
48
|
+
/**
|
|
49
|
+
* Executes the onStart callback if defined.
|
|
50
|
+
*/
|
|
51
|
+
private _executeOnStartCallback;
|
|
52
|
+
/**
|
|
53
|
+
* Executes result-based lifecycle callbacks (onSuccess, onError, onSettled).
|
|
54
|
+
*/
|
|
55
|
+
private _executeResultCallbacks;
|
|
56
|
+
/**
|
|
57
|
+
* Ensures a Result object has the correct action ID.
|
|
58
|
+
*/
|
|
59
|
+
private _ensureResultActionId;
|
|
60
|
+
/**
|
|
61
|
+
* Creates error functions that return a Result object when called by the action handler.
|
|
62
|
+
*/
|
|
63
|
+
private _buildErrorFunctions;
|
|
64
|
+
}
|