-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ab-fix-invalid-urls
- Loading branch information
Showing
24 changed files
with
134 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ApolloClient } from '@apollo/client'; | ||
import { GetGlossaryNodeDocument, GetGlossaryNodeQuery } from '../../graphql/glossaryNode.generated'; | ||
|
||
export function removeTermFromGlossaryNode( | ||
client: ApolloClient<object>, | ||
glossaryNodeUrn: string, | ||
glossaryTermUrn: string, | ||
) { | ||
// Read the data from our cache for this query. | ||
const currData: GetGlossaryNodeQuery | null = client.readQuery({ | ||
query: GetGlossaryNodeDocument, | ||
variables: { urn: glossaryNodeUrn }, | ||
}); | ||
|
||
// Remove the term from the existing children set. | ||
const newTermChildren = { | ||
relationships: [ | ||
...(currData?.glossaryNode?.children?.relationships || []).filter( | ||
(relationship) => relationship.entity?.urn !== glossaryTermUrn, | ||
), | ||
], | ||
total: (currData?.glossaryNode?.children?.total || 1) - 1, | ||
}; | ||
|
||
// Write our data back to the cache. | ||
client.writeQuery({ | ||
query: GetGlossaryNodeDocument, | ||
variables: { urn: glossaryNodeUrn }, | ||
data: { | ||
glossaryNode: { | ||
...currData?.glossaryNode, | ||
children: newTermChildren, | ||
}, | ||
}, | ||
}); | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import ClassVar | ||
|
||
from avrogen.dict_wrapper import DictWrapper | ||
|
||
|
||
class _Aspect(DictWrapper): | ||
"""Base class for all aspects types. | ||
All codegened types inherit from DictWrapper, either directly or indirectly. | ||
Types that are aspects inherit directly from _Aspect. | ||
""" | ||
|
||
ASPECT_NAME: ClassVar[str] = None # type: ignore | ||
ASPECT_TYPE: ClassVar[str] = "default" | ||
ASPECT_INFO: ClassVar[dict] = None # type: ignore | ||
|
||
def __init__(self): | ||
if type(self) is _Aspect: | ||
# Ensure that it cannot be instantiated directly, as | ||
# per https://stackoverflow.com/a/7989101/5004662. | ||
raise TypeError( | ||
"_Aspect is an abstract class, and cannot be instantiated directly." | ||
) | ||
super().__init__() | ||
|
||
@classmethod | ||
def get_aspect_name(cls) -> str: | ||
return cls.ASPECT_NAME # type: ignore | ||
|
||
@classmethod | ||
def get_aspect_type(cls) -> str: | ||
return cls.ASPECT_TYPE | ||
|
||
@classmethod | ||
def get_aspect_info(cls) -> dict: | ||
return cls.ASPECT_INFO |
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 was deleted.
Oops, something went wrong.
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