@ryneex/api-client 1.0.0-beta.3 → 1.0.0-beta.4

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.
Files changed (2) hide show
  1. package/index.d.ts +3 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -40,6 +40,8 @@ type Err<E> = {
40
40
  error: E;
41
41
  };
42
42
  type Result<T, E> = Ok<T> | Err<E>;
43
+ type InferOk<T> = T extends Ok<infer K> ? K : never;
44
+ type InferErr<T> = T extends Err<infer K> ? K : never;
43
45
 
44
46
  declare function createClient(axios: AxiosInstance): {
45
47
  create: <TOutputSchema extends z.ZodType, TInputSchema extends z.ZodType, TVariablesSchema extends z.ZodType, TOutput = z.core.output<TOutputSchema>, TInput = z.core.input<TInputSchema>, TVariables = z.core.input<TVariablesSchema>>(opts: ClientOptions<TOutputSchema, TInputSchema, TVariablesSchema, TOutput, TInput, TVariables>) => ((_payload: OptionalPayload<ClientPayload<TInput, TVariables>>) => Promise<Result<TOutput, ClientError>>) & {
@@ -81,4 +83,4 @@ declare class ValidationError extends ZodError {
81
83
  declare function ok<T>(data: T, response: AxiosResponse): Ok<T>;
82
84
  declare function err<E>(error: E): Err<E>;
83
85
 
84
- export { type ApiClientErrorProps, type ClientError, type ClientOptions, type ClientPayload, type Err, type Ok, type OptionalPayload, type ReactMutationOptions, type ReactQueryOptions, type Result, VALIDATION_ERROR_NAMES, ValidationError, callApi, createClient, err, getResponse, ok };
86
+ export { type ApiClientErrorProps, type ClientError, type ClientOptions, type ClientPayload, type Err, type InferErr, type InferOk, type Ok, type OptionalPayload, type ReactMutationOptions, type ReactQueryOptions, type Result, VALIDATION_ERROR_NAMES, ValidationError, callApi, createClient, err, getResponse, ok };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ryneex/api-client",
3
3
  "module": "src/index.ts",
4
4
  "type": "module",
5
- "version": "1.0.0-beta.3",
5
+ "version": "1.0.0-beta.4",
6
6
  "exports": {
7
7
  ".": "./index.js"
8
8
  },