Skip to content

Core-aligned APIs, options-based create(), and normalized list returns

Choose a tag to compare

released this 20 Oct 17:25
· 33 commits to working since this release

This release aligns adapter/provider APIs with @fjell/core types, switches create flows to use options, adds facet parameters, and standardizes list return values.

API Changes

  • AItemAdapter

    • ContextType.addAllFacets now uses Faceted.AllFacetMethod (src/AItemAdapter.tsx).
  • AItems

    • Import core operation method aliases from @fjell/core and switch ContextType methods to use core types (facet/find/findOne/update/remove/action) (src/AItems.tsx).
  • Contained adapters/providers

    • CItemAdapter.create now accepts options: CreateOptions and forwards them to cache.operations.create; logging derives locations from options.locations (src/contained/CItemAdapter.tsx).
    • Widened locations params to LocKeyArray | [] for all/one/allAction/find/findOne (src/contained/CItemAdapter.tsx).
    • facet now supports params?: OperationParams and forwards to operations.facet(key, facet, params) (src/contained/CItemAdapter.tsx).
    • allFacet now forwards locations to operations.allFacet(facet, params, locations) (src/contained/CItemAdapter.tsx).
    • CItemQuery and CItemsProvider now pass create options as { locations: parentLocations } instead of a raw LocKeyArray (src/contained/CItemQuery.tsx, src/contained/CItemsProvider.tsx).
    • In CItemsProvider, action and facet calls drop the parentLocations argument; allFacet casts parentLocations when forwarding (src/contained/CItemsProvider.tsx).

Behavior Changes

  • Primary adapter list/find normalization

    • PItemAdapter.all() and .find() now return Promise<V[]> and default to [] for null/undefined/invalid results; debug messages updated accordingly (src/primary/PItemAdapter.tsx).
  • Logging and error handling

    • CItemsProvider replaces verbose logger.error payloads with concise console.error messages that include message/code/validOptions (src/contained/CItemsProvider.tsx).
    • ErrorTransformer no longer passes the unused context to createGenericError (src/utils/errorTransform.ts).

Testing Updates

  • Tests updated to match new signatures and behaviors (tests/*):
    • create calls now use options: { locations }.
    • facet/allFacet expectations include third arg as undefined where applicable.
    • action/facet call arity updated to reflect removed parentLocations.
    • PItemAdapter expectations updated to [] (not null) for empty results.

Notes for Upgraders

  • If your code relied on null from PItemAdapter.all()/find(), update it to handle an empty array [].
  • Update create calls to pass an options object (e.g., { locations }) rather than a raw LocKeyArray.
  • If calling action/facet via CItemsProvider, remove parentLocations from those calls as the provider no longer forwards it.