[UNSTABLE] Part I
parent
e4791157a5
commit
0d4bf3a1da
|
@ -51,7 +51,7 @@
|
|||
"css-loader": "1.0.0",
|
||||
"enzyme": "^3.1.0",
|
||||
"enzyme-adapter-react-16": "^1.1.0",
|
||||
"farmbot": "6.4.0",
|
||||
"farmbot": "https://github.com/RickCarlino/farmbot-js.git",
|
||||
"farmbot-toastr": "^1.0.3",
|
||||
"fastclick": "^1.0.6",
|
||||
"file-loader": "1.1.11",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {
|
||||
Resource as Res,
|
||||
ResourceName as Name,
|
||||
TaggedResource,
|
||||
SpecialStatus
|
||||
} from "../resources/tagged_resources";
|
||||
} from "farmbot";
|
||||
import { generateUuid } from "../resources/util";
|
||||
import { TaggedResource } from "farmbot";
|
||||
|
||||
let ID_COUNTER = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TaggedImage, SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { TaggedImage, SpecialStatus } from "farmbot";
|
||||
|
||||
export let fakeImages: TaggedImage[] = [
|
||||
{
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
import { Everything } from "../../interfaces";
|
||||
import { buildResourceIndex } from "../resource_index_builder";
|
||||
import {
|
||||
TaggedFarmEvent, TaggedSequence, TaggedRegimen, TaggedImage,
|
||||
TaggedTool, TaggedUser, TaggedWebcamFeed,
|
||||
TaggedPlantPointer, TaggedGenericPointer, TaggedPeripheral, TaggedFbosConfig,
|
||||
TaggedWebAppConfig,
|
||||
TaggedSensor,
|
||||
TaggedFirmwareConfig,
|
||||
TaggedPinBinding,
|
||||
TaggedLog,
|
||||
TaggedDiagnosticDump,
|
||||
TaggedSensorReading
|
||||
} from "../../resources/tagged_resources";
|
||||
TaggedFarmEvent,
|
||||
TaggedFbosConfig,
|
||||
TaggedFirmwareConfig,
|
||||
TaggedGenericPointer,
|
||||
TaggedImage,
|
||||
TaggedLog,
|
||||
TaggedPeripheral,
|
||||
TaggedPinBinding,
|
||||
TaggedPlantPointer,
|
||||
TaggedRegimen,
|
||||
TaggedSensor,
|
||||
TaggedSensorReading,
|
||||
TaggedSequence,
|
||||
TaggedTool,
|
||||
TaggedUser,
|
||||
TaggedWebAppConfig,
|
||||
TaggedWebcamFeed,
|
||||
} from "farmbot";
|
||||
import { ExecutableType } from "../../farm_designer/interfaces";
|
||||
import { fakeResource } from "../fake_resource";
|
||||
import { emptyToolSlot } from "../../tools/components/empty_tool_slot";
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import { resourceReducer, emptyState } from "../resources/reducer";
|
||||
import {
|
||||
TaggedResource, TaggedDevice, TaggedPoint,
|
||||
ResourceName,
|
||||
SpecialStatus,
|
||||
TaggedDevice,
|
||||
TaggedLog,
|
||||
ResourceName
|
||||
} from "../resources/tagged_resources";
|
||||
TaggedPoint,
|
||||
TaggedResource,
|
||||
} from "farmbot";
|
||||
import * as _ from "lodash";
|
||||
import { Actions } from "../constants";
|
||||
export function fakeDevice(): TaggedDevice {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { User } from "../auth/interfaces";
|
||||
import { TaggedUser, SpecialStatus } from "../resources/tagged_resources";
|
||||
import { TaggedUser, SpecialStatus } from "farmbot";
|
||||
|
||||
export let user: User = {
|
||||
created_at: "2016-10-05T03:02:58.000Z",
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
buildResourceIndex,
|
||||
FAKE_RESOURCES
|
||||
} from "../__test_support__/resource_index_builder";
|
||||
import { TaggedFarmEvent, SpecialStatus } from "../resources/tagged_resources";
|
||||
import { TaggedFarmEvent, SpecialStatus } from "farmbot";
|
||||
|
||||
const STUB_RESOURCE: TaggedFarmEvent = {
|
||||
"uuid": "FarmEvent.0.435",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { User } from "../auth/interfaces";
|
||||
import { TaggedUser } from "../resources/tagged_resources";
|
||||
import { TaggedUser } from "farmbot";
|
||||
|
||||
export interface Props {
|
||||
user: TaggedUser;
|
||||
|
|
|
@ -14,7 +14,7 @@ jest.mock("axios", () => ({
|
|||
}));
|
||||
|
||||
import { refresh, updateViaAjax } from "../crud";
|
||||
import { TaggedDevice, SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { TaggedDevice, SpecialStatus } from "farmbot";
|
||||
import { API } from "../index";
|
||||
import { get } from "lodash";
|
||||
import { Actions } from "../../constants";
|
||||
|
|
|
@ -12,7 +12,7 @@ jest.mock("axios", () => ({
|
|||
}));
|
||||
|
||||
import { refresh } from "../crud";
|
||||
import { TaggedDevice, SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { TaggedDevice, SpecialStatus } from "farmbot";
|
||||
import { API } from "../index";
|
||||
import { Actions } from "../../constants";
|
||||
import { get } from "lodash";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { urlFor } from "../crud";
|
||||
import { API } from "../api";
|
||||
import { ResourceName } from "../../resources/tagged_resources";
|
||||
import { ResourceName } from "farmbot";
|
||||
|
||||
describe("urlFor()", () => {
|
||||
API.setBaseUrl("");
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import {
|
||||
TaggedResource,
|
||||
ResourceName,
|
||||
TaggedResource
|
||||
} from "farmbot";
|
||||
import {
|
||||
isTaggedResource,
|
||||
TaggedSequence,
|
||||
SpecialStatus,
|
||||
} from "../resources/tagged_resources";
|
||||
import {
|
||||
ResourceName,
|
||||
TaggedSequence,
|
||||
} from "farmbot";
|
||||
import { GetState, ReduxAction } from "../redux/interfaces";
|
||||
import { API } from "./index";
|
||||
import axios from "axios";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ResourceName } from "../resources/tagged_resources";
|
||||
import { ResourceName } from "farmbot";
|
||||
import { startTracking } from "../connectivity/data_consistency";
|
||||
|
||||
const BLACKLIST: ResourceName[] = [
|
||||
|
|
|
@ -9,7 +9,7 @@ import { LoadingPlant } from "./loading_plant";
|
|||
import { BotState, Xyz } from "./devices/interfaces";
|
||||
import {
|
||||
ResourceName, TaggedUser, TaggedLog
|
||||
} from "./resources/tagged_resources";
|
||||
} from "farmbot";
|
||||
import {
|
||||
maybeFetchUser,
|
||||
maybeGetTimeOffset,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { GetState } from "../redux/interfaces";
|
||||
import { maybeDetermineUuid } from "../resources/selectors";
|
||||
import {
|
||||
ResourceName, TaggedResource, SpecialStatus
|
||||
} from "../resources/tagged_resources";
|
||||
ResourceName,
|
||||
TaggedResource,
|
||||
SpecialStatus
|
||||
} from "farmbot";
|
||||
import { overwrite, init } from "../api/crud";
|
||||
import { handleInbound } from "./auto_sync_handle_inbound";
|
||||
import { SyncPayload, MqttDataResult, Reason, UpdateMqttData } from "./interfaces";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TaggedLog } from "../resources/tagged_resources";
|
||||
import { TaggedLog } from "farmbot";
|
||||
import { store } from "../redux/store";
|
||||
import { batchInitResources, bothUp } from "./connect_device";
|
||||
import { maybeGetDevice } from "../resources/selectors";
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
} from "../devices/actions";
|
||||
import { init } from "../api/crud";
|
||||
import { AuthState } from "../auth/interfaces";
|
||||
import { TaggedResource, SpecialStatus } from "../resources/tagged_resources";
|
||||
import { TaggedResource, SpecialStatus } from "farmbot";
|
||||
import { autoSync } from "./auto_sync";
|
||||
import { startPinging } from "./ping_mqtt";
|
||||
import { talk } from "browser-speech";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { DeviceAccountSettings } from "../devices/interfaces";
|
||||
import { ResourceName } from "../resources/tagged_resources";
|
||||
import { ResourceName } from "farmbot";
|
||||
|
||||
export type NetworkState = "up" | "down";
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
TaggedPeripheral,
|
||||
TaggedSensor,
|
||||
TaggedSensorReading
|
||||
} from "../resources/tagged_resources";
|
||||
} from "farmbot";
|
||||
import { NetworkState } from "../connectivity/interfaces";
|
||||
import { GetWebAppConfigValue } from "../config_storage/actions";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BotPosition, BotState } from "../../devices/interfaces";
|
||||
import { McuParams, Xyz } from "farmbot";
|
||||
import { TaggedUser } from "../../resources/tagged_resources";
|
||||
import { TaggedUser } from "farmbot";
|
||||
import { NetworkState } from "../../connectivity/interfaces";
|
||||
import { GetWebAppConfigValue } from "../../config_storage/actions";
|
||||
import {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { PeripheralForm } from "../peripheral_form";
|
||||
import { TaggedPeripheral, SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { TaggedPeripheral, SpecialStatus } from "farmbot";
|
||||
|
||||
describe("<PeripheralForm/>", function () {
|
||||
const dispatch = jest.fn();
|
||||
|
|
|
@ -8,7 +8,10 @@ jest.mock("../../../device", () => ({
|
|||
import * as React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { PeripheralList } from "../peripheral_list";
|
||||
import { TaggedPeripheral, SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import {
|
||||
TaggedPeripheral,
|
||||
SpecialStatus
|
||||
} from "farmbot";
|
||||
import { Pins } from "farmbot/dist";
|
||||
|
||||
describe("<PeripheralList/>", function () {
|
||||
|
|
|
@ -7,7 +7,11 @@ import { Widget, WidgetBody, WidgetHeader, SaveBtn } from "../../ui/index";
|
|||
import { PeripheralsProps } from "../../devices/interfaces";
|
||||
import { PeripheralState } from "./interfaces";
|
||||
import {
|
||||
TaggedPeripheral, getArrayStatus, SpecialStatus
|
||||
TaggedPeripheral,
|
||||
} from "farmbot";
|
||||
import {
|
||||
getArrayStatus,
|
||||
SpecialStatus
|
||||
} from "../../resources/tagged_resources";
|
||||
import { saveAll, init } from "../../api/crud";
|
||||
import { ToolTips } from "../../constants";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TaggedPeripheral } from "../../resources/tagged_resources";
|
||||
import { TaggedPeripheral } from "farmbot";
|
||||
import { Pins } from "farmbot/dist";
|
||||
|
||||
export interface PeripheralState {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TaggedSensorReading } from "../../resources/tagged_resources";
|
||||
import { TaggedSensorReading } from "farmbot";
|
||||
import { SensorReadingsState } from "./interfaces";
|
||||
import { every, isNumber } from "lodash";
|
||||
import { Xyz } from "../../devices/interfaces";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TaggedSensorReading, TaggedSensor } from "../../resources/tagged_resources";
|
||||
import { TaggedSensorReading, TaggedSensor } from "farmbot";
|
||||
import { AxisInputBoxGroupState } from "../interfaces";
|
||||
|
||||
export interface SensorReadingsProps {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { LocationSelection, LocationDisplay } from "./location_selection";
|
|||
import { SensorSelection } from "./sensor_selection";
|
||||
import { ToolTips } from "../../constants";
|
||||
import { t } from "i18next";
|
||||
import { TaggedSensor } from "../../resources/tagged_resources";
|
||||
import { TaggedSensor } from "farmbot";
|
||||
import { AxisInputBoxGroupState } from "../interfaces";
|
||||
import { SensorReadingsPlot } from "./graph";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { FBSelect, DropDownItem } from "../../ui";
|
||||
import { t } from "i18next";
|
||||
import { TaggedSensor } from "../../resources/tagged_resources";
|
||||
import { TaggedSensor } from "farmbot";
|
||||
import { SensorSelectionProps } from "./interfaces";
|
||||
|
||||
const ALL_CHOICE: DropDownItem = { label: t("All"), value: "" };
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from "react";
|
|||
import { FBSelect, Row, Col, BlurableInput } from "../../ui";
|
||||
import { t } from "i18next";
|
||||
import * as moment from "moment";
|
||||
import { TaggedSensorReading } from "../../resources/tagged_resources";
|
||||
import { TaggedSensorReading } from "farmbot";
|
||||
import { TimePeriodSelectionProps, DateDisplayProps } from "./interfaces";
|
||||
import { cloneDeep } from "lodash";
|
||||
|
||||
|
|
|
@ -7,7 +7,11 @@ import { Widget, WidgetBody, WidgetHeader, SaveBtn } from "../../ui/index";
|
|||
import { SensorsProps } from "../../devices/interfaces";
|
||||
import { SensorState } from "./interfaces";
|
||||
import {
|
||||
TaggedSensor, getArrayStatus, SpecialStatus
|
||||
TaggedSensor,
|
||||
SpecialStatus
|
||||
} from "farmbot";
|
||||
import {
|
||||
getArrayStatus,
|
||||
} from "../../resources/tagged_resources";
|
||||
import { saveAll, init } from "../../api/crud";
|
||||
import { ToolTips } from "../../constants";
|
||||
|
|
|
@ -7,14 +7,13 @@ import {
|
|||
TaggedRegimen,
|
||||
TaggedGenericPointer,
|
||||
TaggedPlantPointer,
|
||||
TaggedCrop,
|
||||
TaggedImage,
|
||||
} from "../resources/tagged_resources";
|
||||
import { PlantPointer } from "../interfaces";
|
||||
import { SlotWithTool } from "../resources/interfaces";
|
||||
import { BotPosition, StepsPerMmXY, BotLocationData } from "../devices/interfaces";
|
||||
import { isNumber } from "lodash";
|
||||
import { McuParams } from "farmbot/dist";
|
||||
import { McuParams, TaggedCrop } from "farmbot";
|
||||
import { AxisNumberProperty, BotSize } from "./map/interfaces";
|
||||
import { SelectionBoxData } from "./map/selection_box";
|
||||
import { BooleanConfigKey } from "../config_storage/web_app_configs";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {
|
||||
TaggedPlantPointer,
|
||||
TaggedCrop,
|
||||
TaggedGenericPointer
|
||||
} from "../../resources/tagged_resources";
|
||||
import { TaggedCrop } from "farmbot";
|
||||
import { State, BotOriginQuadrant } from "../interfaces";
|
||||
import { BotPosition, BotLocationData } from "../../devices/interfaces";
|
||||
import { GetWebAppConfigValue } from "../../config_storage/actions";
|
||||
|
|
|
@ -2,7 +2,7 @@ import { CropLiveSearchResult, CurrentPointPayl } from "./interfaces";
|
|||
import { generateReducer } from "../redux/generate_reducer";
|
||||
import { DesignerState, HoveredPlantPayl } from "./interfaces";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { TaggedResource } from "../resources/tagged_resources";
|
||||
import { TaggedResource } from "farmbot";
|
||||
import { Actions } from "../constants";
|
||||
import { BotPosition } from "../devices/interfaces";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { generateReducer } from "../redux/generate_reducer";
|
||||
import { FarmwareState } from "./interfaces";
|
||||
import { TaggedResource } from "../resources/tagged_resources";
|
||||
import { TaggedResource } from "farmbot";
|
||||
import { Actions } from "../constants";
|
||||
|
||||
export let farmwareState: FarmwareState = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { mapStateToProps } from "../state_to_props";
|
||||
import { fakeState } from "../../__test_support__/fake_state";
|
||||
import { TaggedResource, SpecialStatus } from "../../resources/tagged_resources";
|
||||
import { TaggedResource, SpecialStatus } from "farmbot";
|
||||
import { buildResourceIndex } from "../../__test_support__/resource_index_builder";
|
||||
|
||||
describe("mapStateToProps()", () => {
|
||||
|
|
|
@ -5,7 +5,7 @@ jest.mock("farmbot-toastr", () => ({ error: mockErr, warning: mockErr }));
|
|||
import { commitBulkEditor, setTimeOffset, toggleDay, setSequence } from "../actions";
|
||||
import { fakeState } from "../../../__test_support__/fake_state";
|
||||
import { buildResourceIndex } from "../../../__test_support__/resource_index_builder";
|
||||
import { TaggedResource, SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { TaggedResource, SpecialStatus } from "farmbot";
|
||||
import { Actions } from "../../../constants";
|
||||
import { Everything } from "../../../interfaces";
|
||||
import { ToggleDayParams } from "../interfaces";
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as _ from "lodash";
|
|||
import { Dictionary } from "farmbot";
|
||||
import { Week, DAYS } from "./bulk_scheduler/interfaces";
|
||||
import { generateReducer } from "../redux/generate_reducer";
|
||||
import { TaggedResource } from "../resources/tagged_resources";
|
||||
import { TaggedResource } from "farmbot";
|
||||
import { Actions } from "../constants";
|
||||
|
||||
export interface RegimenState {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TaggedResource, SpecialStatus } from "./tagged_resources";
|
||||
import { TaggedResource, SpecialStatus } from "farmbot";
|
||||
import { UnsafeError } from "../interfaces";
|
||||
import { Actions } from "../constants";
|
||||
import { toastErrors } from "../toast_errors";
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
ResourceName,
|
||||
TaggedToolSlotPointer,
|
||||
TaggedTool
|
||||
} from "./tagged_resources";
|
||||
} from "farmbot";
|
||||
import { RegimenState } from "../regimens/reducer";
|
||||
import { FarmwareState } from "../farmware/interfaces";
|
||||
|
||||
|
|
|
@ -4,10 +4,12 @@ import { RestResources, ResourceIndex } from "./interfaces";
|
|||
import {
|
||||
TaggedResource,
|
||||
ResourceName,
|
||||
sanityCheck,
|
||||
isTaggedResource,
|
||||
SpecialStatus,
|
||||
TaggedSequence
|
||||
} from "farmbot";
|
||||
import {
|
||||
sanityCheck,
|
||||
isTaggedResource,
|
||||
} from "./tagged_resources";
|
||||
import { generateUuid, arrayWrap } from "./util";
|
||||
import { EditResourceParams } from "../api/interfaces";
|
||||
|
|
|
@ -2,14 +2,7 @@ import * as _ from "lodash";
|
|||
import { ResourceIndex } from "./interfaces";
|
||||
import { joinKindAndId } from "./reducer";
|
||||
import {
|
||||
isTaggedPlantPointer,
|
||||
isTaggedGenericPointer,
|
||||
isTaggedRegimen,
|
||||
isTaggedSequence,
|
||||
isTaggedTool,
|
||||
isTaggedToolSlotPointer,
|
||||
ResourceName,
|
||||
sanityCheck,
|
||||
TaggedGenericPointer,
|
||||
TaggedPlantPointer,
|
||||
TaggedRegimen,
|
||||
|
@ -19,6 +12,15 @@ import {
|
|||
TaggedToolSlotPointer,
|
||||
TaggedUser,
|
||||
TaggedDevice,
|
||||
} from "farmbot";
|
||||
import {
|
||||
isTaggedPlantPointer,
|
||||
isTaggedGenericPointer,
|
||||
isTaggedRegimen,
|
||||
isTaggedSequence,
|
||||
isTaggedTool,
|
||||
isTaggedToolSlotPointer,
|
||||
sanityCheck,
|
||||
} from "./tagged_resources";
|
||||
import { betterCompact, bail } from "../util";
|
||||
import { findAllById } from "./selectors_by_id";
|
||||
|
|
|
@ -6,12 +6,14 @@ import {
|
|||
isTaggedSequence,
|
||||
isTaggedTool,
|
||||
isTaggedToolSlotPointer,
|
||||
ResourceName,
|
||||
sanityCheck,
|
||||
} from "./tagged_resources";
|
||||
import {
|
||||
ResourceName,
|
||||
TaggedResource,
|
||||
TaggedTool,
|
||||
TaggedToolSlotPointer,
|
||||
} from "./tagged_resources";
|
||||
} from "farmbot";
|
||||
import { ResourceIndex } from "./interfaces";
|
||||
import { joinKindAndId } from "./reducer";
|
||||
import { isNumber } from "lodash";
|
||||
|
|
|
@ -2,8 +2,6 @@ import { ResourceIndex } from "./interfaces";
|
|||
import {
|
||||
TaggedResource,
|
||||
SpecialStatus,
|
||||
isTaggedResource,
|
||||
sanityCheck,
|
||||
TaggedWebcamFeed,
|
||||
TaggedFbosConfig,
|
||||
TaggedCrop,
|
||||
|
@ -22,6 +20,10 @@ import {
|
|||
TaggedPinBinding,
|
||||
TaggedDiagnosticDump,
|
||||
TaggedSensorReading,
|
||||
} from "farmbot";
|
||||
import {
|
||||
isTaggedResource,
|
||||
sanityCheck,
|
||||
} from "./tagged_resources";
|
||||
import { sortResourcesById, betterCompact, bail } from "../util";
|
||||
import { error } from "farmbot-toastr";
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
TaggedFarmEvent,
|
||||
TaggedTool,
|
||||
TaggedPoint
|
||||
} from "./tagged_resources";
|
||||
} from "farmbot";
|
||||
import { CowardlyDictionary } from "../util";
|
||||
import {
|
||||
ResourceIndex,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { get, set } from "lodash";
|
||||
import { SequenceBodyItem, uuid } from "farmbot/dist";
|
||||
import { TaggedResource } from "./tagged_resources";
|
||||
import { TaggedResource } from "farmbot";
|
||||
|
||||
/** HISTORICAL NOTES:
|
||||
* This file is the result of some very subtle bugs relating to dynamic
|
||||
|
|
|
@ -1,56 +1,21 @@
|
|||
import { Sequence } from "../sequences/interfaces";
|
||||
import { Tool } from "../tools/interfaces";
|
||||
import { Regimen } from "../regimens/interfaces";
|
||||
import { FarmEvent, Crop, SavedGarden, PlantTemplate } from "../farm_designer/interfaces";
|
||||
import {
|
||||
Log,
|
||||
GenericPointer,
|
||||
PlantPointer,
|
||||
ToolSlotPointer,
|
||||
SensorReading,
|
||||
Sensor,
|
||||
DeviceConfig,
|
||||
} from "../interfaces";
|
||||
import { Peripheral } from "../controls/peripherals/interfaces";
|
||||
import { User } from "../auth/interfaces";
|
||||
import { DeviceAccountSettings } from "../devices/interfaces";
|
||||
import { isObject, isString, get } from "lodash";
|
||||
import { Image } from "../farmware/images/interfaces";
|
||||
import { betterCompact } from "../util";
|
||||
import * as _ from "lodash";
|
||||
import { WebcamFeed } from "../controls/interfaces";
|
||||
import { FbosConfig } from "../config_storage/fbos_configs";
|
||||
import { FirmwareConfig } from "../config_storage/firmware_configs";
|
||||
import { WebAppConfig } from "../config_storage/web_app_configs";
|
||||
import { FarmwareInstallation } from "../farmware/interfaces";
|
||||
import { assertUuid } from "./util";
|
||||
import { PinBinding } from "../devices/pin_bindings/interfaces";
|
||||
|
||||
export type ResourceName =
|
||||
| "Crop"
|
||||
| "Device"
|
||||
| "DeviceConfig"
|
||||
| "DiagnosticDump"
|
||||
| "FarmEvent"
|
||||
| "FarmwareInstallation"
|
||||
| "FbosConfig"
|
||||
| "FirmwareConfig"
|
||||
| "Image"
|
||||
| "Log"
|
||||
| "Peripheral"
|
||||
| "PinBinding"
|
||||
| "Plant"
|
||||
| "PlantTemplate"
|
||||
| "Point"
|
||||
| "Regimen"
|
||||
| "SavedGarden"
|
||||
| "Sensor"
|
||||
| "SensorReading"
|
||||
| "Sequence"
|
||||
| "Tool"
|
||||
| "User"
|
||||
| "WebAppConfig"
|
||||
| "WebcamFeed";
|
||||
import {
|
||||
TaggedCrop,
|
||||
TaggedResource,
|
||||
ResourceName,
|
||||
TaggedRegimen,
|
||||
TaggedSequence,
|
||||
TaggedTool,
|
||||
TaggedFarmEvent,
|
||||
TaggedLog,
|
||||
TaggedToolSlotPointer,
|
||||
TaggedPlantPointer,
|
||||
TaggedGenericPointer,
|
||||
PointerType,
|
||||
} from "farmbot";
|
||||
|
||||
export interface TaggedResourceBase {
|
||||
kind: ResourceName;
|
||||
|
@ -93,62 +58,41 @@ export interface Resource<T extends ResourceName, U extends object>
|
|||
body: U;
|
||||
}
|
||||
|
||||
export type TaggedResource =
|
||||
| TaggedCrop
|
||||
| TaggedDevice
|
||||
| TaggedDiagnosticDump
|
||||
| TaggedFarmEvent
|
||||
| TaggedFarmwareInstallation
|
||||
| TaggedFbosConfig
|
||||
| TaggedFirmwareConfig
|
||||
| TaggedImage
|
||||
| TaggedLog
|
||||
| TaggedPeripheral
|
||||
| TaggedPinBinding
|
||||
| TaggedPlantTemplate
|
||||
| TaggedPoint
|
||||
| TaggedRegimen
|
||||
| TaggedSavedGarden
|
||||
| TaggedSensor
|
||||
| TaggedSensorReading
|
||||
| TaggedSequence
|
||||
| TaggedTool
|
||||
| TaggedUser
|
||||
| TaggedWebAppConfig
|
||||
| TaggedWebcamFeed;
|
||||
// export type TaggedPinBinding = Resource<"PinBinding", PinBinding>;
|
||||
// // export type TaggedDeviceConfig = Resource<"DeviceConfig", DeviceConfig>;
|
||||
// export type TaggedRegimen = Resource<"Regimen", Regimen>;
|
||||
// export type TaggedTool = Resource<"Tool", Tool>;
|
||||
// export type TaggedSequence = Resource<"Sequence", Sequence>;
|
||||
// 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 TaggedFbosConfig = Resource<"FbosConfig", FbosConfig>;
|
||||
// export type TaggedFirmwareConfig = Resource<"FirmwareConfig", FirmwareConfig>;
|
||||
// export type TaggedWebAppConfig = Resource<"WebAppConfig", WebAppConfig>;
|
||||
// export type TaggedSensorReading = Resource<"SensorReading", SensorReading>;
|
||||
// export type TaggedSensor = Resource<"Sensor", Sensor>;
|
||||
// export type TaggedSavedGarden = Resource<"SavedGarden", SavedGarden>;
|
||||
// export type TaggedPlantTemplate = Resource<"PlantTemplate", PlantTemplate>;
|
||||
// export type TaggedDiagnosticDump = Resource<"DiagnosticDump", DiagnosticDump>;
|
||||
|
||||
export type TaggedPinBinding = Resource<"PinBinding", PinBinding>;
|
||||
export type TaggedDeviceConfig = Resource<"DeviceConfig", DeviceConfig>;
|
||||
export type TaggedRegimen = Resource<"Regimen", Regimen>;
|
||||
export type TaggedTool = Resource<"Tool", Tool>;
|
||||
export type TaggedSequence = Resource<"Sequence", Sequence>;
|
||||
export type TaggedCrop = Resource<"Crop", Crop>;
|
||||
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 TaggedFbosConfig = Resource<"FbosConfig", FbosConfig>;
|
||||
export type TaggedFirmwareConfig = Resource<"FirmwareConfig", FirmwareConfig>;
|
||||
export type TaggedWebAppConfig = Resource<"WebAppConfig", WebAppConfig>;
|
||||
export type TaggedSensorReading = Resource<"SensorReading", SensorReading>;
|
||||
export type TaggedSensor = Resource<"Sensor", Sensor>;
|
||||
export type TaggedSavedGarden = Resource<"SavedGarden", SavedGarden>;
|
||||
export type TaggedPlantTemplate = Resource<"PlantTemplate", PlantTemplate>;
|
||||
export type TaggedDiagnosticDump = Resource<"DiagnosticDump", DiagnosticDump>;
|
||||
// type PointUnion = GenericPointer | PlantPointer | ToolSlotPointer;
|
||||
// export type PointerType =
|
||||
// | TaggedToolSlotPointer
|
||||
// | TaggedGenericPointer
|
||||
// | TaggedPlantPointer;
|
||||
|
||||
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 TaggedGenericPointer = Resource<"Point", GenericPointer>;
|
||||
export type TaggedPlantPointer = Resource<"Point", PlantPointer>;
|
||||
export type TaggedToolSlotPointer = Resource<"Point", ToolSlotPointer>;
|
||||
// export type TaggedPoint = Resource<"Point", PointUnion>;
|
||||
|
||||
export type TaggedPoint = Resource<"Point", PointUnion>;
|
||||
|
||||
export type TaggedUser = Resource<"User", User>;
|
||||
export type TaggedDevice = Resource<"Device", DeviceAccountSettings>;
|
||||
export type TaggedWebcamFeed = Resource<"WebcamFeed", WebcamFeed>;
|
||||
export type TaggedFarmwareInstallation =
|
||||
Resource<"FarmwareInstallation", FarmwareInstallation>;
|
||||
// export type TaggedUser = Resource<"User", User>;
|
||||
// export type TaggedDevice = Resource<"Device", DeviceAccountSettings>;
|
||||
// export type TaggedWebcamFeed = Resource<"WebcamFeed", WebcamFeed>;
|
||||
// export type TaggedFarmwareInstallation =
|
||||
// Resource<"FarmwareInstallation", FarmwareInstallation>;
|
||||
|
||||
export interface DiagnosticDump {
|
||||
id: number;
|
||||
|
@ -191,11 +135,6 @@ const is = (r: ResourceName) => function isOfTag(x: object): x is TaggedResource
|
|||
return safe;
|
||||
};
|
||||
|
||||
export type PointerType =
|
||||
| TaggedToolSlotPointer
|
||||
| TaggedGenericPointer
|
||||
| TaggedPlantPointer;
|
||||
|
||||
function isTaggedPoint(x: {}): x is PointerType {
|
||||
return (is("Point")(x)) && (x.kind === "Point");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { SequenceReducerState } from "./interfaces";
|
||||
import { generateReducer } from "../redux/generate_reducer";
|
||||
import { TaggedResource } from "../resources/tagged_resources";
|
||||
import { TaggedResource } from "farmbot";
|
||||
import { Actions } from "../constants";
|
||||
|
||||
export const initialState: SequenceReducerState = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { buildResourceIndex } from "../../../__test_support__/resource_index_builder";
|
||||
import { ResourceIndex } from "../../../resources/interfaces";
|
||||
import { TaggedResource, SpecialStatus } from "../../../resources/tagged_resources";
|
||||
import { TaggedResource, SpecialStatus } from "farmbot";
|
||||
|
||||
export function fakeResourceIndex(): ResourceIndex {
|
||||
const fakeResources: TaggedResource[] = [
|
||||
|
|
|
@ -4,8 +4,10 @@ import { Dictionary } from "farmbot";
|
|||
import { Color } from "../interfaces";
|
||||
import { box } from "boxed_value";
|
||||
import {
|
||||
TaggedResource, TaggedFirmwareConfig, TaggedFbosConfig
|
||||
} from "../resources/tagged_resources";
|
||||
TaggedResource,
|
||||
TaggedFirmwareConfig,
|
||||
TaggedFbosConfig,
|
||||
} from "farmbot";
|
||||
import { BotLocationData } from "../devices/interfaces";
|
||||
import { FirmwareConfig } from "../config_storage/firmware_configs";
|
||||
import { FbosConfig } from "../config_storage/fbos_configs";
|
||||
|
|
|
@ -2417,9 +2417,9 @@ farmbot-toastr@^1.0.0, farmbot-toastr@^1.0.3:
|
|||
farmbot-toastr "^1.0.0"
|
||||
typescript "^2.3.4"
|
||||
|
||||
farmbot@6.4.0:
|
||||
version "6.4.0"
|
||||
resolved "https://registry.yarnpkg.com/farmbot/-/farmbot-6.4.0.tgz#0d79a81aa2283e7b58004da50f5e5d76a3274010"
|
||||
"farmbot@https://github.com/RickCarlino/farmbot-js.git":
|
||||
version "6.4.1"
|
||||
resolved "https://github.com/RickCarlino/farmbot-js.git#9d7b3f479ba64c92ed904cf1b2150eaa5672da8f"
|
||||
dependencies:
|
||||
mqtt "2.15.0"
|
||||
|
||||
|
|
Loading…
Reference in New Issue