@flareone/common 0.1.0
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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/chunk-4TE4W4RZ.js +231 -0
- package/dist/chunk-4TE4W4RZ.js.map +1 -0
- package/dist/chunk-JAMM5H7G.js +577 -0
- package/dist/chunk-JAMM5H7G.js.map +1 -0
- package/dist/chunk-TLAV6QIM.js +327 -0
- package/dist/chunk-TLAV6QIM.js.map +1 -0
- package/dist/chunk-VDUV5SQH.js +281 -0
- package/dist/chunk-VDUV5SQH.js.map +1 -0
- package/dist/chunk-XUS63JTZ.js +16 -0
- package/dist/chunk-XUS63JTZ.js.map +1 -0
- package/dist/guards/index.d.ts +230 -0
- package/dist/guards/index.js +4 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/index.d.ts +151 -0
- package/dist/interceptors/index.js +4 -0
- package/dist/interceptors/index.js.map +1 -0
- package/dist/pipes/index.d.ts +120 -0
- package/dist/pipes/index.js +4 -0
- package/dist/pipes/index.js.map +1 -0
- package/dist/utils/index.d.ts +155 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"names":[],"mappings":";AAQO,SAAS,IAAA,GAAe;AAC3B,EAAA,OAAO,OAAO,UAAA,EAAW;AAC7B;AAKO,SAAS,YAAA,CAAa,MAAA,EAAgB,OAAA,GAAkB,cAAA,EAAwB;AACnF,EAAA,MAAM,QAAA,GAAmC;AAAA,IACrC,YAAA,EAAc,gEAAA;AAAA,IACd,KAAA,EAAO,sDAAA;AAAA,IACP,OAAA,EAAS,YAAA;AAAA,IACT,GAAA,EAAK;AAAA,GACT;AAEA,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,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AA,OAAO,KAAA;AACX","file":"chunk-VDUV5SQH.js","sourcesContent":["/**\r\n * Utils\r\n * mostly stuff i didn't want to re-implement for the 100th time.\r\n */\r\n\r\n/**\r\n * Generate a random UUID v4\r\n */\r\nexport function uuid(): string {\r\n return crypto.randomUUID();\r\n}\r\n\r\n/**\r\n * Generate a random string\r\n */\r\nexport function randomString(length: number, charset: string = 'alphanumeric'): string {\r\n const charsets: Record<string, string> = {\r\n alphanumeric: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',\r\n alpha: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\r\n numeric: '0123456789',\r\n hex: '0123456789abcdef',\r\n };\r\n\r\n const chars = charsets[charset] ?? charset;\r\n const array = new Uint8Array(length);\r\n crypto.getRandomValues(array);\r\n\r\n return Array.from(array)\r\n .map((byte) => chars[byte % chars.length])\r\n .join('');\r\n}\r\n\r\n/**\r\n * Hash a string using SHA-256\r\n */\r\nexport async function sha256(data: string): Promise<string> {\r\n const encoder = new TextEncoder();\r\n const buffer = await crypto.subtle.digest('SHA-256', encoder.encode(data));\r\n return Array.from(new Uint8Array(buffer))\r\n .map((b) => b.toString(16).padStart(2, '0'))\r\n .join('');\r\n}\r\n\r\n/**\r\n * Hash a string using SHA-512\r\n */\r\nexport async function sha512(data: string): Promise<string> {\r\n const encoder = new TextEncoder();\r\n const buffer = await crypto.subtle.digest('SHA-512', encoder.encode(data));\r\n return Array.from(new Uint8Array(buffer))\r\n .map((b) => b.toString(16).padStart(2, '0'))\r\n .join('');\r\n}\r\n\r\n/**\r\n * Create HMAC signature\r\n */\r\nexport async function hmac(\r\n data: string,\r\n secret: string,\r\n algorithm: 'SHA-256' | 'SHA-384' | 'SHA-512' = 'SHA-256'\r\n): Promise<string> {\r\n const encoder = new TextEncoder();\r\n\r\n const key = await crypto.subtle.importKey(\r\n 'raw',\r\n encoder.encode(secret),\r\n { name: 'HMAC', hash: algorithm },\r\n false,\r\n ['sign']\r\n );\r\n\r\n const signature = await crypto.subtle.sign('HMAC', key, encoder.encode(data));\r\n\r\n return Array.from(new Uint8Array(signature))\r\n .map((b) => b.toString(16).padStart(2, '0'))\r\n .join('');\r\n}\r\n\r\n/**\r\n * Constant-time string comparison\r\n */\r\nexport function constantTimeEqual(a: string, b: string): boolean {\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n\r\n let result = 0;\r\n for (let i = 0; i < a.length; i++) {\r\n result |= a.charCodeAt(i) ^ b.charCodeAt(i);\r\n }\r\n return result === 0;\r\n}\r\n\r\n/**\r\n * Base64 encode\r\n */\r\nexport function base64Encode(data: string | ArrayBuffer): string {\r\n if (typeof data === 'string') {\r\n return btoa(data);\r\n }\r\n return btoa(String.fromCharCode(...new Uint8Array(data)));\r\n}\r\n\r\n/**\r\n * Base64 decode\r\n */\r\nexport function base64Decode(data: string): string {\r\n return atob(data);\r\n}\r\n\r\n/**\r\n * Base64 URL-safe encode\r\n */\r\nexport function base64UrlEncode(data: string | ArrayBuffer): string {\r\n return base64Encode(data)\r\n .replace(/\\+/g, '-')\r\n .replace(/\\//g, '_')\r\n .replace(/=+$/, '');\r\n}\r\n\r\n/**\r\n * Base64 URL-safe decode\r\n */\r\nexport function base64UrlDecode(data: string): string {\r\n const padded = data + '='.repeat((4 - (data.length % 4)) % 4);\r\n return base64Decode(padded.replace(/-/g, '+').replace(/_/g, '/'));\r\n}\r\n\r\n/**\r\n * Hex encode\r\n */\r\nexport function hexEncode(data: ArrayBuffer | Uint8Array): string {\r\n const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;\r\n return Array.from(bytes)\r\n .map((b) => b.toString(16).padStart(2, '0'))\r\n .join('');\r\n}\r\n\r\n/**\r\n * Hex decode\r\n */\r\nexport function hexDecode(hex: string): Uint8Array {\r\n const bytes = new Uint8Array(hex.length / 2);\r\n for (let i = 0; i < hex.length; i += 2) {\r\n bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);\r\n }\r\n return bytes;\r\n}\r\n\r\n/**\r\n * Convert string to camelCase\r\n */\r\nexport function camelCase(str: string): string {\r\n return str\r\n .replace(/[-_\\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\r\n .replace(/^(.)/, (c) => c.toLowerCase());\r\n}\r\n\r\n/**\r\n * Convert string to PascalCase\r\n */\r\nexport function pascalCase(str: string): string {\r\n return str\r\n .replace(/[-_\\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\r\n .replace(/^(.)/, (c) => c.toUpperCase());\r\n}\r\n\r\n/**\r\n * Convert string to snake_case\r\n */\r\nexport function snakeCase(str: string): string {\r\n return str\r\n .replace(/([A-Z])/g, '_$1')\r\n .replace(/[-\\s]+/g, '_')\r\n .replace(/^_/, '')\r\n .toLowerCase();\r\n}\r\n\r\n/**\r\n * Convert string to kebab-case\r\n */\r\nexport function kebabCase(str: string): string {\r\n return str\r\n .replace(/([A-Z])/g, '-$1')\r\n .replace(/[_\\s]+/g, '-')\r\n .replace(/^-/, '')\r\n .toLowerCase();\r\n}\r\n\r\n/**\r\n * Generate URL-friendly slug\r\n */\r\nexport function slugify(str: string): string {\r\n return str\r\n .toLowerCase()\r\n .normalize('NFD')\r\n .replace(/[\\u0300-\\u036f]/g, '')\r\n .replace(/[^\\w\\s-]/g, '')\r\n .replace(/[\\s_-]+/g, '-')\r\n .replace(/^-+|-+$/g, '');\r\n}\r\n\r\n/**\r\n * Truncate string with ellipsis\r\n */\r\nexport function truncate(str: string, length: number, suffix: string = '...'): string {\r\n if (str.length <= length) return str;\r\n return str.slice(0, length - suffix.length) + suffix;\r\n}\r\n\r\n/**\r\n * Deep clone an object\r\n */\r\nexport function deepClone<T>(obj: T): T {\r\n if (obj === null || typeof obj !== 'object') {\r\n return obj;\r\n }\r\n\r\n if (obj instanceof Date) {\r\n return new Date(obj.getTime()) as unknown as T;\r\n }\r\n\r\n if (Array.isArray(obj)) {\r\n return obj.map((item) => deepClone(item)) as unknown as T;\r\n }\r\n\r\n const cloned = {} as T;\r\n for (const key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n cloned[key] = deepClone(obj[key]);\r\n }\r\n }\r\n return cloned;\r\n}\r\n\r\n/**\r\n * Deep merge objects\r\n */\r\nexport function deepMerge<T extends Record<string, unknown>>(\r\n target: T,\r\n ...sources: Partial<T>[]\r\n): T {\r\n const result = deepClone(target);\r\n\r\n for (const source of sources) {\r\n for (const key in source) {\r\n if (Object.prototype.hasOwnProperty.call(source, key)) {\r\n const sourceValue = source[key];\r\n const targetValue = result[key];\r\n\r\n if (\r\n typeof sourceValue === 'object' &&\r\n sourceValue !== null &&\r\n !Array.isArray(sourceValue) &&\r\n typeof targetValue === 'object' &&\r\n targetValue !== null &&\r\n !Array.isArray(targetValue)\r\n ) {\r\n (result as Record<string, unknown>)[key] = deepMerge(\r\n targetValue as Record<string, unknown>,\r\n sourceValue as Record<string, unknown>\r\n );\r\n } else {\r\n (result as Record<string, unknown>)[key] = deepClone(sourceValue);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Pick specific keys from an object\r\n */\r\nexport function pick<T extends Record<string, unknown>, K extends keyof T>(\r\n obj: T,\r\n keys: K[]\r\n): Pick<T, K> {\r\n const result = {} as Pick<T, K>;\r\n for (const key of keys) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n result[key] = obj[key];\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Omit specific keys from an object\r\n */\r\nexport function omit<T extends Record<string, unknown>, K extends keyof T>(\r\n obj: T,\r\n keys: K[]\r\n): Omit<T, K> {\r\n const result = { ...obj };\r\n for (const key of keys) {\r\n delete result[key];\r\n }\r\n return result as Omit<T, K>;\r\n}\r\n\r\n/**\r\n * Get nested property value\r\n */\r\nexport function get<T>(obj: unknown, path: string, defaultValue?: T): T | undefined {\r\n const keys = path.split('.');\r\n let result: unknown = obj;\r\n\r\n for (const key of keys) {\r\n if (result === null || result === undefined) {\r\n return defaultValue;\r\n }\r\n result = (result as Record<string, unknown>)[key];\r\n }\r\n\r\n return (result as T) ?? defaultValue;\r\n}\r\n\r\n/**\r\n * Set nested property value\r\n */\r\nexport function set<T extends Record<string, unknown>>(\r\n obj: T,\r\n path: string,\r\n value: unknown\r\n): T {\r\n const keys = path.split('.');\r\n const result = deepClone(obj);\r\n let current: Record<string, unknown> = result;\r\n\r\n for (let i = 0; i < keys.length - 1; i++) {\r\n const key = keys[i]!;\r\n if (!(key in current) || typeof current[key] !== 'object') {\r\n current[key] = {};\r\n }\r\n current = current[key] as Record<string, unknown>;\r\n }\r\n\r\n current[keys[keys.length - 1]!] = value;\r\n return result;\r\n}\r\n\r\n/**\r\n * Split array into chunks\r\n */\r\nexport function chunk<T>(arr: T[], size: number): T[][] {\r\n const chunks: T[][] = [];\r\n for (let i = 0; i < arr.length; i += size) {\r\n chunks.push(arr.slice(i, i + size));\r\n }\r\n return chunks;\r\n}\r\n\r\n/**\r\n * Get unique values from array\r\n */\r\nexport function unique<T>(arr: T[]): T[] {\r\n return [...new Set(arr)];\r\n}\r\n\r\n/**\r\n * Group array elements by key\r\n */\r\nexport function groupBy<T, K extends string | number | symbol>(\r\n arr: T[],\r\n keyFn: (item: T) => K\r\n): Record<K, T[]> {\r\n return arr.reduce(\r\n (acc, item) => {\r\n const key = keyFn(item);\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n acc[key].push(item);\r\n return acc;\r\n },\r\n {} as Record<K, T[]>\r\n );\r\n}\r\n\r\n/**\r\n * Shuffle array (Fisher-Yates)\r\n */\r\nexport function shuffle<T>(arr: T[]): T[] {\r\n const result = [...arr];\r\n for (let i = result.length - 1; i > 0; i--) {\r\n const j = Math.floor(Math.random() * (i + 1));\r\n [result[i], result[j]] = [result[j]!, result[i]!];\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Sleep for specified milliseconds\r\n */\r\nexport function sleep(ms: number): Promise<void> {\r\n return new Promise((resolve) => setTimeout(resolve, ms));\r\n}\r\n\r\n/**\r\n * Retry a function with exponential backoff\r\n */\r\nexport async function retry<T>(\r\n fn: () => Promise<T>,\r\n options: {\r\n maxAttempts?: number;\r\n initialDelay?: number;\r\n maxDelay?: number;\r\n factor?: number;\r\n } = {}\r\n): Promise<T> {\r\n const {\r\n maxAttempts = 3,\r\n initialDelay = 100,\r\n maxDelay = 10000,\r\n factor = 2,\r\n } = options;\r\n\r\n let lastError: Error;\r\n let delay = initialDelay;\r\n\r\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\r\n try {\r\n return await fn();\r\n } catch (error) {\r\n lastError = error instanceof Error ? error : new Error(String(error));\r\n\r\n if (attempt === maxAttempts) {\r\n break;\r\n }\r\n\r\n await sleep(delay);\r\n delay = Math.min(delay * factor, maxDelay);\r\n }\r\n }\r\n\r\n throw lastError!;\r\n}\r\n\r\n/**\r\n * Execute promises with concurrency limit\r\n */\r\nexport async function parallel<T>(\r\n tasks: (() => Promise<T>)[],\r\n concurrency: number\r\n): Promise<T[]> {\r\n const results: T[] = [];\r\n const running: Promise<void>[] = [];\r\n let index = 0;\r\n\r\n const runNext = async (): Promise<void> => {\r\n const i = index++;\r\n if (i >= tasks.length) return;\r\n\r\n results[i] = await tasks[i]!();\r\n await runNext();\r\n };\r\n\r\n while (running.length < concurrency && index < tasks.length) {\r\n running.push(runNext());\r\n }\r\n\r\n await Promise.all(running);\r\n return results;\r\n}\r\n\r\n/**\r\n * Validate email format\r\n */\r\nexport function isEmail(value: string): boolean {\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\r\n return emailRegex.test(value);\r\n}\r\n\r\n/**\r\n * Validate URL format\r\n */\r\nexport function isUrl(value: string): boolean {\r\n try {\r\n new URL(value);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Validate UUID format\r\n */\r\nexport function isUuid(value: string): boolean {\r\n const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\r\n return uuidRegex.test(value);\r\n}\r\n\r\n/**\r\n * Validate IPv4 address\r\n */\r\nexport function isIpv4(value: string): boolean {\r\n const ipv4Regex = /^(\\d{1,3}\\.){3}\\d{1,3}$/;\r\n if (!ipv4Regex.test(value)) return false;\r\n return value.split('.').every((octet) => {\r\n const num = parseInt(octet, 10);\r\n return num >= 0 && num <= 255;\r\n });\r\n}\r\n\r\n/**\r\n * Check if value is empty\r\n */\r\nexport function isEmpty(value: unknown): boolean {\r\n if (value === null || value === undefined) return true;\r\n if (typeof value === 'string') return value.trim() === '';\r\n if (Array.isArray(value)) return value.length === 0;\r\n if (typeof value === 'object') return Object.keys(value).length === 0;\r\n return false;\r\n}\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
13
|
+
|
|
14
|
+
export { __decorateClass, __publicField };
|
|
15
|
+
//# sourceMappingURL=chunk-XUS63JTZ.js.map
|
|
16
|
+
//# sourceMappingURL=chunk-XUS63JTZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-XUS63JTZ.js"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { Guard, ExecutionContextWrapper } from '@flareone/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Guards
|
|
5
|
+
* authentication and other security stuff.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Base authentication guard
|
|
10
|
+
* Override canActivate to implement custom logic
|
|
11
|
+
*/
|
|
12
|
+
declare class AuthGuard implements Guard {
|
|
13
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Override this method to implement token validation
|
|
16
|
+
*/
|
|
17
|
+
protected validateToken(_authHeader: string, _context: ExecutionContextWrapper): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
interface JwtGuardOptions {
|
|
20
|
+
secret?: string;
|
|
21
|
+
secretKey?: CryptoKey;
|
|
22
|
+
tokenPrefix?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* JWT authentication guard
|
|
26
|
+
*/
|
|
27
|
+
declare class JwtGuard extends AuthGuard {
|
|
28
|
+
private readonly options;
|
|
29
|
+
constructor(options?: JwtGuardOptions);
|
|
30
|
+
protected validateToken(authHeader: string, context: ExecutionContextWrapper): Promise<boolean>;
|
|
31
|
+
private verifyJwt;
|
|
32
|
+
private verifySignature;
|
|
33
|
+
}
|
|
34
|
+
interface ApiKeyGuardOptions {
|
|
35
|
+
headerName?: string;
|
|
36
|
+
queryParam?: string;
|
|
37
|
+
validKeys?: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* API Key authentication guard
|
|
41
|
+
*/
|
|
42
|
+
declare class ApiKeyGuard implements Guard {
|
|
43
|
+
private readonly options;
|
|
44
|
+
constructor(options?: ApiKeyGuardOptions);
|
|
45
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
46
|
+
protected extractApiKey(context: ExecutionContextWrapper): string | null;
|
|
47
|
+
protected validateKey(apiKey: string, _context: ExecutionContextWrapper): Promise<boolean>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Role-based access control guard
|
|
51
|
+
*/
|
|
52
|
+
declare class RolesGuard implements Guard {
|
|
53
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
54
|
+
}
|
|
55
|
+
interface ThrottleGuardOptions {
|
|
56
|
+
limit?: number;
|
|
57
|
+
ttl?: number;
|
|
58
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Rate limiting guard with automatic cleanup
|
|
62
|
+
* Uses in-memory storage with periodic cleanup of expired entries.
|
|
63
|
+
* For production distributed rate limiting, use KV or Durable Objects.
|
|
64
|
+
*/
|
|
65
|
+
declare class ThrottleGuard implements Guard {
|
|
66
|
+
private readonly storage;
|
|
67
|
+
private readonly limit;
|
|
68
|
+
private readonly ttl;
|
|
69
|
+
private cleanupInterval?;
|
|
70
|
+
constructor(options?: ThrottleGuardOptions);
|
|
71
|
+
private startCleanup;
|
|
72
|
+
destroy(): void;
|
|
73
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
74
|
+
private generateKey;
|
|
75
|
+
}
|
|
76
|
+
interface IpFilterOptions {
|
|
77
|
+
ips: string[];
|
|
78
|
+
message?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* IP whitelist guard
|
|
82
|
+
*/
|
|
83
|
+
declare class IpWhitelistGuard implements Guard {
|
|
84
|
+
private readonly options;
|
|
85
|
+
constructor(options: IpFilterOptions);
|
|
86
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
87
|
+
private matchIp;
|
|
88
|
+
private matchCIDR;
|
|
89
|
+
private ipToNumber;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* IP blacklist guard
|
|
93
|
+
*/
|
|
94
|
+
declare class IpBlacklistGuard implements Guard {
|
|
95
|
+
private readonly options;
|
|
96
|
+
constructor(options: IpFilterOptions);
|
|
97
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
98
|
+
}
|
|
99
|
+
interface KVThrottleOptions {
|
|
100
|
+
kv: KVNamespace;
|
|
101
|
+
limit?: number;
|
|
102
|
+
ttl?: number;
|
|
103
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
104
|
+
keyPrefix?: string;
|
|
105
|
+
}
|
|
106
|
+
declare class KVThrottleGuard implements Guard {
|
|
107
|
+
private readonly options;
|
|
108
|
+
private readonly limit;
|
|
109
|
+
private readonly ttl;
|
|
110
|
+
private readonly keyPrefix;
|
|
111
|
+
constructor(options: KVThrottleOptions);
|
|
112
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
113
|
+
private getDefaultKey;
|
|
114
|
+
}
|
|
115
|
+
interface DOThrottleOptions {
|
|
116
|
+
namespace: DurableObjectNamespace;
|
|
117
|
+
limit?: number;
|
|
118
|
+
ttl?: number;
|
|
119
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
120
|
+
shardKeyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
121
|
+
}
|
|
122
|
+
declare class DOThrottleGuard implements Guard {
|
|
123
|
+
private readonly options;
|
|
124
|
+
private readonly limit;
|
|
125
|
+
private readonly ttl;
|
|
126
|
+
constructor(options: DOThrottleOptions);
|
|
127
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
128
|
+
private getDefaultKey;
|
|
129
|
+
private getDefaultShardKey;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Cloudflare Rate Limiting binding interface
|
|
133
|
+
*/
|
|
134
|
+
interface RateLimiter {
|
|
135
|
+
limit(options: {
|
|
136
|
+
key: string;
|
|
137
|
+
}): Promise<{
|
|
138
|
+
success: boolean;
|
|
139
|
+
}>;
|
|
140
|
+
}
|
|
141
|
+
interface CFRateLimitGuardOptions {
|
|
142
|
+
rateLimiter: RateLimiter;
|
|
143
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Guard using Cloudflare's native Rate Limiting binding
|
|
147
|
+
*/
|
|
148
|
+
declare class CFRateLimitGuard implements Guard {
|
|
149
|
+
private readonly options;
|
|
150
|
+
constructor(options: CFRateLimitGuardOptions);
|
|
151
|
+
canActivate(context: ExecutionContextWrapper): Promise<boolean>;
|
|
152
|
+
private getDefaultKey;
|
|
153
|
+
}
|
|
154
|
+
interface RateLimitConfig {
|
|
155
|
+
limit: number;
|
|
156
|
+
window: number;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Decorator to apply rate limiting metadata to a method
|
|
160
|
+
* Use with ThrottleGuard or a custom guard that reads this metadata
|
|
161
|
+
*/
|
|
162
|
+
declare function RateLimit(config: RateLimitConfig): MethodDecorator;
|
|
163
|
+
/**
|
|
164
|
+
* Get rate limit config from metadata
|
|
165
|
+
*/
|
|
166
|
+
declare function getRateLimitConfig(target: object, propertyKey: string | symbol): RateLimitConfig | undefined;
|
|
167
|
+
interface RateLimitResult {
|
|
168
|
+
allowed: boolean;
|
|
169
|
+
remaining: number;
|
|
170
|
+
limit: number;
|
|
171
|
+
reset: number;
|
|
172
|
+
retryAfter?: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Fixed window rate limiter (in-memory)
|
|
176
|
+
*/
|
|
177
|
+
declare class FixedWindowRateLimiter {
|
|
178
|
+
private store;
|
|
179
|
+
check(key: string, limit: number, windowSeconds: number): RateLimitResult;
|
|
180
|
+
reset(key: string): void;
|
|
181
|
+
clear(): void;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Sliding window rate limiter (in-memory)
|
|
185
|
+
* More accurate than fixed window but requires more storage
|
|
186
|
+
*/
|
|
187
|
+
declare class SlidingWindowRateLimiter {
|
|
188
|
+
private store;
|
|
189
|
+
check(key: string, limit: number, windowSeconds: number): RateLimitResult;
|
|
190
|
+
reset(key: string): void;
|
|
191
|
+
clear(): void;
|
|
192
|
+
}
|
|
193
|
+
interface TokenBucketOptions {
|
|
194
|
+
capacity: number;
|
|
195
|
+
refillRate: number;
|
|
196
|
+
refillInterval: number;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Token bucket rate limiter (in-memory)
|
|
200
|
+
* Allows bursts while maintaining average rate
|
|
201
|
+
*/
|
|
202
|
+
declare class TokenBucketRateLimiter {
|
|
203
|
+
private store;
|
|
204
|
+
check(key: string, options: TokenBucketOptions): RateLimitResult;
|
|
205
|
+
reset(key: string): void;
|
|
206
|
+
}
|
|
207
|
+
interface RateLimitKeyOptions {
|
|
208
|
+
prefix?: string;
|
|
209
|
+
suffix?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Utility functions for building rate limit keys
|
|
213
|
+
*/
|
|
214
|
+
declare const RateLimitKeys: {
|
|
215
|
+
fromIp(request: Request, options?: RateLimitKeyOptions): string;
|
|
216
|
+
fromUser(userId: string, options?: RateLimitKeyOptions): string;
|
|
217
|
+
fromApiKey(apiKey: string, options?: RateLimitKeyOptions): string;
|
|
218
|
+
fromPath(request: Request, options?: RateLimitKeyOptions): string;
|
|
219
|
+
fromIpAndPath(request: Request, options?: RateLimitKeyOptions): string;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Create rate limit headers for a response
|
|
223
|
+
*/
|
|
224
|
+
declare function createRateLimitHeaders(result: RateLimitResult): Headers;
|
|
225
|
+
/**
|
|
226
|
+
* Create a 429 Too Many Requests response
|
|
227
|
+
*/
|
|
228
|
+
declare function createRateLimitedResponse(result: RateLimitResult, message?: string): Response;
|
|
229
|
+
|
|
230
|
+
export { ApiKeyGuard, type ApiKeyGuardOptions, AuthGuard, CFRateLimitGuard, type CFRateLimitGuardOptions, DOThrottleGuard, type DOThrottleOptions, FixedWindowRateLimiter, IpBlacklistGuard, type IpFilterOptions, IpWhitelistGuard, JwtGuard, type JwtGuardOptions, KVThrottleGuard, type KVThrottleOptions, RateLimit, type RateLimitConfig, type RateLimitKeyOptions, RateLimitKeys, type RateLimitResult, type RateLimiter, RolesGuard, SlidingWindowRateLimiter, ThrottleGuard, type ThrottleGuardOptions, type TokenBucketOptions, TokenBucketRateLimiter, createRateLimitHeaders, createRateLimitedResponse, getRateLimitConfig };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ApiKeyGuard, AuthGuard, CFRateLimitGuard, DOThrottleGuard, FixedWindowRateLimiter, IpBlacklistGuard, IpWhitelistGuard, JwtGuard, KVThrottleGuard, RateLimit, RateLimitKeys, RolesGuard, SlidingWindowRateLimiter, ThrottleGuard, TokenBucketRateLimiter, createRateLimitHeaders, createRateLimitedResponse, getRateLimitConfig } from '../chunk-JAMM5H7G.js';
|
|
2
|
+
import '../chunk-XUS63JTZ.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DefaultValuePipe, FileValidationPipe, FileValidatorOptions, LowerCasePipe, ParseArrayPipe, ParseBoolPipe, ParseEnumPipe, ParseFloatPipe, ParseIntPipe, ParsePipeOptions, ParseUUIDPipe, TrimPipe, UpperCasePipe, ValidationPipe, ValidationPipeOptions } from './pipes/index.js';
|
|
2
|
+
export { ApiKeyGuard, ApiKeyGuardOptions, AuthGuard, CFRateLimitGuard, CFRateLimitGuardOptions, DOThrottleGuard, DOThrottleOptions, FixedWindowRateLimiter, IpBlacklistGuard, IpFilterOptions, IpWhitelistGuard, JwtGuard, JwtGuardOptions, KVThrottleGuard, KVThrottleOptions, RateLimit, RateLimitConfig, RateLimitKeyOptions, RateLimitKeys, RateLimitResult, RolesGuard, SlidingWindowRateLimiter, ThrottleGuard, ThrottleGuardOptions, TokenBucketOptions, TokenBucketRateLimiter, createRateLimitHeaders, createRateLimitedResponse, getRateLimitConfig } from './guards/index.js';
|
|
3
|
+
export { CacheInterceptor, CacheInterceptorOptions, ClassSerializerInterceptor, DOCacheInterceptor, DOCacheOptions, ExcludeNullInterceptor, KVCacheInterceptor, KVCacheOptions, LoggingInterceptor, LoggingInterceptorOptions, ResponseWrapperInterceptor, ResponseWrapperOptions, TimeoutInterceptor, TimeoutInterceptorOptions, TransformInterceptor } from './interceptors/index.js';
|
|
4
|
+
export { base64Decode, base64Encode, base64UrlDecode, base64UrlEncode, camelCase, chunk, constantTimeEqual, deepClone, deepMerge, get, groupBy, hexDecode, hexEncode, hmac, isEmail, isEmpty, isIpv4, isUrl, isUuid, kebabCase, omit, parallel, pascalCase, pick, randomString, retry, set, sha256, sha512, shuffle, sleep, slugify, snakeCase, truncate, unique, uuid } from './utils/index.js';
|
|
5
|
+
import '@flareone/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DefaultValuePipe, FileValidationPipe, LowerCasePipe, ParseArrayPipe, ParseBoolPipe, ParseEnumPipe, ParseFloatPipe, ParseIntPipe, ParseUUIDPipe, TrimPipe, UpperCasePipe, ValidationPipe } from './chunk-4TE4W4RZ.js';
|
|
2
|
+
export { ApiKeyGuard, AuthGuard, CFRateLimitGuard, DOThrottleGuard, FixedWindowRateLimiter, IpBlacklistGuard, IpWhitelistGuard, JwtGuard, KVThrottleGuard, RateLimit, RateLimitKeys, RolesGuard, SlidingWindowRateLimiter, ThrottleGuard, TokenBucketRateLimiter, createRateLimitHeaders, createRateLimitedResponse, getRateLimitConfig } from './chunk-JAMM5H7G.js';
|
|
3
|
+
export { CacheInterceptor, ClassSerializerInterceptor, DOCacheInterceptor, ExcludeNullInterceptor, KVCacheInterceptor, LoggingInterceptor, ResponseWrapperInterceptor, TimeoutInterceptor, TransformInterceptor } from './chunk-TLAV6QIM.js';
|
|
4
|
+
export { base64Decode, base64Encode, base64UrlDecode, base64UrlEncode, camelCase, chunk, constantTimeEqual, deepClone, deepMerge, get, groupBy, hexDecode, hexEncode, hmac, isEmail, isEmpty, isIpv4, isUrl, isUuid, kebabCase, omit, parallel, pascalCase, pick, randomString, retry, set, sha256, sha512, shuffle, sleep, slugify, snakeCase, truncate, unique, uuid } from './chunk-VDUV5SQH.js';
|
|
5
|
+
import './chunk-XUS63JTZ.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Interceptor, ExecutionContextWrapper, CallHandler } from '@flareone/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Interceptors
|
|
5
|
+
* middleware but cooler.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface LoggingInterceptorOptions {
|
|
9
|
+
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
10
|
+
includeBody?: boolean;
|
|
11
|
+
includeResponse?: boolean;
|
|
12
|
+
logger?: (message: string, data?: Record<string, unknown>) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Logging interceptor for request/response logging
|
|
16
|
+
*/
|
|
17
|
+
declare class LoggingInterceptor implements Interceptor {
|
|
18
|
+
private readonly options;
|
|
19
|
+
constructor(options?: LoggingInterceptorOptions);
|
|
20
|
+
intercept(context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
21
|
+
private log;
|
|
22
|
+
}
|
|
23
|
+
interface TimeoutInterceptorOptions {
|
|
24
|
+
timeout: number;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Timeout interceptor
|
|
29
|
+
*/
|
|
30
|
+
declare class TimeoutInterceptor implements Interceptor {
|
|
31
|
+
private readonly options;
|
|
32
|
+
constructor(options: TimeoutInterceptorOptions);
|
|
33
|
+
intercept(_context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
interface CacheInterceptorOptions {
|
|
36
|
+
ttl?: number;
|
|
37
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
38
|
+
methods?: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* In-memory cache interceptor
|
|
42
|
+
* For production, use KV or other distributed cache
|
|
43
|
+
*/
|
|
44
|
+
declare class CacheInterceptor implements Interceptor {
|
|
45
|
+
private readonly cache;
|
|
46
|
+
private readonly ttl;
|
|
47
|
+
private readonly methods;
|
|
48
|
+
constructor(options?: CacheInterceptorOptions);
|
|
49
|
+
intercept(context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
50
|
+
private generateKey;
|
|
51
|
+
/**
|
|
52
|
+
* Clear the cache
|
|
53
|
+
*/
|
|
54
|
+
clear(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Invalidate a specific key
|
|
57
|
+
*/
|
|
58
|
+
invalidate(key: string): void;
|
|
59
|
+
}
|
|
60
|
+
interface TransformInterceptorOptions<T, R> {
|
|
61
|
+
transform: (data: T) => R | Promise<R>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Generic transform interceptor
|
|
65
|
+
*/
|
|
66
|
+
declare class TransformInterceptor<T = unknown, R = unknown> implements Interceptor {
|
|
67
|
+
private readonly transformer;
|
|
68
|
+
constructor(transformer: (data: T) => R | Promise<R>);
|
|
69
|
+
intercept(_context: ExecutionContextWrapper, next: CallHandler<T>): Promise<R>;
|
|
70
|
+
}
|
|
71
|
+
interface ResponseWrapperOptions {
|
|
72
|
+
dataKey?: string;
|
|
73
|
+
includeMetadata?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Wrap response in standard format
|
|
77
|
+
*/
|
|
78
|
+
declare class ResponseWrapperInterceptor implements Interceptor {
|
|
79
|
+
private readonly options;
|
|
80
|
+
constructor(options?: ResponseWrapperOptions);
|
|
81
|
+
intercept(context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Remove null and undefined values from response
|
|
85
|
+
*/
|
|
86
|
+
declare class ExcludeNullInterceptor implements Interceptor {
|
|
87
|
+
intercept(_context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
88
|
+
private removeNulls;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Serialize class instances to plain objects
|
|
92
|
+
*/
|
|
93
|
+
declare class ClassSerializerInterceptor implements Interceptor {
|
|
94
|
+
intercept(_context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
95
|
+
private serialize;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* KV-based cache interceptor for distributed caching
|
|
99
|
+
*/
|
|
100
|
+
interface KVCacheOptions {
|
|
101
|
+
kv: KVNamespace;
|
|
102
|
+
ttl?: number;
|
|
103
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
104
|
+
methods?: string[];
|
|
105
|
+
keyPrefix?: string;
|
|
106
|
+
}
|
|
107
|
+
declare class KVCacheInterceptor implements Interceptor {
|
|
108
|
+
private readonly options;
|
|
109
|
+
private readonly ttl;
|
|
110
|
+
private readonly methods;
|
|
111
|
+
private readonly keyPrefix;
|
|
112
|
+
constructor(options: KVCacheOptions);
|
|
113
|
+
intercept(context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
114
|
+
private generateKey;
|
|
115
|
+
/**
|
|
116
|
+
* Invalidate cache by key
|
|
117
|
+
*/
|
|
118
|
+
invalidate(key: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Invalidate cache by prefix
|
|
121
|
+
*/
|
|
122
|
+
invalidateByPrefix(prefix: string): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Durable Object-based cache interceptor for advanced caching
|
|
126
|
+
*/
|
|
127
|
+
interface DOCacheOptions {
|
|
128
|
+
namespace: DurableObjectNamespace;
|
|
129
|
+
ttl?: number;
|
|
130
|
+
keyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
131
|
+
methods?: string[];
|
|
132
|
+
shardKeyGenerator?: (context: ExecutionContextWrapper) => string;
|
|
133
|
+
}
|
|
134
|
+
declare class DOCacheInterceptor implements Interceptor {
|
|
135
|
+
private readonly options;
|
|
136
|
+
private readonly ttl;
|
|
137
|
+
private readonly methods;
|
|
138
|
+
constructor(options: DOCacheOptions);
|
|
139
|
+
intercept(context: ExecutionContextWrapper, next: CallHandler): Promise<unknown>;
|
|
140
|
+
private generateKey;
|
|
141
|
+
/**
|
|
142
|
+
* Invalidate cache
|
|
143
|
+
*/
|
|
144
|
+
invalidate(key: string, shardKey?: string): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Clear all cache in a shard
|
|
147
|
+
*/
|
|
148
|
+
clear(shardKey?: string): Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { CacheInterceptor, type CacheInterceptorOptions, ClassSerializerInterceptor, DOCacheInterceptor, type DOCacheOptions, ExcludeNullInterceptor, KVCacheInterceptor, type KVCacheOptions, LoggingInterceptor, type LoggingInterceptorOptions, ResponseWrapperInterceptor, type ResponseWrapperOptions, TimeoutInterceptor, type TimeoutInterceptorOptions, TransformInterceptor, type TransformInterceptorOptions };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CacheInterceptor, ClassSerializerInterceptor, DOCacheInterceptor, ExcludeNullInterceptor, KVCacheInterceptor, LoggingInterceptor, ResponseWrapperInterceptor, TimeoutInterceptor, TransformInterceptor } from '../chunk-TLAV6QIM.js';
|
|
2
|
+
import '../chunk-XUS63JTZ.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { PipeTransform, ArgumentMetadata } from '@flareone/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Pipes
|
|
5
|
+
* simple data transformations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface ParsePipeOptions {
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
optional?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse and validate integer values
|
|
14
|
+
*/
|
|
15
|
+
declare class ParseIntPipe implements PipeTransform<string, number> {
|
|
16
|
+
private readonly options;
|
|
17
|
+
constructor(options?: ParsePipeOptions);
|
|
18
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parse and validate float values
|
|
22
|
+
*/
|
|
23
|
+
declare class ParseFloatPipe implements PipeTransform<string, number> {
|
|
24
|
+
private readonly options;
|
|
25
|
+
constructor(options?: ParsePipeOptions);
|
|
26
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse and validate boolean values
|
|
30
|
+
*/
|
|
31
|
+
declare class ParseBoolPipe implements PipeTransform<string | boolean, boolean> {
|
|
32
|
+
private readonly options;
|
|
33
|
+
constructor(options?: ParsePipeOptions);
|
|
34
|
+
transform(value: string | boolean, metadata: ArgumentMetadata): boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse and validate UUID values
|
|
38
|
+
*/
|
|
39
|
+
declare class ParseUUIDPipe implements PipeTransform<string, string> {
|
|
40
|
+
private readonly options;
|
|
41
|
+
private static readonly UUID_REGEX;
|
|
42
|
+
constructor(options?: ParsePipeOptions);
|
|
43
|
+
transform(value: string, metadata: ArgumentMetadata): string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse array from comma-separated string
|
|
47
|
+
*/
|
|
48
|
+
declare class ParseArrayPipe implements PipeTransform<string, string[]> {
|
|
49
|
+
private readonly options;
|
|
50
|
+
constructor(options?: ParsePipeOptions & {
|
|
51
|
+
separator?: string;
|
|
52
|
+
});
|
|
53
|
+
transform(value: string, _metadata: ArgumentMetadata): string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse and validate enum values
|
|
57
|
+
*/
|
|
58
|
+
declare class ParseEnumPipe<T extends Record<string, string | number>> implements PipeTransform<string, T[keyof T]> {
|
|
59
|
+
private readonly options;
|
|
60
|
+
private readonly allowedValues;
|
|
61
|
+
constructor(enumType: T, options?: ParsePipeOptions);
|
|
62
|
+
transform(value: string, metadata: ArgumentMetadata): T[keyof T];
|
|
63
|
+
}
|
|
64
|
+
interface ValidationPipeOptions {
|
|
65
|
+
whitelist?: boolean;
|
|
66
|
+
forbidNonWhitelisted?: boolean;
|
|
67
|
+
transform?: boolean;
|
|
68
|
+
groups?: string[];
|
|
69
|
+
skipMissingProperties?: boolean;
|
|
70
|
+
skipUndefinedProperties?: boolean;
|
|
71
|
+
skipNullProperties?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Simple validation pipe using schema definition
|
|
75
|
+
*/
|
|
76
|
+
declare class ValidationPipe implements PipeTransform {
|
|
77
|
+
private readonly options;
|
|
78
|
+
constructor(options?: ValidationPipeOptions);
|
|
79
|
+
transform(value: unknown, _metadata: ArgumentMetadata): unknown;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Default value pipe - provides a default when value is missing
|
|
83
|
+
*/
|
|
84
|
+
declare class DefaultValuePipe<T = unknown> implements PipeTransform<T, T> {
|
|
85
|
+
private readonly defaultValue;
|
|
86
|
+
constructor(defaultValue: T);
|
|
87
|
+
transform(value: T): T;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Trim pipe - trims whitespace from strings
|
|
91
|
+
*/
|
|
92
|
+
declare class TrimPipe implements PipeTransform<string, string> {
|
|
93
|
+
transform(value: string): string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Lowercase pipe - converts strings to lowercase
|
|
97
|
+
*/
|
|
98
|
+
declare class LowerCasePipe implements PipeTransform<string, string> {
|
|
99
|
+
transform(value: string): string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Uppercase pipe - converts strings to uppercase
|
|
103
|
+
*/
|
|
104
|
+
declare class UpperCasePipe implements PipeTransform<string, string> {
|
|
105
|
+
transform(value: string): string;
|
|
106
|
+
}
|
|
107
|
+
interface FileValidatorOptions {
|
|
108
|
+
maxSize?: number;
|
|
109
|
+
mimeTypes?: string[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* File validation pipe
|
|
113
|
+
*/
|
|
114
|
+
declare class FileValidationPipe implements PipeTransform {
|
|
115
|
+
private readonly options;
|
|
116
|
+
constructor(options?: FileValidatorOptions);
|
|
117
|
+
transform(value: unknown, _metadata: ArgumentMetadata): Promise<unknown>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { DefaultValuePipe, FileValidationPipe, type FileValidatorOptions, LowerCasePipe, ParseArrayPipe, ParseBoolPipe, ParseEnumPipe, ParseFloatPipe, ParseIntPipe, type ParsePipeOptions, ParseUUIDPipe, TrimPipe, UpperCasePipe, ValidationPipe, type ValidationPipeOptions };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DefaultValuePipe, FileValidationPipe, LowerCasePipe, ParseArrayPipe, ParseBoolPipe, ParseEnumPipe, ParseFloatPipe, ParseIntPipe, ParseUUIDPipe, TrimPipe, UpperCasePipe, ValidationPipe } from '../chunk-4TE4W4RZ.js';
|
|
2
|
+
import '../chunk-XUS63JTZ.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|