Skip to content

Commit

Permalink
refactor(types): move adapters types back to adapters/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Jul 19, 2024
1 parent 3c18fd3 commit 6e04a2c
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/action-builder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isNotFoundError } from "next/dist/client/components/not-found.js";
import { isRedirectError } from "next/dist/client/components/redirect.js";
import type {} from "zod";
import type { Infer, InferArray, InferIn, InferInArray, Schema, ValidationAdapter } from "./adapters.types";
import type { Infer, InferArray, InferIn, InferInArray, Schema, ValidationAdapter } from "./adapters/types";
import type {
MiddlewareFn,
MiddlewareResult,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/adapters/valibot.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Code courtesy of https://github.com/decs/typeschema/blob/main/packages/valibot/src/validation.ts

import { getDotPath, safeParseAsync, type GenericSchema, type GenericSchemaAsync } from "valibot";
import type { IfInstalled, Infer, ValidationAdapter } from "../adapters.types";
import type { IfInstalled, Infer, ValidationAdapter } from "./types";

class ValibotAdapter implements ValidationAdapter {
async validate<S extends IfInstalled<GenericSchema | GenericSchemaAsync>>(schema: S, data: unknown) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/adapters/yup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { Schema as YupSchema } from "yup";
import { ValidationError } from "yup";
import type { IfInstalled, Infer, ValidationAdapter, ValidationIssue } from "../adapters.types";
import type { IfInstalled, Infer, ValidationAdapter, ValidationIssue } from "./types";

class YupAdapter implements ValidationAdapter {
async validate<S extends IfInstalled<YupSchema>>(schema: S, data: unknown) {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/adapters/zod.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/decs/typeschema/blob/main/packages/zod/src/validation.ts

import type { z } from "zod";
import type { IfInstalled, Infer, ValidationAdapter } from "../adapters.types";
import type { IfInstalled, Infer, ValidationAdapter } from "./types";

export type ZodSchema = z.ZodType;

Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/hooks-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import {} from "react/experimental";
import type {} from "zod";
import type { InferIn, Schema } from "./adapters.types";
import type { InferIn, Schema } from "./adapters/types";
import type { HookActionStatus, HookCallbacks, HookResult } from "./hooks.types";

export const getActionStatus = <
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import {} from "react/experimental";
import type {} from "zod";
import type { InferIn, Schema } from "./adapters.types";
import type { InferIn, Schema } from "./adapters/types";
import { getActionShorthandStatusObject, getActionStatus, useActionCallbacks } from "./hooks-utils";
import type { HookCallbacks, HookResult, HookSafeActionFn } from "./hooks.types";
import { isError } from "./utils";
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/hooks.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { InferIn, Schema } from "./adapters.types";
import type { InferIn, Schema } from "./adapters/types";
import type { SafeActionResult } from "./index.types";
import type { MaybePromise, Prettify } from "./utils.types";

Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Infer, Schema } from "./adapters.types";
import type { Infer, Schema } from "./adapters/types";
import type { DVES, SafeActionClientOpts } from "./index.types";
import { SafeActionClient } from "./safe-action-client";
import { DEFAULT_SERVER_ERROR_MESSAGE } from "./utils";
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/index.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Infer, InferArray, InferIn, InferInArray, Schema, ValidationAdapter } from "./adapters.types";
import type { Infer, InferArray, InferIn, InferInArray, Schema, ValidationAdapter } from "./adapters/types";
import type { MaybePromise, Prettify } from "./utils.types";
import type { BindArgsValidationErrors, ValidationErrors } from "./validation-errors.types";

Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/safe-action-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {} from "zod";
import { actionBuilder } from "./action-builder";
import type { Infer, Schema, ValidationAdapter } from "./adapters.types";
import type { Infer, Schema, ValidationAdapter } from "./adapters/types";
import type {
DVES,
MiddlewareFn,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/stateful-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import {} from "react/experimental";
import type {} from "zod";
import type { InferIn, Schema } from "./adapters.types";
import type { InferIn, Schema } from "./adapters/types";
import { getActionShorthandStatusObject, getActionStatus, useActionCallbacks } from "./hooks-utils";
import type { HookCallbacks, HookSafeStateActionFn } from "./hooks.types";
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/validation-errors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */

import type { Schema } from "./adapters.types";
import type { Schema } from "./adapters/types";
import type {
FlattenedBindArgsValidationErrors,
FlattenedValidationErrors,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-safe-action/src/validation-errors.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Infer, Schema } from "./adapters.types";
import type { Infer, Schema } from "./adapters/types";
import type { Prettify } from "./utils.types";

export type ValidationIssue = {
Expand Down

0 comments on commit 6e04a2c

Please sign in to comment.