@carbonorm/carbonnode 2.0.14 → 2.0.16
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
CHANGED
|
@@ -3,16 +3,9 @@ import {
|
|
|
3
3
|
iC6Object,
|
|
4
4
|
iC6RestfulModel,
|
|
5
5
|
tC6Tables,
|
|
6
|
-
|
|
7
|
-
iPostC6RestResponse,
|
|
8
|
-
iDeleteC6RestResponse,
|
|
9
|
-
iDynamicApiImport,
|
|
10
|
-
iPutC6RestResponse,
|
|
11
|
-
iAPI,
|
|
6
|
+
iDynamicApiImport
|
|
12
7
|
removePrefixIfExists
|
|
13
8
|
} from "@carbonorm/carbonnode";
|
|
14
|
-
import {AxiosResponse} from "axios";
|
|
15
|
-
|
|
16
9
|
|
|
17
10
|
export const RestTablePrefix = '{{{PREFIX}}}';
|
|
18
11
|
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from "@carbonorm/carbonnode";{{#REACT_IMPORT}}
|
|
15
15
|
import {AxiosResponse} from "axios";{{/REACT_IMPORT}}
|
|
16
16
|
import {C6, i{{TABLE_NAME_SHORT_PASCAL_CASE}}, {{TABLE_NAME_SHORT}}, RestTableNames} from "./C6";{{#if REACT_IMPORT}}
|
|
17
|
-
import {deleteRestfulObjectArrays, updateRestfulObjectArrays} from "@carbonorm/carbonreact";
|
|
18
17
|
{{{REACT_IMPORT}}};{{/if}}
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -41,7 +40,7 @@ const Get = restRequest<GetCustomAndRequiredFields, i{{TABLE_NAME_SHORT_PASCAL_C
|
|
|
41
40
|
{{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
|
|
42
41
|
dataOrCallback: Array.isArray(responseData) ? responseData : [responseData],
|
|
43
42
|
stateKey: "{{TABLE_NAME_SHORT}}",
|
|
44
|
-
uniqueObjectId: C6.{{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
|
|
43
|
+
uniqueObjectId: C6.{{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
|
|
45
44
|
})
|
|
46
45
|
}{{/if}}
|
|
47
46
|
});
|
|
@@ -60,7 +59,7 @@ export function putState(response: AxiosResponse<iPutC6RestResponse<i{{TABLE_NAM
|
|
|
60
59
|
}, C6.TABLES)
|
|
61
60
|
],
|
|
62
61
|
stateKey: "{{TABLE_NAME_SHORT}}",
|
|
63
|
-
uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
|
|
62
|
+
uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
|
|
64
63
|
})
|
|
65
64
|
}
|
|
66
65
|
{{/if}}
|
|
@@ -82,12 +81,12 @@ type PostCustomAndRequiredFields = {}
|
|
|
82
81
|
|
|
83
82
|
type PostRequestTableOverrides = {}
|
|
84
83
|
|
|
85
|
-
{{#if REACT_IMPORT}}export function postState(response: AxiosResponse<iPostC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request: iAPI<Modify<i{{
|
|
84
|
+
{{#if REACT_IMPORT}}export function postState(response: AxiosResponse<iPostC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request: iAPI<Modify<i{{TABLE_NAME_SHORT_PASCAL_CASE}}, PostRequestTableOverrides>> & PostCustomAndRequiredFields, id: string | number | boolean) {
|
|
86
85
|
if ('number' === typeof id || 'string' === typeof id) {
|
|
87
|
-
if (1 !==
|
|
86
|
+
if (1 !== {{TABLE_NAME_SHORT}}.PRIMARY_SHORT.length) {
|
|
88
87
|
console.error("C6 received unexpected result's given the primary key length");
|
|
89
88
|
} else {
|
|
90
|
-
request[
|
|
89
|
+
request[{{TABLE_NAME_SHORT}}.PRIMARY_SHORT[0]] = id
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
{{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
|
|
@@ -133,7 +132,7 @@ export function deleteState(_response: AxiosResponse<iDeleteC6RestResponse<i{{TA
|
|
|
133
132
|
request
|
|
134
133
|
],
|
|
135
134
|
stateKey: "{{TABLE_NAME_SHORT}}",
|
|
136
|
-
uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
|
|
135
|
+
uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
|
|
137
136
|
})
|
|
138
137
|
}
|
|
139
138
|
{{/if}}
|