@dynamicalsystems/idl 0.10.0 → 0.11.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.
@@ -21,6 +21,6 @@ export type IdentityBinding = Static<typeof IdentityBindingSchema>;
21
21
 
22
22
  export const identityBindingV1: ProfileEntry = {
23
23
  literal: IDENTITY_BINDING_PROFILE,
24
- rootShape: "binding",
25
- shapes: { binding: IdentityBindingSchema },
24
+ rootDocument: "binding",
25
+ documents: { binding: IdentityBindingSchema },
26
26
  };
@@ -40,6 +40,6 @@ export type Refusal = Static<typeof RefusalSchema>;
40
40
 
41
41
  export const refusalV1: ProfileEntry = {
42
42
  literal: REFUSAL_PROFILE,
43
- rootShape: "refusal",
44
- shapes: { refusal: RefusalSchema },
43
+ rootDocument: "refusal",
44
+ documents: { refusal: RefusalSchema },
45
45
  };
@@ -61,6 +61,6 @@ export type RefusalV2 = Static<typeof RefusalV2Schema>;
61
61
 
62
62
  export const refusalV2: ProfileEntry = {
63
63
  literal: REFUSAL_V2_PROFILE,
64
- rootShape: "refusal",
65
- shapes: { refusal: RefusalV2Schema },
64
+ rootDocument: "refusal",
65
+ documents: { refusal: RefusalV2Schema },
66
66
  };
@@ -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,10 +139,19 @@ 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
- IDENTITY_BINDING_PROFILE,
144
- IdentityBindingSchema,
145
- } from "./core/identity-binding.v1.js";
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";
147
156
 
148
157
  import type { ProfileEntry } from "./primitives.js";
@@ -154,6 +163,8 @@ import { decisionV1 } from "./run/decision.v1.js";
154
163
  import { runSummaryV1 } from "./run/run-summary.v1.js";
155
164
  import { refusalV1 } from "./core/refusal.v1.js";
156
165
  import { refusalV2 } from "./core/refusal.v2.js";
166
+ import { refusalV3 } from "./core/refusal.v3.js";
167
+ import { googleIdentityV1 } from "./core/google-identity.v1.js";
157
168
  import { identityBindingV1 } from "./core/identity-binding.v1.js";
158
169
  import { signedLawV1 } from "./infra/signed-law.v1.js";
159
170
  import { resourceDescriptorV1 } from "./infra/resource-descriptor.v1.js";
@@ -162,12 +173,11 @@ import { revocationsV1 } from "./registry/revocations.v1.js";
162
173
  import { bootstrapV1 } from "./kernel/bootstrap.v1.js";
163
174
  import { ordinaryAuthorityV1 } from "./kernel/ordinary-authority.v1.js";
164
175
  import { standingOrderActivationV1 } from "./kernel/standing-order-activation.v1.js";
165
-
166
176
  /** Every profile this version of the package defines, keyed by literal.
167
177
  * Profile modules are added here as they are extracted; the rules test
168
178
  * and the schema emitter walk this registry, so a module that is not
169
179
  * registered does not exist. */
170
- export const PROFILES: Readonly<Record<string, ProfileEntry>> = {
180
+ export const PROFILES = {
171
181
  [dispatchConsumeV1.literal]: dispatchConsumeV1,
172
182
  [operationV1.literal]: operationV1,
173
183
  [eventV1.literal]: eventV1,
@@ -176,6 +186,8 @@ export const PROFILES: Readonly<Record<string, ProfileEntry>> = {
176
186
  [runSummaryV1.literal]: runSummaryV1,
177
187
  [refusalV1.literal]: refusalV1,
178
188
  [refusalV2.literal]: refusalV2,
189
+ [refusalV3.literal]: refusalV3,
190
+ [googleIdentityV1.literal]: googleIdentityV1,
179
191
  [identityBindingV1.literal]: identityBindingV1,
180
192
  [signedLawV1.literal]: signedLawV1,
181
193
  [resourceDescriptorV1.literal]: resourceDescriptorV1,
@@ -184,4 +196,4 @@ export const PROFILES: Readonly<Record<string, ProfileEntry>> = {
184
196
  [bootstrapV1.literal]: bootstrapV1,
185
197
  [ordinaryAuthorityV1.literal]: ordinaryAuthorityV1,
186
198
  [standingOrderActivationV1.literal]: standingOrderActivationV1,
187
- };
199
+ } 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
- rootShape: "fact",
46
- shapes: { fact: AdoptionFactSchema },
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
- rootShape: "descriptor",
57
- shapes: { descriptor: ResourceDescriptorSchema },
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
- shapes: { bundle: SignedLawBundleSchema },
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
- shapes: { intent: BootstrapIntentSchema, signed: SignedBootstrapIntentSchema },
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
- shapes: {
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
- rootShape: "authority",
52
- shapes: { authority: OrdinaryAuthoritySchema },
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
- rootShape: "event",
67
- shapes: {
66
+ rootDocument: "event",
67
+ documents: {
68
68
  activation: StandingOrderActivationSchema,
69
69
  signed: SignedStandingOrderActivationSchema,
70
70
  event: StandingOrderActivationEventSchema,
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 shapes: Readonly<Record<string, TSchema>>;
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 rootShape?: string;
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
- shapes: { snapshot: RevocationSchema, pointer: RevocationPointerSchema },
86
+ documents: { snapshot: RevocationSchema, pointer: RevocationPointerSchema },
87
87
  };
@@ -22,6 +22,6 @@ export type RunDecision = Static<typeof RunDecisionSchema>;
22
22
 
23
23
  export const decisionV1: ProfileEntry = {
24
24
  literal: DECISION_PROFILE,
25
- rootShape: "decision",
26
- shapes: { decision: RunDecisionSchema },
25
+ rootDocument: "decision",
26
+ documents: { decision: RunDecisionSchema },
27
27
  };
@@ -90,6 +90,6 @@ export type EventStreamSeal = Static<typeof EventStreamSealSchema>;
90
90
 
91
91
  export const eventV1: ProfileEntry = {
92
92
  literal: EVENT_PROFILE,
93
- rootShape: "event",
94
- shapes: { event: EventSchema, streamSeal: EventStreamSealSchema },
93
+ rootDocument: "event",
94
+ documents: { event: EventSchema, streamSeal: EventStreamSealSchema },
95
95
  };
@@ -150,7 +150,7 @@ export type OperationStatus = Readback;
150
150
 
151
151
  export const operationV1: ProfileEntry = {
152
152
  literal: OPERATION_PROFILE,
153
- shapes: {
153
+ documents: {
154
154
  request: OperationRequestSchema,
155
155
  accepted: AcceptedSchema,
156
156
  readback: ReadbackSchema,
@@ -45,6 +45,6 @@ export type RunRequest = Static<typeof RunRequestSchema>;
45
45
 
46
46
  export const requestV1: ProfileEntry = {
47
47
  literal: REQUEST_PROFILE,
48
- rootShape: "request",
49
- shapes: { request: RunRequestSchema },
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
- rootShape: "summary",
41
- shapes: { summary: RunSummarySchema },
40
+ rootDocument: "summary",
41
+ documents: { summary: RunSummarySchema },
42
42
  };