@mulmoclaude/core 1.4.0 → 1.5.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.
@@ -11,5 +11,5 @@ export { buildEventPatch, calendarApiError, collectCalendarPages, createCalendar
11
11
  export { calendarSyncStatePath, clearCalendarSyncToken, loadCalendarSyncToken, saveCalendarSyncToken } from './calendarSyncStore.js';
12
12
  export { toCollectionDateTime } from './collectionDateTime.js';
13
13
  export { googleCalendarSyncTaskDef, classifyDelete, classifyWrite, anySyncedCollectionSurvives, groupByCalendar, orphanedCalendarId, releaseOrphanedCalendarToken, syncCalendarForCollection, syncCalendarGroup, syncDueCalendarCollections, syncNewCalendarCollections, toCollectionRecord, unsyncedGroups, withKeyedLock, GOOGLE_CALENDAR_SYNC_TASK_ID, type CalendarCollectionSyncResult, type CalendarDeclaring, type ManualCalendarSyncDeps, type ManualCalendarSyncOutcome, } from './collectionSync.js';
14
- export { buildTaskPatch, canonicalTaskListId, completeTask, createTask, deleteTask, listTaskLists, listTasks, toTaskListSummary, toTaskSummary, updateTask, type CompleteTaskInput, type CreateTaskInput, type ListTasksInput, type TaskListSummary, type TaskSummary, type UpdateTaskInput, } from './tasks.js';
14
+ export { buildTaskPatch, canonicalTaskListId, completeTask, createTask, deleteTask, listTaskLists, listTasks, toTaskListSummary, toTaskSummary, uncompleteTask, updateTask, type CompleteTaskInput, type CreateTaskInput, type ListTasksInput, type TaskListSummary, type TaskSummary, type UpdateTaskInput, } from './tasks.js';
15
15
  export { assertSafeMimeType, buildMultipartBody, createDriveFile, deleteDriveFile, isTextMimeType, listDriveFiles, pickBoundary, readDriveFile, toDriveFileSummary, type CreateDriveFileInput, type DriveFileSummary, type ListDriveFilesInput, type ReadDriveFileInput, } from './driveFile.js';
@@ -1175,6 +1175,7 @@ var TASKS_BASE_URL = "https://tasks.googleapis.com/tasks/v1";
1175
1175
  var TASKS_API_LABEL = "Google Tasks API";
1176
1176
  var DEFAULT_TASK_LIST_ID = "@default";
1177
1177
  var TASK_STATUS_COMPLETED = "completed";
1178
+ var TASK_STATUS_NEEDS_ACTION = "needsAction";
1178
1179
  var MAX_TASK_LISTS = 50;
1179
1180
  var toTaskListSummary = (value) => {
1180
1181
  const record = asRecord(value);
@@ -1222,8 +1223,9 @@ async function createTask(accessToken, input) {
1222
1223
  }
1223
1224
  /** PATCH body for a task edit — only the fields the caller supplied. As with
1224
1225
  * events, `undefined` means "leave as is" and `""` means "clear it", so the
1225
- * two must stay distinct. `status` is deliberately absent: `completeTask`
1226
- * owns that transition, and two ways to set it would drift apart. */
1226
+ * two must stay distinct. `status` is deliberately absent: `completeTask` /
1227
+ * `uncompleteTask` own that transition, and two ways to set it would drift
1228
+ * apart. */
1227
1229
  var buildTaskPatch = (input) => ({
1228
1230
  ...input.title !== void 0 ? { title: input.title } : {},
1229
1231
  ...input.notes !== void 0 ? { notes: input.notes } : {},
@@ -1241,6 +1243,25 @@ async function completeTask(accessToken, input) {
1241
1243
  body: JSON.stringify({ status: TASK_STATUS_COMPLETED })
1242
1244
  }));
1243
1245
  }
1246
+ /** Send a completed task back to the to-do list.
1247
+ *
1248
+ * Its own function rather than a flag on `completeTask`, and deliberately not
1249
+ * a `status` field on `updateTask`: one kind per target state keeps the name
1250
+ * honest and leaves exactly one code path setting each value.
1251
+ *
1252
+ * The patch carries `status` alone — mirroring `completeTask`, which also
1253
+ * sets only `status` and lets Google fill in the `completed` timestamp. Note
1254
+ * that whether Google *clears* that timestamp on the way back is its
1255
+ * behaviour, not ours, and is unverified here: `TaskSummary` doesn't carry
1256
+ * `completed`, so nothing in this codebase would show a stale one. If a
1257
+ * reopened task ever displays a completion date in Google's own UI, this is
1258
+ * the place to add `completed: null` to the patch. */
1259
+ async function uncompleteTask(accessToken, input) {
1260
+ return toTaskSummary(await googleRequest(TASKS_API_LABEL, accessToken, tasksUrl(input.taskListId, `/${encodeURIComponent(input.taskId)}`), {
1261
+ method: "PATCH",
1262
+ body: JSON.stringify({ status: TASK_STATUS_NEEDS_ACTION })
1263
+ }));
1264
+ }
1244
1265
  async function deleteTask(accessToken, input) {
1245
1266
  await googleRequest(TASKS_API_LABEL, accessToken, tasksUrl(input.taskListId, `/${encodeURIComponent(input.taskId)}`), { method: "DELETE" });
1246
1267
  }
@@ -1338,6 +1359,6 @@ async function deleteDriveFile(accessToken, input) {
1338
1359
  await googleRequest(DRIVE_API_LABEL, accessToken, `${DRIVE_FILES_URL}/${encodeURIComponent(input.fileId)}`, { method: "DELETE" });
1339
1360
  }
1340
1361
  //#endregion
1341
- export { DEFAULT_LIST_MAX_RESULTS, GOOGLE_AUTH_CANCELLED, GOOGLE_CALENDARLIST_SCOPE, GOOGLE_CALENDAR_SCOPE, GOOGLE_CALENDAR_SYNC_TASK_ID, GOOGLE_DRIVE_FILE_SCOPE, GOOGLE_SCOPES, GOOGLE_TASKS_SCOPE, GoogleApiError, MAX_LIST_RESULTS, anySyncedCollectionSurvives, assertSafeMimeType, authorizeGoogle, brokerBaseUrl, brokerExchange, brokerRefresh, brokerStart, buildEventPatch, buildMultipartBody, buildTaskPatch, calendarApiError, calendarSyncStatePath, canonicalCalendarId, canonicalTaskListId, classifyDelete, classifyWrite, clearCalendarSyncToken, clientSecretPresence, collectCalendarPages, commitLinkedTokens, completeTask, configureGoogleHost, createCalendarEvent, createDriveFile, createGoogleAuthFlow, createTask, deleteCalendarEvent, deleteDriveFile, deleteGoogleTokens, deleteTask, findClientSecretPath, getCalendarColors, getGoogleAccessToken, googleApiError, googleAuthFlow, googleCalendarSyncTaskDef, googleConfigDir, googleSecretsDir, googleTokenPath, groupByCalendar, isGoogleApiError, isIsoDateTimeWithOffset, isTextMimeType, legacyGoogleTokenPath, listCalendarEvents, listCalendars, listDriveFiles, listTaskLists, listTasks, loadCalendarSyncToken, loadClientSecret, loadGoogleTokens, mergeGoogleTokens, orphanedCalendarId, pickBoundary, readDriveFile, releaseOrphanedCalendarToken, saveCalendarSyncToken, saveGoogleTokens, syncCalendarEvents, syncCalendarForCollection, syncCalendarGroup, syncDueCalendarCollections, syncNewCalendarCollections, toCalendarSummary, toCollectionDateTime, toCollectionRecord, toDriveFileSummary, toEventSummary, toTaskListSummary, toTaskSummary, unlinkGoogle, unsyncedGroups, updateCalendarEvent, updateTask, waitForAuthCode, withKeyedLock };
1362
+ export { DEFAULT_LIST_MAX_RESULTS, GOOGLE_AUTH_CANCELLED, GOOGLE_CALENDARLIST_SCOPE, GOOGLE_CALENDAR_SCOPE, GOOGLE_CALENDAR_SYNC_TASK_ID, GOOGLE_DRIVE_FILE_SCOPE, GOOGLE_SCOPES, GOOGLE_TASKS_SCOPE, GoogleApiError, MAX_LIST_RESULTS, anySyncedCollectionSurvives, assertSafeMimeType, authorizeGoogle, brokerBaseUrl, brokerExchange, brokerRefresh, brokerStart, buildEventPatch, buildMultipartBody, buildTaskPatch, calendarApiError, calendarSyncStatePath, canonicalCalendarId, canonicalTaskListId, classifyDelete, classifyWrite, clearCalendarSyncToken, clientSecretPresence, collectCalendarPages, commitLinkedTokens, completeTask, configureGoogleHost, createCalendarEvent, createDriveFile, createGoogleAuthFlow, createTask, deleteCalendarEvent, deleteDriveFile, deleteGoogleTokens, deleteTask, findClientSecretPath, getCalendarColors, getGoogleAccessToken, googleApiError, googleAuthFlow, googleCalendarSyncTaskDef, googleConfigDir, googleSecretsDir, googleTokenPath, groupByCalendar, isGoogleApiError, isIsoDateTimeWithOffset, isTextMimeType, legacyGoogleTokenPath, listCalendarEvents, listCalendars, listDriveFiles, listTaskLists, listTasks, loadCalendarSyncToken, loadClientSecret, loadGoogleTokens, mergeGoogleTokens, orphanedCalendarId, pickBoundary, readDriveFile, releaseOrphanedCalendarToken, saveCalendarSyncToken, saveGoogleTokens, syncCalendarEvents, syncCalendarForCollection, syncCalendarGroup, syncDueCalendarCollections, syncNewCalendarCollections, toCalendarSummary, toCollectionDateTime, toCollectionRecord, toDriveFileSummary, toEventSummary, toTaskListSummary, toTaskSummary, uncompleteTask, unlinkGoogle, unsyncedGroups, updateCalendarEvent, updateTask, waitForAuthCode, withKeyedLock };
1342
1363
 
1343
1364
  //# sourceMappingURL=index.js.map