@pact-foundation/pact-core 13.5.1 → 13.6.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/binding.gyp +141 -0
- package/build/Makefile +334 -0
- package/build/binding.Makefile +6 -0
- package/build/copy_release_artifacts.target.mk +47 -0
- package/build/pact.target.mk +174 -0
- package/build/set_osx_install_name.target.mk +18 -0
- package/ffi/{v0.0.3-libpact_ffi-osx-aarch64-apple-darwin.dylib → libpact_ffi.dylib} +0 -0
- package/ffi/{v0.0.3-libpact_ffi-linux-x86_64.so → libpact_ffi.so} +0 -0
- package/ffi/libpact_ffi.so.gz +0 -0
- package/ffi/{v0.0.3-libpact_ffi-osx-x86_64.dylib → osxaarch64/libpact_ffi.dylib} +0 -0
- package/ffi/pact-cpp.h +2344 -0
- package/ffi/{v0.0.3-pact.h → pact.h} +667 -119
- package/ffi/{v0.0.3-pact_ffi-windows-x86_64.dll → pact_ffi.dll} +0 -0
- package/ffi/pact_ffi.dll.lib +0 -0
- package/native/addon.cc +68 -0
- package/native/consumer.cc +1570 -0
- package/native/consumer.h +124 -0
- package/native/ffi.cc +148 -0
- package/native/ffi.h +18 -0
- package/native/plugin.cc +6 -0
- package/native/plugin.h +7 -0
- package/native/provider.cc +815 -0
- package/native/provider.h +38 -0
- package/package.json +12 -9
- 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 +5 -0
- package/src/consumer/index.js +222 -0
- package/src/consumer/index.js.map +1 -0
- package/src/consumer/types.d.ts +132 -0
- package/src/{ffi/internals → consumer}/types.js +0 -0
- package/src/{ffi/internals → consumer}/types.js.map +0 -0
- package/src/ffi/index.d.ts +4 -3
- package/src/ffi/index.js +6 -9
- package/src/ffi/index.js.map +1 -1
- package/src/ffi/internals/index.d.ts +0 -2
- package/src/ffi/internals/index.js +1 -11
- package/src/ffi/internals/index.js.map +1 -1
- package/src/ffi/types.d.ts +100 -0
- package/src/ffi/types.js +70 -0
- package/src/ffi/types.js.map +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/logger/index.d.ts +5 -2
- package/src/logger/index.js +15 -2
- package/src/logger/index.js.map +1 -1
- package/src/verifier/argumentMapper/arguments.js +8 -0
- package/src/verifier/argumentMapper/arguments.js.map +1 -1
- package/src/verifier/index.js +1 -7
- package/src/verifier/index.js.map +1 -1
- package/src/verifier/nativeVerifier.js +74 -15
- package/src/verifier/nativeVerifier.js.map +1 -1
- package/src/verifier/types.d.ts +10 -2
- package/test.js +52 -0
- package/src/ffi/declarations.d.ts +0 -136
- package/src/ffi/declarations.js +0 -92
- package/src/ffi/declarations.js.map +0 -1
- package/src/ffi/internals/types.d.ts +0 -23
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import ref = require('ref-napi');
|
|
2
|
-
import refStructDi = require('ref-struct-di');
|
|
3
|
-
declare const PactHandle: refStructDi.StructType<{
|
|
4
|
-
pact: ref.Type<ref.Pointer<void>>;
|
|
5
|
-
}>;
|
|
6
|
-
declare const InteractionHandle: refStructDi.StructType<{
|
|
7
|
-
pact: ref.Type<ref.Pointer<void>>;
|
|
8
|
-
interaction: ref.Type<ref.Pointer<void>>;
|
|
9
|
-
}>;
|
|
10
|
-
export declare type FfiDeclarations = {
|
|
11
|
-
pactffi_init: ['string', ['string']];
|
|
12
|
-
pactffi_version: ['string', []];
|
|
13
|
-
pactffi_free_string: ['void', ['string']];
|
|
14
|
-
pactffi_verify: ['int', ['string']];
|
|
15
|
-
pactffi_create_mock_server_for_pact: [
|
|
16
|
-
'int',
|
|
17
|
-
[
|
|
18
|
-
typeof PactHandle,
|
|
19
|
-
'string',
|
|
20
|
-
'bool'
|
|
21
|
-
]
|
|
22
|
-
];
|
|
23
|
-
pactffi_new_pact: [typeof PactHandle, ['string', 'string']];
|
|
24
|
-
pactffi_with_specification: ['void', [typeof PactHandle, 'int']];
|
|
25
|
-
pactffi_new_interaction: [
|
|
26
|
-
typeof InteractionHandle,
|
|
27
|
-
[
|
|
28
|
-
typeof PactHandle,
|
|
29
|
-
'string'
|
|
30
|
-
]
|
|
31
|
-
];
|
|
32
|
-
pactffi_upon_receiving: ['void', [typeof InteractionHandle, 'string']];
|
|
33
|
-
pactffi_given: ['void', [typeof InteractionHandle, 'string']];
|
|
34
|
-
pactffi_given_with_param: [
|
|
35
|
-
'void',
|
|
36
|
-
[
|
|
37
|
-
typeof InteractionHandle,
|
|
38
|
-
'string',
|
|
39
|
-
'string',
|
|
40
|
-
'string'
|
|
41
|
-
]
|
|
42
|
-
];
|
|
43
|
-
pactffi_with_request: [
|
|
44
|
-
'void',
|
|
45
|
-
[
|
|
46
|
-
typeof InteractionHandle,
|
|
47
|
-
'string',
|
|
48
|
-
'string'
|
|
49
|
-
]
|
|
50
|
-
];
|
|
51
|
-
pactffi_with_query_parameter: [
|
|
52
|
-
'void',
|
|
53
|
-
[
|
|
54
|
-
typeof InteractionHandle,
|
|
55
|
-
'string',
|
|
56
|
-
'int',
|
|
57
|
-
'string'
|
|
58
|
-
]
|
|
59
|
-
];
|
|
60
|
-
pactffi_with_header: [
|
|
61
|
-
'void',
|
|
62
|
-
[
|
|
63
|
-
typeof InteractionHandle,
|
|
64
|
-
'int',
|
|
65
|
-
'string',
|
|
66
|
-
'int',
|
|
67
|
-
'string'
|
|
68
|
-
]
|
|
69
|
-
];
|
|
70
|
-
pactffi_with_body: [
|
|
71
|
-
'void',
|
|
72
|
-
[
|
|
73
|
-
typeof InteractionHandle,
|
|
74
|
-
'int',
|
|
75
|
-
'string',
|
|
76
|
-
'string'
|
|
77
|
-
]
|
|
78
|
-
];
|
|
79
|
-
pactffi_with_binary_file: [
|
|
80
|
-
'void',
|
|
81
|
-
[
|
|
82
|
-
typeof InteractionHandle,
|
|
83
|
-
'int',
|
|
84
|
-
'string',
|
|
85
|
-
'string',
|
|
86
|
-
'int'
|
|
87
|
-
]
|
|
88
|
-
];
|
|
89
|
-
pactffi_with_multipart_file: [
|
|
90
|
-
'void',
|
|
91
|
-
[
|
|
92
|
-
typeof InteractionHandle,
|
|
93
|
-
'int',
|
|
94
|
-
'string',
|
|
95
|
-
'string',
|
|
96
|
-
'string'
|
|
97
|
-
]
|
|
98
|
-
];
|
|
99
|
-
pactffi_response_status: ['void', [typeof InteractionHandle, 'int']];
|
|
100
|
-
pactffi_write_pact_file: ['int', ['int', 'string']];
|
|
101
|
-
pactffi_cleanup_mock_server: ['bool', ['int']];
|
|
102
|
-
pactffi_mock_server_mismatches: ['string', ['int']];
|
|
103
|
-
pactffi_get_tls_ca_certificate: ['string', []];
|
|
104
|
-
pactffi_log_message: ['void', ['string', 'string', 'string']];
|
|
105
|
-
pactffi_log_to_buffer: ['int', ['int']];
|
|
106
|
-
pactffi_init_with_log_level: ['void', ['int']];
|
|
107
|
-
pactffi_log_to_stdout: ['int', ['int']];
|
|
108
|
-
pactffi_log_to_file: ['int', ['string', 'int', 'int']];
|
|
109
|
-
pactffi_fetch_log_buffer: ['string', ['int']];
|
|
110
|
-
};
|
|
111
|
-
export declare const declarations: FfiDeclarations;
|
|
112
|
-
export declare enum FfiFunctionResult {
|
|
113
|
-
RESULT_OK = 0,
|
|
114
|
-
RESULT_FAILED = 1
|
|
115
|
-
}
|
|
116
|
-
export declare enum FfiSpecificationVersion {
|
|
117
|
-
SPECIFICATION_VERSION_UNKNOWN = 0,
|
|
118
|
-
SPECIFICATION_VERSION_V1 = 1,
|
|
119
|
-
SPECIFICATION_VERSION_V1_1 = 2,
|
|
120
|
-
SPECIFICATION_VERSION_V2 = 3,
|
|
121
|
-
SPECIFICATION_VERSION_V3 = 4,
|
|
122
|
-
SPECIFICATION_VERSION_V4 = 5
|
|
123
|
-
}
|
|
124
|
-
export declare enum FfiInteractionPart {
|
|
125
|
-
INTERACTION_PART_REQUEST = 0,
|
|
126
|
-
INTERACTION_PART_RESPONSE = 1
|
|
127
|
-
}
|
|
128
|
-
export declare enum FfiLogLevelFilter {
|
|
129
|
-
LOG_LEVEL_OFF = 0,
|
|
130
|
-
LOG_LEVEL_ERROR = 1,
|
|
131
|
-
LOG_LEVEL_WARN = 2,
|
|
132
|
-
LOG_LEVEL_INFO = 3,
|
|
133
|
-
LOG_LEVEL_DEBUG = 4,
|
|
134
|
-
LOG_LEVEL_TRACE = 5
|
|
135
|
-
}
|
|
136
|
-
export {};
|
package/src/ffi/declarations.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FfiLogLevelFilter = exports.FfiInteractionPart = exports.FfiSpecificationVersion = exports.FfiFunctionResult = exports.declarations = void 0;
|
|
4
|
-
var ref = require("ref-napi");
|
|
5
|
-
var refStructDi = require("ref-struct-di");
|
|
6
|
-
var struct = refStructDi(ref);
|
|
7
|
-
var unknown = ref.types.void;
|
|
8
|
-
var pact = unknown;
|
|
9
|
-
var interaction = unknown;
|
|
10
|
-
var InteractionPtr = ref.refType(interaction);
|
|
11
|
-
var PactPtr = ref.refType(pact);
|
|
12
|
-
var PactHandle = struct({
|
|
13
|
-
pact: PactPtr,
|
|
14
|
-
});
|
|
15
|
-
var InteractionHandle = struct({
|
|
16
|
-
pact: PactPtr,
|
|
17
|
-
interaction: InteractionPtr,
|
|
18
|
-
});
|
|
19
|
-
exports.declarations = {
|
|
20
|
-
pactffi_init: ['string', ['string']],
|
|
21
|
-
pactffi_version: ['string', []],
|
|
22
|
-
pactffi_free_string: ['void', ['string']],
|
|
23
|
-
pactffi_verify: ['int', ['string']],
|
|
24
|
-
pactffi_create_mock_server_for_pact: ['int', [PactHandle, 'string', 'bool']],
|
|
25
|
-
pactffi_new_pact: [PactHandle, ['string', 'string']],
|
|
26
|
-
pactffi_with_specification: ['void', [PactHandle, 'int']],
|
|
27
|
-
pactffi_new_interaction: [InteractionHandle, [PactHandle, 'string']],
|
|
28
|
-
pactffi_upon_receiving: ['void', [InteractionHandle, 'string']],
|
|
29
|
-
pactffi_given: ['void', [InteractionHandle, 'string']],
|
|
30
|
-
pactffi_given_with_param: [
|
|
31
|
-
'void',
|
|
32
|
-
[InteractionHandle, 'string', 'string', 'string'],
|
|
33
|
-
],
|
|
34
|
-
pactffi_with_request: ['void', [InteractionHandle, 'string', 'string']],
|
|
35
|
-
pactffi_with_query_parameter: [
|
|
36
|
-
'void',
|
|
37
|
-
[InteractionHandle, 'string', 'int', 'string'],
|
|
38
|
-
],
|
|
39
|
-
pactffi_with_header: [
|
|
40
|
-
'void',
|
|
41
|
-
[InteractionHandle, 'int', 'string', 'int', 'string'],
|
|
42
|
-
],
|
|
43
|
-
pactffi_with_body: ['void', [InteractionHandle, 'int', 'string', 'string']],
|
|
44
|
-
pactffi_with_binary_file: [
|
|
45
|
-
'void',
|
|
46
|
-
[InteractionHandle, 'int', 'string', 'string', 'int'],
|
|
47
|
-
],
|
|
48
|
-
pactffi_with_multipart_file: [
|
|
49
|
-
'void',
|
|
50
|
-
[InteractionHandle, 'int', 'string', 'string', 'string'],
|
|
51
|
-
],
|
|
52
|
-
pactffi_response_status: ['void', [InteractionHandle, 'int']],
|
|
53
|
-
pactffi_write_pact_file: ['int', ['int', 'string']],
|
|
54
|
-
pactffi_cleanup_mock_server: ['bool', ['int']],
|
|
55
|
-
pactffi_mock_server_mismatches: ['string', ['int']],
|
|
56
|
-
pactffi_get_tls_ca_certificate: ['string', []],
|
|
57
|
-
pactffi_log_message: ['void', ['string', 'string', 'string']],
|
|
58
|
-
pactffi_log_to_buffer: ['int', ['int']],
|
|
59
|
-
pactffi_init_with_log_level: ['void', ['int']],
|
|
60
|
-
pactffi_fetch_log_buffer: ['string', ['int']],
|
|
61
|
-
pactffi_log_to_stdout: ['int', ['int']],
|
|
62
|
-
pactffi_log_to_file: ['int', ['string', 'int', 'int']],
|
|
63
|
-
};
|
|
64
|
-
var FfiFunctionResult;
|
|
65
|
-
(function (FfiFunctionResult) {
|
|
66
|
-
FfiFunctionResult[FfiFunctionResult["RESULT_OK"] = 0] = "RESULT_OK";
|
|
67
|
-
FfiFunctionResult[FfiFunctionResult["RESULT_FAILED"] = 1] = "RESULT_FAILED";
|
|
68
|
-
})(FfiFunctionResult = exports.FfiFunctionResult || (exports.FfiFunctionResult = {}));
|
|
69
|
-
var FfiSpecificationVersion;
|
|
70
|
-
(function (FfiSpecificationVersion) {
|
|
71
|
-
FfiSpecificationVersion[FfiSpecificationVersion["SPECIFICATION_VERSION_UNKNOWN"] = 0] = "SPECIFICATION_VERSION_UNKNOWN";
|
|
72
|
-
FfiSpecificationVersion[FfiSpecificationVersion["SPECIFICATION_VERSION_V1"] = 1] = "SPECIFICATION_VERSION_V1";
|
|
73
|
-
FfiSpecificationVersion[FfiSpecificationVersion["SPECIFICATION_VERSION_V1_1"] = 2] = "SPECIFICATION_VERSION_V1_1";
|
|
74
|
-
FfiSpecificationVersion[FfiSpecificationVersion["SPECIFICATION_VERSION_V2"] = 3] = "SPECIFICATION_VERSION_V2";
|
|
75
|
-
FfiSpecificationVersion[FfiSpecificationVersion["SPECIFICATION_VERSION_V3"] = 4] = "SPECIFICATION_VERSION_V3";
|
|
76
|
-
FfiSpecificationVersion[FfiSpecificationVersion["SPECIFICATION_VERSION_V4"] = 5] = "SPECIFICATION_VERSION_V4";
|
|
77
|
-
})(FfiSpecificationVersion = exports.FfiSpecificationVersion || (exports.FfiSpecificationVersion = {}));
|
|
78
|
-
var FfiInteractionPart;
|
|
79
|
-
(function (FfiInteractionPart) {
|
|
80
|
-
FfiInteractionPart[FfiInteractionPart["INTERACTION_PART_REQUEST"] = 0] = "INTERACTION_PART_REQUEST";
|
|
81
|
-
FfiInteractionPart[FfiInteractionPart["INTERACTION_PART_RESPONSE"] = 1] = "INTERACTION_PART_RESPONSE";
|
|
82
|
-
})(FfiInteractionPart = exports.FfiInteractionPart || (exports.FfiInteractionPart = {}));
|
|
83
|
-
var FfiLogLevelFilter;
|
|
84
|
-
(function (FfiLogLevelFilter) {
|
|
85
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_OFF"] = 0] = "LOG_LEVEL_OFF";
|
|
86
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_ERROR"] = 1] = "LOG_LEVEL_ERROR";
|
|
87
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_WARN"] = 2] = "LOG_LEVEL_WARN";
|
|
88
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_INFO"] = 3] = "LOG_LEVEL_INFO";
|
|
89
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_DEBUG"] = 4] = "LOG_LEVEL_DEBUG";
|
|
90
|
-
FfiLogLevelFilter[FfiLogLevelFilter["LOG_LEVEL_TRACE"] = 5] = "LOG_LEVEL_TRACE";
|
|
91
|
-
})(FfiLogLevelFilter = exports.FfiLogLevelFilter || (exports.FfiLogLevelFilter = {}));
|
|
92
|
-
//# sourceMappingURL=declarations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["declarations.ts"],"names":[],"mappings":";;;AAAA,8BAAiC;AACjC,2CAA8C;AAE9C,IAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AAEhC,IAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;AAE/B,IAAM,IAAI,GAAG,OAAO,CAAC;AACrB,IAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,IAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAChD,IAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAClC,IAAM,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,OAAO;CACd,CAAC,CAAC;AACH,IAAM,iBAAiB,GAAG,MAAM,CAAC;IAC/B,IAAI,EAA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Y,uBAOX;AAPD,WAAY,uBAAuB;IACjC,uHAAiC,CAAA;IACjC,6GAAwB,CAAA;IACxB,iHAA0B,CAAA;IAC1B,6GAAwB,CAAA;IACxB,6GAAwB,CAAA;IACxB,6GAAwB,CAAA;AAC1B,CAAC,EAPW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAOlC;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,mGAA4B,CAAA;IAC5B,qGAAyB,CAAA;AAC3B,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B;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"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare type AsyncFfiCall<Args extends unknown[], ReturnType> = {
|
|
2
|
-
async: (...args: [...Args, (err: Error, ret: ReturnType) => void]) => ReturnType;
|
|
3
|
-
};
|
|
4
|
-
declare type FfiFunction<T> = T extends (...a: infer Args) => infer ReturnType ? T & AsyncFfiCall<Args, ReturnType> : never;
|
|
5
|
-
declare type VariableType = 'string' | 'void' | 'int' | 'double' | 'float' | any;
|
|
6
|
-
declare type ActualType<T> = [T] extends ['string'] ? string : [T] extends ['void'] ? void : [T] extends ['int' | 'double' | 'float'] ? number : T;
|
|
7
|
-
declare type ArrayActualType<Tuple extends [...Array<unknown>]> = {
|
|
8
|
-
[Index in keyof Tuple]: ActualType<Tuple[Index]>;
|
|
9
|
-
} & {
|
|
10
|
-
length: Tuple['length'];
|
|
11
|
-
};
|
|
12
|
-
declare type TupleType = [VariableType, Array<VariableType>];
|
|
13
|
-
declare type FunctionFromArray<A extends TupleType> = A extends [
|
|
14
|
-
r: infer ReturnType,
|
|
15
|
-
args: [...infer ArgArrayType]
|
|
16
|
-
] ? (...args: ArrayActualType<ArgArrayType>) => ActualType<ReturnType> : never;
|
|
17
|
-
declare type LibDescription<Functions extends string> = {
|
|
18
|
-
[k in Functions]: [VariableType, Array<VariableType>];
|
|
19
|
-
};
|
|
20
|
-
export declare type FfiBinding<T> = T extends LibDescription<string> ? {
|
|
21
|
-
[Key in keyof T]: FfiFunction<FunctionFromArray<T[Key]>>;
|
|
22
|
-
} : never;
|
|
23
|
-
export {};
|