@appport/integration 0.0.0-stage → 1.1.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/LICENSE +126 -0
- package/README.md +34 -2
- package/dist/base64url.d.ts +4 -0
- package/dist/base64url.d.ts.map +1 -0
- package/dist/base64url.js +36 -0
- package/dist/base64url.js.map +1 -0
- package/dist/behavior.d.ts +164 -0
- package/dist/behavior.d.ts.map +1 -0
- package/dist/behavior.js +493 -0
- package/dist/behavior.js.map +1 -0
- package/dist/coverage.d.ts +44 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +43 -0
- package/dist/coverage.js.map +1 -0
- package/dist/declarations.d.ts +53 -0
- package/dist/declarations.d.ts.map +1 -0
- package/dist/declarations.js +45 -0
- package/dist/declarations.js.map +1 -0
- package/dist/ed25519.d.ts +8 -0
- package/dist/ed25519.d.ts.map +1 -0
- package/dist/ed25519.js +128 -0
- package/dist/ed25519.js.map +1 -0
- package/dist/encodings.d.ts +9 -0
- package/dist/encodings.d.ts.map +1 -0
- package/dist/encodings.js +75 -0
- package/dist/encodings.js.map +1 -0
- package/dist/fields.d.ts +29 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +76 -0
- package/dist/fields.js.map +1 -0
- package/dist/findings.d.ts +189 -0
- package/dist/findings.d.ts.map +1 -0
- package/dist/findings.js +195 -0
- package/dist/findings.js.map +1 -0
- package/dist/footprint.d.ts +67 -0
- package/dist/footprint.d.ts.map +1 -0
- package/dist/footprint.js +78 -0
- package/dist/footprint.js.map +1 -0
- package/dist/graph.d.ts +111 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +390 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/lint.d.ts +35 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +260 -0
- package/dist/lint.js.map +1 -0
- package/dist/mapping.d.ts +28 -0
- package/dist/mapping.d.ts.map +1 -0
- package/dist/mapping.js +282 -0
- package/dist/mapping.js.map +1 -0
- package/dist/normalize.d.ts +27 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/normalize.js +56 -0
- package/dist/normalize.js.map +1 -0
- package/dist/plan.d.ts +240 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +746 -0
- package/dist/plan.js.map +1 -0
- package/dist/readiness.d.ts +146 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +346 -0
- package/dist/readiness.js.map +1 -0
- package/dist/reference.d.ts +39 -0
- package/dist/reference.d.ts.map +1 -0
- package/dist/reference.js +74 -0
- package/dist/reference.js.map +1 -0
- package/dist/scenario.d.ts +114 -0
- package/dist/scenario.d.ts.map +1 -0
- package/dist/scenario.js +117 -0
- package/dist/scenario.js.map +1 -0
- package/dist/select.d.ts +41 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +71 -0
- package/dist/select.js.map +1 -0
- package/dist/trust.d.ts +237 -0
- package/dist/trust.d.ts.map +1 -0
- package/dist/trust.js +511 -0
- package/dist/trust.js.map +1 -0
- package/dist/types.d.ts +130 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/dist/units.d.ts +20 -0
- package/dist/units.d.ts.map +1 -0
- package/dist/units.js +47 -0
- package/dist/units.js.map +1 -0
- package/dist/verification.d.ts +54 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +115 -0
- package/dist/verification.js.map +1 -0
- package/package.json +28 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including
|
|
45
|
+
the original version of the Work and any modifications or additions
|
|
46
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
47
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
48
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
49
|
+
the copyright owner.
|
|
50
|
+
|
|
51
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
52
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
53
|
+
subsequently incorporated within the Work.
|
|
54
|
+
|
|
55
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
56
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
57
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
58
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
59
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
60
|
+
Work and such Derivative Works in Source or Object form.
|
|
61
|
+
|
|
62
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
63
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
64
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
65
|
+
(except as stated in this section) patent license to make, have made,
|
|
66
|
+
use, offer to sell, sell, import, and otherwise transfer the Work.
|
|
67
|
+
|
|
68
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
69
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
70
|
+
modifications, and in Source or Object form, provided that You
|
|
71
|
+
meet the following conditions:
|
|
72
|
+
|
|
73
|
+
(a) You must give any other recipients of the Work or
|
|
74
|
+
Derivative Works a copy of this License; and
|
|
75
|
+
|
|
76
|
+
(b) You must cause any modified files to carry prominent notices
|
|
77
|
+
stating that You changed the files; and
|
|
78
|
+
|
|
79
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
80
|
+
that You distribute, all copyright, patent, trademark, and
|
|
81
|
+
attribution notices from the Source form of the Work; and
|
|
82
|
+
|
|
83
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
84
|
+
distribution, then any Derivative Works that You distribute must
|
|
85
|
+
include a readable copy of the attribution notices contained
|
|
86
|
+
within such NOTICE file.
|
|
87
|
+
|
|
88
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
89
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
90
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
91
|
+
this License, without any additional terms or conditions.
|
|
92
|
+
|
|
93
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
94
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
95
|
+
|
|
96
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
97
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
98
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
99
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
100
|
+
implied.
|
|
101
|
+
|
|
102
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
103
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
104
|
+
shall any Contributor be liable to You for damages.
|
|
105
|
+
|
|
106
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
107
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
108
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
109
|
+
or other liability obligations and/or rights consistent with this
|
|
110
|
+
License.
|
|
111
|
+
|
|
112
|
+
END OF TERMS AND CONDITIONS
|
|
113
|
+
|
|
114
|
+
Copyright 2026 AppPort contributors
|
|
115
|
+
|
|
116
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
117
|
+
you may not use this file except in compliance with the License.
|
|
118
|
+
You may obtain a copy of the License at
|
|
119
|
+
|
|
120
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
121
|
+
|
|
122
|
+
Unless required by applicable law or agreed to in writing, software
|
|
123
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
124
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
125
|
+
See the License for the specific language governing permissions and
|
|
126
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @appport/integration
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pure helpers for AppPort's integration contract. See `spec/mapping-1.md` and
|
|
4
|
+
`docs/architecture/integration-contract-pr2-design.md`.
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { parseMapping, lintMapping, applyAndValidate, resolveMapping, MappingPins,
|
|
8
|
+
planVerification, evaluateVerification, describeFootprint } from "@appport/integration";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Area | Functions |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Mapping | `parseMapping`, `lintMapping`, `applyMapping`, `applyAndValidate`, `runVectors`, `selectRecords`, `mappingDigest` |
|
|
14
|
+
| Identity | `verifyMappingArtifact`, `resolveMapping`, `MappingPins`, `schemaIdentity` |
|
|
15
|
+
| Verification | `planVerification`, `evaluateVerification` (declared methods in, evidence out) |
|
|
16
|
+
| Tracing | `describeFootprint`, `mappingLineage` |
|
|
17
|
+
| Graph | `deriveGraph`, `edgesOf`, `nodeId`; findings in via `findingsFromTelemetry`, `findingsFromInvocationResults`, `findingsFromExecutionTopology`, or your own analyzer |
|
|
18
|
+
| Replacement | `assessReplacement` returns a readiness report: affected consumers, incompatibilities, shared state, missing verification, required tests, unknowns. Never an approval |
|
|
19
|
+
|
|
20
|
+
Everything is synchronous or takes an injected fetcher. There is no registry, no network access, no
|
|
21
|
+
code execution, and no authority: a mapping never makes a capability callable.
|
|
22
|
+
|
|
23
|
+
## Mapping trust, planning and behavioral comparison (first published in 1.1.0)
|
|
24
|
+
|
|
25
|
+
| Area | Functions |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Trust | `signMapping`, `verifyMappingTrust`, `assessMappingTrust`, `compileTrustPolicy`, `evaluateTrust`; strict Ed25519 profile (`verifyEd25519Strict`) |
|
|
28
|
+
| Planning | `planIntegration`, `findCapabilities`, `classifyDeclarations`, `pairFields`; a plan authorizes and executes nothing |
|
|
29
|
+
| Behavior | `compareBehavior`, `validateSuite`, scenario and suite formats; evidence for the tested scenarios only |
|
|
30
|
+
|
|
31
|
+
**Security status.** Mapping-signature verification has had an internal engineering review only; it has **not** had an independent specialist
|
|
32
|
+
security audit and is **not production-ready**. A valid signature shows who signed bytes under a key your policy lists. It does not make a
|
|
33
|
+
mapping correct, safe or eligible, and it grants no authorization. Trust comes only from the policy you supply; AppPort distributes no key
|
|
34
|
+
status, so a stale policy is a stale decision. Verification uses the runtime's WebCrypto Ed25519 and reports `unavailable` where that is
|
|
35
|
+
not supported; it never reports `valid` without having verified. See `docs/architecture/mapping-trust-security-review.md` in the repository.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function encodeBase64Url(bytes: Uint8Array): string;
|
|
2
|
+
/** Returns `undefined` for anything that is not the canonical encoding of some byte string. */
|
|
3
|
+
export declare function decodeBase64Url(text: string): Uint8Array | undefined;
|
|
4
|
+
//# sourceMappingURL=base64url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64url.d.ts","sourceRoot":"","sources":["../src/base64url.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CASzD;AAED,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAiBpE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Unpadded base64url (RFC 4648 §5), strict: no padding, no whitespace, canonical trailing bits. */
|
|
2
|
+
const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
3
|
+
export function encodeBase64Url(bytes) {
|
|
4
|
+
let out = "";
|
|
5
|
+
for (let i = 0; i < bytes.length; i += 3) {
|
|
6
|
+
const n = (bytes[i] << 16) | ((bytes[i + 1] ?? 0) << 8) | (bytes[i + 2] ?? 0);
|
|
7
|
+
out += ALPHABET[(n >> 18) & 63] + ALPHABET[(n >> 12) & 63];
|
|
8
|
+
if (i + 1 < bytes.length)
|
|
9
|
+
out += ALPHABET[(n >> 6) & 63];
|
|
10
|
+
if (i + 2 < bytes.length)
|
|
11
|
+
out += ALPHABET[n & 63];
|
|
12
|
+
}
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
15
|
+
/** Returns `undefined` for anything that is not the canonical encoding of some byte string. */
|
|
16
|
+
export function decodeBase64Url(text) {
|
|
17
|
+
if (typeof text !== "string" || !/^[A-Za-z0-9_-]*$/.test(text) || text.length % 4 === 1)
|
|
18
|
+
return undefined;
|
|
19
|
+
const out = [];
|
|
20
|
+
let buffer = 0;
|
|
21
|
+
let bits = 0;
|
|
22
|
+
for (const char of text) {
|
|
23
|
+
buffer = (buffer << 6) | ALPHABET.indexOf(char);
|
|
24
|
+
bits += 6;
|
|
25
|
+
if (bits >= 8) {
|
|
26
|
+
bits -= 8;
|
|
27
|
+
out.push((buffer >> bits) & 255);
|
|
28
|
+
buffer &= (1 << bits) - 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (buffer !== 0)
|
|
32
|
+
return undefined; // non-zero leftover bits: not canonical
|
|
33
|
+
const bytes = Uint8Array.from(out);
|
|
34
|
+
return encodeBase64Url(bytes) === text ? bytes : undefined;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=base64url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64url.js","sourceRoot":"","sources":["../src/base64url.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,QAAQ,GAAG,kEAAkE,CAAC;AAEpF,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC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GAAG,CAAC,CAAC;YACjC,MAAM,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC,CAAC,wCAAwC;IAC5E,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Behavioral replacement validation: does a candidate preserve the *tested* observable behaviour of an existing implementation?
|
|
3
|
+
*
|
|
4
|
+
* It compares what two implementations do for declared scenarios, through the same authorized boundary a consumer would use
|
|
5
|
+
* (a `BehaviorTarget` wraps an AppPort client or an in-process application), and independently reads state back through each
|
|
6
|
+
* implementation's own declared verification. Nothing is executed outside the targets, the targets must be isolated fixtures,
|
|
7
|
+
* and the report states what was and was not observed.
|
|
8
|
+
*
|
|
9
|
+
* What a result means: `equivalent-for-tested-scenarios` is evidence about those scenarios and the facets observed in them. It
|
|
10
|
+
* is not a proof of equivalence, says nothing about inputs, orderings, timings, volumes or state not exercised, and says nothing about
|
|
11
|
+
* effects that happen outside the instrumented, mediated and read-back paths. Missing evidence is never converted into success.
|
|
12
|
+
*/
|
|
13
|
+
import { type AppPortManifest, type JsonValue } from "@appport/protocol";
|
|
14
|
+
import { SCENARIO_FORMAT, SUITE_FORMAT, type ReplacementScenario, type ReplacementSuite } from "./scenario.js";
|
|
15
|
+
export declare const BEHAVIOR_REPORT_FORMAT: "appport.behavior-comparison/1";
|
|
16
|
+
export declare const BEHAVIOR_OUTCOMES: readonly ["equivalent-for-tested-scenarios", "behavior-mismatch", "unverified", "inconclusive", "not-comparable"];
|
|
17
|
+
export type BehaviorOutcome = (typeof BEHAVIOR_OUTCOMES)[number];
|
|
18
|
+
export type CallResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
output: unknown;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
code: string;
|
|
24
|
+
};
|
|
25
|
+
export interface ObservedEvent {
|
|
26
|
+
name: string;
|
|
27
|
+
payload?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One isolated implementation under test. The host builds it over a fresh fixture for each scenario (a new in-process application,
|
|
31
|
+
* a new server process, a restored snapshot) and attests that it is not production state. Calls go through the implementation's
|
|
32
|
+
* normal authorization.
|
|
33
|
+
*/
|
|
34
|
+
export interface BehaviorTarget {
|
|
35
|
+
id: string;
|
|
36
|
+
manifest: AppPortManifest;
|
|
37
|
+
/** The host's attestation. Anything else is refused: this harness never mutates production state to compare implementations. */
|
|
38
|
+
environment: "isolated-fixture";
|
|
39
|
+
call(capability: string, version: number, input: unknown, options?: {
|
|
40
|
+
idempotencyKey?: string;
|
|
41
|
+
caller?: "authorized" | "unauthorized";
|
|
42
|
+
}): Promise<CallResult>;
|
|
43
|
+
/** Events observed since creation. Absent: events are not observable through this target. */
|
|
44
|
+
events?: () => ObservedEvent[];
|
|
45
|
+
/** Mediated invocations observed since creation (`InvocationEvidence`-shaped). Absent: the invocation boundary is not instrumented. */
|
|
46
|
+
invocations?: () => Array<{
|
|
47
|
+
target: {
|
|
48
|
+
application: string;
|
|
49
|
+
capability: {
|
|
50
|
+
name: string;
|
|
51
|
+
version: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
/** Which AppPort runtime boundaries were instrumented on this target. */
|
|
56
|
+
instrumentation?: {
|
|
57
|
+
invocationBoundary?: boolean;
|
|
58
|
+
stateBoundary?: boolean;
|
|
59
|
+
};
|
|
60
|
+
dispose?: () => Promise<void> | void;
|
|
61
|
+
}
|
|
62
|
+
export type TargetFactory = (scenario: ReplacementScenario) => Promise<BehaviorTarget>;
|
|
63
|
+
export type FacetStatus = "match" | "mismatch" | "unverified" | "original-nonconforming" | "not-comparable";
|
|
64
|
+
export interface BehaviorFacet {
|
|
65
|
+
id: string;
|
|
66
|
+
status: FacetStatus;
|
|
67
|
+
reasons: string[];
|
|
68
|
+
/** Evidence ids this facet rests on. */
|
|
69
|
+
evidence: string[];
|
|
70
|
+
detail?: {
|
|
71
|
+
expected?: JsonValue;
|
|
72
|
+
original?: JsonValue;
|
|
73
|
+
candidate?: JsonValue;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface EvidenceRef {
|
|
77
|
+
id: string;
|
|
78
|
+
target: "original" | "candidate";
|
|
79
|
+
kind: "call" | "read-back" | "events" | "verification" | "setup";
|
|
80
|
+
summary: string;
|
|
81
|
+
digest: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ScenarioResult {
|
|
84
|
+
id: string;
|
|
85
|
+
outcome: BehaviorOutcome;
|
|
86
|
+
facets: BehaviorFacet[];
|
|
87
|
+
/** What this scenario demonstrates, when (and only when) it passed. */
|
|
88
|
+
tags: string[];
|
|
89
|
+
/** What this scenario set out to demonstrate, whether or not it passed. */
|
|
90
|
+
attempted: string[];
|
|
91
|
+
notes: string[];
|
|
92
|
+
}
|
|
93
|
+
export interface CoverageStatement {
|
|
94
|
+
required: string[];
|
|
95
|
+
covered: string[];
|
|
96
|
+
missing: string[];
|
|
97
|
+
waived: Array<{
|
|
98
|
+
tag: string;
|
|
99
|
+
reason: string;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
|
102
|
+
export interface BehaviorReport {
|
|
103
|
+
type: typeof BEHAVIOR_REPORT_FORMAT;
|
|
104
|
+
capability: string;
|
|
105
|
+
original: {
|
|
106
|
+
application: string;
|
|
107
|
+
instrumentation: {
|
|
108
|
+
invocationBoundary: boolean;
|
|
109
|
+
stateBoundary: boolean;
|
|
110
|
+
events: boolean;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
candidate: {
|
|
114
|
+
application: string;
|
|
115
|
+
instrumentation: {
|
|
116
|
+
invocationBoundary: boolean;
|
|
117
|
+
stateBoundary: boolean;
|
|
118
|
+
events: boolean;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
outcome: BehaviorOutcome;
|
|
122
|
+
reasons: Array<{
|
|
123
|
+
code: string;
|
|
124
|
+
scenario?: string;
|
|
125
|
+
facet?: string;
|
|
126
|
+
message: string;
|
|
127
|
+
}>;
|
|
128
|
+
scenarios: ScenarioResult[];
|
|
129
|
+
coverage: CoverageStatement;
|
|
130
|
+
evidence: EvidenceRef[];
|
|
131
|
+
/** Mediated invocations seen on the candidate while the scenarios ran (`application/capability@version`). Empty and `known: false` when not instrumented. */
|
|
132
|
+
exercised: {
|
|
133
|
+
known: boolean;
|
|
134
|
+
invocations: string[];
|
|
135
|
+
};
|
|
136
|
+
/** Paths this comparison cannot see, stated so equivalence is never read as broader than it is. */
|
|
137
|
+
blindSpots: string[];
|
|
138
|
+
valuesIncluded: boolean;
|
|
139
|
+
claim: string;
|
|
140
|
+
limits: string[];
|
|
141
|
+
}
|
|
142
|
+
export declare const BEHAVIOR_LIMITS: readonly string[];
|
|
143
|
+
type Side = "original" | "candidate";
|
|
144
|
+
interface Issue {
|
|
145
|
+
side: Side | "both";
|
|
146
|
+
code: string;
|
|
147
|
+
message: string;
|
|
148
|
+
}
|
|
149
|
+
/** Can this scenario be meaningfully run against both contracts? Anything reported here makes the scenario `not-comparable`. */
|
|
150
|
+
export declare function lintScenarioAgainst(scenario: ReplacementScenario, manifests: {
|
|
151
|
+
original: AppPortManifest;
|
|
152
|
+
candidate: AppPortManifest;
|
|
153
|
+
}): Issue[];
|
|
154
|
+
export interface CompareBehaviorOptions {
|
|
155
|
+
/** Include observed values in facet details. Off by default: reports then carry digests, not data. */
|
|
156
|
+
includeValues?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export declare function compareBehavior(input: {
|
|
159
|
+
suite: ReplacementSuite;
|
|
160
|
+
original: TargetFactory;
|
|
161
|
+
candidate: TargetFactory;
|
|
162
|
+
}, options?: CompareBehaviorOptions): Promise<BehaviorReport>;
|
|
163
|
+
export { SCENARIO_FORMAT, SUITE_FORMAT };
|
|
164
|
+
//# sourceMappingURL=behavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behavior.d.ts","sourceRoot":"","sources":["../src/behavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEf,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAwC,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAA4C,MAAM,eAAe,CAAC;AAG/L,eAAO,MAAM,sBAAsB,EAAG,+BAAwC,CAAC;AAC/E,eAAO,MAAM,iBAAiB,mHAAoH,CAAC;AACnJ,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACrF,MAAM,WAAW,aAAa;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE;AAElE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,eAAe,CAAC;IAC1B,gIAAgI;IAChI,WAAW,EAAE,kBAAkB,CAAC;IAChC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,YAAY,GAAG,cAAc,CAAA;KAAE,GAAG,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