swap the moderation core to the sdk moderation module
Point the moderation primitives - the label definitions, the cause/UI/decision types and the label-info hooks - at `@bsky.app/sdk/moderation` instead of `@atproto/api`. The two implementations are mutually unassignable: the sdk's subject types are the generated `#/lexicons` views, so their `did`/`uri`/`cid` fields are branded (`DidString`, `AtUriString`) where the `@atproto/api` views type the same fields as plain `string`. That rules out a partial swap - a decision made by one implementation cannot be read by the other - so the whole moderation layer moves together. `lib/moderation/subjects.ts` is the transitional seam for the brand mismatch. Every `moderate*` entry point is re-exported through a wrapper that widens its subject parameter to accept a view from either world, because many read paths still emit `@atproto/api` views while the moderation runtime only ever reads `.did`, `.labels` and `.viewer` - none of which the brand affects. It is deleted in the `@atproto/api` removal pass.
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import {type ComAtprotoLabelDefs} from '@atproto/api'
|
||||
import {
|
||||
type AppBskyLabelerDefs,
|
||||
type ComAtprotoLabelDefs,
|
||||
type InterpretedLabelValueDefinition,
|
||||
interpretLabelValueDefinition,
|
||||
LABELS,
|
||||
} from '@atproto/api'
|
||||
} from '@bsky.app/sdk/moderation'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import * as bcp47Match from 'bcp-47-match'
|
||||
|
||||
@@ -13,12 +12,13 @@ import {
|
||||
useGlobalLabelStrings,
|
||||
} from '#/lib/moderation/useGlobalLabelStrings'
|
||||
import {useLabelDefinitions} from '#/state/preferences'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
export interface LabelInfo {
|
||||
label: ComAtprotoLabelDefs.Label
|
||||
def: InterpretedLabelValueDefinition
|
||||
strings: ComAtprotoLabelDefs.LabelValueDefinitionStrings
|
||||
labeler: AppBskyLabelerDefs.LabelerViewDetailed | undefined
|
||||
labeler: app.bsky.labeler.defs.LabelerViewDetailed | undefined
|
||||
}
|
||||
|
||||
export function useLabelInfo(label: ComAtprotoLabelDefs.Label): LabelInfo {
|
||||
|
||||
Reference in New Issue
Block a user