@nice-code/common-errors 0.0.15

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.
@@ -0,0 +1,2 @@
1
+ export * from "./niceCatchSValidation";
2
+ export * from "./niceSValidator";
@@ -0,0 +1,2 @@
1
+ import type { MiddlewareHandler } from "hono";
2
+ export declare const niceCatchSValidation: () => MiddlewareHandler;
@@ -0,0 +1,6 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import type { ValidationTargets } from "hono";
3
+ export declare function niceSValidator<Schema extends StandardSchemaV1, Target extends keyof ValidationTargets>(target: Target, schema: Schema): import("hono").Handler<import("hono").Env, string, {
4
+ in: (undefined extends StandardSchemaV1.InferInput<Schema> ? true : false) extends true ? { [K in Target]?: (StandardSchemaV1.InferInput<Schema> extends infer T ? T extends StandardSchemaV1.InferInput<Schema> ? T extends ValidationTargets[K] ? T : { [K2 in keyof T]?: ValidationTargets[K][K2] | undefined; } : never : never) | undefined; } : { [K_1 in Target]: StandardSchemaV1.InferInput<Schema> extends infer T ? T extends StandardSchemaV1.InferInput<Schema> ? T extends ValidationTargets[K_1] ? T : { [K2 in keyof T]: ValidationTargets[K_1][K2]; } : never : never; };
5
+ out: { [K_2 in Target]: StandardSchemaV1.InferOutput<Schema>; };
6
+ }, never>;
@@ -0,0 +1 @@
1
+ export * from "./validation";
@@ -0,0 +1,11 @@
1
+ import type { IErrContext_HonoStandardSchema } from "./err_validation.types";
2
+ export declare enum EValidator {
3
+ standard_schema = "standard_schema"
4
+ }
5
+ export declare const err_validation: import("@nice-code/error").NiceErrorDefined<{
6
+ domain: string;
7
+ allDomains: [string, "err_nice"];
8
+ schema: {
9
+ standard_schema: import("@nice-code/error").INiceErrorIdMetadata<IErrContext_HonoStandardSchema, import("@nice-code/error").JSONSerializableValue>;
10
+ };
11
+ }>;
@@ -0,0 +1,4 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ export interface IErrContext_HonoStandardSchema {
3
+ issues: readonly StandardSchemaV1.Issue[];
4
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./err_validation";
2
+ export { extractMessageFromStandardSchema } from "./standard_schema/extractMessageFromStandardSchema";
@@ -0,0 +1,2 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ export declare const extractMessageFromStandardSchema: (failureResult: StandardSchemaV1.FailureResult) => string;
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@nice-code/common-errors",
3
+ "version": "0.0.15",
4
+ "private": false,
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./build/types/index.d.ts",
9
+ "import": "./build/index.js"
10
+ },
11
+ "./hono": {
12
+ "types": "./build/types/hono/index.d.ts",
13
+ "import": "./build/hono/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "build",
18
+ "package.json",
19
+ "README.md"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "type-check": "bunx tsc --noEmit",
26
+ "type-check-watch": "bunx tsc --noEmit --watch",
27
+ "clean-build": "bunx rimraf build",
28
+ "build": "bun run clean-build && bun run build.ts && bun run build-types",
29
+ "build-types": "tsc --project tsconfig.build.json"
30
+ },
31
+ "dependencies": {
32
+ "@nice-code/error": "0.0.14",
33
+ "@standard-schema/spec": "^1.1.0",
34
+ "@hono/standard-validator": "^0.2.2",
35
+ "http-status-codes": "^2.3.0"
36
+ },
37
+ "peerDependencies": {
38
+ "valibot": "^1.3.1",
39
+ "hono": "^4.12.14"
40
+ }
41
+ }