@aura-stack/next 0.1.0 → 0.2.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.
- package/dist/client.cjs +1 -1
- package/dist/client.d.ts +3 -24
- package/dist/client.js +1 -1
- package/dist/context.cjs +1 -0
- package/dist/context.d.ts +24 -0
- package/dist/context.js +1 -0
- package/dist/{index-eKek4f4_.d.ts → index-CbFxTFu9.d.ts} +563 -148
- package/dist/index.d.ts +1618 -3
- package/dist/oauth/authentik.cjs +1 -0
- package/dist/oauth/authentik.d.ts +1 -0
- package/dist/oauth/authentik.js +1 -0
- package/dist/oauth/google.cjs +1 -0
- package/dist/oauth/google.d.ts +1 -0
- package/dist/oauth/google.js +1 -0
- package/dist/oauth/hubspot.cjs +1 -0
- package/dist/oauth/hubspot.d.ts +1 -0
- package/dist/oauth/hubspot.js +1 -0
- package/dist/oauth/huggingface.cjs +1 -0
- package/dist/oauth/huggingface.d.ts +1 -0
- package/dist/oauth/huggingface.js +1 -0
- package/dist/pages/client.cjs +1 -0
- package/dist/pages/client.d.ts +3 -0
- package/dist/pages/client.js +1 -0
- package/dist/pages/context.cjs +1 -0
- package/dist/pages/context.d.ts +23 -0
- package/dist/pages/context.js +1 -0
- package/dist/pages/index.cjs +1 -1
- package/dist/pages/index.d.ts +3 -22
- package/dist/pages/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require(`@aura-stack/react/oauth/authentik`);Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@aura-stack/react/oauth/authentik";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"@aura-stack/react/oauth/authentik";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require(`@aura-stack/react/oauth/google`);Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@aura-stack/react/oauth/google";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"@aura-stack/react/oauth/google";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require(`@aura-stack/react/oauth/hubspot`);Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@aura-stack/react/oauth/hubspot";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"@aura-stack/react/oauth/hubspot";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require(`@aura-stack/react/oauth/huggingface`);Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@aura-stack/react/oauth/huggingface";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"@aura-stack/react/oauth/huggingface";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context.cjs`);let t=require(`@aura-stack/react`);exports.AuthProvider=e.AuthProvider,Object.defineProperty(exports,`createAuthClient`,{enumerable:!0,get:function(){return t.createAuthClient}}),Object.defineProperty(exports,`useAuthActions`,{enumerable:!0,get:function(){return t.useAuthActions}}),Object.defineProperty(exports,`useSession`,{enumerable:!0,get:function(){return t.useSession}}),Object.defineProperty(exports,`useSignIn`,{enumerable:!0,get:function(){return t.useSignIn}}),Object.defineProperty(exports,`useSignInCredentials`,{enumerable:!0,get:function(){return t.useSignInCredentials}}),Object.defineProperty(exports,`useSignOut`,{enumerable:!0,get:function(){return t.useSignOut}}),Object.defineProperty(exports,`useUpdateSession`,{enumerable:!0,get:function(){return t.useUpdateSession}});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AuthProvider } from "./context.js";
|
|
2
|
+
import { AuthClientOptions, AuthProviderProps, createAuthClient, useAuthActions, useSession, useSignIn, useSignInCredentials, useSignOut, useUpdateSession } from "@aura-stack/react";
|
|
3
|
+
export { type AuthClientOptions, AuthProvider, type AuthProviderProps, createAuthClient, useAuthActions, useSession, useSignIn, useSignInCredentials, useSignOut, useUpdateSession };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{AuthProvider as e}from"./context.js";import{createAuthClient as t,useAuthActions as n,useSession as r,useSignIn as i,useSignInCredentials as a,useSignOut as o,useUpdateSession as s}from"@aura-stack/react";export{e as AuthProvider,t as createAuthClient,n as useAuthActions,r as useSession,i as useSignIn,a as useSignInCredentials,o as useSignOut,s as useUpdateSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@aura-stack/react/context`),t=require(`react/jsx-runtime`),n=require(`next/router.js`);const r=({client:r,children:i,initialSession:a,redirect:o})=>{let s=(0,n.useRouter)();return(0,t.jsx)(e.AuthProvider,{client:r,initialSession:a,redirect:o??(e=>s.push(e)),children:i})};exports.AuthProvider=r;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AuthProviderProps } from "@aura-stack/react/context";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/pages/context.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Wrapper component that provides authentication context for Next.js Pages Router applications.
|
|
7
|
+
* Falls back to `router.push` from `next/router` when no custom `redirect` prop is supplied.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const client = createAuthClient({ baseURL: "http://localhost:3000" })
|
|
11
|
+
*
|
|
12
|
+
* <AuthProvider client={client}>
|
|
13
|
+
* <App />
|
|
14
|
+
* </AuthProvider>
|
|
15
|
+
*/
|
|
16
|
+
declare const AuthProvider: ({
|
|
17
|
+
client,
|
|
18
|
+
children,
|
|
19
|
+
initialSession,
|
|
20
|
+
redirect
|
|
21
|
+
}: AuthProviderProps) => _$react_jsx_runtime0.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AuthProvider, type AuthProviderProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AuthProvider as e}from"@aura-stack/react/context";import{jsx as t}from"react/jsx-runtime";import{useRouter as n}from"next/router.js";const r=({client:r,children:i,initialSession:a,redirect:o})=>{let s=n();return t(e,{client:r,initialSession:a,redirect:o??(e=>s.push(e)),children:i})};export{r as AuthProvider};
|
package/dist/pages/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context.cjs`);let t=require(`@aura-stack/react/server`);const n=e=>`${e.headers[`x-forwarded-proto`]??`http`}://${e.headers[`x-forwarded-host`]??e.headers.host}`,r=(e,t)=>{for(let[n,r]of t.entries())n.toLowerCase()===`set-cookie`?e.setHeader(`Set-Cookie`,t.getSetCookie()):e.setHeader(n,r)},i=e=>async(t,i)=>{let a=t.method??`GET`,o=e[a];if(!o)return i.status(405).json({error:`Method ${a} Not Allowed`});let s=new URL(t.url,n(t)),c=new Request(s,{method:a,headers:new Headers(t.headers),body:a!==`GET`&&a!==`HEAD`?t.body:void 0});try{let e=await o(c);e.status>=300&&e.status<400&&!t.url?.includes(`/auth/signIn/`)&&!t.url?.includes(`/auth/callback/`)&&e.headers.delete(`Location`),r(i,e.headers);let n=await e.json();return i.status(e.status).json(n)}catch{return i.status(500).json({error:`Internal Server Error`})}},a=e=>{let n=(0,t.createAuth)(e);return{...n,toHandler:i(n.handlers)}};exports.AuthProvider=e.AuthProvider,exports.createAuth=a;
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { t as core_d_exports } from "../core-BDwHYePg.js";
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as UpdateSessionAPIOptions, a as GetSessionAPIReturn, b as EncodeJWTOptions, d as SignInCredentialsAPIOptions, f as SignInCredentialsAPIReturn, g as SignUpAPIReturn, h as SignUpAPIOptions, i as GetSessionAPIOptions, l as SignInAPIOptions, m as SignOutAPIReturn, n as BuiltInOAuthProvider, o as LiteralUnion, p as SignOutAPIOptions, r as FromShapeToObject, u as SignInAPIReturn, v as UpdateSessionAPIReturn, x as TypedJWTPayload, y as DecodeJWTOptions } from "../index-CbFxTFu9.js";
|
|
3
|
+
import { AuthProvider, AuthProviderProps } from "./context.js";
|
|
3
4
|
import { AuthConfig as AuthConfig$1 } from "@aura-stack/react";
|
|
4
|
-
import { AuthProviderProps } from "@aura-stack/react/context";
|
|
5
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
5
|
import { Identities } from "@aura-stack/react/identity";
|
|
7
6
|
import * as _$next from "next";
|
|
8
7
|
|
|
@@ -302,6 +301,7 @@ declare const createAuth: <Identity extends Identities>(config: AuthConfig$1<Ide
|
|
|
302
301
|
getSession: (options: GetSessionAPIOptions) => Promise<GetSessionAPIReturn<FromShapeToObject<Identity>>>;
|
|
303
302
|
signIn: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: SignInAPIOptions) => Promise<SignInAPIReturn>;
|
|
304
303
|
signInCredentials: (options: SignInCredentialsAPIOptions) => Promise<SignInCredentialsAPIReturn>;
|
|
304
|
+
signUp: <Payload extends Record<string, any> = {}>(options: SignUpAPIOptions<Payload>) => Promise<SignUpAPIReturn>;
|
|
305
305
|
updateSession: (options: UpdateSessionAPIOptions<FromShapeToObject<Identity>>) => Promise<UpdateSessionAPIReturn<FromShapeToObject<Identity>>>;
|
|
306
306
|
signOut: (options: SignOutAPIOptions) => Promise<SignOutAPIReturn>;
|
|
307
307
|
};
|
|
@@ -320,25 +320,6 @@ declare const createAuth: <Identity extends Identities>(config: AuthConfig$1<Ide
|
|
|
320
320
|
ALL: (request: Request) => Response | Promise<Response>;
|
|
321
321
|
};
|
|
322
322
|
};
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/pages/context.d.ts
|
|
325
|
-
/**
|
|
326
|
-
* Wrapper component that provides authentication context for Next.js Pages Router applications.
|
|
327
|
-
* Falls back to `router.push` from `next/router` when no custom `redirect` prop is supplied.
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
* const client = createAuthClient({ baseURL: "http://localhost:3000" })
|
|
331
|
-
*
|
|
332
|
-
* <AuthProvider client={client}>
|
|
333
|
-
* <App />
|
|
334
|
-
* </AuthProvider>
|
|
335
|
-
*/
|
|
336
|
-
declare const AuthProvider: ({
|
|
337
|
-
client,
|
|
338
|
-
children,
|
|
339
|
-
initialSession,
|
|
340
|
-
redirect
|
|
341
|
-
}: AuthProviderProps) => _$react_jsx_runtime0.JSX.Element;
|
|
342
323
|
type AuthConfig = core_d_exports.AuthConfig;
|
|
343
324
|
type AuthInstance = core_d_exports.AuthInstance;
|
|
344
325
|
type Session = core_d_exports.Session;
|
package/dist/pages/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AuthProvider as e}from"
|
|
1
|
+
import{AuthProvider as e}from"./context.js";import{createAuth as t}from"@aura-stack/react/server";const n=e=>`${e.headers[`x-forwarded-proto`]??`http`}://${e.headers[`x-forwarded-host`]??e.headers.host}`,r=(e,t)=>{for(let[n,r]of t.entries())n.toLowerCase()===`set-cookie`?e.setHeader(`Set-Cookie`,t.getSetCookie()):e.setHeader(n,r)},i=e=>async(t,i)=>{let a=t.method??`GET`,o=e[a];if(!o)return i.status(405).json({error:`Method ${a} Not Allowed`});let s=new URL(t.url,n(t)),c=new Request(s,{method:a,headers:new Headers(t.headers),body:a!==`GET`&&a!==`HEAD`?t.body:void 0});try{let e=await o(c);e.status>=300&&e.status<400&&!t.url?.includes(`/auth/signIn/`)&&!t.url?.includes(`/auth/callback/`)&&e.headers.delete(`Location`),r(i,e.headers);let n=await e.json();return i.status(e.status).json(n)}catch{return i.status(500).json({error:`Internal Server Error`})}},a=e=>{let n=t(e);return{...n,toHandler:i(n.handlers)}};export{e as AuthProvider,a as createAuth};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aura-stack/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Authentication integration for Next.js applications. Supports App Router, Server Components, Route Handlers and client-side authentication powered by Aura Auth.",
|
|
@@ -106,14 +106,14 @@
|
|
|
106
106
|
},
|
|
107
107
|
"license": "MIT",
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"@aura-stack/react": "0.
|
|
109
|
+
"@aura-stack/react": "0.2.0"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@testing-library/dom": "^10.4.1",
|
|
113
113
|
"@testing-library/react": "^16.3.2",
|
|
114
114
|
"@types/react": "^19.2.7",
|
|
115
115
|
"@types/react-dom": "^19.2.3",
|
|
116
|
-
"next": "^16.
|
|
116
|
+
"next": "^16.2.6",
|
|
117
117
|
"node-mocks-http": "^1.17.2",
|
|
118
118
|
"react": "^19.2.3",
|
|
119
119
|
"react-dom": "^19.2.3",
|