Skip to content
Source
Sign inSign up
Open History to see the last commit

driver.ts

31 lines1.1 KB

1import {
2 defineSourceControlDriver,
3 withOwnServices,
4} from "@t3tools/source-control-core/server/driver";
5import * as Effect from "effect/Effect";
6import * as Layer from "effect/Layer";
7​
8import { definition } from "../shared/definition.ts";
9​
10import * as BitbucketApi from "./BitbucketApi.ts";
11import * as BitbucketPullRequestApi from "./BitbucketPullRequestApi.ts";
12import * as BitbucketPullRequestProvider from "./BitbucketPullRequestProvider.ts";
13import * as BitbucketSourceControlProvider from "./BitbucketSourceControlProvider.ts";
14​
15// Every setting the API reads from the environment is optional, so reading them cannot fail.
16const services = BitbucketPullRequestApi.layer.pipe(
17 Layer.provideMerge(BitbucketApi.layer),
18 Layer.orDie,
19);
20​
21const makeInstance = Effect.all({
22 sourceControl: BitbucketSourceControlProvider.make,
23 discovery: BitbucketSourceControlProvider.makeDiscovery,
24 pullRequests: BitbucketPullRequestProvider.make,
25});
26​
27export const driver = defineSourceControlDriver({
28 kind: definition.kind,
29 definition,
30 make: withOwnServices(makeInstance, services),
31});