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

Function createTemporalClient

libs/@local/hash-backend-utils/src/temporal.ts:11–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9export const temporalNamespace = "HASH";
10
11export const createTemporalClient = async () => {
12 const temporalServerHost = getRequiredEnv("HASH_TEMPORAL_SERVER_HOST");
13
14 const host = new URL(temporalServerHost).hostname;
15 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- we don't want an empty string
16 const port = parseInt(process.env.HASH_TEMPORAL_SERVER_PORT || "7233", 10);
17
18 const connection = await Connection.connect({
19 address: `${host}:${port}`,
20 });
21
22 // When OTEL is configured the active trace context (e.g. an Express
23 // HTTP span) is injected into workflow start headers. The worker-side
24 // interceptors extract it and parent the workflow + activity spans
25 // off the caller's trace.
26 const interceptors = process.env.HASH_OTLP_ENDPOINT
27 ? {
28 workflow: [
29 new OpenTelemetryWorkflowClientInterceptor({
30 tracer: trace.getTracer("@temporalio/interceptors-opentelemetry"),
31 }),
32 ],
33 }
34 : undefined;
35
36 return new TemporalClient({
37 connection,
38 namespace: temporalNamespace,
39 interceptors,
40 });
41};

Callers 9

getTemporalClientFunction · 0.90
mainFunction · 0.90
setup-admin.tsFile · 0.90
processEntityChangeFunction · 0.90
linearWebhookFunction · 0.90
requestExternalInputFunction · 0.90
getTemporalClientFunction · 0.90
log-progress.tsFile · 0.90

Calls 2

getRequiredEnvFunction · 0.85
connectMethod · 0.45

Tested by

no test coverage detected