@microsoft/connected-workbooks 3.2.2-beta → 3.3.1-beta

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.
@@ -3,61 +3,68 @@
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  var utils_1 = require("../src/utils");
6
+ var constants_1 = require("../src/utils/constants");
6
7
  var mocks_1 = require("./mocks");
7
- describe("Table Utils tests", function () {
8
- test("tests workbookXML contains initial data dimensions", function () {
9
- var defaultString = '<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15 xr xr6 xr10 xr2" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="24729"/><workbookPr codeName="ThisWorkbook" defaultThemeVersion="166925"/><mc:AlternateContent><mc:Choice Requires="x15"><x15ac:absPath url="C:Usersv-ahmadsbeihDesktop" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/></mc:Choice></mc:AlternateContent><xr:revisionPtr revIDLastSave="0" documentId="13_ncr:1_{93EF201C-7856-4B60-94D4-65DDB8F3F16A}" xr6:coauthVersionLast="47" xr6:coauthVersionMax="47" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}"/><bookViews><workbookView xWindow="28680" yWindow="-120" windowWidth="29040" windowHeight="15990" xr2:uid="{DB915CB9-8DD9-492A-A471-C61E61200113}"/></bookViews><sheets><sheet name="Query1" sheetId="2" r:id="rId1"/><sheet name="Sheet1" sheetId="1" r:id="rId2"/></sheets><definedNames><definedName name="ExternalData_1" localSheetId="0" hidden="1">Sheet1!$A$1:$B$2</definedName></definedNames><calcPr calcId="191029"/><extLst><ext uri="{140A7094-0E35-4892-8432-C4D2E57EDEB5}"><x15:workbookPr chartTrackingRefBase="1"/></ext><ext uri="{B58B0392-4F1F-4190-BB64-5DF3571DCE5F}" xmlns:xcalcf="http://schemas.microsoft.com/office/spreadsheetml/2018/calcfeatures"><xcalcf:calcFeatures><xcalcf:feature name="microsoft.com:RD"/><xcalcf:feature name="microsoft.com:FV"/><xcalcf:feature name="microsoft.com:LET_WF"/><xcalcf:feature name="microsoft.com:LAMBDA_WF"/></xcalcf:calcFeatures></ext></extLst></workbook>';
10
- var worksheetXml = utils_1.tableUtils.updateWorkbookInitialData(defaultString, {
8
+ var globals_1 = require("@jest/globals");
9
+ (0, globals_1.describe)("Table Utils tests", function () {
10
+ (0, globals_1.test)("tests workbookXML contains initial data dimensions", function () {
11
+ var tableData = {
11
12
  columnNames: ["Column1", "Column2"],
12
13
  rows: [["1", "2"]],
13
- });
14
- expect(worksheetXml).toContain(mocks_1.workbookXmlMock);
14
+ };
15
+ var cellRangeRef = constants_1.defaults.sheetName + utils_1.tableUtils.GenerateReferenceFromString("A1:".concat(utils_1.documentUtils.getCellReferenceRelative(tableData.columnNames.length - 1, tableData.rows.length + 1)));
16
+ var defaultString = '<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15 xr xr6 xr10 xr2" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="24729"/><workbookPr codeName="ThisWorkbook" defaultThemeVersion="166925"/><mc:AlternateContent><mc:Choice Requires="x15"><x15ac:absPath url="C:Usersv-ahmadsbeihDesktop" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/></mc:Choice></mc:AlternateContent><xr:revisionPtr revIDLastSave="0" documentId="13_ncr:1_{93EF201C-7856-4B60-94D4-65DDB8F3F16A}" xr6:coauthVersionLast="47" xr6:coauthVersionMax="47" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}"/><bookViews><workbookView xWindow="28680" yWindow="-120" windowWidth="29040" windowHeight="15990" xr2:uid="{DB915CB9-8DD9-492A-A471-C61E61200113}"/></bookViews><sheets><sheet name="Query1" sheetId="2" r:id="rId1"/><sheet name="Sheet1" sheetId="1" r:id="rId2"/></sheets><definedNames><definedName name="ExternalData_1" localSheetId="0" hidden="1">Sheet1!$A$1:$B$2</definedName></definedNames><calcPr calcId="191029"/><extLst><ext uri="{140A7094-0E35-4892-8432-C4D2E57EDEB5}"><x15:workbookPr chartTrackingRefBase="1"/></ext><ext uri="{B58B0392-4F1F-4190-BB64-5DF3571DCE5F}" xmlns:xcalcf="http://schemas.microsoft.com/office/spreadsheetml/2018/calcfeatures"><xcalcf:calcFeatures><xcalcf:feature name="microsoft.com:RD"/><xcalcf:feature name="microsoft.com:FV"/><xcalcf:feature name="microsoft.com:LET_WF"/><xcalcf:feature name="microsoft.com:LAMBDA_WF"/></xcalcf:calcFeatures></ext></extLst></workbook>';
17
+ var worksheetXml = utils_1.tableUtils.updateWorkbookInitialData(defaultString, cellRangeRef);
18
+ (0, globals_1.expect)(worksheetXml).toContain(mocks_1.workbookXmlMock);
15
19
  });
16
- test("tests Pivot Tables contain initial data", function () {
20
+ (0, globals_1.test)("tests Pivot Tables contain initial data", function () {
17
21
  var defaultString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr xr3" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" id="1" xr:uid="{D8539CF6-04E5-464D-9950-5A36C5A1FCFE}" name="Query1" displayName="Query1" ref="A1:A2" tableType="queryTable" totalsRowShown="0"><autoFilter ref="A1:A2" xr:uid="{D8539CF6-04E5-464D-9950-5A36C5A1FCFE}"/><tableColumns count="1"><tableColumn id="1" xr3:uid="{D1084858-8AE5-4728-A9BE-FE78821CDFFF}" uniqueName="1" name="Query1" queryTableFieldId="1" dataDxfId="0"/></tableColumns><tableStyleInfo name="TableStyleMedium7" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"/></table>';
18
- var tableXmlSheet = utils_1.tableUtils.updateTablesInitialData(defaultString, {
22
+ var tableData = {
19
23
  columnNames: ["Column1", "Column2"],
20
24
  rows: [["1", "2"]],
21
- }, true);
22
- expect(tableXmlSheet).toContain('count="2"');
23
- expect(tableXmlSheet).toContain('ref="A1:B2');
24
- expect(tableXmlSheet).toContain('uniqueName="1"');
25
- expect(tableXmlSheet).toContain('name="Column1"');
26
- expect(tableXmlSheet).toContain('queryTableFieldId="1"');
27
- expect(tableXmlSheet).toContain('uniqueName="2"');
28
- expect(tableXmlSheet).toContain('name="Column2"');
29
- expect(tableXmlSheet).toContain('queryTableFieldId="2"');
25
+ };
26
+ var tableXmlSheet = utils_1.tableUtils.updateTablesInitialData(defaultString, tableData, "A1:".concat(utils_1.documentUtils.getCellReferenceRelative(tableData.columnNames.length - 1, tableData.rows.length + 1)), true);
27
+ (0, globals_1.expect)(tableXmlSheet).toContain('count="2"');
28
+ (0, globals_1.expect)(tableXmlSheet).toContain('ref="A1:B2');
29
+ (0, globals_1.expect)(tableXmlSheet).toContain('uniqueName="1"');
30
+ (0, globals_1.expect)(tableXmlSheet).toContain('name="Column1"');
31
+ (0, globals_1.expect)(tableXmlSheet).toContain('queryTableFieldId="1"');
32
+ (0, globals_1.expect)(tableXmlSheet).toContain('uniqueName="2"');
33
+ (0, globals_1.expect)(tableXmlSheet).toContain('name="Column2"');
34
+ (0, globals_1.expect)(tableXmlSheet).toContain('queryTableFieldId="2"');
30
35
  });
31
- test("tests blank Table contain initial data", function () {
32
- var defaultString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr xr3" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" id="1" xr:uid="{D8539CF6-04E5-464D-9950-5A36C5A1FCFE}" name="Query1" displayName="Query1" ref="A1:A2" tableType="queryTable" totalsRowShown="0"><autoFilter ref="A1:A2" xr:uid="{D8539CF6-04E5-464D-9950-5A36C5A1FCFE}"/><tableColumns count="1"><tableColumn id="1" xr3:uid="{D1084858-8AE5-4728-A9BE-FE78821CDFFF}" uniqueName="1" name="Query1" queryTableFieldId="1" dataDxfId="0"/></tableColumns><tableStyleInfo name="TableStyleMedium7" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"/></table>';
33
- var tableXmlSheet = utils_1.tableUtils.updateTablesInitialData(defaultString, {
36
+ (0, globals_1.test)("tests blank Table contain initial data", function () {
37
+ var tableData = {
34
38
  columnNames: ["Column1", "Column2"],
35
39
  rows: [["1", "2"]],
36
- }, false);
37
- expect(tableXmlSheet).toContain('count="2"');
38
- expect(tableXmlSheet).toContain('ref="A1:B2');
39
- expect(tableXmlSheet).toContain('name="Column2"');
40
- expect(tableXmlSheet).toContain('name="Column1"');
41
- // Not contains query table metadata.
42
- expect(tableXmlSheet).not.toContain('uniqueName="1"');
43
- expect(tableXmlSheet).not.toContain('queryTableFieldId="1"');
44
- expect(tableXmlSheet).not.toContain('uniqueName="2"');
45
- expect(tableXmlSheet).not.toContain('queryTableFieldId="2"');
40
+ };
41
+ var defaultString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr xr3" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" id="1" xr:uid="{D8539CF6-04E5-464D-9950-5A36C5A1FCFE}" name="Query1" displayName="Query1" ref="A1:A2" tableType="queryTable" totalsRowShown="0"><autoFilter ref="A1:A2" xr:uid="{D8539CF6-04E5-464D-9950-5A36C5A1FCFE}"/><tableColumns count="1"><tableColumn id="1" xr3:uid="{D1084858-8AE5-4728-A9BE-FE78821CDFFF}" uniqueName="1" name="Query1" queryTableFieldId="1" dataDxfId="0"/></tableColumns><tableStyleInfo name="TableStyleMedium7" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"/></table>';
42
+ var tableXmlSheet = utils_1.tableUtils.updateTablesInitialData(defaultString, tableData, "A1:".concat(utils_1.documentUtils.getCellReferenceRelative(tableData.columnNames.length - 1, tableData.rows.length + 1)), false);
43
+ (0, globals_1.expect)(tableXmlSheet).toContain('count="2"');
44
+ (0, globals_1.expect)(tableXmlSheet).toContain('ref="A1:B2');
45
+ (0, globals_1.expect)(tableXmlSheet).toContain('name="Column2"');
46
+ (0, globals_1.expect)(tableXmlSheet).toContain('name="Column1"');
47
+ //Not contains query table metadata.
48
+ (0, globals_1.expect)(tableXmlSheet).not.toContain('uniqueName="1"');
49
+ (0, globals_1.expect)(tableXmlSheet).not.toContain('queryTableFieldId="1"');
50
+ (0, globals_1.expect)(tableXmlSheet).not.toContain('uniqueName="2"');
51
+ (0, globals_1.expect)(tableXmlSheet).not.toContain('queryTableFieldId="2"');
46
52
  });
47
- test("test valid initial data in SheetsXML", function () {
48
- var defaultString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac xr xr2 xr3" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xr:uid="{EDF0138E-D216-4CD1-8EFA-1396A1BB4478}"><sheetPr codeName="Sheet1"/><dimension ref="A1:B2"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"><selection sqref="A1:B2"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="14.4" x14ac:dyDescent="0.3"/><cols><col min="1" max="1" width="9.6640625" bestFit="1" customWidth="1"/></cols><sheetData><row r="1" spans="1:1" x14ac:dyDescent="0.3"><c r="A1" t="s"><v>0</v></c></row><row r="2" spans="1:1" x14ac:dyDescent="0.3"><c r="A2" t="s"><v>1</v></c></row></sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/><tableParts count="1"><tablePart r:id="rId1"/></tableParts></worksheet>';
49
- var sheetsXmlString = utils_1.tableUtils.updateSheetsInitialData(defaultString, {
53
+ (0, globals_1.test)("test valid initial data in SheetsXML", function () {
54
+ var tableData = {
50
55
  columnNames: ["Column1", "Column2"],
51
56
  rows: [["1", "2"]],
52
- });
53
- expect(sheetsXmlString).toContain(mocks_1.sheetsXmlMock);
57
+ };
58
+ var defaultString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac xr xr2 xr3" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xr:uid="{EDF0138E-D216-4CD1-8EFA-1396A1BB4478}"><sheetPr codeName="Sheet1"/><dimension ref="A1:B2"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"><selection sqref="A1:B2"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="14.4" x14ac:dyDescent="0.3"/><cols><col min="1" max="1" width="9.6640625" bestFit="1" customWidth="1"/></cols><sheetData><row r="1" spans="1:1" x14ac:dyDescent="0.3"><c r="A1" t="s"><v>0</v></c></row><row r="2" spans="1:1" x14ac:dyDescent="0.3"><c r="A2" t="s"><v>1</v></c></row></sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/><tableParts count="1"><tablePart r:id="rId1"/></tableParts></worksheet>';
59
+ var sheetsXmlString = utils_1.tableUtils.updateSheetsInitialData(defaultString, tableData, "A1:".concat(utils_1.documentUtils.getCellReferenceRelative(tableData.columnNames.length - 1, tableData.rows.length + 1)));
60
+ (0, globals_1.expect)(sheetsXmlString).toContain(mocks_1.sheetsXmlMock);
54
61
  });
55
- test("tests Query Tables contain initial data", function () {
62
+ (0, globals_1.test)("tests Query Tables contain initial data", function () {
56
63
  var defaultString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<queryTable xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr16" xmlns:xr16="http://schemas.microsoft.com/office/spreadsheetml/2017/revision16" name="ExternalData_1" connectionId="1" xr16:uid="{24C17B89-3CD3-4AA5-B84F-9FF5F35245D7}" autoFormatId="16" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="0"><queryTableRefresh nextId="2"><queryTableFields count="1"><queryTableField id="1" name="Query1" tableColumnId="1"/></queryTableFields></queryTableRefresh></queryTable>';
57
64
  var queryTableXmlSheet = utils_1.tableUtils.updateQueryTablesInitialData(defaultString, {
58
65
  columnNames: ["Column1", "Column2"],
59
66
  rows: [["1", "2"]],
60
67
  });
61
- expect(queryTableXmlSheet).toContain(mocks_1.queryTableMock);
68
+ (0, globals_1.expect)(queryTableXmlSheet).toContain(mocks_1.queryTableMock);
62
69
  });
63
70
  });
@@ -47,6 +47,8 @@ var mashupDocumentParser_1 = require("../src/utils/mashupDocumentParser");
47
47
  var workbookTemplate_1 = require("../src/workbookTemplate");
48
48
  var mocks_1 = require("./mocks");
49
49
  var jszip_1 = __importDefault(require("jszip"));
50
+ var globals_1 = require("@jest/globals");
51
+ var xmlMocks_1 = require("./mocks/xmlMocks");
50
52
  var getZip = function (template) { return __awaiter(void 0, void 0, void 0, function () {
51
53
  return __generator(this, function (_a) {
52
54
  switch (_a.label) {
@@ -57,14 +59,16 @@ var getZip = function (template) { return __awaiter(void 0, void 0, void 0, func
57
59
  }
58
60
  });
59
61
  }); };
60
- describe("Single query template tests", function () {
62
+ (0, globals_1.describe)("Single query template tests", function () {
61
63
  var singleQueryDefaultTemplate = workbookTemplate_1.SIMPLE_QUERY_WORKBOOK_TEMPLATE;
64
+ var singleQueryTemplateDiffrenName = workbookTemplate_1.QUERY_WORKBOOK_TEMPLATE_DIFFRENT_SHEET_NAME;
62
65
  var defaultZipFile;
63
- beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
66
+ var zipFileWithSheetName;
67
+ (0, globals_1.beforeAll)(function () { return __awaiter(void 0, void 0, void 0, function () {
64
68
  return __generator(this, function (_a) {
65
69
  switch (_a.label) {
66
70
  case 0:
67
- expect(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
71
+ (0, globals_1.expect)(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
68
72
  switch (_a.label) {
69
73
  case 0: return [4 /*yield*/, getZip(singleQueryDefaultTemplate)];
70
74
  case 1: return [2 /*return*/, _a.sent()];
@@ -73,22 +77,37 @@ describe("Single query template tests", function () {
73
77
  return [4 /*yield*/, getZip(singleQueryDefaultTemplate)];
74
78
  case 1:
75
79
  defaultZipFile = _a.sent();
80
+ (0, globals_1.expect)(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
81
+ switch (_a.label) {
82
+ case 0: return [4 /*yield*/, getZip(singleQueryTemplateDiffrenName)];
83
+ case 1: return [2 /*return*/, _a.sent()];
84
+ }
85
+ }); }); }).not.toThrow();
86
+ return [4 /*yield*/, getZip(singleQueryTemplateDiffrenName)];
87
+ case 2:
88
+ zipFileWithSheetName = _a.sent();
76
89
  return [2 /*return*/];
77
90
  }
78
91
  });
79
92
  }); });
80
- test("Default template is a valid zip file", function () { return __awaiter(void 0, void 0, void 0, function () {
93
+ (0, globals_1.test)("Default template is a valid zip file", function () { return __awaiter(void 0, void 0, void 0, function () {
94
+ return __generator(this, function (_a) {
95
+ (0, globals_1.expect)(defaultZipFile).toBeTruthy();
96
+ return [2 /*return*/];
97
+ });
98
+ }); });
99
+ (0, globals_1.test)("Template with different name is a valid zip file", function () { return __awaiter(void 0, void 0, void 0, function () {
81
100
  return __generator(this, function (_a) {
82
- expect(defaultZipFile).toBeTruthy();
101
+ (0, globals_1.expect)(zipFileWithSheetName).toBeTruthy();
83
102
  return [2 /*return*/];
84
103
  });
85
104
  }); });
86
- test("DataMashup XML exists, and valid PQ Base64 can be extracted", function () { return __awaiter(void 0, void 0, void 0, function () {
105
+ (0, globals_1.test)("DataMashup XML exists, and valid PQ Base64 can be extracted", function () { return __awaiter(void 0, void 0, void 0, function () {
87
106
  var _a, found, path, value;
88
107
  return __generator(this, function (_b) {
89
108
  switch (_b.label) {
90
109
  case 0:
91
- expect(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
110
+ (0, globals_1.expect)(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
92
111
  switch (_a.label) {
93
112
  case 0: return [4 /*yield*/, utils_1.pqUtils.getDataMashupFile(defaultZipFile)];
94
113
  case 1: return [2 /*return*/, _a.sent()];
@@ -97,28 +116,28 @@ describe("Single query template tests", function () {
97
116
  return [4 /*yield*/, utils_1.pqUtils.getDataMashupFile(defaultZipFile)];
98
117
  case 1:
99
118
  _a = _b.sent(), found = _a.found, path = _a.path, value = _a.value;
100
- expect(found).toBeTruthy();
101
- expect(value).toEqual(mocks_1.pqEmptySingleQueryBase64);
102
- expect(path).toEqual(mocks_1.item1Path);
119
+ (0, globals_1.expect)(found).toBeTruthy();
120
+ (0, globals_1.expect)(value).toEqual(mocks_1.pqEmptySingleQueryBase64);
121
+ (0, globals_1.expect)(path).toEqual(mocks_1.item1Path);
103
122
  return [2 /*return*/];
104
123
  }
105
124
  });
106
125
  }); });
107
- test("ConnectedWorkbook XML exists as item1.xml", function () { return __awaiter(void 0, void 0, void 0, function () {
126
+ (0, globals_1.test)("ConnectedWorkbook XML exists as item1.xml", function () { return __awaiter(void 0, void 0, void 0, function () {
108
127
  var _a, found, path, xmlString;
109
128
  return __generator(this, function (_b) {
110
129
  switch (_b.label) {
111
130
  case 0: return [4 /*yield*/, utils_1.pqUtils.getCustomXmlFile(defaultZipFile, constants_1.URLS.CONNECTED_WORKBOOK)];
112
131
  case 1:
113
132
  _a = _b.sent(), found = _a.found, path = _a.path, xmlString = _a.xmlString;
114
- expect(found).toBeTruthy();
115
- expect(xmlString).toEqual(mocks_1.connectedWorkbookXmlMock);
116
- expect(path).toEqual(mocks_1.item2Path);
133
+ (0, globals_1.expect)(found).toBeTruthy();
134
+ (0, globals_1.expect)(xmlString).toEqual(mocks_1.connectedWorkbookXmlMock);
135
+ (0, globals_1.expect)(path).toEqual(mocks_1.item2Path);
117
136
  return [2 /*return*/];
118
137
  }
119
138
  });
120
139
  }); });
121
- test("A single blank query named Query1 exists", function () { return __awaiter(void 0, void 0, void 0, function () {
140
+ (0, globals_1.test)("A single blank query named Query1 exists", function () { return __awaiter(void 0, void 0, void 0, function () {
122
141
  var base64Str, packageOPC, packageZip, section1m, hasQuery1;
123
142
  var _a;
124
143
  return __generator(this, function (_b) {
@@ -137,10 +156,63 @@ describe("Single query template tests", function () {
137
156
  throw new Error("section1m is undefined");
138
157
  }
139
158
  hasQuery1 = section1m.includes("Query1");
140
- expect(hasQuery1).toBeTruthy();
141
- expect(section1m).toEqual(mocks_1.section1mBlankQueryMock);
159
+ (0, globals_1.expect)(hasQuery1).toBeTruthy();
160
+ (0, globals_1.expect)(section1m).toEqual(mocks_1.section1mBlankQueryMock);
142
161
  return [2 /*return*/];
143
162
  }
144
163
  });
145
164
  }); });
165
+ (0, globals_1.test)("A update query with specific sheet name", function () { return __awaiter(void 0, void 0, void 0, function () {
166
+ var queryName, sheetName, refreshOnOpen, zipFileWithSheetNameClone, connectionsXmlString;
167
+ var _a;
168
+ return __generator(this, function (_b) {
169
+ switch (_b.label) {
170
+ case 0:
171
+ queryName = constants_1.defaults.queryName;
172
+ sheetName = "SheetNew";
173
+ refreshOnOpen = false;
174
+ zipFileWithSheetNameClone = zipFileWithSheetName.clone();
175
+ (0, globals_1.expect)(utils_1.xmlPartsUtils.updateWorkbookSingleQueryAttributes(zipFileWithSheetNameClone, queryName, refreshOnOpen, sheetName)).resolves.toBeUndefined();
176
+ return [4 /*yield*/, utils_1.xmlPartsUtils.updateWorkbookSingleQueryAttributes(zipFileWithSheetNameClone, queryName, refreshOnOpen, sheetName)];
177
+ case 1:
178
+ _b.sent();
179
+ return [4 /*yield*/, ((_a = zipFileWithSheetNameClone.file(constants_1.connectionsXmlPath)) === null || _a === void 0 ? void 0 : _a.async(constants_1.textResultType))];
180
+ case 2:
181
+ connectionsXmlString = _b.sent();
182
+ (0, globals_1.expect)(connectionsXmlString).toContain(xmlMocks_1.pqConnectionWithrefreshOnLoadDisable);
183
+ return [2 /*return*/];
184
+ }
185
+ });
186
+ }); });
187
+ (0, globals_1.test)("A update query with default sheet name", function () { return __awaiter(void 0, void 0, void 0, function () {
188
+ var queryName, refreshOnOpen, defaultZipFileClone, connectionsXmlString;
189
+ var _a;
190
+ return __generator(this, function (_b) {
191
+ switch (_b.label) {
192
+ case 0:
193
+ queryName = constants_1.defaults.queryName;
194
+ refreshOnOpen = true;
195
+ defaultZipFileClone = defaultZipFile.clone();
196
+ (0, globals_1.expect)(utils_1.xmlPartsUtils.updateWorkbookSingleQueryAttributes(defaultZipFileClone, queryName, refreshOnOpen)).resolves.toBeUndefined();
197
+ return [4 /*yield*/, utils_1.xmlPartsUtils.updateWorkbookSingleQueryAttributes(defaultZipFileClone, queryName, refreshOnOpen)];
198
+ case 1:
199
+ _b.sent();
200
+ return [4 /*yield*/, ((_a = defaultZipFileClone.file(constants_1.connectionsXmlPath)) === null || _a === void 0 ? void 0 : _a.async(constants_1.textResultType))];
201
+ case 2:
202
+ connectionsXmlString = _b.sent();
203
+ (0, globals_1.expect)(connectionsXmlString).toContain(xmlMocks_1.pqConnectionWithrefreshOnLoadEnable);
204
+ return [2 /*return*/];
205
+ }
206
+ });
207
+ }); });
208
+ (0, globals_1.test)("sent sheet name does not exist in template", function () { return __awaiter(void 0, void 0, void 0, function () {
209
+ var queryName, sheetName, refreshOnOpen;
210
+ return __generator(this, function (_a) {
211
+ queryName = constants_1.defaults.queryName;
212
+ sheetName = "SheetElse";
213
+ refreshOnOpen = true;
214
+ (0, globals_1.expect)(utils_1.xmlPartsUtils.updateWorkbookSingleQueryAttributes(zipFileWithSheetName, queryName, refreshOnOpen, sheetName)).rejects.toEqual(new Error("Sheet with name ".concat(sheetName, " not found")));
215
+ return [2 /*return*/];
216
+ });
217
+ }); });
146
218
  });
@@ -45,6 +45,7 @@ var workbookTemplate_1 = require("../src/workbookTemplate");
45
45
  var utils_1 = require("../src/utils");
46
46
  var constants_1 = require("../src/utils/constants");
47
47
  var jszip_1 = __importDefault(require("jszip"));
48
+ var globals_1 = require("@jest/globals");
48
49
  var getZip = function (template) { return __awaiter(void 0, void 0, void 0, function () {
49
50
  return __generator(this, function (_a) {
50
51
  switch (_a.label) {
@@ -55,14 +56,14 @@ var getZip = function (template) { return __awaiter(void 0, void 0, void 0, func
55
56
  }
56
57
  });
57
58
  }); };
58
- describe("Single blank table template tests", function () {
59
+ (0, globals_1.describe)("Single blank table template tests", function () {
59
60
  var simpleTableDefaultTemplate = workbookTemplate_1.SIMPLE_BLANK_TABLE_TEMPLATE;
60
61
  var defaultZipFile;
61
- beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
62
+ (0, globals_1.beforeAll)(function () { return __awaiter(void 0, void 0, void 0, function () {
62
63
  return __generator(this, function (_a) {
63
64
  switch (_a.label) {
64
65
  case 0:
65
- expect(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
66
+ (0, globals_1.expect)(function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
66
67
  switch (_a.label) {
67
68
  case 0: return [4 /*yield*/, getZip(simpleTableDefaultTemplate)];
68
69
  case 1: return [2 /*return*/, _a.sent()];
@@ -75,10 +76,10 @@ describe("Single blank table template tests", function () {
75
76
  }
76
77
  });
77
78
  }); });
78
- test("Default template is a valid zip file", function () {
79
- expect(defaultZipFile).toBeTruthy();
79
+ (0, globals_1.test)("Default template is a valid zip file", function () {
80
+ (0, globals_1.expect)(defaultZipFile).toBeTruthy();
80
81
  });
81
- test("DataMashup XML doesn't exists", function () { return __awaiter(void 0, void 0, void 0, function () {
82
+ (0, globals_1.test)("DataMashup XML doesn't exists", function () { return __awaiter(void 0, void 0, void 0, function () {
82
83
  var error_1;
83
84
  return __generator(this, function (_a) {
84
85
  switch (_a.label) {
@@ -90,13 +91,13 @@ describe("Single blank table template tests", function () {
90
91
  return [3 /*break*/, 3];
91
92
  case 2:
92
93
  error_1 = _a.sent();
93
- expect(error_1).toBeTruthy();
94
+ (0, globals_1.expect)(error_1).toBeTruthy();
94
95
  return [3 /*break*/, 3];
95
96
  case 3: return [2 /*return*/];
96
97
  }
97
98
  });
98
99
  }); });
99
- test("A single blank table exists", function () { return __awaiter(void 0, void 0, void 0, function () {
100
+ (0, globals_1.test)("A single blank table exists", function () { return __awaiter(void 0, void 0, void 0, function () {
100
101
  var tableXml;
101
102
  var _a;
102
103
  return __generator(this, function (_b) {
@@ -104,12 +105,12 @@ describe("Single blank table template tests", function () {
104
105
  case 0: return [4 /*yield*/, ((_a = defaultZipFile.file(constants_1.tableXmlPath)) === null || _a === void 0 ? void 0 : _a.async(constants_1.textResultType))];
105
106
  case 1:
106
107
  tableXml = _b.sent();
107
- expect(tableXml).toContain('name="Table1" displayName="Table1" ref="A1:A2"');
108
+ (0, globals_1.expect)(tableXml).toContain('name="Table1" displayName="Table1" ref="A1:A2"');
108
109
  return [2 /*return*/];
109
110
  }
110
111
  });
111
112
  }); });
112
- test("Does not contains query table", function () { return __awaiter(void 0, void 0, void 0, function () {
113
+ (0, globals_1.test)("Does not contains query table", function () { return __awaiter(void 0, void 0, void 0, function () {
113
114
  var queryTableXml;
114
115
  var _a;
115
116
  return __generator(this, function (_b) {
@@ -117,7 +118,7 @@ describe("Single blank table template tests", function () {
117
118
  case 0: return [4 /*yield*/, ((_a = defaultZipFile.file(constants_1.queryTableXmlPath)) === null || _a === void 0 ? void 0 : _a.async(constants_1.textResultType))];
118
119
  case 1:
119
120
  queryTableXml = _b.sent();
120
- expect(queryTableXml).toBeFalsy();
121
+ (0, globals_1.expect)(queryTableXml).toBeFalsy();
121
122
  return [2 /*return*/];
122
123
  }
123
124
  });
@@ -40,91 +40,92 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  var mocks_1 = require("./mocks");
42
42
  var utils_1 = require("../src/utils");
43
- describe("Workbook Manager tests", function () {
43
+ var globals_1 = require("@jest/globals");
44
+ (0, globals_1.describe)("Workbook Manager tests", function () {
44
45
  var mockConnectionString = "<connections xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\" mc:Ignorable=\"xr16\">\n <connection id=\"1\" xr16:uid=\"{86BA784C-6640-4989-A85E-EB4966B9E741}\" keepAlive=\"1\" name=\"Query - Query1\" description=\"Connection to the 'Query1' query in the workbook.\" type=\"5\" refreshedVersion=\"7\" background=\"1\" saveData=\"1\">\n <dbPr connection=\"Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=Query1;\" command=\"SELECT * FROM [Query1]\"/></connection></connections>";
45
- test("Connection XML attributes contain new query name", function () { return __awaiter(void 0, void 0, void 0, function () {
46
+ (0, globals_1.test)("Connection XML attributes contain new query name", function () { return __awaiter(void 0, void 0, void 0, function () {
46
47
  var connectionXmlFileString;
47
48
  return __generator(this, function (_a) {
48
49
  switch (_a.label) {
49
50
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateConnections(mockConnectionString, "newQueryName", true)];
50
51
  case 1:
51
52
  connectionXmlFileString = (_a.sent()).connectionXmlFileString;
52
- expect(connectionXmlFileString.replace(/ /g, "")).toContain('command="SELECT * FROM [newQueryName]'.replace(/ /g, ""));
53
- expect(connectionXmlFileString.replace(/ /g, "")).toContain('name="Query - newQueryName"'.replace(/ /g, ""));
54
- expect(connectionXmlFileString.replace(/ /g, "")).toContain("description=\"Connection to the 'newQueryName' query in the workbook.\"".replace(/ /g, ""));
53
+ (0, globals_1.expect)(connectionXmlFileString.replace(/ /g, "")).toContain('command="SELECT * FROM [newQueryName]'.replace(/ /g, ""));
54
+ (0, globals_1.expect)(connectionXmlFileString.replace(/ /g, "")).toContain('name="Query - newQueryName"'.replace(/ /g, ""));
55
+ (0, globals_1.expect)(connectionXmlFileString.replace(/ /g, "")).toContain("description=\"Connection to the 'newQueryName' query in the workbook.\"".replace(/ /g, ""));
55
56
  return [2 /*return*/];
56
57
  }
57
58
  });
58
59
  }); });
59
- test("Connection XML attributes contain refreshOnLoad value", function () { return __awaiter(void 0, void 0, void 0, function () {
60
+ (0, globals_1.test)("Connection XML attributes contain refreshOnLoad value", function () { return __awaiter(void 0, void 0, void 0, function () {
60
61
  var connectionXmlFileString;
61
62
  return __generator(this, function (_a) {
62
63
  switch (_a.label) {
63
64
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateConnections(mockConnectionString, "newQueryName", true)];
64
65
  case 1:
65
66
  connectionXmlFileString = (_a.sent()).connectionXmlFileString;
66
- expect(connectionXmlFileString.replace(/ /g, "")).toContain('refreshOnLoad="1"');
67
+ (0, globals_1.expect)(connectionXmlFileString.replace(/ /g, "")).toContain('refreshOnLoad="1"');
67
68
  return [2 /*return*/];
68
69
  }
69
70
  });
70
71
  }); });
71
- test("SharedStrings XML contains new query name", function () { return __awaiter(void 0, void 0, void 0, function () {
72
+ (0, globals_1.test)("SharedStrings XML contains new query name", function () { return __awaiter(void 0, void 0, void 0, function () {
72
73
  var newSharedStrings;
73
74
  return __generator(this, function (_a) {
74
75
  switch (_a.label) {
75
76
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateSharedStrings('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1"><si><t>Query1</t></si><si><t/></si></sst>', "newQueryName")];
76
77
  case 1:
77
78
  newSharedStrings = (_a.sent()).newSharedStrings;
78
- expect(newSharedStrings.replace(/ /g, "")).toContain(mocks_1.sharedStringsXmlMock.replace(/ /g, ""));
79
+ (0, globals_1.expect)(newSharedStrings.replace(/ /g, "")).toContain(mocks_1.sharedStringsXmlMock.replace(/ /g, ""));
79
80
  return [2 /*return*/];
80
81
  }
81
82
  });
82
83
  }); });
83
- test("Tests SharedStrings update when XML contains query name", function () { return __awaiter(void 0, void 0, void 0, function () {
84
+ (0, globals_1.test)("Tests SharedStrings update when XML contains query name", function () { return __awaiter(void 0, void 0, void 0, function () {
84
85
  var newSharedStrings;
85
86
  return __generator(this, function (_a) {
86
87
  switch (_a.label) {
87
88
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateSharedStrings('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1"><si><t>newQueryName</t></si><si><t/></si></sst>', "newQueryName")];
88
89
  case 1:
89
90
  newSharedStrings = (_a.sent()).newSharedStrings;
90
- expect(newSharedStrings.replace(/ /g, "")).toContain(mocks_1.existingSharedStringsXmlMock.replace(/ /g, ""));
91
+ (0, globals_1.expect)(newSharedStrings.replace(/ /g, "")).toContain(mocks_1.existingSharedStringsXmlMock.replace(/ /g, ""));
91
92
  return [2 /*return*/];
92
93
  }
93
94
  });
94
95
  }); });
95
- test("SharedStrings XML returns new index", function () { return __awaiter(void 0, void 0, void 0, function () {
96
+ (0, globals_1.test)("SharedStrings XML returns new index", function () { return __awaiter(void 0, void 0, void 0, function () {
96
97
  var sharedStringIndex;
97
98
  return __generator(this, function (_a) {
98
99
  switch (_a.label) {
99
100
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateSharedStrings('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1"><si><t>Query1</t></si><si><t/></si></sst>', "newQueryName")];
100
101
  case 1:
101
102
  sharedStringIndex = (_a.sent()).sharedStringIndex;
102
- expect(sharedStringIndex).toEqual(2);
103
+ (0, globals_1.expect)(sharedStringIndex).toEqual(2);
103
104
  return [2 /*return*/];
104
105
  }
105
106
  });
106
107
  }); });
107
- test("SharedStrings XML returns existing index", function () { return __awaiter(void 0, void 0, void 0, function () {
108
+ (0, globals_1.test)("SharedStrings XML returns existing index", function () { return __awaiter(void 0, void 0, void 0, function () {
108
109
  var sharedStringIndex;
109
110
  return __generator(this, function (_a) {
110
111
  switch (_a.label) {
111
112
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateSharedStrings('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1"><si><t>newQueryName</t></si><si><t/></si></sst>', "newQueryName")];
112
113
  case 1:
113
114
  sharedStringIndex = (_a.sent()).sharedStringIndex;
114
- expect(sharedStringIndex).toEqual(1);
115
+ (0, globals_1.expect)(sharedStringIndex).toEqual(1);
115
116
  return [2 /*return*/];
116
117
  }
117
118
  });
118
119
  }); });
119
- test("Table XML contains refrshonload value", function () { return __awaiter(void 0, void 0, void 0, function () {
120
+ (0, globals_1.test)("Table XML contains refrshonload value", function () { return __awaiter(void 0, void 0, void 0, function () {
120
121
  var _a, sharedStringIndex, newSharedStrings;
121
122
  return __generator(this, function (_b) {
122
123
  switch (_b.label) {
123
124
  case 0: return [4 /*yield*/, utils_1.xmlInnerPartsUtils.updateSharedStrings('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="1" uniqueCount="1"><si><t>Query1</t></si><si><t/></si></sst>', "newQueryName")];
124
125
  case 1:
125
126
  _a = _b.sent(), sharedStringIndex = _a.sharedStringIndex, newSharedStrings = _a.newSharedStrings;
126
- expect(sharedStringIndex).toEqual(2);
127
- expect(newSharedStrings.replace(/ /g, "")).toContain(mocks_1.sharedStringsXmlMock.replace(/ /g, ""));
127
+ (0, globals_1.expect)(sharedStringIndex).toEqual(2);
128
+ (0, globals_1.expect)(newSharedStrings.replace(/ /g, "")).toContain(mocks_1.sharedStringsXmlMock.replace(/ /g, ""));
128
129
  return [2 /*return*/];
129
130
  }
130
131
  });
package/dist/types.d.ts CHANGED
@@ -32,6 +32,11 @@ export interface FileConfigs {
32
32
  templateFile?: File;
33
33
  docProps?: DocProps;
34
34
  hostName?: string;
35
+ templateSettings?: TemplateSettings;
36
+ }
37
+ export interface TemplateSettings {
38
+ tableName?: string;
39
+ sheetName?: string;
35
40
  }
36
41
  export declare enum DataTypes {
37
42
  null = 0,
@@ -2,8 +2,8 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.maxQueryLength = exports.divider = exports.section1PathPrefix = exports.emptyValue = exports.falseValue = exports.trueValue = exports.pivotCachesPathPrefix = exports.xmlTextResultType = exports.textResultType = exports.application = exports.uint8ArrayType = exports.blobFileType = exports.columnIndexOutOfRangeErr = exports.relsNotFoundErr = exports.arrayIsntMxNErr = exports.unexpectedErr = exports.promotedHeadersCannotBeUsedWithoutAdjustingColumnNamesErr = exports.InvalidColumnNameErr = exports.stylesNotFoundErr = exports.EmptyQueryNameErr = exports.QueryNameInvalidCharsErr = exports.QueryNameMaxLengthErr = exports.invalidDataTypeErr = exports.headerNotFoundErr = exports.invalidValueInColumnErr = exports.tableNotFoundErr = exports.queryTableNotFoundErr = exports.templateWithInitialDataErr = exports.formulaSectionNotFoundErr = exports.queryConnectionNotFoundErr = exports.queryAndPivotTableNotFoundErr = exports.queryNameNotFoundErr = exports.emptyQueryMashupErr = exports.base64NotFoundErr = exports.sheetsNotFoundErr = exports.connectionsNotFoundErr = exports.sharedStringsNotFoundErr = exports.docPropsRootElement = exports.docMetadataXmlPath = exports.relsXmlPath = exports.docPropsCoreXmlPath = exports.section1mPath = exports.pivotCachesPath = exports.queryTablesPath = exports.workbookXmlPath = exports.queryTableXmlPath = exports.tableXmlPath = exports.sheetsXmlPath = exports.sharedStringsXmlPath = exports.connectionsXmlPath = void 0;
6
- exports.OFU = exports.headers = exports.URLS = exports.defaults = exports.elementAttributesValues = exports.dataTypeKind = exports.elementAttributes = exports.element = exports.BOM = exports.falseStr = exports.trueStr = void 0;
5
+ exports.trueValue = exports.pivotCachesPathPrefix = exports.xmlTextResultType = exports.textResultType = exports.application = exports.uint8ArrayType = exports.blobFileType = exports.columnIndexOutOfRangeErr = exports.xlRelsNotFoundErr = exports.relsNotFoundErr = exports.arrayIsntMxNErr = exports.unexpectedErr = exports.promotedHeadersCannotBeUsedWithoutAdjustingColumnNamesErr = exports.InvalidColumnNameErr = exports.stylesNotFoundErr = exports.EmptyQueryNameErr = exports.QueryNameInvalidCharsErr = exports.QueryNameMaxLengthErr = exports.invalidDataTypeErr = exports.headerNotFoundErr = exports.invalidValueInColumnErr = exports.tableReferenceNotFoundErr = exports.tableNotFoundErr = exports.queryTableNotFoundErr = exports.templateWithInitialDataErr = exports.formulaSectionNotFoundErr = exports.queryConnectionNotFoundErr = exports.queryAndPivotTableNotFoundErr = exports.queryNameNotFoundErr = exports.emptyQueryMashupErr = exports.base64NotFoundErr = exports.sheetsNotFoundErr = exports.WorkbookNotFoundERR = exports.connectionsNotFoundErr = exports.sharedStringsNotFoundErr = exports.workbookRelsXmlPath = exports.docPropsRootElement = exports.docMetadataXmlPath = exports.relsXmlPath = exports.docPropsCoreXmlPath = exports.section1mPath = exports.pivotCachesPath = exports.tablesFolderPath = exports.queryTablesPath = exports.workbookXmlPath = exports.queryTableXmlPath = exports.tableXmlPath = exports.sheetsXmlPath = exports.sharedStringsXmlPath = exports.connectionsXmlPath = void 0;
6
+ exports.OFU = exports.headers = exports.URLS = exports.defaults = exports.elementAttributesValues = exports.dataTypeKind = exports.elementAttributes = exports.element = exports.BOM = exports.falseStr = exports.trueStr = exports.maxQueryLength = exports.divider = exports.section1PathPrefix = exports.emptyValue = exports.falseValue = void 0;
7
7
  exports.connectionsXmlPath = "xl/connections.xml";
8
8
  exports.sharedStringsXmlPath = "xl/sharedStrings.xml";
9
9
  exports.sheetsXmlPath = "xl/worksheets/sheet1.xml";
@@ -11,14 +11,17 @@ exports.tableXmlPath = "xl/tables/table1.xml";
11
11
  exports.queryTableXmlPath = "xl/queryTables/queryTable1.xml";
12
12
  exports.workbookXmlPath = "xl/workbook.xml";
13
13
  exports.queryTablesPath = "xl/queryTables/";
14
+ exports.tablesFolderPath = "xl/tables/";
14
15
  exports.pivotCachesPath = "xl/pivotCache/";
15
16
  exports.section1mPath = "Formulas/Section1.m";
16
17
  exports.docPropsCoreXmlPath = "docProps/core.xml";
17
18
  exports.relsXmlPath = "_rels/.rels";
18
19
  exports.docMetadataXmlPath = "docMetadata";
19
20
  exports.docPropsRootElement = "cp:coreProperties";
21
+ exports.workbookRelsXmlPath = "xl/_rels/workbook.xml.rels";
20
22
  exports.sharedStringsNotFoundErr = "SharedStrings were not found in template";
21
23
  exports.connectionsNotFoundErr = "Connections were not found in template";
24
+ exports.WorkbookNotFoundERR = "workbook was not found in template";
22
25
  exports.sheetsNotFoundErr = "Sheets were not found in template";
23
26
  exports.base64NotFoundErr = "Base64 was not found in template";
24
27
  exports.emptyQueryMashupErr = "Query mashup is empty";
@@ -29,6 +32,7 @@ exports.formulaSectionNotFoundErr = "Formula section wasn't found in template";
29
32
  exports.templateWithInitialDataErr = "Cannot use a template file with initial data";
30
33
  exports.queryTableNotFoundErr = "Query table wasn't found in template";
31
34
  exports.tableNotFoundErr = "Table wasn't found in template";
35
+ exports.tableReferenceNotFoundErr = "Reference not found in the table XML.";
32
36
  exports.invalidValueInColumnErr = "Invalid cell value in column";
33
37
  exports.headerNotFoundErr = "Invalid JSON file, header is missing";
34
38
  exports.invalidDataTypeErr = "Invalid JSON file, invalid data type";
@@ -41,6 +45,7 @@ exports.promotedHeadersCannotBeUsedWithoutAdjustingColumnNamesErr = "Headers can
41
45
  exports.unexpectedErr = "Unexpected error";
42
46
  exports.arrayIsntMxNErr = "Array isn't MxN";
43
47
  exports.relsNotFoundErr = ".rels were not found in template";
48
+ exports.xlRelsNotFoundErr = "workbook.xml.rels were not found xl";
44
49
  exports.columnIndexOutOfRangeErr = "Column index out of range";
45
50
  exports.blobFileType = "blob";
46
51
  exports.uint8ArrayType = "uint8array";
@@ -85,6 +90,7 @@ exports.element = {
85
90
  dimension: "dimension",
86
91
  selection: "selection",
87
92
  kindCell: "c",
93
+ sheet: "sheet",
88
94
  };
89
95
  exports.elementAttributes = {
90
96
  connection: "connection",
@@ -98,6 +104,7 @@ exports.elementAttributes = {
98
104
  name: "name",
99
105
  description: "description",
100
106
  id: "id",
107
+ relationId: "r:id",
101
108
  type: "Type",
102
109
  value: "Value",
103
110
  relationshipInfo: "RelationshipInfoContainer",
@@ -117,6 +124,7 @@ exports.elementAttributes = {
117
124
  x14acDyDescent: "x14ac:dyDescent",
118
125
  xr3uid: "xr3:uid",
119
126
  space: "xml:space",
127
+ target: "Target",
120
128
  };
121
129
  exports.dataTypeKind = {
122
130
  string: "str",
@@ -134,6 +142,7 @@ exports.defaults = {
134
142
  queryName: "Query1",
135
143
  sheetName: "Sheet1",
136
144
  columnName: "Column",
145
+ tableName: "Table1",
137
146
  };
138
147
  exports.URLS = {
139
148
  PQ: [