@suss/intent-ir 0.0.1
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/LICENSE +205 -0
- package/README.md +37 -0
- package/dist/index.cjs +353 -0
- package/dist/index.d.cts +326 -0
- package/dist/index.d.ts +326 -0
- package/dist/index.js +320 -0
- package/package.json +61 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BoundaryBinding, TypeShape } from '@suss/ir-core';
|
|
3
|
+
|
|
4
|
+
declare const IntentFindingKindSchema: z.ZodEnum<{
|
|
5
|
+
uncoveredOutcome: "uncoveredOutcome";
|
|
6
|
+
unimplementedBoundary: "unimplementedBoundary";
|
|
7
|
+
outcomeShapeMismatch: "outcomeShapeMismatch";
|
|
8
|
+
undeclaredOutcome: "undeclaredOutcome";
|
|
9
|
+
unkeyableBoundary: "unkeyableBoundary";
|
|
10
|
+
unlinkedScenario: "unlinkedScenario";
|
|
11
|
+
danglingScenarioLink: "danglingScenarioLink";
|
|
12
|
+
ambiguousScenarioLink: "ambiguousScenarioLink";
|
|
13
|
+
}>;
|
|
14
|
+
type IntentFindingKind = z.infer<typeof IntentFindingKindSchema>;
|
|
15
|
+
declare const IntentFindingSeveritySchema: z.ZodEnum<{
|
|
16
|
+
error: "error";
|
|
17
|
+
warning: "warning";
|
|
18
|
+
info: "info";
|
|
19
|
+
}>;
|
|
20
|
+
type IntentFindingSeverity = z.infer<typeof IntentFindingSeveritySchema>;
|
|
21
|
+
/** Which intent (and, when relevant, which outcome) a finding concerns. */
|
|
22
|
+
declare const IntentRefSchema: z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
outcomeId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
type IntentRef = z.infer<typeof IntentRefSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* Suppression annotation stamped by the .sussignore pipeline. Kept
|
|
29
|
+
* structurally identical to the behavioural `Finding.suppressed` shape
|
|
30
|
+
* so @suss/ir-core's shared suppression pipeline operates on both.
|
|
31
|
+
*/
|
|
32
|
+
declare const IntentFindingSuppressionSchema: z.ZodObject<{
|
|
33
|
+
reason: z.ZodString;
|
|
34
|
+
effect: z.ZodEnum<{
|
|
35
|
+
mark: "mark";
|
|
36
|
+
downgrade: "downgrade";
|
|
37
|
+
hide: "hide";
|
|
38
|
+
}>;
|
|
39
|
+
originalSeverity: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
error: "error";
|
|
41
|
+
warning: "warning";
|
|
42
|
+
info: "info";
|
|
43
|
+
}>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
type IntentFindingSuppression = z.infer<typeof IntentFindingSuppressionSchema>;
|
|
46
|
+
declare const IntentFindingSchema: z.ZodObject<{
|
|
47
|
+
kind: z.ZodEnum<{
|
|
48
|
+
uncoveredOutcome: "uncoveredOutcome";
|
|
49
|
+
unimplementedBoundary: "unimplementedBoundary";
|
|
50
|
+
outcomeShapeMismatch: "outcomeShapeMismatch";
|
|
51
|
+
undeclaredOutcome: "undeclaredOutcome";
|
|
52
|
+
unkeyableBoundary: "unkeyableBoundary";
|
|
53
|
+
unlinkedScenario: "unlinkedScenario";
|
|
54
|
+
danglingScenarioLink: "danglingScenarioLink";
|
|
55
|
+
ambiguousScenarioLink: "ambiguousScenarioLink";
|
|
56
|
+
}>;
|
|
57
|
+
severity: z.ZodEnum<{
|
|
58
|
+
error: "error";
|
|
59
|
+
warning: "warning";
|
|
60
|
+
info: "info";
|
|
61
|
+
}>;
|
|
62
|
+
boundary: z.ZodString;
|
|
63
|
+
intent: z.ZodObject<{
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
outcomeId: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
code: z.ZodOptional<z.ZodString>;
|
|
68
|
+
scenario: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
title: z.ZodOptional<z.ZodString>;
|
|
70
|
+
link: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
suppressed: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
reason: z.ZodString;
|
|
75
|
+
effect: z.ZodEnum<{
|
|
76
|
+
mark: "mark";
|
|
77
|
+
downgrade: "downgrade";
|
|
78
|
+
hide: "hide";
|
|
79
|
+
}>;
|
|
80
|
+
originalSeverity: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
error: "error";
|
|
82
|
+
warning: "warning";
|
|
83
|
+
info: "info";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
type IntentFinding = z.infer<typeof IntentFindingSchema>;
|
|
88
|
+
|
|
89
|
+
declare const IntentSourceSchema: z.ZodDefault<z.ZodEnum<{
|
|
90
|
+
author: "author";
|
|
91
|
+
inferred: "inferred";
|
|
92
|
+
"inferred, curated": "inferred, curated";
|
|
93
|
+
}>>;
|
|
94
|
+
interface AuthoredShape {
|
|
95
|
+
type: z.infer<typeof PrimitiveTypeName> | "array" | "object";
|
|
96
|
+
items?: AuthoredShape | undefined;
|
|
97
|
+
properties?: Record<string, AuthoredShape> | undefined;
|
|
98
|
+
required?: string[] | undefined;
|
|
99
|
+
}
|
|
100
|
+
declare const BodyShapeSchema: z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
101
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
102
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>]>;
|
|
104
|
+
declare const BoundarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
105
|
+
transport: z.ZodDefault<z.ZodLiteral<"http">>;
|
|
106
|
+
semantics: z.ZodLiteral<"rest">;
|
|
107
|
+
method: z.ZodString;
|
|
108
|
+
path: z.ZodString;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
transport: z.ZodDefault<z.ZodString>;
|
|
111
|
+
semantics: z.ZodLiteral<"function-call">;
|
|
112
|
+
module: z.ZodOptional<z.ZodString>;
|
|
113
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
114
|
+
package: z.ZodOptional<z.ZodString>;
|
|
115
|
+
exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
116
|
+
}, z.core.$strip>], "semantics">;
|
|
117
|
+
declare const BoundaryTransitionSchema: z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
when: z.ZodString;
|
|
120
|
+
response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
121
|
+
status: z.ZodNumber;
|
|
122
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
123
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
124
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
125
|
+
}, z.core.$strip>]>>;
|
|
126
|
+
}, z.core.$strip>>>;
|
|
127
|
+
returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
128
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
129
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
130
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
|
+
}, z.core.$strip>]>>;
|
|
132
|
+
}, z.core.$strip>>>;
|
|
133
|
+
throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
134
|
+
errorType: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
declare const BoundaryIntentSchema: z.ZodObject<{
|
|
138
|
+
kind: z.ZodLiteral<"boundary">;
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
purpose: z.ZodString;
|
|
141
|
+
audience: z.ZodString;
|
|
142
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
143
|
+
author: "author";
|
|
144
|
+
inferred: "inferred";
|
|
145
|
+
"inferred, curated": "inferred, curated";
|
|
146
|
+
}>>;
|
|
147
|
+
boundary: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
148
|
+
transport: z.ZodDefault<z.ZodLiteral<"http">>;
|
|
149
|
+
semantics: z.ZodLiteral<"rest">;
|
|
150
|
+
method: z.ZodString;
|
|
151
|
+
path: z.ZodString;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
transport: z.ZodDefault<z.ZodString>;
|
|
154
|
+
semantics: z.ZodLiteral<"function-call">;
|
|
155
|
+
module: z.ZodOptional<z.ZodString>;
|
|
156
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
157
|
+
package: z.ZodOptional<z.ZodString>;
|
|
158
|
+
exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
159
|
+
}, z.core.$strip>], "semantics">;
|
|
160
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
when: z.ZodString;
|
|
163
|
+
response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
164
|
+
status: z.ZodNumber;
|
|
165
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
166
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
167
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$strip>]>>;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
171
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
172
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
173
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
|
+
}, z.core.$strip>]>>;
|
|
175
|
+
}, z.core.$strip>>>;
|
|
176
|
+
throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
177
|
+
errorType: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>>>;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
declare const PrdScenarioSchema: z.ZodObject<{
|
|
182
|
+
title: z.ZodOptional<z.ZodString>;
|
|
183
|
+
when: z.ZodString;
|
|
184
|
+
expect: z.ZodString;
|
|
185
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
declare const PrdSchema: z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"prd">;
|
|
189
|
+
title: z.ZodString;
|
|
190
|
+
purpose: z.ZodString;
|
|
191
|
+
audience: z.ZodString;
|
|
192
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
193
|
+
author: "author";
|
|
194
|
+
inferred: "inferred";
|
|
195
|
+
"inferred, curated": "inferred, curated";
|
|
196
|
+
}>>;
|
|
197
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
198
|
+
title: z.ZodOptional<z.ZodString>;
|
|
199
|
+
when: z.ZodString;
|
|
200
|
+
expect: z.ZodString;
|
|
201
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
declare const IntentDocSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"boundary">;
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
purpose: z.ZodString;
|
|
208
|
+
audience: z.ZodString;
|
|
209
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
210
|
+
author: "author";
|
|
211
|
+
inferred: "inferred";
|
|
212
|
+
"inferred, curated": "inferred, curated";
|
|
213
|
+
}>>;
|
|
214
|
+
boundary: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
215
|
+
transport: z.ZodDefault<z.ZodLiteral<"http">>;
|
|
216
|
+
semantics: z.ZodLiteral<"rest">;
|
|
217
|
+
method: z.ZodString;
|
|
218
|
+
path: z.ZodString;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
transport: z.ZodDefault<z.ZodString>;
|
|
221
|
+
semantics: z.ZodLiteral<"function-call">;
|
|
222
|
+
module: z.ZodOptional<z.ZodString>;
|
|
223
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
224
|
+
package: z.ZodOptional<z.ZodString>;
|
|
225
|
+
exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
}, z.core.$strip>], "semantics">;
|
|
227
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
when: z.ZodString;
|
|
230
|
+
response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
231
|
+
status: z.ZodNumber;
|
|
232
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
233
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
234
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
235
|
+
}, z.core.$strip>]>>;
|
|
236
|
+
}, z.core.$strip>>>;
|
|
237
|
+
returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
238
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
239
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
240
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
241
|
+
}, z.core.$strip>]>>;
|
|
242
|
+
}, z.core.$strip>>>;
|
|
243
|
+
throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
244
|
+
errorType: z.ZodOptional<z.ZodString>;
|
|
245
|
+
}, z.core.$strip>>>;
|
|
246
|
+
}, z.core.$strip>>;
|
|
247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
248
|
+
kind: z.ZodLiteral<"prd">;
|
|
249
|
+
title: z.ZodString;
|
|
250
|
+
purpose: z.ZodString;
|
|
251
|
+
audience: z.ZodString;
|
|
252
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
253
|
+
author: "author";
|
|
254
|
+
inferred: "inferred";
|
|
255
|
+
"inferred, curated": "inferred, curated";
|
|
256
|
+
}>>;
|
|
257
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
258
|
+
title: z.ZodOptional<z.ZodString>;
|
|
259
|
+
when: z.ZodString;
|
|
260
|
+
expect: z.ZodString;
|
|
261
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
262
|
+
}, z.core.$strip>>;
|
|
263
|
+
}, z.core.$strip>], "kind">;
|
|
264
|
+
type IntentDoc = z.infer<typeof IntentDocSchema>;
|
|
265
|
+
type BoundaryIntent = z.infer<typeof BoundaryIntentSchema>;
|
|
266
|
+
type Prd = z.infer<typeof PrdSchema>;
|
|
267
|
+
type PrdScenario = z.infer<typeof PrdScenarioSchema>;
|
|
268
|
+
type Boundary = z.infer<typeof BoundarySchema>;
|
|
269
|
+
type BoundaryTransition = z.infer<typeof BoundaryTransitionSchema>;
|
|
270
|
+
type BodyShape = z.infer<typeof BodyShapeSchema>;
|
|
271
|
+
type IntentSource = z.infer<typeof IntentSourceSchema>;
|
|
272
|
+
declare const PrimitiveTypeName: z.ZodEnum<{
|
|
273
|
+
string: "string";
|
|
274
|
+
number: "number";
|
|
275
|
+
boolean: "boolean";
|
|
276
|
+
integer: "integer";
|
|
277
|
+
null: "null";
|
|
278
|
+
unknown: "unknown";
|
|
279
|
+
}>;
|
|
280
|
+
type PrimitiveTypeName = z.infer<typeof PrimitiveTypeName>;
|
|
281
|
+
|
|
282
|
+
/** How a boundary outcome resolves — the cross-kind unification. */
|
|
283
|
+
type IntentOutcomeKind = "response" | "return" | "throw";
|
|
284
|
+
interface IntentOutcome {
|
|
285
|
+
/** Author-declared id PRD scenarios reference. */
|
|
286
|
+
id: string;
|
|
287
|
+
/** The condition, in human terms (opaque to the checker). */
|
|
288
|
+
when: string;
|
|
289
|
+
kind: IntentOutcomeKind;
|
|
290
|
+
/** Set only for `response` outcomes (REST status code). */
|
|
291
|
+
status: number | null;
|
|
292
|
+
/** Response / return body shape, when declared. */
|
|
293
|
+
body: TypeShape | null;
|
|
294
|
+
/** Error type name, set only for `throw` outcomes when declared. */
|
|
295
|
+
errorType: string | null;
|
|
296
|
+
}
|
|
297
|
+
interface BoundaryIntentSummary {
|
|
298
|
+
kind: "boundary";
|
|
299
|
+
name: string;
|
|
300
|
+
purpose: string;
|
|
301
|
+
audience: string;
|
|
302
|
+
source: IntentSource;
|
|
303
|
+
boundary: BoundaryBinding;
|
|
304
|
+
outcomes: IntentOutcome[];
|
|
305
|
+
}
|
|
306
|
+
interface PrdScenarioSummary {
|
|
307
|
+
title: string | null;
|
|
308
|
+
/** Condition, human terms. */
|
|
309
|
+
when: string;
|
|
310
|
+
/** Expected outcome, human terms. */
|
|
311
|
+
expect: string;
|
|
312
|
+
/** Qualified outcome refs (`<intent-name>.<outcome-id>`); empty when unlinked. */
|
|
313
|
+
link: string[];
|
|
314
|
+
}
|
|
315
|
+
interface PrdSummary {
|
|
316
|
+
kind: "prd";
|
|
317
|
+
title: string;
|
|
318
|
+
purpose: string;
|
|
319
|
+
audience: string;
|
|
320
|
+
source: IntentSource;
|
|
321
|
+
scenarios: PrdScenarioSummary[];
|
|
322
|
+
}
|
|
323
|
+
type IntentSummary = BoundaryIntentSummary | PrdSummary;
|
|
324
|
+
declare function intentDocToSummary(doc: IntentDoc): IntentSummary;
|
|
325
|
+
|
|
326
|
+
export { type BodyShape, BodyShapeSchema, type Boundary, type BoundaryIntent, type BoundaryIntentSummary, BoundarySchema, type BoundaryTransition, type IntentDoc, IntentDocSchema, type IntentFinding, type IntentFindingKind, IntentFindingKindSchema, IntentFindingSchema, type IntentFindingSeverity, IntentFindingSeveritySchema, type IntentFindingSuppression, IntentFindingSuppressionSchema, type IntentOutcome, type IntentOutcomeKind, type IntentRef, IntentRefSchema, type IntentSource, IntentSourceSchema, type IntentSummary, type Prd, type PrdScenario, type PrdScenarioSummary, type PrdSummary, PrimitiveTypeName, intentDocToSummary };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BoundaryBinding, TypeShape } from '@suss/ir-core';
|
|
3
|
+
|
|
4
|
+
declare const IntentFindingKindSchema: z.ZodEnum<{
|
|
5
|
+
uncoveredOutcome: "uncoveredOutcome";
|
|
6
|
+
unimplementedBoundary: "unimplementedBoundary";
|
|
7
|
+
outcomeShapeMismatch: "outcomeShapeMismatch";
|
|
8
|
+
undeclaredOutcome: "undeclaredOutcome";
|
|
9
|
+
unkeyableBoundary: "unkeyableBoundary";
|
|
10
|
+
unlinkedScenario: "unlinkedScenario";
|
|
11
|
+
danglingScenarioLink: "danglingScenarioLink";
|
|
12
|
+
ambiguousScenarioLink: "ambiguousScenarioLink";
|
|
13
|
+
}>;
|
|
14
|
+
type IntentFindingKind = z.infer<typeof IntentFindingKindSchema>;
|
|
15
|
+
declare const IntentFindingSeveritySchema: z.ZodEnum<{
|
|
16
|
+
error: "error";
|
|
17
|
+
warning: "warning";
|
|
18
|
+
info: "info";
|
|
19
|
+
}>;
|
|
20
|
+
type IntentFindingSeverity = z.infer<typeof IntentFindingSeveritySchema>;
|
|
21
|
+
/** Which intent (and, when relevant, which outcome) a finding concerns. */
|
|
22
|
+
declare const IntentRefSchema: z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
outcomeId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
type IntentRef = z.infer<typeof IntentRefSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* Suppression annotation stamped by the .sussignore pipeline. Kept
|
|
29
|
+
* structurally identical to the behavioural `Finding.suppressed` shape
|
|
30
|
+
* so @suss/ir-core's shared suppression pipeline operates on both.
|
|
31
|
+
*/
|
|
32
|
+
declare const IntentFindingSuppressionSchema: z.ZodObject<{
|
|
33
|
+
reason: z.ZodString;
|
|
34
|
+
effect: z.ZodEnum<{
|
|
35
|
+
mark: "mark";
|
|
36
|
+
downgrade: "downgrade";
|
|
37
|
+
hide: "hide";
|
|
38
|
+
}>;
|
|
39
|
+
originalSeverity: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
error: "error";
|
|
41
|
+
warning: "warning";
|
|
42
|
+
info: "info";
|
|
43
|
+
}>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
type IntentFindingSuppression = z.infer<typeof IntentFindingSuppressionSchema>;
|
|
46
|
+
declare const IntentFindingSchema: z.ZodObject<{
|
|
47
|
+
kind: z.ZodEnum<{
|
|
48
|
+
uncoveredOutcome: "uncoveredOutcome";
|
|
49
|
+
unimplementedBoundary: "unimplementedBoundary";
|
|
50
|
+
outcomeShapeMismatch: "outcomeShapeMismatch";
|
|
51
|
+
undeclaredOutcome: "undeclaredOutcome";
|
|
52
|
+
unkeyableBoundary: "unkeyableBoundary";
|
|
53
|
+
unlinkedScenario: "unlinkedScenario";
|
|
54
|
+
danglingScenarioLink: "danglingScenarioLink";
|
|
55
|
+
ambiguousScenarioLink: "ambiguousScenarioLink";
|
|
56
|
+
}>;
|
|
57
|
+
severity: z.ZodEnum<{
|
|
58
|
+
error: "error";
|
|
59
|
+
warning: "warning";
|
|
60
|
+
info: "info";
|
|
61
|
+
}>;
|
|
62
|
+
boundary: z.ZodString;
|
|
63
|
+
intent: z.ZodObject<{
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
outcomeId: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
code: z.ZodOptional<z.ZodString>;
|
|
68
|
+
scenario: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
title: z.ZodOptional<z.ZodString>;
|
|
70
|
+
link: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
suppressed: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
reason: z.ZodString;
|
|
75
|
+
effect: z.ZodEnum<{
|
|
76
|
+
mark: "mark";
|
|
77
|
+
downgrade: "downgrade";
|
|
78
|
+
hide: "hide";
|
|
79
|
+
}>;
|
|
80
|
+
originalSeverity: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
error: "error";
|
|
82
|
+
warning: "warning";
|
|
83
|
+
info: "info";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
type IntentFinding = z.infer<typeof IntentFindingSchema>;
|
|
88
|
+
|
|
89
|
+
declare const IntentSourceSchema: z.ZodDefault<z.ZodEnum<{
|
|
90
|
+
author: "author";
|
|
91
|
+
inferred: "inferred";
|
|
92
|
+
"inferred, curated": "inferred, curated";
|
|
93
|
+
}>>;
|
|
94
|
+
interface AuthoredShape {
|
|
95
|
+
type: z.infer<typeof PrimitiveTypeName> | "array" | "object";
|
|
96
|
+
items?: AuthoredShape | undefined;
|
|
97
|
+
properties?: Record<string, AuthoredShape> | undefined;
|
|
98
|
+
required?: string[] | undefined;
|
|
99
|
+
}
|
|
100
|
+
declare const BodyShapeSchema: z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
101
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
102
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>]>;
|
|
104
|
+
declare const BoundarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
105
|
+
transport: z.ZodDefault<z.ZodLiteral<"http">>;
|
|
106
|
+
semantics: z.ZodLiteral<"rest">;
|
|
107
|
+
method: z.ZodString;
|
|
108
|
+
path: z.ZodString;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
transport: z.ZodDefault<z.ZodString>;
|
|
111
|
+
semantics: z.ZodLiteral<"function-call">;
|
|
112
|
+
module: z.ZodOptional<z.ZodString>;
|
|
113
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
114
|
+
package: z.ZodOptional<z.ZodString>;
|
|
115
|
+
exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
116
|
+
}, z.core.$strip>], "semantics">;
|
|
117
|
+
declare const BoundaryTransitionSchema: z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
when: z.ZodString;
|
|
120
|
+
response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
121
|
+
status: z.ZodNumber;
|
|
122
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
123
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
124
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
125
|
+
}, z.core.$strip>]>>;
|
|
126
|
+
}, z.core.$strip>>>;
|
|
127
|
+
returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
128
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
129
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
130
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
131
|
+
}, z.core.$strip>]>>;
|
|
132
|
+
}, z.core.$strip>>>;
|
|
133
|
+
throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
134
|
+
errorType: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
declare const BoundaryIntentSchema: z.ZodObject<{
|
|
138
|
+
kind: z.ZodLiteral<"boundary">;
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
purpose: z.ZodString;
|
|
141
|
+
audience: z.ZodString;
|
|
142
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
143
|
+
author: "author";
|
|
144
|
+
inferred: "inferred";
|
|
145
|
+
"inferred, curated": "inferred, curated";
|
|
146
|
+
}>>;
|
|
147
|
+
boundary: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
148
|
+
transport: z.ZodDefault<z.ZodLiteral<"http">>;
|
|
149
|
+
semantics: z.ZodLiteral<"rest">;
|
|
150
|
+
method: z.ZodString;
|
|
151
|
+
path: z.ZodString;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
transport: z.ZodDefault<z.ZodString>;
|
|
154
|
+
semantics: z.ZodLiteral<"function-call">;
|
|
155
|
+
module: z.ZodOptional<z.ZodString>;
|
|
156
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
157
|
+
package: z.ZodOptional<z.ZodString>;
|
|
158
|
+
exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
159
|
+
}, z.core.$strip>], "semantics">;
|
|
160
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
when: z.ZodString;
|
|
163
|
+
response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
164
|
+
status: z.ZodNumber;
|
|
165
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
166
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
167
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$strip>]>>;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
171
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
172
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
173
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
|
+
}, z.core.$strip>]>>;
|
|
175
|
+
}, z.core.$strip>>>;
|
|
176
|
+
throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
177
|
+
errorType: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>>>;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
declare const PrdScenarioSchema: z.ZodObject<{
|
|
182
|
+
title: z.ZodOptional<z.ZodString>;
|
|
183
|
+
when: z.ZodString;
|
|
184
|
+
expect: z.ZodString;
|
|
185
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
declare const PrdSchema: z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"prd">;
|
|
189
|
+
title: z.ZodString;
|
|
190
|
+
purpose: z.ZodString;
|
|
191
|
+
audience: z.ZodString;
|
|
192
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
193
|
+
author: "author";
|
|
194
|
+
inferred: "inferred";
|
|
195
|
+
"inferred, curated": "inferred, curated";
|
|
196
|
+
}>>;
|
|
197
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
198
|
+
title: z.ZodOptional<z.ZodString>;
|
|
199
|
+
when: z.ZodString;
|
|
200
|
+
expect: z.ZodString;
|
|
201
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
declare const IntentDocSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"boundary">;
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
purpose: z.ZodString;
|
|
208
|
+
audience: z.ZodString;
|
|
209
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
210
|
+
author: "author";
|
|
211
|
+
inferred: "inferred";
|
|
212
|
+
"inferred, curated": "inferred, curated";
|
|
213
|
+
}>>;
|
|
214
|
+
boundary: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
215
|
+
transport: z.ZodDefault<z.ZodLiteral<"http">>;
|
|
216
|
+
semantics: z.ZodLiteral<"rest">;
|
|
217
|
+
method: z.ZodString;
|
|
218
|
+
path: z.ZodString;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
transport: z.ZodDefault<z.ZodString>;
|
|
221
|
+
semantics: z.ZodLiteral<"function-call">;
|
|
222
|
+
module: z.ZodOptional<z.ZodString>;
|
|
223
|
+
exportName: z.ZodOptional<z.ZodString>;
|
|
224
|
+
package: z.ZodOptional<z.ZodString>;
|
|
225
|
+
exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
+
}, z.core.$strip>], "semantics">;
|
|
227
|
+
transitions: z.ZodArray<z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
when: z.ZodString;
|
|
230
|
+
response: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
231
|
+
status: z.ZodNumber;
|
|
232
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
233
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
234
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
235
|
+
}, z.core.$strip>]>>;
|
|
236
|
+
}, z.core.$strip>>>;
|
|
237
|
+
returns: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
238
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>, z.ZodObject<{
|
|
239
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AuthoredShape, unknown, z.core.$ZodTypeInternals<AuthoredShape, unknown>>>>;
|
|
240
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
241
|
+
}, z.core.$strip>]>>;
|
|
242
|
+
}, z.core.$strip>>>;
|
|
243
|
+
throws: z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodObject<{
|
|
244
|
+
errorType: z.ZodOptional<z.ZodString>;
|
|
245
|
+
}, z.core.$strip>>>;
|
|
246
|
+
}, z.core.$strip>>;
|
|
247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
248
|
+
kind: z.ZodLiteral<"prd">;
|
|
249
|
+
title: z.ZodString;
|
|
250
|
+
purpose: z.ZodString;
|
|
251
|
+
audience: z.ZodString;
|
|
252
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
253
|
+
author: "author";
|
|
254
|
+
inferred: "inferred";
|
|
255
|
+
"inferred, curated": "inferred, curated";
|
|
256
|
+
}>>;
|
|
257
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
258
|
+
title: z.ZodOptional<z.ZodString>;
|
|
259
|
+
when: z.ZodString;
|
|
260
|
+
expect: z.ZodString;
|
|
261
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
262
|
+
}, z.core.$strip>>;
|
|
263
|
+
}, z.core.$strip>], "kind">;
|
|
264
|
+
type IntentDoc = z.infer<typeof IntentDocSchema>;
|
|
265
|
+
type BoundaryIntent = z.infer<typeof BoundaryIntentSchema>;
|
|
266
|
+
type Prd = z.infer<typeof PrdSchema>;
|
|
267
|
+
type PrdScenario = z.infer<typeof PrdScenarioSchema>;
|
|
268
|
+
type Boundary = z.infer<typeof BoundarySchema>;
|
|
269
|
+
type BoundaryTransition = z.infer<typeof BoundaryTransitionSchema>;
|
|
270
|
+
type BodyShape = z.infer<typeof BodyShapeSchema>;
|
|
271
|
+
type IntentSource = z.infer<typeof IntentSourceSchema>;
|
|
272
|
+
declare const PrimitiveTypeName: z.ZodEnum<{
|
|
273
|
+
string: "string";
|
|
274
|
+
number: "number";
|
|
275
|
+
boolean: "boolean";
|
|
276
|
+
integer: "integer";
|
|
277
|
+
null: "null";
|
|
278
|
+
unknown: "unknown";
|
|
279
|
+
}>;
|
|
280
|
+
type PrimitiveTypeName = z.infer<typeof PrimitiveTypeName>;
|
|
281
|
+
|
|
282
|
+
/** How a boundary outcome resolves — the cross-kind unification. */
|
|
283
|
+
type IntentOutcomeKind = "response" | "return" | "throw";
|
|
284
|
+
interface IntentOutcome {
|
|
285
|
+
/** Author-declared id PRD scenarios reference. */
|
|
286
|
+
id: string;
|
|
287
|
+
/** The condition, in human terms (opaque to the checker). */
|
|
288
|
+
when: string;
|
|
289
|
+
kind: IntentOutcomeKind;
|
|
290
|
+
/** Set only for `response` outcomes (REST status code). */
|
|
291
|
+
status: number | null;
|
|
292
|
+
/** Response / return body shape, when declared. */
|
|
293
|
+
body: TypeShape | null;
|
|
294
|
+
/** Error type name, set only for `throw` outcomes when declared. */
|
|
295
|
+
errorType: string | null;
|
|
296
|
+
}
|
|
297
|
+
interface BoundaryIntentSummary {
|
|
298
|
+
kind: "boundary";
|
|
299
|
+
name: string;
|
|
300
|
+
purpose: string;
|
|
301
|
+
audience: string;
|
|
302
|
+
source: IntentSource;
|
|
303
|
+
boundary: BoundaryBinding;
|
|
304
|
+
outcomes: IntentOutcome[];
|
|
305
|
+
}
|
|
306
|
+
interface PrdScenarioSummary {
|
|
307
|
+
title: string | null;
|
|
308
|
+
/** Condition, human terms. */
|
|
309
|
+
when: string;
|
|
310
|
+
/** Expected outcome, human terms. */
|
|
311
|
+
expect: string;
|
|
312
|
+
/** Qualified outcome refs (`<intent-name>.<outcome-id>`); empty when unlinked. */
|
|
313
|
+
link: string[];
|
|
314
|
+
}
|
|
315
|
+
interface PrdSummary {
|
|
316
|
+
kind: "prd";
|
|
317
|
+
title: string;
|
|
318
|
+
purpose: string;
|
|
319
|
+
audience: string;
|
|
320
|
+
source: IntentSource;
|
|
321
|
+
scenarios: PrdScenarioSummary[];
|
|
322
|
+
}
|
|
323
|
+
type IntentSummary = BoundaryIntentSummary | PrdSummary;
|
|
324
|
+
declare function intentDocToSummary(doc: IntentDoc): IntentSummary;
|
|
325
|
+
|
|
326
|
+
export { type BodyShape, BodyShapeSchema, type Boundary, type BoundaryIntent, type BoundaryIntentSummary, BoundarySchema, type BoundaryTransition, type IntentDoc, IntentDocSchema, type IntentFinding, type IntentFindingKind, IntentFindingKindSchema, IntentFindingSchema, type IntentFindingSeverity, IntentFindingSeveritySchema, type IntentFindingSuppression, IntentFindingSuppressionSchema, type IntentOutcome, type IntentOutcomeKind, type IntentRef, IntentRefSchema, type IntentSource, IntentSourceSchema, type IntentSummary, type Prd, type PrdScenario, type PrdScenarioSummary, type PrdSummary, PrimitiveTypeName, intentDocToSummary };
|