@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/schemas.d.ts CHANGED
@@ -1,374 +1,2 @@
1
- import { z } from 'zod';
2
-
3
- declare const ConfidenceSourceSchema: z.ZodEnum<{
4
- inferred_static: "inferred_static";
5
- inferred_ai: "inferred_ai";
6
- declared: "declared";
7
- derived: "derived";
8
- }>;
9
- declare const ConfidenceLevelSchema: z.ZodEnum<{
10
- high: "high";
11
- medium: "medium";
12
- low: "low";
13
- }>;
14
- /**
15
- * The result of corroborating a claim against real execution
16
- * (`suss corroborate`): generated inputs satisfying the claim's own
17
- * conditions were run through the actual function and the observation
18
- * either agreed every time (`observed`), disagreed at least once
19
- * (`refuted` — an extractor bug or a genuine surprise; the
20
- * counterexample says which input), or never produced a verdict
21
- * (`untested` — no satisfying input was found, or every satisfying
22
- * run hit a dependency the harness cannot supply).
23
- *
24
- * Corroboration upgrades a *derivation* with *observations*; it is
25
- * additive evidence, never a rewrite of the derived claim.
26
- */
27
- declare const CorroborationSchema: z.ZodObject<{
28
- outcome: z.ZodEnum<{
29
- observed: "observed";
30
- refuted: "refuted";
31
- untested: "untested";
32
- }>;
33
- runs: z.ZodNumber;
34
- counterexample: z.ZodOptional<z.ZodUnknown>;
35
- reason: z.ZodOptional<z.ZodString>;
36
- }, z.core.$strip>;
37
- declare const ConfidenceInfoSchema: z.ZodObject<{
38
- source: z.ZodEnum<{
39
- inferred_static: "inferred_static";
40
- inferred_ai: "inferred_ai";
41
- declared: "declared";
42
- derived: "derived";
43
- }>;
44
- level: z.ZodEnum<{
45
- high: "high";
46
- medium: "medium";
47
- low: "low";
48
- }>;
49
- corroboration: z.ZodOptional<z.ZodObject<{
50
- outcome: z.ZodEnum<{
51
- observed: "observed";
52
- refuted: "refuted";
53
- untested: "untested";
54
- }>;
55
- runs: z.ZodNumber;
56
- counterexample: z.ZodOptional<z.ZodUnknown>;
57
- reason: z.ZodOptional<z.ZodString>;
58
- }, z.core.$strip>>;
59
- }, z.core.$strip>;
60
- declare const SourceLocationSchema: z.ZodObject<{
61
- file: z.ZodString;
62
- range: z.ZodObject<{
63
- start: z.ZodNumber;
64
- end: z.ZodNumber;
65
- }, z.core.$strip>;
66
- exportName: z.ZodNullable<z.ZodString>;
67
- workspace: z.ZodOptional<z.ZodString>;
68
- }, z.core.$strip>;
69
- declare const RestSemanticsSchema: z.ZodObject<{
70
- name: z.ZodLiteral<"rest">;
71
- method: z.ZodString;
72
- path: z.ZodString;
73
- declaredResponses: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
74
- }, z.core.$strip>;
75
- declare const FunctionCallSemanticsSchema: z.ZodObject<{
76
- name: z.ZodLiteral<"function-call">;
77
- module: z.ZodOptional<z.ZodString>;
78
- exportName: z.ZodOptional<z.ZodString>;
79
- package: z.ZodOptional<z.ZodString>;
80
- exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
- }, z.core.$strip>;
82
- /**
83
- * Provider-side GraphQL resolver. One resolver binds one
84
- * (typeName, fieldName) pair. Pairing key: `${typeName}.${fieldName}`.
85
- */
86
- declare const GraphqlResolverSemanticsSchema: z.ZodObject<{
87
- name: z.ZodLiteral<"graphql-resolver">;
88
- typeName: z.ZodString;
89
- fieldName: z.ZodString;
90
- }, z.core.$strip>;
91
- /**
92
- * Consumer-side GraphQL operation — a document sent from client to
93
- * server. Binds by operation name + type.
94
- */
95
- declare const GraphqlOperationSemanticsSchema: z.ZodObject<{
96
- name: z.ZodLiteral<"graphql-operation">;
97
- operationName: z.ZodOptional<z.ZodString>;
98
- operationType: z.ZodEnum<{
99
- query: "query";
100
- mutation: "mutation";
101
- subscription: "subscription";
102
- }>;
103
- }, z.core.$strip>;
104
- /**
105
- * One thing that gets deployed and runs on its own: a Lambda
106
- * function, an ECS task's container, a plain container, a k8s
107
- * deployment.
108
- *
109
- * `instanceName` is the stable identifier the deployment medium uses:
110
- * the CFN logical resource id for Lambda and ECS, the deployment name
111
- * for k8s, the container name for a plain container.
112
- */
113
- declare const DeployableUnitSchema: z.ZodObject<{
114
- deploymentTarget: z.ZodEnum<{
115
- lambda: "lambda";
116
- "ecs-task": "ecs-task";
117
- container: "container";
118
- "k8s-deployment": "k8s-deployment";
119
- }>;
120
- instanceName: z.ZodString;
121
- }, z.core.$strip>;
122
- /**
123
- * Provider-side runtime configuration channel: env vars and their
124
- * declared values on a deployable unit. The channel is the boundary;
125
- * env var names are FIELDS on its contract. Pairing key:
126
- * `(deploymentTarget, instanceName)`, which is exactly a deployable
127
- * unit, so the two fields come from `DeployableUnitSchema` rather
128
- * than being spelled a second time.
129
- */
130
- declare const RuntimeConfigSemanticsSchema: z.ZodObject<{
131
- deploymentTarget: z.ZodEnum<{
132
- lambda: "lambda";
133
- "ecs-task": "ecs-task";
134
- container: "container";
135
- "k8s-deployment": "k8s-deployment";
136
- }>;
137
- instanceName: z.ZodString;
138
- name: z.ZodLiteral<"runtime-config">;
139
- }, z.core.$strip>;
140
- /**
141
- * Provider-side relational storage table. Columns are FIELDS on the
142
- * table's contract. Pairing key: `(storageSystem, scope, table)`.
143
- */
144
- declare const StorageRelationalSemanticsSchema: z.ZodObject<{
145
- name: z.ZodLiteral<"storage-relational">;
146
- storageSystem: z.ZodEnum<{
147
- postgres: "postgres";
148
- mysql: "mysql";
149
- sqlite: "sqlite";
150
- }>;
151
- scope: z.ZodString;
152
- table: z.ZodString;
153
- }, z.core.$strip>;
154
- /**
155
- * Provider-side message-bus boundary — SQS / EventBridge / BullMQ /
156
- * Kafka / NATS. Producer `interaction(class: "message-send")` effects
157
- * pair against these via `(messageBus, channel)`.
158
- *
159
- * The `channel` string is per-bus. SQS keys it on the single queue
160
- * identity (CFN logical id / env-var name). EventBridge carries a
161
- * two-part identity — the event bus AND the DetailType a rule matches —
162
- * encoded as `"<bus>#<detailType>"`, because one bus multiplexes many
163
- * event types and a rule subscribes to a subset. See
164
- * `@suss/framework-aws-eventbridge` for the producer-side scheme and
165
- * `@suss/contract-cloudformation`'s messageBus reader for the
166
- * consumer/provider-side scheme.
167
- */
168
- declare const MessageBusSemanticsSchema: z.ZodObject<{
169
- name: z.ZodLiteral<"message-bus">;
170
- messageBus: z.ZodEnum<{
171
- sqs: "sqs";
172
- eventbridge: "eventbridge";
173
- bullmq: "bullmq";
174
- kafka: "kafka";
175
- nats: "nats";
176
- }>;
177
- channel: z.ZodString;
178
- }, z.core.$strip>;
179
- declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
180
- name: z.ZodLiteral<"rest">;
181
- method: z.ZodString;
182
- path: z.ZodString;
183
- declaredResponses: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
184
- }, z.core.$strip>, z.ZodObject<{
185
- name: z.ZodLiteral<"function-call">;
186
- module: z.ZodOptional<z.ZodString>;
187
- exportName: z.ZodOptional<z.ZodString>;
188
- package: z.ZodOptional<z.ZodString>;
189
- exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
190
- }, z.core.$strip>, z.ZodObject<{
191
- name: z.ZodLiteral<"graphql-resolver">;
192
- typeName: z.ZodString;
193
- fieldName: z.ZodString;
194
- }, z.core.$strip>, z.ZodObject<{
195
- name: z.ZodLiteral<"graphql-operation">;
196
- operationName: z.ZodOptional<z.ZodString>;
197
- operationType: z.ZodEnum<{
198
- query: "query";
199
- mutation: "mutation";
200
- subscription: "subscription";
201
- }>;
202
- }, z.core.$strip>, z.ZodObject<{
203
- deploymentTarget: z.ZodEnum<{
204
- lambda: "lambda";
205
- "ecs-task": "ecs-task";
206
- container: "container";
207
- "k8s-deployment": "k8s-deployment";
208
- }>;
209
- instanceName: z.ZodString;
210
- name: z.ZodLiteral<"runtime-config">;
211
- }, z.core.$strip>, z.ZodObject<{
212
- name: z.ZodLiteral<"storage-relational">;
213
- storageSystem: z.ZodEnum<{
214
- postgres: "postgres";
215
- mysql: "mysql";
216
- sqlite: "sqlite";
217
- }>;
218
- scope: z.ZodString;
219
- table: z.ZodString;
220
- }, z.core.$strip>, z.ZodObject<{
221
- name: z.ZodLiteral<"message-bus">;
222
- messageBus: z.ZodEnum<{
223
- sqs: "sqs";
224
- eventbridge: "eventbridge";
225
- bullmq: "bullmq";
226
- kafka: "kafka";
227
- nats: "nats";
228
- }>;
229
- channel: z.ZodString;
230
- }, z.core.$strip>], "name">;
231
- declare const BoundaryBindingSchema: z.ZodObject<{
232
- transport: z.ZodString;
233
- semantics: z.ZodDiscriminatedUnion<[z.ZodObject<{
234
- name: z.ZodLiteral<"rest">;
235
- method: z.ZodString;
236
- path: z.ZodString;
237
- declaredResponses: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
238
- }, z.core.$strip>, z.ZodObject<{
239
- name: z.ZodLiteral<"function-call">;
240
- module: z.ZodOptional<z.ZodString>;
241
- exportName: z.ZodOptional<z.ZodString>;
242
- package: z.ZodOptional<z.ZodString>;
243
- exportPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
- }, z.core.$strip>, z.ZodObject<{
245
- name: z.ZodLiteral<"graphql-resolver">;
246
- typeName: z.ZodString;
247
- fieldName: z.ZodString;
248
- }, z.core.$strip>, z.ZodObject<{
249
- name: z.ZodLiteral<"graphql-operation">;
250
- operationName: z.ZodOptional<z.ZodString>;
251
- operationType: z.ZodEnum<{
252
- query: "query";
253
- mutation: "mutation";
254
- subscription: "subscription";
255
- }>;
256
- }, z.core.$strip>, z.ZodObject<{
257
- deploymentTarget: z.ZodEnum<{
258
- lambda: "lambda";
259
- "ecs-task": "ecs-task";
260
- container: "container";
261
- "k8s-deployment": "k8s-deployment";
262
- }>;
263
- instanceName: z.ZodString;
264
- name: z.ZodLiteral<"runtime-config">;
265
- }, z.core.$strip>, z.ZodObject<{
266
- name: z.ZodLiteral<"storage-relational">;
267
- storageSystem: z.ZodEnum<{
268
- postgres: "postgres";
269
- mysql: "mysql";
270
- sqlite: "sqlite";
271
- }>;
272
- scope: z.ZodString;
273
- table: z.ZodString;
274
- }, z.core.$strip>, z.ZodObject<{
275
- name: z.ZodLiteral<"message-bus">;
276
- messageBus: z.ZodEnum<{
277
- sqs: "sqs";
278
- eventbridge: "eventbridge";
279
- bullmq: "bullmq";
280
- kafka: "kafka";
281
- nats: "nats";
282
- }>;
283
- channel: z.ZodString;
284
- }, z.core.$strip>], "name">;
285
- recognition: z.ZodString;
286
- }, z.core.$strip>;
287
- type TypeShape = {
288
- type: "record";
289
- properties: Record<string, TypeShape>;
290
- spreads?: Array<{
291
- sourceText: string;
292
- }> | undefined;
293
- } | {
294
- type: "dictionary";
295
- values: TypeShape;
296
- } | {
297
- type: "array";
298
- items: TypeShape;
299
- } | {
300
- type: "literal";
301
- value: string | number | boolean;
302
- raw?: string | undefined;
303
- } | {
304
- type: "text";
305
- } | {
306
- type: "integer";
307
- } | {
308
- type: "number";
309
- } | {
310
- type: "boolean";
311
- } | {
312
- type: "null";
313
- } | {
314
- type: "undefined";
315
- } | {
316
- type: "union";
317
- variants: TypeShape[];
318
- } | {
319
- type: "ref";
320
- name: string;
321
- /**
322
- * Where this type is written down, when it is. The key into the
323
- * summary's table of definitions.
324
- *
325
- * A name does not identify a type. Every instantiation of one
326
- * generic reports the generic's own name and file, so `Omit<User,
327
- * "secret">` and `Omit<Order, "total">` are both `Omit`, and a
328
- * table keyed on that hands the second one the first one's
329
- * fields. This is built from what the type actually is.
330
- */
331
- def?: string | undefined;
332
- /**
333
- * The file that declares this type, when the project declares it.
334
- * Absent for a name the language or a dependency owns, which means
335
- * the same thing everywhere.
336
- *
337
- * A name on its own does not identify a type. Two modules each
338
- * declaring a `User` produce the same ref, and a checker comparing
339
- * them has nothing to go on. This is what tells them apart.
340
- */
341
- from?: string | undefined;
342
- } | {
343
- type: "unknown";
344
- };
345
- /**
346
- * How a table of definitions names the type a ref points at.
347
- *
348
- * A ref carries the name and the file that declares it, and that pair
349
- * already identifies the type, so a table keyed on it needs nothing new
350
- * on the ref. A name the language or a dependency owns has no file and
351
- * keys on the name alone.
352
- */
353
- declare function typeDefinitionKey(ref: {
354
- def?: string | undefined;
355
- }): string | null;
356
- declare const TypeShapeSchema: z.ZodType<TypeShape>;
357
- /**
358
- * A shape with the definitions it names put back into it.
359
- *
360
- * Comparing two shapes means comparing their structure, and a ref has
361
- * none. Rather than teach every comparison to look in a table, the
362
- * table goes back into the shape once, and everything downstream reads
363
- * what it always read.
364
- *
365
- * Putting a definition back is a substitution rather than a level of
366
- * nesting, so it does not spend depth. Counting it did: a type six
367
- * deep came back three deep, and a consumer reading a field past that
368
- * point was told the provider did not have it. What stops a type that
369
- * names itself is the set of names already being put back on this
370
- * path, which is how the shape walk guards its own cycles.
371
- */
372
- declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
373
-
374
- export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema, typeDefinitionKey, withDefinitionsInlined };
1
+ import 'zod';
2
+ export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, e as DeployableUnitSchema, f as FunctionCallSemanticsSchema, g as GraphqlOperationSemanticsSchema, i 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-BWvfkxSH.js';
package/dist/schemas.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  TypeShapeSchema,
18
18
  typeDefinitionKey,
19
19
  withDefinitionsInlined
20
- } from "./chunk-L4XGOS3I.js";
20
+ } from "./chunk-5KE7OWN3.js";
21
21
  export {
22
22
  BoundaryBindingSchema,
23
23
  ConfidenceInfoSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/ir-core",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
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": [
@@ -1,237 +0,0 @@
1
- // src/schemas.ts
2
- import { z } from "zod";
3
- var ConfidenceSourceSchema = z.enum([
4
- "inferred_static",
5
- "inferred_ai",
6
- "declared",
7
- "derived"
8
- ]);
9
- var ConfidenceLevelSchema = z.enum(["high", "medium", "low"]);
10
- var CorroborationSchema = z.object({
11
- outcome: z.enum(["observed", "refuted", "untested"]),
12
- /** Executions that produced a verdict for this claim. */
13
- runs: z.number(),
14
- /** Present when refuted: the input and observation that disagreed. */
15
- counterexample: z.unknown().optional(),
16
- /** Present when untested: why no verdict was reachable. */
17
- reason: z.string().optional()
18
- });
19
- var ConfidenceInfoSchema = z.object({
20
- source: ConfidenceSourceSchema,
21
- level: ConfidenceLevelSchema,
22
- corroboration: CorroborationSchema.optional()
23
- });
24
- var SourceLocationSchema = z.object({
25
- file: z.string(),
26
- range: z.object({ start: z.number(), end: z.number() }),
27
- exportName: z.string().nullable(),
28
- /**
29
- * What the extract was pointed at, as that project calls itself.
30
- *
31
- * A path is relative to wherever the extract ran, so two services in
32
- * one repository both say `src/handlers.ts` and merging their
33
- * summaries puts them on top of each other. This is what tells them
34
- * apart, and what a reader groups by.
35
- */
36
- workspace: z.string().optional()
37
- });
38
- var RestSemanticsSchema = z.object({
39
- name: z.literal("rest"),
40
- /** Uppercase HTTP method ("GET", "POST", …). */
41
- method: z.string(),
42
- /** Normalized route path ("/users/{id}"). */
43
- path: z.string(),
44
- /**
45
- * Status codes the producing source explicitly declared (OpenAPI
46
- * responses, CFN MethodResponses, ts-rest router statuses). Kept here
47
- * so the pairing layer can still see them without unwrapping metadata.
48
- * Empty / absent for inferred sources.
49
- */
50
- declaredResponses: z.array(z.number()).optional()
51
- });
52
- var FunctionCallSemanticsSchema = z.object({
53
- name: z.literal("function-call"),
54
- /**
55
- * Optional module identifier for cross-unit references
56
- * (e.g. `"./components/Button"` for a React component, or the TS
57
- * module path for a bare function export). Packs that don't do
58
- * cross-module pairing can leave it unset.
59
- */
60
- module: z.string().optional(),
61
- /** Named export within the module, when applicable. */
62
- exportName: z.string().optional(),
63
- /**
64
- * Package name (as written in `package.json`) when this identity
65
- * refers to a public package export — e.g. `"@suss/behavioral-ir"`.
66
- * Set alongside `exportPath` by packs that resolve a package's
67
- * public surface (the `packageExports` discovery variant). Distinct
68
- * from `module`, which is a repo-relative module path for
69
- * intra-repo pairing.
70
- */
71
- package: z.string().optional(),
72
- /**
73
- * Path to the exported binding within the package, starting with
74
- * the sub-path key when one is used. Examples:
75
- * `["parseSummary"]` — root export
76
- * `["schemas", "BoundaryBindingSchema"]` — sub-path `./schemas`
77
- *
78
- * The first segment is the sub-path without the leading `./`
79
- * (`"."` → omitted). The last segment is the exported name.
80
- */
81
- exportPath: z.array(z.string()).optional()
82
- });
83
- var GraphqlResolverSemanticsSchema = z.object({
84
- name: z.literal("graphql-resolver"),
85
- /** GraphQL type the resolver attaches to: "Query", "Mutation", "Subscription", or an object-type name. */
86
- typeName: z.string(),
87
- /** Field name on that type. */
88
- fieldName: z.string()
89
- });
90
- var GraphqlOperationSemanticsSchema = z.object({
91
- name: z.literal("graphql-operation"),
92
- /** Optional operation name — anonymous queries / mutations leave this unset. */
93
- operationName: z.string().optional(),
94
- operationType: z.enum(["query", "mutation", "subscription"])
95
- });
96
- var DeployableUnitSchema = z.object({
97
- deploymentTarget: z.enum([
98
- "lambda",
99
- "ecs-task",
100
- "container",
101
- "k8s-deployment"
102
- ]),
103
- // An empty name would agree with every other empty name, so a unit
104
- // that names nothing has to leave the field off instead.
105
- instanceName: z.string().min(1)
106
- });
107
- var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
108
- name: z.literal("runtime-config")
109
- });
110
- var StorageRelationalSemanticsSchema = z.object({
111
- name: z.literal("storage-relational"),
112
- storageSystem: z.enum(["postgres", "mysql", "sqlite"]),
113
- /**
114
- * ORM / driver scope. Defaults to `"default"` for single-database
115
- * setups; monorepos with multiple schemas use distinct values.
116
- */
117
- scope: z.string(),
118
- /** Table / model name as declared in the schema. */
119
- table: z.string()
120
- });
121
- var MessageBusSemanticsSchema = z.object({
122
- name: z.literal("message-bus"),
123
- messageBus: z.enum(["sqs", "eventbridge", "bullmq", "kafka", "nats"]),
124
- /** Stable channel identifier — CFN logical id, queue/topic name, subject pattern, `bus#detailType`. */
125
- channel: z.string()
126
- });
127
- var SemanticsSchema = z.discriminatedUnion("name", [
128
- RestSemanticsSchema,
129
- FunctionCallSemanticsSchema,
130
- GraphqlResolverSemanticsSchema,
131
- GraphqlOperationSemanticsSchema,
132
- RuntimeConfigSemanticsSchema,
133
- StorageRelationalSemanticsSchema,
134
- MessageBusSemanticsSchema
135
- ]);
136
- var BoundaryBindingSchema = z.object({
137
- transport: z.string(),
138
- semantics: SemanticsSchema,
139
- recognition: z.string()
140
- });
141
- function typeDefinitionKey(ref) {
142
- return ref.def ?? null;
143
- }
144
- var TypeShapeSchema = z.lazy(
145
- () => z.discriminatedUnion("type", [
146
- z.object({
147
- type: z.literal("record"),
148
- properties: z.record(z.string(), TypeShapeSchema),
149
- spreads: z.array(z.object({ sourceText: z.string() })).optional()
150
- }),
151
- z.object({ type: z.literal("dictionary"), values: TypeShapeSchema }),
152
- z.object({ type: z.literal("array"), items: TypeShapeSchema }),
153
- z.object({
154
- type: z.literal("literal"),
155
- value: z.union([z.string(), z.number(), z.boolean()]),
156
- raw: z.string().optional()
157
- }),
158
- z.object({ type: z.literal("text") }),
159
- z.object({ type: z.literal("integer") }),
160
- z.object({ type: z.literal("number") }),
161
- z.object({ type: z.literal("boolean") }),
162
- z.object({ type: z.literal("null") }),
163
- z.object({ type: z.literal("undefined") }),
164
- z.object({
165
- type: z.literal("union"),
166
- variants: z.array(TypeShapeSchema)
167
- }),
168
- z.object({
169
- type: z.literal("ref"),
170
- name: z.string(),
171
- from: z.string().optional(),
172
- def: z.string().optional()
173
- }),
174
- z.object({ type: z.literal("unknown") })
175
- ])
176
- );
177
- var MAX_DEFINITION_DEPTH = 6;
178
- function withDefinitionsInlined(shape, definitions, depth = 0, inProgress = /* @__PURE__ */ new Set()) {
179
- if (definitions === void 0 || depth >= MAX_DEFINITION_DEPTH) {
180
- return shape;
181
- }
182
- const deeper = (inner) => withDefinitionsInlined(inner, definitions, depth + 1, inProgress);
183
- if (shape.type === "ref") {
184
- const key = typeDefinitionKey(shape);
185
- if (key === null) {
186
- return shape;
187
- }
188
- const defined = definitions[key];
189
- if (defined === void 0 || inProgress.has(key)) {
190
- return shape;
191
- }
192
- return withDefinitionsInlined(
193
- defined,
194
- definitions,
195
- depth,
196
- /* @__PURE__ */ new Set([...inProgress, key])
197
- );
198
- }
199
- if (shape.type === "record") {
200
- const properties = {};
201
- for (const [name, value] of Object.entries(shape.properties)) {
202
- properties[name] = deeper(value);
203
- }
204
- return { ...shape, properties };
205
- }
206
- if (shape.type === "array") {
207
- return { ...shape, items: deeper(shape.items) };
208
- }
209
- if (shape.type === "dictionary") {
210
- return { ...shape, values: deeper(shape.values) };
211
- }
212
- if (shape.type === "union") {
213
- return { ...shape, variants: shape.variants.map(deeper) };
214
- }
215
- return shape;
216
- }
217
-
218
- export {
219
- ConfidenceSourceSchema,
220
- ConfidenceLevelSchema,
221
- CorroborationSchema,
222
- ConfidenceInfoSchema,
223
- SourceLocationSchema,
224
- RestSemanticsSchema,
225
- FunctionCallSemanticsSchema,
226
- GraphqlResolverSemanticsSchema,
227
- GraphqlOperationSemanticsSchema,
228
- DeployableUnitSchema,
229
- RuntimeConfigSemanticsSchema,
230
- StorageRelationalSemanticsSchema,
231
- MessageBusSemanticsSchema,
232
- SemanticsSchema,
233
- BoundaryBindingSchema,
234
- typeDefinitionKey,
235
- TypeShapeSchema,
236
- withDefinitionsInlined
237
- };