in netlify/functions/store-ping-data-background/index.ts [39:61]
pingLoop: for (const ping of data) {
// First pass checks whether we should store the ping at all. These
// fields should never be null (based on the query), but we want to
// check to uphold the invariants of the produced data.
for (const [k, desc] of pingFields()) {
if (!desc.nullable && ping[k] === null) {
console.warn(`Unexpected null in ${k}, omitting ping`);
badData++;
continue pingLoop;
}
}
for (const [k, desc] of pingFields()) {
const inValue = ping[k];
if (desc.type === PingFieldType.IndexedString) {
const kfield = k as IndexedStringPingField;
output[kfield].values.push(getstr(kfield, inValue as string | null));
} else {
(output[k] as any[]).push(inValue);
}
}
}