|
| 1 | +/* This is a mst-gql generated file, don't modify it manually */ |
| 2 | +/* eslint-disable */ |
| 3 | +import { types } from "mobx-state-tree" |
| 4 | +import { MSTGQLStore, configureStoreMixin } from "mst-gql" |
| 5 | + |
| 6 | +import { TodoListModel } from "./TodoListModel" |
| 7 | +import { todoListModelPrimitives, TodoListModelSelector } from "./TodoListModel.base" |
| 8 | +import { BasicTodoModel } from "./BasicTodoModel" |
| 9 | +import { basicTodoModelPrimitives, BasicTodoModelSelector } from "./BasicTodoModel.base" |
| 10 | +import { FancyTodoModel } from "./FancyTodoModel" |
| 11 | +import { fancyTodoModelPrimitives, FancyTodoModelSelector } from "./FancyTodoModel.base" |
| 12 | + |
| 13 | +import { todoModelPrimitives, TodoModelSelector } from "./" |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +/** |
| 21 | +* Store, managing, among others, all the objects received through graphQL |
| 22 | +*/ |
| 23 | +export const RootStoreBase = MSTGQLStore |
| 24 | + .named("RootStore") |
| 25 | + .extend(configureStoreMixin([['TodoList', () => TodoListModel], ['BasicTodo', () => BasicTodoModel], ['FancyTodo', () => FancyTodoModel]], ['TodoList', 'BasicTodo', 'FancyTodo'], "js")) |
| 26 | + .props({ |
| 27 | + todoLists: types.optional(types.map(types.late(() => TodoListModel)), {}), |
| 28 | + basicTodos: types.optional(types.map(types.late(() => BasicTodoModel)), {}), |
| 29 | + fancyTodos: types.optional(types.map(types.late(() => FancyTodoModel)), {}) |
| 30 | + }) |
| 31 | + .actions(self => ({ |
| 32 | + queryTodoLists(variables, resultSelector = todoListModelPrimitives.toString(), options = {}) { |
| 33 | + return self.query(`query todoLists { todoLists { |
| 34 | + ${typeof resultSelector === "function" ? resultSelector(new TodoListModelSelector()).toString() : resultSelector} |
| 35 | + } }`, variables, options) |
| 36 | + }, |
| 37 | + })) |
0 commit comments