@itrocks/core-transformers 0.0.13 → 0.0.15
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/cjs/collection-type.d.ts +3 -2
- package/cjs/collection-type.js +6 -5
- package/cjs/store.d.ts +1 -1
- package/cjs/store.js +1 -1
- package/esm/collection-type.d.ts +3 -2
- package/esm/collection-type.js +6 -5
- package/esm/store.d.ts +1 -1
- package/esm/store.js +1 -1
- package/package.json +1 -1
package/cjs/collection-type.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AnyObject } from '@itrocks/class-type';
|
|
2
|
-
import { Type } from '@itrocks/class-type';
|
|
2
|
+
import { KeyOf, Type } from '@itrocks/class-type';
|
|
3
3
|
export type Dependencies = {
|
|
4
4
|
displayOf: (object: AnyObject, property: string) => string;
|
|
5
5
|
fieldNameOf: (property: string) => string;
|
|
6
6
|
fieldIdOf: (property: string) => string;
|
|
7
7
|
ignoreTransformedValue: any;
|
|
8
|
-
|
|
8
|
+
propertyOutput: <T extends object>(object: T, property: KeyOf<T>) => Promise<string>;
|
|
9
|
+
representativeValueOf: (object: object) => Promise<string>;
|
|
9
10
|
routeOf: (type: Type) => string;
|
|
10
11
|
tr: (text: string) => string;
|
|
11
12
|
};
|
package/cjs/collection-type.js
CHANGED
|
@@ -18,7 +18,8 @@ const depends = {
|
|
|
18
18
|
fieldNameOf: property => property,
|
|
19
19
|
fieldIdOf: property => property,
|
|
20
20
|
ignoreTransformedValue: Symbol('ignoreTransformedValue'),
|
|
21
|
-
|
|
21
|
+
propertyOutput: async (object, property) => '' + await object[property],
|
|
22
|
+
representativeValueOf: async (object) => (0, class_type_1.baseType)((0, class_type_2.typeOf)(object)).name,
|
|
22
23
|
routeOf: type => '/' + (0, class_type_1.baseType)(type).name,
|
|
23
24
|
tr: text => text
|
|
24
25
|
};
|
|
@@ -76,7 +77,7 @@ async function collectionOutput(values, object, property, askFor) {
|
|
|
76
77
|
+ '</tr>');
|
|
77
78
|
html.push(...await Promise.all(values.map(async (value) => '<tr>'
|
|
78
79
|
+ (await Promise.all(properties.map(async (property) => '<td>'
|
|
79
|
-
+ (await value
|
|
80
|
+
+ (await depends.propertyOutput(value, property))
|
|
80
81
|
+ '</td>'))).join('')
|
|
81
82
|
+ '</tr>')));
|
|
82
83
|
html.push('</table>');
|
|
@@ -85,9 +86,9 @@ async function collectionOutput(values, object, property, askFor) {
|
|
|
85
86
|
if (askFor?.container) {
|
|
86
87
|
askFor.container = false;
|
|
87
88
|
return '<ul>'
|
|
88
|
-
+ values.map(object => '<li>'
|
|
89
|
-
+ depends.representativeValueOf(object)
|
|
90
|
-
+ '</li>').join('')
|
|
89
|
+
+ (await Promise.all(values.map(async (object) => '<li>'
|
|
90
|
+
+ (await depends.representativeValueOf(object))
|
|
91
|
+
+ '</li>'))).join('')
|
|
91
92
|
+ '</ul>';
|
|
92
93
|
}
|
|
93
94
|
return values.map(object => depends.representativeValueOf(object)).join(', ');
|
package/cjs/store.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type Dependencies = SqlDependencies & {
|
|
|
7
7
|
displayOf: (object: AnyObject, property: string) => string;
|
|
8
8
|
fieldIdOf: (property: string) => string;
|
|
9
9
|
fieldNameOf: (property: string) => string;
|
|
10
|
-
representativeValueOf: (object: object) => string
|
|
10
|
+
representativeValueOf: (object: object) => Promise<string>;
|
|
11
11
|
routeOf: (type: Type) => string;
|
|
12
12
|
tr: (text: string) => string;
|
|
13
13
|
};
|
package/cjs/store.js
CHANGED
|
@@ -17,7 +17,7 @@ const depends = {
|
|
|
17
17
|
fieldIdOf: property => property,
|
|
18
18
|
fieldNameOf: property => property,
|
|
19
19
|
ignoreTransformedValue: Symbol('ignoreTransformedValue'),
|
|
20
|
-
representativeValueOf: object => (0, class_type_1.baseType)((0, class_type_1.typeOf)(object)).name,
|
|
20
|
+
representativeValueOf: async (object) => (0, class_type_1.baseType)((0, class_type_1.typeOf)(object)).name,
|
|
21
21
|
routeOf: type => '/' + (0, class_type_1.baseType)(type).name,
|
|
22
22
|
tr: text => text
|
|
23
23
|
};
|
package/esm/collection-type.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AnyObject } from '@itrocks/class-type';
|
|
2
|
-
import { Type } from '@itrocks/class-type';
|
|
2
|
+
import { KeyOf, Type } from '@itrocks/class-type';
|
|
3
3
|
export type Dependencies = {
|
|
4
4
|
displayOf: (object: AnyObject, property: string) => string;
|
|
5
5
|
fieldNameOf: (property: string) => string;
|
|
6
6
|
fieldIdOf: (property: string) => string;
|
|
7
7
|
ignoreTransformedValue: any;
|
|
8
|
-
|
|
8
|
+
propertyOutput: <T extends object>(object: T, property: KeyOf<T>) => Promise<string>;
|
|
9
|
+
representativeValueOf: (object: object) => Promise<string>;
|
|
9
10
|
routeOf: (type: Type) => string;
|
|
10
11
|
tr: (text: string) => string;
|
|
11
12
|
};
|
package/esm/collection-type.js
CHANGED
|
@@ -14,7 +14,8 @@ const depends = {
|
|
|
14
14
|
fieldNameOf: property => property,
|
|
15
15
|
fieldIdOf: property => property,
|
|
16
16
|
ignoreTransformedValue: Symbol('ignoreTransformedValue'),
|
|
17
|
-
|
|
17
|
+
propertyOutput: async (object, property) => '' + await object[property],
|
|
18
|
+
representativeValueOf: async (object) => baseType(typeOf(object)).name,
|
|
18
19
|
routeOf: type => '/' + baseType(type).name,
|
|
19
20
|
tr: text => text
|
|
20
21
|
};
|
|
@@ -72,7 +73,7 @@ async function collectionOutput(values, object, property, askFor) {
|
|
|
72
73
|
+ '</tr>');
|
|
73
74
|
html.push(...await Promise.all(values.map(async (value) => '<tr>'
|
|
74
75
|
+ (await Promise.all(properties.map(async (property) => '<td>'
|
|
75
|
-
+ (await value
|
|
76
|
+
+ (await depends.propertyOutput(value, property))
|
|
76
77
|
+ '</td>'))).join('')
|
|
77
78
|
+ '</tr>')));
|
|
78
79
|
html.push('</table>');
|
|
@@ -81,9 +82,9 @@ async function collectionOutput(values, object, property, askFor) {
|
|
|
81
82
|
if (askFor?.container) {
|
|
82
83
|
askFor.container = false;
|
|
83
84
|
return '<ul>'
|
|
84
|
-
+ values.map(object => '<li>'
|
|
85
|
-
+ depends.representativeValueOf(object)
|
|
86
|
-
+ '</li>').join('')
|
|
85
|
+
+ (await Promise.all(values.map(async (object) => '<li>'
|
|
86
|
+
+ (await depends.representativeValueOf(object))
|
|
87
|
+
+ '</li>'))).join('')
|
|
87
88
|
+ '</ul>';
|
|
88
89
|
}
|
|
89
90
|
return values.map(object => depends.representativeValueOf(object)).join(', ');
|
package/esm/store.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type Dependencies = SqlDependencies & {
|
|
|
7
7
|
displayOf: (object: AnyObject, property: string) => string;
|
|
8
8
|
fieldIdOf: (property: string) => string;
|
|
9
9
|
fieldNameOf: (property: string) => string;
|
|
10
|
-
representativeValueOf: (object: object) => string
|
|
10
|
+
representativeValueOf: (object: object) => Promise<string>;
|
|
11
11
|
routeOf: (type: Type) => string;
|
|
12
12
|
tr: (text: string) => string;
|
|
13
13
|
};
|
package/esm/store.js
CHANGED
|
@@ -10,7 +10,7 @@ const depends = {
|
|
|
10
10
|
fieldIdOf: property => property,
|
|
11
11
|
fieldNameOf: property => property,
|
|
12
12
|
ignoreTransformedValue: Symbol('ignoreTransformedValue'),
|
|
13
|
-
representativeValueOf: object => baseType(typeOf(object)).name,
|
|
13
|
+
representativeValueOf: async (object) => baseType(typeOf(object)).name,
|
|
14
14
|
routeOf: type => '/' + baseType(type).name,
|
|
15
15
|
tr: text => text
|
|
16
16
|
};
|
package/package.json
CHANGED