@pact-foundation/pact-core 13.7.1 → 13.7.2
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/CHANGELOG.md +7 -0
- package/README.md +4 -4
- package/bin/pact-broker.js +6 -3
- package/bin/pact-broker.js.map +1 -1
- package/bin/pact-message.js +6 -3
- package/bin/pact-message.js.map +1 -1
- package/bin/pact-mock-service.js +6 -3
- package/bin/pact-mock-service.js.map +1 -1
- package/bin/pact-provider-verifier.js +6 -3
- package/bin/pact-provider-verifier.js.map +1 -1
- package/bin/pact-stub-service.js +6 -3
- package/bin/pact-stub-service.js.map +1 -1
- package/bin/pact.js +6 -3
- package/bin/pact.js.map +1 -1
- package/bin/pactflow.js +6 -3
- package/bin/pactflow.js.map +1 -1
- package/build/Makefile +1 -1
- package/package.json +2 -1
- package/src/can-deploy.js +71 -78
- package/src/can-deploy.js.map +1 -1
- package/src/consumer/checkErrors.js +14 -33
- package/src/consumer/checkErrors.js.map +1 -1
- package/src/consumer/index.js +72 -94
- package/src/consumer/index.js.map +1 -1
- package/src/ffi/index.js +29 -11
- package/src/ffi/index.js.map +1 -1
- package/src/ffi/internals/index.js +14 -16
- package/src/ffi/internals/index.js.map +1 -1
- package/src/index.js +4 -1
- package/src/index.js.map +1 -1
- package/src/logger/crashMessage.js +18 -1
- package/src/logger/crashMessage.js.map +1 -1
- package/src/logger/index.js +19 -42
- package/src/logger/index.js.map +1 -1
- package/src/logger/pino.js +7 -9
- package/src/logger/pino.js.map +1 -1
- package/src/message.js +25 -35
- package/src/message.js.map +1 -1
- package/src/pact-environment.js +26 -15
- package/src/pact-environment.js.map +1 -1
- package/src/pact-standalone.js +35 -15
- package/src/pact-standalone.js.map +1 -1
- package/src/pact.js +83 -67
- package/src/pact.js.map +1 -1
- package/src/publisher.js +52 -32
- package/src/publisher.js.map +1 -1
- package/src/server.js +18 -35
- package/src/server.js.map +1 -1
- package/src/service.js +115 -126
- package/src/service.js.map +1 -1
- package/src/spawn/arguments.js +17 -25
- package/src/spawn/arguments.js.map +1 -1
- package/src/spawn/index.js +4 -1
- package/src/spawn/index.js.map +1 -1
- package/src/spawn/spawn.js +50 -45
- package/src/spawn/spawn.js.map +1 -1
- package/src/stub.js +14 -30
- package/src/stub.js.map +1 -1
- package/src/verifier/argumentMapper/arguments.js +27 -36
- package/src/verifier/argumentMapper/arguments.js.map +1 -1
- package/src/verifier/argumentMapper/index.js +50 -54
- package/src/verifier/argumentMapper/index.js.map +1 -1
- package/src/verifier/filesystem/index.js +5 -5
- package/src/verifier/filesystem/index.js.map +1 -1
- package/src/verifier/index.js +16 -21
- package/src/verifier/index.js.map +1 -1
- package/src/verifier/nativeVerifier.js +56 -35
- package/src/verifier/nativeVerifier.js.map +1 -1
- package/src/verifier/validateOptions.js +13 -21
- package/src/verifier/validateOptions.js.map +1 -1
- package/standalone/install.js +16 -18
- package/standalone/install.js.map +1 -1
- package/tsconfig.json +1 -2
package/src/consumer/index.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -22,119 +11,114 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
11
|
};
|
|
23
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
13
|
exports.makeConsumerAsyncMessagePact = exports.makeConsumerPact = void 0;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (logLevel === void 0) { logLevel = logger_1.getLogLevel(); }
|
|
32
|
-
var ffi = ffi_1.getFfiLib(logLevel);
|
|
14
|
+
const types_1 = require("../ffi/types");
|
|
15
|
+
const logger_1 = require("../logger");
|
|
16
|
+
const checkErrors_1 = require("./checkErrors");
|
|
17
|
+
const ffi_1 = require("../ffi");
|
|
18
|
+
const makeConsumerPact = (consumer, provider, version = 3, logLevel = logger_1.getLogLevel()) => {
|
|
19
|
+
const ffi = ffi_1.getFfiLib(logLevel);
|
|
33
20
|
if (logLevel) {
|
|
34
21
|
logger_1.setLogLevel(logLevel);
|
|
35
22
|
}
|
|
36
|
-
|
|
23
|
+
const pactPtr = ffi.pactffiNewPact(consumer, provider);
|
|
37
24
|
if (!ffi.pactffiWithSpecification(pactPtr, version)) {
|
|
38
|
-
throw new Error(
|
|
25
|
+
throw new Error(`Unable to set core spec version. The pact FfiSpecificationVersion '${version}' may be invalid (note this is not the same as the pact spec version)`);
|
|
39
26
|
}
|
|
40
27
|
return {
|
|
41
|
-
addPlugin:
|
|
28
|
+
addPlugin: (name, version) => {
|
|
42
29
|
ffi.pactffiUsingPlugin(pactPtr, name, version);
|
|
43
30
|
},
|
|
44
|
-
cleanupPlugins:
|
|
31
|
+
cleanupPlugins: () => {
|
|
45
32
|
ffi.pactffiCleanupPlugins(pactPtr);
|
|
46
33
|
},
|
|
47
|
-
createMockServer:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var error = Object.keys(types_1.CREATE_MOCK_SERVER_ERRORS).find(function (key) { return types_1.CREATE_MOCK_SERVER_ERRORS[key] === port; });
|
|
34
|
+
createMockServer: (address, requestedPort, tls = false) => {
|
|
35
|
+
const port = ffi.pactffiCreateMockServerForPact(pactPtr, `${address}:${requestedPort ? requestedPort : 0}`, tls);
|
|
36
|
+
const error = Object.keys(types_1.CREATE_MOCK_SERVER_ERRORS).find((key) => types_1.CREATE_MOCK_SERVER_ERRORS[key] === port);
|
|
51
37
|
if (error) {
|
|
52
38
|
if (error === 'ADDRESS_NOT_VALID') {
|
|
53
|
-
logger_1.logErrorAndThrow(
|
|
39
|
+
logger_1.logErrorAndThrow(`Unable to start mock server at '${address}'. Is the address and port valid?`);
|
|
54
40
|
}
|
|
55
41
|
if (error === 'TLS_CONFIG') {
|
|
56
|
-
logger_1.logErrorAndThrow(
|
|
42
|
+
logger_1.logErrorAndThrow(`Unable to create TLS configuration with self-signed certificate`);
|
|
57
43
|
}
|
|
58
|
-
logger_1.logCrashAndThrow(
|
|
44
|
+
logger_1.logCrashAndThrow(`The pact core couldn\'t create the mock server because of an error described by '${error}'`);
|
|
59
45
|
}
|
|
60
46
|
if (port <= 0) {
|
|
61
|
-
logger_1.logCrashAndThrow(
|
|
47
|
+
logger_1.logCrashAndThrow(`The pact core returned an unhandled error code '${port}'`);
|
|
62
48
|
}
|
|
63
49
|
return port;
|
|
64
50
|
},
|
|
65
|
-
mockServerMatchedSuccessfully:
|
|
51
|
+
mockServerMatchedSuccessfully: (port) => {
|
|
66
52
|
return ffi.pactffiMockServerMatched(port);
|
|
67
53
|
},
|
|
68
|
-
mockServerMismatches:
|
|
69
|
-
|
|
70
|
-
return results.map(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
mockServerMismatches: (port) => {
|
|
55
|
+
const results = JSON.parse(ffi.pactffiMockServerMismatches(port));
|
|
56
|
+
return results.map((result) => ({
|
|
57
|
+
...result,
|
|
58
|
+
...('mismatches' in result
|
|
59
|
+
? {
|
|
60
|
+
mismatches: result.mismatches.map((m) => typeof m === 'string' ? JSON.parse(m) : m),
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
}));
|
|
77
64
|
},
|
|
78
|
-
cleanupMockServer:
|
|
79
|
-
return checkErrors_1.wrapWithCheck(
|
|
65
|
+
cleanupMockServer: (port) => {
|
|
66
|
+
return checkErrors_1.wrapWithCheck((port) => ffi.pactffiCleanupMockServer(port), 'cleanupMockServer')(port);
|
|
80
67
|
},
|
|
81
|
-
writePactFile:
|
|
82
|
-
|
|
83
|
-
return writePact(ffi, pactPtr, dir, merge);
|
|
84
|
-
},
|
|
85
|
-
addMetadata: function (namespace, name, value) {
|
|
68
|
+
writePactFile: (dir, merge = true) => writePact(ffi, pactPtr, dir, merge),
|
|
69
|
+
addMetadata: (namespace, name, value) => {
|
|
86
70
|
return ffi.pactffiWithPactMetadata(pactPtr, namespace, name, value);
|
|
87
71
|
},
|
|
88
|
-
newInteraction:
|
|
89
|
-
|
|
72
|
+
newInteraction: (description) => {
|
|
73
|
+
const interactionPtr = ffi.pactffiNewInteraction(pactPtr, description);
|
|
90
74
|
return checkErrors_1.wrapAllWithCheck({
|
|
91
|
-
uponReceiving:
|
|
75
|
+
uponReceiving: (description) => {
|
|
92
76
|
return ffi.pactffiUponReceiving(interactionPtr, description);
|
|
93
77
|
},
|
|
94
|
-
given:
|
|
78
|
+
given: (state) => {
|
|
95
79
|
return ffi.pactffiGiven(interactionPtr, state);
|
|
96
80
|
},
|
|
97
|
-
givenWithParam:
|
|
81
|
+
givenWithParam: (state, name, value) => {
|
|
98
82
|
return ffi.pactffiGivenWithParam(interactionPtr, state, name, value);
|
|
99
83
|
},
|
|
100
|
-
withRequest:
|
|
84
|
+
withRequest: (method, path) => {
|
|
101
85
|
return ffi.pactffiWithRequest(interactionPtr, method, path);
|
|
102
86
|
},
|
|
103
|
-
withQuery:
|
|
87
|
+
withQuery: (name, index, value) => {
|
|
104
88
|
return ffi.pactffiWithQueryParameter(interactionPtr, name, index, value);
|
|
105
89
|
},
|
|
106
|
-
withRequestHeader:
|
|
90
|
+
withRequestHeader: (name, index, value) => {
|
|
107
91
|
return ffi.pactffiWithHeader(interactionPtr, types_1.INTERACTION_PART_REQUEST, name, index, value);
|
|
108
92
|
},
|
|
109
|
-
withRequestBody:
|
|
93
|
+
withRequestBody: (body, contentType) => {
|
|
110
94
|
return ffi.pactffiWithBody(interactionPtr, types_1.INTERACTION_PART_REQUEST, contentType, body);
|
|
111
95
|
},
|
|
112
|
-
withRequestBinaryBody:
|
|
96
|
+
withRequestBinaryBody: (body, contentType) => {
|
|
113
97
|
return ffi.pactffiWithBinaryFile(interactionPtr, types_1.INTERACTION_PART_REQUEST, contentType, body, body.length);
|
|
114
98
|
},
|
|
115
|
-
withRequestMultipartBody:
|
|
99
|
+
withRequestMultipartBody: (contentType, filename, mimePartName) => {
|
|
116
100
|
return (ffi.pactffiWithMultipartFile(interactionPtr, types_1.INTERACTION_PART_REQUEST, contentType, filename, mimePartName) === undefined);
|
|
117
101
|
},
|
|
118
|
-
withResponseHeader:
|
|
102
|
+
withResponseHeader: (name, index, value) => {
|
|
119
103
|
return ffi.pactffiWithHeader(interactionPtr, types_1.INTERACTION_PART_RESPONSE, name, index, value);
|
|
120
104
|
},
|
|
121
|
-
withResponseBody:
|
|
105
|
+
withResponseBody: (body, contentType) => {
|
|
122
106
|
return ffi.pactffiWithBody(interactionPtr, types_1.INTERACTION_PART_RESPONSE, contentType, body);
|
|
123
107
|
},
|
|
124
|
-
withResponseBinaryBody:
|
|
108
|
+
withResponseBinaryBody: (body, contentType) => {
|
|
125
109
|
return ffi.pactffiWithBinaryFile(interactionPtr, types_1.INTERACTION_PART_RESPONSE, contentType, body, body.length);
|
|
126
110
|
},
|
|
127
|
-
withResponseMultipartBody:
|
|
111
|
+
withResponseMultipartBody: (contentType, filename, mimePartName) => {
|
|
128
112
|
return (ffi.pactffiWithMultipartFile(interactionPtr, types_1.INTERACTION_PART_RESPONSE, contentType, filename, mimePartName) === undefined);
|
|
129
113
|
},
|
|
130
|
-
withStatus:
|
|
114
|
+
withStatus: (status) => {
|
|
131
115
|
return ffi.pactffiResponseStatus(interactionPtr, status);
|
|
132
116
|
},
|
|
133
|
-
withPluginRequestInteractionContents:
|
|
117
|
+
withPluginRequestInteractionContents: (contentType, contents) => {
|
|
134
118
|
ffi.pactffiPluginInteractionContents(interactionPtr, types_1.INTERACTION_PART_REQUEST, contentType, contents);
|
|
135
119
|
return true;
|
|
136
120
|
},
|
|
137
|
-
withPluginResponseInteractionContents:
|
|
121
|
+
withPluginResponseInteractionContents: (contentType, contents) => {
|
|
138
122
|
ffi.pactffiPluginInteractionContents(interactionPtr, types_1.INTERACTION_PART_RESPONSE, contentType, contents);
|
|
139
123
|
return true;
|
|
140
124
|
},
|
|
@@ -143,61 +127,56 @@ var makeConsumerPact = function (consumer, provider, version, logLevel) {
|
|
|
143
127
|
};
|
|
144
128
|
};
|
|
145
129
|
exports.makeConsumerPact = makeConsumerPact;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (logLevel === void 0) { logLevel = logger_1.getLogLevel(); }
|
|
149
|
-
var ffi = ffi_1.getFfiLib(logLevel);
|
|
130
|
+
const makeConsumerAsyncMessagePact = (consumer, provider, version = 4, logLevel = logger_1.getLogLevel()) => {
|
|
131
|
+
const ffi = ffi_1.getFfiLib(logLevel);
|
|
150
132
|
if (logLevel) {
|
|
151
133
|
logger_1.setLogLevel(logLevel);
|
|
152
134
|
}
|
|
153
|
-
|
|
135
|
+
const pactPtr = ffi.pactffiNewPact(consumer, provider);
|
|
154
136
|
if (!ffi.pactffiWithSpecification(pactPtr, version) || version < 4) {
|
|
155
|
-
throw new Error(
|
|
137
|
+
throw new Error(`Unable to set core spec version. The pact FfiSpecificationVersion '${version}' may be invalid (note this is not the same as the pact spec version). It should be set to at least 3`);
|
|
156
138
|
}
|
|
157
139
|
return {
|
|
158
|
-
addPlugin:
|
|
140
|
+
addPlugin: (name, version) => {
|
|
159
141
|
ffi.pactffiUsingPlugin(pactPtr, name, version);
|
|
160
142
|
},
|
|
161
|
-
cleanupPlugins:
|
|
143
|
+
cleanupPlugins: () => {
|
|
162
144
|
ffi.pactffiCleanupPlugins(pactPtr);
|
|
163
145
|
},
|
|
164
|
-
writePactFile:
|
|
165
|
-
|
|
166
|
-
return writePact(ffi, pactPtr, dir, merge);
|
|
167
|
-
},
|
|
168
|
-
addMetadata: function (namespace, name, value) {
|
|
146
|
+
writePactFile: (dir, merge = true) => writePact(ffi, pactPtr, dir, merge),
|
|
147
|
+
addMetadata: (namespace, name, value) => {
|
|
169
148
|
return ffi.pactffiWithPactMetadata(pactPtr, namespace, name, value);
|
|
170
149
|
},
|
|
171
|
-
newMessage:
|
|
172
|
-
|
|
150
|
+
newMessage: (description) => {
|
|
151
|
+
const interactionPtr = ffi.pactffiNewAsyncMessage(pactPtr, description);
|
|
173
152
|
return {
|
|
174
|
-
withPluginRequestInteractionContents:
|
|
153
|
+
withPluginRequestInteractionContents: (contentType, contents) => {
|
|
175
154
|
ffi.pactffiPluginInteractionContents(interactionPtr, types_1.INTERACTION_PART_REQUEST, contentType, contents);
|
|
176
155
|
return true;
|
|
177
156
|
},
|
|
178
|
-
withPluginResponseInteractionContents:
|
|
157
|
+
withPluginResponseInteractionContents: (contentType, contents) => {
|
|
179
158
|
ffi.pactffiPluginInteractionContents(interactionPtr, types_1.INTERACTION_PART_RESPONSE, contentType, contents);
|
|
180
159
|
return true;
|
|
181
160
|
},
|
|
182
|
-
expectsToReceive:
|
|
161
|
+
expectsToReceive: (description) => {
|
|
183
162
|
return ffi.pactffiMessageExpectsToReceive(interactionPtr, description);
|
|
184
163
|
},
|
|
185
|
-
given:
|
|
164
|
+
given: (state) => {
|
|
186
165
|
return ffi.pactffiMessageGiven(interactionPtr, state);
|
|
187
166
|
},
|
|
188
|
-
givenWithParam:
|
|
167
|
+
givenWithParam: (state, name, value) => {
|
|
189
168
|
return ffi.pactffiMessageGivenWithParam(interactionPtr, state, name, value);
|
|
190
169
|
},
|
|
191
|
-
withContents:
|
|
170
|
+
withContents: (body, contentType) => {
|
|
192
171
|
return ffi.pactffiMessageWithContents(interactionPtr, contentType, body);
|
|
193
172
|
},
|
|
194
|
-
withBinaryContents:
|
|
173
|
+
withBinaryContents: (body, contentType) => {
|
|
195
174
|
return ffi.pactffiMessageWithBinaryContents(interactionPtr, contentType, body, body.length);
|
|
196
175
|
},
|
|
197
|
-
reifyMessage:
|
|
176
|
+
reifyMessage: () => {
|
|
198
177
|
return ffi.pactffiMessageReify(interactionPtr);
|
|
199
178
|
},
|
|
200
|
-
withMetadata:
|
|
179
|
+
withMetadata: (name, value) => {
|
|
201
180
|
return ffi.pactffiMessageWithMetadata(interactionPtr, name, value);
|
|
202
181
|
},
|
|
203
182
|
};
|
|
@@ -205,9 +184,8 @@ var makeConsumerAsyncMessagePact = function (consumer, provider, version, logLev
|
|
|
205
184
|
};
|
|
206
185
|
};
|
|
207
186
|
exports.makeConsumerAsyncMessagePact = makeConsumerAsyncMessagePact;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var result = ffi.pactffiWritePactFile(pactPtr, dir, !merge);
|
|
187
|
+
const writePact = (ffi, pactPtr, dir, merge = true) => {
|
|
188
|
+
const result = ffi.pactffiWritePactFile(pactPtr, dir, !merge);
|
|
211
189
|
switch (result) {
|
|
212
190
|
case types_1.FfiWritePactResponse.SUCCESS:
|
|
213
191
|
return;
|
|
@@ -218,7 +196,7 @@ var writePact = function (ffi, pactPtr, dir, merge) {
|
|
|
218
196
|
case types_1.FfiWritePactResponse.MOCK_SERVER_NOT_FOUND:
|
|
219
197
|
logger_1.logCrashAndThrow('The pact core was asked to write a pact file from a mock server that appears not to exist');
|
|
220
198
|
default:
|
|
221
|
-
logger_1.logCrashAndThrow(
|
|
199
|
+
logger_1.logCrashAndThrow(`The pact core returned an unknown error code (${result}) instead of writing the pact`);
|
|
222
200
|
}
|
|
223
201
|
};
|
|
224
202
|
__exportStar(require("./types"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mapp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KAAK,4BAAoB,CAAC,yBAAyB;YACjD,yBAAgB,CAAC,iDAAiD,CAAC,CAAC;QACtE,KAAK,4BAAoB,CAAC,aAAa;YACrC,yBAAgB,CAAC,oDAAoD,CAAC,CAAC;QACzE,KAAK,4BAAoB,CAAC,qBAAqB;YAC7C,yBAAgB,CACd,2FAA2F,CAC5F,CAAC;QACJ;YACE,yBAAgB,CACd,iDAAiD,MAAM,+BAA+B,CACvF,CAAC;KACL;AACH,CAAC,CAAC;AAEF,0CAAwB"}
|
package/src/ffi/index.js
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
22
|
exports.getFfiLib = exports.PACT_FFI_VERSION = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
23
|
+
const logger_1 = __importStar(require("../logger"));
|
|
24
|
+
const bindings = require("bindings");
|
|
25
|
+
const ffiLib = bindings('pact.node');
|
|
7
26
|
exports.PACT_FFI_VERSION = '0.2.4';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
logger_1.default.debug(
|
|
27
|
+
let ffi;
|
|
28
|
+
let ffiLogLevel;
|
|
29
|
+
const initialiseFfi = (logLevel) => {
|
|
30
|
+
logger_1.default.debug(`Initalising native core at log level '${logLevel}'`);
|
|
12
31
|
ffiLogLevel = logLevel;
|
|
13
32
|
ffiLib.pactffiInitWithLogLevel(logLevel);
|
|
14
33
|
return ffiLib;
|
|
15
34
|
};
|
|
16
|
-
|
|
17
|
-
if (logLevel === void 0) { logLevel = logger_1.DEFAULT_LOG_LEVEL; }
|
|
35
|
+
const getFfiLib = (logLevel = logger_1.DEFAULT_LOG_LEVEL) => {
|
|
18
36
|
if (!ffi) {
|
|
19
37
|
logger_1.default.trace('Initiliasing ffi for the first time');
|
|
20
38
|
ffi = initialiseFfi(logLevel);
|
|
@@ -22,8 +40,8 @@ var getFfiLib = function (logLevel) {
|
|
|
22
40
|
else {
|
|
23
41
|
logger_1.default.trace('Ffi has already been initialised, no need to repeat it');
|
|
24
42
|
if (logLevel !== ffiLogLevel) {
|
|
25
|
-
logger_1.default.warn(
|
|
26
|
-
logger_1.default.warn(
|
|
43
|
+
logger_1.default.warn(`The pact native core has already been initialised at log level '${ffiLogLevel}'`);
|
|
44
|
+
logger_1.default.warn(`The new requested log level '${logLevel}' will be ignored`);
|
|
27
45
|
}
|
|
28
46
|
}
|
|
29
47
|
return ffi;
|
package/src/ffi/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsD;AAGtD,qCAAsC;AAEtC,MAAM,MAAM,GAAQ,QAAQ,CAAC,WAAW,CAAC,CAAC;AAE7B,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAExC,IAAI,GAAkB,CAAC;AACvB,IAAI,WAAqB,CAAC;AAE1B,MAAM,aAAa,GAAG,CAAC,QAAkB,EAAc,EAAE;IACvD,gBAAM,CAAC,KAAK,CAAC,yCAAyC,QAAQ,GAAG,CAAC,CAAC;IACnE,WAAW,GAAG,QAAQ,CAAC;IACvB,MAAM,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEK,MAAM,SAAS,GAAG,CACvB,WAAqB,0BAAiB,EAC1B,EAAE;IACd,IAAI,CAAC,GAAG,EAAE;QACR,gBAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACpD,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;KAC/B;SAAM;QACL,gBAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,IAAI,QAAQ,KAAK,WAAW,EAAE;YAC5B,gBAAM,CAAC,IAAI,CACT,mEAAmE,WAAW,GAAG,CAClF,CAAC;YACF,gBAAM,CAAC,IAAI,CAAC,gCAAgC,QAAQ,mBAAmB,CAAC,CAAC;SAC1E;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAhBW,QAAA,SAAS,aAgBpB"}
|
|
@@ -1,41 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.libName = void 0;
|
|
4
|
-
|
|
4
|
+
const PLATFORM_LOOKUP = {
|
|
5
5
|
linux: 'linux',
|
|
6
6
|
darwin: 'osx',
|
|
7
7
|
win32: 'windows',
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
const LIBNAME_PREFIX_LOOKUP = {
|
|
10
10
|
linux: 'lib',
|
|
11
11
|
darwin: 'lib',
|
|
12
12
|
win32: '',
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const ARCH_LOOKUP = { x64: 'x86_64', arm64: 'aarch64-apple-darwin' };
|
|
15
|
+
const EXTENSION_LOOKUP = {
|
|
16
16
|
'osx-x86_64': 'dylib',
|
|
17
17
|
'osx-aarch64-apple-darwin': 'dylib',
|
|
18
18
|
'linux-x86_64': 'so',
|
|
19
19
|
'windows-x86_64': 'dll',
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var arch = ARCH_LOOKUP[processArch];
|
|
25
|
-
var platform = PLATFORM_LOOKUP[processPlatform];
|
|
21
|
+
const libName = (library, version, processArch = process.arch, processPlatform = process.platform) => {
|
|
22
|
+
const arch = ARCH_LOOKUP[processArch];
|
|
23
|
+
const platform = PLATFORM_LOOKUP[processPlatform];
|
|
26
24
|
if (!arch || !platform) {
|
|
27
|
-
throw new Error(
|
|
25
|
+
throw new Error(`Pact does not currently support the operating system and architecture combination '${processPlatform}/${processArch}'`);
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const target = `${platform}-${arch}`;
|
|
28
|
+
const extension = EXTENSION_LOOKUP[target];
|
|
31
29
|
if (!extension) {
|
|
32
|
-
throw new Error(
|
|
30
|
+
throw new Error(`Pact doesn't know what extension to use for the libraries in the architecture combination '${target}'`);
|
|
33
31
|
}
|
|
34
|
-
|
|
32
|
+
const libnamePrefix = LIBNAME_PREFIX_LOOKUP[processPlatform];
|
|
35
33
|
if (libnamePrefix === undefined) {
|
|
36
|
-
throw new Error(
|
|
34
|
+
throw new Error(`Pact doesn't know what prefix to use for the libraries on '${processPlatform}'`);
|
|
37
35
|
}
|
|
38
|
-
return version
|
|
36
|
+
return `${version}-${libnamePrefix}${library}-${target}.${extension}`;
|
|
39
37
|
};
|
|
40
38
|
exports.libName = libName;
|
|
41
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","s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,IAAI,KAAK,CACb,8DAA8D,eAAe,GAAG,CACjF,CAAC;KACH;IAED,OAAO,GAAG,OAAO,IAAI,aAAa,GAAG,OAAO,IAAI,MAAM,IAAI,SAAS,EAAE,CAAC;AACxE,CAAC,CAAC;AAhCW,QAAA,OAAO,WAgClB"}
|
package/src/index.js
CHANGED
|
@@ -9,8 +9,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
12
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
|
|
16
|
+
const pact_1 = __importDefault(require("./pact"));
|
|
14
17
|
module.exports = exports = pact_1.default;
|
|
15
18
|
exports.default = pact_1.default;
|
|
16
19
|
__exportStar(require("./verifier"), exports);
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;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;AAE3B,wCAAsB"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pactCrashMessage = void 0;
|
|
4
|
-
|
|
4
|
+
const pactCrashMessage = (extraMessage) => `!!!!!!!!! PACT CRASHED !!!!!!!!!
|
|
5
|
+
|
|
6
|
+
${extraMessage}
|
|
7
|
+
|
|
8
|
+
This is almost certainly a bug in pact-js-core. It would be great if you could
|
|
9
|
+
open a bug report at: https://github.com/pact-foundation/pact-js-core/issues
|
|
10
|
+
so that we can fix it.
|
|
11
|
+
|
|
12
|
+
There is additional debugging information above. If you open a bug report,
|
|
13
|
+
please rerun with logLevel: 'debug' set in the VerifierOptions, and include the
|
|
14
|
+
full output.
|
|
15
|
+
|
|
16
|
+
SECURITY WARNING: Before including your log in the issue tracker, make sure you
|
|
17
|
+
have removed sensitive info such as login credentials and urls that you don't want
|
|
18
|
+
to share with the world.
|
|
19
|
+
|
|
20
|
+
We're sorry about this!
|
|
21
|
+
`;
|
|
5
22
|
exports.pactCrashMessage = pactCrashMessage;
|
|
6
23
|
//# sourceMappingURL=crashMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crashMessage.js","sourceRoot":"","sources":["crashMessage.ts"],"names":[],"mappings":";;;AAAO,
|
|
1
|
+
{"version":3,"file":"crashMessage.js","sourceRoot":"","sources":["crashMessage.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,CAC9B,YAAoB,EACZ,EAAE,CAAC;;EAEX,YAAY;;;;;;;;;;;;;;;CAeb,CAAC;AAnBW,QAAA,gBAAgB,oBAmB3B"}
|
package/src/logger/index.js
CHANGED
|
@@ -1,60 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logCrashAndThrow = exports.logErrorAndThrow = exports.verboseIsImplied = exports.getLogLevel = exports.setLogLevel = exports.DEFAULT_LOG_LEVEL = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const crashMessage_1 = require("./crashMessage");
|
|
5
|
+
const pino_1 = require("./pino");
|
|
6
|
+
const pkg = require('../../package.json');
|
|
7
|
+
const logContext = `pact-core@${pkg.version}`;
|
|
8
|
+
let currentLogLevel = 'info';
|
|
9
|
+
let logger = pino_1.createLogger(currentLogLevel);
|
|
10
10
|
exports.DEFAULT_LOG_LEVEL = 'info';
|
|
11
|
-
|
|
12
|
-
if (level === void 0) { level = 'info'; }
|
|
11
|
+
const setLogLevel = (level = 'info') => {
|
|
13
12
|
currentLogLevel = level;
|
|
14
13
|
logger = pino_1.createLogger(currentLogLevel);
|
|
15
14
|
};
|
|
16
15
|
exports.setLogLevel = setLogLevel;
|
|
17
|
-
|
|
16
|
+
const getLogLevel = () => currentLogLevel;
|
|
18
17
|
exports.getLogLevel = getLogLevel;
|
|
19
|
-
|
|
20
|
-
return currentLogLevel === 'trace' || currentLogLevel === 'debug';
|
|
21
|
-
};
|
|
18
|
+
const verboseIsImplied = () => currentLogLevel === 'trace' || currentLogLevel === 'debug';
|
|
22
19
|
exports.verboseIsImplied = verboseIsImplied;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
},
|
|
20
|
+
const addContext = (context, message) => `${context}: ${message}`;
|
|
21
|
+
const logFunctions = {
|
|
22
|
+
pactCrash: (message, context = logContext) => logger.error(addContext(context, crashMessage_1.pactCrashMessage(message))),
|
|
23
|
+
error: (message, context = logContext) => logger.error(addContext(context, message)),
|
|
24
|
+
warn: (message, context = logContext) => logger.warn(addContext(context, message)),
|
|
25
|
+
info: (message, context = logContext) => logger.info(addContext(context, message)),
|
|
26
|
+
debug: (message, context = logContext) => logger.debug(addContext(context, message)),
|
|
27
|
+
trace: (message, context = logContext) => logger.trace(addContext(context, message)),
|
|
51
28
|
};
|
|
52
|
-
|
|
29
|
+
const logErrorAndThrow = (message, context) => {
|
|
53
30
|
logger.error(message, context);
|
|
54
31
|
throw new Error(message);
|
|
55
32
|
};
|
|
56
33
|
exports.logErrorAndThrow = logErrorAndThrow;
|
|
57
|
-
|
|
34
|
+
const logCrashAndThrow = (message, context) => {
|
|
58
35
|
logFunctions.pactCrash(message, context);
|
|
59
36
|
throw new Error(message);
|
|
60
37
|
};
|
package/src/logger/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,iCAAsC;AAItC,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1C,MAAM,UAAU,GAAG,aAAa,GAAG,CAAC,OAAO,EAAE,CAAC;AAC9C,IAAI,eAAe,GAAa,MAAM,CAAC;AACvC,IAAI,MAAM,GAAG,mBAAY,CAAC,eAAe,CAAC,CAAC;AAE9B,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,QAAkB,MAAM,EAAQ,EAAE;IAC5D,eAAe,GAA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