@c15t/backend 2.0.0-rc.5 → 2.0.0-rc.6

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.
Files changed (47) hide show
  1. package/dist/302.js +473 -0
  2. package/dist/364.js +1140 -0
  3. package/dist/583.js +540 -0
  4. package/dist/cache.cjs +1 -1
  5. package/dist/cache.js +4 -415
  6. package/dist/core.cjs +21 -24
  7. package/dist/core.js +18 -2420
  8. package/dist/db/adapters/drizzle.cjs +1 -1
  9. package/dist/db/adapters/drizzle.js +1 -2
  10. package/dist/db/adapters/kysely.cjs +1 -1
  11. package/dist/db/adapters/kysely.js +1 -2
  12. package/dist/db/adapters/mongo.cjs +1 -1
  13. package/dist/db/adapters/mongo.js +1 -2
  14. package/dist/db/adapters/prisma.cjs +1 -1
  15. package/dist/db/adapters/prisma.js +1 -2
  16. package/dist/db/adapters/typeorm.cjs +1 -1
  17. package/dist/db/adapters/typeorm.js +1 -2
  18. package/dist/db/adapters.cjs +1 -1
  19. package/dist/db/migrator.cjs +1 -1
  20. package/dist/db/schema.cjs +1 -1
  21. package/dist/db/schema.js +1 -1
  22. package/dist/define-config.cjs +1 -1
  23. package/dist/edge.cjs +1 -1
  24. package/dist/edge.js +3 -882
  25. package/dist/router.cjs +17 -18
  26. package/dist/router.js +1 -2058
  27. package/dist/types/index.cjs +1 -1
  28. package/dist-types/cache/gvl-resolver.d.ts +1 -1
  29. package/dist-types/db/registry/runtime-policy-decision.d.ts +1 -1
  30. package/dist-types/db/schema/1.0.0/consent.d.ts +1 -1
  31. package/dist-types/db/schema/2.0.0/audit-log.d.ts +1 -1
  32. package/dist-types/db/schema/2.0.0/consent-policy.d.ts +1 -1
  33. package/dist-types/db/schema/2.0.0/consent-purpose.d.ts +1 -1
  34. package/dist-types/db/schema/2.0.0/consent.d.ts +1 -1
  35. package/dist-types/db/schema/2.0.0/domain.d.ts +1 -1
  36. package/dist-types/db/schema/2.0.0/runtime-policy-decision.d.ts +1 -1
  37. package/dist-types/db/schema/2.0.0/subject.d.ts +1 -1
  38. package/dist-types/handlers/init/index.d.ts +1 -1
  39. package/dist-types/handlers/init/policy.d.ts +1 -1
  40. package/dist-types/handlers/init/resolve-init.d.ts +1 -1
  41. package/dist-types/handlers/policy/snapshot.d.ts +1 -1
  42. package/dist-types/policies/defaults.d.ts +1 -1
  43. package/dist-types/policies/matchers.d.ts +2 -2
  44. package/dist-types/types/index.d.ts +2 -2
  45. package/dist-types/version.d.ts +1 -1
  46. package/docs/guides/policy-packs.md +1 -1
  47. package/package.json +15 -15
package/dist/router.cjs CHANGED
@@ -22,7 +22,7 @@ var __webpack_require__ = {};
22
22
  })();
23
23
  (()=>{
24
24
  __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
25
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
26
  value: 'Module'
27
27
  });
28
28
  Object.defineProperty(exports1, '__esModule', {
@@ -431,11 +431,7 @@ const createConsentRoutes = ()=>{
431
431
  const app = new external_hono_namespaceObject.Hono();
432
432
  app.get('/check', (0, external_hono_openapi_namespaceObject.describeRoute)({
433
433
  summary: 'Check consent by external user ID',
434
- description: `Pre-banner cross-device consent check. Use to avoid showing the banner when the user has already consented on another device.
435
-
436
- **Query parameters:**
437
- - \`externalId\` – External user ID to check
438
- - \`type\` – Consent type(s) to check (comma-separated)`,
434
+ description: "Pre-banner cross-device consent check. Use to avoid showing the banner when the user has already consented on another device.\n\n**Query parameters:**\n- `externalId` – External user ID to check\n- `type` – Consent type(s) to check (comma-separated)",
439
435
  tags: [
440
436
  'Consent'
441
437
  ],
@@ -1198,7 +1194,7 @@ Use for geo-targeted consent banners and regional compliance.`,
1198
1194
  });
1199
1195
  return app;
1200
1196
  };
1201
- const version_version = '2.0.0-rc.5';
1197
+ const version_version = '2.0.0-rc.6';
1202
1198
  function getHeaders(headers) {
1203
1199
  if (!headers) return {
1204
1200
  countryCode: null,
@@ -1285,6 +1281,12 @@ const getSubjectHandler = async (c)=>{
1285
1281
  const subjectId = c.req.param('id');
1286
1282
  const type = c.req.query('type');
1287
1283
  const typeFilter = type?.split(',').map((t)=>t.trim()) || [];
1284
+ if (!subjectId) throw new http_exception_namespaceObject.HTTPException(400, {
1285
+ message: 'Subject ID is required',
1286
+ cause: {
1287
+ code: 'SUBJECT_ID_REQUIRED'
1288
+ }
1289
+ });
1288
1290
  logger.debug('Request parameters', {
1289
1291
  subjectId,
1290
1292
  typeFilter
@@ -1478,6 +1480,12 @@ const patchSubjectHandler = async (c)=>{
1478
1480
  const subjectId = c.req.param('id');
1479
1481
  const body = await c.req.json();
1480
1482
  const { externalId, identityProvider = 'external' } = body;
1483
+ if (!subjectId) throw new http_exception_namespaceObject.HTTPException(400, {
1484
+ message: 'Subject ID is required',
1485
+ cause: {
1486
+ code: 'SUBJECT_ID_REQUIRED'
1487
+ }
1488
+ });
1481
1489
  logger.debug('Request parameters', {
1482
1490
  subjectId,
1483
1491
  externalId,
@@ -1995,11 +2003,7 @@ const createSubjectRoutes = ()=>{
1995
2003
  const app = new external_hono_namespaceObject.Hono();
1996
2004
  app.get('/:id', (0, external_hono_openapi_namespaceObject.describeRoute)({
1997
2005
  summary: 'Get subject consent status',
1998
- description: `Returns the subject's consent status for this device. Use to check if the subject has valid consent for given policy types.
1999
-
2000
- **Query:** \`type\` – Filter by consent type(s), comma-separated (e.g. \`privacy_policy,cookie_banner\`).
2001
-
2002
- **Response:** \`subject\`, \`consents\` (matching filter), \`isValid\` (valid consent for requested type(s)).`,
2006
+ description: "Returns the subject's consent status for this device. Use to check if the subject has valid consent for given policy types.\n\n**Query:** `type` – Filter by consent type(s), comma-separated (e.g. `privacy_policy,cookie_banner`).\n\n**Response:** `subject`, `consents` (matching filter), `isValid` (valid consent for requested type(s)).",
2003
2007
  tags: [
2004
2008
  'Subject',
2005
2009
  'Consent'
@@ -2020,12 +2024,7 @@ const createSubjectRoutes = ()=>{
2020
2024
  }), (0, external_hono_openapi_namespaceObject.validator)('param', schema_namespaceObject.getSubjectInputSchema), getSubjectHandler);
2021
2025
  app.post('/', (0, external_hono_openapi_namespaceObject.describeRoute)({
2022
2026
  summary: 'Record consent for a subject',
2023
- description: `Creates a new consent record (append-only). Creates the subject if it does not exist.
2024
-
2025
- **Request body by \`type\`:**
2026
- - \`cookie_banner\` – Requires \`preferences\` object
2027
- - \`privacy_policy\`, \`dpa\`, \`terms_and_conditions\` – Optional \`policyId\`
2028
- - \`marketing_communications\`, \`age_verification\`, \`other\` – Optional \`preferences\``,
2027
+ description: "Creates a new consent record (append-only). Creates the subject if it does not exist.\n\n**Request body by `type`:**\n- `cookie_banner` – Requires `preferences` object\n- `privacy_policy`, `dpa`, `terms_and_conditions` – Optional `policyId`\n- `marketing_communications`, `age_verification`, `other` – Optional `preferences`",
2029
2028
  tags: [
2030
2029
  'Subject',
2031
2030
  'Consent'