chore: import upstream snapshot with attribution
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / results (push) Has been cancelled
CI / deadcode (push) Has been cancelled
CI / e2e-live (push) Has been cancelled
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / results (push) Has been cancelled
CI / deadcode (push) Has been cancelled
CI / e2e-live (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package event
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// GenericProcessor is the fallback for unregistered event types.
|
||||
// Compact mode parses the event payload as a map; Raw mode passes through raw.Event.
|
||||
type GenericProcessor struct{}
|
||||
|
||||
func (p *GenericProcessor) EventType() string { return "" }
|
||||
|
||||
func (p *GenericProcessor) Transform(_ context.Context, raw *RawEvent, mode TransformMode) interface{} {
|
||||
if mode == TransformRaw {
|
||||
return raw
|
||||
}
|
||||
// Compact: parse event as flat map, inject envelope metadata so AI
|
||||
// can always identify the event type regardless of which processor ran.
|
||||
var eventMap map[string]interface{}
|
||||
if err := json.Unmarshal(raw.Event, &eventMap); err != nil {
|
||||
return raw
|
||||
}
|
||||
eventMap["type"] = raw.Header.EventType
|
||||
if raw.Header.EventID != "" {
|
||||
eventMap["event_id"] = raw.Header.EventID
|
||||
}
|
||||
if raw.Header.CreateTime != "" {
|
||||
eventMap["timestamp"] = raw.Header.CreateTime
|
||||
}
|
||||
return eventMap
|
||||
}
|
||||
|
||||
func (p *GenericProcessor) DeduplicateKey(raw *RawEvent) string { return raw.Header.EventID }
|
||||
func (p *GenericProcessor) WindowStrategy() WindowConfig { return WindowConfig{} }
|
||||
Reference in New Issue
Block a user