@fabrika/control-contract 0.0.7 → 0.0.9
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.
- package/package.json +3 -3
- package/src/index.ts +45 -0
- package/src/rpc.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/control-contract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
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.
|
|
28
|
-
"@fabrika/provider-contract": "^0.0.
|
|
27
|
+
"@fabrika/app": "^0.0.9",
|
|
28
|
+
"@fabrika/provider-contract": "^0.0.9"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/index.ts
CHANGED
|
@@ -81,6 +81,50 @@ export interface GitHubSourceConnectionConnectedDto extends GitHubSourceConnecti
|
|
|
81
81
|
readonly installation: GitHubSourceConnectionInstallationDto
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
export type GitHubSourceConnectionWorkflowDto = Exclude<GitHubSourceConnectionStatusDto, GitHubSourceConnectionConnectedDto>
|
|
85
|
+
|
|
86
|
+
export const GITHUB_SOURCE_CONNECTION_DEFAULT_PAGE_SIZE = 50
|
|
87
|
+
export const GITHUB_SOURCE_CONNECTION_MAX_PAGE_SIZE = 100
|
|
88
|
+
export const GITHUB_SOURCE_CONNECTION_PAGE_CURSOR_MAX_LENGTH = 512
|
|
89
|
+
|
|
90
|
+
export interface GitHubSourceConnectionListInput {
|
|
91
|
+
readonly cursor?: string
|
|
92
|
+
readonly limit?: number
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface GitHubSourceConnectionListResponse {
|
|
96
|
+
readonly items: readonly GitHubSourceConnectionConnectedDto[]
|
|
97
|
+
readonly nextCursor: string | null
|
|
98
|
+
/** The one global non-connected workflow state, when present. */
|
|
99
|
+
readonly workflow: GitHubSourceConnectionWorkflowDto | null
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function decodeGitHubSourceConnectionListInput(value: unknown): GitHubSourceConnectionListInput {
|
|
103
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
104
|
+
throw new Error('source connection list input must be an object')
|
|
105
|
+
}
|
|
106
|
+
const unknownField = Object.keys(value).find((key) => key !== 'cursor' && key !== 'limit')
|
|
107
|
+
if (unknownField !== undefined) throw new Error('source connection list input contains an unknown field')
|
|
108
|
+
const cursorValue = Reflect.get(value, 'cursor')
|
|
109
|
+
if (
|
|
110
|
+
cursorValue !== undefined
|
|
111
|
+
&& (typeof cursorValue !== 'string' || cursorValue.length === 0 || cursorValue.length > GITHUB_SOURCE_CONNECTION_PAGE_CURSOR_MAX_LENGTH)
|
|
112
|
+
) {
|
|
113
|
+
throw new Error(`source connection list cursor must be a non-empty string of at most ${GITHUB_SOURCE_CONNECTION_PAGE_CURSOR_MAX_LENGTH} characters`)
|
|
114
|
+
}
|
|
115
|
+
const limitValue = Reflect.get(value, 'limit')
|
|
116
|
+
if (
|
|
117
|
+
limitValue !== undefined
|
|
118
|
+
&& (typeof limitValue !== 'number' || !Number.isSafeInteger(limitValue) || limitValue < 1 || limitValue > GITHUB_SOURCE_CONNECTION_MAX_PAGE_SIZE)
|
|
119
|
+
) {
|
|
120
|
+
throw new Error(`source connection list limit must be an integer from 1 to ${GITHUB_SOURCE_CONNECTION_MAX_PAGE_SIZE}`)
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
...(cursorValue !== undefined ? { cursor: cursorValue } : {}),
|
|
124
|
+
...(limitValue !== undefined ? { limit: limitValue } : {}),
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
84
128
|
export interface GitHubSourceConnectionRepairRequiredDto extends GitHubSourceConnectionBaseDto {
|
|
85
129
|
readonly state: 'repair-required'
|
|
86
130
|
readonly connectionId: string
|
|
@@ -133,6 +177,7 @@ export interface AppDto {
|
|
|
133
177
|
workerDir: string | null
|
|
134
178
|
buildCmd: string | null
|
|
135
179
|
configPath: string | null
|
|
180
|
+
githubConnectionId?: string | null
|
|
136
181
|
githubInstallationId: number | null
|
|
137
182
|
createdAt: number
|
|
138
183
|
}
|
package/src/rpc.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type {
|
|
|
9
9
|
CursorList,
|
|
10
10
|
DeploymentNamespaceDetailDto,
|
|
11
11
|
DeploymentNamespaceListResponse,
|
|
12
|
+
GitHubSourceConnectionListInput,
|
|
13
|
+
GitHubSourceConnectionListResponse,
|
|
12
14
|
GitHubSourceConnectionStatusDto,
|
|
13
15
|
ListResponse,
|
|
14
16
|
PlanDeploymentNamespaceRequest,
|
|
@@ -103,6 +105,7 @@ export interface GitHubSourceConnectionInput {
|
|
|
103
105
|
/** Provider-neutral admin seam. A statically composed provider implements these GitHub operations. */
|
|
104
106
|
export interface GitHubSourceConnectionRpcContract {
|
|
105
107
|
status: RpcProcedure<void, GitHubSourceConnectionStatusDto>
|
|
108
|
+
list: RpcProcedure<GitHubSourceConnectionListInput, GitHubSourceConnectionListResponse>
|
|
106
109
|
start: RpcProcedure<StartGitHubSourceConnectionRequest, StartGitHubSourceConnectionResponse>
|
|
107
110
|
adoptExisting: RpcProcedure<void, GitHubSourceConnectionStatusDto>
|
|
108
111
|
verifyInstallation: RpcProcedure<GitHubSourceConnectionInput, GitHubSourceConnectionStatusDto>
|