From f0001220f84b7f5449d9c752e07518f01826e43b Mon Sep 17 00:00:00 2001 From: Beau Cameron Date: Fri, 12 Apr 2024 08:50:18 -0600 Subject: [PATCH 1/3] Updating Presets Clashing interface names, decided to change todo interface and class names. Updating Presets --- docs/graph/to-do.md | 2 +- packages/graph/presets/all.ts | 73 ++++++++++++++++++++++------------- packages/graph/to-do/index.ts | 10 ++--- packages/graph/to-do/types.ts | 54 +++++++++++++------------- test/graph/to-do.ts | 4 +- 5 files changed, 81 insertions(+), 62 deletions(-) diff --git a/docs/graph/to-do.md b/docs/graph/to-do.md index 449810e37..4cd6d36c8 100644 --- a/docs/graph/to-do.md +++ b/docs/graph/to-do.md @@ -6,7 +6,7 @@ More information can be found in the official Graph documentation: - [To-do Resource Type](https://learn.microsoft.com/en-us/graph/api/resources/todo-overview?view=graph-rest-1.0) -## IAttachment, IAttachments, IChecklistItem, IChecklistItems, ILinkedResource, ILinkedResources, ITask, ITaskList, ITaskLists, ITodo +## ITodoAttachment, ITodoAttachments, IChecklistItem, IChecklistItems, ILinkedResource, ILinkedResources, ITodoTask, ITaskList, ITaskLists, ITodo [![Selective Imports Banner](https://img.shields.io/badge/Selective%20Imports-informational.svg)](../concepts/selective-imports.md) ## taskLists diff --git a/packages/graph/presets/all.ts b/packages/graph/presets/all.ts index e7b213db4..fb58b02e9 100644 --- a/packages/graph/presets/all.ts +++ b/packages/graph/presets/all.ts @@ -1,46 +1,67 @@ +import "../admin/index.js"; +import "../analytics/index.js"; import "../appCatalog/index.js"; import "../attachments/index.js"; import "../calendars/index.js"; import "../cloud-communications/index.js"; +import "../columns/index.js"; +import "../compliance/index.js"; import "../contacts/index.js"; +import "../content-types/index.js"; import "../conversations/index.js"; import "../directory-objects/index.js"; +import "../files/index.js"; import "../groups/index.js"; import "../insights/index.js"; import "../invitations/index.js"; -import "../members/index.js"; +import "../list-item/index.js"; +import "../lists/index.js"; import "../mail/index.js"; -import "../files/index.js"; +import "../members/index.js"; import "../onenote/index.js"; import "../operations/index.js"; +import "../permissions/index.js"; import "../photos/index.js"; +import "../places/index.js" import "../planner/index.js"; import "../search/index.js"; import "../shares/index.js"; +import "../sites/index.js"; import "../subscriptions/index.js"; -import "../teams/index.js"; +import "../taxonomy/index.js"; +import "../to-do/index.js" import "../users/index.js"; -export * from "../appCatalog/index.js"; -export * from "../attachments/index.js"; -export * from "../calendars/index.js"; -export * from "../cloud-communications/index.js"; -export * from "../contacts/index.js"; -export * from "../conversations/index.js"; -export * from "../directory-objects/index.js"; -export * from "../groups/index.js"; -export * from "../insights/index.js"; -export * from "../invitations/index.js"; -export * from "../members/index.js"; -export * from "../mail/index.js"; -export * from "../files/index.js"; -export * from "../onenote/index.js"; -export * from "../operations/index.js"; -export * from "../photos/index.js"; -export * from "../planner/index.js"; -export * from "../search/index.js"; -export * from "../shares/index.js"; -export * from "../subscriptions/index.js"; -export * from "../teams/index.js"; -export * from "../users/index.js"; -export * from "../index.js"; +export * from "../admin/index.js"; +export * from "../analytics/index.js"; +export * from "../appCatalog/index.js"; +export * from "../attachments/index.js"; +export * from "../calendars/index.js"; +export * from "../cloud-communications/index.js"; +export * from "../columns/index.js"; +export * from "../compliance/index.js"; +export * from "../contacts/index.js"; +export * from "../content-types/index.js"; +export * from "../conversations/index.js"; +export * from "../directory-objects/index.js"; +export * from "../files/index.js"; +export * from "../groups/index.js"; +export * from "../insights/index.js"; +export * from "../invitations/index.js"; +export * from "../list-item/index.js"; +export * from "../lists/index.js"; +export * from "../mail/index.js"; +export * from "../members/index.js"; +export * from "../onenote/index.js"; +export * from "../operations/index.js"; +export * from "../permissions/index.js"; +export * from "../photos/index.js"; +export * from "../places/index.js" +export * from "../planner/index.js"; +export * from "../search/index.js"; +export * from "../shares/index.js"; +export * from "../sites/index.js"; +export * from "../subscriptions/index.js"; +export * from "../taxonomy/index.js"; +export * from "../to-do/index.js"; +export * from "../users/index.js"; \ No newline at end of file diff --git a/packages/graph/to-do/index.ts b/packages/graph/to-do/index.ts index 9862db43f..cfe2406c8 100644 --- a/packages/graph/to-do/index.ts +++ b/packages/graph/to-do/index.ts @@ -1,23 +1,21 @@ import "./user.js"; export { - IAttachment, - IAttachments, + ITodoAttachment, + ITodoAttachments, IChecklistItem, IChecklistItems, ILinkedResource, ILinkedResources, - ITask, + ITodoTask, ITaskList, ITaskLists, ITodo, - Attachment, - Attachments, ChecklistItem, ChecklistItems, LinkedResource, LinkedResources, - Tasks, + ITodoTasks, TaskList, TaskLists, } from "./types.js"; diff --git a/packages/graph/to-do/types.ts b/packages/graph/to-do/types.ts index 645151a25..3902eb816 100644 --- a/packages/graph/to-do/types.ts +++ b/packages/graph/to-do/types.ts @@ -28,8 +28,8 @@ export const Todo = graphInvokableFactory(_Todo); @deleteable() @updateable() export class _TaskList extends _GraphInstance { - public get tasks(): ITasks{ - return Tasks(this); + public get tasks(): ITodoTasks{ + return TodoTasks(this); } // TODO Create Open Extension. Wait for it to be built as part of extensions module @@ -50,14 +50,14 @@ export interface ITaskLists extends _TaskLists, IGetById, IAddable(_TaskLists); /** - * Task + * TodoTask */ @deleteable() @updateable() -export class _Task extends _GraphInstance { +export class _TodoTask extends _GraphInstance { - public get attachments(): IAttachments{ - return Attachments(this); + public get attachments(): ITodoAttachments{ + return TodoAttachments(this); } public get checklistItems(): IChecklistItems{ @@ -70,51 +70,51 @@ export class _Task extends _GraphInstance { // TODO Create Open Extension. Wait for it to be built as part of extensions module // TODO Get Open Extension. Wait for it to be built as part of extensions module } -export interface ITask extends _Task, IUpdateable, IDeleteable{ } -export const Task = graphInvokableFactory(_Task); +export interface ITodoTask extends _TodoTask, IUpdateable, IDeleteable{ } +export const TodoTask = graphInvokableFactory(_TodoTask); /** - * Tasks + * TodoTasks */ @defaultPath("tasks") -@getById(Task) +@getById(TodoTask) @addable() @hasDelta() -export class _Tasks extends _GraphCollection { } -export interface ITasks extends _Tasks, IGetById, IAddable, IHasDelta, ITodoTaskType> { } -export const Tasks = graphInvokableFactory(_Tasks); +export class _TodoTasks extends _GraphCollection { } +export interface ITodoTasks extends _TodoTasks, IGetById, IAddable, IHasDelta, ITodoTaskType> { } +export const TodoTasks = graphInvokableFactory(_TodoTasks); /** - * Attachment + * TodoAttachment */ @deleteable() -export class _Attachment extends _GraphInstance { +export class _TodoAttachment extends _GraphInstance { - public get attachments(): IAttachments{ - return Attachments(this); + public get TodoAttachments(): ITodoAttachments{ + return TodoAttachments(this); } } -export interface IAttachment extends _Attachment, IDeleteable{ } -export const Attachment = graphInvokableFactory(_Attachment); +export interface ITodoAttachment extends _TodoAttachment, IDeleteable{ } +export const TodoAttachment = graphInvokableFactory(_TodoAttachment); /** - * Attachments + * TodoAttachments */ @defaultPath("attachments") -@getById(Attachment) -export class _Attachments extends _GraphCollection { +@getById(TodoAttachment) +export class _TodoAttachments extends _GraphCollection { - public async add(attachmentInfo: IAddAttachmentOptions): Promise{ + public async add(TodoAttachmentInfo: IAddTodoAttachmentOptions): Promise{ const postBody = { "@odata.type": "#microsoft.graph.taskFileAttachment", - ...attachmentInfo, + ...TodoAttachmentInfo, }; return graphPost(this, body(postBody)); } } -export interface IAttachments extends _Attachments, IGetById { } -export const Attachments = graphInvokableFactory(_Attachments); +export interface ITodoAttachments extends _TodoAttachments, IGetById { } +export const TodoAttachments = graphInvokableFactory(_TodoAttachments); /** * Checklist @@ -158,6 +158,6 @@ export interface IAddTaskListOptions{ displayName: string; } -export interface IAddAttachmentOptions extends ITodoAttachmentType{ +export interface IAddTodoAttachmentOptions extends ITodoAttachmentType{ contentBytes: string; } diff --git a/test/graph/to-do.ts b/test/graph/to-do.ts index 7897cf474..66837d3f5 100644 --- a/test/graph/to-do.ts +++ b/test/graph/to-do.ts @@ -4,14 +4,14 @@ import "@pnp/graph/to-do"; import { pnpTest } from "../pnp-test.js"; import { getRandomString, stringIsNullOrEmpty } from "@pnp/core"; import { ChecklistItem } from "@microsoft/microsoft-graph-types"; -import { ITaskList, ITask } from "@pnp/graph/to-do"; +import { ITaskList, ITodoTask } from "@pnp/graph/to-do"; import getValidUser from "./utilities/getValidUser.js"; import { IUser } from "@pnp/graph/users"; describe("To-do", function () { let user: IUser; let taskList: ITaskList; - let todoTask: ITask; + let todoTask: ITodoTask; before(pnpTest("94d99e35-9891-4b50-a23c-359a43eeadc7", async function () { From 019e610a0c10b5726021b3f512e1e6e8c1752838 Mon Sep 17 00:00:00 2001 From: Beau Cameron Date: Mon, 15 Apr 2024 08:18:08 -0600 Subject: [PATCH 2/3] Missing Semi-Colon --- packages/graph/presets/all.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graph/presets/all.ts b/packages/graph/presets/all.ts index fb58b02e9..cab6c2450 100644 --- a/packages/graph/presets/all.ts +++ b/packages/graph/presets/all.ts @@ -22,14 +22,14 @@ import "../onenote/index.js"; import "../operations/index.js"; import "../permissions/index.js"; import "../photos/index.js"; -import "../places/index.js" +import "../places/index.js"; import "../planner/index.js"; import "../search/index.js"; import "../shares/index.js"; import "../sites/index.js"; import "../subscriptions/index.js"; import "../taxonomy/index.js"; -import "../to-do/index.js" +import "../to-do/index.js"; import "../users/index.js"; export * from "../admin/index.js"; From 10ae984121c51202a793163c79d2a5f40f83518b Mon Sep 17 00:00:00 2001 From: Beau Cameron Date: Mon, 15 Apr 2024 08:20:37 -0600 Subject: [PATCH 3/3] EsLint --- packages/graph/presets/all.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graph/presets/all.ts b/packages/graph/presets/all.ts index cab6c2450..6c08ef8c8 100644 --- a/packages/graph/presets/all.ts +++ b/packages/graph/presets/all.ts @@ -56,7 +56,7 @@ export * from "../onenote/index.js"; export * from "../operations/index.js"; export * from "../permissions/index.js"; export * from "../photos/index.js"; -export * from "../places/index.js" +export * from "../places/index.js"; export * from "../planner/index.js"; export * from "../search/index.js"; export * from "../shares/index.js"; @@ -64,4 +64,4 @@ export * from "../sites/index.js"; export * from "../subscriptions/index.js"; export * from "../taxonomy/index.js"; export * from "../to-do/index.js"; -export * from "../users/index.js"; \ No newline at end of file +export * from "../users/index.js";