@coolon/angular-ui-powerups 3.5.3 → 3.7.0-alpha.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 (131) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/bundles/coolon-angular-ui-powerups-cypress.umd.js +41 -1
  3. package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups-cypress.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups-cypress.umd.min.js.map +1 -1
  6. package/bundles/coolon-angular-ui-powerups.umd.js +248 -191
  7. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  8. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  9. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  10. package/coolon-angular-ui-powerups.metadata.json +1 -1
  11. package/cypress/components/aup-navigation.d.ts +9 -0
  12. package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
  13. package/cypress/exports.d.ts +1 -0
  14. package/cypress/package.json +2 -1
  15. package/cypress/page.d.ts +3 -0
  16. package/cypress/section.d.ts +5 -0
  17. package/esm2015/cypress/components/aup-navigation.js +21 -0
  18. package/esm2015/cypress/components/aup-navigation.js.map +1 -0
  19. package/esm2015/cypress/components/aup-navigation.metadata.json +1 -0
  20. package/esm2015/cypress/exports.js +1 -0
  21. package/esm2015/cypress/exports.js.map +1 -1
  22. package/esm2015/cypress/exports.metadata.json +1 -1
  23. package/esm2015/cypress/page.js +10 -1
  24. package/esm2015/cypress/page.js.map +1 -1
  25. package/esm2015/cypress/page.metadata.json +1 -1
  26. package/esm2015/cypress/section.js +7 -0
  27. package/esm2015/cypress/section.js.map +1 -1
  28. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  29. package/esm2015/lib/components/forms/number-input/number-input.component.js +2 -3
  30. package/esm2015/lib/components/forms/number-input/number-input.component.js.map +1 -1
  31. package/esm2015/lib/components/forms/number-input/number-input.component.metadata.json +1 -1
  32. package/esm2015/lib/components/forms/password-input/password-input.component.js +5 -4
  33. package/esm2015/lib/components/forms/password-input/password-input.component.js.map +1 -1
  34. package/esm2015/lib/components/forms/password-input/password-input.component.metadata.json +1 -1
  35. package/esm2015/lib/components/forms/select-input/select-input.component.js.map +1 -1
  36. package/esm2015/lib/components/forms/select-input/select-input.component.metadata.json +1 -1
  37. package/esm2015/lib/components/forms/string-input/string-input.component.js +2 -1
  38. package/esm2015/lib/components/forms/string-input/string-input.component.js.map +1 -1
  39. package/esm2015/lib/components/forms/string-input/string-input.component.metadata.json +1 -1
  40. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js +12 -0
  41. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -1
  42. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.metadata.json +1 -1
  43. package/esm2015/lib/place/components/abstract-place-navigation.component.js +7 -5
  44. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  45. package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
  46. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +6 -6
  47. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
  48. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.metadata.json +1 -1
  49. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js +5 -5
  50. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js.map +1 -1
  51. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.metadata.json +1 -1
  52. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +5 -5
  53. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
  54. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.metadata.json +1 -1
  55. package/esm2015/lib/place/exports.js +1 -0
  56. package/esm2015/lib/place/exports.js.map +1 -1
  57. package/esm2015/lib/place/exports.metadata.json +1 -1
  58. package/esm2015/lib/place/guards/place.guard.js +94 -43
  59. package/esm2015/lib/place/guards/place.guard.js.map +1 -1
  60. package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
  61. package/esm2015/lib/place/guards/place.guard.ngfactory.js.map +1 -0
  62. package/esm2015/lib/place/place-auth-service.js +3 -0
  63. package/esm2015/lib/place/place-auth-service.js.map +1 -0
  64. package/esm2015/lib/place/place-auth-service.metadata.json +1 -0
  65. package/esm2015/lib/place/place-component.js +12 -2
  66. package/esm2015/lib/place/place-component.js.map +1 -1
  67. package/esm2015/lib/place/place-component.metadata.json +1 -1
  68. package/esm2015/lib/place/place-definition.js +2 -1
  69. package/esm2015/lib/place/place-definition.js.map +1 -1
  70. package/esm2015/lib/place/place-definition.metadata.json +1 -1
  71. package/esm2015/lib/place/place-router.js +6 -0
  72. package/esm2015/lib/place/place-router.js.map +1 -1
  73. package/esm2015/lib/place/place-router.metadata.json +1 -1
  74. package/esm2015/lib/place/place.decorator.js +1 -1
  75. package/esm2015/lib/place/place.decorator.js.map +1 -1
  76. package/fesm2015/coolon-angular-ui-powerups-cypress.js +36 -2
  77. package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
  78. package/fesm2015/coolon-angular-ui-powerups.js +205 -135
  79. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  80. package/lib/components/forms/number-input/number-input.component.d.ts +1 -0
  81. package/lib/components/forms/password-input/password-input.component.d.ts +1 -0
  82. package/lib/components/forms/string-input/string-input.component.d.ts +1 -0
  83. package/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.d.ts +12 -0
  84. package/lib/place/components/abstract-place-navigation.component.d.ts +2 -2
  85. package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -2
  86. package/lib/place/components/side-place-navigation/side-place-navigation.component.d.ts +2 -2
  87. package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -2
  88. package/lib/place/exports.d.ts +1 -0
  89. package/lib/place/guards/place.guard.d.ts +5 -7
  90. package/lib/place/place-auth-service.d.ts +36 -0
  91. package/lib/place/place-component.d.ts +2 -1
  92. package/lib/place/place-definition.d.ts +2 -1
  93. package/lib/place/place-router.d.ts +1 -0
  94. package/lib/place/place.decorator.d.ts +1 -0
  95. package/package.json +1 -1
  96. package/schematics/bootstrap-app/index.js +4 -0
  97. package/schematics/bootstrap-app/index.js.map +1 -1
  98. package/schematics/bootstrap-app/templates/app/app.module.ts.template +4 -2
  99. package/schematics/bootstrap-app/templates/app/auth/place-auth.service.ts.template +41 -0
  100. package/schematics/collection.json +5 -0
  101. package/schematics/ng-add/index.js +1 -1
  102. package/schematics/ng-add/index.js.map +1 -1
  103. package/schematics/place-add/index.js +2 -1
  104. package/schematics/place-add/index.js.map +1 -1
  105. package/schematics/place-add/templates/component/__name@dasherize__.component.scss.template +1 -0
  106. package/schematics/place-bootstrap/index.d.ts +3 -0
  107. package/schematics/place-bootstrap/index.js +21 -0
  108. package/schematics/place-bootstrap/index.js.map +1 -0
  109. package/schematics/place-bootstrap/schema.d.ts +4 -0
  110. package/schematics/place-bootstrap/schema.js +3 -0
  111. package/schematics/place-bootstrap/schema.js.map +1 -0
  112. package/schematics/place-bootstrap/schema.json +28 -0
  113. package/schematics/place-routes/place-builder.d.ts +0 -1
  114. package/schematics/place-routes/place-builder.js +34 -24
  115. package/schematics/place-routes/place-builder.js.map +1 -1
  116. package/schematics/place-routes/place-class-scanner.js +2 -1
  117. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  118. package/schematics/place-routes/place-def.d.ts +1 -0
  119. package/schematics/place-routes/place-def.js +2 -2
  120. package/schematics/place-routes/place-def.js.map +1 -1
  121. package/schematics/place-routes/schema.d.ts +1 -4
  122. package/schematics/place-routes/schema.json +9 -1
  123. package/schematics/place-routes/templates/place-destinations.ts.template +1 -9
  124. package/schematics/place-routes/templates/place-routes.ts.template +3 -39
  125. package/schematics/place-routes/templates/place-visits.ts.template +1 -10
  126. package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +0 -23
  127. package/schematics/bootstrap-app/templates/app/auth/auth.module.ts.template +0 -13
  128. package/schematics/bootstrap-app/templates/app/auth/auth.service.ts.template +0 -13
  129. package/schematics/bootstrap-app/templates/app/places/places.json5.template +0 -3
  130. /package/schematics/{bootstrap-app/templates/app/places → place-bootstrap/templates/__name@dasherize__}/place-routes.ts.template +0 -0
  131. /package/schematics/{bootstrap-app/templates/app/places → place-bootstrap/templates/__name@dasherize__}/places.module.ts.template +0 -0
@@ -1,6 +1,7 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { AbstractValueInputComponent } from '../abstract-value-input.component';
3
3
  export declare class NumberInputComponent extends AbstractValueInputComponent<number> implements OnInit {
4
+ autocomplete: string;
4
5
  min: number;
5
6
  max: number;
6
7
  constructor();
@@ -1,6 +1,7 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { AbstractValueInputComponent } from '../abstract-value-input.component';
3
3
  export declare class PasswordInputComponent extends AbstractValueInputComponent<string> implements OnInit {
4
+ autocomplete: string;
4
5
  constructor();
5
6
  ngOnInit(): void;
6
7
  }
@@ -2,6 +2,7 @@ import { OnInit } from '@angular/core';
2
2
  import { Command, ValueModel } from '@coolon/pectin';
3
3
  import { AbstractValueInputComponent } from '../abstract-value-input.component';
4
4
  export declare class StringInputComponent extends AbstractValueInputComponent<string> implements OnInit {
5
+ autocomplete: string;
5
6
  enableClearModel: ValueModel<boolean>;
6
7
  enableClear: boolean;
7
8
  readonly clearCommand: Command<void>;
@@ -8,6 +8,18 @@ import { Confirm } from '../../confirm';
8
8
  import { InteractionContext } from '../../interaction-context';
9
9
  import { InteractionService } from '../../services/interaction.service';
10
10
  import { ActivityContainerComponent } from '../activity-container/activity-container.component';
11
+ /**
12
+ * @example
13
+ * <aup-in-place-interaction-context #inPlaceInteractionContext>
14
+ *
15
+ * </aup-in-place-interaction-context>
16
+ *
17
+ * in your component
18
+ * @ViewChild('inPlaceInteractionContext', { static: true })
19
+ * interactionContext: InteractionContext;
20
+ *
21
+ *
22
+ */
11
23
  export declare class InPlaceInteractionContextComponent<D, R, E> extends DisposableComponent implements InteractionContext, AfterViewInit {
12
24
  readonly interactionService: InteractionService;
13
25
  private readonly tabConfig;
@@ -2,9 +2,9 @@ import { OnInit } from '@angular/core';
2
2
  import { Command, Constructable, DelegatingValueModel, ListModel, ListModelChain, ValueModel } from '@coolon/pectin';
3
3
  import { CommandFace } from '../../components/commands/command-face';
4
4
  import { DisposableComponent } from '../../components/disposable-component';
5
+ import { PlaceAuthService } from '../place-auth-service';
5
6
  import { PlaceComponent } from '../place-component';
6
7
  import { PlaceDefinition } from '../place-definition';
7
- import { PlaceRouter } from '../place-router';
8
8
  import { PlaceOutletComponent } from './place-outlet/place-outlet.component';
9
9
  export declare class AbstractPlaceNavigationComponent extends DisposableComponent implements OnInit {
10
10
  places: Constructable<PlaceComponent>[];
@@ -15,7 +15,7 @@ export declare class AbstractPlaceNavigationComponent extends DisposableComponen
15
15
  readonly commandFactory: Command.Factory<PlaceDefinition, void>;
16
16
  readonly _activePlaceComponent: DelegatingValueModel<PlaceComponent>;
17
17
  private activePlaceDefinition;
18
- constructor(placeRouter: PlaceRouter);
18
+ constructor(authService: PlaceAuthService);
19
19
  getNavigationFace(placeDef: PlaceDefinition): CommandFace;
20
20
  isActive(place: PlaceDefinition): boolean;
21
21
  ngOnInit(): void;
@@ -1,5 +1,5 @@
1
- import { PlaceRouter } from '../../place-router';
1
+ import { PlaceAuthService } from '../../place-auth-service';
2
2
  import { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';
3
3
  export declare class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
4
- constructor(placeRouter: PlaceRouter);
4
+ constructor(authService: PlaceAuthService);
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { Router } from '@angular/router';
3
- import { PlaceRouter } from '../../place-router';
3
+ import { PlaceAuthService } from '../../place-auth-service';
4
4
  import { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';
5
5
  /**
6
6
  * @example
@@ -48,7 +48,7 @@ export declare class SidePlaceNavigationComponent extends AbstractPlaceNavigatio
48
48
  readonly router: Router;
49
49
  expanded: boolean;
50
50
  navEndTemplate: TemplateRef<any>;
51
- constructor(router: Router, placeRouter: PlaceRouter);
51
+ constructor(router: Router, authService: PlaceAuthService);
52
52
  expandMenu(): void;
53
53
  collapseMenu(): void;
54
54
  toggleMenu(): void;
@@ -1,5 +1,5 @@
1
- import { PlaceRouter } from '../../place-router';
1
+ import { PlaceAuthService } from '../../place-auth-service';
2
2
  import { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';
3
3
  export declare class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
4
- constructor(placeRouter: PlaceRouter);
4
+ constructor(authService: PlaceAuthService);
5
5
  }
@@ -2,6 +2,7 @@
2
2
  * @file Automatically generated by barrelsby.
3
3
  */
4
4
  export * from "./nav-item";
5
+ export * from "./place-auth-service";
5
6
  export * from "./place-component";
6
7
  export * from "./place-config";
7
8
  export * from "./place-definition";
@@ -1,25 +1,23 @@
1
1
  import { Injector } from '@angular/core';
2
2
  import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
3
3
  import { InteractionService } from '../../interaction/services/interaction.service';
4
+ import { PlaceAuthService } from '../place-auth-service';
4
5
  import { PlaceComponent } from '../place-component';
5
- import { PlaceDefinition } from '../place-definition';
6
6
  import { PlaceHistory } from '../place-history';
7
7
  import { PlaceRouter } from '../place-router';
8
8
  import { UrlService } from '../url-service';
9
9
  import { UrlSnapshot } from '../url-snapshot';
10
- export declare abstract class PlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {
10
+ export declare class PlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {
11
11
  private readonly router;
12
12
  private urlService;
13
13
  private readonly placeRouter;
14
14
  private readonly placeHistory;
15
+ private readonly placeAuthService;
15
16
  private readonly interactionService;
16
17
  private readonly injector;
17
- constructor(router: Router, urlService: UrlService, placeRouter: PlaceRouter, placeHistory: PlaceHistory, interactionService: InteractionService, injector: Injector);
18
+ constructor(router: Router, urlService: UrlService, placeRouter: PlaceRouter, placeHistory: PlaceHistory, placeAuthService: PlaceAuthService, interactionService: InteractionService, injector: Injector);
18
19
  canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
19
20
  canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
20
21
  private handleGuardResult;
21
- protected authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree>;
22
- isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
23
- abstract getAuthGuard(injector: Injector): CanActivate;
24
- cleanInteractionState(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, then: () => Promise<boolean | UrlSnapshot>): Promise<boolean | UrlSnapshot>;
22
+ cleanInteractionState(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: () => Promise<boolean | UrlSnapshot>): Promise<boolean | UrlSnapshot>;
25
23
  }
@@ -0,0 +1,36 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
3
+ import { ValueModel } from '@coolon/pectin';
4
+ import { PlaceDefinition } from './place-definition';
5
+ import { UrlSnapshot } from './url-snapshot';
6
+ import { Visit } from './visit';
7
+ export declare const PLACE_AUTH_SERVICE: InjectionToken<PlaceAuthService>;
8
+ /**
9
+ * This interface provides auth services to the routing layer and splits authn and authz into two
10
+ * separate calls so that authentication can be promised based where as authorisation is not. This
11
+ * allows components to check authorisation without having to deal with the promised based nature
12
+ * of authentication.
13
+ */
14
+ export interface PlaceAuthService {
15
+ /**
16
+ * An observable model containing the authoriser function. This allows places to react to changes
17
+ * in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
18
+ */
19
+ readonly authoriserModel: ValueModel<PlaceAuthService.AuthoriserCallback>;
20
+ /**
21
+ * Checks if the current user is authenticated. If true the router will proceed to
22
+ * check if the user is authorised. Otherwise it will invoke #handleAuthenticatedFailure.
23
+ */
24
+ isAuthenticated(): boolean | Promise<boolean>;
25
+ /**
26
+ * Checks if the current user is authorised. If true the router will proceed to route sanitisation
27
+ * and view loading, otherwise it will invoke #handleAuthorisationFailure.
28
+ * @param placeDefinition
29
+ */
30
+ isAuthorised(placeDefinition: PlaceDefinition): boolean;
31
+ handleNotAuthenticated(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): UrlSnapshot | Visit;
32
+ handleNotAuthorisation(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): UrlSnapshot | Visit;
33
+ }
34
+ export declare namespace PlaceAuthService {
35
+ type AuthoriserCallback = (placeDef: PlaceDefinition) => boolean;
36
+ }
@@ -1,3 +1,4 @@
1
+ import { ActivatedRouteSnapshot } from '@angular/router';
1
2
  import { Constructable } from '@coolon/pectin';
2
3
  import 'reflect-metadata';
3
4
  import { DisposableComponent } from '../components/disposable-component';
@@ -30,6 +31,6 @@ export declare class PlaceComponent extends DisposableComponent {
30
31
  export declare namespace PlaceComponent {
31
32
  function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent>;
32
33
  function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[];
33
- function getDefinition(klass: Constructable<PlaceComponent>): PlaceDefinition;
34
+ function getDefinition(snapshotOrConstructor: ActivatedRouteSnapshot | Constructable<PlaceComponent>): PlaceDefinition;
34
35
  function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition): void;
35
36
  }
@@ -7,12 +7,13 @@ export declare class PlaceDefinition {
7
7
  readonly component: Constructable<PlaceComponent>;
8
8
  readonly path: string;
9
9
  readonly authenticate: boolean;
10
+ readonly roles: string[];
10
11
  readonly data: {
11
12
  [key: string]: any;
12
13
  };
13
14
  readonly routeParameters: ParameterDefinition<any>[];
14
15
  readonly children: PlaceDefinition[];
15
- constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, data: {
16
+ constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, roles: string[], data: {
16
17
  [key: string]: any;
17
18
  }, routeParameters: ParameterDefinition<any>[], children: PlaceDefinition[]);
18
19
  hasRouteId(): boolean;
@@ -25,6 +25,7 @@ export declare class PlaceRouter extends GarbageCollector {
25
25
  constructor(angularRouter: Router, angularLocation: Location, interactionService: InteractionService, urlService: UrlService, placeHistory: PlaceHistory);
26
26
  get navigationSession(): NavigationSession;
27
27
  get currentSession(): NavigationSession;
28
+ isNavigating(): boolean;
28
29
  onPopState(event: NavigationStart): void;
29
30
  onRouterStarted(event: NavigationStart): void;
30
31
  onUrlChanged(newUrl: string): void;
@@ -8,6 +8,7 @@ export declare namespace Place {
8
8
  [key: string]: any;
9
9
  };
10
10
  authenticate?: boolean;
11
+ roles?: string[];
11
12
  children?: Constructable<PlaceComponent>[];
12
13
  defaultChild?: Constructable<PlaceComponent>;
13
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "3.5.3",
3
+ "version": "3.7.0-alpha.0",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "dependencies": {
6
6
  "@coolon/typescript-utilities": "^2.2.0",
@@ -19,6 +19,10 @@ function bootstrapApp(_options) {
19
19
  schematics_1.externalSchematic('@coolon/angular-ui-powerups', 'aup-i18n', {
20
20
  project: _options.project
21
21
  }),
22
+ schematics_1.externalSchematic('@coolon/angular-ui-powerups', 'place-bootstrap', {
23
+ project: _options.project,
24
+ path: "places"
25
+ }),
22
26
  updatePackageJsonScripts(buildContext)
23
27
  ];
24
28
  // if (_options.initialPlaceName) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/bootstrap-app/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,2DAaoC;AACpC,kDAAoD;AAEpD,kDAA+C;AAG/C,yFAAyF;AAEzF,SAAgB,YAAY,CAAC,QAAgB;IAE3C,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,MAAM,SAAS,GAAG,qBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,SAAS,CAAC,uBAAuB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAExE,MAAM,cAAc,GAAG,kBAAkB,CACvC,gBAAG,CAAC,aAAa,CAAC,EAAE;YAClB,2BAAc,iCAAM,QAAQ,GAAK,cAAO,EAAG;YAC3C,iBAAI,CAAC,YAAY,CAAC,UAAU,CAAC;SAC9B,CAAC,CAAC;QAEL,MAAM,KAAK,GAAG;YACZ,cAAc;YACd,8BAAiB,CAAC,6BAA6B,EAAE,UAAU,EAAE;gBAC3D,OAAO,EAAE,QAAQ,CAAC,OAAO;aAC1B,CAAC;YACF,wBAAwB,CAAC,YAAY,CAAC;SACvC,CAAC;QACF,mCAAmC;QACnC,+EAA+E;QAC/E,mCAAmC;QACnC,oDAAoD;QACpD,SAAS;QACT,OAAO;QACP,IAAI;QACJ,OAAO,kBAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAS,CAAC;IAC9C,CAAC,CAAC;AACJ,CAAC;AA7BD,oCA6BC;AAED,SAAS,wBAAwB,CAAC,OAAyB;IACzD,OAAO,CAAC,IAAU,EAAE,CAAmB,EAAQ,EAAE;QAC/C,OAAO,gCAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;YACrC,KAAK,CAAC,OAAO,mCACR,KAAK,CAAC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IAAI,CAAC;iBACb;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;SACH,CAAC,CACH,CAAC;QAEF,OAAO,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC;AAjBD,gDAiBC;AAGD,6CAA6C;AAC7C,+DAA+D;AAC/D,YAAY;AACZ,wBAAwB;AACxB,uBAAuB;AACvB,qBAAqB;AACrB,qBAAqB;AACrB,0BAA0B;AAC1B,4BAA4B;AAC5B,QAAQ;AACR,IAAI;AAGJ,kDAAkD;AAClD,gCAAgC;AAChC,EAAE;AACF,yDAAyD;AACzD,EAAE;AACF,qDAAqD;AACrD,8CAA8C;AAC9C,UAAU;AACV,4EAA4E;AAC5E,EAAE;AACF,2BAA2B;AAC3B,kBAAkB;AAClB,UAAU;AACV,EAAE;AACF,2CAA2C;AAC3C,OAAO;AACP,IAAI;AAGJ,oDAAoD;AACpD,yDAAyD;AACzD,2EAA2E;AAC3E,mBAAmB;AACnB,OAAO;AACP,IAAI;AACJ,EAAE;AACF,qDAAqD;AACrD,yDAAyD;AACzD,oEAAoE;AACpE,mBAAmB;AACnB,OAAO;AACP,IAAI"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/bootstrap-app/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,2DAaoC;AACpC,kDAAoD;AAEpD,kDAA+C;AAG/C,yFAAyF;AAEzF,SAAgB,YAAY,CAAC,QAAgB;IAE3C,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,MAAM,SAAS,GAAG,qBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,SAAS,CAAC,uBAAuB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAExE,MAAM,cAAc,GAAG,kBAAkB,CACvC,gBAAG,CAAC,aAAa,CAAC,EAAE;Y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8CAA8C;AAC9C,UAAU;AACV,4EAA4E;AAC5E,EAAE;AACF,2BAA2B;AAC3B,kBAAkB;AAClB,UAAU;AACV,EAAE;AACF,2CAA2C;AAC3C,OAAO;AACP,IAAI;AAGJ,oDAAoD;AACpD,yDAAyD;AACzD,2EAA2E;AAC3E,mBAAmB;AACnB,OAAO;AACP,IAAI;AACJ,EAAE;AACF,qDAAqD;AACrD,yDAAyD;AACzD,oEAAoE;AACpE,mBAAmB;AACnB,OAAO;AACP,IAAI"}
@@ -13,13 +13,14 @@ import {
13
13
  DIALOG_INTERACTION_SERVICE_DEFAULTS,
14
14
  DialogInteractionContextFactory,
15
15
  ModalInteractionContextFactory,
16
- PlaceModule
16
+ PlaceModule,
17
+ PLACE_AUTH_SERVICE
17
18
  } from "@coolon/angular-ui-powerups";
18
19
  import {Logger} from "@coolon/pectin";
19
20
  import {setAutoFreeze} from "immer";
20
21
  import {environment} from "../environments/environment";
21
22
  import {AppRoutingModule} from "./app-routing.module";
22
-
23
+ import {PlaceAuthService} from './auth/place-auth.service';
23
24
  import {AppComponent} from "./app.component";
24
25
 
25
26
  @NgModule({
@@ -35,6 +36,7 @@ import {AppComponent} from "./app.component";
35
36
  MatToolbarModule
36
37
  ],
37
38
  providers: [
39
+ {provide: PLACE_AUTH_SERVICE, useClass: PlaceAuthService},
38
40
  {provide: DIALOG_INTERACTION_SERVICE_DEFAULTS, useValue: {restoreFocus: true}},
39
41
  {provide: ModalInteractionContextFactory, useClass: DialogInteractionContextFactory},
40
42
  {provide: LOCALE_ID, useValue: 'en-AU'},
@@ -0,0 +1,41 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
3
+ import { PlaceAuthService as IPlaceAuthService, PlaceDefinition, Visit } from '@coolon/angular-ui-powerups';
4
+ import { lang, GarbageCollector, MutableValueModel, ValueModel } from '@coolon/pectin';
5
+
6
+ @Injectable({
7
+ providedIn: 'root'
8
+ })
9
+ export class PlaceAuthService extends GarbageCollector implements IPlaceAuthService {
10
+
11
+ private readonly _authoriserModel = new MutableValueModel<IPlaceAuthService.AuthoriserCallback>();
12
+
13
+ constructor() {
14
+ super()
15
+ }
16
+
17
+ get authoriserModel(): ValueModel<IPlaceAuthService.AuthoriserCallback> {
18
+ return this._authoriserModel.readonly;
19
+ }
20
+
21
+ isAuthenticated(): boolean | Promise<boolean> {
22
+ return true;
23
+ }
24
+
25
+ isAuthorised(placeDefinition: PlaceDefinition): boolean {
26
+ return this._authoriserModel.value(placeDefinition);
27
+ }
28
+
29
+ handleNotAuthenticated(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Visit {
30
+ // Note: the the router.navigateByUrl(returnUrl) fails if there's no forward slash in the url.
31
+ // const returnUrl = !next.url.toString().includes('login') ? `/${next.url}` : '/';
32
+ // return placeDestinations.loginPlace.createVisit({ returnUrl })
33
+ return lang.notImplemented();
34
+ }
35
+
36
+ handleNotAuthorisation(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Visit {
37
+ // return placeDestinations.home.createVisit();
38
+ return lang.notImplemented();
39
+ }
40
+
41
+ }
@@ -19,6 +19,11 @@
19
19
  "factory": "./aup-i18n/index#run",
20
20
  "schema": "./aup-i18n/schema.json"
21
21
  },
22
+ "place-bootstrap": {
23
+ "description": "Initialises a new folder with place module and empty routes file.",
24
+ "factory": "./place-bootstrap/index#bootstrapPlaces",
25
+ "schema": "./place-bootstrap/schema.json"
26
+ },
22
27
  "place-routes": {
23
28
  "description": "Scans your source for place components and generates the place routes file",
24
29
  "factory": "./place-routes/index#generateRoutes",
@@ -20,7 +20,7 @@ function installDependencies(_options) {
20
20
  return package_util_1.updatePackageJson(tree, draft => {
21
21
  draft.scripts = Object.assign(Object.assign({}, draft.scripts), { "place-routes": "run-s place-routes:**", "i18n": "run-s i18n:**", "watch": "npm-watch" });
22
22
  draft.dependencies = Object.assign(Object.assign({}, draft.dependencies), { "@coolon/pectin": "^3.2.5", '@coolon/typescript-utilities': '^2.0.2', 'roboto-fontface': '^0.10.0', "@fortawesome/angular-fontawesome": "^0.7.0", "@fortawesome/fontawesome-free": "5.15.1", "@fortawesome/fontawesome-svg-core": "^1.2.32", "@fortawesome/free-solid-svg-icons": "^5.15.1", "@js-joda/core": "^3.2.0", "@js-joda/locale": "^3.2.0", "@js-joda/timezone": "^2.3.0", 'cldr-data': '^36.0.0', 'cldrjs': '^0.5.4', 'immer': '^7.0.5', 'reflect-metadata': '^0.1.13', 'resize-observer-polyfill': '^1.5.1', 'typescript-string-enums': '^1.0.0', "format-message-interpret": "^6.2.3", "@angular/material-moment-adapter": "^10.2.1", 'moment': '2.27.0' });
23
- draft.devDependencies = Object.assign(Object.assign({}, draft.devDependencies), { 'husky': '^4.2.0', '@coolon/i18n-resource-generator': '^2.0.13', 'barrelsby': '^2.1.1', 'dotenv': '6.2.0', 'cz-conventional-changelog': '^3.1.0', "@commitlint/cli": "^8.3.5", 'git-is-clean': '^3.0.1', 'shx': '^0.3.2', 'standard-version': '^8.0.0', "npm-watch": "^0.7.0" });
23
+ draft.devDependencies = Object.assign(Object.assign({}, draft.devDependencies), { 'husky': '^4.2.0', '@coolon/i18n-resource-generator': '^2.0.13', "cypress-wait-until": "^1.6.1", 'barrelsby': '^2.1.1', 'dotenv': '6.2.0', 'cz-conventional-changelog': '^3.1.0', "@commitlint/cli": "^8.3.5", 'git-is-clean': '^3.0.1', 'shx': '^0.3.2', 'standard-version': '^8.0.0', "npm-watch": "^0.7.0" });
24
24
  draft.watch = Object.assign({}, draft.watch);
25
25
  draft.config = Object.assign(Object.assign({}, draft.config), { commitizen: {
26
26
  path: './node_modules/cz-conventional-changelog'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AACjF,4DAA0E;AAC1E,kDAAoD;AAEpD,uBAAuB;AACvB,SAAgB,KAAK,CAAC,QAAa;IACjC,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,EAAE,OAAO,EACjB,2BAA2B,EAAE,QAAQ,EACrC,iBAAiB,EAAE,QAAQ,EAC3B,cAAc,EAAE,QAAQ,EACxB,KAAK,EAAE,QAAQ,EACf,kBAAkB,EAAE,QAAQ,EAC5B,WAAW,EAAE,QAAQ,GACtB,CAAC;YAEF,KAAK,CAAC,KAAK,qBACN,KAAK,CAAC,KAAK,CACf,CAAA;YAED,KAAK,CAAC,MAAM,mCACP,KAAK,CAAC,MAAM,KACf,UAAU,EAAE;oBACV,IAAI,EAAE,0CAA0C;iBACjD,GACF,CAAC;YAEF,KAAK,CAAC,KAAK,GAAG;gBACZ,OAAO,EAAE;oBACP,YAAY,EAAE,gCAAgC;iBAC/C;aACF,CAAC;QAEJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAlED,kDAkEC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AACjF,4DAA0E;AAC1E,kDAAoD;AAEpD,uBAAuB;AACvB,SAAgB,KAAK,CAAC,QAAa;IACjC,OAAO,kBAAK,CAAC;QACX,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;YACzC,QAAQ,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,mBAAmB,CAAC,QAAQ,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC;AARD,sBAQC;AAED,SAAgB,mBAAmB,CAAC,QAAa;IAC/C,OAAO,CAAC,IAAU,EAAE,CAAmB,EAAQ,EAAE;QAC/C,OAAO,gCAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;YACrC,KAAK,CAAC,OAAO,mCACR,KAAK,CAAC,OAAO,KAChB,cAAc,EAAE,uBAAuB,EACvC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,WAAW,GACrB,CAAC;YAEF,KAAK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,CAAC;AAnED,kDAmEC"}
@@ -14,7 +14,7 @@ function addPlace(_options) {
14
14
  const pathToSourceRoot = [buildContext.sourceCodeRoot].concat(componentPathParts);
15
15
  const placeModulePath = buildContext.findFileInAncestorPath(pathToSourceRoot, 'places.module.ts');
16
16
  if (!placeModulePath) {
17
- throw new Error(`Places must be created in a directory containing a 'places.module.ts' file or any subdirectory thereof. I couldn't find one in ${pathToSourceRoot.join('/')} or in any ancestor of it`);
17
+ throw new Error(`Places must be created in or under a directory containing a 'places.module.ts'. I couldn't find one in ${pathToSourceRoot.join('/')} or in any ancestor of it. You can run ng g @coolon/angular-ui-powerups:place-bootstrap --dir=<directory> to initialise one`);
18
18
  }
19
19
  const placeModule = buildContext.getSourceFile(placeModulePath);
20
20
  const newPlaceModuleContent = updatePlaceModule(placeModule);
@@ -31,6 +31,7 @@ function addPlace(_options) {
31
31
  }
32
32
  exports.addPlace = addPlace;
33
33
  function updatePlaceModule(placeModule) {
34
+ // TODO: Make this work.
34
35
  // const imports = placeModule.getImportDeclarations();
35
36
  const moduleClass = placeModule.findClassWithDecorator('@NgModule');
36
37
  const decorator = moduleClass.getClassDecoratorNode('@NgModule');
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AAEjF,oEAA0E;AAC1E,kDAA+C;AAI/C,SAAgB,QAAQ,CAAC,QAAgB;IAEvC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAE/C,MAAM,SAAS,GAAG,qBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEhE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,aAAa,GAAG,SAAS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,CAAC;QAChE,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAE7D,MAAM,cAAc,GAAG,gDAA2B,CAChD,IAAI,EACJ,qBAAqB,EACrB;YACE,IAAI,EAAE,aAAa;YACnB,cAAc,EAAE,YAAY,CAAC,cAAc;YAC3C,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SACtD,EACD,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,aAAa,EAAE,CACnD,CAAC;QAGF,MAAM,eAAe,GAAG,gDAA2B,CACjD,IAAI,EACJ,iBAAiB,EACjB;YACE,IAAI,EAAE,aAAa;SACpB,EACD,YAAY,CAAC,UAAU,CAAC,CAAC;QAE3B,OAAO,kBAAK,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEjE,CAAC,CAAC;AAEJ,CAAC;AA1CD,4BA0CC;AAED,SAAS,iBAAiB,CAAC,WAAgC;IAEzD,wBAAwB;IAExB,uDAAuD;IACvD,MAAM,WAAW,GAAG,WAAW,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEjE,OAAO,WAAW,CAAC,WAAW,EAAE,CAAC;AACnC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  :host {
2
2
  display: flex;
3
3
  flex-direction: column;
4
+ padding: var(--default-padding);
4
5
  }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ export declare function bootstrapPlaces(_options: Schema): Rule;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bootstrapPlaces = void 0;
4
+ const template_utilities_1 = require("../utils/template-utilities");
5
+ const workspace_1 = require("../utils/workspace");
6
+ function bootstrapPlaces(_options) {
7
+ return (tree, context) => {
8
+ const workspace = workspace_1.Workspace.load(tree, context);
9
+ const buildContext = workspace.getApplication(_options.project);
10
+ const nameParts = _options.path.split('/');
11
+ const directoryName = nameParts[nameParts.length - 1];
12
+ const componentPathParts = nameParts.slice(0, nameParts.length - 1);
13
+ const pathToSourceRoot = [buildContext.sourceCodeRoot].concat(componentPathParts);
14
+ return template_utilities_1.applyTemplatesWithOverwrite(tree, 'templates', {
15
+ name: directoryName
16
+ }, `${(pathToSourceRoot.join('/'))}`);
17
+ // return chain([placeModuleFiles])(tree, context);
18
+ };
19
+ }
20
+ exports.bootstrapPlaces = bootstrapPlaces;
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-bootstrap/index.ts"],"names":[],"mappings":";;;AACA,oEAA0E;AAC1E,kDAA+C;AAI/C,SAAgB,eAAe,CAAC,QAAgB;IAE9C,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAE/C,MAAM,SAAS,GAAG,qBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEhE,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtD,MAAM,kBAAkB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACpE,MAAM,gBAAgB,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAElF,OAAO,gDAA2B,CAChC,IAAI,EACJ,WAAW,EACX;YACE,IAAI,EAAE,aAAa;SACpB,EACD,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAClC,CAAC;QAEF,mDAAmD;IACrD,CAAC,CAAC;AAEJ,CAAC;AAxBD,0CAwBC"}
@@ -0,0 +1,4 @@
1
+ export interface Schema {
2
+ project: string;
3
+ path: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/place-bootstrap/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "id": "AddPlaceSchematic",
4
+ "type": "object",
5
+ "description": "Add a new place component",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The name of the project.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ },
14
+ "path": {
15
+ "type": "string",
16
+ "description": "The directory path to bootstrap relative to <project-root>/src/app.",
17
+ "$default": {
18
+ "$source": "argv",
19
+ "index": 0
20
+ },
21
+ "x-prompt": "What is the path to the place root directory?"
22
+ }
23
+ },
24
+ "required": [
25
+ "project",
26
+ "path"
27
+ ]
28
+ }
@@ -15,7 +15,6 @@ export declare class PlaceBuilder {
15
15
  loadTypeScriptProject(): Project;
16
16
  process(tree: Tree): Rule;
17
17
  private renderTemplates;
18
- private parseConfig;
19
18
  private extractPlaceDefinitions;
20
19
  private buildPlaceHierarchy;
21
20
  }
@@ -3,9 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlaceBuilder = void 0;
4
4
  const core_1 = require("@angular-devkit/core");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
- const JSON5 = require("json5");
6
+ const path = require("path");
7
7
  const ts_morph_1 = require("ts-morph");
8
8
  const place_def_1 = require("./place-def");
9
+ // interface Config {
10
+ // authGuard: ClassImport;
11
+ // }
12
+ // interface PlaceRoot {
13
+ // dir: string,
14
+ // }
15
+ const noopRule = (tree, context) => tree;
9
16
  class PlaceBuilder {
10
17
  constructor(options, workspace, context) {
11
18
  this.options = options;
@@ -36,15 +43,16 @@ class PlaceBuilder {
36
43
  }
37
44
  process(tree) {
38
45
  const placeRoots = [];
39
- tree.getDir(this.sourceRoot).visit((filePath, entry) => {
40
- if (filePath.endsWith('places.json') || filePath.endsWith('places.json5')) {
41
- const dir = filePath.substr(0, filePath.lastIndexOf('/'));
42
- placeRoots.push({ dir, config: this.parseConfig(entry.content.toString('utf-8')) });
46
+ placeRoots.push(this.options.dir); // todo support multiple place roots on a single run.
47
+ const rules = placeRoots.map(r => path.join(this.sourceRoot, r)).map(placeRoot => {
48
+ const placeDefs = this.extractPlaceDefinitions(tree, placeRoot);
49
+ if (placeDefs.length < 1) {
50
+ this.context.logger.info(`No places found in ${placeRoot}`);
51
+ return noopRule;
52
+ }
53
+ else {
54
+ return this.renderTemplates(placeRoot, placeDefs, tree);
43
55
  }
44
- });
45
- const rules = placeRoots.map(placeRoot => {
46
- const placeDefs = this.extractPlaceDefinitions(tree, placeRoot.dir);
47
- return this.renderTemplates(placeRoot, placeDefs, tree);
48
56
  });
49
57
  return schematics_1.chain(rules);
50
58
  }
@@ -52,8 +60,8 @@ class PlaceBuilder {
52
60
  // this.context.logger.info(`${this.workspaceProject.sourceRoot}/${this.projectType}`);
53
61
  // this.context.logger.info(placeRoot.dir);
54
62
  const files = schematics_1.apply(schematics_1.url('./templates'), [
55
- schematics_1.applyTemplates(Object.assign(Object.assign(Object.assign({}, this.options), { config: placeRoot.config, placeDefs }), core_1.strings)),
56
- schematics_1.move(`${placeRoot.dir}`),
63
+ schematics_1.applyTemplates(Object.assign(Object.assign(Object.assign({}, this.options), { placeDefs }), core_1.strings)),
64
+ schematics_1.move(`${placeRoot}`),
57
65
  // @see https://github.com/angular/angular-cli/issues/11337#issuecomment-448259549
58
66
  schematics_1.forEach((fileEntry) => {
59
67
  this.context.logger.info(fileEntry.path);
@@ -65,19 +73,21 @@ class PlaceBuilder {
65
73
  ]);
66
74
  return schematics_1.mergeWith(files);
67
75
  }
68
- parseConfig(configString) {
69
- const rawConfig = JSON5.parse(configString);
70
- const config = {
71
- authGuard: Object.assign({ className: 'NoopAuthGuard', importPath: '@coolon/angular-ui-powerups' }, rawConfig.authGuard)
72
- };
73
- this.context.logger.info(`config: ${JSON5.stringify(config)}`);
74
- return config;
75
- }
76
- extractPlaceDefinitions(tree, placeRoot) {
77
- const importPrefix = `./${placeRoot}`;
76
+ // private parseConfig(configString: string): Config {
77
+ // const rawConfig = JSON5.parse(configString);
78
+ // const config:Config = {
79
+ // authGuard: {
80
+ // className: 'NoopAuthGuard', importPath: '@coolon/angular-ui-powerups', ...rawConfig.authGuard
81
+ // }
82
+ // };
83
+ // this.context.logger.info(`config: ${JSON5.stringify(config)}`);
84
+ // return config;
85
+ // }
86
+ extractPlaceDefinitions(tree, placeRootPath) {
78
87
  const placeDefs = [];
79
- this.context.logger.info(`Scanning sources in -> ${placeRoot}`);
80
- tree.getDir(placeRoot).visit(filePath => {
88
+ this.context.logger.info(`Scanning sources in -> ${placeRootPath}`);
89
+ const placeRootDir = tree.getDir(placeRootPath);
90
+ placeRootDir.visit(filePath => {
81
91
  if (!filePath.endsWith('.ts') || filePath.endsWith('.spec.ts')) {
82
92
  return;
83
93
  }
@@ -93,7 +103,7 @@ class PlaceBuilder {
93
103
  const imports = sourceFile.getImportDeclarations();
94
104
  sourceFile.getClasses().forEach((classDecl) => {
95
105
  place_def_1.PlaceDef.scan(sourceFile, classDecl, this.context).onMatch(result => {
96
- const moduleImportPath = `.${filePath.substr(placeRoot.length, filePath.length - placeRoot.length - '.ts'.length)}`;
106
+ const moduleImportPath = `.${filePath.substr(placeRootDir.path.length, filePath.length - placeRootDir.path.length - '.ts'.length)}`;
97
107
  const definition = result.createDefinition(moduleImportPath);
98
108
  this.context.logger.info(`${classDecl.getName()}(route: /${definition.fullPath}) -> ${moduleImportPath}`);
99
109
  placeDefs.push(definition);