@openvtc/trust-tasks 0.20.2 → 0.20.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/CHANGELOG.md +51 -0
- package/dist/_shared/components.d.ts +175 -0
- package/dist/_shared/components.d.ts.map +1 -1
- package/dist/git-ns/_shared/0.1/git-ns.d.ts +16 -0
- package/dist/git-ns/_shared/0.1/git-ns.d.ts.map +1 -0
- package/dist/git-ns/_shared/0.1/git-ns.js +6 -0
- package/dist/git-ns/_shared/0.1/git-ns.js.map +1 -0
- package/dist/git-ns/account/link/0.1/payload.d.ts +355 -0
- package/dist/git-ns/account/link/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/account/link/0.1/payload.js +192 -0
- package/dist/git-ns/account/link/0.1/payload.js.map +1 -0
- package/dist/git-ns/account/link-status/0.1/payload.d.ts +403 -0
- package/dist/git-ns/account/link-status/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/account/link-status/0.1/payload.js +234 -0
- package/dist/git-ns/account/link-status/0.1/payload.js.map +1 -0
- package/dist/git-ns/bridge/event/0.1/payload.d.ts +1348 -0
- package/dist/git-ns/bridge/event/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/bridge/event/0.1/payload.js +785 -0
- package/dist/git-ns/bridge/event/0.1/payload.js.map +1 -0
- package/dist/git-ns/bridge/job/0.1/payload.d.ts +1044 -0
- package/dist/git-ns/bridge/job/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/bridge/job/0.1/payload.js +564 -0
- package/dist/git-ns/bridge/job/0.1/payload.js.map +1 -0
- package/dist/git-ns/bridge/result/0.1/payload.d.ts +462 -0
- package/dist/git-ns/bridge/result/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/bridge/result/0.1/payload.js +248 -0
- package/dist/git-ns/bridge/result/0.1/payload.js.map +1 -0
- package/dist/git-ns/namespace/bind/0.1/payload.d.ts +547 -0
- package/dist/git-ns/namespace/bind/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/namespace/bind/0.1/payload.js +322 -0
- package/dist/git-ns/namespace/bind/0.1/payload.js.map +1 -0
- package/dist/git-ns/namespace/unbind/0.1/payload.d.ts +300 -0
- package/dist/git-ns/namespace/unbind/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/namespace/unbind/0.1/payload.js +168 -0
- package/dist/git-ns/namespace/unbind/0.1/payload.js.map +1 -0
- package/dist/git-ns/repo/adopt/0.1/payload.d.ts +962 -0
- package/dist/git-ns/repo/adopt/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/repo/adopt/0.1/payload.js +583 -0
- package/dist/git-ns/repo/adopt/0.1/payload.js.map +1 -0
- package/dist/git-ns/repo/archive/0.1/payload.d.ts +959 -0
- package/dist/git-ns/repo/archive/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/repo/archive/0.1/payload.js +584 -0
- package/dist/git-ns/repo/archive/0.1/payload.js.map +1 -0
- package/dist/git-ns/repo/create/0.1/payload.d.ts +1074 -0
- package/dist/git-ns/repo/create/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/repo/create/0.1/payload.js +636 -0
- package/dist/git-ns/repo/create/0.1/payload.js.map +1 -0
- package/dist/git-ns/repo/transfer/0.1/payload.d.ts +947 -0
- package/dist/git-ns/repo/transfer/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/repo/transfer/0.1/payload.js +577 -0
- package/dist/git-ns/repo/transfer/0.1/payload.js.map +1 -0
- package/dist/git-ns/right/grant/0.1/payload.d.ts +506 -0
- package/dist/git-ns/right/grant/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/right/grant/0.1/payload.js +289 -0
- package/dist/git-ns/right/grant/0.1/payload.js.map +1 -0
- package/dist/git-ns/right/revoke/0.1/payload.d.ts +492 -0
- package/dist/git-ns/right/revoke/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/right/revoke/0.1/payload.js +284 -0
- package/dist/git-ns/right/revoke/0.1/payload.js.map +1 -0
- package/dist/git-ns/view/0.1/payload.d.ts +1407 -0
- package/dist/git-ns/view/0.1/payload.d.ts.map +1 -0
- package/dist/git-ns/view/0.1/payload.js +860 -0
- package/dist/git-ns/view/0.1/payload.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/_shared/components.ts +181 -0
- package/src/git-ns/_shared/0.1/git-ns.ts +17 -0
- package/src/git-ns/account/link/0.1/payload.ts +242 -0
- package/src/git-ns/account/link-status/0.1/payload.ts +276 -0
- package/src/git-ns/bridge/event/0.1/payload.ts +902 -0
- package/src/git-ns/bridge/job/0.1/payload.ts +676 -0
- package/src/git-ns/bridge/result/0.1/payload.ts +321 -0
- package/src/git-ns/namespace/bind/0.1/payload.ts +374 -0
- package/src/git-ns/namespace/unbind/0.1/payload.ts +211 -0
- package/src/git-ns/repo/adopt/0.1/payload.ts +628 -0
- package/src/git-ns/repo/archive/0.1/payload.ts +626 -0
- package/src/git-ns/repo/create/0.1/payload.ts +689 -0
- package/src/git-ns/repo/transfer/0.1/payload.ts +619 -0
- package/src/git-ns/right/grant/0.1/payload.ts +340 -0
- package/src/git-ns/right/revoke/0.1/payload.ts +331 -0
- package/src/git-ns/view/0.1/payload.ts +906 -0
- package/src/index.ts +15 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/git-ns/bridge/result/0.1/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Ext, ForgeId, RepoResource } from "../../../../_shared/components.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The bridge reports how a job ended. Exactly one result is sent per job; the VTC updates the repository's state, bootstrap status and forge id from it.
|
|
11
|
+
*/
|
|
12
|
+
export interface GitNamespacesBridgeJobResultPayload {
|
|
13
|
+
/**
|
|
14
|
+
* The job, as git-ns/bridge/job named it.
|
|
15
|
+
*/
|
|
16
|
+
jobId: string;
|
|
17
|
+
/**
|
|
18
|
+
* `succeeded` — every step was applied. `failed` — nothing was applied. `partial` — some steps were applied and at least one failed; `steps` says which. Every step is check-then-apply, so the VTC may send the job again.
|
|
19
|
+
*/
|
|
20
|
+
outcome: "succeeded" | "failed" | "partial";
|
|
21
|
+
/**
|
|
22
|
+
* The repository the job touched, as the forge now reports it. Present whenever the job reached a repository.
|
|
23
|
+
*/
|
|
24
|
+
repo?: {
|
|
25
|
+
resource: RepoResource;
|
|
26
|
+
forgeId: ForgeId;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Per-step outcomes, in the order they ran.
|
|
30
|
+
*/
|
|
31
|
+
steps?: {
|
|
32
|
+
/**
|
|
33
|
+
* The step name, from the adapter's plan.
|
|
34
|
+
*/
|
|
35
|
+
step: string;
|
|
36
|
+
/**
|
|
37
|
+
* `applied` — changed the forge. `unchanged` — already as required. `failed` — could not be applied. `skipped` — not attempted because an earlier step failed.
|
|
38
|
+
*/
|
|
39
|
+
outcome: "applied" | "unchanged" | "failed" | "skipped";
|
|
40
|
+
/**
|
|
41
|
+
* Human-readable detail, typically for a failure.
|
|
42
|
+
*/
|
|
43
|
+
detail?: string;
|
|
44
|
+
}[];
|
|
45
|
+
/**
|
|
46
|
+
* Why the job failed or stopped partway. Present when `outcome` is not `succeeded`.
|
|
47
|
+
*/
|
|
48
|
+
error?: {
|
|
49
|
+
/**
|
|
50
|
+
* Forge-neutral: `nameTaken`, `notFound`, `forbidden` (the bridge's forge credentials lack a permission), `notCapable` (this forge or namespace cannot do it), `rateLimited`, `expired` (a begin* job's person never completed it), `forgeError`. A bridge MAY use others.
|
|
51
|
+
*/
|
|
52
|
+
code: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
};
|
|
55
|
+
ext?: Ext;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The VTC has recorded the result.
|
|
59
|
+
*/
|
|
60
|
+
export interface GitNamespacesBridgeJobResultResponsePayload {
|
|
61
|
+
jobId: string;
|
|
62
|
+
ext?: Ext;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Shared definitions this specification references, re-exported under the names it used to declare them with. */
|
|
66
|
+
export type { Ext, ForgeId, RepoResource };
|
|
67
|
+
|
|
68
|
+
/** Trust Task type URI. */
|
|
69
|
+
export const TYPE_URI = "https://trusttasks.org/spec/git-ns/bridge/result/0.1" as const;
|
|
70
|
+
|
|
71
|
+
/** Stable alias for this specification's request payload shape. */
|
|
72
|
+
export type Payload = GitNamespacesBridgeJobResultPayload;
|
|
73
|
+
|
|
74
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
75
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/git-ns/bridge/result/0.1#response" as const;
|
|
76
|
+
|
|
77
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
78
|
+
export type Response = GitNamespacesBridgeJobResultResponsePayload;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* This specification's payload schema, as a value.
|
|
82
|
+
*
|
|
83
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
84
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
85
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
86
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
87
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
88
|
+
*/
|
|
89
|
+
export const PAYLOAD_SCHEMA = {
|
|
90
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
91
|
+
"$id": "https://trusttasks.org/spec/git-ns/bridge/result/0.1",
|
|
92
|
+
"title": "Git Namespaces — Bridge Job Result — payload",
|
|
93
|
+
"description": "The bridge reports how a job ended. Exactly one result is sent per job; the VTC updates the repository's state, bootstrap status and forge id from it.",
|
|
94
|
+
"type": "object",
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"required": [
|
|
97
|
+
"jobId",
|
|
98
|
+
"outcome"
|
|
99
|
+
],
|
|
100
|
+
"properties": {
|
|
101
|
+
"jobId": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"minLength": 1,
|
|
104
|
+
"maxLength": 128,
|
|
105
|
+
"description": "The job, as git-ns/bridge/job named it."
|
|
106
|
+
},
|
|
107
|
+
"outcome": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"enum": [
|
|
110
|
+
"succeeded",
|
|
111
|
+
"failed",
|
|
112
|
+
"partial"
|
|
113
|
+
],
|
|
114
|
+
"description": "`succeeded` — every step was applied. `failed` — nothing was applied. `partial` — some steps were applied and at least one failed; `steps` says which. Every step is check-then-apply, so the VTC may send the job again."
|
|
115
|
+
},
|
|
116
|
+
"repo": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"required": [
|
|
120
|
+
"resource",
|
|
121
|
+
"forgeId"
|
|
122
|
+
],
|
|
123
|
+
"description": "The repository the job touched, as the forge now reports it. Present whenever the job reached a repository.",
|
|
124
|
+
"properties": {
|
|
125
|
+
"resource": {
|
|
126
|
+
"$ref": "#/$defs/RepoResource"
|
|
127
|
+
},
|
|
128
|
+
"forgeId": {
|
|
129
|
+
"$ref": "#/$defs/ForgeId"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"steps": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"additionalProperties": false,
|
|
138
|
+
"required": [
|
|
139
|
+
"step",
|
|
140
|
+
"outcome"
|
|
141
|
+
],
|
|
142
|
+
"properties": {
|
|
143
|
+
"step": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"minLength": 1,
|
|
146
|
+
"maxLength": 64,
|
|
147
|
+
"pattern": "^[a-z][A-Za-z0-9]*$",
|
|
148
|
+
"description": "The step name, from the adapter's plan."
|
|
149
|
+
},
|
|
150
|
+
"outcome": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"enum": [
|
|
153
|
+
"applied",
|
|
154
|
+
"unchanged",
|
|
155
|
+
"failed",
|
|
156
|
+
"skipped"
|
|
157
|
+
],
|
|
158
|
+
"description": "`applied` — changed the forge. `unchanged` — already as required. `failed` — could not be applied. `skipped` — not attempted because an earlier step failed."
|
|
159
|
+
},
|
|
160
|
+
"detail": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"maxLength": 1024,
|
|
163
|
+
"description": "Human-readable detail, typically for a failure."
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"description": "Per-step outcomes, in the order they ran."
|
|
168
|
+
},
|
|
169
|
+
"error": {
|
|
170
|
+
"type": "object",
|
|
171
|
+
"additionalProperties": false,
|
|
172
|
+
"required": [
|
|
173
|
+
"code"
|
|
174
|
+
],
|
|
175
|
+
"description": "Why the job failed or stopped partway. Present when `outcome` is not `succeeded`.",
|
|
176
|
+
"properties": {
|
|
177
|
+
"code": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"minLength": 1,
|
|
180
|
+
"maxLength": 64,
|
|
181
|
+
"pattern": "^[a-z][A-Za-z0-9]*$",
|
|
182
|
+
"description": "Forge-neutral: `nameTaken`, `notFound`, `forbidden` (the bridge's forge credentials lack a permission), `notCapable` (this forge or namespace cannot do it), `rateLimited`, `expired` (a begin* job's person never completed it), `forgeError`. A bridge MAY use others."
|
|
183
|
+
},
|
|
184
|
+
"message": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"maxLength": 1024
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"ext": {
|
|
191
|
+
"$ref": "#/$defs/Ext"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"$defs": {
|
|
195
|
+
"Response": {
|
|
196
|
+
"$anchor": "response",
|
|
197
|
+
"title": "Git Namespaces — Bridge Job Result — response payload",
|
|
198
|
+
"description": "The VTC has recorded the result.",
|
|
199
|
+
"type": "object",
|
|
200
|
+
"additionalProperties": false,
|
|
201
|
+
"required": [
|
|
202
|
+
"jobId"
|
|
203
|
+
],
|
|
204
|
+
"properties": {
|
|
205
|
+
"jobId": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"minLength": 1,
|
|
208
|
+
"maxLength": 128
|
|
209
|
+
},
|
|
210
|
+
"ext": {
|
|
211
|
+
"$ref": "#/$defs/Ext"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"Ext": {
|
|
216
|
+
"title": "Ext",
|
|
217
|
+
"description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
|
|
218
|
+
"type": "object",
|
|
219
|
+
"minProperties": 1,
|
|
220
|
+
"additionalProperties": true,
|
|
221
|
+
"propertyNames": {
|
|
222
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"ForgeId": {
|
|
226
|
+
"title": "ForgeId",
|
|
227
|
+
"description": "An identifier the forge itself assigns — a repository id, a user or organisation id — carried as a string so a forge whose ids are not numbers needs no new version. GitHub and Forgejo ids are decimal integers written as strings (`\"812736451\"`). Unlike a name, it survives renames and transfers, which is why rights and bindings are keyed by it.",
|
|
228
|
+
"type": "string",
|
|
229
|
+
"minLength": 1,
|
|
230
|
+
"maxLength": 64
|
|
231
|
+
},
|
|
232
|
+
"RepoResource": {
|
|
233
|
+
"title": "RepoResource",
|
|
234
|
+
"description": "A forge-qualified resource naming exactly one repository: `<forge-host>/<owner>/<repo>`, lowercase.",
|
|
235
|
+
"type": "string",
|
|
236
|
+
"maxLength": 455,
|
|
237
|
+
"pattern": "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
} as const;
|
|
241
|
+
|
|
242
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
243
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
244
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
245
|
+
"$ref": "#/$defs/Response",
|
|
246
|
+
"$defs": {
|
|
247
|
+
"Response": {
|
|
248
|
+
"$anchor": "response",
|
|
249
|
+
"title": "Git Namespaces — Bridge Job Result — response payload",
|
|
250
|
+
"description": "The VTC has recorded the result.",
|
|
251
|
+
"type": "object",
|
|
252
|
+
"additionalProperties": false,
|
|
253
|
+
"required": [
|
|
254
|
+
"jobId"
|
|
255
|
+
],
|
|
256
|
+
"properties": {
|
|
257
|
+
"jobId": {
|
|
258
|
+
"type": "string",
|
|
259
|
+
"minLength": 1,
|
|
260
|
+
"maxLength": 128
|
|
261
|
+
},
|
|
262
|
+
"ext": {
|
|
263
|
+
"$ref": "#/$defs/Ext"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"Ext": {
|
|
268
|
+
"title": "Ext",
|
|
269
|
+
"description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
|
|
270
|
+
"type": "object",
|
|
271
|
+
"minProperties": 1,
|
|
272
|
+
"additionalProperties": true,
|
|
273
|
+
"propertyNames": {
|
|
274
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"ForgeId": {
|
|
278
|
+
"title": "ForgeId",
|
|
279
|
+
"description": "An identifier the forge itself assigns — a repository id, a user or organisation id — carried as a string so a forge whose ids are not numbers needs no new version. GitHub and Forgejo ids are decimal integers written as strings (`\"812736451\"`). Unlike a name, it survives renames and transfers, which is why rights and bindings are keyed by it.",
|
|
280
|
+
"type": "string",
|
|
281
|
+
"minLength": 1,
|
|
282
|
+
"maxLength": 64
|
|
283
|
+
},
|
|
284
|
+
"RepoResource": {
|
|
285
|
+
"title": "RepoResource",
|
|
286
|
+
"description": "A forge-qualified resource naming exactly one repository: `<forge-host>/<owner>/<repo>`, lowercase.",
|
|
287
|
+
"type": "string",
|
|
288
|
+
"maxLength": 455,
|
|
289
|
+
"pattern": "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
} as const;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
296
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
297
|
+
* per-specification and cannot be derived from the document alone, and
|
|
298
|
+
* item 2 needs the schema this carries.
|
|
299
|
+
*/
|
|
300
|
+
export const SPEC = {
|
|
301
|
+
typeUri: TYPE_URI,
|
|
302
|
+
isBearer: false,
|
|
303
|
+
isProofRequired: true,
|
|
304
|
+
isRecipientRequired: true,
|
|
305
|
+
isIssuedAtRequired: true,
|
|
306
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
307
|
+
} as const;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
311
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
312
|
+
* parties (§7.3 item 5).
|
|
313
|
+
*/
|
|
314
|
+
export const RESPONSE_SPEC = {
|
|
315
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
316
|
+
isBearer: false,
|
|
317
|
+
isProofRequired: true,
|
|
318
|
+
isRecipientRequired: true,
|
|
319
|
+
isIssuedAtRequired: true,
|
|
320
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
321
|
+
} as const;
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/git-ns/namespace/bind/0.1/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Ext, ForgeHost, GitNamespace, NamespaceId, Segment } from "../../../../_shared/components.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A VTC administrator binds the VTC to one owner on one forge, so that the VTC governs who may create, own, maintain and commit to repositories under it. In bridge mode the response says where to send the forge owner to prove control; the namespace stays `pending` until that proof arrives.
|
|
11
|
+
*/
|
|
12
|
+
export interface GitNamespacesBindNamespacePayload {
|
|
13
|
+
/**
|
|
14
|
+
* The forge's host, lowercased.
|
|
15
|
+
*/
|
|
16
|
+
forge: ForgeHost;
|
|
17
|
+
/**
|
|
18
|
+
* The organisation or user on that forge, lowercased.
|
|
19
|
+
*/
|
|
20
|
+
owner: Segment;
|
|
21
|
+
/**
|
|
22
|
+
* `bridge` — a bridge service serving this forge proves control and then acts on the forge. `manual` — no automation; the binding admin declares the namespace and people with forge access carry out the forge-side steps.
|
|
23
|
+
*/
|
|
24
|
+
mode: "bridge" | "manual";
|
|
25
|
+
ext?: Ext;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The namespace as recorded, and where to go next if it is still pending.
|
|
29
|
+
*/
|
|
30
|
+
export interface GitNamespacesBindNamespaceResponsePayload {
|
|
31
|
+
namespace: GitNamespace;
|
|
32
|
+
/**
|
|
33
|
+
* Present when the namespace is `pending`: where the administrator goes to prove control of the forge owner (install the community's forge app, or sign in to the forge and authorise the bridge).
|
|
34
|
+
*/
|
|
35
|
+
next?: {
|
|
36
|
+
/**
|
|
37
|
+
* An https URL, single-use, carrying the bridge's binding nonce.
|
|
38
|
+
*/
|
|
39
|
+
url: string;
|
|
40
|
+
};
|
|
41
|
+
ext?: Ext;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Shared definitions this specification references, re-exported under the names it used to declare them with. */
|
|
45
|
+
export type { Ext, ForgeHost, GitNamespace, NamespaceId, Segment };
|
|
46
|
+
|
|
47
|
+
/** Trust Task type URI. */
|
|
48
|
+
export const TYPE_URI = "https://trusttasks.org/spec/git-ns/namespace/bind/0.1" as const;
|
|
49
|
+
|
|
50
|
+
/** Stable alias for this specification's request payload shape. */
|
|
51
|
+
export type Payload = GitNamespacesBindNamespacePayload;
|
|
52
|
+
|
|
53
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
54
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/git-ns/namespace/bind/0.1#response" as const;
|
|
55
|
+
|
|
56
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
57
|
+
export type Response = GitNamespacesBindNamespaceResponsePayload;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* This specification's payload schema, as a value.
|
|
61
|
+
*
|
|
62
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
63
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
64
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
65
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
66
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
67
|
+
*/
|
|
68
|
+
export const PAYLOAD_SCHEMA = {
|
|
69
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
70
|
+
"$id": "https://trusttasks.org/spec/git-ns/namespace/bind/0.1",
|
|
71
|
+
"title": "Git Namespaces — Bind Namespace — payload",
|
|
72
|
+
"description": "A VTC administrator binds the VTC to one owner on one forge, so that the VTC governs who may create, own, maintain and commit to repositories under it. In bridge mode the response says where to send the forge owner to prove control; the namespace stays `pending` until that proof arrives.",
|
|
73
|
+
"type": "object",
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"required": [
|
|
76
|
+
"forge",
|
|
77
|
+
"owner",
|
|
78
|
+
"mode"
|
|
79
|
+
],
|
|
80
|
+
"properties": {
|
|
81
|
+
"forge": {
|
|
82
|
+
"$ref": "#/$defs/ForgeHost",
|
|
83
|
+
"description": "The forge's host, lowercased."
|
|
84
|
+
},
|
|
85
|
+
"owner": {
|
|
86
|
+
"$ref": "#/$defs/Segment",
|
|
87
|
+
"description": "The organisation or user on that forge, lowercased."
|
|
88
|
+
},
|
|
89
|
+
"mode": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"enum": [
|
|
92
|
+
"bridge",
|
|
93
|
+
"manual"
|
|
94
|
+
],
|
|
95
|
+
"description": "`bridge` — a bridge service serving this forge proves control and then acts on the forge. `manual` — no automation; the binding admin declares the namespace and people with forge access carry out the forge-side steps."
|
|
96
|
+
},
|
|
97
|
+
"ext": {
|
|
98
|
+
"$ref": "#/$defs/Ext"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"$defs": {
|
|
102
|
+
"Response": {
|
|
103
|
+
"$anchor": "response",
|
|
104
|
+
"title": "Git Namespaces — Bind Namespace — response payload",
|
|
105
|
+
"description": "The namespace as recorded, and where to go next if it is still pending.",
|
|
106
|
+
"type": "object",
|
|
107
|
+
"additionalProperties": false,
|
|
108
|
+
"required": [
|
|
109
|
+
"namespace"
|
|
110
|
+
],
|
|
111
|
+
"properties": {
|
|
112
|
+
"namespace": {
|
|
113
|
+
"$ref": "#/$defs/GitNamespace"
|
|
114
|
+
},
|
|
115
|
+
"next": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"required": [
|
|
119
|
+
"url"
|
|
120
|
+
],
|
|
121
|
+
"description": "Present when the namespace is `pending`: where the administrator goes to prove control of the forge owner (install the community's forge app, or sign in to the forge and authorise the bridge).",
|
|
122
|
+
"properties": {
|
|
123
|
+
"url": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"format": "uri",
|
|
126
|
+
"maxLength": 2048,
|
|
127
|
+
"pattern": "^https://",
|
|
128
|
+
"description": "An https URL, single-use, carrying the bridge's binding nonce."
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"ext": {
|
|
133
|
+
"$ref": "#/$defs/Ext"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"Ext": {
|
|
138
|
+
"title": "Ext",
|
|
139
|
+
"description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
|
|
140
|
+
"type": "object",
|
|
141
|
+
"minProperties": 1,
|
|
142
|
+
"additionalProperties": true,
|
|
143
|
+
"propertyNames": {
|
|
144
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"GitNamespace": {
|
|
148
|
+
"title": "GitNamespace",
|
|
149
|
+
"description": "The VTC's binding to one owner on one forge.",
|
|
150
|
+
"type": "object",
|
|
151
|
+
"additionalProperties": false,
|
|
152
|
+
"required": [
|
|
153
|
+
"id",
|
|
154
|
+
"forge",
|
|
155
|
+
"owner",
|
|
156
|
+
"mode",
|
|
157
|
+
"state"
|
|
158
|
+
],
|
|
159
|
+
"properties": {
|
|
160
|
+
"id": {
|
|
161
|
+
"$ref": "#/$defs/NamespaceId"
|
|
162
|
+
},
|
|
163
|
+
"forge": {
|
|
164
|
+
"$ref": "#/$defs/ForgeHost"
|
|
165
|
+
},
|
|
166
|
+
"owner": {
|
|
167
|
+
"$ref": "#/$defs/Segment",
|
|
168
|
+
"description": "The organisation or user on the forge, lowercased."
|
|
169
|
+
},
|
|
170
|
+
"kind": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"enum": [
|
|
173
|
+
"organization",
|
|
174
|
+
"user"
|
|
175
|
+
],
|
|
176
|
+
"description": "Whether the owner is an organisation or a personal account, as the forge reports it. Present once known: a bridge-mode namespace learns it when binding completes, and a manual-mode namespace MAY never learn it."
|
|
177
|
+
},
|
|
178
|
+
"mode": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"enum": [
|
|
181
|
+
"bridge",
|
|
182
|
+
"manual"
|
|
183
|
+
],
|
|
184
|
+
"description": "`bridge` — a bridge service acts on the forge for this namespace (creates repositories, projects roles, reports drift). `manual` — no automation; people with forge access carry out the steps the VTC names, and the VTC governs the rights alone."
|
|
185
|
+
},
|
|
186
|
+
"state": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"enum": [
|
|
189
|
+
"pending",
|
|
190
|
+
"bound"
|
|
191
|
+
],
|
|
192
|
+
"description": "`pending` — binding has started and the forge-side proof has not arrived yet. `bound` — the VTC governs rights under this namespace."
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"Segment": {
|
|
197
|
+
"title": "Segment",
|
|
198
|
+
"description": "One lowercased owner or repository name. Forges compare these case-insensitively, so the wire form is always lowercase and a producer lowercases before sending. A leading `.` is refused, which rules out `.` and `..`.",
|
|
199
|
+
"type": "string",
|
|
200
|
+
"minLength": 1,
|
|
201
|
+
"maxLength": 100,
|
|
202
|
+
"pattern": "^[a-z0-9_-][a-z0-9._-]*$"
|
|
203
|
+
},
|
|
204
|
+
"ForgeHost": {
|
|
205
|
+
"title": "ForgeHost",
|
|
206
|
+
"description": "The lowercased DNS host of a forge: `github.com`, a GitHub Enterprise Server host, `codeberg.org`, or a self-hosted Forgejo instance such as `git.example.org`. No scheme, no port, no path. The host is a segment of every resource, so a right never crosses forges.",
|
|
207
|
+
"type": "string",
|
|
208
|
+
"minLength": 3,
|
|
209
|
+
"maxLength": 253,
|
|
210
|
+
"pattern": "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$"
|
|
211
|
+
},
|
|
212
|
+
"NamespaceId": {
|
|
213
|
+
"title": "NamespaceId",
|
|
214
|
+
"description": "The VTC's opaque identifier for a namespace, assigned when it is bound. Stable for the life of the binding; never reused for another binding.",
|
|
215
|
+
"type": "string",
|
|
216
|
+
"minLength": 1,
|
|
217
|
+
"maxLength": 128
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} as const;
|
|
221
|
+
|
|
222
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
223
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
224
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
225
|
+
"$ref": "#/$defs/Response",
|
|
226
|
+
"$defs": {
|
|
227
|
+
"Response": {
|
|
228
|
+
"$anchor": "response",
|
|
229
|
+
"title": "Git Namespaces — Bind Namespace — response payload",
|
|
230
|
+
"description": "The namespace as recorded, and where to go next if it is still pending.",
|
|
231
|
+
"type": "object",
|
|
232
|
+
"additionalProperties": false,
|
|
233
|
+
"required": [
|
|
234
|
+
"namespace"
|
|
235
|
+
],
|
|
236
|
+
"properties": {
|
|
237
|
+
"namespace": {
|
|
238
|
+
"$ref": "#/$defs/GitNamespace"
|
|
239
|
+
},
|
|
240
|
+
"next": {
|
|
241
|
+
"type": "object",
|
|
242
|
+
"additionalProperties": false,
|
|
243
|
+
"required": [
|
|
244
|
+
"url"
|
|
245
|
+
],
|
|
246
|
+
"description": "Present when the namespace is `pending`: where the administrator goes to prove control of the forge owner (install the community's forge app, or sign in to the forge and authorise the bridge).",
|
|
247
|
+
"properties": {
|
|
248
|
+
"url": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"format": "uri",
|
|
251
|
+
"maxLength": 2048,
|
|
252
|
+
"pattern": "^https://",
|
|
253
|
+
"description": "An https URL, single-use, carrying the bridge's binding nonce."
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"ext": {
|
|
258
|
+
"$ref": "#/$defs/Ext"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"Ext": {
|
|
263
|
+
"title": "Ext",
|
|
264
|
+
"description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
|
|
265
|
+
"type": "object",
|
|
266
|
+
"minProperties": 1,
|
|
267
|
+
"additionalProperties": true,
|
|
268
|
+
"propertyNames": {
|
|
269
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
"GitNamespace": {
|
|
273
|
+
"title": "GitNamespace",
|
|
274
|
+
"description": "The VTC's binding to one owner on one forge.",
|
|
275
|
+
"type": "object",
|
|
276
|
+
"additionalProperties": false,
|
|
277
|
+
"required": [
|
|
278
|
+
"id",
|
|
279
|
+
"forge",
|
|
280
|
+
"owner",
|
|
281
|
+
"mode",
|
|
282
|
+
"state"
|
|
283
|
+
],
|
|
284
|
+
"properties": {
|
|
285
|
+
"id": {
|
|
286
|
+
"$ref": "#/$defs/NamespaceId"
|
|
287
|
+
},
|
|
288
|
+
"forge": {
|
|
289
|
+
"$ref": "#/$defs/ForgeHost"
|
|
290
|
+
},
|
|
291
|
+
"owner": {
|
|
292
|
+
"$ref": "#/$defs/Segment",
|
|
293
|
+
"description": "The organisation or user on the forge, lowercased."
|
|
294
|
+
},
|
|
295
|
+
"kind": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"enum": [
|
|
298
|
+
"organization",
|
|
299
|
+
"user"
|
|
300
|
+
],
|
|
301
|
+
"description": "Whether the owner is an organisation or a personal account, as the forge reports it. Present once known: a bridge-mode namespace learns it when binding completes, and a manual-mode namespace MAY never learn it."
|
|
302
|
+
},
|
|
303
|
+
"mode": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"enum": [
|
|
306
|
+
"bridge",
|
|
307
|
+
"manual"
|
|
308
|
+
],
|
|
309
|
+
"description": "`bridge` — a bridge service acts on the forge for this namespace (creates repositories, projects roles, reports drift). `manual` — no automation; people with forge access carry out the steps the VTC names, and the VTC governs the rights alone."
|
|
310
|
+
},
|
|
311
|
+
"state": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"enum": [
|
|
314
|
+
"pending",
|
|
315
|
+
"bound"
|
|
316
|
+
],
|
|
317
|
+
"description": "`pending` — binding has started and the forge-side proof has not arrived yet. `bound` — the VTC governs rights under this namespace."
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"Segment": {
|
|
322
|
+
"title": "Segment",
|
|
323
|
+
"description": "One lowercased owner or repository name. Forges compare these case-insensitively, so the wire form is always lowercase and a producer lowercases before sending. A leading `.` is refused, which rules out `.` and `..`.",
|
|
324
|
+
"type": "string",
|
|
325
|
+
"minLength": 1,
|
|
326
|
+
"maxLength": 100,
|
|
327
|
+
"pattern": "^[a-z0-9_-][a-z0-9._-]*$"
|
|
328
|
+
},
|
|
329
|
+
"ForgeHost": {
|
|
330
|
+
"title": "ForgeHost",
|
|
331
|
+
"description": "The lowercased DNS host of a forge: `github.com`, a GitHub Enterprise Server host, `codeberg.org`, or a self-hosted Forgejo instance such as `git.example.org`. No scheme, no port, no path. The host is a segment of every resource, so a right never crosses forges.",
|
|
332
|
+
"type": "string",
|
|
333
|
+
"minLength": 3,
|
|
334
|
+
"maxLength": 253,
|
|
335
|
+
"pattern": "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$"
|
|
336
|
+
},
|
|
337
|
+
"NamespaceId": {
|
|
338
|
+
"title": "NamespaceId",
|
|
339
|
+
"description": "The VTC's opaque identifier for a namespace, assigned when it is bound. Stable for the life of the binding; never reused for another binding.",
|
|
340
|
+
"type": "string",
|
|
341
|
+
"minLength": 1,
|
|
342
|
+
"maxLength": 128
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} as const;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
349
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
350
|
+
* per-specification and cannot be derived from the document alone, and
|
|
351
|
+
* item 2 needs the schema this carries.
|
|
352
|
+
*/
|
|
353
|
+
export const SPEC = {
|
|
354
|
+
typeUri: TYPE_URI,
|
|
355
|
+
isBearer: false,
|
|
356
|
+
isProofRequired: true,
|
|
357
|
+
isRecipientRequired: true,
|
|
358
|
+
isIssuedAtRequired: true,
|
|
359
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
360
|
+
} as const;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
364
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
365
|
+
* parties (§7.3 item 5).
|
|
366
|
+
*/
|
|
367
|
+
export const RESPONSE_SPEC = {
|
|
368
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
369
|
+
isBearer: false,
|
|
370
|
+
isProofRequired: true,
|
|
371
|
+
isRecipientRequired: true,
|
|
372
|
+
isIssuedAtRequired: true,
|
|
373
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
374
|
+
} as const;
|