@fabrika/control-contract 0.0.4 → 0.0.5

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 (3) hide show
  1. package/package.json +3 -3
  2. package/src/index.ts +98 -0
  3. package/src/rpc.ts +17 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/control-contract",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  "typecheck": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
- "@fabrika/app": "^0.0.4",
28
- "@fabrika/provider-contract": "^0.0.4"
27
+ "@fabrika/app": "^0.0.5",
28
+ "@fabrika/provider-contract": "^0.0.5"
29
29
  }
30
30
  }
package/src/index.ts CHANGED
@@ -15,6 +15,102 @@ export interface CursorList<T> {
15
15
 
16
16
  export type ProviderEnvelopeDto = ProviderEnvelope
17
17
 
18
+ export interface GitHubSourceRepositoryDto {
19
+ readonly owner: string
20
+ readonly name: string
21
+ }
22
+
23
+ export interface GitHubSourceConnectionAppDto {
24
+ readonly id: number
25
+ readonly slug: string
26
+ readonly htmlUrl: string
27
+ readonly public: boolean
28
+ readonly owner: {
29
+ readonly login: string
30
+ readonly type: 'Organization'
31
+ }
32
+ readonly permissions: {
33
+ readonly contents: 'read'
34
+ }
35
+ readonly events: readonly ['push']
36
+ }
37
+
38
+ export interface GitHubSourceConnectionInstallationDto {
39
+ readonly id: number
40
+ readonly accountLogin: string
41
+ readonly repositorySelection: 'all' | 'selected'
42
+ readonly verifiedRepositories: readonly GitHubSourceRepositoryDto[]
43
+ }
44
+
45
+ interface GitHubSourceConnectionBaseDto {
46
+ readonly provider: string
47
+ readonly kind: 'github-app'
48
+ }
49
+
50
+ export interface GitHubSourceConnectionAnonymousDto extends GitHubSourceConnectionBaseDto {
51
+ readonly state: 'anonymous'
52
+ }
53
+
54
+ export interface GitHubSourceConnectionUnavailableDto extends GitHubSourceConnectionBaseDto {
55
+ readonly state: 'unavailable'
56
+ }
57
+
58
+ export interface GitHubSourceConnectionAdoptionRequiredDto extends GitHubSourceConnectionBaseDto {
59
+ readonly state: 'adoption-required'
60
+ }
61
+
62
+ export interface GitHubSourceConnectionSetupPendingDto extends GitHubSourceConnectionBaseDto {
63
+ readonly state: 'setup-pending'
64
+ readonly connectionId: string
65
+ readonly phase: 'starting' | 'awaiting-manifest-callback' | 'persisting' | 'activating'
66
+ /** Present only while the same-origin manifest handoff can be resumed. */
67
+ readonly continuePath?: string
68
+ }
69
+
70
+ export interface GitHubSourceConnectionInstallationRequiredDto extends GitHubSourceConnectionBaseDto {
71
+ readonly state: 'installation-required'
72
+ readonly connectionId: string
73
+ readonly app: GitHubSourceConnectionAppDto
74
+ readonly installationUrl: string
75
+ }
76
+
77
+ export interface GitHubSourceConnectionConnectedDto extends GitHubSourceConnectionBaseDto {
78
+ readonly state: 'connected'
79
+ readonly connectionId: string
80
+ readonly app: GitHubSourceConnectionAppDto
81
+ readonly installation: GitHubSourceConnectionInstallationDto
82
+ }
83
+
84
+ export interface GitHubSourceConnectionRepairRequiredDto extends GitHubSourceConnectionBaseDto {
85
+ readonly state: 'repair-required'
86
+ readonly connectionId: string
87
+ readonly reason: 'interrupted-setup' | 'credential-activation' | 'installation-verification'
88
+ readonly app?: GitHubSourceConnectionAppDto
89
+ }
90
+
91
+ /** Browser-safe setup state. It never carries a private key, webhook secret, token, or source RPC key. */
92
+ export type GitHubSourceConnectionStatusDto =
93
+ | GitHubSourceConnectionAnonymousDto
94
+ | GitHubSourceConnectionUnavailableDto
95
+ | GitHubSourceConnectionAdoptionRequiredDto
96
+ | GitHubSourceConnectionSetupPendingDto
97
+ | GitHubSourceConnectionInstallationRequiredDto
98
+ | GitHubSourceConnectionConnectedDto
99
+ | GitHubSourceConnectionRepairRequiredDto
100
+
101
+ export interface StartGitHubSourceConnectionRequest {
102
+ readonly organization: string
103
+ readonly appName: string
104
+ readonly visibility: 'private' | 'public'
105
+ readonly repositories: readonly GitHubSourceRepositoryDto[]
106
+ }
107
+
108
+ export interface StartGitHubSourceConnectionResponse {
109
+ readonly connectionId: string
110
+ /** Same-origin path that starts the GitHub manifest handoff. */
111
+ readonly continuePath: string
112
+ }
113
+
18
114
  /** One redacted line of deploy output exposed by the control API. */
19
115
  export interface RunLogLine {
20
116
  readonly ts: number
@@ -259,6 +355,8 @@ export type {
259
355
  AppNamedValueInput,
260
356
  ControlRpcContract,
261
357
  CreateAppRequest,
358
+ GitHubSourceConnectionInput,
359
+ GitHubSourceConnectionRpcContract,
262
360
  NamespaceIdInput,
263
361
  OkResponse,
264
362
  PutAppEnvironmentInput,
package/src/rpc.ts CHANGED
@@ -9,6 +9,7 @@ import type {
9
9
  CursorList,
10
10
  DeploymentNamespaceDetailDto,
11
11
  DeploymentNamespaceListResponse,
12
+ GitHubSourceConnectionStatusDto,
12
13
  ListResponse,
13
14
  PlanDeploymentNamespaceRequest,
14
15
  PlanDeploymentNamespaceResponse,
@@ -21,6 +22,8 @@ import type {
21
22
  RunLogResponse,
22
23
  RunTailResponse,
23
24
  SetSecretValueRequest,
25
+ StartGitHubSourceConnectionRequest,
26
+ StartGitHubSourceConnectionResponse,
24
27
  TriggerDeployRequest,
25
28
  UpdateAppRequest,
26
29
  } from './index.js'
@@ -93,8 +96,22 @@ export interface TailRunInput extends RunIdInput {
93
96
  readonly after?: number
94
97
  }
95
98
 
99
+ export interface GitHubSourceConnectionInput {
100
+ readonly connectionId: string
101
+ }
102
+
103
+ /** Provider-neutral admin seam. A statically composed provider implements these GitHub operations. */
104
+ export interface GitHubSourceConnectionRpcContract {
105
+ status: RpcProcedure<void, GitHubSourceConnectionStatusDto>
106
+ start: RpcProcedure<StartGitHubSourceConnectionRequest, StartGitHubSourceConnectionResponse>
107
+ adoptExisting: RpcProcedure<void, GitHubSourceConnectionStatusDto>
108
+ verifyInstallation: RpcProcedure<GitHubSourceConnectionInput, GitHubSourceConnectionStatusDto>
109
+ repair: RpcProcedure<GitHubSourceConnectionInput, GitHubSourceConnectionStatusDto>
110
+ }
111
+
96
112
  /** Portable Delivery control API, implemented alongside the backward-compatible REST transport. */
97
113
  export interface ControlRpcContract {
114
+ sourceConnection: GitHubSourceConnectionRpcContract
98
115
  apps: {
99
116
  list: RpcProcedure<void, ListResponse<AppDto>>
100
117
  get: RpcProcedure<AppIdInput, AppDto>