Skip to content

Client API 4.4.34 — path-building simplification, affected-items typing, linting & CI updates

Choose a tag to compare

released this 09 Oct 22:12
· 47 commits to working since this release

This release advances the client API with three primary themes: clarifying and consolidating internal path construction, formalizing the "affected items" tuple in the public API types and docs, and tightening developer workflows (linting, tests, and CI/publish). The work is focused on removing duplicated/contradictory logic, aligning code and tests with normalized server responses, and keeping dependency and lockfile metadata up to date.

The notes below group related changes and describe concrete impacts for developers and integrators. Where applicable, file paths and the behavioral impact are listed so you can quickly identify areas to review when upgrading.

New Features

  • Affected-items tuples in the client API
    • API surface now explicitly supports returning a tuple [primaryResult, affectedItems] from actions and list-style operations. This is documented in docs/public/api-reference.md and surfaced in TypeScript types.
    • Files updated to reflect the new return shape:
      • src/ClientApi.ts
      • src/CItemAPI.ts
      • src/PItemAPI.ts
      • src/ops/action.ts
      • src/ops/allAction.ts
    • Tests and examples updated to match the tuple form where appropriate (tests/* updated to mock and assert the tuple format).
    • Impact: callers should expect the second element in returned tuples to be an array of keys (PriKey | ComKey | LocKeyArray) describing items indirectly affected by the operation. Code consuming action/allAction should destructure or index the tuple accordingly.

Improvements

  • Simplified and consolidated path-building logic

    • File: src/Utilities.ts
    • The getPath/addPath flow was rewritten to remove duplicated branches, variable shadowing, and redundant early returns. The new flow:
      • Determines the current key and keyType once
      • Finds the best matching pathName using singular/plural/case-insensitive heuristics
      • Falls back to the first available pathName when no match is found
      • Extracts the correct id for PriKey vs LocKey and recurses with a single consistent nextBase
    • Logging was reduced to targeted entries that record chosen pathName and nextBase; extraneous debug branches were removed.
    • Intent preserved: behavior where a single remaining localPathName is appended later remains supported, but implemented without duplicated code.
    • Impact: path construction is more predictable and easier to reason about; reduce chance of subtle bugs introduced by shadowed variables or contradictory branches.
  • allAction response handling simplified

    • File: src/ops/allAction.ts
    • Removed Express-specific workaround that converted empty-object responses ("{}") into [[], []]. The code now relies on the server returning a normalized shape (tuple/array) and destructures directly to [items, affectedItems].
    • Tests updated: tests/ops/allAction.test.ts now cover normal tuple responses and edge cases consistent with the new expectations.
    • Impact: fewer internal transformations; upstream/server shape normalization is assumed. If any client code previously relied on the old workaround, it should be updated to handle the tuple / documented response shapes.
  • Type updates and documentation reflecting affected-items

    • API reference and TypeScript types updated to document and type the second tuple element (affected items).
    • File: docs/public/api-reference.md — new examples and guidance for processing affected items were added.
    • Impact: TypeScript-enabled projects will get compile-time guarantees for the extended return types and can adopt affected-items logic with confidence.

Developer Experience and Tooling

  • Stricter linting in tests

    • ESLint test-level override for no-undefined removed (eslint.config.mjs updated).
    • Removed file-level "/* eslint-disable no-undefined */" comments from tests/http/HttpWrapper.test.ts and tests/ops/errorHandling.test.ts.
    • Impact: tests now run under a stricter linting profile; tests referencing undefined behavior will need to be adjusted.
  • Precommit script removed

    • package.json: the precommit script (previously running clean/lint/build/test chain) was deleted.
    • Impact: local precommit checks no longer run automatically via that script. Workflow around precommit checks should be handled by tooling or CI as desired.
  • Test environment and tooling adjustments (context from previous commits kept)

    • Test setup uses Node-friendly polyfills (fetch/FormData/Blob/File) and vitest fetch mocking via vitest-fetch-mock.
    • tsconfig and vitest configuration were adjusted toward a stricter ESM build and simplified test configuration (see prior commits if relying on explicit vitest settings).

CI and Publishing

  • npm-publish workflow simplified
    • File: .github/workflows/npm-publish.yml
    • The separate build job was removed; the publish-npm job was simplified and no longer depends on a separate build job. This decouples the publish step from a dedicated pre-publish build/test job.
    • Impact: publishing is faster/decoupled, but CI no longer runs the removed build/test/codecov job as a gating step inside this workflow. Ensure CI coverage and pre-publish validations are covered elsewhere if required by release policies.

Dependency and Lockfile Updates

  • Package version bump

    • package.json version advanced to 4.4.34 and earlier development-cycle bumps were applied throughout the cycle (various commits). package.json formatting around the version entry was also normalized.
  • Runtime and lockfile patch bumps

    • Updated dependency version constraints for multiple fjell packages over the development cycle, culminating in:
      • @fjell/core -> ^4.4.42
      • @fjell/http-api -> ^4.4.39
      • @fjell/logging -> ^4.4.47
      • @fjell/registry -> ^4.4.40
    • package-lock.json entries were updated to reflect bumped patches and normalized resolved tarball URLs and integrity checksums for deterministic installs.
    • Impact: routine patch updates. Run a clean install in CI and local environments to refresh lockfile state.

Bug Fixes and Reliability

  • Esbuild version conflict mitigation (contexted earlier in cycle)
    • esbuild pinned to 0.25.9 and npm overrides were added in the monorepo to force a consistent esbuild version across packages, addressing CI build errors.
    • GitHub Actions adjusted to use npm ci for reproducible installs.
    • Impact: fixes intermittent CI failures caused by esbuild version mismatches.

Refactoring and Code Cleanup

  • Utilities and allAction refactors
    • Major cleanup in src/Utilities.ts (consolidation of addPath/getPath) and src/ops/allAction.ts (removal of special-case workarounds and simplified signature). These refactors remove duplicated code and make the implementations easier to maintain.
    • Several tests were updated to align with the refactored code paths.

Breaking Changes and Migration Notes

  • Response-shape assumptions

    • The client now assumes the server returns normalized response shapes for list/all operations. The old Express-oriented conversion of empty-object responses to [[], []] is removed. If any environments or servers still return stringified "{}" or rely on the previous conversion, those servers or client call sites must be updated.
  • Precommit behavior changed

    • The precommit script was removed from package.json. Local precommit automation that relied on this script will no longer run; add your own git hooks or local tooling if you previously relied on it.
  • Stricter test linting

    • Tests are now subject to stricter lint rules (no implicit no-undefined override). Update tests that previously used the relaxed rule.

Migration checklist

  • Update code that calls action/allAction to handle the two-element tuple return ([primaryResult, affectedItems]).
  • Verify any integration with servers that might return empty-object responses — those responses must be normalized on the server side or handled explicitly by the client caller.
  • Re-run installs (npm ci) to pick up updated lockfile entries and patched fjell dependencies.
  • If local precommit checks are required, reintroduce a local git hook or script to run lint/test/build before commits.
  • Run the test suite and confirm updated tests in tests/ops/allAction.test.ts and other adjusted tests pass.

Files of note (summary)

  • src/Utilities.ts — consolidated getPath/addPath; main change to path-building logic and logging
  • src/ops/allAction.ts — removed empty-object workaround and simplified tuple destructuring
  • src/ClientApi.ts, src/CItemAPI.ts, src/PItemAPI.ts — TypeScript typing updates to include affected-items tuple
  • docs/public/api-reference.md — documentation and examples for affected-items tuple
  • package.json — version bumped to 4.4.34; removed precommit script; dependency bumps
  • package-lock.json — normalized and updated resolved/integrity entries for bumped patches
  • .github/workflows/npm-publish.yml — removed build job; simplified publish-npm job
  • eslint.config.mjs and test files — stricter linting for tests; removal of test-specific no-undefined override

If you maintain integrations or tooling that depend on older behaviors (precommit hooks, automatic empty-object conversions, or loose test linting), plan a brief integration pass to update call sites, server responses, and local development hooks. For TypeScript consumers, the updated types will help catch call-site mismatches during compilation; for JavaScript consumers, audit call sites that destructure allAction/action responses.

If any part of this summary needs more detail (for example, a line-by-line mapping of code changes for src/Utilities.ts or a diff-oriented explanation of the affected-items typing changes), indicate which area to expand and the target audience (library maintainers, consumers migrating from an earlier client version, or CI administrators) and a focused follow-up will be provided.