qumra-engine 2.0.1 → 2.0.3

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.
@@ -0,0 +1 @@
1
+ export default function addFilter(name: string, fn: (...args: any[]) => any): void;
@@ -0,0 +1 @@
1
+ export default function addFilter(env: any, name: string, fn: (...args: any[]) => any): void;
@@ -0,0 +1 @@
1
+ export default function capitalize(str: string): string;
@@ -0,0 +1 @@
1
+ export default function discountLabel(value: number): string;
@@ -0,0 +1 @@
1
+ export default function formatDate(date: Date | string, locale?: string): string | Date;
@@ -0,0 +1 @@
1
+ export default function formatMoney(value: number, currency?: string): string;
@@ -0,0 +1,5 @@
1
+ export { default as formatMoney } from './logic/formatMoney';
2
+ export { default as formatDate } from './logic/formatDate';
3
+ export { default as capitalize } from './logic/capitalize';
4
+ export { default as discountLabel } from './logic/discountLabel';
5
+ export { default as component } from './logic/component';
@@ -0,0 +1 @@
1
+ export default function capitalize(str: string): string;
@@ -0,0 +1,2 @@
1
+ import nunjucks from "nunjucks";
2
+ export default function component(str: string, data: object, env: nunjucks.Environment): void;
@@ -0,0 +1 @@
1
+ export default function discountLabel(value: number): string;
@@ -0,0 +1 @@
1
+ export default function formatDate(date: Date | string, locale?: string): string | Date;
@@ -0,0 +1 @@
1
+ export default function formatMoney(value: number, currency?: string): string;
@@ -0,0 +1,2 @@
1
+ import nunjucks from 'nunjucks';
2
+ export default function registerAllFilters(env: nunjucks.Environment): void;
@@ -0,0 +1,2 @@
1
+ import { default as qumraEngine } from "./middleware";
2
+ export default qumraEngine;
@@ -0,0 +1,2 @@
1
+ import { Request, Response, NextFunction } from "express";
2
+ export default function nunjucksMiddleware(req: Request, res: Response, next: NextFunction): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ export declare class AppError extends Error {
3
+ statusCode: number;
4
+ status: string;
5
+ isOperational: boolean;
6
+ constructor(message: string, statusCode: number);
7
+ }
8
+ export declare const errorHandler: (err: Error | AppError, req: Request, res: Response, next: NextFunction) => Response<any, Record<string, any>>;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export declare const pathMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export declare const prepareDataMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export declare const themeMiddleware: (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,6 @@
1
+ import nunjucks from "nunjucks";
2
+ /**
3
+ * إعداد Nunjucks مع مسار مخصص للقوالب
4
+ * @param viewsPath المسار الكامل لملفات القوالب
5
+ */
6
+ export declare function configureNunjucks(viewsPath: string): nunjucks.Environment;
@@ -0,0 +1,2 @@
1
+ import nunjucks from 'nunjucks';
2
+ export default function registerAllFilters(env: nunjucks.Environment): void;
@@ -0,0 +1 @@
1
+ export declare function render(view: string, context?: object): Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ import { MainData } from "../types/sharedTypes";
3
+ export declare const getRenderData: (req: Request, res: Response, next: NextFunction) => MainData;
@@ -0,0 +1,2 @@
1
+ import { Response } from "express";
2
+ export declare const prepareData: (res: Response, url: string) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export declare const prepareDataMiddleware: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
@@ -0,0 +1,2 @@
1
+ import { Response } from "express";
2
+ export declare const renderHandler: (res: Response) => Promise<void>;
@@ -0,0 +1,20 @@
1
+ export interface Globals {
2
+ app: any;
3
+ Setting: any;
4
+ }
5
+ export interface RenderContext {
6
+ page: Page;
7
+ [key: string]: any;
8
+ }
9
+ export interface MainData {
10
+ globals?: Globals;
11
+ context?: RenderContext;
12
+ themePath?: string;
13
+ assetsPath?: string;
14
+ }
15
+ export interface Page {
16
+ title: string;
17
+ description: string;
18
+ fileName: string;
19
+ path: string;
20
+ }
@@ -0,0 +1,5 @@
1
+ import pino from 'pino';
2
+ export declare const logger: import("pino").Logger<never, boolean>;
3
+ export declare const log: pino.LogFn;
4
+ export declare const warn: pino.LogFn;
5
+ export declare const error: pino.LogFn;
@@ -0,0 +1,2 @@
1
+ import { Response } from 'express';
2
+ export declare function render(view: string, context: object | undefined, res: Response): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {