Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add callback information as a webhook (#10)
- Loading branch information
Showing
16 changed files
with
297 additions
and
94 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 @@ | ||
--- | ||
"@pointguard/nextjs": patch | ||
"@pointguard/core": patch | ||
--- | ||
|
||
use the webhook openapi definition for types | ||
|
||
the Next.js adapter now returns 200 for all execution requests, | ||
because we successfuly applied them. But the JSON might be an error | ||
(that is managed by Pointguard). Errors are values, Exceptions are bugs. |
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,5 @@ | ||
--- | ||
"@pointguard/cli": patch | ||
--- | ||
|
||
add executeTask webhook with the request/response schemas |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,5 +4,6 @@ members = [ | |
"crates/web_api", | ||
"crates/engine_postgres", | ||
"crates/cli", | ||
"crates/types", | ||
] | ||
resolver = "2" |
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
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
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 @@ | ||
[package] | ||
name = "pointguard_types" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
chrono = { version = "0.4.31", features = ["serde"] } | ||
schemars = "0.8.16" | ||
serde = "1.0.193" | ||
serde_json = "1.0.108" |
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,33 @@ | ||
#[derive(Debug, serde::Serialize, schemars::JsonSchema)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct InvokedTaskPayload<'a> { | ||
/// The job name to invoke | ||
pub job_name: &'a str, | ||
/// The input data of the task | ||
pub input: &'a serde_json::Value, | ||
/// The amount of times we retried this task | ||
pub retry_count: i32, | ||
/// The maximum amount of times we can retry this task | ||
pub max_retries: i32, | ||
/// The time when this task was enqueued at | ||
pub created_at: &'a chrono::DateTime<chrono::Utc>, | ||
} | ||
|
||
const fn bool_true() -> bool { | ||
true | ||
} | ||
|
||
#[derive(Debug, serde::Serialize, serde::Deserialize, schemars::JsonSchema)] | ||
#[serde(rename_all = "camelCase")] | ||
pub enum InvokedTaskResponse { | ||
/// A successful invocation | ||
Success {}, | ||
/// A failed invocation | ||
Failure { | ||
/// The reason why it failed | ||
reason: String, | ||
/// Whether or not this task is retriable | ||
#[serde(default = "bool_true")] | ||
retriable: bool, | ||
}, | ||
} |
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
Oops, something went wrong.