@c15t/backend 2.0.0-rc.1 → 2.0.0-rc.2
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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +10 -0
- package/dist/core.cjs +21 -24
- package/dist/core.js +21 -24
- package/dist/db/registry/index.d.ts +0 -1
- package/dist/db/registry/index.d.ts.map +1 -1
- package/dist/db/registry/subject.d.ts +0 -1
- package/dist/db/registry/subject.d.ts.map +1 -1
- package/dist/db/schema/1.0.0/index.d.ts +0 -31
- package/dist/db/schema/1.0.0/index.d.ts.map +1 -1
- package/dist/db/schema/1.0.0/subject.d.ts +0 -1
- package/dist/db/schema/1.0.0/subject.d.ts.map +1 -1
- package/dist/db/schema/2.0.0/consent.d.ts +2 -0
- package/dist/db/schema/2.0.0/consent.d.ts.map +1 -1
- package/dist/db/schema/2.0.0/index.d.ts +16 -11
- package/dist/db/schema/2.0.0/index.d.ts.map +1 -1
- package/dist/db/schema/2.0.0/subject.d.ts +0 -1
- package/dist/db/schema/2.0.0/subject.d.ts.map +1 -1
- package/dist/db/schema/index.d.ts +32 -53
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema.cjs +1 -2
- package/dist/db/schema.js +1 -2
- package/dist/handlers/subject/get.handler.d.ts +0 -1
- package/dist/handlers/subject/get.handler.d.ts.map +1 -1
- package/dist/handlers/subject/list.handler.d.ts +0 -1
- package/dist/handlers/subject/list.handler.d.ts.map +1 -1
- package/dist/handlers/subject/patch.handler.d.ts +0 -1
- package/dist/handlers/subject/patch.handler.d.ts.map +1 -1
- package/dist/handlers/subject/post.handler.d.ts.map +1 -1
- package/dist/router.cjs +17 -16
- package/dist/router.js +17 -16
- package/dist/routes/init.d.ts.map +1 -1
- package/dist/types/index.d.ts +13 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/db/registry/subject.test.ts +1 -18
- package/src/db/registry/subject.ts +0 -3
- package/src/db/schema/1.0.0/subject.ts +0 -1
- package/src/db/schema/2.0.0/consent.ts +2 -0
- package/src/db/schema/2.0.0/subject.ts +0 -1
- package/src/db/tenant-scope.test.ts +10 -13
- package/src/handlers/subject/get.handler.ts +0 -1
- package/src/handlers/subject/list.handler.ts +0 -1
- package/src/handlers/subject/patch.handler.ts +0 -3
- package/src/handlers/subject/post.handler.ts +14 -0
- package/src/routes/init.ts +8 -5
- package/src/types/index.ts +14 -5
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGnB,CAAC"}
|
package/dist/db/schema.cjs
CHANGED
|
@@ -132,7 +132,6 @@ var __webpack_exports__ = {};
|
|
|
132
132
|
});
|
|
133
133
|
const subjectTable = (0, schema_namespaceObject.table)('subject', {
|
|
134
134
|
id: (0, schema_namespaceObject.idColumn)('id', 'varchar(255)'),
|
|
135
|
-
isIdentified: (0, schema_namespaceObject.column)('isIdentified', 'bool').defaultTo$(()=>false),
|
|
136
135
|
externalId: (0, schema_namespaceObject.column)('externalId', 'string').nullable(),
|
|
137
136
|
identityProvider: (0, schema_namespaceObject.column)('identityProvider', 'string').nullable(),
|
|
138
137
|
lastIpAddress: (0, schema_namespaceObject.column)('lastIpAddress', 'string').nullable(),
|
|
@@ -225,6 +224,7 @@ var __webpack_exports__ = {};
|
|
|
225
224
|
jurisdictionModel: (0, schema_namespaceObject.column)('jurisdictionModel', 'string').nullable(),
|
|
226
225
|
tcString: (0, schema_namespaceObject.column)('tcString', 'string').nullable(),
|
|
227
226
|
uiSource: (0, schema_namespaceObject.column)('uiSource', 'string').nullable(),
|
|
227
|
+
consentAction: (0, schema_namespaceObject.column)('consentAction', 'string').nullable(),
|
|
228
228
|
tenantId: (0, schema_namespaceObject.column)('tenantId', 'string').nullable()
|
|
229
229
|
});
|
|
230
230
|
const consent_policy_consentPolicyTable = (0, schema_namespaceObject.table)('consentPolicy', {
|
|
@@ -253,7 +253,6 @@ var __webpack_exports__ = {};
|
|
|
253
253
|
});
|
|
254
254
|
const subject_subjectTable = (0, schema_namespaceObject.table)('subject', {
|
|
255
255
|
id: (0, schema_namespaceObject.idColumn)('id', 'varchar(255)'),
|
|
256
|
-
isIdentified: (0, schema_namespaceObject.column)('isIdentified', 'bool').defaultTo$(()=>false),
|
|
257
256
|
externalId: (0, schema_namespaceObject.column)('externalId', 'string').nullable(),
|
|
258
257
|
identityProvider: (0, schema_namespaceObject.column)('identityProvider', 'string').nullable(),
|
|
259
258
|
createdAt: (0, schema_namespaceObject.column)('createdAt', 'timestamp').defaultTo$('now'),
|
package/dist/db/schema.js
CHANGED
|
@@ -73,7 +73,6 @@ const domainTable = table('domain', {
|
|
|
73
73
|
});
|
|
74
74
|
const subjectTable = table('subject', {
|
|
75
75
|
id: idColumn('id', 'varchar(255)'),
|
|
76
|
-
isIdentified: column('isIdentified', 'bool').defaultTo$(()=>false),
|
|
77
76
|
externalId: column('externalId', 'string').nullable(),
|
|
78
77
|
identityProvider: column('identityProvider', 'string').nullable(),
|
|
79
78
|
lastIpAddress: column('lastIpAddress', 'string').nullable(),
|
|
@@ -166,6 +165,7 @@ const consent_consentTable = table('consent', {
|
|
|
166
165
|
jurisdictionModel: column('jurisdictionModel', 'string').nullable(),
|
|
167
166
|
tcString: column('tcString', 'string').nullable(),
|
|
168
167
|
uiSource: column('uiSource', 'string').nullable(),
|
|
168
|
+
consentAction: column('consentAction', 'string').nullable(),
|
|
169
169
|
tenantId: column('tenantId', 'string').nullable()
|
|
170
170
|
});
|
|
171
171
|
const consent_policy_consentPolicyTable = table('consentPolicy', {
|
|
@@ -194,7 +194,6 @@ const domain_domainTable = table('domain', {
|
|
|
194
194
|
});
|
|
195
195
|
const subject_subjectTable = table('subject', {
|
|
196
196
|
id: idColumn('id', 'varchar(255)'),
|
|
197
|
-
isIdentified: column('isIdentified', 'bool').defaultTo$(()=>false),
|
|
198
197
|
externalId: column('externalId', 'string').nullable(),
|
|
199
198
|
identityProvider: column('identityProvider', 'string').nullable(),
|
|
200
199
|
createdAt: column('createdAt', 'timestamp').defaultTo$('now'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/get.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAU,GAAG,OAAO
|
|
1
|
+
{"version":3,"file":"get.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/get.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAU,GAAG,OAAO;;;;;;;;;;;;;;;;;kEAyEjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/list.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAU,GAAG,OAAO
|
|
1
|
+
{"version":3,"file":"list.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/list.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAU,GAAG,OAAO;;;;;;;;;;;;;;;;kEAyEnD,CAAC"}
|
|
@@ -16,7 +16,6 @@ export declare const patchSubjectHandler: (c: Context) => Promise<Response & imp
|
|
|
16
16
|
subject: {
|
|
17
17
|
id: string;
|
|
18
18
|
externalId: string;
|
|
19
|
-
isIdentified: true;
|
|
20
19
|
};
|
|
21
20
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
22
21
|
//# sourceMappingURL=patch.handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/patch.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAU,GAAG,OAAO
|
|
1
|
+
{"version":3,"file":"patch.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/patch.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAU,GAAG,OAAO;;;;;;kEAkGnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/post.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAU,GAAG,OAAO;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"post.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/subject/post.handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAU,GAAG,OAAO;;;;;;;;;;;kEAuPlD,CAAC"}
|
package/dist/router.cjs
CHANGED
|
@@ -857,18 +857,18 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
857
857
|
const jurisdiction = getJurisdiction(location, options);
|
|
858
858
|
const translationsResult = translations_getTranslationsData(acceptLanguage, options.advanced?.customTranslations);
|
|
859
859
|
let gvl = null;
|
|
860
|
-
if (options.advanced?.
|
|
860
|
+
if (options.advanced?.iab?.enabled) {
|
|
861
861
|
const language = translationsResult.language.split('-')[0] || 'en';
|
|
862
862
|
const gvlResolver = createGVLResolver({
|
|
863
863
|
appName: options.appName || 'c15t',
|
|
864
|
-
bundled: options.advanced.
|
|
864
|
+
bundled: options.advanced.iab.bundled,
|
|
865
865
|
cacheAdapter: options.advanced.cache?.adapter,
|
|
866
|
-
vendorIds: options.advanced.
|
|
867
|
-
endpoint: options.advanced.
|
|
866
|
+
vendorIds: options.advanced.iab.vendorIds,
|
|
867
|
+
endpoint: options.advanced.iab.endpoint
|
|
868
868
|
});
|
|
869
869
|
gvl = await gvlResolver.get(language);
|
|
870
870
|
}
|
|
871
|
-
const customVendors = options.advanced?.
|
|
871
|
+
const customVendors = options.advanced?.iab?.customVendors;
|
|
872
872
|
const gpc = '1' === request.headers.get('sec-gpc');
|
|
873
873
|
getMetrics()?.recordInit({
|
|
874
874
|
jurisdiction,
|
|
@@ -882,12 +882,15 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
882
882
|
translations: translationsResult,
|
|
883
883
|
branding: options.advanced?.branding || 'c15t',
|
|
884
884
|
gvl,
|
|
885
|
-
customVendors
|
|
885
|
+
customVendors,
|
|
886
|
+
...options.advanced?.iab?.cmpId != null && {
|
|
887
|
+
cmpId: options.advanced.iab.cmpId
|
|
888
|
+
}
|
|
886
889
|
});
|
|
887
890
|
});
|
|
888
891
|
return app;
|
|
889
892
|
};
|
|
890
|
-
const version_version = '2.0.0-rc.
|
|
893
|
+
const version_version = '2.0.0-rc.2';
|
|
891
894
|
function getHeaders(headers) {
|
|
892
895
|
if (!headers) return {
|
|
893
896
|
countryCode: null,
|
|
@@ -1002,7 +1005,6 @@ const getSubjectHandler = async (c)=>{
|
|
|
1002
1005
|
subject: {
|
|
1003
1006
|
id: subject.id,
|
|
1004
1007
|
externalId: subject.externalId ?? void 0,
|
|
1005
|
-
isIdentified: subject.isIdentified,
|
|
1006
1008
|
createdAt: subject.createdAt
|
|
1007
1009
|
},
|
|
1008
1010
|
consents: filteredConsents,
|
|
@@ -1058,7 +1060,6 @@ const listSubjectsHandler = async (c)=>{
|
|
|
1058
1060
|
return {
|
|
1059
1061
|
id: subject.id,
|
|
1060
1062
|
externalId: subject.externalId ?? externalId,
|
|
1061
|
-
isIdentified: subject.isIdentified,
|
|
1062
1063
|
createdAt: subject.createdAt,
|
|
1063
1064
|
consents: consentItems
|
|
1064
1065
|
};
|
|
@@ -1191,7 +1192,6 @@ const patchSubjectHandler = async (c)=>{
|
|
|
1191
1192
|
set: {
|
|
1192
1193
|
externalId,
|
|
1193
1194
|
identityProvider,
|
|
1194
|
-
isIdentified: true,
|
|
1195
1195
|
updatedAt: new Date()
|
|
1196
1196
|
}
|
|
1197
1197
|
});
|
|
@@ -1211,10 +1211,6 @@ const patchSubjectHandler = async (c)=>{
|
|
|
1211
1211
|
identityProvider: {
|
|
1212
1212
|
from: subject.identityProvider,
|
|
1213
1213
|
to: identityProvider
|
|
1214
|
-
},
|
|
1215
|
-
isIdentified: {
|
|
1216
|
-
from: subject.isIdentified,
|
|
1217
|
-
to: true
|
|
1218
1214
|
}
|
|
1219
1215
|
},
|
|
1220
1216
|
metadata: {
|
|
@@ -1233,8 +1229,7 @@ const patchSubjectHandler = async (c)=>{
|
|
|
1233
1229
|
success: true,
|
|
1234
1230
|
subject: {
|
|
1235
1231
|
id: subjectId,
|
|
1236
|
-
externalId
|
|
1237
|
-
isIdentified: true
|
|
1232
|
+
externalId
|
|
1238
1233
|
}
|
|
1239
1234
|
});
|
|
1240
1235
|
} catch (error) {
|
|
@@ -1260,6 +1255,11 @@ const postSubjectHandler = async (c)=>{
|
|
|
1260
1255
|
const { type, subjectId, identityProvider, externalSubjectId, domain, metadata, givenAt: givenAtEpoch } = input;
|
|
1261
1256
|
const preferences = 'preferences' in input ? input.preferences : void 0;
|
|
1262
1257
|
const givenAt = new Date(givenAtEpoch);
|
|
1258
|
+
const rawConsentAction = 'consentAction' in input ? input.consentAction : void 0;
|
|
1259
|
+
let derivedConsentAction;
|
|
1260
|
+
if ('all' === rawConsentAction) derivedConsentAction = 'accept_all';
|
|
1261
|
+
else if ('necessary' === rawConsentAction) derivedConsentAction = 'opt-out' === input.jurisdictionModel ? 'opt_out' : 'reject_all';
|
|
1262
|
+
else if ('custom' === rawConsentAction) derivedConsentAction = 'custom';
|
|
1263
1263
|
logger.debug('Request parameters', {
|
|
1264
1264
|
type,
|
|
1265
1265
|
subjectId,
|
|
@@ -1382,6 +1382,7 @@ const postSubjectHandler = async (c)=>{
|
|
|
1382
1382
|
jurisdictionModel: input.jurisdictionModel,
|
|
1383
1383
|
tcString: input.tcString,
|
|
1384
1384
|
uiSource: input.uiSource,
|
|
1385
|
+
consentAction: derivedConsentAction,
|
|
1385
1386
|
givenAt
|
|
1386
1387
|
});
|
|
1387
1388
|
logger.debug('Created consent', {
|
package/dist/router.js
CHANGED
|
@@ -14,7 +14,7 @@ function extractErrorMessage(error) {
|
|
|
14
14
|
if (error instanceof Error) return error.message || error.name;
|
|
15
15
|
return String(error);
|
|
16
16
|
}
|
|
17
|
-
const version_version = '2.0.0-rc.
|
|
17
|
+
const version_version = '2.0.0-rc.2';
|
|
18
18
|
let cachedConfig = null;
|
|
19
19
|
let cachedDefaultAttributes = {};
|
|
20
20
|
function create_telemetry_options_isTelemetryEnabled(options) {
|
|
@@ -820,18 +820,18 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
820
820
|
const jurisdiction = getJurisdiction(location, options);
|
|
821
821
|
const translationsResult = translations_getTranslationsData(acceptLanguage, options.advanced?.customTranslations);
|
|
822
822
|
let gvl = null;
|
|
823
|
-
if (options.advanced?.
|
|
823
|
+
if (options.advanced?.iab?.enabled) {
|
|
824
824
|
const language = translationsResult.language.split('-')[0] || 'en';
|
|
825
825
|
const gvlResolver = createGVLResolver({
|
|
826
826
|
appName: options.appName || 'c15t',
|
|
827
|
-
bundled: options.advanced.
|
|
827
|
+
bundled: options.advanced.iab.bundled,
|
|
828
828
|
cacheAdapter: options.advanced.cache?.adapter,
|
|
829
|
-
vendorIds: options.advanced.
|
|
830
|
-
endpoint: options.advanced.
|
|
829
|
+
vendorIds: options.advanced.iab.vendorIds,
|
|
830
|
+
endpoint: options.advanced.iab.endpoint
|
|
831
831
|
});
|
|
832
832
|
gvl = await gvlResolver.get(language);
|
|
833
833
|
}
|
|
834
|
-
const customVendors = options.advanced?.
|
|
834
|
+
const customVendors = options.advanced?.iab?.customVendors;
|
|
835
835
|
const gpc = '1' === request.headers.get('sec-gpc');
|
|
836
836
|
getMetrics()?.recordInit({
|
|
837
837
|
jurisdiction,
|
|
@@ -845,7 +845,10 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
845
845
|
translations: translationsResult,
|
|
846
846
|
branding: options.advanced?.branding || 'c15t',
|
|
847
847
|
gvl,
|
|
848
|
-
customVendors
|
|
848
|
+
customVendors,
|
|
849
|
+
...options.advanced?.iab?.cmpId != null && {
|
|
850
|
+
cmpId: options.advanced.iab.cmpId
|
|
851
|
+
}
|
|
849
852
|
});
|
|
850
853
|
});
|
|
851
854
|
return app;
|
|
@@ -963,7 +966,6 @@ const getSubjectHandler = async (c)=>{
|
|
|
963
966
|
subject: {
|
|
964
967
|
id: subject.id,
|
|
965
968
|
externalId: subject.externalId ?? void 0,
|
|
966
|
-
isIdentified: subject.isIdentified,
|
|
967
969
|
createdAt: subject.createdAt
|
|
968
970
|
},
|
|
969
971
|
consents: filteredConsents,
|
|
@@ -1019,7 +1021,6 @@ const listSubjectsHandler = async (c)=>{
|
|
|
1019
1021
|
return {
|
|
1020
1022
|
id: subject.id,
|
|
1021
1023
|
externalId: subject.externalId ?? externalId,
|
|
1022
|
-
isIdentified: subject.isIdentified,
|
|
1023
1024
|
createdAt: subject.createdAt,
|
|
1024
1025
|
consents: consentItems
|
|
1025
1026
|
};
|
|
@@ -1150,7 +1151,6 @@ const patchSubjectHandler = async (c)=>{
|
|
|
1150
1151
|
set: {
|
|
1151
1152
|
externalId,
|
|
1152
1153
|
identityProvider,
|
|
1153
|
-
isIdentified: true,
|
|
1154
1154
|
updatedAt: new Date()
|
|
1155
1155
|
}
|
|
1156
1156
|
});
|
|
@@ -1170,10 +1170,6 @@ const patchSubjectHandler = async (c)=>{
|
|
|
1170
1170
|
identityProvider: {
|
|
1171
1171
|
from: subject.identityProvider,
|
|
1172
1172
|
to: identityProvider
|
|
1173
|
-
},
|
|
1174
|
-
isIdentified: {
|
|
1175
|
-
from: subject.isIdentified,
|
|
1176
|
-
to: true
|
|
1177
1173
|
}
|
|
1178
1174
|
},
|
|
1179
1175
|
metadata: {
|
|
@@ -1192,8 +1188,7 @@ const patchSubjectHandler = async (c)=>{
|
|
|
1192
1188
|
success: true,
|
|
1193
1189
|
subject: {
|
|
1194
1190
|
id: subjectId,
|
|
1195
|
-
externalId
|
|
1196
|
-
isIdentified: true
|
|
1191
|
+
externalId
|
|
1197
1192
|
}
|
|
1198
1193
|
});
|
|
1199
1194
|
} catch (error) {
|
|
@@ -1219,6 +1214,11 @@ const postSubjectHandler = async (c)=>{
|
|
|
1219
1214
|
const { type, subjectId, identityProvider, externalSubjectId, domain, metadata, givenAt: givenAtEpoch } = input;
|
|
1220
1215
|
const preferences = 'preferences' in input ? input.preferences : void 0;
|
|
1221
1216
|
const givenAt = new Date(givenAtEpoch);
|
|
1217
|
+
const rawConsentAction = 'consentAction' in input ? input.consentAction : void 0;
|
|
1218
|
+
let derivedConsentAction;
|
|
1219
|
+
if ('all' === rawConsentAction) derivedConsentAction = 'accept_all';
|
|
1220
|
+
else if ('necessary' === rawConsentAction) derivedConsentAction = 'opt-out' === input.jurisdictionModel ? 'opt_out' : 'reject_all';
|
|
1221
|
+
else if ('custom' === rawConsentAction) derivedConsentAction = 'custom';
|
|
1222
1222
|
logger.debug('Request parameters', {
|
|
1223
1223
|
type,
|
|
1224
1224
|
subjectId,
|
|
@@ -1341,6 +1341,7 @@ const postSubjectHandler = async (c)=>{
|
|
|
1341
1341
|
jurisdictionModel: input.jurisdictionModel,
|
|
1342
1342
|
tcString: input.tcString,
|
|
1343
1343
|
uiSource: input.uiSource,
|
|
1344
|
+
consentAction: derivedConsentAction,
|
|
1344
1345
|
givenAt
|
|
1345
1346
|
});
|
|
1346
1347
|
logger.debug('Created consent', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/routes/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW;eACjB;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/routes/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW;eACjB;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;yCAqF9D,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -162,16 +162,24 @@ export interface AdvancedOptions {
|
|
|
162
162
|
*/
|
|
163
163
|
apiKeys?: string[];
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
165
|
+
* IAB TCF configuration including GVL, CMP registration, and custom vendors.
|
|
166
166
|
* Disabled by default - most users don't need IAB TCF.
|
|
167
|
-
* Set enabled: true to activate
|
|
167
|
+
* Set enabled: true to activate IAB support.
|
|
168
168
|
*/
|
|
169
|
-
|
|
169
|
+
iab?: {
|
|
170
170
|
/**
|
|
171
|
-
* Enable
|
|
171
|
+
* Enable IAB TCF support.
|
|
172
172
|
* When false or not provided, /init returns gvl: null.
|
|
173
173
|
*/
|
|
174
174
|
enabled: true;
|
|
175
|
+
/**
|
|
176
|
+
* CMP ID registered with IAB Europe.
|
|
177
|
+
* This is returned to clients via the /init endpoint so they
|
|
178
|
+
* can use the correct CMP identity in TC Strings.
|
|
179
|
+
*
|
|
180
|
+
* @see https://iabeurope.eu/cmp-list/ - List of registered CMPs
|
|
181
|
+
*/
|
|
182
|
+
cmpId?: number;
|
|
175
183
|
/**
|
|
176
184
|
* Bundled GVL translations by language code.
|
|
177
185
|
* These are checked first before any cache or fetch.
|
|
@@ -181,7 +189,7 @@ export interface AdvancedOptions {
|
|
|
181
189
|
* import enGVL from './gvl/en.json';
|
|
182
190
|
* import deGVL from './gvl/de.json';
|
|
183
191
|
*
|
|
184
|
-
*
|
|
192
|
+
* iab: {
|
|
185
193
|
* enabled: true,
|
|
186
194
|
* bundled: { en: enGVL, de: deGVL }
|
|
187
195
|
* }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACN,KAAK,QAAQ,EAEb,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEjD,cAAc,OAAO,CAAC;AAGtB,eAAO,MAAM,QAAQ,sCAAiB,CAAC;AACvC,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS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AE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.0.0-rc.
|
|
1
|
+
export declare const version = "2.0.0-rc.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/backend",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.2",
|
|
4
4
|
"description": "Consent policy engine and API for c15t. Powers the cookie banner, consent manager, and preferences centre. Webhooks, audit logs, storage adapters. Self host or use consent.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"consent",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@c15t/logger": "2.0.0-rc.1",
|
|
114
|
-
"@c15t/schema": "2.0.0-rc.
|
|
114
|
+
"@c15t/schema": "2.0.0-rc.2",
|
|
115
115
|
"@c15t/translations": "2.0.0-rc.1",
|
|
116
116
|
"@hono/standard-validator": "^0.2.2",
|
|
117
117
|
"@hono/valibot-validator": "0.6.1",
|
|
@@ -18,7 +18,7 @@ describe('subjectRegistry', () => {
|
|
|
18
18
|
|
|
19
19
|
const createMockSubject = (overrides: Partial<Subject> = {}): Subject => ({
|
|
20
20
|
id: 'sub_test_123',
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
externalId: null,
|
|
23
23
|
identityProvider: 'anonymous',
|
|
24
24
|
createdAt: new Date('2024-01-01T00:00:00.000Z'),
|
|
@@ -36,7 +36,6 @@ describe('subjectRegistry', () => {
|
|
|
36
36
|
const mockSubject = createMockSubject({
|
|
37
37
|
id: 'sub_existing',
|
|
38
38
|
externalId: 'ext_123',
|
|
39
|
-
isIdentified: true,
|
|
40
39
|
});
|
|
41
40
|
|
|
42
41
|
const db = {
|
|
@@ -66,7 +65,6 @@ describe('subjectRegistry', () => {
|
|
|
66
65
|
id: 'sub_new',
|
|
67
66
|
externalId: null,
|
|
68
67
|
identityProvider: 'anonymous',
|
|
69
|
-
isIdentified: false,
|
|
70
68
|
});
|
|
71
69
|
|
|
72
70
|
const db = {
|
|
@@ -91,7 +89,6 @@ describe('subjectRegistry', () => {
|
|
|
91
89
|
id: 'sub_new',
|
|
92
90
|
externalId: null,
|
|
93
91
|
identityProvider: 'anonymous',
|
|
94
|
-
isIdentified: false,
|
|
95
92
|
});
|
|
96
93
|
|
|
97
94
|
expect(result).toEqual(createdSubject);
|
|
@@ -102,7 +99,6 @@ describe('subjectRegistry', () => {
|
|
|
102
99
|
id: 'sub_new',
|
|
103
100
|
externalId: 'ext_123',
|
|
104
101
|
identityProvider: 'external',
|
|
105
|
-
isIdentified: true,
|
|
106
102
|
});
|
|
107
103
|
|
|
108
104
|
const db = {
|
|
@@ -124,7 +120,6 @@ describe('subjectRegistry', () => {
|
|
|
124
120
|
id: 'sub_new',
|
|
125
121
|
externalId: 'ext_123',
|
|
126
122
|
identityProvider: 'external',
|
|
127
|
-
isIdentified: true,
|
|
128
123
|
});
|
|
129
124
|
|
|
130
125
|
expect(result).toEqual(createdSubject);
|
|
@@ -137,7 +132,6 @@ describe('subjectRegistry', () => {
|
|
|
137
132
|
id: 'sub_test_123',
|
|
138
133
|
externalId: 'ext_existing',
|
|
139
134
|
identityProvider: 'external',
|
|
140
|
-
isIdentified: true,
|
|
141
135
|
});
|
|
142
136
|
|
|
143
137
|
const db = {
|
|
@@ -158,7 +152,6 @@ describe('subjectRegistry', () => {
|
|
|
158
152
|
id: 'sub_test_123',
|
|
159
153
|
externalId: 'ext_existing',
|
|
160
154
|
identityProvider: 'external',
|
|
161
|
-
isIdentified: true,
|
|
162
155
|
});
|
|
163
156
|
|
|
164
157
|
expect(result).toEqual(mockSubject);
|
|
@@ -173,7 +166,6 @@ describe('subjectRegistry', () => {
|
|
|
173
166
|
id: 'sub_test_123',
|
|
174
167
|
externalId: 'ext_new',
|
|
175
168
|
identityProvider: 'google',
|
|
176
|
-
isIdentified: true,
|
|
177
169
|
});
|
|
178
170
|
|
|
179
171
|
const db = {
|
|
@@ -194,7 +186,6 @@ describe('subjectRegistry', () => {
|
|
|
194
186
|
id: 'sub_test_123',
|
|
195
187
|
externalId: 'ext_new',
|
|
196
188
|
identityProvider: 'google',
|
|
197
|
-
isIdentified: true,
|
|
198
189
|
});
|
|
199
190
|
|
|
200
191
|
expect(result).toEqual(mockSubject);
|
|
@@ -222,7 +213,6 @@ describe('subjectRegistry', () => {
|
|
|
222
213
|
id: 'sub_test_123',
|
|
223
214
|
externalId: 'ext_test',
|
|
224
215
|
identityProvider: 'external',
|
|
225
|
-
isIdentified: true,
|
|
226
216
|
});
|
|
227
217
|
});
|
|
228
218
|
});
|
|
@@ -231,7 +221,6 @@ describe('subjectRegistry', () => {
|
|
|
231
221
|
it('should create a new anonymous subject', async () => {
|
|
232
222
|
const mockSubject = createMockSubject({
|
|
233
223
|
externalId: null,
|
|
234
|
-
isIdentified: false,
|
|
235
224
|
});
|
|
236
225
|
|
|
237
226
|
const db = {
|
|
@@ -251,7 +240,6 @@ describe('subjectRegistry', () => {
|
|
|
251
240
|
id: 'sub_test_123',
|
|
252
241
|
externalId: null,
|
|
253
242
|
identityProvider: 'anonymous',
|
|
254
|
-
isIdentified: false,
|
|
255
243
|
});
|
|
256
244
|
|
|
257
245
|
expect(result).toEqual(mockSubject);
|
|
@@ -263,7 +251,6 @@ describe('subjectRegistry', () => {
|
|
|
263
251
|
it('should create anonymous subject when no arguments provided', async () => {
|
|
264
252
|
const mockSubject = createMockSubject({
|
|
265
253
|
externalId: null,
|
|
266
|
-
isIdentified: false,
|
|
267
254
|
});
|
|
268
255
|
|
|
269
256
|
const db = {
|
|
@@ -281,7 +268,6 @@ describe('subjectRegistry', () => {
|
|
|
281
268
|
id: 'sub_test_123',
|
|
282
269
|
externalId: null,
|
|
283
270
|
identityProvider: 'anonymous',
|
|
284
|
-
isIdentified: false,
|
|
285
271
|
});
|
|
286
272
|
|
|
287
273
|
expect(result).toEqual(mockSubject);
|
|
@@ -310,7 +296,6 @@ describe('subjectRegistry', () => {
|
|
|
310
296
|
id: 'sub_test_123',
|
|
311
297
|
externalId: null,
|
|
312
298
|
identityProvider: 'anonymous',
|
|
313
|
-
isIdentified: false,
|
|
314
299
|
});
|
|
315
300
|
});
|
|
316
301
|
|
|
@@ -335,7 +320,6 @@ describe('subjectRegistry', () => {
|
|
|
335
320
|
id: 'sub_test_123',
|
|
336
321
|
externalId: null,
|
|
337
322
|
identityProvider: 'anonymous',
|
|
338
|
-
isIdentified: false,
|
|
339
323
|
});
|
|
340
324
|
});
|
|
341
325
|
});
|
|
@@ -380,7 +364,6 @@ describe('subjectRegistry', () => {
|
|
|
380
364
|
id: 'sub_test_123',
|
|
381
365
|
externalId: 'ext_test',
|
|
382
366
|
identityProvider: 'external',
|
|
383
|
-
isIdentified: true,
|
|
384
367
|
});
|
|
385
368
|
});
|
|
386
369
|
});
|
|
@@ -68,7 +68,6 @@ export function subjectRegistry({ db, ctx }: Registry) {
|
|
|
68
68
|
identityProvider: externalSubjectId
|
|
69
69
|
? (identityProvider ?? 'external')
|
|
70
70
|
: 'anonymous',
|
|
71
|
-
isIdentified: !!externalSubjectId,
|
|
72
71
|
});
|
|
73
72
|
|
|
74
73
|
logger.debug('Created new subject', {
|
|
@@ -90,7 +89,6 @@ export function subjectRegistry({ db, ctx }: Registry) {
|
|
|
90
89
|
id: await generateUniqueId(db, 'subject', ctx),
|
|
91
90
|
externalId: externalSubjectId,
|
|
92
91
|
identityProvider: identityProvider ?? 'external',
|
|
93
|
-
isIdentified: true,
|
|
94
92
|
});
|
|
95
93
|
|
|
96
94
|
return subject;
|
|
@@ -102,7 +100,6 @@ export function subjectRegistry({ db, ctx }: Registry) {
|
|
|
102
100
|
id: await generateUniqueId(db, 'subject', ctx),
|
|
103
101
|
externalId: null,
|
|
104
102
|
identityProvider: 'anonymous',
|
|
105
|
-
isIdentified: false,
|
|
106
103
|
});
|
|
107
104
|
|
|
108
105
|
logger.debug('Created new anonymous subject', {
|
|
@@ -2,7 +2,6 @@ import { column, idColumn, table } from 'fumadb/schema';
|
|
|
2
2
|
|
|
3
3
|
export const subjectTable = table('subject', {
|
|
4
4
|
id: idColumn('id', 'varchar(255)'),
|
|
5
|
-
isIdentified: column('isIdentified', 'bool').defaultTo$(() => false),
|
|
6
5
|
externalId: column('externalId', 'string').nullable(),
|
|
7
6
|
identityProvider: column('identityProvider', 'string').nullable(),
|
|
8
7
|
lastIpAddress: column('lastIpAddress', 'string').nullable(),
|
|
@@ -20,6 +20,8 @@ export const consentTable = table('consent', {
|
|
|
20
20
|
tcString: column('tcString', 'string').nullable(),
|
|
21
21
|
/** Which UI component collected this consent (e.g., 'banner', 'dialog', 'widget') */
|
|
22
22
|
uiSource: column('uiSource', 'string').nullable(),
|
|
23
|
+
/** Derived consent action (e.g., 'accept_all', 'reject_all', 'opt_out', 'custom') */
|
|
24
|
+
consentAction: column('consentAction', 'string').nullable(),
|
|
23
25
|
tenantId: column('tenantId', 'string').nullable(),
|
|
24
26
|
});
|
|
25
27
|
|
|
@@ -3,7 +3,6 @@ import { column, idColumn, table } from 'fumadb/schema';
|
|
|
3
3
|
|
|
4
4
|
export const subjectTable = table('subject', {
|
|
5
5
|
id: idColumn('id', 'varchar(255)'),
|
|
6
|
-
isIdentified: column('isIdentified', 'bool').defaultTo$(() => false),
|
|
7
6
|
externalId: column('externalId', 'string').nullable(),
|
|
8
7
|
identityProvider: column('identityProvider', 'string').nullable(),
|
|
9
8
|
createdAt: column('createdAt', 'timestamp').defaultTo$('now'),
|