chore: rename source to linkable in defineLink options (#8016)

* chore: rename source to linkable in defineLink options

* rm unused const
This commit is contained in:
Adrien de Peretti
2024-07-08 16:44:03 +02:00
committed by GitHub
parent fc7f5ff71a
commit 10848c8bf2
2 changed files with 90 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ type InputToJson = {
type CombinedSource = Record<any, any> & InputToJson
type InputOptions = {
source: CombinedSource | InputSource
linkable: CombinedSource | InputSource
isList?: boolean
}
@@ -52,7 +52,7 @@ type ModuleLinkableKeyConfig = {
}
function isInputOptions(input: any): input is InputOptions {
return isObject(input) && "source" in input
return isObject(input) && "linkable" in input
}
function isInputSource(input: any): input is InputSource {
@@ -82,9 +82,9 @@ export function defineLink(
module: source.serviceName,
}
} else if (isInputOptions(leftService)) {
const source = isToJSON(leftService.source)
? leftService.source.toJSON()
: leftService.source
const source = isToJSON(leftService.linkable)
? leftService.linkable.toJSON()
: leftService.linkable
serviceAObj = {
key: source.linkable,
@@ -108,9 +108,9 @@ export function defineLink(
module: source.serviceName,
}
} else if (isInputOptions(rightService)) {
const source = isToJSON(rightService.source)
? rightService.source.toJSON()
: rightService.source
const source = isToJSON(rightService.linkable)
? rightService.linkable.toJSON()
: rightService.linkable
serviceBObj = {
key: source.linkable,