vona-core 5.0.99 → 5.0.100

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.
@@ -20,10 +20,12 @@ export declare class VonaApplication extends KoaApplication {
20
20
  server: Server;
21
21
  ctxStorage: VonaAsyncLocalStorage;
22
22
  constructor(options: VonaApplicationOptions);
23
+ get name(): string;
24
+ get projectPath(): string;
25
+ get configMeta(): import("@cabloy/module-info").VonaConfigMeta;
23
26
  get ctx(): VonaContext;
24
27
  /** get specific module's scope */
25
28
  scope<K extends TypeBeanScopeRecordKeys>(moduleScope: K): IBeanScopeRecord[K];
26
- get name(): string;
27
29
  createAnonymousContext(req?: any, res?: any): VonaContext;
28
30
  close(terminate?: boolean): Promise<void>;
29
31
  }
@@ -43,6 +43,15 @@ export class VonaApplication extends KoaApplication {
43
43
  // zod
44
44
  zodEnhance(this);
45
45
  }
46
+ get name() {
47
+ return this.options.name;
48
+ }
49
+ get projectPath() {
50
+ return this.options.projectPath;
51
+ }
52
+ get configMeta() {
53
+ return this.options.configMeta;
54
+ }
46
55
  get ctx() {
47
56
  return this.currentContext;
48
57
  }
@@ -50,9 +59,6 @@ export class VonaApplication extends KoaApplication {
50
59
  scope(moduleScope) {
51
60
  return this.bean.scope(moduleScope);
52
61
  }
53
- get name() {
54
- return this.options.name;
55
- }
56
62
  createAnonymousContext(req, res) {
57
63
  let request;
58
64
  if (req) {
@@ -52,6 +52,7 @@ function __createApp({ modulesMeta, locales, config, env, AppMonkey }) {
52
52
  const options = {
53
53
  name: appInfo.name,
54
54
  projectPath: appInfo.projectPath,
55
+ configMeta: appInfo.configMeta,
55
56
  modulesMeta,
56
57
  locales,
57
58
  config: appConfig,
@@ -1,3 +1,4 @@
1
1
  export * from './customKey.ts';
2
+ export * from './redis.ts';
2
3
  export * from './retry.ts';
3
4
  export * from './util.ts';
@@ -1,5 +1,6 @@
1
1
  import { zodExtendOpenApi } from "./zod-openapi.js";
2
2
  export * from "./customKey.js";
3
+ export * from "./redis.js";
3
4
  export * from "./retry.js";
4
5
  export * from "./util.js";
5
6
  zodExtendOpenApi();
@@ -0,0 +1,3 @@
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;
@@ -0,0 +1,4 @@
1
+ export function getRedisClientKeyPrefix(clientName, appInfo) {
2
+ const mode = ['test', 'dev'].includes(appInfo.configMeta.mode) ? '_local' : '';
3
+ return `${clientName}_${appInfo.name}${mode}:`;
4
+ }
@@ -27,6 +27,7 @@ export interface VonaAppInfo {
27
27
  export interface VonaApplicationOptions {
28
28
  name: string;
29
29
  projectPath: string;
30
+ configMeta: VonaConfigMeta;
30
31
  modulesMeta: TypeOptionsModulesMeta;
31
32
  locales: VonaLocaleOptionalMap;
32
33
  config: VonaConfig;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.99",
4
+ "version": "5.0.100",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"