collapse the dual-world type layer and delete the widening shims

The types/bsky post/profile/starterPack unions drop their @atproto/api arms,
and dangerousIsType/validate go with the old-world guards they wrapped. The
moderation subjects.ts widening shim and rich-text-helpers' asSdkFacets both
existed only to bridge branded and unbranded views, so their 55 and 14 callers
now go straight to @bsky.app/sdk/moderation and the raw facets.

Boundary fallout: lexicon token defs are camelCase schema objects needing
.value, and the branded string slots that the widening used to absorb are now
cast or branded at their producers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-04 04:53:44 +03:00
parent e9a67f2dea
commit ae0750099f
114 changed files with 591 additions and 899 deletions
+14
View File
@@ -1,6 +1,7 @@
import {
getMain,
type InferMethodError,
LexError,
type Main,
type Procedure,
type Query,
@@ -27,6 +28,19 @@ export function getErrorStatus(e: unknown): number | undefined {
return e instanceof XrpcResponseError ? e.status : undefined
}
/**
* The lexicon error code (`err.error`), or undefined when `e` carries none.
* Gated on `LexError` (the base of every `XrpcError`) rather than `XrpcError`,
* so the non-XRPC lex errors are covered too.
*
* Prefer {@link matchXrpcError} where the method that threw is known: it
* constrains the compared name to that method's declared errors. Use this only
* where the source method is genuinely ambiguous.
*/
export function getErrorName(e: unknown): string | undefined {
return e instanceof LexError ? e.error : undefined
}
/**
* Same nsid means `e` was thrown for this method schema, so `e` can be
* treated as an `XrpcResponseError<M>` - which is what lets the SDK's