-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from flow-build/feature/FBS-82
Feature/fbs 82
- Loading branch information
Showing
30 changed files
with
1,520 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exports.up = function (knex) { | ||
return knex.schema.createTable("blueprints", (table) => { | ||
table.uuid("id").primary(); | ||
table.jsonb("blueprint_spec").notNullable(); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema.dropTable("blueprints"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
exports.up = function (knex) { | ||
return knex.schema.createTable("workflows", (table) => { | ||
table.uuid("id").primary(); | ||
table.string("server", 255).notNullable(); | ||
table.uuid("blueprint_id").notNullable(); | ||
table.foreign("blueprint_id").references("blueprints.id"); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema.dropTable("workflows"); | ||
}; |
12 changes: 12 additions & 0 deletions
12
db/migrations/20221014154948_create_diagram_to_workflow_table.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
exports.up = function (knex) { | ||
return knex.schema.createTable("diagram_to_workflow", (table) => { | ||
table.uuid("diagram_id").notNullable().unique(); | ||
table.uuid("workflow_id").notNullable(); | ||
table.foreign("diagram_id").references("diagrams.id"); | ||
table.foreign("workflow_id").references("workflows.id"); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
return knex.schema.dropTable("diagram_to_workflow"); | ||
}; |
10 changes: 10 additions & 0 deletions
10
db/migrations/20221014160432_rename_workflow_id_on_diagrams.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exports.up = function(knex) { | ||
return knex.schema.alterTable("diagrams", function (table) { | ||
table.renameColumn("workflow_id", "blueprint_id"); | ||
table.foreign("blueprint_id").references("blueprints.id"); | ||
}) | ||
}; | ||
|
||
exports.down = function(knex) { | ||
return knex.schema.dropTable("diagrams"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { blueprint_spec } = require('../../examples/blueprint'); | ||
|
||
exports.seed = async function(knex) { | ||
await knex('blueprints').del(); | ||
await knex('blueprints').insert([ | ||
{ | ||
id: '42a9a60e-e2e5-4d21-8e2f-67318b100e38', | ||
blueprint_spec: blueprint_spec | ||
} | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exports.seed = async function(knex) { | ||
await knex('workflows').del(); | ||
await knex('workflows').insert([ | ||
{ | ||
id: 'ae7e95f6-787a-4c0b-8e1a-4cc122e7d68f', | ||
server: 'http://localhost:3000', | ||
blueprint_id: '42a9a60e-e2e5-4d21-8e2f-67318b100e38' | ||
} | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
exports.seed = async function(knex) { | ||
await knex('diagram_to_workflow').del(); | ||
await knex('diagram_to_workflow').insert([ | ||
{ | ||
diagram_id: 'd655538b-95d3-4627-acaf-b391fdc25142', | ||
workflow_id: 'ae7e95f6-787a-4c0b-8e1a-4cc122e7d68f', | ||
} | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
module.exports = { | ||
"name": "Medium BP", | ||
"description": "Medium BP for tests", | ||
"blueprint_spec": { | ||
"requirements": ["core"], | ||
"prepare": [], | ||
"nodes": [ | ||
{ | ||
"id": "START", | ||
"name": "Start node", | ||
"next": "GET-USER", | ||
"type": "Start", | ||
"lane_id": "anyone", | ||
"parameters": { | ||
"input_schema": {}, | ||
"timeout": 3600 | ||
} | ||
}, | ||
{ | ||
"id": "GET-USER", | ||
"name": "Get user", | ||
"next": "BAG-USER", | ||
"type": "SystemTask", | ||
"lane_id": "anyone", | ||
"category": "http", | ||
"parameters": { | ||
"input": {}, | ||
"request": { | ||
"url": { | ||
"$mustache": "https://api/user" | ||
}, | ||
"verb": "GET", | ||
"headers": { | ||
"Authorization": { | ||
"$mustache": "UserLogin apikey=\"{{{actor_data.token}}}\"" | ||
} | ||
} | ||
}, | ||
"valid_response_codes": [ | ||
200, | ||
204 | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "BAG-USER", | ||
"name": "Bag user", | ||
"next": "USER-ACTIVITY", | ||
"type": "SystemTask", | ||
"lane_id": "anyone", | ||
"category": "setToBag", | ||
"parameters": { | ||
"input": { | ||
"user": { | ||
"$ref": "result.data" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "USER-ACTIVITY", | ||
"name": "Send activity to user", | ||
"next": "BAG-USER-ACTIVITY", | ||
"type": "UserTask", | ||
"lane_id": "anyone", | ||
"parameters": { | ||
"input": { | ||
"user": { | ||
"$ref": "bag.user" | ||
}, | ||
"actor_id": { | ||
"$ref": "bag.actor_id" | ||
} | ||
}, | ||
"action": "USER_ACTIVITY", | ||
"activity_manager": "commit" | ||
} | ||
}, | ||
{ | ||
"id": "BAG-USER-ACTIVITY", | ||
"name": "Bag user action", | ||
"next": "GET-STATUS", | ||
"type": "SystemTask", | ||
"lane_id": "anyone", | ||
"category": "setToBag", | ||
"parameters": { | ||
"input": { | ||
"user_action": { | ||
"$ref": "result.activities[0].data.action" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "GET-STATUS", | ||
"name": "Get status of user", | ||
"next": "CHECK-STATUS", | ||
"type": "SystemTask", | ||
"lane_id": "anyone", | ||
"category": "http", | ||
"parameters": { | ||
"input": {}, | ||
"request": { | ||
"url": { | ||
"$mustache": "https://api/user/status" | ||
}, | ||
"verb": "GET", | ||
"headers": { | ||
"Authorization": { | ||
"$mustache": "UserLogin apikey=\"{{{actor_data.token}}}\"" | ||
} | ||
} | ||
}, | ||
"valid_response_codes": [ | ||
200, | ||
204 | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "CHECK-STATUS", | ||
"name": "Check user status", | ||
"next": { | ||
"default": "CHECK-USER-ACTIVITY", | ||
"ERROR": "NOTIFY-ERROR" | ||
}, | ||
"type": "Flow", | ||
"lane_id": "anyone", | ||
"parameters": { | ||
"input": { | ||
"decision": { | ||
"$ref": "result.data.status" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "CHECK-USER-ACTIVITY", | ||
"name": "Check user action", | ||
"next": { | ||
"cancel": "END-CANCEL", | ||
"default": "END-ACTIVITY", | ||
"continue": "END-CONTINUE" | ||
}, | ||
"type": "Flow", | ||
"lane_id": "anyone", | ||
"parameters": { | ||
"input": { | ||
"decision": { | ||
"$ref": "bag.user_action" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "END-CANCEL", | ||
"name": "Finish node", | ||
"next": null, | ||
"type": "Finish", | ||
"lane_id": "anyone" | ||
}, | ||
{ | ||
"id": "END-ACTIVITY", | ||
"name": "Finish node", | ||
"next": null, | ||
"type": "Finish", | ||
"lane_id": "anyone" | ||
}, | ||
{ | ||
"id": "NOTIFY-ERROR", | ||
"name": "User task node", | ||
"next": "END-ERROR", | ||
"type": "UserTask", | ||
"lane_id": "anyone", | ||
"parameters": { | ||
"input": {}, | ||
"action": "NOTIFY_ERROR", | ||
"activity_manager": "notify" | ||
} | ||
}, | ||
{ | ||
"id": "END-ERROR", | ||
"name": "Finish process after CANCELED", | ||
"next": null, | ||
"type": "Finish", | ||
"lane_id": "anyone" | ||
}, | ||
{ | ||
"id": "END-CONTINUE", | ||
"name": "Finish process after REDIRECT", | ||
"next": null, | ||
"type": "Finish", | ||
"lane_id": "anyone" | ||
} | ||
], | ||
"lanes": [ | ||
{ | ||
"id": "anyone", | ||
"name": "anyone", | ||
"rule": ["fn", ["&", "args"], true] | ||
} | ||
], | ||
"environment": {} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
const { DiagramCore } = require('./src/diagramCore'); | ||
const { BlueprintCore } = require('./src/blueprintCore'); | ||
const { WorkflowCore } = require('./src/workflowCore'); | ||
const { DiagramToWorkflowCore } = require('./src/diagramToWorkflowCore'); | ||
|
||
module.exports = { | ||
DiagramCore | ||
DiagramCore, | ||
BlueprintCore, | ||
WorkflowCore, | ||
DiagramToWorkflowCore | ||
} |
Oops, something went wrong.