This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as task from "fp-ts/lib/Task" | |
| type IObserve<T> = (newValue: T) => task.Task<any> | |
| type IIntercept<T> = (newValue: T) => task.Task<T> | |
| function createAtom<T>(initialValue: T) { | |
| let storedValue = initialValue | |
| let observers: IObserve<T>[] = [] | |
| let interceptors: IIntercept<T>[] = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extend type Order { | |
| pay(id: ID!, amount: Float!): Boolean | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { IType, IExtendedObservableMap } from "mobx-state-tree" | |
| import { IObservableArray } from "mobx" | |
| type StringContains<S extends string, L extends string> = ({ [K in S]: "true" } & { | |
| [key: string]: "false" | |
| })[L] | |
| interface IJSONSchemaBaseType { | |
| $schema?: string | |
| $id?: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type StringContains<S extends string, L extends string> = ({ [K in S]: "true" } & { | |
| [key: string]: "false" | |
| })[L] | |
| interface IJSONSchemaNumber { | |
| type: "number" | |
| } | |
| interface IJSONSchemaInteger { | |
| type: "integer" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as ts from "typescript" | |
| import * as fs from "fs" | |
| // given an import, returns if it imports the given module. | |
| function createModuleImportMatcher(moduleName: string){ | |
| return (node: ts.Node): node is ts.ImportDeclaration => | |
| ts.isImportDeclaration(node) && | |
| ts.isStringLiteral(node.moduleSpecifier) && | |
| node.moduleSpecifier.text === moduleName | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH mov_patologie AS ( | |
| SELECT | |
| hh_zcal_movvac.codditt, | |
| hh_zcal_movvac.mv_idcapo AS xx_idcapo, | |
| hh_zcal_testvac.tv_data AS xx_data, | |
| hh_zcal_movvac.mv_codpato AS xx_codpato | |
| FROM hh_zcal_movvac | |
| INNER JOIN hh_zcal_testvac | |
| ON hh_zcal_testvac.codditt = hh_zcal_movvac.codditt | |
| AND hh_zcal_testvac.tv_tipo = hh_zcal_movvac.mv_tipo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { inject } from "mobx-react"; | |
| import * as React from "react"; | |
| import { ObjectOmit } from "typelevel-ts"; // We <3 You gcanti | |
| function myInject<A, D extends keyof A>( | |
| mapStoreToProps: (store: any) => Pick<A, D>, | |
| component: React.ComponentType<A> | |
| ): React.SFC<ObjectOmit<A, D> & Partial<Pick<A, D>>>{ | |
| return inject(mapStoreToProps)(component as any) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is the store | |
| import fetch from 'node-fetch'; | |
| import { types } from 'mobx-state-tree'; | |
| const UserModel = types.model( | |
| 'UserModel', | |
| { | |
| name: types.string, | |
| bio: types.maybe(types.string), | |
| avatar: types.string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {createFactory, arrayOf, onPatch, getSnapshot, applySnapshot, onSnapshot, applyPatches, IModelFactory, unionOf, primitiveFactory} from 'mobx-state-tree' | |
| const Patch = createFactory({ | |
| op: '', | |
| path: '', | |
| value: '' | |
| }) | |
| function createForm(Factory){ | |
| const F = createFactory({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {computed, observable, IObservableArray, extras, BaseAtom, _, intercept, IArrayWillChange, IArrayWillSplice, observe, asFlat} from 'mobx' | |
| import {NodeType, NodeFactory, NodePatch} from '../core/interfaces' | |
| import {Node, getNode} from '../core/node' | |
| import {addHiddenFinalProp, createPatcher} from '../core/utils' | |
| interface ObservableArrayAdministration<T>{ | |
| values: T[] | |
| atom: BaseAtom | |
| updateArrayLength(oldLength: number, delta: number) | |
| } |