@carlonicora/nextjs-jsonapi 6.32.0 → 6.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/{BlockNoteEditor-HQTBH527.mjs → BlockNoteEditor-KRNC6EAX.mjs} +4 -4
  2. package/dist/{BlockNoteEditor-YONN45A3.js → BlockNoteEditor-VXSVY6OY.js} +24 -24
  3. package/dist/{BlockNoteEditor-YONN45A3.js.map → BlockNoteEditor-VXSVY6OY.js.map} +1 -1
  4. package/dist/{BlockNoteViewer-BNZEXGVT.mjs → BlockNoteViewer-NVSR67X5.mjs} +2 -2
  5. package/dist/{BlockNoteViewer-YONLBNXW.js → BlockNoteViewer-RQBYHBQL.js} +3 -3
  6. package/dist/{BlockNoteViewer-YONLBNXW.js.map → BlockNoteViewer-RQBYHBQL.js.map} +1 -1
  7. package/dist/billing/index.js +465 -465
  8. package/dist/billing/index.mjs +3 -3
  9. package/dist/{chunk-HNK2O6YE.mjs → chunk-4JVLLBRS.mjs} +4 -16
  10. package/dist/chunk-4JVLLBRS.mjs.map +1 -0
  11. package/dist/{chunk-6DNGLY5Y.mjs → chunk-4SXHRANW.mjs} +55 -42
  12. package/dist/chunk-4SXHRANW.mjs.map +1 -0
  13. package/dist/{chunk-NQL2NDKH.js → chunk-5H25LM2Z.js} +10 -10
  14. package/dist/chunk-5H25LM2Z.js.map +1 -0
  15. package/dist/{chunk-FDKAVSZ6.mjs → chunk-AEBZ67JJ.mjs} +8 -8
  16. package/dist/chunk-AEBZ67JJ.mjs.map +1 -0
  17. package/dist/{chunk-JL6XL5NK.mjs → chunk-AMQFKCAX.mjs} +2 -2
  18. package/dist/{chunk-J37GJKCB.js → chunk-GPVLFNLB.js} +1242 -1229
  19. package/dist/chunk-GPVLFNLB.js.map +1 -0
  20. package/dist/{chunk-5XP5G45B.js → chunk-NPGX2GJD.js} +4 -16
  21. package/dist/chunk-NPGX2GJD.js.map +1 -0
  22. package/dist/{chunk-Q5SMFSE4.js → chunk-PNCO3HMJ.js} +3 -3
  23. package/dist/{chunk-Q5SMFSE4.js.map → chunk-PNCO3HMJ.js.map} +1 -1
  24. package/dist/client/index.js +4 -4
  25. package/dist/client/index.mjs +3 -3
  26. package/dist/components/index.js +4 -4
  27. package/dist/components/index.mjs +3 -3
  28. package/dist/contexts/index.js +4 -4
  29. package/dist/contexts/index.mjs +3 -3
  30. package/dist/core/index.js +2 -2
  31. package/dist/core/index.mjs +1 -1
  32. package/dist/email-automations/index.js +105 -105
  33. package/dist/email-automations/index.mjs +3 -3
  34. package/dist/features/analytics/index.js +114 -114
  35. package/dist/features/analytics/index.mjs +3 -3
  36. package/dist/features/analytics/server.js +4 -4
  37. package/dist/features/analytics/server.mjs +2 -2
  38. package/dist/features/auth/components/forms/RefreshUser.d.ts.map +1 -1
  39. package/dist/features/auth/config.d.ts +0 -9
  40. package/dist/features/auth/config.d.ts.map +1 -1
  41. package/dist/features/auth/data/auth.service.d.ts.map +1 -1
  42. package/dist/features/auth/data/two-factor.service.d.ts.map +1 -1
  43. package/dist/features/auth/utils/AuthCookies.d.ts +0 -9
  44. package/dist/features/auth/utils/AuthCookies.d.ts.map +1 -1
  45. package/dist/features/blog/index.js +129 -129
  46. package/dist/features/blog/index.mjs +3 -3
  47. package/dist/features/blog/server.js +7 -7
  48. package/dist/features/blog/server.mjs +1 -1
  49. package/dist/features/help/index.js +37 -37
  50. package/dist/features/help/index.mjs +3 -3
  51. package/dist/features/tokenusage/index.js +114 -114
  52. package/dist/features/tokenusage/index.mjs +3 -3
  53. package/dist/features/user/contexts/CurrentUserContext.d.ts.map +1 -1
  54. package/dist/index.js +3 -3
  55. package/dist/index.mjs +2 -2
  56. package/dist/server/ServerSession.d.ts.map +1 -1
  57. package/dist/server/index.js +3 -3
  58. package/dist/server/index.mjs +2 -2
  59. package/dist/shadcnui/ui/calendar.d.ts +1 -1
  60. package/dist/shadcnui/ui/calendar.d.ts.map +1 -1
  61. package/messages/en.json +11 -0
  62. package/messages/it.json +11 -0
  63. package/package.json +1 -1
  64. package/src/features/auth/components/forms/RefreshUser.tsx +0 -3
  65. package/src/features/auth/config.ts +0 -9
  66. package/src/features/auth/data/auth.service.ts +0 -8
  67. package/src/features/auth/data/two-factor.service.ts +0 -4
  68. package/src/features/auth/utils/AuthCookies.ts +1 -23
  69. package/src/features/user/contexts/CurrentUserContext.tsx +0 -4
  70. package/src/features/user/contexts/__tests__/CurrentUserContext.spec.tsx +2 -0
  71. package/src/server/ServerSession.ts +10 -26
  72. package/src/server/__tests__/ServerSession.hasPermissionToModule.spec.ts +78 -0
  73. package/src/shadcnui/ui/__tests__/calendar.spec.tsx +222 -0
  74. package/src/shadcnui/ui/calendar.tsx +28 -1
  75. package/dist/chunk-5XP5G45B.js.map +0 -1
  76. package/dist/chunk-6DNGLY5Y.mjs.map +0 -1
  77. package/dist/chunk-FDKAVSZ6.mjs.map +0 -1
  78. package/dist/chunk-HNK2O6YE.mjs.map +0 -1
  79. package/dist/chunk-J37GJKCB.js.map +0 -1
  80. package/dist/chunk-NQL2NDKH.js.map +0 -1
  81. /package/dist/{BlockNoteEditor-HQTBH527.mjs.map → BlockNoteEditor-KRNC6EAX.mjs.map} +0 -0
  82. /package/dist/{BlockNoteViewer-BNZEXGVT.mjs.map → BlockNoteViewer-NVSR67X5.mjs.map} +0 -0
  83. /package/dist/{chunk-JL6XL5NK.mjs.map → chunk-AMQFKCAX.mjs.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/server/cache.ts","../src/server/ServerSession.ts","../src/offline/server/build-offline-manifest.ts"],"sourcesContent":["// Server-only utilities (NOT server actions - these cannot be called from client components)\n\nimport { revalidateTag, updateTag } from \"next/cache\";\n\nimport type { CacheProfile } from \"./cacheProfiles\";\n\nexport { CACHE_PROFILES, type CacheProfile } from \"./cacheProfiles\";\n\n/**\n * Revalidate a cache tag to invalidate cached data.\n * Next.js 16+ requires a profile parameter.\n *\n * With `\"max\"` the tagged entries are marked stale and served stale-while-revalidate\n * (a one-year window): the next request still gets the old data while fresh data loads\n * in the background. It is not an immediate invalidation. A Server Action that must\n * read its own write uses `updateCacheTag` instead.\n *\n * @param tag - The cache tag to invalidate\n * @param profile - The cache profile whose `expire` bounds how long stale data may be served (defaults to \"max\")\n */\nexport async function invalidateCacheTag(tag: string, profile: CacheProfile = \"max\"): Promise<void> {\n revalidateTag(tag, profile);\n}\n\n/**\n * Revalidate multiple cache tags.\n *\n * @param tags - Array of cache tags to invalidate\n * @param profile - The cache profile, see `invalidateCacheTag` (defaults to \"max\", stale-while-revalidate)\n */\nexport async function invalidateCacheTags(tags: string[], profile: CacheProfile = \"max\"): Promise<void> {\n for (const tag of tags) {\n revalidateTag(tag, profile);\n }\n}\n\n/**\n * Expire a cache tag immediately, so the same request reads fresh data (read-your-own-writes).\n * Wraps `updateTag`, which works in Server Actions only. Route Handlers use `invalidateCacheTag`.\n *\n * @param tag - The cache tag to expire\n */\nexport async function updateCacheTag(tag: string): Promise<void> {\n updateTag(tag);\n}\n","import { cookies, headers } from \"next/headers\";\nimport { redirect } from \"next/navigation\";\nimport { userAgent } from \"next/server\";\nimport { ungzip } from \"pako\";\nimport { Action, checkPermissionsFromServer, ModuleWithPermissions } from \"../permissions\";\nimport { getRoleId } from \"../roles/config\";\nimport { VIEWPORT_COOKIE_NAME } from \"../utils/use-mobile\";\n\nexport interface SessionSnapshot {\n isLogged: boolean;\n isAdministrator: boolean;\n token?: string;\n sidebarOpen: boolean;\n isMobile: boolean;\n /** The request's raw `Accept-Language` header; the date locale is resolved from it on the client. */\n acceptLanguage?: string;\n}\n\nexport class ServerSession {\n static async read(): Promise<SessionSnapshot> {\n const cookieStore = await cookies();\n const headerStore = await headers();\n\n const token = cookieStore.get(\"token\")?.value || undefined;\n const roles = cookieStore.get(\"roles\")?.value;\n const viewportCookie = cookieStore.get(VIEWPORT_COOKIE_NAME)?.value;\n\n return {\n isLogged: !!token,\n isAdministrator: !!roles && roles.includes(getRoleId().Administrator),\n token,\n sidebarOpen: cookieStore.get(\"sidebar_state\")?.value !== \"false\",\n isMobile: viewportCookie ? viewportCookie === \"1\" : userAgent({ headers: headerStore }).device.type === \"mobile\",\n acceptLanguage: headerStore.get(\"accept-language\") ?? undefined,\n };\n }\n\n static async isLogged() {\n const cookieStore = await cookies();\n const token = cookieStore.get(\"token\");\n\n if (!token || !token.value) return false;\n return true;\n }\n\n static async companyId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"companyId\")?.value ?? \"\";\n }\n\n static async userId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"userId\")?.value ?? \"\";\n }\n\n static async checkPermission<M extends ModuleWithPermissions>(params: { module: M; action: Action; data?: any }) {\n if (!(await this.hasPermissionToModule(params))) redirect(`/401`);\n }\n\n static async hasRole(roleId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const roles = cookieStore.get(\"roles\")?.value;\n\n if (!roles || !roles.includes(roleId)) return false;\n\n return true;\n }\n\n static async hasFeature(featureId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const features = cookieStore.get(\"features\")?.value;\n\n if (!features || !features.includes(featureId)) return false;\n\n return true;\n }\n\n static async hasPermissionToModule<M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }): Promise<boolean> {\n const cookieStore = await cookies();\n\n if (params.module.feature) {\n const features = cookieStore.get(\"features\")?.value;\n\n if (features && !features.includes(params.module.feature)) return false;\n }\n\n const rawModules = cookieStore.get(\"modules\")?.value;\n if (!rawModules) return false;\n\n const modules: {\n id: string;\n permissions: {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n };\n }[] = JSON.parse(ungzip(Buffer.from(rawModules, \"base64\"), { toText: true }));\n\n const selectedModule = modules.find((module) => module.id === params.module.moduleId);\n\n return checkPermissionsFromServer({\n module: params.module,\n action: params.action,\n data: params.data,\n userId: await this.userId(),\n selectedModule: selectedModule,\n });\n\n // if (!selectedModule) return false;\n\n // if (!selectedModule.permissions[params.action]) return false;\n // if (typeof selectedModule.permissions[params.action] === \"boolean\")\n // return selectedModule.permissions[params.action] as boolean;\n\n // if (!params.data) return false;\n\n // return params.data[selectedModule.permissions[params.action] as string] === this.userId;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport type OfflineManifest = { buildId: string; assets: string[] };\n\nasync function listFiles(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) files.push(...(await listFiles(full)));\n else if (entry.isFile()) files.push(full);\n }\n return files;\n}\n\n/**\n * Describes the running build for the service worker's offline shell precache\n * (`/offline-manifest.json`): the build id from `<distDir>/BUILD_ID` and every\n * file under `<distDir>/static`, as the `/_next/static/...` URL Next serves it at.\n * `next dev` writes no BUILD_ID (its folder is `.next/dev`): the id is then `dev-` plus a hash\n * of the asset list. Dev chunk names do NOT carry content hashes (an edit rewrites a chunk under\n * the same name), so the id changes only when files appear or disappear; the service worker\n * therefore serves `/_next/static/` network first for a `dev-` build (pwa/sw.js).\n * `distDir` must be the value the app's next.config uses. `extraAssets` are further same-origin\n * URLs the shell needs with no network (the SQLite files the device worker loads).\n */\nexport async function buildOfflineManifest(params: {\n distDir: string;\n extraAssets?: string[];\n}): Promise<OfflineManifest> {\n const staticDir = path.join(params.distDir, \"static\");\n const files = await listFiles(staticDir);\n const assets = files\n .map((file) => `/_next/static/${path.relative(staticDir, file).split(path.sep).join(\"/\")}`)\n .concat(params.extraAssets ?? [])\n .sort();\n const buildId = await readBuildId(params.distDir, assets);\n return { buildId, assets };\n}\n\nasync function readBuildId(distDir: string, assets: string[]): Promise<string> {\n try {\n return (await readFile(path.join(distDir, \"BUILD_ID\"), \"utf8\")).trim();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n return `dev-${createHash(\"sha256\").update(assets.join(\"\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