Skip to content
90 linesCodeBlameRaw
1import { env } from "cloudflare:workers";
2
3import {
4 accountsClient,
5 actionsClient,
6 advisoriesClient,
7 agentsClient,
8 billingClient,
9 chatClient,
10 deploymentsClient,
11 docsClient,
12 foliosClient,
13 packagesClient,
14 projectsClient,
15 eventsClient,
16 guardrailsClient,
17 identityClient,
18 inboxClient,
19 integrationsClient,
20 reposClient,
21 searchClient,
22 securityClient,
23 securitySuiteClient,
24 webhooksClient,
25 workClient,
26} from "@g1t/contracts";
27import { telemetryClient } from "@g1t/contracts/telemetry";
28
29import { instrumented } from "./perf.server";
30
31/**
32 * Each binding the clients use, timed for `Server-Timing` and, for the
33 * services that read D1 with sessions, told where to read (lib/perf.ts).
34 */
35const IDENTITY = instrumented("identity", env.IDENTITY);
36const REPOS = instrumented("repos", env.REPOS);
37const WORK = instrumented("work", env.WORK);
38const BILLING = instrumented("billing", env.BILLING);
39const EVENTS = instrumented("events", env.EVENTS);
40const INTEGRATIONS = instrumented("integrations", env.INTEGRATIONS);
41const WEBHOOKS = instrumented("webhooks", env.WEBHOOKS);
42const ACTIONS = instrumented("actions", env.ACTIONS);
43const DEPLOYMENTS = instrumented("deployments", env.DEPLOYMENTS);
44const PROJECTS = instrumented("projects", env.PROJECTS);
45const SECURITY = instrumented("security", env.SECURITY);
46const SEARCH = instrumented("search", env.SEARCH);
47const PACKAGES = instrumented("packages", env.PACKAGES);
48const CHAT = instrumented("chat", env.CHAT);
49const ARTIFACTS = instrumented("artifacts", env.ARTIFACTS);
50const TELEMETRY = env.TELEMETRY ? instrumented("telemetry", env.TELEMETRY) : null;
51
52export const identity = identityClient(IDENTITY);
53/** A person's email addresses and account security: methods of identity. */
54export const accounts = accountsClient(IDENTITY);
55export const repos = reposClient(REPOS);
56export const work = workClient(WORK);
57export const billing = billingClient(BILLING);
58export const events = eventsClient(EVENTS);
59/** Each person's inbox, which the events service keeps. */
60export const inbox = inboxClient(EVENTS);
61export const integrations = integrationsClient(INTEGRATIONS);
62export const webhooks = webhooksClient(WEBHOOKS);
63export const actions = actionsClient(ACTIONS);
64export const deployments = deploymentsClient(DEPLOYMENTS);
65export const projects = projectsClient(PROJECTS);
66export const security = securityClient(SECURITY);
67/** The security suite: patterns, bypasses, code scanning, the dependency graph, settings. */
68export const securitySuite = securitySuiteClient(SECURITY);
69/** Security advisories and private vulnerability reports: methods of the security service. */
70export const advisories = advisoriesClient(SECURITY);
71/** Memory and pull request sessions: methods of the work service. */
72export const agents = agentsClient(WORK);
73/** The network a sandbox may reach: methods of the work service. */
74export const guardrails = guardrailsClient(WORK);
75/** Search across all of g1t, and Explore. */
76export const search = searchClient(SEARCH);
77/** The workspace's registries: container images, and more to come. */
78export const packages = packagesClient(PACKAGES);
79/** Channels, direct messages and threads, where people talk. */
80export const chat = chatClient(CHAT);
81/** The artifacts service's spaces (Artifacts' spaces) and projects' docs. Its old pages are no longer read. */
82export const docs = docsClient(ARTIFACTS);
83/** Artifacts (folios): docs, and later slides, designs and dashboards, kept by the artifacts service. */
84export const folios = foliosClient(ARTIFACTS);
85
86/**
87 * Observability (services/telemetry): a project's requests, logs, traces,
88 * metrics and errors. Null where it is not deployed; the pages say so.
89 */
90export const telemetry = TELEMETRY ? telemetryClient(TELEMETRY) : null;