vita-playwright 1.3.3 → 1.3.4

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.
@@ -1,5 +1,25 @@
1
1
  export declare class ApiHelper {
2
- static post(url: any, header: any, payload: any): Promise<any>;
3
- static get(url: any, header: any): Promise<any>;
4
- static put(url: any, header: any, payload: any): Promise<any>;
2
+ /**
3
+ * @description: Post call with endpoint, headers and data.
4
+ * @param {string} apiEndPoint - API end point.
5
+ * @param {string} header - header contains authentication keys, application type etc..
6
+ * @param {string} payload - payload data
7
+ * @returns {Promise<reponse>} - returns Promise of reponse
8
+ */
9
+ static post(apiEndPoint: any, header: any, payload: any): Promise<any>;
10
+ /**
11
+ * @description: Get call with endpoint and headers.
12
+ * @param {string} apiEndPoint - API end point.
13
+ * @param {string} header - header contains authentication keys, application type etc..
14
+ * @returns {Promise<reponse>} - returns Promise of reponse
15
+ */
16
+ static get(apiEndPoint: any, header: any): Promise<any>;
17
+ /**
18
+ * @description: Put call with endpoint, headers and data and it will insert the data.
19
+ * @param {string} apiEndPoint - API end point.
20
+ * @param {string} header - headers contains authentication keys, application type etc..
21
+ * @param {string} payload - payload data
22
+ * @returns {Promise<reponse>} - returns Promise of reponse
23
+ */
24
+ static put(apiEndPoint: any, header: any, payload: any): Promise<any>;
5
25
  }
@@ -12,11 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ApiHelper = void 0;
13
13
  const api_axios_1 = require("../utils/api_axios");
14
14
  class ApiHelper {
15
- static post(url, header, payload) {
15
+ /**
16
+ * @description: Post call with endpoint, headers and data.
17
+ * @param {string} apiEndPoint - API end point.
18
+ * @param {string} header - header contains authentication keys, application type etc..
19
+ * @param {string} payload - payload data
20
+ * @returns {Promise<reponse>} - returns Promise of reponse
21
+ */
22
+ static post(apiEndPoint, header, payload) {
16
23
  return __awaiter(this, void 0, void 0, function* () {
17
24
  var config = {
18
25
  method: 'post',
19
- url: url,
26
+ url: apiEndPoint,
20
27
  headers: header,
21
28
  data: payload
22
29
  };
@@ -24,22 +31,35 @@ class ApiHelper {
24
31
  return response;
25
32
  });
26
33
  }
27
- static get(url, header) {
34
+ /**
35
+ * @description: Get call with endpoint and headers.
36
+ * @param {string} apiEndPoint - API end point.
37
+ * @param {string} header - header contains authentication keys, application type etc..
38
+ * @returns {Promise<reponse>} - returns Promise of reponse
39
+ */
40
+ static get(apiEndPoint, header) {
28
41
  return __awaiter(this, void 0, void 0, function* () {
29
42
  var config = {
30
43
  method: 'GET',
31
- url: url,
44
+ url: apiEndPoint,
32
45
  headers: header
33
46
  };
34
47
  var response = yield api_axios_1.TokenGenerators.request(config);
35
48
  return response;
36
49
  });
37
50
  }
38
- static put(url, header, payload) {
51
+ /**
52
+ * @description: Put call with endpoint, headers and data and it will insert the data.
53
+ * @param {string} apiEndPoint - API end point.
54
+ * @param {string} header - headers contains authentication keys, application type etc..
55
+ * @param {string} payload - payload data
56
+ * @returns {Promise<reponse>} - returns Promise of reponse
57
+ */
58
+ static put(apiEndPoint, header, payload) {
39
59
  return __awaiter(this, void 0, void 0, function* () {
40
60
  var config = {
41
61
  method: 'put',
42
- url: url,
62
+ url: apiEndPoint,
43
63
  headers: header,
44
64
  data: payload
45
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"api-helpers.js","sourceRoot":"","sources":["../../../src/helpers/api-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqD;AAErD,MAAa,SAAS;IAElB,MAAM,CAAO,IAAI,CAAC,GAAQ,EAAE,MAAW,EAAE,OAAY;;YACjD,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAED,M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AC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IACD;;;;;;OAMG;IACH,MAAM,CAAO,GAAG,CAAC,WAAgB,EAAE,MAAW,EAAE,OAAY;;YACxD,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ;AAvDD,8BAuDC"}
@@ -1,18 +1,89 @@
1
1
  export declare class UIHelper {
2
2
  page: any;
3
3
  constructor(page: any);
4
+ /**
5
+ * @description: sets the text in inputbox.
6
+ * @param {string} locator - css selector/xpath of the inputbox.
7
+ * @param {string} data - Text to be set to inputbox
8
+ * @returns {Promise<void>} - returns Promise of void
9
+ */
4
10
  filltheData(locator: any, data: any): Promise<void>;
11
+ /**
12
+ * @description: click the given locator element.
13
+ * @param {string} locator - css selector/xpath of the element.
14
+ * @returns {Promise<void>} - returns Promise of void
15
+ */
5
16
  clickonWebElement(locator: any): Promise<void>;
17
+ /**
18
+ * @description: returns inner html of locator element.
19
+ * @param {string} locator - css selector/xpath of the element.
20
+ * @returns {string} - returns inner html string
21
+ */
6
22
  getInnerHTML(locator: any): Promise<any>;
23
+ /**
24
+ * @description: returns inner text of locator element.
25
+ * @param {string} locator - css selector/xpath of the element.
26
+ * @returns {string} - returns inner text string
27
+ */
7
28
  getInnerText(locator: any): Promise<any>;
29
+ /**
30
+ * @description: returns text of locator element.
31
+ * @param {string} locator - css selector/xpath of the element.
32
+ * @returns {string} - returns text string
33
+ */
8
34
  getText(locator: any): Promise<any>;
35
+ /**
36
+ * @description: returns given attribute value of locator element.
37
+ * @param {string} locator - css selector/xpath of the element.
38
+ * @param {string} attribute - html attribute to get value
39
+ * @returns {string} - returns text string
40
+ */
9
41
  getAttribute(locator: any, attribute: any): Promise<any>;
10
42
  evaluateJS(jsDOM: any): Promise<any>;
43
+ /**
44
+ * @description: verifies given locator element is displayed or not.
45
+ * @param {string} locator - css selector/xpath of the element.
46
+ * @returns {boolean} - returns true/false
47
+ */
11
48
  isElementPresent(locator: any): Promise<any>;
49
+ /**
50
+ * @description: verifies given locator element is enabled or not.
51
+ * @param {string} locator - css selector/xpath of the element.
52
+ * @returns {boolean} - returns true/false
53
+ */
12
54
  isElementEnabled(locator: any): Promise<any>;
55
+ /**
56
+ * @description: waits until locator element visibles.
57
+ * @param {elementReference} elementSelector - element reference.
58
+ * @param {number} wait time
59
+ * @returns {Promise<void>} - returns Promise of void
60
+ */
13
61
  waitTillElementIsVisible(elementSelector: any, waitTime?: number): Promise<void>;
62
+ /**
63
+ * @description: returns value of inputbox.
64
+ * @param {string} locator - css selector/xpath of the element.
65
+ * @returns {string} - returns text string
66
+ */
14
67
  getInputBoxValue(locator: any): Promise<any>;
68
+ /**
69
+ * @description: wait untill download process completes and save file with custom name.
70
+ * @param {string} locator - css selector/xpath of the element.
71
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
72
+ * @returns {Promise<void>} - returns Promise of void
73
+ */
15
74
  downloadAFile(downloadButton: String, filePath: string): Promise<void>;
75
+ /**
76
+ * @description: wait untill upload process completes and save file with custom name.
77
+ * @param {string} locator - css selector/xpath of the element.
78
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
79
+ * @returns {Promise<void>} - returns Promise of void
80
+ */
16
81
  uploadAFile(uploadButton: String, uploadFilePath: String): Promise<void>;
82
+ /**
83
+ * @description: will perform click action.
84
+ * @param {string} roleType - example: "alert"|"alertdialog"|"application"|"article"|"banner"|"blockquote"|"button"|"caption"|"cell"|"checkbox"|"code"|"columnheader"|"combobox"|"complementary"|"contentinfo"|"definition"|"deletion"|"dialog"|"directory"|"document"|"emphasis"|"feed"|"figure"|"form"|"generic"|"grid"|"gridcell"|"group"|"heading"|"img"|"insertion"|"link"|"list"|"listbox"|"listitem"|"log"|"main"|"marquee"|"math"|"meter"|"menu"|"menubar"|"menuitem"|"menuitemcheckbox"|"menuitemradio"|"navigation"|"none"|"note"|"option"|"paragraph"|"presentation"|"progressbar"|"radio"|"radiogroup"|"region"|"row"|"rowgroup"|"rowheader"|"scrollbar"|"search"|"searchbox"|"separator"|"slider"|"spinbutton"|"status"|"strong"|"subscript"|"superscript"|"switch"|"tab"|"table"|"tablist"|"tabpanel"|"term"|"textbox"|"time"|"timer"|"toolbar"|"tooltip"|"tree"|"treegrid"|"treeitem".
85
+ * @param {string} roleName - name of the element.
86
+ * @returns {Promise<void>} - returns Promise of void
87
+ */
17
88
  getElementRefByRole(roleType: string, roleName: string): Promise<void>;
18
89
  }
@@ -15,6 +15,12 @@ class UIHelper {
15
15
  constructor(page) {
16
16
  this.page = page;
17
17
  }
18
+ /**
19
+ * @description: sets the text in inputbox.
20
+ * @param {string} locator - css selector/xpath of the inputbox.
21
+ * @param {string} data - Text to be set to inputbox
22
+ * @returns {Promise<void>} - returns Promise of void
23
+ */
18
24
  filltheData(locator, data) {
19
25
  return __awaiter(this, void 0, void 0, function* () {
20
26
  if (data) {
@@ -24,6 +30,11 @@ class UIHelper {
24
30
  }
25
31
  });
26
32
  }
33
+ /**
34
+ * @description: click the given locator element.
35
+ * @param {string} locator - css selector/xpath of the element.
36
+ * @returns {Promise<void>} - returns Promise of void
37
+ */
27
38
  clickonWebElement(locator) {
28
39
  return __awaiter(this, void 0, void 0, function* () {
29
40
  yield this.page.locator(locator).scrollIntoViewIfNeeded();
@@ -31,6 +42,11 @@ class UIHelper {
31
42
  yield this.page.locator(locator).click();
32
43
  });
33
44
  }
45
+ /**
46
+ * @description: returns inner html of locator element.
47
+ * @param {string} locator - css selector/xpath of the element.
48
+ * @returns {string} - returns inner html string
49
+ */
34
50
  getInnerHTML(locator) {
35
51
  return __awaiter(this, void 0, void 0, function* () {
36
52
  yield this.waitTillElementIsVisible(locator);
@@ -38,6 +54,11 @@ class UIHelper {
38
54
  return yield this.page.innerHTML(locator);
39
55
  });
40
56
  }
57
+ /**
58
+ * @description: returns inner text of locator element.
59
+ * @param {string} locator - css selector/xpath of the element.
60
+ * @returns {string} - returns inner text string
61
+ */
41
62
  getInnerText(locator) {
42
63
  return __awaiter(this, void 0, void 0, function* () {
43
64
  yield this.waitTillElementIsVisible(locator);
@@ -45,6 +66,11 @@ class UIHelper {
45
66
  return yield this.page.locator(locator).innerText().trim();
46
67
  });
47
68
  }
69
+ /**
70
+ * @description: returns text of locator element.
71
+ * @param {string} locator - css selector/xpath of the element.
72
+ * @returns {string} - returns text string
73
+ */
48
74
  getText(locator) {
49
75
  return __awaiter(this, void 0, void 0, function* () {
50
76
  yield this.waitTillElementIsVisible(locator);
@@ -52,6 +78,12 @@ class UIHelper {
52
78
  return yield this.page.locator(locator).textContent();
53
79
  });
54
80
  }
81
+ /**
82
+ * @description: returns given attribute value of locator element.
83
+ * @param {string} locator - css selector/xpath of the element.
84
+ * @param {string} attribute - html attribute to get value
85
+ * @returns {string} - returns text string
86
+ */
55
87
  getAttribute(locator, attribute) {
56
88
  return __awaiter(this, void 0, void 0, function* () {
57
89
  yield this.waitTillElementIsVisible(locator);
@@ -64,6 +96,11 @@ class UIHelper {
64
96
  return yield this.page.evaluate(jsDOM);
65
97
  });
66
98
  }
99
+ /**
100
+ * @description: verifies given locator element is displayed or not.
101
+ * @param {string} locator - css selector/xpath of the element.
102
+ * @returns {boolean} - returns true/false
103
+ */
67
104
  isElementPresent(locator) {
68
105
  return __awaiter(this, void 0, void 0, function* () {
69
106
  // console.log(typeof locator.toString());
@@ -79,17 +116,33 @@ class UIHelper {
79
116
  console.log(type.toString());
80
117
  });
81
118
  }
119
+ /**
120
+ * @description: verifies given locator element is enabled or not.
121
+ * @param {string} locator - css selector/xpath of the element.
122
+ * @returns {boolean} - returns true/false
123
+ */
82
124
  isElementEnabled(locator) {
83
125
  return __awaiter(this, void 0, void 0, function* () {
84
126
  yield this.page.locator(locator).scrollIntoViewIfNeeded();
85
127
  return yield this.page.locator(locator).isEnabled();
86
128
  });
87
129
  }
130
+ /**
131
+ * @description: waits until locator element visibles.
132
+ * @param {elementReference} elementSelector - element reference.
133
+ * @param {number} wait time
134
+ * @returns {Promise<void>} - returns Promise of void
135
+ */
88
136
  waitTillElementIsVisible(elementSelector, waitTime = 60000) {
89
137
  return __awaiter(this, void 0, void 0, function* () {
90
138
  yield this.page.waitForSelector(elementSelector, { waitFor: 'visible', timeout: waitTime });
91
139
  });
92
140
  }
141
+ /**
142
+ * @description: returns value of inputbox.
143
+ * @param {string} locator - css selector/xpath of the element.
144
+ * @returns {string} - returns text string
145
+ */
93
146
  getInputBoxValue(locator) {
94
147
  return __awaiter(this, void 0, void 0, function* () {
95
148
  yield this.waitTillElementIsVisible(locator);
@@ -102,6 +155,12 @@ class UIHelper {
102
155
  // robot.moveMouse(400, 20);
103
156
  // robot.keyTap("enter");
104
157
  // }
158
+ /**
159
+ * @description: wait untill download process completes and save file with custom name.
160
+ * @param {string} locator - css selector/xpath of the element.
161
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
162
+ * @returns {Promise<void>} - returns Promise of void
163
+ */
105
164
  downloadAFile(downloadButton, filePath) {
106
165
  return __awaiter(this, void 0, void 0, function* () {
107
166
  const downloadPromise = this.page.waitForEvent('download');
@@ -112,6 +171,12 @@ class UIHelper {
112
171
  yield download.saveAs(filePath);
113
172
  });
114
173
  }
174
+ /**
175
+ * @description: wait untill upload process completes and save file with custom name.
176
+ * @param {string} locator - css selector/xpath of the element.
177
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
178
+ * @returns {Promise<void>} - returns Promise of void
179
+ */
115
180
  uploadAFile(uploadButton, uploadFilePath) {
116
181
  return __awaiter(this, void 0, void 0, function* () {
117
182
  const fileChooserPromise = this.page.waitForEvent('filechooser');
@@ -120,6 +185,12 @@ class UIHelper {
120
185
  yield fileChooser.setFiles(uploadFilePath);
121
186
  });
122
187
  }
188
+ /**
189
+ * @description: will perform click action.
190
+ * @param {string} roleType - example: "alert"|"alertdialog"|"application"|"article"|"banner"|"blockquote"|"button"|"caption"|"cell"|"checkbox"|"code"|"columnheader"|"combobox"|"complementary"|"contentinfo"|"definition"|"deletion"|"dialog"|"directory"|"document"|"emphasis"|"feed"|"figure"|"form"|"generic"|"grid"|"gridcell"|"group"|"heading"|"img"|"insertion"|"link"|"list"|"listbox"|"listitem"|"log"|"main"|"marquee"|"math"|"meter"|"menu"|"menubar"|"menuitem"|"menuitemcheckbox"|"menuitemradio"|"navigation"|"none"|"note"|"option"|"paragraph"|"presentation"|"progressbar"|"radio"|"radiogroup"|"region"|"row"|"rowgroup"|"rowheader"|"scrollbar"|"search"|"searchbox"|"separator"|"slider"|"spinbutton"|"status"|"strong"|"subscript"|"superscript"|"switch"|"tab"|"table"|"tablist"|"tabpanel"|"term"|"textbox"|"time"|"timer"|"toolbar"|"tooltip"|"tree"|"treegrid"|"treeitem".
191
+ * @param {string} roleName - name of the element.
192
+ * @returns {Promise<void>} - returns Promise of void
193
+ */
123
194
  getElementRefByRole(roleType, roleName) {
124
195
  return __awaiter(this, void 0, void 0, function* () {
125
196
  yield this.page.getByRole(roleType, { name: roleName }).click();
@@ -1 +1 @@
1
- {"version":3,"file":"ui-helpers.js","sourceRoot":"","sources":["../../../src/helpers/ui-helpers.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;;;;;;;;;;AAE9B,MAAa,QAAQ;IAGjB,YAAY,IAAS;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAEK,WAAW,CAAC,OAAY,EAAE,IAAS;;YAErC,IAAI,IAAI,EAAE;gBACN,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;gBAC7C,MAAM,IAAI,CAAC,IAAI,C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C;IAChC,6BAA6B;IAC7B,IAAI;IACJ;;;;;OAKG;IACG,aAAa,CAAC,cAAsB,EAAE,QAAgB;;YACxD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAC3D,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;YAC7C,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC;YACvC,4CAA4C;YAC5C,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/C,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;KAAA;IACD;;;;;OAKG;IACG,WAAW,CAAC,YAAoB,EAAE,cAAsB;;YAC1D,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YACjE,MAAM,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;YAC3C,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC;YAC7C,MAAM,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC;KAAA;IACD;;;;;OAKG;IACG,mBAAmB,CAAC,QAAgB,EAAE,QAAgB;;YACxD,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QACpE,CAAC;KAAA;CAEJ;AA7KD,4BA6KC"}
@@ -1,9 +1,47 @@
1
1
  import moment, { DurationInputArg1, DurationInputArg2 } from 'moment';
2
2
  export declare class Dateutility {
3
+ /**
4
+ * @description: returns date in required format.
5
+ * @param {string} date - date in the form of string, example: 01/01/2023.
6
+ * @param {string} format - format od date, example: DD/MM/YYYY.
7
+ * @returns {string} - returns date in given format.
8
+ */
3
9
  static getDateInCustomFormat(date: any, format: string): string;
10
+ /**
11
+ * @description: adds no of days|months|years|hours|minutes|seconds from given date.
12
+ * @param {string} date - date in the form of string, example: 01/01/2023.
13
+ * @param {string} format - format od date, example: DD/MM/YYYY.
14
+ * @param {string} durationType - example days, months, years, hours, minutes, seconds.
15
+ * @param {string} duration - no of days|months|years|hours|minutes|seconds.
16
+ * @returns {string} - returns date in given format.
17
+ */
4
18
  static getFutureDateInCustomFormat(date: any, format: string, durationType: DurationInputArg2, duration: DurationInputArg1): string;
19
+ /**
20
+ * @description: subtracts no of days|months|years|hours|minutes|seconds from given date.
21
+ * @param {string} date - date in the form of string, example: 01/01/2023.
22
+ * @param {string} format - format od date, example: DD/MM/YYYY.
23
+ * @param {string} durationType - example days, months, years, hours, minutes, seconds.
24
+ * @param {string} duration - no of days|months|years|hours|minutes|seconds.
25
+ * @returns {string} - returns date in given format.
26
+ */
5
27
  static getPastDateInCustomFormat(date: any, format: string, durationType: DurationInputArg2, duration: DurationInputArg1): string;
28
+ /**
29
+ * @description: return min date from given dates.
30
+ * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
31
+ * @returns {string} - return min date amount given dates example: 10/01/2023.
32
+ */
6
33
  static getMinDateFromMultipleDates(datesArrayObject: any): moment.Moment;
34
+ /**
35
+ * @description: return max date from given dates.
36
+ * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
37
+ * @returns {string} - return max date amount given dates example: 20/01/2023.
38
+ */
7
39
  static getMaxDateFromMultipleDates(date1: any, date2: any): moment.Moment;
40
+ /**
41
+ * @description: returns no of days "lessthan|Greaterthan" from given date.
42
+ * @param {string} fromDate - date in the form of string, example: 01/01/2023.
43
+ * @param {string} format - format od date, example: DD/MM/YYYY.
44
+ * @returns {string} - returns string which is no of days "lessthan|Greaterthan" from given date.
45
+ */
8
46
  static calculateRelativeDate(fromDate: any, format: string): string;
9
47
  }
@@ -7,21 +7,59 @@ exports.Dateutility = void 0;
7
7
  const lodash_1 = require("lodash");
8
8
  const moment_1 = __importDefault(require("moment"));
9
9
  class Dateutility {
10
+ /**
11
+ * @description: returns date in required format.
12
+ * @param {string} date - date in the form of string, example: 01/01/2023.
13
+ * @param {string} format - format od date, example: DD/MM/YYYY.
14
+ * @returns {string} - returns date in given format.
15
+ */
10
16
  static getDateInCustomFormat(date, format) {
11
17
  return (0, moment_1.default)(date).format(format);
12
18
  }
19
+ /**
20
+ * @description: adds no of days|months|years|hours|minutes|seconds from given date.
21
+ * @param {string} date - date in the form of string, example: 01/01/2023.
22
+ * @param {string} format - format od date, example: DD/MM/YYYY.
23
+ * @param {string} durationType - example days, months, years, hours, minutes, seconds.
24
+ * @param {string} duration - no of days|months|years|hours|minutes|seconds.
25
+ * @returns {string} - returns date in given format.
26
+ */
13
27
  static getFutureDateInCustomFormat(date, format, durationType, duration) {
14
28
  return (0, moment_1.default)(date).add(duration, durationType).format(format);
15
29
  }
30
+ /**
31
+ * @description: subtracts no of days|months|years|hours|minutes|seconds from given date.
32
+ * @param {string} date - date in the form of string, example: 01/01/2023.
33
+ * @param {string} format - format od date, example: DD/MM/YYYY.
34
+ * @param {string} durationType - example days, months, years, hours, minutes, seconds.
35
+ * @param {string} duration - no of days|months|years|hours|minutes|seconds.
36
+ * @returns {string} - returns date in given format.
37
+ */
16
38
  static getPastDateInCustomFormat(date, format, durationType, duration) {
17
39
  return (0, moment_1.default)(date).subtract(duration, durationType).format(format);
18
40
  }
41
+ /**
42
+ * @description: return min date from given dates.
43
+ * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
44
+ * @returns {string} - return min date amount given dates example: 10/01/2023.
45
+ */
19
46
  static getMinDateFromMultipleDates(datesArrayObject) {
20
47
  return moment_1.default.min((0, lodash_1.map)(datesArrayObject, (obj) => (0, moment_1.default)(obj.date, obj.format)));
21
48
  }
49
+ /**
50
+ * @description: return max date from given dates.
51
+ * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
52
+ * @returns {string} - return max date amount given dates example: 20/01/2023.
53
+ */
22
54
  static getMaxDateFromMultipleDates(date1, date2) {
23
55
  return moment_1.default.max(date1, date2);
24
56
  }
57
+ /**
58
+ * @description: returns no of days "lessthan|Greaterthan" from given date.
59
+ * @param {string} fromDate - date in the form of string, example: 01/01/2023.
60
+ * @param {string} format - format od date, example: DD/MM/YYYY.
61
+ * @returns {string} - returns string which is no of days "lessthan|Greaterthan" from given date.
62
+ */
25
63
  static calculateRelativeDate(fromDate, format) {
26
64
  return (0, moment_1.default)(fromDate, format).fromNow();
27
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date_utilitites.js","sourceRoot":"","sources":["../../../src/utils/date_utilitites.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA6B;AAC7B,oDAAsE;AACtE,MAAa,WAAW;IAEpB,MAAM,CAAC,qBAAqB,CAAC,IAAQ,EAAE,MAAc;QACjD,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,2BAA2B,CAAC,IAAS,EAAE,MAAc,EAAE,YAA8B,EAAE,QAA2B;QACrH,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,yBAAyB,CAAC,IAAS,EAAE,MAAc,EAAE,YAA8B,EAAE,QAA2B;QACnH,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,MAAM,CA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AAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,gBAAqB;QACpD,OAAO,gBAAM,CAAC,GAAG,CAAC,IAAA,YAAG,EAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,gBAAM,EAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,KAAU,EAAE,KAAU;QACrD,OAAO,gBAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAa,EAAE,MAAc;QACtD,OAAO,IAAA,gBAAM,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;IAC9C,CAAC;CACJ;AA/DD,kCA+DC"}
@@ -1,9 +1,46 @@
1
1
  import XLSX from 'xlsx';
2
2
  export declare class DocumentUtility {
3
+ /**
4
+ * @description: it will take excel file path as input and will return excel Workbook object.
5
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
6
+ * @returns {Promise<Workbook>} - returns Promise, if we resolves and will get Workbook object
7
+ */
3
8
  static readData(filePath: string): Promise<XLSX.WorkBook>;
9
+ /**
10
+ * @description: it will take excel file path and sheetname as input and will return array of objects.
11
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
12
+ * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
13
+ * @returns {Promise<Array<Object>>} - returns Promise, if we resolves and will get Array of Json objects.
14
+ * [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
15
+ */
4
16
  static readDataFromExcelorCSV(filePath: string, sheetname: string): Promise<unknown[]>;
17
+ /**
18
+ * @description: it will filter excel data and will return filtered array of objects.
19
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
20
+ * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
21
+ * @param {Object} filterObject - {column Name:Row value} key:value pair. example: {startDate: '****'}
22
+ * @returns {Promise<Array<Object>>} - returns Promise, if we resolves and will get filtered Array of Json objects.
23
+ * [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
24
+ */
5
25
  static filterData(filePath: string, sheetName: string, filterObject: object): Promise<unknown[]>;
26
+ /**
27
+ * @description: it will modify/update excel file based on input data.
28
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
29
+ * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
30
+ * @param {Array<Object>} exportData - excel modify data. example: [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
31
+ * @returns {Promise<void>} - returns void promise.
32
+ */
6
33
  static updateExcelData(filePath: string, sheetName: string, exportData: Array<object>): Promise<void>;
34
+ /**
35
+ * @description: it will delete all files under given directory.
36
+ * @param {string} dirPath - Complete path of the directory which contain file, example: C:/resources.
37
+ * @returns {Promise<void>} - returns void promise.
38
+ */
7
39
  static deleteAllFilesUnderDir(dirPath: string): Promise<void>;
40
+ /**
41
+ * @description: it will take pdf file path as input and will return array of strings(each each line in pdf is each item in result array).
42
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.pdf.
43
+ * @returns { Array<string>} - returns array os string, each string represents each line in pdf
44
+ */
8
45
  static readPdfFile(filePath: string): Promise<unknown>;
9
46
  }
@@ -19,11 +19,23 @@ const promises_1 = __importDefault(require("node:fs/promises"));
19
19
  const node_path_1 = __importDefault(require("node:path"));
20
20
  const pdfreader_1 = require("pdfreader");
21
21
  class DocumentUtility {
22
+ /**
23
+ * @description: it will take excel file path as input and will return excel Workbook object.
24
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
25
+ * @returns {Promise<Workbook>} - returns Promise, if we resolves and will get Workbook object
26
+ */
22
27
  static readData(filePath) {
23
28
  return __awaiter(this, void 0, void 0, function* () {
24
29
  return xlsx_1.default.readFile(filePath, { cellDates: true, bookVBA: true, sheetStubs: true, cellNF: true });
25
30
  });
26
31
  }
32
+ /**
33
+ * @description: it will take excel file path and sheetname as input and will return array of objects.
34
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
35
+ * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
36
+ * @returns {Promise<Array<Object>>} - returns Promise, if we resolves and will get Array of Json objects.
37
+ * [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
38
+ */
27
39
  static readDataFromExcelorCSV(filePath, sheetname) {
28
40
  return __awaiter(this, void 0, void 0, function* () {
29
41
  const jsonOpts = {
@@ -47,12 +59,27 @@ class DocumentUtility {
47
59
  // })[0];
48
60
  });
49
61
  }
62
+ /**
63
+ * @description: it will filter excel data and will return filtered array of objects.
64
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
65
+ * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
66
+ * @param {Object} filterObject - {column Name:Row value} key:value pair. example: {startDate: '****'}
67
+ * @returns {Promise<Array<Object>>} - returns Promise, if we resolves and will get filtered Array of Json objects.
68
+ * [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
69
+ */
50
70
  static filterData(filePath, sheetName, filterObject) {
51
71
  return __awaiter(this, void 0, void 0, function* () {
52
72
  let fileData = yield DocumentUtility.readData(filePath);
53
73
  return lodash_1.default.filter(xlsx_1.default.utils.sheet_to_json(fileData.Sheets[sheetName]), filterObject);
54
74
  });
55
75
  }
76
+ /**
77
+ * @description: it will modify/update excel file based on input data.
78
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
79
+ * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
80
+ * @param {Array<Object>} exportData - excel modify data. example: [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
81
+ * @returns {Promise<void>} - returns void promise.
82
+ */
56
83
  static updateExcelData(filePath, sheetName, exportData) {
57
84
  return __awaiter(this, void 0, void 0, function* () {
58
85
  const workbook = yield DocumentUtility.readData(filePath);
@@ -60,6 +87,11 @@ class DocumentUtility {
60
87
  xlsx_1.default.writeFile(workbook, filePath);
61
88
  });
62
89
  }
90
+ /**
91
+ * @description: it will delete all files under given directory.
92
+ * @param {string} dirPath - Complete path of the directory which contain file, example: C:/resources.
93
+ * @returns {Promise<void>} - returns void promise.
94
+ */
63
95
  static deleteAllFilesUnderDir(dirPath) {
64
96
  return __awaiter(this, void 0, void 0, function* () {
65
97
  for (const file of yield promises_1.default.readdir(dirPath)) {
@@ -67,6 +99,11 @@ class DocumentUtility {
67
99
  }
68
100
  });
69
101
  }
102
+ /**
103
+ * @description: it will take pdf file path as input and will return array of strings(each each line in pdf is each item in result array).
104
+ * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.pdf.
105
+ * @returns { Array<string>} - returns array os string, each string represents each line in pdf
106
+ */
70
107
  static readPdfFile(filePath) {
71
108
  return __awaiter(this, void 0, void 0, function* () {
72
109
  const items = [];
@@ -1 +1 @@
1
- {"version":3,"file":"document_utility.js","sourceRoot":"","sources":["../../../src/utils/document_utility.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,oDAAuB;AACvB,gEAAkC;AAClC,0DAA6B;AAC7B,yCAAsC;AAEtC,MAAa,eAAe;IAExB,MAAM,CAAO,QAAQ,CAAC,QAAgB;;YAClC,OAAO,cAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACvG,CAAC;KAAA;IAED,MAAM,CAAO,sBAAsB,CAAC,QAAgB,EAAE,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