vona-core 5.0.100 → 5.0.101
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.
|
@@ -3,12 +3,13 @@ export function PartialClass(classRef, keys) {
|
|
|
3
3
|
class TargetClass {
|
|
4
4
|
}
|
|
5
5
|
copyMetadataOfClasses(TargetClass.prototype, [classRef.prototype], (rules, key, metadataKeyOptions) => {
|
|
6
|
+
const schema = rules[key];
|
|
6
7
|
if (keys && !keys.includes(key))
|
|
7
|
-
return
|
|
8
|
+
return schema;
|
|
8
9
|
if (metadataKeyOptions?.partialClass) {
|
|
9
|
-
return metadataKeyOptions?.partialClass(
|
|
10
|
+
return metadataKeyOptions?.partialClass(schema);
|
|
10
11
|
}
|
|
11
|
-
return
|
|
12
|
+
return schema;
|
|
12
13
|
});
|
|
13
14
|
copyPropertiesOfClasses(TargetClass, [classRef]);
|
|
14
15
|
return TargetClass;
|
package/dist/lib/utils/util.d.ts
CHANGED
|
@@ -62,4 +62,6 @@ export declare function beanFullNameFromOnionName(onionName: string, sceneName:
|
|
|
62
62
|
export declare function onionNameFromBeanFullName(beanFullName: string, sceneName: keyof IBeanSceneRecord): string;
|
|
63
63
|
export declare function filterHeaders(headers: object | undefined, whitelist: string[]): {} | undefined;
|
|
64
64
|
export declare function combineFilePathSafe(dir: string, file: string): string;
|
|
65
|
+
export declare function loadJSONFile(fileName: string): Promise<any>;
|
|
66
|
+
export declare function saveJSONFile(fileName: string, json: object): Promise<void>;
|
|
65
67
|
export {};
|
package/dist/lib/utils/util.js
CHANGED
|
@@ -307,3 +307,10 @@ export function combineFilePathSafe(dir, file) {
|
|
|
307
307
|
throw new Error(`unsafe dir: ${dir}`);
|
|
308
308
|
return fullPath;
|
|
309
309
|
}
|
|
310
|
+
export async function loadJSONFile(fileName) {
|
|
311
|
+
const pkgContent = (await fse.readFile(fileName)).toString();
|
|
312
|
+
return JSON.parse(pkgContent);
|
|
313
|
+
}
|
|
314
|
+
export async function saveJSONFile(fileName, json) {
|
|
315
|
+
await fse.writeFile(fileName, `${JSON.stringify(json, null, 2)}\n`);
|
|
316
|
+
}
|