@fabrika/control-contract 0.8.1 → 0.9.0-cloudflare.1
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/mail.ts +2 -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/control-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-cloudflare.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"src"
|
|
14
|
+
"src",
|
|
15
|
+
"types"
|
|
15
16
|
],
|
|
16
17
|
"exports": {
|
|
17
18
|
".": {
|
|
18
19
|
"bun": "./src/index.ts",
|
|
19
|
-
"types": "./src/index.ts",
|
|
20
|
+
"types": "./types/src/index.d.ts",
|
|
20
21
|
"default": "./src/index.ts"
|
|
21
22
|
}
|
|
22
23
|
},
|
|
@@ -25,8 +26,8 @@
|
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"zod": "^3.25.76",
|
|
28
|
-
"@fabrika/auth-core": "0.
|
|
29
|
-
"@fabrika/app": "0.
|
|
30
|
-
"@fabrika/provider-contract": "0.
|
|
29
|
+
"@fabrika/auth-core": "0.9.0-cloudflare.1",
|
|
30
|
+
"@fabrika/app": "0.9.0-cloudflare.1",
|
|
31
|
+
"@fabrika/provider-contract": "0.9.0-cloudflare.1"
|
|
31
32
|
}
|
|
32
33
|
}
|
package/src/access.ts
CHANGED
|
@@ -45,6 +45,18 @@ export const CONTROL_ACTIONS = Object.freeze({
|
|
|
45
45
|
MAIL_CONTENT_READ: 'mail.content.read',
|
|
46
46
|
/** Release or drop a held message, requeue a final one, and change the gate's rules. Global. */
|
|
47
47
|
MAIL_MANAGE: 'mail.manage',
|
|
48
|
+
/**
|
|
49
|
+
* Read an application environment's data as a metadata projection: sizes, counts, state and the backup list
|
|
50
|
+
* (ADR-0069 §2). Scoped by app/environment.
|
|
51
|
+
*/
|
|
52
|
+
DATA_READ: 'data.read',
|
|
53
|
+
/**
|
|
54
|
+
* Read row contents, exports, backup downloads and content fields of every tenant of an environment. Checked as a
|
|
55
|
+
* global grant only, so a grant scoped to an app never carries it: content is for the installation's operators.
|
|
56
|
+
*/
|
|
57
|
+
DATA_CONTENT_READ: 'data.content.read',
|
|
58
|
+
/** Run maintenance transitions, backups and restores, and recover an interrupted operation. Scoped by app/environment. */
|
|
59
|
+
DATA_MANAGE: 'data.manage',
|
|
48
60
|
})
|
|
49
61
|
|
|
50
62
|
/**
|
package/src/index.ts
CHANGED
|
@@ -207,9 +207,18 @@ export interface UpdateAppRequest extends AppOptionalFields {
|
|
|
207
207
|
repoUrl?: string
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
* `dev` follows the workspace bound to it through its launcher, without a run (ADR-0049); at most one per application,
|
|
212
|
+
* never protected and never production. Every other environment is `standard`.
|
|
213
|
+
*/
|
|
214
|
+
export const APP_ENV_KINDS = ['standard', 'dev'] as const
|
|
215
|
+
|
|
216
|
+
export type AppEnvKind = (typeof APP_ENV_KINDS)[number]
|
|
217
|
+
|
|
210
218
|
export interface AppEnvDto {
|
|
211
219
|
appId: string
|
|
212
220
|
env: string
|
|
221
|
+
kind: AppEnvKind
|
|
213
222
|
domain: string | null
|
|
214
223
|
publicOrigin: string | null
|
|
215
224
|
/** The exact origins whose pages may call this environment's cross-origin endpoints (ADR-0022); empty lists none. */
|
|
@@ -272,6 +281,8 @@ export interface PutAppEnvRequest {
|
|
|
272
281
|
triggerRef?: string | null
|
|
273
282
|
/** Omitted keeps the stored value. Only a Zerops environment of an app with a GitHub connection qualifies. */
|
|
274
283
|
authoring?: boolean
|
|
284
|
+
/** Set when the environment is created, `standard` when omitted; it never changes afterwards. */
|
|
285
|
+
kind?: AppEnvKind
|
|
275
286
|
namespaceId?: string | null
|
|
276
287
|
target: ProviderEnvelopeDto
|
|
277
288
|
artifact: ProviderEnvelopeDto
|
|
@@ -385,6 +396,16 @@ export interface RemoveDeploymentNamespaceResponse {
|
|
|
385
396
|
readonly removed: DeploymentNamespaceDetailDto
|
|
386
397
|
}
|
|
387
398
|
|
|
399
|
+
/** The namespaces whose proxy rebuild `namespaces.republishAll` submitted. */
|
|
400
|
+
export interface RepublishAllNamespacesResponse {
|
|
401
|
+
readonly namespaceIds: readonly string[]
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/** The resource keys released; each was confirmed gone at the provider in the same call. */
|
|
405
|
+
export interface ReleaseNamespaceClaimsResponse {
|
|
406
|
+
readonly released: readonly string[]
|
|
407
|
+
}
|
|
408
|
+
|
|
388
409
|
export interface PlanDeploymentNamespaceRequest {
|
|
389
410
|
id: string
|
|
390
411
|
env: string
|
|
@@ -567,6 +588,7 @@ export type {
|
|
|
567
588
|
PutAppEnvironmentInput,
|
|
568
589
|
PutAppSecretInput,
|
|
569
590
|
PutAppVarInput,
|
|
591
|
+
ReleaseNamespaceClaimsInput,
|
|
570
592
|
RotateTokenKeyResponse,
|
|
571
593
|
RunIdInput,
|
|
572
594
|
RunListInput,
|
|
@@ -575,3 +597,15 @@ export type {
|
|
|
575
597
|
TailRunInput,
|
|
576
598
|
UpdateNamespaceInput,
|
|
577
599
|
} from './rpc.js'
|
|
600
|
+
export type {
|
|
601
|
+
DataOperationDto,
|
|
602
|
+
DataOperationKind,
|
|
603
|
+
DataOperationListInput,
|
|
604
|
+
DataOperationResolution,
|
|
605
|
+
DataOperationState,
|
|
606
|
+
DataOperationStep,
|
|
607
|
+
MaintenanceMode,
|
|
608
|
+
RecoverDataOperationInput,
|
|
609
|
+
StartDataOperationInput,
|
|
610
|
+
} from './rpc.js'
|
|
611
|
+
export { DATA_OPERATION_MAX_PAGE_SIZE, dataOperationListInputSchema, recoverDataOperationInputSchema, startDataOperationInputSchema } from './rpc.js'
|
package/src/mail.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface MailMessageContentDto {
|
|
|
47
47
|
readonly replyTo?: string
|
|
48
48
|
readonly fromName?: string
|
|
49
49
|
readonly unsubscribeUrl?: string
|
|
50
|
+
/** A message of a send to many recipients, which the provider keeps apart from transactional mail. */
|
|
51
|
+
readonly broadcast?: true
|
|
50
52
|
readonly attachments: readonly MailAttachmentDto[]
|
|
51
53
|
}
|
|
52
54
|
|
package/src/rpc.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RpcProcedureContract } from '@fabrika/app'
|
|
2
|
-
import type { ExportDescription } from '@fabrika/auth-core'
|
|
2
|
+
import type { ExportDescription, OpsContentView, OpsView } from '@fabrika/auth-core'
|
|
3
|
+
import { z } from 'zod'
|
|
3
4
|
import type { BuilderConnectionReceiptDto, CreateBuilderConnectionReceiptRequest, GetBuilderConnectionReceiptRequest } from './builder-connections.js'
|
|
4
5
|
import type {
|
|
5
6
|
ApproveDeviceAuthorizationResult,
|
|
@@ -36,9 +37,12 @@ import type {
|
|
|
36
37
|
PutAppVarRequest,
|
|
37
38
|
RegisterAppRequest,
|
|
38
39
|
RegisterAppResponse,
|
|
40
|
+
ReleaseNamespaceClaimsResponse,
|
|
39
41
|
RemoveDeploymentNamespaceResponse,
|
|
42
|
+
RepublishAllNamespacesResponse,
|
|
40
43
|
RunDto,
|
|
41
44
|
RunLogResponse,
|
|
45
|
+
RunStatus,
|
|
42
46
|
RunTailResponse,
|
|
43
47
|
SetEnvironmentProtectionRequest,
|
|
44
48
|
StartGitHubSourceConnectionRequest,
|
|
@@ -119,9 +123,17 @@ export interface UpdateNamespaceInput extends NamespaceIdInput {
|
|
|
119
123
|
readonly namespace: UpdateDeploymentNamespaceRequest
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
/** The app environment whose claims in the namespace are released. */
|
|
127
|
+
export interface ReleaseNamespaceClaimsInput extends NamespaceIdInput {
|
|
128
|
+
readonly appId: string
|
|
129
|
+
readonly env: string
|
|
130
|
+
}
|
|
131
|
+
|
|
122
132
|
export interface RunListInput {
|
|
123
133
|
readonly appId?: string
|
|
124
134
|
readonly env?: string
|
|
135
|
+
/** Filter before pagination, so an old queued or running deploy is not hidden by newer finished runs. */
|
|
136
|
+
readonly statuses?: RunStatus[]
|
|
125
137
|
readonly before?: string
|
|
126
138
|
readonly limit?: number
|
|
127
139
|
}
|
|
@@ -207,6 +219,16 @@ export interface ControlRpcContract {
|
|
|
207
219
|
update: RpcProcedure<UpdateNamespaceInput, DeploymentNamespaceDetailDto>
|
|
208
220
|
/** Free a namespace id. Refused while any app environment is registered in it (backlog 73). */
|
|
209
221
|
remove: RpcProcedure<NamespaceIdInput, RemoveDeploymentNamespaceResponse>
|
|
222
|
+
/**
|
|
223
|
+
* Republish the proxy of every ready namespace, as after a change of the installation's client logo (ADR-0066).
|
|
224
|
+
* Returns once each rebuild is submitted; a failure is a 502 naming the namespaces to reconcile.
|
|
225
|
+
*/
|
|
226
|
+
republishAll: RpcProcedure<void, RepublishAllNamespacesResponse>
|
|
227
|
+
/**
|
|
228
|
+
* Release one app environment's resource claims in the namespace, only when the provider confirms every claimed
|
|
229
|
+
* resource gone. The operator deletes the resources first; fabrika deletes none (ADR-0034).
|
|
230
|
+
*/
|
|
231
|
+
releaseClaims: RpcProcedure<ReleaseNamespaceClaimsInput, ReleaseNamespaceClaimsResponse>
|
|
210
232
|
}
|
|
211
233
|
runs: {
|
|
212
234
|
list: RpcProcedure<RunListInput, CursorList<RunDto>>
|
|
@@ -249,6 +271,21 @@ export interface ControlRpcContract {
|
|
|
249
271
|
remove: RpcProcedure<MailRuleIdInput, OkResponse>
|
|
250
272
|
}
|
|
251
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* An application environment's data (ADR-0069): `data.read` and `data.manage` at the coordinates,
|
|
276
|
+
* `data.content.read` as a global grant only; every denial is the 404 of an absent environment.
|
|
277
|
+
*/
|
|
278
|
+
data: {
|
|
279
|
+
operations: {
|
|
280
|
+
list: RpcProcedure<DataOperationListInput, CursorList<DataOperationDto>>
|
|
281
|
+
get: RpcProcedure<{ operationId: string }, DataOperationDto>
|
|
282
|
+
}
|
|
283
|
+
/** The metadata view; never content. */
|
|
284
|
+
view: RpcProcedure<AppEnvironmentInput, OpsView>
|
|
285
|
+
content: RpcProcedure<AppEnvironmentInput, OpsContentView>
|
|
286
|
+
start: RpcProcedure<StartDataOperationInput, DataOperationDto>
|
|
287
|
+
recover: RpcProcedure<RecoverDataOperationInput, DataOperationDto>
|
|
288
|
+
}
|
|
252
289
|
}
|
|
253
290
|
|
|
254
291
|
/**
|
|
@@ -262,3 +299,90 @@ export interface DescribeConnectorRequest {
|
|
|
262
299
|
readonly export: string
|
|
263
300
|
readonly version: number
|
|
264
301
|
}
|
|
302
|
+
|
|
303
|
+
// ── Data operations (ADR-0069) ───────────────────────────────────────────────
|
|
304
|
+
|
|
305
|
+
/** What an application environment's object admits (ADR-0069 §3). */
|
|
306
|
+
export type MaintenanceMode = 'open' | 'read-only' | 'closed' | 'inspect'
|
|
307
|
+
|
|
308
|
+
export type DataOperationKind = 'maintenance' | 'backup' | 'migrate' | 'recovery' | 'restore'
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Where an operation stands: `reconcile` reads the record and the object's published state (a recovery's first step),
|
|
312
|
+
* `restrict` publishes a generation in a restricting mode, `backup` and `verify` take and check a consistent backup,
|
|
313
|
+
* `deploy` runs the operation's own deploy, `migrate` runs the pending migrations, `resume` continues the interrupted
|
|
314
|
+
* operation from its recorded step, and `open` publishes the generation that opens the object.
|
|
315
|
+
*/
|
|
316
|
+
export type DataOperationStep = 'reconcile' | 'restrict' | 'backup' | 'verify' | 'deploy' | 'migrate' | 'resume' | 'open'
|
|
317
|
+
|
|
318
|
+
export type DataOperationState = 'running' | 'succeeded' | 'failed'
|
|
319
|
+
|
|
320
|
+
/** What a recovery does after its closed fence: resume the interrupted operation, or open the object. */
|
|
321
|
+
export type DataOperationResolution = 'resume' | 'open'
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* One operation as `data.read` shows it: an allowlisted projection of Control's record, with identifiers, states,
|
|
325
|
+
* codes and timestamps only. It carries no free text and no content.
|
|
326
|
+
*/
|
|
327
|
+
export interface DataOperationDto {
|
|
328
|
+
readonly id: string
|
|
329
|
+
readonly appId: string
|
|
330
|
+
readonly env: string
|
|
331
|
+
readonly kind: DataOperationKind
|
|
332
|
+
readonly step: DataOperationStep
|
|
333
|
+
/** The mode the operation requires of the object at its step; a successor publishes its fresh generation in it. */
|
|
334
|
+
readonly targetMode: MaintenanceMode
|
|
335
|
+
/** The latest generation the operation reserved. */
|
|
336
|
+
readonly generation: number
|
|
337
|
+
readonly state: DataOperationState
|
|
338
|
+
/** A code once it failed, never an error message. */
|
|
339
|
+
readonly errorCode: string | null
|
|
340
|
+
/** An opaque principal id (as `runActor`), never an email or label. */
|
|
341
|
+
readonly actor: string
|
|
342
|
+
readonly createdAt: number
|
|
343
|
+
readonly updatedAt: number
|
|
344
|
+
readonly finishedAt: number | null
|
|
345
|
+
/** A recovery's interrupted operation, of the same environment; `null` for every other kind. */
|
|
346
|
+
readonly recoversOperationId: string | null
|
|
347
|
+
/** A recovery's choice after its closed fence; `null` for every other kind. */
|
|
348
|
+
readonly resolution: DataOperationResolution | null
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export const DATA_OPERATION_MAX_PAGE_SIZE = 100
|
|
352
|
+
|
|
353
|
+
const nonEmpty = z.string().min(1)
|
|
354
|
+
const maintenanceMode = z.enum(['open', 'read-only', 'closed', 'inspect'])
|
|
355
|
+
|
|
356
|
+
/** One environment's operations, newest first; `before` is the last id of the previous page. */
|
|
357
|
+
export const dataOperationListInputSchema = z.object({
|
|
358
|
+
appId: nonEmpty,
|
|
359
|
+
env: nonEmpty,
|
|
360
|
+
before: nonEmpty.optional(),
|
|
361
|
+
limit: z.number().int().min(1).max(DATA_OPERATION_MAX_PAGE_SIZE).optional(),
|
|
362
|
+
}).strict()
|
|
363
|
+
|
|
364
|
+
export type DataOperationListInput = z.infer<typeof dataOperationListInputSchema>
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* An operation a person starts. A migration starts inside a deploy and a recovery has its own request, so neither is
|
|
368
|
+
* started here.
|
|
369
|
+
*/
|
|
370
|
+
export const startDataOperationInputSchema = z.discriminatedUnion('kind', [
|
|
371
|
+
z.object({ appId: nonEmpty, env: nonEmpty, kind: z.literal('maintenance'), mode: maintenanceMode }).strict(),
|
|
372
|
+
z.object({ appId: nonEmpty, env: nonEmpty, kind: z.literal('backup') }).strict(),
|
|
373
|
+
])
|
|
374
|
+
|
|
375
|
+
export type StartDataOperationInput = z.infer<typeof startDataOperationInputSchema>
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Recover an environment whose operation `operationId` is stuck: fence it with a fresh generation in `closed`, then
|
|
379
|
+
* resume that operation from its recorded step, or open the object at a new generation.
|
|
380
|
+
*/
|
|
381
|
+
export const recoverDataOperationInputSchema = z.object({
|
|
382
|
+
appId: nonEmpty,
|
|
383
|
+
env: nonEmpty,
|
|
384
|
+
operationId: nonEmpty,
|
|
385
|
+
resolution: z.enum(['resume', 'open']),
|
|
386
|
+
}).strict()
|
|
387
|
+
|
|
388
|
+
export type RecoverDataOperationInput = z.infer<typeof recoverDataOperationInputSchema>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** IAM vocabulary shared by the Control runtime, its Access schema and the console. */
|
|
2
|
+
/** Durable IAM application id of the console — a deployed identity, not configuration branding (ADR-0024). */
|
|
3
|
+
export declare const CONTROL_APP_ID = "vozka";
|
|
4
|
+
/**
|
|
5
|
+
* The actions Control authorizes against. AWS-IAM-style dotted strings; IAM's `permits` matches
|
|
6
|
+
* them (incl. `*` / `prefix.*` wildcards in granted roles).
|
|
7
|
+
*/
|
|
8
|
+
export declare const CONTROL_ACTIONS: Readonly<{
|
|
9
|
+
/** Trigger a deploy run (the manual "Deploy" button / triggerDeploy RPC). Scoped by app/environment. */
|
|
10
|
+
DEPLOY_TRIGGER: "deploy.trigger";
|
|
11
|
+
/** Read deploy runs + their logs (run history API). Scoped by app/environment. */
|
|
12
|
+
DEPLOY_READ: "deploy.read";
|
|
13
|
+
/** Manage the app registry (apps + app_envs CRUD, onboarding). Scoped by app (global to create). */
|
|
14
|
+
APP_MANAGE: "app.manage";
|
|
15
|
+
/** Manage provider-owned deployment namespaces and their lifecycle. Global because namespaces may span apps. */
|
|
16
|
+
NAMESPACE_MANAGE: "namespace.manage";
|
|
17
|
+
/**
|
|
18
|
+
* Manage SECRET VALUES + their references. Gates the app_secrets reference CRUD (scoped by app) AND
|
|
19
|
+
* writing/rotating/deleting the encrypted per-app/app-env VALUES in the vault. The value is
|
|
20
|
+
* write-only over the API; it is never returned. (Platform creds — the CF token, IAM
|
|
21
|
+
* provisioning creds — are fabrika's own Worker secrets, not managed through this action.)
|
|
22
|
+
*/
|
|
23
|
+
SECRET_MANAGE: "secret.manage";
|
|
24
|
+
/** Manage the platform GitHub source connection. Global because it changes control-wide credentials. */
|
|
25
|
+
SOURCE_CONNECTION_MANAGE: "source.connection.manage";
|
|
26
|
+
/** Read the files of one's own Git workspaces on an authoring target (ADR-0049). Scoped by app/environment. */
|
|
27
|
+
SOURCE_WORKSPACE_READ: "source.workspace.read";
|
|
28
|
+
/** Create Git workspaces and commit to them on an authoring target. Scoped by app/environment. */
|
|
29
|
+
SOURCE_WORKSPACE_WRITE: "source.workspace.write";
|
|
30
|
+
/** Open a pull request from one's own workspace to the default branch. Scoped by app/environment. */
|
|
31
|
+
SOURCE_PULL_REQUEST_CREATE: "source.pull-request.create";
|
|
32
|
+
/**
|
|
33
|
+
* Approve a widening of an environment's access and change its `protected` flag (ADR-0050). Outside `deploy.*`, so
|
|
34
|
+
* the operator role does not hold it; only a human user principal in the console may use it. Scoped by app/environment.
|
|
35
|
+
*/
|
|
36
|
+
ACCESS_APPROVE: "access.approve";
|
|
37
|
+
/**
|
|
38
|
+
* List relayed mail and read its metadata. Scoped by app/environment for an application's messages; an installation
|
|
39
|
+
* sender's messages need a global grant.
|
|
40
|
+
*/
|
|
41
|
+
MAIL_READ: "mail.read";
|
|
42
|
+
/** Read a relayed message's recipient, subject and bodies. Global. */
|
|
43
|
+
MAIL_CONTENT_READ: "mail.content.read";
|
|
44
|
+
/** Release or drop a held message, requeue a final one, and change the gate's rules. Global. */
|
|
45
|
+
MAIL_MANAGE: "mail.manage";
|
|
46
|
+
/**
|
|
47
|
+
* Read an application environment's data as a metadata projection: sizes, counts, state and the backup list
|
|
48
|
+
* (ADR-0069 §2). Scoped by app/environment.
|
|
49
|
+
*/
|
|
50
|
+
DATA_READ: "data.read";
|
|
51
|
+
/**
|
|
52
|
+
* Read row contents, exports, backup downloads and content fields of every tenant of an environment. Checked as a
|
|
53
|
+
* global grant only, so a grant scoped to an app never carries it: content is for the installation's operators.
|
|
54
|
+
*/
|
|
55
|
+
DATA_CONTENT_READ: "data.content.read";
|
|
56
|
+
/** Run maintenance transitions, backups and restores, and recover an interrupted operation. Scoped by app/environment. */
|
|
57
|
+
DATA_MANAGE: "data.manage";
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* The scope dimensions Control authorizes within (flat + independent IAM semantics):
|
|
61
|
+
* - `app` — scoped to one registered app (its `id`), across every environment.
|
|
62
|
+
* - `environment` — scoped to one environment name (e.g. only `stage`), across apps.
|
|
63
|
+
* A grant with neither scope is global.
|
|
64
|
+
*/
|
|
65
|
+
export declare const CONTROL_SCOPES: Readonly<{
|
|
66
|
+
APP: "app";
|
|
67
|
+
ENVIRONMENT: "environment";
|
|
68
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BUILDER_APPROVAL_STORAGE_KEY = "fabrika.builder.approval.v1";
|
|
3
|
+
export declare const BUILDER_AUTHORIZE_PATH = "/builder/authorize";
|
|
4
|
+
export interface BuilderApprovalState {
|
|
5
|
+
readonly attemptId: string;
|
|
6
|
+
readonly approvalVerifier: string;
|
|
7
|
+
readonly expiresAt: number;
|
|
8
|
+
}
|
|
9
|
+
export interface BuilderInstallationDiscoveryDto {
|
|
10
|
+
readonly version: 1;
|
|
11
|
+
readonly controlOrigin: string;
|
|
12
|
+
readonly iamIssuer: string;
|
|
13
|
+
readonly provider: string;
|
|
14
|
+
}
|
|
15
|
+
/** Self-contained so the public capture page can embed this exact validator without external assets. */
|
|
16
|
+
export declare function parseBuilderApprovalState(value: unknown, nowSeconds?: number): BuilderApprovalState | null;
|
|
17
|
+
/** Accept only a credential-free installation origin, never a redirect or a repository-selected path. */
|
|
18
|
+
export declare function parseBuilderPublicOrigin(value: unknown): string | null;
|
|
19
|
+
export declare function parseBuilderInstallationDiscovery(value: unknown): BuilderInstallationDiscoveryDto | null;
|
|
20
|
+
export declare const builderPublicOriginSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
21
|
+
export declare const builderInstallationDiscoverySchema: z.ZodEffects<z.ZodObject<{
|
|
22
|
+
version: z.ZodLiteral<1>;
|
|
23
|
+
controlOrigin: z.ZodEffects<z.ZodString, string, string>;
|
|
24
|
+
iamIssuer: z.ZodEffects<z.ZodString, string, string>;
|
|
25
|
+
provider: z.ZodString;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
version: 1;
|
|
28
|
+
controlOrigin: string;
|
|
29
|
+
iamIssuer: string;
|
|
30
|
+
provider: string;
|
|
31
|
+
}, {
|
|
32
|
+
version: 1;
|
|
33
|
+
controlOrigin: string;
|
|
34
|
+
iamIssuer: string;
|
|
35
|
+
provider: string;
|
|
36
|
+
}>, {
|
|
37
|
+
version: 1;
|
|
38
|
+
controlOrigin: string;
|
|
39
|
+
iamIssuer: string;
|
|
40
|
+
provider: string;
|
|
41
|
+
}, unknown>;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AppDto } from './index.js';
|
|
3
|
+
export declare const BUILDER_CONNECTION_ATTEMPT_ID: RegExp;
|
|
4
|
+
export declare const BUILDER_APPROVAL_VERIFIER: RegExp;
|
|
5
|
+
export declare const BUILDER_CONNECTION_IDENTIFIER: RegExp;
|
|
6
|
+
export interface BuilderConnectionEnvironmentDto {
|
|
7
|
+
readonly env: string;
|
|
8
|
+
readonly namespaceId: string | null;
|
|
9
|
+
readonly domain: string | null;
|
|
10
|
+
readonly publicOrigin: string | null;
|
|
11
|
+
readonly triggerRef: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface BuilderConnectionReceiptDto {
|
|
14
|
+
readonly version: 1;
|
|
15
|
+
readonly attemptId: string;
|
|
16
|
+
readonly provider: string;
|
|
17
|
+
readonly app: AppDto;
|
|
18
|
+
readonly environment: BuilderConnectionEnvironmentDto;
|
|
19
|
+
readonly createdAt: number;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateBuilderConnectionReceiptRequest {
|
|
22
|
+
readonly attemptId: string;
|
|
23
|
+
readonly approvalVerifier: string;
|
|
24
|
+
readonly appId: string;
|
|
25
|
+
readonly environment: BuilderConnectionEnvironmentDto;
|
|
26
|
+
}
|
|
27
|
+
export interface GetBuilderConnectionReceiptRequest {
|
|
28
|
+
readonly attemptId: string;
|
|
29
|
+
}
|
|
30
|
+
/** Decode the persisted/wire snapshot without accepting provider envelopes or credential fields. */
|
|
31
|
+
export declare function parseBuilderConnectionReceipt(value: unknown): BuilderConnectionReceiptDto;
|
|
32
|
+
export declare const builderConnectionAppSchema: z.ZodEffects<z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
repoUrl: z.ZodString;
|
|
35
|
+
defaultBranch: z.ZodString;
|
|
36
|
+
workerDir: z.ZodNullable<z.ZodString>;
|
|
37
|
+
buildCmd: z.ZodNullable<z.ZodString>;
|
|
38
|
+
configPath: z.ZodNullable<z.ZodString>;
|
|
39
|
+
githubConnectionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
githubInstallationId: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
createdAt: z.ZodNumber;
|
|
42
|
+
}, "strict", z.ZodTypeAny, {
|
|
43
|
+
id: string;
|
|
44
|
+
repoUrl: string;
|
|
45
|
+
defaultBranch: string;
|
|
46
|
+
workerDir: string | null;
|
|
47
|
+
buildCmd: string | null;
|
|
48
|
+
configPath: string | null;
|
|
49
|
+
githubInstallationId: number | null;
|
|
50
|
+
createdAt: number;
|
|
51
|
+
githubConnectionId?: string | null | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
id: string;
|
|
54
|
+
repoUrl: string;
|
|
55
|
+
defaultBranch: string;
|
|
56
|
+
workerDir: string | null;
|
|
57
|
+
buildCmd: string | null;
|
|
58
|
+
configPath: string | null;
|
|
59
|
+
githubInstallationId: number | null;
|
|
60
|
+
createdAt: number;
|
|
61
|
+
githubConnectionId?: string | null | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
githubInstallationId: number | null;
|
|
64
|
+
createdAt: number;
|
|
65
|
+
githubConnectionId?: string | null | undefined;
|
|
66
|
+
id: string;
|
|
67
|
+
repoUrl: string;
|
|
68
|
+
defaultBranch: string;
|
|
69
|
+
workerDir: string | null;
|
|
70
|
+
buildCmd: string | null;
|
|
71
|
+
configPath: string | null;
|
|
72
|
+
}, {
|
|
73
|
+
id: string;
|
|
74
|
+
repoUrl: string;
|
|
75
|
+
defaultBranch: string;
|
|
76
|
+
workerDir: string | null;
|
|
77
|
+
buildCmd: string | null;
|
|
78
|
+
configPath: string | null;
|
|
79
|
+
githubInstallationId: number | null;
|
|
80
|
+
createdAt: number;
|
|
81
|
+
githubConnectionId?: string | null | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
export declare const builderConnectionEnvironmentSchema: z.ZodObject<{
|
|
84
|
+
env: z.ZodString;
|
|
85
|
+
namespaceId: z.ZodNullable<z.ZodString>;
|
|
86
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
87
|
+
publicOrigin: z.ZodNullable<z.ZodString>;
|
|
88
|
+
triggerRef: z.ZodNullable<z.ZodString>;
|
|
89
|
+
}, "strict", z.ZodTypeAny, {
|
|
90
|
+
env: string;
|
|
91
|
+
domain: string | null;
|
|
92
|
+
publicOrigin: string | null;
|
|
93
|
+
triggerRef: string | null;
|
|
94
|
+
namespaceId: string | null;
|
|
95
|
+
}, {
|
|
96
|
+
env: string;
|
|
97
|
+
domain: string | null;
|
|
98
|
+
publicOrigin: string | null;
|
|
99
|
+
triggerRef: string | null;
|
|
100
|
+
namespaceId: string | null;
|
|
101
|
+
}>;
|
|
102
|
+
export declare const builderConnectionReceiptSchema: z.ZodObject<{
|
|
103
|
+
version: z.ZodLiteral<1>;
|
|
104
|
+
attemptId: z.ZodString;
|
|
105
|
+
provider: z.ZodString;
|
|
106
|
+
app: z.ZodEffects<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
repoUrl: z.ZodString;
|
|
109
|
+
defaultBranch: z.ZodString;
|
|
110
|
+
workerDir: z.ZodNullable<z.ZodString>;
|
|
111
|
+
buildCmd: z.ZodNullable<z.ZodString>;
|
|
112
|
+
configPath: z.ZodNullable<z.ZodString>;
|
|
113
|
+
githubConnectionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
githubInstallationId: z.ZodNullable<z.ZodNumber>;
|
|
115
|
+
createdAt: z.ZodNumber;
|
|
116
|
+
}, "strict", z.ZodTypeAny, {
|
|
117
|
+
id: string;
|
|
118
|
+
repoUrl: string;
|
|
119
|
+
defaultBranch: string;
|
|
120
|
+
workerDir: string | null;
|
|
121
|
+
buildCmd: string | null;
|
|
122
|
+
configPath: string | null;
|
|
123
|
+
githubInstallationId: number | null;
|
|
124
|
+
createdAt: number;
|
|
125
|
+
githubConnectionId?: string | null | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
id: string;
|
|
128
|
+
repoUrl: string;
|
|
129
|
+
defaultBranch: string;
|
|
130
|
+
workerDir: string | null;
|
|
131
|
+
buildCmd: string | null;
|
|
132
|
+
configPath: string | null;
|
|
133
|
+
githubInstallationId: number | null;
|
|
134
|
+
createdAt: number;
|
|
135
|
+
githubConnectionId?: string | null | undefined;
|
|
136
|
+
}>, {
|
|
137
|
+
githubInstallationId: number | null;
|
|
138
|
+
createdAt: number;
|
|
139
|
+
githubConnectionId?: string | null | undefined;
|
|
140
|
+
id: string;
|
|
141
|
+
repoUrl: string;
|
|
142
|
+
defaultBranch: string;
|
|
143
|
+
workerDir: string | null;
|
|
144
|
+
buildCmd: string | null;
|
|
145
|
+
configPath: string | null;
|
|
146
|
+
}, {
|
|
147
|
+
id: string;
|
|
148
|
+
repoUrl: string;
|
|
149
|
+
defaultBranch: string;
|
|
150
|
+
workerDir: string | null;
|
|
151
|
+
buildCmd: string | null;
|
|
152
|
+
configPath: string | null;
|
|
153
|
+
githubInstallationId: number | null;
|
|
154
|
+
createdAt: number;
|
|
155
|
+
githubConnectionId?: string | null | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
environment: z.ZodObject<{
|
|
158
|
+
env: z.ZodString;
|
|
159
|
+
namespaceId: z.ZodNullable<z.ZodString>;
|
|
160
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
161
|
+
publicOrigin: z.ZodNullable<z.ZodString>;
|
|
162
|
+
triggerRef: z.ZodNullable<z.ZodString>;
|
|
163
|
+
}, "strict", z.ZodTypeAny, {
|
|
164
|
+
env: string;
|
|
165
|
+
domain: string | null;
|
|
166
|
+
publicOrigin: string | null;
|
|
167
|
+
triggerRef: string | null;
|
|
168
|
+
namespaceId: string | null;
|
|
169
|
+
}, {
|
|
170
|
+
env: string;
|
|
171
|
+
domain: string | null;
|
|
172
|
+
publicOrigin: string | null;
|
|
173
|
+
triggerRef: string | null;
|
|
174
|
+
namespaceId: string | null;
|
|
175
|
+
}>;
|
|
176
|
+
createdAt: z.ZodNumber;
|
|
177
|
+
}, "strict", z.ZodTypeAny, {
|
|
178
|
+
app: {
|
|
179
|
+
githubInstallationId: number | null;
|
|
180
|
+
createdAt: number;
|
|
181
|
+
githubConnectionId?: string | null | undefined;
|
|
182
|
+
id: string;
|
|
183
|
+
repoUrl: string;
|
|
184
|
+
defaultBranch: string;
|
|
185
|
+
workerDir: string | null;
|
|
186
|
+
buildCmd: string | null;
|
|
187
|
+
configPath: string | null;
|
|
188
|
+
};
|
|
189
|
+
environment: {
|
|
190
|
+
env: string;
|
|
191
|
+
domain: string | null;
|
|
192
|
+
publicOrigin: string | null;
|
|
193
|
+
triggerRef: string | null;
|
|
194
|
+
namespaceId: string | null;
|
|
195
|
+
};
|
|
196
|
+
attemptId: string;
|
|
197
|
+
version: 1;
|
|
198
|
+
provider: string;
|
|
199
|
+
createdAt: number;
|
|
200
|
+
}, {
|
|
201
|
+
app: {
|
|
202
|
+
id: string;
|
|
203
|
+
repoUrl: string;
|
|
204
|
+
defaultBranch: string;
|
|
205
|
+
workerDir: string | null;
|
|
206
|
+
buildCmd: string | null;
|
|
207
|
+
configPath: string | null;
|
|
208
|
+
githubInstallationId: number | null;
|
|
209
|
+
createdAt: number;
|
|
210
|
+
githubConnectionId?: string | null | undefined;
|
|
211
|
+
};
|
|
212
|
+
environment: {
|
|
213
|
+
env: string;
|
|
214
|
+
domain: string | null;
|
|
215
|
+
publicOrigin: string | null;
|
|
216
|
+
triggerRef: string | null;
|
|
217
|
+
namespaceId: string | null;
|
|
218
|
+
};
|
|
219
|
+
attemptId: string;
|
|
220
|
+
version: 1;
|
|
221
|
+
provider: string;
|
|
222
|
+
createdAt: number;
|
|
223
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { ApproveDeviceAuthorizationResult, DenyDeviceAuthorizationResult, DeviceAuthorizationFailure, DeviceAuthorizationReceipt, DeviceAuthorizationRequest, InspectDeviceAuthorizationResult, ListOwnDeviceAuthorizationsResult, RevokeKeyResult, } from '@fabrika/auth-core';
|
|
2
|
+
export interface BuilderPairingProofRequest {
|
|
3
|
+
readonly attemptId: string;
|
|
4
|
+
readonly approvalVerifier: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ListOwnBuilderPairingsRequest {
|
|
7
|
+
readonly before?: string;
|
|
8
|
+
readonly limit?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RevokeBuilderPairingRequest {
|
|
11
|
+
readonly credentialId: string;
|
|
12
|
+
}
|