@dynamicalsystems/idl 0.11.0 → 0.13.0
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/dist/index.cjs +1153 -1
- package/dist/index.d.cts +2299 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2299 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1080 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/schema/dsg-extension-release-v1.json +866 -0
- package/schema/dsg-organization-release-v1.json +3924 -0
- package/schema/dsg-organization-source-v2.json +623 -0
- package/schema/dsg-organization-source-v3.json +794 -0
- package/schema/dsg-run-execution-binding-v1.json +3163 -0
- package/schema/dsg-run-job-class-v1.json +295 -0
- package/schema/dsg-run-workload-artifact-v1.json +284 -0
- package/src/extension/release.v1.ts +217 -0
- package/src/index.ts +170 -0
- package/src/organization/release.v1.ts +403 -0
- package/src/organization/source.v2.ts +219 -0
- package/src/organization/source.v3.ts +165 -0
- package/src/run/execution-binding.v1.ts +70 -0
- package/src/run/job-class.v1.ts +57 -0
- package/src/run/workload-artifact.v1.ts +89 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
// dsg.organization.release/1
|
|
2
|
+
// Semantic bodies and installation observations are separate documents.
|
|
3
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
4
|
+
import {
|
|
5
|
+
closed,
|
|
6
|
+
Hex64,
|
|
7
|
+
NonEmptyString,
|
|
8
|
+
Orn,
|
|
9
|
+
Reference,
|
|
10
|
+
SafeInt,
|
|
11
|
+
UtcSecond,
|
|
12
|
+
type ProfileEntry,
|
|
13
|
+
} from "../primitives.js";
|
|
14
|
+
import { ExtensionComponentKindSchema } from "../extension/release.v1.js";
|
|
15
|
+
|
|
16
|
+
export const ORGANIZATION_RELEASE_PROFILE = "dsg.organization.release/1" as const;
|
|
17
|
+
export const ORGANIZATION_RELEASE_CANONICALIZATION = "RFC8785-JCS-UTF8" as const;
|
|
18
|
+
const Identifier = Type.String({ pattern: "^[a-z][a-z0-9-]*(?:[.-][a-z0-9]+)*$" });
|
|
19
|
+
const Revision = Type.String({ pattern: "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" });
|
|
20
|
+
const Identifiers = () => Type.Array(Identifier, { uniqueItems: true });
|
|
21
|
+
const References = () => Type.Array(Reference, { uniqueItems: true });
|
|
22
|
+
const Evidence = () => Type.Array(Reference, { minItems: 1, uniqueItems: true });
|
|
23
|
+
const Header = {
|
|
24
|
+
profile: Type.Literal(ORGANIZATION_RELEASE_PROFILE),
|
|
25
|
+
schemaVersion: Type.Literal(1),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const CompilerContractSchema = closed({
|
|
29
|
+
profile: Type.String({ pattern: "^dsg\\.[a-z0-9.-]+/[1-9][0-9]*$" }),
|
|
30
|
+
version: Type.String({ pattern: "^(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)$" }),
|
|
31
|
+
implementation: Reference,
|
|
32
|
+
});
|
|
33
|
+
export type CompilerContract = Static<typeof CompilerContractSchema>;
|
|
34
|
+
export const DependencyKindSchema = Type.Union([
|
|
35
|
+
Type.Literal("extension-release"),
|
|
36
|
+
Type.Literal("component"),
|
|
37
|
+
Type.Literal("idl-package"),
|
|
38
|
+
Type.Literal("module-release"),
|
|
39
|
+
Type.Literal("law-release"),
|
|
40
|
+
Type.Literal("definition"),
|
|
41
|
+
Type.Literal("workload-artifact"),
|
|
42
|
+
Type.Literal("event-catalog"),
|
|
43
|
+
Type.Literal("example"),
|
|
44
|
+
Type.Literal("project"),
|
|
45
|
+
Type.Literal("target"),
|
|
46
|
+
]);
|
|
47
|
+
export type DependencyKind = Static<typeof DependencyKindSchema>;
|
|
48
|
+
export const DependencyLockEntrySchema = closed({
|
|
49
|
+
id: Identifier,
|
|
50
|
+
kind: DependencyKindSchema,
|
|
51
|
+
reference: Reference,
|
|
52
|
+
mediaType: NonEmptyString,
|
|
53
|
+
selectedMemberIds: Identifiers(),
|
|
54
|
+
dependsOn: Identifiers(),
|
|
55
|
+
});
|
|
56
|
+
export type DependencyLockEntry = Static<typeof DependencyLockEntrySchema>;
|
|
57
|
+
// Entries and their dependency IDs are sorted. The closure is exactly the graph
|
|
58
|
+
// reachable from roots; graph validation is a consumer obligation, not uniqueItems.
|
|
59
|
+
export const DependencyLockSchema = closed({
|
|
60
|
+
...Header,
|
|
61
|
+
kind: Type.Literal("dependency-lock"),
|
|
62
|
+
canonicalization: Type.Literal(ORGANIZATION_RELEASE_CANONICALIZATION),
|
|
63
|
+
roots: Identifiers(),
|
|
64
|
+
entries: Type.Array(DependencyLockEntrySchema, { uniqueItems: true }),
|
|
65
|
+
compiler: CompilerContractSchema,
|
|
66
|
+
});
|
|
67
|
+
export type DependencyLock = Static<typeof DependencyLockSchema>;
|
|
68
|
+
|
|
69
|
+
export const OrganizationReleaseMemberKindSchema = Type.Union([
|
|
70
|
+
Type.Literal("publication"),
|
|
71
|
+
Type.Literal("import"),
|
|
72
|
+
Type.Literal("capability-admission"),
|
|
73
|
+
Type.Literal("workflow-publication"),
|
|
74
|
+
Type.Literal("contract-check"),
|
|
75
|
+
Type.Literal("target-readiness"),
|
|
76
|
+
Type.Literal("setup-condition"),
|
|
77
|
+
Type.Literal("paid-execution-readiness"),
|
|
78
|
+
]);
|
|
79
|
+
export type OrganizationReleaseMemberKind = Static<typeof OrganizationReleaseMemberKindSchema>;
|
|
80
|
+
export const OrganizationReleaseMemberSchema = closed({
|
|
81
|
+
id: Identifier,
|
|
82
|
+
kind: OrganizationReleaseMemberKindSchema,
|
|
83
|
+
required: Type.Boolean(),
|
|
84
|
+
acceptableDispositions: Type.Array(NonEmptyString, { minItems: 1, uniqueItems: true }),
|
|
85
|
+
subject: Reference,
|
|
86
|
+
});
|
|
87
|
+
export type OrganizationReleaseMember = Static<typeof OrganizationReleaseMemberSchema>;
|
|
88
|
+
export const ComponentBindingSchema = closed({
|
|
89
|
+
id: Identifier,
|
|
90
|
+
kind: ExtensionComponentKindSchema,
|
|
91
|
+
reference: Reference,
|
|
92
|
+
});
|
|
93
|
+
export type ComponentBinding = Static<typeof ComponentBindingSchema>;
|
|
94
|
+
export const BuildSelectionSchema = closed({
|
|
95
|
+
id: Identifier,
|
|
96
|
+
selection: Reference,
|
|
97
|
+
extensionRelease: Reference,
|
|
98
|
+
members: Type.Array(ComponentBindingSchema, { minItems: 1, uniqueItems: true }),
|
|
99
|
+
});
|
|
100
|
+
export type BuildSelection = Static<typeof BuildSelectionSchema>;
|
|
101
|
+
export const BuildComponentSchema = closed({
|
|
102
|
+
extensionRelease: Reference,
|
|
103
|
+
memberId: Identifier,
|
|
104
|
+
kind: ExtensionComponentKindSchema,
|
|
105
|
+
reference: Reference,
|
|
106
|
+
mediaType: NonEmptyString,
|
|
107
|
+
});
|
|
108
|
+
export type BuildComponent = Static<typeof BuildComponentSchema>;
|
|
109
|
+
export const OrganizationBuildSchema = closed({
|
|
110
|
+
...Header,
|
|
111
|
+
kind: Type.Literal("organization-build"),
|
|
112
|
+
organization: NonEmptyString,
|
|
113
|
+
canonicalization: Type.Literal(ORGANIZATION_RELEASE_CANONICALIZATION),
|
|
114
|
+
source: closed({ root: Reference, revision: Revision }),
|
|
115
|
+
facts: closed({ name: NonEmptyString, purpose: NonEmptyString, space: NonEmptyString }),
|
|
116
|
+
workspaceProfile: Reference,
|
|
117
|
+
projects: Type.Array(closed({ id: Identifier, membership: Reference, revision: Revision }), {
|
|
118
|
+
uniqueItems: true,
|
|
119
|
+
}),
|
|
120
|
+
sourceDocuments: Type.Array(
|
|
121
|
+
closed({ path: NonEmptyString, sha256: Hex64, mediaType: NonEmptyString }),
|
|
122
|
+
{ minItems: 1, uniqueItems: true },
|
|
123
|
+
),
|
|
124
|
+
selections: Type.Array(BuildSelectionSchema, { uniqueItems: true }),
|
|
125
|
+
components: Type.Array(BuildComponentSchema, { uniqueItems: true }),
|
|
126
|
+
typedReleases: Type.Array(DependencyLockEntrySchema, { uniqueItems: true }),
|
|
127
|
+
dependencyLock: Reference,
|
|
128
|
+
compiler: CompilerContractSchema,
|
|
129
|
+
instructions: References(),
|
|
130
|
+
handling: References(),
|
|
131
|
+
releaseDeclarations: References(),
|
|
132
|
+
releaseMembers: Type.Array(OrganizationReleaseMemberSchema, { uniqueItems: true }),
|
|
133
|
+
});
|
|
134
|
+
export type OrganizationBuild = Static<typeof OrganizationBuildSchema>;
|
|
135
|
+
// No self-reference or status: activation and supersession are record state.
|
|
136
|
+
export const OrganizationReleaseSchema = closed({
|
|
137
|
+
...Header,
|
|
138
|
+
kind: Type.Literal("organization-release"),
|
|
139
|
+
id: Identifier,
|
|
140
|
+
organization: NonEmptyString,
|
|
141
|
+
build: Reference,
|
|
142
|
+
dependencyLock: Reference,
|
|
143
|
+
selections: Identifiers(),
|
|
144
|
+
members: Type.Array(OrganizationReleaseMemberSchema, { minItems: 1, uniqueItems: true }),
|
|
145
|
+
});
|
|
146
|
+
export type OrganizationRelease = Static<typeof OrganizationReleaseSchema>;
|
|
147
|
+
|
|
148
|
+
const ImportCommon = {
|
|
149
|
+
...Header,
|
|
150
|
+
kind: Type.Literal("import-disposition"),
|
|
151
|
+
installation: Orn,
|
|
152
|
+
build: Reference,
|
|
153
|
+
release: Reference,
|
|
154
|
+
subject: Reference,
|
|
155
|
+
observedAt: UtcSecond,
|
|
156
|
+
};
|
|
157
|
+
export const ImportDispositionSchema = Type.Union([
|
|
158
|
+
closed({ ...ImportCommon, status: Type.Literal("pending") }),
|
|
159
|
+
closed({
|
|
160
|
+
...ImportCommon,
|
|
161
|
+
status: Type.Literal("verified"),
|
|
162
|
+
disposition: Type.Union([Type.Literal("published"), Type.Literal("digest-match")]),
|
|
163
|
+
evidence: Evidence(),
|
|
164
|
+
}),
|
|
165
|
+
closed({
|
|
166
|
+
...ImportCommon,
|
|
167
|
+
status: Type.Literal("staged"),
|
|
168
|
+
disposition: Type.Literal("captured"),
|
|
169
|
+
evidence: Evidence(),
|
|
170
|
+
}),
|
|
171
|
+
closed({
|
|
172
|
+
...ImportCommon,
|
|
173
|
+
status: Type.Literal("refused"),
|
|
174
|
+
disposition: Type.Union([
|
|
175
|
+
Type.Literal("digest-mismatch"),
|
|
176
|
+
Type.Literal("missing"),
|
|
177
|
+
Type.Literal("unsupported"),
|
|
178
|
+
]),
|
|
179
|
+
reason: NonEmptyString,
|
|
180
|
+
evidence: Evidence(),
|
|
181
|
+
}),
|
|
182
|
+
]);
|
|
183
|
+
export type ImportDisposition = Static<typeof ImportDispositionSchema>;
|
|
184
|
+
export const ReleaseStatusSchema = Type.Union([
|
|
185
|
+
Type.Literal("active"),
|
|
186
|
+
Type.Literal("retired"),
|
|
187
|
+
Type.Literal("revoked"),
|
|
188
|
+
]);
|
|
189
|
+
export type ReleaseStatus = Static<typeof ReleaseStatusSchema>;
|
|
190
|
+
export const ReleaseStatusObservationSchema = closed({
|
|
191
|
+
...Header,
|
|
192
|
+
kind: Type.Literal("release-status-observation"),
|
|
193
|
+
subject: Reference,
|
|
194
|
+
registry: Reference,
|
|
195
|
+
trustView: Reference,
|
|
196
|
+
status: ReleaseStatusSchema,
|
|
197
|
+
effectiveAt: UtcSecond,
|
|
198
|
+
observedAt: UtcSecond,
|
|
199
|
+
evidence: Evidence(),
|
|
200
|
+
});
|
|
201
|
+
export type ReleaseStatusObservation = Static<typeof ReleaseStatusObservationSchema>;
|
|
202
|
+
// A status evaluation pins both the observation and the consumer's current trust
|
|
203
|
+
// input. Retirement permits existing active execution; revocation never does.
|
|
204
|
+
export const ReleaseEligibilitySchema = closed({
|
|
205
|
+
...Header,
|
|
206
|
+
kind: Type.Literal("release-eligibility"),
|
|
207
|
+
release: Reference,
|
|
208
|
+
operation: Type.Union([
|
|
209
|
+
Type.Literal("resolve"),
|
|
210
|
+
Type.Literal("select"),
|
|
211
|
+
Type.Literal("import"),
|
|
212
|
+
Type.Literal("admit"),
|
|
213
|
+
Type.Literal("activate"),
|
|
214
|
+
Type.Literal("execute"),
|
|
215
|
+
]),
|
|
216
|
+
observation: ReleaseStatusObservationSchema,
|
|
217
|
+
trustView: Reference,
|
|
218
|
+
activeSet: Type.Union([Reference, Type.Null()]),
|
|
219
|
+
});
|
|
220
|
+
export type ReleaseEligibility = Static<typeof ReleaseEligibilitySchema>;
|
|
221
|
+
export const ApprovedUseSchema = closed({ use: NonEmptyString, binding: Reference });
|
|
222
|
+
export type ApprovedUse = Static<typeof ApprovedUseSchema>;
|
|
223
|
+
const AdmissionCommon = {
|
|
224
|
+
...Header,
|
|
225
|
+
kind: Type.Literal("admission-record"),
|
|
226
|
+
id: Identifier,
|
|
227
|
+
installation: Orn,
|
|
228
|
+
organization: NonEmptyString,
|
|
229
|
+
build: Reference,
|
|
230
|
+
release: Reference,
|
|
231
|
+
selectionId: Identifier,
|
|
232
|
+
extensionRelease: Reference,
|
|
233
|
+
evaluatingCase: Reference,
|
|
234
|
+
decision: Reference,
|
|
235
|
+
authority: Reference,
|
|
236
|
+
fence: Reference,
|
|
237
|
+
revision: SafeInt,
|
|
238
|
+
decidedAt: UtcSecond,
|
|
239
|
+
};
|
|
240
|
+
export const AdmissionRecordSchema = Type.Union([
|
|
241
|
+
closed({
|
|
242
|
+
...AdmissionCommon,
|
|
243
|
+
status: Type.Literal("admitted"),
|
|
244
|
+
components: Type.Array(ComponentBindingSchema, { minItems: 1, uniqueItems: true }),
|
|
245
|
+
approvedUses: Type.Array(ApprovedUseSchema, { minItems: 1, uniqueItems: true }),
|
|
246
|
+
bindings: Evidence(),
|
|
247
|
+
evidence: Evidence(),
|
|
248
|
+
}),
|
|
249
|
+
closed({
|
|
250
|
+
...AdmissionCommon,
|
|
251
|
+
status: Type.Literal("refused"),
|
|
252
|
+
components: Type.Array(ComponentBindingSchema, { uniqueItems: true }),
|
|
253
|
+
reason: NonEmptyString,
|
|
254
|
+
evidence: Evidence(),
|
|
255
|
+
}),
|
|
256
|
+
]);
|
|
257
|
+
export type AdmissionRecord = Static<typeof AdmissionRecordSchema>;
|
|
258
|
+
const AdmissionObservationCommon = {
|
|
259
|
+
...Header,
|
|
260
|
+
kind: Type.Literal("admission-status-observation"),
|
|
261
|
+
admission: Reference,
|
|
262
|
+
decision: Reference,
|
|
263
|
+
evidence: Evidence(),
|
|
264
|
+
observedAt: UtcSecond,
|
|
265
|
+
};
|
|
266
|
+
export const AdmissionStatusObservationSchema = Type.Union([
|
|
267
|
+
closed({
|
|
268
|
+
...AdmissionObservationCommon,
|
|
269
|
+
status: Type.Literal("suspended"),
|
|
270
|
+
reason: NonEmptyString,
|
|
271
|
+
}),
|
|
272
|
+
closed({
|
|
273
|
+
...AdmissionObservationCommon,
|
|
274
|
+
status: Type.Literal("superseded"),
|
|
275
|
+
replacement: Reference,
|
|
276
|
+
}),
|
|
277
|
+
closed({
|
|
278
|
+
...AdmissionObservationCommon,
|
|
279
|
+
status: Type.Literal("revoked"),
|
|
280
|
+
governedRevocation: Reference,
|
|
281
|
+
trustView: Reference,
|
|
282
|
+
reason: NonEmptyString,
|
|
283
|
+
}),
|
|
284
|
+
]);
|
|
285
|
+
export type AdmissionStatusObservation = Static<typeof AdmissionStatusObservationSchema>;
|
|
286
|
+
const MemberObservationCommon = {
|
|
287
|
+
...Header,
|
|
288
|
+
kind: Type.Literal("member-observation"),
|
|
289
|
+
installation: Orn,
|
|
290
|
+
build: Reference,
|
|
291
|
+
release: Reference,
|
|
292
|
+
memberId: Identifier,
|
|
293
|
+
memberKind: OrganizationReleaseMemberKindSchema,
|
|
294
|
+
subject: Reference,
|
|
295
|
+
evidence: Evidence(),
|
|
296
|
+
observedAt: UtcSecond,
|
|
297
|
+
};
|
|
298
|
+
export const MemberObservationSchema = Type.Union([
|
|
299
|
+
closed({
|
|
300
|
+
...MemberObservationCommon,
|
|
301
|
+
disposition: Type.Union([Type.Literal("ready"), Type.Literal("verified")]),
|
|
302
|
+
}),
|
|
303
|
+
closed({
|
|
304
|
+
...MemberObservationCommon,
|
|
305
|
+
disposition: Type.Union([
|
|
306
|
+
Type.Literal("refused"),
|
|
307
|
+
Type.Literal("suspended"),
|
|
308
|
+
Type.Literal("revoked"),
|
|
309
|
+
]),
|
|
310
|
+
reason: NonEmptyString,
|
|
311
|
+
}),
|
|
312
|
+
]);
|
|
313
|
+
export type MemberObservation = Static<typeof MemberObservationSchema>;
|
|
314
|
+
export const ActiveMemberSchema = closed({
|
|
315
|
+
selectionId: Identifier,
|
|
316
|
+
memberId: Identifier,
|
|
317
|
+
extensionRelease: Reference,
|
|
318
|
+
components: Type.Array(ComponentBindingSchema, { minItems: 1, uniqueItems: true }),
|
|
319
|
+
admission: Reference,
|
|
320
|
+
});
|
|
321
|
+
export type ActiveMember = Static<typeof ActiveMemberSchema>;
|
|
322
|
+
export const ActiveSetSchema = closed({
|
|
323
|
+
...Header,
|
|
324
|
+
kind: Type.Literal("active-set"),
|
|
325
|
+
installation: Orn,
|
|
326
|
+
organization: NonEmptyString,
|
|
327
|
+
release: Reference,
|
|
328
|
+
build: Reference,
|
|
329
|
+
predecessor: Type.Union([Reference, Type.Null()]),
|
|
330
|
+
members: Type.Array(ActiveMemberSchema, { uniqueItems: true }),
|
|
331
|
+
memberObservations: Evidence(),
|
|
332
|
+
policies: References(),
|
|
333
|
+
configuration: References(),
|
|
334
|
+
activatingCase: Reference,
|
|
335
|
+
authority: Reference,
|
|
336
|
+
activatingDecision: Reference,
|
|
337
|
+
fence: Reference,
|
|
338
|
+
revision: SafeInt,
|
|
339
|
+
activatedAt: UtcSecond,
|
|
340
|
+
});
|
|
341
|
+
export type ActiveSet = Static<typeof ActiveSetSchema>;
|
|
342
|
+
const CatalogEntryCommon = {
|
|
343
|
+
id: Identifier,
|
|
344
|
+
activeSet: Reference,
|
|
345
|
+
selectionId: Identifier,
|
|
346
|
+
memberId: Identifier,
|
|
347
|
+
extensionRelease: Reference,
|
|
348
|
+
workflow: Reference,
|
|
349
|
+
example: Type.Union([Reference, Type.Null()]),
|
|
350
|
+
jobClass: Type.Union([Reference, Type.Null()]),
|
|
351
|
+
workloadArtifact: Type.Union([Reference, Type.Null()]),
|
|
352
|
+
contracts: References(),
|
|
353
|
+
availabilityEvidence: Evidence(),
|
|
354
|
+
};
|
|
355
|
+
export const CatalogEntrySchema = Type.Union([
|
|
356
|
+
closed({ ...CatalogEntryCommon, availability: Type.Literal("available") }),
|
|
357
|
+
closed({
|
|
358
|
+
...CatalogEntryCommon,
|
|
359
|
+
availability: Type.Literal("unavailable"),
|
|
360
|
+
unavailableReason: NonEmptyString,
|
|
361
|
+
}),
|
|
362
|
+
]);
|
|
363
|
+
export type CatalogEntry = Static<typeof CatalogEntrySchema>;
|
|
364
|
+
export const CatalogSchema = closed({
|
|
365
|
+
...Header,
|
|
366
|
+
kind: Type.Literal("catalog"),
|
|
367
|
+
activeSet: Reference,
|
|
368
|
+
entries: Type.Array(CatalogEntrySchema, { uniqueItems: true }),
|
|
369
|
+
});
|
|
370
|
+
export type Catalog = Static<typeof CatalogSchema>;
|
|
371
|
+
export const BoundAttestationSchema = closed({
|
|
372
|
+
...Header,
|
|
373
|
+
kind: Type.Literal("bound-attestation"),
|
|
374
|
+
subject: Reference,
|
|
375
|
+
issuer: Orn,
|
|
376
|
+
evidence: Reference,
|
|
377
|
+
verification: Type.Union([
|
|
378
|
+
Type.Literal("publisher-signature"),
|
|
379
|
+
Type.Literal("registry-recognition"),
|
|
380
|
+
Type.Literal("source-provenance"),
|
|
381
|
+
Type.Literal("component-digest"),
|
|
382
|
+
]),
|
|
383
|
+
observedAt: UtcSecond,
|
|
384
|
+
signature: NonEmptyString,
|
|
385
|
+
});
|
|
386
|
+
export type BoundAttestation = Static<typeof BoundAttestationSchema>;
|
|
387
|
+
export const organizationReleaseV1: ProfileEntry = {
|
|
388
|
+
literal: ORGANIZATION_RELEASE_PROFILE,
|
|
389
|
+
documents: {
|
|
390
|
+
dependencyLock: DependencyLockSchema,
|
|
391
|
+
organizationBuild: OrganizationBuildSchema,
|
|
392
|
+
importDisposition: ImportDispositionSchema,
|
|
393
|
+
releaseStatusObservation: ReleaseStatusObservationSchema,
|
|
394
|
+
releaseEligibility: ReleaseEligibilitySchema,
|
|
395
|
+
organizationRelease: OrganizationReleaseSchema,
|
|
396
|
+
admissionRecord: AdmissionRecordSchema,
|
|
397
|
+
admissionStatusObservation: AdmissionStatusObservationSchema,
|
|
398
|
+
memberObservation: MemberObservationSchema,
|
|
399
|
+
activeSet: ActiveSetSchema,
|
|
400
|
+
catalog: CatalogSchema,
|
|
401
|
+
boundAttestation: BoundAttestationSchema,
|
|
402
|
+
},
|
|
403
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// dsg.organization.source/2
|
|
2
|
+
// Closed authoring contracts for an organization source tree. These declarations
|
|
3
|
+
// describe reviewed inputs only: they contain no live principals, grants,
|
|
4
|
+
// admissions, activation state, or deployment authority.
|
|
5
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
6
|
+
import { closed, NonEmptyString, SafeInt, type ProfileEntry } from "../primitives.js";
|
|
7
|
+
|
|
8
|
+
export const ORGANIZATION_SOURCE_PROFILE = "dsg.organization.source/2" as const;
|
|
9
|
+
|
|
10
|
+
export const OrganizationSpaceSchema = Type.String({
|
|
11
|
+
pattern: "^[a-z][a-z0-9-]*(?:\\.[a-z][a-z0-9-]*)+$",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/** A path interpreted relative to the organization source root. Filesystem
|
|
15
|
+
* containment and symlink checks belong to the consumer that opens it. */
|
|
16
|
+
export const OrganizationDocumentPathSchema = Type.String({
|
|
17
|
+
minLength: 1,
|
|
18
|
+
pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*//)(?!.*\\\\).+$",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const OrganizationSourceLocationSchema = closed({
|
|
22
|
+
repository: NonEmptyString,
|
|
23
|
+
ref: NonEmptyString,
|
|
24
|
+
subdirectory: OrganizationDocumentPathSchema,
|
|
25
|
+
});
|
|
26
|
+
export type OrganizationSourceLocation = Static<typeof OrganizationSourceLocationSchema>;
|
|
27
|
+
const OrganizationSourceLocationV1Schema = closed({
|
|
28
|
+
repository: Type.String(),
|
|
29
|
+
ref: Type.String(),
|
|
30
|
+
subdirectory: Type.String(),
|
|
31
|
+
});
|
|
32
|
+
export type OrganizationSourceLocationV1 = Static<typeof OrganizationSourceLocationV1Schema>;
|
|
33
|
+
|
|
34
|
+
export const ProjectSourceSchema = closed({
|
|
35
|
+
repository: NonEmptyString,
|
|
36
|
+
revision: Type.String({ pattern: "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" }),
|
|
37
|
+
});
|
|
38
|
+
export type ProjectSource = Static<typeof ProjectSourceSchema>;
|
|
39
|
+
|
|
40
|
+
const UniquePaths = () => Type.Array(OrganizationDocumentPathSchema, { uniqueItems: true });
|
|
41
|
+
const UniqueNames = () => Type.Array(NonEmptyString, { uniqueItems: true });
|
|
42
|
+
|
|
43
|
+
/** Frozen compatibility shape. Version one is loaded only through the explicit
|
|
44
|
+
* compatibility path; it is never silently reinterpreted as version two. */
|
|
45
|
+
export const OrganizationRootV1Schema = closed({
|
|
46
|
+
schemaVersion: Type.Literal(1),
|
|
47
|
+
kind: Type.Literal("organization"),
|
|
48
|
+
org: NonEmptyString,
|
|
49
|
+
space: OrganizationSpaceSchema,
|
|
50
|
+
identity: closed({
|
|
51
|
+
principals: NonEmptyString,
|
|
52
|
+
qualifications: NonEmptyString,
|
|
53
|
+
designations: NonEmptyString,
|
|
54
|
+
}),
|
|
55
|
+
policies: NonEmptyString,
|
|
56
|
+
vocabulary: NonEmptyString,
|
|
57
|
+
admissions: NonEmptyString,
|
|
58
|
+
deployment: NonEmptyString,
|
|
59
|
+
source: Type.Optional(OrganizationSourceLocationV1Schema),
|
|
60
|
+
});
|
|
61
|
+
export type OrganizationRootV1 = Static<typeof OrganizationRootV1Schema>;
|
|
62
|
+
|
|
63
|
+
export const OrganizationInstructionSchema = closed({
|
|
64
|
+
layer: Type.Union([
|
|
65
|
+
Type.Literal("constitution"),
|
|
66
|
+
Type.Literal("profile"),
|
|
67
|
+
Type.Literal("project"),
|
|
68
|
+
]),
|
|
69
|
+
source: OrganizationDocumentPathSchema,
|
|
70
|
+
provenance: OrganizationDocumentPathSchema,
|
|
71
|
+
});
|
|
72
|
+
export type OrganizationInstruction = Static<typeof OrganizationInstructionSchema>;
|
|
73
|
+
|
|
74
|
+
/** The generic root requires only stable identity, accountability, purpose and
|
|
75
|
+
* a selected profile. Optional declaration groups become required only when
|
|
76
|
+
* that profile says so. */
|
|
77
|
+
export const OrganizationRootSchema = closed({
|
|
78
|
+
schemaVersion: Type.Literal(2),
|
|
79
|
+
kind: Type.Literal("organization"),
|
|
80
|
+
org: NonEmptyString,
|
|
81
|
+
space: OrganizationSpaceSchema,
|
|
82
|
+
owner: closed({
|
|
83
|
+
responsibility: NonEmptyString,
|
|
84
|
+
qualification: Type.Optional(OrganizationDocumentPathSchema),
|
|
85
|
+
designation: Type.Optional(OrganizationDocumentPathSchema),
|
|
86
|
+
}),
|
|
87
|
+
purpose: NonEmptyString,
|
|
88
|
+
profile: closed({
|
|
89
|
+
document: OrganizationDocumentPathSchema,
|
|
90
|
+
facts: Type.Record(
|
|
91
|
+
Type.String({ pattern: "^[a-z][a-z0-9-]*$" }),
|
|
92
|
+
OrganizationDocumentPathSchema,
|
|
93
|
+
{ additionalProperties: false },
|
|
94
|
+
),
|
|
95
|
+
}),
|
|
96
|
+
identity: Type.Optional(
|
|
97
|
+
closed({
|
|
98
|
+
principals: Type.Optional(OrganizationDocumentPathSchema),
|
|
99
|
+
qualifications: Type.Optional(OrganizationDocumentPathSchema),
|
|
100
|
+
designations: Type.Optional(OrganizationDocumentPathSchema),
|
|
101
|
+
eligibility: Type.Optional(OrganizationDocumentPathSchema),
|
|
102
|
+
}),
|
|
103
|
+
),
|
|
104
|
+
policies: Type.Optional(
|
|
105
|
+
closed({
|
|
106
|
+
sources: Type.Array(OrganizationDocumentPathSchema, { minItems: 1, uniqueItems: true }),
|
|
107
|
+
release: Type.Optional(OrganizationDocumentPathSchema),
|
|
108
|
+
}),
|
|
109
|
+
),
|
|
110
|
+
vocabulary: Type.Optional(OrganizationDocumentPathSchema),
|
|
111
|
+
admissions: Type.Optional(OrganizationDocumentPathSchema),
|
|
112
|
+
projects: Type.Optional(UniquePaths()),
|
|
113
|
+
capabilities: Type.Optional(UniquePaths()),
|
|
114
|
+
instructions: Type.Optional(Type.Array(OrganizationInstructionSchema)),
|
|
115
|
+
documents: Type.Optional(UniquePaths()),
|
|
116
|
+
archive: Type.Optional(OrganizationDocumentPathSchema),
|
|
117
|
+
releases: Type.Optional(UniquePaths()),
|
|
118
|
+
deployment: Type.Optional(OrganizationDocumentPathSchema),
|
|
119
|
+
source: Type.Optional(OrganizationSourceLocationSchema),
|
|
120
|
+
});
|
|
121
|
+
export type OrganizationRoot = Static<typeof OrganizationRootSchema>;
|
|
122
|
+
|
|
123
|
+
export const WorkspaceProfileSchema = closed({
|
|
124
|
+
schemaVersion: Type.Literal(1),
|
|
125
|
+
kind: Type.Literal("workspace-profile"),
|
|
126
|
+
id: NonEmptyString,
|
|
127
|
+
profile: Type.Literal(ORGANIZATION_SOURCE_PROFILE),
|
|
128
|
+
version: Type.String({ pattern: "^[1-9][0-9]*\\.[0-9]+\\.[0-9]+$" }),
|
|
129
|
+
requirements: closed({
|
|
130
|
+
facts: UniqueNames(),
|
|
131
|
+
minimumProjects: SafeInt,
|
|
132
|
+
requiredCapabilities: UniqueNames(),
|
|
133
|
+
instructions: Type.Boolean(),
|
|
134
|
+
}),
|
|
135
|
+
allowedCapabilityOrigins: Type.Array(
|
|
136
|
+
Type.Union([Type.Literal("workspace"), Type.Literal("official"), Type.Literal("curated")]),
|
|
137
|
+
{ uniqueItems: true },
|
|
138
|
+
),
|
|
139
|
+
handling: closed({ required: Type.Boolean() }),
|
|
140
|
+
readinessChecks: UniquePaths(),
|
|
141
|
+
});
|
|
142
|
+
export type WorkspaceProfile = Static<typeof WorkspaceProfileSchema>;
|
|
143
|
+
|
|
144
|
+
export const ProjectMembershipSchema = closed({
|
|
145
|
+
schemaVersion: Type.Literal(1),
|
|
146
|
+
kind: Type.Literal("project-membership"),
|
|
147
|
+
id: NonEmptyString,
|
|
148
|
+
mode: Type.Union([Type.Literal("managed"), Type.Literal("independent")]),
|
|
149
|
+
source: ProjectSourceSchema,
|
|
150
|
+
role: NonEmptyString,
|
|
151
|
+
contract: OrganizationDocumentPathSchema,
|
|
152
|
+
handling: OrganizationDocumentPathSchema,
|
|
153
|
+
state: Type.Union([Type.Literal("active"), Type.Literal("suspended"), Type.Literal("removed")]),
|
|
154
|
+
});
|
|
155
|
+
export type ProjectMembership = Static<typeof ProjectMembershipSchema>;
|
|
156
|
+
|
|
157
|
+
export const CapabilityOriginSchema = Type.Union([
|
|
158
|
+
Type.Literal("workspace"),
|
|
159
|
+
Type.Literal("official"),
|
|
160
|
+
Type.Literal("curated"),
|
|
161
|
+
]);
|
|
162
|
+
export type CapabilityOrigin = Static<typeof CapabilityOriginSchema>;
|
|
163
|
+
|
|
164
|
+
/** `declaration` and component `reference` point to their owning existing
|
|
165
|
+
* capability/Definition formats; this schema does not duplicate them. */
|
|
166
|
+
export const CapabilitySelectionSchema = closed({
|
|
167
|
+
schemaVersion: Type.Literal(1),
|
|
168
|
+
kind: Type.Literal("capability-selection"),
|
|
169
|
+
id: NonEmptyString,
|
|
170
|
+
declaration: OrganizationDocumentPathSchema,
|
|
171
|
+
components: Type.Array(
|
|
172
|
+
closed({ id: NonEmptyString, reference: OrganizationDocumentPathSchema }),
|
|
173
|
+
{ uniqueItems: true },
|
|
174
|
+
),
|
|
175
|
+
origin: CapabilityOriginSchema,
|
|
176
|
+
dependencyLock: OrganizationDocumentPathSchema,
|
|
177
|
+
requiredDispositions: UniqueNames(),
|
|
178
|
+
});
|
|
179
|
+
export type CapabilitySelection = Static<typeof CapabilitySelectionSchema>;
|
|
180
|
+
|
|
181
|
+
export const ReleaseMemberKindSchema = Type.Union([
|
|
182
|
+
Type.Literal("policy"),
|
|
183
|
+
Type.Literal("capability-admission"),
|
|
184
|
+
Type.Literal("workflow-publication"),
|
|
185
|
+
Type.Literal("contract-check"),
|
|
186
|
+
Type.Literal("target-readiness"),
|
|
187
|
+
Type.Literal("setup-condition"),
|
|
188
|
+
]);
|
|
189
|
+
export type ReleaseMemberKind = Static<typeof ReleaseMemberKindSchema>;
|
|
190
|
+
|
|
191
|
+
export const ReleaseDeclarationSchema = closed({
|
|
192
|
+
schemaVersion: Type.Literal(1),
|
|
193
|
+
kind: Type.Literal("release-declaration"),
|
|
194
|
+
name: NonEmptyString,
|
|
195
|
+
selection: closed({ projects: UniqueNames(), capabilities: UniqueNames() }),
|
|
196
|
+
members: Type.Array(
|
|
197
|
+
closed({
|
|
198
|
+
key: NonEmptyString,
|
|
199
|
+
artifact: OrganizationDocumentPathSchema,
|
|
200
|
+
kind: ReleaseMemberKindSchema,
|
|
201
|
+
required: Type.Boolean(),
|
|
202
|
+
acceptableDispositions: Type.Array(NonEmptyString, { minItems: 1, uniqueItems: true }),
|
|
203
|
+
}),
|
|
204
|
+
),
|
|
205
|
+
predecessors: UniqueNames(),
|
|
206
|
+
});
|
|
207
|
+
export type ReleaseDeclaration = Static<typeof ReleaseDeclarationSchema>;
|
|
208
|
+
|
|
209
|
+
export const organizationSourceV2: ProfileEntry = {
|
|
210
|
+
literal: ORGANIZATION_SOURCE_PROFILE,
|
|
211
|
+
rootDocument: "organization",
|
|
212
|
+
documents: {
|
|
213
|
+
organization: OrganizationRootSchema,
|
|
214
|
+
workspaceProfile: WorkspaceProfileSchema,
|
|
215
|
+
projectMembership: ProjectMembershipSchema,
|
|
216
|
+
capabilitySelection: CapabilitySelectionSchema,
|
|
217
|
+
releaseDeclaration: ReleaseDeclarationSchema,
|
|
218
|
+
},
|
|
219
|
+
};
|