Skip to content

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

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