@coasys/hooks-helpers 0.11.2-dev.2 → 0.12.0-rc1-dev.4
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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"uuid": "*",
|
|
16
|
-
"@coasys/ad4m": "0.
|
|
16
|
+
"@coasys/ad4m": "0.12.0-rc1-dev.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/uuid": "^9.0.0"
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"@coasys/ad4m": "*"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
"version": "0.
|
|
26
|
+
"version": "0.12.0-rc1-dev.4",
|
|
27
27
|
"scripts": {}
|
|
28
28
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Subject,
|
|
5
5
|
Literal,
|
|
6
6
|
LinkQuery,
|
|
7
|
+
getPropertiesMetadata,
|
|
7
8
|
} from "@coasys/ad4m";
|
|
8
9
|
import { setProperties } from "./model";
|
|
9
10
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -127,20 +128,21 @@ export class SubjectRepository<SubjectClass extends { [x: string]: any }> {
|
|
|
127
128
|
|
|
128
129
|
private async getSubjectData(entry: any) {
|
|
129
130
|
let links = await this.perspective.get(
|
|
130
|
-
new LinkQuery({ source: entry.
|
|
131
|
+
new LinkQuery({ source: entry.id })
|
|
131
132
|
);
|
|
132
133
|
|
|
133
|
-
let data: any = await this.perspective.getSubjectData(this.subject, entry.
|
|
134
|
+
let data: any = await this.perspective.getSubjectData(this.subject, entry.id)
|
|
134
135
|
|
|
135
136
|
for (const key in data) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
const propsMeta = getPropertiesMetadata(this.tempSubject);
|
|
138
|
+
const transform = propsMeta[key]?.transform;
|
|
139
|
+
if (transform) {
|
|
140
|
+
data[key] = transform(data[key]);
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
return {
|
|
143
|
-
id: entry.
|
|
145
|
+
id: entry.id,
|
|
144
146
|
timestamp: links[0].timestamp,
|
|
145
147
|
author: links[0].author,
|
|
146
148
|
...data,
|
package/src/factory/model.ts
CHANGED
|
@@ -29,7 +29,7 @@ export function collectionToAdderName(collection: string): string {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function collectionToSetterName(collection: string): string {
|
|
32
|
-
return `
|
|
32
|
+
return `set${capitalize(collection)}`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function setProperties(subject: any, properties: PropertyValueMap) {
|