@suss/ir-core 0.5.8 → 0.5.10
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/{chunk-5KE7OWN3.js → chunk-FFPB2UKY.js} +32 -4
- package/dist/chunk-WKR5SU4N.js +630 -0
- package/dist/index.cjs +95 -45
- package/dist/index.d.cts +51 -5
- package/dist/index.d.ts +51 -5
- package/dist/index.js +20 -2
- package/dist/{schemas-BWvfkxSH.d.cts → schemas-CaX7_SZ4.d.cts} +1 -1
- package/dist/{schemas-BWvfkxSH.d.ts → schemas-CaX7_SZ4.d.ts} +1 -1
- package/dist/schemas-N9GyG0Sn.d.cts +432 -0
- package/dist/schemas-N9GyG0Sn.d.ts +432 -0
- package/dist/schemas.cjs +35 -5
- package/dist/schemas.d.cts +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/package.json +1 -1
|
@@ -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.ZodNullable<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.ZodNullable<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.ZodNullable<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 MessageBusSemantics 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, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema 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 };
|
package/dist/schemas.cjs
CHANGED
|
@@ -48,6 +48,17 @@ var import_zod9 = require("zod");
|
|
|
48
48
|
// src/semantics/functionCall.ts
|
|
49
49
|
var import_zod = require("zod");
|
|
50
50
|
|
|
51
|
+
// src/identityKeys.ts
|
|
52
|
+
function gqlIdentityKey(typeName, fieldName) {
|
|
53
|
+
return `gql:${typeName}.${fieldName}`;
|
|
54
|
+
}
|
|
55
|
+
function fnIdentityKey(packageName, exportPath) {
|
|
56
|
+
return `fn:${packageName}::${exportPath.join(".")}`;
|
|
57
|
+
}
|
|
58
|
+
function busIdentityKey(messageBus, subject) {
|
|
59
|
+
return `bus:${messageBus} ${subject}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
// src/semantics/definition.ts
|
|
52
63
|
function defineBoundarySemantics(definition) {
|
|
53
64
|
return definition;
|
|
@@ -92,6 +103,12 @@ var functionCallSemantics = defineBoundarySemantics({
|
|
|
92
103
|
/** A call returns a value, which is not a status and a body. */
|
|
93
104
|
exchangesHttpResponses: false,
|
|
94
105
|
reportsUnpairedItself: false,
|
|
106
|
+
/**
|
|
107
|
+
* In-repo units (components, bare handlers) are keyless by design
|
|
108
|
+
* and pair through call edges rather than the keyed pass, so a
|
|
109
|
+
* missing key is not a boundary nothing can reach.
|
|
110
|
+
*/
|
|
111
|
+
canPair: () => true,
|
|
95
112
|
/**
|
|
96
113
|
* `"fn:<package>::<exportPath>"` when both are set. Other in-process
|
|
97
114
|
* function-call units, such as components and bare handlers inside
|
|
@@ -99,7 +116,7 @@ var functionCallSemantics = defineBoundarySemantics({
|
|
|
99
116
|
*/
|
|
100
117
|
identityKey(semantics) {
|
|
101
118
|
if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
|
|
102
|
-
return
|
|
119
|
+
return fnIdentityKey(semantics.package, semantics.exportPath);
|
|
103
120
|
}
|
|
104
121
|
return null;
|
|
105
122
|
}
|
|
@@ -125,6 +142,8 @@ var graphqlOperationSemantics = defineBoundarySemantics({
|
|
|
125
142
|
exchangesHttpResponses: false,
|
|
126
143
|
reportsUnpairedItself: false,
|
|
127
144
|
identityKey: () => null,
|
|
145
|
+
/** Keyless by design; the dedicated pass pairs it by its document. */
|
|
146
|
+
canPair: () => true,
|
|
128
147
|
/** "query GetUser". The contract checker pairs it, the key does not. */
|
|
129
148
|
displayLabel(semantics) {
|
|
130
149
|
return `${semantics.operationType} ${semantics.operationName ?? "<anonymous>"}`;
|
|
@@ -161,7 +180,7 @@ var graphqlResolverSemantics = defineBoundarySemantics({
|
|
|
161
180
|
if (semantics.typeName === null || semantics.fieldName === "") {
|
|
162
181
|
return null;
|
|
163
182
|
}
|
|
164
|
-
return
|
|
183
|
+
return gqlIdentityKey(semantics.typeName, semantics.fieldName);
|
|
165
184
|
}
|
|
166
185
|
}
|
|
167
186
|
});
|
|
@@ -217,6 +236,12 @@ var messageBusSemantics = defineBoundarySemantics({
|
|
|
217
236
|
* ones, so the generic unmatched lists leave them alone.
|
|
218
237
|
*/
|
|
219
238
|
reportsUnpairedItself: true,
|
|
239
|
+
/**
|
|
240
|
+
* A channel unnamed here can still pair: the dedicated pass
|
|
241
|
+
* collapses env chains before comparing, so a consumer whose
|
|
242
|
+
* channel arrives at runtime meets the template that declares it.
|
|
243
|
+
*/
|
|
244
|
+
canPair: () => true,
|
|
220
245
|
/**
|
|
221
246
|
* `"bus:<messageBus> <subject>"`, or null when the channel is null
|
|
222
247
|
* or its subject is empty.
|
|
@@ -239,7 +264,7 @@ var messageBusSemantics = defineBoundarySemantics({
|
|
|
239
264
|
if (subject === "") {
|
|
240
265
|
return null;
|
|
241
266
|
}
|
|
242
|
-
return
|
|
267
|
+
return busIdentityKey(semantics.messageBus, subject);
|
|
243
268
|
},
|
|
244
269
|
sidesAgree(a, b) {
|
|
245
270
|
if (a.channel === null || b.channel === null) {
|
|
@@ -431,8 +456,13 @@ var StorageRelationalSemanticsSchema = import_zod8.z.object({
|
|
|
431
456
|
* and a monorepo with several schemas gives each one its own value.
|
|
432
457
|
*/
|
|
433
458
|
scope: import_zod8.z.string(),
|
|
434
|
-
/**
|
|
435
|
-
|
|
459
|
+
/**
|
|
460
|
+
* The table or model name as the schema declares it, or null when
|
|
461
|
+
* the source states one this reader could not settle. A null table
|
|
462
|
+
* pairs with nothing, rather than with whatever its source text
|
|
463
|
+
* happens to spell.
|
|
464
|
+
*/
|
|
465
|
+
table: import_zod8.z.string().nullable()
|
|
436
466
|
});
|
|
437
467
|
var storageRelationalSemantics = defineBoundarySemantics({
|
|
438
468
|
name: "storage-relational",
|
package/dist/schemas.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema,
|
|
2
|
+
export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageRelationalSemanticsSchema, T as TypeShape, r as TypeShapeSchema, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-N9GyG0Sn.cjs';
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema,
|
|
2
|
+
export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageRelationalSemanticsSchema, T as TypeShape, r as TypeShapeSchema, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-N9GyG0Sn.js';
|
package/dist/schemas.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/ir-core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared IR primitives for suss — type shapes, boundary bindings, source locations, and confidence. Imported by both @suss/behavioral-ir and @suss/intent-ir so neither depends on the other.",
|
|
6
6
|
"keywords": [
|