@c15t/backend 2.0.0-rc.1 → 2.0.0-rc.3
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 +16 -0
- package/dist/core.cjs +22 -24
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +22 -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/core.ts +1 -0
- 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
package/.turbo/turbo-build.log
CHANGED
|
@@ -5,12 +5,12 @@ $ genversion --esm --semi src/version.ts
|
|
|
5
5
|
Rslib v0.18.3
|
|
6
6
|
|
|
7
7
|
info build started...
|
|
8
|
-
ready built in [1m0.
|
|
9
|
-
ready built in [1m0.
|
|
8
|
+
ready built in [1m0.40[22m s[2m (esm)[22m
|
|
9
|
+
ready built in [1m0.41[22m s[2m (cjs)[22m
|
|
10
10
|
start generating declaration files... [2m(esm)[22m
|
|
11
11
|
start generating declaration files... [2m(cjs)[22m
|
|
12
|
-
ready declaration files generated in [1m6.
|
|
13
|
-
ready declaration files generated in [1m6.
|
|
12
|
+
ready declaration files generated in [1m6.66[22m s [2m(esm)[22m
|
|
13
|
+
ready declaration files generated in [1m6.72[22m s [2m(cjs)[22m
|
|
14
14
|
|
|
15
15
|
[34mFile (esm) Size [39m
|
|
16
16
|
[2mdist/db/[22m[36madapters.js[39m 0.00 kB
|
|
@@ -22,12 +22,12 @@ ready declaration files generated in [1m6.67[22m s [2m(esm)[22m
|
|
|
22
22
|
[2mdist/db/adapters/[22m[36mtypeorm.js[39m 0.09 kB
|
|
23
23
|
[2mdist/[22m[36mtypes.js[39m 0.11 kB
|
|
24
24
|
[2mdist/db/[22m[36mmigrator.js[39m 0.96 kB
|
|
25
|
-
[2mdist/db/[22m[36mschema.js[39m 11.
|
|
25
|
+
[2mdist/db/[22m[36mschema.js[39m 11.0 kB
|
|
26
26
|
[2mdist/[22m[36mcache.js[39m 17.4 kB
|
|
27
|
-
[2mdist/[22m[36mrouter.js[39m 54.
|
|
27
|
+
[2mdist/[22m[36mrouter.js[39m 54.8 kB
|
|
28
28
|
[2mdist/[22m[36mcore.js[39m 98.6 kB
|
|
29
29
|
|
|
30
|
-
[35mTotal:[39m 183.
|
|
30
|
+
[35mTotal:[39m 183.4 kB
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
[34mFile (cjs) Size [39m
|
|
@@ -40,10 +40,10 @@ ready declaration files generated in [1m6.67[22m s [2m(esm)[22m
|
|
|
40
40
|
[2mdist/db/adapters/[22m[36mdrizzle.cjs[39m 1.3 kB
|
|
41
41
|
[2mdist/db/adapters/[22m[36mtypeorm.cjs[39m 1.3 kB
|
|
42
42
|
[2mdist/db/[22m[36mmigrator.cjs[39m 2.1 kB
|
|
43
|
-
[2mdist/db/[22m[36mschema.cjs[39m 19.
|
|
43
|
+
[2mdist/db/[22m[36mschema.cjs[39m 19.0 kB
|
|
44
44
|
[2mdist/[22m[36mcache.cjs[39m 20.0 kB
|
|
45
|
-
[2mdist/[22m[36mrouter.cjs[39m 58.
|
|
46
|
-
[2mdist/[22m[36mcore.cjs[39m 119.
|
|
45
|
+
[2mdist/[22m[36mrouter.cjs[39m 58.9 kB
|
|
46
|
+
[2mdist/[22m[36mcore.cjs[39m 119.2 kB
|
|
47
47
|
|
|
48
|
-
[35mTotal:[39m 228.
|
|
48
|
+
[35mTotal:[39m 228.8 kB
|
|
49
49
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @c15t/backend
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0a18fb6: feat(backend): add base '/' root endpoint for better DX
|
|
8
|
+
|
|
9
|
+
## 2.0.0-rc.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 408df0e: feat: CMP ID now comes from backend, either consent.io when hosted or BYO CMP ID
|
|
14
|
+
feat: Center the IAB Banner for better policy compliance
|
|
15
|
+
feat: Improve doc comments around IAB
|
|
16
|
+
- Updated dependencies [408df0e]
|
|
17
|
+
- @c15t/schema@2.0.0-rc.2
|
|
18
|
+
|
|
3
19
|
## 2.0.0-rc.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/core.cjs
CHANGED
|
@@ -79,7 +79,6 @@ var __webpack_modules__ = {
|
|
|
79
79
|
});
|
|
80
80
|
const subjectTable = (0, schema_namespaceObject.table)('subject', {
|
|
81
81
|
id: (0, schema_namespaceObject.idColumn)('id', 'varchar(255)'),
|
|
82
|
-
isIdentified: (0, schema_namespaceObject.column)('isIdentified', 'bool').defaultTo$(()=>false),
|
|
83
82
|
externalId: (0, schema_namespaceObject.column)('externalId', 'string').nullable(),
|
|
84
83
|
identityProvider: (0, schema_namespaceObject.column)('identityProvider', 'string').nullable(),
|
|
85
84
|
lastIpAddress: (0, schema_namespaceObject.column)('lastIpAddress', 'string').nullable(),
|
|
@@ -172,6 +171,7 @@ var __webpack_modules__ = {
|
|
|
172
171
|
jurisdictionModel: (0, schema_namespaceObject.column)('jurisdictionModel', 'string').nullable(),
|
|
173
172
|
tcString: (0, schema_namespaceObject.column)('tcString', 'string').nullable(),
|
|
174
173
|
uiSource: (0, schema_namespaceObject.column)('uiSource', 'string').nullable(),
|
|
174
|
+
consentAction: (0, schema_namespaceObject.column)('consentAction', 'string').nullable(),
|
|
175
175
|
tenantId: (0, schema_namespaceObject.column)('tenantId', 'string').nullable()
|
|
176
176
|
});
|
|
177
177
|
const consent_policy_consentPolicyTable = (0, schema_namespaceObject.table)('consentPolicy', {
|
|
@@ -199,7 +199,6 @@ var __webpack_modules__ = {
|
|
|
199
199
|
});
|
|
200
200
|
const subject_subjectTable = (0, schema_namespaceObject.table)('subject', {
|
|
201
201
|
id: (0, schema_namespaceObject.idColumn)('id', 'varchar(255)'),
|
|
202
|
-
isIdentified: (0, schema_namespaceObject.column)('isIdentified', 'bool').defaultTo$(()=>false),
|
|
203
202
|
externalId: (0, schema_namespaceObject.column)('externalId', 'string').nullable(),
|
|
204
203
|
identityProvider: (0, schema_namespaceObject.column)('identityProvider', 'string').nullable(),
|
|
205
204
|
createdAt: (0, schema_namespaceObject.column)('createdAt', 'timestamp').defaultTo$('now'),
|
|
@@ -569,7 +568,7 @@ var __webpack_exports__ = {};
|
|
|
569
568
|
}
|
|
570
569
|
return null;
|
|
571
570
|
}
|
|
572
|
-
const version_version = '2.0.0-rc.
|
|
571
|
+
const version_version = '2.0.0-rc.3';
|
|
573
572
|
function extractErrorMessage(error) {
|
|
574
573
|
if (error instanceof AggregateError && error.errors?.length > 0) {
|
|
575
574
|
const inner = error.errors.map((e)=>e instanceof Error ? e.message : String(e)).join('; ');
|
|
@@ -1194,8 +1193,7 @@ var __webpack_exports__ = {};
|
|
|
1194
1193
|
const newSubject = await db.create('subject', {
|
|
1195
1194
|
id: subjectId,
|
|
1196
1195
|
externalId: externalSubjectId ?? null,
|
|
1197
|
-
identityProvider: externalSubjectId ? identityProvider ?? 'external' : 'anonymous'
|
|
1198
|
-
isIdentified: !!externalSubjectId
|
|
1196
|
+
identityProvider: externalSubjectId ? identityProvider ?? 'external' : 'anonymous'
|
|
1199
1197
|
});
|
|
1200
1198
|
logger.debug('Created new subject', {
|
|
1201
1199
|
subject: newSubject
|
|
@@ -1209,8 +1207,7 @@ var __webpack_exports__ = {};
|
|
|
1209
1207
|
const subject = await db.create('subject', {
|
|
1210
1208
|
id: await generateUniqueId(db, 'subject', ctx),
|
|
1211
1209
|
externalId: externalSubjectId,
|
|
1212
|
-
identityProvider: identityProvider ?? 'external'
|
|
1213
|
-
isIdentified: true
|
|
1210
|
+
identityProvider: identityProvider ?? 'external'
|
|
1214
1211
|
});
|
|
1215
1212
|
return subject;
|
|
1216
1213
|
}
|
|
@@ -1218,8 +1215,7 @@ var __webpack_exports__ = {};
|
|
|
1218
1215
|
const subject = await db.create('subject', {
|
|
1219
1216
|
id: await generateUniqueId(db, 'subject', ctx),
|
|
1220
1217
|
externalId: null,
|
|
1221
|
-
identityProvider: 'anonymous'
|
|
1222
|
-
isIdentified: false
|
|
1218
|
+
identityProvider: 'anonymous'
|
|
1223
1219
|
});
|
|
1224
1220
|
logger.debug('Created new anonymous subject', {
|
|
1225
1221
|
subject
|
|
@@ -1907,18 +1903,18 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
1907
1903
|
const jurisdiction = getJurisdiction(location, options);
|
|
1908
1904
|
const translationsResult = translations_getTranslationsData(acceptLanguage, options.advanced?.customTranslations);
|
|
1909
1905
|
let gvl = null;
|
|
1910
|
-
if (options.advanced?.
|
|
1906
|
+
if (options.advanced?.iab?.enabled) {
|
|
1911
1907
|
const language = translationsResult.language.split('-')[0] || 'en';
|
|
1912
1908
|
const gvlResolver = createGVLResolver({
|
|
1913
1909
|
appName: options.appName || 'c15t',
|
|
1914
|
-
bundled: options.advanced.
|
|
1910
|
+
bundled: options.advanced.iab.bundled,
|
|
1915
1911
|
cacheAdapter: options.advanced.cache?.adapter,
|
|
1916
|
-
vendorIds: options.advanced.
|
|
1917
|
-
endpoint: options.advanced.
|
|
1912
|
+
vendorIds: options.advanced.iab.vendorIds,
|
|
1913
|
+
endpoint: options.advanced.iab.endpoint
|
|
1918
1914
|
});
|
|
1919
1915
|
gvl = await gvlResolver.get(language);
|
|
1920
1916
|
}
|
|
1921
|
-
const customVendors = options.advanced?.
|
|
1917
|
+
const customVendors = options.advanced?.iab?.customVendors;
|
|
1922
1918
|
const gpc = '1' === request.headers.get('sec-gpc');
|
|
1923
1919
|
getMetrics()?.recordInit({
|
|
1924
1920
|
jurisdiction,
|
|
@@ -1932,7 +1928,10 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
1932
1928
|
translations: translationsResult,
|
|
1933
1929
|
branding: options.advanced?.branding || 'c15t',
|
|
1934
1930
|
gvl,
|
|
1935
|
-
customVendors
|
|
1931
|
+
customVendors,
|
|
1932
|
+
...options.advanced?.iab?.cmpId != null && {
|
|
1933
|
+
cmpId: options.advanced.iab.cmpId
|
|
1934
|
+
}
|
|
1936
1935
|
});
|
|
1937
1936
|
});
|
|
1938
1937
|
return app;
|
|
@@ -2051,7 +2050,6 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2051
2050
|
subject: {
|
|
2052
2051
|
id: subject.id,
|
|
2053
2052
|
externalId: subject.externalId ?? void 0,
|
|
2054
|
-
isIdentified: subject.isIdentified,
|
|
2055
2053
|
createdAt: subject.createdAt
|
|
2056
2054
|
},
|
|
2057
2055
|
consents: filteredConsents,
|
|
@@ -2107,7 +2105,6 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2107
2105
|
return {
|
|
2108
2106
|
id: subject.id,
|
|
2109
2107
|
externalId: subject.externalId ?? externalId,
|
|
2110
|
-
isIdentified: subject.isIdentified,
|
|
2111
2108
|
createdAt: subject.createdAt,
|
|
2112
2109
|
consents: consentItems
|
|
2113
2110
|
};
|
|
@@ -2238,7 +2235,6 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2238
2235
|
set: {
|
|
2239
2236
|
externalId,
|
|
2240
2237
|
identityProvider,
|
|
2241
|
-
isIdentified: true,
|
|
2242
2238
|
updatedAt: new Date()
|
|
2243
2239
|
}
|
|
2244
2240
|
});
|
|
@@ -2258,10 +2254,6 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2258
2254
|
identityProvider: {
|
|
2259
2255
|
from: subject.identityProvider,
|
|
2260
2256
|
to: identityProvider
|
|
2261
|
-
},
|
|
2262
|
-
isIdentified: {
|
|
2263
|
-
from: subject.isIdentified,
|
|
2264
|
-
to: true
|
|
2265
2257
|
}
|
|
2266
2258
|
},
|
|
2267
2259
|
metadata: {
|
|
@@ -2280,8 +2272,7 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2280
2272
|
success: true,
|
|
2281
2273
|
subject: {
|
|
2282
2274
|
id: subjectId,
|
|
2283
|
-
externalId
|
|
2284
|
-
isIdentified: true
|
|
2275
|
+
externalId
|
|
2285
2276
|
}
|
|
2286
2277
|
});
|
|
2287
2278
|
} catch (error) {
|
|
@@ -2307,6 +2298,11 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2307
2298
|
const { type, subjectId, identityProvider, externalSubjectId, domain, metadata, givenAt: givenAtEpoch } = input;
|
|
2308
2299
|
const preferences = 'preferences' in input ? input.preferences : void 0;
|
|
2309
2300
|
const givenAt = new Date(givenAtEpoch);
|
|
2301
|
+
const rawConsentAction = 'consentAction' in input ? input.consentAction : void 0;
|
|
2302
|
+
let derivedConsentAction;
|
|
2303
|
+
if ('all' === rawConsentAction) derivedConsentAction = 'accept_all';
|
|
2304
|
+
else if ('necessary' === rawConsentAction) derivedConsentAction = 'opt-out' === input.jurisdictionModel ? 'opt_out' : 'reject_all';
|
|
2305
|
+
else if ('custom' === rawConsentAction) derivedConsentAction = 'custom';
|
|
2310
2306
|
logger.debug('Request parameters', {
|
|
2311
2307
|
type,
|
|
2312
2308
|
subjectId,
|
|
@@ -2429,6 +2425,7 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2429
2425
|
jurisdictionModel: input.jurisdictionModel,
|
|
2430
2426
|
tcString: input.tcString,
|
|
2431
2427
|
uiSource: input.uiSource,
|
|
2428
|
+
consentAction: derivedConsentAction,
|
|
2432
2429
|
givenAt
|
|
2433
2430
|
});
|
|
2434
2431
|
logger.debug('Created consent', {
|
|
@@ -2684,6 +2681,7 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
|
|
|
2684
2681
|
app.route('/subjects', createSubjectRoutes());
|
|
2685
2682
|
app.route('/consents', createConsentRoutes());
|
|
2686
2683
|
app.route('/status', createStatusRoute());
|
|
2684
|
+
app.route('/', createStatusRoute());
|
|
2687
2685
|
app.onError((err, c)=>{
|
|
2688
2686
|
const ctx = c.get('c15tContext');
|
|
2689
2687
|
const log = ctx?.logger || logger;
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAgBxD;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC;IAAE,SAAS,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,CAAA;CAAE,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEjD;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC;IAEtB;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;OAIG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD;;;;OAIG;IACH,SAAS,EAAE,MAAM,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,WAAW,KAAG,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAgBxD;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC;IAAE,SAAS,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,CAAA;CAAE,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEjD;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC;IAEtB;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;OAIG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD;;;;OAIG;IACH,SAAS,EAAE,MAAM,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,WAAW,KAAG,YAqQnD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/core.js
CHANGED
|
@@ -136,7 +136,7 @@ function createCORSOptions(trustedOrigins) {
|
|
|
136
136
|
]
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
const version_version = '2.0.0-rc.
|
|
139
|
+
const version_version = '2.0.0-rc.3';
|
|
140
140
|
const config_createOpenAPIConfig = (options)=>({
|
|
141
141
|
enabled: options.advanced?.openapi?.enabled !== false,
|
|
142
142
|
specPath: '/spec.json',
|
|
@@ -874,8 +874,7 @@ function subjectRegistry({ db, ctx }) {
|
|
|
874
874
|
const newSubject = await db.create('subject', {
|
|
875
875
|
id: subjectId,
|
|
876
876
|
externalId: externalSubjectId ?? null,
|
|
877
|
-
identityProvider: externalSubjectId ? identityProvider ?? 'external' : 'anonymous'
|
|
878
|
-
isIdentified: !!externalSubjectId
|
|
877
|
+
identityProvider: externalSubjectId ? identityProvider ?? 'external' : 'anonymous'
|
|
879
878
|
});
|
|
880
879
|
logger.debug('Created new subject', {
|
|
881
880
|
subject: newSubject
|
|
@@ -889,8 +888,7 @@ function subjectRegistry({ db, ctx }) {
|
|
|
889
888
|
const subject = await db.create('subject', {
|
|
890
889
|
id: await generateUniqueId(db, 'subject', ctx),
|
|
891
890
|
externalId: externalSubjectId,
|
|
892
|
-
identityProvider: identityProvider ?? 'external'
|
|
893
|
-
isIdentified: true
|
|
891
|
+
identityProvider: identityProvider ?? 'external'
|
|
894
892
|
});
|
|
895
893
|
return subject;
|
|
896
894
|
}
|
|
@@ -898,8 +896,7 @@ function subjectRegistry({ db, ctx }) {
|
|
|
898
896
|
const subject = await db.create('subject', {
|
|
899
897
|
id: await generateUniqueId(db, 'subject', ctx),
|
|
900
898
|
externalId: null,
|
|
901
|
-
identityProvider: 'anonymous'
|
|
902
|
-
isIdentified: false
|
|
899
|
+
identityProvider: 'anonymous'
|
|
903
900
|
});
|
|
904
901
|
logger.debug('Created new anonymous subject', {
|
|
905
902
|
subject
|
|
@@ -999,7 +996,6 @@ const domainTable = schema_table('domain', {
|
|
|
999
996
|
});
|
|
1000
997
|
const subjectTable = schema_table('subject', {
|
|
1001
998
|
id: idColumn('id', 'varchar(255)'),
|
|
1002
|
-
isIdentified: column('isIdentified', 'bool').defaultTo$(()=>false),
|
|
1003
999
|
externalId: column('externalId', 'string').nullable(),
|
|
1004
1000
|
identityProvider: column('identityProvider', 'string').nullable(),
|
|
1005
1001
|
lastIpAddress: column('lastIpAddress', 'string').nullable(),
|
|
@@ -1092,6 +1088,7 @@ const consent_consentTable = schema_table('consent', {
|
|
|
1092
1088
|
jurisdictionModel: column('jurisdictionModel', 'string').nullable(),
|
|
1093
1089
|
tcString: column('tcString', 'string').nullable(),
|
|
1094
1090
|
uiSource: column('uiSource', 'string').nullable(),
|
|
1091
|
+
consentAction: column('consentAction', 'string').nullable(),
|
|
1095
1092
|
tenantId: column('tenantId', 'string').nullable()
|
|
1096
1093
|
});
|
|
1097
1094
|
const consent_policy_consentPolicyTable = schema_table('consentPolicy', {
|
|
@@ -1119,7 +1116,6 @@ const domain_domainTable = schema_table('domain', {
|
|
|
1119
1116
|
});
|
|
1120
1117
|
const subject_subjectTable = schema_table('subject', {
|
|
1121
1118
|
id: idColumn('id', 'varchar(255)'),
|
|
1122
|
-
isIdentified: column('isIdentified', 'bool').defaultTo$(()=>false),
|
|
1123
1119
|
externalId: column('externalId', 'string').nullable(),
|
|
1124
1120
|
identityProvider: column('identityProvider', 'string').nullable(),
|
|
1125
1121
|
createdAt: column('createdAt', 'timestamp').defaultTo$('now'),
|
|
@@ -1840,18 +1836,18 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
1840
1836
|
const jurisdiction = getJurisdiction(location, options);
|
|
1841
1837
|
const translationsResult = translations_getTranslationsData(acceptLanguage, options.advanced?.customTranslations);
|
|
1842
1838
|
let gvl = null;
|
|
1843
|
-
if (options.advanced?.
|
|
1839
|
+
if (options.advanced?.iab?.enabled) {
|
|
1844
1840
|
const language = translationsResult.language.split('-')[0] || 'en';
|
|
1845
1841
|
const gvlResolver = createGVLResolver({
|
|
1846
1842
|
appName: options.appName || 'c15t',
|
|
1847
|
-
bundled: options.advanced.
|
|
1843
|
+
bundled: options.advanced.iab.bundled,
|
|
1848
1844
|
cacheAdapter: options.advanced.cache?.adapter,
|
|
1849
|
-
vendorIds: options.advanced.
|
|
1850
|
-
endpoint: options.advanced.
|
|
1845
|
+
vendorIds: options.advanced.iab.vendorIds,
|
|
1846
|
+
endpoint: options.advanced.iab.endpoint
|
|
1851
1847
|
});
|
|
1852
1848
|
gvl = await gvlResolver.get(language);
|
|
1853
1849
|
}
|
|
1854
|
-
const customVendors = options.advanced?.
|
|
1850
|
+
const customVendors = options.advanced?.iab?.customVendors;
|
|
1855
1851
|
const gpc = '1' === request.headers.get('sec-gpc');
|
|
1856
1852
|
getMetrics()?.recordInit({
|
|
1857
1853
|
jurisdiction,
|
|
@@ -1865,7 +1861,10 @@ Use for geo-targeted consent banners and regional compliance.`,
|
|
|
1865
1861
|
translations: translationsResult,
|
|
1866
1862
|
branding: options.advanced?.branding || 'c15t',
|
|
1867
1863
|
gvl,
|
|
1868
|
-
customVendors
|
|
1864
|
+
customVendors,
|
|
1865
|
+
...options.advanced?.iab?.cmpId != null && {
|
|
1866
|
+
cmpId: options.advanced.iab.cmpId
|
|
1867
|
+
}
|
|
1869
1868
|
});
|
|
1870
1869
|
});
|
|
1871
1870
|
return app;
|
|
@@ -1983,7 +1982,6 @@ const getSubjectHandler = async (c)=>{
|
|
|
1983
1982
|
subject: {
|
|
1984
1983
|
id: subject.id,
|
|
1985
1984
|
externalId: subject.externalId ?? void 0,
|
|
1986
|
-
isIdentified: subject.isIdentified,
|
|
1987
1985
|
createdAt: subject.createdAt
|
|
1988
1986
|
},
|
|
1989
1987
|
consents: filteredConsents,
|
|
@@ -2039,7 +2037,6 @@ const listSubjectsHandler = async (c)=>{
|
|
|
2039
2037
|
return {
|
|
2040
2038
|
id: subject.id,
|
|
2041
2039
|
externalId: subject.externalId ?? externalId,
|
|
2042
|
-
isIdentified: subject.isIdentified,
|
|
2043
2040
|
createdAt: subject.createdAt,
|
|
2044
2041
|
consents: consentItems
|
|
2045
2042
|
};
|
|
@@ -2170,7 +2167,6 @@ const patchSubjectHandler = async (c)=>{
|
|
|
2170
2167
|
set: {
|
|
2171
2168
|
externalId,
|
|
2172
2169
|
identityProvider,
|
|
2173
|
-
isIdentified: true,
|
|
2174
2170
|
updatedAt: new Date()
|
|
2175
2171
|
}
|
|
2176
2172
|
});
|
|
@@ -2190,10 +2186,6 @@ const patchSubjectHandler = async (c)=>{
|
|
|
2190
2186
|
identityProvider: {
|
|
2191
2187
|
from: subject.identityProvider,
|
|
2192
2188
|
to: identityProvider
|
|
2193
|
-
},
|
|
2194
|
-
isIdentified: {
|
|
2195
|
-
from: subject.isIdentified,
|
|
2196
|
-
to: true
|
|
2197
2189
|
}
|
|
2198
2190
|
},
|
|
2199
2191
|
metadata: {
|
|
@@ -2212,8 +2204,7 @@ const patchSubjectHandler = async (c)=>{
|
|
|
2212
2204
|
success: true,
|
|
2213
2205
|
subject: {
|
|
2214
2206
|
id: subjectId,
|
|
2215
|
-
externalId
|
|
2216
|
-
isIdentified: true
|
|
2207
|
+
externalId
|
|
2217
2208
|
}
|
|
2218
2209
|
});
|
|
2219
2210
|
} catch (error) {
|
|
@@ -2239,6 +2230,11 @@ const postSubjectHandler = async (c)=>{
|
|
|
2239
2230
|
const { type, subjectId, identityProvider, externalSubjectId, domain, metadata, givenAt: givenAtEpoch } = input;
|
|
2240
2231
|
const preferences = 'preferences' in input ? input.preferences : void 0;
|
|
2241
2232
|
const givenAt = new Date(givenAtEpoch);
|
|
2233
|
+
const rawConsentAction = 'consentAction' in input ? input.consentAction : void 0;
|
|
2234
|
+
let derivedConsentAction;
|
|
2235
|
+
if ('all' === rawConsentAction) derivedConsentAction = 'accept_all';
|
|
2236
|
+
else if ('necessary' === rawConsentAction) derivedConsentAction = 'opt-out' === input.jurisdictionModel ? 'opt_out' : 'reject_all';
|
|
2237
|
+
else if ('custom' === rawConsentAction) derivedConsentAction = 'custom';
|
|
2242
2238
|
logger.debug('Request parameters', {
|
|
2243
2239
|
type,
|
|
2244
2240
|
subjectId,
|
|
@@ -2361,6 +2357,7 @@ const postSubjectHandler = async (c)=>{
|
|
|
2361
2357
|
jurisdictionModel: input.jurisdictionModel,
|
|
2362
2358
|
tcString: input.tcString,
|
|
2363
2359
|
uiSource: input.uiSource,
|
|
2360
|
+
consentAction: derivedConsentAction,
|
|
2364
2361
|
givenAt
|
|
2365
2362
|
});
|
|
2366
2363
|
logger.debug('Created consent', {
|
|
@@ -2616,6 +2613,7 @@ const c15tInstance = (options)=>{
|
|
|
2616
2613
|
app.route('/subjects', createSubjectRoutes());
|
|
2617
2614
|
app.route('/consents', createConsentRoutes());
|
|
2618
2615
|
app.route('/status', createStatusRoute());
|
|
2616
|
+
app.route('/', createStatusRoute());
|
|
2619
2617
|
app.onError((err, c)=>{
|
|
2620
2618
|
const ctx = c.get('c15tContext');
|
|
2621
2619
|
const log = ctx?.logger || logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/registry/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,cAAc,GAAI,KAAK,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ2iB,CAAC;yBAA8B,CAAC;wBAA6B,CAAC;iBAAsB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/registry/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,cAAc,GAAI,KAAK,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ2iB,CAAC;yBAA8B,CAAC;wBAA6B,CAAC;iBAAsB,CAAC;;;;;;;;;CAD3qB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../../../src/db/registry/subject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ;IAGnD;;;;;;;;;;;;;OAaG;0FAMA;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B
|
|
1
|
+
{"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../../../src/db/registry/subject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ;IAGnD;;;;;;;;;;;;;OAaG;0FAMA;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B;;;;;;;;EA6FF"}
|