forked from tsai/budibase
26 changed files with 156 additions and 395 deletions
@ -1,31 +0,0 @@ |
|||||
// import { isString } from "lodash/fp"
|
|
||||
|
|
||||
// import {
|
|
||||
// BB_STATE_BINDINGPATH,
|
|
||||
// BB_STATE_FALLBACK,
|
|
||||
// BB_STATE_BINDINGSOURCE,
|
|
||||
// isBound,
|
|
||||
// parseBinding,
|
|
||||
// } from "@budibase/client/src/state/parseBinding"
|
|
||||
|
|
||||
// export const isBinding = isBound
|
|
||||
|
|
||||
// export const setBinding = ({ path, fallback, source }, binding = {}) => {
|
|
||||
// if (isNonEmptyString(path)) binding[BB_STATE_BINDINGPATH] = path
|
|
||||
// if (isNonEmptyString(fallback)) binding[BB_STATE_FALLBACK] = fallback
|
|
||||
// binding[BB_STATE_BINDINGSOURCE] = source || "store"
|
|
||||
// return binding
|
|
||||
// }
|
|
||||
|
|
||||
// export const getBinding = val => {
|
|
||||
// const binding = parseBinding(val)
|
|
||||
// return binding
|
|
||||
// ? binding
|
|
||||
// : {
|
|
||||
// path: "",
|
|
||||
// source: "store",
|
|
||||
// fallback: "",
|
|
||||
// }
|
|
||||
// }
|
|
||||
|
|
||||
// const isNonEmptyString = s => isString(s) && s.length > 0
|
|
||||
@ -1,67 +0,0 @@ |
|||||
// export const BB_STATE_BINDINGPATH = "##bbstate"
|
|
||||
// export const BB_STATE_BINDINGSOURCE = "##bbsource"
|
|
||||
// export const BB_STATE_FALLBACK = "##bbstatefallback"
|
|
||||
|
|
||||
// export const isBound = prop => !!parseBinding(prop)
|
|
||||
|
|
||||
// /**
|
|
||||
// *
|
|
||||
// * @param {object|string|number} prop - component property to parse for a dynamic state binding
|
|
||||
// * @returns {object|boolean}
|
|
||||
// */
|
|
||||
// export const parseBinding = prop => {
|
|
||||
// if (!prop) return false
|
|
||||
|
|
||||
// if (isBindingExpression(prop)) {
|
|
||||
// return parseBindingExpression(prop)
|
|
||||
// }
|
|
||||
|
|
||||
// if (isAlreadyBinding(prop)) {
|
|
||||
// return {
|
|
||||
// path: prop.path,
|
|
||||
// source: prop.source || "store",
|
|
||||
// fallback: prop.fallback,
|
|
||||
// }
|
|
||||
// }
|
|
||||
|
|
||||
// if (hasBindingObject(prop)) {
|
|
||||
// return {
|
|
||||
// path: prop[BB_STATE_BINDINGPATH],
|
|
||||
// fallback: prop[BB_STATE_FALLBACK] || "",
|
|
||||
// source: prop[BB_STATE_BINDINGSOURCE] || "store",
|
|
||||
// }
|
|
||||
// }
|
|
||||
// }
|
|
||||
|
|
||||
// export const isStoreBinding = binding => binding && binding.source === "store"
|
|
||||
// export const isContextBinding = binding =>
|
|
||||
// binding && binding.source === "context"
|
|
||||
// // export const isEventBinding = binding => binding && binding.source === "event"
|
|
||||
|
|
||||
// const hasBindingObject = prop =>
|
|
||||
// typeof prop === "object" && prop[BB_STATE_BINDINGPATH] !== undefined
|
|
||||
|
|
||||
// const isAlreadyBinding = prop => typeof prop === "object" && prop.path
|
|
||||
|
|
||||
// const isBindingExpression = prop =>
|
|
||||
// typeof prop === "string" &&
|
|
||||
// (prop.startsWith("state.") ||
|
|
||||
// prop.startsWith("context.") ||
|
|
||||
// prop.startsWith("event.") ||
|
|
||||
// prop.startsWith("route."))
|
|
||||
|
|
||||
// const parseBindingExpression = prop => {
|
|
||||
// let [source, ...rest] = prop.split(".")
|
|
||||
// let path = rest.join(".")
|
|
||||
|
|
||||
// if (source === "route") {
|
|
||||
// source = "state"
|
|
||||
// path = `##routeParams.${path}`
|
|
||||
// }
|
|
||||
|
|
||||
// return {
|
|
||||
// fallback: "", // TODO: provide fallback support
|
|
||||
// source,
|
|
||||
// path,
|
|
||||
// }
|
|
||||
// }
|
|
||||
@ -1,43 +0,0 @@ |
|||||
const TEST_WORKFLOW = { |
|
||||
"_id": "8ebe79daf1c744c7ab204c0b964e309e", |
|
||||
"_rev": "37-94ae573300721c98267cc1d18822c94d", |
|
||||
"name": "Workflow", |
|
||||
"type": "workflow", |
|
||||
"definition": { |
|
||||
"next": { |
|
||||
"type": "CLIENT", |
|
||||
"actionId": "SET_STATE", |
|
||||
"args": { |
|
||||
"path": "myPath", |
|
||||
"value": "foo" |
|
||||
}, |
|
||||
"next": { |
|
||||
"type": "SERVER", |
|
||||
"actionId": "SAVE_RECORD", |
|
||||
"args": { |
|
||||
"record": { |
|
||||
"modelId": "f452a2b9c3a94251b9ea7be1e20e3b19", |
|
||||
"name": "workflowRecord" |
|
||||
}, |
|
||||
"next": { |
|
||||
"type": "CLIENT", |
|
||||
"actionId": "SET_STATE", |
|
||||
"args": { |
|
||||
"path": "myPath", |
|
||||
"value": "$context.SAVE_RECORD.record.name" |
|
||||
}, |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
describe("Workflow Orchestrator", () => { |
|
||||
it("executes a workflow", () => { |
|
||||
}); |
|
||||
|
|
||||
it("", () => { |
|
||||
|
|
||||
}); |
|
||||
}); |
|
||||
Loading…
Reference in new issue