@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/dist/index.js CHANGED
@@ -15,69 +15,63 @@ import {
15
15
  SourceLocationSchema,
16
16
  StorageRelationalSemanticsSchema,
17
17
  TypeShapeSchema,
18
+ allBehaviors,
19
+ behaviorOf,
20
+ busesAgree,
21
+ channelsPair,
22
+ ecsContainerInstanceName,
23
+ formatChannel,
24
+ methodsAgree,
25
+ normalizePath,
26
+ parseChannel,
27
+ routePathAdmits,
18
28
  typeDefinitionKey,
19
29
  withDefinitionsInlined
20
- } from "./chunk-L4XGOS3I.js";
30
+ } from "./chunk-5KE7OWN3.js";
21
31
 
22
- // src/channel.ts
23
- function parseChannel(channel) {
24
- const hash = channel.indexOf("#");
25
- if (hash === -1) {
26
- return { bus: null, subject: channel };
27
- }
28
- return { bus: channel.slice(0, hash), subject: channel.slice(hash + 1) };
32
+ // src/boundaryKey.ts
33
+ function boundaryKey(binding) {
34
+ return behaviorOf(binding.semantics).identityKey(binding.semantics);
29
35
  }
30
- function busesAgree(a, b) {
31
- return a === null || b === null || a === b;
36
+ function pairingKey(binding) {
37
+ const behavior = behaviorOf(binding.semantics);
38
+ return (behavior.pairingKey ?? behavior.identityKey)(binding.semantics);
32
39
  }
33
- function channelsPair(a, b) {
34
- const left = parseChannel(a);
35
- const right = parseChannel(b);
36
- return left.subject === right.subject && busesAgree(left.bus, right.bus);
40
+ function semanticsAgree(a, b) {
41
+ if (a.name !== b.name) {
42
+ return false;
43
+ }
44
+ const agree = behaviorOf(a).sidesAgree;
45
+ return agree === void 0 ? true : agree(a, b);
37
46
  }
38
-
39
- // src/boundaryKey.ts
40
- function normalizePath(path) {
41
- let normalized = path.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
42
- if (normalized.length > 1 && normalized.endsWith("/")) {
43
- normalized = normalized.slice(0, -1);
44
- }
45
- normalized = normalized.replace(
46
- /\{[^}]+\}|[^{]+/g,
47
- (segment) => segment.startsWith("{") ? segment : segment.toLowerCase()
48
- );
49
- return normalized;
47
+ function boundaryLabel(binding) {
48
+ const behavior = behaviorOf(binding.semantics);
49
+ return (behavior.displayLabel ?? behavior.identityKey)(binding.semantics);
50
50
  }
51
- function boundaryKey(binding) {
52
- const semantics = binding.semantics;
53
- if (semantics.name === "rest") {
54
- if (semantics.method === "" || semantics.path === "") {
55
- return null;
56
- }
57
- const method = semantics.method.toUpperCase();
58
- const path = normalizePath(semantics.path);
59
- return `${method} ${path}`;
60
- }
61
- if (semantics.name === "graphql-resolver") {
62
- if (semantics.typeName === "" || semantics.fieldName === "") {
63
- return null;
64
- }
65
- return `gql:${semantics.typeName}.${semantics.fieldName}`;
66
- }
67
- if (semantics.name === "message-bus") {
68
- const { subject } = parseChannel(semantics.channel);
69
- if (subject === "") {
70
- return null;
51
+ function displayLabel(binding) {
52
+ return boundaryLabel(binding) ?? `${binding.semantics.name}:${binding.recognition}`;
53
+ }
54
+ function normalizeRuleBoundary(raw) {
55
+ const trimmed = raw.trim();
56
+ for (const behavior of allBehaviors()) {
57
+ if (behavior.ruleBoundary?.claims(trimmed) === true) {
58
+ return behavior.ruleBoundary.normalize(trimmed);
71
59
  }
72
- return `bus:${semantics.messageBus} ${subject}`;
73
60
  }
74
- if (semantics.name === "function-call") {
75
- if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
76
- return `fn:${semantics.package}::${semantics.exportPath.join(".")}`;
77
- }
61
+ return trimmed;
62
+ }
63
+ function exchangesHttpResponses(binding) {
64
+ return behaviorOf(binding.semantics).exchangesHttpResponses;
65
+ }
66
+ function reportsUnpairedItself(binding) {
67
+ return behaviorOf(binding.semantics).reportsUnpairedItself;
68
+ }
69
+ function servesRequest(binding, method, path) {
70
+ const serves = behaviorOf(binding.semantics).servesRequest;
71
+ if (serves === void 0) {
78
72
  return null;
79
73
  }
80
- return null;
74
+ return serves(binding.semantics, method, path);
81
75
  }
82
76
 
83
77
  // src/codeScope.ts
@@ -107,9 +101,9 @@ var SuppressionSideSchema = z.object({
107
101
  }).optional();
108
102
  var SuppressionRuleSchema = z.object({
109
103
  /**
110
- * Finding kind to match — any behavioural or intent finding kind.
111
- * Open here (this package sits below both IRs); the loader
112
- * validates against the published kind enums.
104
+ * The finding kind to match, behavioural or intent. It is an open
105
+ * string here because this package is below both IRs, and the loader
106
+ * is what validates it against the published kind enums.
113
107
  */
114
108
  kind: z.string().optional(),
115
109
  /**
@@ -120,26 +114,26 @@ var SuppressionRuleSchema = z.object({
120
114
  */
121
115
  boundary: z.string().optional(),
122
116
  /**
123
- * Consumer-side discriminators (narrowest useful match). Only
124
- * meaningful for behavioural findings — a rule that specifies
125
- * `consumer` never matches an intent finding, which has no
126
- * consumer side.
117
+ * Consumer-side discriminators, the narrowest useful match. These
118
+ * mean something only for behavioural findings: a rule that
119
+ * specifies `consumer` never matches an intent finding, because an
120
+ * intent finding has no consumer side.
127
121
  */
128
122
  consumer: SuppressionSideSchema,
129
123
  /**
130
124
  * Provider-side discriminators, the mirror of `consumer`. A finding
131
- * about a status the provider produces carries its transition id on
132
- * this side, and that id is the only handle narrow enough to name
133
- * that one finding. Like `consumer`, a rule that specifies
125
+ * about a status the provider produces has its transition id on this
126
+ * side, and that id is the only handle narrow enough to pick out
127
+ * that one finding. As with `consumer`, a rule that specifies
134
128
  * `provider` never matches an intent finding.
135
129
  */
136
130
  provider: SuppressionSideSchema,
137
131
  /**
138
- * "narrow" (default): requires kind plus one of boundary,
139
- * consumer.transitionId, or provider.transitionId — enough to
140
- * target a specific finding class. "broad" opts in to kind-only or
141
- * boundary-only matches, which silence future regressions in that
142
- * category too.
132
+ * "narrow", the default, requires kind plus one of boundary,
133
+ * consumer.transitionId, or provider.transitionId, which is enough
134
+ * to target a specific class of finding. "broad" opts in to
135
+ * kind-only or boundary-only matches, which also silence future
136
+ * regressions in that category.
143
137
  */
144
138
  scope: z.enum(["narrow", "broad"]).default("narrow"),
145
139
  /** Required human-written justification. */
@@ -166,16 +160,6 @@ function validateRule(rule) {
166
160
  }
167
161
  return "narrow-scope rule must specify kind AND (boundary OR consumer.transitionId OR provider.transitionId); set scope: 'broad' to silence wider categories";
168
162
  }
169
- function normalizeRuleBoundary(raw) {
170
- const trimmed = raw.trim();
171
- const spaceIdx = trimmed.indexOf(" ");
172
- if (spaceIdx < 0) {
173
- return trimmed;
174
- }
175
- const method = trimmed.slice(0, spaceIdx).toUpperCase();
176
- const path = trimmed.slice(spaceIdx + 1);
177
- return `${method} ${normalizePath(path)}`;
178
- }
179
163
  function ruleBoundaryMatchesKey(ruleBoundary, key) {
180
164
  if (key === null) {
181
165
  return false;
@@ -371,13 +355,22 @@ function allowsUndefined(shape) {
371
355
  }
372
356
 
373
357
  // src/index.ts
358
+ function namedOrNull(value, field) {
359
+ if (value === "") {
360
+ throw new Error(
361
+ `${field} is an empty string; write null when the source does not name it`
362
+ );
363
+ }
364
+ return value;
365
+ }
374
366
  function restBinding(opts) {
367
+ const method = namedOrNull(opts.method, "rest method");
375
368
  return {
376
369
  transport: opts.transport,
377
370
  semantics: {
378
371
  name: "rest",
379
- method: opts.method.toUpperCase(),
380
- path: opts.path,
372
+ method: method === null ? null : method.toUpperCase(),
373
+ path: namedOrNull(opts.path, "rest path"),
381
374
  ...opts.declaredResponses !== void 0 ? { declaredResponses: opts.declaredResponses } : {}
382
375
  },
383
376
  recognition: opts.recognition
@@ -409,7 +402,7 @@ function graphqlResolverBinding(opts) {
409
402
  transport: opts.transport,
410
403
  semantics: {
411
404
  name: "graphql-resolver",
412
- typeName: opts.typeName,
405
+ typeName: namedOrNull(opts.typeName, "resolver typeName"),
413
406
  fieldName: opts.fieldName
414
407
  },
415
408
  recognition: opts.recognition
@@ -455,7 +448,7 @@ function messageBusBinding(opts) {
455
448
  semantics: {
456
449
  name: "message-bus",
457
450
  messageBus: opts.messageBus,
458
- channel: opts.channel
451
+ channel: namedOrNull(opts.channel, "message-bus channel")
459
452
  },
460
453
  recognition: opts.recognition
461
454
  };
@@ -482,23 +475,34 @@ export {
482
475
  applySuppressionsToFindings,
483
476
  bodyShapesMatch,
484
477
  boundaryKey,
478
+ boundaryLabel,
485
479
  busesAgree,
486
480
  channelsPair,
487
481
  codeScopePath,
488
482
  countsForThreshold,
489
483
  dispatchByType,
484
+ displayLabel,
485
+ ecsContainerInstanceName,
486
+ exchangesHttpResponses,
490
487
  fileInCodeScope,
488
+ formatChannel,
491
489
  functionCallBinding,
492
490
  graphqlOperationBinding,
493
491
  graphqlResolverBinding,
494
492
  messageBusBinding,
493
+ methodsAgree,
495
494
  normalizePath,
496
495
  normalizeRuleBoundary,
497
496
  packageExportBinding,
497
+ pairingKey,
498
498
  parseChannel,
499
+ reportsUnpairedItself,
499
500
  restBinding,
501
+ routePathAdmits,
500
502
  ruleBoundaryMatchesKey,
501
503
  runtimeConfigBinding,
504
+ semanticsAgree,
505
+ servesRequest,
502
506
  storageRelationalBinding,
503
507
  typeDefinitionKey,
504
508
  validateRule,
@@ -0,0 +1,432 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * One thing that gets deployed and runs on its own: a Lambda function,
5
+ * an ECS task's container, a plain container, or a k8s deployment.
6
+ */
7
+
8
+ /**
9
+ * `instanceName` is the stable identifier the deployment medium uses:
10
+ * the CFN logical resource id for Lambda and ECS, the deployment name
11
+ * for k8s, the container name for a plain container.
12
+ */
13
+ declare const DeployableUnitSchema: z.ZodObject<{
14
+ deploymentTarget: z.ZodEnum<{
15
+ lambda: "lambda";
16
+ "ecs-task": "ecs-task";
17
+ container: "container";
18
+ "k8s-deployment": "k8s-deployment";
19
+ }>;
20
+ instanceName: z.ZodString;
21
+ }, z.core.$strip>;
22
+ type DeployableUnit = z.infer<typeof DeployableUnitSchema>;
23
+ /**
24
+ * The `instanceName` for an ECS task's container: the task definition's
25
+ * own logical id, plus the container name from CFN's
26
+ * `ContainerDefinitions[*].Name`. Everyone who writes an ECS
27
+ * `DeployableUnit`, and everyone who matches a routing edge against
28
+ * one, has to put the two together the same way, so they all call this.
29
+ */
30
+ declare function ecsContainerInstanceName(taskDefinitionLogicalId: string, containerName: string): string;
31
+
32
+ declare const FunctionCallSemanticsSchema: z.ZodObject<{
33
+ name: z.ZodLiteral<"function-call">;
34
+ module: z.ZodOptional<z.ZodString>;
35
+ exportName: z.ZodOptional<z.ZodString>;
36
+ package: z.ZodOptional<z.ZodString>;
37
+ exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ }, z.core.$strip>;
39
+ type FunctionCallSemantics = z.infer<typeof FunctionCallSemanticsSchema>;
40
+
41
+ declare const GraphqlOperationSemanticsSchema: z.ZodObject<{
42
+ name: z.ZodLiteral<"graphql-operation">;
43
+ operationName: z.ZodOptional<z.ZodString>;
44
+ operationType: z.ZodEnum<{
45
+ query: "query";
46
+ mutation: "mutation";
47
+ subscription: "subscription";
48
+ }>;
49
+ }, z.core.$strip>;
50
+ type GraphqlOperationSemantics = z.infer<typeof GraphqlOperationSemanticsSchema>;
51
+
52
+ declare const GraphqlResolverSemanticsSchema: z.ZodObject<{
53
+ name: z.ZodLiteral<"graphql-resolver">;
54
+ typeName: z.ZodNullable<z.ZodString>;
55
+ fieldName: z.ZodString;
56
+ }, z.core.$strip>;
57
+ type GraphqlResolverSemantics = z.infer<typeof GraphqlResolverSemanticsSchema>;
58
+
59
+ declare const MessageBusSemanticsSchema: z.ZodObject<{
60
+ name: z.ZodLiteral<"message-bus">;
61
+ messageBus: z.ZodEnum<{
62
+ sqs: "sqs";
63
+ sns: "sns";
64
+ s3: "s3";
65
+ eventbridge: "eventbridge";
66
+ bullmq: "bullmq";
67
+ kafka: "kafka";
68
+ nats: "nats";
69
+ }>;
70
+ channel: z.ZodNullable<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ type MessageBusSemantics = z.infer<typeof MessageBusSemanticsSchema>;
73
+ /**
74
+ * The bus technologies the schema allows. It comes from the enum, so a
75
+ * value added there cannot drift from a hand-written copy elsewhere.
76
+ */
77
+ type MessageBusTechnology = MessageBusSemantics["messageBus"];
78
+
79
+ /**
80
+ * Where the protocol modules come together.
81
+ *
82
+ * Each protocol under this directory exports one
83
+ * `BoundarySemanticsDefinition`. This file lists them twice, once for
84
+ * the schema union and once for the behavior lookup, and the type check
85
+ * at the bottom fails compilation if the two lists ever cover different
86
+ * sets. Adding a protocol changes this file and no other, by one line in
87
+ * each list.
88
+ */
89
+
90
+ /**
91
+ * The discriminated union every boundary binding validates against.
92
+ * Built from the protocol modules' own schemas.
93
+ */
94
+ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
95
+ name: z.ZodLiteral<"rest">;
96
+ method: z.ZodNullable<z.ZodString>;
97
+ path: z.ZodNullable<z.ZodString>;
98
+ declaredResponses: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ name: z.ZodLiteral<"function-call">;
101
+ module: z.ZodOptional<z.ZodString>;
102
+ exportName: z.ZodOptional<z.ZodString>;
103
+ package: z.ZodOptional<z.ZodString>;
104
+ exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ name: z.ZodLiteral<"graphql-resolver">;
107
+ typeName: z.ZodNullable<z.ZodString>;
108
+ fieldName: z.ZodString;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ name: z.ZodLiteral<"graphql-operation">;
111
+ operationName: z.ZodOptional<z.ZodString>;
112
+ operationType: z.ZodEnum<{
113
+ query: "query";
114
+ mutation: "mutation";
115
+ subscription: "subscription";
116
+ }>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ deploymentTarget: z.ZodEnum<{
119
+ lambda: "lambda";
120
+ "ecs-task": "ecs-task";
121
+ container: "container";
122
+ "k8s-deployment": "k8s-deployment";
123
+ }>;
124
+ instanceName: z.ZodString;
125
+ name: z.ZodLiteral<"runtime-config">;
126
+ }, z.core.$strip>, z.ZodObject<{
127
+ name: z.ZodLiteral<"storage-relational">;
128
+ storageSystem: z.ZodEnum<{
129
+ postgres: "postgres";
130
+ mysql: "mysql";
131
+ sqlite: "sqlite";
132
+ }>;
133
+ scope: z.ZodString;
134
+ table: z.ZodString;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ name: z.ZodLiteral<"message-bus">;
137
+ messageBus: z.ZodEnum<{
138
+ sqs: "sqs";
139
+ sns: "sns";
140
+ s3: "s3";
141
+ eventbridge: "eventbridge";
142
+ bullmq: "bullmq";
143
+ kafka: "kafka";
144
+ nats: "nats";
145
+ }>;
146
+ channel: z.ZodNullable<z.ZodString>;
147
+ }, z.core.$strip>], "name">;
148
+ type Semantics = z.infer<typeof SemanticsSchema>;
149
+
150
+ declare const RestSemanticsSchema: z.ZodObject<{
151
+ name: z.ZodLiteral<"rest">;
152
+ method: z.ZodNullable<z.ZodString>;
153
+ path: z.ZodNullable<z.ZodString>;
154
+ declaredResponses: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
155
+ }, z.core.$strip>;
156
+ type RestSemantics = z.infer<typeof RestSemanticsSchema>;
157
+ /**
158
+ * Normalize a route path to a canonical form for matching.
159
+ *
160
+ * - Converts Express-style params (`:id`) to brace-style (`{id}`)
161
+ * - Strips trailing slashes (except bare `/`)
162
+ * - Lowercases the static segments (params stay case-sensitive)
163
+ */
164
+ declare function normalizePath(path: string): string;
165
+ /**
166
+ * Whether two REST methods mean the same thing. Equal methods agree,
167
+ * and `"*"` agrees with any stated method, because a handler that
168
+ * responds to every method responds to this one. A null method was never
169
+ * stated, so it agrees with nothing: there is no claim to agree with.
170
+ *
171
+ * This is the counterpart of `busesAgree`. No list of methods appears
172
+ * here, so a wildcard pairs with whatever methods consumers write.
173
+ */
174
+ declare function methodsAgree(a: string | null, b: string | null): boolean;
175
+ /** Whether a declared route path admits a concrete request path. */
176
+ declare function routePathAdmits(declaredPath: string, requestPath: string): boolean;
177
+
178
+ /**
179
+ * The pairing key is `(deploymentTarget, instanceName)`, which is
180
+ * exactly a deployable unit, so the two fields come from
181
+ * `DeployableUnitSchema` instead of being written out a second time.
182
+ */
183
+ declare const RuntimeConfigSemanticsSchema: z.ZodObject<{
184
+ deploymentTarget: z.ZodEnum<{
185
+ lambda: "lambda";
186
+ "ecs-task": "ecs-task";
187
+ container: "container";
188
+ "k8s-deployment": "k8s-deployment";
189
+ }>;
190
+ instanceName: z.ZodString;
191
+ name: z.ZodLiteral<"runtime-config">;
192
+ }, z.core.$strip>;
193
+ type RuntimeConfigSemantics = z.infer<typeof RuntimeConfigSemanticsSchema>;
194
+
195
+ declare const StorageRelationalSemanticsSchema: z.ZodObject<{
196
+ name: z.ZodLiteral<"storage-relational">;
197
+ storageSystem: z.ZodEnum<{
198
+ postgres: "postgres";
199
+ mysql: "mysql";
200
+ sqlite: "sqlite";
201
+ }>;
202
+ scope: z.ZodString;
203
+ table: z.ZodString;
204
+ }, z.core.$strip>;
205
+ type StorageRelationalSemantics = z.infer<typeof StorageRelationalSemanticsSchema>;
206
+
207
+ /**
208
+ * @suss/ir-core schemas: primitives shared by every suss IR.
209
+ *
210
+ * These are the types that any IR built on suss references: the
211
+ * structure of a value (`TypeShape`), the identity of a boundary
212
+ * (`BoundaryBinding` and its `Semantics` variants), where something is
213
+ * in the source (`SourceLocation`), and how much to trust a claim
214
+ * (`Confidence`). Behavioural summaries, intent docs, and later on
215
+ * observation records all speak in these terms, so they are defined
216
+ * here, in one place none of those IRs needs another IR to reach.
217
+ *
218
+ * The schemas are the single source of truth, and the package's
219
+ * `index.ts` derives the types from them with `z.infer`.
220
+ */
221
+
222
+ declare const ConfidenceSourceSchema: z.ZodEnum<{
223
+ inferred_static: "inferred_static";
224
+ inferred_ai: "inferred_ai";
225
+ declared: "declared";
226
+ derived: "derived";
227
+ }>;
228
+ declare const ConfidenceLevelSchema: z.ZodEnum<{
229
+ high: "high";
230
+ medium: "medium";
231
+ low: "low";
232
+ }>;
233
+ /**
234
+ * What came of corroborating a claim by running the code
235
+ * (`suss corroborate`). Inputs that satisfy the claim's own conditions
236
+ * are generated and run through the function, and the observation
237
+ * either agreed every time (`observed`), disagreed at least once
238
+ * (`refuted`, which is either an extractor bug or a surprise, and the
239
+ * counterexample says which input), or never produced a verdict
240
+ * (`untested`, meaning no satisfying input was found, or every
241
+ * satisfying run hit a dependency the harness cannot supply).
242
+ *
243
+ * Corroboration adds observations to a derivation. It is extra
244
+ * evidence, and it never rewrites the derived claim.
245
+ */
246
+ declare const CorroborationSchema: z.ZodObject<{
247
+ outcome: z.ZodEnum<{
248
+ observed: "observed";
249
+ refuted: "refuted";
250
+ untested: "untested";
251
+ }>;
252
+ runs: z.ZodNumber;
253
+ counterexample: z.ZodOptional<z.ZodUnknown>;
254
+ reason: z.ZodOptional<z.ZodString>;
255
+ }, z.core.$strip>;
256
+ declare const ConfidenceInfoSchema: z.ZodObject<{
257
+ source: z.ZodEnum<{
258
+ inferred_static: "inferred_static";
259
+ inferred_ai: "inferred_ai";
260
+ declared: "declared";
261
+ derived: "derived";
262
+ }>;
263
+ level: z.ZodEnum<{
264
+ high: "high";
265
+ medium: "medium";
266
+ low: "low";
267
+ }>;
268
+ corroboration: z.ZodOptional<z.ZodObject<{
269
+ outcome: z.ZodEnum<{
270
+ observed: "observed";
271
+ refuted: "refuted";
272
+ untested: "untested";
273
+ }>;
274
+ runs: z.ZodNumber;
275
+ counterexample: z.ZodOptional<z.ZodUnknown>;
276
+ reason: z.ZodOptional<z.ZodString>;
277
+ }, z.core.$strip>>;
278
+ }, z.core.$strip>;
279
+ declare const SourceLocationSchema: z.ZodObject<{
280
+ file: z.ZodString;
281
+ range: z.ZodObject<{
282
+ start: z.ZodNumber;
283
+ end: z.ZodNumber;
284
+ }, z.core.$strip>;
285
+ exportName: z.ZodNullable<z.ZodString>;
286
+ workspace: z.ZodOptional<z.ZodString>;
287
+ }, z.core.$strip>;
288
+ declare const BoundaryBindingSchema: z.ZodObject<{
289
+ transport: z.ZodString;
290
+ semantics: z.ZodDiscriminatedUnion<[z.ZodObject<{
291
+ name: z.ZodLiteral<"rest">;
292
+ method: z.ZodNullable<z.ZodString>;
293
+ path: z.ZodNullable<z.ZodString>;
294
+ declaredResponses: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
295
+ }, z.core.$strip>, z.ZodObject<{
296
+ name: z.ZodLiteral<"function-call">;
297
+ module: z.ZodOptional<z.ZodString>;
298
+ exportName: z.ZodOptional<z.ZodString>;
299
+ package: z.ZodOptional<z.ZodString>;
300
+ exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ name: z.ZodLiteral<"graphql-resolver">;
303
+ typeName: z.ZodNullable<z.ZodString>;
304
+ fieldName: z.ZodString;
305
+ }, z.core.$strip>, z.ZodObject<{
306
+ name: z.ZodLiteral<"graphql-operation">;
307
+ operationName: z.ZodOptional<z.ZodString>;
308
+ operationType: z.ZodEnum<{
309
+ query: "query";
310
+ mutation: "mutation";
311
+ subscription: "subscription";
312
+ }>;
313
+ }, z.core.$strip>, z.ZodObject<{
314
+ deploymentTarget: z.ZodEnum<{
315
+ lambda: "lambda";
316
+ "ecs-task": "ecs-task";
317
+ container: "container";
318
+ "k8s-deployment": "k8s-deployment";
319
+ }>;
320
+ instanceName: z.ZodString;
321
+ name: z.ZodLiteral<"runtime-config">;
322
+ }, z.core.$strip>, z.ZodObject<{
323
+ name: z.ZodLiteral<"storage-relational">;
324
+ storageSystem: z.ZodEnum<{
325
+ postgres: "postgres";
326
+ mysql: "mysql";
327
+ sqlite: "sqlite";
328
+ }>;
329
+ scope: z.ZodString;
330
+ table: z.ZodString;
331
+ }, z.core.$strip>, z.ZodObject<{
332
+ name: z.ZodLiteral<"message-bus">;
333
+ messageBus: z.ZodEnum<{
334
+ sqs: "sqs";
335
+ sns: "sns";
336
+ s3: "s3";
337
+ eventbridge: "eventbridge";
338
+ bullmq: "bullmq";
339
+ kafka: "kafka";
340
+ nats: "nats";
341
+ }>;
342
+ channel: z.ZodNullable<z.ZodString>;
343
+ }, z.core.$strip>], "name">;
344
+ recognition: z.ZodString;
345
+ }, z.core.$strip>;
346
+ type TypeShape = {
347
+ type: "record";
348
+ properties: Record<string, TypeShape>;
349
+ spreads?: Array<{
350
+ sourceText: string;
351
+ }> | undefined;
352
+ } | {
353
+ type: "dictionary";
354
+ values: TypeShape;
355
+ } | {
356
+ type: "array";
357
+ items: TypeShape;
358
+ } | {
359
+ type: "literal";
360
+ value: string | number | boolean;
361
+ raw?: string | undefined;
362
+ } | {
363
+ type: "text";
364
+ } | {
365
+ type: "integer";
366
+ } | {
367
+ type: "number";
368
+ } | {
369
+ type: "boolean";
370
+ } | {
371
+ type: "null";
372
+ } | {
373
+ type: "undefined";
374
+ } | {
375
+ type: "union";
376
+ variants: TypeShape[];
377
+ } | {
378
+ type: "ref";
379
+ name: string;
380
+ /**
381
+ * Where this type is written down, when it is written down
382
+ * anywhere. It is the key into the summary's table of definitions.
383
+ *
384
+ * A name does not identify a type. Every instantiation of one
385
+ * generic reports the generic's own name and file, so `Omit<User,
386
+ * "secret">` and `Omit<Order, "total">` are both `Omit`, and a
387
+ * table keyed on that gives the second one the first one's fields.
388
+ * This key is built from what the type actually is.
389
+ */
390
+ def?: string | undefined;
391
+ /**
392
+ * The file that declares this type, when the project declares it.
393
+ * Absent for a name the language or a dependency owns, which means
394
+ * the same thing everywhere.
395
+ *
396
+ * A name on its own does not identify a type. Two modules each
397
+ * declaring a `User` produce the same ref, and a checker comparing
398
+ * them has nothing to go on. This is what tells them apart.
399
+ */
400
+ from?: string | undefined;
401
+ } | {
402
+ type: "unknown";
403
+ };
404
+ /**
405
+ * The key a table of definitions uses for the type a ref points at.
406
+ *
407
+ * A ref has the name and the file that declares it, and that pair
408
+ * already identifies the type, so a table keyed on it needs nothing new
409
+ * on the ref. A name that the language or a dependency owns has no
410
+ * file, and keys on the name alone.
411
+ */
412
+ declare function typeDefinitionKey(ref: {
413
+ def?: string | undefined;
414
+ }): string | null;
415
+ declare const TypeShapeSchema: z.ZodType<TypeShape>;
416
+ /**
417
+ * A shape with the definitions it refers to substituted back into it.
418
+ *
419
+ * Comparing two shapes means comparing their structure, and a ref has
420
+ * none. Rather than teach every comparison to look in a table, the
421
+ * definitions go back into the shape once and everything downstream
422
+ * reads what it always read.
423
+ *
424
+ * Substituting a definition is not a level of nesting, so it does not
425
+ * spend depth. Counting it meant a type six deep came back three deep,
426
+ * and a consumer reading a field past that was told the provider did
427
+ * not have it. A type that refers to itself is stopped by the names
428
+ * already substituted on this path, the shape walk's own cycle guard.
429
+ */
430
+ declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
431
+
432
+ export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusTechnology as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, DeployableUnitSchema as e, FunctionCallSemanticsSchema as f, GraphqlOperationSemanticsSchema as g, type GraphqlResolverSemantics as h, GraphqlResolverSemanticsSchema as i, type MessageBusSemantics as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageRelationalSemantics as p, StorageRelationalSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, routePathAdmits as v, typeDefinitionKey as w, withDefinitionsInlined as x };