vita-playwright 1.3.18 → 1.3.20

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/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ApiHelper } from "./src/helpers/api-helpers";
3
3
  import { TokenGenerators } from "./src/utils/api_axios";
4
4
  import { AzureStorageMethods } from "./src/utils/azure_storage_methods";
5
5
  import { Comparisions } from "./src/utils/comparisions";
6
- import { DocumentUtility } from "./src/utils/document_utility";
6
+ import { DocumentUtility } from "./src/utils/document_utility.js";
7
7
  import { KeyVaultMethods } from "./src/utils/keyvault_methods";
8
8
  import { TestData } from "./src/utils/test_data";
9
9
  import { XmlToJson } from "./src/utils/xmlToJson";
package/dist/index.js CHANGED
@@ -11,8 +11,8 @@ const azure_storage_methods_1 = require("./src/utils/azure_storage_methods");
11
11
  Object.defineProperty(exports, "AzureStorageMethods", { enumerable: true, get: function () { return azure_storage_methods_1.AzureStorageMethods; } });
12
12
  const comparisions_1 = require("./src/utils/comparisions");
13
13
  Object.defineProperty(exports, "Comparisions", { enumerable: true, get: function () { return comparisions_1.Comparisions; } });
14
- const document_utility_1 = require("./src/utils/document_utility");
15
- Object.defineProperty(exports, "DocumentUtility", { enumerable: true, get: function () { return document_utility_1.DocumentUtility; } });
14
+ const document_utility_js_1 = require("./src/utils/document_utility.js");
15
+ Object.defineProperty(exports, "DocumentUtility", { enumerable: true, get: function () { return document_utility_js_1.DocumentUtility; } });
16
16
  const keyvault_methods_1 = require("./src/utils/keyvault_methods");
17
17
  Object.defineProperty(exports, "KeyVaultMethods", { enumerable: true, get: function () { return keyvault_methods_1.KeyVaultMethods; } });
18
18
  const test_data_1 = require("./src/utils/test_data");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAYhD,yFAZK,qBAAQ,OAYL;AAXZ,2DAAsD;AAYlD,0FAZK,uBAAS,OAYL;AAXb,qDAAwD;AAYpD,gGAZK,2BAAe,OAYL;AAXnB,6EAAwE;AAYpE,oGAZK,2CAAmB,OAYL;AAXvB,2DAAwD;AAYpD,6FAZK,2BAAY,OAYL;AAXhB,mEAA+D;AAY3D,gGAZK,kCAAe,OAYL;AAXnB,mEAA+D;AAY3D,gGAZK,kCAAe,OAYL;AAXnB,qDAAiD;AAY7C,yFAZK,oBAAQ,OAYL;AAXZ,qDAAkD;AAY9C,0FAZK,qBAAS,OAYL;AAXb,qEAAkE;AAY9D,kGAZK,qCAAiB,OAYL"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAYhD,yFAZK,qBAAQ,OAYL;AAXZ,2DAAsD;AAYlD,0FAZK,uBAAS,OAYL;AAXb,qDAAwD;AAYpD,gGAZK,2BAAe,OAYL;AAXnB,6EAAwE;AAYpE,oGAZK,2CAAmB,OAYL;AAXvB,2DAAwD;AAYpD,6FAZK,2BAAY,OAYL;AAXhB,yEAAkE;AAY9D,gGAZK,qCAAe,OAYL;AAXnB,mEAA+D;AAY3D,gGAZK,kCAAe,OAYL;AAXnB,qDAAiD;AAY7C,yFAZK,oBAAQ,OAYL;AAXZ,qDAAkD;AAY9C,0FAZK,qBAAS,OAYL;AAXb,qEAAkE;AAY9D,kGAZK,qCAAiB,OAYL"}
@@ -0,0 +1,46 @@
1
+ import XLSX from 'xlsx';
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
45
+ static readPdfFile(filePath: string): Promise<unknown>;
46
+ }
@@ -37,10 +37,4 @@ export declare class DocumentUtility {
37
37
  * @returns {Promise<void>} - returns void promise.
38
38
  */
39
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
- */
45
- static readPdfFile(filePath: string): Promise<unknown>;
46
40
  }
@@ -17,7 +17,6 @@ const xlsx_1 = __importDefault(require("xlsx"));
17
17
  const lodash_1 = __importDefault(require("lodash"));
18
18
  const promises_1 = __importDefault(require("node:fs/promises"));
19
19
  const node_path_1 = __importDefault(require("node:path"));
20
- const pdfreader_1 = require("pdfreader");
21
20
  class DocumentUtility {
22
21
  /**
23
22
  * @description: it will take excel file path as input and will return excel Workbook object.
@@ -99,26 +98,6 @@ class DocumentUtility {
99
98
  }
100
99
  });
101
100
  }
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
- */
107
- static readPdfFile(filePath) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- const items = [];
110
- return new Promise((resolve, reject) => {
111
- new pdfreader_1.PdfReader().parseFileItems(filePath, (err, item) => {
112
- if (err)
113
- reject(err);
114
- else if (!item)
115
- resolve(items);
116
- else if (item.text)
117
- items.push(item.text);
118
- });
119
- });
120
- });
121
- }
122
101
  }
123
102
  exports.DocumentUtility = DocumentUtility;
124
103
  //# sourceMappingURL=document_utility.js.map
@@ -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;;;;OAIG;IACH,MAAM,CAAO,QA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,CAAC,MAAM,CAAC,cAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;QACvF,CAAC;KAAA;IAED;;;;;;OAMG;IACH,MAAM,CAAO,eAAe,CAAC,QAAgB,EAAE,SAAiB,EAAE,UAAyB;;YACvF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC1D,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,cAAI,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAClE,cAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvC,CAAC;KAAA;IAED;;;;OAIG;IACH,MAAM,CAAO,sBAAsB,CAAC,OAAe;;YAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,kBAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC1C,MAAM,kBAAE,CAAC,MAAM,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC;KAAA;CAoBJ;AAhGD,0CAgGC"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DocumentUtility = void 0;
16
+ const xlsx_1 = __importDefault(require("xlsx"));
17
+ const lodash_1 = __importDefault(require("lodash"));
18
+ const promises_1 = __importDefault(require("node:fs/promises"));
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const pdfreader_1 = require("pdfreader");
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
+ */
27
+ static readData(filePath) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return xlsx_1.default.readFile(filePath, { cellDates: true, bookVBA: true, sheetStubs: true, cellNF: true });
30
+ });
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
+ */
39
+ static readDataFromExcelorCSV(filePath, sheetname) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const jsonOpts = {
42
+ raw: false,
43
+ dateNF: `yyyy/mm/dd` // <--- need dateNF in sheet_to_json options (note the escape chars)
44
+ };
45
+ const workbook = yield DocumentUtility.readData(filePath);
46
+ const sheet_name_list = workbook.SheetNames;
47
+ sheetname = (sheetname === undefined ? sheet_name_list[0] : sheetname);
48
+ return xlsx_1.default.utils.sheet_to_json(workbook.Sheets[sheet_name_list[0]], jsonOpts);
49
+ // const tempTwoDimentionalArr = new Array(_.keys(excelData[0]).length);
50
+ // for (var i = 0; i < tempTwoDimentionalArr.length; i++) {
51
+ // tempTwoDimentionalArr[i] = new Array();
52
+ // }
53
+ // return _.map(excelData, function (obj) {
54
+ // return _.reduce(_.keys(excelData[0]), function (result, columnName, index) {
55
+ // tempTwoDimentionalArr[index].push(obj[columnName])
56
+ // result[columnName] = tempTwoDimentionalArr[index];
57
+ // return result;
58
+ // }, {})
59
+ // })[0];
60
+ });
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
+ */
70
+ static filterData(filePath, sheetName, filterObject) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ let fileData = yield DocumentUtility.readData(filePath);
73
+ return lodash_1.default.filter(xlsx_1.default.utils.sheet_to_json(fileData.Sheets[sheetName]), filterObject);
74
+ });
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
+ */
83
+ static updateExcelData(filePath, sheetName, exportData) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const workbook = yield DocumentUtility.readData(filePath);
86
+ workbook.Sheets[sheetName] = xlsx_1.default.utils.json_to_sheet(exportData);
87
+ xlsx_1.default.writeFile(workbook, filePath);
88
+ });
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
+ */
95
+ static deleteAllFilesUnderDir(dirPath) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ for (const file of yield promises_1.default.readdir(dirPath)) {
98
+ yield promises_1.default.unlink(node_path_1.default.join(dirPath, file));
99
+ }
100
+ });
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
+ */
107
+ static readPdfFile(filePath) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const items = [];
110
+ return new Promise((resolve, reject) => {
111
+ new pdfreader_1.PdfReader().parseFileItems(filePath, (err, item) => {
112
+ if (err)
113
+ reject(err);
114
+ else if (!item)
115
+ resolve(items);
116
+ else if (item.text)
117
+ items.push(item.text);
118
+ });
119
+ });
120
+ });
121
+ }
122
+ }
123
+ exports.DocumentUtility = DocumentUtility;
124
+ //# sourceMappingURL=document_utility.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document_utility.mjs","sourceRoot":"","sources":["../../../src/utils/document_utility.mts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,oDAAuB;AACvB,gEAAkC;AAClC,0DAA6B;AAC7B,yCAAsC;AAEtC,MAAa,eAAe;IAExB;;;;OAIG;IACH,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;;;;;;OAMG;IACH,MAAM,CAAO,sBAAsB,CAAC,QAAgB,EAAE,SAAiB;;YACnE,MAAM,QAAQ,GAAG;gBACb,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,YAAY,CAAC,oEAAoE;aAC5F,CAAA;YACD,MAAM,QAAQ,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AAC,OAAe;;YAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,kBAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC1C,MAAM,kBAAE,CAAC,MAAM,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC;KAAA;IAED;;;;OAIG;IACH,MAAM,CAAO,WAAW,CAAC,QAAgB;;YACrC,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnC,IAAI,qBAAS,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;oBACnD,IAAI,GAAG;wBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;yBAChB,IAAI,CAAC,IAAI;wBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;yBAC1B,IAAI,IAAI,CAAC,IAAI;wBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CAGJ;AA/FD,0CA+FC"}
package/index.ts CHANGED
@@ -3,7 +3,7 @@ import { ApiHelper } from "./src/helpers/api-helpers";
3
3
  import { TokenGenerators } from "./src/utils/api_axios";
4
4
  import { AzureStorageMethods } from "./src/utils/azure_storage_methods";
5
5
  import { Comparisions } from "./src/utils/comparisions";
6
- import { DocumentUtility } from "./src/utils/document_utility";
6
+ import { DocumentUtility } from "./src/utils/document_utility.js";
7
7
  import { KeyVaultMethods } from "./src/utils/keyvault_methods";
8
8
  import { TestData } from "./src/utils/test_data";
9
9
  import { XmlToJson } from "./src/utils/xmlToJson";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vita-playwright",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "email": "noreply_testautomation@vialto.com",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,7 +48,6 @@
48
48
  },
49
49
  "author": "Vialto QE",
50
50
  "license": "ISC",
51
- "type":"module",
52
51
  "description": "common functions for playwright and nodejs",
53
52
  "repository": {
54
53
  "type": "git",
@@ -87,7 +87,8 @@ export class DocumentUtility {
87
87
  * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.pdf.
88
88
  * @returns { Array<string>} - returns array os string, each string represents each line in pdf
89
89
  */
90
- static async readPdfFile(filePath: string) {
90
+ //disabled due to Error [ERR_REQUIRE_ESM]: require() of ES Module, will enable once fix
91
+ /*static async readPdfFile(filePath: string) {
91
92
  const items = [];
92
93
  return new Promise((resolve, reject) => {
93
94
  new PdfReader().parseFileItems(filePath, (err, item) => {
@@ -96,7 +97,7 @@ export class DocumentUtility {
96
97
  else if (item.text) items.push(item.text);
97
98
  });
98
99
  });
99
- }
100
+ }*/
100
101
 
101
102
 
102
103
  }
package/tsconfig.json CHANGED
@@ -101,6 +101,6 @@
101
101
  // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
102
102
  "skipLibCheck": true /* Skip type checking all .d.ts files. */
103
103
  },
104
- "include": ["src/**/*.ts", "index.ts"],
104
+ "include": ["src/**/*.ts", "index.ts", "src/utils/document_utility.ts"],
105
105
  "exclude": ["node_modules"]
106
106
  }