Conversation
Sweeps the same two HaloPSA quirks across every resource — not just
tickets/actions:
1. Single-resource GET endpoints (`GET /<Entity>/{id}`) sometimes return
the entity bare and sometimes wrap it in a list-style envelope
(`{ entities: [{...}] }`). 26 `.get()` methods were unwrapping
unconditionally and would crash with "Cannot read properties of
undefined (reading '0')" against any tenant returning the bare shape.
2. HaloPSA silently ignores `page_size`/`page_no` unless `pageinate=true`
is sent alongside, so caller-supplied page sizes were capped at the
server default of 50 across every list endpoint.
Both behaviors are now centralized in `src/resources/utils.ts`
(`unwrapSingle`, `addPageinate`, `buildListParams`); resources delegate
to the shared helpers so future endpoints inherit the fix automatically.
Covers: actions, agents, appointments, assets, clients, contacts,
contracts, invoices, items, opportunities, projects, quotes, reference
(ticket types, statuses, priorities, categories, SLAs, custom fields,
user roles, KB articles, recurring invoices, reports, software
licences), sites, suppliers, teams, tickets.
github-actions Bot
pushed a commit
that referenced
this pull request
May 7, 2026
## [1.0.3](v1.0.2...v1.0.3) (2026-05-07) ### Bug Fixes * **resources:** apply bare-response and pageinate fixes to all resources ([#3](#3)) ([46af9cb](46af9cb))
3 tasks
asachs01
added a commit
to wyre-technology/halopsa-mcp
that referenced
this pull request
May 7, 2026
Picks up the SDK-wide bare-response and pageinate fixes from wyre-technology/node-halopsa#3 — every resource's `.get()` and list endpoint now handles HaloPSA's quirks consistently, not just tickets and actions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The two HaloPSA quirks fixed in #2 (bare-vs-wrapped single GET response shape, and the
pageinate=truerequirement forpage_size/page_no) existed in every resource, not just tickets/actions. This PR sweeps them across the SDK.src/resources/utils.ts:unwrapSingle<T>(response, listKey)— accepts either bare entity or wrapped list shapeaddPageinate(params)— adds the literalpageinate: trueflag when paging is requestedbuildListParams(params)— camelCase→snake_case conversion + addPageinate.get()methods (across 16 resource files including reference's nested classes) now useunwrapSinglebuildListParamsmethods delegate to the shared helperResources covered
actions, agents, appointments, assets (incl. AssetType), clients, contacts, contracts, invoices, items, opportunities, projects, quotes, reference (ticket types, statuses, priorities, categories, SLAs, custom fields, user roles, KB articles, recurring invoices, reports, software licences), sites, suppliers, teams, tickets.
Test plan
npm run buildnpm test(79 tests pass — added 10 new tests for the helpers).get()calls on a real HaloPSA tenant after release