@pact-foundation/pact-core 15.2.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/CHANGELOG.md +24 -0
- package/package.json +64 -54
- package/src/consumer/checkErrors.d.ts +2 -2
- package/src/consumer/types.d.ts +28 -27
- package/src/ffi/index.js +36 -4
- package/src/ffi/index.js.map +1 -1
- package/src/ffi/types.d.ts +21 -21
- package/src/ffi/types.js +5 -6
- package/src/ffi/types.js.map +1 -1
- package/src/logger/types.d.ts +2 -2
- package/src/verifier/argumentMapper/arguments.d.ts +4 -4
- package/src/verifier/argumentMapper/types.d.ts +7 -7
- package/src/verifier/types.d.ts +1 -1
- package/src/verifier/validateOptions.d.ts +2 -2
- package/prebuilds/darwin-arm64/libpact_ffi.dylib +0 -0
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/libpact_ffi.dylib +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-arm64/libpact_ffi.so +0 -0
- package/prebuilds/linux-arm64/libpact_ffi_musl.so +0 -0
- package/prebuilds/linux-arm64/node.napi.musl.node +0 -0
- package/prebuilds/linux-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/libpact_ffi.so +0 -0
- package/prebuilds/linux-x64/libpact_ffi_musl.so +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/prebuilds/win32-x64/pact_ffi.dll +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [16.0.0](https://github.com/pact-foundation/pact-js-core/compare/v15.2.1...v16.0.0) (2025-02-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* build platform/arch specific npm packages
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* build platform/arch specific npm packages ([809775e](https://github.com/pact-foundation/pact-js-core/commit/809775e01e937e0b20a3305076f72c85dec8b674))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Fixes and Improvements
|
|
18
|
+
|
|
19
|
+
* **deps:** update dependency check-types to v7.4.0 ([30ff204](https://github.com/pact-foundation/pact-js-core/commit/30ff204ea4988ecef56ebef223880e3e44abd7c7))
|
|
20
|
+
* **deps:** update dependency underscore to v1.13.7 ([921f692](https://github.com/pact-foundation/pact-js-core/commit/921f6926955c74c45b33168da3aeb66c1b673ccd))
|
|
21
|
+
|
|
22
|
+
## [15.2.1](https://github.com/pact-foundation/pact-js-core/compare/v15.2.0...v15.2.1) (2024-09-06)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Fixes and Improvements
|
|
26
|
+
|
|
27
|
+
* logFile default to info if undefined, warn if error setting ([a9906c4](https://github.com/pact-foundation/pact-js-core/commit/a9906c486f17832058148fc3b2d62b403a1909d1))
|
|
28
|
+
|
|
5
29
|
## [15.2.0](https://github.com/pact-foundation/pact-js-core/compare/v15.1.1...v15.2.0) (2024-09-06)
|
|
6
30
|
|
|
7
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pact-foundation/pact-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"homepage": "https://github.com/pact-foundation/pact-js-core#readme",
|
|
@@ -43,68 +43,69 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"check-types": "7.
|
|
46
|
+
"check-types": "7.4.0",
|
|
47
|
+
"detect-libc": "^2.0.3",
|
|
47
48
|
"node-gyp-build": "^4.6.0",
|
|
48
49
|
"pino": "^8.7.0",
|
|
49
50
|
"pino-pretty": "^9.1.1",
|
|
50
|
-
"underscore": "1.
|
|
51
|
+
"underscore": "1.13.7"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@grpc/grpc-js": "
|
|
54
|
-
"@grpc/proto-loader": "
|
|
55
|
-
"@pact-foundation/pact-js-prettier-config": "
|
|
56
|
-
"@snyk/protect": "
|
|
57
|
-
"@tsconfig/node14": "
|
|
58
|
-
"@types/basic-auth": "
|
|
59
|
-
"@types/chai": "4.
|
|
60
|
-
"@types/chai-as-promised": "7.1.
|
|
61
|
-
"@types/check-types": "
|
|
62
|
-
"@types/cors": "
|
|
63
|
-
"@types/decompress": "
|
|
64
|
-
"@types/express": "4.
|
|
65
|
-
"@types/mocha": "
|
|
66
|
-
"@types/needle": "
|
|
67
|
-
"@types/node": "
|
|
68
|
-
"@types/rimraf": "
|
|
69
|
-
"@types/sinon": "
|
|
70
|
-
"@types/tar": "
|
|
71
|
-
"@types/underscore": "1.
|
|
72
|
-
"@types/unixify": "
|
|
73
|
-
"@types/url-join": "
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "
|
|
75
|
-
"@typescript-eslint/parser": "
|
|
76
|
-
"axios": "
|
|
77
|
-
"basic-auth": "2.0.
|
|
78
|
-
"body-parser": "
|
|
79
|
-
"chai": "4.
|
|
80
|
-
"chai-as-promised": "7.1.
|
|
81
|
-
"commit-and-tag-version": "
|
|
82
|
-
"cors": "2.8.
|
|
83
|
-
"cross-env": "
|
|
54
|
+
"@grpc/grpc-js": "1.12.4",
|
|
55
|
+
"@grpc/proto-loader": "0.7.13",
|
|
56
|
+
"@pact-foundation/pact-js-prettier-config": "1.0.0",
|
|
57
|
+
"@snyk/protect": "1.1294.2",
|
|
58
|
+
"@tsconfig/node14": "14.1.2",
|
|
59
|
+
"@types/basic-auth": "1.1.8",
|
|
60
|
+
"@types/chai": "4.3.20",
|
|
61
|
+
"@types/chai-as-promised": "7.1.8",
|
|
62
|
+
"@types/check-types": "7.3.7",
|
|
63
|
+
"@types/cors": "2.8.17",
|
|
64
|
+
"@types/decompress": "4.2.7",
|
|
65
|
+
"@types/express": "4.17.21",
|
|
66
|
+
"@types/mocha": "10.0.10",
|
|
67
|
+
"@types/needle": "3.3.0",
|
|
68
|
+
"@types/node": "22.10.1",
|
|
69
|
+
"@types/rimraf": "2.0.5",
|
|
70
|
+
"@types/sinon": "17.0.3",
|
|
71
|
+
"@types/tar": "6.1.13",
|
|
72
|
+
"@types/underscore": "1.13.0",
|
|
73
|
+
"@types/unixify": "1.0.2",
|
|
74
|
+
"@types/url-join": "4.0.3",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
76
|
+
"@typescript-eslint/parser": "5.62.0",
|
|
77
|
+
"axios": "1.7.9",
|
|
78
|
+
"basic-auth": "2.0.1",
|
|
79
|
+
"body-parser": "1.20.3",
|
|
80
|
+
"chai": "4.5.0",
|
|
81
|
+
"chai-as-promised": "7.1.2",
|
|
82
|
+
"commit-and-tag-version": "11.3.0",
|
|
83
|
+
"cors": "2.8.5",
|
|
84
|
+
"cross-env": "5.2.1",
|
|
84
85
|
"decamelize": "2.0.0",
|
|
85
|
-
"eslint": "
|
|
86
|
-
"eslint-config-airbnb-base": "
|
|
87
|
-
"eslint-config-airbnb-typescript": "
|
|
88
|
-
"eslint-config-prettier": "
|
|
89
|
-
"eslint-import-resolver-typescript": "
|
|
90
|
-
"eslint-plugin-chai-friendly": "
|
|
91
|
-
"eslint-plugin-import": "
|
|
92
|
-
"eslint-plugin-mocha": "
|
|
93
|
-
"express": "4.
|
|
94
|
-
"form-data": "
|
|
95
|
-
"grpc-promise": "
|
|
96
|
-
"mocha": "
|
|
97
|
-
"node-addon-api": "
|
|
98
|
-
"nodemon": "
|
|
99
|
-
"prettier": "
|
|
100
|
-
"protobufjs": "
|
|
86
|
+
"eslint": "8.57.1",
|
|
87
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
88
|
+
"eslint-config-airbnb-typescript": "17.1.0",
|
|
89
|
+
"eslint-config-prettier": "8.10.0",
|
|
90
|
+
"eslint-import-resolver-typescript": "3.7.0",
|
|
91
|
+
"eslint-plugin-chai-friendly": "0.7.4",
|
|
92
|
+
"eslint-plugin-import": "2.31.0",
|
|
93
|
+
"eslint-plugin-mocha": "10.1.0",
|
|
94
|
+
"express": "4.21.2",
|
|
95
|
+
"form-data": "4.0.1",
|
|
96
|
+
"grpc-promise": "1.4.0",
|
|
97
|
+
"mocha": "9.2.2",
|
|
98
|
+
"node-addon-api": "6.1.0",
|
|
99
|
+
"nodemon": "2.0.22",
|
|
100
|
+
"prettier": "2.8.8",
|
|
101
|
+
"protobufjs": "7.4.0",
|
|
101
102
|
"rimraf": "2.7.1",
|
|
102
103
|
"sinon": "9.2.4",
|
|
103
|
-
"ts-node": "10.9.
|
|
104
|
-
"typescript": "4.
|
|
104
|
+
"ts-node": "10.9.2",
|
|
105
|
+
"typescript": "4.9.5"
|
|
105
106
|
},
|
|
106
107
|
"overrides": {
|
|
107
|
-
"semver": "7.
|
|
108
|
+
"semver": "7.6.3"
|
|
108
109
|
},
|
|
109
110
|
"scripts": {
|
|
110
111
|
"clean": "rimraf '{src,test}/**/*.{js,map,d.ts}' 'package.zip' '.tmp' 'tmp'",
|
|
@@ -160,5 +161,14 @@
|
|
|
160
161
|
}
|
|
161
162
|
]
|
|
162
163
|
},
|
|
163
|
-
"snyk": true
|
|
164
|
+
"snyk": true,
|
|
165
|
+
"optionalDependencies": {
|
|
166
|
+
"@pact-foundation/pact-core-darwin-arm64": "16.0.0",
|
|
167
|
+
"@pact-foundation/pact-core-darwin-x64": "16.0.0",
|
|
168
|
+
"@pact-foundation/pact-core-linux-arm64-glibc": "16.0.0",
|
|
169
|
+
"@pact-foundation/pact-core-linux-arm64-musl": "16.0.0",
|
|
170
|
+
"@pact-foundation/pact-core-linux-x64-glibc": "16.0.0",
|
|
171
|
+
"@pact-foundation/pact-core-linux-x64-musl": "16.0.0",
|
|
172
|
+
"@pact-foundation/pact-core-windows-x64": "16.0.0"
|
|
173
|
+
}
|
|
164
174
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const wrapWithCheck: <F extends (...args: never[]) => boolean>(f: BooleanFunction<F>, contextMessage: string) => (...args: Parameters<F>) => boolean;
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type BooleanFunction<T> = T extends (...args: infer A) => boolean ? (...args: A) => boolean : never;
|
|
3
|
+
type BooleanFunctions<T> = {
|
|
4
4
|
[key in keyof T]: BooleanFunction<T[key]>;
|
|
5
5
|
};
|
|
6
6
|
export declare const wrapAllWithCheck: <T extends BooleanFunctions<T>>(o: T) => BooleanFunctions<T>;
|
package/src/consumer/types.d.ts
CHANGED
|
@@ -1,64 +1,65 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export type MatchingResult = MatchingResultSuccess | MatchingResultRequestMismatch | MatchingResultRequestNotFound | MatchingResultMissingRequest | MatchingResultPlugin;
|
|
4
|
+
export type MatchingResultSuccess = {
|
|
4
5
|
type: 'request-match';
|
|
5
6
|
};
|
|
6
|
-
export
|
|
7
|
+
export type MatchingResultRequestMismatch = {
|
|
7
8
|
type: 'request-mismatch';
|
|
8
9
|
method: string;
|
|
9
10
|
path: string;
|
|
10
11
|
mismatches: Mismatch[];
|
|
11
12
|
};
|
|
12
|
-
export
|
|
13
|
+
export type MatchingResultRequestNotFound = {
|
|
13
14
|
type: 'request-not-found';
|
|
14
15
|
method: string;
|
|
15
16
|
path: string;
|
|
16
17
|
request: RequestMismatch;
|
|
17
18
|
};
|
|
18
|
-
export
|
|
19
|
+
export type MatchingResultMissingRequest = {
|
|
19
20
|
type: 'missing-request';
|
|
20
21
|
method: string;
|
|
21
22
|
path: string;
|
|
22
23
|
request: RequestMismatch;
|
|
23
24
|
};
|
|
24
|
-
export
|
|
25
|
+
export type MatchingResultPlugin = {
|
|
25
26
|
error: string;
|
|
26
27
|
path?: string;
|
|
27
28
|
mismatches: PluginContentMismatch[];
|
|
28
29
|
};
|
|
29
|
-
export
|
|
30
|
-
export
|
|
30
|
+
export type Mismatch = MethodMismatch | PathMismatch | StatusMismatch | QueryMismatch | HeaderMismatch | BodyTypeMismatch | BodyMismatch | MetadataMismatch | PluginContentMismatch;
|
|
31
|
+
export type MethodMismatch = {
|
|
31
32
|
type: 'MethodMismatch';
|
|
32
33
|
expected: string;
|
|
33
34
|
actual: string;
|
|
34
35
|
};
|
|
35
|
-
export
|
|
36
|
+
export type PathMismatch = {
|
|
36
37
|
type: 'PathMismatch';
|
|
37
38
|
expected: string;
|
|
38
39
|
actual: string;
|
|
39
40
|
mismatch: string;
|
|
40
41
|
};
|
|
41
|
-
export
|
|
42
|
+
export type StatusMismatch = {
|
|
42
43
|
type: 'StatusMismatch';
|
|
43
44
|
expected: string;
|
|
44
45
|
actual: string;
|
|
45
46
|
mismatch: string;
|
|
46
47
|
};
|
|
47
|
-
export
|
|
48
|
+
export type QueryMismatch = {
|
|
48
49
|
type: 'QueryMismatch';
|
|
49
50
|
parameter: string;
|
|
50
51
|
expected: string;
|
|
51
52
|
actual: string;
|
|
52
53
|
mismatch: string;
|
|
53
54
|
};
|
|
54
|
-
export
|
|
55
|
+
export type HeaderMismatch = {
|
|
55
56
|
type: 'HeaderMismatch';
|
|
56
57
|
key: string;
|
|
57
58
|
expected: string;
|
|
58
59
|
actual: string;
|
|
59
60
|
mismatch: string;
|
|
60
61
|
};
|
|
61
|
-
export
|
|
62
|
+
export type BodyTypeMismatch = {
|
|
62
63
|
type: 'BodyTypeMismatch';
|
|
63
64
|
expected: string;
|
|
64
65
|
actual: string;
|
|
@@ -66,21 +67,21 @@ export declare type BodyTypeMismatch = {
|
|
|
66
67
|
expectedBody?: string;
|
|
67
68
|
actualBody?: string;
|
|
68
69
|
};
|
|
69
|
-
export
|
|
70
|
+
export type BodyMismatch = {
|
|
70
71
|
type: 'BodyMismatch';
|
|
71
72
|
path: string;
|
|
72
73
|
expected?: string;
|
|
73
74
|
actual?: string;
|
|
74
75
|
mismatch: string;
|
|
75
76
|
};
|
|
76
|
-
export
|
|
77
|
+
export type MetadataMismatch = {
|
|
77
78
|
type: 'MetadataMismatch';
|
|
78
79
|
key: string;
|
|
79
80
|
expected: string;
|
|
80
81
|
actual: string;
|
|
81
82
|
mismatch: string;
|
|
82
83
|
};
|
|
83
|
-
export
|
|
84
|
+
export type RequestMismatch = {
|
|
84
85
|
method?: string;
|
|
85
86
|
path?: string;
|
|
86
87
|
headers?: Record<string, Array<string>>;
|
|
@@ -94,22 +95,22 @@ export declare type PluginContentMismatch = {
|
|
|
94
95
|
mismatch: string;
|
|
95
96
|
diff?: string;
|
|
96
97
|
};
|
|
97
|
-
export
|
|
98
|
-
export
|
|
98
|
+
export type PluginInteraction = RequestPluginInteraction & ResponsePluginInteraction & RequestResponsePluginInteraction;
|
|
99
|
+
export type RequestPluginInteraction = {
|
|
99
100
|
withPluginRequestInteractionContents: (contentType: string, contents: string) => boolean;
|
|
100
101
|
};
|
|
101
|
-
export
|
|
102
|
+
export type ResponsePluginInteraction = {
|
|
102
103
|
withPluginResponseInteractionContents: (contentType: string, contents: string) => boolean;
|
|
103
104
|
};
|
|
104
|
-
export
|
|
105
|
+
export type RequestResponsePluginInteraction = {
|
|
105
106
|
withPluginRequestResponseInteractionContents: (contentType: string, contents: string) => boolean;
|
|
106
107
|
};
|
|
107
|
-
export
|
|
108
|
+
export type PluginPact = {
|
|
108
109
|
addPlugin: (plugin: string, version: string) => void;
|
|
109
110
|
cleanupPlugins: () => void;
|
|
110
111
|
cleanupMockServer: (port: number) => boolean;
|
|
111
112
|
};
|
|
112
|
-
export
|
|
113
|
+
export type ConsumerInteraction = PluginInteraction & {
|
|
113
114
|
uponReceiving: (description: string) => boolean;
|
|
114
115
|
given: (state: string) => boolean;
|
|
115
116
|
givenWithParam: (state: string, name: string, value: string) => boolean;
|
|
@@ -126,7 +127,7 @@ export declare type ConsumerInteraction = PluginInteraction & {
|
|
|
126
127
|
withResponseBinaryBody: (body: Buffer, contentType: string) => boolean;
|
|
127
128
|
withResponseMultipartBody: (contentType: string, filename: string, mimePartName: string) => boolean;
|
|
128
129
|
};
|
|
129
|
-
export
|
|
130
|
+
export type ConsumerPact = PluginPact & {
|
|
130
131
|
newInteraction: (description: string) => ConsumerInteraction;
|
|
131
132
|
newAsynchronousMessage: (description: string) => AsynchronousMessage;
|
|
132
133
|
newSynchronousMessage: (description: string) => SynchronousMessage;
|
|
@@ -139,7 +140,7 @@ export declare type ConsumerPact = PluginPact & {
|
|
|
139
140
|
mockServerMatchedSuccessfully: (port: number) => boolean;
|
|
140
141
|
addMetadata: (namespace: string, name: string, value: string) => boolean;
|
|
141
142
|
};
|
|
142
|
-
export
|
|
143
|
+
export type AsynchronousMessage = RequestPluginInteraction & {
|
|
143
144
|
given: (state: string) => void;
|
|
144
145
|
givenWithParam: (state: string, name: string, value: string) => void;
|
|
145
146
|
givenWithParams: (state: string, params: string) => void;
|
|
@@ -149,8 +150,8 @@ export declare type AsynchronousMessage = RequestPluginInteraction & {
|
|
|
149
150
|
withBinaryContents: (body: Buffer, contentType: string) => void;
|
|
150
151
|
reifyMessage: () => string;
|
|
151
152
|
};
|
|
152
|
-
export
|
|
153
|
-
export
|
|
153
|
+
export type ConsumerMessage = AsynchronousMessage;
|
|
154
|
+
export type SynchronousMessage = PluginInteraction & {
|
|
154
155
|
given: (state: string) => void;
|
|
155
156
|
givenWithParam: (state: string, name: string, value: string) => void;
|
|
156
157
|
givenWithParams: (state: string, params: string) => void;
|
|
@@ -160,7 +161,7 @@ export declare type SynchronousMessage = PluginInteraction & {
|
|
|
160
161
|
withRequestBinaryContents: (body: Buffer, contentType: string) => void;
|
|
161
162
|
withResponseBinaryContents: (body: Buffer, contentType: string) => void;
|
|
162
163
|
};
|
|
163
|
-
export
|
|
164
|
+
export type ConsumerMessagePact = PluginPact & {
|
|
164
165
|
newMessage: (description: string) => AsynchronousMessage;
|
|
165
166
|
newAsynchronousMessage: (description: string) => AsynchronousMessage;
|
|
166
167
|
newSynchronousMessage: (description: string) => SynchronousMessage;
|
package/src/ffi/index.js
CHANGED
|
@@ -29,9 +29,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.getFfiLib = exports.PACT_FFI_VERSION = void 0;
|
|
30
30
|
const node_path_1 = __importDefault(require("node:path"));
|
|
31
31
|
const bindings = require("node-gyp-build");
|
|
32
|
+
const detect_libc_1 = require("detect-libc");
|
|
32
33
|
const logger_1 = __importStar(require("../logger"));
|
|
33
34
|
const types_1 = require("./types");
|
|
34
35
|
exports.PACT_FFI_VERSION = '0.4.22';
|
|
36
|
+
function getPlatformArchSpecificPackage() {
|
|
37
|
+
const { arch } = process;
|
|
38
|
+
let os = process.platform;
|
|
39
|
+
if (['win32', 'cygwin'].includes(process.platform)) {
|
|
40
|
+
os = 'windows';
|
|
41
|
+
}
|
|
42
|
+
let platformArchSpecificPackage = `@pact-foundation/pact-core-${os}-${arch}`;
|
|
43
|
+
if (os === 'linux') {
|
|
44
|
+
platformArchSpecificPackage += (0, detect_libc_1.isNonGlibcLinuxSync)() ? '-musl' : '-glibc';
|
|
45
|
+
}
|
|
46
|
+
const prebuildPackageLocation = process.env['PACT_PREBUILD_PACKAGE_LOCATION'];
|
|
47
|
+
if (prebuildPackageLocation) {
|
|
48
|
+
platformArchSpecificPackage = node_path_1.default.join(prebuildPackageLocation, platformArchSpecificPackage);
|
|
49
|
+
}
|
|
50
|
+
const packagePath = `${platformArchSpecificPackage}/package.json`;
|
|
51
|
+
try {
|
|
52
|
+
let resolvedPackagePath = require.resolve(packagePath);
|
|
53
|
+
if (os === 'windows') {
|
|
54
|
+
resolvedPackagePath = resolvedPackagePath.replace('\\package.json', '');
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
resolvedPackagePath = resolvedPackagePath.replace('/package.json', '');
|
|
58
|
+
}
|
|
59
|
+
return resolvedPackagePath;
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
throw new Error(`Couldn't find npm package ${platformArchSpecificPackage} \n 💡 you can tell Pact where the npm package is located with env var $PACT_PREBUILD_PACKAGE_LOCATION`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
35
65
|
const supportedPlatforms = [
|
|
36
66
|
'darwin-arm64',
|
|
37
67
|
'darwin-x64',
|
|
@@ -57,7 +87,7 @@ const loadPathMessage = (bindingsPath) => `: attempting to load native module fr
|
|
|
57
87
|
: `\n source: pact-js-core binding lookup \n\n - You can override via PACT_PREBUILD_LOCATION\n`}`;
|
|
58
88
|
const bindingsResolver = (bindingsPath) => bindings(bindingsPath);
|
|
59
89
|
const bindingPaths = [
|
|
60
|
-
node_path_1.default.resolve(
|
|
90
|
+
node_path_1.default.resolve(getPlatformArchSpecificPackage()),
|
|
61
91
|
process.env['PACT_PREBUILD_LOCATION']?.toString() ?? node_path_1.default.resolve(),
|
|
62
92
|
];
|
|
63
93
|
let ffiLib;
|
|
@@ -106,9 +136,11 @@ const getFfiLib = (logLevel = logger_1.DEFAULT_LOG_LEVEL, logFile = undefined) =
|
|
|
106
136
|
ffi = initialiseFfi();
|
|
107
137
|
logger_1.default.debug(`Initialising native core at log level '${logLevel}'`, logFile);
|
|
108
138
|
if (logFile) {
|
|
109
|
-
logger_1.default.debug(`writing log file at level ${
|
|
110
|
-
const res = ffiLib.pactffiLogToFile(logFile, types_1.FfiLogLevelFilter[logLevel]);
|
|
111
|
-
|
|
139
|
+
logger_1.default.debug(`writing log file at level ${logLevel} to ${logFile}`);
|
|
140
|
+
const res = ffiLib.pactffiLogToFile(logFile, types_1.FfiLogLevelFilter[logLevel] ?? 3);
|
|
141
|
+
if (res !== 0) {
|
|
142
|
+
logger_1.default.warn(`Failed to write log file to ${logFile}, reason: ${res}`);
|
|
143
|
+
}
|
|
112
144
|
}
|
|
113
145
|
else {
|
|
114
146
|
ffiLib.pactffiInitWithLogLevel(logLevel);
|
package/src/ffi/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA6B;AAC7B,2CAA4C;AAC5C,oDAAsD;AAEtD,mCAAiD;AAEpC,QAAA,gBAAgB,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA6B;AAC7B,2CAA4C;AAC5C,6CAAkD;AAClD,oDAAsD;AAEtD,mCAAiD;AAEpC,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAUzC,SAAS,8BAA8B;IACrC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,IAAI,EAAE,GAAG,OAAO,CAAC,QAAkB,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAClD,EAAE,GAAG,SAAS,CAAC;KAChB;IACD,IAAI,2BAA2B,GAAG,8BAA8B,EAAE,IAAI,IAAI,EAAE,CAAC;IAC7E,IAAI,EAAE,KAAK,OAAO,EAAE;QAClB,2BAA2B,IAAI,IAAA,iCAAmB,GAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;KAC3E;IAED,MAAM,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9E,IAAI,uBAAuB,EAAE;QAC3B,2BAA2B,GAAG,mBAAI,CAAC,IAAI,CACrC,uBAAuB,EACvB,2BAA2B,CAC5B,CAAC;KACH;IAED,MAAM,WAAW,GAAG,GAAG,2BAA2B,e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AC,CACjC,CAAC;YACF,IAAI,GAAG,KAAK,CAAC,EAAE;gBACb,gBAAM,CAAC,IAAI,CAAC,+BAA+B,OAAO,aAAa,GAAG,EAAE,CAAC,CAAC;aACvE;SACF;aAAM;YACL,MAAM,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;SAC1C;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAzBW,QAAA,SAAS,aAyBpB"}
|
package/src/ffi/types.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export type FfiHandle = number;
|
|
4
|
+
export type FfiPactHandle = number;
|
|
5
|
+
export type FfiInteractionHandle = number;
|
|
6
|
+
export type FfiVerifierHandle = number;
|
|
7
|
+
export type FfiMessagePactHandle = number;
|
|
8
|
+
export type FfiMessageHandle = number;
|
|
9
|
+
export type FfiSpecificationVersion = 0 | 1 | 2 | 3 | 4 | 5;
|
|
9
10
|
export declare const FfiSpecificationVersion: Record<string, FfiSpecificationVersion>;
|
|
10
|
-
export
|
|
11
|
+
export type FfiWritePactResponse = 0 | 1 | 2 | 3;
|
|
11
12
|
export declare const FfiWritePactResponse: Record<string, FfiWritePactResponse>;
|
|
12
|
-
export
|
|
13
|
+
export type FfiWriteMessagePactResponse = 0 | 1 | 2;
|
|
13
14
|
export declare const FfiWriteMessagePactResponse: Record<string, FfiWriteMessagePactResponse>;
|
|
14
|
-
export
|
|
15
|
+
export type FfiConfigurePluginResponse = 0 | 1 | 2 | 3;
|
|
15
16
|
export declare const FfiConfigurePluginResponse: Record<string, FfiConfigurePluginResponse>;
|
|
16
|
-
export
|
|
17
|
+
export type FfiPluginInteractionResponse = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
17
18
|
export declare const FfiPluginInteractionResponse: Record<string, FfiPluginInteractionResponse>;
|
|
18
|
-
export
|
|
19
|
+
export type FfiInteractionPart = 0 | 1;
|
|
19
20
|
export declare const INTERACTION_PART_REQUEST: FfiInteractionPart;
|
|
20
21
|
export declare const INTERACTION_PART_RESPONSE: FfiInteractionPart;
|
|
21
22
|
export declare const CREATE_MOCK_SERVER_ERRORS: {
|
|
@@ -38,18 +39,17 @@ export declare enum FfiFunctionResult {
|
|
|
38
39
|
RESULT_FAILED = 1
|
|
39
40
|
}
|
|
40
41
|
export declare enum FfiLogLevelFilter {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
LOG_LEVEL_TRACE = 5
|
|
42
|
+
'error' = 1,
|
|
43
|
+
'warn' = 2,
|
|
44
|
+
'info' = 3,
|
|
45
|
+
'debug' = 4,
|
|
46
|
+
'trace' = 5
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export type Ffi = {
|
|
49
49
|
pactffiInit(logLevel: string): string;
|
|
50
50
|
pactffiVersion(): string;
|
|
51
51
|
} & FfiConsumerFunctions & FfiVerificationFunctions;
|
|
52
|
-
export
|
|
52
|
+
export type FfiConsumerFunctions = {
|
|
53
53
|
pactffiCreateMockServerForPact(handle: FfiPactHandle, address: string, tls: boolean): number;
|
|
54
54
|
pactffiCreateMockServerForTransport(handle: FfiPactHandle, address: string, port: number, transport: string, config: string): number;
|
|
55
55
|
pactffiNewPact(consumer: string, provider: string): FfiPactHandle;
|
|
@@ -93,7 +93,7 @@ export declare type FfiConsumerFunctions = {
|
|
|
93
93
|
pactffiMessageWithMetadata(handle: FfiMessageHandle, key: string, value: string): void;
|
|
94
94
|
pactffiMessageReify(handle: FfiMessageHandle): string;
|
|
95
95
|
};
|
|
96
|
-
export
|
|
96
|
+
export type FfiVerificationFunctions = {
|
|
97
97
|
pactffiVerifierNewForApplication(libraryName: string, version: string): FfiVerifierHandle;
|
|
98
98
|
pactffiVerifierSetProviderInfo(handle: FfiVerifierHandle, providerName: string, scheme: string, host: string, port: number, path: string): void;
|
|
99
99
|
pactffiVerifierSetFilterInfo(handle: FfiVerifierHandle, description: string, state: string, noState: boolean): void;
|
package/src/ffi/types.js
CHANGED
|
@@ -60,11 +60,10 @@ var FfiFunctionResult;
|
|
|
60
60
|
})(FfiFunctionResult = exports.FfiFunctionResult || (exports.FfiFunctionResult = {}));
|
|
61
61
|
var FfiLogLevelFilter;
|
|
62
62
|
(function (FfiLogLevelFilter) {
|
|
63
|
-
FfiLogLevelFilter[FfiLogLevelFilter["
|
|
64
|
-
FfiLogLevelFilter[FfiLogLevelFilter["
|
|
65
|
-
FfiLogLevelFilter[FfiLogLevelFilter["
|
|
66
|
-
FfiLogLevelFilter[FfiLogLevelFilter["
|
|
67
|
-
FfiLogLevelFilter[FfiLogLevelFilter["
|
|
68
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_TRACE"] = 5] = "LOG_LEVEL_TRACE";
|
|
63
|
+
FfiLogLevelFilter[FfiLogLevelFilter["error"] = 1] = "error";
|
|
64
|
+
FfiLogLevelFilter[FfiLogLevelFilter["warn"] = 2] = "warn";
|
|
65
|
+
FfiLogLevelFilter[FfiLogLevelFilter["info"] = 3] = "info";
|
|
66
|
+
FfiLogLevelFilter[FfiLogLevelFilter["debug"] = 4] = "debug";
|
|
67
|
+
FfiLogLevelFilter[FfiLogLevelFilter["trace"] = 5] = "trace";
|
|
69
68
|
})(FfiLogLevelFilter = exports.FfiLogLevelFilter || (exports.FfiLogLevelFilter = {}));
|
|
70
69
|
//# sourceMappingURL=types.js.map
|
package/src/ffi/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAWa,QAAA,uBAAuB,GAClC;IACE,6BAA6B,EAAE,CAAC;IAChC,wBAAwB,EAAE,CAAC;IAC3B,0BAA0B,EAAE,CAAC;IAC7B,wBAAwB,E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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,iBAMX;AAND,WAAY,iBAAiB;IAC3B,2DAAW,CAAA;IACX,yDAAU,CAAA;IACV,yDAAU,CAAA;IACV,2DAAW,CAAA;IACX,2DAAW,CAAA;AACb,CAAC,EANW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAM5B"}
|
package/src/logger/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type LogLevel = 'debug' | 'error' | 'info' | 'trace' | 'warn';
|
|
2
|
+
export type Logger = {
|
|
3
3
|
pactCrash: (message: string, context?: string) => void;
|
|
4
4
|
error: (message: string, context?: string) => void;
|
|
5
5
|
warn: (message: string, context?: string) => void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { FnMapping } from './types';
|
|
2
2
|
import { InternalPactVerifierOptions } from '../types';
|
|
3
3
|
import { FfiVerificationFunctions } from '../../ffi/types';
|
|
4
|
-
|
|
4
|
+
type IgnoredFfiFunctions = {
|
|
5
5
|
pactffiVerifierNewForApplication: 1;
|
|
6
6
|
pactffiVerifierExecute: 1;
|
|
7
7
|
pactffiVerifierShutdown: 1;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type MergedFfiSourceFunctions = {
|
|
10
10
|
pactffiVerifierAddFileSource: 1;
|
|
11
11
|
pactffiVerifierUrlSource: 1;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type RequiredFfiVerificationFunctions = Omit<FfiVerificationFunctions, keyof (IgnoredFfiFunctions & MergedFfiSourceFunctions)>;
|
|
14
|
+
type OrderedExecution = {
|
|
15
15
|
[Key in keyof RequiredFfiVerificationFunctions]: number;
|
|
16
16
|
};
|
|
17
17
|
export declare const orderOfExecution: OrderedExecution;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Ffi, FfiHandle } from '../../ffi/types';
|
|
2
2
|
export declare const deprecatedFunction: (_: unknown, property: string) => boolean;
|
|
3
|
-
|
|
3
|
+
type KeyedObject = {
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type FnArgumentMapping<O> = {
|
|
7
7
|
validateAndExecute: (ffi: Ffi, handle: FfiHandle, options: O) => FnValidationResult;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type FnMapping<T extends KeyedObject, O> = {
|
|
10
10
|
[Key in keyof T]: FnArgumentMapping<O>;
|
|
11
11
|
};
|
|
12
12
|
export declare enum FnValidationStatus {
|
|
@@ -14,16 +14,16 @@ export declare enum FnValidationStatus {
|
|
|
14
14
|
IGNORE = 1,
|
|
15
15
|
FAIL = 2
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
type FnValidationResultSuccess = {
|
|
18
18
|
status: FnValidationStatus.SUCCESS;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
type FnValidationResultFail = {
|
|
21
21
|
status: FnValidationStatus.FAIL;
|
|
22
22
|
messages: string[];
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
type FnValidationResultIgnore = {
|
|
25
25
|
status: FnValidationStatus.IGNORE;
|
|
26
26
|
messages: string[];
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type FnValidationResult = FnValidationResultSuccess | FnValidationResultFail | FnValidationResultIgnore;
|
|
29
29
|
export {};
|
package/src/verifier/types.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export declare const deprecatedBy: (preferredOption: string) => () => (_: unknow
|
|
|
4
4
|
export declare const incompatibleWith: (keys: (keyof InternalPactVerifierOptions)[]) => (options: InternalPactVerifierOptions) => (_: unknown, property: string) => boolean;
|
|
5
5
|
export declare const requires: (keys: (keyof InternalPactVerifierOptions)[]) => (options: InternalPactVerifierOptions) => (_: unknown, property: string) => boolean;
|
|
6
6
|
export declare const requiresOneOf: (keys: (keyof InternalPactVerifierOptions)[]) => (options: InternalPactVerifierOptions) => (_: unknown, property: string) => boolean;
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
type AssertFunction = (a: unknown, property: string) => boolean;
|
|
8
|
+
export type ArgumentValidationRules<T> = {
|
|
9
9
|
[Key in keyof T]-?: ((options: T) => AssertFunction)[];
|
|
10
10
|
};
|
|
11
11
|
export declare const validationRules: ArgumentValidationRules<InternalPactVerifierOptions>;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|