@chainlink/external-adapter-framework 0.28.6 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter/basic.d.ts +3 -2
- package/adapter/basic.js.map +1 -1
- package/adapter/endpoint.d.ts +6 -8
- package/adapter/endpoint.js +6 -6
- package/adapter/endpoint.js.map +1 -1
- package/adapter/price.d.ts +21 -18
- package/adapter/price.js +2 -2
- package/adapter/price.js.map +1 -1
- package/adapter/types.d.ts +6 -14
- package/cache/index.d.ts +2 -2
- package/cache/index.js +2 -2
- package/cache/index.js.map +1 -1
- package/cache/response.d.ts +5 -5
- package/cache/response.js.map +1 -1
- package/config/index.d.ts +31 -30
- package/config/index.js.map +1 -1
- package/metrics/index.d.ts +2 -1
- package/metrics/index.js.map +1 -1
- package/metrics/util.d.ts +1 -1
- package/package.json +9 -9
- package/transports/abstract/streaming.d.ts +5 -4
- package/transports/abstract/streaming.js.map +1 -1
- package/transports/abstract/subscription.d.ts +6 -8
- package/transports/abstract/subscription.js.map +1 -1
- package/transports/http.d.ts +5 -4
- package/transports/http.js.map +1 -1
- package/transports/index.d.ts +7 -12
- package/transports/index.js.map +1 -1
- package/transports/metrics.d.ts +4 -3
- package/transports/metrics.js.map +1 -1
- package/transports/sse.d.ts +5 -4
- package/transports/sse.js.map +1 -1
- package/transports/websocket.d.ts +7 -6
- package/transports/websocket.js +1 -1
- package/transports/websocket.js.map +1 -1
- package/util/censor/censor-list.js +1 -1
- package/util/censor/censor-list.js.map +1 -1
- package/util/index.d.ts +7 -3
- package/util/index.js +9 -7
- package/util/index.js.map +1 -1
- package/util/logger.d.ts +4 -3
- package/util/logger.js +2 -2
- package/util/logger.js.map +1 -1
- package/util/types.d.ts +20 -16
- package/validation/index.d.ts +1 -1
- package/validation/index.js +7 -2
- package/validation/index.js.map +1 -1
- package/validation/input-params.d.ts +192 -13
- package/validation/input-params.js +226 -0
- package/validation/input-params.js.map +1 -1
- package/validation/utils.d.ts +5 -6
- package/validation/utils.js +5 -15
- package/validation/utils.js.map +1 -1
- package/validation/input-validator.d.ts +0 -19
- package/validation/input-validator.js +0 -153
- package/validation/input-validator.js.map +0 -1
|
@@ -1,22 +1,201 @@
|
|
|
1
|
-
import { ReservedInputParameterNames } from '../util';
|
|
1
|
+
import { Overrides, ReservedInputParameterNames } from '../util';
|
|
2
|
+
/**
|
|
3
|
+
* Type for the overrides object that is either hardcoded in the adapter,
|
|
4
|
+
* or present in the incoming request body
|
|
5
|
+
*/
|
|
2
6
|
export type Override = Map<string, Map<string, string>>;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Possible strings that correspond to types of primitive values
|
|
9
|
+
* that can be specified for an input parameter
|
|
10
|
+
*/
|
|
11
|
+
type PrimitiveParameterTypeString = 'boolean' | 'number' | 'string';
|
|
12
|
+
/**
|
|
13
|
+
* Possible types for each of the possible type strings
|
|
14
|
+
*/
|
|
15
|
+
type PrimitiveParameterType = TypeFromTypeString<PrimitiveParameterTypeString>;
|
|
16
|
+
/**
|
|
17
|
+
* All possible types for an input parameter (either a string, or a nested param definition)
|
|
18
|
+
*/
|
|
19
|
+
type ParameterType = PrimitiveParameterTypeString | InputParametersDefinition;
|
|
20
|
+
/**
|
|
21
|
+
* Given a type parameter T that is a parameter type (string or nested definition),
|
|
22
|
+
* equals to the corresponding type for that type string or definition
|
|
23
|
+
*/
|
|
24
|
+
type TypeFromTypeString<T extends ParameterType> = T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T extends InputParametersDefinition ? TypeFromDefinition<T> : never;
|
|
25
|
+
/**
|
|
26
|
+
* Util type to be able to discern exactly if a generic is exactly unknown
|
|
27
|
+
* (because everything extends unknown, but unknown only extends itself)
|
|
28
|
+
*/
|
|
29
|
+
type IsUnknown<T> = unknown extends T ? true : false;
|
|
30
|
+
/**
|
|
31
|
+
* Given a concrete InputParameter P, results in the type for that definition taking into account
|
|
32
|
+
* the required property of the definition (i.e. makes it optional or not)
|
|
33
|
+
*/
|
|
34
|
+
type ShouldBeUndefinable<P extends InputParameter, T = TypeFromTypeString<P['type']>> = P['required'] extends true ? T : IsUnknown<P['default']> extends true ? T | undefined : T;
|
|
35
|
+
/**
|
|
36
|
+
* Just an alias to make types below more readable
|
|
37
|
+
*/
|
|
38
|
+
type NonArrayInputType<P extends InputParameter> = ShouldBeUndefinable<P>;
|
|
39
|
+
/**
|
|
40
|
+
* Given an InputParameter P, results in the corresponding type for that definition,
|
|
41
|
+
* accounting for configurations like required, array, defaults, etc.
|
|
42
|
+
*/
|
|
43
|
+
type TypeFromParameter<P extends InputParameter, T = TypeFromTypeString<P['type']>> = P['array'] extends true ? T[] : NonArrayInputType<P>;
|
|
44
|
+
/**
|
|
45
|
+
* Constraint for an InputParameter to make sure options are only specified for parameters of type string.
|
|
46
|
+
* All these constraints, for them to work properly, should represent the entire closed realm of possibilities.
|
|
47
|
+
* That is, there should be no possible input parameter that the constraint doesn't accept one way or the other.
|
|
48
|
+
*/
|
|
49
|
+
type InputParameterOptionConstraints = {
|
|
50
|
+
type: 'string';
|
|
51
|
+
options?: string[] | readonly string[];
|
|
52
|
+
} | {
|
|
53
|
+
type: 'number';
|
|
54
|
+
options?: number[] | readonly number[];
|
|
55
|
+
} | {
|
|
56
|
+
type: Exclude<ParameterType, 'string' | 'number'>;
|
|
57
|
+
options?: never;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Constraint to make sure input parameter defaults match their type, and that
|
|
61
|
+
* defaults are only allowed for primitive types
|
|
62
|
+
*/
|
|
63
|
+
type InputParameterDefaultTypeConstraints = {
|
|
64
|
+
type: 'string';
|
|
65
|
+
default?: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: 'number';
|
|
68
|
+
default?: number;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'boolean';
|
|
71
|
+
default?: boolean;
|
|
72
|
+
} | {
|
|
73
|
+
type: Exclude<ParameterType, 'string' | 'number' | 'boolean'>;
|
|
74
|
+
default?: never;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Constraint to avoid unnecessary or impossible required and default combinations
|
|
78
|
+
*/
|
|
79
|
+
type InputParameterDefaultRequiredConstraints = {
|
|
80
|
+
required: true;
|
|
81
|
+
default?: never;
|
|
82
|
+
} | {
|
|
83
|
+
required?: false;
|
|
84
|
+
default?: PrimitiveParameterType;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Constraint to make sure array input parameters don't specify a default
|
|
88
|
+
*/
|
|
89
|
+
type InputParameterArrayDefaultConstraints = {
|
|
90
|
+
array: true;
|
|
91
|
+
default?: never;
|
|
92
|
+
} | {
|
|
93
|
+
array?: false;
|
|
94
|
+
default?: PrimitiveParameterType;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Basic structure for an InputParameter.
|
|
98
|
+
* The concrete possible types that will be used in a definition can be found below this one.
|
|
99
|
+
* (they are split into several types due to existential types not being supported)
|
|
100
|
+
*/
|
|
101
|
+
type BaseInputParameter = {
|
|
102
|
+
description: string;
|
|
103
|
+
type: ParameterType;
|
|
104
|
+
default?: PrimitiveParameterType;
|
|
8
105
|
required?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
106
|
+
array?: boolean;
|
|
107
|
+
options?: string[] | readonly string[] | number | readonly number[];
|
|
108
|
+
aliases?: readonly string[];
|
|
11
109
|
dependsOn?: readonly string[];
|
|
12
110
|
exclusive?: readonly string[];
|
|
13
111
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Type for the definition of one InputParameter.
|
|
114
|
+
* This is built from the base type, intersected with a bunch of constraints.
|
|
115
|
+
*/
|
|
116
|
+
export type InputParameter = BaseInputParameter & InputParameterOptionConstraints & InputParameterDefaultTypeConstraints & InputParameterDefaultRequiredConstraints & InputParameterArrayDefaultConstraints;
|
|
117
|
+
/**
|
|
118
|
+
* Map of input names to their corresponding definition.
|
|
119
|
+
*/
|
|
120
|
+
export type InputParametersDefinition = Record<string, InputParameter>;
|
|
121
|
+
/**
|
|
122
|
+
* Constrains the InputParametersDefinition to exclude reserved param names.
|
|
123
|
+
*/
|
|
124
|
+
type ProperInputParametersDefinition = InputParametersDefinition & {
|
|
17
125
|
[K in ReservedInputParameterNames]?: never;
|
|
18
126
|
};
|
|
19
|
-
|
|
20
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Given an input parameter definition, results in the type for the actual params object.
|
|
129
|
+
*/
|
|
130
|
+
export type TypeFromDefinition<T extends InputParametersDefinition> = {
|
|
131
|
+
-readonly [K in keyof T]: TypeFromParameter<T[K]>;
|
|
21
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Util type to represent the absence of input parameters for an adapter endpoint.
|
|
135
|
+
*/
|
|
136
|
+
export type EmptyInputParameters = InputParametersDefinition;
|
|
137
|
+
/**
|
|
138
|
+
* This class encapsulates logic for a single input parameter, taking its definition
|
|
139
|
+
* and performing validations (both on the definition on construction, and params when prompted).
|
|
140
|
+
*/
|
|
141
|
+
declare class ProcessedParam<const T extends InputParameter = InputParameter> {
|
|
142
|
+
name: string;
|
|
143
|
+
definition: T;
|
|
144
|
+
/** List of aliases for this processed parameter, including the original parameter name */
|
|
145
|
+
aliases: string[];
|
|
146
|
+
/** Set of all possible options for this parameter (used when validating inputs) */
|
|
147
|
+
options?: Set<TypeFromParameter<T>>;
|
|
148
|
+
/** Definition for the type of this parameter */
|
|
149
|
+
type: PrimitiveParameterTypeString | InputParameters<InputParametersDefinition>;
|
|
150
|
+
constructor(name: string, definition: T);
|
|
151
|
+
/** Util method to throw a definition error prefixed with this param name */
|
|
152
|
+
private definitionError;
|
|
153
|
+
/** Util method to throw a validation error prefixed with this param name */
|
|
154
|
+
private validationError;
|
|
155
|
+
/**
|
|
156
|
+
* Validates the definition that this parameter has been constructed with.
|
|
157
|
+
*/
|
|
158
|
+
private validateDefinition;
|
|
159
|
+
/**
|
|
160
|
+
* Validates an incoming adapter request's input params and
|
|
161
|
+
* performs all necessary checks and modifications.
|
|
162
|
+
*
|
|
163
|
+
* @param input - the input data from an incoming adapter request
|
|
164
|
+
* @returns - the validated data
|
|
165
|
+
*/
|
|
166
|
+
validateInput(input: unknown): unknown;
|
|
167
|
+
/**
|
|
168
|
+
* Validates a single value from the incoming params.
|
|
169
|
+
*
|
|
170
|
+
* @param input - a single value from the request params object
|
|
171
|
+
* @returns - the validated input data
|
|
172
|
+
*/
|
|
173
|
+
private validateInputType;
|
|
174
|
+
}
|
|
175
|
+
export declare class InputParameters<const T extends ProperInputParametersDefinition> {
|
|
176
|
+
definition: T;
|
|
177
|
+
params: ProcessedParam[];
|
|
178
|
+
constructor(definition: T);
|
|
179
|
+
/**
|
|
180
|
+
* Validates the entire definitions object provided to the constructor.
|
|
181
|
+
*/
|
|
182
|
+
private validateDefinition;
|
|
183
|
+
/**
|
|
184
|
+
* Validates an incoming adapter request's input params and
|
|
185
|
+
* performs all necessary checks and modifications.
|
|
186
|
+
*
|
|
187
|
+
* @param input - the input data from an incoming adapter request
|
|
188
|
+
* @returns - the validated data
|
|
189
|
+
*/
|
|
190
|
+
validateInput(rawData: unknown): TypeFromDefinition<T>;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Validates that the overrides object in a request (if present) is correct.
|
|
194
|
+
*
|
|
195
|
+
* @param input - a request's input data, which may contain overrides
|
|
196
|
+
* @returns nothing, only throws if an error is found
|
|
197
|
+
*/
|
|
198
|
+
export declare const validateOverrides: (input: {
|
|
199
|
+
overrides?: Overrides;
|
|
200
|
+
}) => void;
|
|
22
201
|
export {};
|
|
@@ -1,3 +1,229 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateOverrides = exports.InputParameters = void 0;
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const error_1 = require("./error");
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown when the validation of a request's params fails.
|
|
8
|
+
*/
|
|
9
|
+
class InputValidationError extends error_1.AdapterError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super({
|
|
12
|
+
statusCode: 400,
|
|
13
|
+
message,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when the validation of the input parameters definition fails.
|
|
19
|
+
*/
|
|
20
|
+
class InputParametersDefinitionError extends Error {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This class encapsulates logic for a single input parameter, taking its definition
|
|
24
|
+
* and performing validations (both on the definition on construction, and params when prompted).
|
|
25
|
+
*/
|
|
26
|
+
class ProcessedParam {
|
|
27
|
+
constructor(name, definition) {
|
|
28
|
+
this.name = name;
|
|
29
|
+
this.definition = definition;
|
|
30
|
+
this.aliases = [this.name, ...(this.definition.aliases || [])];
|
|
31
|
+
this.type =
|
|
32
|
+
typeof definition.type === 'object' ? new InputParameters(definition.type) : definition.type;
|
|
33
|
+
if (definition.options) {
|
|
34
|
+
this.options = new Set(definition.options);
|
|
35
|
+
}
|
|
36
|
+
this.validateDefinition();
|
|
37
|
+
}
|
|
38
|
+
/** Util method to throw a definition error prefixed with this param name */
|
|
39
|
+
definitionError(message) {
|
|
40
|
+
return new InputParametersDefinitionError(`[Param: ${this.name}] ${message}`);
|
|
41
|
+
}
|
|
42
|
+
/** Util method to throw a validation error prefixed with this param name */
|
|
43
|
+
validationError(message) {
|
|
44
|
+
return new InputValidationError(`[Param: ${this.name}] ${message}`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validates the definition that this parameter has been constructed with.
|
|
48
|
+
*/
|
|
49
|
+
validateDefinition() {
|
|
50
|
+
// Check that there are no repeated aliases
|
|
51
|
+
if ((0, util_1.hasRepeatedValues)(this.aliases)) {
|
|
52
|
+
throw this.definitionError(`There are repeated aliases for input param ${this.name}: ${this.aliases}`);
|
|
53
|
+
}
|
|
54
|
+
// Check that if options are specified it has at least one entry
|
|
55
|
+
if (this.definition.options?.length === 0) {
|
|
56
|
+
throw this.definitionError(`The options array must contain at least one option`);
|
|
57
|
+
}
|
|
58
|
+
// Check that there are no repeated options
|
|
59
|
+
if (this.options && this.definition.options?.length !== this.options.size) {
|
|
60
|
+
throw this.definitionError(`There are duplicates in the specified options: ${this.definition.options}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Validates an incoming adapter request's input params and
|
|
65
|
+
* performs all necessary checks and modifications.
|
|
66
|
+
*
|
|
67
|
+
* @param input - the input data from an incoming adapter request
|
|
68
|
+
* @returns - the validated data
|
|
69
|
+
*/
|
|
70
|
+
validateInput(input) {
|
|
71
|
+
if (this.definition.required && input == null) {
|
|
72
|
+
throw this.validationError('param is required but no value was provided');
|
|
73
|
+
}
|
|
74
|
+
if (this.definition.default && input == null) {
|
|
75
|
+
return this.definition.default;
|
|
76
|
+
}
|
|
77
|
+
if (this.definition.array) {
|
|
78
|
+
if (!(Array.isArray(input) && input.length >= 0)) {
|
|
79
|
+
if (this.definition.required || input != null) {
|
|
80
|
+
throw this.validationError('input value must be a non-empty array');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Validate each value from the array individually
|
|
87
|
+
return input.map((item) => this.validateInputType(item));
|
|
88
|
+
}
|
|
89
|
+
// We already know this won't be an array, but the generics are too complex for typescript
|
|
90
|
+
// to infer by itself so we cast manually
|
|
91
|
+
return this.validateInputType(input);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validates a single value from the incoming params.
|
|
95
|
+
*
|
|
96
|
+
* @param input - a single value from the request params object
|
|
97
|
+
* @returns - the validated input data
|
|
98
|
+
*/
|
|
99
|
+
validateInputType(input) {
|
|
100
|
+
// If we're here we've already checked this is not required
|
|
101
|
+
if (input == null) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// If the type is a nested input params object, use that to validate
|
|
105
|
+
if (this.type instanceof InputParameters) {
|
|
106
|
+
return this.type.validateInput(input);
|
|
107
|
+
}
|
|
108
|
+
// If the param has specified options, check that the input is one of them.
|
|
109
|
+
// In this case we don't need to check the type, since the options will do that for us
|
|
110
|
+
if (this.options && !this.options.has(input)) {
|
|
111
|
+
throw this.validationError(`input is not one of valid options (${this.definition.options})`);
|
|
112
|
+
}
|
|
113
|
+
else if (typeof input !== this.definition.type) {
|
|
114
|
+
throw this.validationError(`input type is not the expected one (${this.type})`);
|
|
115
|
+
}
|
|
116
|
+
// If no validations failed and no defaults / modifications were applied, use the original input
|
|
117
|
+
return input;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class InputParameters {
|
|
121
|
+
constructor(definition) {
|
|
122
|
+
this.definition = definition;
|
|
123
|
+
this.params = Object.entries(this.definition).map(([name, param]) => new ProcessedParam(name, param));
|
|
124
|
+
// Check that all options match param type
|
|
125
|
+
// Check that defaults matches param validation
|
|
126
|
+
this.validateDefinition();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Validates the entire definitions object provided to the constructor.
|
|
130
|
+
*/
|
|
131
|
+
validateDefinition() {
|
|
132
|
+
const paramNames = new Set(this.params.map((p) => p.name));
|
|
133
|
+
// Check that aliases don't clash with other properties
|
|
134
|
+
if ((0, util_1.hasRepeatedValues)(this.params.map((p) => p.aliases).flat())) {
|
|
135
|
+
throw new InputParametersDefinitionError('There are clashes in property names and aliases, check that they are all unique');
|
|
136
|
+
}
|
|
137
|
+
for (const param of this.params) {
|
|
138
|
+
// Check that all dependencies reference valid options
|
|
139
|
+
for (const dependency of param.definition.dependsOn || []) {
|
|
140
|
+
if (!paramNames.has(dependency)) {
|
|
141
|
+
throw new InputParametersDefinitionError(`Param "${param.name}" depends on non-existent param "${dependency}"`);
|
|
142
|
+
}
|
|
143
|
+
if (this.definition[dependency].required) {
|
|
144
|
+
throw new InputParametersDefinitionError(`Param "${param.name}" has an unnecessary dependency on "${dependency}" (dependency is always required)`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
for (const exclusion of param.definition.exclusive || []) {
|
|
148
|
+
if (!paramNames.has(exclusion)) {
|
|
149
|
+
throw new InputParametersDefinitionError(`Param "${param.name}" excludes non-existent param "${exclusion}"`);
|
|
150
|
+
}
|
|
151
|
+
if (this.definition[exclusion].required) {
|
|
152
|
+
throw new InputParametersDefinitionError(`Param "${param.name}" excludes required (i.e. always present) param "${exclusion}"`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Validates an incoming adapter request's input params and
|
|
159
|
+
* performs all necessary checks and modifications.
|
|
160
|
+
*
|
|
161
|
+
* @param input - the input data from an incoming adapter request
|
|
162
|
+
* @returns - the validated data
|
|
163
|
+
*/
|
|
164
|
+
validateInput(rawData) {
|
|
165
|
+
if (typeof rawData !== 'object' || rawData == null) {
|
|
166
|
+
throw new InputValidationError('Input for input parameters should be an object');
|
|
167
|
+
}
|
|
168
|
+
const data = rawData;
|
|
169
|
+
const validated = {};
|
|
170
|
+
// Validate each param individually
|
|
171
|
+
for (const param of this.params) {
|
|
172
|
+
let value;
|
|
173
|
+
for (const alias of param.aliases) {
|
|
174
|
+
if (data[alias] == null) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (value) {
|
|
178
|
+
throw new InputValidationError(`Parameter "${param.name}" is specified more than once (aliases: ${param.aliases})`);
|
|
179
|
+
}
|
|
180
|
+
value = data[alias];
|
|
181
|
+
}
|
|
182
|
+
// Perform all validations for the individual param value
|
|
183
|
+
validated[param.name] = param.validateInput(value);
|
|
184
|
+
}
|
|
185
|
+
// We iterate again, now with the complete validated obj to check for dependencies and exclusions
|
|
186
|
+
for (const param of this.params) {
|
|
187
|
+
if (validated[param.name] == null) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (param.definition.dependsOn?.some((d) => validated[d] == null)) {
|
|
191
|
+
throw new InputValidationError(`Parameter "${param.name}" is missing dependencies (${param.definition.dependsOn})`);
|
|
192
|
+
}
|
|
193
|
+
if (param.definition.exclusive?.some((d) => validated[d] != null)) {
|
|
194
|
+
throw new InputValidationError(`Parameter "${param.name}" cannot be present at the same time as exclusions (${param.definition.exclusive})`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return validated;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.InputParameters = InputParameters;
|
|
201
|
+
/**
|
|
202
|
+
* Validates that the overrides object in a request (if present) is correct.
|
|
203
|
+
*
|
|
204
|
+
* @param input - a request's input data, which may contain overrides
|
|
205
|
+
* @returns nothing, only throws if an error is found
|
|
206
|
+
*/
|
|
207
|
+
const validateOverrides = (input) => {
|
|
208
|
+
if (!input.overrides) {
|
|
209
|
+
// Nothing to validate!
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (typeof input.overrides !== 'object') {
|
|
213
|
+
throw new InputValidationError('Overrides should be an object');
|
|
214
|
+
}
|
|
215
|
+
for (const adapterName in input.overrides) {
|
|
216
|
+
const overrides = input.overrides[adapterName];
|
|
217
|
+
if (typeof overrides !== 'object') {
|
|
218
|
+
throw new InputValidationError(`Overrides for adapter "${adapterName}" should be an object`);
|
|
219
|
+
}
|
|
220
|
+
for (const symbol in overrides) {
|
|
221
|
+
const override = overrides[symbol];
|
|
222
|
+
if (typeof symbol !== 'string' || typeof override !== 'string') {
|
|
223
|
+
throw new InputValidationError(`Overrides should map strings to strings, got ${symbol} to ${override}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
exports.validateOverrides = validateOverrides;
|
|
3
229
|
//# sourceMappingURL=input-params.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-params.js","sourceRoot":"","sources":["../../../src/validation/input-params.ts"],"names":[],"mappings":""}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: {
|
|
6
6
|
min?: number;
|
|
7
7
|
max?: number;
|
|
8
|
-
}) => Validator<
|
|
9
|
-
positiveInteger: () => Validator<
|
|
10
|
-
port: () => Validator<
|
|
8
|
+
}) => Validator<number>;
|
|
9
|
+
positiveInteger: () => Validator<number>;
|
|
10
|
+
port: () => Validator<number>;
|
|
11
11
|
url: () => Validator<string>;
|
|
12
12
|
host: () => Validator<string>;
|
|
13
|
-
|
|
14
|
-
responseTimestamp: () => Validator<string | number>;
|
|
13
|
+
responseTimestamp: () => Validator<number>;
|
|
15
14
|
base64: () => Validator<string>;
|
|
16
|
-
compose: (f: Validator<
|
|
15
|
+
compose: <T>(f: Validator<T>[]) => Validator<T>;
|
|
17
16
|
};
|
package/validation/utils.js
CHANGED
|
@@ -24,7 +24,7 @@ const _integer = () => {
|
|
|
24
24
|
};
|
|
25
25
|
const positive = () => {
|
|
26
26
|
return (value) => {
|
|
27
|
-
if (value !== undefined && value < 0) {
|
|
27
|
+
if (value !== undefined && Number(value) < 0) {
|
|
28
28
|
return `Value should be positive number, Received ${value}`;
|
|
29
29
|
}
|
|
30
30
|
return;
|
|
@@ -32,7 +32,7 @@ const positive = () => {
|
|
|
32
32
|
};
|
|
33
33
|
const minNumber = (param) => {
|
|
34
34
|
return (value) => {
|
|
35
|
-
if (value !== undefined && value < param) {
|
|
35
|
+
if (value !== undefined && Number(value) < param) {
|
|
36
36
|
return `Minimum allowed value is ${param}. Received ${value}`;
|
|
37
37
|
}
|
|
38
38
|
return;
|
|
@@ -40,7 +40,7 @@ const minNumber = (param) => {
|
|
|
40
40
|
};
|
|
41
41
|
const maxNumber = (param) => {
|
|
42
42
|
return (value) => {
|
|
43
|
-
if (value !== undefined && value > param) {
|
|
43
|
+
if (value !== undefined && Number(value) > param) {
|
|
44
44
|
return `Maximum allowed value is ${param}. Received ${value}`;
|
|
45
45
|
}
|
|
46
46
|
return;
|
|
@@ -66,15 +66,6 @@ const host = () => {
|
|
|
66
66
|
return;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
const object = () => {
|
|
70
|
-
return (value) => {
|
|
71
|
-
const isObject = typeof value === 'object' && value !== null;
|
|
72
|
-
if (!isObject) {
|
|
73
|
-
return `Value is not valid object.`;
|
|
74
|
-
}
|
|
75
|
-
return;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
69
|
const positiveInteger = () => compose([_integer(), positive()]);
|
|
79
70
|
const integer = (params) => {
|
|
80
71
|
const validators = [_integer()];
|
|
@@ -87,8 +78,8 @@ const integer = (params) => {
|
|
|
87
78
|
return compose(validators);
|
|
88
79
|
};
|
|
89
80
|
const port = () => integer({ min: 1, max: 65535 });
|
|
90
|
-
// Validates that value is a valid timestamp from 2018-01-01 to now
|
|
91
|
-
const responseTimestamp = () => integer({ min: 1514764861000, max: new Date().getTime() });
|
|
81
|
+
// Validates that value is a valid timestamp from 2018-01-01 to now + 50ms to account for clock drift
|
|
82
|
+
const responseTimestamp = () => integer({ min: 1514764861000, max: new Date().getTime() + 50 });
|
|
92
83
|
const base64 = () => {
|
|
93
84
|
return (value) => {
|
|
94
85
|
const errorMessage = `Value is not valid base64 string.`;
|
|
@@ -111,7 +102,6 @@ exports.validator = {
|
|
|
111
102
|
port,
|
|
112
103
|
url,
|
|
113
104
|
host,
|
|
114
|
-
object,
|
|
115
105
|
responseTimestamp,
|
|
116
106
|
base64,
|
|
117
107
|
compose,
|
package/validation/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/validation/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/validation/utils.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAM1B,sJAAsJ;AACtJ,MAAM,OAAO,GAA2C,CAAI,kBAAkC,EAAE,EAAE;IAChG,OAAO,CAAC,KAAoB,EAAE,EAAE;QAC9B,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE;YA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C,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,CAAA;AAE/F,MAAM,MAAM,GAA4B,GAAG,EAAE;IAC3C,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,YAAY,GAAG,mCAAmC,CAAA;QACxD,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,YAAY,CAAA;SACpB;QACD,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;YAC9D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;YACrE,OAAO,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAA;SACzD;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,YAAY,CAAA;SACpB;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAEY,QAAA,SAAS,GAAG;IACvB,OAAO;IACP,eAAe;IACf,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,iBAAiB;IACjB,MAAM;IACN,OAAO;CACR,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { InputParameters } from './input-params';
|
|
2
|
-
export type NormalizedInput = Record<string, unknown>;
|
|
3
|
-
export type Override = Record<string, string>;
|
|
4
|
-
export type OverridesMap = Record<string, Override>;
|
|
5
|
-
export declare class InputValidator {
|
|
6
|
-
private readonly inputConfig;
|
|
7
|
-
private aliases;
|
|
8
|
-
constructor(inputConfig: InputParameters);
|
|
9
|
-
validateInput(input: Record<string, unknown>): NormalizedInput;
|
|
10
|
-
private validateOverrides;
|
|
11
|
-
private initializeInputs;
|
|
12
|
-
private validateInputParamsSchema;
|
|
13
|
-
private validateRequiredConfig;
|
|
14
|
-
private validateOptions;
|
|
15
|
-
private validateTypes;
|
|
16
|
-
private validateDeps;
|
|
17
|
-
private getUsedKey;
|
|
18
|
-
private throwInvalid;
|
|
19
|
-
}
|