WIP- last thing: Need to fix Point union

pull/519/head
Rick Carlino 2017-10-27 09:48:10 -05:00
parent 217b7f4823
commit 032152c143
13 changed files with 350 additions and 330 deletions

View File

@ -1,7 +1,7 @@
import { noop } from "lodash";
import { Everything } from "../interfaces";
import { location } from "./fake_state/location";
import { peripherals } from "./fake_state/peripherals";
import { peripherals as Peripheral } from "./fake_state/peripherals";
import { auth } from "./fake_state/token";
import { bot } from "./fake_state/bot";
import { config } from "./fake_state/config";
@ -17,7 +17,7 @@ export function fakeState(dispatcher: Function = noop): Everything {
dispatch: jest.fn(),
router: { push: jest.fn() },
location,
peripherals,
Peripheral,
auth,
bot,
config,

View File

@ -1,5 +1,5 @@
import { resourceReducer, emptyState } from "../resources/reducer";
import { TaggedResource, TaggedDevice } from "../resources/tagged_resources";
import { TaggedResource, TaggedDevice, TaggedPoint } from "../resources/tagged_resources";
import * as _ from "lodash";
import { Actions } from "../constants";
export function fakeDevice(): TaggedDevice {
@ -10,294 +10,303 @@ export function fakeDevice(): TaggedDevice {
"id": 415,
"name": "wispy-firefly-846"
},
"uuid": "device.415.0"
"uuid": "Device.415.0"
};
}
export let FAKE_RESOURCES: TaggedResource[] = [
{
"kind": "User",
"body": {
"id": 152,
"name": "FarmBot 1",
"email": "farmbot1@farmbot.io",
"created_at": "2017-09-03T20:01:40.336Z",
"updated_at": "2017-09-27T14:00:47.326Z",
},
"specialStatus": undefined,
"uuid": "users.152.44"
const tr1: TaggedResource = {
"kind": "User",
"body": {
"id": 152,
"name": "FarmBot 1",
"email": "farmbot1@farmbot.io",
"created_at": "2017-09-03T20:01:40.336Z",
"updated_at": "2017-09-27T14:00:47.326Z",
},
fakeDevice(),
{
"specialStatus": undefined,
"kind": "FarmEvent",
"body": {
"id": 21,
"start_time": "2017-05-22T05:00:00.000Z",
"end_time": "2017-05-30T05:00:00.000Z",
"repeat": 1,
"time_unit": "daily",
"executable_id": 23,
"executable_type": "Sequence",
"calendar": [
"2017-05-25T05:00:00.000Z",
"2017-05-26T05:00:00.000Z",
"2017-05-27T05:00:00.000Z",
"2017-05-28T05:00:00.000Z",
"2017-05-29T05:00:00.000Z"
]
},
"uuid": "farm_events.21.1"
"specialStatus": undefined,
"uuid": "User.152.44"
};
const tr2: TaggedResource = {
"specialStatus": undefined,
"kind": "FarmEvent",
"body": {
"id": 21,
"start_time": "2017-05-22T05:00:00.000Z",
"end_time": "2017-05-30T05:00:00.000Z",
"repeat": 1,
"time_unit": "daily",
"executable_id": 23,
"executable_type": "Sequence",
"calendar": [
"2017-05-25T05:00:00.000Z",
"2017-05-26T05:00:00.000Z",
"2017-05-27T05:00:00.000Z",
"2017-05-28T05:00:00.000Z",
"2017-05-29T05:00:00.000Z"
]
},
{
"specialStatus": undefined,
"kind": "FarmEvent",
"body": {
"id": 22,
"start_time": "2017-05-22T05:00:00.000Z",
"end_time": "2017-05-29T05:00:00.000Z",
"repeat": 2,
"time_unit": "daily",
"executable_id": 24,
"executable_type": "Sequence",
"calendar": [
"2017-05-26T05:00:00.000Z",
"2017-05-28T05:00:00.000Z"
]
},
"uuid": "farm_events.22.2"
},
{
"specialStatus": undefined,
"kind": "Image",
"body": {
"id": 415,
"device_id": 415,
"attachment_processed_at": undefined,
"updated_at": "2017-05-24T20:41:19.766Z",
"created_at": "2017-05-24T20:41:19.766Z",
"attachment_url": "https://placehold.it/640%3Ftext=Processing...",
"meta": {
"x": 928,
"y": 428,
"z": 144
}
},
"uuid": "images.415.3"
},
{
"specialStatus": undefined,
"kind": "Image",
"body": {
"id": 414,
"device_id": 415,
"attachment_processed_at": undefined,
"updated_at": "2017-05-24T20:41:19.691Z",
"created_at": "2017-05-24T20:41:19.691Z",
"attachment_url": "http://placehold.it/640%3Ftext=Processing...",
"meta": {
"x": 853,
"y": 429,
"z": 165
}
},
"uuid": "images.414.4"
},
{
"specialStatus": undefined,
"kind": "Peripheral",
"body": {
"id": 11,
"pin": 13,
"mode": 0,
"label": "LED"
},
"uuid": "peripherals.11.5"
},
{
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1392,
"created_at": "2017-05-24T20:41:19.804Z",
"updated_at": "2017-05-24T20:41:19.804Z",
"device_id": 415,
"meta": {
"uuid": "FarmEvent.21.1"
};
},
"name": "fenestrate-flower-3632",
"pointer_type": "Plant",
"radius": 46,
"x": 347,
"y": 385,
"z": 0,
"openfarm_slug": "radish"
},
"uuid": "points.1392.6"
const tr3: TaggedResource = {
"specialStatus": undefined,
"kind": "FarmEvent",
"body": {
"id": 22,
"start_time": "2017-05-22T05:00:00.000Z",
"end_time": "2017-05-29T05:00:00.000Z",
"repeat": 2,
"time_unit": "daily",
"executable_id": 24,
"executable_type": "Sequence",
"calendar": [
"2017-05-26T05:00:00.000Z",
"2017-05-28T05:00:00.000Z"
]
},
{
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1393,
"created_at": "2017-05-24T20:41:19.822Z",
"updated_at": "2017-05-24T20:41:19.822Z",
"device_id": 415,
"meta": {
"uuid": "FarmEvent.22.2"
};
},
"name": "alate-fire-7363",
"pointer_type": "Plant",
"radius": 36,
"x": 727,
"y": 376,
"z": 0,
"openfarm_slug": "garlic"
},
"uuid": "points.1393.7"
const tr4: TaggedResource = {
"specialStatus": undefined,
"kind": "Image",
"body": {
"id": 415,
"device_id": 415,
"attachment_processed_at": undefined,
"updated_at": "2017-05-24T20:41:19.766Z",
"created_at": "2017-05-24T20:41:19.766Z",
"attachment_url": "https://placehold.it/640%3Ftext=Processing...",
"meta": {
"x": 928,
"y": 428,
"z": 144
}
},
{
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1394,
"created_at": "2017-05-24T20:41:19.855Z",
"updated_at": "2017-05-24T20:41:19.855Z",
"device_id": 415,
"meta": {
"color": undefined,
"created_by": "plant-detection"
},
"name": "untitled",
"pointer_type": "GenericPointer",
"radius": 6,
"x": 1245,
"y": 637,
"z": 5
},
"uuid": "points.1394.8"
},
{
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1395,
"created_at": "2017-05-24T20:41:19.889Z",
"updated_at": "2017-05-24T20:41:19.889Z",
"device_id": 415,
"meta": {
"color": "gray",
"created_by": "plant-detection"
},
"name": "untitled",
"pointer_type": "GenericPointer",
"radius": 10,
"x": 490,
"y": 421,
"z": 5
},
"uuid": "points.1395.9"
},
{
"kind": "Point",
"specialStatus": undefined,
"body": {
"id": 1396,
"created_at": "2017-05-24T20:41:20.112Z",
"updated_at": "2017-05-24T20:41:20.112Z",
"device_id": 415,
"meta": {
"uuid": "images.415.3"
};
},
"name": "Slot One.",
"pointer_type": "ToolSlot",
"radius": 25,
"x": 10,
"y": 10,
"z": 10,
"tool_id": 14
},
"uuid": "points.1396.10"
const tr5: TaggedResource = {
"specialStatus": undefined,
"kind": "Image",
"body": {
"id": 414,
"device_id": 415,
"attachment_processed_at": undefined,
"updated_at": "2017-05-24T20:41:19.691Z",
"created_at": "2017-05-24T20:41:19.691Z",
"attachment_url": "http://placehold.it/640%3Ftext=Processing...",
"meta": {
"x": 853,
"y": 429,
"z": 165
}
},
{
"specialStatus": undefined,
"kind": "Regimen",
"body": {
"id": 11,
"name": "Test Regimen 456",
"uuid": "images.414.4"
};
const tr6: TaggedResource = {
"specialStatus": undefined,
"kind": "Peripheral",
"body": {
"id": 11,
"pin": 13,
"mode": 0,
"label": "LED"
},
"uuid": "peripherals.11.5"
};
const tr7: TaggedPoint = {
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1392,
"created_at": "2017-05-24T20:41:19.804Z",
"updated_at": "2017-05-24T20:41:19.804Z",
// "device_id": 415,
"meta": {
},
"name": "fenestrate-flower-3632",
"pointer_type": "Plant",
"radius": 46,
"x": 347,
"y": 385,
"z": 0,
"openfarm_slug": "radish"
},
"uuid": "points.1392.6"
};
const tr8: TaggedPoint = {
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1393,
"created_at": "2017-05-24T20:41:19.822Z",
"updated_at": "2017-05-24T20:41:19.822Z",
"meta": {
},
"name": "alate-fire-7363",
"pointer_type": "Plant",
"radius": 36,
"x": 727,
"y": 376,
"z": 0,
"openfarm_slug": "garlic"
},
"uuid": "points.1393.7"
};
const tr9: TaggedPoint = {
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1394,
"created_at": "2017-05-24T20:41:19.855Z",
"updated_at": "2017-05-24T20:41:19.855Z",
"meta": {
"color": undefined,
"created_by": "plant-detection"
},
"name": "untitled",
"pointer_type": "Point",
"radius": 6,
"x": 1245,
"y": 637,
"z": 5
},
"uuid": "points.1394.8"
};
const tr10: TaggedPoint = {
"specialStatus": undefined,
"kind": "Point",
"body": {
"id": 1395,
"created_at": "2017-05-24T20:41:19.889Z",
"updated_at": "2017-05-24T20:41:19.889Z",
"meta": {
"color": "gray",
"device_id": 415,
"regimen_items": [
{
"id": 33,
"regimen_id": 11,
"sequence_id": 23,
"time_offset": 345900000
"created_by": "plant-detection"
},
"name": "untitled",
"pointer_type": "Point",
"radius": 10,
"x": 490,
"y": 421,
"z": 5
},
"uuid": "points.1395.9"
};
const tr11: TaggedPoint = {
"kind": "Point",
"specialStatus": undefined,
"body": {
"id": 1396,
"created_at": "2017-05-24T20:41:20.112Z",
"updated_at": "2017-05-24T20:41:20.112Z",
"meta": {
},
"name": "Slot One.",
"pointer_type": "Tool",
"radius": 25,
"x": 10,
"y": 10,
"z": 10,
"tool_id": 14
},
"uuid": "points.1396.10"
};
const tr12: TaggedResource = {
"specialStatus": undefined,
"kind": "Regimen",
"body": {
"id": 11,
"name": "Test Regimen 456",
"color": "gray",
"device_id": 415,
"regimen_items": [
{
"id": 33,
"regimen_id": 11,
"sequence_id": 23,
"time_offset": 345900000
}
]
},
"uuid": "regimens.11.46"
};
const tr13: TaggedResource = {
"kind": "Sequence",
"specialStatus": undefined,
"body": {
"id": 23,
"name": "Goto 0, 0, 0",
"color": "gray",
"status": undefined,
"body": [
{
"kind": "move_absolute",
"args": {
"location": {
"kind": "coordinate",
"args": {
"x": 0,
"y": 0,
"z": 0
}
},
"offset": {
"kind": "coordinate",
"args": {
"x": 0,
"y": 0,
"z": 0
}
},
"speed": 800
}
]
}
],
"args": {
"is_outdated": false,
"version": 4
},
"uuid": "regimens.11.46"
"kind": "sequence"
},
{
"kind": "Sequence",
"specialStatus": undefined,
"body": {
"id": 23,
"name": "Goto 0, 0, 0",
"color": "gray",
"status": undefined,
"body": [
{
"kind": "move_absolute",
"args": {
"location": {
"kind": "coordinate",
"args": {
"x": 0,
"y": 0,
"z": 0
}
},
"offset": {
"kind": "coordinate",
"args": {
"x": 0,
"y": 0,
"z": 0
}
},
"speed": 800
}
}
],
"args": {
"is_outdated": false,
"version": 4
},
"kind": "sequence"
},
"uuid": "sequences.23.47"
"uuid": "Sequence.23.47"
};
const tr14: TaggedResource = {
"specialStatus": undefined,
"kind": "Tool",
"body": {
"id": 14,
"name": "Trench Digging Tool",
"status": "active"
},
{
"specialStatus": undefined,
"kind": "Tool",
"body": {
"id": 14,
"name": "Trench Digging Tool",
"status": "active"
},
"uuid": "tools.14.49"
"uuid": "Tool.14.49"
};
const tr15: TaggedResource = {
"specialStatus": undefined,
"kind": "Tool",
"body": {
"id": 15,
"name": "Berry Picking Tool",
"status": "inactive"
},
{
"specialStatus": undefined,
"kind": "Tool",
"body": {
"id": 15,
"name": "Berry Picking Tool",
"status": "inactive"
},
"uuid": "tools.15.50"
}
];
"uuid": "Tool.15.50"
};
export let FAKE_RESOURCES: TaggedResource[] = [tr1, fakeDevice(), tr2, tr3, tr4,
tr5, tr6, tr7, tr8, tr9, tr10, tr11, tr12, tr13, tr14, tr15];
export
function buildResourceIndex(resources: TaggedResource[] = FAKE_RESOURCES,

View File

@ -5,7 +5,7 @@ import {
import { TaggedFarmEvent } from "../resources/tagged_resources";
const STUB_RESOURCE: TaggedFarmEvent = {
"uuid": "farm_events.0.435",
"uuid": "FarmEvent.0.435",
"kind": "FarmEvent",
"specialStatus": undefined,
"body": {
@ -29,7 +29,7 @@ test("buildResourceIndex - base case", () => {
test("buildResourceIndex - add a FarmEvent", () => {
const db = buildResourceIndex([STUB_RESOURCE]);
const fe = db.index.references[db.index.byKind.farm_events[0]];
const fe = db.index.references[db.index.byKind.FarmEvent[0]];
expect(fe).toBeTruthy();
if (fe && fe.kind === "FarmEvent") {
const { body } = fe;

View File

@ -164,17 +164,17 @@ export function saveAll(input: TaggedResource[],
export function urlFor(tag: ResourceName) {
const OPTIONS: Partial<Record<ResourceName, string>> = {
sequences: API.current.sequencesPath,
tools: API.current.toolsPath,
farm_events: API.current.farmEventsPath,
regimens: API.current.regimensPath,
peripherals: API.current.peripheralsPath,
points: API.current.pointsPath,
users: API.current.usersPath,
device: API.current.devicePath,
images: API.current.imagesPath,
logs: API.current.logsPath,
webcam_feed: API.current.webcamFeedPath
Sequence: API.current.sequencesPath,
Tool: API.current.toolsPath,
FarmEvent: API.current.farmEventsPath,
Regimen: API.current.regimensPath,
Peripheral: API.current.peripheralsPath,
Point: API.current.pointsPath,
User: API.current.usersPath,
Device: API.current.devicePath,
Image: API.current.imagesPath,
Log: API.current.logsPath,
WebcamFeed: API.current.webcamFeedPath
};
const url = OPTIONS[tag];
if (url) {

View File

@ -15,7 +15,7 @@ describe("mapStateToProps()", () => {
it("currentImage defined", () => {
const state = fakeState();
const secondImageUUID = state.resources.index.byKind.images[1];
const secondImageUUID = state.resources.index.byKind.Image[1];
state.resources.consumers.farmware.currentImage = secondImageUUID;
const props = mapStateToProps(state);
const currentImageUUID = props.currentImage ? props.currentImage.uuid : "";

View File

@ -1,7 +1,8 @@
import { ResourceName, DataChangeType, Dictionary } from "farmbot/dist";
import { DataChangeType, Dictionary } from "farmbot/dist";
import { getDevice } from "./device";
import { box } from "boxed_value";
import * as _ from "lodash";
import { ResourceName } from "./resources/tagged_resources";
export let METHOD_MAP: Dictionary<DataChangeType> = {
"post": "add",
@ -10,9 +11,17 @@ export let METHOD_MAP: Dictionary<DataChangeType> = {
"delete": "remove"
};
export let METHODS = ["post", "put", "patch", "delete"];
export let RESOURCES: ResourceName[] = [
"plants", "Regimen", "Peripheral", "Log", "Sequence",
"FarmEvent", "tool_slots", "Tool", "Point", "Device"];
"Point",
"Regimen",
"Peripheral",
"Log",
"Sequence",
"FarmEvent",
"Point",
"Device"
];
// PROBLEM: The bot doesn't know if the user has changed any of the data.
// GOOD SOLUTION: Create a push notification system on the API.

View File

@ -54,7 +54,7 @@ export interface Everything {
bot: BotState;
location: Location;
draggable: DraggableState;
peripherals: PeripheralState;
Peripheral: PeripheralState;
resources: RestResources;
router: {
push(url?: string): void;
@ -97,12 +97,12 @@ export interface GenericPointer extends BasePoint {
pointer_type: "GenericPointer";
}
export type AnyPointer =
export type Point =
| GenericPointer
| ToolSlotPointer
| PlantPointer;
export type PointerTypeName = AnyPointer["pointer_type"];
export type PointerTypeName = Point["pointer_type"];
export const POINTER_NAMES: Readonly<PointerTypeName>[] = [
"Plant",

View File

@ -6,7 +6,7 @@ import { SpecialStatus, TaggedSequence, TaggedDevice } from "../tagged_resources
describe("resource reducer", () => {
it("marks resources as DIRTY when reducing OVERWRITE_RESOURCE", () => {
const state = fakeState().resources;
const uuid = state.index.byKind.sequences[0];
const uuid = state.index.byKind.Sequence[0];
const sequence = state.index.references[uuid] as TaggedSequence;
expect(sequence).toBeTruthy();
@ -21,7 +21,7 @@ describe("resource reducer", () => {
it("marks resources as SAVING when reducing REFRESH_RESOURCE_START", () => {
const state = fakeState().resources;
const uuid = state.index.byKind.device[0];
const uuid = state.index.byKind.Device[0];
const device = state.index.references[uuid] as TaggedSequence;
expect(device).toBeTruthy();

View File

@ -38,7 +38,7 @@ const fakeSlot: TaggedToolSlotPointer = {
describe("findSlotByToolId", () => {
it("returns undefined when not found", () => {
const state = resourceReducer(buildResourceIndex(), createOK(fakeTool));
expect(state.index.byKindAndId["tools." + fakeTool.body.id]);
expect(state.index.byKindAndId["Tool." + fakeTool.body.id]);
const result = findSlotByToolId(state.index, TOOL_ID);
expect(result).toBeFalsy();
});

View File

@ -53,18 +53,18 @@ export function emptyState(): RestResources {
index: {
all: [],
byKind: {
webcam_feed: [],
device: [],
farm_events: [],
images: [],
logs: [],
peripherals: [],
crops: [],
points: [],
regimens: [],
sequences: [],
tools: [],
users: []
WebcamFeed: [],
Device: [],
FarmEvent: [],
Image: [],
Log: [],
Peripheral: [],
Crop: [],
Point: [],
Regimen: [],
Sequence: [],
Tool: [],
User: []
},
byKindAndId: {},
references: {}

View File

@ -209,7 +209,7 @@ export function selectAllSequences(index: ResourceIndex) {
export function indexSequenceById(index: ResourceIndex) {
const output: CowardlyDictionary<TaggedSequence> = {};
const uuids = index.byKind.sequences;
const uuids = index.byKind.Sequence;
uuids.map(uuid => {
assertUuid("Sequence", uuid);
const sequence = index.references[uuid];
@ -223,7 +223,7 @@ export function indexSequenceById(index: ResourceIndex) {
export function indexRegimenById(index: ResourceIndex) {
const output: CowardlyDictionary<TaggedRegimen> = {};
const uuids = index.byKind.regimens;
const uuids = index.byKind.Regimen;
uuids.map(uuid => {
assertUuid("Regimen", uuid);
const regimen = index.references[uuid];
@ -237,7 +237,7 @@ export function indexRegimenById(index: ResourceIndex) {
export function indexFarmEventById(index: ResourceIndex) {
const output: CowardlyDictionary<TaggedFarmEvent> = {};
const uuids = index.byKind.farm_events;
const uuids = index.byKind.FarmEvent;
uuids.map(uuid => {
assertUuid("FarmEvent", uuid);
const farmEvent = index.references[uuid];
@ -251,7 +251,7 @@ export function indexFarmEventById(index: ResourceIndex) {
export function indexByToolId(index: ResourceIndex) {
const output: CowardlyDictionary<TaggedTool> = {};
const uuids = index.byKind.tools;
const uuids = index.byKind.Tool;
uuids.map(uuid => {
assertUuid("Tool", uuid);
const Tool = index.references[uuid];
@ -265,7 +265,7 @@ export function indexByToolId(index: ResourceIndex) {
export function indexBySlotId(index: ResourceIndex) {
const output: CowardlyDictionary<TaggedToolSlotPointer> = {};
const uuids = index.byKind.points;
const uuids = index.byKind.Point;
uuids.map(uuid => {
assertUuid("Point", uuid);
const tool_slot = index.references[uuid];
@ -427,7 +427,7 @@ export function maybeFindPlantById(index: ResourceIndex, id: number) {
}
export function getDeviceAccountSettings(index: ResourceIndex) {
const list = index.byKind.device;
const list = index.byKind.Device;
const uuid = list[0];
const device = index.references[uuid || -1];
if ((list.length === 1) && device && device.kind === "Device") {
@ -441,7 +441,7 @@ export function getDeviceAccountSettings(index: ResourceIndex) {
}
export function getFeeds(index: ResourceIndex): TaggedWebcamFeed[] {
const list = index.byKind.webcam_feed;
const list = index.byKind.WebcamFeed;
const output: TaggedWebcamFeed[] = [];
list.forEach(y => {
const x = index.references[y];
@ -455,7 +455,7 @@ export function getFeeds(index: ResourceIndex): TaggedWebcamFeed[] {
export function maybeFetchUser(index: ResourceIndex):
TaggedUser | undefined {
const list = index.byKind.users;
const list = index.byKind.User;
const uuid = list[0];
const user = index.references[uuid || -1];
@ -504,7 +504,7 @@ export function findToolBySlotId(input: ResourceIndex, tool_slot_id: number):
TaggedTool | undefined {
const wow = input
.byKind
.points
.Point
.map(x => input.references[x])
.map((x) => {
if (x

View File

@ -31,9 +31,7 @@ export type ResourceName =
| "Tool"
| "User"
| "WebcamFeed"
| "GenericPointer"
| "PlantPointer"
| "ToolSlotPointer";
| "Point";
console.log("RICK REMOVE GenericPointer PlantPointer ToolSlotPointer before PR");
export interface TaggedResourceBase {
kind: ResourceName;
@ -74,18 +72,16 @@ export interface Resource<T extends ResourceName, U extends object>
}
export type TaggedResource =
| TaggedPoint
| TaggedCrop
| TaggedDevice
| TaggedFarmEvent
| TaggedGenericPointer
| TaggedImage
| TaggedLog
| TaggedPeripheral
| TaggedPlantPointer
| TaggedRegimen
| TaggedSequence
| TaggedTool
| TaggedToolSlotPointer
| TaggedUser
| TaggedWebcamFeed;
@ -97,9 +93,15 @@ export type TaggedFarmEvent = Resource<"FarmEvent", FarmEvent>;
export type TaggedImage = Resource<"Image", Image>;
export type TaggedLog = Resource<"Log", Log>;
export type TaggedPeripheral = Resource<"Peripheral", Peripheral>;
export type TaggedGenericPointer = Resource<"GenericPointer", GenericPointer>;
export type TaggedPlantPointer = Resource<"PlantPointer", PlantPointer>;
export type TaggedToolSlotPointer = Resource<"ToolSlotPointer", ToolSlotPointer>;
type PointUnion = GenericPointer | PlantPointer | ToolSlotPointer;
export type TaggedGenericPointer = Resource<"Point", GenericPointer>;
export type TaggedPlantPointer = Resource<"Point", PlantPointer>;
export type TaggedToolSlotPointer = Resource<"Point", ToolSlotPointer>;
export type TaggedPoint = Resource<"Point", PointUnion>;
export type TaggedUser = Resource<"User", User>;
export type TaggedDevice = Resource<"Device", DeviceAccountSettings>;
export type TaggedWebcamFeed = Resource<"WebcamFeed", WebcamFeed>;

View File

@ -1,6 +1,6 @@
import axios from "axios";
import { warning } from "farmbot-toastr";
import { Log, AnyPointer } from "../interfaces";
import { Log, Point } from "../interfaces";
import { API } from "../api";
import { Sequence } from "../sequences/interfaces";
import { Tool } from "../tools/interfaces";
@ -42,7 +42,7 @@ export function fetchSyncData(dispatch: Function) {
fetch<Image[]>("Image", API.current.imagesPath);
fetch<Log[]>("Log", API.current.logsPath);
fetch<Peripheral[]>("Peripheral", API.current.peripheralsPath);
fetch<AnyPointer[]>("Point", API.current.pointsPath);
fetch<Point[]>("Point", API.current.pointsPath);
fetch<Regimen[]>("Regimen", API.current.regimensPath);
fetch<Sequence[]>("Sequence", API.current.sequencesPath);
fetch<Tool[]>("Tool", API.current.toolsPath);