schema.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Creates a new route guard in your project. Route guards are used to control access to
  3. * parts of your application by checking certain conditions before a route is activated.
  4. * This schematic generates a new guard with the specified name, type, and options.
  5. */
  6. export type Schema = {
  7. /**
  8. * Creates the new guard files at the top level of the current project. If set to false, a
  9. * new folder with the guard's name will be created to contain the files.
  10. */
  11. flat?: boolean;
  12. /**
  13. * Generate the guard as a function instead of a class. Functional guards can be simpler for
  14. * basic scenarios.
  15. */
  16. functional?: boolean;
  17. /**
  18. * Specifies the type(s) of guard to create. You can choose one or more of the following:
  19. * `CanActivate` (controls access to a route), `CanActivateChild` (controls access to child
  20. * routes), `CanDeactivate` (asks for confirmation before leaving a route), `CanMatch`
  21. * (determines if a route can be matched).
  22. */
  23. implements?: Implement[];
  24. /**
  25. * The name for the new route guard. This will be used to create the guard's class and spec
  26. * files (e.g., `my-guard.guard.ts` and `my-guard.guard.spec.ts`).
  27. */
  28. name: string;
  29. /**
  30. * The path where the guard files should be created, relative to the current workspace. If
  31. * not provided, the guard will be created in the current directory.
  32. */
  33. path?: string;
  34. /**
  35. * The name of the project where the guard should be created. If not specified, the CLI will
  36. * determine the project from the current directory.
  37. */
  38. project: string;
  39. /**
  40. * Skip the generation of a unit test file `spec.ts` for the new guard.
  41. */
  42. skipTests?: boolean;
  43. };
  44. export declare enum Implement {
  45. CanActivate = "CanActivate",
  46. CanActivateChild = "CanActivateChild",
  47. CanDeactivate = "CanDeactivate",
  48. CanMatch = "CanMatch"
  49. }