@dynamicalsystems/idl 0.10.0 → 0.12.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 +295 -30
- package/dist/index.d.cts +249 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +249 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +276 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
- package/schema/dsg-core-google-identity-v1.json +39 -0
- package/schema/dsg-core-refusal-v3.json +103 -0
- package/schema/dsg-organization-source-v2.json +623 -0
- package/src/core/google-identity.v1.ts +42 -0
- package/src/core/identity-binding.v1.ts +2 -2
- package/src/core/refusal.v1.ts +2 -2
- package/src/core/refusal.v2.ts +2 -2
- package/src/core/refusal.v3.ts +50 -0
- package/src/index.ts +50 -6
- package/src/infra/adoption-fact.v1.ts +2 -2
- package/src/infra/resource-descriptor.v1.ts +2 -2
- package/src/infra/signed-law.v1.ts +1 -1
- package/src/kernel/bootstrap.v1.ts +1 -1
- package/src/kernel/dispatch-consume.v1.ts +1 -1
- package/src/kernel/ordinary-authority.v1.ts +2 -2
- package/src/kernel/standing-order-activation.v1.ts +2 -2
- package/src/organization/source.v2.ts +219 -0
- package/src/primitives.ts +2 -2
- package/src/registry/revocations.v1.ts +1 -1
- package/src/run/decision.v1.ts +2 -2
- package/src/run/event.v1.ts +2 -2
- package/src/run/operation.v1.ts +1 -1
- package/src/run/request.v1.ts +2 -2
- package/src/run/run-summary.v1.ts +2 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Normalized organization refusal. HTTP adapters preserve code as their
|
|
2
|
+
// reason field; their transport envelopes are documented separately.
|
|
3
|
+
// Dependency outages are not verdicts about a person.
|
|
4
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
5
|
+
import { closed, NonEmptyString, type ProfileEntry } from "../primitives.js";
|
|
6
|
+
|
|
7
|
+
export const REFUSAL_V3_PROFILE = "dsg.core.refusal/3" as const;
|
|
8
|
+
|
|
9
|
+
const RefusalCodeV3SchemaValue = Type.Union([
|
|
10
|
+
Type.Literal("organization_absent"),
|
|
11
|
+
Type.Literal("organization_exists"),
|
|
12
|
+
Type.Literal("domain_mismatch"),
|
|
13
|
+
Type.Literal("suspended"),
|
|
14
|
+
Type.Literal("organization_disabled"),
|
|
15
|
+
Type.Literal("claims_missing"),
|
|
16
|
+
Type.Literal("not_qualified"),
|
|
17
|
+
Type.Literal("subject_conflict"),
|
|
18
|
+
]);
|
|
19
|
+
export const RefusalCodeV3Schema: typeof RefusalCodeV3SchemaValue = RefusalCodeV3SchemaValue;
|
|
20
|
+
export type RefusalCodeV3 = Static<typeof RefusalCodeV3Schema>;
|
|
21
|
+
|
|
22
|
+
const RefusalStageV3SchemaValue = Type.Union([
|
|
23
|
+
Type.Literal("proxy"),
|
|
24
|
+
Type.Literal("provider"),
|
|
25
|
+
Type.Literal("identity_read"),
|
|
26
|
+
Type.Literal("plane"),
|
|
27
|
+
Type.Literal("console"),
|
|
28
|
+
Type.Literal("kernel"),
|
|
29
|
+
Type.Literal("record"),
|
|
30
|
+
Type.Literal("claim"),
|
|
31
|
+
]);
|
|
32
|
+
export const RefusalStageV3Schema: typeof RefusalStageV3SchemaValue = RefusalStageV3SchemaValue;
|
|
33
|
+
export type RefusalStageV3 = Static<typeof RefusalStageV3Schema>;
|
|
34
|
+
|
|
35
|
+
const RefusalV3SchemaValue = closed({
|
|
36
|
+
profile: Type.Literal(REFUSAL_V3_PROFILE),
|
|
37
|
+
code: RefusalCodeV3Schema,
|
|
38
|
+
sentence: NonEmptyString,
|
|
39
|
+
stage: Type.Optional(RefusalStageV3Schema),
|
|
40
|
+
correlationId: Type.Optional(NonEmptyString),
|
|
41
|
+
detail: Type.Optional(NonEmptyString),
|
|
42
|
+
});
|
|
43
|
+
export const RefusalV3Schema: typeof RefusalV3SchemaValue = RefusalV3SchemaValue;
|
|
44
|
+
export type RefusalV3 = Static<typeof RefusalV3Schema>;
|
|
45
|
+
|
|
46
|
+
export const refusalV3: ProfileEntry = {
|
|
47
|
+
literal: REFUSAL_V3_PROFILE,
|
|
48
|
+
rootDocument: "refusal",
|
|
49
|
+
documents: { refusal: RefusalV3Schema },
|
|
50
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -139,11 +139,50 @@ export {
|
|
|
139
139
|
} from "./core/refusal.v2.js";
|
|
140
140
|
export type { RefusalCodeV2, RefusalStageV2, RefusalV2 } from "./core/refusal.v2.js";
|
|
141
141
|
export {
|
|
142
|
+
GOOGLE_IDENTITY_PROFILE,
|
|
142
143
|
GOOGLE_SIGN_IN_ISSUER,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
} from "./core/identity
|
|
144
|
+
GoogleIdentitySchema,
|
|
145
|
+
} from "./core/google-identity.v1.js";
|
|
146
|
+
export type { GoogleIdentity } from "./core/google-identity.v1.js";
|
|
147
|
+
export {
|
|
148
|
+
REFUSAL_V3_PROFILE,
|
|
149
|
+
RefusalCodeV3Schema,
|
|
150
|
+
RefusalStageV3Schema,
|
|
151
|
+
RefusalV3Schema,
|
|
152
|
+
} from "./core/refusal.v3.js";
|
|
153
|
+
export type { RefusalCodeV3, RefusalStageV3, RefusalV3 } from "./core/refusal.v3.js";
|
|
154
|
+
export { IDENTITY_BINDING_PROFILE, IdentityBindingSchema } from "./core/identity-binding.v1.js";
|
|
146
155
|
export type { IdentityBinding } from "./core/identity-binding.v1.js";
|
|
156
|
+
export {
|
|
157
|
+
ORGANIZATION_SOURCE_PROFILE,
|
|
158
|
+
CapabilityOriginSchema,
|
|
159
|
+
CapabilitySelectionSchema,
|
|
160
|
+
OrganizationDocumentPathSchema,
|
|
161
|
+
OrganizationInstructionSchema,
|
|
162
|
+
OrganizationRootSchema,
|
|
163
|
+
OrganizationRootV1Schema,
|
|
164
|
+
OrganizationSourceLocationSchema,
|
|
165
|
+
OrganizationSpaceSchema,
|
|
166
|
+
ProjectMembershipSchema,
|
|
167
|
+
ProjectSourceSchema,
|
|
168
|
+
ReleaseDeclarationSchema,
|
|
169
|
+
ReleaseMemberKindSchema,
|
|
170
|
+
WorkspaceProfileSchema,
|
|
171
|
+
} from "./organization/source.v2.js";
|
|
172
|
+
export type {
|
|
173
|
+
CapabilityOrigin,
|
|
174
|
+
CapabilitySelection,
|
|
175
|
+
OrganizationInstruction,
|
|
176
|
+
OrganizationRoot,
|
|
177
|
+
OrganizationRootV1,
|
|
178
|
+
OrganizationSourceLocation,
|
|
179
|
+
OrganizationSourceLocationV1,
|
|
180
|
+
ProjectMembership,
|
|
181
|
+
ProjectSource,
|
|
182
|
+
ReleaseDeclaration,
|
|
183
|
+
ReleaseMemberKind,
|
|
184
|
+
WorkspaceProfile,
|
|
185
|
+
} from "./organization/source.v2.js";
|
|
147
186
|
|
|
148
187
|
import type { ProfileEntry } from "./primitives.js";
|
|
149
188
|
import { dispatchConsumeV1 } from "./kernel/dispatch-consume.v1.js";
|
|
@@ -154,6 +193,8 @@ import { decisionV1 } from "./run/decision.v1.js";
|
|
|
154
193
|
import { runSummaryV1 } from "./run/run-summary.v1.js";
|
|
155
194
|
import { refusalV1 } from "./core/refusal.v1.js";
|
|
156
195
|
import { refusalV2 } from "./core/refusal.v2.js";
|
|
196
|
+
import { refusalV3 } from "./core/refusal.v3.js";
|
|
197
|
+
import { googleIdentityV1 } from "./core/google-identity.v1.js";
|
|
157
198
|
import { identityBindingV1 } from "./core/identity-binding.v1.js";
|
|
158
199
|
import { signedLawV1 } from "./infra/signed-law.v1.js";
|
|
159
200
|
import { resourceDescriptorV1 } from "./infra/resource-descriptor.v1.js";
|
|
@@ -162,12 +203,12 @@ import { revocationsV1 } from "./registry/revocations.v1.js";
|
|
|
162
203
|
import { bootstrapV1 } from "./kernel/bootstrap.v1.js";
|
|
163
204
|
import { ordinaryAuthorityV1 } from "./kernel/ordinary-authority.v1.js";
|
|
164
205
|
import { standingOrderActivationV1 } from "./kernel/standing-order-activation.v1.js";
|
|
165
|
-
|
|
206
|
+
import { organizationSourceV2 } from "./organization/source.v2.js";
|
|
166
207
|
/** Every profile this version of the package defines, keyed by literal.
|
|
167
208
|
* Profile modules are added here as they are extracted; the rules test
|
|
168
209
|
* and the schema emitter walk this registry, so a module that is not
|
|
169
210
|
* registered does not exist. */
|
|
170
|
-
export const PROFILES
|
|
211
|
+
export const PROFILES = {
|
|
171
212
|
[dispatchConsumeV1.literal]: dispatchConsumeV1,
|
|
172
213
|
[operationV1.literal]: operationV1,
|
|
173
214
|
[eventV1.literal]: eventV1,
|
|
@@ -176,6 +217,8 @@ export const PROFILES: Readonly<Record<string, ProfileEntry>> = {
|
|
|
176
217
|
[runSummaryV1.literal]: runSummaryV1,
|
|
177
218
|
[refusalV1.literal]: refusalV1,
|
|
178
219
|
[refusalV2.literal]: refusalV2,
|
|
220
|
+
[refusalV3.literal]: refusalV3,
|
|
221
|
+
[googleIdentityV1.literal]: googleIdentityV1,
|
|
179
222
|
[identityBindingV1.literal]: identityBindingV1,
|
|
180
223
|
[signedLawV1.literal]: signedLawV1,
|
|
181
224
|
[resourceDescriptorV1.literal]: resourceDescriptorV1,
|
|
@@ -184,4 +227,5 @@ export const PROFILES: Readonly<Record<string, ProfileEntry>> = {
|
|
|
184
227
|
[bootstrapV1.literal]: bootstrapV1,
|
|
185
228
|
[ordinaryAuthorityV1.literal]: ordinaryAuthorityV1,
|
|
186
229
|
[standingOrderActivationV1.literal]: standingOrderActivationV1,
|
|
187
|
-
|
|
230
|
+
[organizationSourceV2.literal]: organizationSourceV2,
|
|
231
|
+
} satisfies Readonly<Record<string, ProfileEntry>>;
|
|
@@ -42,6 +42,6 @@ export type AdoptionFact = Static<typeof AdoptionFactSchema>;
|
|
|
42
42
|
|
|
43
43
|
export const adoptionFactV1: ProfileEntry = {
|
|
44
44
|
literal: ADOPTION_FACT_PROFILE,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
rootDocument: "fact",
|
|
46
|
+
documents: { fact: AdoptionFactSchema },
|
|
47
47
|
};
|
|
@@ -53,6 +53,6 @@ export const resourceDescriptorV1: ProfileEntry = {
|
|
|
53
53
|
literal: RESOURCE_DESCRIPTOR_PROFILE,
|
|
54
54
|
literalNote:
|
|
55
55
|
"carried as kind (unversioned) plus schemaVersion on the document; the /1 literal is the version marker signed-law pins",
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
rootDocument: "descriptor",
|
|
57
|
+
documents: { descriptor: ResourceDescriptorSchema },
|
|
58
58
|
};
|
|
@@ -273,5 +273,5 @@ export const signedLawV1: ProfileEntry = {
|
|
|
273
273
|
literal: SIGNED_LAW_PROFILE,
|
|
274
274
|
literalNote:
|
|
275
275
|
"carried as the domain member of the canonical signature input, not as a bundle field",
|
|
276
|
-
|
|
276
|
+
documents: { bundle: SignedLawBundleSchema },
|
|
277
277
|
};
|
|
@@ -64,5 +64,5 @@ export type SignedBootstrapIntent = Static<typeof SignedBootstrapIntentSchema>;
|
|
|
64
64
|
|
|
65
65
|
export const bootstrapV1: ProfileEntry = {
|
|
66
66
|
literal: BOOTSTRAP_PROFILE,
|
|
67
|
-
|
|
67
|
+
documents: { intent: BootstrapIntentSchema, signed: SignedBootstrapIntentSchema },
|
|
68
68
|
};
|
|
@@ -106,7 +106,7 @@ export type DispatchRefusal = Static<typeof DispatchRefusalSchema>;
|
|
|
106
106
|
|
|
107
107
|
export const dispatchConsumeV1: ProfileEntry = {
|
|
108
108
|
literal: DISPATCH_CONSUME_PROFILE,
|
|
109
|
-
|
|
109
|
+
documents: {
|
|
110
110
|
request: DispatchConsumeRequestSchema,
|
|
111
111
|
lease: DispatchLeaseSchema,
|
|
112
112
|
refusal: DispatchRefusalSchema,
|
|
@@ -48,6 +48,6 @@ export type OrdinaryAuthority = Static<typeof OrdinaryAuthoritySchema>;
|
|
|
48
48
|
|
|
49
49
|
export const ordinaryAuthorityV1: ProfileEntry = {
|
|
50
50
|
literal: ORDINARY_AUTHORITY_PROFILE,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
rootDocument: "authority",
|
|
52
|
+
documents: { authority: OrdinaryAuthoritySchema },
|
|
53
53
|
};
|
|
@@ -63,8 +63,8 @@ export type SignedStandingOrderActivation = Static<typeof SignedStandingOrderAct
|
|
|
63
63
|
|
|
64
64
|
export const standingOrderActivationV1: ProfileEntry = {
|
|
65
65
|
literal: STANDING_ORDER_ACTIVATION_PROFILE,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
rootDocument: "event",
|
|
67
|
+
documents: {
|
|
68
68
|
activation: StandingOrderActivationSchema,
|
|
69
69
|
signed: SignedStandingOrderActivationSchema,
|
|
70
70
|
event: StandingOrderActivationEventSchema,
|
|
@@ -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
|
+
};
|
package/src/primitives.ts
CHANGED
|
@@ -46,12 +46,12 @@ export const PersonReference = closed({
|
|
|
46
46
|
* "lease", "refusal"); vectors address a shape as "<literal>#<shape>". */
|
|
47
47
|
export type ProfileEntry = {
|
|
48
48
|
readonly literal: `dsg.${string}.${string}/${number}`;
|
|
49
|
-
readonly
|
|
49
|
+
readonly documents: Readonly<Record<string, TSchema>>;
|
|
50
50
|
/** Set ONLY when the wire cannot carry the literal as a field of any
|
|
51
51
|
* shape (a frozen /1); names exactly where the literal lives instead. */
|
|
52
52
|
readonly literalNote?: string;
|
|
53
53
|
/** Names the shape non-TS consumers validate a whole document against;
|
|
54
54
|
* the emitted JSON Schema gains a root $ref to it. Only meaningful for
|
|
55
55
|
* profiles with a single document root. */
|
|
56
|
-
readonly
|
|
56
|
+
readonly rootDocument?: string;
|
|
57
57
|
};
|
|
@@ -83,5 +83,5 @@ export type RevocationPointer = Static<typeof RevocationPointerSchema>;
|
|
|
83
83
|
|
|
84
84
|
export const revocationsV1: ProfileEntry = {
|
|
85
85
|
literal: REVOCATIONS_PROFILE,
|
|
86
|
-
|
|
86
|
+
documents: { snapshot: RevocationSchema, pointer: RevocationPointerSchema },
|
|
87
87
|
};
|
package/src/run/decision.v1.ts
CHANGED
|
@@ -22,6 +22,6 @@ export type RunDecision = Static<typeof RunDecisionSchema>;
|
|
|
22
22
|
|
|
23
23
|
export const decisionV1: ProfileEntry = {
|
|
24
24
|
literal: DECISION_PROFILE,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
rootDocument: "decision",
|
|
26
|
+
documents: { decision: RunDecisionSchema },
|
|
27
27
|
};
|
package/src/run/event.v1.ts
CHANGED
|
@@ -90,6 +90,6 @@ export type EventStreamSeal = Static<typeof EventStreamSealSchema>;
|
|
|
90
90
|
|
|
91
91
|
export const eventV1: ProfileEntry = {
|
|
92
92
|
literal: EVENT_PROFILE,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
rootDocument: "event",
|
|
94
|
+
documents: { event: EventSchema, streamSeal: EventStreamSealSchema },
|
|
95
95
|
};
|
package/src/run/operation.v1.ts
CHANGED
package/src/run/request.v1.ts
CHANGED
|
@@ -45,6 +45,6 @@ export type RunRequest = Static<typeof RunRequestSchema>;
|
|
|
45
45
|
|
|
46
46
|
export const requestV1: ProfileEntry = {
|
|
47
47
|
literal: REQUEST_PROFILE,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
rootDocument: "request",
|
|
49
|
+
documents: { request: RunRequestSchema },
|
|
50
50
|
};
|
|
@@ -37,6 +37,6 @@ export type RunSummary = Static<typeof RunSummarySchema>;
|
|
|
37
37
|
|
|
38
38
|
export const runSummaryV1: ProfileEntry = {
|
|
39
39
|
literal: RUN_SUMMARY_PROFILE,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
rootDocument: "summary",
|
|
41
|
+
documents: { summary: RunSummarySchema },
|
|
42
42
|
};
|