-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(navigation): add token for providing navigation in-memory seed d…
…ata (#2627)
- Loading branch information
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export { DaffInMemoryBackendNavigationService } from './backend/navigation.service'; | ||
export { DaffInMemoryNavigationService } from './navigation.service'; | ||
export { DaffNavigationInMemoryDriverModule } from './navigation-driver.module'; | ||
|
||
export * from './seed-data-provider/public_api'; |
2 changes: 2 additions & 0 deletions
2
libs/navigation/driver/in-memory/src/seed-data-provider/public_api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { DaffNavigationInMemorySeedDataProvider } from './type'; | ||
export * from './token'; |
21 changes: 21 additions & 0 deletions
21
libs/navigation/driver/in-memory/src/seed-data-provider/token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
InjectionToken, | ||
ValueProvider, | ||
} from '@angular/core'; | ||
|
||
import { DaffNavigationInMemorySeedDataProvider } from './type'; | ||
|
||
/** | ||
* A token for providing a way for the navigation in-memory driver to seed its data from an external source. | ||
*/ | ||
export const DAFF_NAVIGATION_IN_MEMORY_SEED_DATA_PROVIDER = new InjectionToken<DaffNavigationInMemorySeedDataProvider>('DAFF_NAVIGATION_IN_MEMORY_SEED_DATA_PROVIDER'); | ||
|
||
/** | ||
* Provides {@link DAFF_NAVIGATION_IN_MEMORY_SEED_DATA_PROVIDER}. | ||
*/ | ||
export function daffProvideNavigationInMemorySeedDataProvider(provider: DaffNavigationInMemorySeedDataProvider): ValueProvider { | ||
return { | ||
provide: DAFF_NAVIGATION_IN_MEMORY_SEED_DATA_PROVIDER, | ||
useValue: provider, | ||
}; | ||
} |
6 changes: 6 additions & 0 deletions
6
libs/navigation/driver/in-memory/src/seed-data-provider/type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { DaffNavigationTree } from '@daffodil/navigation'; | ||
|
||
/** | ||
* A function that fetches and returns the root navigation tree for the in-memory driver. | ||
*/ | ||
export type DaffNavigationInMemorySeedDataProvider = () => DaffNavigationTree; |