@c15t/backend 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/302.js CHANGED
@@ -13,7 +13,7 @@ function createTelemetryOptions(appName = 'c15t', telemetryConfig, tenantId) {
13
13
  const defaultAttributes = {
14
14
  ...telemetryConfig?.defaultAttributes || {},
15
15
  'service.name': String(appName),
16
- 'service.version': "2.0.2"
16
+ 'service.version': "2.0.4"
17
17
  };
18
18
  if (tenantId) defaultAttributes['tenant.id'] = tenantId;
19
19
  const config = {
package/dist/915.js CHANGED
@@ -709,7 +709,7 @@ const statusHandler = async (c)=>{
709
709
  try {
710
710
  await ctx.db.findFirst('subject', {});
711
711
  return c.json({
712
- version: "2.0.2",
712
+ version: "2.0.4",
713
713
  timestamp: new Date(),
714
714
  client: clientInfo
715
715
  });
@@ -1462,10 +1462,14 @@ const postSubjectHandler = async (c)=>{
1462
1462
  const hasWildcardCategoryScope = allowedCategories?.includes('*') === true;
1463
1463
  const appliedPreferenceEntries = Object.entries(preferences);
1464
1464
  let filteredAppliedPreferenceEntries = appliedPreferenceEntries;
1465
- if (allowedCategories && allowedCategories.length > 0 && !hasWildcardCategoryScope) {
1466
- const disallowed = appliedPreferenceEntries.map(([purpose])=>purpose).filter((purpose)=>!allowedCategories.includes(purpose));
1467
- filteredAppliedPreferenceEntries = appliedPreferenceEntries.filter(([purpose])=>allowedCategories.includes(purpose));
1468
- if (disallowed.length > 0 && 'strict' === effectiveScopeMode) throw new HTTPException(400, {
1465
+ if ('strict' === effectiveScopeMode && allowedCategories && allowedCategories.length > 0 && !hasWildcardCategoryScope) {
1466
+ const strictAllowedCategories = new Set([
1467
+ 'necessary',
1468
+ ...allowedCategories
1469
+ ]);
1470
+ const disallowed = appliedPreferenceEntries.map(([purpose])=>purpose).filter((purpose)=>!strictAllowedCategories.has(purpose));
1471
+ filteredAppliedPreferenceEntries = appliedPreferenceEntries.filter(([purpose])=>strictAllowedCategories.has(purpose));
1472
+ if (disallowed.length > 0) throw new HTTPException(400, {
1469
1473
  message: 'Preferences include categories not allowed by policy',
1470
1474
  cause: {
1471
1475
  code: 'PURPOSE_NOT_ALLOWED',
package/dist/core.cjs CHANGED
@@ -349,7 +349,7 @@ var __webpack_exports__ = {};
349
349
  (()=>{
350
350
  __webpack_require__.r(__webpack_exports__);
351
351
  __webpack_require__.d(__webpack_exports__, {
352
- version: ()=>"2.0.2",
352
+ version: ()=>"2.0.4",
353
353
  c15tInstance: ()=>c15tInstance,
354
354
  EEA_COUNTRY_CODES: ()=>types_namespaceObject.EEA_COUNTRY_CODES,
355
355
  EU_COUNTRY_CODES: ()=>types_namespaceObject.EU_COUNTRY_CODES,
@@ -757,7 +757,7 @@ var __webpack_exports__ = {};
757
757
  const defaultAttributes = {
758
758
  ...telemetryConfig?.defaultAttributes || {},
759
759
  'service.name': String(appName),
760
- 'service.version': "2.0.2"
760
+ 'service.version': "2.0.4"
761
761
  };
762
762
  if (tenantId) defaultAttributes['tenant.id'] = tenantId;
763
763
  const config = {
@@ -2676,7 +2676,7 @@ Use for geo-targeted consent banners and regional compliance.`,
2676
2676
  try {
2677
2677
  await ctx.db.findFirst('subject', {});
2678
2678
  return c.json({
2679
- version: "2.0.2",
2679
+ version: "2.0.4",
2680
2680
  timestamp: new Date(),
2681
2681
  client: clientInfo
2682
2682
  });
@@ -3430,10 +3430,14 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
3430
3430
  const hasWildcardCategoryScope = allowedCategories?.includes('*') === true;
3431
3431
  const appliedPreferenceEntries = Object.entries(preferences);
3432
3432
  let filteredAppliedPreferenceEntries = appliedPreferenceEntries;
3433
- if (allowedCategories && allowedCategories.length > 0 && !hasWildcardCategoryScope) {
3434
- const disallowed = appliedPreferenceEntries.map(([purpose])=>purpose).filter((purpose)=>!allowedCategories.includes(purpose));
3435
- filteredAppliedPreferenceEntries = appliedPreferenceEntries.filter(([purpose])=>allowedCategories.includes(purpose));
3436
- if (disallowed.length > 0 && 'strict' === effectiveScopeMode) throw new http_exception_namespaceObject.HTTPException(400, {
3433
+ if ('strict' === effectiveScopeMode && allowedCategories && allowedCategories.length > 0 && !hasWildcardCategoryScope) {
3434
+ const strictAllowedCategories = new Set([
3435
+ 'necessary',
3436
+ ...allowedCategories
3437
+ ]);
3438
+ const disallowed = appliedPreferenceEntries.map(([purpose])=>purpose).filter((purpose)=>!strictAllowedCategories.has(purpose));
3439
+ filteredAppliedPreferenceEntries = appliedPreferenceEntries.filter(([purpose])=>strictAllowedCategories.has(purpose));
3440
+ if (disallowed.length > 0) throw new http_exception_namespaceObject.HTTPException(400, {
3437
3441
  message: 'Preferences include categories not allowed by policy',
3438
3442
  cause: {
3439
3443
  code: 'PURPOSE_NOT_ALLOWED',
@@ -3878,7 +3882,7 @@ Use for health checks, load balancer probes, and debugging. Performs a lightweig
3878
3882
  openapi: '3.1.0',
3879
3883
  info: {
3880
3884
  title: options.appName || 'c15t API',
3881
- version: "2.0.2",
3885
+ version: "2.0.4",
3882
3886
  description: 'API for consent management'
3883
3887
  },
3884
3888
  servers: [
package/dist/core.js CHANGED
@@ -767,7 +767,7 @@ const c15tInstance = (options)=>{
767
767
  openapi: '3.1.0',
768
768
  info: {
769
769
  title: options.appName || 'c15t API',
770
- version: "2.0.2",
770
+ version: "2.0.4",
771
771
  description: 'API for consent management'
772
772
  },
773
773
  servers: [
@@ -881,7 +881,7 @@ const c15tInstance = (options)=>{
881
881
  getDocsUI
882
882
  };
883
883
  };
884
- var core_version = "2.0.2";
884
+ var core_version = "2.0.4";
885
885
  export { defineConfig } from "./define-config.js";
886
886
  export { inspectPolicies } from "./583.js";
887
887
  export { EEA_COUNTRY_CODES, EU_COUNTRY_CODES, POLICY_MATCH_DATASET_VERSION, UK_COUNTRY_CODES, c15tInstance, core_version as version, policyBuilder, policyMatchers, policyPackPresets };
package/dist/router.cjs CHANGED
@@ -1246,7 +1246,7 @@ const statusHandler = async (c)=>{
1246
1246
  try {
1247
1247
  await ctx.db.findFirst('subject', {});
1248
1248
  return c.json({
1249
- version: "2.0.2",
1249
+ version: "2.0.4",
1250
1250
  timestamp: new Date(),
1251
1251
  client: clientInfo
1252
1252
  });
@@ -2000,10 +2000,14 @@ const postSubjectHandler = async (c)=>{
2000
2000
  const hasWildcardCategoryScope = allowedCategories?.includes('*') === true;
2001
2001
  const appliedPreferenceEntries = Object.entries(preferences);
2002
2002
  let filteredAppliedPreferenceEntries = appliedPreferenceEntries;
2003
- if (allowedCategories && allowedCategories.length > 0 && !hasWildcardCategoryScope) {
2004
- const disallowed = appliedPreferenceEntries.map(([purpose])=>purpose).filter((purpose)=>!allowedCategories.includes(purpose));
2005
- filteredAppliedPreferenceEntries = appliedPreferenceEntries.filter(([purpose])=>allowedCategories.includes(purpose));
2006
- if (disallowed.length > 0 && 'strict' === effectiveScopeMode) throw new http_exception_namespaceObject.HTTPException(400, {
2003
+ if ('strict' === effectiveScopeMode && allowedCategories && allowedCategories.length > 0 && !hasWildcardCategoryScope) {
2004
+ const strictAllowedCategories = new Set([
2005
+ 'necessary',
2006
+ ...allowedCategories
2007
+ ]);
2008
+ const disallowed = appliedPreferenceEntries.map(([purpose])=>purpose).filter((purpose)=>!strictAllowedCategories.has(purpose));
2009
+ filteredAppliedPreferenceEntries = appliedPreferenceEntries.filter(([purpose])=>strictAllowedCategories.has(purpose));
2010
+ if (disallowed.length > 0) throw new http_exception_namespaceObject.HTTPException(400, {
2007
2011
  message: 'Preferences include categories not allowed by policy',
2008
2012
  cause: {
2009
2013
  code: 'PURPOSE_NOT_ALLOWED',
@@ -1 +1 @@
1
- export declare const version = "2.0.2";
1
+ export declare const version = "2.0.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c15t/backend",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Consent policy engine and API for c15t. Powers the cookie banner, consent manager, and preference center. Webhooks, audit logs, storage adapters. Self-host or use inth.com",
5
5
  "keywords": [
6
6
  "consent",
@@ -120,14 +120,14 @@
120
120
  "fmt": "bun biome format --write . && bun biome check --formatter-enabled=false --linter-enabled=false --write",
121
121
  "knip": "knip",
122
122
  "lint": "bun biome lint ./src",
123
- "prepack": "bun run build",
123
+ "prepack": "bun ../../scripts/verify-package-artifacts.ts",
124
124
  "start": "node dist/server.cjs",
125
125
  "test": "bun prebuild && vitest run",
126
126
  "test:watch": "bun prebuild && vitest"
127
127
  },
128
128
  "dependencies": {
129
129
  "@c15t/logger": "2.0.0",
130
- "@c15t/schema": "2.0.0",
130
+ "@c15t/schema": "2.0.1",
131
131
  "@c15t/translations": "2.0.0",
132
132
  "@hono/standard-validator": "^0.2.2",
133
133
  "@hono/valibot-validator": "0.6.1",
@@ -136,9 +136,9 @@
136
136
  "@scalar/hono-api-reference": "0.10.5",
137
137
  "@valibot/to-json-schema": "1.6.0",
138
138
  "base-x": "5.0.1",
139
- "defu": "6.1.4",
139
+ "defu": "6.1.5",
140
140
  "fumadb": "0.2.2",
141
- "hono": "4.12.9",
141
+ "hono": "4.12.14",
142
142
  "hono-openapi": "1.3.0",
143
143
  "jose": "6.2.2",
144
144
  "valibot": "1.3.1"