@itrocks/core-transformers 0.0.3 → 0.0.5

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.
@@ -2,6 +2,8 @@ import { AnyObject } from '@itrocks/class-type';
2
2
  import { Type } from '@itrocks/class-type';
3
3
  export type Dependencies = {
4
4
  displayOf: (object: AnyObject, property: string) => string;
5
+ fieldNameOf: (property: string) => string;
6
+ fieldIdOf: (property: string) => string;
5
7
  ignoreTransformedValue: any;
6
8
  representativeValueOf: (object: object) => string;
7
9
  routeOf: (type: Type) => string;
@@ -15,6 +15,8 @@ const transformer_2 = require("@itrocks/transformer");
15
15
  const transformer_3 = require("@itrocks/transformer");
16
16
  const depends = {
17
17
  displayOf: (_object, property) => property,
18
+ fieldNameOf: property => property,
19
+ fieldIdOf: property => property,
18
20
  ignoreTransformedValue: Symbol('ignoreTransformedValue'),
19
21
  representativeValueOf: object => (0, class_type_1.baseType)((0, class_type_2.typeOf)(object)).name,
20
22
  routeOf: type => '/' + (0, class_type_1.baseType)(type).name,
@@ -22,19 +24,21 @@ const depends = {
22
24
  };
23
25
  const areMayEntityEntries = (entries) => (typeof entries[0]?.[1])[0] === 'o';
24
26
  function collectionEdit(values, object, property) {
27
+ const fieldId = depends.fieldIdOf(property);
28
+ const fieldName = depends.fieldNameOf(property);
25
29
  const propertyType = new reflect_2.ReflectProperty(object, property).collectionType;
26
30
  const fetch = depends.routeOf(propertyType?.elementType) + '/summary';
27
- const label = `<label for="${property}">${depends.tr(depends.displayOf(object, property))}</label>`;
31
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(object, property))}</label>`;
28
32
  const inputs = [];
29
33
  for (const object of values) {
30
34
  const attrValue = `value="${depends.representativeValueOf(object)}"`;
31
35
  inputs.push('<li>' + ((0, storage_1.dataSource)().isObjectConnected(object)
32
- ? `<input id="${property}.${object.id}" name="${property}.${object.id}" ${attrValue}>`
33
- : `<input id="${property}." name="${property}." ${attrValue}>`) + '</li>');
36
+ ? `<input id="${fieldId}.${object.id}" name="${fieldName}.${object.id}" ${attrValue}>`
37
+ : `<input id="${fieldId}." name="${fieldName}." ${attrValue}>`) + '</li>');
34
38
  }
35
39
  return label + `<ul data-multiple-contained-auto-width data-fetch="${fetch}" data-type="objects">`
36
40
  + inputs.join('')
37
- + `<li><input id="${property}" name="${property}" placeholder="+"></li>`
41
+ + `<li><input id="${fieldId}" name="${fieldName}" placeholder="+"></li>`
38
42
  + '</ul>';
39
43
  }
40
44
  function collectionInput(values, object, property) {
@@ -44,7 +48,7 @@ function collectionInput(values, object, property) {
44
48
  }
45
49
  else {
46
50
  delete object[property];
47
- Object.assign(object, { [property + '_ids']: Object.keys(values).map(id => +id) });
51
+ Object.assign(object, { [property + 'Ids']: Object.keys(values).map(id => +id) });
48
52
  }
49
53
  return depends.ignoreTransformedValue;
50
54
  }
@@ -74,7 +78,7 @@ function collectionOutput(values, object, property, askFor) {
74
78
  }
75
79
  async function collectionSave(values, object, property) {
76
80
  const dao = (0, storage_1.dataSource)();
77
- const newIdsPromise = object[property + '_ids']
81
+ const newIdsPromise = object[property + 'Ids']
78
82
  ?? values?.map(async (value) => (dao.isObjectConnected(value) ? value : await dao.save(value)).id).sort()
79
83
  ?? [];
80
84
  const previousIdsPromise = dao.isObjectConnected(object)
@@ -1,6 +1,8 @@
1
1
  import { AnyObject } from '@itrocks/class-type';
2
2
  export type CoreDependencies = {
3
3
  displayOf: (object: AnyObject, property: string) => string;
4
+ fieldIdOf: (property: string) => string;
5
+ fieldNameOf: (property: string) => string;
4
6
  tr: (text: string) => string;
5
7
  };
6
8
  export type Dependencies = CoreDependencies & {
package/cjs/primitive.js CHANGED
@@ -16,6 +16,8 @@ const lfTab = '\n\t\t\t\t';
16
16
  const depends = {
17
17
  displayOf: (_object, property) => property,
18
18
  formatDate: date => date.toString(),
19
+ fieldIdOf: property => property,
20
+ fieldNameOf: property => property,
19
21
  parseDate: date => new Date(date),
20
22
  tr: text => text
21
23
  };
@@ -27,9 +29,11 @@ function initBigintHtmlTransformers() {
27
29
  }
28
30
  // Boolean
29
31
  function booleanEdit(value, type, property) {
30
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
31
- const name = `id="${property}" name="${property}"`;
32
- const hidden = `<input name="${property}" type="hidden" value="0">`;
32
+ const fieldId = depends.fieldIdOf(property);
33
+ const fieldName = depends.fieldNameOf(property);
34
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
35
+ const name = `id="${fieldId}" name="${fieldName}"`;
36
+ const hidden = `<input name="${fieldName}" type="hidden" value="0">`;
33
37
  const checked = value ? 'checked ' : '';
34
38
  const checkbox = `<input ${checked}${name} type="checkbox" value="1">`;
35
39
  return label + lfTab + hidden + lfTab + checkbox;
@@ -50,8 +54,10 @@ function initBooleanSqlTransformers() {
50
54
  }
51
55
  // Date
52
56
  function dateEdit(value, type, property) {
53
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
54
- const name = `id="${property}" name="${property}"`;
57
+ const fieldId = depends.fieldIdOf(property);
58
+ const fieldName = depends.fieldNameOf(property);
59
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
60
+ const name = `id="${fieldId}" name="${fieldName}"`;
55
61
  const inputValue = value ? ` value="${depends.formatDate(value)}"` : '';
56
62
  const input = `<input data-type="date" ${name}${inputValue}>`;
57
63
  return label + lfTab + input;
@@ -67,8 +73,10 @@ function initDateHtmlTransformers() {
67
73
  }
68
74
  // Number
69
75
  function numberEdit(value, type, property) {
70
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
71
- const name = `id="${property}" name="${property}"`;
76
+ const fieldId = depends.fieldIdOf(property);
77
+ const fieldName = depends.fieldNameOf(property);
78
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
79
+ const name = `id="${fieldId}" name="${fieldName}"`;
72
80
  const inputValue = (value !== undefined) ? ` value="${value}"` : '';
73
81
  const input = `<input data-type="number" ${name}${inputValue}>`;
74
82
  return label + lfTab + input;
@@ -81,8 +89,10 @@ function initNumberHtmlTransformers() {
81
89
  }
82
90
  // default
83
91
  function defaultEdit(value, type, property) {
84
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
85
- const name = `id="${property}" name="${property}"`;
92
+ const fieldId = depends.fieldIdOf(property);
93
+ const fieldName = depends.fieldNameOf(property);
94
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
95
+ const name = `id="${fieldId}" name="${fieldName}"`;
86
96
  const inputValue = value ? ` value="${value}"` : '';
87
97
  const input = `<input ${name}${inputValue}>`;
88
98
  return label + lfTab + input;
package/cjs/store.d.ts CHANGED
@@ -5,6 +5,8 @@ export type SqlDependencies = {
5
5
  };
6
6
  export type Dependencies = SqlDependencies & {
7
7
  displayOf: (object: AnyObject, property: string) => string;
8
+ fieldIdOf: (property: string) => string;
9
+ fieldNameOf: (property: string) => string;
8
10
  representativeValueOf: (object: object) => string;
9
11
  routeOf: (type: Type) => string;
10
12
  tr: (text: string) => string;
package/cjs/store.js CHANGED
@@ -14,6 +14,8 @@ const transformer_3 = require("@itrocks/transformer");
14
14
  const lfTab = '\n\t\t\t\t';
15
15
  const depends = {
16
16
  displayOf: (_object, property) => property,
17
+ fieldIdOf: property => property,
18
+ fieldNameOf: property => property,
17
19
  ignoreTransformedValue: Symbol('ignoreTransformedValue'),
18
20
  representativeValueOf: object => (0, class_type_1.baseType)((0, class_type_1.typeOf)(object)).name,
19
21
  routeOf: type => '/' + (0, class_type_1.baseType)(type).name,
@@ -37,38 +39,51 @@ function setStoreDependencies(dependencies) {
37
39
  exports.setStoreHtmlDependencies = setStoreDependencies;
38
40
  exports.setStoreSqlDependencies = setStoreDependencies;
39
41
  function storeEdit(value, object, property) {
42
+ const fieldName = depends.fieldNameOf(property);
43
+ const fieldId = depends.fieldIdOf(property);
40
44
  const propertyType = new reflect_1.ReflectProperty(object, property).type;
41
- const representative = value ? depends.representativeValueOf(value) : '';
45
+ const textValue = value ? depends.representativeValueOf(value) : '';
42
46
  const fetch = depends.routeOf(propertyType) + '/summary';
43
- const label = `<label for="${property}">${depends.tr(depends.displayOf(object, property))}</label>`;
44
- const name = `id="${property}" name="${property}"`;
45
- const inputValue = representative.length ? ` value="${representative}"` : '';
47
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(object, property))}</label>`;
48
+ const name = `id="${fieldId}" name="${fieldName}"`;
49
+ const inputValue = (textValue === '') ? '' : ` value="${textValue}"`;
46
50
  const input = `<input data-fetch="${fetch}" data-type="object" ${name}${inputValue}>`;
47
- const input_id = `<input id="${property}_id" name="${property}_id" type="hidden" value="${value?.id}">`;
48
- return label + lfTab + input + input_id;
51
+ const inputId = `<input id="${fieldId}-id" name="${fieldName}_id" type="hidden" value="${value?.id}">`;
52
+ return label + lfTab + input + inputId;
49
53
  }
50
54
  function storeInput(value, object, property, data) {
51
- const property_id = property + '_id';
52
- if ((property_id in data)
53
- && ((property_id in object)
54
- ? (data[property_id] !== object[property_id] + '')
55
- : (data[property_id] !== value?.id + ''))) {
55
+ const propertyId = property + 'Id';
56
+ const fieldId = depends.fieldNameOf(propertyId);
57
+ if ((fieldId in data)
58
+ && ((propertyId in object)
59
+ ? (data[fieldId] !== object[propertyId] + '')
60
+ : (data[fieldId] !== value?.id + ''))) {
56
61
  delete object[property];
57
- Object.assign(object, { [property_id]: +data[property_id] });
62
+ const id = +data[fieldId];
63
+ if (id) {
64
+ Object.assign(object, { [propertyId]: id });
65
+ }
66
+ else if ((typeof value === 'object')) {
67
+ Object.assign(object, { [property]: value });
68
+ }
69
+ else if ((typeof value === 'string') && (value !== '')) {
70
+ const reflectProperty = new reflect_1.ReflectProperty(object, property);
71
+ Object.assign(object, { [property]: new reflectProperty.type(value) });
72
+ }
58
73
  }
59
74
  return depends.ignoreTransformedValue;
60
75
  }
61
76
  function storeOutput(value) {
62
77
  return value ? depends.representativeValueOf(value) : '';
63
78
  }
64
- async function storeSave(value, _object, property, saveValues) {
79
+ async function storeSave(value, _object, property, record) {
65
80
  const dao = (0, storage_1.dataSource)();
66
81
  if (value && !dao.isObjectConnected(value)) {
67
82
  await dao.save(value);
68
83
  }
69
- const property_id = property + '_id';
70
- const id = (value && dao.isObjectConnected(value)) ? value.id : saveValues[property_id];
71
- saveValues[property_id] = id ?? null;
84
+ const columnId = property + '_id';
85
+ const id = (value && dao.isObjectConnected(value)) ? value.id : record[columnId];
86
+ record[columnId] = id ?? null;
72
87
  return depends.ignoreTransformedValue;
73
88
  }
74
89
  //# sourceMappingURL=store.js.map
@@ -2,6 +2,8 @@ import { AnyObject } from '@itrocks/class-type';
2
2
  import { Type } from '@itrocks/class-type';
3
3
  export type Dependencies = {
4
4
  displayOf: (object: AnyObject, property: string) => string;
5
+ fieldNameOf: (property: string) => string;
6
+ fieldIdOf: (property: string) => string;
5
7
  ignoreTransformedValue: any;
6
8
  representativeValueOf: (object: object) => string;
7
9
  routeOf: (type: Type) => string;
@@ -10,6 +10,8 @@ import { INPUT, OUTPUT, SAVE, SQL } from '@itrocks/transformer';
10
10
  import { setPropertyTypeTransformer } from '@itrocks/transformer';
11
11
  const depends = {
12
12
  displayOf: (_object, property) => property,
13
+ fieldNameOf: property => property,
14
+ fieldIdOf: property => property,
13
15
  ignoreTransformedValue: Symbol('ignoreTransformedValue'),
14
16
  representativeValueOf: object => baseType(typeOf(object)).name,
15
17
  routeOf: type => '/' + baseType(type).name,
@@ -17,19 +19,21 @@ const depends = {
17
19
  };
18
20
  const areMayEntityEntries = (entries) => (typeof entries[0]?.[1])[0] === 'o';
19
21
  function collectionEdit(values, object, property) {
22
+ const fieldId = depends.fieldIdOf(property);
23
+ const fieldName = depends.fieldNameOf(property);
20
24
  const propertyType = new ReflectProperty(object, property).collectionType;
21
25
  const fetch = depends.routeOf(propertyType?.elementType) + '/summary';
22
- const label = `<label for="${property}">${depends.tr(depends.displayOf(object, property))}</label>`;
26
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(object, property))}</label>`;
23
27
  const inputs = [];
24
28
  for (const object of values) {
25
29
  const attrValue = `value="${depends.representativeValueOf(object)}"`;
26
30
  inputs.push('<li>' + (dataSource().isObjectConnected(object)
27
- ? `<input id="${property}.${object.id}" name="${property}.${object.id}" ${attrValue}>`
28
- : `<input id="${property}." name="${property}." ${attrValue}>`) + '</li>');
31
+ ? `<input id="${fieldId}.${object.id}" name="${fieldName}.${object.id}" ${attrValue}>`
32
+ : `<input id="${fieldId}." name="${fieldName}." ${attrValue}>`) + '</li>');
29
33
  }
30
34
  return label + `<ul data-multiple-contained-auto-width data-fetch="${fetch}" data-type="objects">`
31
35
  + inputs.join('')
32
- + `<li><input id="${property}" name="${property}" placeholder="+"></li>`
36
+ + `<li><input id="${fieldId}" name="${fieldName}" placeholder="+"></li>`
33
37
  + '</ul>';
34
38
  }
35
39
  function collectionInput(values, object, property) {
@@ -39,7 +43,7 @@ function collectionInput(values, object, property) {
39
43
  }
40
44
  else {
41
45
  delete object[property];
42
- Object.assign(object, { [property + '_ids']: Object.keys(values).map(id => +id) });
46
+ Object.assign(object, { [property + 'Ids']: Object.keys(values).map(id => +id) });
43
47
  }
44
48
  return depends.ignoreTransformedValue;
45
49
  }
@@ -69,7 +73,7 @@ function collectionOutput(values, object, property, askFor) {
69
73
  }
70
74
  async function collectionSave(values, object, property) {
71
75
  const dao = dataSource();
72
- const newIdsPromise = object[property + '_ids']
76
+ const newIdsPromise = object[property + 'Ids']
73
77
  ?? values?.map(async (value) => (dao.isObjectConnected(value) ? value : await dao.save(value)).id).sort()
74
78
  ?? [];
75
79
  const previousIdsPromise = dao.isObjectConnected(object)
@@ -1,6 +1,8 @@
1
1
  import { AnyObject } from '@itrocks/class-type';
2
2
  export type CoreDependencies = {
3
3
  displayOf: (object: AnyObject, property: string) => string;
4
+ fieldIdOf: (property: string) => string;
5
+ fieldNameOf: (property: string) => string;
4
6
  tr: (text: string) => string;
5
7
  };
6
8
  export type Dependencies = CoreDependencies & {
package/esm/primitive.js CHANGED
@@ -5,6 +5,8 @@ const lfTab = '\n\t\t\t\t';
5
5
  const depends = {
6
6
  displayOf: (_object, property) => property,
7
7
  formatDate: date => date.toString(),
8
+ fieldIdOf: property => property,
9
+ fieldNameOf: property => property,
8
10
  parseDate: date => new Date(date),
9
11
  tr: text => text
10
12
  };
@@ -16,9 +18,11 @@ export function initBigintHtmlTransformers() {
16
18
  }
17
19
  // Boolean
18
20
  function booleanEdit(value, type, property) {
19
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
20
- const name = `id="${property}" name="${property}"`;
21
- const hidden = `<input name="${property}" type="hidden" value="0">`;
21
+ const fieldId = depends.fieldIdOf(property);
22
+ const fieldName = depends.fieldNameOf(property);
23
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
24
+ const name = `id="${fieldId}" name="${fieldName}"`;
25
+ const hidden = `<input name="${fieldName}" type="hidden" value="0">`;
22
26
  const checked = value ? 'checked ' : '';
23
27
  const checkbox = `<input ${checked}${name} type="checkbox" value="1">`;
24
28
  return label + lfTab + hidden + lfTab + checkbox;
@@ -39,8 +43,10 @@ export function initBooleanSqlTransformers() {
39
43
  }
40
44
  // Date
41
45
  function dateEdit(value, type, property) {
42
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
43
- const name = `id="${property}" name="${property}"`;
46
+ const fieldId = depends.fieldIdOf(property);
47
+ const fieldName = depends.fieldNameOf(property);
48
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
49
+ const name = `id="${fieldId}" name="${fieldName}"`;
44
50
  const inputValue = value ? ` value="${depends.formatDate(value)}"` : '';
45
51
  const input = `<input data-type="date" ${name}${inputValue}>`;
46
52
  return label + lfTab + input;
@@ -56,8 +62,10 @@ export function initDateHtmlTransformers() {
56
62
  }
57
63
  // Number
58
64
  function numberEdit(value, type, property) {
59
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
60
- const name = `id="${property}" name="${property}"`;
65
+ const fieldId = depends.fieldIdOf(property);
66
+ const fieldName = depends.fieldNameOf(property);
67
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
68
+ const name = `id="${fieldId}" name="${fieldName}"`;
61
69
  const inputValue = (value !== undefined) ? ` value="${value}"` : '';
62
70
  const input = `<input data-type="number" ${name}${inputValue}>`;
63
71
  return label + lfTab + input;
@@ -70,8 +78,10 @@ export function initNumberHtmlTransformers() {
70
78
  }
71
79
  // default
72
80
  function defaultEdit(value, type, property) {
73
- const label = `<label for="${property}">${depends.tr(depends.displayOf(type, property))}</label>`;
74
- const name = `id="${property}" name="${property}"`;
81
+ const fieldId = depends.fieldIdOf(property);
82
+ const fieldName = depends.fieldNameOf(property);
83
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(type, property))}</label>`;
84
+ const name = `id="${fieldId}" name="${fieldName}"`;
75
85
  const inputValue = value ? ` value="${value}"` : '';
76
86
  const input = `<input ${name}${inputValue}>`;
77
87
  return label + lfTab + input;
package/esm/store.d.ts CHANGED
@@ -5,6 +5,8 @@ export type SqlDependencies = {
5
5
  };
6
6
  export type Dependencies = SqlDependencies & {
7
7
  displayOf: (object: AnyObject, property: string) => string;
8
+ fieldIdOf: (property: string) => string;
9
+ fieldNameOf: (property: string) => string;
8
10
  representativeValueOf: (object: object) => string;
9
11
  routeOf: (type: Type) => string;
10
12
  tr: (text: string) => string;
package/esm/store.js CHANGED
@@ -7,6 +7,8 @@ import { INPUT, OUTPUT, SAVE, SQL } from '@itrocks/transformer';
7
7
  const lfTab = '\n\t\t\t\t';
8
8
  const depends = {
9
9
  displayOf: (_object, property) => property,
10
+ fieldIdOf: property => property,
11
+ fieldNameOf: property => property,
10
12
  ignoreTransformedValue: Symbol('ignoreTransformedValue'),
11
13
  representativeValueOf: object => baseType(typeOf(object)).name,
12
14
  routeOf: type => '/' + baseType(type).name,
@@ -30,38 +32,51 @@ export function setStoreDependencies(dependencies) {
30
32
  export const setStoreHtmlDependencies = setStoreDependencies;
31
33
  export const setStoreSqlDependencies = setStoreDependencies;
32
34
  function storeEdit(value, object, property) {
35
+ const fieldName = depends.fieldNameOf(property);
36
+ const fieldId = depends.fieldIdOf(property);
33
37
  const propertyType = new ReflectProperty(object, property).type;
34
- const representative = value ? depends.representativeValueOf(value) : '';
38
+ const textValue = value ? depends.representativeValueOf(value) : '';
35
39
  const fetch = depends.routeOf(propertyType) + '/summary';
36
- const label = `<label for="${property}">${depends.tr(depends.displayOf(object, property))}</label>`;
37
- const name = `id="${property}" name="${property}"`;
38
- const inputValue = representative.length ? ` value="${representative}"` : '';
40
+ const label = `<label for="${fieldId}">${depends.tr(depends.displayOf(object, property))}</label>`;
41
+ const name = `id="${fieldId}" name="${fieldName}"`;
42
+ const inputValue = (textValue === '') ? '' : ` value="${textValue}"`;
39
43
  const input = `<input data-fetch="${fetch}" data-type="object" ${name}${inputValue}>`;
40
- const input_id = `<input id="${property}_id" name="${property}_id" type="hidden" value="${value?.id}">`;
41
- return label + lfTab + input + input_id;
44
+ const inputId = `<input id="${fieldId}-id" name="${fieldName}_id" type="hidden" value="${value?.id}">`;
45
+ return label + lfTab + input + inputId;
42
46
  }
43
47
  function storeInput(value, object, property, data) {
44
- const property_id = property + '_id';
45
- if ((property_id in data)
46
- && ((property_id in object)
47
- ? (data[property_id] !== object[property_id] + '')
48
- : (data[property_id] !== value?.id + ''))) {
48
+ const propertyId = property + 'Id';
49
+ const fieldId = depends.fieldNameOf(propertyId);
50
+ if ((fieldId in data)
51
+ && ((propertyId in object)
52
+ ? (data[fieldId] !== object[propertyId] + '')
53
+ : (data[fieldId] !== value?.id + ''))) {
49
54
  delete object[property];
50
- Object.assign(object, { [property_id]: +data[property_id] });
55
+ const id = +data[fieldId];
56
+ if (id) {
57
+ Object.assign(object, { [propertyId]: id });
58
+ }
59
+ else if ((typeof value === 'object')) {
60
+ Object.assign(object, { [property]: value });
61
+ }
62
+ else if ((typeof value === 'string') && (value !== '')) {
63
+ const reflectProperty = new ReflectProperty(object, property);
64
+ Object.assign(object, { [property]: new reflectProperty.type(value) });
65
+ }
51
66
  }
52
67
  return depends.ignoreTransformedValue;
53
68
  }
54
69
  function storeOutput(value) {
55
70
  return value ? depends.representativeValueOf(value) : '';
56
71
  }
57
- async function storeSave(value, _object, property, saveValues) {
72
+ async function storeSave(value, _object, property, record) {
58
73
  const dao = dataSource();
59
74
  if (value && !dao.isObjectConnected(value)) {
60
75
  await dao.save(value);
61
76
  }
62
- const property_id = property + '_id';
63
- const id = (value && dao.isObjectConnected(value)) ? value.id : saveValues[property_id];
64
- saveValues[property_id] = id ?? null;
77
+ const columnId = property + '_id';
78
+ const id = (value && dao.isObjectConnected(value)) ? value.id : record[columnId];
79
+ record[columnId] = id ?? null;
65
80
  return depends.ignoreTransformedValue;
66
81
  }
67
82
  //# sourceMappingURL=store.js.map
package/package.json CHANGED
@@ -47,5 +47,5 @@
47
47
  "build:esm": "tsc -p tsconfig.esm.json && node esm/esm"
48
48
  },
49
49
  "types": "./esm/core-transformers.d.ts",
50
- "version": "0.0.3"
50
+ "version": "0.0.5"
51
51
  }