Merge pull request #209 from Superalgos/develop

Development progress update for demo node
This commit is contained in:
benme authored and GitHub committed 2019-04-10 19:37:28 +02:00
commit 8812d5e1c4
21 files changed
+10039 -7465

No files matched your search

+2
View File
@@ -12,3 +12,5 @@ npm-debug.log*
#Mac specific files
.DS_Store
client/package-lock.json
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = (api) => {
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
'dynamic-import-node',
'@babel/plugin-transform-runtime'
['@babel/plugin-transform-runtime', { useESModules: true }]
]
return {
+9 -4
View File
@@ -20,6 +20,7 @@
function loadCanvas(){
if (window.canvasApp.visible === undefined) {
window.canvasApp = {
version: '1.0.0', // This is used to avoid catching problems at the browser level.
sessionToken: '',
executingAt: 'Master App',
visible: false,
@@ -31,9 +32,13 @@
context: {}
};
let delay = 0
if (window.innerHeight === 0) {delay = 3000} // Inside IFRAMES the onload event is reaised before the window has its real size.
setTimeout(loadAdvancedAlgosPlatform, delay)
try {
loadAdvancedAlgosPlatform();
}
catch(err) {
console.log("[ERROR] MasterApp -> Index -> CanvasApp can not be started. Please check that AAWeb is running.");
console.log("[ERROR] MasterApp -> Index -> err = " + err);
}
}
}
@@ -45,7 +50,7 @@
</script>
</head>
<body id="body" onload="loadCanvas()" onresize="onResize()">
<body id="body" onload="" onresize="onResize()">
<div id="masterApp"></div>
<div id="canvasApp"></div>
</body>
+9612 -7354
View File
File diff suppressed because it is too large. Load diff
+13 -10
View File
@@ -1,6 +1,6 @@
{
"name": "master-app-client",
"version": "0.1.3",
"version": "0.1.4",
"description": "Responsible for loading all web modules and running them.",
"main": "src/index.js",
"scripts": {
@@ -25,19 +25,22 @@
},
"homepage": "https://github.com/Algoteers/MasterApp#readme",
"devDependencies": {
"@advancedalgos/events-client": "0.0.4",
"@advancedalgos/financial-beings-client": "0.0.5",
"@superalgos/operations-client": "0.0.13",
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@superalgos/key-vault-client": "0.0.26",
"@superalgos/teams-client": "0.0.33",
"@superalgos/cockpit-client": "0.0.4",
"@superalgos/events-client": "0.0.2",
"@superalgos/key-vault-client": "0.0.32",
"@superalgos/logs-client": "0.0.1",
"@superalgos/operations-client": "0.0.31",
"@superalgos/strategizer-client": "0.0.11",
"@superalgos/teams-client": "0.0.35",
"@superalgos/users-client": "0.0.25",
"@superalgos/web-components": "0.0.18",
"@superalgos/web-components": "0.0.19",
"autoprefixer": "^9.2.0",
"babel-loader": "^8.0.4",
"babel-preset-flow": "6.23.0",
@@ -84,7 +87,7 @@
"@material-ui/core": "^3.6.2",
"@material-ui/icons": "^3.0.1",
"apollo-cache-inmemory": "^1.3.5",
"apollo-client": "^2.4.2",
"apollo-client": "^2.5.1",
"apollo-link": "^1.2.3",
"apollo-link-context": "^1.0.9",
"apollo-link-error": "^1.1.1",
@@ -100,9 +103,9 @@
"optimize-css-assets-webpack-plugin": "^5.0.1",
"prop-types": "^15.6.2",
"query-string": "^6.2.0",
"react": "^16.6.1",
"react-apollo": "^2.2.4",
"react-dom": "^16.6.1",
"react": "^16.8.4",
"react-apollo": "^2.5.2",
"react-dom": "^16.8.4",
"react-redux": "^5.1.0",
"react-router-dom": "^4.3.1",
"redux": "^4.0.1",
+20 -4
View File
@@ -16,10 +16,14 @@ import { Layout, Home, Charts, Callback, EmailSignupConfirm } from './views'
import Users from '@superalgos/users-client'
import Teams from '@superalgos/teams-client'
import Events from '@advancedalgos/events-client'
import Events from '@superalgos/events-client'
import KeyVault from '@superalgos/key-vault-client'
import FinancialBeings from '@advancedalgos/financial-beings-client'
import Operations from '@superalgos/operations-client'
import Strategizer from '@superalgos/strategizer-client'
import Logs from '@superalgos/logs-client'
// import Miners from '@superalgos/miners-client'
import Cockpit from '@superalgos/cockpit-client'
export const auth = new Auth(
result => console.log('Authentication successful.'),
@@ -71,16 +75,28 @@ export const MasterApp = props => (
/>
<Route
path='/financial-beings'
render={props => <FinancialBeings {...props} auth={auth}/>}
render={props => <FinancialBeings {...props} auth={auth} />}
/>
<Route
path='/key-vault'
path='/keys'
render={props => <KeyVault {...props} auth={auth} />}
/>
<Route
path='/operations'
path='/clones'
render={props => <Operations {...props} auth={auth} />}
/>
<Route
path='/strategizer'
render={props => <Strategizer {...props} auth={auth} />}
/>
<Route
path='/logs'
render={props => <Logs {...props} auth={auth} />}
/>
<Route
path='/cockpit'
render={props => <Cockpit {...props} auth={auth} />}
/>
</Switch>
</Layout>
</MuiThemeProvider>
+10 -4
View File
@@ -32,7 +32,7 @@ const VERIFY_TEAM_INVITE = gql`
export const defaultOptions = {
oidcConformant: true,
autoclose: true,
allowedConnections: ['Username-Password-Authentication'],
allowedConnections: ['Username-Password-Authentication', 'github'],
auth: {
sso: true,
redirectUrl: window.location.origin + '/callback',
@@ -49,13 +49,14 @@ export const defaultOptions = {
languageDictionary: {
title: 'Superalgos Platform'
},
avatar:null
avatar: null,
mustAcceptTerms: true
}
export const inviteOptions = {
oidcConformant: true,
autoclose: false,
allowedConnections: ['Username-Password-Authentication'],
allowedConnections: ['Username-Password-Authentication', 'github'],
allowShowPassword: true,
auth: {
sso: false,
@@ -67,7 +68,12 @@ export const inviteOptions = {
scope: `email`
}
},
prefill: { email: '' }
prefill: { email: '' },
languageDictionary: {
title: 'Superalgos Platform'
},
avatar: null,
mustAcceptTerms: true
}
let lock = new Auth0Lock(
+1 -1
View File
@@ -66,7 +66,7 @@ const authLink = setContext((_, { headers }) => {
}
})
const cache = new InMemoryCache().restore(window.__APOLLO_STATE__)
const cache = new InMemoryCache({ addTypename: false }).restore(window.__APOLLO_STATE__)
const defaultOptions = {
watchQuery: {
+1 -1
View File
@@ -21,7 +21,7 @@ export const theme = createMuiTheme({
} // <--RUSTED_RED ~ GOLDEN_ORANGE --> #F0A202
},
typography: {
fontFamily: '"Saira","Saira Condenses", sans-serif',
fontFamily: '"Saira","Saira Condensed", sans-serif',
useNextVariants: true
},
overrides: {
+4
View File
@@ -444,3 +444,7 @@ header.menu{
-webkit-transform: rotate(-135deg);
}
}
h1, h2, h3, h4, h5, h6, p, a, ul li, ol li, blockquote {
font-family: "Saira","Saira Condensed", sans-serif;
}
+4
View File
@@ -25,6 +25,10 @@ const styles = theme => ({
class Charts extends Component {
componentDidMount () {
if (window.canvasApp.visible === undefined) {
loadCanvas() // This happens only once.
}
window.canvasApp.visible = true
let body = document.getElementById('body')
body.style = 'margin: 0px; padding: 0px; border: 0px; overflow:hidden;'
@@ -35,6 +35,7 @@ export const LoggedIn = props => {
<ul className='subMenu'>
<li><Link to='/users/user' onClick={() => closeAll()}> Your Profile </Link></li>
<li><a href='#' onClick={() => auth.logout()}> Logout </a></li>
<li><a href='https://www.superalgos.org/documentation-quick-start.shtml'> Docs </a></li>
<li><a href='https://superalgos.org'> Exit Platform </a></li>
</ul>
</li>
+50 -19
View File
@@ -7,10 +7,10 @@ import {
BugReport,
People,
Group,
// Adb,
VpnKey,
Home,
AddCircleOutline
AddCircleOutline,
ViewModule
} from '@material-ui/icons'
const usersMenus = {
@@ -43,55 +43,86 @@ const eventsMenus = {
icon: Home,
submenus: [
{ title: 'Directory', to: '/events', icon: ImportContacts },
{ title: 'Your events', to: '/events/my', icon: GamepadRounded, authenticated: true },
{ title: 'Your hosted events', to: '/events/host', icon: AccessibilityNew, authenticated: true },
{ title: 'Host an event', to: '/events/create', icon: LibraryAdd, authenticated: true },
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/UsersModule/issues/new', icon: BugReport, externalLink: true }
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/EventsClientModule/issues/new', icon: BugReport, externalLink: true }
]
}
const keyvaultMenus = {
title: 'Key Vault',
to: '/key-vault',
title: 'Keys',
to: '/keys',
icon: Home,
authenticated: true,
submenus: [
{ title: 'Your keys', to: '/key-vault/browse', icon: VpnKey },
{ title: 'Add key', to: '/key-vault/addKey', icon: AddCircleOutline },
{ title: 'Your keys', to: '/keys/browse', icon: VpnKey },
{ title: 'Add key', to: '/keys/addKey', icon: AddCircleOutline },
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/KeyVaultModule/issues/new', icon: BugReport, externalLink: true }
]
}
const operationsMenus = {
title: 'Operations',
to: '/operations',
title: 'Clones',
to: '/clones',
icon: Home,
authenticated: true,
submenus: [
{ title: 'Active clones', to: '/operations/browse', icon: ImportContacts },
{ title: 'History', to: '/operations/history', icon: LibraryAdd },
{ title: 'Clone a bot', to: '/operations/add', icon: AddCircleOutline },
{ title: 'Active Clones', to: '/clones/browse', icon: ImportContacts },
{ title: 'History Clones', to: '/clones/history', icon: LibraryAdd },
{ title: 'Create Clone', to: '/clones/add', icon: AddCircleOutline },
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/OperationsModule/issues/new', icon: BugReport, externalLink: true }
]
}
const financialBeingsMenus = {
title: 'FBs',
to: '/financial-beings',
const minersMenus = {
title: 'Miners',
to: '/miners',
icon: Home,
authenticated: false,
submenus: [
{ title: 'Directory', to: '/financial-beings', icon: ImportContacts }
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/minersClient/issues/new', icon: BugReport, externalLink: true }
]
}
const cockpitMenus = {
title: 'Cockpit',
to: '/cockpit',
icon: Home,
authenticated: true,
submenus: [
{ title: 'Signals', to: '/cockpit/signals', icon: GamepadRounded },
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/CockpitClientModule/issues/new', icon: BugReport, externalLink: true }
]
}
// const financialBeingsMenus = {
// title: 'FBs',
// to: '/financial-beings',
// icon: Home,
// authenticated: false,
// submenus: [
// { title: 'Directory', to: '/financial-beings', icon: ImportContacts }
// ]
// }
const strategizerMenus = {
title: 'Strategizer',
to: '/strategizer',
icon: Home,
authenticated: true,
submenus: []
}
const allMenus = [
usersMenus,
teamsMenus,
// eventsMenus,
eventsMenus,
// financialBeingsMenus,
keyvaultMenus,
operationsMenus
operationsMenus,
// minersMenus,
strategizerMenus,
cockpitMenus
]
export default allMenus
+37 -28
View File
@@ -13,6 +13,7 @@ import AALogo from '../../../assets/superalgos/Superalgos-logo-horz-dark.svg'
class Header extends Component {
constructor (props) {
super(props)
this.renderSubMenu = this.renderSubMenu.bind(this)
this.state = {
onTop: true,
mobileOpen: false,
@@ -84,37 +85,19 @@ class Header extends Component {
if (authenticated && !(this.state.user !== undefined && this.state.user !== null)) {
return
}
let cssChildren = submenus.length === 0 ? null : 'hasChildren';
return (
<li
onMouseEnter={() => this.toggleMenuOpen(index, bigScreen)}
onMouseLeave={() => this.mouseLeave(bigScreen)}
key={index}
className={openedMenu === index ? 'primaryLink hasChildren selected' : 'primaryLink hasChildren'}
className={openedMenu === index ? `primaryLink ${cssChildren} selected` : `primaryLink ${cssChildren}`}
>
{ bigScreen
? <Link to={to} onClick={() => this.toggleMenuOpen(index, true)}> {title} </Link>
: <a onClick={() => this.toggleMenuOpen(index, true)}> {title} </a>
}
<ul className='subMenu'>
{ bigScreen
? ''
: <li key={index + 'home'}><Link to={to}> <Icon /> Module Home Page </Link></li>
}
{
submenus.map(({ icon: SubIcon, to: subTo, title: subTitle, externalLink, authenticated: subAuthenticated }, subindex) => {
if (subAuthenticated && !(this.state.user !== undefined && this.state.user !== null)) {
return
}
if (externalLink) {
return (
<li key={subindex}><a href={subTo} target='_blank'> <SubIcon /> {subTitle} </a></li>
)
}
return (
<li key={subindex}><Link to={subTo} onClick={() => this.closeAll(index)}> <SubIcon /> {subTitle} </Link></li>
)
})}
</ul>
{this.renderSubMenu(Icon, to, title, submenus, authenticated, index, bigScreen)}
</li>
)
})
@@ -133,9 +116,6 @@ class Header extends Component {
<Link to='/charts'> Charts </Link>
</li>
{menus}
<li className='primaryLink'>
<a href='https://www.superalgos.org/documentation-quick-start.shtml'> Docs </a>
</li>
{this.state.user !== undefined && this.state.user !== null ? (
<LoggedIn
user={user}
@@ -147,10 +127,14 @@ class Header extends Component {
closeAll={() => this.closeAll()}
/>
) : (
<li className='primaryLink'>
<a href='#' onClick={() => auth.login()}> Login / Sign Up </a>
</li>
<React.Fragment>
<li className='primaryLink'>
<a href='https://www.superalgos.org/documentation-quick-start.shtml'> Docs </a>
</li>
<li className='primaryLink'>
<a href='#' onClick={() => auth.login()}> Login / Sign Up </a>
</li>
</React.Fragment>
)}
</ul>
</nav>
@@ -160,6 +144,31 @@ class Header extends Component {
</React.Fragment>
)
}
renderSubMenu(Icon, to, title, submenus, authenticated, index, bigScreen) {
return submenus.length === 0 ? null : (
<ul className='subMenu'>
{ bigScreen
? ''
: <li key={index + 'home'}><Link to={to}> <Icon /> Module Home Page </Link></li>
}
{ submenus.length > 0 &&
submenus.map(({ icon: SubIcon, to: subTo, title: subTitle, externalLink, authenticated: subAuthenticated }, subindex) => {
if (subAuthenticated && !(this.state.user !== undefined && this.state.user !== null)) {
return
}
if (externalLink) {
return (
<li key={subindex}><a href={subTo} target='_blank'> <SubIcon /> {subTitle} </a></li>
)
}
return (
<li key={subindex}><Link to={subTo} onClick={() => this.closeAll(index)}> <SubIcon /> {subTitle} </Link></li>
)
})}
</ul>
)
}
}
Header.propTypes = {
+3 -1
View File
@@ -18,7 +18,9 @@ module.exports = merge(commonConfig, {
},
devServer: {
historyApiFallback: true
historyApiFallback: {
disableDotRule: true
}
},
plugins: [
+5
View File
@@ -0,0 +1,5 @@
{
"name": "master-app",
"version": "0.1.3",
"lockfileVersion": 1
}
+36 -30
View File
@@ -8,7 +8,7 @@ import jwksRsa from 'jwks-rsa'
import axios from 'axios'
import { createTransformedRemoteSchema } from './createRemoteSchema'
import { teams, events } from './links'
import { teams, events, operations } from './links'
import logger from './logger'
@@ -70,15 +70,31 @@ async function run () {
'notifications_',
process.env.NOTIFICATIONS_API_URL,
process.env.NOTIFICATIONS_API_PRESHARED)
const transformedLogsSchema = await createTransformedRemoteSchema(
'logs_',
process.env.LOGS_API_URL,
process.env.LOGS_API_PRESHARED)
// const transformedMinersSchema = await createTransformedRemoteSchema(
// 'miners_',
// process.env.MINERS_API_URL,
// process.env.MINERS_PRESHARED)
const transformeStrategizerSchema = await createTransformedRemoteSchema(
'strategizer_',
process.env.STRATEGIZER_API_URL,
process.env.STRATEGIZER_API_PRESHARED)
const transformeCockpitSchema = await createTransformedRemoteSchema(
'cockpit_',
process.env.COCKPIT_API_URL,
process.env.COCKPIT_API_PRESHARED)
var schemas = []
var resolvers = {}
if (transformedTeamsSchema) {
schemas.push(transformedTeamsSchema)
if (transformedUsersSchema) {
if (transformedUsersSchema && transformedEventsSchema && transformeStrategizerSchema) {
schemas.push(teams.linkSchemaDefs)
resolvers = Object.assign(resolvers, teams.resolver(transformedUsersSchema))
resolvers = Object.assign(resolvers, teams.resolver(transformedUsersSchema, transformedEventsSchema, transformeStrategizerSchema))
}
}
if (transformedUsersSchema) {
@@ -86,9 +102,9 @@ async function run () {
}
if (transformedEventsSchema) {
schemas.push(transformedEventsSchema)
if (transformedUsersSchema && transformedTeamsSchema) {
if (transformedUsersSchema && transformedTeamsSchema && transformedOperationsSchema) {
schemas.push(events.linkSchemaDefs)
resolvers = Object.assign(resolvers, events.resolver(transformedUsersSchema, transformedTeamsSchema))
resolvers = Object.assign(resolvers, events.resolver(transformedUsersSchema, transformedTeamsSchema, transformedOperationsSchema))
}
}
if (transformedKeyVaultSchema) {
@@ -99,10 +115,23 @@ async function run () {
}
if (transformedOperationsSchema) {
schemas.push(transformedOperationsSchema)
if (transformedTeamsSchema && transformeCockpitSchema) {
schemas.push(operations.linkSchemaDefs)
resolvers = Object.assign(resolvers, operations.resolver(transformedTeamsSchema, transformeCockpitSchema))
}
}
if (transformedNotificationsSchema) {
schemas.push(transformedNotificationsSchema)
}
if (transformedLogsSchema) {
schemas.push(transformedLogsSchema)
}
if (transformeStrategizerSchema) {
schemas.push(transformeStrategizerSchema)
}
if (transformeCockpitSchema) {
schemas.push(transformeCockpitSchema)
}
const schema = mergeSchemas({
schemas,
@@ -166,8 +195,8 @@ async function run () {
schema,
context,
formatError: error => {
logger.error(`An error ocurred inside a module: ${JSON.stringify(error)}`)
return error
logger.error('An error ocurred inside a module: %s', error.message)
return error.message
},
formatResponse: response => {
logger.debug('Response from Apollo Server: ' + response)
@@ -181,29 +210,6 @@ async function run () {
}
})
const whitelist = [
process.env.PROJECT_SITE_URL,
process.env.PLATFORM_URL,
process.env.GRAPHQL_API_URL,
process.env.TEAMS_API_URL,
process.env.USERS_API_URL,
process.env.EVENTS_API_URL,
process.env.KEYVAULT_API_URL,
process.env.FINANCIAL_BEINGS_API_URL,
process.env.NOTIFICATIONS_API_URL
]
const corsOptionsDelegate = (req, callback) => {
let corsOptions
if (whitelist.indexOf(req.header('Origin')) !== -1) {
corsOptions = { origin: true, credentials: true }
} else {
corsOptions = { origin: false, credentials: true }
}
callback(null, corsOptions)
}
// server.applyMiddleware({ app, cors: corsOptionsDelegate })
server.applyMiddleware({ app, cors: { origin: true, credentials: true, methods:'GET,PUT,POST,DELETE,OPTIONS'}})
app.listen(4100)
+126 -6
View File
@@ -3,12 +3,33 @@ export const linkSchemaDefs =
extend type events_Event {
host: users_User
}
extend type events_Event {
participatingAs: [teams_Team]
}
extend type events_Event {
canParticipateAs: [teams_Team]
}
extend type events_Inviter {
inviter: users_User
}
extend type events_Formula {
owner: users_User
}
extend type events_Plotter {
owner: users_User
}
extend type events_Participant {
team: teams_Team
participant: teams_Team
}
extend type events_Participant {
clone: operations_GetClones
}
extend type events_Invitation {
invitee: teams_Team
}
`
export const resolver = (usersSchema, teamsSchema) => ({
export const resolver = (usersSchema, teamsSchema, operationsSchema) => ({
events_Event: {
host: {
fragment: `fragment UserFragment on events_Event{hostId}`,
@@ -22,12 +43,111 @@ export const resolver = (usersSchema, teamsSchema) => ({
info
})
}
},
participatingAs: {
fragment: `fragment TeamFragment on events_Event{participatingAsId}`,
resolve ({participatingAsId : teamIds}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_TeamsByIds',
args: { teamIds },
context,
info
})
}
},
canParticipateAs: {
fragment: `fragment TeamFragment on events_Event{canParticipateAsId}`,
resolve ({canParticipateAsId : teamIds}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_TeamsByIds',
args: { teamIds },
context,
info
})
}
}
},
events_Inviter: {
inviter: {
fragment: `fragment UserFragment on events_Inviter{inviterId}`,
resolve ({inviter : id}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: usersSchema,
operation: 'query',
fieldName: 'users_User',
args: { id },
context,
info
})
}
}
},
events_Formula: {
owner: {
fragment: `fragment UserFragment on events_Formula{ownerId}`,
resolve ({owner : id}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: usersSchema,
operation: 'query',
fieldName: 'users_User',
args: { id },
context,
info
})
}
}
},
events_Plotter: {
owner: {
fragment: `fragment UserFragment on events_Plotter{ownerId}`,
resolve ({owner : id}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: usersSchema,
operation: 'query',
fieldName: 'users_User',
args: { id },
context,
info
})
}
}
},
events_Participant: {
team: {
fragment: `fragment TeamFragment on events_Participant{teamId}`,
resolve ({teamId}, args, context, info) {
participant: {
fragment: `fragment TeamFragment on events_Participant{participantId}`,
resolve ({participantId : teamId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_TeamById',
args: { teamId },
context,
info
})
}
},
clone: {
fragment: `fragment CloneFragment on events_Participant{operationId}`,
resolve ({operationId: cloneId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: operationsSchema,
operation: 'query',
fieldName: 'operations_GetClone',
args: { cloneId },
context,
info
})
}
}
},
events_Invitation: {
invitee: {
fragment: `fragment TeamFragment on events_Invitation{inviteeId}`,
resolve ({inviteeId : teamId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
@@ -38,7 +158,7 @@ export const resolver = (usersSchema, teamsSchema) => ({
})
}
}
}
},
})
export default { resolver, linkSchemaDefs }
+2 -1
View File
@@ -1,4 +1,5 @@
import teams from './teams'
import events from './events'
import operations from './operations'
export { teams, events }
export { teams, events, operations }
+60
View File
@@ -0,0 +1,60 @@
export const linkSchemaDefs =
`
extend type operations_GetClones {
team: teams_Team
}
extend type operations_GetClones {
bot: teams_FinancialBeings
}
extend type operations_Clone {
signals( orderStatus: String ): [cockpit_Signal]
}
`
export const resolver = (teamsSchema, cockpitSchema) => ({
operations_Clone: {
signals: {
fragment: `fragment SignalFragment on operations_Clone{id}`,
resolve ({id: cloneId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: cockpitSchema,
operation: 'query',
fieldName: 'cockpit_SignalsByCloneId',
args: { ...args, cloneId },
context,
info
})
}
}
},
operations_GetClones: {
team: {
fragment: `fragment TeamFragment on operations_GetClones{teamId}`,
resolve ({teamId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_TeamById',
args: { teamId },
context,
info
})
}
},
bot: {
fragment: `fragment TeamFragment on operations_GetClones{botId}`,
resolve ({botId: fbId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: teamsSchema,
operation: 'query',
fieldName: 'teams_FbByFbId',
args: { fbId },
context,
info
})
}
}
}
})
export default { resolver, linkSchemaDefs }
+42 -1
View File
@@ -3,9 +3,37 @@ export const linkSchemaDefs =
extend type teams_Team {
ownerUser: users_User
}
extend type teams_Team {
events(
hostId: String,
inviteeId: String,
minStartDate: Int,
maxStartDate: Int,
minEndDate: Int,
maxEndDate: Int
): [events_Event]
}
extend type teams_FinancialBeings {
strategy: strategizer_Strategy
}
`
export const resolver = (usersSchema) => ({
export const resolver = (usersSchema, eventsSchema, strategizerSchema) => ({
teams_FinancialBeings: {
strategy: {
fragment: `fragment StrategyFragment on teams_FinancialBeings{slug}`,
resolve ({slug: fbSlug}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: strategizerSchema,
operation: 'query',
fieldName: 'strategizer_StrategyByFb',
args: { fbSlug },
context,
info
})
}
}
},
teams_Team: {
ownerUser: {
fragment: `fragment UserFragment on teams_Team{owner}`,
@@ -19,6 +47,19 @@ export const resolver = (usersSchema) => ({
info
})
}
},
events: {
fragment: `fragment EventFragment on teams_Team{id}`,
resolve ({id: participantId}, args, context, info) {
return info.mergeInfo.delegateToSchema({
schema: eventsSchema,
operation: 'query',
fieldName: 'events_Events',
args: { ...args, participantId },
context,
info
})
}
}
}
})