diff --git a/index.bs b/index.bs index 19a88b321..54dd228d0 100644 --- a/index.bs +++ b/index.bs @@ -655,6 +655,38 @@ Note: The [=report window list/total window=] is conceptually a union of [=report windows=], because there are no gaps in time between any of the [=report windows|windows=]. +
count
"
+:: Number of triggers attributed.
+: "value_sum
"
+:: Sum of the value of triggers.
+
+[=summary window operator/count=]
".
+1. If |map|["`summary_window_operator`"] [=map/exists=]:
+ 1. If |map|["`summary_window_operator`"] is not a [=string=], return an
+ error.
+ 1. If |map|["`summary_window_operator`"] is not a
+ [=summary window operator=], return an error.
+ 1. Set |value| to |map|["`summary_window_operator`"].
+1. Return |value|.
+
+To parse summary buckets given a [=map=] |map| and an integer |maxEventLevelReports|:
+
+1. Let |values| be [=the inclusive range|the range=] 1 to
+ |maxEventLevelReports|, inclusive.
+1. If |map|["`summary_buckets`"] [=map/exists=]:
+ 1. If |map|["`summary_buckets`"] is not a [=list=], [=list/is empty=], or
+ its [=list/size=] is greater than |maxEventLevelReports|, return an
+ error.
+ 1. Set |values| to |map|["`summary_buckets`"].
+1. Let |prev| be 0.
+1. Let |summaryBuckets| be an [=list/is empty|empty=] [=list=].
+1. [=list/iterate|For each=] |item| of |values|:
+ 1. If |item| is not an integer or cannot be represented by an unsigned
+ 32-bit integer, or is less than or equal to |prev|, return an error.
+ 1. Let |summaryBucket| be a new [=summary bucket=] whose items are
+
+ : [=summary bucket/start=]
+ :: |prev|
+ : [=summary bucket/end=]
+ :: |item| - 1
+
+ 1. [=list/Append=] |summaryBucket| to |summaryBuckets|.
+ 1. Set |prev| to |item|.
+1. Return |summaryBuckets|.
+
To parse trigger specs given a [=map=] |map|, a [=moment=]
|sourceTime|, a [=duration=] |expiry|, a [=report window list=]
|defaultReportWindows|, an unsigned 32-bit integer
@@ -1915,7 +1983,8 @@ To parse trigger specs given a [=map=] |map|, a [=moment=]
1. Set |i| to |i| + 1.
1. Return |specs|.
-Issue: Parse "`summary_window_operator`" and "`summary_buckets`" fields.
+Issue: Invoke [=parse summary buckets=] and [=parse summary window operator=]
+from this algorithm.
To parse source-registration JSON given a [=byte sequence=]
|json|, a [=suitable origin=] |sourceOrigin|, a [=suitable origin=] |reportingOrigin|, a