@jbctechsolutions/mcp-outlook-mac 1.0.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.
Files changed (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +358 -0
  3. package/dist/applescript/account-repository.d.ts +29 -0
  4. package/dist/applescript/account-repository.d.ts.map +1 -0
  5. package/dist/applescript/account-repository.js +34 -0
  6. package/dist/applescript/account-repository.js.map +1 -0
  7. package/dist/applescript/account-scripts.d.ts +22 -0
  8. package/dist/applescript/account-scripts.d.ts.map +1 -0
  9. package/dist/applescript/account-scripts.js +176 -0
  10. package/dist/applescript/account-scripts.js.map +1 -0
  11. package/dist/applescript/calendar-manager.d.ts +45 -0
  12. package/dist/applescript/calendar-manager.d.ts.map +1 -0
  13. package/dist/applescript/calendar-manager.js +88 -0
  14. package/dist/applescript/calendar-manager.js.map +1 -0
  15. package/dist/applescript/calendar-writer.d.ts +38 -0
  16. package/dist/applescript/calendar-writer.d.ts.map +1 -0
  17. package/dist/applescript/calendar-writer.js +90 -0
  18. package/dist/applescript/calendar-writer.js.map +1 -0
  19. package/dist/applescript/content-readers.d.ts +93 -0
  20. package/dist/applescript/content-readers.d.ts.map +1 -0
  21. package/dist/applescript/content-readers.js +299 -0
  22. package/dist/applescript/content-readers.js.map +1 -0
  23. package/dist/applescript/executor.d.ts +62 -0
  24. package/dist/applescript/executor.d.ts.map +1 -0
  25. package/dist/applescript/executor.js +164 -0
  26. package/dist/applescript/executor.js.map +1 -0
  27. package/dist/applescript/index.d.ts +16 -0
  28. package/dist/applescript/index.d.ts.map +1 -0
  29. package/dist/applescript/index.js +25 -0
  30. package/dist/applescript/index.js.map +1 -0
  31. package/dist/applescript/mail-sender.d.ts +30 -0
  32. package/dist/applescript/mail-sender.d.ts.map +1 -0
  33. package/dist/applescript/mail-sender.js +53 -0
  34. package/dist/applescript/mail-sender.js.map +1 -0
  35. package/dist/applescript/parser.d.ts +215 -0
  36. package/dist/applescript/parser.d.ts.map +1 -0
  37. package/dist/applescript/parser.js +431 -0
  38. package/dist/applescript/parser.js.map +1 -0
  39. package/dist/applescript/repository.d.ts +58 -0
  40. package/dist/applescript/repository.d.ts.map +1 -0
  41. package/dist/applescript/repository.js +417 -0
  42. package/dist/applescript/repository.js.map +1 -0
  43. package/dist/applescript/scripts.d.ts +242 -0
  44. package/dist/applescript/scripts.d.ts.map +1 -0
  45. package/dist/applescript/scripts.js +1300 -0
  46. package/dist/applescript/scripts.js.map +1 -0
  47. package/dist/approval/hash.d.ts +26 -0
  48. package/dist/approval/hash.d.ts.map +1 -0
  49. package/dist/approval/hash.js +28 -0
  50. package/dist/approval/hash.js.map +1 -0
  51. package/dist/approval/index.d.ts +9 -0
  52. package/dist/approval/index.d.ts.map +1 -0
  53. package/dist/approval/index.js +8 -0
  54. package/dist/approval/index.js.map +1 -0
  55. package/dist/approval/token-manager.d.ts +48 -0
  56. package/dist/approval/token-manager.d.ts.map +1 -0
  57. package/dist/approval/token-manager.js +100 -0
  58. package/dist/approval/token-manager.js.map +1 -0
  59. package/dist/approval/types.d.ts +40 -0
  60. package/dist/approval/types.d.ts.map +1 -0
  61. package/dist/approval/types.js +8 -0
  62. package/dist/approval/types.js.map +1 -0
  63. package/dist/config.d.ts +23 -0
  64. package/dist/config.d.ts.map +1 -0
  65. package/dist/config.js +38 -0
  66. package/dist/config.js.map +1 -0
  67. package/dist/database/connection.d.ts +73 -0
  68. package/dist/database/connection.d.ts.map +1 -0
  69. package/dist/database/connection.js +126 -0
  70. package/dist/database/connection.js.map +1 -0
  71. package/dist/database/index.d.ts +7 -0
  72. package/dist/database/index.d.ts.map +1 -0
  73. package/dist/database/index.js +7 -0
  74. package/dist/database/index.js.map +1 -0
  75. package/dist/database/queries.d.ts +89 -0
  76. package/dist/database/queries.d.ts.map +1 -0
  77. package/dist/database/queries.js +422 -0
  78. package/dist/database/queries.js.map +1 -0
  79. package/dist/database/repository.d.ts +188 -0
  80. package/dist/database/repository.d.ts.map +1 -0
  81. package/dist/database/repository.js +187 -0
  82. package/dist/database/repository.js.map +1 -0
  83. package/dist/graph/auth/config.d.ts +33 -0
  84. package/dist/graph/auth/config.d.ts.map +1 -0
  85. package/dist/graph/auth/config.js +53 -0
  86. package/dist/graph/auth/config.js.map +1 -0
  87. package/dist/graph/auth/device-code-flow.d.ts +51 -0
  88. package/dist/graph/auth/device-code-flow.d.ts.map +1 -0
  89. package/dist/graph/auth/device-code-flow.js +176 -0
  90. package/dist/graph/auth/device-code-flow.js.map +1 -0
  91. package/dist/graph/auth/index.d.ts +9 -0
  92. package/dist/graph/auth/index.d.ts.map +1 -0
  93. package/dist/graph/auth/index.js +9 -0
  94. package/dist/graph/auth/index.js.map +1 -0
  95. package/dist/graph/auth/token-cache.d.ts +43 -0
  96. package/dist/graph/auth/token-cache.d.ts.map +1 -0
  97. package/dist/graph/auth/token-cache.js +99 -0
  98. package/dist/graph/auth/token-cache.js.map +1 -0
  99. package/dist/graph/client/cache.d.ts +65 -0
  100. package/dist/graph/client/cache.d.ts.map +1 -0
  101. package/dist/graph/client/cache.js +109 -0
  102. package/dist/graph/client/cache.js.map +1 -0
  103. package/dist/graph/client/graph-client.d.ts +150 -0
  104. package/dist/graph/client/graph-client.d.ts.map +1 -0
  105. package/dist/graph/client/graph-client.js +538 -0
  106. package/dist/graph/client/graph-client.js.map +1 -0
  107. package/dist/graph/client/index.d.ts +8 -0
  108. package/dist/graph/client/index.d.ts.map +1 -0
  109. package/dist/graph/client/index.js +8 -0
  110. package/dist/graph/client/index.js.map +1 -0
  111. package/dist/graph/content-readers.d.ts +102 -0
  112. package/dist/graph/content-readers.d.ts.map +1 -0
  113. package/dist/graph/content-readers.js +327 -0
  114. package/dist/graph/content-readers.js.map +1 -0
  115. package/dist/graph/index.d.ts +14 -0
  116. package/dist/graph/index.d.ts.map +1 -0
  117. package/dist/graph/index.js +19 -0
  118. package/dist/graph/index.js.map +1 -0
  119. package/dist/graph/mailbox-adapter.d.ts +25 -0
  120. package/dist/graph/mailbox-adapter.d.ts.map +1 -0
  121. package/dist/graph/mailbox-adapter.js +56 -0
  122. package/dist/graph/mailbox-adapter.js.map +1 -0
  123. package/dist/graph/mappers/contact-mapper.d.ts +10 -0
  124. package/dist/graph/mappers/contact-mapper.d.ts.map +1 -0
  125. package/dist/graph/mappers/contact-mapper.js +19 -0
  126. package/dist/graph/mappers/contact-mapper.js.map +1 -0
  127. package/dist/graph/mappers/email-mapper.d.ts +10 -0
  128. package/dist/graph/mappers/email-mapper.d.ts.map +1 -0
  129. package/dist/graph/mappers/email-mapper.js +43 -0
  130. package/dist/graph/mappers/email-mapper.js.map +1 -0
  131. package/dist/graph/mappers/event-mapper.d.ts +10 -0
  132. package/dist/graph/mappers/event-mapper.d.ts.map +1 -0
  133. package/dist/graph/mappers/event-mapper.js +28 -0
  134. package/dist/graph/mappers/event-mapper.js.map +1 -0
  135. package/dist/graph/mappers/folder-mapper.d.ts +18 -0
  136. package/dist/graph/mappers/folder-mapper.d.ts.map +1 -0
  137. package/dist/graph/mappers/folder-mapper.js +50 -0
  138. package/dist/graph/mappers/folder-mapper.js.map +1 -0
  139. package/dist/graph/mappers/index.d.ts +12 -0
  140. package/dist/graph/mappers/index.d.ts.map +1 -0
  141. package/dist/graph/mappers/index.js +12 -0
  142. package/dist/graph/mappers/index.js.map +1 -0
  143. package/dist/graph/mappers/task-mapper.d.ts +16 -0
  144. package/dist/graph/mappers/task-mapper.d.ts.map +1 -0
  145. package/dist/graph/mappers/task-mapper.js +26 -0
  146. package/dist/graph/mappers/task-mapper.js.map +1 -0
  147. package/dist/graph/mappers/utils.d.ts +75 -0
  148. package/dist/graph/mappers/utils.d.ts.map +1 -0
  149. package/dist/graph/mappers/utils.js +130 -0
  150. package/dist/graph/mappers/utils.js.map +1 -0
  151. package/dist/graph/repository.d.ts +112 -0
  152. package/dist/graph/repository.d.ts.map +1 -0
  153. package/dist/graph/repository.js +549 -0
  154. package/dist/graph/repository.js.map +1 -0
  155. package/dist/index.d.ts +17 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +1821 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/parsers/html-stripper.d.ts +43 -0
  160. package/dist/parsers/html-stripper.d.ts.map +1 -0
  161. package/dist/parsers/html-stripper.js +175 -0
  162. package/dist/parsers/html-stripper.js.map +1 -0
  163. package/dist/parsers/index.d.ts +8 -0
  164. package/dist/parsers/index.d.ts.map +1 -0
  165. package/dist/parsers/index.js +8 -0
  166. package/dist/parsers/index.js.map +1 -0
  167. package/dist/parsers/olk15.d.ts +99 -0
  168. package/dist/parsers/olk15.d.ts.map +1 -0
  169. package/dist/parsers/olk15.js +364 -0
  170. package/dist/parsers/olk15.js.map +1 -0
  171. package/dist/tools/calendar.d.ts +203 -0
  172. package/dist/tools/calendar.d.ts.map +1 -0
  173. package/dist/tools/calendar.js +251 -0
  174. package/dist/tools/calendar.js.map +1 -0
  175. package/dist/tools/contacts.d.ts +89 -0
  176. package/dist/tools/contacts.d.ts.map +1 -0
  177. package/dist/tools/contacts.js +129 -0
  178. package/dist/tools/contacts.js.map +1 -0
  179. package/dist/tools/index.d.ts +12 -0
  180. package/dist/tools/index.d.ts.map +1 -0
  181. package/dist/tools/index.js +18 -0
  182. package/dist/tools/index.js.map +1 -0
  183. package/dist/tools/mail.d.ts +83 -0
  184. package/dist/tools/mail.d.ts.map +1 -0
  185. package/dist/tools/mail.js +217 -0
  186. package/dist/tools/mail.js.map +1 -0
  187. package/dist/tools/mailbox-organization.d.ts +337 -0
  188. package/dist/tools/mailbox-organization.d.ts.map +1 -0
  189. package/dist/tools/mailbox-organization.js +525 -0
  190. package/dist/tools/mailbox-organization.js.map +1 -0
  191. package/dist/tools/notes.d.ts +70 -0
  192. package/dist/tools/notes.d.ts.map +1 -0
  193. package/dist/tools/notes.js +132 -0
  194. package/dist/tools/notes.js.map +1 -0
  195. package/dist/tools/tasks.d.ts +70 -0
  196. package/dist/tools/tasks.d.ts.map +1 -0
  197. package/dist/tools/tasks.js +122 -0
  198. package/dist/tools/tasks.js.map +1 -0
  199. package/dist/types/calendar.d.ts +56 -0
  200. package/dist/types/calendar.d.ts.map +1 -0
  201. package/dist/types/calendar.js +14 -0
  202. package/dist/types/calendar.js.map +1 -0
  203. package/dist/types/contacts.d.ts +92 -0
  204. package/dist/types/contacts.d.ts.map +1 -0
  205. package/dist/types/contacts.js +37 -0
  206. package/dist/types/contacts.js.map +1 -0
  207. package/dist/types/index.d.ts +11 -0
  208. package/dist/types/index.d.ts.map +1 -0
  209. package/dist/types/index.js +12 -0
  210. package/dist/types/index.js.map +1 -0
  211. package/dist/types/mail.d.ts +87 -0
  212. package/dist/types/mail.d.ts.map +1 -0
  213. package/dist/types/mail.js +32 -0
  214. package/dist/types/mail.js.map +1 -0
  215. package/dist/types/notes.d.ts +22 -0
  216. package/dist/types/notes.d.ts.map +1 -0
  217. package/dist/types/notes.js +5 -0
  218. package/dist/types/notes.js.map +1 -0
  219. package/dist/types/tasks.d.ts +27 -0
  220. package/dist/types/tasks.d.ts.map +1 -0
  221. package/dist/types/tasks.js +5 -0
  222. package/dist/types/tasks.js.map +1 -0
  223. package/dist/utils/dates.d.ts +62 -0
  224. package/dist/utils/dates.d.ts.map +1 -0
  225. package/dist/utils/dates.js +90 -0
  226. package/dist/utils/dates.js.map +1 -0
  227. package/dist/utils/errors.d.ts +198 -0
  228. package/dist/utils/errors.d.ts.map +1 -0
  229. package/dist/utils/errors.js +281 -0
  230. package/dist/utils/errors.js.map +1 -0
  231. package/dist/utils/index.d.ts +6 -0
  232. package/dist/utils/index.d.ts.map +1 -0
  233. package/dist/utils/index.js +6 -0
  234. package/dist/utils/index.js.map +1 -0
  235. package/package.json +75 -0
@@ -0,0 +1,417 @@
1
+ /**
2
+ * AppleScript-based repository implementation.
3
+ *
4
+ * Implements IRepository using AppleScript to communicate with Outlook,
5
+ * enabling support for both classic and new Outlook for Mac.
6
+ */
7
+ import { executeAppleScriptOrThrow } from './executor.js';
8
+ import * as scripts from './scripts.js';
9
+ import * as parser from './parser.js';
10
+ import { isoToAppleTimestamp } from '../utils/dates.js';
11
+ import { createEmailPath, createEventPath, createContactPath, createTaskPath, createNotePath, } from './content-readers.js';
12
+ // =============================================================================
13
+ // Utility Functions
14
+ // =============================================================================
15
+ /**
16
+ * Converts a priority string to a numeric value.
17
+ */
18
+ function priorityToNumber(priority) {
19
+ switch (priority.toLowerCase()) {
20
+ case 'high':
21
+ return 1;
22
+ case 'low':
23
+ return -1;
24
+ default:
25
+ return 0;
26
+ }
27
+ }
28
+ // =============================================================================
29
+ // Row Converters
30
+ // =============================================================================
31
+ /**
32
+ * Converts AppleScript folder output to FolderRow.
33
+ */
34
+ function toFolderRow(asFolder) {
35
+ return {
36
+ id: asFolder.id,
37
+ name: asFolder.name,
38
+ parentId: null, // AppleScript doesn't provide parent info easily
39
+ specialType: 0,
40
+ folderType: 1, // Mail folder
41
+ accountId: 1, // Default account
42
+ messageCount: 0, // Not available via AppleScript directly
43
+ unreadCount: asFolder.unreadCount,
44
+ };
45
+ }
46
+ /**
47
+ * Converts AppleScript calendar output to FolderRow (calendars use FolderRow).
48
+ */
49
+ function calendarToFolderRow(asCal) {
50
+ return {
51
+ id: asCal.id,
52
+ name: asCal.name,
53
+ parentId: null,
54
+ specialType: 0,
55
+ folderType: 2, // Calendar folder
56
+ accountId: 1,
57
+ messageCount: 0,
58
+ unreadCount: 0,
59
+ };
60
+ }
61
+ /**
62
+ * Converts AppleScript email output to EmailRow.
63
+ */
64
+ function toEmailRow(asEmail) {
65
+ return {
66
+ id: asEmail.id,
67
+ folderId: asEmail.folderId ?? 0,
68
+ subject: asEmail.subject,
69
+ sender: asEmail.senderName,
70
+ senderAddress: asEmail.senderEmail,
71
+ recipients: asEmail.toRecipients,
72
+ displayTo: asEmail.toRecipients,
73
+ toAddresses: asEmail.toRecipients,
74
+ ccAddresses: asEmail.ccRecipients,
75
+ preview: asEmail.preview,
76
+ isRead: asEmail.isRead ? 1 : 0,
77
+ timeReceived: isoToAppleTimestamp(asEmail.dateReceived),
78
+ timeSent: isoToAppleTimestamp(asEmail.dateSent),
79
+ hasAttachment: asEmail.attachments.length > 0 ? 1 : 0,
80
+ size: 0,
81
+ priority: priorityToNumber(asEmail.priority),
82
+ flagStatus: 0,
83
+ categories: null,
84
+ messageId: null,
85
+ conversationId: null,
86
+ dataFilePath: createEmailPath(asEmail.id), // Special path for AppleScript content reader
87
+ };
88
+ }
89
+ /**
90
+ * Converts AppleScript event output to EventRow.
91
+ */
92
+ function toEventRow(asEvent) {
93
+ return {
94
+ id: asEvent.id,
95
+ folderId: asEvent.calendarId ?? 0,
96
+ startDate: isoToAppleTimestamp(asEvent.startTime),
97
+ endDate: isoToAppleTimestamp(asEvent.endTime),
98
+ isRecurring: asEvent.isRecurring ? 1 : 0,
99
+ hasReminder: 0,
100
+ attendeeCount: asEvent.attendees.length,
101
+ uid: null,
102
+ masterRecordId: null,
103
+ recurrenceId: null,
104
+ dataFilePath: createEventPath(asEvent.id),
105
+ };
106
+ }
107
+ /**
108
+ * Converts AppleScript contact output to ContactRow.
109
+ */
110
+ function toContactRow(asContact) {
111
+ return {
112
+ id: asContact.id,
113
+ folderId: 0,
114
+ displayName: asContact.displayName,
115
+ sortName: asContact.lastName ?? asContact.displayName,
116
+ contactType: null,
117
+ dataFilePath: createContactPath(asContact.id),
118
+ };
119
+ }
120
+ /**
121
+ * Converts AppleScript task output to TaskRow.
122
+ */
123
+ function toTaskRow(asTask) {
124
+ return {
125
+ id: asTask.id,
126
+ folderId: asTask.folderId ?? 0,
127
+ name: asTask.name,
128
+ isCompleted: asTask.isCompleted ? 1 : 0,
129
+ dueDate: isoToAppleTimestamp(asTask.dueDate),
130
+ startDate: isoToAppleTimestamp(asTask.startDate),
131
+ priority: priorityToNumber(asTask.priority),
132
+ hasReminder: null,
133
+ dataFilePath: createTaskPath(asTask.id),
134
+ };
135
+ }
136
+ /**
137
+ * Converts AppleScript note output to NoteRow.
138
+ */
139
+ function toNoteRow(asNote) {
140
+ return {
141
+ id: asNote.id,
142
+ folderId: asNote.folderId ?? 0,
143
+ modifiedDate: isoToAppleTimestamp(asNote.modifiedDate),
144
+ dataFilePath: createNotePath(asNote.id),
145
+ };
146
+ }
147
+ // =============================================================================
148
+ // Repository Implementation
149
+ // =============================================================================
150
+ /**
151
+ * Repository implementation using AppleScript.
152
+ *
153
+ * Communicates with Microsoft Outlook via osascript to fetch data.
154
+ * Works with both classic and new Outlook for Mac.
155
+ */
156
+ export class AppleScriptRepository {
157
+ // Cache for folder ID lookup
158
+ folderCache = new Map();
159
+ folderCacheExpiry = 0;
160
+ CACHE_TTL_MS = 30000; // 30 seconds
161
+ // ---------------------------------------------------------------------------
162
+ // Folders
163
+ // ---------------------------------------------------------------------------
164
+ listFolders() {
165
+ const output = executeAppleScriptOrThrow(scripts.LIST_MAIL_FOLDERS);
166
+ const folders = parser.parseFolders(output).map(toFolderRow);
167
+ // Update cache
168
+ this.folderCache.clear();
169
+ for (const folder of folders) {
170
+ this.folderCache.set(folder.id, folder);
171
+ }
172
+ this.folderCacheExpiry = Date.now() + this.CACHE_TTL_MS;
173
+ return folders;
174
+ }
175
+ getFolder(id) {
176
+ // Check cache first
177
+ if (Date.now() < this.folderCacheExpiry) {
178
+ const cached = this.folderCache.get(id);
179
+ if (cached != null) {
180
+ return cached;
181
+ }
182
+ }
183
+ // Refresh cache
184
+ const folders = this.listFolders();
185
+ return folders.find((f) => f.id === id);
186
+ }
187
+ // ---------------------------------------------------------------------------
188
+ // Emails
189
+ // ---------------------------------------------------------------------------
190
+ listEmails(folderId, limit, offset) {
191
+ const script = scripts.listMessages(folderId, limit, offset, false);
192
+ const output = executeAppleScriptOrThrow(script);
193
+ return parser.parseEmails(output).map(toEmailRow);
194
+ }
195
+ listUnreadEmails(folderId, limit, offset) {
196
+ const script = scripts.listMessages(folderId, limit, offset, true);
197
+ const output = executeAppleScriptOrThrow(script);
198
+ return parser.parseEmails(output).map(toEmailRow);
199
+ }
200
+ searchEmails(query, limit) {
201
+ const script = scripts.searchMessages(query, null, limit);
202
+ const output = executeAppleScriptOrThrow(script);
203
+ return parser.parseEmails(output).map(toEmailRow);
204
+ }
205
+ searchEmailsInFolder(folderId, query, limit) {
206
+ const script = scripts.searchMessages(query, folderId, limit);
207
+ const output = executeAppleScriptOrThrow(script);
208
+ return parser.parseEmails(output).map(toEmailRow);
209
+ }
210
+ getEmail(id) {
211
+ try {
212
+ const script = scripts.getMessage(id);
213
+ const output = executeAppleScriptOrThrow(script);
214
+ const email = parser.parseEmail(output);
215
+ return email != null ? toEmailRow(email) : undefined;
216
+ }
217
+ catch {
218
+ return undefined;
219
+ }
220
+ }
221
+ getUnreadCount() {
222
+ // Sum unread counts from all folders
223
+ const folders = this.listFolders();
224
+ return folders.reduce((sum, f) => sum + f.unreadCount, 0);
225
+ }
226
+ getUnreadCountByFolder(folderId) {
227
+ try {
228
+ const script = scripts.getUnreadCount(folderId);
229
+ const output = executeAppleScriptOrThrow(script);
230
+ return parser.parseCount(output);
231
+ }
232
+ catch {
233
+ return 0;
234
+ }
235
+ }
236
+ // ---------------------------------------------------------------------------
237
+ // Calendar
238
+ // ---------------------------------------------------------------------------
239
+ listCalendars() {
240
+ const output = executeAppleScriptOrThrow(scripts.LIST_CALENDARS);
241
+ return parser.parseCalendars(output).map(calendarToFolderRow);
242
+ }
243
+ listEvents(limit) {
244
+ const script = scripts.listEvents(null, null, null, limit);
245
+ const output = executeAppleScriptOrThrow(script);
246
+ return parser.parseEvents(output).map(toEventRow);
247
+ }
248
+ listEventsByFolder(folderId, limit) {
249
+ const script = scripts.listEvents(folderId, null, null, limit);
250
+ const output = executeAppleScriptOrThrow(script);
251
+ return parser.parseEvents(output).map(toEventRow);
252
+ }
253
+ listEventsByDateRange(startDate, endDate, limit) {
254
+ // Convert Apple timestamps to ISO for filtering
255
+ // Note: AppleScript filtering by date is done client-side for simplicity
256
+ const allEvents = this.listEvents(1000); // Get more events for filtering
257
+ return allEvents
258
+ .filter((e) => {
259
+ if (e.startDate == null)
260
+ return false;
261
+ return e.startDate >= startDate && e.startDate <= endDate;
262
+ })
263
+ .slice(0, limit);
264
+ }
265
+ getEvent(id) {
266
+ try {
267
+ const script = scripts.getEvent(id);
268
+ const output = executeAppleScriptOrThrow(script);
269
+ const event = parser.parseEvent(output);
270
+ return event != null ? toEventRow(event) : undefined;
271
+ }
272
+ catch {
273
+ return undefined;
274
+ }
275
+ }
276
+ // ---------------------------------------------------------------------------
277
+ // Contacts
278
+ // ---------------------------------------------------------------------------
279
+ listContacts(limit, offset) {
280
+ const script = scripts.listContacts(limit, offset);
281
+ const output = executeAppleScriptOrThrow(script);
282
+ return parser.parseContacts(output).map(toContactRow);
283
+ }
284
+ searchContacts(query, limit) {
285
+ const script = scripts.searchContacts(query, limit);
286
+ const output = executeAppleScriptOrThrow(script);
287
+ return parser.parseContacts(output).map(toContactRow);
288
+ }
289
+ getContact(id) {
290
+ try {
291
+ const script = scripts.getContact(id);
292
+ const output = executeAppleScriptOrThrow(script);
293
+ const contact = parser.parseContact(output);
294
+ return contact != null ? toContactRow(contact) : undefined;
295
+ }
296
+ catch {
297
+ return undefined;
298
+ }
299
+ }
300
+ // ---------------------------------------------------------------------------
301
+ // Tasks
302
+ // ---------------------------------------------------------------------------
303
+ listTasks(limit, offset) {
304
+ const script = scripts.listTasks(limit, offset, true);
305
+ const output = executeAppleScriptOrThrow(script);
306
+ return parser.parseTasks(output).map(toTaskRow);
307
+ }
308
+ listIncompleteTasks(limit, offset) {
309
+ const script = scripts.listTasks(limit, offset, false);
310
+ const output = executeAppleScriptOrThrow(script);
311
+ return parser.parseTasks(output).map(toTaskRow);
312
+ }
313
+ searchTasks(query, limit) {
314
+ const script = scripts.searchTasks(query, limit);
315
+ const output = executeAppleScriptOrThrow(script);
316
+ return parser.parseTasks(output).map(toTaskRow);
317
+ }
318
+ getTask(id) {
319
+ try {
320
+ const script = scripts.getTask(id);
321
+ const output = executeAppleScriptOrThrow(script);
322
+ const task = parser.parseTask(output);
323
+ return task != null ? toTaskRow(task) : undefined;
324
+ }
325
+ catch {
326
+ return undefined;
327
+ }
328
+ }
329
+ // ---------------------------------------------------------------------------
330
+ // Notes
331
+ // ---------------------------------------------------------------------------
332
+ listNotes(limit, offset) {
333
+ const script = scripts.listNotes(limit, offset);
334
+ const output = executeAppleScriptOrThrow(script);
335
+ return parser.parseNotes(output).map(toNoteRow);
336
+ }
337
+ getNote(id) {
338
+ try {
339
+ const script = scripts.getNote(id);
340
+ const output = executeAppleScriptOrThrow(script);
341
+ const note = parser.parseNote(output);
342
+ return note != null ? toNoteRow(note) : undefined;
343
+ }
344
+ catch {
345
+ return undefined;
346
+ }
347
+ }
348
+ // ---------------------------------------------------------------------------
349
+ // Write Operations
350
+ // ---------------------------------------------------------------------------
351
+ moveEmail(emailId, destinationFolderId) {
352
+ const script = scripts.moveMessage(emailId, destinationFolderId);
353
+ executeAppleScriptOrThrow(script);
354
+ }
355
+ deleteEmail(emailId) {
356
+ const script = scripts.deleteMessage(emailId);
357
+ executeAppleScriptOrThrow(script);
358
+ }
359
+ archiveEmail(emailId) {
360
+ const script = scripts.archiveMessage(emailId);
361
+ executeAppleScriptOrThrow(script);
362
+ }
363
+ junkEmail(emailId) {
364
+ const script = scripts.junkMessage(emailId);
365
+ executeAppleScriptOrThrow(script);
366
+ }
367
+ markEmailRead(emailId, isRead) {
368
+ const script = scripts.setMessageReadStatus(emailId, isRead);
369
+ executeAppleScriptOrThrow(script);
370
+ }
371
+ setEmailFlag(emailId, flagStatus) {
372
+ const script = scripts.setMessageFlag(emailId, flagStatus);
373
+ executeAppleScriptOrThrow(script);
374
+ }
375
+ setEmailCategories(emailId, categories) {
376
+ const script = scripts.setMessageCategories(emailId, categories);
377
+ executeAppleScriptOrThrow(script);
378
+ }
379
+ createFolder(name, parentFolderId) {
380
+ const script = scripts.createMailFolder(name, parentFolderId);
381
+ const output = executeAppleScriptOrThrow(script);
382
+ const newFolderId = parseInt(output.trim(), 10);
383
+ return {
384
+ id: newFolderId,
385
+ name,
386
+ parentId: parentFolderId ?? null,
387
+ specialType: 0,
388
+ folderType: 1,
389
+ accountId: 1,
390
+ messageCount: 0,
391
+ unreadCount: 0,
392
+ };
393
+ }
394
+ deleteFolder(folderId) {
395
+ const script = scripts.deleteMailFolder(folderId);
396
+ executeAppleScriptOrThrow(script);
397
+ }
398
+ renameFolder(folderId, newName) {
399
+ const script = scripts.renameMailFolder(folderId, newName);
400
+ executeAppleScriptOrThrow(script);
401
+ }
402
+ moveFolder(folderId, destinationParentId) {
403
+ const script = scripts.moveMailFolder(folderId, destinationParentId);
404
+ executeAppleScriptOrThrow(script);
405
+ }
406
+ emptyFolder(folderId) {
407
+ const script = scripts.emptyMailFolder(folderId);
408
+ executeAppleScriptOrThrow(script);
409
+ }
410
+ }
411
+ /**
412
+ * Creates an AppleScript-based repository.
413
+ */
414
+ export function createAppleScriptRepository() {
415
+ return new AppleScriptRepository();
416
+ }
417
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/applescript/repository.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;GAEG;AACH,SAAS,gBAAgB,CAAC,QAAgB;IACxC,QAAQ,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,CAAC,CAAC;QACX,KAAK,KAAK;YACR,OAAO,CAAC,CAAC,CAAC;QACZ;YACE,OAA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,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,WAAW,CAAC,QAAgB;QAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACjD,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,IAAI,qBAAqB,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,242 @@
1
+ /**
2
+ * AppleScript template strings for Outlook operations.
3
+ *
4
+ * All scripts output data in a delimiter-based format for reliable parsing:
5
+ * - Records are separated by {{RECORD}}
6
+ * - Fields are separated by {{FIELD}}
7
+ * - Field names and values are separated by {{=}}
8
+ *
9
+ * Example output: {{RECORD}}id{{=}}1{{FIELD}}name{{=}}Inbox{{FIELD}}unread{{=}}5{{RECORD}}...
10
+ */
11
+ export declare const DELIMITERS: {
12
+ readonly RECORD: "{{RECORD}}";
13
+ readonly FIELD: "{{FIELD}}";
14
+ readonly EQUALS: "{{=}}";
15
+ readonly NULL: "{{NULL}}";
16
+ };
17
+ /**
18
+ * Lists all mail folders with their properties.
19
+ */
20
+ export declare const LIST_MAIL_FOLDERS = "\ntell application \"Microsoft Outlook\"\n set output to \"\"\n set allFolders to mail folders\n repeat with f in allFolders\n try\n set fId to id of f\n set fName to name of f\n set uCount to unread count of f\n set output to output & \"{{RECORD}}id{{=}}\" & fId & \"{{FIELD}}name{{=}}\" & fName & \"{{FIELD}}unreadCount{{=}}\" & uCount\n end try\n end repeat\n return output\nend tell\n";
21
+ /**
22
+ * Gets messages from a specific folder.
23
+ */
24
+ export declare function listMessages(folderId: number, limit: number, offset: number, unreadOnly: boolean): string;
25
+ /**
26
+ * Searches messages by query.
27
+ */
28
+ export declare function searchMessages(query: string, folderId: number | null, limit: number): string;
29
+ /**
30
+ * Gets a single message by ID with full content.
31
+ */
32
+ export declare function getMessage(messageId: number): string;
33
+ /**
34
+ * Gets unread count for a folder.
35
+ */
36
+ export declare function getUnreadCount(folderId: number): string;
37
+ /**
38
+ * Lists all calendars.
39
+ */
40
+ export declare const LIST_CALENDARS = "\ntell application \"Microsoft Outlook\"\n set output to \"\"\n set allCalendars to calendars\n repeat with c in allCalendars\n try\n set cId to id of c\n set cName to name of c\n set output to output & \"{{RECORD}}id{{=}}\" & cId & \"{{FIELD}}name{{=}}\" & cName\n end try\n end repeat\n return output\nend tell\n";
41
+ /**
42
+ * Lists events from a calendar within a date range.
43
+ */
44
+ export declare function listEvents(calendarId: number | null, startDate: string | null, endDate: string | null, limit: number): string;
45
+ /**
46
+ * Gets a single event by ID.
47
+ */
48
+ export declare function getEvent(eventId: number): string;
49
+ /**
50
+ * Searches events by query.
51
+ */
52
+ export declare function searchEvents(query: string, limit: number): string;
53
+ /**
54
+ * Recurrence parameters for AppleScript generation.
55
+ */
56
+ export interface RecurrenceScriptParams {
57
+ readonly frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
58
+ readonly interval: number;
59
+ readonly daysOfWeek?: readonly string[];
60
+ readonly dayOfMonth?: number;
61
+ readonly weekOfMonth?: string;
62
+ readonly dayOfWeekMonthly?: string;
63
+ readonly endDate?: {
64
+ readonly year: number;
65
+ readonly month: number;
66
+ readonly day: number;
67
+ readonly hours: number;
68
+ readonly minutes: number;
69
+ };
70
+ readonly endAfterCount?: number;
71
+ }
72
+ /**
73
+ * Parameters for responding to an event invitation (RSVP).
74
+ */
75
+ export interface RespondToEventParams {
76
+ readonly eventId: number;
77
+ readonly response: 'accept' | 'decline' | 'tentative';
78
+ readonly sendResponse: boolean;
79
+ readonly comment?: string;
80
+ }
81
+ /**
82
+ * Responds to an event invitation (RSVP).
83
+ */
84
+ export declare function respondToEvent(params: RespondToEventParams): string;
85
+ /**
86
+ * Parameters for deleting an event.
87
+ */
88
+ export interface DeleteEventParams {
89
+ readonly eventId: number;
90
+ readonly applyTo: 'this_instance' | 'all_in_series';
91
+ }
92
+ /**
93
+ * Deletes an event. For recurring events, can delete single instance or entire series.
94
+ */
95
+ export declare function deleteEvent(params: DeleteEventParams): string;
96
+ /**
97
+ * Parameters for updating an event.
98
+ */
99
+ export interface UpdateEventParams {
100
+ readonly eventId: number;
101
+ readonly applyTo: 'this_instance' | 'all_in_series';
102
+ readonly updates: {
103
+ readonly title?: string;
104
+ readonly startDate?: string;
105
+ readonly endDate?: string;
106
+ readonly location?: string;
107
+ readonly description?: string;
108
+ readonly isAllDay?: boolean;
109
+ };
110
+ }
111
+ /**
112
+ * Updates an event. For recurring events, can update single instance or entire series.
113
+ * All update fields are optional - only specified fields will be updated.
114
+ */
115
+ export declare function updateEvent(params: UpdateEventParams): string;
116
+ /**
117
+ * Creates a new calendar event.
118
+ * Uses component-based date construction for locale safety.
119
+ */
120
+ export declare function createEvent(params: {
121
+ title: string;
122
+ startYear: number;
123
+ startMonth: number;
124
+ startDay: number;
125
+ startHours: number;
126
+ startMinutes: number;
127
+ endYear: number;
128
+ endMonth: number;
129
+ endDay: number;
130
+ endHours: number;
131
+ endMinutes: number;
132
+ calendarId?: number;
133
+ location?: string;
134
+ description?: string;
135
+ isAllDay?: boolean;
136
+ recurrence?: RecurrenceScriptParams;
137
+ }): string;
138
+ /**
139
+ * Lists all contacts.
140
+ */
141
+ export declare function listContacts(limit: number, offset: number): string;
142
+ /**
143
+ * Searches contacts by name.
144
+ */
145
+ export declare function searchContacts(query: string, limit: number): string;
146
+ /**
147
+ * Gets a single contact by ID with full details.
148
+ */
149
+ export declare function getContact(contactId: number): string;
150
+ /**
151
+ * Lists all tasks.
152
+ */
153
+ export declare function listTasks(limit: number, offset: number, includeCompleted: boolean): string;
154
+ /**
155
+ * Searches tasks by name.
156
+ */
157
+ export declare function searchTasks(query: string, limit: number): string;
158
+ /**
159
+ * Gets a single task by ID.
160
+ */
161
+ export declare function getTask(taskId: number): string;
162
+ /**
163
+ * Lists all notes.
164
+ */
165
+ export declare function listNotes(limit: number, offset: number): string;
166
+ /**
167
+ * Searches notes by name.
168
+ */
169
+ export declare function searchNotes(query: string, limit: number): string;
170
+ /**
171
+ * Gets a single note by ID.
172
+ */
173
+ export declare function getNote(noteId: number): string;
174
+ /**
175
+ * Moves a message to a different folder.
176
+ */
177
+ export declare function moveMessage(messageId: number, destinationFolderId: number): string;
178
+ /**
179
+ * Moves a message to the Deleted Items folder.
180
+ */
181
+ export declare function deleteMessage(messageId: number): string;
182
+ /**
183
+ * Moves a message to the Archive folder.
184
+ * Falls back to an "Archive" named folder if the well-known folder isn't available.
185
+ */
186
+ export declare function archiveMessage(messageId: number): string;
187
+ /**
188
+ * Moves a message to the Junk folder.
189
+ */
190
+ export declare function junkMessage(messageId: number): string;
191
+ /**
192
+ * Sets the read status of a message.
193
+ */
194
+ export declare function setMessageReadStatus(messageId: number, isRead: boolean): string;
195
+ /**
196
+ * Sets the flag status of a message.
197
+ * flagStatus: 0 = none, 1 = flagged, 2 = completed
198
+ */
199
+ export declare function setMessageFlag(messageId: number, flagStatus: number): string;
200
+ /**
201
+ * Sets categories on a message.
202
+ */
203
+ export declare function setMessageCategories(messageId: number, categories: string[]): string;
204
+ /**
205
+ * Creates a new mail folder.
206
+ */
207
+ export declare function createMailFolder(name: string, parentFolderId: number | undefined): string;
208
+ /**
209
+ * Deletes a mail folder.
210
+ */
211
+ export declare function deleteMailFolder(folderId: number): string;
212
+ /**
213
+ * Renames a mail folder.
214
+ */
215
+ export declare function renameMailFolder(folderId: number, newName: string): string;
216
+ /**
217
+ * Moves a mail folder to a new parent.
218
+ */
219
+ export declare function moveMailFolder(folderId: number, destinationParentId: number): string;
220
+ /**
221
+ * Deletes all messages in a folder (empties the folder).
222
+ */
223
+ export declare function emptyMailFolder(folderId: number): string;
224
+ export interface SendEmailParams {
225
+ readonly to: readonly string[];
226
+ readonly subject: string;
227
+ readonly body: string;
228
+ readonly bodyType: 'plain' | 'html';
229
+ readonly cc?: readonly string[];
230
+ readonly bcc?: readonly string[];
231
+ readonly replyTo?: string;
232
+ readonly attachments?: readonly {
233
+ path: string;
234
+ name?: string;
235
+ }[];
236
+ readonly accountId?: number;
237
+ }
238
+ /**
239
+ * Sends an email with optional CC, BCC, attachments, and account selection.
240
+ */
241
+ export declare function sendEmail(params: SendEmailParams): string;
242
+ //# sourceMappingURL=scripts.d.ts.map