Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257,304 changes: 257,304 additions & 0 deletions api/make-apps.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions api/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ dependencies {
implementation("ch.qos.logback:logback-classic:$logback_version")
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")

implementation("javax.validation:validation-api:2.0.1.Final")
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.3")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.3")

// see src/main/resources/json/external_dependencies.json
implementation("joda-time:joda-time:2.10.14")
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.tomaszezula.make.server

import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.tomaszezula.make.server.config.MakeConfig
import com.tomaszezula.make.server.handlers.CreateScenarioHandler
import com.tomaszezula.make.server.model.api.App
import com.tomaszezula.make.server.model.web.AuthToken
import com.tomaszezula.make.server.plugins.configureRouting
import com.typesafe.config.ConfigFactory
Expand All @@ -17,9 +21,13 @@ import io.ktor.server.config.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.plugins.contentnegotiation.*
import java.io.File
import java.net.URI

fun main() {
// TODO remove - this is for a quick testing only!
appBuilder()

val config = HoconApplicationConfig(ConfigFactory.load())
val client = HttpClient(CIO) {
install(Logging) {
Expand Down Expand Up @@ -60,3 +68,14 @@ private fun Throwable.isTimeoutException(): Boolean = when (this) {
is SocketTimeoutException -> true
else -> false
}

private fun appBuilder() {
val mapper = ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModule(KotlinModule.Builder().build())
val app = mapper.readValue(
File(ClassLoader.getSystemResource("json/apps/util.json").path),
App::class.java
)
println(app)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tomaszezula.make.server.model.api

data class App(
val name: String,
val version: String,
val author: String,
val label: String,
val theme: String,
val description: String,
val keywords: String,
val triggers: List<Trigger>?,
val transformers: List<Transformer>?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.tomaszezula.make.server.model.api

data class Options(val label: String, val options: List<Option>) {
data class Option(val label: String, val value: String)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.tomaszezula.make.server.model.api

data class Output(val icon: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.tomaszezula.make.server.model.api

data class Parameter(
val name: String,
val label: String,
val type: String,
val spec: List<Spec>,
val required: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tomaszezula.make.server.model.api

data class Spec(
val name: String,
val label: String,
val type: String,
val help: String?,
val required: Boolean?,
val grouped: Boolean?,
val multiline: Boolean?,
val spec: List<Spec>?,
val options: List<Options>?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.tomaszezula.make.server.model.api

data class Transformer(
val name: String,
val label: String,
val description: String,
val expect: List<Spec>,
val `interface`: List<Spec>,
val output: Output
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.tomaszezula.make.server.model.api

import java.net.URI

data class Trigger(
val name: String,
val label: String,
val description: String,
val parameters: List<Parameter>,
val samples: URI,
val `interface`: URI,
val output: Output
)

180 changes: 180 additions & 0 deletions api/server/src/main/resources/json/apps/builtin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"name": "builtin",
"version": "1.4.5",
"author": "Patrik Simek",
"label": "Flow Control",
"description": "Repeat, iterate and aggregate arrays into one or more modules. Create simple and complex scenarios to automate your workflows with Make.",
"theme": "#a1d36e",
"parameters": [],
"actions": [
{
"name": "BasicRepeater",
"label": "Repeater",
"parameters": [],
"expect": [
{
"name": "start",
"type": "number",
"required": true,
"default": 1,
"label": "Initial value"
},
{
"name": "repeats",
"type": "number",
"required": true,
"default": 3,
"label": "Repeats",
"validate": {
"min": 0,
"max": 10000
}
},
{
"name": "step",
"type": "number",
"required": true,
"default": 1,
"label": "Step",
"advanced": true
}
],
"interface": [
{
"name": "i",
"type": "number"
}
],
"output": {
"feeder": true,
"results": "repeats"
}
}
],
"aggregators": [
{
"name": "BasicAggregator",
"label": "Array aggregator",
"parameters": [],
"interface": [
{
"name": "array",
"label": "Array",
"type": "array",
"spec": []
}
],
"defaults": {
"expect": {
"editable": true
}
}
}
],
"feeders": [
{
"name": "BasicFeeder",
"label": "Iterator",
"parameters": [],
"expect": [
{
"name": "array",
"type": "array",
"spec": [],
"label": "Array",
"editable": true,
"mode": "edit"
}
]
}
],
"convergers": [
{
"name": "BasicConverger",
"label": "Converger",
"public": false
}
],
"routers": [
{
"name": "BasicRouter",
"label": "Router",
"parameters": [],
"interface": [],
"expect": "*"
}
],
"directives": [
{
"name": "Rollback",
"label": "Rollback",
"selector": "* ! * self"
},
{
"name": "Break",
"label": "Break",
"selector": "* ! * self",
"expect": [
{
"name": "retry",
"type": "boolean",
"label": "Automatically complete execution",
"required": true,
"editable": true,
"default": true,
"nested": [
{
"name": "count",
"type": "uinteger",
"label": "Number of attempts",
"required": true,
"default": 3,
"help": "The maximum number of attempts allowed for the execution to be tried and completed automatically. If they fail, the execution will have to be completed manually.",
"validate": {
"min": 1,
"max": 10000
}
},
{
"name": "interval",
"type": "uinteger",
"label": "Interval between attempts",
"required": true,
"default": 15,
"help": "In minutes",
"validate": {
"min": 1,
"max": 44640
}
}
]
}
]
},
{
"name": "Resume",
"label": "Resume",
"selector": "* ! * self"
},
{
"name": "Commit",
"label": "Commit",
"selector": "* ! * self"
},
{
"name": "Ignore",
"label": "Ignore",
"selector": "* ! * self"
}
],
"keywords": "feeder,for,until,while,repeat,iterate",
"componentType": "app",
"dependencies": {
"accounts": [],
"hooks": [],
"keys": []
},
"icon": "/img/packages/builtin.png",
"premium": false,
"latest": true
}
Loading