Skip to content

g1t/apps/web/app/lib/services.server.ts

75 lines3,007 bytesCodeBlame
1import { env } from "cloudflare:workers";
2
3import {
4 accountsClient,
5 actionsClient,
6 agentsClient,
7 billingClient,
8 contextClient,
9 deploymentsClient,
10 memoryReviewClient,
11 packagesClient,
12 projectsClient,
13 eventsClient,
14 guardrailsClient,
15 identityClient,
16 inboxClient,
17 integrationsClient,
18 reposClient,
19 searchClient,
20 securityClient,
21 securitySuiteClient,
22 webhooksClient,
23 workClient,
24} from "@g1t/contracts";
25
26import { instrumented } from "./perf.server";
27
28/**
29 * Each binding the clients use, timed for `Server-Timing` and, for the
30 * services that read D1 with sessions, told where to read (lib/perf.ts).
31 */
32const IDENTITY = instrumented("identity", env.IDENTITY);
33const REPOS = instrumented("repos", env.REPOS);
34const WORK = instrumented("work", env.WORK);
35const BILLING = instrumented("billing", env.BILLING);
36const EVENTS = instrumented("events", env.EVENTS);
37const INTEGRATIONS = instrumented("integrations", env.INTEGRATIONS);
38const WEBHOOKS = instrumented("webhooks", env.WEBHOOKS);
39const ACTIONS = instrumented("actions", env.ACTIONS);
40const DEPLOYMENTS = instrumented("deployments", env.DEPLOYMENTS);
41const PROJECTS = instrumented("projects", env.PROJECTS);
42const SECURITY = instrumented("security", env.SECURITY);
43const CONTEXT = instrumented("context", env.CONTEXT);
44const SEARCH = instrumented("search", env.SEARCH);
45const PACKAGES = instrumented("packages", env.PACKAGES);
46
47export const identity = identityClient(IDENTITY);
48/** A person's email addresses and account security: methods of identity. */
49export const accounts = accountsClient(IDENTITY);
50export const repos = reposClient(REPOS);
51export const work = workClient(WORK);
52export const billing = billingClient(BILLING);
53export const events = eventsClient(EVENTS);
54/** Each person's inbox, which the events service keeps. */
55export const inbox = inboxClient(EVENTS);
56export const integrations = integrationsClient(INTEGRATIONS);
57export const webhooks = webhooksClient(WEBHOOKS);
58export const actions = actionsClient(ACTIONS);
59export const deployments = deploymentsClient(DEPLOYMENTS);
60export const projects = projectsClient(PROJECTS);
61export const security = securityClient(SECURITY);
62/** The security suite: patterns, bypasses, code scanning, the dependency graph, settings. */
63export const securitySuite = securitySuiteClient(SECURITY);
64/** Agent runs, sessions and memory: methods of the work service. */
65export const agents = agentsClient(WORK);
66/** What agents may do in a sandbox: methods of the work service. */
67export const guardrails = guardrailsClient(WORK);
68/** The context hub: catalog, search and scorecards. */
69export const context = contextClient(CONTEXT);
70/** Search across all of g1t, and Explore. */
71export const search = searchClient(SEARCH);
72/** The workspace's registries: container images, and more to come. */
73export const packages = packagesClient(PACKAGES);
74/** Memory candidates and their review: methods of the work service. */
75export const memoryReview = memoryReviewClient(WORK);