@anarchitects/auth-angular 0.1.5 → 0.3.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/README.md +33 -17
- package/feature/README.md +2 -2
- package/fesm2022/anarchitects-auth-angular-feature.mjs +67 -286
- package/fesm2022/anarchitects-auth-angular-feature.mjs.map +1 -1
- package/fesm2022/anarchitects-auth-angular-state.mjs +6 -2
- package/fesm2022/anarchitects-auth-angular-state.mjs.map +1 -1
- package/fesm2022/anarchitects-auth-angular-ui.mjs +434 -0
- package/fesm2022/anarchitects-auth-angular-ui.mjs.map +1 -0
- package/fesm2022/anarchitects-auth-angular.mjs +1 -0
- package/fesm2022/anarchitects-auth-angular.mjs.map +1 -1
- package/package.json +28 -14
- package/state/README.md +3 -2
- package/types/anarchitects-auth-angular-feature.d.ts +58 -49
- package/types/anarchitects-auth-angular-state.d.ts +5 -2
- package/types/anarchitects-auth-angular-ui.d.ts +138 -0
- package/types/anarchitects-auth-angular.d.ts +1 -0
- package/ui/README.md +22 -0
- package/util/README.md +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
# @anarchitects/auth-angular
|
|
2
2
|
|
|
3
|
-
Angular
|
|
3
|
+
Angular domain libraries for the Anarchitecture auth domain. The package is organized into standalone slices (config, data-access, feature, state, util, ui) that compose implementation-aligned authentication flows for Angular applications.
|
|
4
|
+
|
|
5
|
+
## Developer + AI Agent Start Here
|
|
6
|
+
|
|
7
|
+
- Read this README before generating integration code for `@anarchitects/auth-angular`.
|
|
8
|
+
- Use public entry points only (`config`, `data-access`, `feature`, `state`, `util`, `ui`); do not import internal files.
|
|
9
|
+
- Register providers and state explicitly via `provideAuthConfig`, `provideAuthDataAccess`, and `provideAuthState`.
|
|
10
|
+
- Keep policy and ability behavior aligned with contracts from `@anarchitects/auth-ts`.
|
|
11
|
+
- Preserve Angular layering and keep orchestration out of UI components.
|
|
4
12
|
|
|
5
13
|
## Features
|
|
6
14
|
|
|
7
15
|
- `config`: DI tokens and provider helpers (API base URL, defaults)
|
|
8
16
|
- `data-access`: generated OpenAPI clients plus adapters over the Nest API
|
|
9
|
-
- `state`: signal-based store
|
|
10
|
-
- `feature`: router policy guard that
|
|
17
|
+
- `state`: signal-based store plus explicit provider helper for login/logout, token refresh, and ability hydration
|
|
18
|
+
- `feature`: router policy guard and orchestration components that delegate rendering to auth UI components
|
|
11
19
|
- `util`: CASL ability helpers (`createAppAbility`, `AppAbility`)
|
|
12
|
-
- `ui`: presentational components
|
|
20
|
+
- `ui`: presentational auth domain form components built on `AnarchitectsUiForm`
|
|
13
21
|
|
|
14
22
|
## Installation
|
|
15
23
|
|
|
16
24
|
```bash
|
|
17
|
-
npm install @anarchitects/auth-angular
|
|
25
|
+
npm install @anarchitects/auth-angular @angular/common @angular/core @angular/router @ngrx/operators @ngrx/signals rxjs
|
|
18
26
|
# or
|
|
19
|
-
yarn add @anarchitects/auth-angular
|
|
27
|
+
yarn add @anarchitects/auth-angular @angular/common @angular/core @angular/router @ngrx/operators @ngrx/signals rxjs
|
|
20
28
|
```
|
|
21
29
|
|
|
22
|
-
Peer
|
|
30
|
+
Peer requirements:
|
|
31
|
+
|
|
32
|
+
- `@angular/common`, `@angular/core`, `@angular/router`
|
|
33
|
+
- `@ngrx/operators`, `@ngrx/signals`, `rxjs`
|
|
34
|
+
|
|
35
|
+
The internal `@anarchitects/auth-ts`, `@anarchitects/forms-angular`, `@anarchitects/forms-ts`, and shared layout packages are installed transitively. Runtime utilities such as `jwt-decode` and `@casl/ability` are bundled as direct dependencies of this package.
|
|
23
36
|
|
|
24
37
|
## Usage
|
|
25
38
|
|
|
@@ -30,6 +43,7 @@ Peer dependencies: Angular v20+, `@ngrx/signals`, `@sinclair/typebox`, and the s
|
|
|
30
43
|
import { ApplicationConfig } from '@angular/core';
|
|
31
44
|
import { provideAuthConfig } from '@anarchitects/auth-angular/config';
|
|
32
45
|
import { provideAuthDataAccess } from '@anarchitects/auth-angular/data-access';
|
|
46
|
+
import { provideAuthState } from '@anarchitects/auth-angular/state';
|
|
33
47
|
|
|
34
48
|
export const appConfig: ApplicationConfig = {
|
|
35
49
|
providers: [
|
|
@@ -37,6 +51,7 @@ export const appConfig: ApplicationConfig = {
|
|
|
37
51
|
apiBaseUrl: 'https://api.anarchitects.dev',
|
|
38
52
|
}),
|
|
39
53
|
provideAuthDataAccess(),
|
|
54
|
+
provideAuthState(),
|
|
40
55
|
],
|
|
41
56
|
};
|
|
42
57
|
```
|
|
@@ -72,21 +87,22 @@ export const routes: Routes = [
|
|
|
72
87
|
path: 'admin',
|
|
73
88
|
canMatch: [policyGuard],
|
|
74
89
|
data: { action: 'manage', subject: 'admin-section' },
|
|
75
|
-
loadComponent: () =>
|
|
90
|
+
loadComponent: () =>
|
|
91
|
+
import('./admin.component').then((m) => m.AdminComponent),
|
|
76
92
|
},
|
|
77
93
|
];
|
|
78
94
|
```
|
|
79
95
|
|
|
80
|
-
|
|
96
|
+
## Entry points
|
|
81
97
|
|
|
82
|
-
| Import path | Description
|
|
83
|
-
| ---------------------------------------- |
|
|
84
|
-
| `@anarchitects/auth-angular/config` | DI tokens and providers
|
|
85
|
-
| `@anarchitects/auth-angular/data-access` | Generated API clients and HTTP adapters
|
|
86
|
-
| `@anarchitects/auth-angular/state` | Signal store and CASL ability sync
|
|
87
|
-
| `@anarchitects/auth-angular/feature` | Router policy guard
|
|
88
|
-
| `@anarchitects/auth-angular/
|
|
89
|
-
| `@anarchitects/auth-angular/
|
|
98
|
+
| Import path | Description |
|
|
99
|
+
| ---------------------------------------- | --------------------------------------- |
|
|
100
|
+
| `@anarchitects/auth-angular/config` | DI tokens and providers |
|
|
101
|
+
| `@anarchitects/auth-angular/data-access` | Generated API clients and HTTP adapters |
|
|
102
|
+
| `@anarchitects/auth-angular/state` | Signal store and CASL ability sync |
|
|
103
|
+
| `@anarchitects/auth-angular/feature` | Router policy guard |
|
|
104
|
+
| `@anarchitects/auth-angular/ui` | Auth domain form UI components |
|
|
105
|
+
| `@anarchitects/auth-angular/util` | CASL ability factory and typings |
|
|
90
106
|
|
|
91
107
|
## Nx scripts
|
|
92
108
|
|
package/feature/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @anarchitects/auth-angular/feature
|
|
2
2
|
|
|
3
|
-
Feature
|
|
3
|
+
Feature-level orchestration for Angular auth. It ships route guards plus standalone feature components that orchestrate auth actions via `AuthStore` and delegate rendering to `@anarchitects/auth-angular/ui`.
|
|
4
4
|
|
|
5
5
|
## Exports
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ export const routes: Routes = [
|
|
|
32
32
|
];
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
The guard reads the `AuthStore` ability snapshot. Ensure the state layer is
|
|
35
|
+
The guard reads the `AuthStore` ability snapshot. Ensure the state layer is explicitly provided in your app/route providers by wiring `provideAuthState()` from `@anarchitects/auth-angular/state`.
|
|
36
36
|
|
|
37
37
|
### Token-driven actions
|
|
38
38
|
|