@nauth-toolkit/core 0.1.95 → 0.1.98

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.
Files changed (33) hide show
  1. package/dist/interfaces/config.interface.d.ts +0 -47
  2. package/dist/interfaces/config.interface.d.ts.map +1 -1
  3. package/dist/interfaces/provider.interface.d.ts +8 -1
  4. package/dist/interfaces/provider.interface.d.ts.map +1 -1
  5. package/dist/interfaces/template.interface.d.ts +3 -1
  6. package/dist/interfaces/template.interface.d.ts.map +1 -1
  7. package/dist/interfaces/template.interface.js +2 -0
  8. package/dist/interfaces/template.interface.js.map +1 -1
  9. package/dist/platform/interfaces.d.ts +0 -2
  10. package/dist/platform/interfaces.d.ts.map +1 -1
  11. package/dist/services/auth-challenge-helper.service.d.ts.map +1 -1
  12. package/dist/services/auth-challenge-helper.service.js +2 -3
  13. package/dist/services/auth-challenge-helper.service.js.map +1 -1
  14. package/dist/services/auth-service-internal-helpers.d.ts +13 -7
  15. package/dist/services/auth-service-internal-helpers.d.ts.map +1 -1
  16. package/dist/services/auth-service-internal-helpers.js +17 -32
  17. package/dist/services/auth-service-internal-helpers.js.map +1 -1
  18. package/dist/services/email-verification.service.d.ts +8 -0
  19. package/dist/services/email-verification.service.d.ts.map +1 -1
  20. package/dist/services/email-verification.service.js +124 -0
  21. package/dist/services/email-verification.service.js.map +1 -1
  22. package/dist/templates/index.d.ts +2 -1
  23. package/dist/templates/index.d.ts.map +1 -1
  24. package/dist/templates/index.js +2 -1
  25. package/dist/templates/index.js.map +1 -1
  26. package/dist/validators/template.validator.d.ts.map +1 -1
  27. package/dist/validators/template.validator.js +1 -0
  28. package/dist/validators/template.validator.js.map +1 -1
  29. package/package.json +2 -2
  30. package/dist/templates/html-template.engine.d.ts +0 -126
  31. package/dist/templates/html-template.engine.d.ts.map +0 -1
  32. package/dist/templates/html-template.engine.js +0 -711
  33. package/dist/templates/html-template.engine.js.map +0 -1
@@ -1,126 +0,0 @@
1
- import { TemplateEngine, TemplateType, TemplateVariables, EmailTemplate } from '../interfaces/template.interface';
2
- /**
3
- * HTML Template Engine
4
- *
5
- * Simple yet powerful template engine for email templates using HTML with placeholder tokens.
6
- * Supports {{variable}} syntax for variable injection.
7
- *
8
- * Features:
9
- * - Simple {{variable}} placeholder syntax
10
- * - Built-in default templates for all email types
11
- * - Custom template registration
12
- * - Automatic HTML entity escaping for security
13
- * - Plain text generation from HTML
14
- *
15
- * @example
16
- * ```typescript
17
- * const engine = new HtmlTemplateEngine();
18
- * const result = await engine.render(
19
- * TemplateType.VERIFICATION,
20
- * { userName: 'John', code: '123456', expiryMinutes: 60 }
21
- * );
22
- * ```
23
- */
24
- export declare class HtmlTemplateEngine implements TemplateEngine {
25
- /**
26
- * Storage for registered templates
27
- * Maps template type to template definition
28
- */
29
- private templates;
30
- /**
31
- * Constructor
32
- * Initializes the engine with default templates
33
- */
34
- constructor();
35
- /**
36
- * Render a template with variables
37
- *
38
- * Replaces all {{variable}} placeholders with actual values.
39
- * Variables are HTML-escaped for security.
40
- * Handles firstName/username fallback for greetings.
41
- *
42
- * @param type - Template type to render
43
- * @param variables - Variables to inject
44
- * @returns Rendered email template
45
- * @throws {Error} If template type not found
46
- */
47
- render(type: TemplateType | string, variables: TemplateVariables): Promise<EmailTemplate>;
48
- /**
49
- * Register a custom template
50
- *
51
- * @param type - Template type identifier
52
- * @param template - Template definition
53
- */
54
- registerTemplate(type: TemplateType | string, template: EmailTemplate): void;
55
- /**
56
- * Get all available template types
57
- *
58
- * @returns Array of template type identifiers
59
- */
60
- getAvailableTemplates(): string[];
61
- /**
62
- * Check if a template exists
63
- *
64
- * @param type - Template type to check
65
- * @returns True if template is registered
66
- */
67
- hasTemplate(type: TemplateType | string): boolean;
68
- /**
69
- * Replace {{variable}} placeholders with values
70
- *
71
- * Escapes HTML entities in variables for security.
72
- * Handles missing variables gracefully (replaces with empty string).
73
- * Supports firstName/username fallback logic and simple conditionals.
74
- *
75
- * @param template - Template string with {{placeholders}}
76
- * @param variables - Variables to inject
77
- * @returns Template with variables replaced
78
- * @private
79
- */
80
- private replaceVariables;
81
- /**
82
- * Replace {{variable}} placeholders with values for text content
83
- *
84
- * Similar to replaceVariables but doesn't escape HTML entities for plain text.
85
- *
86
- * @param template - Template string with {{placeholders}}
87
- * @param variables - Variables to inject
88
- * @returns Template with variables replaced
89
- * @private
90
- */
91
- private replaceVariablesForText;
92
- /**
93
- * Get greeting name with firstName/username fallback logic
94
- *
95
- * @param variables - Template variables
96
- * @returns Greeting name or empty string
97
- * @private
98
- */
99
- private getGreetingName;
100
- /**
101
- * Escape HTML entities to prevent XSS
102
- *
103
- * @param text - Text to escape
104
- * @returns HTML-safe text
105
- * @private
106
- */
107
- private escapeHtml;
108
- /**
109
- * Convert HTML to plain text
110
- *
111
- * Simple conversion: strips HTML tags and decodes entities.
112
- *
113
- * @param html - HTML content
114
- * @returns Plain text
115
- * @private
116
- */
117
- private htmlToText;
118
- /**
119
- * Register default templates for all email types
120
- *
121
- * These templates can be overridden using registerTemplate().
122
- * @private
123
- */
124
- private registerDefaultTemplates;
125
- }
126
- //# sourceMappingURL=html-template.engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-template.engine.d.ts","sourceRoot":"","sources":["../../src/templates/html-template.engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAIlH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAyC;IAE1D;;;OAGG;;IAKH;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IA2B/F;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAI5E;;;;OAIG;IACH,qBAAqB,IAAI,MAAM,EAAE;IAIjC;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO;IAIjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,gBAAgB;IAgCxB;;;;;;;;;OASG;IACH,OAAO,CAAC,uBAAuB;IAgC/B;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAUvB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAYlB;;;;;;;;OAQG;IACH,OAAO,CAAC,UAAU;IAkBlB;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;CAsejC"}