@fabrika/control-contract 0.4.2 → 0.4.3
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 +4 -4
- package/src/access.ts +50 -0
- package/src/index.ts +28 -0
- package/src/rpc.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/control-contract",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"zod": "^3.25.76",
|
|
28
|
-
"@fabrika/auth-core": "^0.4.
|
|
29
|
-
"@fabrika/app": "^0.4.
|
|
30
|
-
"@fabrika/provider-contract": "^0.4.
|
|
28
|
+
"@fabrika/auth-core": "^0.4.3",
|
|
29
|
+
"@fabrika/app": "^0.4.3",
|
|
30
|
+
"@fabrika/provider-contract": "^0.4.3"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/access.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** IAM vocabulary shared by the Control runtime, its Access schema and the console. */
|
|
2
|
+
|
|
3
|
+
/** Durable IAM application id of the console — a deployed identity, not configuration branding (ADR-0024). */
|
|
4
|
+
export const CONTROL_APP_ID = 'vozka'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The actions Control authorizes against. AWS-IAM-style dotted strings; IAM's `permits` matches
|
|
8
|
+
* them (incl. `*` / `prefix.*` wildcards in granted roles).
|
|
9
|
+
*/
|
|
10
|
+
export const CONTROL_ACTIONS = Object.freeze({
|
|
11
|
+
/** Trigger a deploy run (the manual "Deploy" button / triggerDeploy RPC). Scoped by app/environment. */
|
|
12
|
+
DEPLOY_TRIGGER: 'deploy.trigger',
|
|
13
|
+
/** Read deploy runs + their logs (run history API). Scoped by app/environment. */
|
|
14
|
+
DEPLOY_READ: 'deploy.read',
|
|
15
|
+
/** Manage the app registry (apps + app_envs CRUD, onboarding). Scoped by app (global to create). */
|
|
16
|
+
APP_MANAGE: 'app.manage',
|
|
17
|
+
/** Manage provider-owned deployment namespaces and their lifecycle. Global because namespaces may span apps. */
|
|
18
|
+
NAMESPACE_MANAGE: 'namespace.manage',
|
|
19
|
+
/**
|
|
20
|
+
* Manage SECRET VALUES + their references. Gates the app_secrets reference CRUD (scoped by app) AND
|
|
21
|
+
* writing/rotating/deleting the encrypted per-app/app-env VALUES in the vault. The value is
|
|
22
|
+
* write-only over the API; it is never returned. (Platform creds — the CF token, IAM
|
|
23
|
+
* provisioning creds — are fabrika's own Worker secrets, not managed through this action.)
|
|
24
|
+
*/
|
|
25
|
+
SECRET_MANAGE: 'secret.manage',
|
|
26
|
+
/** Manage the platform GitHub source connection. Global because it changes control-wide credentials. */
|
|
27
|
+
SOURCE_CONNECTION_MANAGE: 'source.connection.manage',
|
|
28
|
+
/** Read the files of one's own Git workspaces on an authoring target (ADR-0049). Scoped by app/environment. */
|
|
29
|
+
SOURCE_WORKSPACE_READ: 'source.workspace.read',
|
|
30
|
+
/** Create Git workspaces and commit to them on an authoring target. Scoped by app/environment. */
|
|
31
|
+
SOURCE_WORKSPACE_WRITE: 'source.workspace.write',
|
|
32
|
+
/** Open a pull request from one's own workspace to the default branch. Scoped by app/environment. */
|
|
33
|
+
SOURCE_PULL_REQUEST_CREATE: 'source.pull-request.create',
|
|
34
|
+
/**
|
|
35
|
+
* Approve a widening of an environment's access and change its `protected` flag (ADR-0050). Outside `deploy.*`, so
|
|
36
|
+
* the operator role does not hold it; only a human user principal in the console may use it. Scoped by app/environment.
|
|
37
|
+
*/
|
|
38
|
+
ACCESS_APPROVE: 'access.approve',
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The scope dimensions Control authorizes within (flat + independent IAM semantics):
|
|
43
|
+
* - `app` — scoped to one registered app (its `id`), across every environment.
|
|
44
|
+
* - `environment` — scoped to one environment name (e.g. only `stage`), across apps.
|
|
45
|
+
* A grant with neither scope is global.
|
|
46
|
+
*/
|
|
47
|
+
export const CONTROL_SCOPES = Object.freeze({
|
|
48
|
+
APP: 'app',
|
|
49
|
+
ENVIRONMENT: 'environment',
|
|
50
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JsonValue, ProviderEnvelope } from '@fabrika/provider-contract'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
+
export * from './access.js'
|
|
4
5
|
export * from './builder-bootstrap.js'
|
|
5
6
|
export * from './builder-connections.js'
|
|
6
7
|
export * from './builder-pairing.js'
|
|
@@ -26,6 +27,25 @@ export interface InstallationDto {
|
|
|
26
27
|
readonly provider: string
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The console actions the caller's verified token holds, in the shape of an application's caller document. The
|
|
32
|
+
* console shows and hides by it; it decides nothing, because every procedure checks its own action.
|
|
33
|
+
*/
|
|
34
|
+
export interface ConsoleAccessDto {
|
|
35
|
+
/** Null for a credential bound to no principal. */
|
|
36
|
+
readonly principal: { readonly id: string; readonly label: string } | null
|
|
37
|
+
/** The actions held as a global grant, so in every scope value. */
|
|
38
|
+
readonly global: readonly string[]
|
|
39
|
+
/** Each scope value the caller holds an action in, with those actions; sorted by dimension, then value. */
|
|
40
|
+
readonly scopes: readonly ConsoleScopedActionsDto[]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ConsoleScopedActionsDto {
|
|
44
|
+
readonly type: string
|
|
45
|
+
readonly value: string
|
|
46
|
+
readonly actions: readonly string[]
|
|
47
|
+
}
|
|
48
|
+
|
|
29
49
|
export interface GitHubSourceRepositoryDto {
|
|
30
50
|
readonly owner: string
|
|
31
51
|
readonly name: string
|
|
@@ -81,6 +101,14 @@ export interface GitHubSourceConnectionInstallationRequiredDto extends GitHubSou
|
|
|
81
101
|
readonly installationUrl: string
|
|
82
102
|
}
|
|
83
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The query parameter Control's GitHub setup URL adds when it sends the browser to the console's source page. It reports
|
|
106
|
+
* what that one return from GitHub found; the page still reads the connection state from the API.
|
|
107
|
+
*/
|
|
108
|
+
export const GITHUB_SETUP_OUTCOME_PARAM = 'github-setup'
|
|
109
|
+
|
|
110
|
+
export type GitHubSetupOutcome = 'connected' | 'approval-requested' | 'unverified'
|
|
111
|
+
|
|
84
112
|
export interface GitHubSourceConnectionConnectedDto extends GitHubSourceConnectionBaseDto {
|
|
85
113
|
readonly state: 'connected'
|
|
86
114
|
readonly connectionId: string
|
package/src/rpc.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
AppSecretDto,
|
|
20
20
|
AppVarDto,
|
|
21
21
|
CompleteApprovalRequest,
|
|
22
|
+
ConsoleAccessDto,
|
|
22
23
|
CreateDeploymentNamespaceRequest,
|
|
23
24
|
CursorList,
|
|
24
25
|
DeploymentNamespaceDetailDto,
|
|
@@ -135,6 +136,7 @@ export interface GitHubSourceConnectionRpcContract {
|
|
|
135
136
|
/** Portable Delivery control API shared by browser and machine callers. */
|
|
136
137
|
export interface ControlRpcContract {
|
|
137
138
|
installation: RpcProcedure<void, InstallationDto>
|
|
139
|
+
consoleAccess: RpcProcedure<void, ConsoleAccessDto>
|
|
138
140
|
builderPairing: {
|
|
139
141
|
inspect: RpcProcedure<BuilderPairingProofRequest, InspectDeviceAuthorizationResult>
|
|
140
142
|
approve: RpcProcedure<BuilderPairingProofRequest, ApproveDeviceAuthorizationResult>
|