diff --git a/package.json b/package.json index e578003..883e038 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@makeplane/plane-node-sdk", - "version": "0.2.9", + "version": "0.2.10", "description": "Node SDK for Plane", "author": "Plane ", "repository": { diff --git a/src/models/WorkItem.ts b/src/models/WorkItem.ts index 95e8fc8..2c264b6 100644 --- a/src/models/WorkItem.ts +++ b/src/models/WorkItem.ts @@ -87,6 +87,7 @@ export interface ListWorkItemsParams { assignee?: string; limit?: number; offset?: number; + pql?: string; } export interface WorkItemActivity { diff --git a/tests/unit/work-items/work-items.test.ts b/tests/unit/work-items/work-items.test.ts index b67e9be..024600e 100644 --- a/tests/unit/work-items/work-items.test.ts +++ b/tests/unit/work-items/work-items.test.ts @@ -82,6 +82,38 @@ describe(!!(config.workspaceSlug && config.projectId && config.userId), "Work It expect(foundWorkItem).toBeDefined(); }); + it("should list work items with pql filter", async () => { + const name = randomizeName(); + let pqlWorkItem: WorkItem | undefined; + + try { + pqlWorkItem = await client.workItems.create(workspaceSlug, projectId, { + name, + priority: "high", + }); + + const filtered = await client.workItems.list(workspaceSlug, projectId, { + pql: 'priority IN ("high")', + }); + + expect(filtered).toBeDefined(); + expect(Array.isArray(filtered.results)).toBe(true); + expect(filtered.results.length).toBeGreaterThan(0); + expect(filtered.results.find((wi) => wi.id === pqlWorkItem!.id)).toBeDefined(); + for (const wi of filtered.results) { + expect(wi.priority).toBe("high"); + } + } finally { + if (pqlWorkItem?.id) { + try { + await client.workItems.delete(workspaceSlug, projectId, pqlWorkItem.id); + } catch { + // Best-effort cleanup to avoid polluting subsequent test runs. + } + } + } + }); + it("should retrieve work item by identifier", async () => { const project = await client.projects.retrieve(workspaceSlug, projectId); const workItemByIdentifier = await client.workItems.retrieveByIdentifier(