@omer-x/next-form-actions 1.0.0-alpha.4 → 1.0.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/dist/index.d.mts CHANGED
@@ -1,6 +1,4 @@
1
1
  import { ZodObject, ZodType } from "zod";
2
-
3
- //#region src/core/defineFormAction.d.ts
4
2
  /**
5
3
  * Describes the definition of a type-safe server action for forms.
6
4
  */
@@ -29,9 +27,6 @@ type FormAction<Args extends unknown[]> = (...allParams: [...Args, initialState:
29
27
  * @param definition.action - The function to execute if validation succeeds.
30
28
  * @returns An object containing the server action handler keyed by the action name.
31
29
  */
32
- declare function defineFormAction<Shape extends Record<string, ZodType>, SchemaI, SchemaO, Args extends unknown[]>(definition: ActionDefinition<Shape, SchemaI, SchemaO, Args>): FormAction<Args>;
33
- //#endregion
34
- //#region src/core/displayMessage.d.ts
35
- declare function displayMessage(messageType: "error" | "warning" | "success" | (string & {}), message: string): never;
36
- //#endregion
37
- export { defineFormAction, displayMessage };
30
+ export declare function defineFormAction<Shape extends Record<string, ZodType>, SchemaI, SchemaO, Args extends unknown[]>(definition: ActionDefinition<Shape, SchemaI, SchemaO, Args>): FormAction<Args>;
31
+ export declare function displayMessage(messageType: "error" | "warning" | "success" | (string & {}), message: string): never;
32
+ export {};
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/core/bundleErrors.ts
1
+ // src/core/bundleErrors.ts
2
2
  /**
3
3
  * Maps a Zod issue to a string error code or message.
4
4
  * @param issue - The Zod issue object.
@@ -34,8 +34,7 @@ function bundleErrors(issues) {
34
34
  };
35
35
  }, {});
36
36
  }
37
- //#endregion
38
- //#region src/core/solveKnownIssues.ts
37
+ // src/core/solveKnownIssues.ts
39
38
  function solveKnownIssues(schema, input) {
40
39
  const validation = schema.safeParse(input);
41
40
  if (!validation.success) {
@@ -59,8 +58,7 @@ function solveKnownIssues(schema, input) {
59
58
  }
60
59
  return validation;
61
60
  }
62
- //#endregion
63
- //#region src/core/defineFormAction.ts
61
+ // src/core/defineFormAction.ts
64
62
  /**
65
63
  * Defines a type-safe React server action for forms, validating form data with Zod and handling errors internally.
66
64
  *
@@ -87,8 +85,7 @@ function defineFormAction(definition) {
87
85
  }
88
86
  return handler;
89
87
  }
90
- //#endregion
91
- //#region src/core/displayMessage.ts
88
+ // src/core/displayMessage.ts
92
89
  function displayMessage(messageType, message) {
93
90
  if (messageType === "error" || messageType === "warning" || messageType === "success") throw {
94
91
  isDisplayMessage: true,
@@ -101,5 +98,4 @@ function displayMessage(messageType, message) {
101
98
  message
102
99
  };
103
100
  }
104
- //#endregion
105
101
  export { defineFormAction, displayMessage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/next-form-actions",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0",
4
4
  "description": "Provides helper functions to define a type-safe React server action for forms, validating form data with Zod and handling errors internally.",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -51,13 +51,13 @@
51
51
  "zod": "^4"
52
52
  },
53
53
  "devDependencies": {
54
- "@omer-x/eslint-config": "^2.3.2",
55
- "@types/node": "^26.1.0",
56
- "@vitest/coverage-v8": "^4.1.9",
54
+ "@omer-x/eslint-config": "^2.3.3",
55
+ "@types/node": "^26.6.11",
56
+ "@vitest/coverage-v8": "^5.1.2",
57
57
  "eslint": "^9.39.2",
58
- "semantic-release": "^25.0.5",
59
- "tsdown": "^0.22.3",
58
+ "semantic-release": "^26.0.1",
59
+ "tsdown": "^0.23.7",
60
60
  "typescript": "^6.0.3",
61
- "vitest": "^4.1.9"
61
+ "vitest": "^5.1.2"
62
62
  }
63
63
  }