@fabrika/control-contract 0.8.2 → 0.9.0-cloudflare.2
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 +7 -6
- package/src/access.ts +12 -0
- package/src/index.ts +34 -0
- package/src/rpc.ts +125 -1
- package/types/src/access.d.ts +68 -0
- package/types/src/builder-bootstrap.d.ts +41 -0
- package/types/src/builder-connections.d.ts +223 -0
- package/types/src/builder-pairing.d.ts +12 -0
- package/types/src/index.d.ts +510 -0
- package/types/src/mail.d.ts +90 -0
- package/types/src/rpc.d.ts +341 -0
- package/types/src/source-connection-list.d.ts +20 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import type { EndpointKind, EndpointMethod } from '@fabrika/auth-core';
|
|
2
|
+
import type { JsonValue, ProviderEnvelope } from '@fabrika/provider-contract';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export * from './access.js';
|
|
5
|
+
export * from './builder-bootstrap.js';
|
|
6
|
+
export * from './builder-connections.js';
|
|
7
|
+
export * from './builder-pairing.js';
|
|
8
|
+
export * from './mail.js';
|
|
9
|
+
export type { JsonValue };
|
|
10
|
+
/** A plain list response. */
|
|
11
|
+
export interface ListResponse<T> {
|
|
12
|
+
items: T[];
|
|
13
|
+
}
|
|
14
|
+
/** A keyset-paginated list. */
|
|
15
|
+
export interface CursorList<T> {
|
|
16
|
+
items: T[];
|
|
17
|
+
nextCursor: string | null;
|
|
18
|
+
}
|
|
19
|
+
export type ProviderEnvelopeDto = ProviderEnvelope;
|
|
20
|
+
/** What the console needs to know about the installation it runs in. */
|
|
21
|
+
export interface InstallationDto {
|
|
22
|
+
/** The id of the one provider bundle this installation composes (ADR-0011). */
|
|
23
|
+
readonly provider: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The console actions the caller's verified token holds, in the shape of an application's caller document. The
|
|
27
|
+
* console shows and hides by it; it decides nothing, because every procedure checks its own action.
|
|
28
|
+
*/
|
|
29
|
+
export interface ConsoleAccessDto {
|
|
30
|
+
/** Null for a credential bound to no principal. */
|
|
31
|
+
readonly principal: {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly label: string;
|
|
34
|
+
} | null;
|
|
35
|
+
/** The actions held as a global grant, so in every scope value. */
|
|
36
|
+
readonly global: readonly string[];
|
|
37
|
+
/** Each scope value the caller holds an action in, with those actions; sorted by dimension, then value. */
|
|
38
|
+
readonly scopes: readonly ConsoleScopedActionsDto[];
|
|
39
|
+
}
|
|
40
|
+
export interface ConsoleScopedActionsDto {
|
|
41
|
+
readonly type: string;
|
|
42
|
+
readonly value: string;
|
|
43
|
+
readonly actions: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
export interface GitHubSourceRepositoryDto {
|
|
46
|
+
readonly owner: string;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
}
|
|
49
|
+
export interface GitHubSourceConnectionAppDto {
|
|
50
|
+
readonly id: number;
|
|
51
|
+
readonly slug: string;
|
|
52
|
+
readonly htmlUrl: string;
|
|
53
|
+
readonly public: boolean;
|
|
54
|
+
readonly owner: {
|
|
55
|
+
readonly login: string;
|
|
56
|
+
readonly type: 'Organization';
|
|
57
|
+
};
|
|
58
|
+
readonly permissions: {
|
|
59
|
+
readonly contents: 'read';
|
|
60
|
+
};
|
|
61
|
+
readonly events: readonly ['push'];
|
|
62
|
+
}
|
|
63
|
+
export interface GitHubSourceConnectionInstallationDto {
|
|
64
|
+
readonly id: number;
|
|
65
|
+
readonly accountLogin: string;
|
|
66
|
+
readonly repositorySelection: 'all' | 'selected';
|
|
67
|
+
readonly verifiedRepositories: readonly GitHubSourceRepositoryDto[];
|
|
68
|
+
}
|
|
69
|
+
interface GitHubSourceConnectionBaseDto {
|
|
70
|
+
readonly provider: string;
|
|
71
|
+
readonly kind: 'github-app';
|
|
72
|
+
}
|
|
73
|
+
export interface GitHubSourceConnectionAnonymousDto extends GitHubSourceConnectionBaseDto {
|
|
74
|
+
readonly state: 'anonymous';
|
|
75
|
+
}
|
|
76
|
+
export interface GitHubSourceConnectionUnavailableDto extends GitHubSourceConnectionBaseDto {
|
|
77
|
+
readonly state: 'unavailable';
|
|
78
|
+
}
|
|
79
|
+
export interface GitHubSourceConnectionSetupPendingDto extends GitHubSourceConnectionBaseDto {
|
|
80
|
+
readonly state: 'setup-pending';
|
|
81
|
+
readonly connectionId: string;
|
|
82
|
+
readonly phase: 'starting' | 'awaiting-manifest-callback' | 'persisting' | 'activating';
|
|
83
|
+
/** Present only while the same-origin manifest handoff can be resumed. */
|
|
84
|
+
readonly continuePath?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface GitHubSourceConnectionInstallationRequiredDto extends GitHubSourceConnectionBaseDto {
|
|
87
|
+
readonly state: 'installation-required';
|
|
88
|
+
readonly connectionId: string;
|
|
89
|
+
readonly app: GitHubSourceConnectionAppDto;
|
|
90
|
+
readonly installationUrl: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The query parameter Control's GitHub setup URL adds when it sends the browser to the console's source page. It reports
|
|
94
|
+
* what that one return from GitHub found; the page still reads the connection state from the API.
|
|
95
|
+
*/
|
|
96
|
+
export declare const GITHUB_SETUP_OUTCOME_PARAM = "github-setup";
|
|
97
|
+
export type GitHubSetupOutcome = 'connected' | 'approval-requested' | 'unverified';
|
|
98
|
+
export interface GitHubSourceConnectionConnectedDto extends GitHubSourceConnectionBaseDto {
|
|
99
|
+
readonly state: 'connected';
|
|
100
|
+
readonly connectionId: string;
|
|
101
|
+
readonly app: GitHubSourceConnectionAppDto;
|
|
102
|
+
readonly installation: GitHubSourceConnectionInstallationDto;
|
|
103
|
+
}
|
|
104
|
+
export type GitHubSourceConnectionWorkflowDto = Exclude<GitHubSourceConnectionStatusDto, GitHubSourceConnectionConnectedDto>;
|
|
105
|
+
export * from './source-connection-list.js';
|
|
106
|
+
export interface GitHubSourceConnectionListInput {
|
|
107
|
+
readonly cursor?: string;
|
|
108
|
+
readonly limit?: number;
|
|
109
|
+
}
|
|
110
|
+
export interface GitHubSourceConnectionListResponse {
|
|
111
|
+
readonly items: readonly GitHubSourceConnectionConnectedDto[];
|
|
112
|
+
readonly nextCursor: string | null;
|
|
113
|
+
/** The one global non-connected workflow state, when present. */
|
|
114
|
+
readonly workflow: GitHubSourceConnectionWorkflowDto | null;
|
|
115
|
+
}
|
|
116
|
+
export interface GitHubSourceConnectionRepairRequiredDto extends GitHubSourceConnectionBaseDto {
|
|
117
|
+
readonly state: 'repair-required';
|
|
118
|
+
readonly connectionId: string;
|
|
119
|
+
readonly reason: 'interrupted-setup' | 'credential-activation' | 'installation-verification';
|
|
120
|
+
readonly app?: GitHubSourceConnectionAppDto;
|
|
121
|
+
}
|
|
122
|
+
/** Browser-safe setup state. It never carries a private key, webhook secret, token, or source RPC key. */
|
|
123
|
+
export type GitHubSourceConnectionStatusDto = GitHubSourceConnectionAnonymousDto | GitHubSourceConnectionUnavailableDto | GitHubSourceConnectionSetupPendingDto | GitHubSourceConnectionInstallationRequiredDto | GitHubSourceConnectionConnectedDto | GitHubSourceConnectionRepairRequiredDto;
|
|
124
|
+
export interface StartGitHubSourceConnectionRequest {
|
|
125
|
+
readonly organization: string;
|
|
126
|
+
readonly appName: string;
|
|
127
|
+
readonly visibility: 'private' | 'public';
|
|
128
|
+
readonly repositories: readonly GitHubSourceRepositoryDto[];
|
|
129
|
+
}
|
|
130
|
+
export interface StartGitHubSourceConnectionResponse {
|
|
131
|
+
readonly connectionId: string;
|
|
132
|
+
/** Same-origin path that starts the GitHub manifest handoff. */
|
|
133
|
+
readonly continuePath: string;
|
|
134
|
+
}
|
|
135
|
+
/** One redacted line of deploy output: the runner's NDJSON log line and the control API's view of it. */
|
|
136
|
+
export declare const runLogLineSchema: z.ZodObject<{
|
|
137
|
+
ts: z.ZodNumber;
|
|
138
|
+
stream: z.ZodEnum<["stdout", "stderr", "meta"]>;
|
|
139
|
+
text: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
text: string;
|
|
142
|
+
ts: number;
|
|
143
|
+
stream: "stdout" | "stderr" | "meta";
|
|
144
|
+
}, {
|
|
145
|
+
text: string;
|
|
146
|
+
ts: number;
|
|
147
|
+
stream: "stdout" | "stderr" | "meta";
|
|
148
|
+
}>;
|
|
149
|
+
export type RunLogLine = z.infer<typeof runLogLineSchema>;
|
|
150
|
+
/** Backward-compatible short name for browser consumers. */
|
|
151
|
+
export type LogLine = RunLogLine;
|
|
152
|
+
export interface SetSecretValueRequest {
|
|
153
|
+
value: string;
|
|
154
|
+
env?: string | null;
|
|
155
|
+
}
|
|
156
|
+
export interface AppDto {
|
|
157
|
+
id: string;
|
|
158
|
+
repoUrl: string;
|
|
159
|
+
defaultBranch: string;
|
|
160
|
+
workerDir: string | null;
|
|
161
|
+
buildCmd: string | null;
|
|
162
|
+
configPath: string | null;
|
|
163
|
+
githubConnectionId?: string | null;
|
|
164
|
+
githubInstallationId: number | null;
|
|
165
|
+
createdAt: number;
|
|
166
|
+
}
|
|
167
|
+
export interface AppOptionalFields {
|
|
168
|
+
defaultBranch?: string;
|
|
169
|
+
workerDir?: string | null;
|
|
170
|
+
buildCmd?: string | null;
|
|
171
|
+
configPath?: string | null;
|
|
172
|
+
/** Must equal the installation of the repository owner's GitHub connection. */
|
|
173
|
+
githubInstallationId?: number | null;
|
|
174
|
+
/** Bind the app to the repository owner's GitHub connection (one per owner). */
|
|
175
|
+
resolveInstallationId?: boolean;
|
|
176
|
+
}
|
|
177
|
+
export interface UpdateAppRequest extends AppOptionalFields {
|
|
178
|
+
repoUrl?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* `dev` follows the workspace bound to it through its launcher, without a run (ADR-0049); at most one per application,
|
|
182
|
+
* never protected and never production. Every other environment is `standard`.
|
|
183
|
+
*/
|
|
184
|
+
export declare const APP_ENV_KINDS: readonly ["standard", "dev"];
|
|
185
|
+
export type AppEnvKind = (typeof APP_ENV_KINDS)[number];
|
|
186
|
+
export interface AppEnvDto {
|
|
187
|
+
appId: string;
|
|
188
|
+
env: string;
|
|
189
|
+
kind: AppEnvKind;
|
|
190
|
+
domain: string | null;
|
|
191
|
+
publicOrigin: string | null;
|
|
192
|
+
/** The exact origins whose pages may call this environment's cross-origin endpoints (ADR-0022); empty lists none. */
|
|
193
|
+
crossOrigins: string[];
|
|
194
|
+
triggerRef: string | null;
|
|
195
|
+
/** An MCP authoring target (ADR-0049): users with `source.workspace.*` grants may edit and deploy it. */
|
|
196
|
+
authoring: boolean;
|
|
197
|
+
/** A widening of access waits for a human's approval here (ADR-0050); `prod` is protected by default. */
|
|
198
|
+
protected: boolean;
|
|
199
|
+
/** The run whose snapshot is this environment's active access; null until a run publishes one. */
|
|
200
|
+
publishedRunId: string | null;
|
|
201
|
+
/**
|
|
202
|
+
* The published snapshot's steps off the paved road, grouped by the site or migration that takes them: the reach its
|
|
203
|
+
* sites declare and the database code its migrations declare. Listed whether or not the environment is protected.
|
|
204
|
+
*/
|
|
205
|
+
deviationSubjects: DeviationSubjectDto[];
|
|
206
|
+
/** The published snapshot's endpoints as the outside reaches them, most exposed first; empty until a run publishes one. */
|
|
207
|
+
surface: SurfaceEndpointDto[];
|
|
208
|
+
namespaceId: string | null;
|
|
209
|
+
provider: string;
|
|
210
|
+
target: ProviderEnvelopeDto;
|
|
211
|
+
artifact: ProviderEnvelopeDto;
|
|
212
|
+
createdAt: number;
|
|
213
|
+
}
|
|
214
|
+
/** One endpoint, job or migration of a published snapshot and its steps off the paved road. */
|
|
215
|
+
export interface DeviationSubjectDto {
|
|
216
|
+
/** `Endpoint \`id\``, `Job \`name\`` or `Migration \`file\``. */
|
|
217
|
+
subject: string;
|
|
218
|
+
/** Each step, phrased to follow the subject: `declares raw SQL (\`read\`)`. */
|
|
219
|
+
steps: string[];
|
|
220
|
+
}
|
|
221
|
+
/** Who reaches an endpoint, most exposed first. */
|
|
222
|
+
export declare const SURFACE_REACHES: readonly ["anyone", "link", "app", "machine", "human"];
|
|
223
|
+
/** An endpoint is listed under its most exposed caller: `anyone` for an anonymous kind, `app` for an `app:<id>` caller. */
|
|
224
|
+
export type SurfaceReach = (typeof SURFACE_REACHES)[number];
|
|
225
|
+
/** One endpoint of a published snapshot, in the approval's words. */
|
|
226
|
+
export interface SurfaceEndpointDto {
|
|
227
|
+
id: string;
|
|
228
|
+
method: EndpointMethod;
|
|
229
|
+
path: string;
|
|
230
|
+
kind: EndpointKind;
|
|
231
|
+
reach: SurfaceReach;
|
|
232
|
+
/** Every caller kind the endpoint admits; empty for an anonymous kind. */
|
|
233
|
+
callers: string[];
|
|
234
|
+
/** What a caller must hold: `who are members` or `` with `notes.read` (on `note`) ``; null for an anonymous kind. */
|
|
235
|
+
requirement: string | null;
|
|
236
|
+
/** What else opens the endpoint: another origin, a file it answers, a body limit, a form's protection, a signature. */
|
|
237
|
+
notes: string[];
|
|
238
|
+
}
|
|
239
|
+
export interface PutAppEnvRequest {
|
|
240
|
+
domain?: string | null;
|
|
241
|
+
publicOrigin?: string | null;
|
|
242
|
+
/** Replaces the stored list; omitted keeps it, and an empty list clears it. */
|
|
243
|
+
crossOrigins?: string[];
|
|
244
|
+
triggerRef?: string | null;
|
|
245
|
+
/** Omitted keeps the stored value. Only a Zerops environment of an app with a GitHub connection qualifies. */
|
|
246
|
+
authoring?: boolean;
|
|
247
|
+
/** Set when the environment is created, `standard` when omitted; it never changes afterwards. */
|
|
248
|
+
kind?: AppEnvKind;
|
|
249
|
+
namespaceId?: string | null;
|
|
250
|
+
target: ProviderEnvelopeDto;
|
|
251
|
+
artifact: ProviderEnvelopeDto;
|
|
252
|
+
}
|
|
253
|
+
export type DeploymentNamespaceState = 'pending' | 'provisioning' | 'ready' | 'failed';
|
|
254
|
+
export interface DeploymentNamespaceDto {
|
|
255
|
+
id: string;
|
|
256
|
+
env: string;
|
|
257
|
+
provider: string;
|
|
258
|
+
exclusiveAppId: string | null;
|
|
259
|
+
target: ProviderEnvelopeDto;
|
|
260
|
+
state: DeploymentNamespaceState;
|
|
261
|
+
/**
|
|
262
|
+
* The last lifecycle failure, redacted and bounded, with its class in `lastErrorCode`: a stable
|
|
263
|
+
* identifier — a provider error code such as `insufficientPermissions`, or `internal` when the cause
|
|
264
|
+
* was not a typed provider failure — so a console can tell two failures apart without matching prose.
|
|
265
|
+
* A row written before the codes existed carries a message and no code.
|
|
266
|
+
*/
|
|
267
|
+
lastError: string | null;
|
|
268
|
+
lastErrorCode: string | null;
|
|
269
|
+
/**
|
|
270
|
+
* Present only while a `namespaces.update` is unconfirmed (`lastErrorCode` `namespaceUpdateUnconfirmed`):
|
|
271
|
+
* the target that update was moving to. Retrying `namespaces.update` with it finishes the update.
|
|
272
|
+
*/
|
|
273
|
+
unconfirmedTarget?: ProviderEnvelopeDto;
|
|
274
|
+
createdAt: number;
|
|
275
|
+
}
|
|
276
|
+
export interface DeploymentNamespaceDetailDto extends DeploymentNamespaceDto {
|
|
277
|
+
presentation: DeploymentNamespacePresentationDto | null;
|
|
278
|
+
/**
|
|
279
|
+
* The public hosts this namespace serves, with the environment that already claimed each one. Absent
|
|
280
|
+
* where the provider names none — a placement whose domains are bound out of band, or one whose entry
|
|
281
|
+
* point is not published yet.
|
|
282
|
+
*/
|
|
283
|
+
readonly hosts?: readonly DeploymentNamespaceHostDto[];
|
|
284
|
+
}
|
|
285
|
+
/** One host a namespace serves, and the application environment whose domain already takes it. */
|
|
286
|
+
export interface DeploymentNamespaceHostDto {
|
|
287
|
+
readonly host: string;
|
|
288
|
+
readonly port: number;
|
|
289
|
+
readonly takenBy?: {
|
|
290
|
+
readonly appId: string;
|
|
291
|
+
readonly environment: string;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
export interface CreateDeploymentNamespaceRequest {
|
|
295
|
+
id: string;
|
|
296
|
+
env: string;
|
|
297
|
+
exclusiveAppId?: string | null;
|
|
298
|
+
target: ProviderEnvelopeDto;
|
|
299
|
+
}
|
|
300
|
+
export interface AdoptDeploymentNamespaceRequest {
|
|
301
|
+
env: string;
|
|
302
|
+
exclusiveAppId?: string | null;
|
|
303
|
+
target: ProviderEnvelopeDto;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* A namespace's new provider target. Its payload may name only what changes; the provider merges it over
|
|
307
|
+
* the stored one. Only what the provider can change in place is accepted — on Zerops the PostgreSQL
|
|
308
|
+
* profile. A field the target does not have is a 400; any other change is a 409 that names the supported
|
|
309
|
+
* path, a new namespace under a new id.
|
|
310
|
+
*/
|
|
311
|
+
export interface UpdateDeploymentNamespaceRequest {
|
|
312
|
+
target: ProviderEnvelopeDto;
|
|
313
|
+
}
|
|
314
|
+
export interface DeploymentNamespaceFactDto {
|
|
315
|
+
readonly label: string;
|
|
316
|
+
readonly value: string;
|
|
317
|
+
/** Set when the value names a LIVE provider resource that outlives the namespace row (see removal). */
|
|
318
|
+
readonly resource?: boolean;
|
|
319
|
+
}
|
|
320
|
+
export interface DeploymentNamespacePresentationDto {
|
|
321
|
+
readonly preset: string;
|
|
322
|
+
readonly title: string;
|
|
323
|
+
readonly facts: readonly DeploymentNamespaceFactDto[];
|
|
324
|
+
readonly instructions: readonly string[];
|
|
325
|
+
}
|
|
326
|
+
export interface DeploymentNamespacePresetDto {
|
|
327
|
+
readonly id: string;
|
|
328
|
+
readonly label: string;
|
|
329
|
+
readonly description: string;
|
|
330
|
+
readonly requiresExclusiveApp: boolean;
|
|
331
|
+
}
|
|
332
|
+
export interface DeploymentNamespaceOperatorDto {
|
|
333
|
+
readonly presets: readonly DeploymentNamespacePresetDto[];
|
|
334
|
+
}
|
|
335
|
+
export interface DeploymentNamespaceListResponse {
|
|
336
|
+
items: DeploymentNamespaceDto[];
|
|
337
|
+
operator: DeploymentNamespaceOperatorDto | null;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* What removal leaves behind. Fabrika deletes no provider resource: it holds OWNER on the projects it
|
|
341
|
+
* creates ([ADR-0034](../../../docs/decisions/0034-the-control-plane-creates-the-projects-it-owns.md)),
|
|
342
|
+
* so deleting one is a destructive act on live state that stays with the operator. The removed row is
|
|
343
|
+
* returned whole — its provider target and presentation name what is now unowned.
|
|
344
|
+
*/
|
|
345
|
+
export interface RemoveDeploymentNamespaceResponse {
|
|
346
|
+
readonly removed: DeploymentNamespaceDetailDto;
|
|
347
|
+
}
|
|
348
|
+
/** The namespaces whose proxy rebuild `namespaces.republishAll` submitted. */
|
|
349
|
+
export interface RepublishAllNamespacesResponse {
|
|
350
|
+
readonly namespaceIds: readonly string[];
|
|
351
|
+
}
|
|
352
|
+
/** The resource keys released; each was confirmed gone at the provider in the same call. */
|
|
353
|
+
export interface ReleaseNamespaceClaimsResponse {
|
|
354
|
+
readonly released: readonly string[];
|
|
355
|
+
}
|
|
356
|
+
export interface PlanDeploymentNamespaceRequest {
|
|
357
|
+
id: string;
|
|
358
|
+
env: string;
|
|
359
|
+
preset: string;
|
|
360
|
+
exclusiveAppId?: string;
|
|
361
|
+
options?: JsonValue;
|
|
362
|
+
}
|
|
363
|
+
export interface PlannedDeploymentNamespaceDto {
|
|
364
|
+
readonly id: string;
|
|
365
|
+
readonly env: string;
|
|
366
|
+
readonly exclusiveAppId?: string;
|
|
367
|
+
readonly target: ProviderEnvelopeDto;
|
|
368
|
+
}
|
|
369
|
+
export interface PlanDeploymentNamespaceResponse {
|
|
370
|
+
readonly namespace: PlannedDeploymentNamespaceDto;
|
|
371
|
+
readonly presentation: DeploymentNamespacePresentationDto;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Where an app secret's value is kept: `vault` (control's vault), `provider` (the provider's own storage),
|
|
375
|
+
* or `legacy` — a row from before secrets were vault-only, which no deploy resolves until it is set again.
|
|
376
|
+
*/
|
|
377
|
+
export type AppSecretStorage = 'vault' | 'provider' | 'legacy';
|
|
378
|
+
export interface AppSecretDto {
|
|
379
|
+
appId: string;
|
|
380
|
+
env: string | null;
|
|
381
|
+
name: string;
|
|
382
|
+
storage: AppSecretStorage;
|
|
383
|
+
/** The `vault:` ref; null for any other storage, whose stored ref control cannot vouch for. */
|
|
384
|
+
valueRef: string | null;
|
|
385
|
+
createdAt: number;
|
|
386
|
+
}
|
|
387
|
+
/** The plaintext is write-only: control seals it and stores only the resulting ref. */
|
|
388
|
+
export interface PutAppSecretRequest {
|
|
389
|
+
name: string;
|
|
390
|
+
value: string;
|
|
391
|
+
env?: string | null;
|
|
392
|
+
}
|
|
393
|
+
export interface AppVarDto {
|
|
394
|
+
appId: string;
|
|
395
|
+
env: string | null;
|
|
396
|
+
name: string;
|
|
397
|
+
value: string;
|
|
398
|
+
createdAt: number;
|
|
399
|
+
}
|
|
400
|
+
export interface PutAppVarRequest {
|
|
401
|
+
name: string;
|
|
402
|
+
value: string;
|
|
403
|
+
env?: string | null;
|
|
404
|
+
}
|
|
405
|
+
export interface RegisterAppRequest extends AppOptionalFields {
|
|
406
|
+
id: string;
|
|
407
|
+
repoUrl: string;
|
|
408
|
+
env: string;
|
|
409
|
+
domain?: string | null;
|
|
410
|
+
publicOrigin?: string | null;
|
|
411
|
+
/** The environment's cross-origin list (ADR-0022); omitted lists none. */
|
|
412
|
+
crossOrigins?: string[];
|
|
413
|
+
triggerRef?: string | null;
|
|
414
|
+
namespaceId?: string | null;
|
|
415
|
+
target: ProviderEnvelopeDto;
|
|
416
|
+
artifact: ProviderEnvelopeDto;
|
|
417
|
+
}
|
|
418
|
+
export interface RegisterAppResponse {
|
|
419
|
+
app: AppDto;
|
|
420
|
+
env: AppEnvDto;
|
|
421
|
+
}
|
|
422
|
+
export type RunTrigger = 'webhook' | 'manual' | 'poll';
|
|
423
|
+
/** `awaiting_approval`: the run widens access on a protected environment and waits for a human (ADR-0050). */
|
|
424
|
+
export type RunStatus = 'pending' | 'running' | 'awaiting_approval' | 'succeeded' | 'failed';
|
|
425
|
+
export interface RunDto {
|
|
426
|
+
id: string;
|
|
427
|
+
appId: string;
|
|
428
|
+
env: string;
|
|
429
|
+
ref: string;
|
|
430
|
+
commitSha: string | null;
|
|
431
|
+
trigger: RunTrigger;
|
|
432
|
+
/** Who created the run: `user:<id>`, `service:<id>`, `oauth:<id>` (an MCP client acting for a user), `webhook:<connection>` or `poll`. */
|
|
433
|
+
actor: string | null;
|
|
434
|
+
status: RunStatus;
|
|
435
|
+
exitCode: number | null;
|
|
436
|
+
externalRunId: string | null;
|
|
437
|
+
logKey: string | null;
|
|
438
|
+
createdAt: number;
|
|
439
|
+
startedAt: number | null;
|
|
440
|
+
finishedAt: number | null;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* One plain-language line of an access change. `effect` is `widens` when it can grant access the baseline did not,
|
|
444
|
+
* `narrows` when it can only take access away, and `neutral` when it admits no one new and takes nothing away.
|
|
445
|
+
* `review: 'closer'` marks a step off the paved road (declared reach, database code) or a change the diff cannot classify.
|
|
446
|
+
*/
|
|
447
|
+
export interface AccessChangeDto {
|
|
448
|
+
effect: 'widens' | 'narrows' | 'neutral';
|
|
449
|
+
line: string;
|
|
450
|
+
review?: 'closer';
|
|
451
|
+
/** The line opens an endpoint to the pages on the origins the environment lists; `ApprovalDto.crossOrigins` names them. */
|
|
452
|
+
environmentOrigins?: true;
|
|
453
|
+
}
|
|
454
|
+
/** A run's access change against its environment's active snapshot (ADR-0050 §3). */
|
|
455
|
+
export interface ApprovalDto {
|
|
456
|
+
run: RunDto;
|
|
457
|
+
/** `none`: no line. `no-widening`: lines that narrow or leave access unchanged; it publishes at once. */
|
|
458
|
+
outcome: 'none' | 'no-widening' | 'widening';
|
|
459
|
+
changes: AccessChangeDto[];
|
|
460
|
+
/** The digest of the run's snapshot and of the active one it was compared with: an approval is bound to both. */
|
|
461
|
+
candidateDigest: string;
|
|
462
|
+
baselineDigest: string;
|
|
463
|
+
/** The published run the change was compared with; null when nothing was published. */
|
|
464
|
+
baselineRunId: string | null;
|
|
465
|
+
protected: boolean;
|
|
466
|
+
/**
|
|
467
|
+
* The environment's cross-origin list as it stands now: the pages an endpoint the contract opens to the environment's
|
|
468
|
+
* list answers. It is set on the environment, takes effect at once, and no approval covers it (ADR-0050). Only on one
|
|
469
|
+
* approval read while the run waits for a decision, its environment exists and a line has `environmentOrigins`;
|
|
470
|
+
* empty when the environment lists none.
|
|
471
|
+
*/
|
|
472
|
+
crossOrigins?: string[];
|
|
473
|
+
/** The human who approved it, once one did. */
|
|
474
|
+
approval: {
|
|
475
|
+
principalId: string;
|
|
476
|
+
label: string;
|
|
477
|
+
approvedAt: number;
|
|
478
|
+
} | null;
|
|
479
|
+
}
|
|
480
|
+
/** Approve or refuse one parked run. The digests are the ones the approver read; a reclassified run refuses them. */
|
|
481
|
+
export interface CompleteApprovalRequest {
|
|
482
|
+
runId: string;
|
|
483
|
+
decision: 'approve' | 'reject';
|
|
484
|
+
candidateDigest: string;
|
|
485
|
+
baselineDigest: string;
|
|
486
|
+
}
|
|
487
|
+
/** Change whether a widening waits for approval on one environment (ADR-0050 §4). */
|
|
488
|
+
export interface SetEnvironmentProtectionRequest {
|
|
489
|
+
appId: string;
|
|
490
|
+
env: string;
|
|
491
|
+
protected: boolean;
|
|
492
|
+
}
|
|
493
|
+
export interface TriggerDeployRequest {
|
|
494
|
+
appId: string;
|
|
495
|
+
env: string;
|
|
496
|
+
ref?: string;
|
|
497
|
+
}
|
|
498
|
+
export interface RunTailResponse {
|
|
499
|
+
lines: RunLogLine[];
|
|
500
|
+
cursor: number;
|
|
501
|
+
done: boolean;
|
|
502
|
+
status: RunStatus;
|
|
503
|
+
}
|
|
504
|
+
export interface RunLogResponse {
|
|
505
|
+
lines: RunLogLine[];
|
|
506
|
+
status?: RunStatus;
|
|
507
|
+
}
|
|
508
|
+
export type { AdoptNamespaceInput, AppEnvironmentInput, AppIdInput, AppNamedValueInput, ControlRpcContract, CreateAppRequest, DescribeConnectorRequest, GitHubSourceConnectionInput, GitHubSourceConnectionRpcContract, NamespaceIdInput, OkResponse, PutAppEnvironmentInput, PutAppSecretInput, PutAppVarInput, ReleaseNamespaceClaimsInput, RotateTokenKeyResponse, RunIdInput, RunListInput, SecretValueInput, SecretValueResponse, TailRunInput, UpdateNamespaceInput, } from './rpc.js';
|
|
509
|
+
export type { DataOperationDto, DataOperationKind, DataOperationListInput, DataOperationResolution, DataOperationState, DataOperationStep, MaintenanceMode, RecoverDataOperationInput, StartDataOperationInput, } from './rpc.js';
|
|
510
|
+
export { DATA_OPERATION_MAX_PAGE_SIZE, dataOperationListInputSchema, recoverDataOperationInputSchema, startDataOperationInputSchema } from './rpc.js';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** The mail relay as the console reads and steers it. */
|
|
2
|
+
/**
|
|
3
|
+
* `held` waits for a person, `queued` for the dispatcher, `sending` is one attempt a dispatcher claimed. `sent`,
|
|
4
|
+
* `failed` (not sent), `unknown` (may have left) and `dropped` are final.
|
|
5
|
+
*/
|
|
6
|
+
export type MailMessageState = 'held' | 'queued' | 'sending' | 'sent' | 'failed' | 'unknown' | 'dropped';
|
|
7
|
+
export type MailRuleAction = 'pass' | 'hold' | 'drop';
|
|
8
|
+
/** A relayed message's metadata, behind `mail.read`. It carries no recipient, subject or body. */
|
|
9
|
+
export interface MailMessageDto {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** `<app>@<env>`, or `installation:<service>` for an installation sender. */
|
|
12
|
+
readonly sender: string;
|
|
13
|
+
readonly recipientDomain: string;
|
|
14
|
+
readonly state: MailMessageState;
|
|
15
|
+
/** The rule that decided the message at acceptance; null when none did. */
|
|
16
|
+
readonly ruleId: string | null;
|
|
17
|
+
/** Who released or dropped it, or requeued it once it was final. */
|
|
18
|
+
readonly decidedBy: string | null;
|
|
19
|
+
readonly attempts: number;
|
|
20
|
+
readonly nextAttemptAt: number | null;
|
|
21
|
+
readonly providerMessageId: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The `EmailDeliveryErrorCode` of the last failed attempt, or `dispatch_interrupted`: the dispatcher stopped after it
|
|
24
|
+
* claimed the attempt, before it recorded an outcome.
|
|
25
|
+
*/
|
|
26
|
+
readonly errorCode: string | null;
|
|
27
|
+
readonly createdAt: number;
|
|
28
|
+
readonly updatedAt: number;
|
|
29
|
+
}
|
|
30
|
+
/** One attachment as the console shows it: its name, type and size, never its bytes. */
|
|
31
|
+
export interface MailAttachmentDto {
|
|
32
|
+
readonly filename: string;
|
|
33
|
+
readonly contentType: string;
|
|
34
|
+
readonly bytes: number;
|
|
35
|
+
}
|
|
36
|
+
/** What the recipient sees, behind `mail.content.read`. */
|
|
37
|
+
export interface MailMessageContentDto {
|
|
38
|
+
readonly to: string;
|
|
39
|
+
readonly subject: string;
|
|
40
|
+
readonly text: string;
|
|
41
|
+
readonly html?: string;
|
|
42
|
+
readonly replyTo?: string;
|
|
43
|
+
readonly fromName?: string;
|
|
44
|
+
readonly unsubscribeUrl?: string;
|
|
45
|
+
/** A message of a send to many recipients, which the provider keeps apart from transactional mail. */
|
|
46
|
+
readonly broadcast?: true;
|
|
47
|
+
readonly attachments: readonly MailAttachmentDto[];
|
|
48
|
+
}
|
|
49
|
+
/** `withheld`: the caller does not hold `mail.content.read`. `purged`: the relay no longer keeps it. */
|
|
50
|
+
export type MailContentDto = {
|
|
51
|
+
readonly kind: 'withheld';
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: 'purged';
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: 'present';
|
|
56
|
+
readonly message: MailMessageContentDto;
|
|
57
|
+
};
|
|
58
|
+
export interface MailMessageDetailDto extends MailMessageDto {
|
|
59
|
+
readonly content: MailContentDto;
|
|
60
|
+
/** Whether a requeue would send it again now: `failed`, or `unknown` over an idempotent transport, with its content kept. */
|
|
61
|
+
readonly requeueable: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface MailMessageListInput {
|
|
64
|
+
readonly state?: MailMessageState;
|
|
65
|
+
/** One sender: `<app>@<env>` or `installation:<service>`. */
|
|
66
|
+
readonly scope?: string;
|
|
67
|
+
readonly cursor?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface MailMessageIdInput {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
}
|
|
72
|
+
export interface MailRuleDto {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
/** `*` or `<app>@<env>`. */
|
|
75
|
+
readonly scope: string;
|
|
76
|
+
/** `*` or a lowercase recipient domain. */
|
|
77
|
+
readonly domain: string;
|
|
78
|
+
readonly action: MailRuleAction;
|
|
79
|
+
readonly createdAt: number;
|
|
80
|
+
readonly updatedAt: number;
|
|
81
|
+
}
|
|
82
|
+
/** Sets the action of the rule of `scope` and `domain`, creating it when there is none. */
|
|
83
|
+
export interface SetMailRuleInput {
|
|
84
|
+
readonly scope: string;
|
|
85
|
+
readonly domain: string;
|
|
86
|
+
readonly action: MailRuleAction;
|
|
87
|
+
}
|
|
88
|
+
export interface MailRuleIdInput {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
}
|