@nauth-toolkit/client-angular 0.1.55 → 0.1.57

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 (66) hide show
  1. package/esm2022/lib/auth.guard.mjs +83 -0
  2. package/esm2022/lib/auth.interceptor.mjs +158 -0
  3. package/esm2022/lib/social-redirect-callback.guard.mjs +81 -0
  4. package/esm2022/nauth-toolkit-client-angular.mjs +5 -0
  5. package/esm2022/ngmodule/auth.interceptor.class.mjs +109 -0
  6. package/esm2022/ngmodule/auth.service.mjs +777 -0
  7. package/esm2022/ngmodule/http-adapter.mjs +81 -0
  8. package/esm2022/ngmodule/nauth.module.mjs +65 -0
  9. package/esm2022/ngmodule/tokens.mjs +6 -0
  10. package/esm2022/public-api.mjs +19 -0
  11. package/esm2022/src/standalone/nauth-toolkit-client-angular-src-standalone.mjs +5 -0
  12. package/esm2022/src/standalone/public-api.mjs +12 -0
  13. package/esm2022/standalone/auth.guard.mjs +83 -0
  14. package/esm2022/standalone/auth.interceptor.mjs +158 -0
  15. package/esm2022/standalone/auth.service.mjs +777 -0
  16. package/esm2022/standalone/http-adapter.mjs +81 -0
  17. package/esm2022/standalone/nauth-toolkit-client-angular-standalone.mjs +5 -0
  18. package/esm2022/standalone/public-api.mjs +16 -0
  19. package/esm2022/standalone/social-redirect-callback.guard.mjs +81 -0
  20. package/esm2022/standalone/tokens.mjs +6 -0
  21. package/fesm2022/nauth-toolkit-client-angular-src-standalone.mjs +17 -0
  22. package/fesm2022/nauth-toolkit-client-angular-src-standalone.mjs.map +1 -0
  23. package/fesm2022/nauth-toolkit-client-angular-standalone.mjs +1183 -0
  24. package/fesm2022/nauth-toolkit-client-angular-standalone.mjs.map +1 -0
  25. package/fesm2022/nauth-toolkit-client-angular.mjs +1344 -0
  26. package/fesm2022/nauth-toolkit-client-angular.mjs.map +1 -0
  27. package/index.d.ts +5 -0
  28. package/{src/lib/auth.guard.ts → lib/auth.guard.d.ts} +15 -37
  29. package/lib/auth.interceptor.d.ts +15 -0
  30. package/lib/social-redirect-callback.guard.d.ts +25 -0
  31. package/ngmodule/auth.interceptor.class.d.ts +34 -0
  32. package/ngmodule/auth.service.d.ts +580 -0
  33. package/ngmodule/http-adapter.d.ts +37 -0
  34. package/ngmodule/nauth.module.d.ts +31 -0
  35. package/{src/ngmodule/tokens.ts → ngmodule/tokens.d.ts} +1 -2
  36. package/package.json +30 -20
  37. package/{src/public-api.ts → public-api.d.ts} +0 -6
  38. package/src/standalone/index.d.ts +5 -0
  39. package/src/standalone/{public-api.ts → public-api.d.ts} +0 -2
  40. package/standalone/{auth.guard.ts → auth.guard.d.ts} +15 -37
  41. package/standalone/auth.interceptor.d.ts +15 -0
  42. package/standalone/auth.service.d.ts +580 -0
  43. package/standalone/http-adapter.d.ts +37 -0
  44. package/standalone/index.d.ts +5 -0
  45. package/standalone/{public-api.ts → public-api.d.ts} +1 -6
  46. package/standalone/social-redirect-callback.guard.d.ts +25 -0
  47. package/standalone/{tokens.ts → tokens.d.ts} +1 -2
  48. package/ng-package.json +0 -12
  49. package/src/lib/auth.interceptor.ts +0 -194
  50. package/src/lib/social-redirect-callback.guard.ts +0 -87
  51. package/src/ngmodule/auth.interceptor.class.ts +0 -124
  52. package/src/ngmodule/auth.service.ts +0 -865
  53. package/src/ngmodule/http-adapter.ts +0 -79
  54. package/src/ngmodule/nauth.module.ts +0 -59
  55. package/src/package.json +0 -11
  56. package/src/standalone/ng-package.json +0 -7
  57. package/src/standalone/package.json +0 -8
  58. package/standalone/auth.interceptor.ts +0 -194
  59. package/standalone/auth.service.ts +0 -865
  60. package/standalone/http-adapter.ts +0 -79
  61. package/standalone/ng-package.json +0 -7
  62. package/standalone/package.json +0 -8
  63. package/standalone/social-redirect-callback.guard.ts +0 -87
  64. package/tsconfig.json +0 -10
  65. package/tsconfig.lib.json +0 -28
  66. package/tsconfig.lib.prod.json +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nauth-toolkit/client-angular",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
4
4
  "description": "Angular adapter for nauth-toolkit client SDK",
5
5
  "keywords": [
6
6
  "nauth",
@@ -24,29 +24,39 @@
24
24
  "peerDependencies": {
25
25
  "@angular/common": ">=17.0.0",
26
26
  "@angular/core": ">=17.0.0",
27
- "@nauth-toolkit/client": "^0.1.55",
27
+ "@nauth-toolkit/client": "^0.1.57",
28
28
  "rxjs": "^7.0.0 || ^8.0.0"
29
29
  },
30
30
  "dependencies": {
31
31
  "tslib": "^2.3.0"
32
32
  },
33
- "devDependencies": {
34
- "@angular/common": "^17.3.12",
35
- "@angular/compiler": "^17.3.12",
36
- "@angular/compiler-cli": "^17.3.12",
37
- "@angular/core": "^17.3.12",
38
- "@angular/platform-browser": "^17.3.12",
39
- "@angular/platform-browser-dynamic": "^17.3.12",
40
- "@angular/router": "^17.3.12",
41
- "ng-packagr": "^17.0.0",
42
- "rxjs": "~7.8.0",
43
- "typescript": "~5.3.3"
44
- },
45
- "scripts": {
46
- "build": "ng-packagr -p ng-package.json",
47
- "clean": "rm -rf dist"
48
- },
49
33
  "engines": {
50
34
  "node": ">=22.0.0"
51
- }
52
- }
35
+ },
36
+ "module": "fesm2022/nauth-toolkit-client-angular.mjs",
37
+ "typings": "index.d.ts",
38
+ "exports": {
39
+ "./package.json": {
40
+ "default": "./package.json"
41
+ },
42
+ ".": {
43
+ "types": "./index.d.ts",
44
+ "esm2022": "./esm2022/nauth-toolkit-client-angular.mjs",
45
+ "esm": "./esm2022/nauth-toolkit-client-angular.mjs",
46
+ "default": "./fesm2022/nauth-toolkit-client-angular.mjs"
47
+ },
48
+ "./standalone": {
49
+ "types": "./standalone/index.d.ts",
50
+ "esm2022": "./esm2022/standalone/nauth-toolkit-client-angular-standalone.mjs",
51
+ "esm": "./esm2022/standalone/nauth-toolkit-client-angular-standalone.mjs",
52
+ "default": "./fesm2022/nauth-toolkit-client-angular-standalone.mjs"
53
+ },
54
+ "./src/standalone": {
55
+ "types": "./src/standalone/index.d.ts",
56
+ "esm2022": "./esm2022/src/standalone/nauth-toolkit-client-angular-src-standalone.mjs",
57
+ "esm": "./esm2022/src/standalone/nauth-toolkit-client-angular-src-standalone.mjs",
58
+ "default": "./fesm2022/nauth-toolkit-client-angular-src-standalone.mjs"
59
+ }
60
+ },
61
+ "sideEffects": false
62
+ }
@@ -4,18 +4,12 @@
4
4
  * This is the default entry point for NgModule-based Angular apps.
5
5
  * For standalone components, use: @nauth-toolkit/client-angular/standalone
6
6
  */
7
-
8
- // Re-export core client types and utilities
9
7
  export * from '@nauth-toolkit/client';
10
-
11
- // Export NgModule-specific components (class-based)
12
8
  export * from './ngmodule/tokens';
13
9
  export * from './ngmodule/auth.service';
14
10
  export * from './ngmodule/http-adapter';
15
11
  export * from './ngmodule/auth.interceptor.class';
16
12
  export * from './ngmodule/nauth.module';
17
-
18
- // Export functional components (for flexibility in NgModule apps too)
19
13
  export * from './lib/auth.interceptor';
20
14
  export * from './lib/auth.guard';
21
15
  export * from './lib/social-redirect-callback.guard';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@nauth-toolkit/client-angular/src/standalone" />
5
+ export * from './public-api';
@@ -7,6 +7,4 @@
7
7
  * NOTE: This simply re-exports the main entry point since both share the same code for now.
8
8
  * The split allows future additions like `provideNAuth()` for standalone apps.
9
9
  */
10
-
11
- // Re-export everything from the main entry point
12
10
  export * from '@nauth-toolkit/client-angular';
@@ -1,7 +1,5 @@
1
- import { inject } from '@angular/core';
2
1
  import { CanActivateFn, Router, UrlTree } from '@angular/router';
3
2
  import { AuthService } from './auth.service';
4
-
5
3
  /**
6
4
  * Functional route guard for authentication (Angular 17+).
7
5
  *
@@ -28,19 +26,7 @@ import { AuthService } from './auth.service';
28
26
  * ];
29
27
  * ```
30
28
  */
31
- export function authGuard(redirectTo = '/login'): CanActivateFn {
32
- return (): boolean | UrlTree => {
33
- const auth = inject(AuthService);
34
- const router = inject(Router);
35
-
36
- if (auth.isAuthenticated()) {
37
- return true;
38
- }
39
-
40
- return router.createUrlTree([redirectTo]);
41
- };
42
- }
43
-
29
+ export declare function authGuard(redirectTo?: string): CanActivateFn;
44
30
  /**
45
31
  * Class-based authentication guard for NgModule compatibility.
46
32
  *
@@ -61,26 +47,18 @@ export function authGuard(redirectTo = '/login'): CanActivateFn {
61
47
  * })
62
48
  * ```
63
49
  */
64
- export class AuthGuard {
65
- /**
66
- * @param auth - Authentication service
67
- * @param router - Angular router
68
- */
69
- constructor(
70
- private auth: AuthService,
71
- private router: Router,
72
- ) {}
73
-
74
- /**
75
- * Check if route can be activated.
76
- *
77
- * @returns True if authenticated, otherwise redirects to login
78
- */
79
- canActivate(): boolean | UrlTree {
80
- if (this.auth.isAuthenticated()) {
81
- return true;
82
- }
83
-
84
- return this.router.createUrlTree(['/login']);
85
- }
50
+ export declare class AuthGuard {
51
+ private auth;
52
+ private router;
53
+ /**
54
+ * @param auth - Authentication service
55
+ * @param router - Angular router
56
+ */
57
+ constructor(auth: AuthService, router: Router);
58
+ /**
59
+ * Check if route can be activated.
60
+ *
61
+ * @returns True if authenticated, otherwise redirects to login
62
+ */
63
+ canActivate(): boolean | UrlTree;
86
64
  }
@@ -0,0 +1,15 @@
1
+ import { HttpHandlerFn, HttpInterceptorFn, HttpRequest } from '@angular/common/http';
2
+ /**
3
+ * Angular HTTP interceptor for nauth-toolkit.
4
+ *
5
+ * Handles:
6
+ * - Cookies mode: withCredentials + CSRF tokens + refresh via POST
7
+ * - JSON mode: refresh via SDK, retry with new token
8
+ */
9
+ export declare const authInterceptor: HttpInterceptorFn;
10
+ /**
11
+ * Class-based interceptor for NgModule compatibility.
12
+ */
13
+ export declare class AuthInterceptor {
14
+ intercept(req: HttpRequest<unknown>, next: HttpHandlerFn): import("rxjs").Observable<import("@angular/common/http").HttpEvent<unknown>>;
15
+ }