@carlonicora/nextjs-jsonapi 1.9.0 → 1.10.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.
@@ -1,7 +1,7 @@
1
1
  // Server-only cookie utilities (consumers should provide their own server actions via configureAuth)
2
2
 
3
3
  import { cookies } from "next/headers";
4
- import zlib from "zlib";
4
+ import pako from "pako";
5
5
 
6
6
  export async function updateToken(params: {
7
7
  token?: string;
@@ -93,7 +93,7 @@ export async function updateToken(params: {
93
93
  });
94
94
 
95
95
  if (params.modules) {
96
- const compressedValue = zlib.gzipSync(JSON.stringify(params.modules)).toString("base64");
96
+ const compressedValue = Buffer.from(pako.gzip(JSON.stringify(params.modules))).toString("base64");
97
97
 
98
98
  (await cookies()).set({
99
99
  name: "modules",
@@ -1,6 +1,6 @@
1
1
  import { cookies } from "next/headers";
2
2
  import { redirect } from "next/navigation";
3
- import zlib from "zlib";
3
+ import pako from "pako";
4
4
  import { Action, checkPermissionsFromServer, ModuleWithPermissions } from "../permissions";
5
5
 
6
6
  export class ServerSession {
@@ -78,7 +78,7 @@ export class ServerSession {
78
78
  update: boolean | string;
79
79
  delete: boolean | string;
80
80
  };
81
- }[] = JSON.parse(zlib.gunzipSync(Buffer.from(rawModules, "base64")).toString());
81
+ }[] = JSON.parse(pako.ungzip(Buffer.from(rawModules, "base64"), { to: "string" }));
82
82
 
83
83
  const selectedModule = modules.find((module) => module.id === params.module.moduleId);
84
84