@abgov/nx-adsp 12.4.1 → 12.6.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.
Files changed (44) hide show
  1. package/generators.json +6 -0
  2. package/package.json +1 -1
  3. package/src/generators/angular-app/angular-app.js +22 -7
  4. package/src/generators/angular-app/angular-app.js.map +1 -1
  5. package/src/generators/angular-app/files/AGENTS.md__tmpl__ +96 -0
  6. package/src/generators/angular-app/files/src/app/app.component.css__tmpl__ +10 -54
  7. package/src/generators/angular-app/files/src/app/app.component.html__tmpl__ +18 -49
  8. package/src/generators/angular-app/files/src/app/app.component.spec.ts__tmpl__ +22 -27
  9. package/src/generators/angular-app/files/src/app/app.component.ts__tmpl__ +60 -20
  10. package/src/generators/angular-app/files/src/app/app.config.ts__tmpl__ +27 -0
  11. package/src/generators/angular-app/files/src/app/app.routes.ts__tmpl__ +10 -31
  12. package/src/generators/angular-app/files/src/app/home/home.component.html__tmpl__ +1 -3
  13. package/src/generators/angular-app/files/src/app/home/home.component.ts__tmpl__ +9 -23
  14. package/src/generators/angular-app/files/src/app/protected/protected.component.html__tmpl__ +2 -2
  15. package/src/generators/angular-app/files/src/app/protected/protected.component.spec.ts__tmpl__ +27 -43
  16. package/src/generators/angular-app/files/src/app/protected/protected.component.ts__tmpl__ +15 -15
  17. package/src/generators/angular-app/files/src/app/services/auth-guard.service.ts__tmpl__ +12 -21
  18. package/src/generators/angular-app/files/src/environments/environment.ts__tmpl__ +2 -11
  19. package/src/generators/angular-app/files/src/index.html__tmpl__ +3 -9
  20. package/src/generators/angular-app/files/src/main.ts__tmpl__ +8 -12
  21. package/src/generators/angular-app/files/src/silent-check-sso.html__tmpl__ +5 -0
  22. package/src/generators/angular-app/files/src/styles.css__tmpl__ +2 -2
  23. package/src/generators/express-service/files/AGENTS.md__tmpl__ +76 -0
  24. package/src/generators/mean/mean.d.ts +3 -0
  25. package/src/generators/mean/mean.js +30 -0
  26. package/src/generators/mean/mean.js.map +1 -0
  27. package/src/generators/mean/mean.spec.ts +38 -0
  28. package/src/generators/mean/schema.d.ts +11 -0
  29. package/src/generators/mean/schema.json +26 -0
  30. package/src/generators/react-app/files/AGENTS.md__tmpl__ +76 -0
  31. package/src/generators/angular-app/files/src/app/app.module.ts__tmpl__ +0 -47
  32. package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.css__tmpl__ +0 -13
  33. package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.html__tmpl__ +0 -12
  34. package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.spec.ts__tmpl__ +0 -33
  35. package/src/generators/angular-app/files/src/app/auth-callback/auth-callback.component.ts__tmpl__ +0 -48
  36. package/src/generators/angular-app/files/src/app/auth.interceptor.ts__tmpl__ +0 -24
  37. package/src/generators/angular-app/files/src/app/logout/logout.component.html__tmpl__ +0 -1
  38. package/src/generators/angular-app/files/src/app/logout/logout.component.ts__tmpl__ +0 -9
  39. package/src/generators/angular-app/files/src/app/services/auth.service.ts__tmpl__ +0 -57
  40. package/src/generators/angular-app/files/src/app/tenant.service.ts__tmpl__ +0 -19
  41. package/src/generators/angular-app/files/src/environments/config.ts__tmpl__ +0 -21
  42. /package/src/generators/angular-app/files/{src → public}/assets/banner.jpg +0 -0
  43. /package/src/generators/angular-app/files/{src → public}/assets/github-1.svg +0 -0
  44. /package/src/generators/angular-app/files/{src → public}/favicon.ico +0 -0
@@ -1,48 +0,0 @@
1
- import { Injectable, Component, OnInit } from '@angular/core';
2
- import { AuthService } from '../services/auth.service';
3
- import { User } from 'oidc-client';
4
-
5
- @Component({
6
- selector: '<%= projectName %>-app-auth-callback',
7
- templateUrl: './auth-callback.component.html',
8
- styleUrls: ['./auth-callback.component.css'],
9
- })
10
- @Injectable({
11
- providedIn: 'root',
12
- })
13
- export class AuthCallbackComponent implements OnInit {
14
- public tokenType = '';
15
- public accessToken = '';
16
-
17
- constructor(private authService: AuthService) {}
18
-
19
- ngOnInit() {
20
- this.getAuth();
21
- }
22
-
23
- getAuth() {
24
- if (!this.authService.isLoggedIn()) {
25
- this.authService
26
- .completeAuthentication()
27
- .catch((error) => {
28
- console.error(`could not complete authentication: ${error}`);
29
- })
30
- .then(() => {
31
- this.setTokens();
32
- });
33
- }
34
- }
35
-
36
- setTokens() {
37
- if (this.authService.isLoggedIn()) {
38
- const user: User | null = this.authService.getUser();
39
- if (user) {
40
- this.accessToken = user.access_token;
41
- this.tokenType = user.token_type;
42
- }
43
- return true;
44
- } else {
45
- return false;
46
- }
47
- }
48
- }
@@ -1,24 +0,0 @@
1
- import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
2
- import { Injectable } from '@angular/core';
3
- import { Observable } from 'rxjs';
4
- import { AuthCallbackComponent } from './auth-callback/auth-callback.component';
5
-
6
- @Injectable({ providedIn: 'root' })
7
- export class AuthInterceptor implements HttpInterceptor {
8
-
9
- constructor(private authCallBackComponent: AuthCallbackComponent) { }
10
-
11
- intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
12
- if (this.authCallBackComponent.setTokens()) {
13
- req = req.clone({
14
- setHeaders: {
15
- 'Content-Type' : 'application/json; charset=utf-8',
16
- 'Accept' : 'application/json',
17
- 'Authorization': `Bearer ${this.authCallBackComponent.accessToken}`,
18
- },
19
- });
20
- }
21
-
22
- return next.handle(req);
23
- }
24
- }
@@ -1,9 +0,0 @@
1
- import { Component } from '@angular/core';
2
-
3
- @Component({
4
- selector: '<%= projectName %>-app-logout',
5
- templateUrl: 'logout.component.html',
6
- })
7
- export class LogoutComponent {
8
- isAuthenticated = false;
9
- }
@@ -1,57 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { UserManager, UserManagerSettings, User } from 'oidc-client';
3
-
4
- @Injectable({
5
- providedIn: 'root',
6
- })
7
- export class AuthService {
8
- private manager = new UserManager(getClientSettings());
9
- private user: User | null = null;
10
-
11
- constructor() {
12
- this.manager.getUser().then((user) => {
13
- this.user = user;
14
- });
15
- }
16
-
17
- isLoggedIn(): boolean {
18
- return this.user != null && !this.user.expired;
19
- }
20
-
21
- getUser(): User | null {
22
- return this.user;
23
- }
24
-
25
- startAuthentication(): Promise<void> {
26
- return this.manager.signinRedirect();
27
- }
28
-
29
- completeAuthentication(): Promise<void> {
30
- return this.manager.signinRedirectCallback().then((user) => {
31
- this.user = user;
32
- console.log(JSON.stringify(this.user));
33
- });
34
- }
35
-
36
- logout() {
37
- return this.manager.signoutRedirect();
38
- }
39
- }
40
-
41
- export function getClientSettings(): UserManagerSettings {
42
- const data = JSON.parse(localStorage.getItem('envData') || "\"\"");
43
- const appUrl = `${window.location.protocol}//${window.location.hostname}${
44
- window.location.port ? `:${window.location.port}` : ''
45
- }`;
46
-
47
- const settings = {
48
- client_id: data.access.client_id,
49
- redirect_uri: `${appUrl}/auth-callback`,
50
- post_logout_redirect_uri: `${appUrl}/signout/callback`,
51
- silent_redirect_uri: `${appUrl}/auth-callback`,
52
- response_type: 'code',
53
- authority: `${data.access.url}/auth/realms/${data.access.realm}`,
54
- automaticSilentRenew: true,
55
- };
56
- return settings;
57
- }
@@ -1,19 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
-
4
- @Injectable({ providedIn: 'root' })
5
- export default class TenantService {
6
-
7
- private getTenantNameUrl = `${this.configData().tenantApi.host}${this.configData().tenantApi.endpoints.tenantNameByRealm}/${this.configData().access.realm}`;
8
-
9
- constructor(private http: HttpClient) {}
10
-
11
- /** GET tenants from the server */
12
- getTenant() {
13
- return this.http.get(this.getTenantNameUrl);
14
- }
15
-
16
- configData () {
17
- return JSON.parse(localStorage.getItem('envData') || "\"\"");
18
- }
19
- }
@@ -1,21 +0,0 @@
1
- import { environment } from './environment';
2
- import { Injectable } from '@angular/core';
3
-
4
- @Injectable()
5
- export class Config {
6
- constructor() {}
7
-
8
- Init() {
9
- return new Promise<void>((resolve, reject) => {
10
- console.log("AppInitService.init() called");
11
-
12
- fetch('/config/config.json')
13
- .then((res) => {
14
- return (res.ok ? res.json() : environment)
15
- }).then(( envData ) => {
16
- localStorage.setItem('envData', JSON.stringify(envData));
17
- resolve();
18
- })
19
- });
20
- }
21
- }