connections, extensions. trigger blocks
This commit is contained in:
parent
18d649313c
commit
52c77e93dc
23 changed files with 36 additions and 20 deletions
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "on_schedule",
|
||||
bytecodeKey: "onSchedule",
|
||||
|
|
@ -68,13 +69,13 @@ export default {
|
|||
},
|
||||
|
||||
regenerators: {
|
||||
json: (blockObject, helpers) => {
|
||||
json: (blockObject) => {
|
||||
const
|
||||
EVERY_REGEX = /^(\d{1,2})(-(\d{1,2}))?\/(\d{1,2})$/m,
|
||||
isEveryBetween = cron => EVERY_REGEX.test(cron),
|
||||
|
||||
everyBetweenToBlock = (everyBetweenCron, blockType) => {
|
||||
const [ skip1, START, skip2, END, FREQUENCY ] = everyBetweenCron.match(EVERY_REGEX)
|
||||
const [ , START, , END, FREQUENCY ] = everyBetweenCron.match(EVERY_REGEX)
|
||||
|
||||
return { block: {
|
||||
type: blockType,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from "./day_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "all_days",
|
||||
name: "All Days",
|
||||
|
|
@ -17,8 +18,6 @@ export default {
|
|||
template: "Every day",
|
||||
|
||||
generators: {
|
||||
json: block => {
|
||||
return [ '*', 0 ]
|
||||
}
|
||||
json: () => [ '*', 0 ]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "day_settings",
|
||||
name: "Day Settings",
|
||||
|
|
@ -16,6 +17,6 @@ export default {
|
|||
},
|
||||
|
||||
generators: {
|
||||
json: block => { }
|
||||
json: () => { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from "./day_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "days_of_week",
|
||||
name: "Days of the Week",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from "./day_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "every_days_between",
|
||||
name: "Every X Days",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from "./day_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "one_day",
|
||||
name: "One Day",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from "./hour_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "all_hours",
|
||||
name: "All Hours",
|
||||
|
|
@ -17,8 +18,6 @@ export default {
|
|||
template: "Every hour",
|
||||
|
||||
generators: {
|
||||
json: block => {
|
||||
return [ '*', 0 ]
|
||||
}
|
||||
json: () => [ '*', 0 ]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from "./hour_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "every_hours_between",
|
||||
name: "Every X Hours",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "hour_settings",
|
||||
name: "Hour Settings",
|
||||
|
|
@ -16,6 +17,6 @@ export default {
|
|||
},
|
||||
|
||||
generators: {
|
||||
json: block => { }
|
||||
json: () => { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from "./hour_mutator.js"
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "one_hour",
|
||||
name: "One Hour",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from './minute_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "all_minutes",
|
||||
name: "All Minutes",
|
||||
|
|
@ -17,8 +18,6 @@ export default {
|
|||
template: "Every minute",
|
||||
|
||||
generators: {
|
||||
json: block => {
|
||||
return [ '*', 0 ]
|
||||
}
|
||||
json: () => [ '*', 0 ]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from './minute_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "every_minutes_between",
|
||||
name: "Every X Minutes",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "minute_settings",
|
||||
name: "Minute Settings",
|
||||
|
|
@ -16,6 +17,6 @@ export default {
|
|||
},
|
||||
|
||||
generators: {
|
||||
json: block => { }
|
||||
json: () => { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from './minute_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "one_minute",
|
||||
name: "One Minute",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from './month_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "all_months",
|
||||
name: "All Months",
|
||||
|
|
@ -17,8 +18,6 @@ export default {
|
|||
template: "Every month",
|
||||
|
||||
generators: {
|
||||
json: block => {
|
||||
return [ '*', 0 ]
|
||||
}
|
||||
json: () => [ '*', 0 ]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { makeOptions } from "#app/util/fields.js"
|
|||
import mutator from './month_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "every_months_between",
|
||||
name: "Every X Months",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "month_settings",
|
||||
name: "Month Settings",
|
||||
|
|
@ -16,6 +17,6 @@ export default {
|
|||
},
|
||||
|
||||
generators: {
|
||||
json: block => { }
|
||||
json: () => { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from './month_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "one_month",
|
||||
name: "One Month",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mutator from './month_mutator.js'
|
||||
|
||||
|
||||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: 'some_months',
|
||||
name: "Some Months",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "when_data",
|
||||
bytecodeKey: "whenData",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "when_data_matching",
|
||||
bytecodeKey: "whenDataMatching",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @type {import('#types').BlockDefinitionRaw} */
|
||||
export default {
|
||||
type: "when_data_matching_state",
|
||||
bytecodeKey: "whenDataMatchStateChanged",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
/**
|
||||
* @typedef {object} BlockConnections
|
||||
* @prop {string=} mode "value", "statement"
|
||||
* @prop {("value"|"statement")=} mode Is this block a value or statement?
|
||||
* @prop {string=} next Limits the blocks that can connect to the bottom of
|
||||
* this statement block.
|
||||
* @prop {string|string[]=} output what kinds of blocks can be inserted here?
|
||||
*/
|
||||
|
||||
|
|
@ -21,7 +23,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object.<string, BlockExtensionFunction>} BlockExtensions
|
||||
* @typedef {string[]|Object.<string, BlockExtensionFunction>} BlockExtensions
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue