Files
tasks/chasm/lib/tests/library.go
Alan WuandGitHub 18b007c44f Add BusinessID search attribute option (#8803)
## What changed?
Add BusinessID search attribute option. CHASM archetype developers that
require Visibility will need to call `WithBusinessIDAlias` as a required
RegistrableComponent option.

Adds validation if BusinessIDAlias option is not set, but contains
Visibility as a child component, registration to the CHASM Registry will
fail.

## Why?
CHASM archetypes define separate aliases for BusinessID, eg.
`ActivityID`, `ScheduleID`, etc. End users of these archetypes will
query Visibility using a filter such as `ActivityID = my-activity-id`,
and should be able to map to the underlying shared `system` visibility
storage column.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2026-01-05 13:46:33 -05:00

44 lines
949 B
Go

package tests
import "go.temporal.io/server/chasm"
type (
library struct {
chasm.UnimplementedLibrary
}
)
var Library = &library{}
func (l *library) Name() string {
return "tests"
}
func (l *library) Components() []*chasm.RegistrableComponent {
return []*chasm.RegistrableComponent{
chasm.NewRegistrableComponent[*PayloadStore]("payloadStore",
chasm.WithBusinessIDAlias("PayloadStoreId"),
chasm.WithSearchAttributes(
PayloadTotalCountSearchAttribute,
PayloadTotalSizeSearchAttribute,
PayloadExecutionStatusSearchAttribute,
),
),
}
}
func (l *library) Tasks() []*chasm.RegistrableTask {
return []*chasm.RegistrableTask{
chasm.NewRegistrablePureTask(
"payloadTTLPureTask",
&PayloadTTLPureTaskValidator{},
&PayloadTTLPureTaskExecutor{},
),
chasm.NewRegistrableSideEffectTask(
"payloadTTLSideEffectTask",
&PayloadTTLSideEffectTaskValidator{},
&PayloadTTLSideEffectTaskExecutor{},
),
}
}