microsoft-graph 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +2 -1
- package/dist/operations/drive/createFolder.d.ts +8 -1
- package/dist/operations/drive/createFolder.d.ts.map +1 -1
- package/dist/operations/drive/createFolder.js +8 -1
- package/dist/operations/drive/listDrives.d.ts +7 -1
- package/dist/operations/drive/listDrives.d.ts.map +1 -1
- package/dist/operations/drive/listDrives.js +7 -1
- package/dist/operations/driveItem/deleteDriveItem.d.ts +7 -1
- package/dist/operations/driveItem/deleteDriveItem.d.ts.map +1 -1
- package/dist/operations/driveItem/deleteDriveItem.js +7 -1
- package/dist/operations/driveItem/getDriveItem.d.ts +7 -1
- package/dist/operations/driveItem/getDriveItem.d.ts.map +1 -1
- package/dist/operations/driveItem/getDriveItem.js +7 -1
- package/dist/operations/driveItem/getDriveItemByPath.d.ts +8 -1
- package/dist/operations/driveItem/getDriveItemByPath.d.ts.map +1 -1
- package/dist/operations/driveItem/getDriveItemByPath.js +8 -1
- package/dist/operations/driveItem/getDriveItemContent.d.ts +8 -1
- package/dist/operations/driveItem/getDriveItemContent.d.ts.map +1 -1
- package/dist/operations/driveItem/getDriveItemContent.js +8 -1
- package/dist/operations/driveItem/initiateCopyDriveItem.d.ts +9 -1
- package/dist/operations/driveItem/initiateCopyDriveItem.d.ts.map +1 -1
- package/dist/operations/driveItem/initiateCopyDriveItem.js +9 -1
- package/dist/operations/driveItem/listDriveItems.d.ts +8 -2
- package/dist/operations/driveItem/listDriveItems.d.ts.map +1 -1
- package/dist/operations/driveItem/listDriveItems.js +8 -3
- package/dist/operations/site/getSite.d.ts +7 -1
- package/dist/operations/site/getSite.d.ts.map +1 -1
- package/dist/operations/site/getSite.js +7 -1
- package/dist/operations/site/getSiteByName.d.ts +9 -1
- package/dist/operations/site/getSiteByName.d.ts.map +1 -1
- package/dist/operations/site/getSiteByName.js +9 -1
- package/dist/operations/site/listSites.d.ts +7 -1
- package/dist/operations/site/listSites.d.ts.map +1 -1
- package/dist/operations/site/listSites.js +7 -1
- package/dist/operations/site/searchSites.d.ts +8 -1
- package/dist/operations/site/searchSites.d.ts.map +1 -1
- package/dist/operations/site/searchSites.js +8 -1
- package/dist/operations/user/userSendMail.d.ts +10 -1
- package/dist/operations/user/userSendMail.d.ts.map +1 -1
- package/dist/operations/user/userSendMail.js +10 -1
- package/dist/operations/workbook/calculateWorkbook.d.ts +14 -2
- package/dist/operations/workbook/calculateWorkbook.d.ts.map +1 -1
- package/dist/operations/workbook/calculateWorkbook.js +14 -2
- package/dist/operations/workbook/createWorkbook.d.ts +9 -1
- package/dist/operations/workbook/createWorkbook.d.ts.map +1 -1
- package/dist/operations/workbook/createWorkbook.js +9 -1
- package/dist/operations/workbook/deleteWorkbook.d.ts +7 -1
- package/dist/operations/workbook/deleteWorkbook.d.ts.map +1 -1
- package/dist/operations/workbook/deleteWorkbook.js +7 -1
- package/dist/operations/workbookRange/clearWorkbookRange.d.ts +8 -1
- package/dist/operations/workbookRange/clearWorkbookRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/clearWorkbookRange.js +8 -1
- package/dist/operations/workbookRange/deleteWorkbookRange.d.ts +8 -1
- package/dist/operations/workbookRange/deleteWorkbookRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/deleteWorkbookRange.js +8 -1
- package/dist/operations/workbookRange/getWorkbookNamedRange.d.ts +7 -1
- package/dist/operations/workbookRange/getWorkbookNamedRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/getWorkbookNamedRange.js +7 -1
- package/dist/operations/workbookRange/getWorkbookRangeFormat.d.ts +7 -1
- package/dist/operations/workbookRange/getWorkbookRangeFormat.d.ts.map +1 -1
- package/dist/operations/workbookRange/getWorkbookRangeFormat.js +7 -1
- package/dist/operations/workbookRange/getWorkbookUsedRange.d.ts +7 -1
- package/dist/operations/workbookRange/getWorkbookUsedRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/getWorkbookUsedRange.js +7 -1
- package/dist/operations/workbookRange/getWorkbookVisibleRange.d.ts +7 -1
- package/dist/operations/workbookRange/getWorkbookVisibleRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/getWorkbookVisibleRange.js +7 -1
- package/dist/operations/workbookRange/getWorkbookWorksheetRange.d.ts +7 -1
- package/dist/operations/workbookRange/getWorkbookWorksheetRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/getWorkbookWorksheetRange.js +7 -1
- package/dist/operations/workbookRange/insertWorkbookCells.d.ts +9 -1
- package/dist/operations/workbookRange/insertWorkbookCells.d.ts.map +1 -1
- package/dist/operations/workbookRange/insertWorkbookCells.js +9 -1
- package/dist/operations/workbookRange/updateWorkbookNamedRange.d.ts +8 -1
- package/dist/operations/workbookRange/updateWorkbookNamedRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/updateWorkbookNamedRange.js +8 -1
- package/dist/operations/workbookRange/updateWorkbookRange.d.ts +8 -1
- package/dist/operations/workbookRange/updateWorkbookRange.d.ts.map +1 -1
- package/dist/operations/workbookRange/updateWorkbookRange.js +8 -1
- package/dist/operations/workbookSession/closeWorkbookSession.d.ts +8 -1
- package/dist/operations/workbookSession/closeWorkbookSession.d.ts.map +1 -1
- package/dist/operations/workbookSession/closeWorkbookSession.js +8 -1
- package/dist/operations/workbookSession/createWorkbookSession.d.ts +9 -1
- package/dist/operations/workbookSession/createWorkbookSession.d.ts.map +1 -1
- package/dist/operations/workbookSession/createWorkbookSession.js +9 -1
- package/dist/operations/workbookSession/refreshWorkbookSession.d.ts +8 -1
- package/dist/operations/workbookSession/refreshWorkbookSession.d.ts.map +1 -1
- package/dist/operations/workbookSession/refreshWorkbookSession.js +8 -1
- package/dist/operations/workbookTable/createWorkbookTable.d.ts +8 -1
- package/dist/operations/workbookTable/createWorkbookTable.d.ts.map +1 -1
- package/dist/operations/workbookTable/createWorkbookTable.js +8 -1
- package/dist/operations/workbookTable/getWorkbookTable.d.ts +7 -1
- package/dist/operations/workbookTable/getWorkbookTable.d.ts.map +1 -1
- package/dist/operations/workbookTable/getWorkbookTable.js +7 -1
- package/dist/operations/workbookTable/getWorkbookTableBodyRange.d.ts +7 -1
- package/dist/operations/workbookTable/getWorkbookTableBodyRange.d.ts.map +1 -1
- package/dist/operations/workbookTable/getWorkbookTableBodyRange.js +7 -1
- package/dist/operations/workbookTable/getWorkbookTableHeaderRange.d.ts +7 -1
- package/dist/operations/workbookTable/getWorkbookTableHeaderRange.d.ts.map +1 -1
- package/dist/operations/workbookTable/getWorkbookTableHeaderRange.js +7 -1
- package/dist/operations/workbookTable/listWorkbookTableColumns.d.ts +7 -1
- package/dist/operations/workbookTable/listWorkbookTableColumns.d.ts.map +1 -1
- package/dist/operations/workbookTable/listWorkbookTableColumns.js +7 -1
- package/dist/operations/workbookTable/listWorkbookTableRows.d.ts +7 -1
- package/dist/operations/workbookTable/listWorkbookTableRows.d.ts.map +1 -1
- package/dist/operations/workbookTable/listWorkbookTableRows.js +7 -1
- package/dist/operations/workbookTable/listWorkbookTables.d.ts +7 -1
- package/dist/operations/workbookTable/listWorkbookTables.d.ts.map +1 -1
- package/dist/operations/workbookTable/listWorkbookTables.js +7 -1
- package/dist/operations/workbookWorksheet/createWorkbookWorksheet.d.ts +8 -1
- package/dist/operations/workbookWorksheet/createWorkbookWorksheet.d.ts.map +1 -1
- package/dist/operations/workbookWorksheet/createWorkbookWorksheet.js +8 -1
- package/dist/operations/workbookWorksheet/deleteWorkbookWorksheet.d.ts +7 -1
- package/dist/operations/workbookWorksheet/deleteWorkbookWorksheet.d.ts.map +1 -1
- package/dist/operations/workbookWorksheet/deleteWorkbookWorksheet.js +7 -1
- package/dist/operations/workbookWorksheet/listWorkbookWorksheets.d.ts +7 -1
- package/dist/operations/workbookWorksheet/listWorkbookWorksheets.d.ts.map +1 -1
- package/dist/operations/workbookWorksheet/listWorkbookWorksheets.js +7 -1
- package/dist/operations/workbookWorksheet/updateWorkbookWorksheet.d.ts +11 -1
- package/dist/operations/workbookWorksheet/updateWorkbookWorksheet.d.ts.map +1 -1
- package/dist/operations/workbookWorksheet/updateWorkbookWorksheet.js +11 -1
- package/dist/services/accessToken.d.ts +9 -1
- package/dist/services/accessToken.d.ts.map +1 -1
- package/dist/services/accessToken.js +9 -1
- package/dist/services/addressManipulation.d.ts +67 -0
- package/dist/services/addressManipulation.d.ts.map +1 -1
- package/dist/services/addressManipulation.js +67 -0
- package/dist/services/addressOffset.d.ts +20 -0
- package/dist/services/addressOffset.d.ts.map +1 -1
- package/dist/services/addressOffset.js +20 -0
- package/dist/services/context.d.ts +19 -2
- package/dist/services/context.d.ts.map +1 -1
- package/dist/services/context.js +19 -2
- package/dist/services/drive.d.ts +12 -1
- package/dist/services/drive.d.ts.map +1 -1
- package/dist/services/drive.js +12 -1
- package/dist/services/driveItem.d.ts +13 -1
- package/dist/services/driveItem.d.ts.map +1 -1
- package/dist/services/driveItem.js +13 -1
- package/dist/services/environmentVariable.d.ts +13 -0
- package/dist/services/environmentVariable.d.ts.map +1 -1
- package/dist/services/environmentVariable.js +13 -0
- package/dist/services/httpAgent.d.ts +5 -0
- package/dist/services/httpAgent.d.ts.map +1 -1
- package/dist/services/httpAgent.js +5 -0
- package/dist/services/httpStatus.d.ts +15 -0
- package/dist/services/httpStatus.d.ts.map +1 -1
- package/dist/services/httpStatus.js +15 -0
- package/dist/services/operationId.d.ts +10 -0
- package/dist/services/operationId.d.ts.map +1 -1
- package/dist/services/operationId.js +10 -0
- package/dist/services/random.d.ts +5 -0
- package/dist/services/random.d.ts.map +1 -1
- package/dist/services/random.js +5 -0
- package/dist/services/sharepointUrl.d.ts +6 -1
- package/dist/services/sharepointUrl.d.ts.map +1 -1
- package/dist/services/sharepointUrl.js +6 -1
- package/dist/services/site.d.ts +12 -1
- package/dist/services/site.d.ts.map +1 -1
- package/dist/services/site.js +12 -1
- package/dist/services/sleep.d.ts +5 -0
- package/dist/services/sleep.d.ts.map +1 -1
- package/dist/services/sleep.js +5 -0
- package/dist/services/stringCaseConversion.d.ts +5 -0
- package/dist/services/stringCaseConversion.d.ts.map +1 -1
- package/dist/services/stringCaseConversion.js +5 -0
- package/dist/services/templatedPaths.d.ts +7 -1
- package/dist/services/templatedPaths.d.ts.map +1 -1
- package/dist/services/templatedPaths.js +7 -1
- package/dist/services/temporaryFiles.d.ts +5 -0
- package/dist/services/temporaryFiles.d.ts.map +1 -1
- package/dist/services/temporaryFiles.js +5 -0
- package/dist/services/workbookRange.d.ts +6 -0
- package/dist/services/workbookRange.d.ts.map +1 -1
- package/dist/services/workbookRange.js +6 -0
- package/dist/services/workbookTable.d.ts +7 -0
- package/dist/services/workbookTable.d.ts.map +1 -1
- package/dist/services/workbookTable.js +7 -0
- package/dist/services/workbookWorksheet.d.ts +12 -0
- package/dist/services/workbookWorksheet.d.ts.map +1 -1
- package/dist/services/workbookWorksheet.js +12 -0
- package/dist/tasks/createWorkbookAndStartSession.d.ts +7 -1
- package/dist/tasks/createWorkbookAndStartSession.d.ts.map +1 -1
- package/dist/tasks/createWorkbookAndStartSession.js +7 -1
- package/dist/tasks/deleteDriveItemWithRetry.d.ts +6 -1
- package/dist/tasks/deleteDriveItemWithRetry.d.ts.map +1 -1
- package/dist/tasks/deleteDriveItemWithRetry.js +6 -1
- package/dist/tasks/downloadDriveItemContent.d.ts +7 -1
- package/dist/tasks/downloadDriveItemContent.d.ts.map +1 -1
- package/dist/tasks/downloadDriveItemContent.js +7 -1
- package/dist/tasks/getRangeLastUsedCell.d.ts +7 -1
- package/dist/tasks/getRangeLastUsedCell.d.ts.map +1 -1
- package/dist/tasks/getRangeLastUsedCell.js +7 -1
- package/dist/tasks/getWorkbookTableVisibleBody.d.ts +6 -1
- package/dist/tasks/getWorkbookTableVisibleBody.d.ts.map +1 -1
- package/dist/tasks/getWorkbookTableVisibleBody.js +6 -1
- package/dist/tasks/getWorkbookWorksheetByName.d.ts +8 -1
- package/dist/tasks/getWorkbookWorksheetByName.d.ts.map +1 -1
- package/dist/tasks/getWorkbookWorksheetByName.js +8 -1
- package/dist/tasks/safeDeleteWorkbook.d.ts +7 -1
- package/dist/tasks/safeDeleteWorkbook.d.ts.map +1 -1
- package/dist/tasks/safeDeleteWorkbook.js +7 -1
- package/dist/tasks/setColumnHidden.d.ts +7 -1
- package/dist/tasks/setColumnHidden.d.ts.map +1 -1
- package/dist/tasks/setColumnHidden.js +7 -1
- package/dist/tasks/setRowHidden.d.ts +7 -1
- package/dist/tasks/setRowHidden.d.ts.map +1 -1
- package/dist/tasks/setRowHidden.js +7 -1
- package/dist/tasks/setWorkbookTableBodyVisibleRows.d.ts +9 -1
- package/dist/tasks/setWorkbookTableBodyVisibleRows.d.ts.map +1 -1
- package/dist/tasks/setWorkbookTableBodyVisibleRows.js +23 -16
- package/dist/tasks/setWorkbookTableBodyVisibleRows.test.js +2 -0
- package/package.json +1 -1
|
@@ -6,6 +6,12 @@ const lastColumn = "XFD";
|
|
|
6
6
|
const firstRow = "1";
|
|
7
7
|
const lastRow = "1048576";
|
|
8
8
|
const addressPattern = /^(?<sheet>[A-Za-z0-9_]+!)?(?:(?<startColumn>[A-Z]+)?(?<startRow>\d+)?(?::(?<endColumn>[A-Z]+)?(?<endRow>\d+)?)?)$/;
|
|
9
|
+
/**
|
|
10
|
+
* Decomposes an address into its components (start and end columns/rows).
|
|
11
|
+
* @param address - The address to decompose.
|
|
12
|
+
* @returns The decomposed address components.
|
|
13
|
+
* @throws InvalidArgumentError if the address format is invalid.
|
|
14
|
+
*/
|
|
9
15
|
export function decomposeAddress(address) {
|
|
10
16
|
const match = address.match(addressPattern);
|
|
11
17
|
if (!match?.groups) {
|
|
@@ -19,6 +25,12 @@ export function decomposeAddress(address) {
|
|
|
19
25
|
endRow: groups.endRow ?? groups.startRow ?? lastRow,
|
|
20
26
|
};
|
|
21
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Composes an address from its components.
|
|
30
|
+
* @param components - The address components.
|
|
31
|
+
* @returns The composed address.
|
|
32
|
+
* @throws InvalidArgumentError if the components are invalid.
|
|
33
|
+
*/
|
|
22
34
|
export function composeAddress(components) {
|
|
23
35
|
if (isSingleColumn(components) && isMaxRows(components)) {
|
|
24
36
|
return composeColumnAddress(components.startColumn);
|
|
@@ -43,14 +55,29 @@ export function composeAddress(components) {
|
|
|
43
55
|
}
|
|
44
56
|
return composeCellRangeAddress(components.startColumn, components.startRow, components.endColumn, components.endRow);
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the first cell address from a given address.
|
|
60
|
+
* @param address - The address to analyze.
|
|
61
|
+
* @returns The first cell address.
|
|
62
|
+
*/
|
|
46
63
|
export function getFirstCellAddress(address) {
|
|
47
64
|
const components = decomposeAddress(address);
|
|
48
65
|
return composeCellAddress(components.startColumn, components.startRow);
|
|
49
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the last cell address from a given address.
|
|
69
|
+
* @param address - The address to analyze.
|
|
70
|
+
* @returns The last cell address.
|
|
71
|
+
*/
|
|
50
72
|
export function getLastCellAddress(address) {
|
|
51
73
|
const components = decomposeAddress(address);
|
|
52
74
|
return composeCellAddress(components.endColumn, components.endRow);
|
|
53
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Gets the first row address from a given address.
|
|
78
|
+
* @param address - The address to analyze.
|
|
79
|
+
* @returns The first row address.
|
|
80
|
+
*/
|
|
54
81
|
export function getFirstRowAddress(address) {
|
|
55
82
|
const components = decomposeAddress(address);
|
|
56
83
|
return composeAddress({
|
|
@@ -60,6 +87,11 @@ export function getFirstRowAddress(address) {
|
|
|
60
87
|
endRow: components.startRow,
|
|
61
88
|
});
|
|
62
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Gets the last row address from a given address.
|
|
92
|
+
* @param address - The address to analyze.
|
|
93
|
+
* @returns The last row address.
|
|
94
|
+
*/
|
|
63
95
|
export function getLastRowAddress(address) {
|
|
64
96
|
const components = decomposeAddress(address);
|
|
65
97
|
return composeAddress({
|
|
@@ -69,6 +101,11 @@ export function getLastRowAddress(address) {
|
|
|
69
101
|
endRow: components.endRow,
|
|
70
102
|
});
|
|
71
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets the first column address from a given address.
|
|
106
|
+
* @param address - The address to analyze.
|
|
107
|
+
* @returns The first column address.
|
|
108
|
+
*/
|
|
72
109
|
export function getFirstColumnAddress(address) {
|
|
73
110
|
const components = decomposeAddress(address);
|
|
74
111
|
return composeAddress({
|
|
@@ -78,6 +115,11 @@ export function getFirstColumnAddress(address) {
|
|
|
78
115
|
endRow: components.endRow,
|
|
79
116
|
});
|
|
80
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Gets the last column address from a given address.
|
|
120
|
+
* @param address - The address to analyze.
|
|
121
|
+
* @returns The last column address.
|
|
122
|
+
*/
|
|
81
123
|
export function getLastColumnAddress(address) {
|
|
82
124
|
const components = decomposeAddress(address);
|
|
83
125
|
return composeAddress({
|
|
@@ -87,6 +129,15 @@ export function getLastColumnAddress(address) {
|
|
|
87
129
|
endRow: components.endRow,
|
|
88
130
|
});
|
|
89
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Offsets an address by the specified column and row offsets.
|
|
134
|
+
* @param address - The address to offset.
|
|
135
|
+
* @param columnOffset - The column offset.
|
|
136
|
+
* @param rowOffset - The row offset.
|
|
137
|
+
* @returns The offset address.
|
|
138
|
+
* @throws UnsupportedAddressTypeError if the address cannot be offset.
|
|
139
|
+
* @throws InvalidArgumentError if the offset is out of bounds.
|
|
140
|
+
*/
|
|
90
141
|
export function offsetAddress(address, columnOffset, rowOffset) {
|
|
91
142
|
const components = decomposeAddress(address);
|
|
92
143
|
if (isMaxRows(components) && rowOffset !== 0) {
|
|
@@ -116,12 +167,28 @@ export function offsetAddress(address, columnOffset, rowOffset) {
|
|
|
116
167
|
endRow: newEndRow,
|
|
117
168
|
});
|
|
118
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Increments the row address by one.
|
|
172
|
+
* @param address - The address to increment.
|
|
173
|
+
* @returns The incremented address.
|
|
174
|
+
*/
|
|
119
175
|
export function incrementRowAddress(address) {
|
|
120
176
|
return offsetAddress(address, 0, +1);
|
|
121
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Decrements the row address by one.
|
|
180
|
+
* @param address - The address to decrement.
|
|
181
|
+
* @returns The decremented address.
|
|
182
|
+
*/
|
|
122
183
|
export function decrementRowAddress(address) {
|
|
123
184
|
return offsetAddress(address, 0, -1);
|
|
124
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Checks if two addresses overlap.
|
|
188
|
+
* @param address1 - The first address.
|
|
189
|
+
* @param address2 - The second address.
|
|
190
|
+
* @returns True if the addresses overlap, otherwise false.
|
|
191
|
+
*/
|
|
125
192
|
export function isAddressOverlapping(address1, address2) {
|
|
126
193
|
const components1 = decomposeAddress(address1);
|
|
127
194
|
const components2 = decomposeAddress(address2);
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import type { ColumnAddress, RowAddress } from "../models/Address.ts";
|
|
2
2
|
import type { ColumnOffset } from "../models/ColumnOffset.ts";
|
|
3
3
|
import type { RowOffset } from "../models/RowOffset.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Converts a column address (e.g., "A") to a zero-based column offset.
|
|
6
|
+
* @param column - The column address.
|
|
7
|
+
* @returns The zero-based column offset.
|
|
8
|
+
*/
|
|
4
9
|
export declare function columnAddressToOffset(column: ColumnAddress): ColumnOffset;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a zero-based column offset to a column address (e.g., "A").
|
|
12
|
+
* @param offset - The zero-based column offset.
|
|
13
|
+
* @returns The column address.
|
|
14
|
+
*/
|
|
5
15
|
export declare function offsetToColumnAddress(offset: ColumnOffset): ColumnAddress;
|
|
16
|
+
/**
|
|
17
|
+
* Converts a row address (e.g., "1") to a zero-based row offset.
|
|
18
|
+
* @param row - The row address.
|
|
19
|
+
* @returns The zero-based row offset.
|
|
20
|
+
*/
|
|
6
21
|
export declare function rowAddressToOffset(row: RowAddress): RowOffset;
|
|
22
|
+
/**
|
|
23
|
+
* Converts a zero-based row offset to a row address (e.g., "1").
|
|
24
|
+
* @param offset - The zero-based row offset.
|
|
25
|
+
* @returns The row address.
|
|
26
|
+
*/
|
|
7
27
|
export declare function offsetToRowAddress(offset: RowOffset): RowAddress;
|
|
8
28
|
//# sourceMappingURL=addressOffset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addressOffset.d.ts","sourceRoot":"","sources":["../../src/services/addressOffset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAMzE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CASzE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAE7D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE"}
|
|
1
|
+
{"version":3,"file":"addressOffset.d.ts","sourceRoot":"","sources":["../../src/services/addressOffset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CASzE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a column address (e.g., "A") to a zero-based column offset.
|
|
3
|
+
* @param column - The column address.
|
|
4
|
+
* @returns The zero-based column offset.
|
|
5
|
+
*/
|
|
1
6
|
export function columnAddressToOffset(column) {
|
|
2
7
|
let offset = 0;
|
|
3
8
|
for (let i = 0; i < column.length; i++) {
|
|
@@ -5,6 +10,11 @@ export function columnAddressToOffset(column) {
|
|
|
5
10
|
}
|
|
6
11
|
return (offset - 1);
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Converts a zero-based column offset to a column address (e.g., "A").
|
|
15
|
+
* @param offset - The zero-based column offset.
|
|
16
|
+
* @returns The column address.
|
|
17
|
+
*/
|
|
8
18
|
export function offsetToColumnAddress(offset) {
|
|
9
19
|
let result = "";
|
|
10
20
|
let currentOffset = offset + 1;
|
|
@@ -15,9 +25,19 @@ export function offsetToColumnAddress(offset) {
|
|
|
15
25
|
}
|
|
16
26
|
return result;
|
|
17
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Converts a row address (e.g., "1") to a zero-based row offset.
|
|
30
|
+
* @param row - The row address.
|
|
31
|
+
* @returns The zero-based row offset.
|
|
32
|
+
*/
|
|
18
33
|
export function rowAddressToOffset(row) {
|
|
19
34
|
return (Number.parseInt(row, 10) - 1);
|
|
20
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Converts a zero-based row offset to a row address (e.g., "1").
|
|
38
|
+
* @param offset - The zero-based row offset.
|
|
39
|
+
* @returns The row address.
|
|
40
|
+
*/
|
|
21
41
|
export function offsetToRowAddress(offset) {
|
|
22
42
|
return (offset + 1).toString();
|
|
23
43
|
}
|
|
@@ -5,9 +5,26 @@ import type { ContextId } from "../models/ContextId.ts";
|
|
|
5
5
|
import type { ContextRef } from "../models/ContextRef.ts";
|
|
6
6
|
import type { HttpProxy } from "../models/HttpProxy.ts";
|
|
7
7
|
import type { TenantId } from "../models/TenantId.ts";
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Registers a tenant+client so that its secret can be used later.
|
|
10
|
+
* @param tenantId - The tenant ID.
|
|
11
|
+
* @param clientId - The client ID.
|
|
12
|
+
* @param clientSecret - The client secret.
|
|
13
|
+
* @param httpProxy - Optional HTTP proxy configuration.
|
|
14
|
+
* @returns A reference to the registered context.
|
|
15
|
+
*/
|
|
9
16
|
export declare function register(tenantId: TenantId, clientId: ClientId, clientSecret: ClientSecret, httpProxy?: HttpProxy | undefined): ContextRef;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the context for a given context ID.
|
|
19
|
+
* @param contextId - The ID of the context.
|
|
20
|
+
* @returns The context associated with the given ID.
|
|
21
|
+
* @throws ContextNotRegisteredError if the context ID is not registered.
|
|
22
|
+
*/
|
|
10
23
|
export declare function getContext(contextId: ContextId): Context;
|
|
11
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves the opinionated default context reference. NOT RECOMMENDED FOR PRODUCTION USE.
|
|
26
|
+
* @returns A reference to the default context.
|
|
27
|
+
* @remarks This method is opinionated and not recommended for production use.
|
|
28
|
+
*/
|
|
12
29
|
export declare function getDefaultContextRef(): ContextRef;
|
|
13
30
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAe1I;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAMxD;AAYD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CASjD"}
|
package/dist/services/context.js
CHANGED
|
@@ -2,7 +2,14 @@ import ContextNotRegisteredError from "../errors/ContextNotRegisteredError.js";
|
|
|
2
2
|
import { getEnvironmentVariable } from "./environmentVariable.js";
|
|
3
3
|
import { generateRandomString } from "./random.js";
|
|
4
4
|
const contexts = {};
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Registers a tenant+client so that its secret can be used later.
|
|
7
|
+
* @param tenantId - The tenant ID.
|
|
8
|
+
* @param clientId - The client ID.
|
|
9
|
+
* @param clientSecret - The client secret.
|
|
10
|
+
* @param httpProxy - Optional HTTP proxy configuration.
|
|
11
|
+
* @returns A reference to the registered context.
|
|
12
|
+
*/
|
|
6
13
|
export function register(tenantId, clientId, clientSecret, httpProxy) {
|
|
7
14
|
const contextId = generateContextId();
|
|
8
15
|
const context = {
|
|
@@ -15,6 +22,12 @@ export function register(tenantId, clientId, clientSecret, httpProxy) {
|
|
|
15
22
|
const contextRef = createContextRef(contextId);
|
|
16
23
|
return contextRef;
|
|
17
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves the context for a given context ID.
|
|
27
|
+
* @param contextId - The ID of the context.
|
|
28
|
+
* @returns The context associated with the given ID.
|
|
29
|
+
* @throws ContextNotRegisteredError if the context ID is not registered.
|
|
30
|
+
*/
|
|
18
31
|
export function getContext(contextId) {
|
|
19
32
|
const context = contexts[contextId];
|
|
20
33
|
if (!context) {
|
|
@@ -30,7 +43,11 @@ function createContextRef(contextId) {
|
|
|
30
43
|
contextId,
|
|
31
44
|
};
|
|
32
45
|
}
|
|
33
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the opinionated default context reference. NOT RECOMMENDED FOR PRODUCTION USE.
|
|
48
|
+
* @returns A reference to the default context.
|
|
49
|
+
* @remarks This method is opinionated and not recommended for production use.
|
|
50
|
+
*/
|
|
34
51
|
export function getDefaultContextRef() {
|
|
35
52
|
const tenantId = getEnvironmentVariable("AZURE_TENANT_ID");
|
|
36
53
|
const clientId = getEnvironmentVariable("AZURE_CLIENT_ID");
|
package/dist/services/drive.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { DriveId } from "../models/DriveId.ts";
|
|
2
2
|
import type { DriveRef } from "../models/DriveRef.ts";
|
|
3
3
|
import type { SiteRef } from "../models/SiteRef.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a reference to a drive.
|
|
6
|
+
* @param siteRef - The reference to the site.
|
|
7
|
+
* @param driveId - The ID of the drive.
|
|
8
|
+
* @returns A reference to the drive.
|
|
9
|
+
* @throws ProtocolError if the drive ID is missing.
|
|
10
|
+
*/
|
|
4
11
|
export declare function createDriveRef(siteRef: SiteRef, driveId: DriveId | undefined): DriveRef;
|
|
5
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves the opinionated default drive reference. NOT RECOMMENDED FOR PRODUCTION USE.
|
|
14
|
+
* @returns A reference to the default drive.
|
|
15
|
+
* @remarks This method is opinionated and not recommended for production use.
|
|
16
|
+
*/
|
|
6
17
|
export declare function getDefaultDriveRef(): DriveRef;
|
|
7
18
|
//# sourceMappingURL=drive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/services/drive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAUvF;AAED
|
|
1
|
+
{"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/services/drive.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAa7C"}
|
package/dist/services/drive.js
CHANGED
|
@@ -2,6 +2,13 @@ import ProtocolError from "../errors/ProtocolError.js";
|
|
|
2
2
|
import { register } from "./context.js";
|
|
3
3
|
import { getEnvironmentVariable } from "./environmentVariable.js";
|
|
4
4
|
import { createSiteRef } from "./site.js";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a reference to a drive.
|
|
7
|
+
* @param siteRef - The reference to the site.
|
|
8
|
+
* @param driveId - The ID of the drive.
|
|
9
|
+
* @returns A reference to the drive.
|
|
10
|
+
* @throws ProtocolError if the drive ID is missing.
|
|
11
|
+
*/
|
|
5
12
|
export function createDriveRef(siteRef, driveId) {
|
|
6
13
|
if (!driveId) {
|
|
7
14
|
throw new ProtocolError("DriveID is missing");
|
|
@@ -12,7 +19,11 @@ export function createDriveRef(siteRef, driveId) {
|
|
|
12
19
|
driveId,
|
|
13
20
|
};
|
|
14
21
|
}
|
|
15
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the opinionated default drive reference. NOT RECOMMENDED FOR PRODUCTION USE.
|
|
24
|
+
* @returns A reference to the default drive.
|
|
25
|
+
* @remarks This method is opinionated and not recommended for production use.
|
|
26
|
+
*/
|
|
16
27
|
export function getDefaultDriveRef() {
|
|
17
28
|
const tenantId = getEnvironmentVariable("AZURE_TENANT_ID");
|
|
18
29
|
const clientId = getEnvironmentVariable("AZURE_CLIENT_ID");
|
|
@@ -4,7 +4,19 @@ import type { DriveItemRef } from "../models/DriveItemRef.ts";
|
|
|
4
4
|
import type { DriveRef } from "../models/DriveRef.ts";
|
|
5
5
|
export declare const workbookFileExtension = "xlsx";
|
|
6
6
|
export declare const rootDriveItemPath: DriveItemPath;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Creates a drive item path from a given set of segments.
|
|
9
|
+
* @param segments - The segments of the path.
|
|
10
|
+
* @returns The constructed drive item path.
|
|
11
|
+
* @throws InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
|
|
12
|
+
*/
|
|
8
13
|
export declare function driveItemPath(...segments: string[]): DriveItemPath;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a reference to a drive item.
|
|
16
|
+
* @param driveRef - The reference to the drive.
|
|
17
|
+
* @param itemId - The ID of the drive item.
|
|
18
|
+
* @returns A reference to the drive item.
|
|
19
|
+
* @throws ProtocolError if the item ID is missing.
|
|
20
|
+
*/
|
|
9
21
|
export declare function createDriveItemRef(driveRef: DriveRef, itemId: DriveItemId | undefined): DriveItemRef;
|
|
10
22
|
//# sourceMappingURL=driveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../src/services/driveItem.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C,eAAO,MAAM,iBAAiB,eAAqB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../src/services/driveItem.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C,eAAO,MAAM,iBAAiB,eAAqB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,CAkClE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,YAAY,CAWpG"}
|
|
@@ -4,7 +4,12 @@ const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
|
|
|
4
4
|
const reservedNames = ["CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"];
|
|
5
5
|
export const workbookFileExtension = "xlsx";
|
|
6
6
|
export const rootDriveItemPath = driveItemPath("/");
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Creates a drive item path from a given set of segments.
|
|
9
|
+
* @param segments - The segments of the path.
|
|
10
|
+
* @returns The constructed drive item path.
|
|
11
|
+
* @throws InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
|
|
12
|
+
*/
|
|
8
13
|
export function driveItemPath(...segments) {
|
|
9
14
|
for (const segment of segments) {
|
|
10
15
|
if (segment === "") {
|
|
@@ -32,6 +37,13 @@ export function driveItemPath(...segments) {
|
|
|
32
37
|
}
|
|
33
38
|
return path;
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a reference to a drive item.
|
|
42
|
+
* @param driveRef - The reference to the drive.
|
|
43
|
+
* @param itemId - The ID of the drive item.
|
|
44
|
+
* @returns A reference to the drive item.
|
|
45
|
+
* @throws ProtocolError if the item ID is missing.
|
|
46
|
+
*/
|
|
35
47
|
export function createDriveItemRef(driveRef, itemId) {
|
|
36
48
|
if (!itemId) {
|
|
37
49
|
throw new ProtocolError("ItemID is missing");
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the value of an environment variable.
|
|
3
|
+
* @param env - The name of the environment variable.
|
|
4
|
+
* @param fallbackValue - The fallback value to use if the environment variable is not set. Defaults to null.
|
|
5
|
+
* @returns The value of the environment variable or the fallback value.
|
|
6
|
+
* @throws EnvironmentVariableMissingError if the environment variable is not set and no fallback value is provided.
|
|
7
|
+
*/
|
|
1
8
|
export declare function getEnvironmentVariable(env: string, fallbackValue?: string | null): unknown;
|
|
9
|
+
/**
|
|
10
|
+
* Binds an environment variable to a function that retrieves its value.
|
|
11
|
+
* @param env - The name of the environment variable.
|
|
12
|
+
* @param fallbackValue - The fallback value to use if the environment variable is not set. Defaults to null.
|
|
13
|
+
* @returns A function that retrieves the value of the environment variable or the fallback value.
|
|
14
|
+
*/
|
|
2
15
|
export declare function bindEnvironmentVariable(env: string, fallbackValue?: string | null): () => unknown;
|
|
3
16
|
//# sourceMappingURL=environmentVariable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environmentVariable.d.ts","sourceRoot":"","sources":["../../src/services/environmentVariable.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAWhG;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,OAAO,CAEvG"}
|
|
1
|
+
{"version":3,"file":"environmentVariable.d.ts","sourceRoot":"","sources":["../../src/services/environmentVariable.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAWhG;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,OAAO,CAEvG"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import EnvironmentVariableMissingError from "../errors/EnvironmentVariableMissingError.js";
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the value of an environment variable.
|
|
4
|
+
* @param env - The name of the environment variable.
|
|
5
|
+
* @param fallbackValue - The fallback value to use if the environment variable is not set. Defaults to null.
|
|
6
|
+
* @returns The value of the environment variable or the fallback value.
|
|
7
|
+
* @throws EnvironmentVariableMissingError if the environment variable is not set and no fallback value is provided.
|
|
8
|
+
*/
|
|
2
9
|
export function getEnvironmentVariable(env, fallbackValue = null) {
|
|
3
10
|
const value = process.env[env]?.trim() ?? "";
|
|
4
11
|
if (value === "") {
|
|
@@ -9,6 +16,12 @@ export function getEnvironmentVariable(env, fallbackValue = null) {
|
|
|
9
16
|
}
|
|
10
17
|
return value;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Binds an environment variable to a function that retrieves its value.
|
|
21
|
+
* @param env - The name of the environment variable.
|
|
22
|
+
* @param fallbackValue - The fallback value to use if the environment variable is not set. Defaults to null.
|
|
23
|
+
* @returns A function that retrieves the value of the environment variable or the fallback value.
|
|
24
|
+
*/
|
|
12
25
|
export function bindEnvironmentVariable(env, fallbackValue = null) {
|
|
13
26
|
return () => getEnvironmentVariable(env, fallbackValue);
|
|
14
27
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
2
2
|
import type { HttpProxy } from "../models/HttpProxy.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Attempts to create an HTTP agent for a given proxy configuration.
|
|
5
|
+
* @param httpProxy - The HTTP proxy configuration.
|
|
6
|
+
* @returns An instance of HttpsProxyAgent if the proxy is defined, otherwise undefined.
|
|
7
|
+
*/
|
|
3
8
|
export declare function tryGetHttpAgent(httpProxy: HttpProxy | undefined): HttpsProxyAgent<string> | undefined;
|
|
4
9
|
//# sourceMappingURL=httpAgent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpAgent.d.ts","sourceRoot":"","sources":["../../src/services/httpAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,SAAS,CAKrG"}
|
|
1
|
+
{"version":3,"file":"httpAgent.d.ts","sourceRoot":"","sources":["../../src/services/httpAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,SAAS,CAKrG"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
2
|
+
/**
|
|
3
|
+
* Attempts to create an HTTP agent for a given proxy configuration.
|
|
4
|
+
* @param httpProxy - The HTTP proxy configuration.
|
|
5
|
+
* @returns An instance of HttpsProxyAgent if the proxy is defined, otherwise undefined.
|
|
6
|
+
*/
|
|
2
7
|
export function tryGetHttpAgent(httpProxy) {
|
|
3
8
|
if (!httpProxy) {
|
|
4
9
|
return undefined;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the HTTP status code indicates a successful response.
|
|
3
|
+
* @param status - The HTTP status code.
|
|
4
|
+
* @returns True if the status code is in the range 200-299, otherwise false.
|
|
5
|
+
*/
|
|
1
6
|
export declare function isHttpOk(status: number): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the HTTP status code indicates too many requests (rate limiting).
|
|
9
|
+
* @param status - The HTTP status code.
|
|
10
|
+
* @returns True if the status code is 429, otherwise false.
|
|
11
|
+
*/
|
|
2
12
|
export declare function isHttpTooManyRequests(status: number): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the HTTP status code indicates the service is unavailable.
|
|
15
|
+
* @param status - The HTTP status code.
|
|
16
|
+
* @returns True if the status code is 503, otherwise false.
|
|
17
|
+
*/
|
|
3
18
|
export declare function isServiceUnavailable(status: number): boolean;
|
|
4
19
|
//# sourceMappingURL=httpStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
1
|
+
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the HTTP status code indicates a successful response.
|
|
3
|
+
* @param status - The HTTP status code.
|
|
4
|
+
* @returns True if the status code is in the range 200-299, otherwise false.
|
|
5
|
+
*/
|
|
1
6
|
export function isHttpOk(status) {
|
|
2
7
|
return status >= 200 && status < 300;
|
|
3
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the HTTP status code indicates too many requests (rate limiting).
|
|
11
|
+
* @param status - The HTTP status code.
|
|
12
|
+
* @returns True if the status code is 429, otherwise false.
|
|
13
|
+
*/
|
|
4
14
|
export function isHttpTooManyRequests(status) {
|
|
5
15
|
return status === 429;
|
|
6
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the HTTP status code indicates the service is unavailable.
|
|
19
|
+
* @param status - The HTTP status code.
|
|
20
|
+
* @returns True if the status code is 503, otherwise false.
|
|
21
|
+
*/
|
|
7
22
|
export function isServiceUnavailable(status) {
|
|
8
23
|
return status === 503;
|
|
9
24
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an operation index to an operation ID.
|
|
3
|
+
* @param index - The operation index.
|
|
4
|
+
* @returns The operation ID as a string.
|
|
5
|
+
*/
|
|
1
6
|
export declare function operationIndexToId(index: number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Converts an operation ID to an operation index.
|
|
9
|
+
* @param id - The operation ID as a string.
|
|
10
|
+
* @returns The operation index as a number.
|
|
11
|
+
*/
|
|
2
12
|
export declare function operationIdToIndex(id: string): number;
|
|
3
13
|
//# sourceMappingURL=operationId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operationId.d.ts","sourceRoot":"","sources":["../../src/services/operationId.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
1
|
+
{"version":3,"file":"operationId.d.ts","sourceRoot":"","sources":["../../src/services/operationId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an operation index to an operation ID.
|
|
3
|
+
* @param index - The operation index.
|
|
4
|
+
* @returns The operation ID as a string.
|
|
5
|
+
*/
|
|
1
6
|
export function operationIndexToId(index) {
|
|
2
7
|
return index.toString();
|
|
3
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Converts an operation ID to an operation index.
|
|
11
|
+
* @param id - The operation ID as a string.
|
|
12
|
+
* @returns The operation index as a number.
|
|
13
|
+
*/
|
|
4
14
|
export function operationIdToIndex(id) {
|
|
5
15
|
return Number.parseInt(id, 10);
|
|
6
16
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random alphanumeric string of the specified length.
|
|
3
|
+
* @param length - The length of the string to generate. Defaults to 16.
|
|
4
|
+
* @returns A random alphanumeric string.
|
|
5
|
+
*/
|
|
1
6
|
export declare function generateRandomString(length?: number): string;
|
|
2
7
|
//# sourceMappingURL=random.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/services/random.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,MAAM,SAAK,GAAG,MAAM,CAQxD"}
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/services/random.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,SAAK,GAAG,MAAM,CAQxD"}
|
package/dist/services/random.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { randomInt } from "node:crypto";
|
|
2
2
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
3
|
+
/**
|
|
4
|
+
* Generates a random alphanumeric string of the specified length.
|
|
5
|
+
* @param length - The length of the string to generate. Defaults to 16.
|
|
6
|
+
* @returns A random alphanumeric string.
|
|
7
|
+
*/
|
|
3
8
|
export function generateRandomString(length = 16) {
|
|
4
9
|
let result = "";
|
|
5
10
|
for (let i = 0; i < length; i++) {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { DriveItemId } from "../models/DriveItemId.ts";
|
|
2
2
|
import type { HostName } from "../models/HostName.ts";
|
|
3
3
|
import type { SiteName } from "../models/SiteName.ts";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
6
|
+
* @param url - The SharePoint document URL.
|
|
7
|
+
* @returns An object containing the host name, site name, and item ID.
|
|
8
|
+
* @throws InvalidArgumentError if the URL is invalid or required components are missing.
|
|
9
|
+
*/
|
|
5
10
|
export declare function parseSharepointUrl(url: URL): {
|
|
6
11
|
hostName: HostName;
|
|
7
12
|
siteName: SiteName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepointUrl.d.ts","sourceRoot":"","sources":["../../src/services/sharepointUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"sharepointUrl.d.ts","sourceRoot":"","sources":["../../src/services/sharepointUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAyB5G"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import InvalidArgumentError from "../errors/InvalidArgumentError.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
4
|
+
* @param url - The SharePoint document URL.
|
|
5
|
+
* @returns An object containing the host name, site name, and item ID.
|
|
6
|
+
* @throws InvalidArgumentError if the URL is invalid or required components are missing.
|
|
7
|
+
*/
|
|
3
8
|
export function parseSharepointUrl(url) {
|
|
4
9
|
if (!url.hostname.endsWith(".sharepoint.com")) {
|
|
5
10
|
throw new InvalidArgumentError("Invalid SharePoint URL. Hostname must end with '.sharepoint.com'.");
|
package/dist/services/site.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { ContextRef } from "../models/ContextRef.ts";
|
|
2
2
|
import type { SiteId } from "../models/SiteId.ts";
|
|
3
3
|
import type { SiteRef } from "../models/SiteRef.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a reference to a site.
|
|
6
|
+
* @param contextRef - The reference to the context.
|
|
7
|
+
* @param siteId - The ID of the site.
|
|
8
|
+
* @returns A reference to the site.
|
|
9
|
+
* @throws ProtocolError if the site ID is missing.
|
|
10
|
+
*/
|
|
4
11
|
export declare function createSiteRef(contextRef: ContextRef, siteId: SiteId | undefined): SiteRef;
|
|
5
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves the opinionated default site reference. NOT RECOMMENDED FOR PRODUCTION USE
|
|
14
|
+
* @returns A reference to the default site.
|
|
15
|
+
* @remarks This method is opinionated and not recommended for production use.
|
|
16
|
+
*/
|
|
6
17
|
export declare function getDefaultSiteRef(): SiteRef;
|
|
7
18
|
//# sourceMappingURL=site.d.ts.map
|