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