@suss/ir-core 0.19.0 → 0.21.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/{chunk-HSJYPBJU.js → chunk-QHFMZPEG.js} +148 -52
- package/dist/index.cjs +279 -67
- package/dist/index.d.cts +159 -3
- package/dist/index.d.ts +159 -3
- package/dist/index.js +125 -15
- package/dist/{schemas-k-169oiY.d.cts → schemas-Dn1AzzWd.d.cts} +41 -1
- package/dist/{schemas-k-169oiY.d.ts → schemas-Dn1AzzWd.d.ts} +41 -1
- package/dist/schemas.cjs +142 -52
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/schemas.ts
|
|
2
|
-
import { z as
|
|
2
|
+
import { z as z12 } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/semantics/registry.ts
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as z11 } from "zod";
|
|
6
6
|
|
|
7
7
|
// src/semantics/functionCall.ts
|
|
8
8
|
import { z } from "zod";
|
|
@@ -17,6 +17,9 @@ function fnIdentityKey(packageName, exportPath) {
|
|
|
17
17
|
function busIdentityKey(messageBus, subject) {
|
|
18
18
|
return `bus:${messageBus} ${subject}`;
|
|
19
19
|
}
|
|
20
|
+
function unitIdentityKey(deploymentTarget, instanceName) {
|
|
21
|
+
return `unit:${deploymentTarget} ${instanceName}`;
|
|
22
|
+
}
|
|
20
23
|
function metricIdentityKey(metricSystem, metricType) {
|
|
21
24
|
return `metric:${metricSystem} ${metricType}`;
|
|
22
25
|
}
|
|
@@ -75,14 +78,24 @@ var functionCallSemantics = defineBoundarySemantics({
|
|
|
75
78
|
*/
|
|
76
79
|
canPair: () => true,
|
|
77
80
|
/**
|
|
78
|
-
* `"fn:<package>::<exportPath>"` when both are set
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
+
* `"fn:<package>::<exportPath>"` when both are set, and
|
|
82
|
+
* `"fn:<module>::<exportName>"` for an in-repo unit that states its
|
|
83
|
+
* module, the way a server action does. Components and bare
|
|
84
|
+
* handlers state neither and have no key at all.
|
|
81
85
|
*/
|
|
86
|
+
rewritePaths(semantics, rewrite) {
|
|
87
|
+
if (semantics.module === void 0) {
|
|
88
|
+
return semantics;
|
|
89
|
+
}
|
|
90
|
+
return { ...semantics, module: rewrite(semantics.module) };
|
|
91
|
+
},
|
|
82
92
|
identityKey(semantics) {
|
|
83
93
|
if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
|
|
84
94
|
return fnIdentityKey(semantics.package, semantics.exportPath);
|
|
85
95
|
}
|
|
96
|
+
if (semantics.module !== void 0 && semantics.exportName !== void 0) {
|
|
97
|
+
return fnIdentityKey(semantics.module, [semantics.exportName]);
|
|
98
|
+
}
|
|
86
99
|
return null;
|
|
87
100
|
}
|
|
88
101
|
}
|
|
@@ -455,6 +468,14 @@ var restSemantics = defineBoundarySemantics({
|
|
|
455
468
|
}
|
|
456
469
|
return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
|
|
457
470
|
},
|
|
471
|
+
/**
|
|
472
|
+
* A route the registration pattern admits is inside it. A route
|
|
473
|
+
* whose path this source never gave is left outside, because
|
|
474
|
+
* nothing here can show it is one the pattern covers.
|
|
475
|
+
*/
|
|
476
|
+
withinScope(semantics, scope) {
|
|
477
|
+
return semantics.path !== null && routePathAdmits(scope, semantics.path);
|
|
478
|
+
},
|
|
458
479
|
/**
|
|
459
480
|
* A call whose base URL the deployment fills in, resolved to the
|
|
460
481
|
* path it reaches.
|
|
@@ -590,12 +611,71 @@ var storageSemantics = defineBoundarySemantics({
|
|
|
590
611
|
/** A query returns rows or items, not a status and a body. */
|
|
591
612
|
exchangesHttpResponses: false,
|
|
592
613
|
reportsUnpairedItself: false,
|
|
593
|
-
identityKey: () => null
|
|
614
|
+
identityKey: () => null,
|
|
615
|
+
displayLabel: storageLabel
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
function storageLabel(semantics) {
|
|
619
|
+
return `${semantics.storageSystem}:${storageContainerLabel(semantics)}`;
|
|
620
|
+
}
|
|
621
|
+
var EVERY_FIELD = "*";
|
|
622
|
+
function storageContainerLabel(semantics) {
|
|
623
|
+
const container = semantics.container ?? "<unnamed container>";
|
|
624
|
+
const addressed = semantics.accessPath === null ? container : `${container}#${semantics.accessPath}`;
|
|
625
|
+
return semantics.scope === "default" ? addressed : `${semantics.scope}/${addressed}`;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// src/semantics/unitInvocation.ts
|
|
629
|
+
import { z as z10 } from "zod";
|
|
630
|
+
var UnitInvocationSemanticsSchema = DeployableUnitSchema.extend({
|
|
631
|
+
name: z10.literal("unit-invocation"),
|
|
632
|
+
instanceName: DeployableUnitSchema.shape.instanceName.nullable()
|
|
633
|
+
});
|
|
634
|
+
var unitInvocationSemantics = defineBoundarySemantics({
|
|
635
|
+
name: "unit-invocation",
|
|
636
|
+
schema: UnitInvocationSemanticsSchema,
|
|
637
|
+
// faas.name is the deployed function's own name and instanceName is
|
|
638
|
+
// the deployment template's logical id, which is a different string.
|
|
639
|
+
// Runtime config leaves the pair off for the same reason.
|
|
640
|
+
semconv: {},
|
|
641
|
+
behavior: {
|
|
642
|
+
/**
|
|
643
|
+
* A synchronous invoke gives back whatever the handler returned,
|
|
644
|
+
* which is a value rather than a status and a body. A handler's
|
|
645
|
+
* return only becomes an HTTP response under a proxy integration,
|
|
646
|
+
* and that route gets a REST binding instead of this one.
|
|
647
|
+
*/
|
|
648
|
+
exchangesHttpResponses: false,
|
|
649
|
+
/**
|
|
650
|
+
* A unit nothing in the run invokes is the ordinary case, since
|
|
651
|
+
* most services are reached from a stack suss never read. So an
|
|
652
|
+
* uninvoked unit stays in the generic unmatched list rather than
|
|
653
|
+
* being reported as a problem here.
|
|
654
|
+
*/
|
|
655
|
+
reportsUnpairedItself: false,
|
|
656
|
+
identityKey(semantics) {
|
|
657
|
+
if (semantics.instanceName === null) {
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
return unitIdentityKey(
|
|
661
|
+
semantics.deploymentTarget,
|
|
662
|
+
semantics.instanceName
|
|
663
|
+
);
|
|
664
|
+
},
|
|
665
|
+
displayLabel(semantics) {
|
|
666
|
+
if (semantics.instanceName === null) {
|
|
667
|
+
return `unit:${semantics.deploymentTarget} (named at runtime)`;
|
|
668
|
+
}
|
|
669
|
+
return unitIdentityKey(
|
|
670
|
+
semantics.deploymentTarget,
|
|
671
|
+
semantics.instanceName
|
|
672
|
+
);
|
|
673
|
+
}
|
|
594
674
|
}
|
|
595
675
|
});
|
|
596
676
|
|
|
597
677
|
// src/semantics/registry.ts
|
|
598
|
-
var SemanticsSchema =
|
|
678
|
+
var SemanticsSchema = z11.discriminatedUnion("name", [
|
|
599
679
|
restSemantics.schema,
|
|
600
680
|
functionCallSemantics.schema,
|
|
601
681
|
graphqlResolverSemantics.schema,
|
|
@@ -603,7 +683,8 @@ var SemanticsSchema = z10.discriminatedUnion("name", [
|
|
|
603
683
|
runtimeConfigSemantics.schema,
|
|
604
684
|
storageSemantics.schema,
|
|
605
685
|
messageBusSemantics.schema,
|
|
606
|
-
metricSemantics.schema
|
|
686
|
+
metricSemantics.schema,
|
|
687
|
+
unitInvocationSemantics.schema
|
|
607
688
|
]);
|
|
608
689
|
var DEFINITIONS = [
|
|
609
690
|
restSemantics,
|
|
@@ -613,7 +694,8 @@ var DEFINITIONS = [
|
|
|
613
694
|
runtimeConfigSemantics,
|
|
614
695
|
storageSemantics,
|
|
615
696
|
messageBusSemantics,
|
|
616
|
-
metricSemantics
|
|
697
|
+
metricSemantics,
|
|
698
|
+
unitInvocationSemantics
|
|
617
699
|
];
|
|
618
700
|
var BY_NAME = new Map(
|
|
619
701
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -636,31 +718,40 @@ function allBehaviors() {
|
|
|
636
718
|
}
|
|
637
719
|
|
|
638
720
|
// src/schemas.ts
|
|
639
|
-
var ConfidenceSourceSchema =
|
|
721
|
+
var ConfidenceSourceSchema = z12.enum([
|
|
640
722
|
"inferred_static",
|
|
641
723
|
"inferred_ai",
|
|
642
724
|
"declared",
|
|
643
725
|
"derived"
|
|
644
726
|
]);
|
|
645
|
-
var ConfidenceLevelSchema =
|
|
646
|
-
var CorroborationSchema =
|
|
647
|
-
outcome:
|
|
727
|
+
var ConfidenceLevelSchema = z12.enum(["high", "medium", "low"]);
|
|
728
|
+
var CorroborationSchema = z12.object({
|
|
729
|
+
outcome: z12.enum(["observed", "refuted", "untested"]),
|
|
648
730
|
/** Executions that produced a verdict for this claim. */
|
|
649
|
-
runs:
|
|
731
|
+
runs: z12.number(),
|
|
650
732
|
/** Present when refuted: the input and observation that disagreed. */
|
|
651
|
-
counterexample:
|
|
733
|
+
counterexample: z12.unknown().optional(),
|
|
652
734
|
/** Present when untested: why no verdict was reachable. */
|
|
653
|
-
reason:
|
|
735
|
+
reason: z12.string().optional()
|
|
654
736
|
});
|
|
655
|
-
var ConfidenceInfoSchema =
|
|
737
|
+
var ConfidenceInfoSchema = z12.object({
|
|
656
738
|
source: ConfidenceSourceSchema,
|
|
657
739
|
level: ConfidenceLevelSchema,
|
|
658
740
|
corroboration: CorroborationSchema.optional()
|
|
659
741
|
});
|
|
660
|
-
var SourceLocationSchema =
|
|
661
|
-
file:
|
|
662
|
-
|
|
663
|
-
|
|
742
|
+
var SourceLocationSchema = z12.object({
|
|
743
|
+
file: z12.string(),
|
|
744
|
+
/** Line numbers, for a person reading the summary or an editor link. */
|
|
745
|
+
range: z12.object({ start: z12.number(), end: z12.number() }),
|
|
746
|
+
/**
|
|
747
|
+
* Character offsets of the unit in its file. Identity and joins
|
|
748
|
+
* measure with these, since two functions can share a line and never
|
|
749
|
+
* an offset range; the line `range` above is the presentation of the
|
|
750
|
+
* same place. Absent on summaries no source position backs, a
|
|
751
|
+
* contract artifact's say.
|
|
752
|
+
*/
|
|
753
|
+
span: z12.object({ start: z12.number(), end: z12.number() }).optional(),
|
|
754
|
+
exportName: z12.string().nullable(),
|
|
664
755
|
/**
|
|
665
756
|
* The project the extract was pointed at, by the name that project
|
|
666
757
|
* calls itself.
|
|
@@ -670,47 +761,47 @@ var SourceLocationSchema = z11.object({
|
|
|
670
761
|
* summaries puts them on top of each other. This field is what tells
|
|
671
762
|
* them apart, and what a reader groups by.
|
|
672
763
|
*/
|
|
673
|
-
workspace:
|
|
764
|
+
workspace: z12.string().optional()
|
|
674
765
|
});
|
|
675
|
-
var BoundaryBindingSchema =
|
|
676
|
-
transport:
|
|
766
|
+
var BoundaryBindingSchema = z12.object({
|
|
767
|
+
transport: z12.string(),
|
|
677
768
|
semantics: SemanticsSchema,
|
|
678
|
-
recognition:
|
|
769
|
+
recognition: z12.string()
|
|
679
770
|
});
|
|
680
771
|
function typeDefinitionKey(ref) {
|
|
681
772
|
return ref.def ?? null;
|
|
682
773
|
}
|
|
683
|
-
var TypeShapeSchema =
|
|
684
|
-
() =>
|
|
685
|
-
|
|
686
|
-
type:
|
|
687
|
-
properties:
|
|
688
|
-
spreads:
|
|
774
|
+
var TypeShapeSchema = z12.lazy(
|
|
775
|
+
() => z12.discriminatedUnion("type", [
|
|
776
|
+
z12.object({
|
|
777
|
+
type: z12.literal("record"),
|
|
778
|
+
properties: z12.record(z12.string(), TypeShapeSchema),
|
|
779
|
+
spreads: z12.array(z12.object({ sourceText: z12.string() })).optional()
|
|
689
780
|
}),
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
type:
|
|
694
|
-
value:
|
|
695
|
-
raw:
|
|
781
|
+
z12.object({ type: z12.literal("dictionary"), values: TypeShapeSchema }),
|
|
782
|
+
z12.object({ type: z12.literal("array"), items: TypeShapeSchema }),
|
|
783
|
+
z12.object({
|
|
784
|
+
type: z12.literal("literal"),
|
|
785
|
+
value: z12.union([z12.string(), z12.number(), z12.boolean()]),
|
|
786
|
+
raw: z12.string().optional()
|
|
696
787
|
}),
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
type:
|
|
705
|
-
variants:
|
|
788
|
+
z12.object({ type: z12.literal("text") }),
|
|
789
|
+
z12.object({ type: z12.literal("integer") }),
|
|
790
|
+
z12.object({ type: z12.literal("number") }),
|
|
791
|
+
z12.object({ type: z12.literal("boolean") }),
|
|
792
|
+
z12.object({ type: z12.literal("null") }),
|
|
793
|
+
z12.object({ type: z12.literal("undefined") }),
|
|
794
|
+
z12.object({
|
|
795
|
+
type: z12.literal("union"),
|
|
796
|
+
variants: z12.array(TypeShapeSchema)
|
|
706
797
|
}),
|
|
707
|
-
|
|
708
|
-
type:
|
|
709
|
-
name:
|
|
710
|
-
from:
|
|
711
|
-
def:
|
|
798
|
+
z12.object({
|
|
799
|
+
type: z12.literal("ref"),
|
|
800
|
+
name: z12.string(),
|
|
801
|
+
from: z12.string().optional(),
|
|
802
|
+
def: z12.string().optional()
|
|
712
803
|
}),
|
|
713
|
-
|
|
804
|
+
z12.object({ type: z12.literal("unknown") })
|
|
714
805
|
])
|
|
715
806
|
);
|
|
716
807
|
var MAX_DEFINITION_DEPTH = 6;
|
|
@@ -759,6 +850,7 @@ export {
|
|
|
759
850
|
gqlIdentityKey,
|
|
760
851
|
fnIdentityKey,
|
|
761
852
|
busIdentityKey,
|
|
853
|
+
unitIdentityKey,
|
|
762
854
|
metricIdentityKey,
|
|
763
855
|
FunctionCallSemanticsSchema,
|
|
764
856
|
GraphqlResolverSemanticsSchema,
|
|
@@ -779,6 +871,10 @@ export {
|
|
|
779
871
|
ecsContainerInstanceName,
|
|
780
872
|
RuntimeConfigSemanticsSchema,
|
|
781
873
|
StorageSemanticsSchema,
|
|
874
|
+
storageLabel,
|
|
875
|
+
EVERY_FIELD,
|
|
876
|
+
storageContainerLabel,
|
|
877
|
+
UnitInvocationSemanticsSchema,
|
|
782
878
|
SemanticsSchema,
|
|
783
879
|
behaviorOf,
|
|
784
880
|
semconvMappingOf,
|