Typechecks
parent
a020435852
commit
0099911af0
|
@ -45,7 +45,7 @@ module CeleryScriptSettingsBag
|
|||
read_status reboot sync take_photo)
|
||||
STEPS = %w(_if execute execute_script find_home move_absolute
|
||||
move_relative read_pin send_message take_photo wait
|
||||
write_pin)
|
||||
write_pin resource_update)
|
||||
BAD_ALLOWED_PIN_MODES = '"%s" is not a valid pin_mode. Allowed values: %s'
|
||||
BAD_LHS = 'Can not put "%s" into a left hand side (LHS) '\
|
||||
'argument. Allowed values: %s'
|
||||
|
@ -78,6 +78,7 @@ module CeleryScriptSettingsBag
|
|||
KLASS_LOOKUP = Point::POINTER_KINDS.reduce({}) do |acc, val|
|
||||
(acc[val] = Kernel.const_get(val)) && acc
|
||||
end
|
||||
RESOURCE_UPDATE_ARGS = [:resource_type, :resource_id, :label, :value]
|
||||
|
||||
Corpus = CeleryScript::Corpus
|
||||
.new
|
||||
|
@ -248,7 +249,7 @@ module CeleryScriptSettingsBag
|
|||
.node(:set_servo_angle, [:pin_number, :pin_value], [])
|
||||
.node(:change_ownership, [], [:pair])
|
||||
.node(:dump_info, [], [])
|
||||
.node(:resource_update, [:resource_type, :resource_id], [:pair])
|
||||
.node(:resource_update, RESOURCE_UPDATE_ARGS)
|
||||
.node(:install_first_party_farmware, [])
|
||||
|
||||
ANY_ARG_NAME = Corpus.as_json[:args].pluck("name").map(&:to_s)
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
class CorpusEmitter
|
||||
PIPE = "\n | "
|
||||
PIPE = "\n | "
|
||||
|
||||
class CSArg
|
||||
TRANSLATIONS = {"integer" => "number",
|
||||
"string" => "string",
|
||||
"float" => "number" }
|
||||
"float" => "number",
|
||||
"boolean" => "boolean" }
|
||||
|
||||
attr_reader :name, :allowed_values
|
||||
|
||||
def initialize(name:, allowed_values:)
|
||||
|
@ -141,7 +143,7 @@ class CorpusEmitter
|
|||
result.push(enum_type :PlantStage, CeleryScriptSettingsBag::PLANT_STAGES)
|
||||
|
||||
File.open("latest_corpus.ts", "w") do |f|
|
||||
f.write(result.join.gsub("\n\n\n", "\n").gsub("\n\n", "\n").strip)
|
||||
f.write(result.join.gsub("\n\n\n", "\n").gsub("\n\n", "\n").gsub("\n\n", "\n").strip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
"css-loader": "1.0.0",
|
||||
"enzyme-adapter-react-16": "1.5.0",
|
||||
"enzyme": "3.6.0",
|
||||
"farmbot": "https://github.com/RickCarlino/farmbot-js.git#e019f316",
|
||||
"farmbot": "https://github.com/RickCarlino/farmbot-js.git#2458c790",
|
||||
"farmbot-toastr": "^1.0.3",
|
||||
"fastclick": "^1.0.6",
|
||||
"file-loader": "2.0.0",
|
||||
|
|
|
@ -136,7 +136,10 @@ export function StepButtonCluster({ dispatch, current }: StepButtonProps) {
|
|||
<StepButton
|
||||
dispatch={dispatch}
|
||||
current={current}
|
||||
step={{ kind: "transaction", args: { label: "mark_as" } }}
|
||||
step={{
|
||||
kind: "resource_update",
|
||||
args: { resource_type: "none", resource_id: 1, label: "none", value: 0 }
|
||||
}}
|
||||
color="brown">
|
||||
{t("Mark Point As...")}
|
||||
</StepButton>,
|
||||
|
|
|
@ -19,9 +19,9 @@ function translate(input: Step): string {
|
|||
"read_pin": t("Read Pin"),
|
||||
"send_message": t("Send Message"),
|
||||
"take_photo": t("Take a Photo"),
|
||||
"transaction": t("Mark As"),
|
||||
"resource_update": t("Mark As"),
|
||||
"wait": t("Wait"),
|
||||
"write_pin": t("Write Pin"),
|
||||
"write_pin": t("Write Pin")
|
||||
};
|
||||
|
||||
return TRANSLATIONS[input.kind] || input.kind;
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
Nothing,
|
||||
ScopeDeclarationBodyItem
|
||||
} from "farmbot";
|
||||
import { isObject as obj, isString as strn, uniqBy } from "lodash";
|
||||
import { get, uniqBy } from "lodash";
|
||||
import { defensiveClone } from "../../../util";
|
||||
|
||||
/** A less strict version of a CeleryScript node used for
|
||||
|
@ -32,9 +32,12 @@ const isIdentifier =
|
|||
(x: Traversable): x is Identifier => (x.kind === "identifier");
|
||||
|
||||
/** Is it a fully-formed CeleryScript node? Can we continue recursing? */
|
||||
const isTraversable =
|
||||
// tslint:disable-next-line:no-any
|
||||
(x: any): x is Traversable => (obj(x) && obj(x.args) && strn(x.kind));
|
||||
const isTraversable = (x: unknown): x is Traversable => {
|
||||
const kind: string | undefined = get(x, "kind");
|
||||
const args: object | undefined = get(x, "args");
|
||||
|
||||
return !!((typeof kind == "string") && args && typeof args == "object");
|
||||
};
|
||||
|
||||
/** Is it an _identifier_ node? Put it in the array if so.
|
||||
* If it is some other node type, continue recursion. */
|
||||
|
@ -57,7 +60,7 @@ const traverseBody = (input: Body, accumulator: Accum) => {
|
|||
|
||||
/** Recurse into every leg of node.args and node.body, pushing all `identifier`
|
||||
* nodes into the `acc` array. */
|
||||
const traverse = (acc: Accum = []) => (input: Traversable): Accum => {
|
||||
const traverse = (acc: Accum = []) => (input: unknown): Accum => {
|
||||
if (isTraversable(input)) {
|
||||
traverseArgs(input.args, acc);
|
||||
traverseBody(input.body, acc);
|
||||
|
|
|
@ -2355,9 +2355,9 @@ farmbot-toastr@^1.0.0, farmbot-toastr@^1.0.3:
|
|||
farmbot-toastr "^1.0.0"
|
||||
typescript "^2.3.4"
|
||||
|
||||
"farmbot@https://github.com/RickCarlino/farmbot-js.git#e019f316":
|
||||
version "6.5.0-rc5"
|
||||
resolved "https://github.com/RickCarlino/farmbot-js.git#e019f3168cb9a70772e49c21c82c45b606087d36"
|
||||
"farmbot@https://github.com/RickCarlino/farmbot-js.git#2458c790":
|
||||
version "6.5.0-rc7"
|
||||
resolved "https://github.com/RickCarlino/farmbot-js.git#2458c790e27cb07df9c7aa4bc3e8a9cf2accb875"
|
||||
dependencies:
|
||||
mqtt "2.15.0"
|
||||
|
||||
|
|
Loading…
Reference in New Issue