vona-core 5.0.100 → 5.0.102

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 rules[key];
8
+ return schema;
8
9
  if (metadataKeyOptions?.partialClass) {
9
- return metadataKeyOptions?.partialClass(rules[key]);
10
+ return metadataKeyOptions?.partialClass(schema);
10
11
  }
11
- return rules[key];
12
+ return schema;
12
13
  });
13
14
  copyPropertiesOfClasses(TargetClass, [classRef]);
14
15
  return TargetClass;
@@ -1,4 +1,3 @@
1
1
  export * from './customKey.ts';
2
- export * from './redis.ts';
3
2
  export * from './retry.ts';
4
3
  export * from './util.ts';
@@ -1,6 +1,5 @@
1
1
  import { zodExtendOpenApi } from "./zod-openapi.js";
2
2
  export * from "./customKey.js";
3
- export * from "./redis.js";
4
3
  export * from "./retry.js";
5
4
  export * from "./util.js";
6
5
  zodExtendOpenApi();
@@ -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 {};
@@ -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
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.100",
4
+ "version": "5.0.102",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -1,3 +0,0 @@
1
- import type { VonaAppInfo } from '../../types/application/app.ts';
2
- import type { VonaApplication } from '../core/application.ts';
3
- export declare function getRedisClientKeyPrefix(clientName: string, appInfo: VonaAppInfo | VonaApplication): string;
@@ -1,4 +0,0 @@
1
- export function getRedisClientKeyPrefix(clientName, appInfo) {
2
- const mode = ['test', 'dev'].includes(appInfo.configMeta.mode) ? '_local' : '';
3
- return `${clientName}_${appInfo.name}${mode}:`;
4
- }