@monocloud/auth-nextjs 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -222,11 +222,28 @@ const isMonoCloudResponse = (res) => res instanceof MonoCloudAppRouterResponse |
222
222
  const isAppRouter = (req) => req instanceof Request || req.headers instanceof Headers || typeof req.bodyUsed === "boolean";
223
223
  const getNextRequest = (req) => {
224
224
  if (req instanceof next_server_js.NextRequest) return req;
225
- return new next_server_js.NextRequest(req);
225
+ return new next_server_js.NextRequest(req.url, {
226
+ method: req.method,
227
+ headers: req.headers,
228
+ body: req.body,
229
+ duplex: req.duplex ?? "half"
230
+ });
226
231
  };
227
232
  const getNextResponse = (res) => {
228
233
  if (res instanceof next_server_js.NextResponse) return res;
229
- if (res instanceof Response) return new next_server_js.NextResponse(res.body, res);
234
+ if (res instanceof Response) {
235
+ const nextResponse = new next_server_js.NextResponse(res.body, {
236
+ status: res.status,
237
+ statusText: res.statusText,
238
+ headers: res.headers,
239
+ url: res.url
240
+ });
241
+ try {
242
+ /* v8 ignore else -- @preserve */
243
+ if (!(0, _monocloud_auth_node_core_internal.isPresent)(nextResponse.url)) nextResponse.url = res.url;
244
+ } catch {}
245
+ return nextResponse;
246
+ }
230
247
  return new next_server_js.NextResponse();
231
248
  };
232
249
  const getMonoCloudCookieReqRes = (req, resOrCtx) => {
@@ -442,7 +459,7 @@ var MonoCloudNextClient = class {
442
459
  constructor(options) {
443
460
  const opt = {
444
461
  ...options ?? {},
445
- userAgent: (options === null || options === void 0 ? void 0 : options.userAgent) ?? `@monocloud/auth-nextjs@0.1.3`,
462
+ userAgent: (options === null || options === void 0 ? void 0 : options.userAgent) ?? `@monocloud/auth-nextjs@0.1.4`,
446
463
  debugger: (options === null || options === void 0 ? void 0 : options.debugger) ?? "@monocloud:auth-nextjs"
447
464
  };
448
465
  this.registerPublicEnvVariables();