Skip to content

List operations model no query params (query?: never) — no typed paging/filtering; invalid filter operators can't be caught #3

Description

@Rich107

Summary

The generated list operations for collection endpoints model no query parameters (query?: never), so there is no typed way to page or filter collections. Consumers are forced to bypass the typed SDK and hand-write query params against the untyped raw transport — with zero type-safety, which recently let an invalid Actionstep filter operator ship to production undetected.

Where

In dist/clients/*/types.gen.d.ts the list operations declare query?: never:

// clients/actions/types.gen.d.ts
export type GetActionsData = {
  body?: never;
  path?: never;
  query?: never;          // ← no paging / no filtering modelled
  url: "/actions";
};

Same for:

  • GetParticipantsData (clients/participants/types.gen.d.ts) — query?: never
  • GetActionparticipantsData (clients/actionparticipants/types.gen.d.ts) — query?: never

(observed in @forsyteco/actionstep-client-typescript@0.1.6)

Impact

Actionstep collection endpoints do support paging and filtering as query params — documented at https://docs.actionstep.com/api-requests/ :

  • Paging: page, pageSize (default 50, max 200)
  • Filtering (field-operator form): {field}{operator}={value} where Datetime operators are _eq / _nteq / _in / _ntin / _gt / _lt / _gteq / _lteq (e.g. createdTimestamp_gteq=…&createdTimestamp_lteq=…)
  • Filtering (SQL-like form): filter=status ilike '%active%' AND priority > 0

Because the generated types expose none of these, a consumer must call the raw transport (requestWithResponse(scoped, { url: "/actions", query: { … } })) and hand-build the query object. With query typed as Record<string, unknown>, TypeScript cannot validate operator names — we shipped createdTimestamp_gte/_lte (invalid; the correct operators are _gteq/_lteq), Actionstep silently ignored the unknown params and returned the entire tenant on every request. A typed query model would have caught this at compile time.

Endpoint reference

Suggested fix

Model the collection query params in the generated types (from the OpenAPI spec's parameters, or a hand-authored augmentation if the upstream spec omits them):

  • page?: number, pageSize?: number
  • the field-operator filter params (or at least a typed filter?: string for the SQL-like form)
  • ideally a typed operator suffix union for filterable fields so _gte vs _gteq mistakes fail to compile

At minimum, adding page/pageSize and a typed filter string to the list ops would remove the need to drop to the untyped transport for the common case.

Repro

  1. import { getActions } from "@forsyteco/actionstep-client-typescript" — observe there is no way to pass page, pageSize, or a filter.
  2. Fall back to the raw transport and pass any misspelled operator (e.g. createdTimestamp_gte) — it compiles, and Actionstep returns unfiltered results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions