@pact-foundation/pact-core 13.7.2 → 13.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/build/Makefile +1 -1
- package/package.json +2 -2
- package/src/ffi/types.d.ts +5 -0
- package/src/ffi/types.js.map +1 -1
- package/src/verifier/argumentMapper/arguments.d.ts +14 -5
- package/src/verifier/argumentMapper/arguments.js +128 -80
- package/src/verifier/argumentMapper/arguments.js.map +1 -1
- package/src/verifier/argumentMapper/index.d.ts +3 -1
- package/src/verifier/argumentMapper/index.js +37 -52
- package/src/verifier/argumentMapper/index.js.map +1 -1
- package/src/verifier/argumentMapper/types.d.ts +20 -1
- package/src/verifier/argumentMapper/types.js +16 -0
- package/src/verifier/argumentMapper/types.js.map +1 -1
- package/src/verifier/nativeVerifier.js +2 -65
- package/src/verifier/nativeVerifier.js.map +1 -1
- package/src/verifier/types.d.ts +1 -0
- package/src/verifier/validateOptions.d.ts +12 -2
- package/src/verifier/validateOptions.js +149 -84
- package/src/verifier/validateOptions.js.map +1 -1
- package/src/verifier/filesystem/index.d.ts +0 -2
- package/src/verifier/filesystem/index.js +0 -24
- package/src/verifier/filesystem/index.js.map +0 -1
- package/src/verifier/filesystem/types.d.ts +0 -1
- package/src/verifier/filesystem/types.js +0 -3
- package/src/verifier/filesystem/types.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.7.3](https://github.com/pact-foundation/pact-js-core/compare/v13.7.2...v13.7.3) (2022-08-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Fixes and Improvements
|
|
9
|
+
|
|
10
|
+
* update the argument validation and function mapping for ffi verification ([#391](https://github.com/pact-foundation/pact-js-core/issues/391)) ([fee85e1](https://github.com/pact-foundation/pact-js-core/commit/fee85e1d1fcd63b81c3d2d0f86ab9691975873e6))
|
|
11
|
+
|
|
5
12
|
### [13.7.2](https://github.com/pact-foundation/pact-js-core/compare/v13.7.1...v13.7.2) (2022-08-11)
|
|
6
13
|
|
|
7
14
|
|
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/12.22.12/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/12.22.12" "-Dnode_gyp_dir=/opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/home/runner/.cache/node-gyp/12.22.12/<(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/12.22.12/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/runner/.cache/node-gyp/12.22.12/include/node/common.gypi "--toplevel-dir=." binding.gyp
|
|
322
|
-
Makefile: $(srcdir)
|
|
322
|
+
Makefile: $(srcdir)/binding.gyp $(srcdir)/build/config.gypi $(srcdir)/../../../../../opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/../../../.cache/node-gyp/12.22.12/include/node/common.gypi
|
|
323
323
|
$(call do_cmd,regen_makefile)
|
|
324
324
|
|
|
325
325
|
# "all" is a concatenation of the "all" targets from all the included
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pact-foundation/pact-core",
|
|
3
|
-
"version": "13.7.
|
|
3
|
+
"version": "13.7.3",
|
|
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",
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
"type": "refactor",
|
|
158
|
-
"
|
|
158
|
+
"section": "Fixes and Improvements"
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
161
|
"type": "perf",
|
package/src/ffi/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
export declare type FfiHandle = number;
|
|
2
3
|
export declare type FfiPactHandle = number;
|
|
3
4
|
export declare type FfiInteractionHandle = number;
|
|
4
5
|
export declare type FfiVerifierHandle = number;
|
|
@@ -47,6 +48,8 @@ export declare enum FfiLogLevelFilter {
|
|
|
47
48
|
export declare type Ffi = {
|
|
48
49
|
pactffiInit(logLevel: string): string;
|
|
49
50
|
pactffiVersion(): string;
|
|
51
|
+
} & FfiConsumerFunctions & FfiVerificationFunctions;
|
|
52
|
+
export declare type FfiConsumerFunctions = {
|
|
50
53
|
pactffiCreateMockServerForPact(handle: FfiPactHandle, address: string, tls: boolean): number;
|
|
51
54
|
pactffiNewPact(consumer: string, provider: string): FfiPactHandle;
|
|
52
55
|
pactffiWithSpecification(handle: FfiPactHandle, specification: FfiSpecificationVersion): boolean;
|
|
@@ -84,6 +87,8 @@ export declare type Ffi = {
|
|
|
84
87
|
pactffiMessageWithBinaryContents(handle: FfiMessageHandle, contentType: string, data: Buffer, size: number): void;
|
|
85
88
|
pactffiMessageWithMetadata(handle: FfiMessageHandle, key: string, value: string): void;
|
|
86
89
|
pactffiMessageReify(handle: FfiMessageHandle): string;
|
|
90
|
+
};
|
|
91
|
+
export declare type FfiVerificationFunctions = {
|
|
87
92
|
pactffiVerifierNewForApplication(libraryName: string, version: string): FfiVerifierHandle;
|
|
88
93
|
pactffiVerifierExecute(handle: FfiVerifierHandle, callback: (e: Error, res: number) => void): number;
|
|
89
94
|
pactffiVerifierShutdown(handle: FfiVerifierHandle): void;
|
package/src/ffi/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AASa,QAAA,uBAAuB,GAClC;IACE,6BAA6B,EAAE,CAAC;IAChC,wBAAwB,EAAE,CAAC;IAC3B,0BAA0B,EAAE,CAAC;IAC7B,wBAAwB,EAAE,CAAC;IAC3B,wBAAwB,EAAE,CAAC;IAC3B,wBAAwB,EAAE,CAAC;CAC5B,CAAC;AAIS,QAAA,oBAAoB,GAAyC;IACxE,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,yBAAyB,EAAE,CAAC;IAC5B,qBAAqB,EAAE,CAAC;CACzB,CAAC;AAIW,QAAA,2BAA2B,GAGpC;IACF,OAAO,EAAE,CAAC;IACV,yBAAyB,EAAE,CAAC;IAC5B,sBAAsB,EAAE,CAAC;CAC1B,CAAC;AAIW,QAAA,0BAA0B,GAGnC;IACF,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,qBAAqB,EAAE,CAAC;IACxB,mBAAmB,EAAE,CAAC;CACvB,CAAC;AAIW,QAAA,4BAA4B,GAGrC;IACF,OAAO,EAAE,CAAC;IACV,0BAA0B,EAAE,CAAC;IAC7B,oCAAoC,EAAE,CAAC;IACvC,6BAA6B,EAAE,CAAC;IAChC,yBAAyB,EAAE,CAAC;IAC5B,+BAA+B,EAAE,CAAC;IAClC,wBAAwB,EAAE,CAAC;CAC5B,CAAC;AAIW,QAAA,wBAAwB,GAAuB,CAAC,CAAC;AACjD,QAAA,yBAAyB,GAAuB,CAAC,CAAC;AAElD,QAAA,yBAAyB,GAAG;IACvC,YAAY,EAAE,CAAC,CAAC;IAChB,gBAAgB,EAAE,CAAC,CAAC;IACpB,sBAAsB,EAAE,CAAC,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC;IACd,iBAAiB,EAAE,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,CAAC;CACf,CAAC;AAUF,IAAY,wBAMX;AAND,WAAY,wBAAwB;IAClC,6GAA2B,CAAA;IAC3B,qGAAmB,CAAA;IACnB,yGAAqB,CAAA;IACrB,6FAAe,CAAA;IACf,iGAAiB,CAAA;AACnB,CAAC,EANW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAMnC;AAUD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,mEAAa,CAAA;IACb,2EAAa,CAAA;AACf,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AAED,IAAY,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,5 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InternalPactVerifierOptions
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
|
|
1
|
+
import { FnMapping } from './types';
|
|
2
|
+
import { InternalPactVerifierOptions } from '../types';
|
|
3
|
+
import { FfiVerificationFunctions } from '../../ffi/types';
|
|
4
|
+
export declare type IgnoredFfiFunctions = {
|
|
5
|
+
pactffiVerifierNewForApplication: 1;
|
|
6
|
+
pactffiVerifierExecute: 1;
|
|
7
|
+
pactffiVerifierShutdown: 1;
|
|
8
|
+
};
|
|
9
|
+
export declare type MergedFfiSourceFunctions = {
|
|
10
|
+
pactffiVerifierAddFileSource: 1;
|
|
11
|
+
pactffiVerifierUrlSource: 1;
|
|
12
|
+
};
|
|
13
|
+
export declare type RequiredFfiVerificationFunctions = Omit<FfiVerificationFunctions, keyof (IgnoredFfiFunctions & MergedFfiSourceFunctions)>;
|
|
14
|
+
export declare const ffiFnMapping: FnMapping<RequiredFfiVerificationFunctions, InternalPactVerifierOptions>;
|
|
@@ -1,94 +1,142 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'beforeEach',
|
|
12
|
-
'afterEach',
|
|
13
|
-
'validateSSL',
|
|
14
|
-
];
|
|
15
|
-
exports.ignoreOptionCombinations = {
|
|
16
|
-
enablePending: { ifNotSet: 'pactBrokerUrl' },
|
|
17
|
-
consumerVersionSelectors: { ifNotSet: 'pactBrokerUrl' },
|
|
18
|
-
consumerVersionTags: { ifNotSet: 'pactBrokerUrl' },
|
|
19
|
-
publishVerificationResult: { ifNotSet: 'pactBrokerUrl' },
|
|
6
|
+
exports.ffiFnMapping = void 0;
|
|
7
|
+
const logger_1 = __importDefault(require("../../logger"));
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const url_1 = require("url");
|
|
11
|
+
const DEFAULT_TIMEOUT = 30000;
|
|
12
|
+
const objArrayToStringArray = (obj) => {
|
|
13
|
+
return obj.map((o) => JSON.stringify(o));
|
|
20
14
|
};
|
|
21
|
-
exports.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
exports.ffiFnMapping = {
|
|
16
|
+
pactffiVerifierAddCustomHeader: {
|
|
17
|
+
validateAndExecute(ffi, handle, options) {
|
|
18
|
+
if (options.customProviderHeaders) {
|
|
19
|
+
if (options.customProviderHeaders) {
|
|
20
|
+
Object.entries(options.customProviderHeaders).forEach(([key, value]) => {
|
|
21
|
+
ffi.pactffiVerifierAddCustomHeader(handle, key, value);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
25
|
+
}
|
|
26
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
27
|
+
},
|
|
29
28
|
},
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
pactffiVerifierAddDirectorySource: {
|
|
30
|
+
validateAndExecute(ffi, handle, options) {
|
|
31
|
+
const messages = [];
|
|
32
|
+
if (options.pactUrls) {
|
|
33
|
+
options.pactUrls.forEach((file) => {
|
|
34
|
+
logger_1.default.debug(`checking source type of given pactUrl: ${file}`);
|
|
35
|
+
try {
|
|
36
|
+
const u = new url_1.URL(file);
|
|
37
|
+
if (u.hostname) {
|
|
38
|
+
logger_1.default.debug(`adding ${file} as a Url source`);
|
|
39
|
+
ffi.pactffiVerifierUrlSource(handle, file, options.pactBrokerUsername ||
|
|
40
|
+
process.env.PACT_BROKER_USERNAME ||
|
|
41
|
+
'', options.pactBrokerPassword ||
|
|
42
|
+
process.env.PACT_BROKER_PASSWORD ||
|
|
43
|
+
'', options.pactBrokerToken || process.env.PACT_BROKER_TOKEN || '');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
messages.push(`${file} is not a valid URL`);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const f = fs.lstatSync(file);
|
|
51
|
+
if (f.isDirectory()) {
|
|
52
|
+
logger_1.default.debug(`adding ${file} as Directory source`);
|
|
53
|
+
ffi.pactffiVerifierAddDirectorySource(handle, file);
|
|
54
|
+
}
|
|
55
|
+
else if (f.isFile() || f.isSymbolicLink()) {
|
|
56
|
+
logger_1.default.debug(`adding ${file} as File source`);
|
|
57
|
+
ffi.pactffiVerifierAddFileSource(handle, file);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
messages.push(`'${file}' does not exist, or is not a file or directory`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
65
|
+
}
|
|
66
|
+
if (messages.length > 0) {
|
|
67
|
+
return { status: types_1.FnValidationStatus.FAIL, messages };
|
|
68
|
+
}
|
|
69
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
70
|
+
},
|
|
32
71
|
},
|
|
33
|
-
|
|
34
|
-
|
|
72
|
+
pactffiVerifierBrokerSourceWithSelectors: {
|
|
73
|
+
validateAndExecute(ffi, handle, opts) {
|
|
74
|
+
const brokerUrl = opts.pactBrokerUrl || process.env.PACT_BROKER_BASE_URL;
|
|
75
|
+
if (brokerUrl && opts.provider) {
|
|
76
|
+
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
|
|
77
|
+
? objArrayToStringArray(opts.consumerVersionSelectors)
|
|
78
|
+
: [], opts.consumerVersionTags || []);
|
|
79
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
80
|
+
}
|
|
81
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
82
|
+
},
|
|
35
83
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
case 'FILE':
|
|
45
|
-
return [...acc, '--file', uri];
|
|
46
|
-
default:
|
|
47
|
-
return acc;
|
|
48
|
-
}
|
|
49
|
-
}, []),
|
|
50
|
-
pactBrokerUrl: { arg: '--broker-url', mapper: 'string' },
|
|
51
|
-
pactBrokerUsername: { arg: '--user', mapper: 'string' },
|
|
52
|
-
pactBrokerPassword: { arg: '--password', mapper: 'string' },
|
|
53
|
-
pactBrokerToken: { arg: '--token', mapper: 'string' },
|
|
54
|
-
consumerVersionTags: (tags) => [
|
|
55
|
-
'--consumer-version-tags',
|
|
56
|
-
Array.isArray(tags) ? tags.join(',') : tags,
|
|
57
|
-
],
|
|
58
|
-
providerVersionTags: (tags) => [
|
|
59
|
-
'--provider-tags',
|
|
60
|
-
Array.isArray(tags) ? tags.join(',') : tags,
|
|
61
|
-
],
|
|
62
|
-
providerStatesSetupUrl: { arg: '--state-change-url', mapper: 'string' },
|
|
63
|
-
providerVersion: { arg: '--provider-version', mapper: 'string' },
|
|
64
|
-
includeWipPactsSince: { arg: '--include-wip-pacts-since', mapper: 'string' },
|
|
65
|
-
consumerVersionSelectors: (selectors) => selectors
|
|
66
|
-
.map((s) => [
|
|
67
|
-
'--consumer-version-selectors',
|
|
68
|
-
JSON.stringify(s),
|
|
69
|
-
])
|
|
70
|
-
.reduce((acc, current) => [...acc, ...current], []),
|
|
71
|
-
publishVerificationResult: { arg: '--publish', mapper: 'flag' },
|
|
72
|
-
enablePending: { arg: '--enable-pending', mapper: 'flag' },
|
|
73
|
-
timeout: { arg: '--request-timeout', mapper: 'string' },
|
|
74
|
-
disableSslVerification: { arg: '--disable-ssl-verification', mapper: 'flag' },
|
|
75
|
-
format: {
|
|
76
|
-
warningMessage: "All output is now on standard out, setting 'format' has no effect",
|
|
84
|
+
pactffiVerifierSetConsumerFilters: {
|
|
85
|
+
validateAndExecute(ffi, handle, options) {
|
|
86
|
+
if (options.consumerFilters && options.consumerFilters.length > 0) {
|
|
87
|
+
ffi.pactffiVerifierSetConsumerFilters(handle, options.consumerFilters);
|
|
88
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
89
|
+
}
|
|
90
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
91
|
+
},
|
|
77
92
|
},
|
|
78
|
-
|
|
79
|
-
|
|
93
|
+
pactffiVerifierSetFilterInfo: {
|
|
94
|
+
validateAndExecute(ffi, handle, options) {
|
|
95
|
+
if (process.env.PACT_DESCRIPTION ||
|
|
96
|
+
process.env.PACT_PROVIDER_STATE ||
|
|
97
|
+
process.env.PACT_PROVIDER_NO_STATE) {
|
|
98
|
+
const filterDescription = process.env.PACT_DESCRIPTION || '';
|
|
99
|
+
const filterState = process.env.PACT_PROVIDER_STATE || '';
|
|
100
|
+
const filterNoState = process.env.PACT_PROVIDER_NO_STATE ? true : false;
|
|
101
|
+
ffi.pactffiVerifierSetFilterInfo(handle, filterDescription, filterState, filterNoState);
|
|
102
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
103
|
+
}
|
|
104
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
105
|
+
},
|
|
80
106
|
},
|
|
81
|
-
|
|
82
|
-
|
|
107
|
+
pactffiVerifierSetProviderInfo: {
|
|
108
|
+
validateAndExecute(ffi, handle, options) {
|
|
109
|
+
const uri = new url_1.URL(options.providerBaseUrl);
|
|
110
|
+
ffi.pactffiVerifierSetProviderInfo(handle, options.provider || '', uri.protocol.split(':')[0], uri.hostname, parseInt(uri.port, 10), uri.pathname);
|
|
111
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
112
|
+
},
|
|
83
113
|
},
|
|
84
|
-
|
|
85
|
-
|
|
114
|
+
pactffiVerifierSetProviderState: {
|
|
115
|
+
validateAndExecute(ffi, handle, options) {
|
|
116
|
+
if (options.providerStatesSetupUrl) {
|
|
117
|
+
ffi.pactffiVerifierSetProviderState(handle, options.providerStatesSetupUrl, true, true);
|
|
118
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
119
|
+
}
|
|
120
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
121
|
+
},
|
|
86
122
|
},
|
|
87
|
-
|
|
88
|
-
|
|
123
|
+
pactffiVerifierSetPublishOptions: {
|
|
124
|
+
validateAndExecute(ffi, handle, options) {
|
|
125
|
+
if (options.publishVerificationResult && options.providerVersion) {
|
|
126
|
+
ffi.pactffiVerifierSetPublishOptions(handle, options.providerVersion, options.buildUrl || '', options.providerVersionTags || [], options.providerBranch || '');
|
|
127
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
128
|
+
}
|
|
129
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
130
|
+
},
|
|
89
131
|
},
|
|
90
|
-
|
|
91
|
-
|
|
132
|
+
pactffiVerifierSetVerificationOptions: {
|
|
133
|
+
validateAndExecute(ffi, handle, opts) {
|
|
134
|
+
if (opts.disableSslVerification || opts.timeout) {
|
|
135
|
+
ffi.pactffiVerifierSetVerificationOptions(handle, opts.disableSslVerification || false, opts.timeout || DEFAULT_TIMEOUT);
|
|
136
|
+
return { status: types_1.FnValidationStatus.SUCCESS };
|
|
137
|
+
}
|
|
138
|
+
return { status: types_1.FnValidationStatus.IGNORE };
|
|
139
|
+
},
|
|
92
140
|
},
|
|
93
141
|
};
|
|
94
142
|
//# sourceMappingURL=arguments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["arguments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["arguments.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,yBAA0B;AAE1B,mCAAwD;AAIxD,6BAA0B;AAE1B,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,MAAM,qBAAqB,GAAG,CAAC,GAAc,EAAE,EAAE;IAC/C,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC;AAkBW,QAAA,YAAY,GAGrB;IACF,8BAA8B,EAAE;QAC9B,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9B,IAAI,EACJ,IAAI,CACL,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,0BAAkB,CAAC,OAAO,EAAE,CAAC;aAC/C;YAED,OAAO,EAAE,MAAM,EAAE,0BAAkB,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;KACF;IACD,gCAAgC,EAAE;QAChC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO;YACrC,IAAI,OAAO,CAAC,yBAAyB,IAAI,OAAO,CAAC,eAAe,EAAE;gBAChE,GAAG,CAAC,gCAAgC,CAClC,MAAM,EACN,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,QAAQ,IAAI,EAAE,EACtB,OAAO,CAAC,mBAAmB,IAAI,EAAE,EACjC,OAAO,CAAC,cAAc,IAAI,EAAE,CAC7B,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,0BAAkB,CAAC,OAAO,EAAE,CAAC;aAC/C;YACD,OAAO,EAAE,MAAM,EAAE,0BAAkB,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;KACF;IACD,qCAAqC,EAAE;QACrC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI;YAClC,IAAI,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,OAAO,EAAE;gBAC/C,GAAG,CAAC,qCAAqC,CACvC,MAAM,EACN,IAAI,CAAC,sBAAsB,IAAI,KAAK,EACpC,IAAI,CAAC,OAAO,IAAI,eAAe,CAChC,CAAC;gBACF,OAAO,EAAE,MAAM,EAAE,0BAAkB,CAAC,OAAO,EAAE,CAAC;aAC/C;YAED,OAAO,EAAE,MAAM,EAAE,0BAAkB,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;KACF;CACF,CAAC"}
|
|
@@ -1,59 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
4
20
|
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const
|
|
22
|
+
exports.setupVerification = void 0;
|
|
23
|
+
const types_1 = require("./types");
|
|
24
|
+
const logger_1 = __importStar(require("../../logger"));
|
|
8
25
|
const arguments_1 = require("./arguments");
|
|
9
|
-
const
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return true;
|
|
22
|
-
})
|
|
23
|
-
.map((key) => {
|
|
24
|
-
const thisMapping = arguments_1.argMapping[key];
|
|
25
|
-
const thisValue = options[key];
|
|
26
|
-
if (!thisMapping) {
|
|
27
|
-
if (!arguments_1.ignoredArguments.includes(key)) {
|
|
28
|
-
logger_1.default.error(`Pact-core is ignoring unknown option '${key}'`);
|
|
29
|
-
}
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
if (thisValue === undefined) {
|
|
33
|
-
logger_1.default.warn(`The Verifier option '${key}' was was explicitly set to undefined and will be ignored. This may indicate an error in your config. Remove the option entirely to prevent this warning`);
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
if ('warningMessage' in thisMapping) {
|
|
37
|
-
logger_1.default.warn(thisMapping.warningMessage);
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
if ('arg' in thisMapping) {
|
|
41
|
-
switch (thisMapping.mapper) {
|
|
42
|
-
case 'string':
|
|
43
|
-
return [thisMapping.arg, `${thisValue}`];
|
|
44
|
-
case 'flag':
|
|
45
|
-
return thisValue ? [thisMapping.arg] : [];
|
|
26
|
+
const setupVerification = (ffi, handle, options) => {
|
|
27
|
+
Object.keys(arguments_1.ffiFnMapping).map((k) => {
|
|
28
|
+
const validation = arguments_1.ffiFnMapping[k].validateAndExecute(ffi, handle, options);
|
|
29
|
+
switch (validation.status) {
|
|
30
|
+
case types_1.FnValidationStatus.FAIL:
|
|
31
|
+
logger_1.logErrorAndThrow(`the required ffi function '${k}' failed validation with errors: ${validation.messages || [].join(',')}`);
|
|
32
|
+
break;
|
|
33
|
+
case types_1.FnValidationStatus.IGNORE:
|
|
34
|
+
logger_1.default.debug(`the optional ffi function '${k}' was not executed as it had non-fatal validation errors: ${validation.messages || [].join(',')}`);
|
|
35
|
+
break;
|
|
36
|
+
case types_1.FnValidationStatus.SUCCESS:
|
|
37
|
+
break;
|
|
46
38
|
default:
|
|
47
|
-
logger_1.
|
|
48
|
-
return [];
|
|
39
|
+
logger_1.logCrashAndThrow(`the ffi function '${k}' returned the following unrecognised validation signal: '${validation.status}'`);
|
|
49
40
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
logger_1.default.pactCrash(`The option mapper completely failed to find a mapping for '${key}'.`);
|
|
55
|
-
return [];
|
|
56
|
-
})
|
|
57
|
-
.reduce((acc, current) => [...acc, ...current], []);
|
|
58
|
-
exports.argumentMapper = argumentMapper;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
exports.setupVerification = setupVerification;
|
|
59
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA6C;AAC7C,uDAA0E;AAE1E,2CAA6E;AAGtE,MAAM,iBAAiB,GAAG,CAC/B,GAAQ,EACR,MAAyB,EACzB,OAAoC,EAC9B,EAAE;IAEN,MAAM,CAAC,IAAI,CAAC,wBAAY,CACzB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACV,MAAM,UAAU,GAAG,wBAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5E,QAAQ,UAAU,CAAC,MAAM,EAAE;YACzB,KAAK,0BAAkB,CAAC,IAAI;gBAC1B,yBAAgB,CACd,8BAA8B,CAAC,oCAC7B,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CACpC,EAAE,CACH,CAAC;gBACF,MAAM;YACR,KAAK,0BAAkB,CAAC,MAAM;gBAC5B,gBAAM,CAAC,KAAK,CACV,8BAA8B,CAAC,6DAC7B,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CACpC,EAAE,CACH,CAAC;gBACF,MAAM;YACR,KAAK,0BAAkB,CAAC,OAAO;gBAC7B,MAAM;YACR;gBACE,yBAAgB,CACd,qBAAqB,CAAC,6DAA6D,UAAU,CAAC,MAAM,GAAG,CACxG,CAAC;SACL;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAjCW,QAAA,iBAAiB,qBAiC5B"}
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const deprecatedFunction: (_: any, property: string) => boolean;
|
|
2
|
+
import { Ffi, FfiHandle } from '../../ffi/types';
|
|
3
|
+
export declare type FnObject = {
|
|
4
|
+
[key: string]: (...args: any) => any;
|
|
5
|
+
};
|
|
6
|
+
export declare type FnMapping<T extends FnObject, O> = {
|
|
7
|
+
[Key in keyof T]: FnArgumentMapping<Key, T, O>;
|
|
8
|
+
};
|
|
9
|
+
export declare enum FnValidationStatus {
|
|
10
|
+
SUCCESS = 0,
|
|
11
|
+
IGNORE = 1,
|
|
12
|
+
FAIL = 2
|
|
13
|
+
}
|
|
14
|
+
export declare type FnValidationResult = {
|
|
15
|
+
status: FnValidationStatus;
|
|
16
|
+
messages?: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare type FnArgumentMapping<K extends keyof T, T extends FnObject, O> = {
|
|
19
|
+
validateAndExecute: (ffi: Ffi, handle: FfiHandle, options: O) => FnValidationResult;
|
|
20
|
+
};
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FnValidationStatus = exports.deprecatedFunction = void 0;
|
|
7
|
+
const logger_1 = __importDefault(require("../../logger"));
|
|
8
|
+
const deprecatedFunction = (_, property) => {
|
|
9
|
+
logger_1.default.warn(`${property} is deprecated and no longer has any effect`);
|
|
10
|
+
return true;
|
|
11
|
+
};
|
|
12
|
+
exports.deprecatedFunction = deprecatedFunction;
|
|
13
|
+
var FnValidationStatus;
|
|
14
|
+
(function (FnValidationStatus) {
|
|
15
|
+
FnValidationStatus[FnValidationStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
16
|
+
FnValidationStatus[FnValidationStatus["IGNORE"] = 1] = "IGNORE";
|
|
17
|
+
FnValidationStatus[FnValidationStatus["FAIL"] = 2] = "FAIL";
|
|
18
|
+
})(FnValidationStatus = exports.FnValidationStatus || (exports.FnValidationStatus = {}));
|
|
3
19
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAE3B,MAAM,kBAAkB,GAAG,CAAC,CAAM,EAAE,QAAgB,EAAW,EAAE;IACtE,gBAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,6CAA6C,CAAC,CAAC;IAEtE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B;AAWF,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,iEAAW,CAAA;IACX,+DAAU,CAAA;IACV,2DAAQ,CAAA;AACV,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B"}
|
|
@@ -23,78 +23,15 @@ exports.verify = void 0;
|
|
|
23
23
|
const logger_1 = __importStar(require("../logger"));
|
|
24
24
|
const ffi_1 = require("../ffi");
|
|
25
25
|
const types_1 = require("../ffi/types");
|
|
26
|
-
const url_1 = require("url");
|
|
27
26
|
const pkg = require('../../package.json');
|
|
28
|
-
const
|
|
29
|
-
const objArrayToStringArray = (obj) => {
|
|
30
|
-
return obj.map((o) => JSON.stringify(o));
|
|
31
|
-
};
|
|
27
|
+
const argumentMapper_1 = require("./argumentMapper");
|
|
32
28
|
const verify = (opts) => {
|
|
33
29
|
const ffi = ffi_1.getFfiLib(opts.logLevel);
|
|
34
30
|
if (opts.logLevel) {
|
|
35
31
|
logger_1.setLogLevel(opts.logLevel);
|
|
36
32
|
}
|
|
37
33
|
const handle = ffi.pactffiVerifierNewForApplication(pkg.name.split('/')[1], pkg.version);
|
|
38
|
-
|
|
39
|
-
ffi.pactffiVerifierSetProviderInfo(handle, opts.provider || '', uri.protocol.split(':')[0], uri.hostname, parseInt(uri.port, 10), uri.pathname);
|
|
40
|
-
if (opts.providerStatesSetupUrl) {
|
|
41
|
-
ffi.pactffiVerifierSetProviderState(handle, opts.providerStatesSetupUrl, opts.providerStatesSetupTeardown || true, opts.providerStatesSetupBody || true);
|
|
42
|
-
}
|
|
43
|
-
if (opts.customProviderHeaders) {
|
|
44
|
-
Object.entries(opts.customProviderHeaders).forEach(([key, value]) => {
|
|
45
|
-
ffi.pactffiVerifierAddCustomHeader(handle, key, value);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
const filterDescription = process.env.PACT_DESCRIPTION || '';
|
|
49
|
-
const filterState = process.env.PACT_PROVIDER_STATE || '';
|
|
50
|
-
const filterNoState = process.env.PACT_PROVIDER_NO_STATE ? true : false;
|
|
51
|
-
ffi.pactffiVerifierSetFilterInfo(handle, filterDescription, filterState, filterNoState);
|
|
52
|
-
if (opts.pactUrls) {
|
|
53
|
-
opts.pactUrls.forEach((file) => {
|
|
54
|
-
logger_1.default.debug(`checking source type of given pactUrl: ${file}`);
|
|
55
|
-
try {
|
|
56
|
-
const u = new url_1.URL(file);
|
|
57
|
-
if (u.hostname) {
|
|
58
|
-
logger_1.default.debug(`adding ${file} as a Url source`);
|
|
59
|
-
ffi.pactffiVerifierUrlSource(handle, file, opts.pactBrokerUsername || '', opts.pactBrokerPassword || '', opts.pactBrokerToken || '');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
logger_1.default.debug(`${file} is not a URI`);
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
const f = fs.lstatSync(file);
|
|
67
|
-
if (f.isDirectory()) {
|
|
68
|
-
logger_1.default.debug(`adding ${file} as Directory source`);
|
|
69
|
-
ffi.pactffiVerifierAddDirectorySource(handle, file);
|
|
70
|
-
}
|
|
71
|
-
else if (f.isFile() || f.isSymbolicLink()) {
|
|
72
|
-
logger_1.default.debug(`adding ${file} as File source`);
|
|
73
|
-
ffi.pactffiVerifierAddFileSource(handle, file);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
logger_1.default.debug(`${file} is not a file`);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (opts.disableSslVerification || opts.timeout) {
|
|
82
|
-
ffi.pactffiVerifierSetVerificationOptions(handle, opts.disableSslVerification || false, opts.timeout || 30000);
|
|
83
|
-
}
|
|
84
|
-
if (opts.publishVerificationResult ||
|
|
85
|
-
opts.providerVersion ||
|
|
86
|
-
opts.buildUrl ||
|
|
87
|
-
opts.disableSslVerification ||
|
|
88
|
-
opts.timeout ||
|
|
89
|
-
opts.providerVersionTags) {
|
|
90
|
-
ffi.pactffiVerifierSetPublishOptions(handle, opts.providerVersion || '', opts.buildUrl || '', opts.providerVersionTags || [], opts.providerBranch || '');
|
|
91
|
-
}
|
|
92
|
-
const brokerUrl = opts.pactBrokerUrl || process.env.PACT_BROKER_BASE_URL;
|
|
93
|
-
if (brokerUrl && opts.provider) {
|
|
94
|
-
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
|
|
95
|
-
? objArrayToStringArray(opts.consumerVersionSelectors)
|
|
96
|
-
: [], opts.consumerVersionTags || []);
|
|
97
|
-
}
|
|
34
|
+
argumentMapper_1.setupVerification(ffi, handle, opts);
|
|
98
35
|
return new Promise((resolve, reject) => {
|
|
99
36
|
ffi.pactffiVerifierExecute(handle, (err, res) => {
|
|
100
37
|
logger_1.default.debug(`shutting down verifier with handle ${handle}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeVerifier.js","sourceRoot":"","sources":["nativeVerifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,oDAAgD;AAChD,gCAAmC;AACnC,wCAAwD;
|
|
1
|
+
{"version":3,"file":"nativeVerifier.js","sourceRoot":"","sources":["nativeVerifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,oDAAgD;AAChD,gCAAmC;AACnC,wCAAwD;AAGxD,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1C,qDAAqD;AAE9C,MAAM,MAAM,GAAG,CAAC,IAAqB,EAAmB,EAAE;IAC/D,MAAM,GAAG,GAAG,eAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,oBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAC5B;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,gCAAgC,CACjD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EACtB,GAAG,CAAC,OAAO,CACZ,CAAC;IAEF,kCAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAErC,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,GAAG,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC,GAAU,EAAE,GAAW,EAAE,EAAE;YAC7D,gBAAM,CAAC,KAAK,CAAC,sCAAsC,MAAM,EAAE,CAAC,CAAC;YAE7D,GAAG,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;YAEpC,gBAAM,CAAC,KAAK,CAAC,2BAA2B,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;YACvD,IAAI,GAAG,EAAE;gBACP,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;oBAE3B,gBAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACnB;qBAAM,IAAI,GAAG,CAAC,OAAO,EAAE;oBACtB,gBAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;iBAC3B;gBACD,gBAAM,CAAC,SAAS,CACd,sEAAsE,CACvE,CAAC;gBACF,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;iBAAM;gBACL,QAAQ,GAAG,EAAE;oBACX,KAAK,gCAAwB,CAAC,uBAAuB;wBACnD,gBAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;wBACvC,OAAO,CAAC,aAAa,GAAG,EAAE,CAAC,CAAC;wBAC5B,MAAM;oBACR,KAAK,gCAAwB,CAAC,mBAAmB;wBAC/C,gBAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;wBAC1C,MAAM,CAAC,IAAI,KAAK,CAAC,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;AAzDW,QAAA,MAAM,UAyDjB"}
|
package/src/verifier/types.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import { VerifierOptions } from './types';
|
|
2
|
-
export declare const
|
|
1
|
+
import { InternalPactVerifierOptions, VerifierOptions } from './types';
|
|
2
|
+
export declare const deprecatedFunction: (_: InternalPactVerifierOptions) => (_: any, property: string) => boolean;
|
|
3
|
+
export declare const incompatibleWith: (keys: (keyof InternalPactVerifierOptions)[]) => (options: InternalPactVerifierOptions) => (_: any, property: string) => boolean;
|
|
4
|
+
export declare const requires: (keys: (keyof InternalPactVerifierOptions)[]) => (options: InternalPactVerifierOptions) => (_: any, property: string) => boolean;
|
|
5
|
+
export declare const requiresOneOf: (keys: (keyof InternalPactVerifierOptions)[]) => (options: InternalPactVerifierOptions) => (_: any, property: string) => boolean;
|
|
6
|
+
export declare type AssertFunction = (a: any, ...args: any) => boolean;
|
|
7
|
+
export declare const wrapCheckType: (fn: AssertFunction) => (_: InternalPactVerifierOptions) => AssertFunction;
|
|
8
|
+
export declare type ArgumentValidationRules<T> = {
|
|
9
|
+
[Key in keyof T]-?: ((options: T) => AssertFunction)[];
|
|
10
|
+
};
|
|
11
|
+
export declare const validationRules: ArgumentValidationRules<InternalPactVerifierOptions>;
|
|
12
|
+
export declare const validateOptions: (options: VerifierOptions) => VerifierOptions;
|
|
@@ -1,44 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
4
20
|
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateOptions = void 0;
|
|
22
|
+
exports.validateOptions = exports.validationRules = exports.wrapCheckType = exports.requiresOneOf = exports.requires = exports.incompatibleWith = exports.deprecatedFunction = void 0;
|
|
7
23
|
const checkTypes = require("check-types");
|
|
8
|
-
const logger_1 =
|
|
24
|
+
const logger_1 = __importStar(require("../logger"));
|
|
25
|
+
const underscore_1 = require("underscore");
|
|
26
|
+
const deprecatedFunction = (_) => (_, property) => {
|
|
27
|
+
logger_1.default.warn(`${property} is deprecated and no longer has any effect`);
|
|
28
|
+
return true;
|
|
29
|
+
};
|
|
30
|
+
exports.deprecatedFunction = deprecatedFunction;
|
|
31
|
+
const incompatibleWith = (keys) => (options) => (_, property) => {
|
|
32
|
+
const incompatibilities = underscore_1.pick(options, keys);
|
|
33
|
+
if (Object.keys(incompatibilities).length > 0) {
|
|
34
|
+
logger_1.logErrorAndThrow(`${property} is incompatible with the following properties: ${keys.join(',')}`);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
exports.incompatibleWith = incompatibleWith;
|
|
40
|
+
const requires = (keys) => (options) => (_, property) => {
|
|
41
|
+
const required = underscore_1.pick(options, keys);
|
|
42
|
+
if (keys.length !== Object.keys(required).length) {
|
|
43
|
+
logger_1.logErrorAndThrow(`${property} requires the following properties: ${keys.join(',')}`);
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
};
|
|
48
|
+
exports.requires = requires;
|
|
49
|
+
const requiresOneOf = (keys) => (options) => (_, property) => {
|
|
50
|
+
const required = underscore_1.pick(options, keys);
|
|
51
|
+
if (Object.keys(required).length === 0) {
|
|
52
|
+
logger_1.logErrorAndThrow(`${property} requires one of the following properties: ${keys.join(',')}`);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
exports.requiresOneOf = requiresOneOf;
|
|
58
|
+
const wrapCheckType = (fn) => (_) => fn;
|
|
59
|
+
exports.wrapCheckType = wrapCheckType;
|
|
9
60
|
const LogLevels = ['debug', 'error', 'info', 'trace', 'warn'];
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (LogLevels.includes(options.logLevel.toLowerCase())) {
|
|
14
|
-
options.logLevel = options.logLevel.toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
throw new Error(`The logLevel '${options.logLevel}' is not a valid logLevel. The valid options are: ${LogLevels.join(', ')}`);
|
|
18
|
-
}
|
|
61
|
+
const logLevelValidator = (_) => (l) => {
|
|
62
|
+
if (LogLevels.includes(l.toLowerCase())) {
|
|
63
|
+
l = l.toLowerCase();
|
|
19
64
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
!checkTypes.array.of.string(options.providerVersionTags)) {
|
|
23
|
-
throw new Error('providerVersionTags should be a string or an array of strings');
|
|
24
|
-
}
|
|
25
|
-
if (options.providerVersionTags.includes('latest')) {
|
|
26
|
-
logger_1.default.warn("Using the tag 'latest' is not recommended and probably does not do what you intended.");
|
|
27
|
-
logger_1.default.warn(' See https://docs.pact.io/pact_broker/tags/#latest-pacts');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (options.consumerVersionTags) {
|
|
31
|
-
if (!checkTypes.string(options.consumerVersionTags) &&
|
|
32
|
-
!checkTypes.array.of.string(options.consumerVersionTags)) {
|
|
33
|
-
throw new Error('consumerVersionTags should be a string or an array of strings');
|
|
34
|
-
}
|
|
35
|
-
if (options.consumerVersionTags.includes('latest')) {
|
|
36
|
-
logger_1.default.warn("Using the tag 'latest' is not recommended and probably does not do what you intended.");
|
|
37
|
-
logger_1.default.warn(' See https://docs.pact.io/pact_broker/tags/#latest-pacts');
|
|
38
|
-
logger_1.default.warn(' If you need to specify latest, try:');
|
|
39
|
-
logger_1.default.warn(' consumerVersionSelectors: [{ lastest: true }]');
|
|
40
|
-
}
|
|
65
|
+
else {
|
|
66
|
+
throw new Error(`The logLevel '${l}' is not a valid logLevel. The valid options are: ${LogLevels.join(', ')}`);
|
|
41
67
|
}
|
|
68
|
+
return true;
|
|
69
|
+
};
|
|
70
|
+
const consumerVersionSelectorValidator = (options) => (l) => {
|
|
42
71
|
if (options.consumerVersionSelectors &&
|
|
43
72
|
Array.isArray(options.consumerVersionSelectors)) {
|
|
44
73
|
const PROPS = [
|
|
@@ -63,61 +92,97 @@ const validateOptions = (o) => {
|
|
|
63
92
|
}
|
|
64
93
|
Object.keys(selector).forEach((key) => {
|
|
65
94
|
if (!PROPS.includes(key)) {
|
|
66
|
-
|
|
95
|
+
logger_1.default.warn(`The consumer version selector '${key}' is unknown but will be sent through to the validation. Allowed properties are ${PROPS.join(', ')})`);
|
|
67
96
|
}
|
|
68
97
|
});
|
|
69
98
|
});
|
|
70
99
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
checkTypes.assert.string(options.providerStatesSetupUrl, 'providerStatesSetupUrl must be a non-empty string');
|
|
86
|
-
}
|
|
87
|
-
if (options.pactBrokerUsername) {
|
|
88
|
-
checkTypes.assert.string(options.pactBrokerUsername, 'pactBrokerUsername must be a non-empty string');
|
|
89
|
-
}
|
|
90
|
-
if (options.pactBrokerPassword) {
|
|
91
|
-
checkTypes.assert.string(options.pactBrokerPassword, 'pactBrokerPassword must be a string');
|
|
92
|
-
}
|
|
93
|
-
if (options.pactBrokerToken &&
|
|
94
|
-
(options.pactBrokerUsername || options.pactBrokerPassword)) {
|
|
95
|
-
throw new Error('Must provide pactBrokerToken or pactBrokerUsername/pactBrokerPassword but not both.');
|
|
96
|
-
}
|
|
97
|
-
if (options.pactBrokerUrl) {
|
|
98
|
-
checkTypes.assert.string(options.pactBrokerUrl, 'pactBrokerUrl must be a string');
|
|
99
|
-
}
|
|
100
|
-
if (options.pactUrls) {
|
|
101
|
-
checkTypes.assert.array.of.string(options.pactUrls, 'pactUrls must be an array of strings');
|
|
102
|
-
}
|
|
103
|
-
if (options.providerBaseUrl) {
|
|
104
|
-
checkTypes.assert.string(options.providerBaseUrl, 'providerBaseUrl must be a string');
|
|
105
|
-
}
|
|
106
|
-
if (options.publishVerificationResult) {
|
|
107
|
-
checkTypes.assert.boolean(options.publishVerificationResult, 'publishVerificationResult must be a boolean');
|
|
108
|
-
}
|
|
109
|
-
if (options.publishVerificationResult && !options.providerVersion) {
|
|
110
|
-
throw new Error('Must provide both or none of publishVerificationResult and providerVersion.');
|
|
111
|
-
}
|
|
112
|
-
if (options.providerVersion) {
|
|
113
|
-
checkTypes.assert.string(options.providerVersion, 'providerVersion must be a string');
|
|
114
|
-
}
|
|
115
|
-
if (options.enablePending !== undefined) {
|
|
116
|
-
checkTypes.assert.boolean(options.enablePending, 'enablePending must be a boolean');
|
|
117
|
-
}
|
|
118
|
-
if (options.timeout) {
|
|
119
|
-
checkTypes.assert.positive(options.timeout, 'timeout must be a positive number');
|
|
100
|
+
return true;
|
|
101
|
+
};
|
|
102
|
+
const consumerVersionTagsValidator = (options) => (l) => {
|
|
103
|
+
if (options.consumerVersionTags) {
|
|
104
|
+
if (!checkTypes.string(options.consumerVersionTags) &&
|
|
105
|
+
!checkTypes.array.of.string(options.consumerVersionTags)) {
|
|
106
|
+
throw new Error('consumerVersionTags should be a string or an array of strings');
|
|
107
|
+
}
|
|
108
|
+
if (options.consumerVersionTags.includes('latest')) {
|
|
109
|
+
logger_1.default.warn("Using the tag 'latest' is not recommended and probably does not do what you intended.");
|
|
110
|
+
logger_1.default.warn(' See https://docs.pact.io/pact_broker/tags/#latest-pacts');
|
|
111
|
+
logger_1.default.warn(' If you need to specify latest, try:');
|
|
112
|
+
logger_1.default.warn(' consumerVersionSelectors: [{ lastest: true }]');
|
|
113
|
+
}
|
|
120
114
|
}
|
|
115
|
+
return true;
|
|
116
|
+
};
|
|
117
|
+
exports.validationRules = {
|
|
118
|
+
providerBaseUrl: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
119
|
+
buildUrl: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
120
|
+
consumerVersionSelectors: [consumerVersionSelectorValidator],
|
|
121
|
+
consumerVersionTags: [consumerVersionTagsValidator],
|
|
122
|
+
customProviderHeaders: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
123
|
+
disableSslVerification: [exports.wrapCheckType(checkTypes.assert.boolean)],
|
|
124
|
+
enablePending: [exports.wrapCheckType(checkTypes.assert.boolean)],
|
|
125
|
+
format: [exports.deprecatedFunction],
|
|
126
|
+
includeWipPactsSince: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
127
|
+
provider: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
128
|
+
pactUrls: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
129
|
+
pactBrokerUrl: [
|
|
130
|
+
exports.wrapCheckType(checkTypes.assert.nonEmptyString),
|
|
131
|
+
exports.requires(['provider']),
|
|
132
|
+
exports.requiresOneOf([
|
|
133
|
+
'pactUrls',
|
|
134
|
+
'consumerVersionSelectors',
|
|
135
|
+
'consumerVersionTags',
|
|
136
|
+
]),
|
|
137
|
+
],
|
|
138
|
+
pactBrokerUsername: [
|
|
139
|
+
exports.wrapCheckType(checkTypes.assert.nonEmptyString),
|
|
140
|
+
exports.incompatibleWith(['pactBrokerToken']),
|
|
141
|
+
exports.requires(['pactBrokerPassword']),
|
|
142
|
+
],
|
|
143
|
+
pactBrokerPassword: [
|
|
144
|
+
exports.wrapCheckType(checkTypes.assert.nonEmptyString),
|
|
145
|
+
exports.incompatibleWith(['pactBrokerToken']),
|
|
146
|
+
exports.requires(['pactBrokerUsername']),
|
|
147
|
+
],
|
|
148
|
+
pactBrokerToken: [
|
|
149
|
+
exports.wrapCheckType(checkTypes.assert.nonEmptyString),
|
|
150
|
+
exports.incompatibleWith(['pactBrokerUsername', 'pactBrokerPassword']),
|
|
151
|
+
],
|
|
152
|
+
providerVersionTags: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
153
|
+
providerBranch: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
154
|
+
providerStatesSetupUrl: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
155
|
+
providerStatesSetupTeardown: [exports.wrapCheckType(checkTypes.assert.boolean)],
|
|
156
|
+
providerStatesSetupBody: [exports.wrapCheckType(checkTypes.assert.boolean)],
|
|
157
|
+
publishVerificationResult: [
|
|
158
|
+
exports.wrapCheckType(checkTypes.assert.boolean),
|
|
159
|
+
exports.requires(['providerVersion']),
|
|
160
|
+
],
|
|
161
|
+
providerVersion: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
162
|
+
timeout: [exports.wrapCheckType(checkTypes.assert.positive)],
|
|
163
|
+
logLevel: [logLevelValidator],
|
|
164
|
+
out: [exports.deprecatedFunction],
|
|
165
|
+
verbose: [exports.deprecatedFunction],
|
|
166
|
+
monkeypatch: [exports.deprecatedFunction],
|
|
167
|
+
logDir: [exports.deprecatedFunction],
|
|
168
|
+
consumerFilters: [exports.wrapCheckType(checkTypes.assert.nonEmptyString)],
|
|
169
|
+
};
|
|
170
|
+
const validateOptions = (options) => {
|
|
171
|
+
Object.keys(options).concat('providerBaseUrl').map((k) => {
|
|
172
|
+
const rules = exports.validationRules[k];
|
|
173
|
+
if (Array.isArray(options[k])) {
|
|
174
|
+
options[k].map((item) => {
|
|
175
|
+
rules.map((rule) => {
|
|
176
|
+
rule(options)(item, k);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
rules.map((rule) => {
|
|
182
|
+
rule(options)(options[k], k);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|
|
121
186
|
return options;
|
|
122
187
|
};
|
|
123
188
|
exports.validateOptions = validateOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOptions.js","sourceRoot":"","sources":["validateOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateOptions.js","sourceRoot":"","sources":["validateOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2C;AAC3C,oDAAqD;AAErD,2CAAkC;AAO3B,MAAM,kBAAkB,GAC7B,CAAC,CAA8B,EAAE,EAAE,CACnC,CAAC,CAAM,EAAE,QAAgB,EAAW,EAAE;IACpC,gBAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,6CAA6C,CAAC,CAAC;IAEtE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AANS,QAAA,kBAAkB,sBAM3B;AAEG,MAAM,gBAAgB,GAC3B,CAAC,IAA2C,EAAE,EAAE,CAChD,CAAC,OAAoC,EAAE,EAAE,CACzC,CAAC,CAAM,EAAE,QAAgB,EAAW,EAAE;IACpC,MAAM,iBAAiB,GAAG,iBAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE9C,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7C,yBAAgB,CACd,GAAG,QAAQ,mDAAmD,IAAI,CAAC,IAAI,CACrE,GAAG,CACJ,EAAE,CACJ,CAAC;QACF,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAhBS,QAAA,gBAAgB,oBAgBzB;AAEG,MAAM,QAAQ,GACnB,CAAC,IAA2C,EAAE,EAAE,CAChD,CAAC,OAAoC,EAAE,EAAE,CACzC,CAAC,CAAM,EAAE,QAAgB,EAAW,EAAE;IACpC,MAAM,QAAQ,GAAG,iBAAI,CAAC,OAAO,EAA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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAxBW,QAAA,eAAe,mBAwB1B"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUriType = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const url = require("url");
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const getUriType = (uri) => {
|
|
8
|
-
if (/https?:/.test(url.parse(uri).protocol || '')) {
|
|
9
|
-
return 'URL';
|
|
10
|
-
}
|
|
11
|
-
try {
|
|
12
|
-
if (fs.statSync(path.normalize(uri)).isDirectory()) {
|
|
13
|
-
return 'DIRECTORY';
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return 'FILE';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
throw new Error(`Pact file or directory '${uri}' doesn't exist`);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
exports.getUriType = getUriType;
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,6BAA8B;AAC9B,2BAA4B;AAC5B,yBAA0B;AAInB,MAAM,UAAU,GAAG,CAAC,GAAW,EAAW,EAAE;IACjD,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE;QACjD,OAAO,KAAK,CAAC;KACd;IACD,IAAI;QACF,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;YAClD,OAAO,WAAW,CAAC;SACpB;aAAM;YACL,OAAO,MAAM,CAAC;SACf;KACF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,iBAAiB,CAAC,CAAC;KAClE;AACH,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type UriType = 'URL' | 'DIRECTORY' | 'FILE';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""}
|