outlook-cli 1.2.0

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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * OData helper functions for Microsoft Graph API
3
+ */
4
+
5
+ /**
6
+ * Escapes a string for use in OData queries
7
+ * @param {string} str - The string to escape
8
+ * @returns {string} - The escaped string
9
+ */
10
+ function escapeODataString(str) {
11
+ if (!str) return str;
12
+
13
+ // Replace single quotes with double single quotes (OData escaping)
14
+ // And remove any special characters that could cause OData syntax errors
15
+ str = str.replace(/'/g, "''");
16
+
17
+ // Escape other potentially problematic characters
18
+ str = str.replace(/[\(\)\{\}\[\]\:\;\,\/\?\&\=\+\*\%\$\#\@\!\^]/g, '');
19
+
20
+ console.error(`Escaped OData string: '${str}'`);
21
+ return str;
22
+ }
23
+
24
+ /**
25
+ * Builds an OData filter from filter conditions
26
+ * @param {Array<string>} conditions - Array of filter conditions
27
+ * @returns {string} - Combined OData filter expression
28
+ */
29
+ function buildODataFilter(conditions) {
30
+ if (!conditions || conditions.length === 0) {
31
+ return '';
32
+ }
33
+
34
+ return conditions.join(' and ');
35
+ }
36
+
37
+ module.exports = {
38
+ escapeODataString,
39
+ buildODataFilter
40
+ };