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

69 lines2,713 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 integrationsClient,
17 reposClient,
18 searchClient,
19 securityClient,
20 webhooksClient,
21 workClient,
22} from "@g1t/contracts";
23
24import { instrumented } from "./perf.server";
25
26/**
27 * Each binding the clients use, timed for `Server-Timing` and, for the
28 * services that read D1 with sessions, told where to read (lib/perf.ts).
29 */
30const IDENTITY = instrumented("identity", env.IDENTITY);
31const REPOS = instrumented("repos", env.REPOS);
32const WORK = instrumented("work", env.WORK);
33const BILLING = instrumented("billing", env.BILLING);
34const EVENTS = instrumented("events", env.EVENTS);
35const INTEGRATIONS = instrumented("integrations", env.INTEGRATIONS);
36const WEBHOOKS = instrumented("webhooks", env.WEBHOOKS);
37const ACTIONS = instrumented("actions", env.ACTIONS);
38const DEPLOYMENTS = instrumented("deployments", env.DEPLOYMENTS);
39const PROJECTS = instrumented("projects", env.PROJECTS);
40const SECURITY = instrumented("security", env.SECURITY);
41const CONTEXT = instrumented("context", env.CONTEXT);
42const SEARCH = instrumented("search", env.SEARCH);
43const PACKAGES = instrumented("packages", env.PACKAGES);
44
45export const identity = identityClient(IDENTITY);
46/** A person's email addresses and account security: methods of identity. */
47export const accounts = accountsClient(IDENTITY);
48export const repos = reposClient(REPOS);
49export const work = workClient(WORK);
50export const billing = billingClient(BILLING);
51export const events = eventsClient(EVENTS);
52export const integrations = integrationsClient(INTEGRATIONS);
53export const webhooks = webhooksClient(WEBHOOKS);
54export const actions = actionsClient(ACTIONS);
55export const deployments = deploymentsClient(DEPLOYMENTS);
56export const projects = projectsClient(PROJECTS);
57export const security = securityClient(SECURITY);
58/** Agent runs, sessions and memory: methods of the work service. */
59export const agents = agentsClient(WORK);
60/** What agents may do in a sandbox: methods of the work service. */
61export const guardrails = guardrailsClient(WORK);
62/** The context hub: catalog, search and scorecards. */
63export const context = contextClient(CONTEXT);
64/** Search across all of g1t, and Explore. */
65export const search = searchClient(SEARCH);
66/** The workspace's registries: container images, and more to come. */
67export const packages = packagesClient(PACKAGES);
68/** Memory candidates and their review: methods of the work service. */
69export const memoryReview = memoryReviewClient(WORK);