@suss/ir-core 0.1.0 → 0.1.1

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.
@@ -84,19 +84,19 @@ var GraphqlOperationSemanticsSchema = z.object({
84
84
  operationName: z.string().optional(),
85
85
  operationType: z.enum(["query", "mutation", "subscription"])
86
86
  });
87
- var RuntimeConfigSemanticsSchema = z.object({
88
- name: z.literal("runtime-config"),
87
+ var DeployableUnitSchema = z.object({
89
88
  deploymentTarget: z.enum([
90
89
  "lambda",
91
90
  "ecs-task",
92
91
  "container",
93
92
  "k8s-deployment"
94
93
  ]),
95
- /**
96
- * Stable identifier for the runtime instance — CFN logical resource
97
- * ID for Lambda / ECS, k8s deployment name, container name.
98
- */
99
- instanceName: z.string()
94
+ // An empty name would agree with every other empty name, so a unit
95
+ // that names nothing has to leave the field off instead.
96
+ instanceName: z.string().min(1)
97
+ });
98
+ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
99
+ name: z.literal("runtime-config")
100
100
  });
101
101
  var StorageRelationalSemanticsSchema = z.object({
102
102
  name: z.literal("storage-relational"),
@@ -153,7 +153,11 @@ var TypeShapeSchema = z.lazy(
153
153
  type: z.literal("union"),
154
154
  variants: z.array(TypeShapeSchema)
155
155
  }),
156
- z.object({ type: z.literal("ref"), name: z.string() }),
156
+ z.object({
157
+ type: z.literal("ref"),
158
+ name: z.string(),
159
+ from: z.string().optional()
160
+ }),
157
161
  z.object({ type: z.literal("unknown") })
158
162
  ])
159
163
  );
@@ -168,6 +172,7 @@ export {
168
172
  FunctionCallSemanticsSchema,
169
173
  GraphqlResolverSemanticsSchema,
170
174
  GraphqlOperationSemanticsSchema,
175
+ DeployableUnitSchema,
171
176
  RuntimeConfigSemanticsSchema,
172
177
  StorageRelationalSemanticsSchema,
173
178
  MessageBusSemanticsSchema,
package/dist/index.cjs CHANGED
@@ -25,6 +25,7 @@ __export(index_exports, {
25
25
  ConfidenceLevelSchema: () => ConfidenceLevelSchema,
26
26
  ConfidenceSourceSchema: () => ConfidenceSourceSchema,
27
27
  CorroborationSchema: () => CorroborationSchema,
28
+ DeployableUnitSchema: () => DeployableUnitSchema,
28
29
  FunctionCallSemanticsSchema: () => FunctionCallSemanticsSchema,
29
30
  GraphqlOperationSemanticsSchema: () => GraphqlOperationSemanticsSchema,
30
31
  GraphqlResolverSemanticsSchema: () => GraphqlResolverSemanticsSchema,
@@ -42,7 +43,10 @@ __export(index_exports, {
42
43
  boundaryKey: () => boundaryKey,
43
44
  busesAgree: () => busesAgree,
44
45
  channelsPair: () => channelsPair,
46
+ codeScopePath: () => codeScopePath,
45
47
  countsForThreshold: () => countsForThreshold,
48
+ dispatchByType: () => dispatchByType,
49
+ fileInCodeScope: () => fileInCodeScope,
46
50
  functionCallBinding: () => functionCallBinding,
47
51
  graphqlOperationBinding: () => graphqlOperationBinding,
48
52
  graphqlResolverBinding: () => graphqlResolverBinding,
@@ -145,19 +149,19 @@ var GraphqlOperationSemanticsSchema = import_zod.z.object({
145
149
  operationName: import_zod.z.string().optional(),
146
150
  operationType: import_zod.z.enum(["query", "mutation", "subscription"])
147
151
  });
148
- var RuntimeConfigSemanticsSchema = import_zod.z.object({
149
- name: import_zod.z.literal("runtime-config"),
152
+ var DeployableUnitSchema = import_zod.z.object({
150
153
  deploymentTarget: import_zod.z.enum([
151
154
  "lambda",
152
155
  "ecs-task",
153
156
  "container",
154
157
  "k8s-deployment"
155
158
  ]),
156
- /**
157
- * Stable identifier for the runtime instance — CFN logical resource
158
- * ID for Lambda / ECS, k8s deployment name, container name.
159
- */
160
- instanceName: import_zod.z.string()
159
+ // An empty name would agree with every other empty name, so a unit
160
+ // that names nothing has to leave the field off instead.
161
+ instanceName: import_zod.z.string().min(1)
162
+ });
163
+ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
164
+ name: import_zod.z.literal("runtime-config")
161
165
  });
162
166
  var StorageRelationalSemanticsSchema = import_zod.z.object({
163
167
  name: import_zod.z.literal("storage-relational"),
@@ -214,7 +218,11 @@ var TypeShapeSchema = import_zod.z.lazy(
214
218
  type: import_zod.z.literal("union"),
215
219
  variants: import_zod.z.array(TypeShapeSchema)
216
220
  }),
217
- import_zod.z.object({ type: import_zod.z.literal("ref"), name: import_zod.z.string() }),
221
+ import_zod.z.object({
222
+ type: import_zod.z.literal("ref"),
223
+ name: import_zod.z.string(),
224
+ from: import_zod.z.string().optional()
225
+ }),
218
226
  import_zod.z.object({ type: import_zod.z.literal("unknown") })
219
227
  ])
220
228
  );
@@ -259,6 +267,9 @@ function boundaryKey(binding) {
259
267
  return `${method} ${path}`;
260
268
  }
261
269
  if (semantics.name === "graphql-resolver") {
270
+ if (semantics.typeName === "" || semantics.fieldName === "") {
271
+ return null;
272
+ }
262
273
  return `gql:${semantics.typeName}.${semantics.fieldName}`;
263
274
  }
264
275
  if (semantics.name === "message-bus") {
@@ -277,6 +288,25 @@ function boundaryKey(binding) {
277
288
  return null;
278
289
  }
279
290
 
291
+ // src/codeScope.ts
292
+ function codeScopePath(raw) {
293
+ return raw.trim().replace(/^\.\//, "").replace(/\/+$/, "");
294
+ }
295
+ function fileInCodeScope(file, scope) {
296
+ const prefix = codeScopePath(scope);
297
+ if (prefix === "" || prefix === ".") {
298
+ return true;
299
+ }
300
+ const path = codeScopePath(file);
301
+ return path === prefix || path.startsWith(`${prefix}/`);
302
+ }
303
+
304
+ // src/dispatch.ts
305
+ function dispatchByType(table, value) {
306
+ const handler = table[value.type];
307
+ return handler(value);
308
+ }
309
+
280
310
  // src/suppressions.ts
281
311
  var import_zod2 = require("zod");
282
312
  var SuppressionSideSchema = import_zod2.z.object({
@@ -409,10 +439,11 @@ function bodyShapesMatch(actual, declared) {
409
439
  if (actual.type === "unknown" || declared.type === "unknown") {
410
440
  return "unknown";
411
441
  }
442
+ if (actual.type === "ref" && declared.type === "ref") {
443
+ const sameDeclaration = actual.from !== void 0 && actual.from === declared.from && actual.name === declared.name;
444
+ return sameDeclaration ? "match" : "unknown";
445
+ }
412
446
  if (actual.type === "ref" || declared.type === "ref") {
413
- if (actual.type === "ref" && declared.type === "ref" && actual.name === declared.name) {
414
- return "match";
415
- }
416
447
  return "unknown";
417
448
  }
418
449
  if (actual.type === "union") {
@@ -644,6 +675,7 @@ function messageBusBinding(opts) {
644
675
  ConfidenceLevelSchema,
645
676
  ConfidenceSourceSchema,
646
677
  CorroborationSchema,
678
+ DeployableUnitSchema,
647
679
  FunctionCallSemanticsSchema,
648
680
  GraphqlOperationSemanticsSchema,
649
681
  GraphqlResolverSemanticsSchema,
@@ -661,7 +693,10 @@ function messageBusBinding(opts) {
661
693
  boundaryKey,
662
694
  busesAgree,
663
695
  channelsPair,
696
+ codeScopePath,
664
697
  countsForThreshold,
698
+ dispatchByType,
699
+ fileInCodeScope,
665
700
  functionCallBinding,
666
701
  graphqlOperationBinding,
667
702
  graphqlResolverBinding,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { TypeShape, BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, SemanticsSchema, SourceLocationSchema } from './schemas.cjs';
2
+ import { TypeShape, BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, SemanticsSchema, SourceLocationSchema } from './schemas.cjs';
3
3
  export { FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, StorageRelationalSemanticsSchema, TypeShapeSchema } from './schemas.cjs';
4
4
 
5
5
  /**
@@ -14,7 +14,9 @@ declare function normalizePath(path: string): string;
14
14
  * Compute a stable string key from a boundary binding for grouping.
15
15
  * Dispatches on `semantics.name`:
16
16
  * - `rest` → `"METHOD /normalized/path"` (null if method or path empty)
17
- * - `graphql-resolver` → `"gql:<TypeName>.<fieldName>"`
17
+ * - `graphql-resolver` → `"gql:<TypeName>.<fieldName>"` (null when
18
+ * either is empty, which is how a resolver says the source never
19
+ * named the field it answers)
18
20
  * - `message-bus` → `"bus:<messageBus> <subject>"` (null if the
19
21
  * subject is empty)
20
22
  * - `function-call` → `"fn:<package>::<exportPath>"` when both
@@ -45,6 +47,34 @@ declare function busesAgree(a: string | null, b: string | null): boolean;
45
47
  /** Whether two channels name the same subject on agreeing buses. */
46
48
  declare function channelsPair(a: string, b: string): boolean;
47
49
 
50
+ /**
51
+ * The canonical form of a code-scope directory: no leading `./`, no
52
+ * trailing slash, no surrounding whitespace. An empty result means the
53
+ * scope names the project root.
54
+ */
55
+ declare function codeScopePath(raw: string): string;
56
+ /**
57
+ * Whether a project-relative file sits inside a code scope. Matching
58
+ * stops at a segment boundary, so `src/foo` covers `src/foo/a.ts` and
59
+ * never `src/foobar/a.ts`. A scope naming the project root covers
60
+ * every file.
61
+ *
62
+ * Both arguments pass through `codeScopePath`, so a scope stored under
63
+ * either of the older trailing-slash conventions still reads correctly.
64
+ */
65
+ declare function fileInCodeScope(file: string, scope: string): boolean;
66
+
67
+ type DispatchTable<T extends {
68
+ type: string;
69
+ }, R> = {
70
+ [K in T["type"]]: (variant: Extract<T, {
71
+ type: K;
72
+ }>) => R;
73
+ };
74
+ declare function dispatchByType<T extends {
75
+ type: string;
76
+ }, R>(table: DispatchTable<T, R>, value: T): R;
77
+
48
78
  declare const SuppressionRuleSchema: z.ZodObject<{
49
79
  kind: z.ZodOptional<z.ZodString>;
50
80
  boundary: z.ZodOptional<z.ZodString>;
@@ -204,6 +234,7 @@ type StorageRelationalSemantics = Extract<Semantics, {
204
234
  type MessageBusSemantics = Extract<Semantics, {
205
235
  name: "message-bus";
206
236
  }>;
237
+ type DeployableUnit = z.infer<typeof DeployableUnitSchema>;
207
238
 
208
239
  /**
209
240
  * Build a REST-semantics binding. `method` and `path` can be empty
@@ -293,4 +324,4 @@ declare function messageBusBinding(opts: {
293
324
  channel: string;
294
325
  }): BoundaryBinding;
295
326
 
296
- export { type BoundaryBinding, BoundaryBindingSchema, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, type FindingSuppression, type FunctionCallSemantics, type GraphqlOperationSemantics, type GraphqlResolverSemantics, type MatchResult, type MessageBusSemantics, type ParsedChannel, type RestSemantics, type RuntimeConfigSemantics, type Semantics, SemanticsSchema, type SourceLocation, SourceLocationSchema, type StorageRelationalSemantics, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, busesAgree, channelsPair, countsForThreshold, functionCallBinding, graphqlOperationBinding, graphqlResolverBinding, messageBusBinding, normalizePath, normalizeRuleBoundary, packageExportBinding, parseChannel, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, storageRelationalBinding, validateRule };
327
+ export { type BoundaryBinding, BoundaryBindingSchema, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, type DeployableUnit, DeployableUnitSchema, type DispatchTable, type FindingSuppression, type FunctionCallSemantics, type GraphqlOperationSemantics, type GraphqlResolverSemantics, type MatchResult, type MessageBusSemantics, type ParsedChannel, type RestSemantics, type RuntimeConfigSemantics, type Semantics, SemanticsSchema, type SourceLocation, SourceLocationSchema, type StorageRelationalSemantics, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, busesAgree, channelsPair, codeScopePath, countsForThreshold, dispatchByType, fileInCodeScope, functionCallBinding, graphqlOperationBinding, graphqlResolverBinding, messageBusBinding, normalizePath, normalizeRuleBoundary, packageExportBinding, parseChannel, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, storageRelationalBinding, validateRule };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { TypeShape, BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, SemanticsSchema, SourceLocationSchema } from './schemas.js';
2
+ import { TypeShape, BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, SemanticsSchema, SourceLocationSchema } from './schemas.js';
3
3
  export { FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, StorageRelationalSemanticsSchema, TypeShapeSchema } from './schemas.js';
4
4
 
5
5
  /**
@@ -14,7 +14,9 @@ declare function normalizePath(path: string): string;
14
14
  * Compute a stable string key from a boundary binding for grouping.
15
15
  * Dispatches on `semantics.name`:
16
16
  * - `rest` → `"METHOD /normalized/path"` (null if method or path empty)
17
- * - `graphql-resolver` → `"gql:<TypeName>.<fieldName>"`
17
+ * - `graphql-resolver` → `"gql:<TypeName>.<fieldName>"` (null when
18
+ * either is empty, which is how a resolver says the source never
19
+ * named the field it answers)
18
20
  * - `message-bus` → `"bus:<messageBus> <subject>"` (null if the
19
21
  * subject is empty)
20
22
  * - `function-call` → `"fn:<package>::<exportPath>"` when both
@@ -45,6 +47,34 @@ declare function busesAgree(a: string | null, b: string | null): boolean;
45
47
  /** Whether two channels name the same subject on agreeing buses. */
46
48
  declare function channelsPair(a: string, b: string): boolean;
47
49
 
50
+ /**
51
+ * The canonical form of a code-scope directory: no leading `./`, no
52
+ * trailing slash, no surrounding whitespace. An empty result means the
53
+ * scope names the project root.
54
+ */
55
+ declare function codeScopePath(raw: string): string;
56
+ /**
57
+ * Whether a project-relative file sits inside a code scope. Matching
58
+ * stops at a segment boundary, so `src/foo` covers `src/foo/a.ts` and
59
+ * never `src/foobar/a.ts`. A scope naming the project root covers
60
+ * every file.
61
+ *
62
+ * Both arguments pass through `codeScopePath`, so a scope stored under
63
+ * either of the older trailing-slash conventions still reads correctly.
64
+ */
65
+ declare function fileInCodeScope(file: string, scope: string): boolean;
66
+
67
+ type DispatchTable<T extends {
68
+ type: string;
69
+ }, R> = {
70
+ [K in T["type"]]: (variant: Extract<T, {
71
+ type: K;
72
+ }>) => R;
73
+ };
74
+ declare function dispatchByType<T extends {
75
+ type: string;
76
+ }, R>(table: DispatchTable<T, R>, value: T): R;
77
+
48
78
  declare const SuppressionRuleSchema: z.ZodObject<{
49
79
  kind: z.ZodOptional<z.ZodString>;
50
80
  boundary: z.ZodOptional<z.ZodString>;
@@ -204,6 +234,7 @@ type StorageRelationalSemantics = Extract<Semantics, {
204
234
  type MessageBusSemantics = Extract<Semantics, {
205
235
  name: "message-bus";
206
236
  }>;
237
+ type DeployableUnit = z.infer<typeof DeployableUnitSchema>;
207
238
 
208
239
  /**
209
240
  * Build a REST-semantics binding. `method` and `path` can be empty
@@ -293,4 +324,4 @@ declare function messageBusBinding(opts: {
293
324
  channel: string;
294
325
  }): BoundaryBinding;
295
326
 
296
- export { type BoundaryBinding, BoundaryBindingSchema, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, type FindingSuppression, type FunctionCallSemantics, type GraphqlOperationSemantics, type GraphqlResolverSemantics, type MatchResult, type MessageBusSemantics, type ParsedChannel, type RestSemantics, type RuntimeConfigSemantics, type Semantics, SemanticsSchema, type SourceLocation, SourceLocationSchema, type StorageRelationalSemantics, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, busesAgree, channelsPair, countsForThreshold, functionCallBinding, graphqlOperationBinding, graphqlResolverBinding, messageBusBinding, normalizePath, normalizeRuleBoundary, packageExportBinding, parseChannel, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, storageRelationalBinding, validateRule };
327
+ export { type BoundaryBinding, BoundaryBindingSchema, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, type DeployableUnit, DeployableUnitSchema, type DispatchTable, type FindingSuppression, type FunctionCallSemantics, type GraphqlOperationSemantics, type GraphqlResolverSemantics, type MatchResult, type MessageBusSemantics, type ParsedChannel, type RestSemantics, type RuntimeConfigSemantics, type Semantics, SemanticsSchema, type SourceLocation, SourceLocationSchema, type StorageRelationalSemantics, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, busesAgree, channelsPair, codeScopePath, countsForThreshold, dispatchByType, fileInCodeScope, functionCallBinding, graphqlOperationBinding, graphqlResolverBinding, messageBusBinding, normalizePath, normalizeRuleBoundary, packageExportBinding, parseChannel, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, storageRelationalBinding, validateRule };
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  ConfidenceLevelSchema,
5
5
  ConfidenceSourceSchema,
6
6
  CorroborationSchema,
7
+ DeployableUnitSchema,
7
8
  FunctionCallSemanticsSchema,
8
9
  GraphqlOperationSemanticsSchema,
9
10
  GraphqlResolverSemanticsSchema,
@@ -14,7 +15,7 @@ import {
14
15
  SourceLocationSchema,
15
16
  StorageRelationalSemanticsSchema,
16
17
  TypeShapeSchema
17
- } from "./chunk-BQEWYFCF.js";
18
+ } from "./chunk-QQLJDL3C.js";
18
19
 
19
20
  // src/channel.ts
20
21
  function parseChannel(channel) {
@@ -56,6 +57,9 @@ function boundaryKey(binding) {
56
57
  return `${method} ${path}`;
57
58
  }
58
59
  if (semantics.name === "graphql-resolver") {
60
+ if (semantics.typeName === "" || semantics.fieldName === "") {
61
+ return null;
62
+ }
59
63
  return `gql:${semantics.typeName}.${semantics.fieldName}`;
60
64
  }
61
65
  if (semantics.name === "message-bus") {
@@ -74,6 +78,25 @@ function boundaryKey(binding) {
74
78
  return null;
75
79
  }
76
80
 
81
+ // src/codeScope.ts
82
+ function codeScopePath(raw) {
83
+ return raw.trim().replace(/^\.\//, "").replace(/\/+$/, "");
84
+ }
85
+ function fileInCodeScope(file, scope) {
86
+ const prefix = codeScopePath(scope);
87
+ if (prefix === "" || prefix === ".") {
88
+ return true;
89
+ }
90
+ const path = codeScopePath(file);
91
+ return path === prefix || path.startsWith(`${prefix}/`);
92
+ }
93
+
94
+ // src/dispatch.ts
95
+ function dispatchByType(table, value) {
96
+ const handler = table[value.type];
97
+ return handler(value);
98
+ }
99
+
77
100
  // src/suppressions.ts
78
101
  import { z } from "zod";
79
102
  var SuppressionSideSchema = z.object({
@@ -206,10 +229,11 @@ function bodyShapesMatch(actual, declared) {
206
229
  if (actual.type === "unknown" || declared.type === "unknown") {
207
230
  return "unknown";
208
231
  }
232
+ if (actual.type === "ref" && declared.type === "ref") {
233
+ const sameDeclaration = actual.from !== void 0 && actual.from === declared.from && actual.name === declared.name;
234
+ return sameDeclaration ? "match" : "unknown";
235
+ }
209
236
  if (actual.type === "ref" || declared.type === "ref") {
210
- if (actual.type === "ref" && declared.type === "ref" && actual.name === declared.name) {
211
- return "match";
212
- }
213
237
  return "unknown";
214
238
  }
215
239
  if (actual.type === "union") {
@@ -440,6 +464,7 @@ export {
440
464
  ConfidenceLevelSchema,
441
465
  ConfidenceSourceSchema,
442
466
  CorroborationSchema,
467
+ DeployableUnitSchema,
443
468
  FunctionCallSemanticsSchema,
444
469
  GraphqlOperationSemanticsSchema,
445
470
  GraphqlResolverSemanticsSchema,
@@ -457,7 +482,10 @@ export {
457
482
  boundaryKey,
458
483
  busesAgree,
459
484
  channelsPair,
485
+ codeScopePath,
460
486
  countsForThreshold,
487
+ dispatchByType,
488
+ fileInCodeScope,
461
489
  functionCallBinding,
462
490
  graphqlOperationBinding,
463
491
  graphqlResolverBinding,
package/dist/schemas.cjs CHANGED
@@ -25,6 +25,7 @@ __export(schemas_exports, {
25
25
  ConfidenceLevelSchema: () => ConfidenceLevelSchema,
26
26
  ConfidenceSourceSchema: () => ConfidenceSourceSchema,
27
27
  CorroborationSchema: () => CorroborationSchema,
28
+ DeployableUnitSchema: () => DeployableUnitSchema,
28
29
  FunctionCallSemanticsSchema: () => FunctionCallSemanticsSchema,
29
30
  GraphqlOperationSemanticsSchema: () => GraphqlOperationSemanticsSchema,
30
31
  GraphqlResolverSemanticsSchema: () => GraphqlResolverSemanticsSchema,
@@ -122,19 +123,19 @@ var GraphqlOperationSemanticsSchema = import_zod.z.object({
122
123
  operationName: import_zod.z.string().optional(),
123
124
  operationType: import_zod.z.enum(["query", "mutation", "subscription"])
124
125
  });
125
- var RuntimeConfigSemanticsSchema = import_zod.z.object({
126
- name: import_zod.z.literal("runtime-config"),
126
+ var DeployableUnitSchema = import_zod.z.object({
127
127
  deploymentTarget: import_zod.z.enum([
128
128
  "lambda",
129
129
  "ecs-task",
130
130
  "container",
131
131
  "k8s-deployment"
132
132
  ]),
133
- /**
134
- * Stable identifier for the runtime instance — CFN logical resource
135
- * ID for Lambda / ECS, k8s deployment name, container name.
136
- */
137
- instanceName: import_zod.z.string()
133
+ // An empty name would agree with every other empty name, so a unit
134
+ // that names nothing has to leave the field off instead.
135
+ instanceName: import_zod.z.string().min(1)
136
+ });
137
+ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
138
+ name: import_zod.z.literal("runtime-config")
138
139
  });
139
140
  var StorageRelationalSemanticsSchema = import_zod.z.object({
140
141
  name: import_zod.z.literal("storage-relational"),
@@ -191,7 +192,11 @@ var TypeShapeSchema = import_zod.z.lazy(
191
192
  type: import_zod.z.literal("union"),
192
193
  variants: import_zod.z.array(TypeShapeSchema)
193
194
  }),
194
- import_zod.z.object({ type: import_zod.z.literal("ref"), name: import_zod.z.string() }),
195
+ import_zod.z.object({
196
+ type: import_zod.z.literal("ref"),
197
+ name: import_zod.z.string(),
198
+ from: import_zod.z.string().optional()
199
+ }),
195
200
  import_zod.z.object({ type: import_zod.z.literal("unknown") })
196
201
  ])
197
202
  );
@@ -202,6 +207,7 @@ var TypeShapeSchema = import_zod.z.lazy(
202
207
  ConfidenceLevelSchema,
203
208
  ConfidenceSourceSchema,
204
209
  CorroborationSchema,
210
+ DeployableUnitSchema,
205
211
  FunctionCallSemanticsSchema,
206
212
  GraphqlOperationSemanticsSchema,
207
213
  GraphqlResolverSemanticsSchema,
@@ -101,13 +101,32 @@ declare const GraphqlOperationSemanticsSchema: z.ZodObject<{
101
101
  }>;
102
102
  }, z.core.$strip>;
103
103
  /**
104
- * Provider-side runtime configuration channel — env vars + their
104
+ * One thing that gets deployed and runs on its own: a Lambda
105
+ * function, an ECS task's container, a plain container, a k8s
106
+ * deployment.
107
+ *
108
+ * `instanceName` is the stable identifier the deployment medium uses:
109
+ * the CFN logical resource id for Lambda and ECS, the deployment name
110
+ * for k8s, the container name for a plain container.
111
+ */
112
+ declare const DeployableUnitSchema: z.ZodObject<{
113
+ deploymentTarget: z.ZodEnum<{
114
+ lambda: "lambda";
115
+ "ecs-task": "ecs-task";
116
+ container: "container";
117
+ "k8s-deployment": "k8s-deployment";
118
+ }>;
119
+ instanceName: z.ZodString;
120
+ }, z.core.$strip>;
121
+ /**
122
+ * Provider-side runtime configuration channel: env vars and their
105
123
  * declared values on a deployable unit. The channel is the boundary;
106
124
  * env var names are FIELDS on its contract. Pairing key:
107
- * `(deploymentTarget, instanceName)`.
125
+ * `(deploymentTarget, instanceName)`, which is exactly a deployable
126
+ * unit, so the two fields come from `DeployableUnitSchema` rather
127
+ * than being spelled a second time.
108
128
  */
109
129
  declare const RuntimeConfigSemanticsSchema: z.ZodObject<{
110
- name: z.ZodLiteral<"runtime-config">;
111
130
  deploymentTarget: z.ZodEnum<{
112
131
  lambda: "lambda";
113
132
  "ecs-task": "ecs-task";
@@ -115,6 +134,7 @@ declare const RuntimeConfigSemanticsSchema: z.ZodObject<{
115
134
  "k8s-deployment": "k8s-deployment";
116
135
  }>;
117
136
  instanceName: z.ZodString;
137
+ name: z.ZodLiteral<"runtime-config">;
118
138
  }, z.core.$strip>;
119
139
  /**
120
140
  * Provider-side relational storage table. Columns are FIELDS on the
@@ -179,7 +199,6 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
199
  subscription: "subscription";
180
200
  }>;
181
201
  }, z.core.$strip>, z.ZodObject<{
182
- name: z.ZodLiteral<"runtime-config">;
183
202
  deploymentTarget: z.ZodEnum<{
184
203
  lambda: "lambda";
185
204
  "ecs-task": "ecs-task";
@@ -187,6 +206,7 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
187
206
  "k8s-deployment": "k8s-deployment";
188
207
  }>;
189
208
  instanceName: z.ZodString;
209
+ name: z.ZodLiteral<"runtime-config">;
190
210
  }, z.core.$strip>, z.ZodObject<{
191
211
  name: z.ZodLiteral<"storage-relational">;
192
212
  storageSystem: z.ZodEnum<{
@@ -233,7 +253,6 @@ declare const BoundaryBindingSchema: z.ZodObject<{
233
253
  subscription: "subscription";
234
254
  }>;
235
255
  }, z.core.$strip>, z.ZodObject<{
236
- name: z.ZodLiteral<"runtime-config">;
237
256
  deploymentTarget: z.ZodEnum<{
238
257
  lambda: "lambda";
239
258
  "ecs-task": "ecs-task";
@@ -241,6 +260,7 @@ declare const BoundaryBindingSchema: z.ZodObject<{
241
260
  "k8s-deployment": "k8s-deployment";
242
261
  }>;
243
262
  instanceName: z.ZodString;
263
+ name: z.ZodLiteral<"runtime-config">;
244
264
  }, z.core.$strip>, z.ZodObject<{
245
265
  name: z.ZodLiteral<"storage-relational">;
246
266
  storageSystem: z.ZodEnum<{
@@ -297,9 +317,19 @@ type TypeShape = {
297
317
  } | {
298
318
  type: "ref";
299
319
  name: string;
320
+ /**
321
+ * The file that declares this type, when the project declares it.
322
+ * Absent for a name the language or a dependency owns, which means
323
+ * the same thing everywhere.
324
+ *
325
+ * A name on its own does not identify a type. Two modules each
326
+ * declaring a `User` produce the same ref, and a checker comparing
327
+ * them has nothing to go on. This is what tells them apart.
328
+ */
329
+ from?: string | undefined;
300
330
  } | {
301
331
  type: "unknown";
302
332
  };
303
333
  declare const TypeShapeSchema: z.ZodType<TypeShape>;
304
334
 
305
- export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema };
335
+ export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema };
package/dist/schemas.d.ts CHANGED
@@ -101,13 +101,32 @@ declare const GraphqlOperationSemanticsSchema: z.ZodObject<{
101
101
  }>;
102
102
  }, z.core.$strip>;
103
103
  /**
104
- * Provider-side runtime configuration channel — env vars + their
104
+ * One thing that gets deployed and runs on its own: a Lambda
105
+ * function, an ECS task's container, a plain container, a k8s
106
+ * deployment.
107
+ *
108
+ * `instanceName` is the stable identifier the deployment medium uses:
109
+ * the CFN logical resource id for Lambda and ECS, the deployment name
110
+ * for k8s, the container name for a plain container.
111
+ */
112
+ declare const DeployableUnitSchema: z.ZodObject<{
113
+ deploymentTarget: z.ZodEnum<{
114
+ lambda: "lambda";
115
+ "ecs-task": "ecs-task";
116
+ container: "container";
117
+ "k8s-deployment": "k8s-deployment";
118
+ }>;
119
+ instanceName: z.ZodString;
120
+ }, z.core.$strip>;
121
+ /**
122
+ * Provider-side runtime configuration channel: env vars and their
105
123
  * declared values on a deployable unit. The channel is the boundary;
106
124
  * env var names are FIELDS on its contract. Pairing key:
107
- * `(deploymentTarget, instanceName)`.
125
+ * `(deploymentTarget, instanceName)`, which is exactly a deployable
126
+ * unit, so the two fields come from `DeployableUnitSchema` rather
127
+ * than being spelled a second time.
108
128
  */
109
129
  declare const RuntimeConfigSemanticsSchema: z.ZodObject<{
110
- name: z.ZodLiteral<"runtime-config">;
111
130
  deploymentTarget: z.ZodEnum<{
112
131
  lambda: "lambda";
113
132
  "ecs-task": "ecs-task";
@@ -115,6 +134,7 @@ declare const RuntimeConfigSemanticsSchema: z.ZodObject<{
115
134
  "k8s-deployment": "k8s-deployment";
116
135
  }>;
117
136
  instanceName: z.ZodString;
137
+ name: z.ZodLiteral<"runtime-config">;
118
138
  }, z.core.$strip>;
119
139
  /**
120
140
  * Provider-side relational storage table. Columns are FIELDS on the
@@ -179,7 +199,6 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
199
  subscription: "subscription";
180
200
  }>;
181
201
  }, z.core.$strip>, z.ZodObject<{
182
- name: z.ZodLiteral<"runtime-config">;
183
202
  deploymentTarget: z.ZodEnum<{
184
203
  lambda: "lambda";
185
204
  "ecs-task": "ecs-task";
@@ -187,6 +206,7 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
187
206
  "k8s-deployment": "k8s-deployment";
188
207
  }>;
189
208
  instanceName: z.ZodString;
209
+ name: z.ZodLiteral<"runtime-config">;
190
210
  }, z.core.$strip>, z.ZodObject<{
191
211
  name: z.ZodLiteral<"storage-relational">;
192
212
  storageSystem: z.ZodEnum<{
@@ -233,7 +253,6 @@ declare const BoundaryBindingSchema: z.ZodObject<{
233
253
  subscription: "subscription";
234
254
  }>;
235
255
  }, z.core.$strip>, z.ZodObject<{
236
- name: z.ZodLiteral<"runtime-config">;
237
256
  deploymentTarget: z.ZodEnum<{
238
257
  lambda: "lambda";
239
258
  "ecs-task": "ecs-task";
@@ -241,6 +260,7 @@ declare const BoundaryBindingSchema: z.ZodObject<{
241
260
  "k8s-deployment": "k8s-deployment";
242
261
  }>;
243
262
  instanceName: z.ZodString;
263
+ name: z.ZodLiteral<"runtime-config">;
244
264
  }, z.core.$strip>, z.ZodObject<{
245
265
  name: z.ZodLiteral<"storage-relational">;
246
266
  storageSystem: z.ZodEnum<{
@@ -297,9 +317,19 @@ type TypeShape = {
297
317
  } | {
298
318
  type: "ref";
299
319
  name: string;
320
+ /**
321
+ * The file that declares this type, when the project declares it.
322
+ * Absent for a name the language or a dependency owns, which means
323
+ * the same thing everywhere.
324
+ *
325
+ * A name on its own does not identify a type. Two modules each
326
+ * declaring a `User` produce the same ref, and a checker comparing
327
+ * them has nothing to go on. This is what tells them apart.
328
+ */
329
+ from?: string | undefined;
300
330
  } | {
301
331
  type: "unknown";
302
332
  };
303
333
  declare const TypeShapeSchema: z.ZodType<TypeShape>;
304
334
 
305
- export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema };
335
+ export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema };
package/dist/schemas.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  ConfidenceLevelSchema,
5
5
  ConfidenceSourceSchema,
6
6
  CorroborationSchema,
7
+ DeployableUnitSchema,
7
8
  FunctionCallSemanticsSchema,
8
9
  GraphqlOperationSemanticsSchema,
9
10
  GraphqlResolverSemanticsSchema,
@@ -14,13 +15,14 @@ import {
14
15
  SourceLocationSchema,
15
16
  StorageRelationalSemanticsSchema,
16
17
  TypeShapeSchema
17
- } from "./chunk-BQEWYFCF.js";
18
+ } from "./chunk-QQLJDL3C.js";
18
19
  export {
19
20
  BoundaryBindingSchema,
20
21
  ConfidenceInfoSchema,
21
22
  ConfidenceLevelSchema,
22
23
  ConfidenceSourceSchema,
23
24
  CorroborationSchema,
25
+ DeployableUnitSchema,
24
26
  FunctionCallSemanticsSchema,
25
27
  GraphqlOperationSemanticsSchema,
26
28
  GraphqlResolverSemanticsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/ir-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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": [