@pact-foundation/pact-core 13.13.0 → 13.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [13.13.2](https://github.com/pact-foundation/pact-js-core/compare/v13.13.1...v13.13.2) (2022-12-22)
6
+
7
+
8
+ ### Fixes and Improvements
9
+
10
+ * upgrade to latest ffi 0.3.19 ([1c5a4fe](https://github.com/pact-foundation/pact-js-core/commit/1c5a4fea66bf83fed530f10aba85793853fe157d))
11
+
12
+ ### [13.13.1](https://github.com/pact-foundation/pact-js-core/compare/v13.13.0...v13.13.1) (2022-12-19)
13
+
14
+
15
+ ### Fixes and Improvements
16
+
17
+ * update rust core to 0.3.18 ([d178c27](https://github.com/pact-foundation/pact-js-core/commit/d178c2784bb31e2bfe12585ad8d6f8d65dddf62b))
18
+
5
19
  ## [13.13.0](https://github.com/pact-foundation/pact-js-core/compare/v13.12.2...v13.13.0) (2022-12-02)
6
20
 
7
21
 
package/build/Makefile CHANGED
@@ -319,7 +319,7 @@ endif
319
319
 
320
320
  quiet_cmd_regen_makefile = ACTION Regenerating $@
321
321
  cmd_regen_makefile = cd $(srcdir); /opt/hostedtoolcache/node/16.18.1/x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/runner/.cache/node-gyp/16.18.1" "-Dnode_gyp_dir=/opt/hostedtoolcache/node/16.18.1/x64/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/home/runner/.cache/node-gyp/16.18.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/runner/work/pact-js-core/pact-js-core" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/runner/work/pact-js-core/pact-js-core/build/config.gypi -I/opt/hostedtoolcache/node/16.18.1/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/runner/.cache/node-gyp/16.18.1/include/node/common.gypi "--toplevel-dir=." binding.gyp
322
- Makefile: $(srcdir)/binding.gyp $(srcdir)/build/config.gypi $(srcdir)/../../../../../opt/hostedtoolcache/node/16.18.1/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/../../../.cache/node-gyp/16.18.1/include/node/common.gypi
322
+ Makefile: $(srcdir)/../../../.cache/node-gyp/16.18.1/include/node/common.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi $(srcdir)/../../../../../opt/hostedtoolcache/node/16.18.1/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
323
323
  $(call do_cmd,regen_makefile)
324
324
 
325
325
  # "all" is a concatenation of the "all" targets from all the included
Binary file
Binary file
Binary file
Binary file
Binary file
package/ffi/pact-cpp.h CHANGED
@@ -131,6 +131,38 @@ struct MatchingRuleDefinitionResult;
131
131
  */
132
132
  struct MatchingRuleIterator;
133
133
 
134
+ /**
135
+ * The matching rule or reference from parsing the matching definition expression.
136
+ *
137
+ * For matching rules, the ID corresponds to the following rules:
138
+ * | Rule | ID |
139
+ * | ---- | -- |
140
+ * | Equality | 1 |
141
+ * | Regex | 2 |
142
+ * | Type | 3 |
143
+ * | MinType | 4 |
144
+ * | MaxType | 5 |
145
+ * | MinMaxType | 6 |
146
+ * | Timestamp | 7 |
147
+ * | Time | 8 |
148
+ * | Date | 9 |
149
+ * | Include | 10 |
150
+ * | Number | 11 |
151
+ * | Integer | 12 |
152
+ * | Decimal | 13 |
153
+ * | Null | 14 |
154
+ * | ContentType | 15 |
155
+ * | ArrayContains | 16 |
156
+ * | Values | 17 |
157
+ * | Boolean | 18 |
158
+ * | StatusCode | 19 |
159
+ * | NotEmpty | 20 |
160
+ * | Semver | 21 |
161
+ * | EachKey | 22 |
162
+ * | EachValue | 23 |
163
+ */
164
+ struct MatchingRuleResult;
165
+
134
166
  /**
135
167
  * Struct that defines a message.
136
168
  */
@@ -283,65 +315,6 @@ struct ProviderStateParamPair {
283
315
  const char *value;
284
316
  };
285
317
 
286
- /**
287
- * The matching rule or reference from parsing the matching definition expression.
288
- *
289
- * For matching rules, the ID corresponds to the following rules:
290
- * | Rule | ID |
291
- * | ---- | -- |
292
- * | Equality | 1 |
293
- * | Regex | 2 |
294
- * | Type | 3 |
295
- * | MinType | 4 |
296
- * | MaxType | 5 |
297
- * | MinMaxType | 6 |
298
- * | Timestamp | 7 |
299
- * | Time | 8 |
300
- * | Date | 9 |
301
- * | Include | 10 |
302
- * | Number | 11 |
303
- * | Integer | 12 |
304
- * | Decimal | 13 |
305
- * | Null | 14 |
306
- * | ContentType | 15 |
307
- * | ArrayContains | 16 |
308
- * | Values | 17 |
309
- * | Boolean | 18 |
310
- * | StatusCode | 19 |
311
- * | NotEmpty | 20 |
312
- * | Semver | 21 |
313
- * | EachKey | 22 |
314
- * | EachValue | 23 |
315
- */
316
- struct MatchingRuleResult {
317
- enum class Tag {
318
- /**
319
- * The matching rule from the expression.
320
- */
321
- MatchingRuleResult_MatchingRule,
322
- /**
323
- * A reference to a named item.
324
- */
325
- MatchingRuleResult_MatchingReference,
326
- };
327
-
328
- struct MatchingRuleResult_MatchingRule_Body {
329
- uint16_t _0;
330
- const char *_1;
331
- const MatchingRule *_2;
332
- };
333
-
334
- struct MatchingRuleResult_MatchingReference_Body {
335
- const char *_0;
336
- };
337
-
338
- Tag tag;
339
- union {
340
- MatchingRuleResult_MatchingRule_Body matching_rule;
341
- MatchingRuleResult_MatchingReference_Body matching_reference;
342
- };
343
- };
344
-
345
318
  /**
346
319
  * Wraps a Pact model struct
347
320
  */
@@ -1988,6 +1961,118 @@ MatchingRuleIterator *pactffi_matcher_definition_iter(const MatchingRuleDefiniti
1988
1961
  */
1989
1962
  const MatchingRuleResult *pactffi_matching_rule_iter_next(MatchingRuleIterator *iter);
1990
1963
 
1964
+ /**
1965
+ * Return the ID of the matching rule.
1966
+ *
1967
+ * The ID corresponds to the following rules:
1968
+ * | Rule | ID |
1969
+ * | ---- | -- |
1970
+ * | Equality | 1 |
1971
+ * | Regex | 2 |
1972
+ * | Type | 3 |
1973
+ * | MinType | 4 |
1974
+ * | MaxType | 5 |
1975
+ * | MinMaxType | 6 |
1976
+ * | Timestamp | 7 |
1977
+ * | Time | 8 |
1978
+ * | Date | 9 |
1979
+ * | Include | 10 |
1980
+ * | Number | 11 |
1981
+ * | Integer | 12 |
1982
+ * | Decimal | 13 |
1983
+ * | Null | 14 |
1984
+ * | ContentType | 15 |
1985
+ * | ArrayContains | 16 |
1986
+ * | Values | 17 |
1987
+ * | Boolean | 18 |
1988
+ * | StatusCode | 19 |
1989
+ * | NotEmpty | 20 |
1990
+ * | Semver | 21 |
1991
+ * | EachKey | 22 |
1992
+ * | EachValue | 23 |
1993
+ *
1994
+ * # Safety
1995
+ *
1996
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
1997
+ * iterator has not been deleted.
1998
+ */
1999
+ uint16_t pactffi_matching_rule_id(const MatchingRuleResult *rule_result);
2000
+
2001
+ /**
2002
+ * Returns the associated value for the matching rule. If the matching rule does not have an
2003
+ * associated value, will return a NULL pointer.
2004
+ *
2005
+ * The associated values for the rules are:
2006
+ * | Rule | ID | VALUE |
2007
+ * | ---- | -- | ----- |
2008
+ * | Equality | 1 | NULL |
2009
+ * | Regex | 2 | Regex value |
2010
+ * | Type | 3 | NULL |
2011
+ * | MinType | 4 | Minimum value |
2012
+ * | MaxType | 5 | Maximum value |
2013
+ * | MinMaxType | 6 | "min:max" |
2014
+ * | Timestamp | 7 | Format string |
2015
+ * | Time | 8 | Format string |
2016
+ * | Date | 9 | Format string |
2017
+ * | Include | 10 | String value |
2018
+ * | Number | 11 | NULL |
2019
+ * | Integer | 12 | NULL |
2020
+ * | Decimal | 13 | NULL |
2021
+ * | Null | 14 | NULL |
2022
+ * | ContentType | 15 | Content type |
2023
+ * | ArrayContains | 16 | NULL |
2024
+ * | Values | 17 | NULL |
2025
+ * | Boolean | 18 | NULL |
2026
+ * | StatusCode | 19 | NULL |
2027
+ * | NotEmpty | 20 | NULL |
2028
+ * | Semver | 21 | NULL |
2029
+ * | EachKey | 22 | NULL |
2030
+ * | EachValue | 23 | NULL |
2031
+ *
2032
+ * Will return a NULL pointer if the matching rule was a reference or does not have an
2033
+ * associated value.
2034
+ *
2035
+ * # Safety
2036
+ *
2037
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
2038
+ * iterator it came from has not been deleted.
2039
+ */
2040
+ const char *pactffi_matching_rule_value(const MatchingRuleResult *rule_result);
2041
+
2042
+ /**
2043
+ * Returns the matching rule pointer for the matching rule. Will return a NULL pointer if the
2044
+ * matching rule result was a reference.
2045
+ *
2046
+ * # Safety
2047
+ *
2048
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
2049
+ * iterator it came from has not been deleted.
2050
+ */
2051
+ const MatchingRule *pactffi_matching_rule_pointer(const MatchingRuleResult *rule_result);
2052
+
2053
+ /**
2054
+ * Return any matching rule reference to a attribute by name. This is when the matcher should
2055
+ * be configured to match the type of a structure. I.e.,
2056
+ *
2057
+ * ```json
2058
+ * {
2059
+ * "pact:match": "eachValue(matching($'person'))",
2060
+ * "person": {
2061
+ * "name": "Fred",
2062
+ * "age": 100
2063
+ * }
2064
+ * }
2065
+ * ```
2066
+ *
2067
+ * Will return a NULL pointer if the matching rule was not a reference.
2068
+ *
2069
+ * # Safety
2070
+ *
2071
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
2072
+ * iterator has not been deleted.
2073
+ */
2074
+ const char *pactffi_matching_rule_reference_name(const MatchingRuleResult *rule_result);
2075
+
1991
2076
  /**
1992
2077
  * Get the JSON form of the matching rule.
1993
2078
  *
@@ -3327,6 +3412,154 @@ unsigned int pactffi_interaction_contents(InteractionHandle interaction,
3327
3412
  const char *content_type,
3328
3413
  const char *contents);
3329
3414
 
3415
+ /**
3416
+ * Determines if the string value matches the given matching rule. If the value matches OK,
3417
+ * will return a NULL pointer. If the value does not match, will return a error message as
3418
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3419
+ * `pactffi_string_delete` function once it is no longer required.
3420
+ *
3421
+ * * matching_rule - pointer to a matching rule
3422
+ * * expected_value - value we expect to get as a NULL terminated string
3423
+ * * actual_value - value to match as a NULL terminated string
3424
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3425
+ *
3426
+ * # Safety
3427
+ *
3428
+ * The matching rule pointer must be a valid pointer, and the value parameters must be
3429
+ * valid pointers to a NULL terminated strings.
3430
+ */
3431
+ const char *pactffi_matches_string_value(const MatchingRule *matching_rule,
3432
+ const char *expected_value,
3433
+ const char *actual_value,
3434
+ uint8_t cascaded);
3435
+
3436
+ /**
3437
+ * Determines if the unsigned integer value matches the given matching rule. If the value matches OK,
3438
+ * will return a NULL pointer. If the value does not match, will return a error message as
3439
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3440
+ * `pactffi_string_delete` function once it is no longer required.
3441
+ *
3442
+ * * matching_rule - pointer to a matching rule
3443
+ * * expected_value - value we expect to get
3444
+ * * actual_value - value to match
3445
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3446
+ *
3447
+ * # Safety
3448
+ *
3449
+ * The matching rule pointer must be a valid pointer.
3450
+ */
3451
+ const char *pactffi_matches_u64_value(const MatchingRule *matching_rule,
3452
+ uint64_t expected_value,
3453
+ uint64_t actual_value,
3454
+ uint8_t cascaded);
3455
+
3456
+ /**
3457
+ * Determines if the signed integer value matches the given matching rule. If the value matches OK,
3458
+ * will return a NULL pointer. If the value does not match, will return a error message as
3459
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3460
+ * `pactffi_string_delete` function once it is no longer required.
3461
+ *
3462
+ * * matching_rule - pointer to a matching rule
3463
+ * * expected_value - value we expect to get
3464
+ * * actual_value - value to match
3465
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3466
+ *
3467
+ * # Safety
3468
+ *
3469
+ * The matching rule pointer must be a valid pointer.
3470
+ */
3471
+ const char *pactffi_matches_i64_value(const MatchingRule *matching_rule,
3472
+ int64_t expected_value,
3473
+ int64_t actual_value,
3474
+ uint8_t cascaded);
3475
+
3476
+ /**
3477
+ * Determines if the floating point value matches the given matching rule. If the value matches OK,
3478
+ * will return a NULL pointer. If the value does not match, will return a error message as
3479
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3480
+ * `pactffi_string_delete` function once it is no longer required.
3481
+ *
3482
+ * * matching_rule - pointer to a matching rule
3483
+ * * expected_value - value we expect to get
3484
+ * * actual_value - value to match
3485
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3486
+ *
3487
+ * # Safety
3488
+ *
3489
+ * The matching rule pointer must be a valid pointer.
3490
+ */
3491
+ const char *pactffi_matches_f64_value(const MatchingRule *matching_rule,
3492
+ double expected_value,
3493
+ double actual_value,
3494
+ uint8_t cascaded);
3495
+
3496
+ /**
3497
+ * Determines if the boolean value matches the given matching rule. If the value matches OK,
3498
+ * will return a NULL pointer. If the value does not match, will return a error message as
3499
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3500
+ * `pactffi_string_delete` function once it is no longer required.
3501
+ *
3502
+ * * matching_rule - pointer to a matching rule
3503
+ * * expected_value - value we expect to get, 0 == false and 1 == true
3504
+ * * actual_value - value to match, 0 == false and 1 == true
3505
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3506
+ *
3507
+ * # Safety
3508
+ *
3509
+ * The matching rule pointer must be a valid pointer.
3510
+ */
3511
+ const char *pactffi_matches_bool_value(const MatchingRule *matching_rule,
3512
+ uint8_t expected_value,
3513
+ uint8_t actual_value,
3514
+ uint8_t cascaded);
3515
+
3516
+ /**
3517
+ * Determines if the binary value matches the given matching rule. If the value matches OK,
3518
+ * will return a NULL pointer. If the value does not match, will return a error message as
3519
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3520
+ * `pactffi_string_delete` function once it is no longer required.
3521
+ *
3522
+ * * matching_rule - pointer to a matching rule
3523
+ * * expected_value - value we expect to get
3524
+ * * expected_value_len - length of the expected value bytes
3525
+ * * actual_value - value to match
3526
+ * * actual_value_len - length of the actual value bytes
3527
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3528
+ *
3529
+ * # Safety
3530
+ *
3531
+ * The matching rule, expected value and actual value pointers must be a valid pointers.
3532
+ * expected_value_len and actual_value_len must contain the number of bytes that the value
3533
+ * pointers point to. Passing invalid lengths can lead to undefined behaviour.
3534
+ */
3535
+ const char *pactffi_matches_binary_value(const MatchingRule *matching_rule,
3536
+ const unsigned char *expected_value,
3537
+ uintptr_t expected_value_len,
3538
+ const unsigned char *actual_value,
3539
+ uintptr_t actual_value_len,
3540
+ uint8_t cascaded);
3541
+
3542
+ /**
3543
+ * Determines if the JSON value matches the given matching rule. If the value matches OK,
3544
+ * will return a NULL pointer. If the value does not match, will return a error message as
3545
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3546
+ * `pactffi_string_delete` function once it is no longer required.
3547
+ *
3548
+ * * matching_rule - pointer to a matching rule
3549
+ * * expected_value - value we expect to get as a NULL terminated string
3550
+ * * actual_value - value to match as a NULL terminated string
3551
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3552
+ *
3553
+ * # Safety
3554
+ *
3555
+ * The matching rule pointer must be a valid pointer, and the value parameters must be
3556
+ * valid pointers to a NULL terminated strings.
3557
+ */
3558
+ const char *pactffi_matches_json_value(const MatchingRule *matching_rule,
3559
+ const char *expected_value,
3560
+ const char *actual_value,
3561
+ uint8_t cascaded);
3562
+
3330
3563
  } // extern "C"
3331
3564
 
3332
3565
  #endif // pact_ffi_h
package/ffi/pact.h CHANGED
@@ -130,6 +130,38 @@ typedef struct MatchingRuleDefinitionResult MatchingRuleDefinitionResult;
130
130
  */
131
131
  typedef struct MatchingRuleIterator MatchingRuleIterator;
132
132
 
133
+ /**
134
+ * The matching rule or reference from parsing the matching definition expression.
135
+ *
136
+ * For matching rules, the ID corresponds to the following rules:
137
+ * | Rule | ID |
138
+ * | ---- | -- |
139
+ * | Equality | 1 |
140
+ * | Regex | 2 |
141
+ * | Type | 3 |
142
+ * | MinType | 4 |
143
+ * | MaxType | 5 |
144
+ * | MinMaxType | 6 |
145
+ * | Timestamp | 7 |
146
+ * | Time | 8 |
147
+ * | Date | 9 |
148
+ * | Include | 10 |
149
+ * | Number | 11 |
150
+ * | Integer | 12 |
151
+ * | Decimal | 13 |
152
+ * | Null | 14 |
153
+ * | ContentType | 15 |
154
+ * | ArrayContains | 16 |
155
+ * | Values | 17 |
156
+ * | Boolean | 18 |
157
+ * | StatusCode | 19 |
158
+ * | NotEmpty | 20 |
159
+ * | Semver | 21 |
160
+ * | EachKey | 22 |
161
+ * | EachValue | 23 |
162
+ */
163
+ typedef struct MatchingRuleResult MatchingRuleResult;
164
+
133
165
  /**
134
166
  * Struct that defines a message.
135
167
  */
@@ -282,63 +314,6 @@ typedef struct ProviderStateParamPair {
282
314
  const char *value;
283
315
  } ProviderStateParamPair;
284
316
 
285
- /**
286
- * The matching rule or reference from parsing the matching definition expression.
287
- *
288
- * For matching rules, the ID corresponds to the following rules:
289
- * | Rule | ID |
290
- * | ---- | -- |
291
- * | Equality | 1 |
292
- * | Regex | 2 |
293
- * | Type | 3 |
294
- * | MinType | 4 |
295
- * | MaxType | 5 |
296
- * | MinMaxType | 6 |
297
- * | Timestamp | 7 |
298
- * | Time | 8 |
299
- * | Date | 9 |
300
- * | Include | 10 |
301
- * | Number | 11 |
302
- * | Integer | 12 |
303
- * | Decimal | 13 |
304
- * | Null | 14 |
305
- * | ContentType | 15 |
306
- * | ArrayContains | 16 |
307
- * | Values | 17 |
308
- * | Boolean | 18 |
309
- * | StatusCode | 19 |
310
- * | NotEmpty | 20 |
311
- * | Semver | 21 |
312
- * | EachKey | 22 |
313
- * | EachValue | 23 |
314
- */
315
- typedef enum MatchingRuleResult_Tag {
316
- /**
317
- * The matching rule from the expression.
318
- */
319
- MatchingRuleResult_MatchingRule,
320
- /**
321
- * A reference to a named item.
322
- */
323
- MatchingRuleResult_MatchingReference,
324
- } MatchingRuleResult_Tag;
325
-
326
- typedef struct MatchingRuleResult_MatchingRule_Body {
327
- uint16_t _0;
328
- const char *_1;
329
- const struct MatchingRule *_2;
330
- } MatchingRuleResult_MatchingRule_Body;
331
-
332
- typedef struct MatchingRuleResult {
333
- MatchingRuleResult_Tag tag;
334
- union {
335
- MatchingRuleResult_MatchingRule_Body matching_rule;
336
- struct {
337
- const char *matching_reference;
338
- };
339
- };
340
- } MatchingRuleResult;
341
-
342
317
  /**
343
318
  * Wraps a Pact model struct
344
319
  */
@@ -1984,6 +1959,118 @@ struct MatchingRuleIterator *pactffi_matcher_definition_iter(const struct Matchi
1984
1959
  */
1985
1960
  const struct MatchingRuleResult *pactffi_matching_rule_iter_next(struct MatchingRuleIterator *iter);
1986
1961
 
1962
+ /**
1963
+ * Return the ID of the matching rule.
1964
+ *
1965
+ * The ID corresponds to the following rules:
1966
+ * | Rule | ID |
1967
+ * | ---- | -- |
1968
+ * | Equality | 1 |
1969
+ * | Regex | 2 |
1970
+ * | Type | 3 |
1971
+ * | MinType | 4 |
1972
+ * | MaxType | 5 |
1973
+ * | MinMaxType | 6 |
1974
+ * | Timestamp | 7 |
1975
+ * | Time | 8 |
1976
+ * | Date | 9 |
1977
+ * | Include | 10 |
1978
+ * | Number | 11 |
1979
+ * | Integer | 12 |
1980
+ * | Decimal | 13 |
1981
+ * | Null | 14 |
1982
+ * | ContentType | 15 |
1983
+ * | ArrayContains | 16 |
1984
+ * | Values | 17 |
1985
+ * | Boolean | 18 |
1986
+ * | StatusCode | 19 |
1987
+ * | NotEmpty | 20 |
1988
+ * | Semver | 21 |
1989
+ * | EachKey | 22 |
1990
+ * | EachValue | 23 |
1991
+ *
1992
+ * # Safety
1993
+ *
1994
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
1995
+ * iterator has not been deleted.
1996
+ */
1997
+ uint16_t pactffi_matching_rule_id(const struct MatchingRuleResult *rule_result);
1998
+
1999
+ /**
2000
+ * Returns the associated value for the matching rule. If the matching rule does not have an
2001
+ * associated value, will return a NULL pointer.
2002
+ *
2003
+ * The associated values for the rules are:
2004
+ * | Rule | ID | VALUE |
2005
+ * | ---- | -- | ----- |
2006
+ * | Equality | 1 | NULL |
2007
+ * | Regex | 2 | Regex value |
2008
+ * | Type | 3 | NULL |
2009
+ * | MinType | 4 | Minimum value |
2010
+ * | MaxType | 5 | Maximum value |
2011
+ * | MinMaxType | 6 | "min:max" |
2012
+ * | Timestamp | 7 | Format string |
2013
+ * | Time | 8 | Format string |
2014
+ * | Date | 9 | Format string |
2015
+ * | Include | 10 | String value |
2016
+ * | Number | 11 | NULL |
2017
+ * | Integer | 12 | NULL |
2018
+ * | Decimal | 13 | NULL |
2019
+ * | Null | 14 | NULL |
2020
+ * | ContentType | 15 | Content type |
2021
+ * | ArrayContains | 16 | NULL |
2022
+ * | Values | 17 | NULL |
2023
+ * | Boolean | 18 | NULL |
2024
+ * | StatusCode | 19 | NULL |
2025
+ * | NotEmpty | 20 | NULL |
2026
+ * | Semver | 21 | NULL |
2027
+ * | EachKey | 22 | NULL |
2028
+ * | EachValue | 23 | NULL |
2029
+ *
2030
+ * Will return a NULL pointer if the matching rule was a reference or does not have an
2031
+ * associated value.
2032
+ *
2033
+ * # Safety
2034
+ *
2035
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
2036
+ * iterator it came from has not been deleted.
2037
+ */
2038
+ const char *pactffi_matching_rule_value(const struct MatchingRuleResult *rule_result);
2039
+
2040
+ /**
2041
+ * Returns the matching rule pointer for the matching rule. Will return a NULL pointer if the
2042
+ * matching rule result was a reference.
2043
+ *
2044
+ * # Safety
2045
+ *
2046
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
2047
+ * iterator it came from has not been deleted.
2048
+ */
2049
+ const struct MatchingRule *pactffi_matching_rule_pointer(const struct MatchingRuleResult *rule_result);
2050
+
2051
+ /**
2052
+ * Return any matching rule reference to a attribute by name. This is when the matcher should
2053
+ * be configured to match the type of a structure. I.e.,
2054
+ *
2055
+ * ```json
2056
+ * {
2057
+ * "pact:match": "eachValue(matching($'person'))",
2058
+ * "person": {
2059
+ * "name": "Fred",
2060
+ * "age": 100
2061
+ * }
2062
+ * }
2063
+ * ```
2064
+ *
2065
+ * Will return a NULL pointer if the matching rule was not a reference.
2066
+ *
2067
+ * # Safety
2068
+ *
2069
+ * This function is safe as long as the MatchingRuleResult pointer is a valid pointer and the
2070
+ * iterator has not been deleted.
2071
+ */
2072
+ const char *pactffi_matching_rule_reference_name(const struct MatchingRuleResult *rule_result);
2073
+
1987
2074
  /**
1988
2075
  * Get the JSON form of the matching rule.
1989
2076
  *
@@ -3325,4 +3412,152 @@ unsigned int pactffi_interaction_contents(InteractionHandle interaction,
3325
3412
  const char *content_type,
3326
3413
  const char *contents);
3327
3414
 
3415
+ /**
3416
+ * Determines if the string value matches the given matching rule. If the value matches OK,
3417
+ * will return a NULL pointer. If the value does not match, will return a error message as
3418
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3419
+ * `pactffi_string_delete` function once it is no longer required.
3420
+ *
3421
+ * * matching_rule - pointer to a matching rule
3422
+ * * expected_value - value we expect to get as a NULL terminated string
3423
+ * * actual_value - value to match as a NULL terminated string
3424
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3425
+ *
3426
+ * # Safety
3427
+ *
3428
+ * The matching rule pointer must be a valid pointer, and the value parameters must be
3429
+ * valid pointers to a NULL terminated strings.
3430
+ */
3431
+ const char *pactffi_matches_string_value(const struct MatchingRule *matching_rule,
3432
+ const char *expected_value,
3433
+ const char *actual_value,
3434
+ uint8_t cascaded);
3435
+
3436
+ /**
3437
+ * Determines if the unsigned integer value matches the given matching rule. If the value matches OK,
3438
+ * will return a NULL pointer. If the value does not match, will return a error message as
3439
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3440
+ * `pactffi_string_delete` function once it is no longer required.
3441
+ *
3442
+ * * matching_rule - pointer to a matching rule
3443
+ * * expected_value - value we expect to get
3444
+ * * actual_value - value to match
3445
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3446
+ *
3447
+ * # Safety
3448
+ *
3449
+ * The matching rule pointer must be a valid pointer.
3450
+ */
3451
+ const char *pactffi_matches_u64_value(const struct MatchingRule *matching_rule,
3452
+ uint64_t expected_value,
3453
+ uint64_t actual_value,
3454
+ uint8_t cascaded);
3455
+
3456
+ /**
3457
+ * Determines if the signed integer value matches the given matching rule. If the value matches OK,
3458
+ * will return a NULL pointer. If the value does not match, will return a error message as
3459
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3460
+ * `pactffi_string_delete` function once it is no longer required.
3461
+ *
3462
+ * * matching_rule - pointer to a matching rule
3463
+ * * expected_value - value we expect to get
3464
+ * * actual_value - value to match
3465
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3466
+ *
3467
+ * # Safety
3468
+ *
3469
+ * The matching rule pointer must be a valid pointer.
3470
+ */
3471
+ const char *pactffi_matches_i64_value(const struct MatchingRule *matching_rule,
3472
+ int64_t expected_value,
3473
+ int64_t actual_value,
3474
+ uint8_t cascaded);
3475
+
3476
+ /**
3477
+ * Determines if the floating point value matches the given matching rule. If the value matches OK,
3478
+ * will return a NULL pointer. If the value does not match, will return a error message as
3479
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3480
+ * `pactffi_string_delete` function once it is no longer required.
3481
+ *
3482
+ * * matching_rule - pointer to a matching rule
3483
+ * * expected_value - value we expect to get
3484
+ * * actual_value - value to match
3485
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3486
+ *
3487
+ * # Safety
3488
+ *
3489
+ * The matching rule pointer must be a valid pointer.
3490
+ */
3491
+ const char *pactffi_matches_f64_value(const struct MatchingRule *matching_rule,
3492
+ double expected_value,
3493
+ double actual_value,
3494
+ uint8_t cascaded);
3495
+
3496
+ /**
3497
+ * Determines if the boolean value matches the given matching rule. If the value matches OK,
3498
+ * will return a NULL pointer. If the value does not match, will return a error message as
3499
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3500
+ * `pactffi_string_delete` function once it is no longer required.
3501
+ *
3502
+ * * matching_rule - pointer to a matching rule
3503
+ * * expected_value - value we expect to get, 0 == false and 1 == true
3504
+ * * actual_value - value to match, 0 == false and 1 == true
3505
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3506
+ *
3507
+ * # Safety
3508
+ *
3509
+ * The matching rule pointer must be a valid pointer.
3510
+ */
3511
+ const char *pactffi_matches_bool_value(const struct MatchingRule *matching_rule,
3512
+ uint8_t expected_value,
3513
+ uint8_t actual_value,
3514
+ uint8_t cascaded);
3515
+
3516
+ /**
3517
+ * Determines if the binary value matches the given matching rule. If the value matches OK,
3518
+ * will return a NULL pointer. If the value does not match, will return a error message as
3519
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3520
+ * `pactffi_string_delete` function once it is no longer required.
3521
+ *
3522
+ * * matching_rule - pointer to a matching rule
3523
+ * * expected_value - value we expect to get
3524
+ * * expected_value_len - length of the expected value bytes
3525
+ * * actual_value - value to match
3526
+ * * actual_value_len - length of the actual value bytes
3527
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3528
+ *
3529
+ * # Safety
3530
+ *
3531
+ * The matching rule, expected value and actual value pointers must be a valid pointers.
3532
+ * expected_value_len and actual_value_len must contain the number of bytes that the value
3533
+ * pointers point to. Passing invalid lengths can lead to undefined behaviour.
3534
+ */
3535
+ const char *pactffi_matches_binary_value(const struct MatchingRule *matching_rule,
3536
+ const unsigned char *expected_value,
3537
+ uintptr_t expected_value_len,
3538
+ const unsigned char *actual_value,
3539
+ uintptr_t actual_value_len,
3540
+ uint8_t cascaded);
3541
+
3542
+ /**
3543
+ * Determines if the JSON value matches the given matching rule. If the value matches OK,
3544
+ * will return a NULL pointer. If the value does not match, will return a error message as
3545
+ * a NULL terminated string. The error message pointer will need to be deleted with the
3546
+ * `pactffi_string_delete` function once it is no longer required.
3547
+ *
3548
+ * * matching_rule - pointer to a matching rule
3549
+ * * expected_value - value we expect to get as a NULL terminated string
3550
+ * * actual_value - value to match as a NULL terminated string
3551
+ * * cascaded - if the matching rule has been cascaded from a parent. 0 == false, 1 == true
3552
+ *
3553
+ * # Safety
3554
+ *
3555
+ * The matching rule pointer must be a valid pointer, and the value parameters must be
3556
+ * valid pointers to a NULL terminated strings.
3557
+ */
3558
+ const char *pactffi_matches_json_value(const struct MatchingRule *matching_rule,
3559
+ const char *expected_value,
3560
+ const char *actual_value,
3561
+ uint8_t cascaded);
3562
+
3328
3563
  #endif /* pact_ffi_h */
package/ffi/pact_ffi.dll CHANGED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pact-foundation/pact-core",
3
- "version": "13.13.0",
3
+ "version": "13.13.2",
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",
@@ -1,7 +1,7 @@
1
1
  import { LogLevel } from '../logger/types';
2
2
  import { Ffi } from './types';
3
3
  declare const ffiLib: Ffi;
4
- export declare const PACT_FFI_VERSION = "0.3.15";
4
+ export declare const PACT_FFI_VERSION = "0.3.19";
5
5
  declare let ffi: typeof ffiLib;
6
6
  export declare const getFfiLib: (logLevel?: LogLevel) => typeof ffi;
7
7
  export {};
package/src/ffi/index.js CHANGED
@@ -23,7 +23,7 @@ exports.getFfiLib = exports.PACT_FFI_VERSION = void 0;
23
23
  const logger_1 = __importStar(require("../logger"));
24
24
  const bindings = require("bindings");
25
25
  const ffiLib = bindings('pact.node');
26
- exports.PACT_FFI_VERSION = '0.3.15';
26
+ exports.PACT_FFI_VERSION = '0.3.19';
27
27
  let ffi;
28
28
  let ffiLogLevel;
29
29
  const initialiseFfi = (logLevel) => {