@carbonorm/carbonnode 2.0.13 → 2.0.14

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonnode",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "browser": "dist/index.umd.js",
@@ -38,7 +38,11 @@ const Get = restRequest<GetCustomAndRequiredFields, i{{TABLE_NAME_SHORT_PASCAL_C
38
38
  },{{#if REACT_IMPORT}}
39
39
  responseCallback: (response, _request) => {
40
40
  const responseData = response?.data?.rest;
41
- {{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>(Array.isArray(responseData) ? responseData : [responseData], "{{TABLE_NAME_SHORT}}", C6.{{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[])
41
+ {{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
42
+ dataOrCallback: Array.isArray(responseData) ? responseData : [responseData],
43
+ stateKey: "{{TABLE_NAME_SHORT}}",
44
+ uniqueObjectId: C6.{{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[])
45
+ })
42
46
  }{{/if}}
43
47
  });
44
48
 
@@ -47,14 +51,19 @@ type PutCustomAndRequiredFields = {}
47
51
  type PutRequestTableOverrides = {}
48
52
 
49
53
  {{#if REACT_IMPORT}}
50
- export function putState(response : AxiosResponse<iPutC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request : iAPI<Modify<i{{TABLE_NAME_SHORT_PASCAL_CASE}}, PutRequestTableOverrides>> & PutCustomAndRequiredFields) {
51
- {{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>([
52
- removeInvalidKeys<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
53
- ...request,
54
- ...response?.data?.rest,
55
- }, C6.TABLES)
56
- ], "{{TABLE_NAME_SHORT}}", {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[])
57
- }{{/if}}
54
+ export function putState(response: AxiosResponse<iPutC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request: iAPI<Modify<i{{TABLE_NAME_SHORT_PASCAL_CASE}}, PutRequestTableOverrides>> & PutCustomAndRequiredFields) {
55
+ {{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
56
+ dataOrCallback: [
57
+ removeInvalidKeys<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
58
+ ...request,
59
+ ...response?.data?.rest,
60
+ }, C6.TABLES)
61
+ ],
62
+ stateKey: "{{TABLE_NAME_SHORT}}",
63
+ uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[])
64
+ })
65
+ }
66
+ {{/if}}
58
67
 
59
68
  const Put = restRequest<PutCustomAndRequiredFields, i{{TABLE_NAME_SHORT_PASCAL_CASE}}, PutRequestTableOverrides, iPutC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>, RestTableNames>({
60
69
  C6: C6,
@@ -73,16 +82,16 @@ type PostCustomAndRequiredFields = {}
73
82
 
74
83
  type PostRequestTableOverrides = {}
75
84
 
76
- {{#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) {
85
+ {{#if REACT_IMPORT}}export function postState(response: AxiosResponse<iPostC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request: iAPI<Modify<i{{CARBON_REACT_INSTANCE}}, PostRequestTableOverrides>> & PostCustomAndRequiredFields, id: string | number | boolean) {
77
86
  if ('number' === typeof id || 'string' === typeof id) {
78
- if (1 !== {{TABLE_NAME_SHORT}}.PRIMARY_SHORT.length) {
87
+ if (1 !== caller_requests.PRIMARY_SHORT.length) {
79
88
  console.error("C6 received unexpected result's given the primary key length");
80
89
  } else {
81
- request[{{TABLE_NAME_SHORT}}.PRIMARY_SHORT[0]] = id
90
+ request[caller_requests.PRIMARY_SHORT[0]] = id
82
91
  }
83
92
  }
84
- {{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>(
85
- undefined !== request.dataInsertMultipleRows
93
+ {{CARBON_REACT_INSTANCE}}.updateRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
94
+ dataOrCallback: undefined !== request.dataInsertMultipleRows
86
95
  ? request.dataInsertMultipleRows.map((request, index) => {
87
96
  return removeInvalidKeys<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
88
97
  ...request,
@@ -93,11 +102,11 @@ type PostRequestTableOverrides = {}
93
102
  removeInvalidKeys<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
94
103
  ...request,
95
104
  ...response?.data?.rest,
96
- }, C6.TABLES)
105
+ }, C6.TABLES)
97
106
  ],
98
- "{{TABLE_NAME_SHORT}}",
99
- {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
100
- )
107
+ stateKey: "{{TABLE_NAME_SHORT}}",
108
+ uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[]
109
+ })
101
110
  }{{/if}}
102
111
 
103
112
  const Post = restRequest<PostCustomAndRequiredFields, i{{TABLE_NAME_SHORT_PASCAL_CASE}}, PostRequestTableOverrides, iPostC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>, RestTableNames>({
@@ -117,11 +126,17 @@ type DeleteCustomAndRequiredFields = {}
117
126
 
118
127
  type DeleteRequestTableOverrides = {}
119
128
 
120
- {{#if REACT_IMPORT}}export function deleteState(_response : AxiosResponse<iDeleteC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request : iAPI<Modify<i{{TABLE_NAME_SHORT_PASCAL_CASE}}, DeleteRequestTableOverrides>> & DeleteCustomAndRequiredFields) {
121
- {{CARBON_REACT_INSTANCE}}.deleteRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>([
122
- request
123
- ], "{{TABLE_NAME_SHORT}}", {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[])
124
- }{{/if}}
129
+ {{#if REACT_IMPORT}}
130
+ export function deleteState(_response: AxiosResponse<iDeleteC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>>, request: iAPI<Modify<i{{TABLE_NAME_SHORT_PASCAL_CASE}}, DeleteRequestTableOverrides>> & DeleteCustomAndRequiredFields) {
131
+ {{CARBON_REACT_INSTANCE}}.deleteRestfulObjectArrays<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>({
132
+ dataOrCallback: [
133
+ request
134
+ ],
135
+ stateKey: "{{TABLE_NAME_SHORT}}",
136
+ uniqueObjectId: {{TABLE_NAME_SHORT}}.PRIMARY_SHORT as (keyof i{{TABLE_NAME_SHORT_PASCAL_CASE}})[])
137
+ })
138
+ }
139
+ {{/if}}
125
140
 
126
141
  const Delete = restRequest<DeleteCustomAndRequiredFields, i{{TABLE_NAME_SHORT_PASCAL_CASE}}, DeleteRequestTableOverrides, iDeleteC6RestResponse<i{{TABLE_NAME_SHORT_PASCAL_CASE}}>, RestTableNames>({
127
142
  C6: C6,
@@ -205,7 +205,7 @@ var parseSQLToTypeScript = function (sql) {
205
205
  if (argMap['--react'] || false) {
206
206
  var reactArgSplit = argMap['--react'].split(';');
207
207
  if (reactArgSplit.length !== 2) {
208
- console.error("React requires two arguments, the import and the carbon react instance statement. Example: --react 'import CustomCarbonReactApplication from \"src/CustomCarbonReactApplication.tsx\"; CustomCarbonReactApplication'");
208
+ console.error("React requires two arguments, the import and the carbon react instance statement. Example: --react 'import CustomCarbonReactApplication from \"src/CustomCarbonReactApplication.tsx\"; CustomCarbonReactApplication.instance'");
209
209
  process.exit(1);
210
210
  }
211
211
  _c = __read(reactArgSplit, 2), REACT_IMPORT = _c[0], CARBON_REACT_INSTANCE = _c[1];
@@ -274,7 +274,7 @@ const parseSQLToTypeScript = (sql: string) => {
274
274
  const reactArgSplit = argMap['--react'].split(';')
275
275
 
276
276
  if (reactArgSplit.length !== 2) {
277
- console.error("React requires two arguments, the import and the carbon react instance statement. Example: --react 'import CustomCarbonReactApplication from \"src/CustomCarbonReactApplication.tsx\"; CustomCarbonReactApplication'");
277
+ console.error("React requires two arguments, the import and the carbon react instance statement. Example: --react 'import CustomCarbonReactApplication from \"src/CustomCarbonReactApplication.tsx\"; CustomCarbonReactApplication.instance'");
278
278
  process.exit(1);
279
279
  }
280
280