MCPcopy Create free account
hub / github.com/hashintel/hash / emit

Method emit

apps/hash-api/src/telemetry/telemetry.ts:105–125  ·  view source on GitHub ↗
(
    envelope: EventEnvelope,
    event: string,
    properties: Record<string, unknown>,
  )

Source from the content-addressed store, hash-verified

103 }
104
105 private emit(
106 envelope: EventEnvelope,
107 event: string,
108 properties: Record<string, unknown>,
109 ): void {
110 const client = this.getClient();
111 // The SDK requires an identity; drop anonymous-and-unidentified events.
112 if (!client || (!envelope.userId && !envelope.anonymousId)) {
113 return;
114 }
115 // The SDK's `apiObject` type does not accept `unknown`-valued property bags,
116 // so we cast at this boundary rather than constraining dynamic properties.
117 client.track({
118 userId: envelope.userId,
119 anonymousId: envelope.anonymousId,
120 event,
121 properties: { ...envelope.baseProperties, ...properties },
122 context: envelope.context,
123 timestamp: envelope.timestamp,
124 } as unknown as RudderAnalytics.TrackParams);
125 }
126
127 private emitPage(
128 envelope: EventEnvelope,

Callers 3

trackMethod · 0.95
trackForActorMethod · 0.95
trackFromClientMethod · 0.95

Calls 2

getClientMethod · 0.95
trackMethod · 0.80

Tested by

no test coverage detected