yarn install
yarn dynamo:install
// installs a local dynamo for use with the offline pluginyarn start
// starts up the offline server with all 4 lambdas- navigate to
http://localhost:4001/dev/gw
to start playing with the api
classDiagram
direction LR
Car "1" --> "*" Charger
Driver "*" -- "*" Car
Charger "*" <-- "1" Driver
- Charger 1 - * Car
classDiagram
direction LR
Car "1" --> "*" Charger
sequenceDiagram
Car.Req-->>+Car: Car Req
Car->>+CarTable: Get Car
CarTable-->>-Car: Car
Car->>+Charger.Car: Chargers by Car Id
Charger.Car->>+ChargerTable: Chargers by Car Id
ChargerTable-->>-Charger.Car: chargers
Charger.Car-->>-Car: Chargers
Car-->>-Car.Req: Car With Chargers
- ------------------------- CAR REQ {
"query": "query ONE_TO_MANY_CAR_CHARGERS__cars__0($ids:[ID]){cars(ids:$ids){__typename id name registrationNumber}}",
"variables": {
"ids": [
"1"
]
},
"operationName": "ONE_TO_MANY_CAR_CHARGERS__cars__0"
}
- ------------------------- CAR - CARS
- ------------------------- CHARGER REQ {
"query": "query ONE_TO_MANY_CAR_CHARGERS__chargers__1($representations:[_Any!]!){_entities(representations:$representations){...on Car{chargers{id productName}}}}",
"variables": {
"representations": [
{
"__typename": "Car",
"id": "1"
}
]
},
"operationName": "ONE_TO_MANY_CAR_CHARGERS__chargers__1
}
-
- 2 ----------------------- CHARGER -> CAR - CHARGERS 1
- Car * - 1 Charger
classDiagram
direction LR
Charger "*" --> "1" Car
sequenceDiagram
Charger.Req->>+Charger: Charger Request
Charger->>+ChargerTable: Get Charger
ChargerTable-->>-Charger: Charger with Car id
Charger-->>Charger: Car Ref ( type/id )
Charger->>+Car._resolveRefernce: Car Req
Car._resolveRefernce-->>-Charger: Resolved Car
Charger-->>-Charger.Req: Chargers with Car
-
------------------------- CHARGER REQ { "query": "query MANY_TO_ONE_CAR_CHARGER__chargers__0($ids:[ID]){chargers(ids:$ids){id productName car{__typename id}}}", "variables": { "ids": [ "1" ] }, "operationName": "MANY_TO_ONE_CAR_CHARGER__chargers__0" }
- ----------------------- CHARGER - CHARGERS
- ------------------------- CHARGER - CAR 1
------------------------- CAR REQ {
"query": "query MANY_TO_ONE_CAR_CHARGER__cars__1($representations:[_Any!]!){_entities(representations:$representations){...on Car{registrationNumber}}}",
"variables": {
"representations": [
{
"__typename": "Car",
"id": "1"
}
]
},
"operationName": "MANY_TO_ONE_CAR_CHARGER__cars__1"
}
- ####### Resolve Car { __typename: 'Car', id: '1' }
- Car * - * Driver
classDiagram
direction LR
Car "*" --> "*" Driver
sequenceDiagram
Car.Req->>+Car: Car Request
Car->>+CarTable: Get Car
CarTable-->>-Car: Car with driver ids
Car-->>Car: Drivers Resolver return Refs ( type/id )
Car->>+Driver._resolveRefernce: Driver Req
Driver._resolveRefernce-->>-Car: Resolved Drivers
Car-->>-Car.Req: Cars with Drivers
- ------------------------- CAR REQ {
"query": "query MANY_TO_MANY_CAR_DRIVER__cars__0($ids:[ID]){cars(ids:$ids){id name registrationNumber drivers{__typename id}}}",
"variables": {
"ids": [
"1"
]
},
"operationName": "MANY_TO_MANY_CAR_DRIVER__cars__0"
}
- ------------------------- CAR - CARS
- ------------------------- CAR - DRIVERS
- ------------------------- DRIVER REQ {
"query": "query MANY_TO_MANY_CAR_DRIVER__drivers__1($representations:[_Any!]!){_entities(representations:$representations){...on Driver{email}}}",
"variables": {
"representations": [
{
"__typename": "Driver",
"id": "1"
},
{
"__typename": "Driver",
"id": "2"
}
]
},
"operationName": "MANY_TO_MANY_CAR_DRIVER__drivers__1"
}
- ####### Resolve Drivers { __typename: 'Driver', id: '1' }
- ####### Resolve Drivers { __typename: 'Driver', id: '2' }
- !!!!!!!!!!! load drivers [ '1', '2' ] -- Dataloader