fiftyone.pipeline.core 4.3.7 → 4.3.8
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/package.json
CHANGED
package/pipelineBuilder.js
CHANGED
|
@@ -122,11 +122,17 @@ class PipelineBuilder {
|
|
|
122
122
|
flowElements.push(new FlowElement(element.elementParameters));
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
flowElements =
|
|
125
|
+
flowElements = this.addRequiredElements(flowElements);
|
|
126
126
|
|
|
127
127
|
return new Pipeline(flowElements);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
addRequiredElements(flowElements) {
|
|
131
|
+
return flowElements
|
|
132
|
+
.concat(this.getJavaScriptElements())
|
|
133
|
+
.concat(this.getHttpElements());
|
|
134
|
+
}
|
|
135
|
+
|
|
130
136
|
/**
|
|
131
137
|
* Internal function used to first check if the
|
|
132
138
|
* JavaScript elements should be added to the pipeline
|
|
@@ -214,10 +220,7 @@ class PipelineBuilder {
|
|
|
214
220
|
* @returns {Pipeline} The constructed Pipeline
|
|
215
221
|
*/
|
|
216
222
|
build () {
|
|
217
|
-
this.flowElements = this.flowElements
|
|
218
|
-
.concat(this.getJavaScriptElements())
|
|
219
|
-
.concat(this.getHttpElements());
|
|
220
|
-
|
|
223
|
+
this.flowElements = this.addRequiredElements(this.flowElements);
|
|
221
224
|
return new Pipeline(this.flowElements);
|
|
222
225
|
}
|
|
223
226
|
}
|
package/setHeadersElement.js
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
const FlowElement = require('./flowElement.js');
|
|
24
24
|
const ElementDataDictionary = require('./elementDataDictionary.js');
|
|
25
25
|
const AspectPropertyValue = require('./aspectPropertyValue');
|
|
26
|
+
// SetHeader source headers separator
|
|
27
|
+
const SOURCE_HEADER_SEPARATOR = ',';
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* @typedef {import('./pipeline')} Pipeline
|
|
@@ -130,19 +132,19 @@ const AspectPropertyValue = require('./aspectPropertyValue');
|
|
|
130
132
|
getResponseHeaders(flowData) {
|
|
131
133
|
const result = {};
|
|
132
134
|
for (const [key, header] of Object.entries(this.headers)) {
|
|
133
|
-
var headerValue =
|
|
135
|
+
var headerValue = new Set();
|
|
134
136
|
header.properties.forEach(property => {
|
|
135
137
|
var keys = property.split('.');
|
|
136
138
|
var value = this.tryGetValue(flowData, keys[0], keys[1]);
|
|
137
139
|
if (value !== undefined && value !== '') {
|
|
138
|
-
|
|
139
|
-
headerValue
|
|
140
|
-
}
|
|
141
|
-
headerValue += value;
|
|
140
|
+
value.split(SOURCE_HEADER_SEPARATOR).forEach((v) => {
|
|
141
|
+
headerValue.add(v);
|
|
142
|
+
});
|
|
142
143
|
}
|
|
143
144
|
});
|
|
144
|
-
if (headerValue
|
|
145
|
-
result[header.name] =
|
|
145
|
+
if (headerValue.size > 0) {
|
|
146
|
+
result[header.name] =
|
|
147
|
+
Array.from(headerValue).join(SOURCE_HEADER_SEPARATOR);
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
return result;
|
package/tests/core.test.js
CHANGED
|
@@ -229,6 +229,10 @@ test('build from config', done => {
|
|
|
229
229
|
configPipelineFlowData.process().then(function () {
|
|
230
230
|
expect(configPipelineFlowData.get('configTest')
|
|
231
231
|
.get('built')).toBe('hello_world');
|
|
232
|
+
expect(configPipeline.getElement('sequence')).not.toBe(undefined);
|
|
233
|
+
expect(configPipeline.getElement('jsonbundler')).not.toBe(undefined);
|
|
234
|
+
expect(configPipeline.getElement('javascriptbuilder')).not.toBe(undefined);
|
|
235
|
+
expect(configPipeline.getElement('set-headers')).not.toBe(undefined);
|
|
232
236
|
|
|
233
237
|
done();
|
|
234
238
|
});
|
|
@@ -33,6 +33,8 @@ const testValue = new AspectPropertyValue(null, 'test')
|
|
|
33
33
|
const browserValue = new AspectPropertyValue(null, 'SEC-CH-UA,SEC-CH-UA-Full-Version')
|
|
34
34
|
const platformValue = new AspectPropertyValue(null, 'SEC-CH-UA-Platform,SEC-CH-UA-Platform-Version')
|
|
35
35
|
const hardwareValue = new AspectPropertyValue(null, 'SEC-CH-UA-Model,SEC-CH-UA-Mobile,SEC-CH-UA-Arch')
|
|
36
|
+
// Value which contains at least one duplicate value from each of other SetHeader values.
|
|
37
|
+
const duplicateValue = new AspectPropertyValue(null, 'SEC-CH-UA,SEC-CH-UA-Platform,SEC-CH-UA-Model')
|
|
36
38
|
|
|
37
39
|
// Set up the properties in the element.
|
|
38
40
|
setup.device.properties["SetHeaderBrowserAccept-CH"] = {
|
|
@@ -81,6 +83,9 @@ each([
|
|
|
81
83
|
["Set multiple headers.",
|
|
82
84
|
{ "SetHeaderBrowserAccept-CH": browserValue, "SetHeaderHardwareSomeOtherHeader": platformValue},
|
|
83
85
|
{ "Accept-CH": browserValue.value, "SomeOtherHeader": platformValue.value}],
|
|
86
|
+
["Properties with duplicate values.",
|
|
87
|
+
{ "SetHeaderPlatformAccept-CH": platformValue, "SetHeaderHardwareAccept-CH": duplicateValue},
|
|
88
|
+
{ "Accept-CH": "SEC-CH-UA-Platform,SEC-CH-UA-Platform-Version,SEC-CH-UA,SEC-CH-UA-Model"}],
|
|
84
89
|
])
|
|
85
90
|
.test('testGetResponseHeaderValue - %s', async (name, device, expectedHeaders) => {
|
|
86
91
|
// Set up a mock repsonse object to collect the headers which are
|