@suss/ir-core 0.33.0 → 0.34.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 +30 -30
- package/dist/{chunk-N564FH5U.js → chunk-WOXA5GBL.js} +251 -208
- package/dist/index.cjs +335 -248
- package/dist/index.d.cts +399 -355
- package/dist/index.d.ts +399 -355
- package/dist/index.js +68 -26
- package/dist/{schemas-CIns0fqF.d.cts → schemas-CghZNwSE.d.cts} +88 -81
- package/dist/{schemas-CIns0fqF.d.ts → schemas-CghZNwSE.d.ts} +88 -81
- package/dist/schemas.cjs +248 -208
- package/dist/schemas.d.cts +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/package.json +2 -2
package/dist/schemas.cjs
CHANGED
|
@@ -40,10 +40,10 @@ __export(schemas_exports, {
|
|
|
40
40
|
withDefinitionsInlined: () => withDefinitionsInlined
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(schemas_exports);
|
|
43
|
-
var
|
|
43
|
+
var import_zod13 = require("zod");
|
|
44
44
|
|
|
45
45
|
// src/semantics/registry.ts
|
|
46
|
-
var
|
|
46
|
+
var import_zod12 = require("zod");
|
|
47
47
|
|
|
48
48
|
// src/semantics/functionCall.ts
|
|
49
49
|
var import_zod = require("zod");
|
|
@@ -64,6 +64,9 @@ function unitIdentityKey(deploymentTarget, instanceName) {
|
|
|
64
64
|
function metricIdentityKey(metricSystem, metricType) {
|
|
65
65
|
return `metric:${metricSystem} ${metricType}`;
|
|
66
66
|
}
|
|
67
|
+
function ioIdentityKey(target) {
|
|
68
|
+
return `io:${target}`;
|
|
69
|
+
}
|
|
67
70
|
|
|
68
71
|
// src/semantics/definition.ts
|
|
69
72
|
function defineBoundarySemantics(definition) {
|
|
@@ -74,10 +77,11 @@ function defineBoundarySemantics(definition) {
|
|
|
74
77
|
var FunctionCallSemanticsSchema = import_zod.z.object({
|
|
75
78
|
name: import_zod.z.literal("function-call"),
|
|
76
79
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* module path
|
|
80
|
-
*
|
|
80
|
+
* Where the function lives inside this repository. It is either the
|
|
81
|
+
* name of a module the project lists in `suss.json`, such as
|
|
82
|
+
* `"billing"`, or a module path, such as the file a server action is
|
|
83
|
+
* written in. A name has no separator in it and a path always does.
|
|
84
|
+
* Packs that don't do cross-module pairing can leave it unset.
|
|
81
85
|
*/
|
|
82
86
|
module: import_zod.z.string().optional(),
|
|
83
87
|
/** Named export within the module, when applicable. */
|
|
@@ -102,35 +106,38 @@ var FunctionCallSemanticsSchema = import_zod.z.object({
|
|
|
102
106
|
*/
|
|
103
107
|
exportPath: import_zod.z.array(import_zod.z.string()).optional()
|
|
104
108
|
});
|
|
109
|
+
function isModuleName(module2) {
|
|
110
|
+
return !module2.includes("/") && !module2.includes("\\");
|
|
111
|
+
}
|
|
105
112
|
var functionCallSemantics = defineBoundarySemantics({
|
|
106
113
|
name: "function-call",
|
|
107
114
|
schema: FunctionCallSemanticsSchema,
|
|
108
|
-
// A call
|
|
109
|
-
//
|
|
115
|
+
// A call inside the process does not produce a span, and the
|
|
116
|
+
// conventions have no attributes for it.
|
|
110
117
|
semconv: {},
|
|
111
118
|
behavior: {
|
|
112
|
-
/** A call returns a value,
|
|
119
|
+
/** A call returns a value, with no status. */
|
|
113
120
|
exchangesHttpResponses: false,
|
|
114
121
|
leavesTheProcess: false,
|
|
115
122
|
reportsUnpairedItself: false,
|
|
116
123
|
/**
|
|
117
|
-
* In-repo units
|
|
118
|
-
*
|
|
119
|
-
*
|
|
124
|
+
* In-repo units such as components have no key on purpose. They
|
|
125
|
+
* pair through call edges instead of the keyed pass, so a missing
|
|
126
|
+
* key does not make them unreachable.
|
|
120
127
|
*/
|
|
121
128
|
canPair: () => true,
|
|
122
|
-
/**
|
|
123
|
-
* `"fn:<package>::<exportPath>"` when both are set, and
|
|
124
|
-
* `"fn:<module>::<exportName>"` for an in-repo unit that states its
|
|
125
|
-
* module, the way a server action does. Components and bare
|
|
126
|
-
* handlers state neither and have no key at all.
|
|
127
|
-
*/
|
|
128
129
|
rewritePaths(semantics, rewrite) {
|
|
129
|
-
if (semantics.module === void 0) {
|
|
130
|
+
if (semantics.module === void 0 || isModuleName(semantics.module)) {
|
|
130
131
|
return semantics;
|
|
131
132
|
}
|
|
132
133
|
return { ...semantics, module: rewrite(semantics.module) };
|
|
133
134
|
},
|
|
135
|
+
/**
|
|
136
|
+
* `"fn:<package>::<exportPath>"` when both are set, and
|
|
137
|
+
* `"fn:<module>::<exportName>"` for an in-repo unit that gives its
|
|
138
|
+
* module, as a server action does. Components and plain handlers
|
|
139
|
+
* give neither and have no key.
|
|
140
|
+
*/
|
|
134
141
|
identityKey(semantics) {
|
|
135
142
|
if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
|
|
136
143
|
return fnIdentityKey(semantics.package, semantics.exportPath);
|
|
@@ -161,15 +168,15 @@ var graphqlOperationSemantics = defineBoundarySemantics({
|
|
|
161
168
|
behavior: {
|
|
162
169
|
/**
|
|
163
170
|
* An operation gets a data-and-errors document back, which the
|
|
164
|
-
* GraphQL contract checker reads. Status codes
|
|
171
|
+
* GraphQL contract checker reads. Status codes do not apply.
|
|
165
172
|
*/
|
|
166
173
|
exchangesHttpResponses: false,
|
|
167
174
|
leavesTheProcess: true,
|
|
168
175
|
reportsUnpairedItself: false,
|
|
169
176
|
identityKey: () => null,
|
|
170
|
-
/**
|
|
177
|
+
/** No key on purpose. The dedicated pass pairs an operation by its document. */
|
|
171
178
|
canPair: () => true,
|
|
172
|
-
/**
|
|
179
|
+
/** `query GetUser`. Only for display, since the contract checker does the pairing. */
|
|
173
180
|
displayLabel(semantics) {
|
|
174
181
|
return `${semantics.operationType} ${semantics.operationName ?? "<anonymous>"}`;
|
|
175
182
|
}
|
|
@@ -192,14 +199,14 @@ var GraphqlResolverSemanticsSchema = import_zod3.z.object({
|
|
|
192
199
|
var graphqlResolverSemantics = defineBoundarySemantics({
|
|
193
200
|
name: "graphql-resolver",
|
|
194
201
|
schema: GraphqlResolverSemanticsSchema,
|
|
195
|
-
// The conventions
|
|
196
|
-
// resolver the server ran for one field of it.
|
|
202
|
+
// The conventions describe the operation a client sent. They have no
|
|
203
|
+
// attribute for the resolver the server ran for one field of it.
|
|
197
204
|
semconv: {},
|
|
198
205
|
behavior: {
|
|
199
|
-
/** A resolver returns a field value,
|
|
206
|
+
/** A resolver returns a field value, with no status. */
|
|
200
207
|
exchangesHttpResponses: false,
|
|
201
|
-
// A
|
|
202
|
-
// server calls
|
|
208
|
+
// A resolver runs because a client outside the process sent a query,
|
|
209
|
+
// even though the server calls it in its own process.
|
|
203
210
|
leavesTheProcess: true,
|
|
204
211
|
reportsUnpairedItself: false,
|
|
205
212
|
/**
|
|
@@ -216,8 +223,32 @@ var graphqlResolverSemantics = defineBoundarySemantics({
|
|
|
216
223
|
}
|
|
217
224
|
});
|
|
218
225
|
|
|
219
|
-
// src/semantics/
|
|
226
|
+
// src/semantics/io.ts
|
|
220
227
|
var import_zod4 = require("zod");
|
|
228
|
+
var IoSemanticsSchema = import_zod4.z.object({
|
|
229
|
+
name: import_zod4.z.literal("io"),
|
|
230
|
+
/** The stream, such as `stdout` or `stderr`. Null when the source does not say which. */
|
|
231
|
+
target: import_zod4.z.string().nullable()
|
|
232
|
+
});
|
|
233
|
+
var ioSemantics = defineBoundarySemantics({
|
|
234
|
+
name: "io",
|
|
235
|
+
schema: IoSemanticsSchema,
|
|
236
|
+
// The semantic conventions have no attribute for a process's own streams.
|
|
237
|
+
semconv: {},
|
|
238
|
+
behavior: {
|
|
239
|
+
exchangesHttpResponses: false,
|
|
240
|
+
leavesTheProcess: true,
|
|
241
|
+
reportsUnpairedItself: false,
|
|
242
|
+
identityKey(semantics) {
|
|
243
|
+
return semantics.target === null ? null : ioIdentityKey(semantics.target);
|
|
244
|
+
},
|
|
245
|
+
// Nothing declares the reading side, so a write has nothing to meet.
|
|
246
|
+
canPair: () => false
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// src/semantics/messageBus.ts
|
|
251
|
+
var import_zod5 = require("zod");
|
|
221
252
|
|
|
222
253
|
// src/channel.ts
|
|
223
254
|
function parseChannel(channel) {
|
|
@@ -237,12 +268,11 @@ function channelsPair(a, b) {
|
|
|
237
268
|
}
|
|
238
269
|
|
|
239
270
|
// src/semantics/messageBus.ts
|
|
240
|
-
var MessageBusSemanticsSchema =
|
|
241
|
-
name:
|
|
242
|
-
messageBus:
|
|
243
|
-
// The conventions
|
|
244
|
-
// underscore and one with a dot
|
|
245
|
-
// not a typo.
|
|
271
|
+
var MessageBusSemanticsSchema = import_zod5.z.object({
|
|
272
|
+
name: import_zod5.z.literal("message-bus"),
|
|
273
|
+
messageBus: import_zod5.z.enum([
|
|
274
|
+
// The conventions write these two AWS buses differently, one with an
|
|
275
|
+
// underscore and one with a dot. Both are as the conventions give them.
|
|
246
276
|
"aws_sqs",
|
|
247
277
|
"aws.sns",
|
|
248
278
|
"s3",
|
|
@@ -261,12 +291,13 @@ var MessageBusSemanticsSchema = import_zod4.z.object({
|
|
|
261
291
|
"cloudflare-tail"
|
|
262
292
|
]),
|
|
263
293
|
/**
|
|
264
|
-
*
|
|
265
|
-
* a subject pattern, or `bus#detailType`. Null when this
|
|
266
|
-
* not say which channel, as with a send whose queue the
|
|
267
|
-
*
|
|
294
|
+
* A stable channel identifier: a CloudFormation logical id, a queue or
|
|
295
|
+
* topic name, a subject pattern, or `bus#detailType`. Null when this
|
|
296
|
+
* source does not say which channel, as with a send whose queue the
|
|
297
|
+
* code picks at run time, or a receive whose queue is set in the
|
|
298
|
+
* event-source mapping.
|
|
268
299
|
*/
|
|
269
|
-
channel:
|
|
300
|
+
channel: import_zod5.z.string().min(1).nullable()
|
|
270
301
|
});
|
|
271
302
|
var messageBusSemantics = defineBoundarySemantics({
|
|
272
303
|
name: "message-bus",
|
|
@@ -280,25 +311,26 @@ var messageBusSemantics = defineBoundarySemantics({
|
|
|
280
311
|
exchangesHttpResponses: false,
|
|
281
312
|
leavesTheProcess: true,
|
|
282
313
|
/**
|
|
283
|
-
* `checkMessageBus`
|
|
284
|
-
*
|
|
314
|
+
* `checkMessageBus` reports every channel, unused ones included, so
|
|
315
|
+
* the generic unmatched list leaves them out.
|
|
285
316
|
*/
|
|
286
317
|
reportsUnpairedItself: true,
|
|
287
318
|
/**
|
|
288
|
-
* A channel
|
|
289
|
-
*
|
|
290
|
-
* channel
|
|
319
|
+
* A channel that is null here can still pair. The dedicated pass
|
|
320
|
+
* follows environment variable chains before comparing, so a
|
|
321
|
+
* consumer whose channel is set at run time meets the template that
|
|
322
|
+
* declares it.
|
|
291
323
|
*/
|
|
292
324
|
canPair: () => true,
|
|
293
325
|
/**
|
|
294
326
|
* `"bus:<messageBus> <subject>"`, or null when the channel is null
|
|
295
327
|
* or its subject is empty.
|
|
296
328
|
*
|
|
297
|
-
* The key has the subject
|
|
298
|
-
*
|
|
329
|
+
* The key has the subject and leaves out the bus, so a template
|
|
330
|
+
* writing `default#order.placed` and a handler writing
|
|
299
331
|
* `order.placed` land in one bucket, where `sidesAgree` compares the
|
|
300
|
-
* buses.
|
|
301
|
-
*
|
|
332
|
+
* buses. Keying on the bus would separate a side that cannot know
|
|
333
|
+
* its bus from the side that can.
|
|
302
334
|
*
|
|
303
335
|
* The bus technology stays in, because a queue and an event router
|
|
304
336
|
* are different destinations even with the same subject. Case stays
|
|
@@ -321,9 +353,9 @@ var messageBusSemantics = defineBoundarySemantics({
|
|
|
321
353
|
return channelsPair(a.channel, b.channel);
|
|
322
354
|
},
|
|
323
355
|
/**
|
|
324
|
-
* The whole channel, bus included,
|
|
325
|
-
*
|
|
326
|
-
*
|
|
356
|
+
* The whole channel, bus included, where the identity key has only
|
|
357
|
+
* the subject. A reader looking at unmatched channels needs to see
|
|
358
|
+
* which bus each one was on.
|
|
327
359
|
*/
|
|
328
360
|
displayLabel(semantics) {
|
|
329
361
|
if (semantics.channel === null) {
|
|
@@ -335,25 +367,25 @@ var messageBusSemantics = defineBoundarySemantics({
|
|
|
335
367
|
});
|
|
336
368
|
|
|
337
369
|
// src/semantics/metric.ts
|
|
338
|
-
var
|
|
339
|
-
var MetricSemanticsSchema =
|
|
340
|
-
name:
|
|
341
|
-
/**
|
|
342
|
-
metricSystem:
|
|
370
|
+
var import_zod6 = require("zod");
|
|
371
|
+
var MetricSemanticsSchema = import_zod6.z.object({
|
|
372
|
+
name: import_zod6.z.literal("metric"),
|
|
373
|
+
/** The system the series is stored in, such as `cloud-monitoring` or `cloudwatch`. */
|
|
374
|
+
metricSystem: import_zod6.z.string(),
|
|
343
375
|
/**
|
|
344
|
-
* The type string the system
|
|
345
|
-
* both sides
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
376
|
+
* The type string the system uses for the metric, written the same
|
|
377
|
+
* way on both sides. Null when the reader could not work the string
|
|
378
|
+
* out, as with a query it could not parse. A null type pairs with
|
|
379
|
+
* nothing, so it cannot pair with an unrelated metric that happens to
|
|
380
|
+
* share its source text.
|
|
349
381
|
*/
|
|
350
|
-
metricType:
|
|
382
|
+
metricType: import_zod6.z.string().nullable()
|
|
351
383
|
});
|
|
352
384
|
var metricSemantics = defineBoundarySemantics({
|
|
353
385
|
name: "metric",
|
|
354
386
|
schema: MetricSemanticsSchema,
|
|
355
|
-
// OpenTelemetry
|
|
356
|
-
// attribute for the system
|
|
387
|
+
// OpenTelemetry identifies a metric by its instrument name. It has no
|
|
388
|
+
// attribute for the metric's system or its type string.
|
|
357
389
|
semconv: {},
|
|
358
390
|
behavior: {
|
|
359
391
|
exchangesHttpResponses: false,
|
|
@@ -369,7 +401,7 @@ var metricSemantics = defineBoundarySemantics({
|
|
|
369
401
|
});
|
|
370
402
|
|
|
371
403
|
// src/semantics/rest.ts
|
|
372
|
-
var
|
|
404
|
+
var import_zod7 = require("zod");
|
|
373
405
|
|
|
374
406
|
// src/boundaryName.ts
|
|
375
407
|
var HOLE_SPLIT = /(\{[^}]*\})/;
|
|
@@ -600,23 +632,23 @@ function compareRanks(a, b) {
|
|
|
600
632
|
}
|
|
601
633
|
|
|
602
634
|
// src/semantics/rest.ts
|
|
603
|
-
var RestSemanticsSchema =
|
|
604
|
-
name:
|
|
635
|
+
var RestSemanticsSchema = import_zod7.z.object({
|
|
636
|
+
name: import_zod7.z.literal("rest"),
|
|
605
637
|
/**
|
|
606
638
|
* Uppercase HTTP method ("GET", "POST", …), `"*"` for a handler that
|
|
607
639
|
* responds to every method, or null when this source does not say
|
|
608
640
|
* which method.
|
|
609
641
|
*/
|
|
610
|
-
method:
|
|
642
|
+
method: import_zod7.z.string().min(1).nullable(),
|
|
611
643
|
/** Normalized route path ("/users/{id}"), or null when this source does not give one. */
|
|
612
|
-
path:
|
|
644
|
+
path: import_zod7.z.string().min(1).nullable(),
|
|
613
645
|
/**
|
|
614
|
-
* Status codes the producing source explicitly
|
|
615
|
-
* responses
|
|
616
|
-
*
|
|
617
|
-
* metadata. Absent
|
|
646
|
+
* Status codes the producing source declared explicitly, such as
|
|
647
|
+
* OpenAPI responses or CloudFormation MethodResponses. They are kept
|
|
648
|
+
* here so the pairing layer can see them without unwrapping any
|
|
649
|
+
* metadata. Absent or empty for an inferred source.
|
|
618
650
|
*/
|
|
619
|
-
declaredResponses:
|
|
651
|
+
declaredResponses: import_zod7.z.array(import_zod7.z.number()).optional()
|
|
620
652
|
});
|
|
621
653
|
var OPENING_HOLE = /^\{([^{}]+)\}(.*)$/;
|
|
622
654
|
function baseUrlReference(semantics) {
|
|
@@ -673,16 +705,15 @@ var restSemantics = defineBoundarySemantics({
|
|
|
673
705
|
return `${semantics.method.toUpperCase()} ${normalizePath(semantics.path)}`;
|
|
674
706
|
},
|
|
675
707
|
/**
|
|
676
|
-
* The bucket has only the path
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
* sees and a suppression targets ("GET /users", "* /users")
|
|
680
|
-
* this key groups what a reader still tells apart.
|
|
708
|
+
* The bucket has only the path, so a `"*"` route lands with the
|
|
709
|
+
* consumers that each give a method, and `methodsAgree` compares the
|
|
710
|
+
* methods inside the bucket. The identity key is still what a reader
|
|
711
|
+
* sees and what a suppression targets ("GET /users", "* /users").
|
|
681
712
|
*
|
|
682
|
-
*
|
|
683
|
-
* `{userId}` where the Express route that serves it
|
|
684
|
-
* both match the same requests
|
|
685
|
-
* boundaries that never
|
|
713
|
+
* Parameter names are dropped too. A hand-written spec writes
|
|
714
|
+
* `{userId}` where the Express route that serves it writes `:id`,
|
|
715
|
+
* and both match the same requests. Pairing on the name would leave
|
|
716
|
+
* two boundaries that never meet.
|
|
686
717
|
*/
|
|
687
718
|
pairingKey(semantics) {
|
|
688
719
|
if (semantics.method === null || semantics.path === null) {
|
|
@@ -703,9 +734,9 @@ var restSemantics = defineBoundarySemantics({
|
|
|
703
734
|
return semantics.path === null ? [] : pathSpecificity(normalizePath(semantics.path));
|
|
704
735
|
},
|
|
705
736
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
737
|
+
* The identity key, with a missing half still readable: `ANY` when
|
|
738
|
+
* the source gave no method, and `?` when it gave no path. Null when
|
|
739
|
+
* both are missing, since then there is nothing to show.
|
|
709
740
|
*/
|
|
710
741
|
displayLabel(semantics) {
|
|
711
742
|
if (semantics.method === null && semantics.path === null) {
|
|
@@ -716,11 +747,11 @@ var restSemantics = defineBoundarySemantics({
|
|
|
716
747
|
return `${method} ${path}`;
|
|
717
748
|
},
|
|
718
749
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
750
|
+
* With both halves present, the method goes through `methodsAgree`
|
|
751
|
+
* (so a `"*"` route matches every method) and the path through
|
|
752
|
+
* `routePathAdmits`. A route missing either half might still handle
|
|
753
|
+
* the request, and this declaration cannot settle that, so the
|
|
754
|
+
* result is `"unknown"`.
|
|
724
755
|
*/
|
|
725
756
|
servesRequest(semantics, method, path) {
|
|
726
757
|
if (semantics.method === null || semantics.path === null) {
|
|
@@ -733,8 +764,8 @@ var restSemantics = defineBoundarySemantics({
|
|
|
733
764
|
},
|
|
734
765
|
/**
|
|
735
766
|
* A route the registration pattern admits is inside it. A route
|
|
736
|
-
*
|
|
737
|
-
*
|
|
767
|
+
* without a path counts as outside, because nothing shows that the
|
|
768
|
+
* pattern covers it.
|
|
738
769
|
*/
|
|
739
770
|
withinScope(semantics, scope) {
|
|
740
771
|
return semantics.path !== null && routePathAdmits(scope, semantics.path);
|
|
@@ -743,16 +774,12 @@ var restSemantics = defineBoundarySemantics({
|
|
|
743
774
|
* A call whose base URL the deployment fills in, resolved to the
|
|
744
775
|
* path it reaches.
|
|
745
776
|
*
|
|
746
|
-
* The source cannot settle this on its own,
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
* Only a hole at the front is a base URL. A hole further along is a
|
|
754
|
-
* route parameter, and `/orders/{id}` means every id rather than a
|
|
755
|
-
* variable somebody set.
|
|
777
|
+
* The source cannot settle this on its own, so the adapter leaves
|
|
778
|
+
* the hole in. `API_BASE` could be `http://backend.internal`, and
|
|
779
|
+
* then the path is `/orders`. It could equally be `/api/v2`, and
|
|
780
|
+
* then the path is `/api/v2/orders`. Filling in the deployed value
|
|
781
|
+
* and reading the path back out gets the right one either way.
|
|
782
|
+
* `baseUrlReference` finds the hole that is the base URL.
|
|
756
783
|
*/
|
|
757
784
|
groundName(semantics, deployment) {
|
|
758
785
|
const reference = baseUrlReference(semantics);
|
|
@@ -769,7 +796,7 @@ var restSemantics = defineBoundarySemantics({
|
|
|
769
796
|
},
|
|
770
797
|
nameReference: baseUrlReference,
|
|
771
798
|
ruleBoundary: {
|
|
772
|
-
// "METHOD /path": one
|
|
799
|
+
// "METHOD /path": one token, a space, then an absolute path.
|
|
773
800
|
claims(raw) {
|
|
774
801
|
return /^\S+ +\//.test(raw.trim());
|
|
775
802
|
},
|
|
@@ -784,12 +811,12 @@ var restSemantics = defineBoundarySemantics({
|
|
|
784
811
|
});
|
|
785
812
|
|
|
786
813
|
// src/semantics/runtimeConfig.ts
|
|
787
|
-
var
|
|
814
|
+
var import_zod9 = require("zod");
|
|
788
815
|
|
|
789
816
|
// src/deployableUnit.ts
|
|
790
|
-
var
|
|
791
|
-
var DeployableUnitSchema =
|
|
792
|
-
deploymentTarget:
|
|
817
|
+
var import_zod8 = require("zod");
|
|
818
|
+
var DeployableUnitSchema = import_zod8.z.object({
|
|
819
|
+
deploymentTarget: import_zod8.z.enum([
|
|
793
820
|
"lambda",
|
|
794
821
|
"ecs-task",
|
|
795
822
|
"container",
|
|
@@ -798,7 +825,7 @@ var DeployableUnitSchema = import_zod7.z.object({
|
|
|
798
825
|
]),
|
|
799
826
|
// An empty name would agree with every other empty name, so a unit
|
|
800
827
|
// with no name has to leave the field off instead.
|
|
801
|
-
instanceName:
|
|
828
|
+
instanceName: import_zod8.z.string().min(1)
|
|
802
829
|
});
|
|
803
830
|
|
|
804
831
|
// src/semantics/runtimeConfig.ts
|
|
@@ -806,14 +833,14 @@ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.partial({
|
|
|
806
833
|
deploymentTarget: true,
|
|
807
834
|
instanceName: true
|
|
808
835
|
}).extend({
|
|
809
|
-
name:
|
|
836
|
+
name: import_zod9.z.literal("runtime-config")
|
|
810
837
|
});
|
|
811
838
|
var runtimeConfigSemantics = defineBoundarySemantics({
|
|
812
839
|
name: "runtime-config",
|
|
813
840
|
schema: RuntimeConfigSemanticsSchema,
|
|
814
|
-
// service.name and cloud.resource_id
|
|
815
|
-
// instanceName is the
|
|
816
|
-
//
|
|
841
|
+
// service.name and cloud.resource_id identify the same deployable, but
|
|
842
|
+
// instanceName is the template's logical id, a different string from
|
|
843
|
+
// both.
|
|
817
844
|
semconv: {},
|
|
818
845
|
behavior: {
|
|
819
846
|
/** A process reads its config at startup, and nothing replies. */
|
|
@@ -822,46 +849,53 @@ var runtimeConfigSemantics = defineBoundarySemantics({
|
|
|
822
849
|
// comes from outside the code.
|
|
823
850
|
leavesTheProcess: true,
|
|
824
851
|
reportsUnpairedItself: false,
|
|
825
|
-
identityKey: () => null
|
|
852
|
+
identityKey: () => null,
|
|
853
|
+
// A reader sees which deployable's environment this is. Code that
|
|
854
|
+
// reads a variable does not say which deployable runs it, so a read
|
|
855
|
+
// has no name.
|
|
856
|
+
displayLabel(semantics) {
|
|
857
|
+
const instance = semantics.instanceName;
|
|
858
|
+
return instance === void 0 ? null : `runtime-config:${instance}`;
|
|
859
|
+
}
|
|
826
860
|
}
|
|
827
861
|
});
|
|
828
862
|
|
|
829
863
|
// src/semantics/storage.ts
|
|
830
|
-
var
|
|
831
|
-
var StorageSemanticsSchema =
|
|
832
|
-
name:
|
|
864
|
+
var import_zod10 = require("zod");
|
|
865
|
+
var StorageSemanticsSchema = import_zod10.z.object({
|
|
866
|
+
name: import_zod10.z.literal("storage"),
|
|
833
867
|
/**
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
837
|
-
* containers can share a name,
|
|
838
|
-
*
|
|
839
|
-
*
|
|
868
|
+
* The storage system: an OpenTelemetry value such as `postgresql` or
|
|
869
|
+
* `aws.dynamodb`, or suss's own word for one the conventions do not
|
|
870
|
+
* cover, such as `s3`. Null when the reader could not work out which
|
|
871
|
+
* system the source uses. Two products' containers can share a name,
|
|
872
|
+
* and this field keeps them apart. The pairing pass decides how to
|
|
873
|
+
* treat a null.
|
|
840
874
|
*/
|
|
841
|
-
storageSystem:
|
|
875
|
+
storageSystem: import_zod10.z.string().nullable(),
|
|
842
876
|
/**
|
|
843
877
|
* The ORM, schema, or deployment scope. A single-database setup uses
|
|
844
878
|
* `"default"`, and a monorepo with several schemas gives each one its
|
|
845
879
|
* own value.
|
|
846
880
|
*/
|
|
847
|
-
scope:
|
|
881
|
+
scope: import_zod10.z.string(),
|
|
848
882
|
/**
|
|
849
|
-
* The table, bucket, collection
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
883
|
+
* The table, bucket, collection or index, as the source declares it.
|
|
884
|
+
* Null when the reader could not work out the container, and a null
|
|
885
|
+
* container pairs with nothing, so it cannot match by accident of
|
|
886
|
+
* shared source text. The string uses the boundary-name syntax (a
|
|
887
|
+
* literal, a pattern with `{}` holes, or a reference), and only
|
|
888
|
+
* `parseBoundaryName` should read it.
|
|
855
889
|
*/
|
|
856
|
-
container:
|
|
890
|
+
container: import_zod10.z.string().nullable(),
|
|
857
891
|
/**
|
|
858
|
-
* A secondary way into the container, a DynamoDB global
|
|
859
|
-
* index or an Elasticsearch alias, each with its own key
|
|
860
|
-
* Null means the container's
|
|
892
|
+
* A secondary way into the container, such as a DynamoDB global
|
|
893
|
+
* secondary index or an Elasticsearch alias, each with its own key
|
|
894
|
+
* fields. Null means the container's primary key. A query through an
|
|
861
895
|
* index and a query through the table are different accesses, so
|
|
862
896
|
* they pair separately.
|
|
863
897
|
*/
|
|
864
|
-
accessPath:
|
|
898
|
+
accessPath: import_zod10.z.string().nullable()
|
|
865
899
|
});
|
|
866
900
|
function containerReference(semantics) {
|
|
867
901
|
return semantics.container === null ? null : referenceFromName(semantics.container);
|
|
@@ -871,21 +905,21 @@ var storageSemantics = defineBoundarySemantics({
|
|
|
871
905
|
schema: StorageSemanticsSchema,
|
|
872
906
|
semconv: {
|
|
873
907
|
storageSystem: { name: "db.system.name" },
|
|
874
|
-
// "default"
|
|
908
|
+
// suss writes "default" when the source did not say which database.
|
|
875
909
|
scope: { name: "db.namespace", placeholderValues: ["default"] },
|
|
876
910
|
container: { name: "db.collection.name" }
|
|
877
|
-
//
|
|
878
|
-
//
|
|
911
|
+
// The conventions have no attribute for a secondary index, so
|
|
912
|
+
// accessPath is left out.
|
|
879
913
|
},
|
|
880
914
|
behavior: {
|
|
881
|
-
/** A query returns rows or items,
|
|
915
|
+
/** A query returns rows or items, with no status. */
|
|
882
916
|
exchangesHttpResponses: false,
|
|
883
917
|
leavesTheProcess: true,
|
|
884
918
|
reportsUnpairedItself: false,
|
|
885
919
|
identityKey: () => null,
|
|
886
920
|
displayLabel: storageLabel,
|
|
887
921
|
/**
|
|
888
|
-
* A container the source
|
|
922
|
+
* A container the source gives as a variable is whatever the
|
|
889
923
|
* deployment sets that variable to. `{SUBSCRIBERS_TABLE}` in the
|
|
890
924
|
* code and `prod-subscribers-v1` in the manifest are one table.
|
|
891
925
|
*/
|
|
@@ -914,9 +948,9 @@ function storageContainerLabel(semantics) {
|
|
|
914
948
|
}
|
|
915
949
|
|
|
916
950
|
// src/semantics/unitInvocation.ts
|
|
917
|
-
var
|
|
951
|
+
var import_zod11 = require("zod");
|
|
918
952
|
var UnitInvocationSemanticsSchema = DeployableUnitSchema.extend({
|
|
919
|
-
name:
|
|
953
|
+
name: import_zod11.z.literal("unit-invocation"),
|
|
920
954
|
instanceName: DeployableUnitSchema.shape.instanceName.nullable()
|
|
921
955
|
});
|
|
922
956
|
function calleeReference(semantics) {
|
|
@@ -946,9 +980,9 @@ var unitInvocationSemantics = defineBoundarySemantics({
|
|
|
946
980
|
*/
|
|
947
981
|
reportsUnpairedItself: false,
|
|
948
982
|
/**
|
|
949
|
-
* A callee the source
|
|
950
|
-
*
|
|
951
|
-
*
|
|
983
|
+
* A callee the source gives only as a variable has no name until the
|
|
984
|
+
* deployment fills it in. It gets no key, since a key built from the
|
|
985
|
+
* variable would pair only with itself.
|
|
952
986
|
*/
|
|
953
987
|
identityKey(semantics) {
|
|
954
988
|
if (semantics.instanceName === null || namesNothing(semantics.instanceName)) {
|
|
@@ -969,11 +1003,10 @@ var unitInvocationSemantics = defineBoundarySemantics({
|
|
|
969
1003
|
);
|
|
970
1004
|
},
|
|
971
1005
|
/**
|
|
972
|
-
* A call that reads its callee's name
|
|
973
|
-
*
|
|
974
|
-
*
|
|
975
|
-
*
|
|
976
|
-
* id and neither side ever writes the other's string.
|
|
1006
|
+
* A call that reads its callee's name from the environment reaches
|
|
1007
|
+
* whichever resource the template wires that variable to. The name
|
|
1008
|
+
* is grounded to the logical id and not the deployed name, because
|
|
1009
|
+
* the invoked unit's own summary is keyed by the logical id.
|
|
977
1010
|
*/
|
|
978
1011
|
groundName(semantics, deployment) {
|
|
979
1012
|
const reference = calleeReference(semantics);
|
|
@@ -988,7 +1021,7 @@ var unitInvocationSemantics = defineBoundarySemantics({
|
|
|
988
1021
|
});
|
|
989
1022
|
|
|
990
1023
|
// src/semantics/registry.ts
|
|
991
|
-
var SemanticsSchema =
|
|
1024
|
+
var SemanticsSchema = import_zod12.z.discriminatedUnion("name", [
|
|
992
1025
|
restSemantics.schema,
|
|
993
1026
|
functionCallSemantics.schema,
|
|
994
1027
|
graphqlResolverSemantics.schema,
|
|
@@ -997,7 +1030,8 @@ var SemanticsSchema = import_zod11.z.discriminatedUnion("name", [
|
|
|
997
1030
|
storageSemantics.schema,
|
|
998
1031
|
messageBusSemantics.schema,
|
|
999
1032
|
metricSemantics.schema,
|
|
1000
|
-
unitInvocationSemantics.schema
|
|
1033
|
+
unitInvocationSemantics.schema,
|
|
1034
|
+
ioSemantics.schema
|
|
1001
1035
|
]);
|
|
1002
1036
|
var DEFINITIONS = [
|
|
1003
1037
|
restSemantics,
|
|
@@ -1008,97 +1042,103 @@ var DEFINITIONS = [
|
|
|
1008
1042
|
storageSemantics,
|
|
1009
1043
|
messageBusSemantics,
|
|
1010
1044
|
metricSemantics,
|
|
1011
|
-
unitInvocationSemantics
|
|
1045
|
+
unitInvocationSemantics,
|
|
1046
|
+
ioSemantics
|
|
1012
1047
|
];
|
|
1013
1048
|
var BY_NAME = new Map(
|
|
1014
1049
|
DEFINITIONS.map((d) => [d.name, d])
|
|
1015
1050
|
);
|
|
1016
1051
|
|
|
1017
1052
|
// src/schemas.ts
|
|
1018
|
-
var ConfidenceSourceSchema =
|
|
1053
|
+
var ConfidenceSourceSchema = import_zod13.z.enum([
|
|
1019
1054
|
"inferred_static",
|
|
1020
1055
|
"inferred_ai",
|
|
1021
1056
|
"declared",
|
|
1022
1057
|
"derived"
|
|
1023
1058
|
]);
|
|
1024
|
-
var ConfidenceLevelSchema =
|
|
1025
|
-
var CorroborationSchema =
|
|
1026
|
-
outcome:
|
|
1059
|
+
var ConfidenceLevelSchema = import_zod13.z.enum(["high", "medium", "low"]);
|
|
1060
|
+
var CorroborationSchema = import_zod13.z.object({
|
|
1061
|
+
outcome: import_zod13.z.enum(["observed", "refuted", "untested"]),
|
|
1027
1062
|
/** Executions that produced a verdict for this claim. */
|
|
1028
|
-
runs:
|
|
1063
|
+
runs: import_zod13.z.number(),
|
|
1029
1064
|
/** Present when refuted: the input and observation that disagreed. */
|
|
1030
|
-
counterexample:
|
|
1065
|
+
counterexample: import_zod13.z.unknown().optional(),
|
|
1031
1066
|
/** Present when untested: why no verdict was reachable. */
|
|
1032
|
-
reason:
|
|
1067
|
+
reason: import_zod13.z.string().optional()
|
|
1033
1068
|
});
|
|
1034
|
-
var ConfidenceInfoSchema =
|
|
1069
|
+
var ConfidenceInfoSchema = import_zod13.z.object({
|
|
1035
1070
|
source: ConfidenceSourceSchema,
|
|
1036
1071
|
level: ConfidenceLevelSchema,
|
|
1037
1072
|
corroboration: CorroborationSchema.optional()
|
|
1038
1073
|
});
|
|
1039
|
-
var SourceLocationSchema =
|
|
1040
|
-
file:
|
|
1074
|
+
var SourceLocationSchema = import_zod13.z.object({
|
|
1075
|
+
file: import_zod13.z.string(),
|
|
1041
1076
|
/** Line numbers, for a person reading the summary or an editor link. */
|
|
1042
|
-
range:
|
|
1077
|
+
range: import_zod13.z.object({ start: import_zod13.z.number(), end: import_zod13.z.number() }),
|
|
1043
1078
|
/**
|
|
1044
|
-
* Character offsets of the unit in its file. Identity and joins
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
* contract artifact's say.
|
|
1079
|
+
* Character offsets of the unit in its file. Identity and joins use
|
|
1080
|
+
* these, because two functions can share a line but never an offset
|
|
1081
|
+
* range. `range` gives the same place in lines. Absent on a summary
|
|
1082
|
+
* with no source position, such as one read from a contract.
|
|
1049
1083
|
*/
|
|
1050
|
-
span:
|
|
1051
|
-
exportName:
|
|
1084
|
+
span: import_zod13.z.object({ start: import_zod13.z.number(), end: import_zod13.z.number() }).optional(),
|
|
1085
|
+
exportName: import_zod13.z.string().nullable(),
|
|
1052
1086
|
/**
|
|
1053
|
-
* The project the extract
|
|
1054
|
-
*
|
|
1087
|
+
* The project the extract ran on, by the name the project gives
|
|
1088
|
+
* itself.
|
|
1055
1089
|
*
|
|
1056
1090
|
* Paths are relative to wherever the extract ran, so two services in
|
|
1057
|
-
* one repository both report `src/handlers.ts`, and merging their
|
|
1058
|
-
* summaries
|
|
1059
|
-
*
|
|
1091
|
+
* one repository can both report `src/handlers.ts`, and merging their
|
|
1092
|
+
* summaries would mix them up. This field tells them apart, and a
|
|
1093
|
+
* reader groups by it.
|
|
1094
|
+
*/
|
|
1095
|
+
workspace: import_zod13.z.string().optional(),
|
|
1096
|
+
/**
|
|
1097
|
+
* The module of the application the unit belongs to, by the name the
|
|
1098
|
+
* project's `suss.json` gives it. Set only when the project lists its
|
|
1099
|
+
* modules, and then on every unit whose file is under a module's root.
|
|
1060
1100
|
*/
|
|
1061
|
-
|
|
1101
|
+
module: import_zod13.z.string().optional()
|
|
1062
1102
|
});
|
|
1063
|
-
var BoundaryBindingSchema =
|
|
1064
|
-
transport:
|
|
1103
|
+
var BoundaryBindingSchema = import_zod13.z.object({
|
|
1104
|
+
transport: import_zod13.z.string(),
|
|
1065
1105
|
semantics: SemanticsSchema,
|
|
1066
|
-
recognition:
|
|
1106
|
+
recognition: import_zod13.z.string()
|
|
1067
1107
|
});
|
|
1068
1108
|
function typeDefinitionKey(ref) {
|
|
1069
1109
|
return ref.def ?? null;
|
|
1070
1110
|
}
|
|
1071
|
-
var TypeShapeSchema =
|
|
1072
|
-
() =>
|
|
1073
|
-
|
|
1074
|
-
type:
|
|
1075
|
-
properties:
|
|
1076
|
-
spreads:
|
|
1111
|
+
var TypeShapeSchema = import_zod13.z.lazy(
|
|
1112
|
+
() => import_zod13.z.discriminatedUnion("type", [
|
|
1113
|
+
import_zod13.z.object({
|
|
1114
|
+
type: import_zod13.z.literal("record"),
|
|
1115
|
+
properties: import_zod13.z.record(import_zod13.z.string(), TypeShapeSchema),
|
|
1116
|
+
spreads: import_zod13.z.array(import_zod13.z.object({ sourceText: import_zod13.z.string() })).optional()
|
|
1077
1117
|
}),
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
type:
|
|
1082
|
-
value:
|
|
1083
|
-
raw:
|
|
1118
|
+
import_zod13.z.object({ type: import_zod13.z.literal("dictionary"), values: TypeShapeSchema }),
|
|
1119
|
+
import_zod13.z.object({ type: import_zod13.z.literal("array"), items: TypeShapeSchema }),
|
|
1120
|
+
import_zod13.z.object({
|
|
1121
|
+
type: import_zod13.z.literal("literal"),
|
|
1122
|
+
value: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number(), import_zod13.z.boolean()]),
|
|
1123
|
+
raw: import_zod13.z.string().optional()
|
|
1084
1124
|
}),
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
type:
|
|
1093
|
-
variants:
|
|
1125
|
+
import_zod13.z.object({ type: import_zod13.z.literal("text") }),
|
|
1126
|
+
import_zod13.z.object({ type: import_zod13.z.literal("integer") }),
|
|
1127
|
+
import_zod13.z.object({ type: import_zod13.z.literal("number") }),
|
|
1128
|
+
import_zod13.z.object({ type: import_zod13.z.literal("boolean") }),
|
|
1129
|
+
import_zod13.z.object({ type: import_zod13.z.literal("null") }),
|
|
1130
|
+
import_zod13.z.object({ type: import_zod13.z.literal("undefined") }),
|
|
1131
|
+
import_zod13.z.object({
|
|
1132
|
+
type: import_zod13.z.literal("union"),
|
|
1133
|
+
variants: import_zod13.z.array(TypeShapeSchema)
|
|
1094
1134
|
}),
|
|
1095
|
-
|
|
1096
|
-
type:
|
|
1097
|
-
name:
|
|
1098
|
-
from:
|
|
1099
|
-
def:
|
|
1135
|
+
import_zod13.z.object({
|
|
1136
|
+
type: import_zod13.z.literal("ref"),
|
|
1137
|
+
name: import_zod13.z.string(),
|
|
1138
|
+
from: import_zod13.z.string().optional(),
|
|
1139
|
+
def: import_zod13.z.string().optional()
|
|
1100
1140
|
}),
|
|
1101
|
-
|
|
1141
|
+
import_zod13.z.object({ type: import_zod13.z.literal("unknown") })
|
|
1102
1142
|
])
|
|
1103
1143
|
);
|
|
1104
1144
|
var MAX_DEFINITION_DEPTH = 6;
|