autotel-pact 15.0.0 → 16.0.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/{attrs-ElwK54Ym.js → attrs-BxJCnQsN.js} +11 -10
- package/dist/{attrs-DbCs1ou0.cjs → attrs-DkYI6Fhz.cjs} +11 -10
- package/dist/audit.d.cts +2 -2
- package/dist/audit.d.ts +2 -2
- package/dist/auto-wrap.cjs +1 -1
- package/dist/auto-wrap.d.cts +13 -3
- package/dist/auto-wrap.d.ts +13 -3
- package/dist/auto-wrap.js +1 -1
- package/dist/broker.cjs +10 -4
- package/dist/broker.d.cts +1 -1
- package/dist/broker.d.ts +1 -1
- package/dist/broker.js +10 -4
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -6
- package/dist/index.d.ts +11 -6
- package/dist/index.js +1 -1
- package/dist/{ledger-yzVOA9iE.d.cts → ledger-BBxcf9SV.d.cts} +1 -1
- package/dist/{ledger-CBUbpQr-.d.ts → ledger-iDI3Mq4i.d.ts} +1 -1
- package/dist/processor.cjs +1 -1
- package/dist/processor.d.cts +14 -7
- package/dist/processor.d.ts +14 -7
- package/dist/processor.js +1 -1
- package/dist/provider.cjs +1 -1
- package/dist/provider.d.cts +10 -4
- package/dist/provider.d.ts +10 -4
- package/dist/provider.js +1 -1
- package/dist/tag.cjs +1 -1
- package/dist/tag.d.cts +1 -1
- package/dist/tag.d.ts +1 -1
- package/dist/tag.js +1 -1
- package/dist/{types-DpHqSzxb.d.cts → types-ylkoxFXB.d.cts} +2 -2
- package/dist/{types-DpHqSzxb.d.ts → types-ylkoxFXB.d.ts} +2 -2
- package/package.json +3 -3
|
@@ -19,16 +19,17 @@ const PACT_ATTRS = {
|
|
|
19
19
|
* about to be exercised. `outcome` is added later by the wrapper.
|
|
20
20
|
*/
|
|
21
21
|
function buildPactAttributes(meta, opts = {}) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[PACT_ATTRS.
|
|
27
|
-
[PACT_ATTRS.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
const optional = [];
|
|
23
|
+
if (opts.contractFile) optional.push([PACT_ATTRS.CONTRACT_FILE, opts.contractFile]);
|
|
24
|
+
if (meta.interactionId) optional.push([PACT_ATTRS.INTERACTION_ID, meta.interactionId]);
|
|
25
|
+
return Object.fromEntries([
|
|
26
|
+
[PACT_ATTRS.CONSUMER, meta.consumer],
|
|
27
|
+
[PACT_ATTRS.PROVIDER, meta.provider],
|
|
28
|
+
[PACT_ATTRS.KIND, meta.kind],
|
|
29
|
+
[PACT_ATTRS.INTERACTION_DESCRIPTION, meta.description],
|
|
30
|
+
[PACT_ATTRS.INTERACTION_STATES, meta.states],
|
|
31
|
+
...optional
|
|
32
|
+
]);
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Helper that returns just the outcome attribute — stamped after the
|
|
@@ -20,16 +20,17 @@ const PACT_ATTRS = {
|
|
|
20
20
|
* about to be exercised. `outcome` is added later by the wrapper.
|
|
21
21
|
*/
|
|
22
22
|
function buildPactAttributes(meta, opts = {}) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[PACT_ATTRS.
|
|
28
|
-
[PACT_ATTRS.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
const optional = [];
|
|
24
|
+
if (opts.contractFile) optional.push([PACT_ATTRS.CONTRACT_FILE, opts.contractFile]);
|
|
25
|
+
if (meta.interactionId) optional.push([PACT_ATTRS.INTERACTION_ID, meta.interactionId]);
|
|
26
|
+
return Object.fromEntries([
|
|
27
|
+
[PACT_ATTRS.CONSUMER, meta.consumer],
|
|
28
|
+
[PACT_ATTRS.PROVIDER, meta.provider],
|
|
29
|
+
[PACT_ATTRS.KIND, meta.kind],
|
|
30
|
+
[PACT_ATTRS.INTERACTION_DESCRIPTION, meta.description],
|
|
31
|
+
[PACT_ATTRS.INTERACTION_STATES, meta.states],
|
|
32
|
+
...optional
|
|
33
|
+
]);
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Helper that returns just the outcome attribute — stamped after the
|
package/dist/audit.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as PactInteractionKey, i as BrokerVerification, n as AuditMatrix, s as LedgerRecord } from "./types-
|
|
1
|
+
import { d as PactInteractionKey, i as BrokerVerification, n as AuditMatrix, s as LedgerRecord } from "./types-ylkoxFXB.cjs";
|
|
2
2
|
import { BrokerConfig } from "./broker.cjs";
|
|
3
|
-
import { t as LedgerOptions } from "./ledger-
|
|
3
|
+
import { t as LedgerOptions } from "./ledger-BBxcf9SV.cjs";
|
|
4
4
|
//#region src/audit.d.ts
|
|
5
5
|
interface AuditOptions extends LedgerOptions {
|
|
6
6
|
pactsDir?: string;
|
package/dist/audit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as PactInteractionKey, i as BrokerVerification, n as AuditMatrix, s as LedgerRecord } from "./types-
|
|
1
|
+
import { d as PactInteractionKey, i as BrokerVerification, n as AuditMatrix, s as LedgerRecord } from "./types-ylkoxFXB.js";
|
|
2
2
|
import { BrokerConfig } from "./broker.js";
|
|
3
|
-
import { t as LedgerOptions } from "./ledger-
|
|
3
|
+
import { t as LedgerOptions } from "./ledger-iDI3Mq4i.js";
|
|
4
4
|
//#region src/audit.d.ts
|
|
5
5
|
interface AuditOptions extends LedgerOptions {
|
|
6
6
|
pactsDir?: string;
|
package/dist/auto-wrap.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_ledger = require('./ledger-BayQwemz.cjs');
|
|
3
|
-
const require_attrs = require('./attrs-
|
|
3
|
+
const require_attrs = require('./attrs-DkYI6Fhz.cjs');
|
|
4
4
|
let autotel = require("autotel");
|
|
5
5
|
let node_module = require("node:module");
|
|
6
6
|
|
package/dist/auto-wrap.d.cts
CHANGED
|
@@ -36,12 +36,22 @@
|
|
|
36
36
|
* cleanly. The same setup file can stay in place for a repo whose
|
|
37
37
|
* non-contract test packages don't have Pact as a dependency.
|
|
38
38
|
*/
|
|
39
|
+
/**
|
|
40
|
+
* A Pact-JS prototype as this file patches it. Pact-JS is an optional peer, so
|
|
41
|
+
* its classes are reached through the module object rather than imported, and
|
|
42
|
+
* each method is captured and replaced by name.
|
|
43
|
+
*/
|
|
44
|
+
type PactPrototype = Record<string | symbol, PactPrototypeMember>;
|
|
45
|
+
/** A member of a patched prototype: the method being wrapped, or our marker. */
|
|
46
|
+
type PactPrototypeMember = ((...args: never[]) => PactCallResult) | boolean | undefined;
|
|
47
|
+
/** What a patched Pact-JS method returns: a builder, a promise, or nothing. */
|
|
48
|
+
type PactCallResult = object | Promise<unknown> | void;
|
|
39
49
|
interface PactJsModule {
|
|
40
50
|
MessageConsumerPact?: {
|
|
41
|
-
prototype:
|
|
51
|
+
prototype: PactPrototype;
|
|
42
52
|
};
|
|
43
53
|
PactV3?: {
|
|
44
|
-
prototype:
|
|
54
|
+
prototype: PactPrototype;
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
@@ -55,4 +65,4 @@ interface PactJsModule {
|
|
|
55
65
|
*/
|
|
56
66
|
declare function installAutoWrap(pactModule?: PactJsModule): boolean;
|
|
57
67
|
//#endregion
|
|
58
|
-
export { installAutoWrap };
|
|
68
|
+
export { PactCallResult, PactPrototype, PactPrototypeMember, installAutoWrap };
|
package/dist/auto-wrap.d.ts
CHANGED
|
@@ -36,12 +36,22 @@
|
|
|
36
36
|
* cleanly. The same setup file can stay in place for a repo whose
|
|
37
37
|
* non-contract test packages don't have Pact as a dependency.
|
|
38
38
|
*/
|
|
39
|
+
/**
|
|
40
|
+
* A Pact-JS prototype as this file patches it. Pact-JS is an optional peer, so
|
|
41
|
+
* its classes are reached through the module object rather than imported, and
|
|
42
|
+
* each method is captured and replaced by name.
|
|
43
|
+
*/
|
|
44
|
+
type PactPrototype = Record<string | symbol, PactPrototypeMember>;
|
|
45
|
+
/** A member of a patched prototype: the method being wrapped, or our marker. */
|
|
46
|
+
type PactPrototypeMember = ((...args: never[]) => PactCallResult) | boolean | undefined;
|
|
47
|
+
/** What a patched Pact-JS method returns: a builder, a promise, or nothing. */
|
|
48
|
+
type PactCallResult = object | Promise<unknown> | void;
|
|
39
49
|
interface PactJsModule {
|
|
40
50
|
MessageConsumerPact?: {
|
|
41
|
-
prototype:
|
|
51
|
+
prototype: PactPrototype;
|
|
42
52
|
};
|
|
43
53
|
PactV3?: {
|
|
44
|
-
prototype:
|
|
54
|
+
prototype: PactPrototype;
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
@@ -55,4 +65,4 @@ interface PactJsModule {
|
|
|
55
65
|
*/
|
|
56
66
|
declare function installAutoWrap(pactModule?: PactJsModule): boolean;
|
|
57
67
|
//#endregion
|
|
58
|
-
export { installAutoWrap };
|
|
68
|
+
export { PactCallResult, PactPrototype, PactPrototypeMember, installAutoWrap };
|
package/dist/auto-wrap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as buildPactAttributes, r as outcomeAttribute } from "./attrs-
|
|
1
|
+
import { n as buildPactAttributes, r as outcomeAttribute } from "./attrs-BxJCnQsN.js";
|
|
2
2
|
import { c as LEDGER_ENTRY_SPEC, t as appendLedgerEntry } from "./ledger-sII3Ig3Y.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { getActiveSpan, span } from "autotel";
|
package/dist/broker.cjs
CHANGED
|
@@ -2,10 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
//#region src/broker.ts
|
|
4
4
|
function authHeaders(config) {
|
|
5
|
-
const
|
|
6
|
-
if (config.token)
|
|
7
|
-
else if (config.username && config.password)
|
|
8
|
-
|
|
5
|
+
const auth = [];
|
|
6
|
+
if (config.token) auth.push(["Authorization", `Bearer ${config.token}`]);
|
|
7
|
+
else if (config.username && config.password) {
|
|
8
|
+
const encoded = Buffer.from(`${config.username}:${config.password}`).toString("base64");
|
|
9
|
+
auth.push(["Authorization", `Basic ${encoded}`]);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
Accept: "application/json",
|
|
13
|
+
...Object.fromEntries(auth)
|
|
14
|
+
};
|
|
9
15
|
}
|
|
10
16
|
function trimBaseUrl(url) {
|
|
11
17
|
return url.replace(/\/$/, "");
|
package/dist/broker.d.cts
CHANGED
package/dist/broker.d.ts
CHANGED
package/dist/broker.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
//#region src/broker.ts
|
|
2
2
|
function authHeaders(config) {
|
|
3
|
-
const
|
|
4
|
-
if (config.token)
|
|
5
|
-
else if (config.username && config.password)
|
|
6
|
-
|
|
3
|
+
const auth = [];
|
|
4
|
+
if (config.token) auth.push(["Authorization", `Bearer ${config.token}`]);
|
|
5
|
+
else if (config.username && config.password) {
|
|
6
|
+
const encoded = Buffer.from(`${config.username}:${config.password}`).toString("base64");
|
|
7
|
+
auth.push(["Authorization", `Basic ${encoded}`]);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
Accept: "application/json",
|
|
11
|
+
...Object.fromEntries(auth)
|
|
12
|
+
};
|
|
7
13
|
}
|
|
8
14
|
function trimBaseUrl(url) {
|
|
9
15
|
return url.replace(/\/$/, "");
|
package/dist/cli.cjs
CHANGED
|
@@ -174,7 +174,7 @@ async function main(argv) {
|
|
|
174
174
|
try {
|
|
175
175
|
args = parseArgs(argv);
|
|
176
176
|
} catch (error) {
|
|
177
|
-
process.stderr.write(`${error.message}\n\n${HELP_TEXT}`);
|
|
177
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n\n${HELP_TEXT}`);
|
|
178
178
|
return 2;
|
|
179
179
|
}
|
|
180
180
|
if (args.help) {
|
package/dist/cli.js
CHANGED
|
@@ -173,7 +173,7 @@ async function main(argv) {
|
|
|
173
173
|
try {
|
|
174
174
|
args = parseArgs(argv);
|
|
175
175
|
} catch (error) {
|
|
176
|
-
process.stderr.write(`${error.message}\n\n${HELP_TEXT}`);
|
|
176
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n\n${HELP_TEXT}`);
|
|
177
177
|
return 2;
|
|
178
178
|
}
|
|
179
179
|
if (args.help) {
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_ledger = require('./ledger-BayQwemz.cjs');
|
|
3
|
-
const require_attrs = require('./attrs-
|
|
3
|
+
const require_attrs = require('./attrs-DkYI6Fhz.cjs');
|
|
4
4
|
const require_pact_file = require('./pact-file-B8QjVrC7.cjs');
|
|
5
5
|
const require_provider = require('./provider.cjs');
|
|
6
6
|
const require_tag = require('./tag.cjs');
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as isProviderVerificationRun, a as InteractionLedgerEntry, c as LedgerRole, d as PactInteractionKey, f as PactInteractionMeta, g as isInteractionLedgerEntry, h as ProviderVerificationRunEntry, i as BrokerVerification, l as LedgerSource, m as PactOutcome, n as AuditMatrix, o as LEDGER_ENTRY_SPEC, p as PactKind, r as AuditRow, s as LedgerRecord, t as AUDIT_MATRIX_SPEC, u as PactFile } from "./types-
|
|
1
|
+
import { _ as isProviderVerificationRun, a as InteractionLedgerEntry, c as LedgerRole, d as PactInteractionKey, f as PactInteractionMeta, g as isInteractionLedgerEntry, h as ProviderVerificationRunEntry, i as BrokerVerification, l as LedgerSource, m as PactOutcome, n as AuditMatrix, o as LEDGER_ENTRY_SPEC, p as PactKind, r as AuditRow, s as LedgerRecord, t as AUDIT_MATRIX_SPEC, u as PactFile } from "./types-ylkoxFXB.cjs";
|
|
2
2
|
import { BrokerConfig, ConsumerProviderPair, brokerConfigFromEnv, fetchBrokerVerifications, parseBrokerVerificationResult } from "./broker.cjs";
|
|
3
|
-
import { a as flushLedgerWrites, i as appendProviderVerificationFailure, n as appendLedgerEntry, o as ledgerPath, r as appendLedgerEntryAsync, s as readLedger, t as LedgerOptions } from "./ledger-
|
|
3
|
+
import { a as flushLedgerWrites, i as appendProviderVerificationFailure, n as appendLedgerEntry, o as ledgerPath, r as appendLedgerEntryAsync, s as readLedger, t as LedgerOptions } from "./ledger-BBxcf9SV.cjs";
|
|
4
4
|
import { AuditOptions, computeAuditMatrix, keyOf, runAudit, runAuditSync } from "./audit.cjs";
|
|
5
5
|
import { VerifierConstructor, VerifierLike, VerifierOptionsLike, WithProviderVerificationOptions, withProviderVerification } from "./provider.cjs";
|
|
6
6
|
import { tagPactInteraction } from "./tag.cjs";
|
|
@@ -14,7 +14,8 @@ import { PactLedgerProcessorOptions, PactLedgerSpanProcessor, ReadableSpanLike,
|
|
|
14
14
|
* at runtime, with `opts.consumer` / `opts.provider` as override fallbacks.
|
|
15
15
|
*/
|
|
16
16
|
interface MessageConsumerPactLike {
|
|
17
|
-
|
|
17
|
+
/** Runs the handler against the reified message and forwards what it returned. */
|
|
18
|
+
verify: <R>(handler: (message: ReifiedMessage) => Promise<R>) => Promise<R>;
|
|
18
19
|
/**
|
|
19
20
|
* Optional fluent metadata appender. Pact-JS's `MessageConsumerPact`
|
|
20
21
|
* provides this; we use it (when present) to write `interactionId`
|
|
@@ -30,7 +31,7 @@ interface MessageConsumerPactLike {
|
|
|
30
31
|
interface ReifiedMessage {
|
|
31
32
|
contents: unknown;
|
|
32
33
|
description?: string;
|
|
33
|
-
metadata?: Record<string,
|
|
34
|
+
metadata?: Record<string, string | number | boolean>;
|
|
34
35
|
providerStates?: Array<{
|
|
35
36
|
name: string;
|
|
36
37
|
}>;
|
|
@@ -178,12 +179,16 @@ type PactAttributeKey = (typeof PACT_ATTRS)[keyof typeof PACT_ATTRS];
|
|
|
178
179
|
*/
|
|
179
180
|
declare function buildPactAttributes(meta: PactInteractionMeta, opts?: {
|
|
180
181
|
contractFile?: string;
|
|
181
|
-
}):
|
|
182
|
+
}): {
|
|
183
|
+
[k: string]: string | string[];
|
|
184
|
+
};
|
|
182
185
|
/**
|
|
183
186
|
* Helper that returns just the outcome attribute — stamped after the
|
|
184
187
|
* handler resolves or rejects.
|
|
185
188
|
*/
|
|
186
|
-
declare function outcomeAttribute(outcome: PactOutcome):
|
|
189
|
+
declare function outcomeAttribute(outcome: PactOutcome): {
|
|
190
|
+
"pact.outcome": PactOutcome;
|
|
191
|
+
};
|
|
187
192
|
//#endregion
|
|
188
193
|
//#region src/pact-file.d.ts
|
|
189
194
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as isProviderVerificationRun, a as InteractionLedgerEntry, c as LedgerRole, d as PactInteractionKey, f as PactInteractionMeta, g as isInteractionLedgerEntry, h as ProviderVerificationRunEntry, i as BrokerVerification, l as LedgerSource, m as PactOutcome, n as AuditMatrix, o as LEDGER_ENTRY_SPEC, p as PactKind, r as AuditRow, s as LedgerRecord, t as AUDIT_MATRIX_SPEC, u as PactFile } from "./types-
|
|
1
|
+
import { _ as isProviderVerificationRun, a as InteractionLedgerEntry, c as LedgerRole, d as PactInteractionKey, f as PactInteractionMeta, g as isInteractionLedgerEntry, h as ProviderVerificationRunEntry, i as BrokerVerification, l as LedgerSource, m as PactOutcome, n as AuditMatrix, o as LEDGER_ENTRY_SPEC, p as PactKind, r as AuditRow, s as LedgerRecord, t as AUDIT_MATRIX_SPEC, u as PactFile } from "./types-ylkoxFXB.js";
|
|
2
2
|
import { BrokerConfig, ConsumerProviderPair, brokerConfigFromEnv, fetchBrokerVerifications, parseBrokerVerificationResult } from "./broker.js";
|
|
3
|
-
import { a as flushLedgerWrites, i as appendProviderVerificationFailure, n as appendLedgerEntry, o as ledgerPath, r as appendLedgerEntryAsync, s as readLedger, t as LedgerOptions } from "./ledger-
|
|
3
|
+
import { a as flushLedgerWrites, i as appendProviderVerificationFailure, n as appendLedgerEntry, o as ledgerPath, r as appendLedgerEntryAsync, s as readLedger, t as LedgerOptions } from "./ledger-iDI3Mq4i.js";
|
|
4
4
|
import { AuditOptions, computeAuditMatrix, keyOf, runAudit, runAuditSync } from "./audit.js";
|
|
5
5
|
import { VerifierConstructor, VerifierLike, VerifierOptionsLike, WithProviderVerificationOptions, withProviderVerification } from "./provider.js";
|
|
6
6
|
import { tagPactInteraction } from "./tag.js";
|
|
@@ -14,7 +14,8 @@ import { PactLedgerProcessorOptions, PactLedgerSpanProcessor, ReadableSpanLike,
|
|
|
14
14
|
* at runtime, with `opts.consumer` / `opts.provider` as override fallbacks.
|
|
15
15
|
*/
|
|
16
16
|
interface MessageConsumerPactLike {
|
|
17
|
-
|
|
17
|
+
/** Runs the handler against the reified message and forwards what it returned. */
|
|
18
|
+
verify: <R>(handler: (message: ReifiedMessage) => Promise<R>) => Promise<R>;
|
|
18
19
|
/**
|
|
19
20
|
* Optional fluent metadata appender. Pact-JS's `MessageConsumerPact`
|
|
20
21
|
* provides this; we use it (when present) to write `interactionId`
|
|
@@ -30,7 +31,7 @@ interface MessageConsumerPactLike {
|
|
|
30
31
|
interface ReifiedMessage {
|
|
31
32
|
contents: unknown;
|
|
32
33
|
description?: string;
|
|
33
|
-
metadata?: Record<string,
|
|
34
|
+
metadata?: Record<string, string | number | boolean>;
|
|
34
35
|
providerStates?: Array<{
|
|
35
36
|
name: string;
|
|
36
37
|
}>;
|
|
@@ -178,12 +179,16 @@ type PactAttributeKey = (typeof PACT_ATTRS)[keyof typeof PACT_ATTRS];
|
|
|
178
179
|
*/
|
|
179
180
|
declare function buildPactAttributes(meta: PactInteractionMeta, opts?: {
|
|
180
181
|
contractFile?: string;
|
|
181
|
-
}):
|
|
182
|
+
}): {
|
|
183
|
+
[k: string]: string | string[];
|
|
184
|
+
};
|
|
182
185
|
/**
|
|
183
186
|
* Helper that returns just the outcome attribute — stamped after the
|
|
184
187
|
* handler resolves or rejects.
|
|
185
188
|
*/
|
|
186
|
-
declare function outcomeAttribute(outcome: PactOutcome):
|
|
189
|
+
declare function outcomeAttribute(outcome: PactOutcome): {
|
|
190
|
+
"pact.outcome": PactOutcome;
|
|
191
|
+
};
|
|
187
192
|
//#endregion
|
|
188
193
|
//#region src/pact-file.d.ts
|
|
189
194
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as buildPactAttributes, r as outcomeAttribute, t as PACT_ATTRS } from "./attrs-
|
|
1
|
+
import { n as buildPactAttributes, r as outcomeAttribute, t as PACT_ATTRS } from "./attrs-BxJCnQsN.js";
|
|
2
2
|
import { a as ledgerPath, c as LEDGER_ENTRY_SPEC, i as flushLedgerWrites, l as isInteractionLedgerEntry, n as appendLedgerEntryAsync, o as readLedger, r as appendProviderVerificationFailure, s as AUDIT_MATRIX_SPEC, t as appendLedgerEntry, u as isProviderVerificationRun } from "./ledger-sII3Ig3Y.js";
|
|
3
3
|
import { n as listPactFiles, r as parsePactFile, t as interactionsFromPactFile } from "./pact-file-CkE4NFZ1.js";
|
|
4
4
|
import { withProviderVerification } from "./provider.js";
|
package/dist/processor.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_ledger = require('./ledger-BayQwemz.cjs');
|
|
3
|
-
const require_attrs = require('./attrs-
|
|
3
|
+
const require_attrs = require('./attrs-DkYI6Fhz.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/processor.ts
|
|
6
6
|
const DEFAULT_MAX_QUEUE = 1024;
|
package/dist/processor.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { t as LedgerOptions } from "./ledger-
|
|
1
|
+
import { t as LedgerOptions } from "./ledger-BBxcf9SV.cjs";
|
|
2
2
|
//#region src/processor.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** What a span attribute can hold once it has been recorded. */
|
|
4
|
+
type SpanAttributeValue = string | number | boolean | Array<string | number | boolean | null> | undefined;
|
|
5
|
+
/** A ReadableSpan as this processor reads one, without a hard SDK dependency. */
|
|
4
6
|
interface ReadableSpanLike {
|
|
5
|
-
attributes: Record<string,
|
|
7
|
+
attributes: Record<string, SpanAttributeValue>;
|
|
6
8
|
spanContext(): {
|
|
7
9
|
traceId: string;
|
|
8
10
|
spanId: string;
|
|
@@ -19,8 +21,13 @@ interface SpanLike {
|
|
|
19
21
|
spanId: string;
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The parent context OTel hands a span processor. This package never reads it;
|
|
26
|
+
* naming it keeps the SpanProcessor signature matchable without the SDK.
|
|
27
|
+
*/
|
|
28
|
+
interface OtelContext {
|
|
29
|
+
getValue?: (key: symbol) => object | string | number | boolean | undefined;
|
|
30
|
+
}
|
|
24
31
|
interface SpanProcessorLike {
|
|
25
32
|
onStart(span: SpanLike, parentContext: OtelContext): void;
|
|
26
33
|
onEnd(span: ReadableSpanLike): void;
|
|
@@ -31,7 +38,7 @@ interface PactLedgerProcessorOptions extends LedgerOptions {
|
|
|
31
38
|
/** Max queued ledger writes before dropping (default 1024). */
|
|
32
39
|
maxQueueSize?: number;
|
|
33
40
|
onDrop?: (reason: 'queue_full') => void;
|
|
34
|
-
onWriteError?: (
|
|
41
|
+
onWriteError?: (cause: unknown) => void;
|
|
35
42
|
onWarn?: (message: string) => void;
|
|
36
43
|
}
|
|
37
44
|
/**
|
|
@@ -54,4 +61,4 @@ declare class PactLedgerSpanProcessor implements SpanProcessorLike {
|
|
|
54
61
|
}
|
|
55
62
|
declare function createPactLedgerProcessor(opts?: PactLedgerProcessorOptions): PactLedgerSpanProcessor;
|
|
56
63
|
//#endregion
|
|
57
|
-
export { OtelContext, PactLedgerProcessorOptions, PactLedgerSpanProcessor, ReadableSpanLike, SpanLike, SpanProcessorLike, createPactLedgerProcessor };
|
|
64
|
+
export { OtelContext, PactLedgerProcessorOptions, PactLedgerSpanProcessor, ReadableSpanLike, SpanAttributeValue, SpanLike, SpanProcessorLike, createPactLedgerProcessor };
|
package/dist/processor.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { t as LedgerOptions } from "./ledger-
|
|
1
|
+
import { t as LedgerOptions } from "./ledger-iDI3Mq4i.js";
|
|
2
2
|
//#region src/processor.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** What a span attribute can hold once it has been recorded. */
|
|
4
|
+
type SpanAttributeValue = string | number | boolean | Array<string | number | boolean | null> | undefined;
|
|
5
|
+
/** A ReadableSpan as this processor reads one, without a hard SDK dependency. */
|
|
4
6
|
interface ReadableSpanLike {
|
|
5
|
-
attributes: Record<string,
|
|
7
|
+
attributes: Record<string, SpanAttributeValue>;
|
|
6
8
|
spanContext(): {
|
|
7
9
|
traceId: string;
|
|
8
10
|
spanId: string;
|
|
@@ -19,8 +21,13 @@ interface SpanLike {
|
|
|
19
21
|
spanId: string;
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The parent context OTel hands a span processor. This package never reads it;
|
|
26
|
+
* naming it keeps the SpanProcessor signature matchable without the SDK.
|
|
27
|
+
*/
|
|
28
|
+
interface OtelContext {
|
|
29
|
+
getValue?: (key: symbol) => object | string | number | boolean | undefined;
|
|
30
|
+
}
|
|
24
31
|
interface SpanProcessorLike {
|
|
25
32
|
onStart(span: SpanLike, parentContext: OtelContext): void;
|
|
26
33
|
onEnd(span: ReadableSpanLike): void;
|
|
@@ -31,7 +38,7 @@ interface PactLedgerProcessorOptions extends LedgerOptions {
|
|
|
31
38
|
/** Max queued ledger writes before dropping (default 1024). */
|
|
32
39
|
maxQueueSize?: number;
|
|
33
40
|
onDrop?: (reason: 'queue_full') => void;
|
|
34
|
-
onWriteError?: (
|
|
41
|
+
onWriteError?: (cause: unknown) => void;
|
|
35
42
|
onWarn?: (message: string) => void;
|
|
36
43
|
}
|
|
37
44
|
/**
|
|
@@ -54,4 +61,4 @@ declare class PactLedgerSpanProcessor implements SpanProcessorLike {
|
|
|
54
61
|
}
|
|
55
62
|
declare function createPactLedgerProcessor(opts?: PactLedgerProcessorOptions): PactLedgerSpanProcessor;
|
|
56
63
|
//#endregion
|
|
57
|
-
export { OtelContext, PactLedgerProcessorOptions, PactLedgerSpanProcessor, ReadableSpanLike, SpanLike, SpanProcessorLike, createPactLedgerProcessor };
|
|
64
|
+
export { OtelContext, PactLedgerProcessorOptions, PactLedgerSpanProcessor, ReadableSpanLike, SpanAttributeValue, SpanLike, SpanProcessorLike, createPactLedgerProcessor };
|
package/dist/processor.js
CHANGED
package/dist/provider.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_ledger = require('./ledger-BayQwemz.cjs');
|
|
3
|
-
const require_attrs = require('./attrs-
|
|
3
|
+
const require_attrs = require('./attrs-DkYI6Fhz.cjs');
|
|
4
4
|
const require_pact_file = require('./pact-file-B8QjVrC7.cjs');
|
|
5
5
|
let autotel = require("autotel");
|
|
6
6
|
let node_path = require("node:path");
|
package/dist/provider.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as LedgerOptions } from "./ledger-
|
|
1
|
+
import { t as LedgerOptions } from "./ledger-BBxcf9SV.cjs";
|
|
2
2
|
//#region src/wrapper-provider.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Minimal Verifier options — structural match for @pact-foundation/pact Verifier.
|
|
@@ -8,11 +8,17 @@ interface VerifierOptionsLike {
|
|
|
8
8
|
providerBaseUrl: string;
|
|
9
9
|
pactUrls?: string[];
|
|
10
10
|
logLevel?: string;
|
|
11
|
-
|
|
11
|
+
/** Pact-JS accepts more options than this package names; they pass through. */
|
|
12
|
+
[key: string]: VerifierOptionValue;
|
|
12
13
|
}
|
|
14
|
+
/** What a Pact-JS verifier option can hold. */
|
|
15
|
+
type VerifierOptionValue = string | number | boolean | Array<string> | Record<string, string> | undefined;
|
|
13
16
|
interface VerifierLike {
|
|
14
|
-
|
|
17
|
+
/** Resolves with Pact-JS's own verification output, which we do not read. */
|
|
18
|
+
verifyProvider: () => Promise<VerificationOutput>;
|
|
15
19
|
}
|
|
20
|
+
/** Whatever Pact-JS reports from a verification run. */
|
|
21
|
+
type VerificationOutput = string | object;
|
|
16
22
|
interface VerifierConstructor {
|
|
17
23
|
new (options: VerifierOptionsLike): VerifierLike;
|
|
18
24
|
}
|
|
@@ -37,4 +43,4 @@ interface WithProviderVerificationOptions extends LedgerOptions {
|
|
|
37
43
|
*/
|
|
38
44
|
declare function withProviderVerification(verifierOpts: VerifierOptionsLike, wrapOpts?: WithProviderVerificationOptions): Promise<void>;
|
|
39
45
|
//#endregion
|
|
40
|
-
export { VerifierConstructor, VerifierLike, VerifierOptionsLike, WithProviderVerificationOptions, withProviderVerification };
|
|
46
|
+
export { VerificationOutput, VerifierConstructor, VerifierLike, VerifierOptionValue, VerifierOptionsLike, WithProviderVerificationOptions, withProviderVerification };
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as LedgerOptions } from "./ledger-
|
|
1
|
+
import { t as LedgerOptions } from "./ledger-iDI3Mq4i.js";
|
|
2
2
|
//#region src/wrapper-provider.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Minimal Verifier options — structural match for @pact-foundation/pact Verifier.
|
|
@@ -8,11 +8,17 @@ interface VerifierOptionsLike {
|
|
|
8
8
|
providerBaseUrl: string;
|
|
9
9
|
pactUrls?: string[];
|
|
10
10
|
logLevel?: string;
|
|
11
|
-
|
|
11
|
+
/** Pact-JS accepts more options than this package names; they pass through. */
|
|
12
|
+
[key: string]: VerifierOptionValue;
|
|
12
13
|
}
|
|
14
|
+
/** What a Pact-JS verifier option can hold. */
|
|
15
|
+
type VerifierOptionValue = string | number | boolean | Array<string> | Record<string, string> | undefined;
|
|
13
16
|
interface VerifierLike {
|
|
14
|
-
|
|
17
|
+
/** Resolves with Pact-JS's own verification output, which we do not read. */
|
|
18
|
+
verifyProvider: () => Promise<VerificationOutput>;
|
|
15
19
|
}
|
|
20
|
+
/** Whatever Pact-JS reports from a verification run. */
|
|
21
|
+
type VerificationOutput = string | object;
|
|
16
22
|
interface VerifierConstructor {
|
|
17
23
|
new (options: VerifierOptionsLike): VerifierLike;
|
|
18
24
|
}
|
|
@@ -37,4 +43,4 @@ interface WithProviderVerificationOptions extends LedgerOptions {
|
|
|
37
43
|
*/
|
|
38
44
|
declare function withProviderVerification(verifierOpts: VerifierOptionsLike, wrapOpts?: WithProviderVerificationOptions): Promise<void>;
|
|
39
45
|
//#endregion
|
|
40
|
-
export { VerifierConstructor, VerifierLike, VerifierOptionsLike, WithProviderVerificationOptions, withProviderVerification };
|
|
46
|
+
export { VerificationOutput, VerifierConstructor, VerifierLike, VerifierOptionValue, VerifierOptionsLike, WithProviderVerificationOptions, withProviderVerification };
|
package/dist/provider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PACT_ATTRS } from "./attrs-
|
|
1
|
+
import { t as PACT_ATTRS } from "./attrs-BxJCnQsN.js";
|
|
2
2
|
import { c as LEDGER_ENTRY_SPEC, r as appendProviderVerificationFailure, t as appendLedgerEntry } from "./ledger-sII3Ig3Y.js";
|
|
3
3
|
import { r as parsePactFile, t as interactionsFromPactFile } from "./pact-file-CkE4NFZ1.js";
|
|
4
4
|
import { getActiveSpan, span } from "autotel";
|
package/dist/tag.cjs
CHANGED
package/dist/tag.d.cts
CHANGED
package/dist/tag.d.ts
CHANGED
package/dist/tag.js
CHANGED
|
@@ -79,14 +79,14 @@ interface PactFile {
|
|
|
79
79
|
providerStates?: Array<{
|
|
80
80
|
name: string;
|
|
81
81
|
}>;
|
|
82
|
-
metadata?: Record<string,
|
|
82
|
+
metadata?: Record<string, string | number | boolean>;
|
|
83
83
|
}>;
|
|
84
84
|
interactions?: Array<{
|
|
85
85
|
description: string;
|
|
86
86
|
providerStates?: Array<{
|
|
87
87
|
name: string;
|
|
88
88
|
}>;
|
|
89
|
-
metadata?: Record<string,
|
|
89
|
+
metadata?: Record<string, string | number | boolean>;
|
|
90
90
|
}>;
|
|
91
91
|
}
|
|
92
92
|
interface BrokerVerification {
|
|
@@ -79,14 +79,14 @@ interface PactFile {
|
|
|
79
79
|
providerStates?: Array<{
|
|
80
80
|
name: string;
|
|
81
81
|
}>;
|
|
82
|
-
metadata?: Record<string,
|
|
82
|
+
metadata?: Record<string, string | number | boolean>;
|
|
83
83
|
}>;
|
|
84
84
|
interactions?: Array<{
|
|
85
85
|
description: string;
|
|
86
86
|
providerStates?: Array<{
|
|
87
87
|
name: string;
|
|
88
88
|
}>;
|
|
89
|
-
metadata?: Record<string,
|
|
89
|
+
metadata?: Record<string, string | number | boolean>;
|
|
90
90
|
}>;
|
|
91
91
|
}
|
|
92
92
|
interface BrokerVerification {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-pact",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "Runtime evidence for Pact contracts — autotel bridge that records which contract interactions were actually exercised, and audits 'contracted but never observed'.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"license": "Apache-2.0",
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@pact-foundation/pact": ">=17",
|
|
72
|
-
"autotel": "
|
|
72
|
+
"autotel": "7.0.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"@pact-foundation/pact": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"tsdown": "^0.22.14",
|
|
84
84
|
"typescript": "^6.0.3",
|
|
85
85
|
"vitest": "^4.1.10",
|
|
86
|
-
"autotel": "
|
|
86
|
+
"autotel": "7.0.0"
|
|
87
87
|
},
|
|
88
88
|
"repository": {
|
|
89
89
|
"type": "git",
|