@sealant/api-contracts-next 0.0.0-next.0 → 0.39.0-next.682

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +202 -0
  2. package/dist/core-api/access-tokens.d.ts +126 -0
  3. package/dist/core-api/access-tokens.js +72 -0
  4. package/dist/core-api/budgets.d.ts +15 -0
  5. package/dist/core-api/budgets.js +13 -0
  6. package/dist/core-api/connected-accounts.d.ts +226 -0
  7. package/dist/core-api/connected-accounts.js +128 -0
  8. package/dist/core-api/control-plane.d.ts +1318 -0
  9. package/dist/core-api/control-plane.js +31 -0
  10. package/dist/core-api/github.d.ts +261 -0
  11. package/dist/core-api/github.js +153 -0
  12. package/dist/core-api/inference.d.ts +223 -0
  13. package/dist/core-api/inference.js +139 -0
  14. package/dist/core-api/oci-names.d.ts +21 -0
  15. package/dist/core-api/oci-names.js +44 -0
  16. package/dist/core-api/packages.d.ts +179 -0
  17. package/dist/core-api/packages.js +60 -0
  18. package/dist/core-api/profiles.d.ts +188 -0
  19. package/dist/core-api/profiles.js +88 -0
  20. package/dist/core-api/record-events.d.ts +209 -0
  21. package/dist/core-api/record-events.js +193 -0
  22. package/dist/core-api/registries.d.ts +106 -0
  23. package/dist/core-api/registries.js +85 -0
  24. package/dist/core-api/runs.d.ts +516 -0
  25. package/dist/core-api/runs.js +284 -0
  26. package/dist/core-api/sessions.d.ts +390 -0
  27. package/dist/core-api/sessions.js +264 -0
  28. package/dist/core-api/ssh-keys.d.ts +120 -0
  29. package/dist/core-api/ssh-keys.js +108 -0
  30. package/dist/core-api/system.d.ts +51 -0
  31. package/dist/core-api/system.js +41 -0
  32. package/dist/core-api/users.d.ts +71 -0
  33. package/dist/core-api/users.js +48 -0
  34. package/dist/core-api/workspaces.d.ts +1880 -0
  35. package/dist/core-api/workspaces.js +980 -0
  36. package/dist/index.d.ts +18 -0
  37. package/dist/index.js +18 -0
  38. package/dist/workspace-environment.d.ts +124 -0
  39. package/dist/workspace-environment.js +259 -0
  40. package/package.json +31 -9
@@ -0,0 +1,31 @@
1
+ import { HttpApi, OpenApi } from "effect/unstable/httpapi";
2
+ import { AccessTokensGroup } from "./access-tokens.js";
3
+ import { ConnectedAccountsGroup } from "./connected-accounts.js";
4
+ import { GitHubGroup } from "./github.js";
5
+ import { InferenceGroup } from "./inference.js";
6
+ import { PackagesGroup } from "./packages.js";
7
+ import { ProfilesGroup } from "./profiles.js";
8
+ import { RegistriesGroup } from "./registries.js";
9
+ import { RunsGroup } from "./runs.js";
10
+ import { SessionsGroup } from "./sessions.js";
11
+ import { SshKeysGroup } from "./ssh-keys.js";
12
+ import { SystemGroup } from "./system.js";
13
+ import { UsersGroup } from "./users.js";
14
+ import { WorkspacesGroup } from "./workspaces.js";
15
+ export const ControlPlaneAPI = HttpApi.make("sealantControlPlaneApi")
16
+ .add(SystemGroup)
17
+ .add(PackagesGroup.prefix("/v1/packages"))
18
+ .add(WorkspacesGroup.prefix("/v1/workspaces"))
19
+ .add(SshKeysGroup.prefix("/v1/ssh-keys"))
20
+ .add(ConnectedAccountsGroup.prefix("/v1/connected-accounts"))
21
+ .add(ProfilesGroup.prefix("/v1/profiles"))
22
+ .add(InferenceGroup.prefix("/v1/inference"))
23
+ .add(RunsGroup.prefix("/v1/runs"))
24
+ .add(SessionsGroup.prefix("/v1/sessions"))
25
+ .add(AccessTokensGroup.prefix("/v1/access-tokens"))
26
+ .add(RegistriesGroup.prefix("/v1/registries"))
27
+ .add(GitHubGroup.prefix("/v1/github"))
28
+ .add(UsersGroup.prefix("/v1/users"))
29
+ .annotate(OpenApi.Title, "Sealant Control Plane API")
30
+ .annotate(OpenApi.Version, "0.0.0")
31
+ .annotate(OpenApi.Description, "Sealant control-plane HTTP API.");
@@ -0,0 +1,261 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
+ export declare const messageResponseSchema: Schema.Struct<{
4
+ readonly message: Schema.String;
5
+ }>;
6
+ export declare const githubInstallationsQuerySchema: Schema.Struct<{
7
+ readonly userId: Schema.String;
8
+ }>;
9
+ export type GitHubInstallationsQuery = typeof githubInstallationsQuerySchema.Type;
10
+ export declare const githubInstallationRepositoriesQuerySchema: Schema.Struct<{
11
+ readonly userId: Schema.String;
12
+ readonly search: Schema.optional<Schema.String>;
13
+ }>;
14
+ export type GitHubInstallationRepositoriesQuery = typeof githubInstallationRepositoriesQuerySchema.Type;
15
+ export declare const syncGitHubInstallationQuerySchema: Schema.Struct<{
16
+ readonly userId: Schema.String;
17
+ }>;
18
+ export type SyncGitHubInstallationQuery = typeof syncGitHubInstallationQuerySchema.Type;
19
+ export declare const importGitHubInstallationRequestSchema: Schema.Struct<{
20
+ readonly userId: Schema.String;
21
+ readonly externalInstallationId: Schema.String;
22
+ }>;
23
+ export type ImportGitHubInstallationRequest = typeof importGitHubInstallationRequestSchema.Type;
24
+ export declare const githubWebhookHeadersSchema: Schema.Struct<{
25
+ readonly "x-github-delivery": Schema.optional<Schema.String>;
26
+ readonly "x-github-event": Schema.optional<Schema.String>;
27
+ readonly "x-hub-signature-256": Schema.optional<Schema.String>;
28
+ }>;
29
+ export type GitHubWebhookHeaders = typeof githubWebhookHeadersSchema.Type;
30
+ export declare const githubInstallationSummarySchema: Schema.Struct<{
31
+ readonly installationId: Schema.String;
32
+ readonly externalInstallationId: Schema.String;
33
+ readonly accountLogin: Schema.String;
34
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
35
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
36
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
37
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
38
+ }>;
39
+ export type GitHubInstallationSummary = typeof githubInstallationSummarySchema.Type;
40
+ export declare const githubInstallationRepositorySummarySchema: Schema.Struct<{
41
+ readonly installationRepositoryId: Schema.String;
42
+ readonly installationId: Schema.String;
43
+ readonly repositoryId: Schema.String;
44
+ readonly externalRepositoryId: Schema.String;
45
+ readonly owner: Schema.String;
46
+ readonly name: Schema.String;
47
+ readonly fullName: Schema.String;
48
+ readonly defaultBranch: Schema.String;
49
+ readonly isPrivate: Schema.Boolean;
50
+ readonly isArchived: Schema.Boolean;
51
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
52
+ }>;
53
+ export type GitHubInstallationRepositorySummary = typeof githubInstallationRepositorySummarySchema.Type;
54
+ export declare const listGitHubInstallationsResponseSchema: Schema.Struct<{
55
+ readonly items: Schema.$Array<Schema.Struct<{
56
+ readonly installationId: Schema.String;
57
+ readonly externalInstallationId: Schema.String;
58
+ readonly accountLogin: Schema.String;
59
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
60
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
61
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
62
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
63
+ }>>;
64
+ }>;
65
+ export type ListGitHubInstallationsResponse = typeof listGitHubInstallationsResponseSchema.Type;
66
+ export declare const listGitHubInstallationRepositoriesResponseSchema: Schema.Struct<{
67
+ readonly items: Schema.$Array<Schema.Struct<{
68
+ readonly installationRepositoryId: Schema.String;
69
+ readonly installationId: Schema.String;
70
+ readonly repositoryId: Schema.String;
71
+ readonly externalRepositoryId: Schema.String;
72
+ readonly owner: Schema.String;
73
+ readonly name: Schema.String;
74
+ readonly fullName: Schema.String;
75
+ readonly defaultBranch: Schema.String;
76
+ readonly isPrivate: Schema.Boolean;
77
+ readonly isArchived: Schema.Boolean;
78
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
79
+ }>>;
80
+ }>;
81
+ export type ListGitHubInstallationRepositoriesResponse = typeof listGitHubInstallationRepositoriesResponseSchema.Type;
82
+ export declare const syncGitHubInstallationResponseSchema: Schema.Struct<{
83
+ readonly installationId: Schema.String;
84
+ readonly syncedRepositoryCount: Schema.Number;
85
+ readonly syncedAt: Schema.String;
86
+ }>;
87
+ export type SyncGitHubInstallationResponse = typeof syncGitHubInstallationResponseSchema.Type;
88
+ export declare const importGitHubInstallationResponseSchema: Schema.Struct<{
89
+ readonly installation: Schema.Struct<{
90
+ readonly installationId: Schema.String;
91
+ readonly externalInstallationId: Schema.String;
92
+ readonly accountLogin: Schema.String;
93
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
94
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
95
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
96
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
97
+ }>;
98
+ readonly syncedRepositoryCount: Schema.Number;
99
+ readonly syncedAt: Schema.String;
100
+ }>;
101
+ export type ImportGitHubInstallationResponse = typeof importGitHubInstallationResponseSchema.Type;
102
+ export declare const githubWebhookResponseSchema: Schema.Struct<{
103
+ readonly deliveryId: Schema.String;
104
+ readonly status: Schema.Literals<readonly ["received", "processed", "failed", "ignored"]>;
105
+ }>;
106
+ export type GitHubWebhookResponse = typeof githubWebhookResponseSchema.Type;
107
+ declare const GitHubBadRequestError_base: Schema.Class<GitHubBadRequestError, Schema.TaggedStruct<"GitHubBadRequestError", {
108
+ readonly message: Schema.String;
109
+ }>, import("effect/Cause").YieldableError>;
110
+ export declare class GitHubBadRequestError extends GitHubBadRequestError_base {
111
+ }
112
+ declare const GitHubUnauthorizedError_base: Schema.Class<GitHubUnauthorizedError, Schema.TaggedStruct<"GitHubUnauthorizedError", {
113
+ readonly message: Schema.String;
114
+ }>, import("effect/Cause").YieldableError>;
115
+ export declare class GitHubUnauthorizedError extends GitHubUnauthorizedError_base {
116
+ }
117
+ declare const GitHubForbiddenError_base: Schema.Class<GitHubForbiddenError, Schema.TaggedStruct<"GitHubForbiddenError", {
118
+ readonly message: Schema.String;
119
+ }>, import("effect/Cause").YieldableError>;
120
+ export declare class GitHubForbiddenError extends GitHubForbiddenError_base {
121
+ }
122
+ declare const GitHubNotFoundError_base: Schema.Class<GitHubNotFoundError, Schema.TaggedStruct<"GitHubNotFoundError", {
123
+ readonly message: Schema.String;
124
+ }>, import("effect/Cause").YieldableError>;
125
+ export declare class GitHubNotFoundError extends GitHubNotFoundError_base {
126
+ }
127
+ declare const GitHubServiceUnavailableError_base: Schema.Class<GitHubServiceUnavailableError, Schema.TaggedStruct<"GitHubServiceUnavailableError", {
128
+ readonly message: Schema.String;
129
+ }>, import("effect/Cause").YieldableError>;
130
+ export declare class GitHubServiceUnavailableError extends GitHubServiceUnavailableError_base {
131
+ }
132
+ declare const GitHubInternalServerError_base: Schema.Class<GitHubInternalServerError, Schema.TaggedStruct<"GitHubInternalServerError", {
133
+ readonly message: Schema.String;
134
+ }>, import("effect/Cause").YieldableError>;
135
+ export declare class GitHubInternalServerError extends GitHubInternalServerError_base {
136
+ }
137
+ export declare const GitHubGroup: HttpApiGroup.HttpApiGroup<"github", HttpApiEndpoint.HttpApiEndpoint<"handleWebhook", "POST", "/webhooks", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.String>, HttpApiEndpoint.StringTree<Schema.Struct<{
138
+ readonly "x-github-delivery": Schema.optional<Schema.String>;
139
+ readonly "x-github-event": Schema.optional<Schema.String>;
140
+ readonly "x-hub-signature-256": Schema.optional<Schema.String>;
141
+ }>>, HttpApiEndpoint.Json<Schema.Struct<{
142
+ readonly deliveryId: Schema.String;
143
+ readonly status: Schema.Literals<readonly ["received", "processed", "failed", "ignored"]>;
144
+ }>>, HttpApiEndpoint.Json<typeof GitHubBadRequestError | typeof GitHubUnauthorizedError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"importInstallation", "POST", "/installations/import", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
145
+ readonly userId: Schema.String;
146
+ readonly externalInstallationId: Schema.String;
147
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
148
+ readonly installation: Schema.Struct<{
149
+ readonly installationId: Schema.String;
150
+ readonly externalInstallationId: Schema.String;
151
+ readonly accountLogin: Schema.String;
152
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
153
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
154
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
155
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
156
+ }>;
157
+ readonly syncedRepositoryCount: Schema.Number;
158
+ readonly syncedAt: Schema.String;
159
+ }>>, HttpApiEndpoint.Json<typeof GitHubNotFoundError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listInstallationRepositories", "GET", "/installations/:installationId/repositories", HttpApiEndpoint.StringTree<Schema.Struct<{
160
+ readonly installationId: Schema.String;
161
+ }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
162
+ readonly userId: Schema.String;
163
+ readonly search: Schema.optional<Schema.String>;
164
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
165
+ readonly items: Schema.$Array<Schema.Struct<{
166
+ readonly installationRepositoryId: Schema.String;
167
+ readonly installationId: Schema.String;
168
+ readonly repositoryId: Schema.String;
169
+ readonly externalRepositoryId: Schema.String;
170
+ readonly owner: Schema.String;
171
+ readonly name: Schema.String;
172
+ readonly fullName: Schema.String;
173
+ readonly defaultBranch: Schema.String;
174
+ readonly isPrivate: Schema.Boolean;
175
+ readonly isArchived: Schema.Boolean;
176
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
177
+ }>>;
178
+ }>>, HttpApiEndpoint.Json<typeof GitHubForbiddenError | typeof GitHubNotFoundError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listInstallations", "GET", "/installations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
179
+ readonly userId: Schema.String;
180
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
181
+ readonly items: Schema.$Array<Schema.Struct<{
182
+ readonly installationId: Schema.String;
183
+ readonly externalInstallationId: Schema.String;
184
+ readonly accountLogin: Schema.String;
185
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
186
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
187
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
188
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
189
+ }>>;
190
+ }>>, HttpApiEndpoint.Json<typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"syncInstallation", "POST", "/installations/:installationId/sync", HttpApiEndpoint.StringTree<Schema.Struct<{
191
+ readonly installationId: Schema.String;
192
+ }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
193
+ readonly userId: Schema.String;
194
+ }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
195
+ readonly installationId: Schema.String;
196
+ readonly syncedRepositoryCount: Schema.Number;
197
+ readonly syncedAt: Schema.String;
198
+ }>>, HttpApiEndpoint.Json<typeof GitHubForbiddenError | typeof GitHubNotFoundError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never>, false>;
199
+ export declare const GitHubApi: HttpApi.HttpApi<"sealantGitHubApi", HttpApiGroup.HttpApiGroup<"github", HttpApiEndpoint.HttpApiEndpoint<"handleWebhook", "POST", "/webhooks", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.String>, HttpApiEndpoint.StringTree<Schema.Struct<{
200
+ readonly "x-github-delivery": Schema.optional<Schema.String>;
201
+ readonly "x-github-event": Schema.optional<Schema.String>;
202
+ readonly "x-hub-signature-256": Schema.optional<Schema.String>;
203
+ }>>, HttpApiEndpoint.Json<Schema.Struct<{
204
+ readonly deliveryId: Schema.String;
205
+ readonly status: Schema.Literals<readonly ["received", "processed", "failed", "ignored"]>;
206
+ }>>, HttpApiEndpoint.Json<typeof GitHubBadRequestError | typeof GitHubUnauthorizedError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"importInstallation", "POST", "/installations/import", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
207
+ readonly userId: Schema.String;
208
+ readonly externalInstallationId: Schema.String;
209
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
210
+ readonly installation: Schema.Struct<{
211
+ readonly installationId: Schema.String;
212
+ readonly externalInstallationId: Schema.String;
213
+ readonly accountLogin: Schema.String;
214
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
215
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
216
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
217
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
218
+ }>;
219
+ readonly syncedRepositoryCount: Schema.Number;
220
+ readonly syncedAt: Schema.String;
221
+ }>>, HttpApiEndpoint.Json<typeof GitHubNotFoundError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listInstallationRepositories", "GET", "/installations/:installationId/repositories", HttpApiEndpoint.StringTree<Schema.Struct<{
222
+ readonly installationId: Schema.String;
223
+ }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
224
+ readonly userId: Schema.String;
225
+ readonly search: Schema.optional<Schema.String>;
226
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
227
+ readonly items: Schema.$Array<Schema.Struct<{
228
+ readonly installationRepositoryId: Schema.String;
229
+ readonly installationId: Schema.String;
230
+ readonly repositoryId: Schema.String;
231
+ readonly externalRepositoryId: Schema.String;
232
+ readonly owner: Schema.String;
233
+ readonly name: Schema.String;
234
+ readonly fullName: Schema.String;
235
+ readonly defaultBranch: Schema.String;
236
+ readonly isPrivate: Schema.Boolean;
237
+ readonly isArchived: Schema.Boolean;
238
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
239
+ }>>;
240
+ }>>, HttpApiEndpoint.Json<typeof GitHubForbiddenError | typeof GitHubNotFoundError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listInstallations", "GET", "/installations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
241
+ readonly userId: Schema.String;
242
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
243
+ readonly items: Schema.$Array<Schema.Struct<{
244
+ readonly installationId: Schema.String;
245
+ readonly externalInstallationId: Schema.String;
246
+ readonly accountLogin: Schema.String;
247
+ readonly accountType: Schema.Literals<readonly ["organization", "user"]>;
248
+ readonly status: Schema.Literals<readonly ["active", "suspended", "deleted"]>;
249
+ readonly repositorySelection: Schema.Literals<readonly ["all", "selected"]>;
250
+ readonly lastSyncedAt: Schema.optional<Schema.String>;
251
+ }>>;
252
+ }>>, HttpApiEndpoint.Json<typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"syncInstallation", "POST", "/installations/:installationId/sync", HttpApiEndpoint.StringTree<Schema.Struct<{
253
+ readonly installationId: Schema.String;
254
+ }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
255
+ readonly userId: Schema.String;
256
+ }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
257
+ readonly installationId: Schema.String;
258
+ readonly syncedRepositoryCount: Schema.Number;
259
+ readonly syncedAt: Schema.String;
260
+ }>>, HttpApiEndpoint.Json<typeof GitHubForbiddenError | typeof GitHubNotFoundError | typeof GitHubServiceUnavailableError | typeof GitHubInternalServerError>, never, never>, false>>;
261
+ export {};
@@ -0,0 +1,153 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi, } from "effect/unstable/httpapi";
3
+ // These literal sets mirror the control-plane DB enums (packages/db `control-plane.ts`). They are
4
+ // INLINED here so the public contract package carries NO @sealant/db dependency — which keeps
5
+ // consumers like @sealant/sdk free of drizzle/pg. Keep them in sync with the db schema.
6
+ const GitHubInstallationAccountTypeSchema = Schema.Literals(["organization", "user"]);
7
+ const GitHubInstallationStatusSchema = Schema.Literals(["active", "suspended", "deleted"]);
8
+ const GitHubInstallationRepositorySelectionSchema = Schema.Literals(["all", "selected"]);
9
+ const GitHubWebhookDeliveryStatusSchema = Schema.Literals([
10
+ "received",
11
+ "processed",
12
+ "failed",
13
+ "ignored",
14
+ ]);
15
+ const NonEmptyString = Schema.String.check(Schema.isNonEmpty(), Schema.isTrimmed());
16
+ export const messageResponseSchema = Schema.Struct({
17
+ message: Schema.String,
18
+ });
19
+ export const githubInstallationsQuerySchema = Schema.Struct({
20
+ userId: NonEmptyString,
21
+ });
22
+ export const githubInstallationRepositoriesQuerySchema = Schema.Struct({
23
+ userId: NonEmptyString,
24
+ search: Schema.optional(NonEmptyString),
25
+ });
26
+ export const syncGitHubInstallationQuerySchema = Schema.Struct({
27
+ userId: NonEmptyString,
28
+ });
29
+ export const importGitHubInstallationRequestSchema = Schema.Struct({
30
+ userId: NonEmptyString,
31
+ externalInstallationId: NonEmptyString,
32
+ });
33
+ export const githubWebhookHeadersSchema = Schema.Struct({
34
+ "x-github-delivery": Schema.optional(NonEmptyString),
35
+ "x-github-event": Schema.optional(NonEmptyString),
36
+ "x-hub-signature-256": Schema.optional(NonEmptyString),
37
+ });
38
+ export const githubInstallationSummarySchema = Schema.Struct({
39
+ installationId: NonEmptyString,
40
+ externalInstallationId: NonEmptyString,
41
+ accountLogin: NonEmptyString,
42
+ accountType: GitHubInstallationAccountTypeSchema,
43
+ status: GitHubInstallationStatusSchema,
44
+ repositorySelection: GitHubInstallationRepositorySelectionSchema,
45
+ lastSyncedAt: Schema.optional(Schema.String),
46
+ });
47
+ export const githubInstallationRepositorySummarySchema = Schema.Struct({
48
+ installationRepositoryId: NonEmptyString,
49
+ installationId: NonEmptyString,
50
+ repositoryId: NonEmptyString,
51
+ externalRepositoryId: NonEmptyString,
52
+ owner: NonEmptyString,
53
+ name: NonEmptyString,
54
+ fullName: NonEmptyString,
55
+ defaultBranch: NonEmptyString,
56
+ isPrivate: Schema.Boolean,
57
+ isArchived: Schema.Boolean,
58
+ lastSyncedAt: Schema.optional(Schema.String),
59
+ });
60
+ export const listGitHubInstallationsResponseSchema = Schema.Struct({
61
+ items: Schema.Array(githubInstallationSummarySchema),
62
+ });
63
+ export const listGitHubInstallationRepositoriesResponseSchema = Schema.Struct({
64
+ items: Schema.Array(githubInstallationRepositorySummarySchema),
65
+ });
66
+ export const syncGitHubInstallationResponseSchema = Schema.Struct({
67
+ installationId: NonEmptyString,
68
+ syncedRepositoryCount: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
69
+ syncedAt: Schema.String,
70
+ });
71
+ export const importGitHubInstallationResponseSchema = Schema.Struct({
72
+ installation: githubInstallationSummarySchema,
73
+ syncedRepositoryCount: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
74
+ syncedAt: Schema.String,
75
+ });
76
+ export const githubWebhookResponseSchema = Schema.Struct({
77
+ deliveryId: NonEmptyString,
78
+ status: GitHubWebhookDeliveryStatusSchema,
79
+ });
80
+ export class GitHubBadRequestError extends Schema.TaggedErrorClass()("GitHubBadRequestError", {
81
+ message: Schema.String,
82
+ }, { httpApiStatus: 400 }) {
83
+ }
84
+ export class GitHubUnauthorizedError extends Schema.TaggedErrorClass()("GitHubUnauthorizedError", {
85
+ message: Schema.String,
86
+ }, { httpApiStatus: 401 }) {
87
+ }
88
+ export class GitHubForbiddenError extends Schema.TaggedErrorClass()("GitHubForbiddenError", {
89
+ message: Schema.String,
90
+ }, { httpApiStatus: 403 }) {
91
+ }
92
+ export class GitHubNotFoundError extends Schema.TaggedErrorClass()("GitHubNotFoundError", {
93
+ message: Schema.String,
94
+ }, { httpApiStatus: 404 }) {
95
+ }
96
+ export class GitHubServiceUnavailableError extends Schema.TaggedErrorClass()("GitHubServiceUnavailableError", {
97
+ message: Schema.String,
98
+ }, { httpApiStatus: 503 }) {
99
+ }
100
+ export class GitHubInternalServerError extends Schema.TaggedErrorClass()("GitHubInternalServerError", {
101
+ message: Schema.String,
102
+ }, { httpApiStatus: 500 }) {
103
+ }
104
+ const installationIdParams = Schema.Struct({ installationId: NonEmptyString });
105
+ export const GitHubGroup = HttpApiGroup.make("github")
106
+ .add(HttpApiEndpoint.get("listInstallations", "/installations", {
107
+ query: githubInstallationsQuerySchema,
108
+ success: listGitHubInstallationsResponseSchema,
109
+ error: [GitHubServiceUnavailableError, GitHubInternalServerError],
110
+ }))
111
+ .add(HttpApiEndpoint.get("listInstallationRepositories", "/installations/:installationId/repositories", {
112
+ params: installationIdParams,
113
+ query: githubInstallationRepositoriesQuerySchema,
114
+ success: listGitHubInstallationRepositoriesResponseSchema,
115
+ error: [
116
+ GitHubForbiddenError,
117
+ GitHubNotFoundError,
118
+ GitHubServiceUnavailableError,
119
+ GitHubInternalServerError,
120
+ ],
121
+ }))
122
+ .add(HttpApiEndpoint.post("importInstallation", "/installations/import", {
123
+ payload: importGitHubInstallationRequestSchema,
124
+ success: importGitHubInstallationResponseSchema,
125
+ error: [GitHubNotFoundError, GitHubServiceUnavailableError, GitHubInternalServerError],
126
+ }))
127
+ .add(HttpApiEndpoint.post("syncInstallation", "/installations/:installationId/sync", {
128
+ params: installationIdParams,
129
+ query: syncGitHubInstallationQuerySchema,
130
+ success: syncGitHubInstallationResponseSchema,
131
+ error: [
132
+ GitHubForbiddenError,
133
+ GitHubNotFoundError,
134
+ GitHubServiceUnavailableError,
135
+ GitHubInternalServerError,
136
+ ],
137
+ }))
138
+ .add(HttpApiEndpoint.post("handleWebhook", "/webhooks", {
139
+ headers: githubWebhookHeadersSchema,
140
+ payload: Schema.String.pipe(HttpApiSchema.asText({ contentType: "application/json" })),
141
+ success: githubWebhookResponseSchema.pipe(HttpApiSchema.status(202)),
142
+ error: [
143
+ GitHubBadRequestError,
144
+ GitHubUnauthorizedError,
145
+ GitHubServiceUnavailableError,
146
+ GitHubInternalServerError,
147
+ ],
148
+ }))
149
+ .annotate(OpenApi.Description, "GitHub App installation and webhook control-plane operations.");
150
+ export const GitHubApi = HttpApi.make("sealantGitHubApi")
151
+ .add(GitHubGroup)
152
+ .annotate(OpenApi.Title, "Sealant Control Plane API - GitHub")
153
+ .annotate(OpenApi.Version, "0.0.0");