server-act 1.2.0 → 1.2.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/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -18,17 +18,17 @@ interface ActionBuilder<TParams extends ActionParams> {
|
|
|
18
18
|
/**
|
|
19
19
|
* Middleware allows you to run code before the action, its return value will pass as context to the action.
|
|
20
20
|
*/
|
|
21
|
-
middleware: <TContext>(middleware: () => Promise<TContext> | TContext) => ActionBuilder<{
|
|
21
|
+
middleware: <TContext>(middleware: () => Promise<TContext> | TContext) => Omit<ActionBuilder<{
|
|
22
22
|
_input: TParams["_input"];
|
|
23
23
|
_context: TContext;
|
|
24
|
-
}>;
|
|
24
|
+
}>, "middleware">;
|
|
25
25
|
/**
|
|
26
26
|
* Input validation for the action.
|
|
27
27
|
*/
|
|
28
|
-
input: <TParser extends z.ZodType>(input: TParser) => ActionBuilder<{
|
|
28
|
+
input: <TParser extends z.ZodType>(input: TParser) => Omit<ActionBuilder<{
|
|
29
29
|
_input: TParser;
|
|
30
30
|
_context: TParams["_context"];
|
|
31
|
-
}>;
|
|
31
|
+
}>, "input">;
|
|
32
32
|
/**
|
|
33
33
|
* Create an action.
|
|
34
34
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -18,17 +18,17 @@ interface ActionBuilder<TParams extends ActionParams> {
|
|
|
18
18
|
/**
|
|
19
19
|
* Middleware allows you to run code before the action, its return value will pass as context to the action.
|
|
20
20
|
*/
|
|
21
|
-
middleware: <TContext>(middleware: () => Promise<TContext> | TContext) => ActionBuilder<{
|
|
21
|
+
middleware: <TContext>(middleware: () => Promise<TContext> | TContext) => Omit<ActionBuilder<{
|
|
22
22
|
_input: TParams["_input"];
|
|
23
23
|
_context: TContext;
|
|
24
|
-
}>;
|
|
24
|
+
}>, "middleware">;
|
|
25
25
|
/**
|
|
26
26
|
* Input validation for the action.
|
|
27
27
|
*/
|
|
28
|
-
input: <TParser extends z.ZodType>(input: TParser) => ActionBuilder<{
|
|
28
|
+
input: <TParser extends z.ZodType>(input: TParser) => Omit<ActionBuilder<{
|
|
29
29
|
_input: TParser;
|
|
30
30
|
_context: TParams["_context"];
|
|
31
|
-
}>;
|
|
31
|
+
}>, "input">;
|
|
32
32
|
/**
|
|
33
33
|
* Create an action.
|
|
34
34
|
*/
|
package/dist/index.js
CHANGED
|
@@ -63,7 +63,7 @@ function createServerActionBuilder(initDef = {}) {
|
|
|
63
63
|
return /*#__PURE__*/ _async_to_generator(function*(input) {
|
|
64
64
|
const ctx = yield _def.middleware == null ? void 0 : _def.middleware.call(_def);
|
|
65
65
|
if (_def.input) {
|
|
66
|
-
const result = _def.input.
|
|
66
|
+
const result = yield _def.input.safeParseAsync(input);
|
|
67
67
|
if (!result.success) {
|
|
68
68
|
console.error("❌ Input validation error:", result.error.errors);
|
|
69
69
|
throw new Error("Input validation error");
|
package/dist/index.mjs
CHANGED
|
@@ -61,7 +61,7 @@ function createServerActionBuilder(initDef = {}) {
|
|
|
61
61
|
return /*#__PURE__*/ _async_to_generator(function*(input) {
|
|
62
62
|
const ctx = yield _def.middleware == null ? void 0 : _def.middleware.call(_def);
|
|
63
63
|
if (_def.input) {
|
|
64
|
-
const result = _def.input.
|
|
64
|
+
const result = yield _def.input.safeParseAsync(input);
|
|
65
65
|
if (!result.success) {
|
|
66
66
|
console.error("❌ Input validation error:", result.error.errors);
|
|
67
67
|
throw new Error("Input validation error");
|