@pact-foundation/pact-core 13.4.1-beta.16 → 13.4.1-beta.17
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/build/Makefile +1 -1
- package/ffi/libpact_ffi.dylib +0 -0
- package/{native/pact.h → ffi/pact-cpp.h} +0 -0
- package/native/consumer.cc +1 -1
- package/native/ffi.cc +1 -1
- package/{src/ffi/pact.h → native/pact-cpp.h} +57 -12
- package/native/plugin.cc +1 -1
- package/native/provider.cc +1 -10
- package/package.json +1 -1
- package/src/verifier/nativeVerifier.js +7 -3
- package/src/verifier/nativeVerifier.js.map +1 -1
- package/ffi/libpact_ffi.dylib.gz +0 -0
- package/ffi/libpact_ffi.so.gz +0 -0
- package/ffi/osxaarch64/libpact_ffi.dylib.gz +0 -0
- package/ffi/pact_ffi.dll.gz +0 -0
- package/ffi/pact_ffi.dll.lib.gz +0 -0
- package/native/provider.cc.bak +0 -749
package/build/Makefile
CHANGED
|
@@ -337,7 +337,7 @@ endif
|
|
|
337
337
|
|
|
338
338
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
339
339
|
cmd_regen_makefile = cd $(srcdir); /Users/matthewfellows/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/matthewfellows/Library/Caches/node-gyp/12.18.0" "-Dnode_gyp_dir=/Users/matthewfellows/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/matthewfellows/Library/Caches/node-gyp/12.18.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/matthewfellows/development/public/pact-js-core" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/matthewfellows/development/public/pact-js-core/build/config.gypi -I/Users/matthewfellows/.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/matthewfellows/Library/Caches/node-gyp/12.18.0/include/node/common.gypi "--toplevel-dir=." binding.gyp
|
|
340
|
-
Makefile: $(srcdir)
|
|
340
|
+
Makefile: $(srcdir)/../../../Library/Caches/node-gyp/12.18.0/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../.nvm/versions/node/v12.18.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
|
|
341
341
|
$(call do_cmd,regen_makefile)
|
|
342
342
|
|
|
343
343
|
# "all" is a concatenation of the "all" targets from all the included
|
package/ffi/libpact_ffi.dylib
CHANGED
|
Binary file
|
|
File without changes
|
package/native/consumer.cc
CHANGED
package/native/ffi.cc
CHANGED
|
@@ -281,7 +281,7 @@ const char *pactffi_version();
|
|
|
281
281
|
*
|
|
282
282
|
* # Safety
|
|
283
283
|
*
|
|
284
|
-
*
|
|
284
|
+
* log_env_var must be a valid NULL terminated UTF-8 string.
|
|
285
285
|
*/
|
|
286
286
|
void pactffi_init(const char *log_env_var);
|
|
287
287
|
|
|
@@ -294,6 +294,15 @@ void pactffi_init(const char *log_env_var);
|
|
|
294
294
|
*/
|
|
295
295
|
void pactffi_init_with_log_level(const char *level);
|
|
296
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Enable ANSI coloured output on Windows. On non-Windows platforms, this function is a no-op.
|
|
299
|
+
*
|
|
300
|
+
* # Safety
|
|
301
|
+
*
|
|
302
|
+
* This function is safe.
|
|
303
|
+
*/
|
|
304
|
+
void pactffi_enable_ansi_support();
|
|
305
|
+
|
|
297
306
|
/**
|
|
298
307
|
* Log using the shared core logging facility.
|
|
299
308
|
*
|
|
@@ -1946,7 +1955,7 @@ VerifierHandle *pactffi_verifier_new();
|
|
|
1946
1955
|
*
|
|
1947
1956
|
* Returns NULL on error.
|
|
1948
1957
|
*/
|
|
1949
|
-
VerifierHandle *pactffi_verifier_new_for_application(const char *name, const char *
|
|
1958
|
+
VerifierHandle *pactffi_verifier_new_for_application(const char *name, const char *version);
|
|
1950
1959
|
|
|
1951
1960
|
/**
|
|
1952
1961
|
* Shutdown the verifier and release all resources
|
|
@@ -2006,9 +2015,8 @@ void pactffi_verifier_set_provider_state(VerifierHandle *handle,
|
|
|
2006
2015
|
unsigned char body);
|
|
2007
2016
|
|
|
2008
2017
|
/**
|
|
2009
|
-
* Set the
|
|
2018
|
+
* Set the options used by the verifier when calling the provider
|
|
2010
2019
|
*
|
|
2011
|
-
* `publish` is a boolean value. Set it to greater than zero to turn the option on.
|
|
2012
2020
|
* `disable_ssl_verification` is a boolean value. Set it to greater than zero to turn the option on.
|
|
2013
2021
|
*
|
|
2014
2022
|
* # Safety
|
|
@@ -2018,13 +2026,33 @@ void pactffi_verifier_set_provider_state(VerifierHandle *handle,
|
|
|
2018
2026
|
*
|
|
2019
2027
|
*/
|
|
2020
2028
|
int pactffi_verifier_set_verification_options(VerifierHandle *handle,
|
|
2021
|
-
unsigned char publish,
|
|
2022
|
-
const char *provider_version,
|
|
2023
|
-
const char *build_url,
|
|
2024
2029
|
unsigned char disable_ssl_verification,
|
|
2025
|
-
unsigned long request_timeout
|
|
2026
|
-
|
|
2027
|
-
|
|
2030
|
+
unsigned long request_timeout);
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Set the options used when publishing verification results to the Pact Broker
|
|
2034
|
+
*
|
|
2035
|
+
* # Args
|
|
2036
|
+
*
|
|
2037
|
+
* - `handle` - The pact verifier handle to update
|
|
2038
|
+
* - `provider_version` - Version of the provider to publish
|
|
2039
|
+
* - `build_url` - URL to the build which ran the verification
|
|
2040
|
+
* - `provider_tags` - Collection of tags for the provider
|
|
2041
|
+
* - `provider_tags_len` - Number of provider tags supplied
|
|
2042
|
+
* - `provider_branch` - Name of the branch used for verification
|
|
2043
|
+
*
|
|
2044
|
+
* # Safety
|
|
2045
|
+
*
|
|
2046
|
+
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
2047
|
+
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
2048
|
+
*
|
|
2049
|
+
*/
|
|
2050
|
+
int pactffi_verifier_set_publish_options(VerifierHandle *handle,
|
|
2051
|
+
const char *provider_version,
|
|
2052
|
+
const char *build_url,
|
|
2053
|
+
const char *const *provider_tags,
|
|
2054
|
+
unsigned short provider_tags_len,
|
|
2055
|
+
const char *provider_branch);
|
|
2028
2056
|
|
|
2029
2057
|
/**
|
|
2030
2058
|
* Set the consumer filters for the Pact verifier.
|
|
@@ -2095,7 +2123,6 @@ void pactffi_verifier_url_source(VerifierHandle *handle,
|
|
|
2095
2123
|
*/
|
|
2096
2124
|
void pactffi_verifier_broker_source(VerifierHandle *handle,
|
|
2097
2125
|
const char *url,
|
|
2098
|
-
const char *provider_name,
|
|
2099
2126
|
const char *username,
|
|
2100
2127
|
const char *password,
|
|
2101
2128
|
const char *token);
|
|
@@ -2123,7 +2150,6 @@ void pactffi_verifier_broker_source(VerifierHandle *handle,
|
|
|
2123
2150
|
*/
|
|
2124
2151
|
void pactffi_verifier_broker_source_with_selectors(VerifierHandle *handle,
|
|
2125
2152
|
const char *url,
|
|
2126
|
-
const char *provider_name,
|
|
2127
2153
|
const char *username,
|
|
2128
2154
|
const char *password,
|
|
2129
2155
|
const char *token,
|
|
@@ -2215,6 +2241,25 @@ const char *pactffi_verifier_logs(const VerifierHandle *handle);
|
|
|
2215
2241
|
*/
|
|
2216
2242
|
const char *pactffi_verifier_logs_for_provider(const char *provider_name);
|
|
2217
2243
|
|
|
2244
|
+
/**
|
|
2245
|
+
* Extracts the standard output for the verification run. The returned string will need to be
|
|
2246
|
+
* freed with the `free_string` function call to avoid leaking memory.
|
|
2247
|
+
*
|
|
2248
|
+
* * `strip_ansi` - This parameter controls ANSI escape codes. Setting it to a non-zero value
|
|
2249
|
+
* will cause the ANSI control codes to be stripped from the output.
|
|
2250
|
+
*
|
|
2251
|
+
* Will return a NULL pointer if the handle is invalid.
|
|
2252
|
+
*/
|
|
2253
|
+
const char *pactffi_verifier_output(const VerifierHandle *handle, unsigned char strip_ansi);
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Extracts the verification result as a JSON document. The returned string will need to be
|
|
2257
|
+
* freed with the `free_string` function call to avoid leaking memory.
|
|
2258
|
+
*
|
|
2259
|
+
* Will return a NULL pointer if the handle is invalid.
|
|
2260
|
+
*/
|
|
2261
|
+
const char *pactffi_verifier_json(const VerifierHandle *handle);
|
|
2262
|
+
|
|
2218
2263
|
/**
|
|
2219
2264
|
* Add a plugin to be used by the test. The plugin needs to be installed correctly for this
|
|
2220
2265
|
* function to work.
|
package/native/plugin.cc
CHANGED
package/native/provider.cc
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#include <napi.h>
|
|
2
2
|
#include <map>
|
|
3
|
-
#include "pact.h"
|
|
3
|
+
#include "pact-cpp.h"
|
|
4
4
|
#include <vector>
|
|
5
|
-
#include <iostream>
|
|
6
5
|
|
|
7
6
|
using namespace Napi;
|
|
8
7
|
|
|
@@ -13,7 +12,6 @@ std::map<int, VerifierHandle*> handles;
|
|
|
13
12
|
std::vector<const char*> cVec;
|
|
14
13
|
for(size_t i = 0; i < arr.Length(); i++) {
|
|
15
14
|
std::string tag = arr.Get(i).As<Napi::String>().Utf8Value();
|
|
16
|
-
std::cout << "element: " << tag.c_str() << "\n";
|
|
17
15
|
char *cstr = strdup(tag.c_str());
|
|
18
16
|
cVec.push_back(cstr);
|
|
19
17
|
}
|
|
@@ -109,8 +107,6 @@ Napi::Value PactffiVerifierNewForApplication(const Napi::CallbackInfo& info) {
|
|
|
109
107
|
Napi::Value PactffiVerifierExecute(const Napi::CallbackInfo& info) {
|
|
110
108
|
Napi::Env env = info.Env();
|
|
111
109
|
|
|
112
|
-
std::cout << "Pactffiverifierexecute \n";
|
|
113
|
-
|
|
114
110
|
if (info.Length() < 1) {
|
|
115
111
|
throw Napi::Error::New(env, "PactffiInit(arguments) received < 1 argument");
|
|
116
112
|
}
|
|
@@ -119,18 +115,13 @@ Napi::Value PactffiVerifierExecute(const Napi::CallbackInfo& info) {
|
|
|
119
115
|
throw Napi::Error::New(env, "PactffiInit(arguments) expected a number");
|
|
120
116
|
}
|
|
121
117
|
|
|
122
|
-
std::cout << "Pactffiverifierexecute 1 \n";
|
|
123
118
|
// Extract arguments to verifier
|
|
124
119
|
size_t handle = info[0].As<Napi::Number>().Uint32Value();
|
|
125
|
-
std::cout << "Pactffiverifierexecute 2 \n";
|
|
126
120
|
|
|
127
121
|
// Execute the function asynchronously
|
|
128
122
|
Napi::Function callback = info[1].As<Napi::Function>();
|
|
129
|
-
std::cout << "Pactffiverifierexecute 3 \n";
|
|
130
123
|
VerificationWorker* verificationWorker = new VerificationWorker(callback, handle);
|
|
131
|
-
std::cout << "Pactffiverifierexecute 4 \n";
|
|
132
124
|
verificationWorker->Queue();
|
|
133
|
-
std::cout << "Pactffiverifierexecute 5 \n";
|
|
134
125
|
|
|
135
126
|
return info.Env().Undefined();
|
|
136
127
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pact-foundation/pact-core",
|
|
3
|
-
"version": "13.4.1-beta.
|
|
3
|
+
"version": "13.4.1-beta.17",
|
|
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",
|
|
@@ -21,6 +21,10 @@ var verify = function (opts) {
|
|
|
21
21
|
if (opts.providerStatesSetupUrl) {
|
|
22
22
|
ffi.pactffiVerifierSetProviderState(handle, opts.providerStatesSetupUrl, opts.providerStatesSetupTeardown || true, opts.providerStatesSetupBody || true);
|
|
23
23
|
}
|
|
24
|
+
var filterDescription = process.env.PACT_DESCRIPTION || '';
|
|
25
|
+
var filterState = process.env.PACT_PROVIDER_STATE || '';
|
|
26
|
+
var filterNoState = process.env.PACT_PROVIDER_NO_STATE ? true : false;
|
|
27
|
+
ffi.pactffiVerifierSetFilterInfo(handle, filterDescription, filterState, filterNoState);
|
|
24
28
|
if (opts.pactUrls) {
|
|
25
29
|
opts.pactUrls.forEach(function (file) {
|
|
26
30
|
logger_1.default.debug("checking source type of given pactUrl: " + file);
|
|
@@ -53,15 +57,15 @@ var verify = function (opts) {
|
|
|
53
57
|
}
|
|
54
58
|
if (opts.publishVerificationResult ||
|
|
55
59
|
opts.providerVersion ||
|
|
56
|
-
opts.publishVerificationResult ||
|
|
57
60
|
opts.buildUrl ||
|
|
58
61
|
opts.disableSslVerification ||
|
|
59
62
|
opts.timeout ||
|
|
60
63
|
opts.providerVersionTags) {
|
|
61
64
|
ffi.pactffiVerifierSetPublishOptions(handle, opts.providerVersion || '', opts.buildUrl || '', opts.providerVersionTags || [], opts.providerBranch || '');
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
var brokerUrl = opts.pactBrokerUrl || process.env.PACT_BROKER_BASE_URL;
|
|
67
|
+
if (brokerUrl && opts.provider) {
|
|
68
|
+
ffi.pactffiVerifierBrokerSourceWithSelectors(handle, brokerUrl, opts.pactBrokerUsername || process.env.PACT_BROKER_USERNAME || '', opts.pactBrokerPassword || process.env.PACT_BROKER_PASSWORD || '', opts.pactBrokerToken || process.env.PACT_BROKER_TOKEN || '', opts.enablePending || false, opts.includeWipPactsSince || '', opts.providerVersionTags || [], opts.providerBranch || '', opts.consumerVersionSelectors
|
|
65
69
|
? objArrayToStringArray(opts.consumerVersionSelectors)
|
|
66
70
|
: [], opts.consumerVersionTags || []);
|
|
67
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeVerifier.js","sourceRoot":"","sources":["nativeVerifier.ts"],"names":[],"mappings":";;;AACA,oCAAgD;AAChD,8BAAmC;AACnC,sCAAwD;AACxD,2BAA0B;AAG1B,IAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1C,uBAA0B;AAE1B,IAAM,qBAAqB,GAAG,UA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C,oBAAoB,CAAC,CAAC,CAAC;wBACxC,MAAM;oBACR,KAAK,gCAAwB,CAAC,iBAAiB;wBAC7C,gBAAM,CAAC,SAAS,CACd,mDAAmD,CACpD,CAAC;wBACF,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;wBACpD,MAAM;oBACR;wBACE,gBAAM,CAAC,SAAS,CACd,wDAAwD,CACzD,CAAC;wBACF,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;wBACvC,MAAM;iBACT;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAvKW,QAAA,MAAM,UAuKjB"}
|
package/ffi/libpact_ffi.dylib.gz
DELETED
|
Binary file
|
package/ffi/libpact_ffi.so.gz
DELETED
|
Binary file
|
|
Binary file
|
package/ffi/pact_ffi.dll.gz
DELETED
|
Binary file
|
package/ffi/pact_ffi.dll.lib.gz
DELETED
|
Binary file
|
package/native/provider.cc.bak
DELETED
|
@@ -1,749 +0,0 @@
|
|
|
1
|
-
#include <napi.h>
|
|
2
|
-
#include <map>
|
|
3
|
-
#include "pact.h"
|
|
4
|
-
|
|
5
|
-
using namespace Napi;
|
|
6
|
-
|
|
7
|
-
// To save passing the struct around. Remove once the rust types are made opaque
|
|
8
|
-
std::map<int, VerifierHandle*> handles;
|
|
9
|
-
|
|
10
|
-
// https://stackoverflow.com/questions/6701816/how-to-use-a-stdvector-in-a-c-function
|
|
11
|
-
// TODO: maybe just need to pass the vector in?
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
&// char** NapiArrayToCStringVector(Napi::Array arr) [0]{
|
|
15
|
-
// // const char *cArr[arr.Length()];
|
|
16
|
-
// const char *cArr[10];
|
|
17
|
-
// // for(int i = 0; i < arr.Length(); i++) {
|
|
18
|
-
// // std::string tag = arr[i].As<Napi::String>().Utf8Value();
|
|
19
|
-
// // cArr[i] = tag.c_str();
|
|
20
|
-
// // }
|
|
21
|
-
|
|
22
|
-
// return cArr
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
|
-
class VerificationWorker : public AsyncWorker {
|
|
26
|
-
public:
|
|
27
|
-
VerificationWorker(Function& callback, size_t handle)
|
|
28
|
-
: AsyncWorker(callback), handle(handle) {}
|
|
29
|
-
|
|
30
|
-
~VerificationWorker() {}
|
|
31
|
-
|
|
32
|
-
// This code will be executed on the worker thread
|
|
33
|
-
void Execute() override {
|
|
34
|
-
result = pactffi_verifier_execute(handles[handle]);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void OnOK() override {
|
|
38
|
-
HandleScope scope(Env());
|
|
39
|
-
Callback().Call({Env().Null(), Number::New(Env(), result)});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private:
|
|
43
|
-
int result;
|
|
44
|
-
int handle;
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* External interface to verifier a provider
|
|
50
|
-
*
|
|
51
|
-
* * `args` - the same as the CLI interface, except newline delimited
|
|
52
|
-
*
|
|
53
|
-
* # Errors
|
|
54
|
-
*
|
|
55
|
-
* Errors are returned as non-zero numeric values.
|
|
56
|
-
*
|
|
57
|
-
* | Error | Description |
|
|
58
|
-
* |-------|-------------|
|
|
59
|
-
* | 1 | The verification process failed, see output for errors |
|
|
60
|
-
* | 2 | A null pointer was received |
|
|
61
|
-
* | 3 | The method panicked |
|
|
62
|
-
* | 4 | Invalid arguments were provided to the verification process |
|
|
63
|
-
*
|
|
64
|
-
* # Safety
|
|
65
|
-
*
|
|
66
|
-
* Exported functions are inherently unsafe. Deal.
|
|
67
|
-
*
|
|
68
|
-
* C interface:
|
|
69
|
-
*
|
|
70
|
-
* int32_t pactffi_verify(const char *args);
|
|
71
|
-
*/
|
|
72
|
-
Napi::Value PactffiVerifierExecute(const Napi::CallbackInfo& info) {
|
|
73
|
-
Napi::Env env = info.Env();
|
|
74
|
-
if (info.Length() < 1) {
|
|
75
|
-
throw Napi::Error::New(env, "PactffiInit(arguments) received < 1 argument");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!info[0].IsNumber()) {
|
|
79
|
-
throw Napi::Error::New(env, "PactffiInit(arguments) expected a number");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Extract arguments to verifier
|
|
83
|
-
size_t handle = info[0].As<Napi::Number>().Uint32Value();
|
|
84
|
-
|
|
85
|
-
// Execute the function asynchronously
|
|
86
|
-
Napi::Function callback = info[1].As<Napi::Function>();
|
|
87
|
-
VerificationWorker* verificationWorker = new VerificationWorker(callback, handle);
|
|
88
|
-
verificationWorker->Queue();
|
|
89
|
-
|
|
90
|
-
return info.Env().Undefined();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get a Handle to a newly created verifier. You should call `pactffi_verifier_shutdown` when
|
|
95
|
-
* done with the verifier to free all allocated resources
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* Returns a new `VerifierHandle`.
|
|
99
|
-
*
|
|
100
|
-
* C interface:
|
|
101
|
-
*
|
|
102
|
-
* struct VerifierHandle *pactffi_verifier_new_for_application(const char *name, const char *version);
|
|
103
|
-
*
|
|
104
|
-
*/
|
|
105
|
-
Napi::Value PactffiVerifierNewForApplication(const Napi::CallbackInfo& info) {
|
|
106
|
-
Napi::Env env = info.Env();
|
|
107
|
-
if (info.Length() < 2) {
|
|
108
|
-
throw Napi::Error::New(env, "PactffiNewForApplication received < 2 arguments");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!info[0].IsString()) {
|
|
112
|
-
throw Napi::Error::New(env, "PactffiNewForApplication(arg 0) expected a string");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (!info[2].IsString()) {
|
|
116
|
-
throw Napi::Error::New(env, "PactffiNewForApplication(arg 1) expected a string");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Extract arguments to verifier
|
|
120
|
-
std::string name = info[0].As<Napi::String>().Utf8Value();
|
|
121
|
-
std::string version = info[1].As<Napi::String>().Utf8Value();
|
|
122
|
-
|
|
123
|
-
// Store the pointer
|
|
124
|
-
VerifierHandle *handle = pactffi_verifier_new_for_application(name.c_str(), version.c_str());
|
|
125
|
-
handles[handles.size()] = handle;
|
|
126
|
-
|
|
127
|
-
return Number::New(env, handles.size() - 1);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Shutdown the verifier and release all resources
|
|
132
|
-
*
|
|
133
|
-
* C interface:
|
|
134
|
-
*
|
|
135
|
-
* void pactffi_verifier_shutdown(VerifierHandle *handle);
|
|
136
|
-
*
|
|
137
|
-
*/
|
|
138
|
-
Napi::Value PactffiVerifierShutdown(const Napi::CallbackInfo& info) {
|
|
139
|
-
Napi::Env env = info.Env();
|
|
140
|
-
if (info.Length() < 1) {
|
|
141
|
-
throw Napi::Error::New(env, "PactffiVerifierShutdown received < 1 argument");
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (!info[0].IsNumber()) {
|
|
145
|
-
throw Napi::Error::New(env, "PactffiVerifierShutdown(arg 0) expected a VerifierHandle (uint32_t)");
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
149
|
-
|
|
150
|
-
pactffi_verifier_shutdown(handles[handleId]);
|
|
151
|
-
|
|
152
|
-
return info.Env().Undefined();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Set the provider details for the Pact verifier. Passing a NULL for any field will
|
|
158
|
-
* use the default value for that field.
|
|
159
|
-
*
|
|
160
|
-
* # Safety
|
|
161
|
-
*
|
|
162
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
163
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
164
|
-
*
|
|
165
|
-
* C interface:
|
|
166
|
-
*
|
|
167
|
-
* void pactffi_verifier_set_provider_info(VerifierHandle *handle,
|
|
168
|
-
* const char *name,
|
|
169
|
-
* const char *scheme,
|
|
170
|
-
* const char *host,
|
|
171
|
-
* unsigned short port,
|
|
172
|
-
* const char *path);
|
|
173
|
-
*
|
|
174
|
-
* */
|
|
175
|
-
Napi::Value pactffiVerifierSetProviderInfo(const Napi::CallbackInfo& info) {
|
|
176
|
-
Napi::Env env = info.Env();
|
|
177
|
-
if (info.Length() < 6) {
|
|
178
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo received < 6 arguments");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (!info[0].IsNumber()) {
|
|
182
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo(arg 0) expected a VerifierHandle");
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (!info[1].IsString()) {
|
|
186
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo(arg 1) expected a string");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (!info[2].IsString()) {
|
|
190
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo(arg 2 expected a string");
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (!info[3].IsString()) {
|
|
194
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo(arg 3 expected a string");
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (!info[4].IsNumber()) {
|
|
198
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo(arg 4) expected a number");
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (!info[5].IsString()) {
|
|
202
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderInfo(arg 5) expected a string");
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
206
|
-
std::string name = info[1].As<Napi::String>().Utf8Value();
|
|
207
|
-
std::string scheme = info[2].As<Napi::String>().Utf8Value();
|
|
208
|
-
std::string host = info[3].As<Napi::String>().Utf8Value();
|
|
209
|
-
uint32_t port = info[4].As<Napi::Number>().Uint32Value();
|
|
210
|
-
std::string path = info[5].As<Napi::String>().Utf8Value();
|
|
211
|
-
|
|
212
|
-
pactffi_verifier_set_provider_info(handles[handleId], name.c_str(), scheme.c_str(), host.c_str(), port, path.c_str());
|
|
213
|
-
|
|
214
|
-
return info.Env().Undefined();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Set the filters for the Pact verifier.
|
|
219
|
-
*
|
|
220
|
-
* If `filter_description` is not empty, it needs to be as a regular expression.
|
|
221
|
-
*
|
|
222
|
-
* `filter_no_state` is a boolean value. Set it to greater than zero to turn the option on.
|
|
223
|
-
*
|
|
224
|
-
* # Safety
|
|
225
|
-
*
|
|
226
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
227
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
228
|
-
*
|
|
229
|
-
* C interface:
|
|
230
|
-
*
|
|
231
|
-
* void pactffi_verifier_set_filter_info(VerifierHandle *handle,
|
|
232
|
-
* const char *filter_description,
|
|
233
|
-
* const char *filter_state,
|
|
234
|
-
* unsigned char filter_no_state);
|
|
235
|
-
*/
|
|
236
|
-
Napi::Value pactffiVerifierSetFilterInfo(const Napi::CallbackInfo& info) {
|
|
237
|
-
Napi::Env env = info.Env();
|
|
238
|
-
if (info.Length() < 4) {
|
|
239
|
-
throw Napi::Error::New(env, "pactffiVerifierSetFilterInfo received < 4 arguments");
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (!info[0].IsNumber()) {
|
|
243
|
-
throw Napi::Error::New(env, "pactffiVerifierSetFilterInfo(arg 0) expected a VerifierHandle");
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (!info[1].IsString()) {
|
|
247
|
-
throw Napi::Error::New(env, "pactffiVerifierSetFilterInfo(arg 1) expected a string");
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (!info[2].IsString()) {
|
|
251
|
-
throw Napi::Error::New(env, "pactffiVerifierSetFilterInfo(arg 2 expected a string");
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (!info[3].IsBoolean()) {
|
|
255
|
-
throw Napi::Error::New(env, "pactffiVerifierSetFilterInfo(arg 3 expected a boolean");
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
259
|
-
std::string description = info[1].As<Napi::String>().Utf8Value();
|
|
260
|
-
std::string filterState = info[2].As<Napi::String>().Utf8Value();
|
|
261
|
-
bool filterNoState = info[3].As<Napi::Boolean>().Value();
|
|
262
|
-
|
|
263
|
-
pactffi_verifier_set_filter_info(handles[handleId], description.c_str(), filterState.c_str(), filterNoState);
|
|
264
|
-
|
|
265
|
-
return info.Env().Undefined();
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Set the provider state for the Pact verifier.
|
|
270
|
-
*
|
|
271
|
-
* `teardown` is a boolean value. Set it to greater than zero to turn the option on.
|
|
272
|
-
* `body` is a boolean value. Set it to greater than zero to turn the option on.
|
|
273
|
-
*
|
|
274
|
-
* # Safety
|
|
275
|
-
*
|
|
276
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
277
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
278
|
-
*
|
|
279
|
-
* C interface:
|
|
280
|
-
*
|
|
281
|
-
* VerifierHandle *handle, const char *url, unsigned char teardown, unsigned char body);
|
|
282
|
-
*/
|
|
283
|
-
Napi::Value pactffiVerifierSetProviderState(const Napi::CallbackInfo& info) {
|
|
284
|
-
Napi::Env env = info.Env();
|
|
285
|
-
if (info.Length() < 4) {
|
|
286
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderState received < 4 arguments");
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (!info[0].IsNumber()) {
|
|
290
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderState(arg 0) expected a VerifierHandle");
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (!info[1].IsString()) {
|
|
294
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderState(arg 1) expected a string");
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (!info[2].IsBoolean()) {
|
|
298
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderState(arg 2 expected a boolean");
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (!info[3].IsBoolean()) {
|
|
302
|
-
throw Napi::Error::New(env, "pactffiVerifierSetProviderState(arg 3 expected a boolean");
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
306
|
-
std::string url = info[1].As<Napi::String>().Utf8Value();
|
|
307
|
-
bool teardown = info[2].As<Napi::Boolean>().Value();
|
|
308
|
-
bool body = info[3].As<Napi::Boolean>().Value();
|
|
309
|
-
|
|
310
|
-
pactffi_verifier_set_provider_state(handles[handleId], url.c_str(), teardown, body);
|
|
311
|
-
|
|
312
|
-
return info.Env().Undefined();
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// Deprecated in favour of pactffi_verifier_broker_source_with_selectors
|
|
316
|
-
// /**
|
|
317
|
-
// * Set the verification options for the Pact verifier.
|
|
318
|
-
// *
|
|
319
|
-
// * `publish` is a boolean value. Set it to greater than zero to turn the option on.
|
|
320
|
-
// * `disable_ssl_verification` is a boolean value. Set it to greater than zero to turn the option on.
|
|
321
|
-
// *
|
|
322
|
-
// * # Safety
|
|
323
|
-
// *
|
|
324
|
-
// * All string fields must contain valid UTF-8. Invalid UTF-8
|
|
325
|
-
// * will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
326
|
-
// *
|
|
327
|
-
// * C interface:
|
|
328
|
-
// *
|
|
329
|
-
// * int pactffi_verifier_set_verification_options(VerifierHandle *handle,
|
|
330
|
-
// * unsigned char publish,
|
|
331
|
-
// * const char *provider_version,
|
|
332
|
-
// * const char *build_url,
|
|
333
|
-
// * unsigned char disable_ssl_verification,
|
|
334
|
-
// * unsigned long request_timeout,
|
|
335
|
-
// * const char *const *provider_tags,
|
|
336
|
-
// * unsigned short provider_tags_len);
|
|
337
|
-
// *
|
|
338
|
-
// */
|
|
339
|
-
// Napi::Value pactffiVerifierSetVerificationOptions(const Napi::CallbackInfo& info) {
|
|
340
|
-
// Napi::Env env = info.Env();
|
|
341
|
-
// if (info.Length() < 7) {
|
|
342
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions received < 7 arguments");
|
|
343
|
-
// }
|
|
344
|
-
|
|
345
|
-
// if (!info[0].IsNumber()) {
|
|
346
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 0) expected a VerifierHandle");
|
|
347
|
-
// }
|
|
348
|
-
|
|
349
|
-
// if (!info[1].IsBoolean()) {
|
|
350
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 1) expected a boolean");
|
|
351
|
-
// }
|
|
352
|
-
|
|
353
|
-
// if (!info[2].IsString()) {
|
|
354
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 2 expected a string");
|
|
355
|
-
// }
|
|
356
|
-
|
|
357
|
-
// if (!info[3].IsString()) {
|
|
358
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 3 expected a string");
|
|
359
|
-
// }
|
|
360
|
-
|
|
361
|
-
// if (!info[4].IsBoolean()) {
|
|
362
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 4) expected a boolean");
|
|
363
|
-
// }
|
|
364
|
-
|
|
365
|
-
// if (!info[5].IsNumber()) {
|
|
366
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 5) expected a number");
|
|
367
|
-
// }
|
|
368
|
-
|
|
369
|
-
// if (!info[6].IsArray()) {
|
|
370
|
-
// throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 6) expected an array of strings");
|
|
371
|
-
// }
|
|
372
|
-
|
|
373
|
-
// uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
374
|
-
// bool publish = info[1].As<Napi::Boolean>().Value();
|
|
375
|
-
// std::string providerVersion = info[2].As<Napi::String>().Utf8Value();
|
|
376
|
-
// std::string buildUrl = info[3].As<Napi::String>().Utf8Value();
|
|
377
|
-
// bool disableSslVerification = info[4].As<Napi::Boolean>().Value();
|
|
378
|
-
// uint32_t requestTimeout = info[5].As<Napi::Number>().Uint32Value(); // Napi::Array providerTagsRaw = info[6].As<Napi::Array>();
|
|
379
|
-
|
|
380
|
-
// const char *providerTags[providerTagsRaw.Length()];
|
|
381
|
-
|
|
382
|
-
// for(int i = 0; i < providerTags.Length(); i++) {
|
|
383
|
-
// std::string tag = providerTagsRaw[i].As<Napi::String>().Utf8Value();
|
|
384
|
-
// providerTags[i] = tag.c_str();
|
|
385
|
-
// }
|
|
386
|
-
|
|
387
|
-
// pactffi_verifier_set_verification_options(handles[handleId],
|
|
388
|
-
// publish,
|
|
389
|
-
// providerVersion.c_str(),
|
|
390
|
-
// buildUrl.c_str(),
|
|
391
|
-
// disableSslVerification,
|
|
392
|
-
// requestTimeout,
|
|
393
|
-
// providerTags,
|
|
394
|
-
// providerTagsRaw.Length());
|
|
395
|
-
|
|
396
|
-
// return info.Env().Undefined();
|
|
397
|
-
// }
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Set the consumer filters for the Pact verifier.
|
|
401
|
-
*
|
|
402
|
-
* # Safety
|
|
403
|
-
*
|
|
404
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
405
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
406
|
-
*
|
|
407
|
-
* C interface:
|
|
408
|
-
*
|
|
409
|
-
* void pactffi_verifier_set_consumer_filters(VerifierHandle *handle,
|
|
410
|
-
* const char *const *consumer_filters,
|
|
411
|
-
* unsigned short consumer_filters_len);
|
|
412
|
-
*
|
|
413
|
-
*/
|
|
414
|
-
Napi::Value pactffiVerifierSetConsumerFilters(const Napi::CallbackInfo& info) {
|
|
415
|
-
Napi::Env env = info.Env();
|
|
416
|
-
if (info.Length() < 2) {
|
|
417
|
-
throw Napi::Error::New(env, "pactffiVerifierSetConsumerFilters received < 2 arguments");
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (!info[0].IsNumber()) {
|
|
421
|
-
throw Napi::Error::New(env, "pactffiVerifierSetConsumerFilters(arg 0) expected a VerifierHandle");
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
if (!info[1].IsArray()) {
|
|
425
|
-
throw Napi::Error::New(env, "pactffiVerifierSetConsumerFilters(arg 1) expected an array of strings");
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
429
|
-
Napi::Array consumerFilters = info[1].As<Napi::Array>();
|
|
430
|
-
|
|
431
|
-
pactffi_verifier_set_consumer_filters(handles[handleId],
|
|
432
|
-
&NapiArrayToCStringVector(consumerFilters)[0],
|
|
433
|
-
consumerFilters.Length());
|
|
434
|
-
|
|
435
|
-
return info.Env().Undefined();
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Adds a Pact file as a source to verify.
|
|
440
|
-
*
|
|
441
|
-
* # Safety
|
|
442
|
-
*
|
|
443
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
444
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
445
|
-
*
|
|
446
|
-
* C interface:
|
|
447
|
-
*
|
|
448
|
-
* void pactffi_verifier_add_file_source(VerifierHandle *handle, const char *file);
|
|
449
|
-
*/
|
|
450
|
-
Napi::Value pactffiVerifierAddFileSource(const Napi::CallbackInfo& info) {
|
|
451
|
-
Napi::Env env = info.Env();
|
|
452
|
-
if (info.Length() < 2) {
|
|
453
|
-
throw Napi::Error::New(env, "pactffiVerifierAddFileSource received < 2 arguments");
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (!info[0].IsNumber()) {
|
|
457
|
-
throw Napi::Error::New(env, "pactffiVerifierAddFileSource(arg 0) expected a VerifierHandle");
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
if (!info[1].IsString()) {
|
|
461
|
-
throw Napi::Error::New(env, "pactffiVerifierAddFileSource(arg 1) expected a string");
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
465
|
-
std::string file = info[1].As<Napi::String>().Utf8Value();
|
|
466
|
-
|
|
467
|
-
pactffi_verifier_add_file_source(handles[handleId], file.c_str());
|
|
468
|
-
|
|
469
|
-
return info.Env().Undefined();
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Adds a Pact directory as a source to verify. All pacts from the directory that match the
|
|
474
|
-
* provider name will be verified.
|
|
475
|
-
*
|
|
476
|
-
* # Safety
|
|
477
|
-
*
|
|
478
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
479
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
480
|
-
*
|
|
481
|
-
* C interface:
|
|
482
|
-
*
|
|
483
|
-
* void pactffi_verifier_add_directory_source(VerifierHandle *handle, const char *directory);
|
|
484
|
-
*/
|
|
485
|
-
Napi::Value pactffiVerifierAddDirectorySource(const Napi::CallbackInfo& info) {
|
|
486
|
-
Napi::Env env = info.Env();
|
|
487
|
-
if (info.Length() < 2) {
|
|
488
|
-
throw Napi::Error::New(env, "pactffiVerifierAddDirectorySource received < 2 arguments");
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
if (!info[0].IsNumber()) {
|
|
492
|
-
throw Napi::Error::New(env, "pactffiVerifierAddDirectorySource(arg 0) expected a VerifierHandle");
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
if (!info[1].IsString()) {
|
|
496
|
-
throw Napi::Error::New(env, "pactffiVerifierAddDirectorySource(arg 1) expected a string");
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
500
|
-
std::string dir = info[1].As<Napi::String>().Utf8Value();
|
|
501
|
-
|
|
502
|
-
pactffi_verifier_add_directory_source(handles[handleId], dir.c_str());
|
|
503
|
-
|
|
504
|
-
return info.Env().Undefined();
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Adds a URL as a source to verify. The Pact file will be fetched from the URL.
|
|
509
|
-
*
|
|
510
|
-
* If a username and password is given, then basic authentication will be used when fetching
|
|
511
|
-
* the pact file. If a token is provided, then bearer token authentication will be used.
|
|
512
|
-
*
|
|
513
|
-
* # Safety
|
|
514
|
-
*
|
|
515
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
516
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
517
|
-
*
|
|
518
|
-
* C interface:
|
|
519
|
-
*
|
|
520
|
-
* void pactffi_verifier_url_source(VerifierHandle *handle,
|
|
521
|
-
* const char *url,
|
|
522
|
-
* const char *username,
|
|
523
|
-
* const char *password,
|
|
524
|
-
* const char *token);
|
|
525
|
-
*/
|
|
526
|
-
Napi::Value pactffiVerifierUrlSource(const Napi::CallbackInfo& info) {
|
|
527
|
-
Napi::Env env = info.Env();
|
|
528
|
-
if (info.Length() < 5) {
|
|
529
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource received < 5 arguments");
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
if (!info[0].IsNumber()) {
|
|
533
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 0) expected a VerifierHandle");
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
if (!info[1].IsString()) {
|
|
537
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 1) expected a string");
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
if (!info[2].IsString()) {
|
|
541
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 2) expected a string");
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
if (!info[3].IsString()) {
|
|
545
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 3) expected a string");
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
if (!info[4].IsString()) {
|
|
549
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 4) expected a string");
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
553
|
-
std::string url = info[1].As<Napi::String>().Utf8Value();
|
|
554
|
-
std::string username = info[2].As<Napi::String>().Utf8Value();
|
|
555
|
-
std::string password = info[3].As<Napi::String>().Utf8Value();
|
|
556
|
-
std::string token = info[4].As<Napi::String>().Utf8Value();
|
|
557
|
-
|
|
558
|
-
pactffi_verifier_url_source(handles[handleId], url.c_str(), username.c_str(), password.c_str(), token.c_str());
|
|
559
|
-
|
|
560
|
-
return info.Env().Undefined();
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Adds a Pact broker as a source to verify. This will fetch all the pact files from the broker
|
|
565
|
-
* that match the provider name.
|
|
566
|
-
*
|
|
567
|
-
* If a username and password is given, then basic authentication will be used when fetching
|
|
568
|
-
* the pact file. If a token is provided, then bearer token authentication will be used.
|
|
569
|
-
*
|
|
570
|
-
* # Safety
|
|
571
|
-
*
|
|
572
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
573
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
574
|
-
*
|
|
575
|
-
* C interface:
|
|
576
|
-
*
|
|
577
|
-
* void pactffi_verifier_broker_source(VerifierHandle *handle,
|
|
578
|
-
* const char *url,
|
|
579
|
-
* const char *provider_name,
|
|
580
|
-
* const char *username,
|
|
581
|
-
* const char *password,
|
|
582
|
-
* const char *token);
|
|
583
|
-
*/
|
|
584
|
-
Napi::Value pactffiVerifierBrokerSource(const Napi::CallbackInfo& info) {
|
|
585
|
-
Napi::Env env = info.Env();
|
|
586
|
-
if (info.Length() < 6) {
|
|
587
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource received < 6 arguments");
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
if (!info[0].IsNumber()) {
|
|
591
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 0) expected a VerifierHandle");
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if (!info[1].IsString()) {
|
|
595
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 1) expected a string");
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
if (!info[2].IsString()) {
|
|
599
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 2) expected a string");
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
if (!info[3].IsString()) {
|
|
603
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 3) expected a string");
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (!info[4].IsString()) {
|
|
607
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 4) expected a string");
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
if (!info[5].IsString()) {
|
|
611
|
-
throw Napi::Error::New(env, "pactffiVerifierUrlSource(arg 5) expected a string");
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
615
|
-
std::string url = info[1].As<Napi::String>().Utf8Value();
|
|
616
|
-
std::string providerName = info[2].As<Napi::String>().Utf8Value();
|
|
617
|
-
std::string username = info[3].As<Napi::String>().Utf8Value();
|
|
618
|
-
std::string password = info[4].As<Napi::String>().Utf8Value();
|
|
619
|
-
std::string token = info[5].As<Napi::String>().Utf8Value();
|
|
620
|
-
|
|
621
|
-
pactffi_verifier_broker_source(handles[handleId], url.c_str(), providerName.c_str(), username.c_str(), password.c_str(), token.c_str());
|
|
622
|
-
|
|
623
|
-
return info.Env().Undefined();
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* Adds a Pact broker as a source to verify. This will fetch all the pact files from the broker
|
|
628
|
-
* that match the provider name and the consumer version selectors
|
|
629
|
-
* (See `https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors/`).
|
|
630
|
-
*
|
|
631
|
-
* The consumer version selectors must be passed in in JSON format.
|
|
632
|
-
*
|
|
633
|
-
* `enable_pending` is a boolean value. Set it to greater than zero to turn the option on.
|
|
634
|
-
*
|
|
635
|
-
* If the `include_wip_pacts_since` option is provided, it needs to be a date formatted in
|
|
636
|
-
* ISO format (YYYY-MM-DD).
|
|
637
|
-
*
|
|
638
|
-
* If a username and password is given, then basic authentication will be used when fetching
|
|
639
|
-
* the pact file. If a token is provided, then bearer token authentication will be used.
|
|
640
|
-
*
|
|
641
|
-
* # Safety
|
|
642
|
-
*
|
|
643
|
-
* All string fields must contain valid UTF-8. Invalid UTF-8
|
|
644
|
-
* will be replaced with U+FFFD REPLACEMENT CHARACTER.
|
|
645
|
-
*
|
|
646
|
-
* C interface:
|
|
647
|
-
*
|
|
648
|
-
* void pactffi_verifier_broker_source_with_selectors(VerifierHandle *handle,
|
|
649
|
-
* const char *url,
|
|
650
|
-
* const char *provider_name,
|
|
651
|
-
* const char *username,
|
|
652
|
-
* const char *password,
|
|
653
|
-
* const char *token,
|
|
654
|
-
* unsigned char enable_pending,
|
|
655
|
-
* const char *include_wip_pacts_since,
|
|
656
|
-
* const char *const *provider_tags,
|
|
657
|
-
* unsigned short provider_tags_len,
|
|
658
|
-
* const char *provider_branch,
|
|
659
|
-
* const char *const *consumer_version_selectors,
|
|
660
|
-
* unsigned short consumer_version_selectors_len,
|
|
661
|
-
* const char *const *consumer_version_tags,
|
|
662
|
-
* unsigned short consumer_version_tags_len);
|
|
663
|
-
*/
|
|
664
|
-
Napi::Value pactffi_verifier_broker_source_with_selectors(const Napi::CallbackInfo& info) {
|
|
665
|
-
Napi::Env env = info.Env();
|
|
666
|
-
if (info.Length() < 11) {
|
|
667
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions received < 11 arguments");
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
if (!info[0].IsNumber()) {
|
|
671
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 0) expected a VerifierHandle");
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
if (!info[1].IsString()) {
|
|
675
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 1 expected a string");
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
if (!info[2].IsString()) {
|
|
679
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 2 expected a string");
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
if (!info[3].IsString()) {
|
|
683
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 3 expected a string");
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
if (!info[4].IsString()) {
|
|
687
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 4 expected a string");
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (!info[5].IsString()) {
|
|
691
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 5 expected a string");
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
if (!info[6].IsBoolean()) {
|
|
695
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 6) expected a boolean");
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
if (!info[7].IsString()) {
|
|
699
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 7 expected a string");
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
if (!info[8].IsArray()) {
|
|
703
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 8) expected an array of strings");
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (!info[9].IsString()) {
|
|
707
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 9 expected a string");
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (!info[10].IsArray()) {
|
|
711
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 10) expected an array of strings");
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
if (!info[11].IsArray()) {
|
|
715
|
-
throw Napi::Error::New(env, "pactffiVerifierSetVerificationOptions(arg 11) expected an array of strings");
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
uint32_t handleId = info[0].As<Napi::Number>().Uint32Value();
|
|
719
|
-
std::string url = info[1].As<Napi::String>().Utf8Value();
|
|
720
|
-
std::string providerName = info[2].As<Napi::String>().Utf8Value();
|
|
721
|
-
std::string username = info[3].As<Napi::String>().Utf8Value();
|
|
722
|
-
std::string password = info[4].As<Napi::String>().Utf8Value();
|
|
723
|
-
std::string token = info[5].As<Napi::String>().Utf8Value();
|
|
724
|
-
bool enablePending = info[6].As<Napi::Boolean>().Value();
|
|
725
|
-
std::string includeWipPactsSince = info[7].As<Napi::String>().Utf8Value();
|
|
726
|
-
Napi::Array providerTags = info[8].As<Napi::Array>();
|
|
727
|
-
std::string providerBranch = info[9].As<Napi::String>().Utf8Value();
|
|
728
|
-
Napi::Array consumerVersionSelectors = info[10].As<Napi::Array>();
|
|
729
|
-
Napi::Array consumerVersionTags = info[11].As<Napi::Array>();
|
|
730
|
-
|
|
731
|
-
pactffi_verifier_broker_source_with_selectors(handles[handleId],
|
|
732
|
-
url.c_str(),
|
|
733
|
-
providerName.c_str(),
|
|
734
|
-
username.c_str(),
|
|
735
|
-
password.c_str(),
|
|
736
|
-
token.c_str(),
|
|
737
|
-
enablePending,
|
|
738
|
-
includeWipPactsSince.c_str(),
|
|
739
|
-
&NapiArrayToCStringVector(providerTags)[0],
|
|
740
|
-
providerTags.Length(),
|
|
741
|
-
providerBranch.c_str(),
|
|
742
|
-
&NapiArrayToCStringVector(consumerVersionSelectors)[0],
|
|
743
|
-
consumerVersionSelectors.Length(),
|
|
744
|
-
&NapiArrayToCStringVector(consumerVersionTags)[0],
|
|
745
|
-
consumerVersionTags.Length());
|
|
746
|
-
|
|
747
|
-
return info.Env().Undefined();
|
|
748
|
-
}
|
|
749
|
-
|