@pact-foundation/pact-core 13.4.1-beta.14 → 13.4.1-beta.15
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/bin/pact-broker.d.ts +2 -0
- package/bin/pact-broker.js +10 -0
- package/bin/pact-broker.js.map +1 -0
- package/bin/pact-message.d.ts +2 -0
- package/bin/pact-message.js +10 -0
- package/bin/pact-message.js.map +1 -0
- package/bin/pact-mock-service.d.ts +2 -0
- package/bin/pact-mock-service.js +8 -0
- package/bin/pact-mock-service.js.map +1 -0
- package/bin/pact-provider-verifier.d.ts +2 -0
- package/bin/pact-provider-verifier.js +10 -0
- package/bin/pact-provider-verifier.js.map +1 -0
- package/bin/pact-stub-service.d.ts +2 -0
- package/bin/pact-stub-service.js +10 -0
- package/bin/pact-stub-service.js.map +1 -0
- package/bin/pact.d.ts +2 -0
- package/bin/pact.js +10 -0
- package/bin/pact.js.map +1 -0
- package/ffi/libpact_ffi.so.gz +0 -0
- package/ffi/pact.h +171 -177
- package/package.json +2 -2
- package/src/can-deploy.d.ts +49 -0
- package/src/can-deploy.js +148 -0
- package/src/can-deploy.js.map +1 -0
- package/src/consumer/__testoutput__/foo-consumer-bar-provider.json +2 -2
- package/src/consumer/checkErrors.d.ts +7 -0
- package/src/consumer/checkErrors.js +41 -0
- package/src/consumer/checkErrors.js.map +1 -0
- package/src/consumer/index.d.ts +4 -0
- package/src/consumer/index.js +145 -0
- package/src/consumer/index.js.map +1 -0
- package/src/consumer/types.d.ts +109 -0
- package/src/consumer/types.js +3 -0
- package/src/consumer/types.js.map +1 -0
- package/src/ffi/index.d.ts +7 -0
- package/src/ffi/index.js +32 -0
- package/src/ffi/index.js.map +1 -0
- package/src/ffi/internals/index.d.ts +2 -0
- package/src/ffi/internals/index.js +41 -0
- package/src/ffi/internals/index.js.map +1 -0
- package/src/ffi/types.d.ts +81 -0
- package/src/ffi/types.js +50 -0
- package/src/ffi/types.js.map +1 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +25 -0
- package/src/index.js.map +1 -0
- package/src/logger/crashMessage.d.ts +1 -0
- package/src/logger/crashMessage.js +6 -0
- package/src/logger/crashMessage.js.map +1 -0
- package/src/logger/index.d.ts +16 -0
- package/src/logger/index.js +63 -0
- package/src/logger/index.js.map +1 -0
- package/src/logger/pino.d.ts +3 -0
- package/src/logger/pino.js +14 -0
- package/src/logger/pino.js.map +1 -0
- package/src/logger/types.d.ts +9 -0
- package/src/logger/types.js +3 -0
- package/src/logger/types.js.map +1 -0
- package/src/message.d.ts +16 -0
- package/src/message.js +96 -0
- package/src/message.js.map +1 -0
- package/src/pact-environment.d.ts +6 -0
- package/src/pact-environment.js +23 -0
- package/src/pact-environment.js.map +1 -0
- package/src/pact-standalone.d.ts +18 -0
- package/src/pact-standalone.js +44 -0
- package/src/pact-standalone.js.map +1 -0
- package/src/pact.d.ts +27 -0
- package/src/pact.js +120 -0
- package/src/pact.js.map +1 -0
- package/src/publisher.d.ts +20 -0
- package/src/publisher.js +99 -0
- package/src/publisher.js.map +1 -0
- package/src/server.d.ts +25 -0
- package/src/server.js +96 -0
- package/src/server.js.map +1 -0
- package/src/service.d.ts +46 -0
- package/src/service.js +252 -0
- package/src/service.js.map +1 -0
- package/src/spawn/arguments.d.ts +20 -0
- package/src/spawn/arguments.js +48 -0
- package/src/spawn/arguments.js.map +1 -0
- package/src/spawn/index.d.ts +2 -0
- package/src/spawn/index.js +17 -0
- package/src/spawn/index.js.map +1 -0
- package/src/spawn/spawn.d.ts +12 -0
- package/src/spawn/spawn.js +78 -0
- package/src/spawn/spawn.js.map +1 -0
- package/src/stub.d.ts +20 -0
- package/src/stub.js +51 -0
- package/src/stub.js.map +1 -0
- package/src/verifier/argumentMapper/arguments.d.ts +5 -0
- package/src/verifier/argumentMapper/arguments.js +103 -0
- package/src/verifier/argumentMapper/arguments.js.map +1 -0
- package/src/verifier/argumentMapper/index.d.ts +1 -0
- package/src/verifier/argumentMapper/index.js +63 -0
- package/src/verifier/argumentMapper/index.js.map +1 -0
- package/src/verifier/argumentMapper/types.d.ts +1 -0
- package/src/verifier/argumentMapper/types.js +3 -0
- package/src/verifier/argumentMapper/types.js.map +1 -0
- package/src/verifier/filesystem/index.d.ts +2 -0
- package/src/verifier/filesystem/index.js +24 -0
- package/src/verifier/filesystem/index.js.map +1 -0
- package/src/verifier/filesystem/types.d.ts +1 -0
- package/src/verifier/filesystem/types.js +3 -0
- package/src/verifier/filesystem/types.js.map +1 -0
- package/src/verifier/index.d.ts +8 -0
- package/src/verifier/index.js +31 -0
- package/src/verifier/index.js.map +1 -0
- package/src/verifier/nativeVerifier.d.ts +2 -0
- package/src/verifier/nativeVerifier.js +152 -0
- package/src/verifier/nativeVerifier.js.map +1 -0
- package/src/verifier/types.d.ts +54 -0
- package/src/verifier/types.js +3 -0
- package/src/verifier/types.js.map +1 -0
- package/src/verifier/validateOptions.d.ts +2 -0
- package/src/verifier/validateOptions.js +132 -0
- package/src/verifier/validateOptions.js.map +1 -0
- package/standalone/install.d.ts +32 -0
- package/standalone/install.js +96 -0
- package/standalone/install.js.map +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.libName = void 0;
|
|
4
|
+
var PLATFORM_LOOKUP = {
|
|
5
|
+
linux: 'linux',
|
|
6
|
+
darwin: 'osx',
|
|
7
|
+
win32: 'windows',
|
|
8
|
+
};
|
|
9
|
+
var LIBNAME_PREFIX_LOOKUP = {
|
|
10
|
+
linux: 'lib',
|
|
11
|
+
darwin: 'lib',
|
|
12
|
+
win32: '',
|
|
13
|
+
};
|
|
14
|
+
var ARCH_LOOKUP = { x64: 'x86_64', arm64: 'aarch64-apple-darwin' };
|
|
15
|
+
var EXTENSION_LOOKUP = {
|
|
16
|
+
'osx-x86_64': 'dylib',
|
|
17
|
+
'osx-aarch64-apple-darwin': 'dylib',
|
|
18
|
+
'linux-x86_64': 'so',
|
|
19
|
+
'windows-x86_64': 'dll',
|
|
20
|
+
};
|
|
21
|
+
var libName = function (library, version, processArch, processPlatform) {
|
|
22
|
+
if (processArch === void 0) { processArch = process.arch; }
|
|
23
|
+
if (processPlatform === void 0) { processPlatform = process.platform; }
|
|
24
|
+
var arch = ARCH_LOOKUP[processArch];
|
|
25
|
+
var platform = PLATFORM_LOOKUP[processPlatform];
|
|
26
|
+
if (!arch || !platform) {
|
|
27
|
+
throw new Error("Pact does not currently support the operating system and architecture combination '" + processPlatform + "/" + processArch + "'");
|
|
28
|
+
}
|
|
29
|
+
var target = platform + "-" + arch;
|
|
30
|
+
var extension = EXTENSION_LOOKUP[target];
|
|
31
|
+
if (!extension) {
|
|
32
|
+
throw new Error("Pact doesn't know what extension to use for the libraries in the architecture combination '" + target + "'");
|
|
33
|
+
}
|
|
34
|
+
var libnamePrefix = LIBNAME_PREFIX_LOOKUP[processPlatform];
|
|
35
|
+
if (libnamePrefix === undefined) {
|
|
36
|
+
throw new Error("Pact doesn't know what prefix to use for the libraries on '" + processPlatform + "'");
|
|
37
|
+
}
|
|
38
|
+
return version + "-" + libnamePrefix + library + "-" + target + "." + extension;
|
|
39
|
+
};
|
|
40
|
+
exports.libName = libName;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,IAAM,eAAe,GAAG;IACtB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAIF,IAAM,qBAAqB,GAAG;IAC5B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,EAAE;CACV,CAAC;AAIF,IAAM,WAAW,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;AAIrE,IAAM,gBAAgB,GAAG;IACvB,YAAY,EAAE,OAAO;IACrB,0BAA0B,EAAE,OAAO;IACnC,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,KAAK;CACxB,CAAC;AAEK,IAAM,OAAO,GAAG,UACrB,OAAe,EACf,OAAe,EACf,WAA0B,EAC1B,eAAkC;IADlC,4BAAA,EAAA,cAAc,OAAO,CAAC,IAAI;IAC1B,gCAAA,EAAA,kBAAkB,OAAO,CAAC,QAAQ;IAElC,IAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,IAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;IAElD,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;QACtB,MAAM,IAAI,KAAK,CACb,wFAAsF,eAAe,SAAI,WAAW,MAAG,CACxH,CAAC;KACH;IAED,IAAM,MAAM,GAAM,QAAQ,SAAI,IAAM,CAAC;IAErC,IAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CACb,gGAA8F,MAAM,MAAG,CACxG,CAAC;KACH;IAED,IAAM,aAAa,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC7D,IAAI,aAAa,KAAK,SAAS,EAAE;QAC/B,MAAM,IAAI,KAAK,CACb,gEAA8D,eAAe,MAAG,CACjF,CAAC;KACH;IAED,OAAU,OAAO,SAAI,aAAa,GAAG,OAAO,SAAI,MAAM,SAAI,SAAW,CAAC;AACxE,CAAC,CAAC;AAhCW,QAAA,OAAO,WAgClB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare type FfiPactHandle = number;
|
|
3
|
+
export declare type FfiInteractionHandle = number;
|
|
4
|
+
export declare type FfiVerifierHandle = number;
|
|
5
|
+
export declare type FfiSpecificationVersion = 0 | 1 | 2 | 3 | 4 | 5;
|
|
6
|
+
export declare const FfiSpecificationVersion: Record<string, FfiSpecificationVersion>;
|
|
7
|
+
export declare type FfiWritePactResponse = 0 | 1 | 2 | 3;
|
|
8
|
+
export declare const FfiWritePactResponse: Record<string, FfiWritePactResponse>;
|
|
9
|
+
export declare type FfiInteractionPart = 0 | 1;
|
|
10
|
+
export declare const INTERACTION_PART_REQUEST: FfiInteractionPart;
|
|
11
|
+
export declare const INTERACTION_PART_RESPONSE: FfiInteractionPart;
|
|
12
|
+
export declare const CREATE_MOCK_SERVER_ERRORS: {
|
|
13
|
+
NULL_POINTER: number;
|
|
14
|
+
JSON_PARSE_ERROR: number;
|
|
15
|
+
MOCK_SERVER_START_FAIL: number;
|
|
16
|
+
CORE_PANIC: number;
|
|
17
|
+
ADDRESS_NOT_VALID: number;
|
|
18
|
+
TLS_CONFIG: number;
|
|
19
|
+
};
|
|
20
|
+
export declare enum VERIFY_PROVIDER_RESPONSE {
|
|
21
|
+
VERIFICATION_SUCCESSFUL = 0,
|
|
22
|
+
VERIFICATION_FAILED = 1,
|
|
23
|
+
NULL_POINTER_RECEIVED = 2,
|
|
24
|
+
METHOD_PANICKED = 3,
|
|
25
|
+
INVALID_ARGUMENTS = 4
|
|
26
|
+
}
|
|
27
|
+
export declare enum FfiFunctionResult {
|
|
28
|
+
RESULT_OK = 0,
|
|
29
|
+
RESULT_FAILED = 1
|
|
30
|
+
}
|
|
31
|
+
export declare enum FfiLogLevelFilter {
|
|
32
|
+
LOG_LEVEL_OFF = 0,
|
|
33
|
+
LOG_LEVEL_ERROR = 1,
|
|
34
|
+
LOG_LEVEL_WARN = 2,
|
|
35
|
+
LOG_LEVEL_INFO = 3,
|
|
36
|
+
LOG_LEVEL_DEBUG = 4,
|
|
37
|
+
LOG_LEVEL_TRACE = 5
|
|
38
|
+
}
|
|
39
|
+
export declare type Ffi = {
|
|
40
|
+
pactffiInit(logLevel: string): string;
|
|
41
|
+
pactffiVersion(): string;
|
|
42
|
+
pactffiCreateMockServerForPact(handle: FfiPactHandle, address: string, tls: boolean): number;
|
|
43
|
+
pactffiNewPact(consumer: string, provider: string): FfiPactHandle;
|
|
44
|
+
pactffiWithSpecification(handle: FfiPactHandle, specification: FfiSpecificationVersion): boolean;
|
|
45
|
+
pactffiWithPactMetadata(handle: FfiPactHandle, namespace_: string, name: string, value: string): boolean;
|
|
46
|
+
pactffiNewInteraction(handle: FfiPactHandle, description: string): FfiInteractionHandle;
|
|
47
|
+
pactffiUponReceiving(handle: FfiInteractionHandle, description: string): boolean;
|
|
48
|
+
pactffiGiven(handle: FfiInteractionHandle, providerState: string): boolean;
|
|
49
|
+
pactffiGivenWithParam(handle: FfiInteractionHandle, description: string, name: string, value: string): boolean;
|
|
50
|
+
pactffiWithRequest(handle: FfiInteractionHandle, method: string, path: string): boolean;
|
|
51
|
+
pactffiWithQueryParameter(handle: FfiInteractionHandle, name: string, index: number, value: string): boolean;
|
|
52
|
+
pactffiWithHeader(handle: FfiInteractionHandle, part: FfiInteractionPart, name: string, index: number, value: string): boolean;
|
|
53
|
+
pactffiWithBody(handle: FfiInteractionHandle, part: FfiInteractionPart, contentType: string, body: string): boolean;
|
|
54
|
+
pactffiWithBinaryFile(handle: FfiInteractionHandle, part: FfiInteractionPart, contentType: string, body: Buffer, size: number): boolean;
|
|
55
|
+
pactffiWithMultipartFile(handle: FfiInteractionHandle, part: FfiInteractionPart, contentType: string, file: string, partName: string): void;
|
|
56
|
+
pactffiResponseStatus(handle: FfiInteractionHandle, status: number): boolean;
|
|
57
|
+
pactffiWritePactFile(port: number, dir: string, overwrite: boolean): number;
|
|
58
|
+
pactffiCleanupMockServer(port: number): boolean;
|
|
59
|
+
pactffiMockServerMatched(port: number): boolean;
|
|
60
|
+
pactffiMockServerMismatches(port: number): string;
|
|
61
|
+
pactffiGetTlsCaCertificate(): string;
|
|
62
|
+
pactffiLogMessage(source: string, logLevel: string, message: string): void;
|
|
63
|
+
pactffiLogToBuffer(level: FfiLogLevelFilter): number;
|
|
64
|
+
pactffiInitWithLogLevel(level: string): void;
|
|
65
|
+
pactffiLogToStdout(level: FfiLogLevelFilter): number;
|
|
66
|
+
pactffiLogToFile(fileName: string, level: FfiLogLevelFilter): number;
|
|
67
|
+
pactffiFetchLogBuffer(logId: number): string;
|
|
68
|
+
pactffiVerifierNewForApplication(libraryName: string, version: string): FfiVerifierHandle;
|
|
69
|
+
pactffiVerifierExecute(handle: FfiVerifierHandle, callback: (e: Error, res: number) => void): number;
|
|
70
|
+
pactffiVerifierShutdown(handle: FfiVerifierHandle): void;
|
|
71
|
+
pactffiVerifierSetProviderInfo(handle: FfiVerifierHandle, providerName: string, scheme: string, host: string, port: number, path: string): void;
|
|
72
|
+
pactffiVerifierSetFilterInfo(handle: FfiVerifierHandle, description: string, filterState: string, filterNoState: boolean): void;
|
|
73
|
+
pactffiVerifierSetProviderState(handle: FfiVerifierHandle, url: string, teardown: boolean, body: boolean): void;
|
|
74
|
+
pactffiVerifierSetVerificationOptions(handle: FfiVerifierHandle, disableSslVerification: boolean, requestTimeout: number): void;
|
|
75
|
+
pactffiVerifierSetPublishOptions(handle: FfiVerifierHandle, providerVersion: string, buildUrl: string, providerTags: string[], providerBranch: string): void;
|
|
76
|
+
pactffiVerifierSetConsumerFilters(handle: FfiVerifierHandle, consumers: string[]): void;
|
|
77
|
+
pactffiVerifierAddFileSource(handle: FfiVerifierHandle, file: string): void;
|
|
78
|
+
pactffiVerifierAddDirectorySource(handle: FfiVerifierHandle, dir: string): void;
|
|
79
|
+
pactffiVerifierUrlSource(handle: FfiVerifierHandle, url: string, username: string, password: string, token: string): void;
|
|
80
|
+
pactffiVerifierBrokerSourceWithSelectors(handle: FfiVerifierHandle, url: string, providerName: string, username: string, password: string, token: string, enablePending: boolean, includeWipPactsSince: string, providerTags: string[], providerBranch: string, consumerVersionSelectors: string[], consumerVersionTags: string[]): void;
|
|
81
|
+
};
|
package/src/ffi/types.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FfiLogLevelFilter = exports.FfiFunctionResult = exports.VERIFY_PROVIDER_RESPONSE = exports.CREATE_MOCK_SERVER_ERRORS = exports.INTERACTION_PART_RESPONSE = exports.INTERACTION_PART_REQUEST = exports.FfiWritePactResponse = exports.FfiSpecificationVersion = void 0;
|
|
4
|
+
exports.FfiSpecificationVersion = {
|
|
5
|
+
SPECIFICATION_VERSION_UNKNOWN: 0,
|
|
6
|
+
SPECIFICATION_VERSION_V1: 1,
|
|
7
|
+
SPECIFICATION_VERSION_V1_1: 2,
|
|
8
|
+
SPECIFICATION_VERSION_V2: 3,
|
|
9
|
+
SPECIFICATION_VERSION_V3: 4,
|
|
10
|
+
SPECIFICATION_VERSION_V4: 5,
|
|
11
|
+
};
|
|
12
|
+
exports.FfiWritePactResponse = {
|
|
13
|
+
SUCCESS: 0,
|
|
14
|
+
GENERAL_PANIC: 1,
|
|
15
|
+
UNABLE_TO_WRITE_PACT_FILE: 2,
|
|
16
|
+
MOCK_SERVER_NOT_FOUND: 3,
|
|
17
|
+
};
|
|
18
|
+
exports.INTERACTION_PART_REQUEST = 0;
|
|
19
|
+
exports.INTERACTION_PART_RESPONSE = 1;
|
|
20
|
+
exports.CREATE_MOCK_SERVER_ERRORS = {
|
|
21
|
+
NULL_POINTER: -1,
|
|
22
|
+
JSON_PARSE_ERROR: -2,
|
|
23
|
+
MOCK_SERVER_START_FAIL: -3,
|
|
24
|
+
CORE_PANIC: -4,
|
|
25
|
+
ADDRESS_NOT_VALID: -5,
|
|
26
|
+
TLS_CONFIG: -6,
|
|
27
|
+
};
|
|
28
|
+
var VERIFY_PROVIDER_RESPONSE;
|
|
29
|
+
(function (VERIFY_PROVIDER_RESPONSE) {
|
|
30
|
+
VERIFY_PROVIDER_RESPONSE[VERIFY_PROVIDER_RESPONSE["VERIFICATION_SUCCESSFUL"] = 0] = "VERIFICATION_SUCCESSFUL";
|
|
31
|
+
VERIFY_PROVIDER_RESPONSE[VERIFY_PROVIDER_RESPONSE["VERIFICATION_FAILED"] = 1] = "VERIFICATION_FAILED";
|
|
32
|
+
VERIFY_PROVIDER_RESPONSE[VERIFY_PROVIDER_RESPONSE["NULL_POINTER_RECEIVED"] = 2] = "NULL_POINTER_RECEIVED";
|
|
33
|
+
VERIFY_PROVIDER_RESPONSE[VERIFY_PROVIDER_RESPONSE["METHOD_PANICKED"] = 3] = "METHOD_PANICKED";
|
|
34
|
+
VERIFY_PROVIDER_RESPONSE[VERIFY_PROVIDER_RESPONSE["INVALID_ARGUMENTS"] = 4] = "INVALID_ARGUMENTS";
|
|
35
|
+
})(VERIFY_PROVIDER_RESPONSE = exports.VERIFY_PROVIDER_RESPONSE || (exports.VERIFY_PROVIDER_RESPONSE = {}));
|
|
36
|
+
var FfiFunctionResult;
|
|
37
|
+
(function (FfiFunctionResult) {
|
|
38
|
+
FfiFunctionResult[FfiFunctionResult["RESULT_OK"] = 0] = "RESULT_OK";
|
|
39
|
+
FfiFunctionResult[FfiFunctionResult["RESULT_FAILED"] = 1] = "RESULT_FAILED";
|
|
40
|
+
})(FfiFunctionResult = exports.FfiFunctionResult || (exports.FfiFunctionResult = {}));
|
|
41
|
+
var FfiLogLevelFilter;
|
|
42
|
+
(function (FfiLogLevelFilter) {
|
|
43
|
+
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_OFF"] = 0] = "LOG_LEVEL_OFF";
|
|
44
|
+
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_ERROR"] = 1] = "LOG_LEVEL_ERROR";
|
|
45
|
+
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_WARN"] = 2] = "LOG_LEVEL_WARN";
|
|
46
|
+
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_INFO"] = 3] = "LOG_LEVEL_INFO";
|
|
47
|
+
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_DEBUG"] = 4] = "LOG_LEVEL_DEBUG";
|
|
48
|
+
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_TRACE"] = 5] = "LOG_LEVEL_TRACE";
|
|
49
|
+
})(FfiLogLevelFilter = exports.FfiLogLevelFilter || (exports.FfiLogLevelFilter = {}));
|
|
50
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAMa,QAAA,uBAAuB,GAClC;IACE,6BAA6B,EAAE,CAAC;IAChC,wBAAwB,EAAE,CAAC;IAC3B,0BAA0B,EAAE,CAAC;IAC7B,wBAAwB,EAAE,CAAC;IAC3B,wBAAwB,EAAE,CAAC;IAC3B,wBAAwB,EAAE,CAAC;CAC5B,CAAC;AAIS,QAAA,oBAAoB,GAAyC;IACxE,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,yBAAyB,EAAE,CAAC;IAC5B,qBAAqB,EAAE,CAAC;CACzB,CAAC;AAIW,QAAA,wBAAwB,GAAuB,CAAC,CAAC;AACjD,QAAA,yBAAyB,GAAuB,CAAC,CAAC;AAElD,QAAA,yBAAyB,GAAG;IACvC,YAAY,EAAE,CAAC,CAAC;IAChB,gBAAgB,EAAE,CAAC,CAAC;IACpB,sBAAsB,EAAE,CAAC,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC;IACd,iBAAiB,EAAE,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,CAAC;CACf,CAAC;AAUF,IAAY,wBAMX;AAND,WAAY,wBAAwB;IAClC,6GAA2B,CAAA;IAC3B,qGAAmB,CAAA;IACnB,yGAAqB,CAAA;IACrB,6FAAe,CAAA;IACf,iGAAiB,CAAA;AACnB,CAAC,EANW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAMnC;AAUD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,mEAAa,CAAA;IACb,2EAAa,CAAA;AACf,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AAED,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,2EAAiB,CAAA;IACjB,+EAAe,CAAA;IACf,6EAAc,CAAA;IACd,6EAAc,CAAA;IACd,+EAAe,CAAA;IACf,+EAAe,CAAA;AACjB,CAAC,EAPW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAO5B"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import pact from './pact';
|
|
2
|
+
export default pact;
|
|
3
|
+
export * from './verifier';
|
|
4
|
+
export * from './verifier/types';
|
|
5
|
+
export * from './server';
|
|
6
|
+
export * from './publisher';
|
|
7
|
+
export * from './logger';
|
|
8
|
+
export * from './logger/types';
|
|
9
|
+
export * from './stub';
|
|
10
|
+
export * from './can-deploy';
|
|
11
|
+
export * from './consumer';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
var pact_1 = require("./pact");
|
|
14
|
+
module.exports = exports = pact_1.default;
|
|
15
|
+
exports.default = pact_1.default;
|
|
16
|
+
__exportStar(require("./verifier"), exports);
|
|
17
|
+
__exportStar(require("./verifier/types"), exports);
|
|
18
|
+
__exportStar(require("./server"), exports);
|
|
19
|
+
__exportStar(require("./publisher"), exports);
|
|
20
|
+
__exportStar(require("./logger"), exports);
|
|
21
|
+
__exportStar(require("./logger/types"), exports);
|
|
22
|
+
__exportStar(require("./stub"), exports);
|
|
23
|
+
__exportStar(require("./can-deploy"), exports);
|
|
24
|
+
__exportStar(require("./consumer"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA0B;AAC1B,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,cAAI,CAAC;AAChC,kBAAe,cAAI,CAAC;AAEpB,6CAA2B;AAC3B,mDAAiC;AAEjC,2CAAyB;AAEzB,8CAA4B;AAE5B,2CAAyB;AACzB,iDAA+B;AAE/B,yCAAuB;AAEvB,+CAA6B;AAE7B,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pactCrashMessage: (extraMessage: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pactCrashMessage = void 0;
|
|
4
|
+
var pactCrashMessage = function (extraMessage) { return "!!!!!!!!! PACT CRASHED !!!!!!!!!\n\n" + extraMessage + "\n\nThis is almost certainly a bug in pact-js-core. It would be great if you could\nopen a bug report at: https://github.com/pact-foundation/pact-js-core/issues\nso that we can fix it.\n\nThere is additional debugging information above. If you open a bug report, \nplease rerun with logLevel: 'debug' set in the VerifierOptions, and include the\nfull output.\n\nSECURITY WARNING: Before including your log in the issue tracker, make sure you\nhave removed sensitive info such as login credentials and urls that you don't want\nto share with the world.\n\nWe're sorry about this!\n"; };
|
|
5
|
+
exports.pactCrashMessage = pactCrashMessage;
|
|
6
|
+
//# sourceMappingURL=crashMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crashMessage.js","sourceRoot":"","sources":["crashMessage.ts"],"names":[],"mappings":";;;AAAO,IAAM,gBAAgB,GAAG,UAC9B,YAAoB,IACT,OAAA,yCAEX,YAAY,ykBAeb,EAjBY,CAiBZ,CAAC;AAnBW,QAAA,gBAAgB,oBAmB3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LogLevel } from './types';
|
|
2
|
+
export declare const DEFAULT_LOG_LEVEL = "info";
|
|
3
|
+
export declare const setLogLevel: (level?: LogLevel) => void;
|
|
4
|
+
export declare const getLogLevel: () => LogLevel;
|
|
5
|
+
export declare const verboseIsImplied: () => boolean;
|
|
6
|
+
declare const logFunctions: {
|
|
7
|
+
pactCrash: (message: string, context?: string) => void;
|
|
8
|
+
error: (message: string, context?: string) => void;
|
|
9
|
+
warn: (message: string, context?: string) => void;
|
|
10
|
+
info: (message: string, context?: string) => void;
|
|
11
|
+
debug: (message: string, context?: string) => void;
|
|
12
|
+
trace: (message: string, context?: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const logErrorAndThrow: (message: string, context?: string | undefined) => never;
|
|
15
|
+
export declare const logCrashAndThrow: (message: string, context?: string | undefined) => never;
|
|
16
|
+
export default logFunctions;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logCrashAndThrow = exports.logErrorAndThrow = exports.verboseIsImplied = exports.getLogLevel = exports.setLogLevel = exports.DEFAULT_LOG_LEVEL = void 0;
|
|
4
|
+
var crashMessage_1 = require("./crashMessage");
|
|
5
|
+
var pino_1 = require("./pino");
|
|
6
|
+
var pkg = require('../../package.json');
|
|
7
|
+
var logContext = "pact-core@" + pkg.version;
|
|
8
|
+
var currentLogLevel = 'info';
|
|
9
|
+
var logger = pino_1.createLogger(currentLogLevel);
|
|
10
|
+
exports.DEFAULT_LOG_LEVEL = 'info';
|
|
11
|
+
var setLogLevel = function (level) {
|
|
12
|
+
if (level === void 0) { level = 'info'; }
|
|
13
|
+
currentLogLevel = level;
|
|
14
|
+
logger = pino_1.createLogger(currentLogLevel);
|
|
15
|
+
};
|
|
16
|
+
exports.setLogLevel = setLogLevel;
|
|
17
|
+
var getLogLevel = function () { return currentLogLevel; };
|
|
18
|
+
exports.getLogLevel = getLogLevel;
|
|
19
|
+
var verboseIsImplied = function () {
|
|
20
|
+
return currentLogLevel === 'trace' || currentLogLevel === 'debug';
|
|
21
|
+
};
|
|
22
|
+
exports.verboseIsImplied = verboseIsImplied;
|
|
23
|
+
var addContext = function (context, message) {
|
|
24
|
+
return context + ": " + message;
|
|
25
|
+
};
|
|
26
|
+
var logFunctions = {
|
|
27
|
+
pactCrash: function (message, context) {
|
|
28
|
+
if (context === void 0) { context = logContext; }
|
|
29
|
+
return logger.error(addContext(context, crashMessage_1.pactCrashMessage(message)));
|
|
30
|
+
},
|
|
31
|
+
error: function (message, context) {
|
|
32
|
+
if (context === void 0) { context = logContext; }
|
|
33
|
+
return logger.error(addContext(context, message));
|
|
34
|
+
},
|
|
35
|
+
warn: function (message, context) {
|
|
36
|
+
if (context === void 0) { context = logContext; }
|
|
37
|
+
return logger.warn(addContext(context, message));
|
|
38
|
+
},
|
|
39
|
+
info: function (message, context) {
|
|
40
|
+
if (context === void 0) { context = logContext; }
|
|
41
|
+
return logger.info(addContext(context, message));
|
|
42
|
+
},
|
|
43
|
+
debug: function (message, context) {
|
|
44
|
+
if (context === void 0) { context = logContext; }
|
|
45
|
+
return logger.debug(addContext(context, message));
|
|
46
|
+
},
|
|
47
|
+
trace: function (message, context) {
|
|
48
|
+
if (context === void 0) { context = logContext; }
|
|
49
|
+
return logger.trace(addContext(context, message));
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
var logErrorAndThrow = function (message, context) {
|
|
53
|
+
logger.error(message, context);
|
|
54
|
+
throw new Error(message);
|
|
55
|
+
};
|
|
56
|
+
exports.logErrorAndThrow = logErrorAndThrow;
|
|
57
|
+
var logCrashAndThrow = function (message, context) {
|
|
58
|
+
logFunctions.pactCrash(message, context);
|
|
59
|
+
throw new Error(message);
|
|
60
|
+
};
|
|
61
|
+
exports.logCrashAndThrow = logCrashAndThrow;
|
|
62
|
+
exports.default = logFunctions;
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,+BAAsC;AAItC,IAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1C,IAAM,UAAU,GAAG,eAAa,GAAG,CAAC,OAAS,CAAC;AAC9C,IAAI,eAAe,GAAa,MAAM,CAAC;AACvC,IAAI,MAAM,GAAG,mBAAY,CAAC,eAAe,CAAC,CAAC;AAE9B,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAEjC,IAAM,WAAW,GAAG,UAAC,KAAwB;IAAxB,sBAAA,EAAA,cAAwB;IAClD,eAAe,GAAG,KAAK,CAAC;IACxB,MAAM,GAAG,mBAAY,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC,CAAC;AAHW,QAAA,WAAW,eAGtB;AAEK,IAAM,WAAW,GAAG,cAAgB,OAAA,eAAe,EAAf,CAAe,CAAC;AAA9C,QAAA,WAAW,eAAmC;AAEpD,IAAM,gBAAgB,GAAG;IAC9B,OAAA,eAAe,KAAK,OAAO,IAAI,eAAe,KAAK,OAAO;AAA1D,CAA0D,CAAC;AADhD,QAAA,gBAAgB,oBACgC;AAE7D,IAAM,UAAU,GAAG,UAAC,OAAe,EAAE,OAAe;IAClD,OAAG,OAAO,UAAK,OAAS;AAAxB,CAAwB,CAAC;AAE3B,IAAM,YAAY,GAAG;IACnB,SAAS,EAAE,UAAC,OAAe,EAAE,OAA4B;QAA5B,wBAAA,EAAA,oBAA4B;QACvD,OAAA,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,+BAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IAA5D,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,CAAC;AAHW,QAAA,gBAAgB,oBAG3B;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLogger = void 0;
|
|
4
|
+
var pino = require("pino");
|
|
5
|
+
var createLogger = function (level) {
|
|
6
|
+
return pino({
|
|
7
|
+
level: level.toLowerCase(),
|
|
8
|
+
prettyPrint: {
|
|
9
|
+
translateTime: true,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
exports.createLogger = createLogger;
|
|
14
|
+
//# sourceMappingURL=pino.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pino.js","sourceRoot":"","sources":["pino.ts"],"names":[],"mappings":";;;AAAA,2BAA8B;AAGvB,IAAM,YAAY,GAAG,UAAC,KAAe;IAC1C,OAAA,IAAI,CAAC;QACH,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;QAC1B,WAAW,EAAE;YACX,aAAa,EAAE,IAAI;SACpB;KACF,CAAC;AALF,CAKE,CAAC;AANQ,QAAA,YAAY,gBAMpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare type LogLevel = 'debug' | 'error' | 'info' | 'trace' | 'warn';
|
|
2
|
+
export declare type Logger = {
|
|
3
|
+
pactCrash: (message: string, context?: string) => void;
|
|
4
|
+
error: (message: string, context?: string) => void;
|
|
5
|
+
warn: (message: string, context?: string) => void;
|
|
6
|
+
info: (message: string, context?: string) => void;
|
|
7
|
+
debug: (message: string, context?: string) => void;
|
|
8
|
+
trace: (message: string, context?: string) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""}
|
package/src/message.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class Message {
|
|
2
|
+
readonly options: MessageOptions;
|
|
3
|
+
private readonly __argMapping;
|
|
4
|
+
constructor(options: MessageOptions);
|
|
5
|
+
createMessage(): Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: (options: MessageOptions) => Message;
|
|
8
|
+
export default _default;
|
|
9
|
+
export interface MessageOptions {
|
|
10
|
+
content?: string;
|
|
11
|
+
dir?: string;
|
|
12
|
+
consumer?: string;
|
|
13
|
+
provider?: string;
|
|
14
|
+
pactFileWriteMode?: 'overwrite' | 'update' | 'merge';
|
|
15
|
+
spec?: number;
|
|
16
|
+
}
|
package/src/message.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Message = void 0;
|
|
15
|
+
var fs = require("fs");
|
|
16
|
+
var logger_1 = require("./logger");
|
|
17
|
+
var spawn_1 = require("./spawn");
|
|
18
|
+
var spawn_2 = require("./spawn");
|
|
19
|
+
var pact_standalone_1 = require("./pact-standalone");
|
|
20
|
+
var path = require("path");
|
|
21
|
+
var mkdirp = require("mkdirp");
|
|
22
|
+
var checkTypes = require("check-types");
|
|
23
|
+
var Message = (function () {
|
|
24
|
+
function Message(options) {
|
|
25
|
+
this.__argMapping = {
|
|
26
|
+
pactFileWriteMode: spawn_2.DEFAULT_ARG,
|
|
27
|
+
dir: '--pact_dir',
|
|
28
|
+
consumer: '--consumer',
|
|
29
|
+
provider: '--provider',
|
|
30
|
+
spec: '--pact_specification_version',
|
|
31
|
+
};
|
|
32
|
+
options = options || {};
|
|
33
|
+
options.pactFileWriteMode = options.pactFileWriteMode || 'update';
|
|
34
|
+
options.spec = options.spec || 3;
|
|
35
|
+
checkTypes.assert.nonEmptyString(options.consumer || '', 'Must provide the consumer name');
|
|
36
|
+
checkTypes.assert.nonEmptyString(options.provider || '', 'Must provide the provider name');
|
|
37
|
+
checkTypes.assert.nonEmptyString(options.content || '', 'Must provide message content');
|
|
38
|
+
checkTypes.assert.nonEmptyString(options.dir || '', 'Must provide pact output dir');
|
|
39
|
+
if (options.spec) {
|
|
40
|
+
checkTypes.assert.number(options.spec);
|
|
41
|
+
checkTypes.assert.integer(options.spec);
|
|
42
|
+
checkTypes.assert.positive(options.spec);
|
|
43
|
+
}
|
|
44
|
+
if (options.dir) {
|
|
45
|
+
options.dir = path.resolve(options.dir);
|
|
46
|
+
try {
|
|
47
|
+
fs.statSync(options.dir).isDirectory();
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
mkdirp.sync(options.dir);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (options.content) {
|
|
54
|
+
try {
|
|
55
|
+
JSON.parse(options.content);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw new Error('Unable to parse message content to JSON, invalid json supplied');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (options.consumer) {
|
|
62
|
+
checkTypes.assert.string(options.consumer);
|
|
63
|
+
}
|
|
64
|
+
if (options.provider) {
|
|
65
|
+
checkTypes.assert.string(options.provider);
|
|
66
|
+
}
|
|
67
|
+
this.options = options;
|
|
68
|
+
}
|
|
69
|
+
Message.prototype.createMessage = function () {
|
|
70
|
+
var _this = this;
|
|
71
|
+
logger_1.default.info("Creating message pact");
|
|
72
|
+
return new Promise(function (resolve, reject) {
|
|
73
|
+
var _a = _this.options, pactFileWriteMode = _a.pactFileWriteMode, content = _a.content, restOptions = __rest(_a, ["pactFileWriteMode", "content"]);
|
|
74
|
+
var instance = spawn_1.default.spawnBinary(pact_standalone_1.default.messageFullPath, [{ pactFileWriteMode: pactFileWriteMode }, restOptions], _this.__argMapping);
|
|
75
|
+
var output = [];
|
|
76
|
+
instance.stdout.on('data', function (l) { return output.push(l); });
|
|
77
|
+
instance.stderr.on('data', function (l) { return output.push(l); });
|
|
78
|
+
instance.stdin.write(content);
|
|
79
|
+
instance.stdin.end();
|
|
80
|
+
instance.once('close', function (code) {
|
|
81
|
+
var o = output.join('\n');
|
|
82
|
+
logger_1.default.info(o);
|
|
83
|
+
if (code === 0) {
|
|
84
|
+
return resolve(o);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return reject(o);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return Message;
|
|
93
|
+
}());
|
|
94
|
+
exports.Message = Message;
|
|
95
|
+
exports.default = (function (options) { return new Message(options); });
|
|
96
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["message.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uBAA0B;AAC1B,mCAA8B;AAC9B,iCAA4B;AAC5B,iCAAsC;AACtC,qDAA+C;AAC/C,2BAA8B;AAC9B,+BAAkC;AAClC,wCAA2C;AAE3C;IAUE,iBAAY,OAAuB;QARlB,iBAAY,GAAG;YAC9B,iBAAiB,EAAE,mBAAW;YAC9B,GAAG,EAAE,YAAY;YACjB,QAAQ,EAAE,YAAY;YACtB,QAAQ,EAAE,YAAY;YACtB,IAAI,EAAE,8BAA8B;SACrC,CAAC;QAGA,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAA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AAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,gBAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEf,IAAI,IAAI,KAAK,CAAC,EAAE;oBACd,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;iBACnB;qBAAM;oBACL,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACH,cAAC;AAAD,CAAC,AAhGD,IAgGC;AAhGY,0BAAO;AAkGpB,mBAAe,UAAC,OAAuB,IAAc,OAAA,IAAI,OAAO,CAAC,OAAO,CAAC,EAApB,CAAoB,EAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PactEnvironment = void 0;
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var PactEnvironment = (function () {
|
|
6
|
+
function PactEnvironment() {
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(PactEnvironment.prototype, "cwd", {
|
|
9
|
+
get: function () {
|
|
10
|
+
return path.resolve(__dirname, '..');
|
|
11
|
+
},
|
|
12
|
+
enumerable: false,
|
|
13
|
+
configurable: true
|
|
14
|
+
});
|
|
15
|
+
PactEnvironment.prototype.isWindows = function (platform) {
|
|
16
|
+
if (platform === void 0) { platform = process.platform; }
|
|
17
|
+
return platform === 'win32';
|
|
18
|
+
};
|
|
19
|
+
return PactEnvironment;
|
|
20
|
+
}());
|
|
21
|
+
exports.PactEnvironment = PactEnvironment;
|
|
22
|
+
exports.default = new PactEnvironment();
|
|
23
|
+
//# sourceMappingURL=pact-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pact-environment.js","sourceRoot":"","sources":["pact-environment.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAE7B;IAAA;IAQA,CAAC;IAPC,sBAAW,gCAAG;aAAd;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;;;OAAA;IAEM,mCAAS,GAAhB,UAAiB,QAAmC;QAAnC,yBAAA,EAAA,WAAmB,OAAO,CAAC,QAAQ;QAClD,OAAO,QAAQ,KAAK,OAAO,CAAC;IAC9B,CAAC;IACH,sBAAC;AAAD,CAAC,AARD,IAQC;AARY,0CAAe;AAU5B,kBAAe,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface PactStandalone {
|
|
2
|
+
cwd: string;
|
|
3
|
+
brokerPath: string;
|
|
4
|
+
brokerFullPath: string;
|
|
5
|
+
mockServicePath: string;
|
|
6
|
+
mockServiceFullPath: string;
|
|
7
|
+
stubPath: string;
|
|
8
|
+
stubFullPath: string;
|
|
9
|
+
verifierPath: string;
|
|
10
|
+
verifierFullPath: string;
|
|
11
|
+
messagePath: string;
|
|
12
|
+
messageFullPath: string;
|
|
13
|
+
pactPath: string;
|
|
14
|
+
pactFullPath: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const standalone: (platform?: string | undefined, arch?: string | undefined) => PactStandalone;
|
|
17
|
+
declare const _default: PactStandalone;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.standalone = void 0;
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var install_1 = require("../standalone/install");
|
|
6
|
+
var pact_environment_1 = require("./pact-environment");
|
|
7
|
+
var standalone = function (platform, arch) {
|
|
8
|
+
platform = platform || process.platform;
|
|
9
|
+
arch = arch || process.arch;
|
|
10
|
+
var binName = function (name) {
|
|
11
|
+
return "" + name + (pact_environment_1.default.isWindows(platform) ? '.bat' : '');
|
|
12
|
+
};
|
|
13
|
+
var mock = binName('pact-mock-service');
|
|
14
|
+
var message = binName('pact-message');
|
|
15
|
+
var verify = binName('pact-provider-verifier');
|
|
16
|
+
var broker = binName('pact-broker');
|
|
17
|
+
var stub = binName('pact-stub-service');
|
|
18
|
+
var pact = binName('pact');
|
|
19
|
+
var basePath = path.join('standalone', install_1.getBinaryEntry(platform, arch).folderName, 'pact', 'bin');
|
|
20
|
+
return {
|
|
21
|
+
cwd: pact_environment_1.default.cwd,
|
|
22
|
+
brokerPath: path.join(basePath, broker),
|
|
23
|
+
brokerFullPath: path.resolve(pact_environment_1.default.cwd, basePath, broker).trim(),
|
|
24
|
+
messagePath: path.join(basePath, message),
|
|
25
|
+
messageFullPath: path
|
|
26
|
+
.resolve(pact_environment_1.default.cwd, basePath, message)
|
|
27
|
+
.trim(),
|
|
28
|
+
mockServicePath: path.join(basePath, mock),
|
|
29
|
+
mockServiceFullPath: path
|
|
30
|
+
.resolve(pact_environment_1.default.cwd, basePath, mock)
|
|
31
|
+
.trim(),
|
|
32
|
+
stubPath: path.join(basePath, stub),
|
|
33
|
+
stubFullPath: path.resolve(pact_environment_1.default.cwd, basePath, stub).trim(),
|
|
34
|
+
pactPath: path.join(basePath, pact),
|
|
35
|
+
pactFullPath: path.resolve(pact_environment_1.default.cwd, basePath, pact).trim(),
|
|
36
|
+
verifierPath: path.join(basePath, verify),
|
|
37
|
+
verifierFullPath: path
|
|
38
|
+
.resolve(pact_environment_1.default.cwd, basePath, verify)
|
|
39
|
+
.trim(),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.standalone = standalone;
|
|
43
|
+
exports.default = exports.standalone();
|
|
44
|
+
//# sourceMappingURL=pact-standalone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pact-standalone.js","sourceRoot":"","sources":["pact-standalone.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,iDAAuD;AACvD,uDAAiD;AAkB1C,IAAM,UAAU,GAAG,UACxB,QAAiB,EACjB,IAAa;IAEb,QAAQ,GAAG,QA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,mBAAmB,EAAE,IAAI;aACtB,OAAO,CAAC,0BAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC;aAC5C,IAAI,EAAE;QACT,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;QACnC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,0BAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE;QACtE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;QACnC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,0BAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE;QACtE,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;QACzC,gBAAgB,EAAE,IAAI;aACnB,OAAO,CAAC,0BAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC;aAC9C,IAAI,EAAE;KACV,CAAC;AACJ,CAAC,CAAC;AA1CW,QAAA,UAAU,cA0CrB;AAEF,kBAAe,kBAAU,EAAE,CAAC"}
|
package/src/pact.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Server, ServerOptions } from './server';
|
|
2
|
+
import { Stub, StubOptions } from './stub';
|
|
3
|
+
import { VerifierOptions } from './verifier/types';
|
|
4
|
+
import { MessageOptions } from './message';
|
|
5
|
+
import { PublisherOptions } from './publisher';
|
|
6
|
+
import { CanDeployOptions, CanDeployResponse } from './can-deploy';
|
|
7
|
+
import { LogLevel } from './logger/types';
|
|
8
|
+
import { AbstractService } from './service';
|
|
9
|
+
export declare class Pact {
|
|
10
|
+
private __servers;
|
|
11
|
+
private __stubs;
|
|
12
|
+
constructor();
|
|
13
|
+
logLevel(level?: LogLevel): void;
|
|
14
|
+
createServer(options?: ServerOptions): Server;
|
|
15
|
+
listServers(): Server[];
|
|
16
|
+
removeAllServers(): Promise<Server[]>;
|
|
17
|
+
createStub(options?: StubOptions): Stub;
|
|
18
|
+
listStubs(): Stub[];
|
|
19
|
+
removeAllStubs(): Promise<Stub[]>;
|
|
20
|
+
removeAll(): Promise<AbstractService[]>;
|
|
21
|
+
verifyPacts(options: VerifierOptions): Promise<string>;
|
|
22
|
+
createMessage(options: MessageOptions): Promise<unknown>;
|
|
23
|
+
publishPacts(options: PublisherOptions): Promise<string[]>;
|
|
24
|
+
canDeploy(options: CanDeployOptions): Promise<CanDeployResponse | string>;
|
|
25
|
+
}
|
|
26
|
+
declare const _default: Pact;
|
|
27
|
+
export default _default;
|