@sap_oss/wdio-qmate-service 1.2.3 → 1.3.1
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/docs/doc.md +189 -51
- package/lib/reuse/index.js +3 -4
- package/lib/reuse/index.js.map +1 -1
- package/lib/reuse/modules/runtime/Runtime.d.ts +5 -0
- package/lib/reuse/modules/runtime/Runtime.js +11 -0
- package/lib/reuse/modules/runtime/Runtime.js.map +1 -0
- package/lib/reuse/modules/ui5/control.d.ts +18 -17
- package/lib/reuse/modules/ui5/control.js +21 -21
- package/lib/reuse/modules/ui5/control.js.map +1 -1
- package/lib/reuse/modules/ui5/navigationBar.js +2 -1
- package/lib/reuse/modules/ui5/navigationBar.js.map +1 -1
- package/lib/reuse/modules/ui5/table.js +16 -4
- package/lib/reuse/modules/ui5/table.js.map +1 -1
- package/lib/reuse/modules/ui5/types/ui5.types.d.ts +16 -0
- package/lib/reuse/modules/ui5/types/ui5.types.js +3 -0
- package/lib/reuse/modules/ui5/types/ui5.types.js.map +1 -0
- package/lib/reuse/modules/util/Util.d.ts +9 -7
- package/lib/reuse/modules/util/Util.js +2 -0
- package/lib/reuse/modules/util/Util.js.map +1 -1
- package/lib/reuse/modules/util/component.d.ts +25 -0
- package/lib/reuse/modules/util/component.js +67 -0
- package/lib/reuse/modules/util/component.js.map +1 -0
- package/lib/reuse/modules/util/data.d.ts +25 -5
- package/lib/reuse/modules/util/data.js +86 -15
- package/lib/reuse/modules/util/data.js.map +1 -1
- package/lib/reuse/modules/util/file.js +1 -9
- package/lib/reuse/modules/util/file.js.map +1 -1
- package/lib/scripts/hooks/beforeSession.js +4 -1
- package/lib/scripts/hooks/beforeSession.js.map +1 -1
- package/lib/scripts/hooks/utils/cycle.js +7 -1
- package/lib/scripts/hooks/utils/cycle.js.map +1 -1
- package/package.json +3 -2
- package/test/reuse/ui5/control/execute.spec.js +53 -1
- package/test/reuse/ui5/control/getAggregationProperty.spec.js +7 -2
- package/test/reuse/ui5/control/getAssociationProperty.spec.js +67 -1
- package/test/reuse/ui5/control/getBindingContextPathProperty.spec.js +8 -4
- package/test/reuse/ui5/control/getProperty.spec.js +6 -2
- package/test/reuse/ui5/control/getPropertyBinding.spec.js +8 -4
- package/test/reuse/util/component/loadEntryPoint.spec.js +44 -0
- package/test/reuse/util/component/storeEntryPoint.spec.js +30 -0
- package/test/reuse/util/component/test.component.conf.js +22 -0
- package/test/reuse/util/data/customSourceData/test.json +3 -0
- package/test/reuse/util/data/customSourceData/test.secure.json +5 -0
- package/test/reuse/util/data/getData.spec.js +18 -1
- package/test/reuse/util/data/getSecureData.spec.js +18 -1
- package/test/reuse/util/data/readDataFromFile.spec.js +29 -0
- package/test/reuse/util/data/test.data.conf.js +5 -2
- package/test/reuse/util/data/writeDataToFile.spec.js +32 -0
|
@@ -17,7 +17,7 @@ class Control {
|
|
|
17
17
|
* @description Executes a native UI5 action as callback function in the browser on the given UI5 control.
|
|
18
18
|
* @param {Function} callbackFunction - The client script function to be used with the control instance.
|
|
19
19
|
* Caution: The first and last parameter is reserved for the mockserver instance and the promise resolve function - done.
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {Element | Ui5Selector | Ui5SelectorWithOptions} selectorOrElement - The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed).
|
|
21
21
|
* @param {Object} args - An object containing the arguments to pass to the callback function.
|
|
22
22
|
* @example const selector = {"elementProperties":{"metadata":"sap.m.StandardListItem", "id": "*categoryList-7"}};
|
|
23
23
|
* const args = {"property": "text"};
|
|
@@ -34,74 +34,74 @@ class Control {
|
|
|
34
34
|
* @function getProperty
|
|
35
35
|
* @memberOf ui5.control
|
|
36
36
|
* @description Gets the UI5 control property of the given element.
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {Element | Ui5Selector | Ui5SelectorWithOptions} selectorOrElement - The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed)
|
|
38
38
|
* @param {String} propertyName - The property name of the control to retrieve the value from.
|
|
39
39
|
* @example const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{ "title":[{"path":"CategoryName"}] }};
|
|
40
|
-
* const elem = await ui5.element.
|
|
40
|
+
* const elem = await ui5.element.getDisplayed(selector);
|
|
41
41
|
* const propertyName = "title";
|
|
42
42
|
* const val = await ui5.control.getProperty(elem, propertyName);
|
|
43
43
|
**/
|
|
44
|
-
async getProperty(
|
|
45
|
-
return this.locatorCommands.getUI5Property(propertyName,
|
|
44
|
+
async getProperty(selectorOrElement, propertyName) {
|
|
45
|
+
return this.locatorCommands.getUI5Property(propertyName, selectorOrElement);
|
|
46
46
|
}
|
|
47
47
|
;
|
|
48
48
|
/**
|
|
49
49
|
* @function getAggregationProperty
|
|
50
50
|
* @memberOf ui5.control
|
|
51
51
|
* @description Gets the UI5 control aggregation property of the given element.
|
|
52
|
-
* @param {
|
|
52
|
+
* @param {Element | Ui5Selector | Ui5SelectorWithOptions} selectorOrElement - The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed)
|
|
53
53
|
* @param {String} propertyName - The aggregation property name of the control to retrieve the value from.
|
|
54
54
|
* @example const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{ "items":[{"path":"/Categories"}] }};
|
|
55
|
-
* const elem = await ui5.element.
|
|
55
|
+
* const elem = await ui5.element.getDisplayed(selector);
|
|
56
56
|
* const propertyName = "tooltip";
|
|
57
57
|
* const val = await ui5.control.getAggregationProperty(elem, propertyName);
|
|
58
58
|
**/
|
|
59
|
-
async getAggregationProperty(
|
|
60
|
-
return this.locatorCommands.getUI5Aggregation(propertyName,
|
|
59
|
+
async getAggregationProperty(selectorOrElement, propertyName) {
|
|
60
|
+
return this.locatorCommands.getUI5Aggregation(propertyName, selectorOrElement);
|
|
61
61
|
}
|
|
62
62
|
;
|
|
63
63
|
/**
|
|
64
64
|
* @function getAssociationProperty
|
|
65
65
|
* @memberOf ui5.control
|
|
66
66
|
* @description Get UI control property
|
|
67
|
-
* @param {
|
|
67
|
+
* @param {Element | Ui5Selector | Ui5SelectorWithOptions} selectorOrElement - The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed)
|
|
68
68
|
* @param {String} propertyName - The association property name of the control to retrieve the value from.
|
|
69
69
|
* @example const selector = { "elementProperties":{"metadata":"sap.m.MultiComboBox","mProperties":{}};
|
|
70
|
-
* const elem = await ui5.element.
|
|
70
|
+
* const elem = await ui5.element.getDisplayed(selector);
|
|
71
71
|
* const propertyName = "selectedItems";
|
|
72
72
|
* const propertyValue = await ui5.control.getAssociationProperty(elem, propertyName);
|
|
73
73
|
**/
|
|
74
|
-
async getAssociationProperty(
|
|
75
|
-
return this.locatorCommands.getUI5Association(propertyName,
|
|
74
|
+
async getAssociationProperty(selectorOrElement, propertyName) {
|
|
75
|
+
return this.locatorCommands.getUI5Association(propertyName, selectorOrElement);
|
|
76
76
|
}
|
|
77
77
|
;
|
|
78
78
|
/**
|
|
79
79
|
* @function getBindingContextPathProperty
|
|
80
80
|
* @memberOf ui5.control
|
|
81
81
|
* @description Get UI control binding context path
|
|
82
|
-
* @param {
|
|
82
|
+
* @param {Element | Ui5Selector | Ui5SelectorWithOptions} selectorOrElement - The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed)
|
|
83
83
|
* @example const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{"title":[{"path":"CategoryName"}] }};
|
|
84
|
-
* const elem = await ui5.element.
|
|
84
|
+
* const elem = await ui5.element.getDisplayed(selector);
|
|
85
85
|
* const context = await ui5.control.getBindingContextPathProperty(elem);
|
|
86
86
|
**/
|
|
87
|
-
async getBindingContextPathProperty(
|
|
88
|
-
return this.locatorCommands.getBindingContextPath(
|
|
87
|
+
async getBindingContextPathProperty(selectorOrElement) {
|
|
88
|
+
return this.locatorCommands.getBindingContextPath(selectorOrElement);
|
|
89
89
|
}
|
|
90
90
|
;
|
|
91
91
|
/**
|
|
92
92
|
* @function getPropertyBinding
|
|
93
93
|
* @memberOf ui5.control
|
|
94
94
|
* @description Get UI control property
|
|
95
|
-
* @param {
|
|
95
|
+
* @param {Element | Ui5Selector | Ui5SelectorWithOptions} selectorOrElement - The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed)
|
|
96
96
|
* @param {String} propertyName - The property name to retrieve from the control binding
|
|
97
97
|
* @returns {Array} Array of bindings for the specific property
|
|
98
98
|
* @example const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{ "title":[{"path":"CategoryName"}] }};
|
|
99
|
-
* const elem = await ui5.element.
|
|
99
|
+
* const elem = await ui5.element.getDisplayed(selector);
|
|
100
100
|
* const propertyName = "title";
|
|
101
101
|
* const binding = await ui5.control.getPropertyBinding(elem, propertyName);
|
|
102
102
|
**/
|
|
103
|
-
async getPropertyBinding(
|
|
104
|
-
return this.locatorCommands.getBindingProperty(propertyName,
|
|
103
|
+
async getPropertyBinding(selectorOrElement, propertyName) {
|
|
104
|
+
return this.locatorCommands.getBindingProperty(propertyName, selectorOrElement);
|
|
105
105
|
}
|
|
106
106
|
;
|
|
107
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../src/reuse/modules/ui5/control.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../src/reuse/modules/ui5/control.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAKb;;;GAGG;AACH,MAAa,OAAO;IAApB;QAEU,QAAG,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;QAClD,oBAAe,GAAG,OAAO,CAAC,8CAA8C,CAAC,CAAC;IAkGpF,CAAC;IAhGC,kFAAkF;IAClF;;;;;;;;;;;;;QAaI;IACJ,KAAK,CAAC,OAAO,CAAE,gBAA0B,EAAE,iBAAiE,EAAE,IAAU;QACtH,OA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;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,YAAoB;QACxC,MAAM,QAAQ,GAAG;YACf,mBAAmB,EAAE;gBACnB,UAAU,EAAE,mCAAmC;gBAC/C,aAAa,EAAE;oBACb,MAAM,EAAE,YAAY;iBACrB;aACF;SACF,CAAC;QACF,IAAI;YACF,MAAM,GAAG,CAAC,SAAS,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;SAC3D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;SAChE;IACH,CAAC;IAAA,CAAC;IAEF;;;;;;OAMG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,KAAK;QAC3I,MAAM,QAAQ,GAAG;YACf,mBAAmB,EAAE;gBACnB,UAAU,EAAE,2BAA2B;gBACvC,IAAI,EAAE,cAAc;aACrB;SACF,CAAC;QACF,IAAI;YACF,MAAM,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;SAClF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;SAChE;IACH,CAAC;IAAA,CAAC;CAEH;AA5GD,sCA4GC;AAAA,CAAC;AACF,kBAAe,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -24,7 +24,7 @@ class Table {
|
|
|
24
24
|
* await ui5.table.sortColumnAscending("Amount", glAccountItemsTable);
|
|
25
25
|
*/
|
|
26
26
|
async sortColumnAscending(columnName, tableSelector) {
|
|
27
|
-
const
|
|
27
|
+
const oldSortButtonSelector = {
|
|
28
28
|
"elementProperties": {
|
|
29
29
|
"metadata": "sap.m.Button",
|
|
30
30
|
"icon": "sap-icon://sort-ascending"
|
|
@@ -33,10 +33,16 @@ class Table {
|
|
|
33
33
|
"metadata": "sap.m.Toolbar"
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
const newSortButtonSelector = {
|
|
37
|
+
"elementProperties": {
|
|
38
|
+
"metadata": "sap.m.ToggleButton",
|
|
39
|
+
"text": "Ascending"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
36
42
|
const sort = await this._getSortIndicatorValue(columnName, tableSelector);
|
|
37
43
|
if (sort !== "Ascending") {
|
|
38
44
|
this._clickColumn(columnName, tableSelector);
|
|
39
|
-
await ui5.userInteraction.click(
|
|
45
|
+
await Promise.any([ui5.userInteraction.click(oldSortButtonSelector), ui5.userInteraction.click(newSortButtonSelector)]);
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
;
|
|
@@ -57,7 +63,7 @@ class Table {
|
|
|
57
63
|
* await ui5.table.sortColumnDescending("Amount", glAccountItemsTable);
|
|
58
64
|
*/
|
|
59
65
|
async sortColumnDescending(columnName, tableSelector) {
|
|
60
|
-
const
|
|
66
|
+
const oldSortButtonSelector = {
|
|
61
67
|
"elementProperties": {
|
|
62
68
|
"metadata": "sap.m.Button",
|
|
63
69
|
"icon": "sap-icon://sort-descending"
|
|
@@ -66,10 +72,16 @@ class Table {
|
|
|
66
72
|
"metadata": "sap.m.Toolbar"
|
|
67
73
|
}
|
|
68
74
|
};
|
|
75
|
+
const newSortButtonSelector = {
|
|
76
|
+
"elementProperties": {
|
|
77
|
+
"metadata": "sap.m.ToggleButton",
|
|
78
|
+
"text": "Descending"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
69
81
|
const sort = await this._getSortIndicatorValue(columnName, tableSelector);
|
|
70
82
|
if (sort !== "Descending") {
|
|
71
83
|
this._clickColumn(columnName, tableSelector);
|
|
72
|
-
await ui5.userInteraction.click(
|
|
84
|
+
await Promise.any([ui5.userInteraction.click(oldSortButtonSelector), ui5.userInteraction.click(newSortButtonSelector)]);
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
87
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../src/reuse/modules/ui5/table.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AACb;;;GAGG;AACH,MAAa,KAAK;IAEhB,kFAAkF;IAClF;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,mBAAmB,CAAE,UAAkB,EAAE,aAAkB;QAC/D,MAAM,
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../src/reuse/modules/ui5/table.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AACb;;;GAGG;AACH,MAAa,KAAK;IAEhB,kFAAkF;IAClF;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,mBAAmB,CAAE,UAAkB,EAAE,aAAkB;QAC/D,MAAM,qBAAqB,GAAG;YAC5B,mBAAmB,EAAE;gBACnB,UAAU,EAAE,cAAc;gBAC1B,MAAM,EAAE,2BAA2B;aACpC;YACD,oBAAoB,EAAE;gBACpB,UAAU,EAAE,eAAe;aAC5B;SACF,CAAC;QACF,MAAM,qBAAqB,GAAG;YAC5B,mBAAmB,EAAE;gBACnB,UAAU,EAAE,oBAAoB;gBAChC,MAAM,EAAE,WAAW;aACpB;SACF,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QAC1E,IAAI,IAAI,KAAK,WAAW,EAAE;YACxB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;YAC7C,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;SACzH;IACH,CAAC;IAAA,CAAC;IAEF;;;;;;;;;;;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AAC,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;SAC1F;aAAM,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;YAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,wBAAwB,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;YACnF,OAAO,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;SAChE;IACH,CAAC;IAEO,wBAAwB,CAAE,QAAa,EAAE,gBAAqB;QACpE,IAAI,mBAAmB,IAAI,gBAAgB,EAAE;YAC3C,QAAQ,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC;SAClE;aAAM,IAAI,CAAC,CAAC,oBAAoB,IAAI,QAAQ,CAAC,EAAE;YAC9C,QAAQ,CAAC,kBAAkB,GAAG,EAAE,CAAC;SAClC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,GAAG,KAAK,mBAAmB,EAAE;gBAC/B,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;aAC1D;SACF;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CAEF;AA7KD,sBA6KC;AAAA,CAAC;AACF,kBAAe,IAAI,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare type Ui5Selector = {
|
|
2
|
+
elementProperties: any;
|
|
3
|
+
ancestorProperties?: any;
|
|
4
|
+
parentProperties?: any;
|
|
5
|
+
siblingProperties?: any;
|
|
6
|
+
prevSiblingProperties?: any;
|
|
7
|
+
nextSiblingProperties?: any;
|
|
8
|
+
childProperties?: any;
|
|
9
|
+
descendantProperties?: any;
|
|
10
|
+
};
|
|
11
|
+
export declare type Ui5SelectorWithOptions = {
|
|
12
|
+
selector: Ui5Selector;
|
|
13
|
+
index?: number;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
returnAllDomElements?: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui5.types.js","sourceRoot":"","sources":["../../../../../src/reuse/modules/ui5/types/ui5.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Browser } from
|
|
2
|
-
import { Console } from
|
|
3
|
-
import { Data } from
|
|
4
|
-
import { File } from
|
|
5
|
-
import { Formatter } from
|
|
6
|
-
import { FunctionModule } from
|
|
7
|
-
import { System } from
|
|
1
|
+
import { Browser } from "./browser";
|
|
2
|
+
import { Console } from "./console";
|
|
3
|
+
import { Data } from "./data";
|
|
4
|
+
import { File } from "./file";
|
|
5
|
+
import { Formatter } from "./formatter";
|
|
6
|
+
import { FunctionModule } from "./function";
|
|
7
|
+
import { System } from "./system";
|
|
8
|
+
import { Component } from "./component";
|
|
8
9
|
interface DataHooksExtended extends Data {
|
|
9
10
|
decrypt: (input: string) => string;
|
|
10
11
|
privateKeyFound: boolean;
|
|
@@ -17,6 +18,7 @@ export declare class Util {
|
|
|
17
18
|
formatter: Formatter;
|
|
18
19
|
function: FunctionModule;
|
|
19
20
|
system: System;
|
|
21
|
+
component: Component;
|
|
20
22
|
}
|
|
21
23
|
declare const _default: Util;
|
|
22
24
|
export default _default;
|
|
@@ -11,6 +11,7 @@ const file_1 = __importDefault(require("./file"));
|
|
|
11
11
|
const formatter_1 = __importDefault(require("./formatter"));
|
|
12
12
|
const function_1 = __importDefault(require("./function"));
|
|
13
13
|
const system_1 = __importDefault(require("./system"));
|
|
14
|
+
const component_1 = __importDefault(require("./component"));
|
|
14
15
|
class Util {
|
|
15
16
|
constructor() {
|
|
16
17
|
this.browser = browser_1.default;
|
|
@@ -20,6 +21,7 @@ class Util {
|
|
|
20
21
|
this.formatter = formatter_1.default;
|
|
21
22
|
this.function = function_1.default;
|
|
22
23
|
this.system = system_1.default;
|
|
24
|
+
this.component = component_1.default;
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
exports.Util = Util;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Util.js","sourceRoot":"","sources":["../../../../src/reuse/modules/util/Util.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Util.js","sourceRoot":"","sources":["../../../../src/reuse/modules/util/Util.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA6C;AAC7C,wDAA6C;AAC7C,kDAAoC;AACpC,kDAAoC;AACpC,4DAAmD;AACnD,0DAA4D;AAC5D,sDAA0C;AAC1C,4DAAmD;AAOnD,MAAa,IAAI;IAAjB;QACE,YAAO,GAAY,iBAAO,CAAC;QAC3B,YAAO,GAAY,iBAAO,CAAC;QAC3B,SAAI,GAAsB,cAAyB,CAAC;QACpD,SAAI,GAAS,cAAI,CAAC;QAClB,cAAS,GAAc,mBAAS,CAAC;QACjC,aAAQ,GAAmB,kBAAc,CAAC;QAC1C,WAAM,GAAW,gBAAM,CAAC;QACxB,cAAS,GAAc,mBAAS,CAAC;IACnC,CAAC;CAAA;AATD,oBASC;AAED,kBAAe,IAAI,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class component
|
|
3
|
+
* @memberof util
|
|
4
|
+
* @description This class provides functions for writing component tests with qmate-proxy-service
|
|
5
|
+
*/
|
|
6
|
+
export declare class Component {
|
|
7
|
+
/**
|
|
8
|
+
* @function loadEntryPoint
|
|
9
|
+
* @memberOf util.component
|
|
10
|
+
* @description Will be called in component test scripts. Returns a previously stored entry point object for sharing information (like a draft id) between preparation and the actual component tests.
|
|
11
|
+
* @returns {Object} The data object of the stored entry point.
|
|
12
|
+
* @example const entryPoint = util.component.loadEntryPoint();
|
|
13
|
+
*/
|
|
14
|
+
loadEntryPoint(): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* @function storeEntryPoint
|
|
17
|
+
* @memberOf util.component
|
|
18
|
+
* @description Will be called in preparation scripts before component tests. Stores an entry point object for sharing information (like a draft id) between preparation and the actual component tests.
|
|
19
|
+
* @param {Object} The data object of the stored entry point.
|
|
20
|
+
* @example const entryPoint = util.component.storeEntryPoint({"draftId": "0123456789"});
|
|
21
|
+
*/
|
|
22
|
+
storeEntryPoint(data: any): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: Component;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Component = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
/**
|
|
29
|
+
* @class component
|
|
30
|
+
* @memberof util
|
|
31
|
+
* @description This class provides functions for writing component tests with qmate-proxy-service
|
|
32
|
+
*/
|
|
33
|
+
class Component {
|
|
34
|
+
/**
|
|
35
|
+
* @function loadEntryPoint
|
|
36
|
+
* @memberOf util.component
|
|
37
|
+
* @description Will be called in component test scripts. Returns a previously stored entry point object for sharing information (like a draft id) between preparation and the actual component tests.
|
|
38
|
+
* @returns {Object} The data object of the stored entry point.
|
|
39
|
+
* @example const entryPoint = util.component.loadEntryPoint();
|
|
40
|
+
*/
|
|
41
|
+
async loadEntryPoint() {
|
|
42
|
+
// Will be called in component scripts
|
|
43
|
+
const componentSpec = runtime.specs.filter((spec) => {
|
|
44
|
+
return !spec.includes("prep.");
|
|
45
|
+
})[0];
|
|
46
|
+
const componentSpecIdentifier = path.basename(componentSpec).replaceAll(".spec.js", "");
|
|
47
|
+
return await util.data.readDataFromFile(`${componentSpecIdentifier}.entrypoint.json`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @function storeEntryPoint
|
|
51
|
+
* @memberOf util.component
|
|
52
|
+
* @description Will be called in preparation scripts before component tests. Stores an entry point object for sharing information (like a draft id) between preparation and the actual component tests.
|
|
53
|
+
* @param {Object} The data object of the stored entry point.
|
|
54
|
+
* @example const entryPoint = util.component.storeEntryPoint({"draftId": "0123456789"});
|
|
55
|
+
*/
|
|
56
|
+
async storeEntryPoint(data) {
|
|
57
|
+
// Will be called in preparation scripts
|
|
58
|
+
const componentSpec = runtime.specs.filter((spec) => {
|
|
59
|
+
return !spec.includes("prep.");
|
|
60
|
+
})[0];
|
|
61
|
+
const componentSpecIdentifier = path.basename(componentSpec).replaceAll(".spec.js", "");
|
|
62
|
+
await util.data.writeDataToFile(`${componentSpecIdentifier}.entrypoint.json`, data);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Component = Component;
|
|
66
|
+
exports.default = new Component();
|
|
67
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/reuse/modules/util/component.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,2CAA6B;AAE7B;;;;GAIG;AACH,MAAa,SAAS;IACpB;;;;;;OAMG;IACH,KAAK,CAAC,cAAc;QAClB,sCAAsC;QACtC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE;YAC1D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACN,MAAM,uBAAuB,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAExF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,uBAAuB,kBAAkB,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,IAAS;QAC7B,wCAAwC;QACxC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE;YAC1D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACN,MAAM,uBAAuB,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAExF,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,uBAAuB,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACtF,CAAC;CACF;AAlCD,8BAkCC;AAED,kBAAe,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -8,25 +8,45 @@ export declare class Data {
|
|
|
8
8
|
* @memberOf util.data
|
|
9
9
|
* @description Returns the data object with the given filename (JSON, stored in data folder).
|
|
10
10
|
* @param {String} filename - The name of the data file.
|
|
11
|
-
* @
|
|
11
|
+
* @param {String} [source=data] - The source key defined under params.import of the config file.
|
|
12
|
+
* @returns {Object} The data object.
|
|
12
13
|
* @example const data = util.data.getData("myTest");
|
|
13
14
|
*/
|
|
14
|
-
getData(filename: string): string;
|
|
15
|
+
getData(filename: string, source?: string): string;
|
|
15
16
|
/**
|
|
16
17
|
* @function getSecureData
|
|
17
18
|
* @memberOf util.data
|
|
18
19
|
* @description Returns and encrypts the data object with the given filename (JSON, stored in data folder). Will return the local file object if private key is not accessible.
|
|
19
20
|
* @param {String} filename - The name of the data file (without suffix '.secure' or '.local').
|
|
20
|
-
* @
|
|
21
|
+
* @param {String} [source=data] - The source key defined under params.import of the config file.
|
|
22
|
+
* @returns {Object} The encrypted or local data object.
|
|
21
23
|
* @example const secureData = util.data.getSecureData("myTest");
|
|
22
24
|
*/
|
|
23
|
-
getSecureData(filename: string): string;
|
|
25
|
+
getSecureData(filename: string, source?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* @function readDataFromFile
|
|
28
|
+
* @memberOf util.data
|
|
29
|
+
* @description Reads the data object from the given filepath.
|
|
30
|
+
* @param {String} filePath - The filepath.
|
|
31
|
+
* @returns {Object} The data object.
|
|
32
|
+
* @example const data = util.data.readDataFromFile("./data/myData.json");
|
|
33
|
+
*/
|
|
34
|
+
readDataFromFile(filePath: string): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* @function writeDataToFile
|
|
37
|
+
* @memberOf util.data
|
|
38
|
+
* @description Writes the data object to the given filepath.
|
|
39
|
+
* @param {String} filePath - The filepath.
|
|
40
|
+
* @param {Object} data - The data object to write.
|
|
41
|
+
* @example const data = util.data.writeDataToFile("myTest");
|
|
42
|
+
*/
|
|
43
|
+
writeDataToFile(filePath: string, data: any): Promise<void>;
|
|
24
44
|
/**
|
|
25
45
|
* @function decrypt
|
|
26
46
|
* @memberOf util.data
|
|
27
47
|
* @description Decrypts the passed input data.
|
|
28
48
|
* @param {String} data - The encrypted data to decrypt.
|
|
29
|
-
* @returns {
|
|
49
|
+
* @returns {Object} The decrypted data.
|
|
30
50
|
* @example const decrypted = util.data.decrypt("d704004c262faa8ef4bdcf34c8a94883e15524872c7bef334d26a391a1934cf47338b749d99426980ee4cc7a81deaef21439c6894ab0324cdb29b9b6332635baca442651c5d37847f52bb90b8868e037271a7d456024b39b65fdf4dc62e8d82a3d5683a72e4324c59d339742fc79749f0ee74abef916d38e306218adc48e3547a2b346962249320c962d22cb46d9998de36d8219a2496c0997d0fc389f76fb1431a9b57c317886e9c9795c0a09ad98d9fa0b7687d10814dc7973397f3f72a227a04ead4c3d1d428c096a51922ffc4d7afc3952df1c130def5c5fb3e834605cbf1454885966cc65c77046343f4c678e74931fb2dd6cac8dae17837cf674f288d6550dd7fa6b01f5b7ea68aa6bd27d79dd5d53edb5fd4b4edce824bd31b3939352ad7a71a16bab8c54025c2bb92c54e022fcd23ff08bc54a17fc50d00dc3b884cadbfdefe1e75901fdf80e7324ad02a891f2c4863fa120ca238520b79126c65a03");
|
|
31
51
|
*/
|
|
32
52
|
decrypt(data: string): string;
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
29
|
exports.Data = void 0;
|
|
30
|
+
const fs_1 = require("fs");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const dataExchangeUtil_1 = __importDefault(require("../../../scripts/dataExchange/dataExchangeUtil"));
|
|
4
33
|
/**
|
|
5
34
|
* @class data
|
|
6
35
|
* @memberof util
|
|
@@ -11,20 +40,21 @@ class Data {
|
|
|
11
40
|
* @memberOf util.data
|
|
12
41
|
* @description Returns the data object with the given filename (JSON, stored in data folder).
|
|
13
42
|
* @param {String} filename - The name of the data file.
|
|
14
|
-
* @
|
|
43
|
+
* @param {String} [source=data] - The source key defined under params.import of the config file.
|
|
44
|
+
* @returns {Object} The data object.
|
|
15
45
|
* @example const data = util.data.getData("myTest");
|
|
16
46
|
*/
|
|
17
|
-
getData(filename) {
|
|
18
|
-
if (browser.config.params && browser.config.params.import && browser.config.params.import
|
|
19
|
-
if (browser.config.params.import
|
|
20
|
-
return browser.config.params.import
|
|
47
|
+
getData(filename, source = "data") {
|
|
48
|
+
if (browser.config.params && browser.config.params.import && browser.config.params.import[source]) {
|
|
49
|
+
if (browser.config.params.import[source][filename]) {
|
|
50
|
+
return browser.config.params.import[source][filename];
|
|
21
51
|
}
|
|
22
52
|
else {
|
|
23
|
-
throw new Error(`Function 'getData' failed.
|
|
53
|
+
throw new Error(`Function 'getData' failed. File '${filename}.json' empty or not defined under '${source}'`);
|
|
24
54
|
}
|
|
25
55
|
}
|
|
26
56
|
else {
|
|
27
|
-
throw new Error(`Function 'getData' failed.
|
|
57
|
+
throw new Error(`Function 'getData' failed. Data path '${source}' not defined in config.`);
|
|
28
58
|
}
|
|
29
59
|
}
|
|
30
60
|
/**
|
|
@@ -32,10 +62,11 @@ class Data {
|
|
|
32
62
|
* @memberOf util.data
|
|
33
63
|
* @description Returns and encrypts the data object with the given filename (JSON, stored in data folder). Will return the local file object if private key is not accessible.
|
|
34
64
|
* @param {String} filename - The name of the data file (without suffix '.secure' or '.local').
|
|
35
|
-
* @
|
|
65
|
+
* @param {String} [source=data] - The source key defined under params.import of the config file.
|
|
66
|
+
* @returns {Object} The encrypted or local data object.
|
|
36
67
|
* @example const secureData = util.data.getSecureData("myTest");
|
|
37
68
|
*/
|
|
38
|
-
getSecureData(filename) {
|
|
69
|
+
getSecureData(filename, source = "data") {
|
|
39
70
|
const privateKeyFound = global.util.data.privateKeyFound === true;
|
|
40
71
|
if (privateKeyFound) {
|
|
41
72
|
filename = `${filename}.secure`;
|
|
@@ -44,20 +75,60 @@ class Data {
|
|
|
44
75
|
util.console.info("getSecureData: No private key found. Continue using local file.");
|
|
45
76
|
filename = `${filename}.local`;
|
|
46
77
|
}
|
|
47
|
-
if (browser.config.params && browser.config.params.import && browser.config.params.import
|
|
48
|
-
if (browser.config.params.import
|
|
49
|
-
const data = browser.config.params.import
|
|
78
|
+
if (browser.config.params && browser.config.params.import && browser.config.params.import[source]) {
|
|
79
|
+
if (browser.config.params.import[source][filename]) {
|
|
80
|
+
const data = browser.config.params.import[source][filename];
|
|
50
81
|
if (privateKeyFound) {
|
|
51
82
|
this._decryptRecursively(data);
|
|
52
83
|
}
|
|
53
84
|
return data;
|
|
54
85
|
}
|
|
55
86
|
else {
|
|
56
|
-
throw new Error(`Function 'getSecureData' failed. File '${filename}.json' not
|
|
87
|
+
throw new Error(`Function 'getSecureData' failed. File '${filename}.json' empty or not defined under '${source}'`);
|
|
57
88
|
}
|
|
58
89
|
}
|
|
59
90
|
else {
|
|
60
|
-
throw new Error(`Function 'getSecureData' failed.
|
|
91
|
+
throw new Error(`Function 'getSecureData' failed. Data path '${source}' not defined in config.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @function readDataFromFile
|
|
96
|
+
* @memberOf util.data
|
|
97
|
+
* @description Reads the data object from the given filepath.
|
|
98
|
+
* @param {String} filePath - The filepath.
|
|
99
|
+
* @returns {Object} The data object.
|
|
100
|
+
* @example const data = util.data.readDataFromFile("./data/myData.json");
|
|
101
|
+
*/
|
|
102
|
+
async readDataFromFile(filePath) {
|
|
103
|
+
const relativeFilePath = dataExchangeUtil_1.default.getFileAbsPath(filePath);
|
|
104
|
+
if (!relativeFilePath) {
|
|
105
|
+
throw new Error("Function 'readDataFromFile' failed. Filepath could not be resolved.");
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
return JSON.parse(await fs_1.promises.readFile(path.resolve(relativeFilePath), "utf8"));
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw new Error(`Function 'readDataFromFile' failed: ${error}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @function writeDataToFile
|
|
116
|
+
* @memberOf util.data
|
|
117
|
+
* @description Writes the data object to the given filepath.
|
|
118
|
+
* @param {String} filePath - The filepath.
|
|
119
|
+
* @param {Object} data - The data object to write.
|
|
120
|
+
* @example const data = util.data.writeDataToFile("myTest");
|
|
121
|
+
*/
|
|
122
|
+
async writeDataToFile(filePath, data) {
|
|
123
|
+
const relativeFilePath = dataExchangeUtil_1.default.getFileAbsPath(filePath);
|
|
124
|
+
if (!relativeFilePath) {
|
|
125
|
+
throw new Error("Function 'writeDataToFile' failed. Filepath could not be resolved.");
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
await fs_1.promises.writeFile(path.resolve(relativeFilePath), JSON.stringify(data));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
throw new Error(`Function 'writeDataToFile' failed: ${error}`);
|
|
61
132
|
}
|
|
62
133
|
}
|
|
63
134
|
/**
|
|
@@ -65,7 +136,7 @@ class Data {
|
|
|
65
136
|
* @memberOf util.data
|
|
66
137
|
* @description Decrypts the passed input data.
|
|
67
138
|
* @param {String} data - The encrypted data to decrypt.
|
|
68
|
-
* @returns {
|
|
139
|
+
* @returns {Object} The decrypted data.
|
|
69
140
|
* @example const decrypted = util.data.decrypt("d704004c262faa8ef4bdcf34c8a94883e15524872c7bef334d26a391a1934cf47338b749d99426980ee4cc7a81deaef21439c6894ab0324cdb29b9b6332635baca442651c5d37847f52bb90b8868e037271a7d456024b39b65fdf4dc62e8d82a3d5683a72e4324c59d339742fc79749f0ee74abef916d38e306218adc48e3547a2b346962249320c962d22cb46d9998de36d8219a2496c0997d0fc389f76fb1431a9b57c317886e9c9795c0a09ad98d9fa0b7687d10814dc7973397f3f72a227a04ead4c3d1d428c096a51922ffc4d7afc3952df1c130def5c5fb3e834605cbf1454885966cc65c77046343f4c678e74931fb2dd6cac8dae17837cf674f288d6550dd7fa6b01f5b7ea68aa6bd27d79dd5d53edb5fd4b4edce824bd31b3939352ad7a71a16bab8c54025c2bb92c54e022fcd23ff08bc54a17fc50d00dc3b884cadbfdefe1e75901fdf80e7324ad02a891f2c4863fa120ca238520b79126c65a03");
|
|
70
141
|
*/
|
|
71
142
|
decrypt(data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../src/reuse/modules/util/data.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC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