-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dandi/model-builder): use
localTokenFactory
- Loading branch information
1 parent
ae207b5
commit 3ccb202
Showing
6 changed files
with
10 additions
and
17 deletions.
There are no files selected for viewing
Empty file.
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,10 +1,3 @@ | ||
import { InjectionOptions, InjectionToken, OpinionatedToken, SymbolToken } from '@dandi/core' | ||
import { localTokenFactory } from '@dandi/core' | ||
|
||
export const PKG = '@dandi/model-builder' | ||
|
||
export function localSymbolToken<T>(target: string): InjectionToken<T> { | ||
return SymbolToken.local<T>(PKG, target) | ||
} | ||
export function localOpinionatedToken<T>(target: string, options: InjectionOptions): InjectionToken<T> { | ||
return OpinionatedToken.local<T>(PKG, target, options) | ||
} | ||
export const localToken = localTokenFactory('@dandi/model-builder') |
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
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
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,12 +1,12 @@ | ||
import { InjectionToken } from '@dandi/core' | ||
import { MemberMetadata } from '@dandi/model' | ||
|
||
import { localOpinionatedToken } from './local-token' | ||
import { localToken } from './local-token' | ||
|
||
export interface ModelValidator { | ||
validateMember(metadata: MemberMetadata, key: string, value: any): void | ||
} | ||
|
||
export const ModelValidator: InjectionToken<ModelValidator> = localOpinionatedToken('ModelValidator', { | ||
export const ModelValidator: InjectionToken<ModelValidator> = localToken.opinionated('ModelValidator', { | ||
multi: true, | ||
}) |
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