elseware-nodejs 1.11.0 → 1.11.1

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/dist/index.d.cts CHANGED
@@ -1,44 +1,13 @@
1
- import { ZodTypeAny, infer, ZodSchema } from 'zod';
2
1
  import { CorsOptions } from 'cors';
3
2
  import * as express from 'express';
4
3
  import { Request, Response, NextFunction, RequestHandler } from 'express';
5
4
  import * as qs from 'qs';
6
5
  import * as express_serve_static_core from 'express-serve-static-core';
7
6
  import { Schema } from 'joi';
7
+ import { ZodSchema } from 'zod';
8
8
  import { Model, UpdateQuery } from 'mongoose';
9
9
  import { SignOptions, JwtPayload } from 'jsonwebtoken';
10
10
 
11
- declare function loadEnv<TSchema extends ZodTypeAny, TTransform = undefined>(options: {
12
- schema: TSchema;
13
- transform?: (env: infer<TSchema>) => TTransform;
14
- }): TTransform extends undefined ? infer<TSchema> : TTransform;
15
-
16
- interface LoggerOptions {
17
- timestamp?: boolean;
18
- enabled?: boolean;
19
- }
20
- declare class Logger {
21
- private timestamp;
22
- private enabled;
23
- configure(options?: LoggerOptions): void;
24
- private format;
25
- private output;
26
- success(msg: string): void;
27
- info(msg: string): void;
28
- warning(msg: string): void;
29
- danger(message: string, error?: unknown): void;
30
- log(msg: string): void;
31
- }
32
- declare const logger: Logger;
33
-
34
- interface AllowedOriginsOptions {
35
- origins?: string | string[];
36
- defaults?: string[];
37
- }
38
- declare function createAllowedOrigins(options?: AllowedOriginsOptions): string[];
39
-
40
- declare function createCorsOptions(allowedOrigins: string[]): CorsOptions;
41
-
42
11
  /**
43
12
  * CircularArray (Ring Buffer)
44
13
  * ---------------------------
@@ -1731,6 +1700,15 @@ declare class SegmentTree<T> {
1731
1700
  private updatePoint;
1732
1701
  }
1733
1702
 
1703
+ interface AllowedOriginsOptions {
1704
+ origins?: string | string[];
1705
+ defaults?: string[];
1706
+ }
1707
+
1708
+ declare function createAllowedOrigins(options?: AllowedOriginsOptions): string[];
1709
+
1710
+ declare function createCorsOptions(allowedOrigins: string[]): CorsOptions;
1711
+
1734
1712
  interface DatabaseProvider {
1735
1713
  connect(): Promise<void>;
1736
1714
  disconnect(): Promise<void>;
@@ -1766,18 +1744,6 @@ declare class MongoDatabaseProvider implements DatabaseProvider {
1766
1744
  getConnectionState(): string;
1767
1745
  }
1768
1746
 
1769
- declare class AppError extends Error {
1770
- statusCode: number;
1771
- status: string;
1772
- isOperational: boolean;
1773
- code?: string;
1774
- details?: Record<string, unknown>;
1775
- constructor(message: string, statusCode?: number, options?: {
1776
- code?: string;
1777
- details?: Record<string, unknown>;
1778
- });
1779
- }
1780
-
1781
1747
  type Filter<T> = Partial<Record<keyof T, unknown>>;
1782
1748
  type Field<T> = Extract<keyof T, string>;
1783
1749
  type PrefixedField<T> = `+${Field<T>}` | `-${Field<T>}`;
@@ -2315,4 +2281,4 @@ declare function toMinutes(ms: number): number;
2315
2281
  declare function toHours(ms: number): number;
2316
2282
  declare function sleep(ms: number): Promise<void>;
2317
2283
 
2318
- export { AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, ApiFeatures, type ApiMeta, ApiResponse, type ApiResponseOptions, AppError, AsyncHandler, type AsyncRequestHandler, type AuthStrategy, type AuthenticatedUser, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BearerTokenStrategy, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, type CloudinaryConfig, CloudinaryService, ConsistentHash, CorrelationId, CountMinSketch, CrudControllerFactory, type CrudControllerOptions, DEFAULT_LIMIT, DEFAULT_PAGE, DEFAULT_SORT_DIRECTION, type DatabaseConnectionOptions, DatabaseManager, type DatabaseProvider, Deque, type DirectedEdge, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, type Edge, type EmailProvider, EmailService, type ErrorMeta, ErrorMiddleware, type ExponentialBackoffOptions, ExponentialBackoffRetryPolicy, FenwickTree, FibNode, FibonacciHeap, type Filter, FixedRetryPolicy, type FixedRetryPolicyOptions, Graph, HashMap, HashSet, HttpClient, type HttpClientOptions, HyperLogLog, type IValidator, InternalServiceClient, type Interval, IntervalTree, JWTService, type JWTServiceOptions, JoiValidator, KDTree, LFUCache, LRUCache, type LoggerOptions, MaxHeap, MaxStack, MinHeap, MinStack, type MongoDatabaseConfig, MongoDatabaseProvider, MongoRepository, MulterFileHandlerService, MultiSet, Node, OrderedSet, type PaginationMeta, type PaginationQuery, PairingHeap, PairingNode, type ParsedQuery, type PickOptions, type Point, type Point2D, PriorityQueue, type ProgressCallback, QUERY_RESERVED_FIELDS, QuadTree, type QueryFilter, type QueryOperator, type QueryOptions, type QuerySort, Queue, RadixTree, type Rect, RedBlackTree, type Repository, RequestContext, type RequestContextData, type RequestContextOptions, type RetryPolicy, SMTPProvider, SUPPORTED_OPERATORS, SegmentTree, type Select, type SendEmailOptions, ServiceClient, type ServiceResponse, Set, SinglyLinkedList, type Sort, SparseTable, SplayTree, Stack, type StandardApiResponse, StaticArray, StaticTokenProvider, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, type TokenProvider, TracingHeaders, TreeNode, Trie, type UpdateQueryOptions, type UploadOptions, type ValidationResult, type ValidationSchema, ZodValidator, authMiddleware, createAllowedOrigins, createCorsOptions, createRequestContextMiddleware, days, errorToString, hours, isJoiSchema, isZodSchema, loadEnv, logger, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };
2284
+ export { AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, ApiFeatures, type ApiMeta, ApiResponse, type ApiResponseOptions, AsyncHandler, type AsyncRequestHandler, type AuthStrategy, type AuthenticatedUser, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BearerTokenStrategy, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, type CloudinaryConfig, CloudinaryService, ConsistentHash, CorrelationId, CountMinSketch, CrudControllerFactory, type CrudControllerOptions, DEFAULT_LIMIT, DEFAULT_PAGE, DEFAULT_SORT_DIRECTION, type DatabaseConnectionOptions, DatabaseManager, type DatabaseProvider, Deque, type DirectedEdge, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, type Edge, type EmailProvider, EmailService, type ErrorMeta, ErrorMiddleware, type ExponentialBackoffOptions, ExponentialBackoffRetryPolicy, FenwickTree, FibNode, FibonacciHeap, type Filter, FixedRetryPolicy, type FixedRetryPolicyOptions, Graph, HashMap, HashSet, HttpClient, type HttpClientOptions, HyperLogLog, type IValidator, InternalServiceClient, type Interval, IntervalTree, JWTService, type JWTServiceOptions, JoiValidator, KDTree, LFUCache, LRUCache, MaxHeap, MaxStack, MinHeap, MinStack, type MongoDatabaseConfig, MongoDatabaseProvider, MongoRepository, MulterFileHandlerService, MultiSet, Node, OrderedSet, type PaginationMeta, type PaginationQuery, PairingHeap, PairingNode, type ParsedQuery, type PickOptions, type Point, type Point2D, PriorityQueue, type ProgressCallback, QUERY_RESERVED_FIELDS, QuadTree, type QueryFilter, type QueryOperator, type QueryOptions, type QuerySort, Queue, RadixTree, type Rect, RedBlackTree, type Repository, RequestContext, type RequestContextData, type RequestContextOptions, type RetryPolicy, SMTPProvider, SUPPORTED_OPERATORS, SegmentTree, type Select, type SendEmailOptions, ServiceClient, type ServiceResponse, Set, SinglyLinkedList, type Sort, SparseTable, SplayTree, Stack, type StandardApiResponse, StaticArray, StaticTokenProvider, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, type TokenProvider, TracingHeaders, TreeNode, Trie, type UpdateQueryOptions, type UploadOptions, type ValidationResult, type ValidationSchema, ZodValidator, authMiddleware, createAllowedOrigins, createCorsOptions, createRequestContextMiddleware, days, errorToString, hours, isJoiSchema, isZodSchema, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };
package/dist/index.d.ts CHANGED
@@ -1,44 +1,13 @@
1
- import { ZodTypeAny, infer, ZodSchema } from 'zod';
2
1
  import { CorsOptions } from 'cors';
3
2
  import * as express from 'express';
4
3
  import { Request, Response, NextFunction, RequestHandler } from 'express';
5
4
  import * as qs from 'qs';
6
5
  import * as express_serve_static_core from 'express-serve-static-core';
7
6
  import { Schema } from 'joi';
7
+ import { ZodSchema } from 'zod';
8
8
  import { Model, UpdateQuery } from 'mongoose';
9
9
  import { SignOptions, JwtPayload } from 'jsonwebtoken';
10
10
 
11
- declare function loadEnv<TSchema extends ZodTypeAny, TTransform = undefined>(options: {
12
- schema: TSchema;
13
- transform?: (env: infer<TSchema>) => TTransform;
14
- }): TTransform extends undefined ? infer<TSchema> : TTransform;
15
-
16
- interface LoggerOptions {
17
- timestamp?: boolean;
18
- enabled?: boolean;
19
- }
20
- declare class Logger {
21
- private timestamp;
22
- private enabled;
23
- configure(options?: LoggerOptions): void;
24
- private format;
25
- private output;
26
- success(msg: string): void;
27
- info(msg: string): void;
28
- warning(msg: string): void;
29
- danger(message: string, error?: unknown): void;
30
- log(msg: string): void;
31
- }
32
- declare const logger: Logger;
33
-
34
- interface AllowedOriginsOptions {
35
- origins?: string | string[];
36
- defaults?: string[];
37
- }
38
- declare function createAllowedOrigins(options?: AllowedOriginsOptions): string[];
39
-
40
- declare function createCorsOptions(allowedOrigins: string[]): CorsOptions;
41
-
42
11
  /**
43
12
  * CircularArray (Ring Buffer)
44
13
  * ---------------------------
@@ -1731,6 +1700,15 @@ declare class SegmentTree<T> {
1731
1700
  private updatePoint;
1732
1701
  }
1733
1702
 
1703
+ interface AllowedOriginsOptions {
1704
+ origins?: string | string[];
1705
+ defaults?: string[];
1706
+ }
1707
+
1708
+ declare function createAllowedOrigins(options?: AllowedOriginsOptions): string[];
1709
+
1710
+ declare function createCorsOptions(allowedOrigins: string[]): CorsOptions;
1711
+
1734
1712
  interface DatabaseProvider {
1735
1713
  connect(): Promise<void>;
1736
1714
  disconnect(): Promise<void>;
@@ -1766,18 +1744,6 @@ declare class MongoDatabaseProvider implements DatabaseProvider {
1766
1744
  getConnectionState(): string;
1767
1745
  }
1768
1746
 
1769
- declare class AppError extends Error {
1770
- statusCode: number;
1771
- status: string;
1772
- isOperational: boolean;
1773
- code?: string;
1774
- details?: Record<string, unknown>;
1775
- constructor(message: string, statusCode?: number, options?: {
1776
- code?: string;
1777
- details?: Record<string, unknown>;
1778
- });
1779
- }
1780
-
1781
1747
  type Filter<T> = Partial<Record<keyof T, unknown>>;
1782
1748
  type Field<T> = Extract<keyof T, string>;
1783
1749
  type PrefixedField<T> = `+${Field<T>}` | `-${Field<T>}`;
@@ -2315,4 +2281,4 @@ declare function toMinutes(ms: number): number;
2315
2281
  declare function toHours(ms: number): number;
2316
2282
  declare function sleep(ms: number): Promise<void>;
2317
2283
 
2318
- export { AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, ApiFeatures, type ApiMeta, ApiResponse, type ApiResponseOptions, AppError, AsyncHandler, type AsyncRequestHandler, type AuthStrategy, type AuthenticatedUser, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BearerTokenStrategy, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, type CloudinaryConfig, CloudinaryService, ConsistentHash, CorrelationId, CountMinSketch, CrudControllerFactory, type CrudControllerOptions, DEFAULT_LIMIT, DEFAULT_PAGE, DEFAULT_SORT_DIRECTION, type DatabaseConnectionOptions, DatabaseManager, type DatabaseProvider, Deque, type DirectedEdge, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, type Edge, type EmailProvider, EmailService, type ErrorMeta, ErrorMiddleware, type ExponentialBackoffOptions, ExponentialBackoffRetryPolicy, FenwickTree, FibNode, FibonacciHeap, type Filter, FixedRetryPolicy, type FixedRetryPolicyOptions, Graph, HashMap, HashSet, HttpClient, type HttpClientOptions, HyperLogLog, type IValidator, InternalServiceClient, type Interval, IntervalTree, JWTService, type JWTServiceOptions, JoiValidator, KDTree, LFUCache, LRUCache, type LoggerOptions, MaxHeap, MaxStack, MinHeap, MinStack, type MongoDatabaseConfig, MongoDatabaseProvider, MongoRepository, MulterFileHandlerService, MultiSet, Node, OrderedSet, type PaginationMeta, type PaginationQuery, PairingHeap, PairingNode, type ParsedQuery, type PickOptions, type Point, type Point2D, PriorityQueue, type ProgressCallback, QUERY_RESERVED_FIELDS, QuadTree, type QueryFilter, type QueryOperator, type QueryOptions, type QuerySort, Queue, RadixTree, type Rect, RedBlackTree, type Repository, RequestContext, type RequestContextData, type RequestContextOptions, type RetryPolicy, SMTPProvider, SUPPORTED_OPERATORS, SegmentTree, type Select, type SendEmailOptions, ServiceClient, type ServiceResponse, Set, SinglyLinkedList, type Sort, SparseTable, SplayTree, Stack, type StandardApiResponse, StaticArray, StaticTokenProvider, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, type TokenProvider, TracingHeaders, TreeNode, Trie, type UpdateQueryOptions, type UploadOptions, type ValidationResult, type ValidationSchema, ZodValidator, authMiddleware, createAllowedOrigins, createCorsOptions, createRequestContextMiddleware, days, errorToString, hours, isJoiSchema, isZodSchema, loadEnv, logger, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };
2284
+ export { AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, ApiFeatures, type ApiMeta, ApiResponse, type ApiResponseOptions, AsyncHandler, type AsyncRequestHandler, type AuthStrategy, type AuthenticatedUser, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BearerTokenStrategy, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, type CloudinaryConfig, CloudinaryService, ConsistentHash, CorrelationId, CountMinSketch, CrudControllerFactory, type CrudControllerOptions, DEFAULT_LIMIT, DEFAULT_PAGE, DEFAULT_SORT_DIRECTION, type DatabaseConnectionOptions, DatabaseManager, type DatabaseProvider, Deque, type DirectedEdge, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, type Edge, type EmailProvider, EmailService, type ErrorMeta, ErrorMiddleware, type ExponentialBackoffOptions, ExponentialBackoffRetryPolicy, FenwickTree, FibNode, FibonacciHeap, type Filter, FixedRetryPolicy, type FixedRetryPolicyOptions, Graph, HashMap, HashSet, HttpClient, type HttpClientOptions, HyperLogLog, type IValidator, InternalServiceClient, type Interval, IntervalTree, JWTService, type JWTServiceOptions, JoiValidator, KDTree, LFUCache, LRUCache, MaxHeap, MaxStack, MinHeap, MinStack, type MongoDatabaseConfig, MongoDatabaseProvider, MongoRepository, MulterFileHandlerService, MultiSet, Node, OrderedSet, type PaginationMeta, type PaginationQuery, PairingHeap, PairingNode, type ParsedQuery, type PickOptions, type Point, type Point2D, PriorityQueue, type ProgressCallback, QUERY_RESERVED_FIELDS, QuadTree, type QueryFilter, type QueryOperator, type QueryOptions, type QuerySort, Queue, RadixTree, type Rect, RedBlackTree, type Repository, RequestContext, type RequestContextData, type RequestContextOptions, type RetryPolicy, SMTPProvider, SUPPORTED_OPERATORS, SegmentTree, type Select, type SendEmailOptions, ServiceClient, type ServiceResponse, Set, SinglyLinkedList, type Sort, SparseTable, SplayTree, Stack, type StandardApiResponse, StaticArray, StaticTokenProvider, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, type TokenProvider, TracingHeaders, TreeNode, Trie, type UpdateQueryOptions, type UploadOptions, type ValidationResult, type ValidationSchema, ZodValidator, authMiddleware, createAllowedOrigins, createCorsOptions, createRequestContextMiddleware, days, errorToString, hours, isJoiSchema, isZodSchema, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };