Let plugins specify user types (#1365)

This modifies the pluginDeclaration so that it can specifiy user node
types. This will allow us to replace the TimelineCredConfig type with a
plugin collection instead.

It's expected that the user types will also be present in the node
types, although this isn't validated anywhere at present.

Test plan: `yarn flow`.
This commit is contained in:
Dandelion Mané 2019-09-10 19:09:01 +02:00 committed by GitHub
parent dbb31a586c
commit aecd2864bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,11 @@ export type PluginDeclaration = {|
+edgePrefix: EdgeAddressT,
+nodeTypes: $ReadOnlyArray<NodeType>,
+edgeTypes: $ReadOnlyArray<EdgeType>,
// Which node types represent user identities.
// Important for computing score and for display in the frontend.
// It's expected that the userTypes will also be included in the array of
// nodeTypes.
+userTypes: $ReadOnlyArray<NodeType>,
|};
export function combineTypes(

View File

@ -44,4 +44,5 @@ export const declaration: PluginDeclaration = deepFreeze({
nodeTypes: [inserterNodeType, machineNodeType],
edgePrefix: EdgeAddress.fromParts(["factorio"]),
edgeTypes: [assemblesEdgeType, transportsEdgeType],
userTypes: [],
});

View File

@ -85,4 +85,5 @@ export const declaration: PluginDeclaration = deepFreeze({
topicContainsPostEdgeType,
likesEdgeType,
],
userTypes: [userNodeType],
});

View File

@ -31,4 +31,5 @@ export const declaration: PluginDeclaration = deepFreeze({
edgePrefix: E.Prefix.base,
nodeTypes,
edgeTypes,
userTypes: [],
});

View File

@ -199,4 +199,5 @@ export const declaration: PluginDeclaration = deepFreeze({
edgePrefix: E.Prefix.base,
nodeTypes: nodeTypes,
edgeTypes: edgeTypes,
userTypes: [userNodeType],
});