| 707 | ]; |
| 708 | |
| 709 | export class TaskNotesAPI implements TaskNotesRuntimeApiV1 { |
| 710 | readonly apiVersion = TASKNOTES_RUNTIME_API_VERSION; |
| 711 | |
| 712 | readonly model = { |
| 713 | info: () => ({ |
| 714 | packageName: "@tasknotes/model" as const, |
| 715 | specVersion: TASKNOTES_SPEC_VERSION, |
| 716 | runtimeApiVersion: this.apiVersion, |
| 717 | }), |
| 718 | config: () => this.getModelConfig(), |
| 719 | validateTask: (task: Partial<TaskInfo>) => this.validateTask(task), |
| 720 | validatePatch: (patch: TaskNotesTaskPatch) => this.validateTaskPatch(patch), |
| 721 | }; |
| 722 | |
| 723 | readonly catalog = { |
| 724 | statuses: () => this.getStatuses(), |
| 725 | priorities: () => this.getPriorities(), |
| 726 | userFields: () => this.getUserFields(), |
| 727 | fields: () => this.getFieldDefinitions(), |
| 728 | writableFields: () => this.getFieldDefinitions().filter((field) => field.writable), |
| 729 | filterProperties: () => this.getFilterPropertyDefinitions(), |
| 730 | filterOperators: () => FILTER_OPERATOR_DEFINITIONS.map((operator) => ({ ...operator })), |
| 731 | relationships: () => RELATIONSHIP_DEFINITIONS.map((relationship) => ({ ...relationship })), |
| 732 | dependencyRelTypes: () => |
| 733 | DEPENDENCY_REL_TYPE_DEFINITIONS.map((relationshipType) => ({ ...relationshipType })), |
| 734 | events: () => this.events.list(), |
| 735 | }; |
| 736 | |
| 737 | readonly tasks = { |
| 738 | get: (path: string) => this.getTask(path), |
| 739 | list: (query?: TaskNotesRuntimeTaskQuery) => this.listTasks(query), |
| 740 | create: (taskData: TaskCreationData, context?: TaskNotesMutationContext) => |
| 741 | this.createTask(taskData, context), |
| 742 | update: (path: string, patch: TaskNotesTaskPatch, context?: TaskNotesMutationContext) => |
| 743 | this.updateTask(path, patch, context), |
| 744 | patch: (path: string, patch: TaskNotesTaskPatch, context?: TaskNotesMutationContext) => |
| 745 | this.updateTask(path, patch, context), |
| 746 | delete: (path: string, context?: TaskNotesMutationContext) => |
| 747 | this.deleteTask(path, context), |
| 748 | complete: ( |
| 749 | path: string, |
| 750 | options?: CompleteTaskOptions, |
| 751 | context?: TaskNotesMutationContext |
| 752 | ) => this.completeTask(path, options, context), |
| 753 | uncomplete: ( |
| 754 | path: string, |
| 755 | options?: UncompleteTaskOptions, |
| 756 | context?: TaskNotesMutationContext |
| 757 | ) => this.uncompleteTask(path, options, context), |
| 758 | setStatus: (path: string, status: string, context?: TaskNotesMutationContext) => |
| 759 | this.setTaskProperty(path, "status", status, context), |
| 760 | setPriority: (path: string, priority: string, context?: TaskNotesMutationContext) => |
| 761 | this.setTaskProperty(path, "priority", priority, context), |
| 762 | setDue: (path: string, date: string, context?: TaskNotesMutationContext) => |
| 763 | this.setTaskProperty(path, "due", date, context), |
| 764 | clearDue: (path: string, context?: TaskNotesMutationContext) => |
| 765 | this.setTaskProperty(path, "due", undefined, context), |
| 766 | setScheduled: (path: string, date: string, context?: TaskNotesMutationContext) => |
nothing calls this directly
no test coverage detected