-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Inverted config option `atomicNumberOperations` to `noAtomicNumberOperations` Replace `atomicNumberOperations = false` by `noAtomicNumberOperations = true`
- Loading branch information
Showing
18 changed files
with
77 additions
and
76 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
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
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
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,32 +1,18 @@ | ||
import { PrismaDMMF } from '../types'; | ||
import { GeneratorConfiguration, InputType } from '../types'; | ||
import { combineScalarFilters } from './combine-scalar-filters'; | ||
import { noAtomicNumberOperations } from './no-atomic-number-operations'; | ||
import { renameZooTypes } from './rename-zoo-types'; | ||
|
||
type MutateFiltersOptions = { | ||
atomicNumberOperations?: boolean; | ||
combineScalarFilters?: boolean; | ||
renameZooTypes?: boolean; | ||
}; | ||
export function mutateFilters(inputTypes: InputType[], config: GeneratorConfiguration) { | ||
if (config.combineScalarFilters) { | ||
inputTypes = inputTypes.map(combineScalarFilters(inputTypes)); | ||
} | ||
if (config.noAtomicNumberOperations) { | ||
inputTypes = inputTypes.filter(noAtomicNumberOperations()); | ||
} | ||
if (config.renameZooTypes) { | ||
inputTypes = inputTypes.map(renameZooTypes(inputTypes)); | ||
} | ||
|
||
export function mutateFilters( | ||
inputTypes: PrismaDMMF.InputType[], | ||
options: MutateFiltersOptions, | ||
) { | ||
const mutations = [ | ||
options.combineScalarFilters && combineScalarFilters(inputTypes), | ||
!options.atomicNumberOperations && noAtomicNumberOperations(), | ||
options.renameZooTypes && renameZooTypes(inputTypes), | ||
].filter(Boolean); | ||
|
||
return function (inputType: PrismaDMMF.InputType) { | ||
for (const mutation of mutations) { | ||
const result = mutation && mutation(inputType); | ||
if (!result) { | ||
return false; | ||
} | ||
inputType = result; | ||
} | ||
return inputType; | ||
}; | ||
return inputTypes; | ||
} |
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
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
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
Oops, something went wrong.