@hed-hog/core 0.0.329 → 0.0.330
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/ai/ai.service.d.ts +1 -1
- package/dist/auth/auth.controller.d.ts +23 -23
- package/dist/auth/auth.service.d.ts +41 -41
- package/dist/challenge/challenge.service.d.ts +14 -14
- package/dist/core/system.controller.d.ts +2 -2
- package/dist/core/system.service.d.ts +2 -2
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +7 -4
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +87 -87
- package/dist/dashboard/dashboard/dashboard.service.d.ts +87 -87
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +33 -33
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +33 -33
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +42 -42
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +42 -42
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +12 -12
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +12 -12
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +7 -7
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +7 -7
- package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts +33 -33
- package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts +33 -33
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
- package/dist/file/file.controller.d.ts +8 -8
- package/dist/file/file.service.d.ts +18 -18
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/mail/mail.controller.d.ts +15 -15
- package/dist/mail/mail.service.d.ts +15 -15
- package/dist/mail-profile/mail-profile.controller.d.ts +9 -9
- package/dist/mail-profile/mail-profile.service.d.ts +9 -9
- package/dist/mail-sent/mail-sent.controller.d.ts +17 -17
- package/dist/mail-sent/mail-sent.service.d.ts +17 -17
- package/dist/mcp-chat/mcp-chat.controller.d.ts +10 -10
- package/dist/mcp-chat/mcp-chat.service.d.ts +10 -10
- package/dist/menu/menu.controller.d.ts +11 -11
- package/dist/menu/menu.service.d.ts +11 -11
- package/dist/oauth/oauth.service.js +1 -1
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/pdf/components/index.d.ts +57 -0
- package/dist/pdf/components/index.d.ts.map +1 -0
- package/dist/pdf/components/index.js +258 -0
- package/dist/pdf/components/index.js.map +1 -0
- package/dist/pdf/dto/generate-pdf.dto.d.ts +5 -0
- package/dist/pdf/dto/generate-pdf.dto.d.ts.map +1 -0
- package/dist/pdf/dto/generate-pdf.dto.js +27 -0
- package/dist/pdf/dto/generate-pdf.dto.js.map +1 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.d.ts +10 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.d.ts.map +1 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.js +3 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.js.map +1 -0
- package/dist/pdf/pdf.controller.d.ts +16 -0
- package/dist/pdf/pdf.controller.d.ts.map +1 -0
- package/dist/pdf/pdf.controller.js +100 -0
- package/dist/pdf/pdf.controller.js.map +1 -0
- package/dist/pdf/pdf.module.d.ts +3 -0
- package/dist/pdf/pdf.module.d.ts.map +1 -0
- package/dist/pdf/pdf.module.js +29 -0
- package/dist/pdf/pdf.module.js.map +1 -0
- package/dist/pdf/pdf.service.d.ts +44 -0
- package/dist/pdf/pdf.service.d.ts.map +1 -0
- package/dist/pdf/pdf.service.js +185 -0
- package/dist/pdf/pdf.service.js.map +1 -0
- package/dist/pdf/templates/hcode-institutional.template.d.ts +36 -0
- package/dist/pdf/templates/hcode-institutional.template.d.ts.map +1 -0
- package/dist/pdf/templates/hcode-institutional.template.js +67 -0
- package/dist/pdf/templates/hcode-institutional.template.js.map +1 -0
- package/dist/pdf/themes/hcode.theme.d.ts +25 -0
- package/dist/pdf/themes/hcode.theme.d.ts.map +1 -0
- package/dist/pdf/themes/hcode.theme.js +504 -0
- package/dist/pdf/themes/hcode.theme.js.map +1 -0
- package/dist/profile/profile.controller.d.ts +17 -17
- package/dist/profile/profile.service.d.ts +17 -17
- package/dist/role/role.controller.d.ts +12 -12
- package/dist/role/role.service.d.ts +12 -12
- package/dist/screen/screen.controller.d.ts +3 -3
- package/dist/screen/screen.service.d.ts +3 -3
- package/dist/session/session.controller.d.ts +4 -4
- package/dist/session/session.service.d.ts +12 -12
- package/dist/setting/setting.controller.d.ts +13 -13
- package/dist/setting/setting.service.d.ts +13 -13
- package/dist/user/user.controller.d.ts +24 -24
- package/dist/user/user.service.d.ts +55 -55
- package/hedhog/data/route.yaml +8 -0
- package/hedhog/data/setting_group.yaml +60 -0
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +574 -574
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +5 -9
- package/hedhog/frontend/messages/en.json +2 -0
- package/hedhog/frontend/messages/pt.json +2 -0
- package/package.json +4 -4
- package/src/core.module.ts +7 -4
- package/src/index.ts +9 -6
- package/src/oauth/oauth.service.ts +12 -12
- package/src/pdf/components/index.ts +316 -0
- package/src/pdf/dto/generate-pdf.dto.ts +11 -0
- package/src/pdf/interfaces/pdf-theme-config.interface.ts +10 -0
- package/src/pdf/pdf.controller.ts +86 -0
- package/src/pdf/pdf.module.ts +17 -0
- package/src/pdf/pdf.service.ts +229 -0
- package/src/pdf/templates/hcode-institutional.template.ts +122 -0
- package/src/pdf/themes/hcode.theme.ts +515 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildLogoHtml = buildLogoHtml;
|
|
4
|
+
exports.pageShell = pageShell;
|
|
5
|
+
exports.coverPage = coverPage;
|
|
6
|
+
exports.pageAccentBar = pageAccentBar;
|
|
7
|
+
exports.pageHeader = pageHeader;
|
|
8
|
+
exports.sectionHeader = sectionHeader;
|
|
9
|
+
exports.purposeBlock = purposeBlock;
|
|
10
|
+
exports.featureCards = featureCards;
|
|
11
|
+
exports.chip = chip;
|
|
12
|
+
exports.dataTable = dataTable;
|
|
13
|
+
exports.metadataBlock = metadataBlock;
|
|
14
|
+
exports.signatureArea = signatureArea;
|
|
15
|
+
exports.pdfFooter = pdfFooter;
|
|
16
|
+
const hcode_theme_1 = require("../themes/hcode.theme");
|
|
17
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
18
|
+
// Inline SVG icon paths (24×24 viewBox, stroke-width 2.2 — Design System spec)
|
|
19
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
20
|
+
const ICON_PATHS = {
|
|
21
|
+
discovery: '<circle cx="11" cy="11" r="8" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
22
|
+
'<line x1="16.5" y1="16.5" x2="22" y2="22" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/>',
|
|
23
|
+
strategy: '<rect x="3" y="12" width="4" height="9" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
24
|
+
'<rect x="10" y="7" width="4" height="14" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
25
|
+
'<rect x="17" y="3" width="4" height="18" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>',
|
|
26
|
+
governance: '<polygon points="12,2 22,7 22,17 12,22 2,17 2,7" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
27
|
+
'<polygon points="12,7 17,9.5 17,14.5 12,17 7,14.5 7,9.5" stroke="currentColor" stroke-width="2.2" fill="none"/>',
|
|
28
|
+
training: '<path d="M22 10v6m0 0l-10 5-10-5V10l10 5 10-5z" stroke="currentColor" stroke-width="2.2" fill="none" stroke-linejoin="round"/>',
|
|
29
|
+
curriculum: '<rect x="2" y="3" width="20" height="14" rx="2" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
30
|
+
'<line x1="7" y1="8" x2="17" y2="8" stroke="currentColor" stroke-width="2.2"/>' +
|
|
31
|
+
'<line x1="7" y1="12" x2="13" y2="12" stroke="currentColor" stroke-width="2.2"/>',
|
|
32
|
+
agents: '<circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
33
|
+
'<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
34
|
+
'<line x1="12" y1="3" x2="12" y2="1" stroke="currentColor" stroke-width="2.2"/>' +
|
|
35
|
+
'<line x1="12" y1="23" x2="12" y2="21" stroke="currentColor" stroke-width="2.2"/>' +
|
|
36
|
+
'<line x1="3" y1="12" x2="1" y2="12" stroke="currentColor" stroke-width="2.2"/>' +
|
|
37
|
+
'<line x1="23" y1="12" x2="21" y2="12" stroke="currentColor" stroke-width="2.2"/>',
|
|
38
|
+
datasets: '<rect x="3" y="3" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
39
|
+
'<rect x="13" y="3" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
40
|
+
'<rect x="3" y="13" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
41
|
+
'<rect x="13" y="13" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>',
|
|
42
|
+
impact: '<polyline points="22,12 18,12 15,21 9,3 6,12 2,12" stroke="currentColor" stroke-width="2.2" fill="none" ' +
|
|
43
|
+
'stroke-linecap="round" stroke-linejoin="round"/>',
|
|
44
|
+
experiment: '<path d="M9 3h6M9 3v7L4.5 17A2 2 0 006.4 20h11.2a2 2 0 001.9-3L15 10V3" ' +
|
|
45
|
+
'stroke="currentColor" stroke-width="2.2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>',
|
|
46
|
+
default: '<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
47
|
+
'<line x1="12" y1="8" x2="12" y2="12" stroke="currentColor" stroke-width="2.2"/>' +
|
|
48
|
+
'<circle cx="12" cy="16" r="0.8" fill="currentColor"/>',
|
|
49
|
+
};
|
|
50
|
+
function inlineSvgIcon(name) {
|
|
51
|
+
var _a;
|
|
52
|
+
const path = (_a = ICON_PATHS[name]) !== null && _a !== void 0 ? _a : ICON_PATHS.default;
|
|
53
|
+
return (`<svg width="17" height="17" viewBox="0 0 24 24" fill="none" ` +
|
|
54
|
+
`xmlns="http://www.w3.org/2000/svg">${path}</svg>`);
|
|
55
|
+
}
|
|
56
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
57
|
+
// Logo
|
|
58
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
59
|
+
/**
|
|
60
|
+
* Builds the logo HTML.
|
|
61
|
+
* If the admin has set a pdf-logo URL/data-URI → renders <img>.
|
|
62
|
+
* Otherwise renders the CSS-based wordmark from the Design System spec.
|
|
63
|
+
*/
|
|
64
|
+
function buildLogoHtml(config, compact = false) {
|
|
65
|
+
if (config.logoOverride) {
|
|
66
|
+
const h = compact ? '28px' : '36px';
|
|
67
|
+
return (`<img src="${config.logoOverride}" alt="${config.companyName}" ` +
|
|
68
|
+
`style="max-height:${h};max-width:140px;object-fit:contain;">`);
|
|
69
|
+
}
|
|
70
|
+
if (compact) {
|
|
71
|
+
// Header-size lockup
|
|
72
|
+
return `<div style="display:flex;flex-direction:column;gap:2px;">
|
|
73
|
+
<div style="font-family:'Inter',sans-serif;font-weight:300;font-size:22px;letter-spacing:-0.01em;line-height:1;">
|
|
74
|
+
<span style="color:var(--primary)">h</span><span style="color:var(--ink-3)">code</span>
|
|
75
|
+
</div>
|
|
76
|
+
<div style="font-family:'Inter',sans-serif;font-weight:400;font-size:7px;letter-spacing:0.30em;text-transform:uppercase;color:var(--primary);">${config.area.toUpperCase()}</div>
|
|
77
|
+
</div>`;
|
|
78
|
+
}
|
|
79
|
+
return `<div class="lockup">
|
|
80
|
+
<div class="lockup-wordmark">
|
|
81
|
+
<span class="glyph">h</span><span class="wordmark">code</span>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="lockup-area">${config.area.toUpperCase()}</div>
|
|
84
|
+
</div>`;
|
|
85
|
+
}
|
|
86
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
// Page shell
|
|
88
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
89
|
+
/** Wraps everything in a complete HTML document with fonts + theme CSS. */
|
|
90
|
+
function pageShell(extraHead, body, config) {
|
|
91
|
+
return `<!DOCTYPE html>
|
|
92
|
+
<html lang="pt-BR">
|
|
93
|
+
<head>
|
|
94
|
+
<meta charset="UTF-8">
|
|
95
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
96
|
+
${(0, hcode_theme_1.buildFontImport)()}
|
|
97
|
+
${(0, hcode_theme_1.buildThemeCss)(config)}
|
|
98
|
+
${extraHead}
|
|
99
|
+
</head>
|
|
100
|
+
<body>
|
|
101
|
+
${body}
|
|
102
|
+
</body>
|
|
103
|
+
</html>`;
|
|
104
|
+
}
|
|
105
|
+
/** Full-bleed A4 cover with Design System two-column layout. */
|
|
106
|
+
function coverPage(config, data) {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
const date = (_a = data.dateLabel) !== null && _a !== void 0 ? _a : new Date()
|
|
109
|
+
.toLocaleDateString('pt-BR', { month: 'long', year: 'numeric' })
|
|
110
|
+
.toUpperCase();
|
|
111
|
+
const areas = [
|
|
112
|
+
{ num: '01', label: 'CONSULTING' },
|
|
113
|
+
{ num: '02', label: 'TRAINING' },
|
|
114
|
+
{ num: '03', label: 'RESEARCH' },
|
|
115
|
+
];
|
|
116
|
+
return `<div class="cover">
|
|
117
|
+
<!-- LEFT: white, content -->
|
|
118
|
+
<div class="cover-left">
|
|
119
|
+
<div>
|
|
120
|
+
<div class="t-meta" style="margin-bottom:40px;">DESIGN SYSTEM · V1.0 · ${date}</div>
|
|
121
|
+
${buildLogoHtml(config)}
|
|
122
|
+
<div style="margin-top:32px;margin-bottom:20px;">
|
|
123
|
+
<div class="t-display">${data.title}</div>
|
|
124
|
+
</div>
|
|
125
|
+
${data.subtitle ? `<div class="t-body" style="max-width:340px;font-size:12px;">${data.subtitle}</div>` : ''}
|
|
126
|
+
</div>
|
|
127
|
+
<div class="t-micro">${(_b = data.bottomMeta) !== null && _b !== void 0 ? _b : 'HCODE · CNPJ 24.700.731/0001-08'}</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<!-- RIGHT: primary color, glyph + area list -->
|
|
131
|
+
<div class="cover-right">
|
|
132
|
+
<div class="cover-system-label">HCODE / SYSTEM</div>
|
|
133
|
+
<div class="cover-release-label">RELEASE 01</div>
|
|
134
|
+
<div class="cover-right-glyph">h</div>
|
|
135
|
+
<ul class="cover-right-areas">
|
|
136
|
+
${areas
|
|
137
|
+
.map((a) => `<li><span class="num">0${areas.indexOf(a) + 1}</span>${a.label}</li>`)
|
|
138
|
+
.join('')}
|
|
139
|
+
</ul>
|
|
140
|
+
</div>
|
|
141
|
+
</div>`;
|
|
142
|
+
}
|
|
143
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
144
|
+
// Page header (accent bar + logo row)
|
|
145
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
146
|
+
/** Thin primary-colored bar at the very top of a content page. */
|
|
147
|
+
function pageAccentBar() {
|
|
148
|
+
return `<div class="page-accent-bar"></div>`;
|
|
149
|
+
}
|
|
150
|
+
/** Header row: compact logo lockup on the left, page title (meta) on the right.
|
|
151
|
+
* Matches Design System pattern: logo | ● PAGE · TITLE
|
|
152
|
+
*/
|
|
153
|
+
function pageHeader(config, pageTitle) {
|
|
154
|
+
return `<div class="page-header">
|
|
155
|
+
${buildLogoHtml(config, true)}
|
|
156
|
+
<div style="display:flex;align-items:center;gap:6px;">
|
|
157
|
+
<span style="display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--primary);flex-shrink:0;"></span>
|
|
158
|
+
<div class="t-meta" style="color:var(--ink-3);">${pageTitle.toUpperCase()}</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>`;
|
|
161
|
+
}
|
|
162
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
163
|
+
// Section header
|
|
164
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
165
|
+
/** Eyebrow + H2 title with primary-color left accent bar — Design System spec. */
|
|
166
|
+
function sectionHeader(eyebrow, title) {
|
|
167
|
+
return `<div class="section-header">
|
|
168
|
+
<div class="t-eyebrow">${eyebrow}</div>
|
|
169
|
+
<div class="t-h2">${title}</div>
|
|
170
|
+
</div>`;
|
|
171
|
+
}
|
|
172
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
173
|
+
// Purpose block
|
|
174
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
175
|
+
/** Full-width colored block (primary background) with eyebrow, title and body. */
|
|
176
|
+
function purposeBlock(eyebrow, title, body) {
|
|
177
|
+
return `<div class="purpose-block no-break">
|
|
178
|
+
<div class="t-eyebrow">${eyebrow}</div>
|
|
179
|
+
<div class="t-h3">${title}</div>
|
|
180
|
+
<div class="t-body">${body}</div>
|
|
181
|
+
</div>`;
|
|
182
|
+
}
|
|
183
|
+
/** 3-column feature card grid — icon tile + colored title + body. */
|
|
184
|
+
function featureCards(cards) {
|
|
185
|
+
const items = cards
|
|
186
|
+
.map((c) => {
|
|
187
|
+
var _a;
|
|
188
|
+
return `<div class="feature-card no-break">
|
|
189
|
+
<div class="feature-card-icon">${inlineSvgIcon((_a = c.icon) !== null && _a !== void 0 ? _a : 'default')}</div>
|
|
190
|
+
<div class="feature-card-title">${c.title}</div>
|
|
191
|
+
<div class="feature-card-desc">${c.description}</div>
|
|
192
|
+
</div>`;
|
|
193
|
+
})
|
|
194
|
+
.join('');
|
|
195
|
+
return `<div class="feature-cards">${items}</div>`;
|
|
196
|
+
}
|
|
197
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
198
|
+
// Chip
|
|
199
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
200
|
+
/** Pill chip with area-colored dot — Design System spec. */
|
|
201
|
+
function chip(label) {
|
|
202
|
+
return `<span class="chip">${label}</span>`;
|
|
203
|
+
}
|
|
204
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
205
|
+
// Data table
|
|
206
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
207
|
+
/** Responsive data table with page-break-inside:avoid on rows. */
|
|
208
|
+
function dataTable(headers, rows) {
|
|
209
|
+
const ths = headers.map((h) => `<th>${h}</th>`).join('');
|
|
210
|
+
const trs = rows
|
|
211
|
+
.map((row) => `<tr>${row.map((cell) => `<td>${cell}</td>`).join('')}</tr>`)
|
|
212
|
+
.join('');
|
|
213
|
+
return `<table class="data-table">
|
|
214
|
+
<thead><tr>${ths}</tr></thead>
|
|
215
|
+
<tbody>${trs}</tbody>
|
|
216
|
+
</table>`;
|
|
217
|
+
}
|
|
218
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
219
|
+
// Metadata block
|
|
220
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
221
|
+
/** 4-column grid of label+value cells with rounded border. */
|
|
222
|
+
function metadataBlock(items) {
|
|
223
|
+
const cells = items
|
|
224
|
+
.map((item) => `<div class="metadata-item">
|
|
225
|
+
<div class="metadata-label">${item.label}</div>
|
|
226
|
+
<div class="metadata-value">${item.value}</div>
|
|
227
|
+
</div>`)
|
|
228
|
+
.join('');
|
|
229
|
+
return `<div class="metadata-block">${cells}</div>`;
|
|
230
|
+
}
|
|
231
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
232
|
+
// Signature area
|
|
233
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
234
|
+
/** Auto-grid of signature lines with optional name label. */
|
|
235
|
+
function signatureArea(signatories) {
|
|
236
|
+
const items = signatories
|
|
237
|
+
.map((s) => `<div class="signature-item">
|
|
238
|
+
<div class="signature-line"></div>
|
|
239
|
+
<div class="signature-label">${s.label}</div>
|
|
240
|
+
${s.name ? `<div class="signature-name">${s.name}</div>` : ''}
|
|
241
|
+
</div>`)
|
|
242
|
+
.join('');
|
|
243
|
+
return `<div class="signature-area">${items}</div>`;
|
|
244
|
+
}
|
|
245
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
246
|
+
// Fixed footer (repeats on every PDF page)
|
|
247
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
248
|
+
/**
|
|
249
|
+
* Fixed footer that appears on every page.
|
|
250
|
+
* Left: company + doc label. Right: page counter via CSS counter(page).
|
|
251
|
+
*/
|
|
252
|
+
function pdfFooter(companyName = 'hcode', docLabel = 'DESIGN SYSTEM V1.0') {
|
|
253
|
+
return `<div class="pdf-footer">
|
|
254
|
+
<div class="t-micro">${companyName.toUpperCase()} · ${docLabel}</div>
|
|
255
|
+
<div class="t-micro pdf-footer-page"></div>
|
|
256
|
+
</div>`;
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pdf/components/index.ts"],"names":[],"mappings":";;AAgEA,sCAuBC;AAOD,8BAcC;AAgBD,8BA0CC;AAOD,sCAEC;AAKD,gCAQC;AAOD,sCAKC;AAOD,oCAMC;AAcD,oCAWC;AAOD,oBAEC;AAOD,8BASC;AAOD,sCAUC;AAOD,sCAaC;AAUD,8BAKC;AA1TD,uDAAuE;AAEvE,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,MAAM,UAAU,GAA2B;IACzC,SAAS,EACP,sFAAsF;QACtF,6GAA6G;IAC/G,QAAQ,EACN,uGAAuG;QACvG,wGAAwG;QACxG,wGAAwG;IAC1G,UAAU,EACR,yGAAyG;QACzG,iHAAiH;IACnH,QAAQ,EACN,gIAAgI;IAClI,UAAU,EACR,wGAAwG;QACxG,+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d.ts","sourceRoot":"","sources":["../../../src/pdf/dto/generate-pdf.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,cAAc;IAGzB,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;IAI9C,WAAW,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CACvC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GeneratePdfDTO = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class GeneratePdfDTO {
|
|
15
|
+
}
|
|
16
|
+
exports.GeneratePdfDTO = GeneratePdfDTO;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
(0, class_validator_1.IsIn)(['consulting', 'training', 'research']),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], GeneratePdfDTO.prototype, "area", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsOptional)(),
|
|
24
|
+
(0, class_validator_1.IsIn)(['inline', 'attachment']),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], GeneratePdfDTO.prototype, "disposition", void 0);
|
|
27
|
+
//# sourceMappingURL=generate-pdf.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-pdf.dto.js","sourceRoot":"","sources":["../../../src/pdf/dto/generate-pdf.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmD;AAEnD,MAAa,cAAc;CAQ1B;AARD,wCAQC;AALC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;;4CACC;AAI9C;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;;mDACO"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type PdfAreaType = 'consulting' | 'training' | 'research';
|
|
2
|
+
export interface PdfThemeConfig {
|
|
3
|
+
area: PdfAreaType;
|
|
4
|
+
companyName: string;
|
|
5
|
+
logoOverride: string;
|
|
6
|
+
primaryColor: string;
|
|
7
|
+
darkColor: string;
|
|
8
|
+
lightColor: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=pdf-theme-config.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-theme-config.interface.d.ts","sourceRoot":"","sources":["../../../src/pdf/interfaces/pdf-theme-config.interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf-theme-config.interface.js","sourceRoot":"","sources":["../../../src/pdf/interfaces/pdf-theme-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { GeneratePdfDTO } from './dto/generate-pdf.dto';
|
|
3
|
+
import { PdfService } from './pdf.service';
|
|
4
|
+
export declare class PdfController {
|
|
5
|
+
private readonly pdfService;
|
|
6
|
+
constructor(pdfService: PdfService);
|
|
7
|
+
/**
|
|
8
|
+
* GET /core/pdf/example
|
|
9
|
+
*
|
|
10
|
+
* Generates a sample hcode Institutional PDF using the Design System
|
|
11
|
+
* template with the currently configured area color.
|
|
12
|
+
* Publicly accessible — no auth required.
|
|
13
|
+
*/
|
|
14
|
+
example(query: GeneratePdfDTO, res: Response): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=pdf.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.controller.d.ts","sourceRoot":"","sources":["../../src/pdf/pdf.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qBAEa,aAAa;IAGtB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAGzC;;;;;;OAMG;IAGG,OAAO,CAAU,KAAK,EAAE,cAAc,EAAS,GAAG,EAAE,QAAQ;CA6DnE"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PdfController = void 0;
|
|
16
|
+
const api_1 = require("@hed-hog/api");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const generate_pdf_dto_1 = require("./dto/generate-pdf.dto");
|
|
19
|
+
const pdf_service_1 = require("./pdf.service");
|
|
20
|
+
let PdfController = class PdfController {
|
|
21
|
+
constructor(pdfService) {
|
|
22
|
+
this.pdfService = pdfService;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* GET /core/pdf/example
|
|
26
|
+
*
|
|
27
|
+
* Generates a sample hcode Institutional PDF using the Design System
|
|
28
|
+
* template with the currently configured area color.
|
|
29
|
+
* Publicly accessible — no auth required.
|
|
30
|
+
*/
|
|
31
|
+
async example(query, res) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const area = (_a = query.area) !== null && _a !== void 0 ? _a : 'consulting';
|
|
34
|
+
const disposition = (_b = query.disposition) !== null && _b !== void 0 ? _b : 'inline';
|
|
35
|
+
const buffer = await this.pdfService.generatePdfFromTemplate('hcode-institutional', {
|
|
36
|
+
area,
|
|
37
|
+
title: 'Inteligência aplicada.',
|
|
38
|
+
subtitle: 'De diagnóstico a aplicação: consultoria, formação e pesquisa em IA para empresas que querem liderar.',
|
|
39
|
+
description: 'Combinamos diagnóstico estratégico, formação corporativa e pesquisa aplicada para transformar ' +
|
|
40
|
+
'a inteligência artificial em resultado mensurável para o seu negócio.',
|
|
41
|
+
features: [
|
|
42
|
+
{
|
|
43
|
+
icon: 'discovery',
|
|
44
|
+
title: 'Discovery & Diagnóstico',
|
|
45
|
+
description: 'Mapeamento de maturidade, gaps e oportunidades de IA na sua operação atual.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
icon: 'strategy',
|
|
49
|
+
title: 'Estratégia & Roadmap',
|
|
50
|
+
description: 'Plano de adoção com priorização por impacto, viabilidade e alinhamento cultural.',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
icon: 'governance',
|
|
54
|
+
title: 'Governança & Ética',
|
|
55
|
+
description: 'Frameworks de uso responsável, políticas internas e compliance regulatório.',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
tableHeaders: ['Fase', 'Entregável', 'Duração', 'Responsável'],
|
|
59
|
+
tableRows: [
|
|
60
|
+
['01 · Discovery', 'Diagnóstico de maturidade IA', '2 semanas', 'hcode'],
|
|
61
|
+
['02 · Estratégia', 'Roadmap de adoção e priorização', '3 semanas', 'hcode + Cliente'],
|
|
62
|
+
['03 · Piloto', 'Implantação de caso de uso prioritário', '6 semanas', 'hcode + TI'],
|
|
63
|
+
['04 · Scale', 'Expansão e gestão de mudança', 'ongoing', 'Cliente (suporte hcode)'],
|
|
64
|
+
],
|
|
65
|
+
metadata: [
|
|
66
|
+
{ label: 'Área', value: area.charAt(0).toUpperCase() + area.slice(1) },
|
|
67
|
+
{ label: 'Versão', value: '1.0' },
|
|
68
|
+
{ label: 'Data', value: new Date().toLocaleDateString('pt-BR') },
|
|
69
|
+
{ label: 'Design System', value: 'DS v1.0' },
|
|
70
|
+
],
|
|
71
|
+
signatories: [
|
|
72
|
+
{ label: 'Responsável pelo Projeto' },
|
|
73
|
+
{ label: 'Aprovado por' },
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
res.set({
|
|
77
|
+
'Content-Type': 'application/pdf',
|
|
78
|
+
'Content-Disposition': `${disposition}; filename="hcode-${area}-example.pdf"`,
|
|
79
|
+
'Content-Length': buffer.length,
|
|
80
|
+
});
|
|
81
|
+
res.end(buffer);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.PdfController = PdfController;
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, api_1.Public)(),
|
|
87
|
+
(0, common_1.Get)('example'),
|
|
88
|
+
__param(0, (0, common_1.Query)()),
|
|
89
|
+
__param(1, (0, common_1.Res)()),
|
|
90
|
+
__metadata("design:type", Function),
|
|
91
|
+
__metadata("design:paramtypes", [generate_pdf_dto_1.GeneratePdfDTO, Object]),
|
|
92
|
+
__metadata("design:returntype", Promise)
|
|
93
|
+
], PdfController.prototype, "example", null);
|
|
94
|
+
exports.PdfController = PdfController = __decorate([
|
|
95
|
+
(0, api_1.Role)(),
|
|
96
|
+
(0, common_1.Controller)('core/pdf'),
|
|
97
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => pdf_service_1.PdfService))),
|
|
98
|
+
__metadata("design:paramtypes", [pdf_service_1.PdfService])
|
|
99
|
+
], PdfController);
|
|
100
|
+
//# sourceMappingURL=pdf.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.controller.js","sourceRoot":"","sources":["../../src/pdf/pdf.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA4C;AAC5C,2CAAiF;AAGjF,6DAAwD;AACxD,+CAA2C;AAIpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ;;;;;;OAMG;IAGG,AAAN,KAAK,CAAC,OAAO,CAAU,KAAqB,EAAS,GAAa;;QAChE,MAAM,IAAI,GAAG,MAAA,KAAK,CAAC,IAAI,mCAAI,Y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C,kBAAkB,CAAC,OAAO,CAAC,EAAE;gBAChE,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE;aAC7C;YACD,WAAW,EAAE;gBACX,EAAE,KAAK,EAAE,0BAA0B,EAAE;gBACrC,EAAE,KAAK,EAAE,cAAc,EAAE;aAC1B;SACF,CACF,CAAC;QAEF,GAAG,CAAC,GAAG,CAAC;YACN,cAAc,EAAE,iBAAiB;YACjC,qBAAqB,EAAE,GAAG,WAAW,qBAAqB,IAAI,eAAe;YAC7E,gBAAgB,EAAE,MAAM,CAAC,MAAM;SAChC,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;CACF,CAAA;AA5EY,sCAAa;AAelB;IAFL,IAAA,YAAM,GAAE;IACR,IAAA,YAAG,EAAC,SAAS,CAAC;IACA,WAAA,IAAA,cAAK,GAAE,CAAA;IAAyB,WAAA,IAAA,YAAG,GAAE,CAAA;;qCAAtB,iCAAc;;4CA4D3C;wBA3EU,aAAa;IAFzB,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,UAAU,CAAC;IAGlB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC,CAAC,CAAA;qCACR,wBAAU;GAH9B,aAAa,CA4EzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.module.d.ts","sourceRoot":"","sources":["../../src/pdf/pdf.module.ts"],"names":[],"mappings":"AAOA,qBASa,SAAS;CAAG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PdfModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const config_1 = require("@nestjs/config");
|
|
12
|
+
const setting_module_1 = require("../setting/setting.module");
|
|
13
|
+
const pdf_controller_1 = require("./pdf.controller");
|
|
14
|
+
const pdf_service_1 = require("./pdf.service");
|
|
15
|
+
let PdfModule = class PdfModule {
|
|
16
|
+
};
|
|
17
|
+
exports.PdfModule = PdfModule;
|
|
18
|
+
exports.PdfModule = PdfModule = __decorate([
|
|
19
|
+
(0, common_1.Module)({
|
|
20
|
+
imports: [
|
|
21
|
+
config_1.ConfigModule,
|
|
22
|
+
(0, common_1.forwardRef)(() => setting_module_1.SettingModule),
|
|
23
|
+
],
|
|
24
|
+
providers: [pdf_service_1.PdfService],
|
|
25
|
+
exports: [pdf_service_1.PdfService],
|
|
26
|
+
controllers: [pdf_controller_1.PdfController],
|
|
27
|
+
})
|
|
28
|
+
], PdfModule);
|
|
29
|
+
//# sourceMappingURL=pdf.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.module.js","sourceRoot":"","sources":["../../src/pdf/pdf.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,2CAA8C;AAE9C,8DAA0D;AAC1D,qDAAiD;AACjD,+CAA2C;AAWpC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IATrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY;YACZ,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC;SAChC;QACD,SAAS,EAAE,CAAC,wBAAU,CAAC;QACvB,OAAO,EAAE,CAAC,wBAAU,CAAC;QACrB,WAAW,EAAE,CAAC,8BAAa,CAAC;KAC7B,CAAC;GACW,SAAS,CAAG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { SettingService } from '../setting/setting.service';
|
|
3
|
+
import { PdfAreaType, PdfThemeConfig } from './interfaces/pdf-theme-config.interface';
|
|
4
|
+
export interface PdfGenerateOptions {
|
|
5
|
+
format?: 'A4' | 'A3' | 'Letter';
|
|
6
|
+
margin?: {
|
|
7
|
+
top?: string;
|
|
8
|
+
right?: string;
|
|
9
|
+
bottom?: string;
|
|
10
|
+
left?: string;
|
|
11
|
+
};
|
|
12
|
+
printBackground?: boolean;
|
|
13
|
+
landscape?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class PdfService {
|
|
16
|
+
private readonly settingService;
|
|
17
|
+
private readonly configService;
|
|
18
|
+
private readonly logger;
|
|
19
|
+
constructor(settingService: SettingService, configService: ConfigService);
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the active PdfThemeConfig for the given area.
|
|
22
|
+
* Reads admin-configured overrides from SettingService and falls back to
|
|
23
|
+
* the hard-coded Design System v1.0 defaults.
|
|
24
|
+
*/
|
|
25
|
+
loadThemeConfig(area?: PdfAreaType): Promise<PdfThemeConfig>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves a potentially relative URL (e.g. /logo.svg) to an absolute URL
|
|
28
|
+
* using the API base URL derived from environment variables.
|
|
29
|
+
*/
|
|
30
|
+
private resolveUrl;
|
|
31
|
+
/**
|
|
32
|
+
* Renders an HTML string to a PDF buffer using Playwright/Chromium.
|
|
33
|
+
*
|
|
34
|
+
* Uses dynamic `import()` via `new Function` to remain compatible with
|
|
35
|
+
* CommonJS bundle output (same pattern as operations.service.ts).
|
|
36
|
+
*/
|
|
37
|
+
generatePdfFromHtml(html: string, options?: PdfGenerateOptions): Promise<Buffer>;
|
|
38
|
+
/**
|
|
39
|
+
* Generates a PDF from a named template and structured data.
|
|
40
|
+
* The theme is resolved automatically from `data.area` via SettingService.
|
|
41
|
+
*/
|
|
42
|
+
generatePdfFromTemplate(templateName: string, data: Record<string, any>, options?: PdfGenerateOptions): Promise<Buffer>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=pdf.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.service.d.ts","sourceRoot":"","sources":["../../src/pdf/pdf.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAQtF,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,QAAQ,CAAC;IAChC,MAAM,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD,qBACa,UAAU;IAKnB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IALhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;gBAInC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa;IAK/C;;;;OAIG;IACG,eAAe,CAAC,IAAI,GAAE,WAA0B,GAAG,OAAO,CAAC,cAAc,CAAC;IA8DhF;;;OAGG;IACH,OAAO,CAAC,UAAU;IAqBlB;;;;;OAKG;IACG,mBAAmB,CAAC,IAAI,EAAE,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