@xrystal/core 3.21.3 → 3.21.5

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.21.3",
4
+ "version": "3.21.5",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -14,7 +14,7 @@ export default class LocalizationsService {
14
14
  this.i18next({
15
15
  loadPath: localization.loadPath,
16
16
  fallbackLang: localization.fallbackLang,
17
- preloadLang: localization.preloadLang,
17
+ preloadLang: localization.preloadLangs,
18
18
  });
19
19
  };
20
20
  i18next = ({ loadPath, fallbackLang, preloadLang, }) => {
@@ -1,3 +1,4 @@
1
+ import { ProtocolEnum } from "../../index.js";
1
2
  export declare const getCore: () => {
2
3
  _: any;
3
4
  };
@@ -8,6 +9,7 @@ export declare const getTmpConfig: ({ root, tmpFileName, ext }: {
8
9
  }) => any;
9
10
  export declare function resolveObjWithHandlebars(obj: any, context: any): any;
10
11
  export declare function findFileRecursively(startDir: string, baseName: string, extName?: string, excludedDirs?: string[]): string | null;
12
+ export declare const protocol: (callback: () => Promise<any>, protocol?: ProtocolEnum) => Promise<any>;
11
13
  export declare const argvsConverter: (argvs: string) => {
12
14
  [key: string]: string;
13
15
  };
@@ -1,7 +1,8 @@
1
1
  import path from "path";
2
2
  import fs from 'fs';
3
3
  import Handlebars from 'handlebars';
4
- import { Constants, TmpFileLoader } from "../../index.js";
4
+ import { Constants, ProtocolEnum, TmpFileLoader } from "../../index.js";
5
+ import { controllerContextStorage } from "../../../loader/controller";
5
6
  export const getCore = () => {
6
7
  const ownerTmpFilePath = findFileRecursively(".", Constants.defaultTmpFileName, Constants.defaultTmpFileExt);
7
8
  if (!ownerTmpFilePath) {
@@ -75,6 +76,13 @@ export function findFileRecursively(startDir, baseName, extName = '', excludedDi
75
76
  return null;
76
77
  }
77
78
  }
79
+ export const protocol = async (callback, protocol = ProtocolEnum.HTTP) => {
80
+ const store = controllerContextStorage.getStore();
81
+ if (store) {
82
+ store.protocol = protocol;
83
+ }
84
+ return await callback();
85
+ };
78
86
  // => ---
79
87
  export const argvsConverter = (argvs) => {
80
88
  const reelArgvs = argvs?.slice(2);