schema.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * The separator character to use before the type within the generated file's name. For
  45. * example, if you set the option to `.`, the file will be named `example.guard.ts`.
  46. */
  47. typeSeparator?: TypeSeparator;
  48. };
  49. export declare enum Implement {
  50. CanActivate = "CanActivate",
  51. CanActivateChild = "CanActivateChild",
  52. CanDeactivate = "CanDeactivate",
  53. CanMatch = "CanMatch"
  54. }
  55. /**
  56. * The separator character to use before the type within the generated file's name. For
  57. * example, if you set the option to `.`, the file will be named `example.guard.ts`.
  58. */
  59. export declare enum TypeSeparator {
  60. Empty = "-",
  61. TypeSeparator = "."
  62. }