@consenti/api 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/README.md +623 -0
- package/dist/dashboard/assets/index-BBbhHyc_.js +2637 -0
- package/dist/dashboard/assets/index-DYK73WL5.css +1 -0
- package/dist/dashboard/favicon.ico +0 -0
- package/dist/dashboard/icon.svg +30 -0
- package/dist/dashboard/index.html +15 -0
- package/dist/dashboard/logo-dark.svg +50 -0
- package/dist/dashboard/logo.svg +50 -0
- package/dist/index.cjs +9162 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1085 -0
- package/dist/index.d.ts +1085 -0
- package/dist/index.js +9116 -0
- package/dist/index.js.map +1 -0
- package/dist/widget/widget.js +2305 -0
- package/package.json +97 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1085 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
|
|
4
|
+
type ConsentStatus = 'granted' | 'denied' | 'objected';
|
|
5
|
+
type ConsentValue = Record<string, ConsentStatus>;
|
|
6
|
+
interface Cookie {
|
|
7
|
+
id: string;
|
|
8
|
+
type?: 'consent' | 'legitimate_interest';
|
|
9
|
+
mandatory?: boolean;
|
|
10
|
+
listenGpc?: boolean;
|
|
11
|
+
expiry?: number;
|
|
12
|
+
tcfVendorId?: number;
|
|
13
|
+
tcfPurposes?: number[];
|
|
14
|
+
cpraCategory?: 'sale' | 'sharing' | 'sensitive';
|
|
15
|
+
}
|
|
16
|
+
type ButtonStyle = 'primary' | 'secondary' | 'text' | 'accent';
|
|
17
|
+
type ButtonAction = 'submit' | 'manage' | 'close' | 'custom' | 'link';
|
|
18
|
+
interface Button {
|
|
19
|
+
text: string;
|
|
20
|
+
style: ButtonStyle;
|
|
21
|
+
action: ButtonAction;
|
|
22
|
+
cookies?: string[] | '*' | '!';
|
|
23
|
+
url?: string;
|
|
24
|
+
}
|
|
25
|
+
interface MainBanner {
|
|
26
|
+
position: 'top' | 'bottom' | 'middle' | 'left-bottom' | 'right-bottom';
|
|
27
|
+
overlayOpacity?: number;
|
|
28
|
+
showClose?: boolean;
|
|
29
|
+
showLocaleSwitcher?: boolean;
|
|
30
|
+
heading?: string;
|
|
31
|
+
headingTag?: string;
|
|
32
|
+
htmlText: string;
|
|
33
|
+
buttons: Button[];
|
|
34
|
+
}
|
|
35
|
+
type GpcBanner = MainBanner;
|
|
36
|
+
interface Category {
|
|
37
|
+
id: string;
|
|
38
|
+
heading: string;
|
|
39
|
+
headingTag?: string;
|
|
40
|
+
htmlText: string;
|
|
41
|
+
mandatory?: boolean;
|
|
42
|
+
type?: 'consent' | 'legitimate_interest';
|
|
43
|
+
legitimateInterest?: {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
description?: string;
|
|
46
|
+
};
|
|
47
|
+
cookies: string[];
|
|
48
|
+
}
|
|
49
|
+
interface PreferenceModal {
|
|
50
|
+
position?: 'left' | 'right' | 'center';
|
|
51
|
+
overlayOpacity?: number;
|
|
52
|
+
showClose?: boolean;
|
|
53
|
+
showLocaleSwitcher?: boolean;
|
|
54
|
+
heading?: string;
|
|
55
|
+
headingTag?: string;
|
|
56
|
+
subheading?: string;
|
|
57
|
+
htmlText?: string;
|
|
58
|
+
buttons: Button[];
|
|
59
|
+
categories: Category[];
|
|
60
|
+
persistent?: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface LocaleTranslations {
|
|
63
|
+
mainBanner: MainBanner;
|
|
64
|
+
gpcBanner?: GpcBanner;
|
|
65
|
+
preferenceModal: PreferenceModal;
|
|
66
|
+
}
|
|
67
|
+
interface ProfileTranslations {
|
|
68
|
+
[locale: string]: LocaleTranslations;
|
|
69
|
+
}
|
|
70
|
+
interface DpdpaConfig {
|
|
71
|
+
dataFiduciary: string;
|
|
72
|
+
grievanceEmail: string;
|
|
73
|
+
purposeDescription?: string;
|
|
74
|
+
}
|
|
75
|
+
interface LocaleTextContent {
|
|
76
|
+
mainBanner: {
|
|
77
|
+
heading: string;
|
|
78
|
+
htmlText: string;
|
|
79
|
+
buttonLabels: string[];
|
|
80
|
+
};
|
|
81
|
+
gpcBanner: {
|
|
82
|
+
heading: string;
|
|
83
|
+
htmlText: string;
|
|
84
|
+
buttonLabels: string[];
|
|
85
|
+
};
|
|
86
|
+
preferenceModal: {
|
|
87
|
+
heading: string;
|
|
88
|
+
subheading?: string;
|
|
89
|
+
htmlText?: string;
|
|
90
|
+
buttonLabels: string[];
|
|
91
|
+
categories: Array<{
|
|
92
|
+
id: string;
|
|
93
|
+
heading: string;
|
|
94
|
+
htmlText: string;
|
|
95
|
+
}>;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface ProfileConfig {
|
|
99
|
+
cookies?: Cookie[];
|
|
100
|
+
defaultLocale: string;
|
|
101
|
+
translations?: ProfileTranslations;
|
|
102
|
+
gpcBanner?: boolean;
|
|
103
|
+
darkMode?: boolean;
|
|
104
|
+
allowedOrigins?: string[];
|
|
105
|
+
dpdpa?: DpdpaConfig;
|
|
106
|
+
regulation?: 'gdpr' | 'ccpa' | 'cpra' | 'dpdpa' | 'uk-gdpr' | 'lgpd' | 'pipeda' | 'popia' | 'pdpa-th' | 'appi' | 'kvkk';
|
|
107
|
+
regulations?: string[];
|
|
108
|
+
cookieTemplateId?: string;
|
|
109
|
+
uiTemplateId?: string;
|
|
110
|
+
localeContents?: Record<string, LocaleTextContent>;
|
|
111
|
+
}
|
|
112
|
+
interface UITemplateButton {
|
|
113
|
+
text: string;
|
|
114
|
+
type: string;
|
|
115
|
+
action: 'submit' | 'custom' | 'manage' | 'close' | 'link';
|
|
116
|
+
cookies?: string | string[];
|
|
117
|
+
url?: string;
|
|
118
|
+
}
|
|
119
|
+
interface UITemplateBanner {
|
|
120
|
+
position: string;
|
|
121
|
+
overlayOpacity: number;
|
|
122
|
+
showClose: boolean;
|
|
123
|
+
showLocaleSwitcher?: boolean;
|
|
124
|
+
headingTag: string;
|
|
125
|
+
buttons: UITemplateButton[];
|
|
126
|
+
}
|
|
127
|
+
interface UITemplateCategory {
|
|
128
|
+
id: string;
|
|
129
|
+
headingTag: string;
|
|
130
|
+
mandatory: boolean;
|
|
131
|
+
type: 'consent' | 'legitimate_interest';
|
|
132
|
+
liEnabled: boolean;
|
|
133
|
+
cookies: string[];
|
|
134
|
+
}
|
|
135
|
+
interface UITemplateModal extends UITemplateBanner {
|
|
136
|
+
hasSubheading: boolean;
|
|
137
|
+
persistent: boolean;
|
|
138
|
+
showLocaleSwitcher?: boolean;
|
|
139
|
+
categories: UITemplateCategory[];
|
|
140
|
+
}
|
|
141
|
+
interface ServerUITemplate {
|
|
142
|
+
id: string;
|
|
143
|
+
tenantId: string;
|
|
144
|
+
name: string;
|
|
145
|
+
mainBanner: UITemplateBanner;
|
|
146
|
+
gpcBanner: UITemplateBanner;
|
|
147
|
+
preferenceModal: UITemplateModal;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
}
|
|
151
|
+
interface ServerCookieTemplate {
|
|
152
|
+
id: string;
|
|
153
|
+
tenantId: string;
|
|
154
|
+
name: string;
|
|
155
|
+
cookies: Cookie[];
|
|
156
|
+
createdAt: string;
|
|
157
|
+
updatedAt: string;
|
|
158
|
+
}
|
|
159
|
+
interface CreateCookieTemplateInput {
|
|
160
|
+
tenantId: string;
|
|
161
|
+
name: string;
|
|
162
|
+
cookies: Cookie[];
|
|
163
|
+
}
|
|
164
|
+
interface UpdateCookieTemplateInput {
|
|
165
|
+
name?: string;
|
|
166
|
+
cookies?: Cookie[];
|
|
167
|
+
}
|
|
168
|
+
interface CreateUITemplateInput {
|
|
169
|
+
tenantId: string;
|
|
170
|
+
name: string;
|
|
171
|
+
mainBanner: UITemplateBanner;
|
|
172
|
+
gpcBanner: UITemplateBanner;
|
|
173
|
+
preferenceModal: UITemplateModal;
|
|
174
|
+
}
|
|
175
|
+
interface UpdateUITemplateInput {
|
|
176
|
+
name?: string;
|
|
177
|
+
mainBanner?: UITemplateBanner;
|
|
178
|
+
gpcBanner?: UITemplateBanner;
|
|
179
|
+
preferenceModal?: UITemplateModal;
|
|
180
|
+
}
|
|
181
|
+
interface PublicProfileResponse {
|
|
182
|
+
id: string;
|
|
183
|
+
version: number;
|
|
184
|
+
defaultLocale: string;
|
|
185
|
+
currentLocale: string;
|
|
186
|
+
locales: string[];
|
|
187
|
+
cookies: Cookie[];
|
|
188
|
+
mainBanner: MainBanner;
|
|
189
|
+
gpcBanner?: GpcBanner;
|
|
190
|
+
preferenceModal: PreferenceModal;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface StorageConfig {
|
|
194
|
+
driver: 'sqlite' | 'better-sqlite3' | 'node-sqlite3-wasm' | 'node:sqlite' | 'mongodb' | 'mysql' | 'postgresql' | 'json';
|
|
195
|
+
path?: string;
|
|
196
|
+
uri?: string;
|
|
197
|
+
dbName?: string;
|
|
198
|
+
database?: string;
|
|
199
|
+
host?: string;
|
|
200
|
+
port?: number;
|
|
201
|
+
user?: string;
|
|
202
|
+
password?: string;
|
|
203
|
+
}
|
|
204
|
+
interface OidcConfig {
|
|
205
|
+
issuer: string;
|
|
206
|
+
clientId: string;
|
|
207
|
+
clientSecret: string;
|
|
208
|
+
redirectUri: string;
|
|
209
|
+
claimsMapping?: {
|
|
210
|
+
roles?: string;
|
|
211
|
+
email?: string;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
interface SamlConfig {
|
|
215
|
+
issuer: string;
|
|
216
|
+
entryPoint: string;
|
|
217
|
+
cert: string;
|
|
218
|
+
callbackUrl: string;
|
|
219
|
+
}
|
|
220
|
+
interface AuthConfig {
|
|
221
|
+
mode: 'local' | 'jwt' | 'custom' | 'oidc' | 'saml';
|
|
222
|
+
jwtSecret?: string;
|
|
223
|
+
validateUser?: (req: unknown) => Promise<AdminUser | null>;
|
|
224
|
+
adminEmail?: string;
|
|
225
|
+
adminPassword?: string;
|
|
226
|
+
oidc?: OidcConfig;
|
|
227
|
+
saml?: SamlConfig;
|
|
228
|
+
}
|
|
229
|
+
interface RateLimitConfig {
|
|
230
|
+
enabled?: boolean;
|
|
231
|
+
windowMs?: number;
|
|
232
|
+
maxRequests?: number;
|
|
233
|
+
}
|
|
234
|
+
interface ComplianceConfig {
|
|
235
|
+
gdpr?: boolean;
|
|
236
|
+
ccpa?: boolean;
|
|
237
|
+
gpc?: boolean;
|
|
238
|
+
}
|
|
239
|
+
interface DashboardConfig {
|
|
240
|
+
enabled?: boolean;
|
|
241
|
+
path?: string;
|
|
242
|
+
}
|
|
243
|
+
interface MultiTenantConfig {
|
|
244
|
+
enabled: boolean;
|
|
245
|
+
}
|
|
246
|
+
interface AgeGateConfig {
|
|
247
|
+
enabled: boolean;
|
|
248
|
+
minimumAge: number;
|
|
249
|
+
requireParentalConsent?: boolean;
|
|
250
|
+
}
|
|
251
|
+
interface TcfConfig {
|
|
252
|
+
enabled: boolean;
|
|
253
|
+
cmpId: number;
|
|
254
|
+
cmpVersion: number;
|
|
255
|
+
}
|
|
256
|
+
interface DataRetentionConfig {
|
|
257
|
+
purgeAfterDays: number;
|
|
258
|
+
}
|
|
259
|
+
interface ConsentiServerConfig {
|
|
260
|
+
basePath?: string;
|
|
261
|
+
dashboard?: boolean | DashboardConfig;
|
|
262
|
+
storage?: StorageConfig;
|
|
263
|
+
auth?: AuthConfig;
|
|
264
|
+
rateLimit?: RateLimitConfig;
|
|
265
|
+
compliance?: ComplianceConfig;
|
|
266
|
+
multiTenant?: MultiTenantConfig;
|
|
267
|
+
plugins?: ConsentiServerPlugin[];
|
|
268
|
+
ageGate?: AgeGateConfig;
|
|
269
|
+
tcf?: TcfConfig;
|
|
270
|
+
dataRetention?: DataRetentionConfig;
|
|
271
|
+
maxBodySize?: number;
|
|
272
|
+
trustedProxies?: string[];
|
|
273
|
+
}
|
|
274
|
+
interface Tenant {
|
|
275
|
+
id: string;
|
|
276
|
+
name: string;
|
|
277
|
+
slug: string;
|
|
278
|
+
createdAt: string;
|
|
279
|
+
updatedAt: string;
|
|
280
|
+
}
|
|
281
|
+
interface ApiKey {
|
|
282
|
+
id: string;
|
|
283
|
+
tenantId: string;
|
|
284
|
+
keyHash: string;
|
|
285
|
+
name: string;
|
|
286
|
+
isActive: boolean;
|
|
287
|
+
createdAt: string;
|
|
288
|
+
}
|
|
289
|
+
interface Profile {
|
|
290
|
+
id: string;
|
|
291
|
+
tenantId: string;
|
|
292
|
+
name: string;
|
|
293
|
+
defaultLocale: string;
|
|
294
|
+
version: number;
|
|
295
|
+
profileJson: ProfileConfig;
|
|
296
|
+
createdAt: string;
|
|
297
|
+
updatedAt: string;
|
|
298
|
+
}
|
|
299
|
+
interface ConsentDbRecord {
|
|
300
|
+
id: string;
|
|
301
|
+
tenantId: string;
|
|
302
|
+
visitorId: string;
|
|
303
|
+
profileId: string;
|
|
304
|
+
profileVersion: number;
|
|
305
|
+
locale: string;
|
|
306
|
+
consentJson: ConsentValue;
|
|
307
|
+
gpcDetected: boolean;
|
|
308
|
+
source: 'banner' | 'api' | 'import';
|
|
309
|
+
ageVerified?: boolean;
|
|
310
|
+
parentalConsentToken?: string;
|
|
311
|
+
tcfString?: string;
|
|
312
|
+
createdAt: string;
|
|
313
|
+
updatedAt: string;
|
|
314
|
+
}
|
|
315
|
+
interface ConsentHistoryEntry {
|
|
316
|
+
id: string;
|
|
317
|
+
tenantId: string;
|
|
318
|
+
consentRecordId: string;
|
|
319
|
+
visitorId: string;
|
|
320
|
+
oldJson: ConsentValue | null;
|
|
321
|
+
newJson: ConsentValue;
|
|
322
|
+
action: 'created' | 'updated' | 'withdrawn';
|
|
323
|
+
createdAt: string;
|
|
324
|
+
}
|
|
325
|
+
interface Visitor {
|
|
326
|
+
id: string;
|
|
327
|
+
tenantId: string;
|
|
328
|
+
visitorId: string;
|
|
329
|
+
country?: string;
|
|
330
|
+
region?: string;
|
|
331
|
+
city?: string;
|
|
332
|
+
ipHash?: string;
|
|
333
|
+
userAgentHash?: string;
|
|
334
|
+
firstSeen: string;
|
|
335
|
+
lastSeen: string;
|
|
336
|
+
}
|
|
337
|
+
interface AdminUser {
|
|
338
|
+
id: string;
|
|
339
|
+
tenantId: string;
|
|
340
|
+
name: string;
|
|
341
|
+
email: string;
|
|
342
|
+
passwordHash: string;
|
|
343
|
+
isActive: boolean;
|
|
344
|
+
totpEnabled?: boolean;
|
|
345
|
+
totpSecret?: string;
|
|
346
|
+
createdAt: string;
|
|
347
|
+
updatedAt: string;
|
|
348
|
+
}
|
|
349
|
+
interface Role {
|
|
350
|
+
id: string;
|
|
351
|
+
tenantId: string;
|
|
352
|
+
name: string;
|
|
353
|
+
description?: string;
|
|
354
|
+
}
|
|
355
|
+
interface Permission {
|
|
356
|
+
id: string;
|
|
357
|
+
name: string;
|
|
358
|
+
description?: string;
|
|
359
|
+
}
|
|
360
|
+
interface AuditLog {
|
|
361
|
+
id: string;
|
|
362
|
+
tenantId: string;
|
|
363
|
+
userId?: string;
|
|
364
|
+
action: string;
|
|
365
|
+
resourceType: string;
|
|
366
|
+
resourceId?: string;
|
|
367
|
+
oldData?: unknown;
|
|
368
|
+
newData?: unknown;
|
|
369
|
+
createdAt: string;
|
|
370
|
+
}
|
|
371
|
+
interface CreateProfileInput {
|
|
372
|
+
tenantId: string;
|
|
373
|
+
name: string;
|
|
374
|
+
defaultLocale: string;
|
|
375
|
+
profileJson: ProfileConfig;
|
|
376
|
+
}
|
|
377
|
+
interface UpdateProfileInput {
|
|
378
|
+
name?: string;
|
|
379
|
+
defaultLocale?: string;
|
|
380
|
+
profileJson?: ProfileConfig;
|
|
381
|
+
}
|
|
382
|
+
interface CreateConsentInput {
|
|
383
|
+
tenantId: string;
|
|
384
|
+
visitorId: string;
|
|
385
|
+
profileId: string;
|
|
386
|
+
profileVersion: number;
|
|
387
|
+
locale: string;
|
|
388
|
+
consentJson: ConsentValue;
|
|
389
|
+
gpcDetected: boolean;
|
|
390
|
+
source: 'banner' | 'api' | 'import';
|
|
391
|
+
ageVerified?: boolean;
|
|
392
|
+
parentalConsentToken?: string;
|
|
393
|
+
tcfString?: string;
|
|
394
|
+
}
|
|
395
|
+
interface UpdateConsentInput {
|
|
396
|
+
consentJson: ConsentValue;
|
|
397
|
+
locale?: string;
|
|
398
|
+
gpcDetected?: boolean;
|
|
399
|
+
}
|
|
400
|
+
interface CreateVisitorInput {
|
|
401
|
+
tenantId: string;
|
|
402
|
+
visitorId: string;
|
|
403
|
+
country?: string;
|
|
404
|
+
region?: string;
|
|
405
|
+
city?: string;
|
|
406
|
+
ipHash?: string;
|
|
407
|
+
userAgentHash?: string;
|
|
408
|
+
}
|
|
409
|
+
interface UpdateVisitorInput {
|
|
410
|
+
country?: string;
|
|
411
|
+
region?: string;
|
|
412
|
+
city?: string;
|
|
413
|
+
lastSeen?: string;
|
|
414
|
+
}
|
|
415
|
+
interface CreateUserInput {
|
|
416
|
+
tenantId: string;
|
|
417
|
+
name: string;
|
|
418
|
+
email: string;
|
|
419
|
+
passwordHash: string;
|
|
420
|
+
}
|
|
421
|
+
interface UpdateUserInput {
|
|
422
|
+
name?: string;
|
|
423
|
+
email?: string;
|
|
424
|
+
passwordHash?: string;
|
|
425
|
+
isActive?: boolean;
|
|
426
|
+
totpSecret?: string | null;
|
|
427
|
+
totpEnabled?: boolean;
|
|
428
|
+
}
|
|
429
|
+
interface CreateAuditLogInput {
|
|
430
|
+
tenantId: string;
|
|
431
|
+
userId?: string;
|
|
432
|
+
action: string;
|
|
433
|
+
resourceType: string;
|
|
434
|
+
resourceId?: string;
|
|
435
|
+
oldData?: unknown;
|
|
436
|
+
newData?: unknown;
|
|
437
|
+
}
|
|
438
|
+
interface ConsentFilters {
|
|
439
|
+
tenantId: string;
|
|
440
|
+
profileId?: string;
|
|
441
|
+
from?: string;
|
|
442
|
+
to?: string;
|
|
443
|
+
page?: number;
|
|
444
|
+
limit?: number;
|
|
445
|
+
}
|
|
446
|
+
interface VisitorFilters {
|
|
447
|
+
tenantId: string;
|
|
448
|
+
from?: string;
|
|
449
|
+
to?: string;
|
|
450
|
+
page?: number;
|
|
451
|
+
limit?: number;
|
|
452
|
+
}
|
|
453
|
+
interface AuditFilters {
|
|
454
|
+
tenantId: string;
|
|
455
|
+
action?: string;
|
|
456
|
+
resourceType?: string;
|
|
457
|
+
from?: string;
|
|
458
|
+
to?: string;
|
|
459
|
+
page?: number;
|
|
460
|
+
limit?: number;
|
|
461
|
+
}
|
|
462
|
+
interface ConsentVerifyResult {
|
|
463
|
+
valid: boolean;
|
|
464
|
+
reasons: Array<'profile_version_mismatch' | 'consent_expired' | 'hmac_invalid'>;
|
|
465
|
+
currentProfileVersion?: number;
|
|
466
|
+
consentProfileVersion?: number;
|
|
467
|
+
}
|
|
468
|
+
type SafeAdminUser = Omit<AdminUser, 'passwordHash'>;
|
|
469
|
+
interface CreateRoleInput {
|
|
470
|
+
tenantId: string;
|
|
471
|
+
name: string;
|
|
472
|
+
description?: string;
|
|
473
|
+
}
|
|
474
|
+
interface UpdateRoleInput {
|
|
475
|
+
name?: string;
|
|
476
|
+
description?: string;
|
|
477
|
+
}
|
|
478
|
+
interface OverviewStats {
|
|
479
|
+
totalConsents: number;
|
|
480
|
+
acceptedPct: number;
|
|
481
|
+
rejectedPct: number;
|
|
482
|
+
totalVisitors: number;
|
|
483
|
+
gpcDetectedCount: number;
|
|
484
|
+
}
|
|
485
|
+
type CategoryStats = Record<string, {
|
|
486
|
+
granted: number;
|
|
487
|
+
denied: number;
|
|
488
|
+
objected: number;
|
|
489
|
+
}>;
|
|
490
|
+
interface TimelineEntry {
|
|
491
|
+
date: string;
|
|
492
|
+
count: number;
|
|
493
|
+
}
|
|
494
|
+
interface CountryStat {
|
|
495
|
+
country: string;
|
|
496
|
+
count: number;
|
|
497
|
+
}
|
|
498
|
+
interface GpcStats {
|
|
499
|
+
detected: number;
|
|
500
|
+
total: number;
|
|
501
|
+
rate: number;
|
|
502
|
+
}
|
|
503
|
+
interface CreateApiKeyInput {
|
|
504
|
+
tenantId: string;
|
|
505
|
+
name: string;
|
|
506
|
+
keyHash: string;
|
|
507
|
+
}
|
|
508
|
+
interface CreateTenantInput {
|
|
509
|
+
name: string;
|
|
510
|
+
slug: string;
|
|
511
|
+
}
|
|
512
|
+
interface UpdateTenantInput {
|
|
513
|
+
name?: string;
|
|
514
|
+
slug?: string;
|
|
515
|
+
}
|
|
516
|
+
interface StorageAdapter {
|
|
517
|
+
connect(): Promise<void>;
|
|
518
|
+
disconnect(): Promise<void>;
|
|
519
|
+
migrate(): Promise<void>;
|
|
520
|
+
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
521
|
+
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
522
|
+
deleteProfile(id: string): Promise<void>;
|
|
523
|
+
getProfile(id: string): Promise<Profile | null>;
|
|
524
|
+
getProfiles(tenantId: string): Promise<Profile[]>;
|
|
525
|
+
createConsent(data: CreateConsentInput): Promise<ConsentDbRecord>;
|
|
526
|
+
updateConsent(visitorId: string, data: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
527
|
+
deleteConsent(visitorId: string): Promise<void>;
|
|
528
|
+
getConsent(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
529
|
+
getConsents(filters: ConsentFilters): Promise<ConsentDbRecord[]>;
|
|
530
|
+
streamConsents(filters: ConsentFilters): AsyncIterable<ConsentDbRecord>;
|
|
531
|
+
createVisitor(data: CreateVisitorInput): Promise<Visitor>;
|
|
532
|
+
updateVisitor(visitorId: string, data: UpdateVisitorInput): Promise<Visitor>;
|
|
533
|
+
deleteVisitor(visitorId: string): Promise<void>;
|
|
534
|
+
getVisitor(visitorId: string): Promise<Visitor | null>;
|
|
535
|
+
getVisitors(filters: VisitorFilters): Promise<Visitor[]>;
|
|
536
|
+
getConsentHistory(visitorId: string): Promise<ConsentHistoryEntry[]>;
|
|
537
|
+
streamAuditLogs(filters: AuditFilters): AsyncIterable<AuditLog>;
|
|
538
|
+
getOverviewStats(tenantId: string): Promise<OverviewStats>;
|
|
539
|
+
getCategoryStats(tenantId: string): Promise<CategoryStats>;
|
|
540
|
+
getTimeline(tenantId: string, days?: number): Promise<TimelineEntry[]>;
|
|
541
|
+
getCountries(tenantId: string): Promise<CountryStat[]>;
|
|
542
|
+
getGpcStats(tenantId: string): Promise<GpcStats>;
|
|
543
|
+
getTenants(): Promise<Tenant[]>;
|
|
544
|
+
createTenant(data: CreateTenantInput): Promise<Tenant>;
|
|
545
|
+
updateTenant(id: string, data: UpdateTenantInput): Promise<Tenant>;
|
|
546
|
+
deleteTenant(id: string): Promise<void>;
|
|
547
|
+
createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
|
|
548
|
+
getApiKeyByHash(keyHash: string): Promise<ApiKey | null>;
|
|
549
|
+
revokeApiKey(id: string): Promise<void>;
|
|
550
|
+
getApiKeys(tenantId: string): Promise<ApiKey[]>;
|
|
551
|
+
purgeExpiredConsents(olderThanDays: number): Promise<number>;
|
|
552
|
+
createCookieTemplate(data: CreateCookieTemplateInput): Promise<ServerCookieTemplate>;
|
|
553
|
+
updateCookieTemplate(id: string, data: UpdateCookieTemplateInput): Promise<ServerCookieTemplate>;
|
|
554
|
+
deleteCookieTemplate(id: string): Promise<void>;
|
|
555
|
+
getCookieTemplate(id: string): Promise<ServerCookieTemplate | null>;
|
|
556
|
+
getCookieTemplates(tenantId: string): Promise<ServerCookieTemplate[]>;
|
|
557
|
+
copyCookieTemplate(id: string, newName: string): Promise<ServerCookieTemplate>;
|
|
558
|
+
createUITemplate(data: CreateUITemplateInput): Promise<ServerUITemplate>;
|
|
559
|
+
updateUITemplate(id: string, data: UpdateUITemplateInput): Promise<ServerUITemplate>;
|
|
560
|
+
deleteUITemplate(id: string): Promise<void>;
|
|
561
|
+
getUITemplate(id: string): Promise<ServerUITemplate | null>;
|
|
562
|
+
getUITemplates(tenantId: string): Promise<ServerUITemplate[]>;
|
|
563
|
+
copyUITemplate(id: string, newName: string): Promise<ServerUITemplate>;
|
|
564
|
+
createUser(data: CreateUserInput): Promise<AdminUser>;
|
|
565
|
+
updateUser(id: string, data: UpdateUserInput): Promise<AdminUser>;
|
|
566
|
+
deleteUser(id: string): Promise<void>;
|
|
567
|
+
getUserById(id: string): Promise<AdminUser | null>;
|
|
568
|
+
getUserByEmail(email: string): Promise<AdminUser | null>;
|
|
569
|
+
getUsers(tenantId: string): Promise<AdminUser[]>;
|
|
570
|
+
countUsers(tenantId?: string): Promise<number>;
|
|
571
|
+
getRoles(tenantId: string): Promise<Role[]>;
|
|
572
|
+
createRole(data: CreateRoleInput): Promise<Role>;
|
|
573
|
+
updateRole(id: string, data: UpdateRoleInput): Promise<Role>;
|
|
574
|
+
deleteRole(id: string): Promise<void>;
|
|
575
|
+
getAllPermissions(): Promise<Permission[]>;
|
|
576
|
+
getPermissionsForRole(roleId: string): Promise<Permission[]>;
|
|
577
|
+
getUserRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
578
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
579
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
580
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<void>;
|
|
581
|
+
revokePermissionFromRole(roleId: string, permissionId: string): Promise<void>;
|
|
582
|
+
createLog(data: CreateAuditLogInput): Promise<void>;
|
|
583
|
+
getLogs(filters: AuditFilters): Promise<AuditLog[]>;
|
|
584
|
+
}
|
|
585
|
+
interface PluginContext {
|
|
586
|
+
storage: StorageAdapter;
|
|
587
|
+
config: ConsentiServerConfig;
|
|
588
|
+
}
|
|
589
|
+
declare abstract class ConsentiServerPlugin {
|
|
590
|
+
abstract name: string;
|
|
591
|
+
initialize?(context: PluginContext): Promise<void>;
|
|
592
|
+
destroy?(): Promise<void>;
|
|
593
|
+
beforeConsentSave?(data: CreateConsentInput): Promise<CreateConsentInput>;
|
|
594
|
+
afterConsentSave?(record: ConsentDbRecord): Promise<void>;
|
|
595
|
+
beforeConsentUpdate?(data: UpdateConsentInput): Promise<UpdateConsentInput>;
|
|
596
|
+
afterConsentUpdate?(record: ConsentDbRecord): Promise<void>;
|
|
597
|
+
beforeProfileFetch?(id: string): Promise<string>;
|
|
598
|
+
afterProfileFetch?(profile: Profile): Promise<Profile>;
|
|
599
|
+
beforeUserCreate?(data: CreateUserInput): Promise<CreateUserInput>;
|
|
600
|
+
afterUserCreate?(user: AdminUser): Promise<void>;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
declare class ProfileRepo {
|
|
604
|
+
private adapter;
|
|
605
|
+
constructor(adapter: StorageAdapter);
|
|
606
|
+
create(data: CreateProfileInput): Promise<Profile>;
|
|
607
|
+
update(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
608
|
+
delete(id: string): Promise<void>;
|
|
609
|
+
get(id: string): Promise<Profile | null>;
|
|
610
|
+
list(tenantId: string): Promise<Profile[]>;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
declare class AuditRepo {
|
|
614
|
+
private adapter;
|
|
615
|
+
constructor(adapter: StorageAdapter);
|
|
616
|
+
log(data: CreateAuditLogInput): Promise<void>;
|
|
617
|
+
list(filters: AuditFilters): Promise<AuditLog[]>;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare class ProfileService {
|
|
621
|
+
private profiles;
|
|
622
|
+
private audit;
|
|
623
|
+
private tenantId;
|
|
624
|
+
private storage?;
|
|
625
|
+
constructor(profiles: ProfileRepo, audit: AuditRepo, tenantId?: string, storage?: StorageAdapter | undefined);
|
|
626
|
+
create(input: Omit<CreateProfileInput, 'tenantId'>): Promise<Profile>;
|
|
627
|
+
update(id: string, input: UpdateProfileInput): Promise<Profile>;
|
|
628
|
+
delete(id: string): Promise<void>;
|
|
629
|
+
get(id: string, locale?: string): Promise<Profile | null>;
|
|
630
|
+
getResolved(id: string, locale?: string): Promise<PublicProfileResponse | null>;
|
|
631
|
+
list(): Promise<Profile[]>;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
declare class ConsentRepo {
|
|
635
|
+
private adapter;
|
|
636
|
+
constructor(adapter: StorageAdapter);
|
|
637
|
+
create(data: CreateConsentInput): Promise<ConsentDbRecord>;
|
|
638
|
+
update(visitorId: string, data: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
639
|
+
delete(visitorId: string): Promise<void>;
|
|
640
|
+
get(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
641
|
+
list(filters: ConsentFilters): Promise<ConsentDbRecord[]>;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
declare class VisitorRepo {
|
|
645
|
+
private adapter;
|
|
646
|
+
constructor(adapter: StorageAdapter);
|
|
647
|
+
create(data: CreateVisitorInput): Promise<Visitor>;
|
|
648
|
+
update(visitorId: string, data: UpdateVisitorInput): Promise<Visitor>;
|
|
649
|
+
delete(visitorId: string): Promise<void>;
|
|
650
|
+
get(visitorId: string): Promise<Visitor | null>;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
declare class PluginEngine {
|
|
654
|
+
private plugins;
|
|
655
|
+
register(plugins: ConsentiServerPlugin[]): void;
|
|
656
|
+
initialize(context: PluginContext): Promise<void>;
|
|
657
|
+
destroy(): Promise<void>;
|
|
658
|
+
runBeforeConsentSave(data: CreateConsentInput): Promise<CreateConsentInput>;
|
|
659
|
+
runAfterConsentSave(record: ConsentDbRecord): Promise<void>;
|
|
660
|
+
runBeforeConsentUpdate(data: UpdateConsentInput): Promise<UpdateConsentInput>;
|
|
661
|
+
runAfterConsentUpdate(record: ConsentDbRecord): Promise<void>;
|
|
662
|
+
runAfterProfileFetch(profile: Profile): Promise<Profile>;
|
|
663
|
+
runBeforeUserCreate(data: CreateUserInput): Promise<CreateUserInput>;
|
|
664
|
+
runAfterUserCreate(user: AdminUser): Promise<void>;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
declare class ConsentService {
|
|
668
|
+
private consents;
|
|
669
|
+
private visitors;
|
|
670
|
+
private profiles;
|
|
671
|
+
private audit;
|
|
672
|
+
private tenantId;
|
|
673
|
+
private compliance?;
|
|
674
|
+
private pluginEngine?;
|
|
675
|
+
private eventBus?;
|
|
676
|
+
private tcfConfig?;
|
|
677
|
+
constructor(consents: ConsentRepo, visitors: VisitorRepo, profiles: ProfileRepo, audit: AuditRepo, tenantId?: string, compliance?: ComplianceConfig | undefined, pluginEngine?: PluginEngine | undefined, eventBus?: EventEmitter | undefined, tcfConfig?: TcfConfig | undefined);
|
|
678
|
+
create(input: Omit<CreateConsentInput, 'tenantId'>): Promise<ConsentDbRecord>;
|
|
679
|
+
update(visitorId: string, input: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
680
|
+
get(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
681
|
+
verify(visitorId: string): Promise<ConsentVerifyResult>;
|
|
682
|
+
erase(visitorId: string): Promise<void>;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
declare class VisitorService {
|
|
686
|
+
private visitors;
|
|
687
|
+
private tenantId;
|
|
688
|
+
constructor(visitors: VisitorRepo, tenantId?: string);
|
|
689
|
+
upsert(data: {
|
|
690
|
+
visitorId: string;
|
|
691
|
+
ip?: string;
|
|
692
|
+
userAgent?: string;
|
|
693
|
+
country?: string;
|
|
694
|
+
region?: string;
|
|
695
|
+
city?: string;
|
|
696
|
+
}): Promise<Visitor>;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
declare class UserRepo {
|
|
700
|
+
private adapter;
|
|
701
|
+
constructor(adapter: StorageAdapter);
|
|
702
|
+
getById(id: string): Promise<AdminUser | null>;
|
|
703
|
+
getByEmail(email: string): Promise<AdminUser | null>;
|
|
704
|
+
list(tenantId: string): Promise<AdminUser[]>;
|
|
705
|
+
create(data: CreateUserInput): Promise<AdminUser>;
|
|
706
|
+
update(id: string, data: UpdateUserInput): Promise<AdminUser>;
|
|
707
|
+
delete(id: string): Promise<void>;
|
|
708
|
+
getRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
709
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
710
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
declare class UserService {
|
|
714
|
+
private users;
|
|
715
|
+
private audit;
|
|
716
|
+
private tenantId;
|
|
717
|
+
constructor(users: UserRepo, audit: AuditRepo, tenantId?: string);
|
|
718
|
+
private safe;
|
|
719
|
+
create(input: {
|
|
720
|
+
name: string;
|
|
721
|
+
email: string;
|
|
722
|
+
password: string;
|
|
723
|
+
roleId?: string;
|
|
724
|
+
}, actorId?: string): Promise<SafeAdminUser>;
|
|
725
|
+
update(id: string, input: {
|
|
726
|
+
name?: string;
|
|
727
|
+
email?: string;
|
|
728
|
+
isActive?: boolean;
|
|
729
|
+
password?: string;
|
|
730
|
+
}, actorId?: string): Promise<SafeAdminUser>;
|
|
731
|
+
delete(id: string, actorId?: string): Promise<void>;
|
|
732
|
+
get(id: string): Promise<SafeAdminUser | null>;
|
|
733
|
+
list(): Promise<SafeAdminUser[]>;
|
|
734
|
+
getRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
735
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
736
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
declare class BetterSqlite3Adapter implements StorageAdapter {
|
|
740
|
+
private config;
|
|
741
|
+
private db;
|
|
742
|
+
private cache;
|
|
743
|
+
constructor(config: StorageConfig);
|
|
744
|
+
private stmt;
|
|
745
|
+
connect(): Promise<void>;
|
|
746
|
+
disconnect(): Promise<void>;
|
|
747
|
+
migrate(): Promise<void>;
|
|
748
|
+
private mapProfile;
|
|
749
|
+
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
750
|
+
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
751
|
+
deleteProfile(id: string): Promise<void>;
|
|
752
|
+
getProfile(id: string): Promise<Profile | null>;
|
|
753
|
+
getProfiles(tenantId: string): Promise<Profile[]>;
|
|
754
|
+
private mapConsent;
|
|
755
|
+
createConsent(data: CreateConsentInput): Promise<ConsentDbRecord>;
|
|
756
|
+
updateConsent(visitorId: string, data: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
757
|
+
deleteConsent(visitorId: string): Promise<void>;
|
|
758
|
+
getConsent(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
759
|
+
getConsents(filters: ConsentFilters): Promise<ConsentDbRecord[]>;
|
|
760
|
+
streamConsents(filters: ConsentFilters): AsyncIterable<ConsentDbRecord>;
|
|
761
|
+
getConsentHistory(visitorId: string): Promise<ConsentHistoryEntry[]>;
|
|
762
|
+
private mapVisitor;
|
|
763
|
+
createVisitor(data: CreateVisitorInput): Promise<Visitor>;
|
|
764
|
+
updateVisitor(visitorId: string, data: UpdateVisitorInput): Promise<Visitor>;
|
|
765
|
+
deleteVisitor(visitorId: string): Promise<void>;
|
|
766
|
+
getVisitor(visitorId: string): Promise<Visitor | null>;
|
|
767
|
+
getVisitors(filters: VisitorFilters): Promise<Visitor[]>;
|
|
768
|
+
private mapUser;
|
|
769
|
+
createUser(data: CreateUserInput): Promise<AdminUser>;
|
|
770
|
+
updateUser(id: string, data: UpdateUserInput): Promise<AdminUser>;
|
|
771
|
+
deleteUser(id: string): Promise<void>;
|
|
772
|
+
getUserById(id: string): Promise<AdminUser | null>;
|
|
773
|
+
getUserByEmail(email: string): Promise<AdminUser | null>;
|
|
774
|
+
getUsers(tenantId: string): Promise<AdminUser[]>;
|
|
775
|
+
countUsers(tenantId?: string): Promise<number>;
|
|
776
|
+
getRoles(tenantId: string): Promise<Role[]>;
|
|
777
|
+
createRole(data: CreateRoleInput): Promise<Role>;
|
|
778
|
+
updateRole(id: string, data: UpdateRoleInput): Promise<Role>;
|
|
779
|
+
deleteRole(id: string): Promise<void>;
|
|
780
|
+
getAllPermissions(): Promise<Permission[]>;
|
|
781
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<void>;
|
|
782
|
+
revokePermissionFromRole(roleId: string, permissionId: string): Promise<void>;
|
|
783
|
+
getPermissionsForRole(roleId: string): Promise<Permission[]>;
|
|
784
|
+
getUserRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
785
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
786
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
787
|
+
createLog(data: CreateAuditLogInput): Promise<void>;
|
|
788
|
+
getLogs(filters: AuditFilters): Promise<AuditLog[]>;
|
|
789
|
+
private mapAuditLog;
|
|
790
|
+
streamAuditLogs(filters: AuditFilters): AsyncIterable<AuditLog>;
|
|
791
|
+
getOverviewStats(tenantId: string): Promise<OverviewStats>;
|
|
792
|
+
getCategoryStats(tenantId: string): Promise<CategoryStats>;
|
|
793
|
+
getTimeline(tenantId: string, days?: number): Promise<TimelineEntry[]>;
|
|
794
|
+
getCountries(tenantId: string): Promise<CountryStat[]>;
|
|
795
|
+
getGpcStats(tenantId: string): Promise<GpcStats>;
|
|
796
|
+
getTenants(): Promise<Tenant[]>;
|
|
797
|
+
createTenant(data: CreateTenantInput): Promise<Tenant>;
|
|
798
|
+
updateTenant(id: string, data: UpdateTenantInput): Promise<Tenant>;
|
|
799
|
+
deleteTenant(id: string): Promise<void>;
|
|
800
|
+
purgeExpiredConsents(olderThanDays: number): Promise<number>;
|
|
801
|
+
private mapApiKey;
|
|
802
|
+
createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
|
|
803
|
+
getApiKeyByHash(keyHash: string): Promise<ApiKey | null>;
|
|
804
|
+
revokeApiKey(id: string): Promise<void>;
|
|
805
|
+
getApiKeys(tenantId: string): Promise<ApiKey[]>;
|
|
806
|
+
private mapCookieTemplate;
|
|
807
|
+
createCookieTemplate(data: CreateCookieTemplateInput): Promise<ServerCookieTemplate>;
|
|
808
|
+
updateCookieTemplate(id: string, data: UpdateCookieTemplateInput): Promise<ServerCookieTemplate>;
|
|
809
|
+
deleteCookieTemplate(id: string): Promise<void>;
|
|
810
|
+
getCookieTemplate(id: string): Promise<ServerCookieTemplate | null>;
|
|
811
|
+
getCookieTemplates(tenantId: string): Promise<ServerCookieTemplate[]>;
|
|
812
|
+
copyCookieTemplate(id: string, newName: string): Promise<ServerCookieTemplate>;
|
|
813
|
+
private mapUITemplate;
|
|
814
|
+
createUITemplate(data: CreateUITemplateInput): Promise<ServerUITemplate>;
|
|
815
|
+
updateUITemplate(id: string, data: UpdateUITemplateInput): Promise<ServerUITemplate>;
|
|
816
|
+
deleteUITemplate(id: string): Promise<void>;
|
|
817
|
+
getUITemplate(id: string): Promise<ServerUITemplate | null>;
|
|
818
|
+
getUITemplates(tenantId: string): Promise<ServerUITemplate[]>;
|
|
819
|
+
copyUITemplate(id: string, newName: string): Promise<ServerUITemplate>;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
declare class MongoDBAdapter implements StorageAdapter {
|
|
823
|
+
private config;
|
|
824
|
+
private client;
|
|
825
|
+
private db;
|
|
826
|
+
constructor(config: StorageConfig);
|
|
827
|
+
private col;
|
|
828
|
+
connect(): Promise<void>;
|
|
829
|
+
disconnect(): Promise<void>;
|
|
830
|
+
migrate(): Promise<void>;
|
|
831
|
+
private createIndexes;
|
|
832
|
+
private seed;
|
|
833
|
+
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
834
|
+
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
835
|
+
deleteProfile(id: string): Promise<void>;
|
|
836
|
+
getProfile(id: string): Promise<Profile | null>;
|
|
837
|
+
getProfiles(tenantId: string): Promise<Profile[]>;
|
|
838
|
+
createConsent(data: CreateConsentInput): Promise<ConsentDbRecord>;
|
|
839
|
+
updateConsent(visitorId: string, data: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
840
|
+
deleteConsent(visitorId: string): Promise<void>;
|
|
841
|
+
getConsent(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
842
|
+
getConsents(filters: ConsentFilters): Promise<ConsentDbRecord[]>;
|
|
843
|
+
streamConsents(filters: ConsentFilters): AsyncIterable<ConsentDbRecord>;
|
|
844
|
+
private buildConsentFilter;
|
|
845
|
+
private writeHistory;
|
|
846
|
+
getConsentHistory(visitorId: string): Promise<ConsentHistoryEntry[]>;
|
|
847
|
+
createVisitor(data: CreateVisitorInput): Promise<Visitor>;
|
|
848
|
+
updateVisitor(visitorId: string, data: UpdateVisitorInput): Promise<Visitor>;
|
|
849
|
+
deleteVisitor(visitorId: string): Promise<void>;
|
|
850
|
+
getVisitor(visitorId: string): Promise<Visitor | null>;
|
|
851
|
+
getVisitors(filters: VisitorFilters): Promise<Visitor[]>;
|
|
852
|
+
getOverviewStats(tenantId: string): Promise<OverviewStats>;
|
|
853
|
+
getCategoryStats(tenantId: string): Promise<CategoryStats>;
|
|
854
|
+
getTimeline(tenantId: string, days?: number): Promise<TimelineEntry[]>;
|
|
855
|
+
createUser(data: CreateUserInput): Promise<AdminUser>;
|
|
856
|
+
updateUser(id: string, data: UpdateUserInput): Promise<AdminUser>;
|
|
857
|
+
deleteUser(id: string): Promise<void>;
|
|
858
|
+
getUserById(id: string): Promise<AdminUser | null>;
|
|
859
|
+
getUserByEmail(email: string): Promise<AdminUser | null>;
|
|
860
|
+
getUsers(tenantId: string): Promise<AdminUser[]>;
|
|
861
|
+
countUsers(tenantId?: string): Promise<number>;
|
|
862
|
+
getRoles(tenantId: string): Promise<Role[]>;
|
|
863
|
+
createRole(data: CreateRoleInput): Promise<Role>;
|
|
864
|
+
updateRole(id: string, data: UpdateRoleInput): Promise<Role>;
|
|
865
|
+
deleteRole(id: string): Promise<void>;
|
|
866
|
+
getAllPermissions(): Promise<Permission[]>;
|
|
867
|
+
getPermissionsForRole(roleId: string): Promise<Permission[]>;
|
|
868
|
+
getUserRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
869
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
870
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
871
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<void>;
|
|
872
|
+
revokePermissionFromRole(roleId: string, permissionId: string): Promise<void>;
|
|
873
|
+
createLog(data: CreateAuditLogInput): Promise<void>;
|
|
874
|
+
getLogs(filters: AuditFilters): Promise<AuditLog[]>;
|
|
875
|
+
streamAuditLogs(filters: AuditFilters): AsyncIterable<AuditLog>;
|
|
876
|
+
private buildAuditFilter;
|
|
877
|
+
getCountries(tenantId: string): Promise<CountryStat[]>;
|
|
878
|
+
getGpcStats(tenantId: string): Promise<GpcStats>;
|
|
879
|
+
getTenants(): Promise<Tenant[]>;
|
|
880
|
+
createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
|
|
881
|
+
getApiKeyByHash(keyHash: string): Promise<ApiKey | null>;
|
|
882
|
+
revokeApiKey(id: string): Promise<void>;
|
|
883
|
+
getApiKeys(tenantId: string): Promise<ApiKey[]>;
|
|
884
|
+
createTenant(data: CreateTenantInput): Promise<Tenant>;
|
|
885
|
+
updateTenant(id: string, data: UpdateTenantInput): Promise<Tenant>;
|
|
886
|
+
deleteTenant(id: string): Promise<void>;
|
|
887
|
+
purgeExpiredConsents(olderThanDays: number): Promise<number>;
|
|
888
|
+
createCookieTemplate(): Promise<never>;
|
|
889
|
+
updateCookieTemplate(): Promise<never>;
|
|
890
|
+
deleteCookieTemplate(): Promise<void>;
|
|
891
|
+
getCookieTemplate(): Promise<never>;
|
|
892
|
+
getCookieTemplates(): Promise<never>;
|
|
893
|
+
copyCookieTemplate(): Promise<never>;
|
|
894
|
+
createUITemplate(): Promise<never>;
|
|
895
|
+
updateUITemplate(): Promise<never>;
|
|
896
|
+
deleteUITemplate(): Promise<void>;
|
|
897
|
+
getUITemplate(): Promise<never>;
|
|
898
|
+
getUITemplates(): Promise<never>;
|
|
899
|
+
copyUITemplate(): Promise<never>;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
declare class MySQLAdapter implements StorageAdapter {
|
|
903
|
+
private config;
|
|
904
|
+
private pool;
|
|
905
|
+
constructor(config: StorageConfig);
|
|
906
|
+
private q;
|
|
907
|
+
private exec;
|
|
908
|
+
connect(): Promise<void>;
|
|
909
|
+
disconnect(): Promise<void>;
|
|
910
|
+
migrate(): Promise<void>;
|
|
911
|
+
private seed;
|
|
912
|
+
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
913
|
+
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
914
|
+
deleteProfile(id: string): Promise<void>;
|
|
915
|
+
getProfile(id: string): Promise<Profile | null>;
|
|
916
|
+
getProfiles(tenantId: string): Promise<Profile[]>;
|
|
917
|
+
createConsent(data: CreateConsentInput): Promise<ConsentDbRecord>;
|
|
918
|
+
updateConsent(visitorId: string, data: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
919
|
+
deleteConsent(visitorId: string): Promise<void>;
|
|
920
|
+
getConsent(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
921
|
+
getConsents(filters: ConsentFilters): Promise<ConsentDbRecord[]>;
|
|
922
|
+
streamConsents(filters: ConsentFilters): AsyncIterable<ConsentDbRecord>;
|
|
923
|
+
private buildConsentQuery;
|
|
924
|
+
private writeHistory;
|
|
925
|
+
getConsentHistory(visitorId: string): Promise<ConsentHistoryEntry[]>;
|
|
926
|
+
createVisitor(data: CreateVisitorInput): Promise<Visitor>;
|
|
927
|
+
updateVisitor(visitorId: string, data: UpdateVisitorInput): Promise<Visitor>;
|
|
928
|
+
deleteVisitor(visitorId: string): Promise<void>;
|
|
929
|
+
getVisitor(visitorId: string): Promise<Visitor | null>;
|
|
930
|
+
getVisitors(filters: VisitorFilters): Promise<Visitor[]>;
|
|
931
|
+
getOverviewStats(tenantId: string): Promise<OverviewStats>;
|
|
932
|
+
getCategoryStats(tenantId: string): Promise<CategoryStats>;
|
|
933
|
+
getTimeline(tenantId: string, days?: number): Promise<TimelineEntry[]>;
|
|
934
|
+
createUser(data: CreateUserInput): Promise<AdminUser>;
|
|
935
|
+
updateUser(id: string, data: UpdateUserInput): Promise<AdminUser>;
|
|
936
|
+
deleteUser(id: string): Promise<void>;
|
|
937
|
+
getUserById(id: string): Promise<AdminUser | null>;
|
|
938
|
+
getUserByEmail(email: string): Promise<AdminUser | null>;
|
|
939
|
+
getUsers(tenantId: string): Promise<AdminUser[]>;
|
|
940
|
+
countUsers(tenantId?: string): Promise<number>;
|
|
941
|
+
getRoles(tenantId: string): Promise<Role[]>;
|
|
942
|
+
createRole(data: CreateRoleInput): Promise<Role>;
|
|
943
|
+
updateRole(id: string, data: UpdateRoleInput): Promise<Role>;
|
|
944
|
+
deleteRole(id: string): Promise<void>;
|
|
945
|
+
getAllPermissions(): Promise<Permission[]>;
|
|
946
|
+
getPermissionsForRole(roleId: string): Promise<Permission[]>;
|
|
947
|
+
getUserRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
948
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
949
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
950
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<void>;
|
|
951
|
+
revokePermissionFromRole(roleId: string, permissionId: string): Promise<void>;
|
|
952
|
+
createLog(data: CreateAuditLogInput): Promise<void>;
|
|
953
|
+
getLogs(filters: AuditFilters): Promise<AuditLog[]>;
|
|
954
|
+
streamAuditLogs(filters: AuditFilters): AsyncIterable<AuditLog>;
|
|
955
|
+
private buildAuditQuery;
|
|
956
|
+
getCountries(tenantId: string): Promise<CountryStat[]>;
|
|
957
|
+
getGpcStats(tenantId: string): Promise<GpcStats>;
|
|
958
|
+
getTenants(): Promise<Tenant[]>;
|
|
959
|
+
createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
|
|
960
|
+
getApiKeyByHash(keyHash: string): Promise<ApiKey | null>;
|
|
961
|
+
revokeApiKey(id: string): Promise<void>;
|
|
962
|
+
getApiKeys(tenantId: string): Promise<ApiKey[]>;
|
|
963
|
+
createTenant(data: CreateTenantInput): Promise<Tenant>;
|
|
964
|
+
updateTenant(id: string, data: UpdateTenantInput): Promise<Tenant>;
|
|
965
|
+
deleteTenant(id: string): Promise<void>;
|
|
966
|
+
purgeExpiredConsents(olderThanDays: number): Promise<number>;
|
|
967
|
+
createCookieTemplate(): Promise<never>;
|
|
968
|
+
updateCookieTemplate(): Promise<never>;
|
|
969
|
+
deleteCookieTemplate(): Promise<void>;
|
|
970
|
+
getCookieTemplate(): Promise<never>;
|
|
971
|
+
getCookieTemplates(): Promise<never>;
|
|
972
|
+
copyCookieTemplate(): Promise<never>;
|
|
973
|
+
createUITemplate(): Promise<never>;
|
|
974
|
+
updateUITemplate(): Promise<never>;
|
|
975
|
+
deleteUITemplate(): Promise<void>;
|
|
976
|
+
getUITemplate(): Promise<never>;
|
|
977
|
+
getUITemplates(): Promise<never>;
|
|
978
|
+
copyUITemplate(): Promise<never>;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
declare class PostgreSQLAdapter implements StorageAdapter {
|
|
982
|
+
private config;
|
|
983
|
+
private pool;
|
|
984
|
+
constructor(config: StorageConfig);
|
|
985
|
+
private q;
|
|
986
|
+
connect(): Promise<void>;
|
|
987
|
+
disconnect(): Promise<void>;
|
|
988
|
+
migrate(): Promise<void>;
|
|
989
|
+
private seedTx;
|
|
990
|
+
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
991
|
+
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
992
|
+
deleteProfile(id: string): Promise<void>;
|
|
993
|
+
getProfile(id: string): Promise<Profile | null>;
|
|
994
|
+
getProfiles(tenantId: string): Promise<Profile[]>;
|
|
995
|
+
createConsent(data: CreateConsentInput): Promise<ConsentDbRecord>;
|
|
996
|
+
updateConsent(visitorId: string, data: UpdateConsentInput): Promise<ConsentDbRecord>;
|
|
997
|
+
deleteConsent(visitorId: string): Promise<void>;
|
|
998
|
+
getConsent(visitorId: string): Promise<ConsentDbRecord | null>;
|
|
999
|
+
getConsents(filters: ConsentFilters): Promise<ConsentDbRecord[]>;
|
|
1000
|
+
streamConsents(filters: ConsentFilters): AsyncIterable<ConsentDbRecord>;
|
|
1001
|
+
private buildConsentQuery;
|
|
1002
|
+
private writeHistory;
|
|
1003
|
+
getConsentHistory(visitorId: string): Promise<ConsentHistoryEntry[]>;
|
|
1004
|
+
createVisitor(data: CreateVisitorInput): Promise<Visitor>;
|
|
1005
|
+
updateVisitor(visitorId: string, data: UpdateVisitorInput): Promise<Visitor>;
|
|
1006
|
+
deleteVisitor(visitorId: string): Promise<void>;
|
|
1007
|
+
getVisitor(visitorId: string): Promise<Visitor | null>;
|
|
1008
|
+
getVisitors(filters: VisitorFilters): Promise<Visitor[]>;
|
|
1009
|
+
getOverviewStats(tenantId: string): Promise<OverviewStats>;
|
|
1010
|
+
getCategoryStats(tenantId: string): Promise<CategoryStats>;
|
|
1011
|
+
getTimeline(tenantId: string, days?: number): Promise<TimelineEntry[]>;
|
|
1012
|
+
createUser(data: CreateUserInput): Promise<AdminUser>;
|
|
1013
|
+
updateUser(id: string, data: UpdateUserInput): Promise<AdminUser>;
|
|
1014
|
+
deleteUser(id: string): Promise<void>;
|
|
1015
|
+
getUserById(id: string): Promise<AdminUser | null>;
|
|
1016
|
+
getUserByEmail(email: string): Promise<AdminUser | null>;
|
|
1017
|
+
getUsers(tenantId: string): Promise<AdminUser[]>;
|
|
1018
|
+
countUsers(tenantId?: string): Promise<number>;
|
|
1019
|
+
getRoles(tenantId: string): Promise<Role[]>;
|
|
1020
|
+
createRole(data: CreateRoleInput): Promise<Role>;
|
|
1021
|
+
updateRole(id: string, data: UpdateRoleInput): Promise<Role>;
|
|
1022
|
+
deleteRole(id: string): Promise<void>;
|
|
1023
|
+
getAllPermissions(): Promise<Permission[]>;
|
|
1024
|
+
getPermissionsForRole(roleId: string): Promise<Permission[]>;
|
|
1025
|
+
getUserRoles(userId: string, tenantId?: string): Promise<Role[]>;
|
|
1026
|
+
assignRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
1027
|
+
revokeRole(userId: string, roleId: string, tenantId?: string): Promise<void>;
|
|
1028
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<void>;
|
|
1029
|
+
revokePermissionFromRole(roleId: string, permissionId: string): Promise<void>;
|
|
1030
|
+
createLog(data: CreateAuditLogInput): Promise<void>;
|
|
1031
|
+
getLogs(filters: AuditFilters): Promise<AuditLog[]>;
|
|
1032
|
+
streamAuditLogs(filters: AuditFilters): AsyncIterable<AuditLog>;
|
|
1033
|
+
private buildAuditQuery;
|
|
1034
|
+
getCountries(tenantId: string): Promise<CountryStat[]>;
|
|
1035
|
+
getGpcStats(tenantId: string): Promise<GpcStats>;
|
|
1036
|
+
getTenants(): Promise<Tenant[]>;
|
|
1037
|
+
createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
|
|
1038
|
+
getApiKeyByHash(keyHash: string): Promise<ApiKey | null>;
|
|
1039
|
+
revokeApiKey(id: string): Promise<void>;
|
|
1040
|
+
getApiKeys(tenantId: string): Promise<ApiKey[]>;
|
|
1041
|
+
createTenant(data: CreateTenantInput): Promise<Tenant>;
|
|
1042
|
+
updateTenant(id: string, data: UpdateTenantInput): Promise<Tenant>;
|
|
1043
|
+
deleteTenant(id: string): Promise<void>;
|
|
1044
|
+
purgeExpiredConsents(olderThanDays: number): Promise<number>;
|
|
1045
|
+
createCookieTemplate(): Promise<never>;
|
|
1046
|
+
updateCookieTemplate(): Promise<never>;
|
|
1047
|
+
deleteCookieTemplate(): Promise<void>;
|
|
1048
|
+
getCookieTemplate(): Promise<never>;
|
|
1049
|
+
getCookieTemplates(): Promise<never>;
|
|
1050
|
+
copyCookieTemplate(): Promise<never>;
|
|
1051
|
+
createUITemplate(): Promise<never>;
|
|
1052
|
+
updateUITemplate(): Promise<never>;
|
|
1053
|
+
deleteUITemplate(): Promise<void>;
|
|
1054
|
+
getUITemplate(): Promise<never>;
|
|
1055
|
+
getUITemplates(): Promise<never>;
|
|
1056
|
+
copyUITemplate(): Promise<never>;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
declare const dashboardDir: string;
|
|
1060
|
+
declare function createConsenti(userConfig: ConsentiServerConfig): {
|
|
1061
|
+
router: (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => void;
|
|
1062
|
+
handler: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1063
|
+
fastifyPlugin: (fastify: {
|
|
1064
|
+
all: (path: string, handler: (req: {
|
|
1065
|
+
raw: IncomingMessage;
|
|
1066
|
+
}, reply: {
|
|
1067
|
+
raw: ServerResponse;
|
|
1068
|
+
hijack: () => void;
|
|
1069
|
+
}) => Promise<void>) => void;
|
|
1070
|
+
}, _opts: unknown) => Promise<void>;
|
|
1071
|
+
honoApp: {
|
|
1072
|
+
fetch: (request: Request) => Promise<Response>;
|
|
1073
|
+
};
|
|
1074
|
+
services: {
|
|
1075
|
+
profile: ProfileService;
|
|
1076
|
+
consent: ConsentService;
|
|
1077
|
+
visitor: VisitorService;
|
|
1078
|
+
user: UserService;
|
|
1079
|
+
};
|
|
1080
|
+
storage: StorageAdapter;
|
|
1081
|
+
eventBus: EventEmitter<[never]>;
|
|
1082
|
+
destroy: () => Promise<void>;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
export { type AdminUser, type AuditLog, type ConsentDbRecord, type ConsentVerifyResult, type ConsentiServerConfig, MongoDBAdapter, MySQLAdapter, type Permission, PostgreSQLAdapter, type Profile, type Role, BetterSqlite3Adapter as SQLiteAdapter, type SafeAdminUser, type StorageAdapter, type Visitor, createConsenti, dashboardDir };
|