@suss/ir-core 0.3.1 → 0.4.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/README.md +12 -4
- package/dist/chunk-5KE7OWN3.js +597 -0
- package/dist/index.cjs +575 -220
- package/dist/index.d.cts +251 -123
- package/dist/index.d.ts +251 -123
- package/dist/index.js +85 -81
- package/dist/schemas-BWvfkxSH.d.cts +432 -0
- package/dist/schemas-BWvfkxSH.d.ts +432 -0
- package/dist/schemas.cjs +458 -127
- package/dist/schemas.d.cts +2 -374
- package/dist/schemas.d.ts +2 -374
- package/dist/schemas.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-L4XGOS3I.js +0 -237
package/dist/schemas.cjs
CHANGED
|
@@ -40,56 +40,20 @@ __export(schemas_exports, {
|
|
|
40
40
|
withDefinitionsInlined: () => withDefinitionsInlined
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(schemas_exports);
|
|
43
|
+
var import_zod10 = require("zod");
|
|
44
|
+
|
|
45
|
+
// src/semantics/registry.ts
|
|
46
|
+
var import_zod9 = require("zod");
|
|
47
|
+
|
|
48
|
+
// src/semantics/functionCall.ts
|
|
43
49
|
var import_zod = require("zod");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var CorroborationSchema = import_zod.z.object({
|
|
52
|
-
outcome: import_zod.z.enum(["observed", "refuted", "untested"]),
|
|
53
|
-
/** Executions that produced a verdict for this claim. */
|
|
54
|
-
runs: import_zod.z.number(),
|
|
55
|
-
/** Present when refuted: the input and observation that disagreed. */
|
|
56
|
-
counterexample: import_zod.z.unknown().optional(),
|
|
57
|
-
/** Present when untested: why no verdict was reachable. */
|
|
58
|
-
reason: import_zod.z.string().optional()
|
|
59
|
-
});
|
|
60
|
-
var ConfidenceInfoSchema = import_zod.z.object({
|
|
61
|
-
source: ConfidenceSourceSchema,
|
|
62
|
-
level: ConfidenceLevelSchema,
|
|
63
|
-
corroboration: CorroborationSchema.optional()
|
|
64
|
-
});
|
|
65
|
-
var SourceLocationSchema = import_zod.z.object({
|
|
66
|
-
file: import_zod.z.string(),
|
|
67
|
-
range: import_zod.z.object({ start: import_zod.z.number(), end: import_zod.z.number() }),
|
|
68
|
-
exportName: import_zod.z.string().nullable(),
|
|
69
|
-
/**
|
|
70
|
-
* What the extract was pointed at, as that project calls itself.
|
|
71
|
-
*
|
|
72
|
-
* A path is relative to wherever the extract ran, so two services in
|
|
73
|
-
* one repository both say `src/handlers.ts` and merging their
|
|
74
|
-
* summaries puts them on top of each other. This is what tells them
|
|
75
|
-
* apart, and what a reader groups by.
|
|
76
|
-
*/
|
|
77
|
-
workspace: import_zod.z.string().optional()
|
|
78
|
-
});
|
|
79
|
-
var RestSemanticsSchema = import_zod.z.object({
|
|
80
|
-
name: import_zod.z.literal("rest"),
|
|
81
|
-
/** Uppercase HTTP method ("GET", "POST", …). */
|
|
82
|
-
method: import_zod.z.string(),
|
|
83
|
-
/** Normalized route path ("/users/{id}"). */
|
|
84
|
-
path: import_zod.z.string(),
|
|
85
|
-
/**
|
|
86
|
-
* Status codes the producing source explicitly declared (OpenAPI
|
|
87
|
-
* responses, CFN MethodResponses, ts-rest router statuses). Kept here
|
|
88
|
-
* so the pairing layer can still see them without unwrapping metadata.
|
|
89
|
-
* Empty / absent for inferred sources.
|
|
90
|
-
*/
|
|
91
|
-
declaredResponses: import_zod.z.array(import_zod.z.number()).optional()
|
|
92
|
-
});
|
|
50
|
+
|
|
51
|
+
// src/semantics/definition.ts
|
|
52
|
+
function defineBoundarySemantics(definition) {
|
|
53
|
+
return definition;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/semantics/functionCall.ts
|
|
93
57
|
var FunctionCallSemanticsSchema = import_zod.z.object({
|
|
94
58
|
name: import_zod.z.literal("function-call"),
|
|
95
59
|
/**
|
|
@@ -102,117 +66,484 @@ var FunctionCallSemanticsSchema = import_zod.z.object({
|
|
|
102
66
|
/** Named export within the module, when applicable. */
|
|
103
67
|
exportName: import_zod.z.string().optional(),
|
|
104
68
|
/**
|
|
105
|
-
* Package name
|
|
106
|
-
* refers to a public package export
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* from `module`, which is a
|
|
110
|
-
*
|
|
69
|
+
* Package name, as written in `package.json`, when this identity
|
|
70
|
+
* refers to a public package export, for example
|
|
71
|
+
* `"@suss/behavioral-ir"`. Packs that resolve a package's public
|
|
72
|
+
* surface (the `packageExports` discovery variant) set it alongside
|
|
73
|
+
* `exportPath`. It is different from `module`, which is a
|
|
74
|
+
* repo-relative module path used for pairing inside one repo.
|
|
111
75
|
*/
|
|
112
76
|
package: import_zod.z.string().optional(),
|
|
113
77
|
/**
|
|
114
|
-
* Path to the exported binding within the package, starting with
|
|
115
|
-
*
|
|
116
|
-
* `["parseSummary"]
|
|
117
|
-
* `["schemas", "BoundaryBindingSchema"]
|
|
78
|
+
* Path to the exported binding within the package, starting with the
|
|
79
|
+
* sub-path key when one is used. Examples:
|
|
80
|
+
* `["parseSummary"]`: a root export
|
|
81
|
+
* `["schemas", "BoundaryBindingSchema"]`: the sub-path `./schemas`
|
|
118
82
|
*
|
|
119
|
-
* The first segment is the sub-path without the leading
|
|
120
|
-
*
|
|
83
|
+
* The first segment is the sub-path without the leading `./`, and
|
|
84
|
+
* `"."` is left out. The last segment is the exported name.
|
|
121
85
|
*/
|
|
122
86
|
exportPath: import_zod.z.array(import_zod.z.string()).optional()
|
|
123
87
|
});
|
|
124
|
-
var
|
|
125
|
-
name:
|
|
126
|
-
|
|
127
|
-
|
|
88
|
+
var functionCallSemantics = defineBoundarySemantics({
|
|
89
|
+
name: "function-call",
|
|
90
|
+
schema: FunctionCallSemanticsSchema,
|
|
91
|
+
behavior: {
|
|
92
|
+
/** A call returns a value, which is not a status and a body. */
|
|
93
|
+
exchangesHttpResponses: false,
|
|
94
|
+
reportsUnpairedItself: false,
|
|
95
|
+
/**
|
|
96
|
+
* `"fn:<package>::<exportPath>"` when both are set. Other in-process
|
|
97
|
+
* function-call units, such as components and bare handlers inside
|
|
98
|
+
* one repo, have no key at all.
|
|
99
|
+
*/
|
|
100
|
+
identityKey(semantics) {
|
|
101
|
+
if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
|
|
102
|
+
return `fn:${semantics.package}::${semantics.exportPath.join(".")}`;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// src/semantics/graphqlOperation.ts
|
|
110
|
+
var import_zod2 = require("zod");
|
|
111
|
+
var GraphqlOperationSemanticsSchema = import_zod2.z.object({
|
|
112
|
+
name: import_zod2.z.literal("graphql-operation"),
|
|
113
|
+
/** Optional operation name. An anonymous query or mutation leaves it unset. */
|
|
114
|
+
operationName: import_zod2.z.string().optional(),
|
|
115
|
+
operationType: import_zod2.z.enum(["query", "mutation", "subscription"])
|
|
116
|
+
});
|
|
117
|
+
var graphqlOperationSemantics = defineBoundarySemantics({
|
|
118
|
+
name: "graphql-operation",
|
|
119
|
+
schema: GraphqlOperationSemanticsSchema,
|
|
120
|
+
behavior: {
|
|
121
|
+
/**
|
|
122
|
+
* An operation gets a data-and-errors document back, which the
|
|
123
|
+
* GraphQL contract checker reads. Status codes say nothing here.
|
|
124
|
+
*/
|
|
125
|
+
exchangesHttpResponses: false,
|
|
126
|
+
reportsUnpairedItself: false,
|
|
127
|
+
identityKey: () => null,
|
|
128
|
+
/** "query GetUser". The contract checker pairs it, the key does not. */
|
|
129
|
+
displayLabel(semantics) {
|
|
130
|
+
return `${semantics.operationType} ${semantics.operationName ?? "<anonymous>"}`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// src/semantics/graphqlResolver.ts
|
|
136
|
+
var import_zod3 = require("zod");
|
|
137
|
+
var GraphqlResolverSemanticsSchema = import_zod3.z.object({
|
|
138
|
+
name: import_zod3.z.literal("graphql-resolver"),
|
|
139
|
+
/**
|
|
140
|
+
* GraphQL type the resolver attaches to: "Query", "Mutation",
|
|
141
|
+
* "Subscription", or an object-type name. Null when the source never
|
|
142
|
+
* says which one, as with a `@Resolver()` class that has no argument.
|
|
143
|
+
*/
|
|
144
|
+
typeName: import_zod3.z.string().min(1).nullable(),
|
|
128
145
|
/** Field name on that type. */
|
|
129
|
-
fieldName:
|
|
146
|
+
fieldName: import_zod3.z.string()
|
|
147
|
+
});
|
|
148
|
+
var graphqlResolverSemantics = defineBoundarySemantics({
|
|
149
|
+
name: "graphql-resolver",
|
|
150
|
+
schema: GraphqlResolverSemanticsSchema,
|
|
151
|
+
behavior: {
|
|
152
|
+
/** A resolver returns a field value, not a status and a body. */
|
|
153
|
+
exchangesHttpResponses: false,
|
|
154
|
+
reportsUnpairedItself: false,
|
|
155
|
+
/**
|
|
156
|
+
* `"gql:<TypeName>.<fieldName>"`, or null when the type is null or
|
|
157
|
+
* the field is empty, which is how a resolver reports that the
|
|
158
|
+
* source never gave them.
|
|
159
|
+
*/
|
|
160
|
+
identityKey(semantics) {
|
|
161
|
+
if (semantics.typeName === null || semantics.fieldName === "") {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return `gql:${semantics.typeName}.${semantics.fieldName}`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
130
167
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
168
|
+
|
|
169
|
+
// src/semantics/messageBus.ts
|
|
170
|
+
var import_zod4 = require("zod");
|
|
171
|
+
|
|
172
|
+
// src/channel.ts
|
|
173
|
+
function parseChannel(channel) {
|
|
174
|
+
const hash = channel.indexOf("#");
|
|
175
|
+
if (hash === -1) {
|
|
176
|
+
return { bus: null, subject: channel };
|
|
177
|
+
}
|
|
178
|
+
return { bus: channel.slice(0, hash), subject: channel.slice(hash + 1) };
|
|
179
|
+
}
|
|
180
|
+
function busesAgree(a, b) {
|
|
181
|
+
return a === null || b === null || a === b;
|
|
182
|
+
}
|
|
183
|
+
function channelsPair(a, b) {
|
|
184
|
+
const left = parseChannel(a);
|
|
185
|
+
const right = parseChannel(b);
|
|
186
|
+
return left.subject === right.subject && busesAgree(left.bus, right.bus);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/semantics/messageBus.ts
|
|
190
|
+
var MessageBusSemanticsSchema = import_zod4.z.object({
|
|
191
|
+
name: import_zod4.z.literal("message-bus"),
|
|
192
|
+
messageBus: import_zod4.z.enum([
|
|
193
|
+
"sqs",
|
|
194
|
+
"sns",
|
|
195
|
+
"s3",
|
|
196
|
+
"eventbridge",
|
|
197
|
+
"bullmq",
|
|
198
|
+
"kafka",
|
|
199
|
+
"nats"
|
|
200
|
+
]),
|
|
201
|
+
/**
|
|
202
|
+
* Stable channel identifier: a CFN logical id, a queue or topic name,
|
|
203
|
+
* a subject pattern, or `bus#detailType`. Null when this source does
|
|
204
|
+
* not say which channel, as with a send whose queue the code picks at
|
|
205
|
+
* runtime, or a receive whose queue the event-source mapping states.
|
|
206
|
+
*/
|
|
207
|
+
channel: import_zod4.z.string().min(1).nullable()
|
|
208
|
+
});
|
|
209
|
+
var messageBusSemantics = defineBoundarySemantics({
|
|
210
|
+
name: "message-bus",
|
|
211
|
+
schema: MessageBusSemanticsSchema,
|
|
212
|
+
behavior: {
|
|
213
|
+
/** A message goes onto the channel and nothing comes back. */
|
|
214
|
+
exchangesHttpResponses: false,
|
|
215
|
+
/**
|
|
216
|
+
* `checkMessageBus` looks at every channel, including the unused
|
|
217
|
+
* ones, so the generic unmatched lists leave them alone.
|
|
218
|
+
*/
|
|
219
|
+
reportsUnpairedItself: true,
|
|
220
|
+
/**
|
|
221
|
+
* `"bus:<messageBus> <subject>"`, or null when the channel is null
|
|
222
|
+
* or its subject is empty.
|
|
223
|
+
*
|
|
224
|
+
* The key has the subject in it and leaves out the bus, so a
|
|
225
|
+
* template writing `default#order.placed` and a handler writing
|
|
226
|
+
* `order.placed` land in one bucket, where `sidesAgree` compares the
|
|
227
|
+
* buses. A side that cannot know its bus would otherwise be keyed
|
|
228
|
+
* away from the side that can.
|
|
229
|
+
*
|
|
230
|
+
* The bus technology stays in, because a queue and an event router
|
|
231
|
+
* are different destinations even with the same subject. Case stays
|
|
232
|
+
* too, because AWS compares detail-types and queue ids byte for byte.
|
|
233
|
+
*/
|
|
234
|
+
identityKey(semantics) {
|
|
235
|
+
if (semantics.channel === null) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
const { subject } = parseChannel(semantics.channel);
|
|
239
|
+
if (subject === "") {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
return `bus:${semantics.messageBus} ${subject}`;
|
|
243
|
+
},
|
|
244
|
+
sidesAgree(a, b) {
|
|
245
|
+
if (a.channel === null || b.channel === null) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
return channelsPair(a.channel, b.channel);
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
251
|
+
* The whole channel, bus included, unlike the identity key, which
|
|
252
|
+
* has the subject alone. Someone reading a list of unmatched
|
|
253
|
+
* channels wants to see which bus each one was on.
|
|
254
|
+
*/
|
|
255
|
+
displayLabel(semantics) {
|
|
256
|
+
if (semantics.channel === null) {
|
|
257
|
+
return `bus:${semantics.messageBus} (channel named at runtime)`;
|
|
258
|
+
}
|
|
259
|
+
return `bus:${semantics.messageBus} ${semantics.channel}`;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
136
262
|
});
|
|
137
|
-
|
|
138
|
-
|
|
263
|
+
|
|
264
|
+
// src/semantics/rest.ts
|
|
265
|
+
var import_zod5 = require("zod");
|
|
266
|
+
var RestSemanticsSchema = import_zod5.z.object({
|
|
267
|
+
name: import_zod5.z.literal("rest"),
|
|
268
|
+
/**
|
|
269
|
+
* Uppercase HTTP method ("GET", "POST", …), `"*"` for a handler that
|
|
270
|
+
* responds to every method, or null when this source does not say
|
|
271
|
+
* which method.
|
|
272
|
+
*/
|
|
273
|
+
method: import_zod5.z.string().min(1).nullable(),
|
|
274
|
+
/** Normalized route path ("/users/{id}"), or null when this source does not give one. */
|
|
275
|
+
path: import_zod5.z.string().min(1).nullable(),
|
|
276
|
+
/**
|
|
277
|
+
* Status codes the producing source explicitly declared (OpenAPI
|
|
278
|
+
* responses, CFN MethodResponses, ts-rest router statuses). They are
|
|
279
|
+
* kept here so the pairing layer can see them without unwrapping any
|
|
280
|
+
* metadata. Absent, or empty, for a source that was inferred.
|
|
281
|
+
*/
|
|
282
|
+
declaredResponses: import_zod5.z.array(import_zod5.z.number()).optional()
|
|
283
|
+
});
|
|
284
|
+
function normalizePath(path) {
|
|
285
|
+
let normalized = path.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
|
|
286
|
+
if (normalized.length > 1 && normalized.endsWith("/")) {
|
|
287
|
+
normalized = normalized.slice(0, -1);
|
|
288
|
+
}
|
|
289
|
+
normalized = normalized.replace(
|
|
290
|
+
/\{[^}]+\}|[^{]+/g,
|
|
291
|
+
(segment) => segment.startsWith("{") ? segment : segment.toLowerCase()
|
|
292
|
+
);
|
|
293
|
+
return normalized;
|
|
294
|
+
}
|
|
295
|
+
function methodsAgree(a, b) {
|
|
296
|
+
if (a === null || b === null) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return a === b || a === "*" || b === "*";
|
|
300
|
+
}
|
|
301
|
+
function routePathRegex(pattern) {
|
|
302
|
+
const source = pattern.split(/(\{[^}]+\}|\*)/g).map((part) => {
|
|
303
|
+
if (part === "*") {
|
|
304
|
+
return ".*";
|
|
305
|
+
}
|
|
306
|
+
if (part.startsWith("{") && part.endsWith("}")) {
|
|
307
|
+
return "[^/]+";
|
|
308
|
+
}
|
|
309
|
+
return part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
310
|
+
}).join("");
|
|
311
|
+
return new RegExp(`^${source}$`);
|
|
312
|
+
}
|
|
313
|
+
function routePathAdmits(declaredPath, requestPath) {
|
|
314
|
+
return routePathRegex(normalizePath(declaredPath)).test(
|
|
315
|
+
normalizePath(requestPath)
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
var restSemantics = defineBoundarySemantics({
|
|
319
|
+
name: "rest",
|
|
320
|
+
schema: RestSemanticsSchema,
|
|
321
|
+
behavior: {
|
|
322
|
+
/** A request goes out, a status and a body come back. */
|
|
323
|
+
exchangesHttpResponses: true,
|
|
324
|
+
reportsUnpairedItself: false,
|
|
325
|
+
/** `"METHOD /normalized/path"`, or null when either half is missing. */
|
|
326
|
+
identityKey(semantics) {
|
|
327
|
+
if (semantics.method === null || semantics.path === null) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
return `${semantics.method.toUpperCase()} ${normalizePath(semantics.path)}`;
|
|
331
|
+
},
|
|
332
|
+
/**
|
|
333
|
+
* The bucket has only the path in it, so a `"*"` route lands with
|
|
334
|
+
* the consumers that each specify a method, and `methodsAgree`
|
|
335
|
+
* settles it inside the bucket. The identity key stays what a reader
|
|
336
|
+
* sees and a suppression targets ("GET /users", "* /users"), and
|
|
337
|
+
* this key groups what a reader still tells apart.
|
|
338
|
+
*/
|
|
339
|
+
pairingKey(semantics) {
|
|
340
|
+
if (semantics.method === null || semantics.path === null) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
return `rest ${normalizePath(semantics.path)}`;
|
|
344
|
+
},
|
|
345
|
+
sidesAgree(a, b) {
|
|
346
|
+
return methodsAgree(a.method, b.method);
|
|
347
|
+
},
|
|
348
|
+
/**
|
|
349
|
+
* What the identity key says, with a missing half still readable:
|
|
350
|
+
* ANY when no method was stated, and ? when no path was. Null when
|
|
351
|
+
* neither was stated, because then there is nothing to show.
|
|
352
|
+
*/
|
|
353
|
+
displayLabel(semantics) {
|
|
354
|
+
if (semantics.method === null && semantics.path === null) {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
const method = semantics.method === null ? "ANY" : semantics.method.toUpperCase();
|
|
358
|
+
const path = semantics.path === null ? "?" : normalizePath(semantics.path);
|
|
359
|
+
return `${method} ${path}`;
|
|
360
|
+
},
|
|
361
|
+
/**
|
|
362
|
+
* A route with both halves stated decides for itself: the method
|
|
363
|
+
* through `methodsAgree` (so a `"*"` route matches every method),
|
|
364
|
+
* and the path through `routePathAdmits`. A route missing either
|
|
365
|
+
* half might still be the one that handles the request, and nothing
|
|
366
|
+
* here can settle that, so it abstains instead of refusing.
|
|
367
|
+
*/
|
|
368
|
+
servesRequest(semantics, method, path) {
|
|
369
|
+
if (semantics.method === null || semantics.path === null) {
|
|
370
|
+
return "unknown";
|
|
371
|
+
}
|
|
372
|
+
if (!methodsAgree(semantics.method, method.toUpperCase())) {
|
|
373
|
+
return "nomatch";
|
|
374
|
+
}
|
|
375
|
+
return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
|
|
376
|
+
},
|
|
377
|
+
ruleBoundary: {
|
|
378
|
+
// "METHOD /path": one leading token, then an absolute path.
|
|
379
|
+
claims(raw) {
|
|
380
|
+
return /^\S+ +\//.test(raw.trim());
|
|
381
|
+
},
|
|
382
|
+
normalize(raw) {
|
|
383
|
+
const trimmed = raw.trim();
|
|
384
|
+
const spaceIdx = trimmed.indexOf(" ");
|
|
385
|
+
const method = trimmed.slice(0, spaceIdx).toUpperCase();
|
|
386
|
+
return `${method} ${normalizePath(trimmed.slice(spaceIdx + 1).trim())}`;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
// src/semantics/runtimeConfig.ts
|
|
393
|
+
var import_zod7 = require("zod");
|
|
394
|
+
|
|
395
|
+
// src/deployableUnit.ts
|
|
396
|
+
var import_zod6 = require("zod");
|
|
397
|
+
var DeployableUnitSchema = import_zod6.z.object({
|
|
398
|
+
deploymentTarget: import_zod6.z.enum([
|
|
139
399
|
"lambda",
|
|
140
400
|
"ecs-task",
|
|
141
401
|
"container",
|
|
142
402
|
"k8s-deployment"
|
|
143
403
|
]),
|
|
144
404
|
// An empty name would agree with every other empty name, so a unit
|
|
145
|
-
//
|
|
146
|
-
instanceName:
|
|
405
|
+
// with no name has to leave the field off instead.
|
|
406
|
+
instanceName: import_zod6.z.string().min(1)
|
|
147
407
|
});
|
|
408
|
+
|
|
409
|
+
// src/semantics/runtimeConfig.ts
|
|
148
410
|
var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
|
|
149
|
-
name:
|
|
411
|
+
name: import_zod7.z.literal("runtime-config")
|
|
412
|
+
});
|
|
413
|
+
var runtimeConfigSemantics = defineBoundarySemantics({
|
|
414
|
+
name: "runtime-config",
|
|
415
|
+
schema: RuntimeConfigSemanticsSchema,
|
|
416
|
+
behavior: {
|
|
417
|
+
/** A process reads its config at startup, and nothing replies. */
|
|
418
|
+
exchangesHttpResponses: false,
|
|
419
|
+
reportsUnpairedItself: false,
|
|
420
|
+
identityKey: () => null
|
|
421
|
+
}
|
|
150
422
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
423
|
+
|
|
424
|
+
// src/semantics/storageRelational.ts
|
|
425
|
+
var import_zod8 = require("zod");
|
|
426
|
+
var StorageRelationalSemanticsSchema = import_zod8.z.object({
|
|
427
|
+
name: import_zod8.z.literal("storage-relational"),
|
|
428
|
+
storageSystem: import_zod8.z.enum(["postgres", "mysql", "sqlite"]),
|
|
154
429
|
/**
|
|
155
|
-
* ORM
|
|
156
|
-
*
|
|
430
|
+
* The ORM or driver scope. A single-database setup uses `"default"`,
|
|
431
|
+
* and a monorepo with several schemas gives each one its own value.
|
|
157
432
|
*/
|
|
158
|
-
scope:
|
|
159
|
-
/**
|
|
160
|
-
table:
|
|
433
|
+
scope: import_zod8.z.string(),
|
|
434
|
+
/** The table or model name, as declared in the schema. */
|
|
435
|
+
table: import_zod8.z.string()
|
|
161
436
|
});
|
|
162
|
-
var
|
|
163
|
-
name:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
437
|
+
var storageRelationalSemantics = defineBoundarySemantics({
|
|
438
|
+
name: "storage-relational",
|
|
439
|
+
schema: StorageRelationalSemanticsSchema,
|
|
440
|
+
behavior: {
|
|
441
|
+
/** A query returns rows, not a status and a body. */
|
|
442
|
+
exchangesHttpResponses: false,
|
|
443
|
+
reportsUnpairedItself: false,
|
|
444
|
+
identityKey: () => null
|
|
445
|
+
}
|
|
167
446
|
});
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
447
|
+
|
|
448
|
+
// src/semantics/registry.ts
|
|
449
|
+
var SemanticsSchema = import_zod9.z.discriminatedUnion("name", [
|
|
450
|
+
restSemantics.schema,
|
|
451
|
+
functionCallSemantics.schema,
|
|
452
|
+
graphqlResolverSemantics.schema,
|
|
453
|
+
graphqlOperationSemantics.schema,
|
|
454
|
+
runtimeConfigSemantics.schema,
|
|
455
|
+
storageRelationalSemantics.schema,
|
|
456
|
+
messageBusSemantics.schema
|
|
457
|
+
]);
|
|
458
|
+
var DEFINITIONS = [
|
|
459
|
+
restSemantics,
|
|
460
|
+
functionCallSemantics,
|
|
461
|
+
graphqlResolverSemantics,
|
|
462
|
+
graphqlOperationSemantics,
|
|
463
|
+
runtimeConfigSemantics,
|
|
464
|
+
storageRelationalSemantics,
|
|
465
|
+
messageBusSemantics
|
|
466
|
+
];
|
|
467
|
+
var BY_NAME = new Map(
|
|
468
|
+
DEFINITIONS.map((d) => [d.name, d])
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
// src/schemas.ts
|
|
472
|
+
var ConfidenceSourceSchema = import_zod10.z.enum([
|
|
473
|
+
"inferred_static",
|
|
474
|
+
"inferred_ai",
|
|
475
|
+
"declared",
|
|
476
|
+
"derived"
|
|
176
477
|
]);
|
|
177
|
-
var
|
|
178
|
-
|
|
478
|
+
var ConfidenceLevelSchema = import_zod10.z.enum(["high", "medium", "low"]);
|
|
479
|
+
var CorroborationSchema = import_zod10.z.object({
|
|
480
|
+
outcome: import_zod10.z.enum(["observed", "refuted", "untested"]),
|
|
481
|
+
/** Executions that produced a verdict for this claim. */
|
|
482
|
+
runs: import_zod10.z.number(),
|
|
483
|
+
/** Present when refuted: the input and observation that disagreed. */
|
|
484
|
+
counterexample: import_zod10.z.unknown().optional(),
|
|
485
|
+
/** Present when untested: why no verdict was reachable. */
|
|
486
|
+
reason: import_zod10.z.string().optional()
|
|
487
|
+
});
|
|
488
|
+
var ConfidenceInfoSchema = import_zod10.z.object({
|
|
489
|
+
source: ConfidenceSourceSchema,
|
|
490
|
+
level: ConfidenceLevelSchema,
|
|
491
|
+
corroboration: CorroborationSchema.optional()
|
|
492
|
+
});
|
|
493
|
+
var SourceLocationSchema = import_zod10.z.object({
|
|
494
|
+
file: import_zod10.z.string(),
|
|
495
|
+
range: import_zod10.z.object({ start: import_zod10.z.number(), end: import_zod10.z.number() }),
|
|
496
|
+
exportName: import_zod10.z.string().nullable(),
|
|
497
|
+
/**
|
|
498
|
+
* The project the extract was pointed at, by the name that project
|
|
499
|
+
* calls itself.
|
|
500
|
+
*
|
|
501
|
+
* Paths are relative to wherever the extract ran, so two services in
|
|
502
|
+
* one repository both report `src/handlers.ts`, and merging their
|
|
503
|
+
* summaries puts them on top of each other. This field is what tells
|
|
504
|
+
* them apart, and what a reader groups by.
|
|
505
|
+
*/
|
|
506
|
+
workspace: import_zod10.z.string().optional()
|
|
507
|
+
});
|
|
508
|
+
var BoundaryBindingSchema = import_zod10.z.object({
|
|
509
|
+
transport: import_zod10.z.string(),
|
|
179
510
|
semantics: SemanticsSchema,
|
|
180
|
-
recognition:
|
|
511
|
+
recognition: import_zod10.z.string()
|
|
181
512
|
});
|
|
182
513
|
function typeDefinitionKey(ref) {
|
|
183
514
|
return ref.def ?? null;
|
|
184
515
|
}
|
|
185
|
-
var TypeShapeSchema =
|
|
186
|
-
() =>
|
|
187
|
-
|
|
188
|
-
type:
|
|
189
|
-
properties:
|
|
190
|
-
spreads:
|
|
516
|
+
var TypeShapeSchema = import_zod10.z.lazy(
|
|
517
|
+
() => import_zod10.z.discriminatedUnion("type", [
|
|
518
|
+
import_zod10.z.object({
|
|
519
|
+
type: import_zod10.z.literal("record"),
|
|
520
|
+
properties: import_zod10.z.record(import_zod10.z.string(), TypeShapeSchema),
|
|
521
|
+
spreads: import_zod10.z.array(import_zod10.z.object({ sourceText: import_zod10.z.string() })).optional()
|
|
191
522
|
}),
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
type:
|
|
196
|
-
value:
|
|
197
|
-
raw:
|
|
523
|
+
import_zod10.z.object({ type: import_zod10.z.literal("dictionary"), values: TypeShapeSchema }),
|
|
524
|
+
import_zod10.z.object({ type: import_zod10.z.literal("array"), items: TypeShapeSchema }),
|
|
525
|
+
import_zod10.z.object({
|
|
526
|
+
type: import_zod10.z.literal("literal"),
|
|
527
|
+
value: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number(), import_zod10.z.boolean()]),
|
|
528
|
+
raw: import_zod10.z.string().optional()
|
|
198
529
|
}),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
type:
|
|
207
|
-
variants:
|
|
530
|
+
import_zod10.z.object({ type: import_zod10.z.literal("text") }),
|
|
531
|
+
import_zod10.z.object({ type: import_zod10.z.literal("integer") }),
|
|
532
|
+
import_zod10.z.object({ type: import_zod10.z.literal("number") }),
|
|
533
|
+
import_zod10.z.object({ type: import_zod10.z.literal("boolean") }),
|
|
534
|
+
import_zod10.z.object({ type: import_zod10.z.literal("null") }),
|
|
535
|
+
import_zod10.z.object({ type: import_zod10.z.literal("undefined") }),
|
|
536
|
+
import_zod10.z.object({
|
|
537
|
+
type: import_zod10.z.literal("union"),
|
|
538
|
+
variants: import_zod10.z.array(TypeShapeSchema)
|
|
208
539
|
}),
|
|
209
|
-
|
|
210
|
-
type:
|
|
211
|
-
name:
|
|
212
|
-
from:
|
|
213
|
-
def:
|
|
540
|
+
import_zod10.z.object({
|
|
541
|
+
type: import_zod10.z.literal("ref"),
|
|
542
|
+
name: import_zod10.z.string(),
|
|
543
|
+
from: import_zod10.z.string().optional(),
|
|
544
|
+
def: import_zod10.z.string().optional()
|
|
214
545
|
}),
|
|
215
|
-
|
|
546
|
+
import_zod10.z.object({ type: import_zod10.z.literal("unknown") })
|
|
216
547
|
])
|
|
217
548
|
);
|
|
218
549
|
var MAX_DEFINITION_DEPTH = 6;
|