@hortiview/modulebase 1.0.4 → 1.1.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.
@@ -1,19 +1,21 @@
1
- import { u as f } from "../useQuery-Cepqe-Ee.js";
2
- import { fetchFromCustomApi as i } from "../utils/fetches.js";
3
- import { universalSelector as n } from "../utils/helper.js";
4
- const y = ({
1
+ import { u as i } from "../useQuery-Cepqe-Ee.js";
2
+ import { fetchFromCustomApi as n } from "../utils/fetches.js";
3
+ import { universalSelector as p } from "../utils/helper.js";
4
+ const C = ({
5
5
  endpoint: o,
6
6
  queryKey: t,
7
7
  token: u,
8
8
  selector: r,
9
9
  enabled: m = !0,
10
- noAuth: s = !1
11
- }) => f({
10
+ noAuth: s = !1,
11
+ ...f
12
+ }) => i({
12
13
  queryKey: t,
13
- queryFn: () => i(o, u, s),
14
- select: (e) => r ? r(e) : n(e),
15
- enabled: m
14
+ queryFn: () => n(o, u, s),
15
+ select: (e) => r ? r(e) : p(e),
16
+ enabled: m,
17
+ ...f
16
18
  });
17
19
  export {
18
- y as useCustom
20
+ C as useCustom
19
21
  };
@@ -1,23 +1,25 @@
1
- import { u as n } from "../useMutation-a0q2LJY6.js";
1
+ import { u as s } from "../useMutation-a0q2LJY6.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "../provider/SignalR/SignalRProvider.js";
5
5
  import "../stores/BasePropsStore.js";
6
6
  import "../ModuleCore-U32BXXin.js";
7
- import { mutateOnCustomApi as s } from "../utils/fetches.js";
7
+ import { mutateOnCustomApi as a } from "../utils/fetches.js";
8
8
  import "../types/Entities.js";
9
9
  import "../api-COabZnyn.js";
10
10
  import "../omit-DYPaIq41.js";
11
11
  import "../stores/EnvironmentStore.js";
12
- const d = ({
12
+ const g = ({
13
13
  endpoint: t,
14
14
  method: o,
15
15
  token: m,
16
16
  headers: r,
17
- noAuth: i
18
- }) => n({
19
- mutationFn: ({ input: p, replaceEndpointWith: u }) => s(u ?? t, p, o, m, r, i)
17
+ noAuth: i,
18
+ ...p
19
+ }) => s({
20
+ mutationFn: ({ input: u, replaceEndpointWith: n }) => a(n ?? t, u, o, m, r, i),
21
+ ...p
20
22
  });
21
23
  export {
22
- d as useCustomMutation
24
+ g as useCustomMutation
23
25
  };
@@ -1,10 +1,9 @@
1
- type UseCustomParams<T> = {
1
+ import { useQuery } from '@tanstack/react-query';
2
+ type UseCustomParams<T> = Omit<Parameters<typeof useQuery>[0], 'queryFn' | 'select'> & {
2
3
  endpoint: string;
3
- queryKey: (string | undefined)[];
4
4
  token?: string;
5
5
  selector?: (data: unknown) => T;
6
- enabled?: boolean;
7
6
  noAuth?: boolean;
8
7
  };
9
- export declare const useCustom: <T>({ endpoint, queryKey, token, selector, enabled, noAuth, }: UseCustomParams<T>) => import('@tanstack/react-query').UseQueryResult<import('@tanstack/query-core').NoInfer<T>, Error>;
8
+ export declare const useCustom: <T>({ endpoint, queryKey, token, selector, enabled, noAuth, ...rest }: UseCustomParams<T>) => import('@tanstack/react-query').UseQueryResult<import('@tanstack/query-core').NoInfer<T>, unknown>;
10
9
  export {};
@@ -1,6 +1,6 @@
1
- import { UseMutationResult } from '@tanstack/react-query';
1
+ import { UseMutationResult, useMutation } from '@tanstack/react-query';
2
2
  import { BaseResponse, httpMethod } from '../types/Requests';
3
- export type UseCustomMutationParams = {
3
+ export type UseCustomMutationParams = Omit<Parameters<typeof useMutation>[0], 'mutationFn'> & {
4
4
  endpoint: string;
5
5
  method: Omit<httpMethod, 'GET'>;
6
6
  token?: string;
@@ -11,4 +11,4 @@ export type CustomMutationInput<Input> = {
11
11
  input: Input;
12
12
  replaceEndpointWith?: string;
13
13
  };
14
- export declare const useCustomMutation: <Input, Output>({ endpoint, method, token, headers, noAuth, }: UseCustomMutationParams) => UseMutationResult<BaseResponse<Output>, Error, CustomMutationInput<Input>, unknown>;
14
+ export declare const useCustomMutation: <Input, Output>({ endpoint, method, token, headers, noAuth, ...rest }: UseCustomMutationParams) => UseMutationResult<BaseResponse<Output>, Error, CustomMutationInput<Input>, unknown>;
@@ -25,7 +25,7 @@ const g = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([
25
25
  }, E = (r, e) => {
26
26
  const t = c(r), n = c(e), o = t.pop(), i = n.pop(), s = p(t, n);
27
27
  return s !== 0 ? s : o && i ? p(o.split("."), i.split(".")) : o || i ? o ? -1 : 1 : 0;
28
- }, d = "1.0.3", w = (r) => m.every((e) => y(e, r)), y = (r, e) => {
28
+ }, d = "1.0.4", w = (r) => m.every((e) => y(e, r)), y = (r, e) => {
29
29
  if (!e[r]) {
30
30
  if (e.throwError)
31
31
  return e.throwError(`Missing required prop: ${r}`, 404), !1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/modulebase",
3
3
  "description": "This is a base module for hortiview",
4
- "version": "1.0.4",
4
+ "version": "1.1.0",
5
5
  "type": "module",
6
6
  "author": "Falk Menge <falk.menge.ext@bayer.com>",
7
7
  "contributors": [