@truedat/ai 7.5.9 → 7.5.11
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.
- package/package.json +39 -59
- package/src/components/AiRoutes.js +39 -46
- package/src/components/TranslationModal.js +8 -10
- package/src/components/__tests__/TranslationModal.spec.js +0 -1
- package/src/components/actions/Action.js +1 -2
- package/src/components/actions/ActionActions.js +4 -5
- package/src/components/actions/ActionBreadcrumbs.js +1 -2
- package/src/components/actions/ActionDetail.js +4 -3
- package/src/components/actions/ActionEdit.js +3 -3
- package/src/components/actions/ActionForm.js +7 -7
- package/src/components/actions/ActionNew.js +1 -1
- package/src/components/actions/Actions.js +1 -2
- package/src/components/actions/ActionsContext.js +3 -7
- package/src/components/actions/ActionsTable.js +1 -2
- package/src/components/actions/__tests__/Action.spec.js +14 -36
- package/src/components/actions/__tests__/ActionActions.spec.js +2 -20
- package/src/components/actions/__tests__/ActionBreadcrumbs.spec.js +1 -10
- package/src/components/actions/__tests__/ActionDetail.spec.js +5 -23
- package/src/components/actions/__tests__/ActionEdit.spec.js +7 -31
- package/src/components/actions/__tests__/ActionForm.spec.js +11 -27
- package/src/components/actions/__tests__/ActionNew.spec.js +7 -53
- package/src/components/actions/__tests__/Actions.spec.js +6 -15
- package/src/components/actions/__tests__/ActionsTable.spec.js +3 -23
- package/src/components/actions/__tests__/__snapshots__/Action.spec.js.snap +39 -11
- package/src/components/actions/__tests__/__snapshots__/ActionActions.spec.js.snap +4 -4
- package/src/components/actions/__tests__/__snapshots__/ActionBreadcrumbs.spec.js.snap +2 -1
- package/src/components/actions/__tests__/__snapshots__/ActionDetail.spec.js.snap +26 -3
- package/src/components/actions/__tests__/__snapshots__/ActionEdit.spec.js.snap +11 -73
- package/src/components/actions/__tests__/__snapshots__/ActionForm.spec.js.snap +91 -13
- package/src/components/actions/__tests__/__snapshots__/ActionNew.spec.js.snap +16 -263
- package/src/components/actions/__tests__/__snapshots__/Actions.spec.js.snap +5 -4
- package/src/components/actions/__tests__/__snapshots__/ActionsTable.spec.js.snap +7 -5
- package/src/components/aiSandbox/AiSandbox.js +3 -6
- package/src/components/aiSandbox/RequestForm.js +6 -4
- package/src/components/prompts/PromptEditor.js +1 -8
- package/src/components/prompts/Prompts.js +2 -6
- package/src/components/prompts/__tests__/PromptEditor.spec.js +62 -54
- package/src/components/prompts/__tests__/Prompts.spec.js +0 -2
- package/src/components/prompts/__tests__/__snapshots__/PromptEditor.spec.js.snap +115 -10
- package/src/components/providers/ProviderEditor.js +1 -5
- package/src/components/providers/Providers.js +1 -2
- package/src/components/providers/__tests__/ProviderEditor.spec.js +54 -75
- package/src/components/providers/__tests__/Providers.spec.js +0 -2
- package/src/components/providers/__tests__/__snapshots__/ProviderEditor.spec.js.snap +0 -4
- package/src/components/providers/providerProperties/AzureOpenai.js +0 -1
- package/src/components/providers/providerProperties/BedrockClaude.js +0 -1
- package/src/components/providers/providerProperties/Gemini.js +0 -1
- package/src/components/providers/providerProperties/Openai.js +0 -1
- package/src/components/resourceMappings/ResourceMappingEditor.js +2 -5
- package/src/components/resourceMappings/ResourceMappingFields.js +3 -2
- package/src/components/resourceMappings/ResourceMappings.js +4 -2
- package/src/components/resourceMappings/__tests__/ResourceMappingEditor.spec.js +51 -93
- package/src/components/resourceMappings/__tests__/ResourceMappings.spec.js +0 -2
- package/src/components/resourceMappings/__tests__/__snapshots__/ResourceMappingEditor.spec.js.snap +4 -4
- package/src/components/resourceMappings/selectors/DataStructureSelector.js +0 -1
- package/src/components/resourceMappings/selectors/index.js +0 -1
- package/src/components/suggestions/SuggestionsWidget.js +1 -1
- package/src/components/suggestions/__tests__/SuggestionsWidget.spec.js +3 -3
- package/src/components/suggestions/__tests__/__snapshots__/SuggestionsWidget.spec.js.snap +0 -3
- package/src/hooks/__mocks__/useActions.js +44 -0
- package/src/hooks/__mocks__/useSuggestions.js +5 -0
- package/src/hooks/__tests__/usePrompts.spec.js +5 -5
- package/src/hooks/__tests__/{useProviders.js → useProviders.spec.js} +5 -5
- package/src/hooks/__tests__/useResourceMappings.spec.js +5 -5
- package/src/hooks/useActions.js +5 -4
- package/src/hooks/usePrompts.js +6 -6
- package/src/hooks/useProviders.js +5 -5
- package/src/hooks/useResourceMappings.js +4 -4
- package/src/index.js +2 -1
package/src/components/resourceMappings/__tests__/__snapshots__/ResourceMappingEditor.spec.js.snap
CHANGED
|
@@ -70,7 +70,7 @@ exports[`<ResourceMappingEditor /> matches snapshot without onDelete 1`] = `
|
|
|
70
70
|
<span
|
|
71
71
|
class="text"
|
|
72
72
|
>
|
|
73
|
-
|
|
73
|
+
resourceMappings.resourceType.business_concept
|
|
74
74
|
</span>
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
@@ -268,7 +268,7 @@ exports[`<ResourceMappingEditor /> matches the latest snapshot 1`] = `
|
|
|
268
268
|
<span
|
|
269
269
|
class="text"
|
|
270
270
|
>
|
|
271
|
-
|
|
271
|
+
resourceMappings.resourceType.business_concept
|
|
272
272
|
</span>
|
|
273
273
|
</div>
|
|
274
274
|
</div>
|
|
@@ -469,7 +469,7 @@ exports[`<ResourceMappingEditor /> test cancel button with confirm 1`] = `
|
|
|
469
469
|
<span
|
|
470
470
|
class="text"
|
|
471
471
|
>
|
|
472
|
-
|
|
472
|
+
resourceMappings.resourceType.business_concept
|
|
473
473
|
</span>
|
|
474
474
|
</div>
|
|
475
475
|
</div>
|
|
@@ -668,7 +668,7 @@ exports[`<ResourceMappingEditor /> test delete button 1`] = `
|
|
|
668
668
|
<span
|
|
669
669
|
class="text"
|
|
670
670
|
>
|
|
671
|
-
|
|
671
|
+
resourceMappings.resourceType.business_concept
|
|
672
672
|
</span>
|
|
673
673
|
</div>
|
|
674
674
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Suspense } from "react";
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import { render } from "@truedat/test/render";
|
|
@@ -28,8 +28,8 @@ const requestAiSuggestion = (mock) => (callback) => {
|
|
|
28
28
|
mock === "suggestions"
|
|
29
29
|
? mockSuggestions
|
|
30
30
|
: mock === "error_message"
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
? ["error", { error: { message: "ERROR MESSAGE" } }]
|
|
32
|
+
: ["error", "ERROR TEXT"],
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
35
|
};
|
|
@@ -43,7 +43,6 @@ exports[`<SuggestionsWidget /> component lifecycle 1`] = `
|
|
|
43
43
|
readonly=""
|
|
44
44
|
tabindex="0"
|
|
45
45
|
type="checkbox"
|
|
46
|
-
value=""
|
|
47
46
|
/>
|
|
48
47
|
<label
|
|
49
48
|
for="editable_field"
|
|
@@ -96,7 +95,6 @@ exports[`<SuggestionsWidget /> component lifecycle 1`] = `
|
|
|
96
95
|
readonly=""
|
|
97
96
|
tabindex="-1"
|
|
98
97
|
type="checkbox"
|
|
99
|
-
value=""
|
|
100
98
|
/>
|
|
101
99
|
<label
|
|
102
100
|
for="non_editable_field"
|
|
@@ -134,7 +132,6 @@ exports[`<SuggestionsWidget /> component lifecycle 1`] = `
|
|
|
134
132
|
readonly=""
|
|
135
133
|
tabindex="0"
|
|
136
134
|
type="checkbox"
|
|
137
|
-
value=""
|
|
138
135
|
/>
|
|
139
136
|
<label
|
|
140
137
|
for="unselect_field"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const useActions = jest.fn(() => ({
|
|
2
|
+
data: [],
|
|
3
|
+
error: null,
|
|
4
|
+
loading: false,
|
|
5
|
+
mutate: jest.fn(),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
export const useActionsSearch = jest.fn(() => ({
|
|
9
|
+
trigger: jest.fn(() => ({
|
|
10
|
+
then: jest.fn(),
|
|
11
|
+
})),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export const useAction = jest.fn(() => ({
|
|
15
|
+
data: {},
|
|
16
|
+
action: {},
|
|
17
|
+
error: null,
|
|
18
|
+
loading: false,
|
|
19
|
+
mutate: jest.fn(),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
export const useActionCreate = jest.fn(() => ({
|
|
23
|
+
trigger: jest.fn(() => ({
|
|
24
|
+
then: jest.fn(),
|
|
25
|
+
})),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export const useActionUpdate = jest.fn(() => ({
|
|
29
|
+
trigger: jest.fn(() => ({
|
|
30
|
+
then: jest.fn(),
|
|
31
|
+
})),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
export const useActionDelete = jest.fn(() => ({
|
|
35
|
+
trigger: jest.fn(() => ({
|
|
36
|
+
then: jest.fn(),
|
|
37
|
+
})),
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
export const useActionSetActive = jest.fn(() => ({
|
|
41
|
+
trigger: jest.fn(() => ({
|
|
42
|
+
then: jest.fn(),
|
|
43
|
+
})),
|
|
44
|
+
}));
|
|
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { compile } from "path-to-regexp";
|
|
3
3
|
import useSWR from "swr";
|
|
4
4
|
import useSWRMutations from "swr/mutation";
|
|
5
|
-
import { renderHook } from "@testing-library/react
|
|
5
|
+
import { renderHook } from "@testing-library/react";
|
|
6
6
|
import {
|
|
7
7
|
apiJson,
|
|
8
8
|
apiJsonPost,
|
|
@@ -63,7 +63,7 @@ describe("usePrompts", () => {
|
|
|
63
63
|
expect(apiJsonPost).toHaveBeenCalledWith(url, arg);
|
|
64
64
|
});
|
|
65
65
|
it("usePromptUpdate calls useSWRMutations with correct api route", () => {
|
|
66
|
-
const id = 8;
|
|
66
|
+
const id = "8";
|
|
67
67
|
renderHook(() => usePromptUpdate({ id }));
|
|
68
68
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
69
69
|
const arg = { some: "arg" };
|
|
@@ -76,12 +76,12 @@ describe("usePrompts", () => {
|
|
|
76
76
|
renderHook(() => usePromptUpdate());
|
|
77
77
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
78
78
|
const arg = { some: "arg" };
|
|
79
|
-
expect(url).toBe(compile(API_PROMPT)({ id: 0 }));
|
|
79
|
+
expect(url).toBe(compile(API_PROMPT)({ id: "0" }));
|
|
80
80
|
func(url, { arg });
|
|
81
81
|
expect(apiJsonPatch).toHaveBeenCalledWith(url, arg);
|
|
82
82
|
});
|
|
83
83
|
it("usePromptDelete calls useSWRMutations with correct api route", () => {
|
|
84
|
-
const id = 8;
|
|
84
|
+
const id = "8";
|
|
85
85
|
renderHook(() => usePromptDelete({ id }));
|
|
86
86
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
87
87
|
const arg = { some: "arg" };
|
|
@@ -94,7 +94,7 @@ describe("usePrompts", () => {
|
|
|
94
94
|
renderHook(() => usePromptDelete());
|
|
95
95
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
96
96
|
const arg = { some: "arg" };
|
|
97
|
-
expect(url).toBe(compile(API_PROMPT)({ id: 0 }));
|
|
97
|
+
expect(url).toBe(compile(API_PROMPT)({ id: "0" }));
|
|
98
98
|
func(url, { arg });
|
|
99
99
|
expect(apiJsonDelete).toHaveBeenCalledWith(url, arg);
|
|
100
100
|
});
|
|
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { compile } from "path-to-regexp";
|
|
3
3
|
import useSWR from "swr";
|
|
4
4
|
import useSWRMutations from "swr/mutation";
|
|
5
|
-
import { renderHook } from "@testing-library/react
|
|
5
|
+
import { renderHook } from "@testing-library/react";
|
|
6
6
|
import {
|
|
7
7
|
apiJson,
|
|
8
8
|
apiJsonPost,
|
|
@@ -63,7 +63,7 @@ describe("useProviders", () => {
|
|
|
63
63
|
expect(apiJsonPost).toHaveBeenCalledWith(url, arg);
|
|
64
64
|
});
|
|
65
65
|
it("useProviderUpdate calls useSWRMutations with correct api route", () => {
|
|
66
|
-
const id = 8;
|
|
66
|
+
const id = "8";
|
|
67
67
|
renderHook(() => useProviderUpdate({ id }));
|
|
68
68
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
69
69
|
const arg = { some: "arg" };
|
|
@@ -76,12 +76,12 @@ describe("useProviders", () => {
|
|
|
76
76
|
renderHook(() => useProviderUpdate());
|
|
77
77
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
78
78
|
const arg = { some: "arg" };
|
|
79
|
-
expect(url).toBe(compile(API_PROVIDER)({ id: 0 }));
|
|
79
|
+
expect(url).toBe(compile(API_PROVIDER)({ id: "0" }));
|
|
80
80
|
func(url, { arg });
|
|
81
81
|
expect(apiJsonPatch).toHaveBeenCalledWith(url, arg);
|
|
82
82
|
});
|
|
83
83
|
it("useProviderDelete calls useSWRMutations with correct api route", () => {
|
|
84
|
-
const id = 8;
|
|
84
|
+
const id = "8";
|
|
85
85
|
renderHook(() => useProviderDelete({ id }));
|
|
86
86
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
87
87
|
const arg = { some: "arg" };
|
|
@@ -94,7 +94,7 @@ describe("useProviders", () => {
|
|
|
94
94
|
renderHook(() => useProviderDelete());
|
|
95
95
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
96
96
|
const arg = { some: "arg" };
|
|
97
|
-
expect(url).toBe(compile(API_PROVIDER)({ id: 0 }));
|
|
97
|
+
expect(url).toBe(compile(API_PROVIDER)({ id: "0" }));
|
|
98
98
|
func(url, { arg });
|
|
99
99
|
expect(apiJsonDelete).toHaveBeenCalledWith(url, arg);
|
|
100
100
|
});
|
|
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import { compile } from "path-to-regexp";
|
|
3
3
|
import useSWR from "swr";
|
|
4
4
|
import useSWRMutations from "swr/mutation";
|
|
5
|
-
import { renderHook } from "@testing-library/react
|
|
5
|
+
import { renderHook } from "@testing-library/react";
|
|
6
6
|
import {
|
|
7
7
|
apiJson,
|
|
8
8
|
apiJsonPost,
|
|
@@ -63,7 +63,7 @@ describe("useResourceMappings", () => {
|
|
|
63
63
|
expect(apiJsonPost).toHaveBeenCalledWith(url, arg);
|
|
64
64
|
});
|
|
65
65
|
it("useResourceMappingUpdate calls useSWRMutations with correct api route", () => {
|
|
66
|
-
const id = 8;
|
|
66
|
+
const id = "8";
|
|
67
67
|
renderHook(() => useResourceMappingUpdate({ id }));
|
|
68
68
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
69
69
|
const arg = { some: "arg" };
|
|
@@ -76,12 +76,12 @@ describe("useResourceMappings", () => {
|
|
|
76
76
|
renderHook(() => useResourceMappingUpdate());
|
|
77
77
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
78
78
|
const arg = { some: "arg" };
|
|
79
|
-
expect(url).toBe(compile(API_RESOURCE_MAPPING)({ id: 0 }));
|
|
79
|
+
expect(url).toBe(compile(API_RESOURCE_MAPPING)({ id: "0" }));
|
|
80
80
|
func(url, { arg });
|
|
81
81
|
expect(apiJsonPatch).toHaveBeenCalledWith(url, arg);
|
|
82
82
|
});
|
|
83
83
|
it("useResourceMappingDelete calls useSWRMutations with correct api route", () => {
|
|
84
|
-
const id = 8;
|
|
84
|
+
const id = "8";
|
|
85
85
|
renderHook(() => useResourceMappingDelete({ id }));
|
|
86
86
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
87
87
|
const arg = { some: "arg" };
|
|
@@ -94,7 +94,7 @@ describe("useResourceMappings", () => {
|
|
|
94
94
|
renderHook(() => useResourceMappingDelete());
|
|
95
95
|
const [url, func] = _.last(useSWRMutations.mock.calls);
|
|
96
96
|
const arg = { some: "arg" };
|
|
97
|
-
expect(url).toBe(compile(API_RESOURCE_MAPPING)({ id: 0 }));
|
|
97
|
+
expect(url).toBe(compile(API_RESOURCE_MAPPING)({ id: "0" }));
|
|
98
98
|
func(url, { arg });
|
|
99
99
|
expect(apiJsonDelete).toHaveBeenCalledWith(url, arg);
|
|
100
100
|
});
|
package/src/hooks/useActions.js
CHANGED
|
@@ -28,7 +28,7 @@ export const useActionsSearch = () => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export const useAction = (id) => {
|
|
31
|
-
const url = compile(API_ACTION)({ id });
|
|
31
|
+
const url = compile(API_ACTION)({ id: `${id}` });
|
|
32
32
|
const { data, error, mutate } = useSWRImmutable(url, apiJson);
|
|
33
33
|
return {
|
|
34
34
|
data: data?.data,
|
|
@@ -44,20 +44,21 @@ export const useActionCreate = () => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export const useActionUpdate = (id) => {
|
|
47
|
-
const url = compile(API_ACTION)({ id });
|
|
47
|
+
const url = compile(API_ACTION)({ id: `${id}` });
|
|
48
48
|
return useSWRMutations(url, (url, { arg }) => apiJsonPatch(url, arg));
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export const useActionDelete = (payload) => {
|
|
52
52
|
const id = payload?.id || 0;
|
|
53
53
|
const logical = payload?.logical || true;
|
|
54
|
-
const url = compile(API_ACTION)({ id }) + "?logical=" + logical;
|
|
54
|
+
const url = compile(API_ACTION)({ id: `${id}` }) + "?logical=" + logical;
|
|
55
55
|
return useSWRMutations(url, (url, { arg }) => apiJsonDelete(url, arg));
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export const useActionSetActive = (payload) => {
|
|
59
59
|
const id = payload?.id || 0;
|
|
60
60
|
const active = _.propOr(true, "active")(payload);
|
|
61
|
-
const url =
|
|
61
|
+
const url =
|
|
62
|
+
compile(API_ACTION_SET_ACTIVE)({ id: `${id}` }) + "?active=" + active;
|
|
62
63
|
return useSWRMutations(url, (url, { arg }) => apiJsonPost(url, arg));
|
|
63
64
|
};
|
package/src/hooks/usePrompts.js
CHANGED
|
@@ -19,19 +19,19 @@ export const usePromptCreate = () => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const usePromptUpdate = (func) => {
|
|
22
|
-
const id = func?.id || 0;
|
|
23
|
-
const url = compile(API_PROMPT)({ id });
|
|
22
|
+
const id = func?.id || "0";
|
|
23
|
+
const url = compile(API_PROMPT)({ id: `${id}` });
|
|
24
24
|
return useSWRMutations(url, (url, { arg }) => apiJsonPatch(url, arg));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export const usePromptSetActive = (func) => {
|
|
28
|
-
const id = func?.id || 0;
|
|
29
|
-
const url = compile(API_PROMPT_SET_ACTIVE)({ id });
|
|
28
|
+
const id = func?.id || "0";
|
|
29
|
+
const url = compile(API_PROMPT_SET_ACTIVE)({ id: `${id}` });
|
|
30
30
|
return useSWRMutations(url, (url) => apiJsonPatch(url));
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const usePromptDelete = (func) => {
|
|
34
|
-
const id = func?.id || 0;
|
|
35
|
-
const url = compile(API_PROMPT)({ id });
|
|
34
|
+
const id = func?.id || "0";
|
|
35
|
+
const url = compile(API_PROMPT)({ id: `${id}` });
|
|
36
36
|
return useSWRMutations(url, (url, { arg }) => apiJsonDelete(url, arg));
|
|
37
37
|
};
|
|
@@ -21,18 +21,18 @@ export const useProviderCreate = () => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export const useProviderUpdate = (payload) => {
|
|
24
|
-
const id = payload?.id || 0;
|
|
25
|
-
const url = compile(API_PROVIDER)({ id });
|
|
24
|
+
const id = payload?.id || "0";
|
|
25
|
+
const url = compile(API_PROVIDER)({ id: `${id}` });
|
|
26
26
|
return useSWRMutations(url, (url, { arg }) => apiJsonPatch(url, arg));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const useProviderChatCompletion = (id) => {
|
|
30
|
-
const url = compile(API_PROVIDER_CHAT)({ id });
|
|
30
|
+
const url = compile(API_PROVIDER_CHAT)({ id: `${id}` });
|
|
31
31
|
return useSWRMutations(url, (url, { arg }) => apiJsonPost(url, arg));
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export const useProviderDelete = (payload) => {
|
|
35
|
-
const id = payload?.id || 0;
|
|
36
|
-
const url = compile(API_PROVIDER)({ id });
|
|
35
|
+
const id = payload?.id || "0";
|
|
36
|
+
const url = compile(API_PROVIDER)({ id: `${id}` });
|
|
37
37
|
return useSWRMutations(url, (url, { arg }) => apiJsonDelete(url, arg));
|
|
38
38
|
};
|
|
@@ -21,13 +21,13 @@ export const useResourceMappingCreate = () => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export const useResourceMappingUpdate = (func) => {
|
|
24
|
-
const id = func?.id || 0;
|
|
25
|
-
const url = compile(API_RESOURCE_MAPPING)({ id });
|
|
24
|
+
const id = func?.id || "0";
|
|
25
|
+
const url = compile(API_RESOURCE_MAPPING)({ id: `${id}` });
|
|
26
26
|
return useSWRMutations(url, (url, { arg }) => apiJsonPatch(url, arg));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const useResourceMappingDelete = (func) => {
|
|
30
|
-
const id = func?.id || 0;
|
|
31
|
-
const url = compile(API_RESOURCE_MAPPING)({ id });
|
|
30
|
+
const id = func?.id || "0";
|
|
31
|
+
const url = compile(API_RESOURCE_MAPPING)({ id: `${id}` });
|
|
32
32
|
return useSWRMutations(url, (url, { arg }) => apiJsonDelete(url, arg));
|
|
33
33
|
};
|
package/src/index.js
CHANGED