@monocloud/auth-nextjs 0.1.2 → 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/README.md CHANGED
@@ -10,8 +10,10 @@ This SDK is designed specifically for **Next.js**, providing first-class integra
10
10
 
11
11
  ## 📘 Documentation
12
12
 
13
+ - **Documentation:** [https://www.monocloud.com/docs](https://www.monocloud.com/docs?utm_source=github&utm_medium=auth_js)
13
14
  - **Quickstart:** [https://www.monocloud.com/docs/quickstarts/nextjs-app-router](https://www.monocloud.com/docs/quickstarts/nextjs-app-router?utm_source=github&utm_medium=auth_js)
14
15
  - **SDK Reference:** [https://www.monocloud.com/docs/sdk-reference/nextjs](https://www.monocloud.com/docs/sdk-reference/nextjs/index?utm_source=github&utm_medium=auth_js)
16
+ - **API Reference:** [https://monocloud.github.io/auth-js](https://monocloud.github.io/auth-js?utm_source=github&utm_medium=auth_js)
15
17
 
16
18
  ## Supported Platforms
17
19
 
@@ -124,6 +126,7 @@ export default function Page() {
124
126
  );
125
127
  }
126
128
  ```
129
+
127
130
  ## When should I use `auth-nextjs`?
128
131
 
129
132
  Use **`@monocloud/auth-nextjs`** if you are building a **Next.js application** and want a secure authentication solution with minimal configuration.
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.2`,
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();