Skip to content

feat(lemmyv1): Lemmy 1.0 beta support#33

Merged
aeharding merged 5 commits into
mainfrom
lemmyyv1
May 23, 2026
Merged

feat(lemmyv1): Lemmy 1.0 beta support#33
aeharding merged 5 commits into
mainfrom
lemmyyv1

Conversation

@aeharding
Copy link
Copy Markdown
Owner

Summary

  • Upgrades lemmy-js-client-v1 to 1.0.0-image-uploads-request.0 and adapts the V1 provider to the new wire shape (RequestState wrapping, paged .items, flattened modlog, separated search result arrays, MyUserInfo restructure, etc.)
  • Promotes V1 as the source of truth for shared schemas: aggregates flattened into their parent views, vote payload becomes is_upvote: boolean, NotificationView gains a mod_action branch. V0 and PieFed compat layers upconvert into the new shapes.
  • Fixes a number of bugs surfaced during live testing against voyager.lemmy.ml:
    • Null-wire handling for optional fields (notification ids, vote_is_upvote)
    • Vote payload field rename was silently dropping the value
    • normalizeError was wrapping transport errors (TypeError/AbortError) as LemmyResponseError
    • mod_action notifications were being filtered out, inflating the unread badge
    • Profile filter sent wrong field name/casing; search field rename (qsearch_term)
    • cleanThreadiverseParams mode-leak fix moved into compat layers
  • Adds tests for V1 compat, vote payload, and mode-leak guards.

Test plan

  • pnpm test:types passes
  • pnpm test passes (19 tests)
  • Smoke-tested against voyager.lemmy.ml (Lemmy 1.0 beta) via Voyager: post feed, comments, vote/save, modlog, inbox (mentions/replies/PMs/mod actions), search, profile filters

- New lemmyv1 adapter with full v4 API support: RequestState unwrapping,
  paged responses (.items), unified getNotifications + markNotificationAsRead,
  search via search_term, resolveObject discriminated union, getSite +
  getMyUser parallel fetch with toMyUserInfo conversion.
- Flat ModlogItem shape (replaces 15 typed views). v0 adapter upconverts.
  ModlogKind enum now lowercase/snake_case.
- Provider-typed error hierarchy: ResponseError -> LemmyResponseError /
  PiefedResponseError, with .code/.status/.cause. Errors are only wrapped
  when the server returned an error response; transport failures pass
  through as their native types.
- Lowercase/snake_case enums: ListingType, SearchType, CommunityVisibility,
  RegistrationMode, FederationMode, ModlogKind.
- Removed 6 dead methods (getReplies/getPersonMentions/getPrivateMessages
  and the 3 mark-as-read variants) from BaseClient + forwarders. v0/piefed
  now route through getNotifications + markNotificationAsRead.
- Support nightly version strings (e.g. nightly-2026-05-21) in version
  satisfaction check.
- Drop PrivateMessage.read from schema (v1 reads come from
  notification.read).
- Add mod_warn_post, mod_warn_comment, mod_lock_comment to ModlogKind.
- New PiefedResponseError gains cause field via ES2022 Error.cause.
Promotes Lemmy v1 to the source of truth for shared schemas (aggregates
flattened, NotificationView extended with mod_action, vote payload
shape change to is_upvote) and updates v0/PieFed compat layers to
upconvert into the new shape. Fixes a slew of bugs surfaced during live
testing against voyager.lemmy.ml: null-wire handling for optional
fields, vote-payload field rename, over-eager error wrapping, and
mod-action notifications being silently dropped.
# Conflicts:
#	src/BaseClient.ts
#	src/errors.ts
#	src/providers/lemmyv0/compat.ts
#	src/providers/piefed/compat.ts
#	src/providers/piefed/index.ts
Threadiverse moved to snake_case enums for v1 alignment, but the PieFed
server still expects PascalCase (`All`, `Subscribed`, ...). `getComments`,
`listCommunities`, and `search` were forwarding snake_case values and
getting `400 Validation failed` back. Convert via `fromListingType` /
`fromSearchType` at the boundary.

Also drops stale commented-out helpers from lemmyv1/helpers.ts.
@aeharding aeharding merged commit a5f5c4b into main May 23, 2026
1 check passed
@aeharding aeharding deleted the lemmyyv1 branch May 23, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant