dog-and-duck.quack.picky.utils
Utility functions supporting the picky validator
concat-non-empty
(concat-non-empty & lists)Quick function to replace the pattern (nil-if-empty (remove nil? (concat …))) which I’m using a lot!
context?
(context? x)Returns true iff x quacks like an ActivityStreams context, else false.
A context is either 1. the URI (actually an IRI) activitystreams-context-uri, or 2. a collection comprising that URI and a map.
filter-severity
(filter-severity reports severity)Return a list of reports taken from these reports where the severity of the report is greater than this or equal to this severity.
has-activity-type?
(has-activity-type? x)Return true if the object x has a type which is an activity type, else false.
has-actor-type?
(has-actor-type? x)Return true if the object x has a type which is an actor type, else false.
has-context?
macro
(has-context? x)True if x is an ActivityStreams object with a valid context, else false.
has-type-or-fault
(has-type-or-fault x acceptable severity token)If object x has a :type value which is acceptable, return nil; else return a fault object with this severity and token.
acceptable may be passed as either nil, a string, or a set of strings. If acceptable is nil, no type specific tests will be performed.
has-type?
(has-type? x type)Return true if object x has type type, else false.
The values of type fields of ActivityStreams objects may be lists; they are considered to have a type if the type token is a member of the list.
make-fault-object
(make-fault-object severity fault)Return a fault object with these severity, fault and narrative values.
An ActivityPub object MUST have a globally unique ID. Whether this is meaningful depends on whether we persist fault report objects and serve them, which at present I have no plans to do.
verb-type?
(verb-type? x)true if x, a string, represents a recognised ActivityStreams activity type.