From bd002ba253b42c59a874d5583bd58a39b44a645c Mon Sep 17 00:00:00 2001 From: Loren Norman Date: Wed, 23 Jul 2025 15:32:13 -0400 Subject: [PATCH] ensure all block inputs/outputs are checked --- app/blocks/action/email.js | 2 ++ app/blocks/action/log.js | 1 + app/blocks/action/publish.js | 2 ++ app/blocks/action/sms.js | 1 + app/blocks/action/webhook.js | 2 ++ app/blocks/controls/if.js | 2 ++ app/blocks/feed/get_value.js | 5 +++++ app/blocks/feed/selector.js | 5 +++++ app/blocks/feed/set_value.js | 1 + app/blocks/logic/negate.js | 6 ++++++ app/blocks/logic/operation.js | 7 +++++++ app/blocks/matchers/matcher_boolean_operation.js | 1 + app/blocks/matchers/matcher_compare.js | 1 + app/blocks/matchers/matcher_text_compare.js | 1 + app/blocks/math/arithmetic.js | 7 +++++++ app/blocks/math/compare.js | 7 +++++++ app/blocks/math/constrain.js | 1 + app/blocks/math/range.js | 2 ++ app/blocks/math/round.js | 1 + app/blocks/text/compare.js | 7 +++++++ app/blocks/text/join.js | 7 +++++++ app/blocks/text/template.js | 5 ++++- app/blocks/variables/set.js | 1 + 23 files changed, 74 insertions(+), 1 deletion(-) diff --git a/app/blocks/action/email.js b/app/blocks/action/email.js index fb12576..fa1b87c 100644 --- a/app/blocks/action/email.js +++ b/app/blocks/action/email.js @@ -18,12 +18,14 @@ export default { inputs: { SUBJECT: { description: "a template for generating the email subject", + check: "expression", bytecodeProperty: "subjectTemplate", shadow: singleLineTemplate, }, BODY: { description: "a multi-line template for generating the email body", + check: "expression", bytecodeProperty: "bodyTemplate", shadow: multilineLineTemplate, } diff --git a/app/blocks/action/log.js b/app/blocks/action/log.js index 901f48f..66fecc4 100644 --- a/app/blocks/action/log.js +++ b/app/blocks/action/log.js @@ -16,6 +16,7 @@ export default { inputs: { EXPRESSION: { description: "A Block diagram you'd like to see the resolved value and type of.", + check: "expression", shadow: 'io_text' } }, diff --git a/app/blocks/action/publish.js b/app/blocks/action/publish.js index 81c8fc7..4788c62 100644 --- a/app/blocks/action/publish.js +++ b/app/blocks/action/publish.js @@ -21,11 +21,13 @@ export default { inputs: { VALUE: { description: "The value to write to the Feed.", + check: "expression", shadow: 'io_text' }, FEED: { description: "The Feed to write to.", + check: "expression", shadow: 'feed_selector' }, }, diff --git a/app/blocks/action/sms.js b/app/blocks/action/sms.js index 5ad40f4..4aec5ed 100644 --- a/app/blocks/action/sms.js +++ b/app/blocks/action/sms.js @@ -23,6 +23,7 @@ export default { inputs: { BODY: { description: "A template for generating the SMS body", + check: "expression", shadow: multilineLineTemplate } }, diff --git a/app/blocks/action/webhook.js b/app/blocks/action/webhook.js index b71705e..bd4b1e6 100644 --- a/app/blocks/action/webhook.js +++ b/app/blocks/action/webhook.js @@ -25,6 +25,7 @@ export default { inputs: { URL: { description: "A valid web location to send a POST request to.", + check: "expression", shadow: { type: 'io_text', fields: { TEXT: 'https://...' } @@ -33,6 +34,7 @@ export default { BODY: { description: "A JSON template to render and POST", + check: "expression", shadow: multilineLineTemplate } }, diff --git a/app/blocks/controls/if.js b/app/blocks/controls/if.js index 59fee9b..2a1a370 100644 --- a/app/blocks/controls/if.js +++ b/app/blocks/controls/if.js @@ -36,11 +36,13 @@ export default { inputs: { IF0: { description: "Runs the given block tree and checks whether it resolve true or false. If true, executes the 'do' branch, otherwise moves onto the next if (if present), or the final else (if present.)", + check: "expression", shadow: 'io_logic_boolean' }, THEN0: { description: "The block diagram to execute when the preceding 'if' clause resolves to true", + check: "expression", type: 'statement', }, diff --git a/app/blocks/feed/get_value.js b/app/blocks/feed/get_value.js index ee56862..a261e43 100644 --- a/app/blocks/feed/get_value.js +++ b/app/blocks/feed/get_value.js @@ -8,6 +8,11 @@ export default { mixins: ['replaceDropdownOptions'], extensions: ['populateFeedDropdown'], + connections: { + mode: "value", + output: "expression", + }, + template: `Get %FEED_KEY`, fields: { diff --git a/app/blocks/feed/selector.js b/app/blocks/feed/selector.js index 4fd5732..64f50e5 100644 --- a/app/blocks/feed/selector.js +++ b/app/blocks/feed/selector.js @@ -9,6 +9,11 @@ export default { mixins: ['replaceDropdownOptions'], extensions: ['populateFeedDropdown'], + connections: { + mode: "value", + output: "expression", + }, + template: "Feed: %FEED_KEY", fields: { diff --git a/app/blocks/feed/set_value.js b/app/blocks/feed/set_value.js index 03f91ea..dc514d4 100644 --- a/app/blocks/feed/set_value.js +++ b/app/blocks/feed/set_value.js @@ -20,6 +20,7 @@ export default { inputs: { VALUE: { description: "The value to publish to the Feed.", + check: "expression", shadow: 'io_text' } }, diff --git a/app/blocks/logic/negate.js b/app/blocks/logic/negate.js index 3ec2414..a39b714 100644 --- a/app/blocks/logic/negate.js +++ b/app/blocks/logic/negate.js @@ -5,11 +5,17 @@ export default { colour: 60, description: "Swaps a truthy value to `false`, or a falsy value to `true`.", + connections: { + mode: "value", + output: "expression", + }, + template: "not %EXPRESSION", inputs: { EXPRESSION: { description: "Block diagram that will be resolved, then have its truthiness flipped.", + check: "expression", shadow: 'io_logic_boolean' } }, diff --git a/app/blocks/logic/operation.js b/app/blocks/logic/operation.js index 82c2a1e..a1217a3 100644 --- a/app/blocks/logic/operation.js +++ b/app/blocks/logic/operation.js @@ -6,16 +6,23 @@ export default { colour: 60, description: "Perform the specifed boolean logic operation on two operands.", + connections: { + mode: "value", + output: "expression", + }, + template: `%A %OP %B`, inputs: { A: { description: "A block diagram that will be resolved to a truthy/falsy value", + check: "expression", shadow: 'io_logic_boolean' }, B: { description: "A block diagram that will be resolved to a truthy/falsy value", + check: "expression", shadow: 'io_logic_boolean' } }, diff --git a/app/blocks/matchers/matcher_boolean_operation.js b/app/blocks/matchers/matcher_boolean_operation.js index f0bd4af..36688a5 100644 --- a/app/blocks/matchers/matcher_boolean_operation.js +++ b/app/blocks/matchers/matcher_boolean_operation.js @@ -21,6 +21,7 @@ export default { inputs: { B: { + check: "expression", shadow: 'io_logic_boolean' } }, diff --git a/app/blocks/matchers/matcher_compare.js b/app/blocks/matchers/matcher_compare.js index fb7fb8f..71551dc 100644 --- a/app/blocks/matchers/matcher_compare.js +++ b/app/blocks/matchers/matcher_compare.js @@ -27,6 +27,7 @@ export default { inputs: { B: { description: "The value to compare with the Feed value.", + check: "expression", shadow: 'io_math_number' } }, diff --git a/app/blocks/matchers/matcher_text_compare.js b/app/blocks/matchers/matcher_text_compare.js index 6b8a8e1..75498d2 100644 --- a/app/blocks/matchers/matcher_text_compare.js +++ b/app/blocks/matchers/matcher_text_compare.js @@ -13,6 +13,7 @@ export default { inputs: { B: { description: "The string to compare with the Feed value.", + check: "expression", shadow: 'io_text' } }, diff --git a/app/blocks/math/arithmetic.js b/app/blocks/math/arithmetic.js index 0ec7351..bf3dcff 100644 --- a/app/blocks/math/arithmetic.js +++ b/app/blocks/math/arithmetic.js @@ -6,16 +6,23 @@ export default { inputsInline: true, description: "Perform the specified arithmetic operation on two specified operands.", + connections: { + mode: "value", + output: "expression", + }, + template: `%A %OP %B`, inputs: { A: { description: "The left side of the operation. Will be coerced to a number", + check: "expression", shadow: 'io_math_number' }, B: { description: "The right side of the operation. Will be coerced to a number", + check: "expression", shadow: 'io_math_number' }, }, diff --git a/app/blocks/math/compare.js b/app/blocks/math/compare.js index 9892b24..c47181c 100644 --- a/app/blocks/math/compare.js +++ b/app/blocks/math/compare.js @@ -6,16 +6,23 @@ export default { inputsInline: true, description: "Numerically compare two given values using the selected math operation.", + connections: { + mode: "value", + output: "expression", + }, + template: `%A %OP %B`, inputs: { A: { description: "The left side of the comparison. Will be coerced to a number", + check: "expression", shadow: 'io_math_number' }, B: { description: "The right side of the comparison. Will be coerced to a number", + check: "expression", shadow: 'io_math_number' }, }, diff --git a/app/blocks/math/constrain.js b/app/blocks/math/constrain.js index 215836b..ae69c1f 100644 --- a/app/blocks/math/constrain.js +++ b/app/blocks/math/constrain.js @@ -17,6 +17,7 @@ export default { inputs: { VALUE: { + check: "expression", shadow: "io_math_number" }, diff --git a/app/blocks/math/range.js b/app/blocks/math/range.js index 1d70012..f1c57f8 100644 --- a/app/blocks/math/range.js +++ b/app/blocks/math/range.js @@ -17,12 +17,14 @@ export default { inputs: { FROM: { description: "The lower bound of the range.", + check: "expression", bytecodeProperty: "from", shadow: "io_math_number" }, TO: { description: "The upper bound of the range.", + check: "expression", bytecodeProperty: "to", shadow: "io_math_number" }, diff --git a/app/blocks/math/round.js b/app/blocks/math/round.js index b03490f..02a04d9 100644 --- a/app/blocks/math/round.js +++ b/app/blocks/math/round.js @@ -14,6 +14,7 @@ export default { VALUE: { description: "A value you'd like to round to a whole number. Will be coerced to a number.", bytecodeProperty: "value", + check: "expression", shadow: "io_math_number" } }, diff --git a/app/blocks/text/compare.js b/app/blocks/text/compare.js index d4269bd..018ae22 100644 --- a/app/blocks/text/compare.js +++ b/app/blocks/text/compare.js @@ -6,16 +6,23 @@ export default { inputsInline: true, description: "Compare two chunks of text for equality, inequality, or inclusion.", + connections: { + mode: "value", + output: "expression", + }, + template: `%A %OP %B`, inputs: { A: { description: "The left side of the comparison. Will be coerced to a string", + check: "expression", shadow: 'io_text' }, B: { description: "The right side of the comparison. Will be coerced to a string", + check: "expression", shadow: 'io_text' }, }, diff --git a/app/blocks/text/join.js b/app/blocks/text/join.js index 6fb297e..c936b5b 100644 --- a/app/blocks/text/join.js +++ b/app/blocks/text/join.js @@ -6,16 +6,23 @@ export default { inputsInline: true, description: "Join two pieces of text into one.", + connections: { + mode: "value", + output: "expression", + }, + template: "%A + %B", inputs: { A: { description: "The first string of text", + check: "expression", shadow: "io_text" }, B: { description: "The last string of text", + check: "expression", shadow: "io_text" }, }, diff --git a/app/blocks/text/template.js b/app/blocks/text/template.js index 1960ffb..544943f 100644 --- a/app/blocks/text/template.js +++ b/app/blocks/text/template.js @@ -49,7 +49,10 @@ export default { template: "{{ %TEMPLATE", inputs: { - TEMPLATE: { shadow: 'io_text_multiline' } + TEMPLATE: { + check: "expression", + shadow: 'io_text_multiline' + } }, generators: { diff --git a/app/blocks/variables/set.js b/app/blocks/variables/set.js index c2caca8..6d5a840 100644 --- a/app/blocks/variables/set.js +++ b/app/blocks/variables/set.js @@ -16,6 +16,7 @@ export default { inputs: { VALUE: { + check: "expression", shadow: "io_text", } },