fiftyone.pipeline.core 4.4.91 → 4.4.93
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/examples/customFlowElements/clientSideEvidenceFlowElement.js +31 -31
- package/examples/customFlowElements/simpleEvidenceFlowElement.js +26 -26
- package/examples/pipelines.js +25 -25
- package/flowElement.js +21 -21
- package/helpers.js +22 -24
- package/package.json +1 -1
- package/pipeline.js +24 -22
- package/pipelineBuilder.js +23 -23
- package/setHeadersElement.js +27 -33
- package/tests/jsoutput.js +23 -23
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
@example clientSideEvidenceFlowElement.js
|
|
25
|
-
|
|
26
|
-
This example demonstrates the creation of a custom flow element
|
|
27
|
-
which takes the results of a client side form collecting
|
|
28
|
-
date of birth, setting this as evidence on a flowData object
|
|
29
|
-
to calculate a person's starsign.
|
|
30
|
-
The flowElement also serves additional JavaScript which gets a
|
|
31
|
-
user's geolocation and saves the latitude as a cookie.
|
|
32
|
-
This latitude is also then passed in to the flowData to
|
|
33
|
-
calculate if a person is in the northern or southern hemispheres.
|
|
34
|
-
|
|
24
|
+
* @example clientSideEvidenceFlowElement.js
|
|
25
|
+
*
|
|
26
|
+
* This example demonstrates the creation of a custom flow element
|
|
27
|
+
* which takes the results of a client side form collecting
|
|
28
|
+
* date of birth, setting this as evidence on a flowData object
|
|
29
|
+
* to calculate a person's starsign.
|
|
30
|
+
* The flowElement also serves additional JavaScript which gets a
|
|
31
|
+
* user's geolocation and saves the latitude as a cookie.
|
|
32
|
+
* This latitude is also then passed in to the flowData to
|
|
33
|
+
* calculate if a person is in the northern or southern hemispheres.
|
|
34
|
+
*
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
// First require the core Pipeline
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
@example simpleEvidenceFlowElement.js
|
|
25
|
-
|
|
26
|
-
This example demonstrates the creation of a custom flowElement
|
|
27
|
-
which takes a birth date as evidence and uses it to check a
|
|
28
|
-
lookup table for a starsign.
|
|
29
|
-
|
|
24
|
+
* @example simpleEvidenceFlowElement.js
|
|
25
|
+
*
|
|
26
|
+
* This example demonstrates the creation of a custom flowElement
|
|
27
|
+
* which takes a birth date as evidence and uses it to check a
|
|
28
|
+
* lookup table for a starsign.
|
|
29
|
+
*
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
// First require the core Pipeline
|
package/examples/pipelines.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
@example pipelines.js
|
|
25
|
-
|
|
26
|
-
This example demonstrates syncronous and asyncronous pipelines
|
|
27
|
-
with multiple flowElements and other core features of the 51Degrees pipeline
|
|
28
|
-
|
|
24
|
+
* @example pipelines.js
|
|
25
|
+
*
|
|
26
|
+
* This example demonstrates syncronous and asyncronous pipelines
|
|
27
|
+
* with multiple flowElements and other core features of the 51Degrees pipeline
|
|
28
|
+
*
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
// Note that this example is designed to be run from within the
|
package/flowElement.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
const EvidenceKeyFilterBase = require('./evidenceKeyFilter');
|
|
@@ -90,7 +90,7 @@ class FlowElement {
|
|
|
90
90
|
* Function called to check if a FlowElement is ready
|
|
91
91
|
* Used when there are asynchronous initialisation steps
|
|
92
92
|
*
|
|
93
|
-
* @returns {Promise}
|
|
93
|
+
* @returns {Promise} returns Promise
|
|
94
94
|
* */
|
|
95
95
|
ready () {
|
|
96
96
|
return Promise.resolve(this);
|
package/helpers.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
class Helpers {
|
|
24
24
|
/**
|
|
25
25
|
* Set response headers in the response object (e.g. Accept-CH)
|
|
26
26
|
*
|
|
27
|
-
* @param response
|
|
28
|
-
* @param flowData
|
|
27
|
+
* @param {http.ServerResponse} response The response to set the headers in.
|
|
28
|
+
* @param {FlowData} flowData A processed FlowData instance to get the response header values
|
|
29
29
|
* from.
|
|
30
|
-
* @param response
|
|
31
|
-
* @param flowData
|
|
32
30
|
*/
|
|
33
31
|
static setResponseHeaders (response, flowData) {
|
|
34
32
|
for (const [key, value] of Object.entries(flowData['set-headers'].responseheadersdictionary)) {
|
package/package.json
CHANGED
package/pipeline.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
const FlowData = require('./flowData');
|
|
@@ -25,6 +25,7 @@ const EventEmitter = require('events');
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @typedef {import('./flowElement')} FlowElement
|
|
28
|
+
* @typedef {import('../fiftyone.pipeline.engines/dataFileUpdateService')} DataFileUpdateService
|
|
28
29
|
*/
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -40,7 +41,7 @@ class Pipeline {
|
|
|
40
41
|
* add to the Pipeline
|
|
41
42
|
* @param {boolean} suppressProcessExceptions If true then pipeline
|
|
42
43
|
* will suppress exceptions added to FlowData.
|
|
43
|
-
* @param dataFileUpdateService
|
|
44
|
+
* @param {DataFileUpdateService} dataFileUpdateService Service that registers FlowElements
|
|
44
45
|
*/
|
|
45
46
|
constructor (flowElements = [], suppressProcessExceptions = false, dataFileUpdateService = null) {
|
|
46
47
|
const pipeline = this;
|
|
@@ -218,8 +219,9 @@ class Pipeline {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
/**
|
|
222
|
+
* Update pipeline's property database for FlowElement
|
|
221
223
|
*
|
|
222
|
-
* @param {FlowElement} flowElement
|
|
224
|
+
* @param {FlowElement} flowElement FlowElement to update
|
|
223
225
|
* @returns {void}
|
|
224
226
|
*/
|
|
225
227
|
updatePropertyDataBaseForElement (flowElement) {
|
package/pipelineBuilder.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
const Pipeline = require('./pipeline');
|
|
@@ -49,9 +49,9 @@ class PipelineBuilder {
|
|
|
49
49
|
* @param {boolean} settings.useSetHeaderProperties Whether to
|
|
50
50
|
* automatically add the SetHeadersElement needed to request additional
|
|
51
51
|
* HTTP headers from the client side. This is true by default.
|
|
52
|
-
* @param {typeof import('./javascriptbuilder').prototype.settings}
|
|
53
|
-
* settings
|
|
54
|
-
*
|
|
52
|
+
* @param {typeof import('./javascriptbuilder').prototype.settings} settings.javascriptBuilderSettings
|
|
53
|
+
* The settings to pass to the JavaScriptBuilder.
|
|
54
|
+
* See JavaScriptBuilder class for details.
|
|
55
55
|
*/
|
|
56
56
|
constructor (settings = {}) {
|
|
57
57
|
/**
|
package/setHeadersElement.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
const FlowElement = require('./flowElement.js');
|
|
@@ -52,8 +52,7 @@ class SetHeadersElement extends FlowElement {
|
|
|
52
52
|
/**
|
|
53
53
|
* Get the name of the header which the property relates to.
|
|
54
54
|
*
|
|
55
|
-
* @param {string} propertyName
|
|
56
|
-
* @param propertyName
|
|
55
|
+
* @param {string} propertyName To get the header name from.
|
|
57
56
|
* @returns {string} Header name.
|
|
58
57
|
*/
|
|
59
58
|
getHeaderName (propertyName) {
|
|
@@ -81,8 +80,7 @@ class SetHeadersElement extends FlowElement {
|
|
|
81
80
|
* 'device.SetHeaderPlatformAccept-CH',
|
|
82
81
|
* 'device.SetHeaderHardwareAccept-CH' ] } }
|
|
83
82
|
*
|
|
84
|
-
* @param {Pipeline} pipeline
|
|
85
|
-
* @param pipeline
|
|
83
|
+
* @param {Pipeline} pipeline The pipeline instance to get the properties from.
|
|
86
84
|
* @returns {object} Collection of headers which can be set in the response.
|
|
87
85
|
*/
|
|
88
86
|
constructHeaders (pipeline) {
|
|
@@ -128,16 +126,15 @@ class SetHeadersElement extends FlowElement {
|
|
|
128
126
|
/**
|
|
129
127
|
* Get response headers (e.g. Accept-CH)
|
|
130
128
|
*
|
|
131
|
-
* @param {FlowData} flowData
|
|
129
|
+
* @param {FlowData} flowData A processed FlowData instance to get the response header values
|
|
132
130
|
* from.
|
|
133
|
-
* @param flowData
|
|
134
131
|
* @returns {object} A dictionary of response header names with their values if they are not
|
|
135
132
|
* null
|
|
136
133
|
*/
|
|
137
134
|
getResponseHeaders (flowData) {
|
|
138
135
|
const result = {};
|
|
139
136
|
for (const [, header] of Object.entries(this.headers)) {
|
|
140
|
-
|
|
137
|
+
const headerValue = new Set();
|
|
141
138
|
header.properties.forEach(property => {
|
|
142
139
|
const keys = property.split('.');
|
|
143
140
|
const value = this.tryGetValue(flowData, keys[0], keys[1]);
|
|
@@ -160,12 +157,9 @@ class SetHeadersElement extends FlowElement {
|
|
|
160
157
|
* If the value cannot be found or is null/unknown, then undefined
|
|
161
158
|
* is returned.
|
|
162
159
|
*
|
|
163
|
-
* @param {FlowData} flowData
|
|
164
|
-
* @param {string} elementKey
|
|
165
|
-
* @param {string} propertyKey
|
|
166
|
-
* @param flowData
|
|
167
|
-
* @param elementKey
|
|
168
|
-
* @param propertyKey
|
|
160
|
+
* @param {FlowData} flowData A processed FlowData instance to get the value from.
|
|
161
|
+
* @param {string} elementKey Key for the element data to get the value from.
|
|
162
|
+
* @param {string} propertyKey Name of the property to get the value for.
|
|
169
163
|
* @returns {string | undefined} value string or undefined.
|
|
170
164
|
*/
|
|
171
165
|
tryGetValue (flowData, elementKey, propertyKey) {
|
package/tests/jsoutput.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/* *********************************************************************
|
|
2
|
-
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
-
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
-
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
-
*
|
|
6
|
-
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
-
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
-
*
|
|
9
|
-
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
-
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
-
*
|
|
12
|
-
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
-
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
-
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
-
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
-
*
|
|
17
|
-
* If using the Work as, or as part of, a network application, by
|
|
18
|
-
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
-
* in the end user terms of the application under an appropriate heading,
|
|
20
|
-
* such notice(s) shall fulfill the requirements of that article.
|
|
1
|
+
/* *********************************************************************
|
|
2
|
+
* This Original Work is copyright of 51 Degrees Mobile Experts Limited.
|
|
3
|
+
* Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
|
|
4
|
+
* Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
|
|
5
|
+
*
|
|
6
|
+
* This Original Work is licensed under the European Union Public Licence
|
|
7
|
+
* (EUPL) v.1.2 and is subject to its terms as set out below.
|
|
8
|
+
*
|
|
9
|
+
* If a copy of the EUPL was not distributed with this file, You can obtain
|
|
10
|
+
* one at https://opensource.org/licenses/EUPL-1.2.
|
|
11
|
+
*
|
|
12
|
+
* The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
|
|
13
|
+
* amended by the European Commission) shall be deemed incompatible for
|
|
14
|
+
* the purposes of the Work and the provisions of the compatibility
|
|
15
|
+
* clause in Article 5 of the EUPL shall not apply.
|
|
16
|
+
*
|
|
17
|
+
* If using the Work as, or as part of, a network application, by
|
|
18
|
+
* including the attribution notice(s) required under Article 5 of the EUPL
|
|
19
|
+
* in the end user terms of the application under an appropriate heading,
|
|
20
|
+
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
23
|
fiftyoneDegreesManager = function () { // eslint-disable-line
|
|
@@ -77,10 +77,10 @@ fiftyoneDegreesManager = function () { // eslint-disable-line
|
|
|
77
77
|
return keyValuePairs;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
// Delete a cookie.
|
|
81
80
|
/**
|
|
81
|
+
* Delete a cookie.
|
|
82
82
|
*
|
|
83
|
-
* @param name
|
|
83
|
+
* @param {string} name Name of a cookie
|
|
84
84
|
*/
|
|
85
85
|
function deleteCookie (name) { // eslint-disable-line
|
|
86
86
|
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
@@ -198,7 +198,7 @@ fiftyoneDegreesManager = function () { // eslint-disable-line
|
|
|
198
198
|
Object.getOwnPropertyNames(data).forEach(function (key) {
|
|
199
199
|
self[key] = {};
|
|
200
200
|
for (const i in data[key]) {
|
|
201
|
-
|
|
201
|
+
const obj = self[key];
|
|
202
202
|
(function (i) {
|
|
203
203
|
Object.defineProperty(obj, i, {
|
|
204
204
|
get: function () {
|