Skip to content

Align Node SDK browse types with JavaScript SDK #268

Description

@BBlackwo

The Node SDK browse types diverge from the JavaScript SDK:

  • Node BrowseParameters is missing filterMatchTypes?: Record<string, 'all' | 'any' | 'none'>, which exists in JS IBrowseParameters.

  • Node VariationsMap differs from the JS VariationsMap:

    • group_by is required in Node but optional in JS.
    • JS supports filter_by, which is missing in Node.
    • Node only supports first | min | max | all aggregations.
    • JS additionally supports count | field_count | value_count.
    • JS value_count entries support a value: string | number | boolean field.
  • Node GetBrowseResultsResponse differs from the JS GetBrowseResultsResponse:

    • Node makes request and response optional and wraps them in Partial<>; JS requires both and uses complete response data types.
    • Node makes result_id optional; JS requires it.
    • Node response collections are partial:
      • result_sources: Partial<ResultSources>
      • facets: Partial<Facet>[]
      • groups: Partial<Group>[]
      • results: Partial<BrowseResultData>[]
      • sort_options: Partial<SortOption>[]
      • features: Partial<Feature>[]
      • collection: Partial<Collection>
    • The JS type makes those collections complete, while collection is optional.
    • JS additionally exposes optional related_searches and related_browse_pages.
    • Node requires BrowseResultData.variations and variations_map; JS makes both optional and uses VariationsMapResponse for variations_map.
  • The nested Node BrowseRequestType also differs from the JS BrowseRequestType: Node requires fields such as filter_match_types, filters, and query, while JS makes filter_match_types, filters, and query optional and includes facet_name.

This prevents sharing browse models between server and client without type assertions. It would be great to align them, thanks!

🤖 I used a clanker to write this but have verified myself that it's all correct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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