MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / generateTelemetryCSV

Function generateTelemetryCSV

src/telemetryGenerator.node.ts:609–667  ·  view source on GitHub ↗
(output: TelemetryEntry[])

Source from the content-addressed store, hash-verified

607 }
608}
609function generateTelemetryCSV(output: TelemetryEntry[]) {
610 const entries: {}[] = [];
611 output.forEach((o) => {
612 if (o.propertyGroups.length === 0) {
613 // an event without any properties.
614 entries.push({
615 eventName: o.name,
616 eventDescription: o.description,
617 eventConstant: o.constantName,
618 owner: o.gdpr.owner,
619 feature: Array.isArray(o.gdpr.feature) ? o.gdpr.feature.join(', ') : o.gdpr.feature || '',
620 tags: Array.isArray(o.gdpr.tags) ? o.gdpr.tags.join(', ') : o.gdpr.tags || '',
621 groupDescription: '',
622 propertyName: '',
623 propertyDescription: '',
624 propertyType: '',
625 propertyPossibleValues: '',
626 propertyIsNullable: ''
627 });
628 }
629 o.propertyGroups.forEach((og) => {
630 const groupDescription =
631 typeof og.description === 'string' ? og.description : (og.description || []).join('\n');
632 og.properties
633 .sort((a, b) => a.name.localeCompare(b.name))
634 .forEach((p) => {
635 const description = Array.isArray(p.descriptions)
636 ? p.descriptions.join('\n')
637 : p.descriptions || '';
638 const possibleValues =
639 Array.isArray(p.possibleValues) && p.possibleValues.length
640 ? p.possibleValues
641 .map((item) => `${item.value} ${item.comment ? `(${item.comment})` : ''}`)
642 .join('\n')
643 : '';
644
645 entries.push({
646 eventName: o.name,
647 eventDescription: o.description,
648 eventConstant: o.constantName,
649 owner: o.gdpr.owner,
650 feature: Array.isArray(o.gdpr.feature) ? o.gdpr.feature.join(', ') : o.gdpr.feature || '',
651 tags: Array.isArray(o.gdpr.tags) ? o.gdpr.tags.join(', ') : o.gdpr.tags || '',
652 groupDescription,
653 propertyName: p.name,
654 propertyDescription: description,
655 propertyType: p.type,
656 propertyPossibleValues: possibleValues,
657 propertyIsNullable: p.isNullable
658 });
659 });
660 });
661 });
662
663 const fields = Object.keys(entries[0]);
664 const parser = new Parser({ fields });
665 const csv = parser.parse(entries);
666 fs.writeFileSync('./TELEMETRY.csv', csv);

Callers 1

generateDocumentationFunction · 0.85

Calls 7

joinMethod · 0.80
mapMethod · 0.80
pushMethod · 0.65
sortMethod · 0.65
parseMethod · 0.65
forEachMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected