@m5kdev/commons 0.35.0 → 0.36.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.
Files changed (27) hide show
  1. package/dist/src/modules/auth/auth.roles.cjs +8 -6
  2. package/dist/src/modules/auth/auth.roles.cjs.map +1 -1
  3. package/dist/src/modules/auth/auth.roles.mjs +8 -6
  4. package/dist/src/modules/auth/auth.roles.mjs.map +1 -1
  5. package/dist/src/modules/auth/auth.schema.cjs +0 -3
  6. package/dist/src/modules/auth/auth.schema.cjs.map +1 -1
  7. package/dist/src/modules/auth/auth.schema.d.cts +0 -3
  8. package/dist/src/modules/auth/auth.schema.d.mts +0 -3
  9. package/dist/src/modules/auth/auth.schema.mjs +0 -3
  10. package/dist/src/modules/auth/auth.schema.mjs.map +1 -1
  11. package/dist/src/modules/notification/notification.constants.cjs +19 -2
  12. package/dist/src/modules/notification/notification.constants.cjs.map +1 -1
  13. package/dist/src/modules/notification/notification.constants.d.cts +20 -2
  14. package/dist/src/modules/notification/notification.constants.d.mts +20 -2
  15. package/dist/src/modules/notification/notification.constants.mjs +13 -2
  16. package/dist/src/modules/notification/notification.constants.mjs.map +1 -1
  17. package/dist/src/modules/notification/notification.schema.cjs +49 -6
  18. package/dist/src/modules/notification/notification.schema.cjs.map +1 -1
  19. package/dist/src/modules/notification/notification.schema.d.cts +120 -10
  20. package/dist/src/modules/notification/notification.schema.d.mts +120 -10
  21. package/dist/src/modules/notification/notification.schema.mjs +42 -8
  22. package/dist/src/modules/notification/notification.schema.mjs.map +1 -1
  23. package/dist/src/modules/schemas/query.schema.d.cts +9 -9
  24. package/dist/src/modules/schemas/query.schema.d.mts +9 -9
  25. package/dist/src/modules/tag/tag.schema.d.cts +3 -3
  26. package/dist/src/modules/tag/tag.schema.d.mts +3 -3
  27. package/package.json +2 -2
@@ -14,11 +14,7 @@ const DEFAULT_AUTH_ROLES = {
14
14
  "owner"
15
15
  ],
16
16
  managerRoles: ["admin", "owner"],
17
- assignableRoles: [
18
- "member",
19
- "admin",
20
- "owner"
21
- ],
17
+ assignableRoles: ["member", "admin"],
22
18
  defaultRole: "member"
23
19
  },
24
20
  team: {
@@ -47,11 +43,17 @@ function normalizeRoleScopeConfig(scope, defaults) {
47
43
  defaultRole
48
44
  };
49
45
  }
46
+ function withoutOwnerAssignable(scope) {
47
+ return {
48
+ ...scope,
49
+ assignableRoles: scope.assignableRoles.filter((role) => role !== "owner")
50
+ };
51
+ }
50
52
  function normalizeAuthRolesConfig(config) {
51
53
  if (!config) return DEFAULT_AUTH_ROLES;
52
54
  return {
53
55
  user: normalizeRoleScopeConfig(config.user, DEFAULT_AUTH_ROLES.user),
54
- organization: normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization),
56
+ organization: withoutOwnerAssignable(normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization)),
55
57
  team: normalizeRoleScopeConfig(config.team, DEFAULT_AUTH_ROLES.team)
56
58
  };
57
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.roles.cjs","names":["z"],"sources":["../../../../src/modules/auth/auth.roles.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport type AuthRoleScope = \"user\" | \"organization\" | \"team\";\r\n\r\nexport interface AuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles?: readonly string[];\r\n assignableRoles?: readonly string[];\r\n defaultRole?: string;\r\n}\r\n\r\nexport interface AuthRolesConfig {\r\n user: AuthRoleScopeConfig;\r\n organization: AuthRoleScopeConfig;\r\n team: AuthRoleScopeConfig;\r\n}\r\n\r\nexport interface NormalizedAuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles: readonly string[];\r\n assignableRoles: readonly string[];\r\n defaultRole: string;\r\n}\r\n\r\nexport interface NormalizedAuthRolesConfig {\r\n user: NormalizedAuthRoleScopeConfig;\r\n organization: NormalizedAuthRoleScopeConfig;\r\n team: NormalizedAuthRoleScopeConfig;\r\n}\r\n\r\nconst DEFAULT_USER_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"user\", \"admin\"],\r\n managerRoles: [\"admin\"],\r\n assignableRoles: [\"user\", \"admin\"],\r\n defaultRole: \"user\",\r\n};\r\n\r\nconst DEFAULT_ORGANIZATION_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"member\", \"admin\", \"owner\"],\r\n managerRoles: [\"admin\", \"owner\"],\r\n assignableRoles: [\"member\", \"admin\", \"owner\"],\r\n defaultRole: \"member\",\r\n};\r\n\r\nconst DEFAULT_TEAM_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"owner\"],\r\n managerRoles: [\"owner\"],\r\n assignableRoles: [\"owner\"],\r\n defaultRole: \"owner\",\r\n};\r\n\r\nexport const DEFAULT_AUTH_ROLES: NormalizedAuthRolesConfig = {\r\n user: DEFAULT_USER_SCOPE,\r\n organization: DEFAULT_ORGANIZATION_SCOPE,\r\n team: DEFAULT_TEAM_SCOPE,\r\n};\r\n\r\nfunction pickSubset(\r\n values: readonly string[],\r\n allowed: readonly string[],\r\n fallback: readonly string[]\r\n): readonly string[] {\r\n const allowedSet = new Set(allowed);\r\n const picked = values.filter((value) => allowedSet.has(value));\r\n if (picked.length > 0) {\r\n return picked;\r\n }\r\n\r\n const fallbackPicked = fallback.filter((value) => allowedSet.has(value));\r\n if (fallbackPicked.length > 0) {\r\n return fallbackPicked;\r\n }\r\n\r\n return allowed.length > 0 ? [allowed[0]] : [];\r\n}\r\n\r\nexport function normalizeRoleScopeConfig(\r\n scope: AuthRoleScopeConfig,\r\n defaults: NormalizedAuthRoleScopeConfig\r\n): NormalizedAuthRoleScopeConfig {\r\n const roles = scope.roles.length > 0 ? scope.roles : defaults.roles;\r\n const roleSet = new Set(roles);\r\n\r\n const defaultRole =\r\n scope.defaultRole && roleSet.has(scope.defaultRole)\r\n ? scope.defaultRole\r\n : defaults.defaultRole && roleSet.has(defaults.defaultRole)\r\n ? defaults.defaultRole\r\n : roles[0];\r\n\r\n const managerRoles = pickSubset(\r\n scope.managerRoles ?? defaults.managerRoles,\r\n roles,\r\n defaults.managerRoles\r\n );\r\n\r\n const assignableRoles = pickSubset(scope.assignableRoles ?? roles, roles, roles);\r\n\r\n return {\r\n roles,\r\n managerRoles,\r\n assignableRoles,\r\n defaultRole,\r\n };\r\n}\r\n\r\nexport function normalizeAuthRolesConfig(\r\n config?: AuthRolesConfig | null\r\n): NormalizedAuthRolesConfig {\r\n if (!config) {\r\n return DEFAULT_AUTH_ROLES;\r\n }\r\n\r\n return {\r\n user: normalizeRoleScopeConfig(config.user, DEFAULT_AUTH_ROLES.user),\r\n organization: normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization),\r\n team: normalizeRoleScopeConfig(config.team, DEFAULT_AUTH_ROLES.team),\r\n };\r\n}\r\n\r\nexport function defineAuthRoles(config: AuthRolesConfig): NormalizedAuthRolesConfig {\r\n return normalizeAuthRolesConfig(config);\r\n}\r\n\r\nexport function getRoleKeys(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope\r\n): readonly string[] {\r\n return config[scope].roles;\r\n}\r\n\r\nexport function isAllowedRole(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope,\r\n role: string\r\n): boolean {\r\n return getRoleKeys(config, scope).includes(role);\r\n}\r\n\r\nexport function createRoleValueSchema(scope: NormalizedAuthRoleScopeConfig) {\r\n const allowed = [...scope.roles];\r\n if (allowed.length === 0) {\r\n return z.string();\r\n }\r\n return z.enum(allowed as [string, ...string[]]);\r\n}\r\n\r\nexport function getAppRoleTranslationKey(scope: AuthRoleScope, role: string): string {\r\n return `${scope}.role.${role}`;\r\n}\r\n"],"mappings":";;AAmDA,MAAa,qBAAgD;CAC3D,MAtBwD;EACxD,OAAO,CAAC,QAAQ,QAAQ;EACxB,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ,QAAQ;EAClC,aAAa;EACd;CAkBC,cAhBgE;EAChE,OA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O,yBAAyB,OAAO;;AAGzC,SAAgB,YACd,QACA,OACmB;AACnB,QAAO,OAAO,OAAO;;AAGvB,SAAgB,cACd,QACA,OACA,MACS;AACT,QAAO,YAAY,QAAQ,MAAM,CAAC,SAAS,KAAK;;AAGlD,SAAgB,sBAAsB,OAAsC;CAC1E,MAAM,UAAU,CAAC,GAAG,MAAM,MAAM;AAChC,KAAI,QAAQ,WAAW,EACrB,QAAOA,IAAAA,EAAE,QAAQ;AAEnB,QAAOA,IAAAA,EAAE,KAAK,QAAiC;;AAGjD,SAAgB,yBAAyB,OAAsB,MAAsB;AACnF,QAAO,GAAG,MAAM,QAAQ"}
1
+ {"version":3,"file":"auth.roles.cjs","names":["z"],"sources":["../../../../src/modules/auth/auth.roles.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport type AuthRoleScope = \"user\" | \"organization\" | \"team\";\r\n\r\nexport interface AuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles?: readonly string[];\r\n assignableRoles?: readonly string[];\r\n defaultRole?: string;\r\n}\r\n\r\nexport interface AuthRolesConfig {\r\n user: AuthRoleScopeConfig;\r\n organization: AuthRoleScopeConfig;\r\n team: AuthRoleScopeConfig;\r\n}\r\n\r\nexport interface NormalizedAuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles: readonly string[];\r\n assignableRoles: readonly string[];\r\n defaultRole: string;\r\n}\r\n\r\nexport interface NormalizedAuthRolesConfig {\r\n user: NormalizedAuthRoleScopeConfig;\r\n organization: NormalizedAuthRoleScopeConfig;\r\n team: NormalizedAuthRoleScopeConfig;\r\n}\r\n\r\nconst DEFAULT_USER_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"user\", \"admin\"],\r\n managerRoles: [\"admin\"],\r\n assignableRoles: [\"user\", \"admin\"],\r\n defaultRole: \"user\",\r\n};\r\n\r\nconst DEFAULT_ORGANIZATION_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"member\", \"admin\", \"owner\"],\r\n managerRoles: [\"admin\", \"owner\"],\r\n assignableRoles: [\"member\", \"admin\"],\r\n defaultRole: \"member\",\r\n};\r\n\r\nconst DEFAULT_TEAM_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"owner\"],\r\n managerRoles: [\"owner\"],\r\n assignableRoles: [\"owner\"],\r\n defaultRole: \"owner\",\r\n};\r\n\r\nexport const DEFAULT_AUTH_ROLES: NormalizedAuthRolesConfig = {\r\n user: DEFAULT_USER_SCOPE,\r\n organization: DEFAULT_ORGANIZATION_SCOPE,\r\n team: DEFAULT_TEAM_SCOPE,\r\n};\r\n\r\nfunction pickSubset(\r\n values: readonly string[],\r\n allowed: readonly string[],\r\n fallback: readonly string[]\r\n): readonly string[] {\r\n const allowedSet = new Set(allowed);\r\n const picked = values.filter((value) => allowedSet.has(value));\r\n if (picked.length > 0) {\r\n return picked;\r\n }\r\n\r\n const fallbackPicked = fallback.filter((value) => allowedSet.has(value));\r\n if (fallbackPicked.length > 0) {\r\n return fallbackPicked;\r\n }\r\n\r\n return allowed.length > 0 ? [allowed[0]] : [];\r\n}\r\n\r\nexport function normalizeRoleScopeConfig(\r\n scope: AuthRoleScopeConfig,\r\n defaults: NormalizedAuthRoleScopeConfig\r\n): NormalizedAuthRoleScopeConfig {\r\n const roles = scope.roles.length > 0 ? scope.roles : defaults.roles;\r\n const roleSet = new Set(roles);\r\n\r\n const defaultRole =\r\n scope.defaultRole && roleSet.has(scope.defaultRole)\r\n ? scope.defaultRole\r\n : defaults.defaultRole && roleSet.has(defaults.defaultRole)\r\n ? defaults.defaultRole\r\n : roles[0];\r\n\r\n const managerRoles = pickSubset(\r\n scope.managerRoles ?? defaults.managerRoles,\r\n roles,\r\n defaults.managerRoles\r\n );\r\n\r\n const assignableRoles = pickSubset(scope.assignableRoles ?? roles, roles, roles);\r\n\r\n return {\r\n roles,\r\n managerRoles,\r\n assignableRoles,\r\n defaultRole,\r\n };\r\n}\r\n\r\nfunction withoutOwnerAssignable(\r\n scope: NormalizedAuthRoleScopeConfig\r\n): NormalizedAuthRoleScopeConfig {\r\n return {\r\n ...scope,\r\n assignableRoles: scope.assignableRoles.filter((role) => role !== \"owner\"),\r\n };\r\n}\r\n\r\nexport function normalizeAuthRolesConfig(\r\n config?: AuthRolesConfig | null\r\n): NormalizedAuthRolesConfig {\r\n if (!config) {\r\n return DEFAULT_AUTH_ROLES;\r\n }\r\n\r\n return {\r\n user: normalizeRoleScopeConfig(config.user, DEFAULT_AUTH_ROLES.user),\r\n organization: withoutOwnerAssignable(\r\n normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization)\r\n ),\r\n team: normalizeRoleScopeConfig(config.team, DEFAULT_AUTH_ROLES.team),\r\n };\r\n}\r\n\r\nexport function defineAuthRoles(config: AuthRolesConfig): NormalizedAuthRolesConfig {\r\n return normalizeAuthRolesConfig(config);\r\n}\r\n\r\nexport function getRoleKeys(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope\r\n): readonly string[] {\r\n return config[scope].roles;\r\n}\r\n\r\nexport function isAllowedRole(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope,\r\n role: string\r\n): boolean {\r\n return getRoleKeys(config, scope).includes(role);\r\n}\r\n\r\nexport function createRoleValueSchema(scope: NormalizedAuthRoleScopeConfig) {\r\n const allowed = [...scope.roles];\r\n if (allowed.length === 0) {\r\n return z.string();\r\n }\r\n return z.enum(allowed as [string, ...string[]]);\r\n}\r\n\r\nexport function getAppRoleTranslationKey(scope: AuthRoleScope, role: string): string {\r\n return `${scope}.role.${role}`;\r\n}\r\n"],"mappings":";;AAmDA,MAAa,qBAAgD;CAC3D,MAtBwD;EACxD,OAAO,CAAC,QAAQ,QAAQ;EACxB,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ,QAAQ;EAClC,aAAa;EACd;CAkBC,cAhBgE;EAChE,OAAO;GAAC;GAAU;GAAS;GAAQ;EACnC,cAAc,CAAC,SAAS,QA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,mBAAmB,KAAK;EACrE;;AAGH,SAAgB,gBAAgB,QAAoD;AAClF,QAAO,yBAAyB,OAAO;;AAGzC,SAAgB,YACd,QACA,OACmB;AACnB,QAAO,OAAO,OAAO;;AAGvB,SAAgB,cACd,QACA,OACA,MACS;AACT,QAAO,YAAY,QAAQ,MAAM,CAAC,SAAS,KAAK;;AAGlD,SAAgB,sBAAsB,OAAsC;CAC1E,MAAM,UAAU,CAAC,GAAG,MAAM,MAAM;AAChC,KAAI,QAAQ,WAAW,EACrB,QAAOA,IAAAA,EAAE,QAAQ;AAEnB,QAAOA,IAAAA,EAAE,KAAK,QAAiC;;AAGjD,SAAgB,yBAAyB,OAAsB,MAAsB;AACnF,QAAO,GAAG,MAAM,QAAQ"}
@@ -13,11 +13,7 @@ const DEFAULT_AUTH_ROLES = {
13
13
  "owner"
14
14
  ],
15
15
  managerRoles: ["admin", "owner"],
16
- assignableRoles: [
17
- "member",
18
- "admin",
19
- "owner"
20
- ],
16
+ assignableRoles: ["member", "admin"],
21
17
  defaultRole: "member"
22
18
  },
23
19
  team: {
@@ -46,11 +42,17 @@ function normalizeRoleScopeConfig(scope, defaults) {
46
42
  defaultRole
47
43
  };
48
44
  }
45
+ function withoutOwnerAssignable(scope) {
46
+ return {
47
+ ...scope,
48
+ assignableRoles: scope.assignableRoles.filter((role) => role !== "owner")
49
+ };
50
+ }
49
51
  function normalizeAuthRolesConfig(config) {
50
52
  if (!config) return DEFAULT_AUTH_ROLES;
51
53
  return {
52
54
  user: normalizeRoleScopeConfig(config.user, DEFAULT_AUTH_ROLES.user),
53
- organization: normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization),
55
+ organization: withoutOwnerAssignable(normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization)),
54
56
  team: normalizeRoleScopeConfig(config.team, DEFAULT_AUTH_ROLES.team)
55
57
  };
56
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.roles.mjs","names":[],"sources":["../../../../src/modules/auth/auth.roles.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport type AuthRoleScope = \"user\" | \"organization\" | \"team\";\r\n\r\nexport interface AuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles?: readonly string[];\r\n assignableRoles?: readonly string[];\r\n defaultRole?: string;\r\n}\r\n\r\nexport interface AuthRolesConfig {\r\n user: AuthRoleScopeConfig;\r\n organization: AuthRoleScopeConfig;\r\n team: AuthRoleScopeConfig;\r\n}\r\n\r\nexport interface NormalizedAuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles: readonly string[];\r\n assignableRoles: readonly string[];\r\n defaultRole: string;\r\n}\r\n\r\nexport interface NormalizedAuthRolesConfig {\r\n user: NormalizedAuthRoleScopeConfig;\r\n organization: NormalizedAuthRoleScopeConfig;\r\n team: NormalizedAuthRoleScopeConfig;\r\n}\r\n\r\nconst DEFAULT_USER_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"user\", \"admin\"],\r\n managerRoles: [\"admin\"],\r\n assignableRoles: [\"user\", \"admin\"],\r\n defaultRole: \"user\",\r\n};\r\n\r\nconst DEFAULT_ORGANIZATION_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"member\", \"admin\", \"owner\"],\r\n managerRoles: [\"admin\", \"owner\"],\r\n assignableRoles: [\"member\", \"admin\", \"owner\"],\r\n defaultRole: \"member\",\r\n};\r\n\r\nconst DEFAULT_TEAM_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"owner\"],\r\n managerRoles: [\"owner\"],\r\n assignableRoles: [\"owner\"],\r\n defaultRole: \"owner\",\r\n};\r\n\r\nexport const DEFAULT_AUTH_ROLES: NormalizedAuthRolesConfig = {\r\n user: DEFAULT_USER_SCOPE,\r\n organization: DEFAULT_ORGANIZATION_SCOPE,\r\n team: DEFAULT_TEAM_SCOPE,\r\n};\r\n\r\nfunction pickSubset(\r\n values: readonly string[],\r\n allowed: readonly string[],\r\n fallback: readonly string[]\r\n): readonly string[] {\r\n const allowedSet = new Set(allowed);\r\n const picked = values.filter((value) => allowedSet.has(value));\r\n if (picked.length > 0) {\r\n return picked;\r\n }\r\n\r\n const fallbackPicked = fallback.filter((value) => allowedSet.has(value));\r\n if (fallbackPicked.length > 0) {\r\n return fallbackPicked;\r\n }\r\n\r\n return allowed.length > 0 ? [allowed[0]] : [];\r\n}\r\n\r\nexport function normalizeRoleScopeConfig(\r\n scope: AuthRoleScopeConfig,\r\n defaults: NormalizedAuthRoleScopeConfig\r\n): NormalizedAuthRoleScopeConfig {\r\n const roles = scope.roles.length > 0 ? scope.roles : defaults.roles;\r\n const roleSet = new Set(roles);\r\n\r\n const defaultRole =\r\n scope.defaultRole && roleSet.has(scope.defaultRole)\r\n ? scope.defaultRole\r\n : defaults.defaultRole && roleSet.has(defaults.defaultRole)\r\n ? defaults.defaultRole\r\n : roles[0];\r\n\r\n const managerRoles = pickSubset(\r\n scope.managerRoles ?? defaults.managerRoles,\r\n roles,\r\n defaults.managerRoles\r\n );\r\n\r\n const assignableRoles = pickSubset(scope.assignableRoles ?? roles, roles, roles);\r\n\r\n return {\r\n roles,\r\n managerRoles,\r\n assignableRoles,\r\n defaultRole,\r\n };\r\n}\r\n\r\nexport function normalizeAuthRolesConfig(\r\n config?: AuthRolesConfig | null\r\n): NormalizedAuthRolesConfig {\r\n if (!config) {\r\n return DEFAULT_AUTH_ROLES;\r\n }\r\n\r\n return {\r\n user: normalizeRoleScopeConfig(config.user, DEFAULT_AUTH_ROLES.user),\r\n organization: normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization),\r\n team: normalizeRoleScopeConfig(config.team, DEFAULT_AUTH_ROLES.team),\r\n };\r\n}\r\n\r\nexport function defineAuthRoles(config: AuthRolesConfig): NormalizedAuthRolesConfig {\r\n return normalizeAuthRolesConfig(config);\r\n}\r\n\r\nexport function getRoleKeys(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope\r\n): readonly string[] {\r\n return config[scope].roles;\r\n}\r\n\r\nexport function isAllowedRole(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope,\r\n role: string\r\n): boolean {\r\n return getRoleKeys(config, scope).includes(role);\r\n}\r\n\r\nexport function createRoleValueSchema(scope: NormalizedAuthRoleScopeConfig) {\r\n const allowed = [...scope.roles];\r\n if (allowed.length === 0) {\r\n return z.string();\r\n }\r\n return z.enum(allowed as [string, ...string[]]);\r\n}\r\n\r\nexport function getAppRoleTranslationKey(scope: AuthRoleScope, role: string): string {\r\n return `${scope}.role.${role}`;\r\n}\r\n"],"mappings":";AAmDA,MAAa,qBAAgD;CAC3D,MAtBwD;EACxD,OAAO,CAAC,QAAQ,QAAQ;EACxB,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ,QAAQ;EAClC,aAAa;EACd;CAkBC,cAhBgE;EAChE,OAAO;GAAC;GAAU;GAAS;GAAQ;EACnC,cAAc,CAAC,SAAS,QAAQ;EAChC,iBAAiB;GAAC;GAAU;GAAS;GAAQ;EAC7C,aAAa;EACd;CAYC,MAVwD;EACxD,OAAO,CAAC,QAAQ;EAChB,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ;EAC1B,aAAa;EACd;CAMA;AAED,SAAS,WACP,QACA,SACA,UACmB;CACnB,MAAM,aAAa,IAAI,IAAI,QAAQ;CACnC,MAAM,SAAS,OAAO,QAAQ,UAAU,WAAW,IAAI,MAAM,CAAC;AAC9D,KAAI,OAAO,SAAS,EAClB,QAAO;CAGT,MAAM,iBAAiB,SAAS,QAAQ,UAAU,WAAW,IAAI,MAAM,CAAC;AACxE,KAAI,eAAe,SAAS,EAC1B,QAAO;AAGT,QAAO,QAAQ,SAAS,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE;;AAG/C,SAAgB,yBACd,OACA,UAC+B;CAC/B,MAAM,QAAQ,MAAM,MAAM,SAAS,IAAI,MAAM,QAAQ,SAAS;CAC9D,MAAM,UAAU,IAAI,IAAI,MAAM;CAE9B,MAAM,cACJ,MAAM,eAAe,QAAQ,IAAI,MAAM,YAAY,GAC/C,MAAM,cACN,SAAS,eAAe,QAAQ,IAAI,SAAS,YAAY,GACvD,SAAS,cACT,MAAM;AAUd,QAAO;EACL;EACA,cAVmB,WACnB,MAAM,gBAAgB,SAAS,cAC/B,OACA,SAAS,aACV;EAOC,iBALsB,WAAW,MAAM,mBAAmB,OAAO,OAAO,MAAM;EAM9E;EACD;;AAGH,SAAgB,yBACd,QAC2B;AAC3B,KAAI,CAAC,OACH,QAAO;AAGT,QAAO;EACL,MAAM,yBAAyB,OAAO,MAAM,mBAAmB,KAAK;EACpE,cAAc,yBAAyB,OAAO,cAAc,mBAAmB,aAAa;EAC5F,MAAM,yBAAyB,OAAO,MAAM,mBAAmB,KAAK;EACrE;;AAGH,SAAgB,gBAAgB,QAAoD;AAClF,QAAO,yBAAyB,OAAO;;AAGzC,SAAgB,YACd,QACA,OACmB;AACnB,QAAO,OAAO,OAAO;;AAGvB,SAAgB,cACd,QACA,OACA,MACS;AACT,QAAO,YAAY,QAAQ,MAAM,CAAC,SAAS,KAAK;;AAGlD,SAAgB,sBAAsB,OAAsC;CAC1E,MAAM,UAAU,CAAC,GAAG,MAAM,MAAM;AAChC,KAAI,QAAQ,WAAW,EACrB,QAAO,EAAE,QAAQ;AAEnB,QAAO,EAAE,KAAK,QAAiC;;AAGjD,SAAgB,yBAAyB,OAAsB,MAAsB;AACnF,QAAO,GAAG,MAAM,QAAQ"}
1
+ {"version":3,"file":"auth.roles.mjs","names":[],"sources":["../../../../src/modules/auth/auth.roles.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport type AuthRoleScope = \"user\" | \"organization\" | \"team\";\r\n\r\nexport interface AuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles?: readonly string[];\r\n assignableRoles?: readonly string[];\r\n defaultRole?: string;\r\n}\r\n\r\nexport interface AuthRolesConfig {\r\n user: AuthRoleScopeConfig;\r\n organization: AuthRoleScopeConfig;\r\n team: AuthRoleScopeConfig;\r\n}\r\n\r\nexport interface NormalizedAuthRoleScopeConfig {\r\n roles: readonly string[];\r\n managerRoles: readonly string[];\r\n assignableRoles: readonly string[];\r\n defaultRole: string;\r\n}\r\n\r\nexport interface NormalizedAuthRolesConfig {\r\n user: NormalizedAuthRoleScopeConfig;\r\n organization: NormalizedAuthRoleScopeConfig;\r\n team: NormalizedAuthRoleScopeConfig;\r\n}\r\n\r\nconst DEFAULT_USER_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"user\", \"admin\"],\r\n managerRoles: [\"admin\"],\r\n assignableRoles: [\"user\", \"admin\"],\r\n defaultRole: \"user\",\r\n};\r\n\r\nconst DEFAULT_ORGANIZATION_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"member\", \"admin\", \"owner\"],\r\n managerRoles: [\"admin\", \"owner\"],\r\n assignableRoles: [\"member\", \"admin\"],\r\n defaultRole: \"member\",\r\n};\r\n\r\nconst DEFAULT_TEAM_SCOPE: NormalizedAuthRoleScopeConfig = {\r\n roles: [\"owner\"],\r\n managerRoles: [\"owner\"],\r\n assignableRoles: [\"owner\"],\r\n defaultRole: \"owner\",\r\n};\r\n\r\nexport const DEFAULT_AUTH_ROLES: NormalizedAuthRolesConfig = {\r\n user: DEFAULT_USER_SCOPE,\r\n organization: DEFAULT_ORGANIZATION_SCOPE,\r\n team: DEFAULT_TEAM_SCOPE,\r\n};\r\n\r\nfunction pickSubset(\r\n values: readonly string[],\r\n allowed: readonly string[],\r\n fallback: readonly string[]\r\n): readonly string[] {\r\n const allowedSet = new Set(allowed);\r\n const picked = values.filter((value) => allowedSet.has(value));\r\n if (picked.length > 0) {\r\n return picked;\r\n }\r\n\r\n const fallbackPicked = fallback.filter((value) => allowedSet.has(value));\r\n if (fallbackPicked.length > 0) {\r\n return fallbackPicked;\r\n }\r\n\r\n return allowed.length > 0 ? [allowed[0]] : [];\r\n}\r\n\r\nexport function normalizeRoleScopeConfig(\r\n scope: AuthRoleScopeConfig,\r\n defaults: NormalizedAuthRoleScopeConfig\r\n): NormalizedAuthRoleScopeConfig {\r\n const roles = scope.roles.length > 0 ? scope.roles : defaults.roles;\r\n const roleSet = new Set(roles);\r\n\r\n const defaultRole =\r\n scope.defaultRole && roleSet.has(scope.defaultRole)\r\n ? scope.defaultRole\r\n : defaults.defaultRole && roleSet.has(defaults.defaultRole)\r\n ? defaults.defaultRole\r\n : roles[0];\r\n\r\n const managerRoles = pickSubset(\r\n scope.managerRoles ?? defaults.managerRoles,\r\n roles,\r\n defaults.managerRoles\r\n );\r\n\r\n const assignableRoles = pickSubset(scope.assignableRoles ?? roles, roles, roles);\r\n\r\n return {\r\n roles,\r\n managerRoles,\r\n assignableRoles,\r\n defaultRole,\r\n };\r\n}\r\n\r\nfunction withoutOwnerAssignable(\r\n scope: NormalizedAuthRoleScopeConfig\r\n): NormalizedAuthRoleScopeConfig {\r\n return {\r\n ...scope,\r\n assignableRoles: scope.assignableRoles.filter((role) => role !== \"owner\"),\r\n };\r\n}\r\n\r\nexport function normalizeAuthRolesConfig(\r\n config?: AuthRolesConfig | null\r\n): NormalizedAuthRolesConfig {\r\n if (!config) {\r\n return DEFAULT_AUTH_ROLES;\r\n }\r\n\r\n return {\r\n user: normalizeRoleScopeConfig(config.user, DEFAULT_AUTH_ROLES.user),\r\n organization: withoutOwnerAssignable(\r\n normalizeRoleScopeConfig(config.organization, DEFAULT_AUTH_ROLES.organization)\r\n ),\r\n team: normalizeRoleScopeConfig(config.team, DEFAULT_AUTH_ROLES.team),\r\n };\r\n}\r\n\r\nexport function defineAuthRoles(config: AuthRolesConfig): NormalizedAuthRolesConfig {\r\n return normalizeAuthRolesConfig(config);\r\n}\r\n\r\nexport function getRoleKeys(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope\r\n): readonly string[] {\r\n return config[scope].roles;\r\n}\r\n\r\nexport function isAllowedRole(\r\n config: NormalizedAuthRolesConfig,\r\n scope: AuthRoleScope,\r\n role: string\r\n): boolean {\r\n return getRoleKeys(config, scope).includes(role);\r\n}\r\n\r\nexport function createRoleValueSchema(scope: NormalizedAuthRoleScopeConfig) {\r\n const allowed = [...scope.roles];\r\n if (allowed.length === 0) {\r\n return z.string();\r\n }\r\n return z.enum(allowed as [string, ...string[]]);\r\n}\r\n\r\nexport function getAppRoleTranslationKey(scope: AuthRoleScope, role: string): string {\r\n return `${scope}.role.${role}`;\r\n}\r\n"],"mappings":";AAmDA,MAAa,qBAAgD;CAC3D,MAtBwD;EACxD,OAAO,CAAC,QAAQ,QAAQ;EACxB,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ,QAAQ;EAClC,aAAa;EACd;CAkBC,cAhBgE;EAChE,OAAO;GAAC;GAAU;GAAS;GAAQ;EACnC,cAAc,CAAC,SAAS,QAAQ;EAChC,iBAAiB,CAAC,UAAU,QAAQ;EACpC,aAAa;EACd;CAYC,MAVwD;EACxD,OAAO,CAAC,QAAQ;EAChB,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ;EAC1B,aAAa;EACd;CAMA;AAED,SAAS,WACP,QACA,SACA,UACmB;CACnB,MAAM,aAAa,IAAI,IAAI,QAAQ;CACnC,MAAM,SAAS,OAAO,QAAQ,UAAU,WAAW,IAAI,MAAM,CAAC;AAC9D,KAAI,OAAO,SAAS,EAClB,QAAO;CAGT,MAAM,iBAAiB,SAAS,QAAQ,UAAU,WAAW,IAAI,MAAM,CAAC;AACxE,KAAI,eAAe,SAAS,EAC1B,QAAO;AAGT,QAAO,QAAQ,SAAS,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE;;AAG/C,SAAgB,yBACd,OACA,UAC+B;CAC/B,MAAM,QAAQ,MAAM,MAAM,SAAS,IAAI,MAAM,QAAQ,SAAS;CAC9D,MAAM,UAAU,IAAI,IAAI,MAAM;CAE9B,MAAM,cACJ,MAAM,eAAe,QAAQ,IAAI,MAAM,YAAY,GAC/C,MAAM,cACN,SAAS,eAAe,QAAQ,IAAI,SAAS,YAAY,GACvD,SAAS,cACT,MAAM;AAUd,QAAO;EACL;EACA,cAVmB,WACnB,MAAM,gBAAgB,SAAS,cAC/B,OACA,SAAS,aACV;EAOC,iBALsB,WAAW,MAAM,mBAAmB,OAAO,OAAO,MAAM;EAM9E;EACD;;AAGH,SAAS,uBACP,OAC+B;AAC/B,QAAO;EACL,GAAG;EACH,iBAAiB,MAAM,gBAAgB,QAAQ,SAAS,SAAS,QAAQ;EAC1E;;AAGH,SAAgB,yBACd,QAC2B;AAC3B,KAAI,CAAC,OACH,QAAO;AAGT,QAAO;EACL,MAAM,yBAAyB,OAAO,MAAM,mBAAmB,KAAK;EACpE,cAAc,uBACZ,yBAAyB,OAAO,cAAc,mBAAmB,aAAa,CAC/E;EACD,MAAM,yBAAyB,OAAO,MAAM,mBAAmB,KAAK;EACrE;;AAGH,SAAgB,gBAAgB,QAAoD;AAClF,QAAO,yBAAyB,OAAO;;AAGzC,SAAgB,YACd,QACA,OACmB;AACnB,QAAO,OAAO,OAAO;;AAGvB,SAAgB,cACd,QACA,OACA,MACS;AACT,QAAO,YAAY,QAAQ,MAAM,CAAC,SAAS,KAAK;;AAGlD,SAAgB,sBAAsB,OAAsC;CAC1E,MAAM,UAAU,CAAC,GAAG,MAAM,MAAM;AAChC,KAAI,QAAQ,WAAW,EACrB,QAAO,EAAE,QAAQ;AAEnB,QAAO,EAAE,KAAK,QAAiC;;AAGjD,SAAgB,yBAAyB,OAAsB,MAAsB;AACnF,QAAO,GAAG,MAAM,QAAQ"}
@@ -13,9 +13,6 @@ const userSchema = zod.z.object({
13
13
  banned: zod.z.boolean().nullable(),
14
14
  banReason: zod.z.string().nullable(),
15
15
  banExpires: zod.z.date().nullable(),
16
- paymentCustomerId: zod.z.string().nullable(),
17
- paymentPlanTier: zod.z.string().nullable(),
18
- paymentPlanExpiresAt: zod.z.date().nullable(),
19
16
  preferences: zod.z.string().nullable(),
20
17
  onboarding: zod.z.boolean().nullable()
21
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"auth.schema.cjs","names":["z"],"sources":["../../../../src/modules/auth/auth.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport const userSchema = z.object({\r\n id: z.string(),\r\n name: z.string(),\r\n email: z.string(),\r\n emailVerified: z.boolean(),\r\n image: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n role: z.string().nullable(),\r\n banned: z.boolean().nullable(),\r\n banReason: z.string().nullable(),\r\n banExpires: z.date().nullable(),\r\n paymentCustomerId: z.string().nullable(),\r\n paymentPlanTier: z.string().nullable(),\r\n paymentPlanExpiresAt: z.date().nullable(),\r\n preferences: z.string().nullable(),\r\n onboarding: z.boolean().nullable(),\r\n});\r\n\r\nexport type UserSchema = z.infer<typeof userSchema>;\r\n"],"mappings":";;;AAEA,MAAa,aAAaA,IAAAA,EAAE,OAAO;CACjC,IAAIA,IAAAA,EAAE,QAAQ;CACd,MAAMA,IAAAA,EAAE,QAAQ;CAChB,OAAOA,IAAAA,EAAE,QAAQ;CACjB,eAAeA,IAAAA,EAAE,SAAS;CAC1B,OAAOA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAWA,IAAAA,EAAE,MAAM;CACnB,WAAWA,IAAAA,EAAE,MAAM;CACnB,MAAMA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQA,IAAAA,EAAE,SAAS,CAAC,UAAU;CAC9B,WAAWA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAYA,IAAAA,EAAE,MAAM,CAAC,UAAU;CAC/B,mBAAmBA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACxC,iBAAiBA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACtC,sBAAsBA,IAAAA,EAAE,MAAM,CAAC,UAAU;CACzC,aAAaA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAClC,YAAYA,IAAAA,EAAE,SAAS,CAAC,UAAU;CACnC,CAAC"}
1
+ {"version":3,"file":"auth.schema.cjs","names":["z"],"sources":["../../../../src/modules/auth/auth.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport const userSchema = z.object({\r\n id: z.string(),\r\n name: z.string(),\r\n email: z.string(),\r\n emailVerified: z.boolean(),\r\n image: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n role: z.string().nullable(),\r\n banned: z.boolean().nullable(),\r\n banReason: z.string().nullable(),\r\n banExpires: z.date().nullable(),\r\n preferences: z.string().nullable(),\r\n onboarding: z.boolean().nullable(),\r\n});\r\n\r\nexport type UserSchema = z.infer<typeof userSchema>;\r\n"],"mappings":";;;AAEA,MAAa,aAAaA,IAAAA,EAAE,OAAO;CACjC,IAAIA,IAAAA,EAAE,QAAQ;CACd,MAAMA,IAAAA,EAAE,QAAQ;CAChB,OAAOA,IAAAA,EAAE,QAAQ;CACjB,eAAeA,IAAAA,EAAE,SAAS;CAC1B,OAAOA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAWA,IAAAA,EAAE,MAAM;CACnB,WAAWA,IAAAA,EAAE,MAAM;CACnB,MAAMA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQA,IAAAA,EAAE,SAAS,CAAC,UAAU;CAC9B,WAAWA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAYA,IAAAA,EAAE,MAAM,CAAC,UAAU;CAC/B,aAAaA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAClC,YAAYA,IAAAA,EAAE,SAAS,CAAC,UAAU;CACnC,CAAC"}
@@ -13,9 +13,6 @@ declare const userSchema: z.ZodObject<{
13
13
  banned: z.ZodNullable<z.ZodBoolean>;
14
14
  banReason: z.ZodNullable<z.ZodString>;
15
15
  banExpires: z.ZodNullable<z.ZodDate>;
16
- paymentCustomerId: z.ZodNullable<z.ZodString>;
17
- paymentPlanTier: z.ZodNullable<z.ZodString>;
18
- paymentPlanExpiresAt: z.ZodNullable<z.ZodDate>;
19
16
  preferences: z.ZodNullable<z.ZodString>;
20
17
  onboarding: z.ZodNullable<z.ZodBoolean>;
21
18
  }, z.core.$strip>;
@@ -13,9 +13,6 @@ declare const userSchema: z.ZodObject<{
13
13
  banned: z.ZodNullable<z.ZodBoolean>;
14
14
  banReason: z.ZodNullable<z.ZodString>;
15
15
  banExpires: z.ZodNullable<z.ZodDate>;
16
- paymentCustomerId: z.ZodNullable<z.ZodString>;
17
- paymentPlanTier: z.ZodNullable<z.ZodString>;
18
- paymentPlanExpiresAt: z.ZodNullable<z.ZodDate>;
19
16
  preferences: z.ZodNullable<z.ZodString>;
20
17
  onboarding: z.ZodNullable<z.ZodBoolean>;
21
18
  }, z.core.$strip>;
@@ -12,9 +12,6 @@ const userSchema = z.object({
12
12
  banned: z.boolean().nullable(),
13
13
  banReason: z.string().nullable(),
14
14
  banExpires: z.date().nullable(),
15
- paymentCustomerId: z.string().nullable(),
16
- paymentPlanTier: z.string().nullable(),
17
- paymentPlanExpiresAt: z.date().nullable(),
18
15
  preferences: z.string().nullable(),
19
16
  onboarding: z.boolean().nullable()
20
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"auth.schema.mjs","names":[],"sources":["../../../../src/modules/auth/auth.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport const userSchema = z.object({\r\n id: z.string(),\r\n name: z.string(),\r\n email: z.string(),\r\n emailVerified: z.boolean(),\r\n image: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n role: z.string().nullable(),\r\n banned: z.boolean().nullable(),\r\n banReason: z.string().nullable(),\r\n banExpires: z.date().nullable(),\r\n paymentCustomerId: z.string().nullable(),\r\n paymentPlanTier: z.string().nullable(),\r\n paymentPlanExpiresAt: z.date().nullable(),\r\n preferences: z.string().nullable(),\r\n onboarding: z.boolean().nullable(),\r\n});\r\n\r\nexport type UserSchema = z.infer<typeof userSchema>;\r\n"],"mappings":";;AAEA,MAAa,aAAa,EAAE,OAAO;CACjC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ;CACjB,eAAe,EAAE,SAAS;CAC1B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAW,EAAE,MAAM;CACnB,WAAW,EAAE,MAAM;CACnB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,SAAS,CAAC,UAAU;CAC9B,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAY,EAAE,MAAM,CAAC,UAAU;CAC/B,mBAAmB,EAAE,QAAQ,CAAC,UAAU;CACxC,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,sBAAsB,EAAE,MAAM,CAAC,UAAU;CACzC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,YAAY,EAAE,SAAS,CAAC,UAAU;CACnC,CAAC"}
1
+ {"version":3,"file":"auth.schema.mjs","names":[],"sources":["../../../../src/modules/auth/auth.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport const userSchema = z.object({\r\n id: z.string(),\r\n name: z.string(),\r\n email: z.string(),\r\n emailVerified: z.boolean(),\r\n image: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n role: z.string().nullable(),\r\n banned: z.boolean().nullable(),\r\n banReason: z.string().nullable(),\r\n banExpires: z.date().nullable(),\r\n preferences: z.string().nullable(),\r\n onboarding: z.boolean().nullable(),\r\n});\r\n\r\nexport type UserSchema = z.infer<typeof userSchema>;\r\n"],"mappings":";;AAEA,MAAa,aAAa,EAAE,OAAO;CACjC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ;CACjB,eAAe,EAAE,SAAS;CAC1B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAW,EAAE,MAAM;CACnB,WAAW,EAAE,MAAM;CACnB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,SAAS,CAAC,UAAU;CAC9B,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAY,EAAE,MAAM,CAAC,UAAU;CAC/B,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,YAAY,EAAE,SAAS,CAAC,UAAU;CACnC,CAAC"}
@@ -15,11 +15,28 @@ const NOTIFICATION_SEND_STATUSES = [
15
15
  "sent",
16
16
  "failed"
17
17
  ];
18
- const NOTIFICATION_DELIVER_JOB_NAME = "notification.deliver";
18
+ const NOTIFICATION_WEB_PUSH_JOB_NAME = "notification.webPush";
19
+ const NOTIFICATION_MOBILE_PUSH_JOB_NAME = "notification.mobilePush";
20
+ const NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS = 120 * 1e3;
21
+ const NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS = 300 * 1e3;
22
+ const NOTIFICATION_EMAIL_JOB_NAME = "notification.email";
23
+ const NOTIFICATION_DEFAULT_EMAIL_DELAY_MS = 900 * 1e3;
24
+ const NOTIFICATION_CHANNELS = [
25
+ "in-app",
26
+ "web-push",
27
+ "mobile-push",
28
+ "email"
29
+ ];
19
30
  //#endregion
20
- exports.NOTIFICATION_DELIVER_JOB_NAME = NOTIFICATION_DELIVER_JOB_NAME;
31
+ exports.NOTIFICATION_CHANNELS = NOTIFICATION_CHANNELS;
32
+ exports.NOTIFICATION_DEFAULT_EMAIL_DELAY_MS = NOTIFICATION_DEFAULT_EMAIL_DELAY_MS;
33
+ exports.NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS = NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS;
34
+ exports.NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS = NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS;
35
+ exports.NOTIFICATION_EMAIL_JOB_NAME = NOTIFICATION_EMAIL_JOB_NAME;
36
+ exports.NOTIFICATION_MOBILE_PUSH_JOB_NAME = NOTIFICATION_MOBILE_PUSH_JOB_NAME;
21
37
  exports.NOTIFICATION_PLATFORMS = NOTIFICATION_PLATFORMS;
22
38
  exports.NOTIFICATION_PROVIDERS = NOTIFICATION_PROVIDERS;
23
39
  exports.NOTIFICATION_SEND_STATUSES = NOTIFICATION_SEND_STATUSES;
40
+ exports.NOTIFICATION_WEB_PUSH_JOB_NAME = NOTIFICATION_WEB_PUSH_JOB_NAME;
24
41
 
25
42
  //# sourceMappingURL=notification.constants.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.constants.cjs","names":[],"sources":["../../../../src/modules/notification/notification.constants.ts"],"sourcesContent":["export const NOTIFICATION_PLATFORMS = [\"web\", \"ios\", \"android\"] as const;\r\nexport type NotificationPlatform = (typeof NOTIFICATION_PLATFORMS)[number];\r\n\r\nexport const NOTIFICATION_PROVIDERS = [\"web\", \"apn\", \"fcm\"] as const;\r\nexport type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];\r\n\r\nexport const NOTIFICATION_SEND_STATUSES = [\"pending\", \"sent\", \"failed\"] as const;\r\nexport type NotificationSendStatus = (typeof NOTIFICATION_SEND_STATUSES)[number];\r\n\r\nexport const NOTIFICATION_DELIVER_JOB_NAME = \"notification.deliver\" as const;\r\n"],"mappings":";;AAAA,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAU;AAG/D,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAM;AAG3D,MAAa,6BAA6B;CAAC;CAAW;CAAQ;CAAS;AAGvE,MAAa,gCAAgC"}
1
+ {"version":3,"file":"notification.constants.cjs","names":[],"sources":["../../../../src/modules/notification/notification.constants.ts"],"sourcesContent":["export const NOTIFICATION_PLATFORMS = [\"web\", \"ios\", \"android\"] as const;\r\nexport type NotificationPlatform = (typeof NOTIFICATION_PLATFORMS)[number];\r\n\r\nexport const NOTIFICATION_PROVIDERS = [\"web\", \"apn\", \"fcm\"] as const;\r\nexport type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];\r\n\r\nexport const NOTIFICATION_SEND_STATUSES = [\"pending\", \"sent\", \"failed\"] as const;\r\nexport type NotificationSendStatus = (typeof NOTIFICATION_SEND_STATUSES)[number];\r\n\r\nexport const NOTIFICATION_WEB_PUSH_JOB_NAME = \"notification.webPush\" as const;\r\nexport const NOTIFICATION_MOBILE_PUSH_JOB_NAME = \"notification.mobilePush\" as const;\r\n\r\nexport const NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS = 2 * 60 * 1000;\r\nexport const NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS = 5 * 60 * 1000;\r\nexport const NOTIFICATION_EMAIL_JOB_NAME = \"notification.email\" as const;\r\nexport const NOTIFICATION_DEFAULT_EMAIL_DELAY_MS = 15 * 60 * 1000;\r\n\r\nexport const NOTIFICATION_CHANNELS = [\"in-app\", \"web-push\", \"mobile-push\", \"email\"] as const;\r\nexport type NotificationChannel = (typeof NOTIFICATION_CHANNELS)[number];\r\n\r\nexport interface NotificationKindDelays {\r\n readonly webPushMs?: number;\r\n readonly mobilePushMs?: number;\r\n readonly emailMs?: number;\r\n}\r\n\r\nexport interface NotificationKind {\r\n readonly id: string;\r\n readonly defaultChannels: readonly NotificationChannel[];\r\n readonly delays?: NotificationKindDelays;\r\n readonly emailTemplate?: string;\r\n}\r\n"],"mappings":";;AAAA,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAU;AAG/D,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAM;AAG3D,MAAa,6BAA6B;CAAC;CAAW;CAAQ;CAAS;AAGvE,MAAa,iCAAiC;AAC9C,MAAa,oCAAoC;AAEjD,MAAa,yCAAyC,MAAS;AAC/D,MAAa,4CAA4C,MAAS;AAClE,MAAa,8BAA8B;AAC3C,MAAa,sCAAsC,MAAU;AAE7D,MAAa,wBAAwB;CAAC;CAAU;CAAY;CAAe;CAAQ"}
@@ -5,7 +5,25 @@ declare const NOTIFICATION_PROVIDERS: readonly ["web", "apn", "fcm"];
5
5
  type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];
6
6
  declare const NOTIFICATION_SEND_STATUSES: readonly ["pending", "sent", "failed"];
7
7
  type NotificationSendStatus = (typeof NOTIFICATION_SEND_STATUSES)[number];
8
- declare const NOTIFICATION_DELIVER_JOB_NAME: "notification.deliver";
8
+ declare const NOTIFICATION_WEB_PUSH_JOB_NAME: "notification.webPush";
9
+ declare const NOTIFICATION_MOBILE_PUSH_JOB_NAME: "notification.mobilePush";
10
+ declare const NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS: number;
11
+ declare const NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS: number;
12
+ declare const NOTIFICATION_EMAIL_JOB_NAME: "notification.email";
13
+ declare const NOTIFICATION_DEFAULT_EMAIL_DELAY_MS: number;
14
+ declare const NOTIFICATION_CHANNELS: readonly ["in-app", "web-push", "mobile-push", "email"];
15
+ type NotificationChannel = (typeof NOTIFICATION_CHANNELS)[number];
16
+ interface NotificationKindDelays {
17
+ readonly webPushMs?: number;
18
+ readonly mobilePushMs?: number;
19
+ readonly emailMs?: number;
20
+ }
21
+ interface NotificationKind {
22
+ readonly id: string;
23
+ readonly defaultChannels: readonly NotificationChannel[];
24
+ readonly delays?: NotificationKindDelays;
25
+ readonly emailTemplate?: string;
26
+ }
9
27
  //#endregion
10
- export { NOTIFICATION_DELIVER_JOB_NAME, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES, NotificationPlatform, NotificationProvider, NotificationSendStatus };
28
+ export { NOTIFICATION_CHANNELS, NOTIFICATION_DEFAULT_EMAIL_DELAY_MS, NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS, NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS, NOTIFICATION_EMAIL_JOB_NAME, NOTIFICATION_MOBILE_PUSH_JOB_NAME, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES, NOTIFICATION_WEB_PUSH_JOB_NAME, NotificationChannel, NotificationKind, NotificationKindDelays, NotificationPlatform, NotificationProvider, NotificationSendStatus };
11
29
  //# sourceMappingURL=notification.constants.d.cts.map
@@ -5,7 +5,25 @@ declare const NOTIFICATION_PROVIDERS: readonly ["web", "apn", "fcm"];
5
5
  type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];
6
6
  declare const NOTIFICATION_SEND_STATUSES: readonly ["pending", "sent", "failed"];
7
7
  type NotificationSendStatus = (typeof NOTIFICATION_SEND_STATUSES)[number];
8
- declare const NOTIFICATION_DELIVER_JOB_NAME: "notification.deliver";
8
+ declare const NOTIFICATION_WEB_PUSH_JOB_NAME: "notification.webPush";
9
+ declare const NOTIFICATION_MOBILE_PUSH_JOB_NAME: "notification.mobilePush";
10
+ declare const NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS: number;
11
+ declare const NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS: number;
12
+ declare const NOTIFICATION_EMAIL_JOB_NAME: "notification.email";
13
+ declare const NOTIFICATION_DEFAULT_EMAIL_DELAY_MS: number;
14
+ declare const NOTIFICATION_CHANNELS: readonly ["in-app", "web-push", "mobile-push", "email"];
15
+ type NotificationChannel = (typeof NOTIFICATION_CHANNELS)[number];
16
+ interface NotificationKindDelays {
17
+ readonly webPushMs?: number;
18
+ readonly mobilePushMs?: number;
19
+ readonly emailMs?: number;
20
+ }
21
+ interface NotificationKind {
22
+ readonly id: string;
23
+ readonly defaultChannels: readonly NotificationChannel[];
24
+ readonly delays?: NotificationKindDelays;
25
+ readonly emailTemplate?: string;
26
+ }
9
27
  //#endregion
10
- export { NOTIFICATION_DELIVER_JOB_NAME, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES, NotificationPlatform, NotificationProvider, NotificationSendStatus };
28
+ export { NOTIFICATION_CHANNELS, NOTIFICATION_DEFAULT_EMAIL_DELAY_MS, NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS, NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS, NOTIFICATION_EMAIL_JOB_NAME, NOTIFICATION_MOBILE_PUSH_JOB_NAME, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES, NOTIFICATION_WEB_PUSH_JOB_NAME, NotificationChannel, NotificationKind, NotificationKindDelays, NotificationPlatform, NotificationProvider, NotificationSendStatus };
11
29
  //# sourceMappingURL=notification.constants.d.mts.map
@@ -14,8 +14,19 @@ const NOTIFICATION_SEND_STATUSES = [
14
14
  "sent",
15
15
  "failed"
16
16
  ];
17
- const NOTIFICATION_DELIVER_JOB_NAME = "notification.deliver";
17
+ const NOTIFICATION_WEB_PUSH_JOB_NAME = "notification.webPush";
18
+ const NOTIFICATION_MOBILE_PUSH_JOB_NAME = "notification.mobilePush";
19
+ const NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS = 120 * 1e3;
20
+ const NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS = 300 * 1e3;
21
+ const NOTIFICATION_EMAIL_JOB_NAME = "notification.email";
22
+ const NOTIFICATION_DEFAULT_EMAIL_DELAY_MS = 900 * 1e3;
23
+ const NOTIFICATION_CHANNELS = [
24
+ "in-app",
25
+ "web-push",
26
+ "mobile-push",
27
+ "email"
28
+ ];
18
29
  //#endregion
19
- export { NOTIFICATION_DELIVER_JOB_NAME, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES };
30
+ export { NOTIFICATION_CHANNELS, NOTIFICATION_DEFAULT_EMAIL_DELAY_MS, NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS, NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS, NOTIFICATION_EMAIL_JOB_NAME, NOTIFICATION_MOBILE_PUSH_JOB_NAME, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES, NOTIFICATION_WEB_PUSH_JOB_NAME };
20
31
 
21
32
  //# sourceMappingURL=notification.constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.constants.mjs","names":[],"sources":["../../../../src/modules/notification/notification.constants.ts"],"sourcesContent":["export const NOTIFICATION_PLATFORMS = [\"web\", \"ios\", \"android\"] as const;\r\nexport type NotificationPlatform = (typeof NOTIFICATION_PLATFORMS)[number];\r\n\r\nexport const NOTIFICATION_PROVIDERS = [\"web\", \"apn\", \"fcm\"] as const;\r\nexport type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];\r\n\r\nexport const NOTIFICATION_SEND_STATUSES = [\"pending\", \"sent\", \"failed\"] as const;\r\nexport type NotificationSendStatus = (typeof NOTIFICATION_SEND_STATUSES)[number];\r\n\r\nexport const NOTIFICATION_DELIVER_JOB_NAME = \"notification.deliver\" as const;\r\n"],"mappings":";AAAA,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAU;AAG/D,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAM;AAG3D,MAAa,6BAA6B;CAAC;CAAW;CAAQ;CAAS;AAGvE,MAAa,gCAAgC"}
1
+ {"version":3,"file":"notification.constants.mjs","names":[],"sources":["../../../../src/modules/notification/notification.constants.ts"],"sourcesContent":["export const NOTIFICATION_PLATFORMS = [\"web\", \"ios\", \"android\"] as const;\r\nexport type NotificationPlatform = (typeof NOTIFICATION_PLATFORMS)[number];\r\n\r\nexport const NOTIFICATION_PROVIDERS = [\"web\", \"apn\", \"fcm\"] as const;\r\nexport type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];\r\n\r\nexport const NOTIFICATION_SEND_STATUSES = [\"pending\", \"sent\", \"failed\"] as const;\r\nexport type NotificationSendStatus = (typeof NOTIFICATION_SEND_STATUSES)[number];\r\n\r\nexport const NOTIFICATION_WEB_PUSH_JOB_NAME = \"notification.webPush\" as const;\r\nexport const NOTIFICATION_MOBILE_PUSH_JOB_NAME = \"notification.mobilePush\" as const;\r\n\r\nexport const NOTIFICATION_DEFAULT_WEB_PUSH_DELAY_MS = 2 * 60 * 1000;\r\nexport const NOTIFICATION_DEFAULT_MOBILE_PUSH_DELAY_MS = 5 * 60 * 1000;\r\nexport const NOTIFICATION_EMAIL_JOB_NAME = \"notification.email\" as const;\r\nexport const NOTIFICATION_DEFAULT_EMAIL_DELAY_MS = 15 * 60 * 1000;\r\n\r\nexport const NOTIFICATION_CHANNELS = [\"in-app\", \"web-push\", \"mobile-push\", \"email\"] as const;\r\nexport type NotificationChannel = (typeof NOTIFICATION_CHANNELS)[number];\r\n\r\nexport interface NotificationKindDelays {\r\n readonly webPushMs?: number;\r\n readonly mobilePushMs?: number;\r\n readonly emailMs?: number;\r\n}\r\n\r\nexport interface NotificationKind {\r\n readonly id: string;\r\n readonly defaultChannels: readonly NotificationChannel[];\r\n readonly delays?: NotificationKindDelays;\r\n readonly emailTemplate?: string;\r\n}\r\n"],"mappings":";AAAA,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAU;AAG/D,MAAa,yBAAyB;CAAC;CAAO;CAAO;CAAM;AAG3D,MAAa,6BAA6B;CAAC;CAAW;CAAQ;CAAS;AAGvE,MAAa,iCAAiC;AAC9C,MAAa,oCAAoC;AAEjD,MAAa,yCAAyC,MAAS;AAC/D,MAAa,4CAA4C,MAAS;AAClE,MAAa,8BAA8B;AAC3C,MAAa,sCAAsC,MAAU;AAE7D,MAAa,wBAAwB;CAAC;CAAU;CAAY;CAAe;CAAQ"}
@@ -46,12 +46,15 @@ const notificationDeviceSelectSchema = zod.z.object({
46
46
  });
47
47
  const notificationListDevicesOutputSchema = zod.z.array(notificationDeviceSelectSchema);
48
48
  const notificationVapidPublicKeyOutputSchema = zod.z.object({ publicKey: zod.z.string() });
49
+ const notificationChannelSchema = zod.z.enum(require_src_modules_notification_notification_constants.NOTIFICATION_CHANNELS);
49
50
  const notificationSendLogSelectSchema = zod.z.object({
50
51
  id: zod.z.string(),
51
52
  batchId: zod.z.string(),
53
+ notificationId: zod.z.string(),
52
54
  userId: zod.z.string(),
53
- deviceId: zod.z.string(),
54
- provider: notificationProviderSchema,
55
+ deviceId: zod.z.string().nullable(),
56
+ channel: notificationChannelSchema,
57
+ provider: notificationProviderSchema.nullable(),
55
58
  title: zod.z.string(),
56
59
  body: zod.z.string(),
57
60
  data: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
@@ -66,21 +69,59 @@ const notificationListSendLogsInputSchema = zod.z.object({
66
69
  limit: zod.z.number().int().min(1).max(100).optional()
67
70
  });
68
71
  const notificationListSendLogsOutputSchema = zod.z.array(notificationSendLogSelectSchema);
72
+ const notificationInstanceSelectSchema = zod.z.object({
73
+ id: zod.z.string(),
74
+ memberId: zod.z.string(),
75
+ userId: zod.z.string(),
76
+ kind: zod.z.string(),
77
+ title: zod.z.string(),
78
+ body: zod.z.string(),
79
+ data: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
80
+ visibleInInbox: zod.z.boolean(),
81
+ webPushedAt: zod.z.date().nullable(),
82
+ mobilePushedAt: zod.z.date().nullable(),
83
+ emailedAt: zod.z.date().nullable(),
84
+ readAt: zod.z.date().nullable(),
85
+ createdAt: zod.z.date(),
86
+ updatedAt: zod.z.date()
87
+ });
88
+ const notificationListInboxOutputSchema = zod.z.array(notificationInstanceSelectSchema);
89
+ const notificationMarkReadInputSchema = zod.z.object({ id: zod.z.string() });
69
90
  const notificationSendTestInputSchema = zod.z.object({
70
- userId: zod.z.string().optional(),
91
+ memberId: zod.z.string().min(1),
92
+ kind: zod.z.string().min(1),
71
93
  title: zod.z.string().min(1).max(200),
72
94
  body: zod.z.string().min(1).max(2e3),
73
95
  data: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
74
96
  });
75
- const notificationSendTestOutputSchema = zod.z.object({
76
- batchId: zod.z.string(),
77
- jobId: zod.z.string()
97
+ const notificationSendTestOutputSchema = zod.z.object({ id: zod.z.string() });
98
+ const notificationKindPreferenceChannelSchema = zod.z.object({
99
+ channel: notificationChannelSchema,
100
+ enabled: zod.z.boolean()
101
+ });
102
+ const notificationKindPreferenceSchema = zod.z.object({
103
+ kind: zod.z.string(),
104
+ channels: zod.z.array(notificationKindPreferenceChannelSchema)
105
+ });
106
+ const notificationListPreferencesOutputSchema = zod.z.array(notificationKindPreferenceSchema);
107
+ const notificationSetPreferenceInputSchema = zod.z.object({
108
+ kind: zod.z.string().min(1),
109
+ channel: notificationChannelSchema,
110
+ enabled: zod.z.boolean()
78
111
  });
112
+ const notificationSetPreferenceOutputSchema = notificationKindPreferenceSchema;
79
113
  //#endregion
114
+ exports.notificationChannelSchema = notificationChannelSchema;
80
115
  exports.notificationDeviceSelectSchema = notificationDeviceSelectSchema;
116
+ exports.notificationInstanceSelectSchema = notificationInstanceSelectSchema;
117
+ exports.notificationKindPreferenceChannelSchema = notificationKindPreferenceChannelSchema;
118
+ exports.notificationKindPreferenceSchema = notificationKindPreferenceSchema;
81
119
  exports.notificationListDevicesOutputSchema = notificationListDevicesOutputSchema;
120
+ exports.notificationListInboxOutputSchema = notificationListInboxOutputSchema;
121
+ exports.notificationListPreferencesOutputSchema = notificationListPreferencesOutputSchema;
82
122
  exports.notificationListSendLogsInputSchema = notificationListSendLogsInputSchema;
83
123
  exports.notificationListSendLogsOutputSchema = notificationListSendLogsOutputSchema;
124
+ exports.notificationMarkReadInputSchema = notificationMarkReadInputSchema;
84
125
  exports.notificationPlatformSchema = notificationPlatformSchema;
85
126
  exports.notificationProviderSchema = notificationProviderSchema;
86
127
  exports.notificationRegisterDeviceInputSchema = notificationRegisterDeviceInputSchema;
@@ -89,6 +130,8 @@ exports.notificationSendLogSelectSchema = notificationSendLogSelectSchema;
89
130
  exports.notificationSendStatusSchema = notificationSendStatusSchema;
90
131
  exports.notificationSendTestInputSchema = notificationSendTestInputSchema;
91
132
  exports.notificationSendTestOutputSchema = notificationSendTestOutputSchema;
133
+ exports.notificationSetPreferenceInputSchema = notificationSetPreferenceInputSchema;
134
+ exports.notificationSetPreferenceOutputSchema = notificationSetPreferenceOutputSchema;
92
135
  exports.notificationUnregisterDeviceInputSchema = notificationUnregisterDeviceInputSchema;
93
136
  exports.notificationUnregisterDeviceOutputSchema = notificationUnregisterDeviceOutputSchema;
94
137
  exports.notificationVapidPublicKeyOutputSchema = notificationVapidPublicKeyOutputSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"notification.schema.cjs","names":["z","NOTIFICATION_PLATFORMS","NOTIFICATION_PROVIDERS","NOTIFICATION_SEND_STATUSES"],"sources":["../../../../src/modules/notification/notification.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport {\r\n NOTIFICATION_PLATFORMS,\r\n NOTIFICATION_PROVIDERS,\r\n NOTIFICATION_SEND_STATUSES,\r\n} from \"./notification.constants\";\r\n\r\nexport const notificationPlatformSchema = z.enum(NOTIFICATION_PLATFORMS);\r\nexport const notificationProviderSchema = z.enum(NOTIFICATION_PROVIDERS);\r\nexport const notificationSendStatusSchema = z.enum(NOTIFICATION_SEND_STATUSES);\r\n\r\n/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */\r\nexport const pushSubscriptionJsonSchema = z.object({\r\n endpoint: z.string().url(),\r\n expirationTime: z.number().nullable().optional(),\r\n keys: z.object({\r\n p256dh: z.string(),\r\n auth: z.string(),\r\n }),\r\n});\r\n\r\nexport const notificationRegisterDeviceInputSchema = z.discriminatedUnion(\"platform\", [\r\n z.object({\r\n platform: z.literal(\"web\"),\r\n subscription: pushSubscriptionJsonSchema,\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"ios\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"android\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n]);\r\n\r\nexport type NotificationRegisterDeviceInput = z.infer<typeof notificationRegisterDeviceInputSchema>;\r\n\r\nexport const notificationRegisterDeviceOutputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceInputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceOutputSchema = z.object({\r\n ok: z.literal(true),\r\n});\r\n\r\nexport const notificationDeviceSelectSchema = z.object({\r\n id: z.string(),\r\n userId: z.string(),\r\n platform: notificationPlatformSchema,\r\n endpoint: z.string().nullable(),\r\n label: z.string().nullable(),\r\n enabled: z.boolean(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListDevicesOutputSchema = z.array(notificationDeviceSelectSchema);\r\n\r\nexport const notificationVapidPublicKeyOutputSchema = z.object({\r\n publicKey: z.string(),\r\n});\r\n\r\nexport const notificationSendLogSelectSchema = z.object({\r\n id: z.string(),\r\n batchId: z.string(),\r\n userId: z.string(),\r\n deviceId: z.string(),\r\n provider: notificationProviderSchema,\r\n title: z.string(),\r\n body: z.string(),\r\n data: z.record(z.string(), z.unknown()).nullable(),\r\n status: notificationSendStatusSchema,\r\n error: z.string().nullable(),\r\n jobId: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListSendLogsInputSchema = z.object({\r\n batchId: z.string().optional(),\r\n limit: z.number().int().min(1).max(100).optional(),\r\n});\r\n\r\nexport const notificationListSendLogsOutputSchema = z.array(notificationSendLogSelectSchema);\r\n\r\nexport const notificationSendTestInputSchema = z.object({\r\n userId: z.string().optional(),\r\n title: z.string().min(1).max(200),\r\n body: z.string().min(1).max(2000),\r\n data: z.record(z.string(), z.unknown()).optional(),\r\n});\r\n\r\nexport const notificationSendTestOutputSchema = z.object({\r\n batchId: z.string(),\r\n jobId: z.string(),\r\n});\r\n"],"mappings":";;;;AAOA,MAAa,6BAA6BA,IAAAA,EAAE,KAAKC,wDAAAA,uBAAuB;AACxE,MAAa,6BAA6BD,IAAAA,EAAE,KAAKE,wDAAAA,uBAAuB;AACxE,MAAa,+BAA+BF,IAAAA,EAAE,KAAKG,wDAAAA,2BAA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AQA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC7B,OAAOA,IAAAA,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;CACjC,MAAMA,IAAAA,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAK;CACjC,MAAMA,IAAAA,EAAE,OAAOA,IAAAA,EAAE,QAAQ,EAAEA,IAAAA,EAAE,SAAS,CAAC,CAAC,UAAU;CACnD,CAAC;AAEF,MAAa,mCAAmCA,IAAAA,EAAE,OAAO;CACvD,SAASA,IAAAA,EAAE,QAAQ;CACnB,OAAOA,IAAAA,EAAE,QAAQ;CAClB,CAAC"}
1
+ {"version":3,"file":"notification.schema.cjs","names":["z","NOTIFICATION_PLATFORMS","NOTIFICATION_PROVIDERS","NOTIFICATION_SEND_STATUSES","NOTIFICATION_CHANNELS"],"sources":["../../../../src/modules/notification/notification.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport {\r\n NOTIFICATION_CHANNELS,\r\n NOTIFICATION_PLATFORMS,\r\n NOTIFICATION_PROVIDERS,\r\n NOTIFICATION_SEND_STATUSES,\r\n} from \"./notification.constants\";\r\n\r\nexport const notificationPlatformSchema = z.enum(NOTIFICATION_PLATFORMS);\r\nexport const notificationProviderSchema = z.enum(NOTIFICATION_PROVIDERS);\r\nexport const notificationSendStatusSchema = z.enum(NOTIFICATION_SEND_STATUSES);\r\n\r\n/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */\r\nexport const pushSubscriptionJsonSchema = z.object({\r\n endpoint: z.string().url(),\r\n expirationTime: z.number().nullable().optional(),\r\n keys: z.object({\r\n p256dh: z.string(),\r\n auth: z.string(),\r\n }),\r\n});\r\n\r\nexport const notificationRegisterDeviceInputSchema = z.discriminatedUnion(\"platform\", [\r\n z.object({\r\n platform: z.literal(\"web\"),\r\n subscription: pushSubscriptionJsonSchema,\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"ios\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"android\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n]);\r\n\r\nexport type NotificationRegisterDeviceInput = z.infer<typeof notificationRegisterDeviceInputSchema>;\r\n\r\nexport const notificationRegisterDeviceOutputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceInputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceOutputSchema = z.object({\r\n ok: z.literal(true),\r\n});\r\n\r\nexport const notificationDeviceSelectSchema = z.object({\r\n id: z.string(),\r\n userId: z.string(),\r\n platform: notificationPlatformSchema,\r\n endpoint: z.string().nullable(),\r\n label: z.string().nullable(),\r\n enabled: z.boolean(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListDevicesOutputSchema = z.array(notificationDeviceSelectSchema);\r\n\r\nexport const notificationVapidPublicKeyOutputSchema = z.object({\r\n publicKey: z.string(),\r\n});\r\n\r\nexport const notificationChannelSchema = z.enum(NOTIFICATION_CHANNELS);\r\n\r\nexport const notificationSendLogSelectSchema = z.object({\r\n id: z.string(),\r\n batchId: z.string(),\r\n notificationId: z.string(),\r\n userId: z.string(),\r\n deviceId: z.string().nullable(),\r\n channel: notificationChannelSchema,\r\n provider: notificationProviderSchema.nullable(),\r\n title: z.string(),\r\n body: z.string(),\r\n data: z.record(z.string(), z.unknown()).nullable(),\r\n status: notificationSendStatusSchema,\r\n error: z.string().nullable(),\r\n jobId: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListSendLogsInputSchema = z.object({\r\n batchId: z.string().optional(),\r\n limit: z.number().int().min(1).max(100).optional(),\r\n});\r\n\r\nexport const notificationListSendLogsOutputSchema = z.array(notificationSendLogSelectSchema);\r\n\r\nexport const notificationInstanceSelectSchema = z.object({\r\n id: z.string(),\r\n memberId: z.string(),\r\n userId: z.string(),\r\n kind: z.string(),\r\n title: z.string(),\r\n body: z.string(),\r\n data: z.record(z.string(), z.unknown()).nullable(),\r\n visibleInInbox: z.boolean(),\r\n webPushedAt: z.date().nullable(),\r\n mobilePushedAt: z.date().nullable(),\r\n emailedAt: z.date().nullable(),\r\n readAt: z.date().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListInboxOutputSchema = z.array(notificationInstanceSelectSchema);\r\n\r\nexport const notificationMarkReadInputSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport const notificationSendTestInputSchema = z.object({\r\n memberId: z.string().min(1),\r\n kind: z.string().min(1),\r\n title: z.string().min(1).max(200),\r\n body: z.string().min(1).max(2000),\r\n data: z.record(z.string(), z.unknown()).optional(),\r\n});\r\n\r\nexport const notificationSendTestOutputSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport const notificationKindPreferenceChannelSchema = z.object({\r\n channel: notificationChannelSchema,\r\n enabled: z.boolean(),\r\n});\r\n\r\nexport const notificationKindPreferenceSchema = z.object({\r\n kind: z.string(),\r\n channels: z.array(notificationKindPreferenceChannelSchema),\r\n});\r\n\r\nexport const notificationListPreferencesOutputSchema = z.array(notificationKindPreferenceSchema);\r\n\r\nexport const notificationSetPreferenceInputSchema = z.object({\r\n kind: z.string().min(1),\r\n channel: notificationChannelSchema,\r\n enabled: z.boolean(),\r\n});\r\n\r\nexport const notificationSetPreferenceOutputSchema = notificationKindPreferenceSchema;\r\n"],"mappings":";;;;AAQA,MAAa,6BAA6BA,IAAAA,EAAE,KAAKC,wDAAAA,uBAAuB;AACxE,MAAa,6BAA6BD,IAAAA,EAAE,KAAKE,wDAAAA,uBAAuB;AACxE,MAAa,+BAA+BF,IAAAA,EAAE,KAAKG,wDAAAA,2BAA2B;;AAG9E,MAAa,6BAA6BH,IAAAA,EAAE,OAAO;CACjD,UAAUA,IAAAA,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EACvD,IAAIA,IAAAA,EAAE,QAAQ,EACf,CAAC;AAEF,MAAa,0CAA0CA,IAAAA,EAAE,OAAO;CAC9D,SAAS;CACT,SAASA,IAAAA,EAAE,SAAS;CACrB,CAAC;AAEF,MAAa,mCAAmCA,IAAAA,EAAE,OAAO;CACvD,MAAMA,IAAAA,EAAE,QAAQ;CAChB,UAAUA,IAAAA,EAAE,MAAM,wCAAwC;CAC3D,CAAC;AAEF,MAAa,0CAA0CA,IAAAA,EAAE,MAAM,iCAAiC;AAEhG,MAAa,uCAAuCA,IAAAA,EAAE,OAAO;CAC3D,MAAMA,IAAAA,EAAE,QAAQ,CAAC,IAAI,EAAE;CACvB,SAAS;CACT,SAASA,IAAAA,EAAE,SAAS;CACrB,CAAC;AAEF,MAAa,wCAAwC"}
@@ -86,16 +86,29 @@ declare const notificationListDevicesOutputSchema: z.ZodArray<z.ZodObject<{
86
86
  declare const notificationVapidPublicKeyOutputSchema: z.ZodObject<{
87
87
  publicKey: z.ZodString;
88
88
  }, z.core.$strip>;
89
+ declare const notificationChannelSchema: z.ZodEnum<{
90
+ email: "email";
91
+ "in-app": "in-app";
92
+ "web-push": "web-push";
93
+ "mobile-push": "mobile-push";
94
+ }>;
89
95
  declare const notificationSendLogSelectSchema: z.ZodObject<{
90
96
  id: z.ZodString;
91
97
  batchId: z.ZodString;
98
+ notificationId: z.ZodString;
92
99
  userId: z.ZodString;
93
- deviceId: z.ZodString;
94
- provider: z.ZodEnum<{
100
+ deviceId: z.ZodNullable<z.ZodString>;
101
+ channel: z.ZodEnum<{
102
+ email: "email";
103
+ "in-app": "in-app";
104
+ "web-push": "web-push";
105
+ "mobile-push": "mobile-push";
106
+ }>;
107
+ provider: z.ZodNullable<z.ZodEnum<{
95
108
  web: "web";
96
109
  apn: "apn";
97
110
  fcm: "fcm";
98
- }>;
111
+ }>>;
99
112
  title: z.ZodString;
100
113
  body: z.ZodString;
101
114
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -116,13 +129,20 @@ declare const notificationListSendLogsInputSchema: z.ZodObject<{
116
129
  declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
117
130
  id: z.ZodString;
118
131
  batchId: z.ZodString;
132
+ notificationId: z.ZodString;
119
133
  userId: z.ZodString;
120
- deviceId: z.ZodString;
121
- provider: z.ZodEnum<{
134
+ deviceId: z.ZodNullable<z.ZodString>;
135
+ channel: z.ZodEnum<{
136
+ email: "email";
137
+ "in-app": "in-app";
138
+ "web-push": "web-push";
139
+ "mobile-push": "mobile-push";
140
+ }>;
141
+ provider: z.ZodNullable<z.ZodEnum<{
122
142
  web: "web";
123
143
  apn: "apn";
124
144
  fcm: "fcm";
125
- }>;
145
+ }>>;
126
146
  title: z.ZodString;
127
147
  body: z.ZodString;
128
148
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -136,16 +156,106 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
136
156
  createdAt: z.ZodDate;
137
157
  updatedAt: z.ZodDate;
138
158
  }, z.core.$strip>>;
159
+ declare const notificationInstanceSelectSchema: z.ZodObject<{
160
+ id: z.ZodString;
161
+ memberId: z.ZodString;
162
+ userId: z.ZodString;
163
+ kind: z.ZodString;
164
+ title: z.ZodString;
165
+ body: z.ZodString;
166
+ data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
167
+ visibleInInbox: z.ZodBoolean;
168
+ webPushedAt: z.ZodNullable<z.ZodDate>;
169
+ mobilePushedAt: z.ZodNullable<z.ZodDate>;
170
+ emailedAt: z.ZodNullable<z.ZodDate>;
171
+ readAt: z.ZodNullable<z.ZodDate>;
172
+ createdAt: z.ZodDate;
173
+ updatedAt: z.ZodDate;
174
+ }, z.core.$strip>;
175
+ declare const notificationListInboxOutputSchema: z.ZodArray<z.ZodObject<{
176
+ id: z.ZodString;
177
+ memberId: z.ZodString;
178
+ userId: z.ZodString;
179
+ kind: z.ZodString;
180
+ title: z.ZodString;
181
+ body: z.ZodString;
182
+ data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
183
+ visibleInInbox: z.ZodBoolean;
184
+ webPushedAt: z.ZodNullable<z.ZodDate>;
185
+ mobilePushedAt: z.ZodNullable<z.ZodDate>;
186
+ emailedAt: z.ZodNullable<z.ZodDate>;
187
+ readAt: z.ZodNullable<z.ZodDate>;
188
+ createdAt: z.ZodDate;
189
+ updatedAt: z.ZodDate;
190
+ }, z.core.$strip>>;
191
+ declare const notificationMarkReadInputSchema: z.ZodObject<{
192
+ id: z.ZodString;
193
+ }, z.core.$strip>;
139
194
  declare const notificationSendTestInputSchema: z.ZodObject<{
140
- userId: z.ZodOptional<z.ZodString>;
195
+ memberId: z.ZodString;
196
+ kind: z.ZodString;
141
197
  title: z.ZodString;
142
198
  body: z.ZodString;
143
199
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
144
200
  }, z.core.$strip>;
145
201
  declare const notificationSendTestOutputSchema: z.ZodObject<{
146
- batchId: z.ZodString;
147
- jobId: z.ZodString;
202
+ id: z.ZodString;
203
+ }, z.core.$strip>;
204
+ declare const notificationKindPreferenceChannelSchema: z.ZodObject<{
205
+ channel: z.ZodEnum<{
206
+ email: "email";
207
+ "in-app": "in-app";
208
+ "web-push": "web-push";
209
+ "mobile-push": "mobile-push";
210
+ }>;
211
+ enabled: z.ZodBoolean;
212
+ }, z.core.$strip>;
213
+ declare const notificationKindPreferenceSchema: z.ZodObject<{
214
+ kind: z.ZodString;
215
+ channels: z.ZodArray<z.ZodObject<{
216
+ channel: z.ZodEnum<{
217
+ email: "email";
218
+ "in-app": "in-app";
219
+ "web-push": "web-push";
220
+ "mobile-push": "mobile-push";
221
+ }>;
222
+ enabled: z.ZodBoolean;
223
+ }, z.core.$strip>>;
224
+ }, z.core.$strip>;
225
+ declare const notificationListPreferencesOutputSchema: z.ZodArray<z.ZodObject<{
226
+ kind: z.ZodString;
227
+ channels: z.ZodArray<z.ZodObject<{
228
+ channel: z.ZodEnum<{
229
+ email: "email";
230
+ "in-app": "in-app";
231
+ "web-push": "web-push";
232
+ "mobile-push": "mobile-push";
233
+ }>;
234
+ enabled: z.ZodBoolean;
235
+ }, z.core.$strip>>;
236
+ }, z.core.$strip>>;
237
+ declare const notificationSetPreferenceInputSchema: z.ZodObject<{
238
+ kind: z.ZodString;
239
+ channel: z.ZodEnum<{
240
+ email: "email";
241
+ "in-app": "in-app";
242
+ "web-push": "web-push";
243
+ "mobile-push": "mobile-push";
244
+ }>;
245
+ enabled: z.ZodBoolean;
246
+ }, z.core.$strip>;
247
+ declare const notificationSetPreferenceOutputSchema: z.ZodObject<{
248
+ kind: z.ZodString;
249
+ channels: z.ZodArray<z.ZodObject<{
250
+ channel: z.ZodEnum<{
251
+ email: "email";
252
+ "in-app": "in-app";
253
+ "web-push": "web-push";
254
+ "mobile-push": "mobile-push";
255
+ }>;
256
+ enabled: z.ZodBoolean;
257
+ }, z.core.$strip>>;
148
258
  }, z.core.$strip>;
149
259
  //#endregion
150
- export { NotificationRegisterDeviceInput, notificationDeviceSelectSchema, notificationListDevicesOutputSchema, notificationListSendLogsInputSchema, notificationListSendLogsOutputSchema, notificationPlatformSchema, notificationProviderSchema, notificationRegisterDeviceInputSchema, notificationRegisterDeviceOutputSchema, notificationSendLogSelectSchema, notificationSendStatusSchema, notificationSendTestInputSchema, notificationSendTestOutputSchema, notificationUnregisterDeviceInputSchema, notificationUnregisterDeviceOutputSchema, notificationVapidPublicKeyOutputSchema, pushSubscriptionJsonSchema };
260
+ export { NotificationRegisterDeviceInput, notificationChannelSchema, notificationDeviceSelectSchema, notificationInstanceSelectSchema, notificationKindPreferenceChannelSchema, notificationKindPreferenceSchema, notificationListDevicesOutputSchema, notificationListInboxOutputSchema, notificationListPreferencesOutputSchema, notificationListSendLogsInputSchema, notificationListSendLogsOutputSchema, notificationMarkReadInputSchema, notificationPlatformSchema, notificationProviderSchema, notificationRegisterDeviceInputSchema, notificationRegisterDeviceOutputSchema, notificationSendLogSelectSchema, notificationSendStatusSchema, notificationSendTestInputSchema, notificationSendTestOutputSchema, notificationSetPreferenceInputSchema, notificationSetPreferenceOutputSchema, notificationUnregisterDeviceInputSchema, notificationUnregisterDeviceOutputSchema, notificationVapidPublicKeyOutputSchema, pushSubscriptionJsonSchema };
151
261
  //# sourceMappingURL=notification.schema.d.cts.map
@@ -86,16 +86,29 @@ declare const notificationListDevicesOutputSchema: z.ZodArray<z.ZodObject<{
86
86
  declare const notificationVapidPublicKeyOutputSchema: z.ZodObject<{
87
87
  publicKey: z.ZodString;
88
88
  }, z.core.$strip>;
89
+ declare const notificationChannelSchema: z.ZodEnum<{
90
+ email: "email";
91
+ "in-app": "in-app";
92
+ "web-push": "web-push";
93
+ "mobile-push": "mobile-push";
94
+ }>;
89
95
  declare const notificationSendLogSelectSchema: z.ZodObject<{
90
96
  id: z.ZodString;
91
97
  batchId: z.ZodString;
98
+ notificationId: z.ZodString;
92
99
  userId: z.ZodString;
93
- deviceId: z.ZodString;
94
- provider: z.ZodEnum<{
100
+ deviceId: z.ZodNullable<z.ZodString>;
101
+ channel: z.ZodEnum<{
102
+ email: "email";
103
+ "in-app": "in-app";
104
+ "web-push": "web-push";
105
+ "mobile-push": "mobile-push";
106
+ }>;
107
+ provider: z.ZodNullable<z.ZodEnum<{
95
108
  web: "web";
96
109
  apn: "apn";
97
110
  fcm: "fcm";
98
- }>;
111
+ }>>;
99
112
  title: z.ZodString;
100
113
  body: z.ZodString;
101
114
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -116,13 +129,20 @@ declare const notificationListSendLogsInputSchema: z.ZodObject<{
116
129
  declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
117
130
  id: z.ZodString;
118
131
  batchId: z.ZodString;
132
+ notificationId: z.ZodString;
119
133
  userId: z.ZodString;
120
- deviceId: z.ZodString;
121
- provider: z.ZodEnum<{
134
+ deviceId: z.ZodNullable<z.ZodString>;
135
+ channel: z.ZodEnum<{
136
+ email: "email";
137
+ "in-app": "in-app";
138
+ "web-push": "web-push";
139
+ "mobile-push": "mobile-push";
140
+ }>;
141
+ provider: z.ZodNullable<z.ZodEnum<{
122
142
  web: "web";
123
143
  apn: "apn";
124
144
  fcm: "fcm";
125
- }>;
145
+ }>>;
126
146
  title: z.ZodString;
127
147
  body: z.ZodString;
128
148
  data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -136,16 +156,106 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
136
156
  createdAt: z.ZodDate;
137
157
  updatedAt: z.ZodDate;
138
158
  }, z.core.$strip>>;
159
+ declare const notificationInstanceSelectSchema: z.ZodObject<{
160
+ id: z.ZodString;
161
+ memberId: z.ZodString;
162
+ userId: z.ZodString;
163
+ kind: z.ZodString;
164
+ title: z.ZodString;
165
+ body: z.ZodString;
166
+ data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
167
+ visibleInInbox: z.ZodBoolean;
168
+ webPushedAt: z.ZodNullable<z.ZodDate>;
169
+ mobilePushedAt: z.ZodNullable<z.ZodDate>;
170
+ emailedAt: z.ZodNullable<z.ZodDate>;
171
+ readAt: z.ZodNullable<z.ZodDate>;
172
+ createdAt: z.ZodDate;
173
+ updatedAt: z.ZodDate;
174
+ }, z.core.$strip>;
175
+ declare const notificationListInboxOutputSchema: z.ZodArray<z.ZodObject<{
176
+ id: z.ZodString;
177
+ memberId: z.ZodString;
178
+ userId: z.ZodString;
179
+ kind: z.ZodString;
180
+ title: z.ZodString;
181
+ body: z.ZodString;
182
+ data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
183
+ visibleInInbox: z.ZodBoolean;
184
+ webPushedAt: z.ZodNullable<z.ZodDate>;
185
+ mobilePushedAt: z.ZodNullable<z.ZodDate>;
186
+ emailedAt: z.ZodNullable<z.ZodDate>;
187
+ readAt: z.ZodNullable<z.ZodDate>;
188
+ createdAt: z.ZodDate;
189
+ updatedAt: z.ZodDate;
190
+ }, z.core.$strip>>;
191
+ declare const notificationMarkReadInputSchema: z.ZodObject<{
192
+ id: z.ZodString;
193
+ }, z.core.$strip>;
139
194
  declare const notificationSendTestInputSchema: z.ZodObject<{
140
- userId: z.ZodOptional<z.ZodString>;
195
+ memberId: z.ZodString;
196
+ kind: z.ZodString;
141
197
  title: z.ZodString;
142
198
  body: z.ZodString;
143
199
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
144
200
  }, z.core.$strip>;
145
201
  declare const notificationSendTestOutputSchema: z.ZodObject<{
146
- batchId: z.ZodString;
147
- jobId: z.ZodString;
202
+ id: z.ZodString;
203
+ }, z.core.$strip>;
204
+ declare const notificationKindPreferenceChannelSchema: z.ZodObject<{
205
+ channel: z.ZodEnum<{
206
+ email: "email";
207
+ "in-app": "in-app";
208
+ "web-push": "web-push";
209
+ "mobile-push": "mobile-push";
210
+ }>;
211
+ enabled: z.ZodBoolean;
212
+ }, z.core.$strip>;
213
+ declare const notificationKindPreferenceSchema: z.ZodObject<{
214
+ kind: z.ZodString;
215
+ channels: z.ZodArray<z.ZodObject<{
216
+ channel: z.ZodEnum<{
217
+ email: "email";
218
+ "in-app": "in-app";
219
+ "web-push": "web-push";
220
+ "mobile-push": "mobile-push";
221
+ }>;
222
+ enabled: z.ZodBoolean;
223
+ }, z.core.$strip>>;
224
+ }, z.core.$strip>;
225
+ declare const notificationListPreferencesOutputSchema: z.ZodArray<z.ZodObject<{
226
+ kind: z.ZodString;
227
+ channels: z.ZodArray<z.ZodObject<{
228
+ channel: z.ZodEnum<{
229
+ email: "email";
230
+ "in-app": "in-app";
231
+ "web-push": "web-push";
232
+ "mobile-push": "mobile-push";
233
+ }>;
234
+ enabled: z.ZodBoolean;
235
+ }, z.core.$strip>>;
236
+ }, z.core.$strip>>;
237
+ declare const notificationSetPreferenceInputSchema: z.ZodObject<{
238
+ kind: z.ZodString;
239
+ channel: z.ZodEnum<{
240
+ email: "email";
241
+ "in-app": "in-app";
242
+ "web-push": "web-push";
243
+ "mobile-push": "mobile-push";
244
+ }>;
245
+ enabled: z.ZodBoolean;
246
+ }, z.core.$strip>;
247
+ declare const notificationSetPreferenceOutputSchema: z.ZodObject<{
248
+ kind: z.ZodString;
249
+ channels: z.ZodArray<z.ZodObject<{
250
+ channel: z.ZodEnum<{
251
+ email: "email";
252
+ "in-app": "in-app";
253
+ "web-push": "web-push";
254
+ "mobile-push": "mobile-push";
255
+ }>;
256
+ enabled: z.ZodBoolean;
257
+ }, z.core.$strip>>;
148
258
  }, z.core.$strip>;
149
259
  //#endregion
150
- export { NotificationRegisterDeviceInput, notificationDeviceSelectSchema, notificationListDevicesOutputSchema, notificationListSendLogsInputSchema, notificationListSendLogsOutputSchema, notificationPlatformSchema, notificationProviderSchema, notificationRegisterDeviceInputSchema, notificationRegisterDeviceOutputSchema, notificationSendLogSelectSchema, notificationSendStatusSchema, notificationSendTestInputSchema, notificationSendTestOutputSchema, notificationUnregisterDeviceInputSchema, notificationUnregisterDeviceOutputSchema, notificationVapidPublicKeyOutputSchema, pushSubscriptionJsonSchema };
260
+ export { NotificationRegisterDeviceInput, notificationChannelSchema, notificationDeviceSelectSchema, notificationInstanceSelectSchema, notificationKindPreferenceChannelSchema, notificationKindPreferenceSchema, notificationListDevicesOutputSchema, notificationListInboxOutputSchema, notificationListPreferencesOutputSchema, notificationListSendLogsInputSchema, notificationListSendLogsOutputSchema, notificationMarkReadInputSchema, notificationPlatformSchema, notificationProviderSchema, notificationRegisterDeviceInputSchema, notificationRegisterDeviceOutputSchema, notificationSendLogSelectSchema, notificationSendStatusSchema, notificationSendTestInputSchema, notificationSendTestOutputSchema, notificationSetPreferenceInputSchema, notificationSetPreferenceOutputSchema, notificationUnregisterDeviceInputSchema, notificationUnregisterDeviceOutputSchema, notificationVapidPublicKeyOutputSchema, pushSubscriptionJsonSchema };
151
261
  //# sourceMappingURL=notification.schema.d.mts.map
@@ -1,4 +1,4 @@
1
- import { NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES } from "./notification.constants.mjs";
1
+ import { NOTIFICATION_CHANNELS, NOTIFICATION_PLATFORMS, NOTIFICATION_PROVIDERS, NOTIFICATION_SEND_STATUSES } from "./notification.constants.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/modules/notification/notification.schema.ts
4
4
  const notificationPlatformSchema = z.enum(NOTIFICATION_PLATFORMS);
@@ -45,12 +45,15 @@ const notificationDeviceSelectSchema = z.object({
45
45
  });
46
46
  const notificationListDevicesOutputSchema = z.array(notificationDeviceSelectSchema);
47
47
  const notificationVapidPublicKeyOutputSchema = z.object({ publicKey: z.string() });
48
+ const notificationChannelSchema = z.enum(NOTIFICATION_CHANNELS);
48
49
  const notificationSendLogSelectSchema = z.object({
49
50
  id: z.string(),
50
51
  batchId: z.string(),
52
+ notificationId: z.string(),
51
53
  userId: z.string(),
52
- deviceId: z.string(),
53
- provider: notificationProviderSchema,
54
+ deviceId: z.string().nullable(),
55
+ channel: notificationChannelSchema,
56
+ provider: notificationProviderSchema.nullable(),
54
57
  title: z.string(),
55
58
  body: z.string(),
56
59
  data: z.record(z.string(), z.unknown()).nullable(),
@@ -65,17 +68,48 @@ const notificationListSendLogsInputSchema = z.object({
65
68
  limit: z.number().int().min(1).max(100).optional()
66
69
  });
67
70
  const notificationListSendLogsOutputSchema = z.array(notificationSendLogSelectSchema);
71
+ const notificationInstanceSelectSchema = z.object({
72
+ id: z.string(),
73
+ memberId: z.string(),
74
+ userId: z.string(),
75
+ kind: z.string(),
76
+ title: z.string(),
77
+ body: z.string(),
78
+ data: z.record(z.string(), z.unknown()).nullable(),
79
+ visibleInInbox: z.boolean(),
80
+ webPushedAt: z.date().nullable(),
81
+ mobilePushedAt: z.date().nullable(),
82
+ emailedAt: z.date().nullable(),
83
+ readAt: z.date().nullable(),
84
+ createdAt: z.date(),
85
+ updatedAt: z.date()
86
+ });
87
+ const notificationListInboxOutputSchema = z.array(notificationInstanceSelectSchema);
88
+ const notificationMarkReadInputSchema = z.object({ id: z.string() });
68
89
  const notificationSendTestInputSchema = z.object({
69
- userId: z.string().optional(),
90
+ memberId: z.string().min(1),
91
+ kind: z.string().min(1),
70
92
  title: z.string().min(1).max(200),
71
93
  body: z.string().min(1).max(2e3),
72
94
  data: z.record(z.string(), z.unknown()).optional()
73
95
  });
74
- const notificationSendTestOutputSchema = z.object({
75
- batchId: z.string(),
76
- jobId: z.string()
96
+ const notificationSendTestOutputSchema = z.object({ id: z.string() });
97
+ const notificationKindPreferenceChannelSchema = z.object({
98
+ channel: notificationChannelSchema,
99
+ enabled: z.boolean()
100
+ });
101
+ const notificationKindPreferenceSchema = z.object({
102
+ kind: z.string(),
103
+ channels: z.array(notificationKindPreferenceChannelSchema)
104
+ });
105
+ const notificationListPreferencesOutputSchema = z.array(notificationKindPreferenceSchema);
106
+ const notificationSetPreferenceInputSchema = z.object({
107
+ kind: z.string().min(1),
108
+ channel: notificationChannelSchema,
109
+ enabled: z.boolean()
77
110
  });
111
+ const notificationSetPreferenceOutputSchema = notificationKindPreferenceSchema;
78
112
  //#endregion
79
- export { notificationDeviceSelectSchema, notificationListDevicesOutputSchema, notificationListSendLogsInputSchema, notificationListSendLogsOutputSchema, notificationPlatformSchema, notificationProviderSchema, notificationRegisterDeviceInputSchema, notificationRegisterDeviceOutputSchema, notificationSendLogSelectSchema, notificationSendStatusSchema, notificationSendTestInputSchema, notificationSendTestOutputSchema, notificationUnregisterDeviceInputSchema, notificationUnregisterDeviceOutputSchema, notificationVapidPublicKeyOutputSchema, pushSubscriptionJsonSchema };
113
+ export { notificationChannelSchema, notificationDeviceSelectSchema, notificationInstanceSelectSchema, notificationKindPreferenceChannelSchema, notificationKindPreferenceSchema, notificationListDevicesOutputSchema, notificationListInboxOutputSchema, notificationListPreferencesOutputSchema, notificationListSendLogsInputSchema, notificationListSendLogsOutputSchema, notificationMarkReadInputSchema, notificationPlatformSchema, notificationProviderSchema, notificationRegisterDeviceInputSchema, notificationRegisterDeviceOutputSchema, notificationSendLogSelectSchema, notificationSendStatusSchema, notificationSendTestInputSchema, notificationSendTestOutputSchema, notificationSetPreferenceInputSchema, notificationSetPreferenceOutputSchema, notificationUnregisterDeviceInputSchema, notificationUnregisterDeviceOutputSchema, notificationVapidPublicKeyOutputSchema, pushSubscriptionJsonSchema };
80
114
 
81
115
  //# sourceMappingURL=notification.schema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.schema.mjs","names":[],"sources":["../../../../src/modules/notification/notification.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport {\r\n NOTIFICATION_PLATFORMS,\r\n NOTIFICATION_PROVIDERS,\r\n NOTIFICATION_SEND_STATUSES,\r\n} from \"./notification.constants\";\r\n\r\nexport const notificationPlatformSchema = z.enum(NOTIFICATION_PLATFORMS);\r\nexport const notificationProviderSchema = z.enum(NOTIFICATION_PROVIDERS);\r\nexport const notificationSendStatusSchema = z.enum(NOTIFICATION_SEND_STATUSES);\r\n\r\n/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */\r\nexport const pushSubscriptionJsonSchema = z.object({\r\n endpoint: z.string().url(),\r\n expirationTime: z.number().nullable().optional(),\r\n keys: z.object({\r\n p256dh: z.string(),\r\n auth: z.string(),\r\n }),\r\n});\r\n\r\nexport const notificationRegisterDeviceInputSchema = z.discriminatedUnion(\"platform\", [\r\n z.object({\r\n platform: z.literal(\"web\"),\r\n subscription: pushSubscriptionJsonSchema,\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"ios\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"android\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n]);\r\n\r\nexport type NotificationRegisterDeviceInput = z.infer<typeof notificationRegisterDeviceInputSchema>;\r\n\r\nexport const notificationRegisterDeviceOutputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceInputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceOutputSchema = z.object({\r\n ok: z.literal(true),\r\n});\r\n\r\nexport const notificationDeviceSelectSchema = z.object({\r\n id: z.string(),\r\n userId: z.string(),\r\n platform: notificationPlatformSchema,\r\n endpoint: z.string().nullable(),\r\n label: z.string().nullable(),\r\n enabled: z.boolean(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListDevicesOutputSchema = z.array(notificationDeviceSelectSchema);\r\n\r\nexport const notificationVapidPublicKeyOutputSchema = z.object({\r\n publicKey: z.string(),\r\n});\r\n\r\nexport const notificationSendLogSelectSchema = z.object({\r\n id: z.string(),\r\n batchId: z.string(),\r\n userId: z.string(),\r\n deviceId: z.string(),\r\n provider: notificationProviderSchema,\r\n title: z.string(),\r\n body: z.string(),\r\n data: z.record(z.string(), z.unknown()).nullable(),\r\n status: notificationSendStatusSchema,\r\n error: z.string().nullable(),\r\n jobId: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListSendLogsInputSchema = z.object({\r\n batchId: z.string().optional(),\r\n limit: z.number().int().min(1).max(100).optional(),\r\n});\r\n\r\nexport const notificationListSendLogsOutputSchema = z.array(notificationSendLogSelectSchema);\r\n\r\nexport const notificationSendTestInputSchema = z.object({\r\n userId: z.string().optional(),\r\n title: z.string().min(1).max(200),\r\n body: z.string().min(1).max(2000),\r\n data: z.record(z.string(), z.unknown()).optional(),\r\n});\r\n\r\nexport const notificationSendTestOutputSchema = z.object({\r\n batchId: z.string(),\r\n jobId: z.string(),\r\n});\r\n"],"mappings":";;;AAOA,MAAa,6BAA6B,EAAE,KAAK,uBAAuB;AACxE,MAAa,6BAA6B,EAAE,KAAK,uBAAuB;AACxE,MAAa,+BAA+B,EAAE,KAAK,2BAA2B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AEF,MAAa,sCAAsC,EAAE,MAAM,+BAA+B;AAE1F,MAAa,yCAAyC,EAAE,OAAO,EAC7D,WAAW,EAAE,QAAQ,EACtB,CAAC;AAEF,MAAa,kCAAkC,EAAE,OAAO;CACtD,IAAI,EAAE,QAAQ;CACd,SAAS,EAAE,QAAQ;CACnB,QAAQ,EAAE,QAAQ;CAClB,UAAU,EAAE,QAAQ;CACpB,UAAU;CACV,OAAO,EAAE,QAAQ;CACjB,MAAM,EAAE,QAAQ;CAChB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,UAAU;CAClD,QAAQ;CACR,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,WAAW,EAAE,MAAM;CACnB,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAa,sCAAsC,EAAE,OAAO;CAC1D,SAAS,EAAE,QAAQ,CAAC,UAAU;CAC9B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU;CACnD,CAAC;AAEF,MAAa,uCAAuC,EAAE,MAAM,gCAAgC;AAE5F,MAAa,kCAAkC,EAAE,OAAO;CACtD,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;CACjC,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAK;CACjC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,UAAU;CACnD,CAAC;AAEF,MAAa,mCAAmC,EAAE,OAAO;CACvD,SAAS,EAAE,QAAQ;CACnB,OAAO,EAAE,QAAQ;CAClB,CAAC"}
1
+ {"version":3,"file":"notification.schema.mjs","names":[],"sources":["../../../../src/modules/notification/notification.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport {\r\n NOTIFICATION_CHANNELS,\r\n NOTIFICATION_PLATFORMS,\r\n NOTIFICATION_PROVIDERS,\r\n NOTIFICATION_SEND_STATUSES,\r\n} from \"./notification.constants\";\r\n\r\nexport const notificationPlatformSchema = z.enum(NOTIFICATION_PLATFORMS);\r\nexport const notificationProviderSchema = z.enum(NOTIFICATION_PROVIDERS);\r\nexport const notificationSendStatusSchema = z.enum(NOTIFICATION_SEND_STATUSES);\r\n\r\n/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */\r\nexport const pushSubscriptionJsonSchema = z.object({\r\n endpoint: z.string().url(),\r\n expirationTime: z.number().nullable().optional(),\r\n keys: z.object({\r\n p256dh: z.string(),\r\n auth: z.string(),\r\n }),\r\n});\r\n\r\nexport const notificationRegisterDeviceInputSchema = z.discriminatedUnion(\"platform\", [\r\n z.object({\r\n platform: z.literal(\"web\"),\r\n subscription: pushSubscriptionJsonSchema,\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"ios\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n z.object({\r\n platform: z.literal(\"android\"),\r\n token: z.string().min(1).max(4096),\r\n label: z.string().max(120).optional(),\r\n }),\r\n]);\r\n\r\nexport type NotificationRegisterDeviceInput = z.infer<typeof notificationRegisterDeviceInputSchema>;\r\n\r\nexport const notificationRegisterDeviceOutputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceInputSchema = z.object({\r\n deviceId: z.string(),\r\n});\r\n\r\nexport const notificationUnregisterDeviceOutputSchema = z.object({\r\n ok: z.literal(true),\r\n});\r\n\r\nexport const notificationDeviceSelectSchema = z.object({\r\n id: z.string(),\r\n userId: z.string(),\r\n platform: notificationPlatformSchema,\r\n endpoint: z.string().nullable(),\r\n label: z.string().nullable(),\r\n enabled: z.boolean(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListDevicesOutputSchema = z.array(notificationDeviceSelectSchema);\r\n\r\nexport const notificationVapidPublicKeyOutputSchema = z.object({\r\n publicKey: z.string(),\r\n});\r\n\r\nexport const notificationChannelSchema = z.enum(NOTIFICATION_CHANNELS);\r\n\r\nexport const notificationSendLogSelectSchema = z.object({\r\n id: z.string(),\r\n batchId: z.string(),\r\n notificationId: z.string(),\r\n userId: z.string(),\r\n deviceId: z.string().nullable(),\r\n channel: notificationChannelSchema,\r\n provider: notificationProviderSchema.nullable(),\r\n title: z.string(),\r\n body: z.string(),\r\n data: z.record(z.string(), z.unknown()).nullable(),\r\n status: notificationSendStatusSchema,\r\n error: z.string().nullable(),\r\n jobId: z.string().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListSendLogsInputSchema = z.object({\r\n batchId: z.string().optional(),\r\n limit: z.number().int().min(1).max(100).optional(),\r\n});\r\n\r\nexport const notificationListSendLogsOutputSchema = z.array(notificationSendLogSelectSchema);\r\n\r\nexport const notificationInstanceSelectSchema = z.object({\r\n id: z.string(),\r\n memberId: z.string(),\r\n userId: z.string(),\r\n kind: z.string(),\r\n title: z.string(),\r\n body: z.string(),\r\n data: z.record(z.string(), z.unknown()).nullable(),\r\n visibleInInbox: z.boolean(),\r\n webPushedAt: z.date().nullable(),\r\n mobilePushedAt: z.date().nullable(),\r\n emailedAt: z.date().nullable(),\r\n readAt: z.date().nullable(),\r\n createdAt: z.date(),\r\n updatedAt: z.date(),\r\n});\r\n\r\nexport const notificationListInboxOutputSchema = z.array(notificationInstanceSelectSchema);\r\n\r\nexport const notificationMarkReadInputSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport const notificationSendTestInputSchema = z.object({\r\n memberId: z.string().min(1),\r\n kind: z.string().min(1),\r\n title: z.string().min(1).max(200),\r\n body: z.string().min(1).max(2000),\r\n data: z.record(z.string(), z.unknown()).optional(),\r\n});\r\n\r\nexport const notificationSendTestOutputSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport const notificationKindPreferenceChannelSchema = z.object({\r\n channel: notificationChannelSchema,\r\n enabled: z.boolean(),\r\n});\r\n\r\nexport const notificationKindPreferenceSchema = z.object({\r\n kind: z.string(),\r\n channels: z.array(notificationKindPreferenceChannelSchema),\r\n});\r\n\r\nexport const notificationListPreferencesOutputSchema = z.array(notificationKindPreferenceSchema);\r\n\r\nexport const notificationSetPreferenceInputSchema = z.object({\r\n kind: z.string().min(1),\r\n channel: notificationChannelSchema,\r\n enabled: z.boolean(),\r\n});\r\n\r\nexport const notificationSetPreferenceOutputSchema = notificationKindPreferenceSchema;\r\n"],"mappings":";;;AAQA,MAAa,6BAA6B,EAAE,KAAK,uBAAuB;AACxE,MAAa,6BAA6B,EAAE,KAAK,uBAAuB;AACxE,MAAa,+BAA+B,EAAE,KAAK,2BAA2B;;AAG9E,MAAa,6BAA6B,EAAE,OAAO;CACjD,UAAU,EAAE,QAAQ,CAAC,KAAK;CAC1B,gBAAgB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CAChD,MAAM,EAAE,OAAO;EACb,QAAQ,EAAE,QAAQ;EAClB,MAAM,EAAE,QAAQ;EACjB,CAAC;CACH,CAAC;AAEF,MAAa,wCAAwC,EAAE,mBAAmB,YAAY;CACpF,EAAE,OAAO;EACP,UAAU,EAAE,QAAQ,MAAM;EAC1B,cAAc;EACd,OAAO,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU;EACtC,CAAC;CACF,EAAE,OAAO;EACP,UAAU,EAAE,QAAQ,MAAM;EAC1B,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK;EAClC,OAAO,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU;EACtC,CAAC;CACF,EAAE,OAAO;EACP,UAAU,EAAE,QAAQ,UAAU;EAC9B,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK;EAClC,OAAO,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,U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E,OAAO;CACvD,MAAM,EAAE,QAAQ;CAChB,UAAU,EAAE,MAAM,wCAAwC;CAC3D,CAAC;AAEF,MAAa,0CAA0C,EAAE,MAAM,iCAAiC;AAEhG,MAAa,uCAAuC,EAAE,OAAO;CAC3D,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE;CACvB,SAAS;CACT,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF,MAAa,wCAAwC"}
@@ -7,15 +7,15 @@ declare const filterSchema: z.ZodObject<{
7
7
  string: "string";
8
8
  number: "number";
9
9
  boolean: "boolean";
10
- date: "date";
11
10
  enum: "enum";
11
+ date: "date";
12
12
  jsonArray: "jsonArray";
13
13
  }>;
14
14
  method: z.ZodEnum<{
15
- contains: "contains";
16
- equals: "equals";
17
15
  starts_with: "starts_with";
18
16
  ends_with: "ends_with";
17
+ contains: "contains";
18
+ equals: "equals";
19
19
  greater_than: "greater_than";
20
20
  less_than: "less_than";
21
21
  on: "on";
@@ -39,15 +39,15 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
39
39
  string: "string";
40
40
  number: "number";
41
41
  boolean: "boolean";
42
- date: "date";
43
42
  enum: "enum";
43
+ date: "date";
44
44
  jsonArray: "jsonArray";
45
45
  }>;
46
46
  method: z.ZodEnum<{
47
- contains: "contains";
48
- equals: "equals";
49
47
  starts_with: "starts_with";
50
48
  ends_with: "ends_with";
49
+ contains: "contains";
50
+ equals: "equals";
51
51
  greater_than: "greater_than";
52
52
  less_than: "less_than";
53
53
  on: "on";
@@ -79,15 +79,15 @@ declare const querySchema: z.ZodObject<{
79
79
  string: "string";
80
80
  number: "number";
81
81
  boolean: "boolean";
82
- date: "date";
83
82
  enum: "enum";
83
+ date: "date";
84
84
  jsonArray: "jsonArray";
85
85
  }>;
86
86
  method: z.ZodEnum<{
87
- contains: "contains";
88
- equals: "equals";
89
87
  starts_with: "starts_with";
90
88
  ends_with: "ends_with";
89
+ contains: "contains";
90
+ equals: "equals";
91
91
  greater_than: "greater_than";
92
92
  less_than: "less_than";
93
93
  on: "on";
@@ -7,15 +7,15 @@ declare const filterSchema: z.ZodObject<{
7
7
  string: "string";
8
8
  number: "number";
9
9
  boolean: "boolean";
10
- date: "date";
11
10
  enum: "enum";
11
+ date: "date";
12
12
  jsonArray: "jsonArray";
13
13
  }>;
14
14
  method: z.ZodEnum<{
15
- contains: "contains";
16
- equals: "equals";
17
15
  starts_with: "starts_with";
18
16
  ends_with: "ends_with";
17
+ contains: "contains";
18
+ equals: "equals";
19
19
  greater_than: "greater_than";
20
20
  less_than: "less_than";
21
21
  on: "on";
@@ -39,15 +39,15 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
39
39
  string: "string";
40
40
  number: "number";
41
41
  boolean: "boolean";
42
- date: "date";
43
42
  enum: "enum";
43
+ date: "date";
44
44
  jsonArray: "jsonArray";
45
45
  }>;
46
46
  method: z.ZodEnum<{
47
- contains: "contains";
48
- equals: "equals";
49
47
  starts_with: "starts_with";
50
48
  ends_with: "ends_with";
49
+ contains: "contains";
50
+ equals: "equals";
51
51
  greater_than: "greater_than";
52
52
  less_than: "less_than";
53
53
  on: "on";
@@ -79,15 +79,15 @@ declare const querySchema: z.ZodObject<{
79
79
  string: "string";
80
80
  number: "number";
81
81
  boolean: "boolean";
82
- date: "date";
83
82
  enum: "enum";
83
+ date: "date";
84
84
  jsonArray: "jsonArray";
85
85
  }>;
86
86
  method: z.ZodEnum<{
87
- contains: "contains";
88
- equals: "equals";
89
87
  starts_with: "starts_with";
90
88
  ends_with: "ends_with";
89
+ contains: "contains";
90
+ equals: "equals";
91
91
  greater_than: "greater_than";
92
92
  less_than: "less_than";
93
93
  on: "on";
@@ -37,15 +37,15 @@ declare const tagListInputSchema: z.ZodObject<{
37
37
  string: "string";
38
38
  number: "number";
39
39
  boolean: "boolean";
40
- date: "date";
41
40
  enum: "enum";
41
+ date: "date";
42
42
  jsonArray: "jsonArray";
43
43
  }>;
44
44
  method: z.ZodEnum<{
45
- contains: "contains";
46
- equals: "equals";
47
45
  starts_with: "starts_with";
48
46
  ends_with: "ends_with";
47
+ contains: "contains";
48
+ equals: "equals";
49
49
  greater_than: "greater_than";
50
50
  less_than: "less_than";
51
51
  on: "on";
@@ -37,15 +37,15 @@ declare const tagListInputSchema: z.ZodObject<{
37
37
  string: "string";
38
38
  number: "number";
39
39
  boolean: "boolean";
40
- date: "date";
41
40
  enum: "enum";
41
+ date: "date";
42
42
  jsonArray: "jsonArray";
43
43
  }>;
44
44
  method: z.ZodEnum<{
45
- contains: "contains";
46
- equals: "equals";
47
45
  starts_with: "starts_with";
48
46
  ends_with: "ends_with";
47
+ contains: "contains";
48
+ equals: "equals";
49
49
  greater_than: "greater_than";
50
50
  less_than: "less_than";
51
51
  on: "on";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m5kdev/commons",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "license": "GPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "tsdown": "0.21.7",
22
22
  "typescript": "6.0.3",
23
23
  "zod": "4.2.1",
24
- "@m5kdev/config": "0.35.0"
24
+ "@m5kdev/config": "0.36.0"
25
25
  },
26
26
  "exports": {
27
27
  "./utils/*": {