feat(eda): per-org workflow enable/disable gating bindings
A workflow-enablement control-plane resource lists, per org, the workflows that org has disabled. A binding targeting a disabled workflow is skipped at dispatch like an unarmed one, is refused on save, and is flagged on the binding list; the workflows page toggles it. Bindings now carry the org_id column they already had in storage, over the State Store wire too. Org-owned workflow definitions are deferred to a follow-up bead: they need the caller's org, which the access chain resolves.
This commit is contained in:
1 parent
e6916d57bb
commit
dc1b61d394
29 files changed
+543
-34
No files matched your search
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
const armedBindingsForSource = `-- name: ArmedBindingsForSource :many
|
||||
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
|
||||
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param, org_id
|
||||
FROM bindings WHERE source = $1 AND status = 'armed' ORDER BY created_at DESC
|
||||
`
|
||||
|
||||
@@ -30,6 +30,7 @@ type ArmedBindingsForSourceRow struct {
|
||||
Filter string
|
||||
Inputs string
|
||||
RepoParam string
|
||||
OrgID string
|
||||
}
|
||||
|
||||
func (q *Queries) ArmedBindingsForSource(ctx context.Context, source string) ([]ArmedBindingsForSourceRow, error) {
|
||||
@@ -56,6 +57,7 @@ func (q *Queries) ArmedBindingsForSource(ctx context.Context, source string) ([]
|
||||
&i.Filter,
|
||||
&i.Inputs,
|
||||
&i.RepoParam,
|
||||
&i.OrgID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -177,7 +179,7 @@ func (q *Queries) EventTypesForSource(ctx context.Context, source string) ([]Eve
|
||||
}
|
||||
|
||||
const getBinding = `-- name: GetBinding :one
|
||||
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
|
||||
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param, org_id
|
||||
FROM bindings WHERE id = $1
|
||||
`
|
||||
|
||||
@@ -196,6 +198,7 @@ type GetBindingRow struct {
|
||||
Filter string
|
||||
Inputs string
|
||||
RepoParam string
|
||||
OrgID string
|
||||
}
|
||||
|
||||
func (q *Queries) GetBinding(ctx context.Context, id string) (GetBindingRow, error) {
|
||||
@@ -216,6 +219,7 @@ func (q *Queries) GetBinding(ctx context.Context, id string) (GetBindingRow, err
|
||||
&i.Filter,
|
||||
&i.Inputs,
|
||||
&i.RepoParam,
|
||||
&i.OrgID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -524,7 +528,7 @@ func (q *Queries) InsertToolCall(ctx context.Context, arg InsertToolCallParams)
|
||||
}
|
||||
|
||||
const listBindings = `-- name: ListBindings :many
|
||||
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param
|
||||
SELECT id, name, source, mapping, workflow, owner, repo, version, status, created_at, updated_at, filter, inputs, repo_param, org_id
|
||||
FROM bindings ORDER BY created_at DESC
|
||||
`
|
||||
|
||||
@@ -543,6 +547,7 @@ type ListBindingsRow struct {
|
||||
Filter string
|
||||
Inputs string
|
||||
RepoParam string
|
||||
OrgID string
|
||||
}
|
||||
|
||||
func (q *Queries) ListBindings(ctx context.Context) ([]ListBindingsRow, error) {
|
||||
@@ -569,6 +574,7 @@ func (q *Queries) ListBindings(ctx context.Context) ([]ListBindingsRow, error) {
|
||||
&i.Filter,
|
||||
&i.Inputs,
|
||||
&i.RepoParam,
|
||||
&i.OrgID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user