@suss/ir-core 0.20.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-52CH76PE.js → chunk-QHFMZPEG.js} +127 -50
- package/dist/index.cjs +246 -65
- package/dist/index.d.cts +147 -3
- package/dist/index.d.ts +147 -3
- package/dist/index.js +114 -15
- package/dist/{schemas-Dt93kAZT.d.cts → schemas-Dn1AzzWd.d.cts} +37 -1
- package/dist/{schemas-Dt93kAZT.d.ts → schemas-Dn1AzzWd.d.ts} +37 -1
- package/dist/schemas.cjs +121 -50
- 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
|
}
|
|
@@ -465,6 +468,14 @@ var restSemantics = defineBoundarySemantics({
|
|
|
465
468
|
}
|
|
466
469
|
return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
|
|
467
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
|
+
},
|
|
468
479
|
/**
|
|
469
480
|
* A call whose base URL the deployment fills in, resolved to the
|
|
470
481
|
* path it reaches.
|
|
@@ -600,12 +611,71 @@ var storageSemantics = defineBoundarySemantics({
|
|
|
600
611
|
/** A query returns rows or items, not a status and a body. */
|
|
601
612
|
exchangesHttpResponses: false,
|
|
602
613
|
reportsUnpairedItself: false,
|
|
603
|
-
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
|
+
}
|
|
604
674
|
}
|
|
605
675
|
});
|
|
606
676
|
|
|
607
677
|
// src/semantics/registry.ts
|
|
608
|
-
var SemanticsSchema =
|
|
678
|
+
var SemanticsSchema = z11.discriminatedUnion("name", [
|
|
609
679
|
restSemantics.schema,
|
|
610
680
|
functionCallSemantics.schema,
|
|
611
681
|
graphqlResolverSemantics.schema,
|
|
@@ -613,7 +683,8 @@ var SemanticsSchema = z10.discriminatedUnion("name", [
|
|
|
613
683
|
runtimeConfigSemantics.schema,
|
|
614
684
|
storageSemantics.schema,
|
|
615
685
|
messageBusSemantics.schema,
|
|
616
|
-
metricSemantics.schema
|
|
686
|
+
metricSemantics.schema,
|
|
687
|
+
unitInvocationSemantics.schema
|
|
617
688
|
]);
|
|
618
689
|
var DEFINITIONS = [
|
|
619
690
|
restSemantics,
|
|
@@ -623,7 +694,8 @@ var DEFINITIONS = [
|
|
|
623
694
|
runtimeConfigSemantics,
|
|
624
695
|
storageSemantics,
|
|
625
696
|
messageBusSemantics,
|
|
626
|
-
metricSemantics
|
|
697
|
+
metricSemantics,
|
|
698
|
+
unitInvocationSemantics
|
|
627
699
|
];
|
|
628
700
|
var BY_NAME = new Map(
|
|
629
701
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -646,31 +718,31 @@ function allBehaviors() {
|
|
|
646
718
|
}
|
|
647
719
|
|
|
648
720
|
// src/schemas.ts
|
|
649
|
-
var ConfidenceSourceSchema =
|
|
721
|
+
var ConfidenceSourceSchema = z12.enum([
|
|
650
722
|
"inferred_static",
|
|
651
723
|
"inferred_ai",
|
|
652
724
|
"declared",
|
|
653
725
|
"derived"
|
|
654
726
|
]);
|
|
655
|
-
var ConfidenceLevelSchema =
|
|
656
|
-
var CorroborationSchema =
|
|
657
|
-
outcome:
|
|
727
|
+
var ConfidenceLevelSchema = z12.enum(["high", "medium", "low"]);
|
|
728
|
+
var CorroborationSchema = z12.object({
|
|
729
|
+
outcome: z12.enum(["observed", "refuted", "untested"]),
|
|
658
730
|
/** Executions that produced a verdict for this claim. */
|
|
659
|
-
runs:
|
|
731
|
+
runs: z12.number(),
|
|
660
732
|
/** Present when refuted: the input and observation that disagreed. */
|
|
661
|
-
counterexample:
|
|
733
|
+
counterexample: z12.unknown().optional(),
|
|
662
734
|
/** Present when untested: why no verdict was reachable. */
|
|
663
|
-
reason:
|
|
735
|
+
reason: z12.string().optional()
|
|
664
736
|
});
|
|
665
|
-
var ConfidenceInfoSchema =
|
|
737
|
+
var ConfidenceInfoSchema = z12.object({
|
|
666
738
|
source: ConfidenceSourceSchema,
|
|
667
739
|
level: ConfidenceLevelSchema,
|
|
668
740
|
corroboration: CorroborationSchema.optional()
|
|
669
741
|
});
|
|
670
|
-
var SourceLocationSchema =
|
|
671
|
-
file:
|
|
742
|
+
var SourceLocationSchema = z12.object({
|
|
743
|
+
file: z12.string(),
|
|
672
744
|
/** Line numbers, for a person reading the summary or an editor link. */
|
|
673
|
-
range:
|
|
745
|
+
range: z12.object({ start: z12.number(), end: z12.number() }),
|
|
674
746
|
/**
|
|
675
747
|
* Character offsets of the unit in its file. Identity and joins
|
|
676
748
|
* measure with these, since two functions can share a line and never
|
|
@@ -678,8 +750,8 @@ var SourceLocationSchema = z11.object({
|
|
|
678
750
|
* same place. Absent on summaries no source position backs, a
|
|
679
751
|
* contract artifact's say.
|
|
680
752
|
*/
|
|
681
|
-
span:
|
|
682
|
-
exportName:
|
|
753
|
+
span: z12.object({ start: z12.number(), end: z12.number() }).optional(),
|
|
754
|
+
exportName: z12.string().nullable(),
|
|
683
755
|
/**
|
|
684
756
|
* The project the extract was pointed at, by the name that project
|
|
685
757
|
* calls itself.
|
|
@@ -689,47 +761,47 @@ var SourceLocationSchema = z11.object({
|
|
|
689
761
|
* summaries puts them on top of each other. This field is what tells
|
|
690
762
|
* them apart, and what a reader groups by.
|
|
691
763
|
*/
|
|
692
|
-
workspace:
|
|
764
|
+
workspace: z12.string().optional()
|
|
693
765
|
});
|
|
694
|
-
var BoundaryBindingSchema =
|
|
695
|
-
transport:
|
|
766
|
+
var BoundaryBindingSchema = z12.object({
|
|
767
|
+
transport: z12.string(),
|
|
696
768
|
semantics: SemanticsSchema,
|
|
697
|
-
recognition:
|
|
769
|
+
recognition: z12.string()
|
|
698
770
|
});
|
|
699
771
|
function typeDefinitionKey(ref) {
|
|
700
772
|
return ref.def ?? null;
|
|
701
773
|
}
|
|
702
|
-
var TypeShapeSchema =
|
|
703
|
-
() =>
|
|
704
|
-
|
|
705
|
-
type:
|
|
706
|
-
properties:
|
|
707
|
-
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()
|
|
708
780
|
}),
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
type:
|
|
713
|
-
value:
|
|
714
|
-
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()
|
|
715
787
|
}),
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
type:
|
|
724
|
-
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)
|
|
725
797
|
}),
|
|
726
|
-
|
|
727
|
-
type:
|
|
728
|
-
name:
|
|
729
|
-
from:
|
|
730
|
-
def:
|
|
798
|
+
z12.object({
|
|
799
|
+
type: z12.literal("ref"),
|
|
800
|
+
name: z12.string(),
|
|
801
|
+
from: z12.string().optional(),
|
|
802
|
+
def: z12.string().optional()
|
|
731
803
|
}),
|
|
732
|
-
|
|
804
|
+
z12.object({ type: z12.literal("unknown") })
|
|
733
805
|
])
|
|
734
806
|
);
|
|
735
807
|
var MAX_DEFINITION_DEPTH = 6;
|
|
@@ -778,6 +850,7 @@ export {
|
|
|
778
850
|
gqlIdentityKey,
|
|
779
851
|
fnIdentityKey,
|
|
780
852
|
busIdentityKey,
|
|
853
|
+
unitIdentityKey,
|
|
781
854
|
metricIdentityKey,
|
|
782
855
|
FunctionCallSemanticsSchema,
|
|
783
856
|
GraphqlResolverSemanticsSchema,
|
|
@@ -798,6 +871,10 @@ export {
|
|
|
798
871
|
ecsContainerInstanceName,
|
|
799
872
|
RuntimeConfigSemanticsSchema,
|
|
800
873
|
StorageSemanticsSchema,
|
|
874
|
+
storageLabel,
|
|
875
|
+
EVERY_FIELD,
|
|
876
|
+
storageContainerLabel,
|
|
877
|
+
UnitInvocationSemanticsSchema,
|
|
801
878
|
SemanticsSchema,
|
|
802
879
|
behaviorOf,
|
|
803
880
|
semconvMappingOf,
|