@wtfalch/moderation
v0.1.0
Published
Public client SDK and API types for the Moderation service.
Readme
@wtfalch/moderation
Public client SDK and API types for the Moderation service. Requires Node 22+ or a browser with Fetch support. The client has no runtime package dependencies.
Status
Published: no.
npm install @wtfalch/moderationimport { createModerationClient } from '@wtfalch/moderation';
const moderation = createModerationClient({
baseUrl: serviceOrigin,
credential: () => serviceKey,
});
await moderation.fileReport({ organisationId, targetKind: 'chat', targetId: `${roomId}/${eventId}`, reason });
const page = await moderation.listReports(organisationId, { state: 'open' });
await moderation.resolveReports({ organisationId, targetKind: 'chat', targetId, resolution: 'dismissed' });
await moderation.dismissSource({ organisationId, source: 'synapse' });
// Next page: pass the previous page's nextCursor.
await moderation.listReports(organisationId, { cursor: page.nextCursor });The credential callback runs for every request, so rotation does not require a
new client. API failures reject with ModerationApiError, which carries status
and a typed code (see ModerationError); the SDK never throws a bare Error
for a service failure.
The root export provides the client and public request/response types.
@wtfalch/moderation/client is also supported. There are no server, database,
migration or authorization exports. The service implementation is a private
package.
