MCPcopy Create free account
hub / github.com/TanStack/cli / createTelemetryRequestBody

Function createTelemetryRequestBody

packages/cli/src/telemetry.ts:101–128  ·  view source on GitHub ↗
(
  event: string,
  distinctId: string,
  properties: TelemetryProperties,
)

Source from the content-addressed store, hash-verified

99}
100
101function createTelemetryRequestBody(
102 event: string,
103 distinctId: string,
104 properties: TelemetryProperties,
105) {
106 const params = new URLSearchParams({
107 cid: distinctId,
108 en: event,
109 tid: TELEMETRY_PROPERTY_ID,
110 v: '2',
111 })
112
113 for (const [key, value] of Object.entries(properties)) {
114 const normalizedValue = normalizeParamValue(value)
115 if (normalizedValue === undefined) {
116 continue
117 }
118
119 const normalizedKey = normalizeParamKey(key)
120 const paramName =
121 typeof normalizedValue === 'number'
122 ? `${TELEMETRY_NUMERIC_PREFIX}${normalizedKey}`
123 : `${TELEMETRY_STRING_PREFIX}${normalizedKey}`
124 params.append(paramName, String(normalizedValue))
125 }
126
127 return params.toString()
128}
129
130function getErrorCode(error: unknown) {
131 if (!error || typeof error !== 'object') {

Callers 1

postEventFunction · 0.85

Calls 4

normalizeParamValueFunction · 0.85
normalizeParamKeyFunction · 0.85
toStringMethod · 0.80
appendMethod · 0.65

Tested by

no test coverage detected