The MetaMate community progressively models the abstract schema graph around real-world data. Following, a high-level perspective on how the asg emerges, and how it propagates through the stack.
graph TD
entities[entities] --> expansion[expansion]
actions[actions] --> expansion[expansion]
expansion[expansion] --> asg[asg]
asg[asg] --> |powers| metactl[metactl]
metactl[metactl aaaa] --> |generates| clientsdks[client sdks]
metactl[metactl aaaa] --> |generates| servicesdks[service sdks]
clientsdks[client sdks] --> |power| services[services]
clientsdks[client sdks] --> |power| clients[clients]
servicesdks[service sdks] --> |power| services[services]
asg[asg] --> |powers| metamate[MetaMate aaa]
clients[clients] --> |read/write| metamate[MetaMate aaa]
services[services] --> |read/write| metamate[MetaMate aaa]
metamate[MetaMate aaa] --> |reads/writes| services[services]
class metactl metactl-icon;
class metamate metamate-icon;
Entities
This stage defines core and domain-specific entity types, how they relate to one another and which ones are going to be exposed by endpoints. Core entity types are ClientAccount, ServiceAccount, and Service, to name a few. Domain-specific entities are HackerNewsActivity, Post, or PostFeed, for example. Currently, these entities are defined as code but are going to be served by MetaMates soon (see Roadmap).
Actions
The action stage defines endpoints that are hard to model in a CRUD fashion. Examples of this are the LookupService, AuthenticateClientAccount or VerifyToken endpoints.
Expansion
graph TD
entities[entities] --> expansion[expansion]
actions[actions] --> expansion[expansion]
expansion[expansion] --> asg[asg]
This stage processes the previously defined entity types, adds further fields to types, generates relation and relationship types, and composes generic types like SocialAccountFilter, SocialAccountSort, and SocialAccountSelect entities. The expansion stage further generates the communication bits of the asg on top of that. It adds generic types like GetSocialAccountsRequest, PostSocialAccountsRequest, PutSocialAccountsRequest, DeleteSocialAccountsRequest and the according Response counterparts for all exposed types, and connects them to endpoints.
graph TD
metactl[metactl aaaa] --> |generates| servicesdks[service sdks]
metactl[metactl aaaa] --> |generates| clientsdks[client sdks]
asg[asg] --> |powers| metactl[metactl]
class metactl metactl-icon;
metactl is MetaMate’s CLI. It relies on the asg to query MetaMate instances, to inspect nodes in the asg, and most importantly, to generate project tailored and typed SDKs.
graph TD
asg[asg] --> |powers| metamate[MetaMate aaa]
clients[clients] --> |read/write| metamate[MetaMate aaa]
services[services] --> |read/write| metamate[MetaMate aaa]
metamate[MetaMate aaa] --> |reads/writes| services[services]
class metamate metamate-icon;
The asg powers MetaMate’s internal and generic type representation system. MetaMate uses it to boot the communication stack, like composing the graphql schema and exposing a generic http/json based API. MetaMate furthermore enforces validation rules, defined by the asg.
Nodes
graph TD
root[root]
basictype[basictype]
endpoint[endpoint]
enum[enum]
type[type]
field[field]
path[path]
relation[relation]
The asg is composed of 8 different kinds of nodes. Nodes carry binary flags and are interconnected via edges.
Root
The Root node holds a reference to all other nodes. It’s the starting point when retrieving nodes or traversing the graph.
BasicType
BasicType nodes hold low-level types. They are predefined and constrained by the typing capabilities of various serialization formats. They currently consist of bool, int32, float64, and string.
graph TD
basictype[basictype]
Enum
Enum nodes represent a predefined set of string values.
graph TD
enum[enum]
Type
Type nodes define custom data structures.
graph LR
Type[Type] --> | For | Type0[Type]
Type[Type] --> | FilteredBy | Type0[Type]
Type[Type] --> | SortedBy | Type0[Type]
Type[Type] --> | SelectedBy | Type0[Type]
Type[Type] --> | Collection | Type0[Type]
Type[Type] --> | Request | Type0[Type]
Type[Type] --> | Response | Type0[Type]
Type[Type] --> | GetRequest | Type0[Type]
Type[Type] --> | GetCollection | Type0[Type]
Type[Type] --> | GetRelations | Type0[Type]
Type[Type] --> | GetResponse | Type0[Type]
Type[Type] --> | PipeRequest | Type0[Type]
Type[Type] --> | PipeResponse | Type0[Type]
Type[Type] --> | GetEndpoint | Type0[Type]
Type[Type] --> | PipeEndpoint | Type0[Type]
Type[Type] --> | For | Enum[Enum]
Type[Type] --> | ListKind | Enum[Enum]
Type[Type] --> | BelongsTo | Enum[Enum]
Type[Type] --> | Get | Endpoint[Endpoint]
Type[Type] --> | Pipe | Endpoint[Endpoint]
Type[Type] --> | Holds | Fields[Fields]
Type[Type] --> | EdgedByFields | Fields[Fields]
Type[Type] --> | EdgedByListFields | Fields[Fields]
Type[Type] --> | Holds | Relations[Relations]
Type[Type] --> | ToOneRelations | Types[Types]
Type[Type] --> | ToManyRelations | Types[Types]
Type[Type] --> | Misses | Types[Types]
Type[Type] --> | Dependencies | Types[Types]
Type[Type] --> | Dependencies | Enums[Enums]
Field
Field nodes are referenced by Type nodes and either hold BasicType, Enum or Type nodes.
graph TD
Field[Field] --> |Holds| BasicType[BasicType]
Field[Field] --> |Holds| Enum[Enum]
Field[Field] --> |For| Field[Field]
Field[Field] --> |RelatedTo| Field[Field]
Field[Field] --> |RelatedThrough| Relation[Relation]
Field[Field] --> |Holds| Type[Type]
Field[Field] --> |HeldBy| Type[Type]
Field[Field] --> |BelongsTo| Path[Path]
Relation
Relation nodes hold an active and a passive Path node.
graph TD
Relation[Relation] --> |NodeA| Type[Type]
Relation[Relation] --> |NodeB| Type[Type]
Relation[Relation] --> |Active| Path[Path]
Relation[Relation] --> |Passive| Path[Path]
Path
Path nodes are attached to Relation nodes and model either an active or passive relation path between Type nodes and specify a cardinality. Post mentions many SocialAccounts is an active, HackerNewsActivity mentioned by many Posts is it’s passive counterpart Path.
graph TD
Path[Path] --> |From| Type[Type]
Path[Path] --> |To| Type[Type]
Path[Path] --> |BelongsTo| Relation[Relation]
Endpoint
Endpoint nodes
graph TD
Endpoint[Endpoint] --> |For| Type[Type]
Endpoint[Endpoint] --> |Request| Type[Type]
Endpoint[Endpoint] --> |Response| Type[Type]
Endpoint[Endpoint] --> |Dependencies| Types[Types]
Endpoint[Endpoint] --> |Dependencies| Enums[Enums]