RedactionDirective events.redaction-directive@1
Generated at from
openvibe-contracts v0.33.0 and
openvibe-sdk v0.5.0.
- Version
- 1.0.0
- Owner
- events
- Visibility
- public
- Status
- active
- Compatibility
- backward
- Decision
- ADR-026
- Schema
https://openvibe.network/contracts/events/redaction-directive.v1.json
payload.redacts (ADR-026): a producer takes back events it published earlier. Any event may carry it, normally the producer's own *.deleted event. It names event_ids, or subject_type + subject_ids, or both, never an empty list. event_ids names events directly; subject_type + subject_ids names every stored event of the same source (for an app, the same project and environment) about those subjects. OpenVibe.Events rewrites each target into a tombstone (events.tombstone-payload@1) in the transaction that stores the directive. Naming another source's event is 403 events.redaction_not_allowed (the whole batch is refused); a malformed directive is 422 events.invalid_redaction. An event that carries a directive is never redacted itself.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
event_ids | array of string | Events to redact by id. Duplicates are ignored. |
| |
subject_type | string | Envelope subject.type of the events to redact (chat_message, post…). Goes with subject_ids. |
| |
subject_ids | array of string | Envelope subject.id values; every not-yet-redacted event of the same source about each one is redacted. |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: by-event-id
{
"event_ids": [
"evt_01JAB2C3D4E5F6G7H8J9K0MNPQ"
]
}Valid: by-subject
{
"subject_type": "chat_message",
"subject_ids": [
"1201",
"1202"
]
}Rejected: empty-lists
{
"event_ids": [],
"subject_type": "post",
"subject_ids": []
}Rejected: names-nothing
{}Rejected: type-without-ids
{
"subject_type": "chat_message"
}Rejected: unknown-field
{
"event_ids": [
"evt_01JAB2C3D4E5F6G7H8J9K0MNPQ"
],
"reason": "spam"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('events.redaction-directive@1', value); // { valid, errors: [{ path, message }] }