Socket
Socket
Sign inDemoInstall

server-act

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

server-act - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

6

CHANGELOG.md
# server-act
## 1.1.3
### Patch Changes
- [#14](https://github.com/chungweileong94/server-act/pull/14) [`8bb348e`](https://github.com/chungweileong94/server-act/commit/8bb348ee0ed7a60a2498a37cab86c7271c205752) Thanks [@chungweileong94](https://github.com/chungweileong94)! - Remove `zod-validation-error` dependency
## 1.1.2

@@ -4,0 +10,0 @@

105

dist/index.js
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;

@@ -20,10 +18,2 @@ var __export = (target, all) => {

};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

@@ -37,94 +27,2 @@

module.exports = __toCommonJS(src_exports);
// ../../node_modules/.pnpm/zod-validation-error@1.5.0_zod@3.22.2/node_modules/zod-validation-error/dist/esm/ValidationError.js
var zod = __toESM(require("zod"));
// ../../node_modules/.pnpm/zod-validation-error@1.5.0_zod@3.22.2/node_modules/zod-validation-error/dist/esm/utils/joinPath.js
var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
function joinPath(path) {
if (path.length === 1) {
return path[0].toString();
}
return path.reduce((acc, item) => {
if (typeof item === "number") {
return acc + "[" + item.toString() + "]";
}
if (item.includes('"')) {
return acc + '["' + escapeQuotes(item) + '"]';
}
if (!identifierRegex.test(item)) {
return acc + '["' + item + '"]';
}
const separator = acc.length === 0 ? "" : ".";
return acc + separator + item;
}, "");
}
function escapeQuotes(str) {
return str.replace(/"/g, '\\"');
}
// ../../node_modules/.pnpm/zod-validation-error@1.5.0_zod@3.22.2/node_modules/zod-validation-error/dist/esm/utils/NonEmptyArray.js
function isNonEmptyArray(value) {
return value.length !== 0;
}
// ../../node_modules/.pnpm/zod-validation-error@1.5.0_zod@3.22.2/node_modules/zod-validation-error/dist/esm/ValidationError.js
var MAX_ISSUES_IN_MESSAGE = 99;
var ISSUE_SEPARATOR = "; ";
var UNION_SEPARATOR = ", or ";
var PREFIX = "Validation error";
var PREFIX_SEPARATOR = ": ";
var ValidationError = class extends Error {
details;
name;
constructor(message, details = []) {
super(message);
this.details = details;
this.name = "ZodValidationError";
}
toString() {
return this.message;
}
};
function getMessageFromZodIssue(issue, issueSeparator, unionSeparator) {
if (issue.code === "invalid_union") {
return issue.unionErrors.reduce((acc, zodError) => {
const newIssues = zodError.issues.map((issue2) => getMessageFromZodIssue(issue2, issueSeparator, unionSeparator)).join(issueSeparator);
if (!acc.includes(newIssues)) {
acc.push(newIssues);
}
return acc;
}, []).join(unionSeparator);
}
if (isNonEmptyArray(issue.path)) {
if (issue.path.length === 1) {
const identifier = issue.path[0];
if (typeof identifier === "number") {
return `${issue.message} at index ${identifier}`;
}
}
return `${issue.message} at "${joinPath(issue.path)}"`;
}
return issue.message;
}
function conditionallyPrefixMessage(reason, prefix, prefixSeparator) {
if (prefix !== null) {
if (reason.length > 0) {
return [prefix, reason].join(prefixSeparator);
}
return prefix;
}
if (reason.length > 0) {
return reason;
}
return PREFIX;
}
function fromZodError(zodError, options = {}) {
const { maxIssuesInMessage = MAX_ISSUES_IN_MESSAGE, issueSeparator = ISSUE_SEPARATOR, unionSeparator = UNION_SEPARATOR, prefixSeparator = PREFIX_SEPARATOR, prefix = PREFIX } = options;
const reason = zodError.errors.slice(0, maxIssuesInMessage).map((issue) => getMessageFromZodIssue(issue, issueSeparator, unionSeparator)).join(issueSeparator);
const message = conditionallyPrefixMessage(reason, prefix, prefixSeparator);
return new ValidationError(message, zodError.errors);
}
// src/index.ts
var unsetMarker = Symbol("unsetMarker");

@@ -150,3 +48,4 @@ var createNewServerActionBuilder = (def) => {

if (!result.success) {
throw fromZodError(result.error);
console.error("\u274C Input validation error:", result.error.errors);
throw new Error("Input validation error");
}

@@ -153,0 +52,0 @@ }

{
"name": "server-act",
"version": "1.1.2",
"version": "1.1.3",
"homepage": "https://github.com/chungweileong94/server-act#readme",

@@ -43,4 +43,3 @@ "repository": {

"zod": "^3.22.2",
"zod-form-data": "^2.0.2",
"zod-validation-error": "^1.5.0"
"zod-form-data": "^2.0.2"
},

@@ -51,2 +50,7 @@ "peerDependencies": {

},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"scripts": {

@@ -53,0 +57,0 @@ "build": "tsup",

/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-explicit-any */
import {type z} from 'zod';
import {fromZodError} from 'zod-validation-error';

@@ -105,3 +104,4 @@ type Prettify<T> = {

if (!result.success) {
throw fromZodError(result.error);
console.error('❌ Input validation error:', result.error.errors);
throw new Error('Input validation error');
}

@@ -108,0 +108,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc