@consenti/api 0.5.0 → 0.6.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 +143 -11
- package/dist/chunk-7NKW7UTJ.js +2 -0
- package/dist/chunk-7NKW7UTJ.js.map +1 -0
- package/dist/dashboard/assets/{ApiConfig-dmDLJNfI.js → ApiConfig-DLPkgWsM.js} +1 -1
- package/dist/dashboard/assets/{ArchivedProfileList-ChWp1RHE.js → ArchivedProfileList-fRvXAaWy.js} +1 -1
- package/dist/dashboard/assets/{AuditLog-3lekUOk8.js → AuditLog-9flkPiEQ.js} +1 -1
- package/dist/dashboard/assets/{ChangePassword-BYlF08cE.js → ChangePassword-D--mNLLR.js} +1 -1
- package/dist/dashboard/assets/{ConfirmDialog-sMBVcbiI.js → ConfirmDialog-CJAqYRfE.js} +1 -1
- package/dist/dashboard/assets/{ConsentList-DLDBSjxO.js → ConsentList-CyddMOrW.js} +1 -1
- package/dist/dashboard/assets/{ConsentTemplateEditor-0iB6G95-.js → ConsentTemplateEditor-DZGFzkTA.js} +1 -1
- package/dist/dashboard/assets/{ConsentTemplateList-BnU_nL8h.js → ConsentTemplateList-CwNVxHyZ.js} +1 -1
- package/dist/dashboard/assets/{HeadingTagInput-7owwn9Vj.js → HeadingTagInput-DGKZYLTR.js} +1 -1
- package/dist/dashboard/assets/{HowItWorks-B05y-6xX.js → HowItWorks-10CyO4Kp.js} +1 -1
- package/dist/dashboard/assets/{PermissionGate-D45f3WrO.js → PermissionGate-CkaZ9DKx.js} +1 -1
- package/dist/dashboard/assets/PreviewPane-ArCfR0c9.js +38 -0
- package/dist/dashboard/assets/{ProfileEditor-CuMRNzdM.js → ProfileEditor-BNUxXKMk.js} +1 -1
- package/dist/dashboard/assets/{ProfileList-CFZ_i1zk.js → ProfileList-Ti5ZML_L.js} +1 -1
- package/dist/dashboard/assets/{ProfileVersionHistory-40HtQSrd.js → ProfileVersionHistory-D2KtUROF.js} +1 -1
- package/dist/dashboard/assets/{RecordDetailModal-hpJgK02E.js → RecordDetailModal-4OyHjtux.js} +1 -1
- package/dist/dashboard/assets/{Reports-BlvcycZ8.js → Reports-CHpF_j2k.js} +1 -1
- package/dist/dashboard/assets/{RoleList-CTeQdx6f.js → RoleList-BICQW5gU.js} +1 -1
- package/dist/dashboard/assets/{Select-CeC6GRyb.js → Select-C7q2vevu.js} +1 -1
- package/dist/dashboard/assets/{Settings-DLsvGtMh.js → Settings-BlOcU0wL.js} +1 -1
- package/dist/dashboard/assets/{SetupWizard-BVzGrBm2.js → SetupWizard-DReZ5DWr.js} +1 -1
- package/dist/dashboard/assets/{Table-CcBP7eXS.js → Table-C59yMXY2.js} +1 -1
- package/dist/dashboard/assets/{TenantList-DLgPnlVv.js → TenantList-Bbwcxyo8.js} +1 -1
- package/dist/dashboard/assets/{UITemplateEditor-B9EBcvOB.js → UITemplateEditor-CR7TnHBH.js} +1 -1
- package/dist/dashboard/assets/{UITemplateList-CGYRRlCh.js → UITemplateList-NKwDQJAw.js} +1 -1
- package/dist/dashboard/assets/{UserList-BbpiUrVr.js → UserList-DMk0_UF0.js} +1 -1
- package/dist/dashboard/assets/{VendorList-mlOlW7ht.js → VendorList-BawJ8Kyc.js} +1 -1
- package/dist/dashboard/assets/{VisitorList-Dne7xkNx.js → VisitorList-BVSFRtul.js} +1 -1
- package/dist/dashboard/assets/check-BAoHs1bd.js +1 -0
- package/dist/dashboard/assets/{copy-FTaGH7-z.js → copy-DjZpSOQM.js} +1 -1
- package/dist/dashboard/assets/{external-link-5y29qnhn.js → external-link-CFayXpKz.js} +1 -1
- package/dist/dashboard/assets/{index-BaYVhd1M.js → index-D7qdwIxs.js} +2 -2
- package/dist/dashboard/assets/{profiles-D-hvl_fK.js → profiles-Jb6uV-0U.js} +1 -1
- package/dist/dashboard/assets/{roles-DZyZwZDr.js → roles-ChXEt79v.js} +1 -1
- package/dist/dashboard/assets/{rotate-ccw-clock-C5cVu2_f.js → rotate-ccw-clock-503u3yEE.js} +1 -1
- package/dist/dashboard/assets/{search-mdMD-WTj.js → search-B05qPv24.js} +1 -1
- package/dist/dashboard/assets/{square-pen-BoEcHaSW.js → square-pen-BX2H18m3.js} +1 -1
- package/dist/dashboard/assets/{templates-DLMsZs7d.js → templates-DalUjETH.js} +1 -1
- package/dist/dashboard/assets/{trash-BVDX09Xe.js → trash-Bfqti-Og.js} +1 -1
- package/dist/dashboard/assets/{useHashQuery-wXzkY-tk.js → useHashQuery-DzYBqPIg.js} +1 -1
- package/dist/dashboard/assets/{users-BLTbK4tk.js → users-CDdO4hYQ.js} +1 -1
- package/dist/dashboard/assets/x-Clw5rGTJ.js +1 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/dist-MNR4WETI.js +2 -0
- package/dist/index.cjs +77 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -9
- package/dist/index.d.ts +45 -9
- package/dist/index.js +76 -74
- package/dist/index.js.map +1 -1
- package/dist/widget/widget.js +1 -1
- package/package.json +3 -2
- package/scripts/migrate-to-consenti-prefix.mjs +196 -0
- package/dist/chunk-COR72NFQ.js +0 -2
- package/dist/chunk-COR72NFQ.js.map +0 -1
- package/dist/dashboard/assets/PreviewPane-Czax39la.js +0 -38
- package/dist/dashboard/assets/check-IM5PInrX.js +0 -1
- package/dist/dashboard/assets/x-CtCy0YcJ.js +0 -1
- package/dist/dist-QJYW5KUK.js +0 -2
- /package/dist/{dist-QJYW5KUK.js.map → dist-MNR4WETI.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -140,8 +140,15 @@ type GeoResult = {
|
|
|
140
140
|
};
|
|
141
141
|
type CountryResolverFn = (ctx: {
|
|
142
142
|
ip: string;
|
|
143
|
+
/** The widget's `navigator.language` (single tag), or — for requests without the widget's hints —
|
|
144
|
+
* the raw `Accept-Language` header value. */
|
|
143
145
|
language: string;
|
|
146
|
+
/** Every language the visitor's browser prefers, most preferred first (the widget's
|
|
147
|
+
* `navigator.languages`; parsed from `Accept-Language` otherwise). Empty when unknown. */
|
|
148
|
+
languages: string[];
|
|
144
149
|
timezone: string;
|
|
150
|
+
/** The locale the widget asked for (`core.locale`); `''` when the request carried none. */
|
|
151
|
+
locale: string;
|
|
145
152
|
}) => Promise<GeoResult>;
|
|
146
153
|
interface S3ApiConfig {
|
|
147
154
|
enabled: boolean;
|
|
@@ -216,6 +223,10 @@ interface OptInStats {
|
|
|
216
223
|
}
|
|
217
224
|
interface ComplianceMapData {
|
|
218
225
|
version: string;
|
|
226
|
+
/** `true` (default): this map replaces the embedded one entirely, so only the countries listed here
|
|
227
|
+
* resolve (server side). `false`: `countries` is merged over the embedded map — a listed country
|
|
228
|
+
* replaces its embedded entry wholesale, every unlisted country keeps its built-in mapping. */
|
|
229
|
+
override?: boolean;
|
|
219
230
|
countries: Record<string, CountryComplianceEntry>;
|
|
220
231
|
}
|
|
221
232
|
interface CountryComplianceEntry {
|
|
@@ -239,8 +250,11 @@ interface ComplianceConfig {
|
|
|
239
250
|
geoDataProvider?: 'default' | 'maxmind' | 'geoip' | 'hosted-geoip-lite' | CountryResolverFn;
|
|
240
251
|
/** `'default'` (embedded map, the default), a URL to fetch a JSON `ComplianceMapData` document
|
|
241
252
|
* from (refreshed in the background per the response's `Cache-Control`/`Expires` header, 24h
|
|
242
|
-
* fallback if absent), or an inline operator-supplied `ComplianceMapData` object.
|
|
243
|
-
*
|
|
253
|
+
* fallback if absent), or an inline operator-supplied `ComplianceMapData` object. By default the
|
|
254
|
+
* supplied map replaces the embedded one; set `override: false` on the document to merge its
|
|
255
|
+
* `countries` over the embedded map instead (listed countries replace their embedded entry, the
|
|
256
|
+
* rest keep the built-in mapping). Invalid data from either a URL or an object logs an error and
|
|
257
|
+
* falls back to `'default'`. */
|
|
244
258
|
complianceMap?: 'default' | string | ComplianceMapData;
|
|
245
259
|
tcf?: TcfConfig;
|
|
246
260
|
gpp?: GppConfig;
|
|
@@ -401,6 +415,9 @@ interface ConsentDbRecord {
|
|
|
401
415
|
tenantId: string;
|
|
402
416
|
visitorId: string;
|
|
403
417
|
profileId: string;
|
|
418
|
+
/** The profile's `version` when this consent was last given — with `profileId`, pins the exact
|
|
419
|
+
* on-disk snapshot (the banner text the visitor saw). Absent on records from before it was tracked. */
|
|
420
|
+
profileVersion?: number;
|
|
404
421
|
locale: string;
|
|
405
422
|
consentJson: ConsentValue;
|
|
406
423
|
gpcDetected: boolean;
|
|
@@ -421,6 +438,8 @@ interface ConsentHistoryEntry {
|
|
|
421
438
|
tenantId: string;
|
|
422
439
|
consentRecordId: string;
|
|
423
440
|
visitorId: string;
|
|
441
|
+
/** The profile version in force for this change — see {@link ConsentDbRecord.profileVersion}. */
|
|
442
|
+
profileVersion?: number;
|
|
424
443
|
oldJson: ConsentValue | null;
|
|
425
444
|
newJson: ConsentValue;
|
|
426
445
|
action: 'created' | 'updated' | 'withdrawn';
|
|
@@ -523,6 +542,7 @@ interface CreateConsentInput {
|
|
|
523
542
|
tenantId: string;
|
|
524
543
|
visitorId: string;
|
|
525
544
|
profileId: string;
|
|
545
|
+
profileVersion?: number;
|
|
526
546
|
locale: string;
|
|
527
547
|
consentJson: ConsentValue;
|
|
528
548
|
gpcDetected: boolean;
|
|
@@ -535,6 +555,7 @@ interface CreateConsentInput {
|
|
|
535
555
|
}
|
|
536
556
|
interface UpdateConsentInput {
|
|
537
557
|
consentJson: ConsentValue;
|
|
558
|
+
profileVersion?: number;
|
|
538
559
|
locale?: string;
|
|
539
560
|
gpcDetected?: boolean;
|
|
540
561
|
signature?: string;
|
|
@@ -1212,7 +1233,7 @@ declare class ProfileService {
|
|
|
1212
1233
|
* unchanged from `previousVersion` by the worker — never silently dropped.
|
|
1213
1234
|
*/
|
|
1214
1235
|
private writeLocaleFiles;
|
|
1215
|
-
create(input: Omit<CreateProfileInput, 'tenantId'
|
|
1236
|
+
create(input: Omit<CreateProfileInput, 'tenantId'>, actorId?: string): Promise<Profile>;
|
|
1216
1237
|
/**
|
|
1217
1238
|
* Duplicates a profile as a brand new, always-inactive profile (own `id`, `version` starts at
|
|
1218
1239
|
* 1 again). Delegates to {@link create} rather than copying on-disk files directly — the
|
|
@@ -1220,16 +1241,16 @@ declare class ProfileService {
|
|
|
1220
1241
|
* new profile rather than byte-copied from the source's. Non-default locale content is read
|
|
1221
1242
|
* back off the source's current version files so the copy carries every locale forward too.
|
|
1222
1243
|
*/
|
|
1223
|
-
copy(id: string, name?: string): Promise<Profile>;
|
|
1244
|
+
copy(id: string, name?: string, actorId?: string): Promise<Profile>;
|
|
1224
1245
|
/**
|
|
1225
1246
|
* Mutates the existing row in place — `id` is stable across every edit, `version` is
|
|
1226
1247
|
* incremented. The prior state isn't kept as a separate DB row; its resolved-JSON snapshot
|
|
1227
1248
|
* on disk (see {@link listVersions}) is the audit trail for that edit.
|
|
1228
1249
|
*/
|
|
1229
|
-
update(id: string, input: UpdateProfileInput): Promise<Profile>;
|
|
1230
|
-
delete(id: string): Promise<void>;
|
|
1231
|
-
activate(id: string): Promise<Profile>;
|
|
1232
|
-
deactivate(id: string): Promise<Profile>;
|
|
1250
|
+
update(id: string, input: UpdateProfileInput, actorId?: string): Promise<Profile>;
|
|
1251
|
+
delete(id: string, actorId?: string): Promise<void>;
|
|
1252
|
+
activate(id: string, actorId?: string): Promise<Profile>;
|
|
1253
|
+
deactivate(id: string, actorId?: string): Promise<Profile>;
|
|
1233
1254
|
private runDeactivate;
|
|
1234
1255
|
get(id: string): Promise<Profile | null>;
|
|
1235
1256
|
/**
|
|
@@ -1252,6 +1273,14 @@ declare class ProfileService {
|
|
|
1252
1273
|
* tree is the only thing this reads.
|
|
1253
1274
|
*/
|
|
1254
1275
|
listVersions(profileId: string): Promise<ProfileVersionEntry[]>;
|
|
1276
|
+
/**
|
|
1277
|
+
* The newest on-disk snapshot of a profile whose DB row has been deleted — what a surviving
|
|
1278
|
+
* consent record's `profileId` resolves to. Null when nothing was ever written for that id.
|
|
1279
|
+
* `version` is the one a consent record was given (`ConsentDbRecord.profileVersion`); records
|
|
1280
|
+
* from before it was tracked have none, and so does a version whose files are gone — both
|
|
1281
|
+
* resolve to the newest snapshot.
|
|
1282
|
+
*/
|
|
1283
|
+
getArchivedSnapshot(profileId: string, version?: number): Promise<PublicProfileResponse | null>;
|
|
1255
1284
|
/** Works for archived profiles too — see `listVersions()`. */
|
|
1256
1285
|
getVersionFile(profileId: string, version: string, locale: string): Promise<string | null>;
|
|
1257
1286
|
/**
|
|
@@ -1348,7 +1377,8 @@ declare class ConsentService {
|
|
|
1348
1377
|
private storage?;
|
|
1349
1378
|
private dataSigningHash?;
|
|
1350
1379
|
private gppConfig?;
|
|
1351
|
-
|
|
1380
|
+
private archivedSnapshot?;
|
|
1381
|
+
constructor(consents: ConsentRepo, visitors: VisitorRepo, profiles: ProfileRepo, audit: AuditRepo, tenantId?: string, compliance?: ComplianceConfig | undefined, pluginEngine?: PluginEngine | undefined, eventBus?: EventEmitter | undefined, tcfConfig?: TcfConfig | undefined, storage?: StorageAdapter | undefined, dataSigningHash?: string | undefined, gppConfig?: GppConfig | undefined, archivedSnapshot?: ((profileId: string, version?: number) => Promise<PublicProfileResponse | null>) | undefined);
|
|
1352
1382
|
private sign;
|
|
1353
1383
|
/** Fails closed: no `storage` to check against means unconfirmed, never assumed confirmed. */
|
|
1354
1384
|
private isTcfConfirmed;
|
|
@@ -1433,11 +1463,13 @@ declare class BetterSqlite3Adapter implements StorageAdapter {
|
|
|
1433
1463
|
private config;
|
|
1434
1464
|
private db;
|
|
1435
1465
|
private cache;
|
|
1466
|
+
private dbPath;
|
|
1436
1467
|
constructor(config: StorageConfig);
|
|
1437
1468
|
private stmt;
|
|
1438
1469
|
connect(): Promise<void>;
|
|
1439
1470
|
disconnect(): Promise<void>;
|
|
1440
1471
|
migrate(): Promise<void>;
|
|
1472
|
+
private migrateToV2;
|
|
1441
1473
|
private mapProfile;
|
|
1442
1474
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
1443
1475
|
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
@@ -1539,6 +1571,8 @@ declare class MongoDBAdapter implements StorageAdapter {
|
|
|
1539
1571
|
connect(): Promise<void>;
|
|
1540
1572
|
disconnect(): Promise<void>;
|
|
1541
1573
|
migrate(): Promise<void>;
|
|
1574
|
+
/** Collections from before the `consenti_` prefix exist and no prefixed set does: stop, don't start empty. */
|
|
1575
|
+
private refuseLegacyCollections;
|
|
1542
1576
|
private createIndexes;
|
|
1543
1577
|
private seed;
|
|
1544
1578
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
@@ -1635,6 +1669,7 @@ declare class MySQLAdapter implements StorageAdapter {
|
|
|
1635
1669
|
connect(): Promise<void>;
|
|
1636
1670
|
disconnect(): Promise<void>;
|
|
1637
1671
|
migrate(): Promise<void>;
|
|
1672
|
+
private migrateToV2;
|
|
1638
1673
|
private seed;
|
|
1639
1674
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
1640
1675
|
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
@@ -1729,6 +1764,7 @@ declare class PostgreSQLAdapter implements StorageAdapter {
|
|
|
1729
1764
|
connect(): Promise<void>;
|
|
1730
1765
|
disconnect(): Promise<void>;
|
|
1731
1766
|
migrate(): Promise<void>;
|
|
1767
|
+
private migrateToV2;
|
|
1732
1768
|
private seedTx;
|
|
1733
1769
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
1734
1770
|
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
package/dist/index.d.ts
CHANGED
|
@@ -140,8 +140,15 @@ type GeoResult = {
|
|
|
140
140
|
};
|
|
141
141
|
type CountryResolverFn = (ctx: {
|
|
142
142
|
ip: string;
|
|
143
|
+
/** The widget's `navigator.language` (single tag), or — for requests without the widget's hints —
|
|
144
|
+
* the raw `Accept-Language` header value. */
|
|
143
145
|
language: string;
|
|
146
|
+
/** Every language the visitor's browser prefers, most preferred first (the widget's
|
|
147
|
+
* `navigator.languages`; parsed from `Accept-Language` otherwise). Empty when unknown. */
|
|
148
|
+
languages: string[];
|
|
144
149
|
timezone: string;
|
|
150
|
+
/** The locale the widget asked for (`core.locale`); `''` when the request carried none. */
|
|
151
|
+
locale: string;
|
|
145
152
|
}) => Promise<GeoResult>;
|
|
146
153
|
interface S3ApiConfig {
|
|
147
154
|
enabled: boolean;
|
|
@@ -216,6 +223,10 @@ interface OptInStats {
|
|
|
216
223
|
}
|
|
217
224
|
interface ComplianceMapData {
|
|
218
225
|
version: string;
|
|
226
|
+
/** `true` (default): this map replaces the embedded one entirely, so only the countries listed here
|
|
227
|
+
* resolve (server side). `false`: `countries` is merged over the embedded map — a listed country
|
|
228
|
+
* replaces its embedded entry wholesale, every unlisted country keeps its built-in mapping. */
|
|
229
|
+
override?: boolean;
|
|
219
230
|
countries: Record<string, CountryComplianceEntry>;
|
|
220
231
|
}
|
|
221
232
|
interface CountryComplianceEntry {
|
|
@@ -239,8 +250,11 @@ interface ComplianceConfig {
|
|
|
239
250
|
geoDataProvider?: 'default' | 'maxmind' | 'geoip' | 'hosted-geoip-lite' | CountryResolverFn;
|
|
240
251
|
/** `'default'` (embedded map, the default), a URL to fetch a JSON `ComplianceMapData` document
|
|
241
252
|
* from (refreshed in the background per the response's `Cache-Control`/`Expires` header, 24h
|
|
242
|
-
* fallback if absent), or an inline operator-supplied `ComplianceMapData` object.
|
|
243
|
-
*
|
|
253
|
+
* fallback if absent), or an inline operator-supplied `ComplianceMapData` object. By default the
|
|
254
|
+
* supplied map replaces the embedded one; set `override: false` on the document to merge its
|
|
255
|
+
* `countries` over the embedded map instead (listed countries replace their embedded entry, the
|
|
256
|
+
* rest keep the built-in mapping). Invalid data from either a URL or an object logs an error and
|
|
257
|
+
* falls back to `'default'`. */
|
|
244
258
|
complianceMap?: 'default' | string | ComplianceMapData;
|
|
245
259
|
tcf?: TcfConfig;
|
|
246
260
|
gpp?: GppConfig;
|
|
@@ -401,6 +415,9 @@ interface ConsentDbRecord {
|
|
|
401
415
|
tenantId: string;
|
|
402
416
|
visitorId: string;
|
|
403
417
|
profileId: string;
|
|
418
|
+
/** The profile's `version` when this consent was last given — with `profileId`, pins the exact
|
|
419
|
+
* on-disk snapshot (the banner text the visitor saw). Absent on records from before it was tracked. */
|
|
420
|
+
profileVersion?: number;
|
|
404
421
|
locale: string;
|
|
405
422
|
consentJson: ConsentValue;
|
|
406
423
|
gpcDetected: boolean;
|
|
@@ -421,6 +438,8 @@ interface ConsentHistoryEntry {
|
|
|
421
438
|
tenantId: string;
|
|
422
439
|
consentRecordId: string;
|
|
423
440
|
visitorId: string;
|
|
441
|
+
/** The profile version in force for this change — see {@link ConsentDbRecord.profileVersion}. */
|
|
442
|
+
profileVersion?: number;
|
|
424
443
|
oldJson: ConsentValue | null;
|
|
425
444
|
newJson: ConsentValue;
|
|
426
445
|
action: 'created' | 'updated' | 'withdrawn';
|
|
@@ -523,6 +542,7 @@ interface CreateConsentInput {
|
|
|
523
542
|
tenantId: string;
|
|
524
543
|
visitorId: string;
|
|
525
544
|
profileId: string;
|
|
545
|
+
profileVersion?: number;
|
|
526
546
|
locale: string;
|
|
527
547
|
consentJson: ConsentValue;
|
|
528
548
|
gpcDetected: boolean;
|
|
@@ -535,6 +555,7 @@ interface CreateConsentInput {
|
|
|
535
555
|
}
|
|
536
556
|
interface UpdateConsentInput {
|
|
537
557
|
consentJson: ConsentValue;
|
|
558
|
+
profileVersion?: number;
|
|
538
559
|
locale?: string;
|
|
539
560
|
gpcDetected?: boolean;
|
|
540
561
|
signature?: string;
|
|
@@ -1212,7 +1233,7 @@ declare class ProfileService {
|
|
|
1212
1233
|
* unchanged from `previousVersion` by the worker — never silently dropped.
|
|
1213
1234
|
*/
|
|
1214
1235
|
private writeLocaleFiles;
|
|
1215
|
-
create(input: Omit<CreateProfileInput, 'tenantId'
|
|
1236
|
+
create(input: Omit<CreateProfileInput, 'tenantId'>, actorId?: string): Promise<Profile>;
|
|
1216
1237
|
/**
|
|
1217
1238
|
* Duplicates a profile as a brand new, always-inactive profile (own `id`, `version` starts at
|
|
1218
1239
|
* 1 again). Delegates to {@link create} rather than copying on-disk files directly — the
|
|
@@ -1220,16 +1241,16 @@ declare class ProfileService {
|
|
|
1220
1241
|
* new profile rather than byte-copied from the source's. Non-default locale content is read
|
|
1221
1242
|
* back off the source's current version files so the copy carries every locale forward too.
|
|
1222
1243
|
*/
|
|
1223
|
-
copy(id: string, name?: string): Promise<Profile>;
|
|
1244
|
+
copy(id: string, name?: string, actorId?: string): Promise<Profile>;
|
|
1224
1245
|
/**
|
|
1225
1246
|
* Mutates the existing row in place — `id` is stable across every edit, `version` is
|
|
1226
1247
|
* incremented. The prior state isn't kept as a separate DB row; its resolved-JSON snapshot
|
|
1227
1248
|
* on disk (see {@link listVersions}) is the audit trail for that edit.
|
|
1228
1249
|
*/
|
|
1229
|
-
update(id: string, input: UpdateProfileInput): Promise<Profile>;
|
|
1230
|
-
delete(id: string): Promise<void>;
|
|
1231
|
-
activate(id: string): Promise<Profile>;
|
|
1232
|
-
deactivate(id: string): Promise<Profile>;
|
|
1250
|
+
update(id: string, input: UpdateProfileInput, actorId?: string): Promise<Profile>;
|
|
1251
|
+
delete(id: string, actorId?: string): Promise<void>;
|
|
1252
|
+
activate(id: string, actorId?: string): Promise<Profile>;
|
|
1253
|
+
deactivate(id: string, actorId?: string): Promise<Profile>;
|
|
1233
1254
|
private runDeactivate;
|
|
1234
1255
|
get(id: string): Promise<Profile | null>;
|
|
1235
1256
|
/**
|
|
@@ -1252,6 +1273,14 @@ declare class ProfileService {
|
|
|
1252
1273
|
* tree is the only thing this reads.
|
|
1253
1274
|
*/
|
|
1254
1275
|
listVersions(profileId: string): Promise<ProfileVersionEntry[]>;
|
|
1276
|
+
/**
|
|
1277
|
+
* The newest on-disk snapshot of a profile whose DB row has been deleted — what a surviving
|
|
1278
|
+
* consent record's `profileId` resolves to. Null when nothing was ever written for that id.
|
|
1279
|
+
* `version` is the one a consent record was given (`ConsentDbRecord.profileVersion`); records
|
|
1280
|
+
* from before it was tracked have none, and so does a version whose files are gone — both
|
|
1281
|
+
* resolve to the newest snapshot.
|
|
1282
|
+
*/
|
|
1283
|
+
getArchivedSnapshot(profileId: string, version?: number): Promise<PublicProfileResponse | null>;
|
|
1255
1284
|
/** Works for archived profiles too — see `listVersions()`. */
|
|
1256
1285
|
getVersionFile(profileId: string, version: string, locale: string): Promise<string | null>;
|
|
1257
1286
|
/**
|
|
@@ -1348,7 +1377,8 @@ declare class ConsentService {
|
|
|
1348
1377
|
private storage?;
|
|
1349
1378
|
private dataSigningHash?;
|
|
1350
1379
|
private gppConfig?;
|
|
1351
|
-
|
|
1380
|
+
private archivedSnapshot?;
|
|
1381
|
+
constructor(consents: ConsentRepo, visitors: VisitorRepo, profiles: ProfileRepo, audit: AuditRepo, tenantId?: string, compliance?: ComplianceConfig | undefined, pluginEngine?: PluginEngine | undefined, eventBus?: EventEmitter | undefined, tcfConfig?: TcfConfig | undefined, storage?: StorageAdapter | undefined, dataSigningHash?: string | undefined, gppConfig?: GppConfig | undefined, archivedSnapshot?: ((profileId: string, version?: number) => Promise<PublicProfileResponse | null>) | undefined);
|
|
1352
1382
|
private sign;
|
|
1353
1383
|
/** Fails closed: no `storage` to check against means unconfirmed, never assumed confirmed. */
|
|
1354
1384
|
private isTcfConfirmed;
|
|
@@ -1433,11 +1463,13 @@ declare class BetterSqlite3Adapter implements StorageAdapter {
|
|
|
1433
1463
|
private config;
|
|
1434
1464
|
private db;
|
|
1435
1465
|
private cache;
|
|
1466
|
+
private dbPath;
|
|
1436
1467
|
constructor(config: StorageConfig);
|
|
1437
1468
|
private stmt;
|
|
1438
1469
|
connect(): Promise<void>;
|
|
1439
1470
|
disconnect(): Promise<void>;
|
|
1440
1471
|
migrate(): Promise<void>;
|
|
1472
|
+
private migrateToV2;
|
|
1441
1473
|
private mapProfile;
|
|
1442
1474
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
1443
1475
|
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
@@ -1539,6 +1571,8 @@ declare class MongoDBAdapter implements StorageAdapter {
|
|
|
1539
1571
|
connect(): Promise<void>;
|
|
1540
1572
|
disconnect(): Promise<void>;
|
|
1541
1573
|
migrate(): Promise<void>;
|
|
1574
|
+
/** Collections from before the `consenti_` prefix exist and no prefixed set does: stop, don't start empty. */
|
|
1575
|
+
private refuseLegacyCollections;
|
|
1542
1576
|
private createIndexes;
|
|
1543
1577
|
private seed;
|
|
1544
1578
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
@@ -1635,6 +1669,7 @@ declare class MySQLAdapter implements StorageAdapter {
|
|
|
1635
1669
|
connect(): Promise<void>;
|
|
1636
1670
|
disconnect(): Promise<void>;
|
|
1637
1671
|
migrate(): Promise<void>;
|
|
1672
|
+
private migrateToV2;
|
|
1638
1673
|
private seed;
|
|
1639
1674
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
1640
1675
|
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|
|
@@ -1729,6 +1764,7 @@ declare class PostgreSQLAdapter implements StorageAdapter {
|
|
|
1729
1764
|
connect(): Promise<void>;
|
|
1730
1765
|
disconnect(): Promise<void>;
|
|
1731
1766
|
migrate(): Promise<void>;
|
|
1767
|
+
private migrateToV2;
|
|
1732
1768
|
private seedTx;
|
|
1733
1769
|
createProfile(data: CreateProfileInput): Promise<Profile>;
|
|
1734
1770
|
updateProfile(id: string, data: UpdateProfileInput): Promise<Profile>;
|