diff --git a/packages/api/src/client/index.ts b/packages/api/src/client/index.ts index 3850e0abef7..2026bd40644 100644 --- a/packages/api/src/client/index.ts +++ b/packages/api/src/client/index.ts @@ -4,6 +4,7 @@ import { XrpcClient, FetchHandler, FetchHandlerOptions } from '@atproto/xrpc' import { schemas } from './lexicons' import { CID } from 'multiformats/cid' +import { OmitKey } from './util' import * as ComAtprotoAdminDefs from './types/com/atproto/admin/defs' import * as ComAtprotoAdminDeleteAccount from './types/com/atproto/admin/deleteAccount' import * as ComAtprotoAdminDisableAccountInvites from './types/com/atproto/admin/disableAccountInvites' @@ -1588,7 +1589,7 @@ export class ProfileRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyActorProfile.Record }[] @@ -1601,7 +1602,7 @@ export class ProfileRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyActorProfile.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.actor.profile', @@ -1611,25 +1612,30 @@ export class ProfileRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyActorProfile.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.actor.profile' + const collection = 'app.bsky.actor.profile' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.actor.profile', rkey: 'self', ...params, record }, + { + collection, + rkey: 'self', + ...params, + record: { ...record, $type: collection }, + }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -1871,7 +1877,7 @@ export class GeneratorRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyFeedGenerator.Record }[] @@ -1884,7 +1890,7 @@ export class GeneratorRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyFeedGenerator.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.feed.generator', @@ -1894,25 +1900,25 @@ export class GeneratorRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyFeedGenerator.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.feed.generator' + const collection = 'app.bsky.feed.generator' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.feed.generator', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -1932,7 +1938,7 @@ export class LikeRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyFeedLike.Record }[] @@ -1945,7 +1951,7 @@ export class LikeRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyFeedLike.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.feed.like', @@ -1955,25 +1961,25 @@ export class LikeRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyFeedLike.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.feed.like' + const collection = 'app.bsky.feed.like' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.feed.like', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -1993,7 +1999,7 @@ export class PostRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyFeedPost.Record }[] @@ -2006,7 +2012,7 @@ export class PostRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyFeedPost.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.feed.post', @@ -2016,25 +2022,25 @@ export class PostRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyFeedPost.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.feed.post' + const collection = 'app.bsky.feed.post' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.feed.post', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2054,7 +2060,7 @@ export class PostgateRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyFeedPostgate.Record }[] @@ -2067,7 +2073,7 @@ export class PostgateRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyFeedPostgate.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.feed.postgate', @@ -2077,25 +2083,25 @@ export class PostgateRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyFeedPostgate.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.feed.postgate' + const collection = 'app.bsky.feed.postgate' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.feed.postgate', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2115,7 +2121,7 @@ export class RepostRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyFeedRepost.Record }[] @@ -2128,7 +2134,7 @@ export class RepostRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyFeedRepost.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.feed.repost', @@ -2138,25 +2144,25 @@ export class RepostRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyFeedRepost.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.feed.repost' + const collection = 'app.bsky.feed.repost' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.feed.repost', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2176,7 +2182,7 @@ export class ThreadgateRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyFeedThreadgate.Record }[] @@ -2189,7 +2195,7 @@ export class ThreadgateRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string cid: string @@ -2203,25 +2209,25 @@ export class ThreadgateRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyFeedThreadgate.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.feed.threadgate' + const collection = 'app.bsky.feed.threadgate' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.feed.threadgate', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2470,7 +2476,7 @@ export class BlockRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyGraphBlock.Record }[] @@ -2483,7 +2489,7 @@ export class BlockRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyGraphBlock.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.graph.block', @@ -2493,25 +2499,25 @@ export class BlockRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyGraphBlock.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.graph.block' + const collection = 'app.bsky.graph.block' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.graph.block', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2531,7 +2537,7 @@ export class FollowRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyGraphFollow.Record }[] @@ -2544,7 +2550,7 @@ export class FollowRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyGraphFollow.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.graph.follow', @@ -2554,25 +2560,25 @@ export class FollowRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyGraphFollow.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.graph.follow' + const collection = 'app.bsky.graph.follow' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.graph.follow', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2592,7 +2598,7 @@ export class ListRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyGraphList.Record }[] @@ -2605,7 +2611,7 @@ export class ListRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyGraphList.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.graph.list', @@ -2615,25 +2621,25 @@ export class ListRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyGraphList.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.graph.list' + const collection = 'app.bsky.graph.list' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.graph.list', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2653,7 +2659,7 @@ export class ListblockRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyGraphListblock.Record }[] @@ -2666,7 +2672,7 @@ export class ListblockRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string cid: string @@ -2680,25 +2686,25 @@ export class ListblockRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyGraphListblock.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.graph.listblock' + const collection = 'app.bsky.graph.listblock' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.graph.listblock', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2718,7 +2724,7 @@ export class ListitemRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyGraphListitem.Record }[] @@ -2731,7 +2737,7 @@ export class ListitemRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string; cid: string; value: AppBskyGraphListitem.Record }> { const res = await this._client.call('com.atproto.repo.getRecord', { collection: 'app.bsky.graph.listitem', @@ -2741,25 +2747,25 @@ export class ListitemRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyGraphListitem.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.graph.listitem' + const collection = 'app.bsky.graph.listitem' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.graph.listitem', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2779,7 +2785,7 @@ export class StarterpackRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyGraphStarterpack.Record }[] @@ -2792,7 +2798,7 @@ export class StarterpackRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string cid: string @@ -2806,25 +2812,25 @@ export class StarterpackRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyGraphStarterpack.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.graph.starterpack' + const collection = 'app.bsky.graph.starterpack' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, - { collection: 'app.bsky.graph.starterpack', ...params, record }, + { collection, ...params, record: { ...record, $type: collection } }, { encoding: 'application/json', headers }, ) return res.data } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -2866,7 +2872,7 @@ export class ServiceRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: AppBskyLabelerService.Record }[] @@ -2879,7 +2885,7 @@ export class ServiceRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string cid: string @@ -2893,22 +2899,22 @@ export class ServiceRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: AppBskyLabelerService.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'app.bsky.labeler.service' + const collection = 'app.bsky.labeler.service' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, { - collection: 'app.bsky.labeler.service', + collection, rkey: 'self', ...params, - record, + record: { ...record, $type: collection }, }, { encoding: 'application/json', headers }, ) @@ -2916,7 +2922,7 @@ export class ServiceRecord { } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( @@ -3187,7 +3193,7 @@ export class DeclarationRecord { } async list( - params: Omit, + params: OmitKey, ): Promise<{ cursor?: string records: { uri: string; value: ChatBskyActorDeclaration.Record }[] @@ -3200,7 +3206,7 @@ export class DeclarationRecord { } async get( - params: Omit, + params: OmitKey, ): Promise<{ uri: string cid: string @@ -3214,22 +3220,22 @@ export class DeclarationRecord { } async create( - params: Omit< + params: OmitKey< ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record' >, record: ChatBskyActorDeclaration.Record, headers?: Record, ): Promise<{ uri: string; cid: string }> { - record.$type = 'chat.bsky.actor.declaration' + const collection = 'chat.bsky.actor.declaration' const res = await this._client.call( 'com.atproto.repo.createRecord', undefined, { - collection: 'chat.bsky.actor.declaration', + collection, rkey: 'self', ...params, - record, + record: { ...record, $type: collection }, }, { encoding: 'application/json', headers }, ) @@ -3237,7 +3243,7 @@ export class DeclarationRecord { } async delete( - params: Omit, + params: OmitKey, headers?: Record, ): Promise { await this._client.call( diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 03821c358c0..f0d88577b9a 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -13576,4 +13576,4 @@ export const ids = { ToolsOzoneTeamDeleteMember: 'tools.ozone.team.deleteMember', ToolsOzoneTeamListMembers: 'tools.ozone.team.listMembers', ToolsOzoneTeamUpdateMember: 'tools.ozone.team.updateMember', -} +} as const diff --git a/packages/api/src/client/types/app/bsky/actor/defs.ts b/packages/api/src/client/types/app/bsky/actor/defs.ts index 322a79b3b20..d447e5f1ad1 100644 --- a/packages/api/src/client/types/app/bsky/actor/defs.ts +++ b/packages/api/src/client/types/app/bsky/actor/defs.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as AppBskyGraphDefs from '../graph/defs' @@ -12,6 +12,7 @@ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' export const id = 'app.bsky.actor.defs' export interface ProfileViewBasic { + $type?: 'app.bsky.actor.defs#profileViewBasic' did: string handle: string displayName?: string @@ -20,12 +21,9 @@ export interface ProfileViewBasic { viewer?: ViewerState labels?: ComAtprotoLabelDefs.Label[] createdAt?: string - [k: string]: unknown } -export function isProfileViewBasic(v: unknown): v is ProfileViewBasic & { - $type: $Type<'app.bsky.actor.defs', 'profileViewBasic'> -} { +export function isProfileViewBasic(v: unknown): v is $Typed { return is$typed(v, id, 'profileViewBasic') } @@ -37,6 +35,7 @@ export function validateProfileViewBasic(v: unknown) { } export interface ProfileView { + $type?: 'app.bsky.actor.defs#profileView' did: string handle: string displayName?: string @@ -47,12 +46,9 @@ export interface ProfileView { createdAt?: string viewer?: ViewerState labels?: ComAtprotoLabelDefs.Label[] - [k: string]: unknown } -export function isProfileView( - v: unknown, -): v is ProfileView & { $type: $Type<'app.bsky.actor.defs', 'profileView'> } { +export function isProfileView(v: unknown): v is $Typed { return is$typed(v, id, 'profileView') } @@ -64,6 +60,7 @@ export function validateProfileView(v: unknown) { } export interface ProfileViewDetailed { + $type?: 'app.bsky.actor.defs#profileViewDetailed' did: string handle: string displayName?: string @@ -80,12 +77,11 @@ export interface ProfileViewDetailed { viewer?: ViewerState labels?: ComAtprotoLabelDefs.Label[] pinnedPost?: ComAtprotoRepoStrongRef.Main - [k: string]: unknown } -export function isProfileViewDetailed(v: unknown): v is ProfileViewDetailed & { - $type: $Type<'app.bsky.actor.defs', 'profileViewDetailed'> -} { +export function isProfileViewDetailed( + v: unknown, +): v is $Typed { return is$typed(v, id, 'profileViewDetailed') } @@ -97,17 +93,17 @@ export function validateProfileViewDetailed(v: unknown) { } export interface ProfileAssociated { + $type?: 'app.bsky.actor.defs#profileAssociated' lists?: number feedgens?: number starterPacks?: number labeler?: boolean chat?: ProfileAssociatedChat - [k: string]: unknown } -export function isProfileAssociated(v: unknown): v is ProfileAssociated & { - $type: $Type<'app.bsky.actor.defs', 'profileAssociated'> -} { +export function isProfileAssociated( + v: unknown, +): v is $Typed { return is$typed(v, id, 'profileAssociated') } @@ -119,15 +115,13 @@ export function validateProfileAssociated(v: unknown) { } export interface ProfileAssociatedChat { + $type?: 'app.bsky.actor.defs#profileAssociatedChat' allowIncoming: 'all' | 'none' | 'following' | (string & {}) - [k: string]: unknown } export function isProfileAssociatedChat( v: unknown, -): v is ProfileAssociatedChat & { - $type: $Type<'app.bsky.actor.defs', 'profileAssociatedChat'> -} { +): v is $Typed { return is$typed(v, id, 'profileAssociatedChat') } @@ -140,6 +134,7 @@ export function validateProfileAssociatedChat(v: unknown) { /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ export interface ViewerState { + $type?: 'app.bsky.actor.defs#viewerState' muted?: boolean mutedByList?: AppBskyGraphDefs.ListViewBasic blockedBy?: boolean @@ -148,12 +143,9 @@ export interface ViewerState { following?: string followedBy?: string knownFollowers?: KnownFollowers - [k: string]: unknown } -export function isViewerState( - v: unknown, -): v is ViewerState & { $type: $Type<'app.bsky.actor.defs', 'viewerState'> } { +export function isViewerState(v: unknown): v is $Typed { return is$typed(v, id, 'viewerState') } @@ -166,14 +158,12 @@ export function validateViewerState(v: unknown) { /** The subject's followers whom you also follow */ export interface KnownFollowers { + $type?: 'app.bsky.actor.defs#knownFollowers' count: number followers: ProfileViewBasic[] - [k: string]: unknown } -export function isKnownFollowers(v: unknown): v is KnownFollowers & { - $type: $Type<'app.bsky.actor.defs', 'knownFollowers'> -} { +export function isKnownFollowers(v: unknown): v is $Typed { return is$typed(v, id, 'knownFollowers') } @@ -185,29 +175,27 @@ export function validateKnownFollowers(v: unknown) { } export type Preferences = ( - | AdultContentPref - | ContentLabelPref - | SavedFeedsPref - | SavedFeedsPrefV2 - | PersonalDetailsPref - | FeedViewPref - | ThreadViewPref - | InterestsPref - | MutedWordsPref - | HiddenPostsPref - | BskyAppStatePref - | LabelersPref - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] export interface AdultContentPref { + $type?: 'app.bsky.actor.defs#adultContentPref' enabled: boolean - [k: string]: unknown } -export function isAdultContentPref(v: unknown): v is AdultContentPref & { - $type: $Type<'app.bsky.actor.defs', 'adultContentPref'> -} { +export function isAdultContentPref(v: unknown): v is $Typed { return is$typed(v, id, 'adultContentPref') } @@ -219,16 +207,14 @@ export function validateAdultContentPref(v: unknown) { } export interface ContentLabelPref { + $type?: 'app.bsky.actor.defs#contentLabelPref' /** Which labeler does this preference apply to? If undefined, applies globally. */ labelerDid?: string label: string visibility: 'ignore' | 'show' | 'warn' | 'hide' | (string & {}) - [k: string]: unknown } -export function isContentLabelPref(v: unknown): v is ContentLabelPref & { - $type: $Type<'app.bsky.actor.defs', 'contentLabelPref'> -} { +export function isContentLabelPref(v: unknown): v is $Typed { return is$typed(v, id, 'contentLabelPref') } @@ -240,16 +226,14 @@ export function validateContentLabelPref(v: unknown) { } export interface SavedFeed { + $type?: 'app.bsky.actor.defs#savedFeed' id: string type: 'feed' | 'list' | 'timeline' | (string & {}) value: string pinned: boolean - [k: string]: unknown } -export function isSavedFeed( - v: unknown, -): v is SavedFeed & { $type: $Type<'app.bsky.actor.defs', 'savedFeed'> } { +export function isSavedFeed(v: unknown): v is $Typed { return is$typed(v, id, 'savedFeed') } @@ -258,13 +242,11 @@ export function validateSavedFeed(v: unknown) { } export interface SavedFeedsPrefV2 { + $type?: 'app.bsky.actor.defs#savedFeedsPrefV2' items: SavedFeed[] - [k: string]: unknown } -export function isSavedFeedsPrefV2(v: unknown): v is SavedFeedsPrefV2 & { - $type: $Type<'app.bsky.actor.defs', 'savedFeedsPrefV2'> -} { +export function isSavedFeedsPrefV2(v: unknown): v is $Typed { return is$typed(v, id, 'savedFeedsPrefV2') } @@ -276,15 +258,13 @@ export function validateSavedFeedsPrefV2(v: unknown) { } export interface SavedFeedsPref { + $type?: 'app.bsky.actor.defs#savedFeedsPref' pinned: string[] saved: string[] timelineIndex?: number - [k: string]: unknown } -export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref & { - $type: $Type<'app.bsky.actor.defs', 'savedFeedsPref'> -} { +export function isSavedFeedsPref(v: unknown): v is $Typed { return is$typed(v, id, 'savedFeedsPref') } @@ -296,14 +276,14 @@ export function validateSavedFeedsPref(v: unknown) { } export interface PersonalDetailsPref { + $type?: 'app.bsky.actor.defs#personalDetailsPref' /** The birth date of account owner. */ birthDate?: string - [k: string]: unknown } -export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref & { - $type: $Type<'app.bsky.actor.defs', 'personalDetailsPref'> -} { +export function isPersonalDetailsPref( + v: unknown, +): v is $Typed { return is$typed(v, id, 'personalDetailsPref') } @@ -315,6 +295,7 @@ export function validatePersonalDetailsPref(v: unknown) { } export interface FeedViewPref { + $type?: 'app.bsky.actor.defs#feedViewPref' /** The URI of the feed, or an identifier which describes the feed. */ feed: string /** Hide replies in the feed. */ @@ -327,12 +308,9 @@ export interface FeedViewPref { hideReposts?: boolean /** Hide quote posts in the feed. */ hideQuotePosts?: boolean - [k: string]: unknown } -export function isFeedViewPref( - v: unknown, -): v is FeedViewPref & { $type: $Type<'app.bsky.actor.defs', 'feedViewPref'> } { +export function isFeedViewPref(v: unknown): v is $Typed { return is$typed(v, id, 'feedViewPref') } @@ -344,16 +322,14 @@ export function validateFeedViewPref(v: unknown) { } export interface ThreadViewPref { + $type?: 'app.bsky.actor.defs#threadViewPref' /** Sorting mode for threads. */ sort?: 'oldest' | 'newest' | 'most-likes' | 'random' | (string & {}) /** Show followed users at the top of all replies. */ prioritizeFollowedUsers?: boolean - [k: string]: unknown } -export function isThreadViewPref(v: unknown): v is ThreadViewPref & { - $type: $Type<'app.bsky.actor.defs', 'threadViewPref'> -} { +export function isThreadViewPref(v: unknown): v is $Typed { return is$typed(v, id, 'threadViewPref') } @@ -365,14 +341,12 @@ export function validateThreadViewPref(v: unknown) { } export interface InterestsPref { + $type?: 'app.bsky.actor.defs#interestsPref' /** A list of tags which describe the account owner's interests gathered during onboarding. */ tags: string[] - [k: string]: unknown } -export function isInterestsPref(v: unknown): v is InterestsPref & { - $type: $Type<'app.bsky.actor.defs', 'interestsPref'> -} { +export function isInterestsPref(v: unknown): v is $Typed { return is$typed(v, id, 'interestsPref') } @@ -387,6 +361,7 @@ export type MutedWordTarget = 'content' | 'tag' | (string & {}) /** A word that the account owner has muted. */ export interface MutedWord { + $type?: 'app.bsky.actor.defs#mutedWord' id?: string /** The muted word itself. */ value: string @@ -396,12 +371,9 @@ export interface MutedWord { actorTarget: 'all' | 'exclude-following' | (string & {}) /** The date and time at which the muted word will expire and no longer be applied. */ expiresAt?: string - [k: string]: unknown } -export function isMutedWord( - v: unknown, -): v is MutedWord & { $type: $Type<'app.bsky.actor.defs', 'mutedWord'> } { +export function isMutedWord(v: unknown): v is $Typed { return is$typed(v, id, 'mutedWord') } @@ -410,14 +382,12 @@ export function validateMutedWord(v: unknown) { } export interface MutedWordsPref { + $type?: 'app.bsky.actor.defs#mutedWordsPref' /** A list of words the account owner has muted. */ items: MutedWord[] - [k: string]: unknown } -export function isMutedWordsPref(v: unknown): v is MutedWordsPref & { - $type: $Type<'app.bsky.actor.defs', 'mutedWordsPref'> -} { +export function isMutedWordsPref(v: unknown): v is $Typed { return is$typed(v, id, 'mutedWordsPref') } @@ -429,14 +399,12 @@ export function validateMutedWordsPref(v: unknown) { } export interface HiddenPostsPref { + $type?: 'app.bsky.actor.defs#hiddenPostsPref' /** A list of URIs of posts the account owner has hidden. */ items: string[] - [k: string]: unknown } -export function isHiddenPostsPref(v: unknown): v is HiddenPostsPref & { - $type: $Type<'app.bsky.actor.defs', 'hiddenPostsPref'> -} { +export function isHiddenPostsPref(v: unknown): v is $Typed { return is$typed(v, id, 'hiddenPostsPref') } @@ -448,13 +416,11 @@ export function validateHiddenPostsPref(v: unknown) { } export interface LabelersPref { + $type?: 'app.bsky.actor.defs#labelersPref' labelers: LabelerPrefItem[] - [k: string]: unknown } -export function isLabelersPref( - v: unknown, -): v is LabelersPref & { $type: $Type<'app.bsky.actor.defs', 'labelersPref'> } { +export function isLabelersPref(v: unknown): v is $Typed { return is$typed(v, id, 'labelersPref') } @@ -466,13 +432,11 @@ export function validateLabelersPref(v: unknown) { } export interface LabelerPrefItem { + $type?: 'app.bsky.actor.defs#labelerPrefItem' did: string - [k: string]: unknown } -export function isLabelerPrefItem(v: unknown): v is LabelerPrefItem & { - $type: $Type<'app.bsky.actor.defs', 'labelerPrefItem'> -} { +export function isLabelerPrefItem(v: unknown): v is $Typed { return is$typed(v, id, 'labelerPrefItem') } @@ -485,17 +449,15 @@ export function validateLabelerPrefItem(v: unknown) { /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ export interface BskyAppStatePref { + $type?: 'app.bsky.actor.defs#bskyAppStatePref' activeProgressGuide?: BskyAppProgressGuide /** An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. */ queuedNudges?: string[] /** Storage for NUXs the user has encountered. */ nuxs?: Nux[] - [k: string]: unknown } -export function isBskyAppStatePref(v: unknown): v is BskyAppStatePref & { - $type: $Type<'app.bsky.actor.defs', 'bskyAppStatePref'> -} { +export function isBskyAppStatePref(v: unknown): v is $Typed { return is$typed(v, id, 'bskyAppStatePref') } @@ -508,15 +470,13 @@ export function validateBskyAppStatePref(v: unknown) { /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ export interface BskyAppProgressGuide { + $type?: 'app.bsky.actor.defs#bskyAppProgressGuide' guide: string - [k: string]: unknown } export function isBskyAppProgressGuide( v: unknown, -): v is BskyAppProgressGuide & { - $type: $Type<'app.bsky.actor.defs', 'bskyAppProgressGuide'> -} { +): v is $Typed { return is$typed(v, id, 'bskyAppProgressGuide') } @@ -529,18 +489,16 @@ export function validateBskyAppProgressGuide(v: unknown) { /** A new user experiences (NUX) storage object */ export interface Nux { + $type?: 'app.bsky.actor.defs#nux' id: string completed: boolean /** Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. */ data?: string /** The date and time at which the NUX will expire and should be considered completed. */ expiresAt?: string - [k: string]: unknown } -export function isNux( - v: unknown, -): v is Nux & { $type: $Type<'app.bsky.actor.defs', 'nux'> } { +export function isNux(v: unknown): v is $Typed { return is$typed(v, id, 'nux') } diff --git a/packages/api/src/client/types/app/bsky/actor/getPreferences.ts b/packages/api/src/client/types/app/bsky/actor/getPreferences.ts index 0ec7b98b92c..cb6b6b345ef 100644 --- a/packages/api/src/client/types/app/bsky/actor/getPreferences.ts +++ b/packages/api/src/client/types/app/bsky/actor/getPreferences.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' @@ -16,7 +16,6 @@ export type InputSchema = undefined export interface OutputSchema { preferences: AppBskyActorDefs.Preferences - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/actor/getProfile.ts b/packages/api/src/client/types/app/bsky/actor/getProfile.ts index 906d7ed3196..95f02e472a4 100644 --- a/packages/api/src/client/types/app/bsky/actor/getProfile.ts +++ b/packages/api/src/client/types/app/bsky/actor/getProfile.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' diff --git a/packages/api/src/client/types/app/bsky/actor/getProfiles.ts b/packages/api/src/client/types/app/bsky/actor/getProfiles.ts index 8d07d783aba..80bf62d69b6 100644 --- a/packages/api/src/client/types/app/bsky/actor/getProfiles.ts +++ b/packages/api/src/client/types/app/bsky/actor/getProfiles.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { profiles: AppBskyActorDefs.ProfileViewDetailed[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/actor/getSuggestions.ts b/packages/api/src/client/types/app/bsky/actor/getSuggestions.ts index 5df24f37d82..8addb8b1294 100644 --- a/packages/api/src/client/types/app/bsky/actor/getSuggestions.ts +++ b/packages/api/src/client/types/app/bsky/actor/getSuggestions.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string actors: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/actor/profile.ts b/packages/api/src/client/types/app/bsky/actor/profile.ts index b9f37890669..60e6cdc87c1 100644 --- a/packages/api/src/client/types/app/bsky/actor/profile.ts +++ b/packages/api/src/client/types/app/bsky/actor/profile.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' @@ -11,6 +11,7 @@ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' export const id = 'app.bsky.actor.profile' export interface Record { + $type?: 'app.bsky.actor.profile' | 'app.bsky.actor.profile#main' displayName?: string /** Free-form profile description text. */ description?: string @@ -19,17 +20,15 @@ export interface Record { /** Larger horizontal image to display behind profile view. */ banner?: BlobRef labels?: - | ComAtprotoLabelDefs.SelfLabels - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed<{ [k: string]: unknown }> joinedViaStarterPack?: ComAtprotoRepoStrongRef.Main pinnedPost?: ComAtprotoRepoStrongRef.Main createdAt?: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.actor.profile', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/actor/putPreferences.ts b/packages/api/src/client/types/app/bsky/actor/putPreferences.ts index 540a12674a5..460a5c14095 100644 --- a/packages/api/src/client/types/app/bsky/actor/putPreferences.ts +++ b/packages/api/src/client/types/app/bsky/actor/putPreferences.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' @@ -14,7 +14,6 @@ export interface QueryParams {} export interface InputSchema { preferences: AppBskyActorDefs.Preferences - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/actor/searchActors.ts b/packages/api/src/client/types/app/bsky/actor/searchActors.ts index b96de15360e..4f4dabd4a67 100644 --- a/packages/api/src/client/types/app/bsky/actor/searchActors.ts +++ b/packages/api/src/client/types/app/bsky/actor/searchActors.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' @@ -24,7 +24,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string actors: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts b/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts index eb8f6402235..9e664ca764b 100644 --- a/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' @@ -22,7 +22,6 @@ export type InputSchema = undefined export interface OutputSchema { actors: AppBskyActorDefs.ProfileViewBasic[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/embed/defs.ts b/packages/api/src/client/types/app/bsky/embed/defs.ts index 937dbeaf71d..0e858d4d963 100644 --- a/packages/api/src/client/types/app/bsky/embed/defs.ts +++ b/packages/api/src/client/types/app/bsky/embed/defs.ts @@ -3,21 +3,19 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.embed.defs' /** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ export interface AspectRatio { + $type?: 'app.bsky.embed.defs#aspectRatio' width: number height: number - [k: string]: unknown } -export function isAspectRatio( - v: unknown, -): v is AspectRatio & { $type: $Type<'app.bsky.embed.defs', 'aspectRatio'> } { +export function isAspectRatio(v: unknown): v is $Typed { return is$typed(v, id, 'aspectRatio') } diff --git a/packages/api/src/client/types/app/bsky/embed/external.ts b/packages/api/src/client/types/app/bsky/embed/external.ts index f523615380b..d888afb8558 100644 --- a/packages/api/src/client/types/app/bsky/embed/external.ts +++ b/packages/api/src/client/types/app/bsky/embed/external.ts @@ -3,20 +3,18 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.embed.external' /** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ export interface Main { + $type?: 'app.bsky.embed.external' | 'app.bsky.embed.external#main' external: External - [k: string]: unknown } -export function isMain( - v: unknown, -): v is Main & { $type: $Type<'app.bsky.embed.external', 'main'> } { +export function isMain(v: unknown): v is $Typed
{ return is$typed(v, id, 'main') } @@ -25,16 +23,14 @@ export function validateMain(v: unknown) { } export interface External { + $type?: 'app.bsky.embed.external#external' uri: string title: string description: string thumb?: BlobRef - [k: string]: unknown } -export function isExternal( - v: unknown, -): v is External & { $type: $Type<'app.bsky.embed.external', 'external'> } { +export function isExternal(v: unknown): v is $Typed { return is$typed(v, id, 'external') } @@ -43,13 +39,11 @@ export function validateExternal(v: unknown) { } export interface View { + $type?: 'app.bsky.embed.external#view' external: ViewExternal - [k: string]: unknown } -export function isView( - v: unknown, -): v is View & { $type: $Type<'app.bsky.embed.external', 'view'> } { +export function isView(v: unknown): v is $Typed { return is$typed(v, id, 'view') } @@ -58,16 +52,14 @@ export function validateView(v: unknown) { } export interface ViewExternal { + $type?: 'app.bsky.embed.external#viewExternal' uri: string title: string description: string thumb?: string - [k: string]: unknown } -export function isViewExternal(v: unknown): v is ViewExternal & { - $type: $Type<'app.bsky.embed.external', 'viewExternal'> -} { +export function isViewExternal(v: unknown): v is $Typed { return is$typed(v, id, 'viewExternal') } diff --git a/packages/api/src/client/types/app/bsky/embed/images.ts b/packages/api/src/client/types/app/bsky/embed/images.ts index 5f9f9f39c22..006639cd426 100644 --- a/packages/api/src/client/types/app/bsky/embed/images.ts +++ b/packages/api/src/client/types/app/bsky/embed/images.ts @@ -3,20 +3,18 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyEmbedDefs from './defs' export const id = 'app.bsky.embed.images' export interface Main { + $type?: 'app.bsky.embed.images' | 'app.bsky.embed.images#main' images: Image[] - [k: string]: unknown } -export function isMain( - v: unknown, -): v is Main & { $type: $Type<'app.bsky.embed.images', 'main'> } { +export function isMain(v: unknown): v is $Typed
{ return is$typed(v, id, 'main') } @@ -25,16 +23,14 @@ export function validateMain(v: unknown) { } export interface Image { + $type?: 'app.bsky.embed.images#image' image: BlobRef /** Alt text description of the image, for accessibility. */ alt: string aspectRatio?: AppBskyEmbedDefs.AspectRatio - [k: string]: unknown } -export function isImage( - v: unknown, -): v is Image & { $type: $Type<'app.bsky.embed.images', 'image'> } { +export function isImage(v: unknown): v is $Typed { return is$typed(v, id, 'image') } @@ -43,13 +39,11 @@ export function validateImage(v: unknown) { } export interface View { + $type?: 'app.bsky.embed.images#view' images: ViewImage[] - [k: string]: unknown } -export function isView( - v: unknown, -): v is View & { $type: $Type<'app.bsky.embed.images', 'view'> } { +export function isView(v: unknown): v is $Typed { return is$typed(v, id, 'view') } @@ -58,6 +52,7 @@ export function validateView(v: unknown) { } export interface ViewImage { + $type?: 'app.bsky.embed.images#viewImage' /** Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. */ thumb: string /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ @@ -65,12 +60,9 @@ export interface ViewImage { /** Alt text description of the image, for accessibility. */ alt: string aspectRatio?: AppBskyEmbedDefs.AspectRatio - [k: string]: unknown } -export function isViewImage( - v: unknown, -): v is ViewImage & { $type: $Type<'app.bsky.embed.images', 'viewImage'> } { +export function isViewImage(v: unknown): v is $Typed { return is$typed(v, id, 'viewImage') } diff --git a/packages/api/src/client/types/app/bsky/embed/record.ts b/packages/api/src/client/types/app/bsky/embed/record.ts index 3289ca15f58..e810b61c831 100644 --- a/packages/api/src/client/types/app/bsky/embed/record.ts +++ b/packages/api/src/client/types/app/bsky/embed/record.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' import * as AppBskyFeedDefs from '../feed/defs' @@ -19,13 +19,11 @@ import * as AppBskyEmbedRecordWithMedia from './recordWithMedia' export const id = 'app.bsky.embed.record' export interface Main { + $type?: 'app.bsky.embed.record' | 'app.bsky.embed.record#main' record: ComAtprotoRepoStrongRef.Main - [k: string]: unknown } -export function isMain( - v: unknown, -): v is Main & { $type: $Type<'app.bsky.embed.record', 'main'> } { +export function isMain(v: unknown): v is $Typed
{ return is$typed(v, id, 'main') } @@ -34,22 +32,20 @@ export function validateMain(v: unknown) { } export interface View { + $type?: 'app.bsky.embed.record#view' record: - | ViewRecord - | ViewNotFound - | ViewBlocked - | ViewDetached - | AppBskyFeedDefs.GeneratorView - | AppBskyGraphDefs.ListView - | AppBskyLabelerDefs.LabelerView - | AppBskyGraphDefs.StarterPackViewBasic - | { $type: string; [k: string]: unknown } - [k: string]: unknown -} - -export function isView( - v: unknown, -): v is View & { $type: $Type<'app.bsky.embed.record', 'view'> } { + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> +} + +export function isView(v: unknown): v is $Typed { return is$typed(v, id, 'view') } @@ -58,31 +54,29 @@ export function validateView(v: unknown) { } export interface ViewRecord { + $type?: 'app.bsky.embed.record#viewRecord' uri: string cid: string author: AppBskyActorDefs.ProfileViewBasic /** The record data itself. */ - value: {} + value: { [_ in string]: unknown } labels?: ComAtprotoLabelDefs.Label[] replyCount?: number repostCount?: number likeCount?: number quoteCount?: number embeds?: ( - | AppBskyEmbedImages.View - | AppBskyEmbedVideo.View - | AppBskyEmbedExternal.View - | View - | AppBskyEmbedRecordWithMedia.View - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] indexedAt: string - [k: string]: unknown } -export function isViewRecord( - v: unknown, -): v is ViewRecord & { $type: $Type<'app.bsky.embed.record', 'viewRecord'> } { +export function isViewRecord(v: unknown): v is $Typed { return is$typed(v, id, 'viewRecord') } @@ -94,14 +88,12 @@ export function validateViewRecord(v: unknown) { } export interface ViewNotFound { + $type?: 'app.bsky.embed.record#viewNotFound' uri: string notFound: true - [k: string]: unknown } -export function isViewNotFound(v: unknown): v is ViewNotFound & { - $type: $Type<'app.bsky.embed.record', 'viewNotFound'> -} { +export function isViewNotFound(v: unknown): v is $Typed { return is$typed(v, id, 'viewNotFound') } @@ -113,15 +105,13 @@ export function validateViewNotFound(v: unknown) { } export interface ViewBlocked { + $type?: 'app.bsky.embed.record#viewBlocked' uri: string blocked: true author: AppBskyFeedDefs.BlockedAuthor - [k: string]: unknown } -export function isViewBlocked( - v: unknown, -): v is ViewBlocked & { $type: $Type<'app.bsky.embed.record', 'viewBlocked'> } { +export function isViewBlocked(v: unknown): v is $Typed { return is$typed(v, id, 'viewBlocked') } @@ -133,14 +123,12 @@ export function validateViewBlocked(v: unknown) { } export interface ViewDetached { + $type?: 'app.bsky.embed.record#viewDetached' uri: string detached: true - [k: string]: unknown } -export function isViewDetached(v: unknown): v is ViewDetached & { - $type: $Type<'app.bsky.embed.record', 'viewDetached'> -} { +export function isViewDetached(v: unknown): v is $Typed { return is$typed(v, id, 'viewDetached') } diff --git a/packages/api/src/client/types/app/bsky/embed/recordWithMedia.ts b/packages/api/src/client/types/app/bsky/embed/recordWithMedia.ts index 46ff8bf6c16..a5f85f25026 100644 --- a/packages/api/src/client/types/app/bsky/embed/recordWithMedia.ts +++ b/packages/api/src/client/types/app/bsky/embed/recordWithMedia.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyEmbedRecord from './record' import * as AppBskyEmbedImages from './images' @@ -13,18 +13,18 @@ import * as AppBskyEmbedExternal from './external' export const id = 'app.bsky.embed.recordWithMedia' export interface Main { + $type?: + | 'app.bsky.embed.recordWithMedia' + | 'app.bsky.embed.recordWithMedia#main' record: AppBskyEmbedRecord.Main media: - | AppBskyEmbedImages.Main - | AppBskyEmbedVideo.Main - | AppBskyEmbedExternal.Main - | { $type: string; [k: string]: unknown } - [k: string]: unknown + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> } -export function isMain( - v: unknown, -): v is Main & { $type: $Type<'app.bsky.embed.recordWithMedia', 'main'> } { +export function isMain(v: unknown): v is $Typed
{ return is$typed(v, id, 'main') } @@ -33,18 +33,16 @@ export function validateMain(v: unknown) { } export interface View { + $type?: 'app.bsky.embed.recordWithMedia#view' record: AppBskyEmbedRecord.View media: - | AppBskyEmbedImages.View - | AppBskyEmbedVideo.View - | AppBskyEmbedExternal.View - | { $type: string; [k: string]: unknown } - [k: string]: unknown + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> } -export function isView( - v: unknown, -): v is View & { $type: $Type<'app.bsky.embed.recordWithMedia', 'view'> } { +export function isView(v: unknown): v is $Typed { return is$typed(v, id, 'view') } diff --git a/packages/api/src/client/types/app/bsky/embed/video.ts b/packages/api/src/client/types/app/bsky/embed/video.ts index a37f33c0232..00af0bc0437 100644 --- a/packages/api/src/client/types/app/bsky/embed/video.ts +++ b/packages/api/src/client/types/app/bsky/embed/video.ts @@ -3,24 +3,22 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyEmbedDefs from './defs' export const id = 'app.bsky.embed.video' export interface Main { + $type?: 'app.bsky.embed.video' | 'app.bsky.embed.video#main' video: BlobRef captions?: Caption[] /** Alt text description of the video, for accessibility. */ alt?: string aspectRatio?: AppBskyEmbedDefs.AspectRatio - [k: string]: unknown } -export function isMain( - v: unknown, -): v is Main & { $type: $Type<'app.bsky.embed.video', 'main'> } { +export function isMain(v: unknown): v is $Typed
{ return is$typed(v, id, 'main') } @@ -29,14 +27,12 @@ export function validateMain(v: unknown) { } export interface Caption { + $type?: 'app.bsky.embed.video#caption' lang: string file: BlobRef - [k: string]: unknown } -export function isCaption( - v: unknown, -): v is Caption & { $type: $Type<'app.bsky.embed.video', 'caption'> } { +export function isCaption(v: unknown): v is $Typed { return is$typed(v, id, 'caption') } @@ -45,17 +41,15 @@ export function validateCaption(v: unknown) { } export interface View { + $type?: 'app.bsky.embed.video#view' cid: string playlist: string thumbnail?: string alt?: string aspectRatio?: AppBskyEmbedDefs.AspectRatio - [k: string]: unknown } -export function isView( - v: unknown, -): v is View & { $type: $Type<'app.bsky.embed.video', 'view'> } { +export function isView(v: unknown): v is $Typed { return is$typed(v, id, 'view') } diff --git a/packages/api/src/client/types/app/bsky/feed/defs.ts b/packages/api/src/client/types/app/bsky/feed/defs.ts index e255b754a7f..bf2b5f2b25e 100644 --- a/packages/api/src/client/types/app/bsky/feed/defs.ts +++ b/packages/api/src/client/types/app/bsky/feed/defs.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' import * as AppBskyEmbedImages from '../embed/images' @@ -18,17 +18,18 @@ import * as AppBskyGraphDefs from '../graph/defs' export const id = 'app.bsky.feed.defs' export interface PostView { + $type?: 'app.bsky.feed.defs#postView' uri: string cid: string author: AppBskyActorDefs.ProfileViewBasic - record: {} + record: { [_ in string]: unknown } embed?: - | AppBskyEmbedImages.View - | AppBskyEmbedVideo.View - | AppBskyEmbedExternal.View - | AppBskyEmbedRecord.View - | AppBskyEmbedRecordWithMedia.View - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> replyCount?: number repostCount?: number likeCount?: number @@ -37,12 +38,9 @@ export interface PostView { viewer?: ViewerState labels?: ComAtprotoLabelDefs.Label[] threadgate?: ThreadgateView - [k: string]: unknown } -export function isPostView( - v: unknown, -): v is PostView & { $type: $Type<'app.bsky.feed.defs', 'postView'> } { +export function isPostView(v: unknown): v is $Typed { return is$typed(v, id, 'postView') } @@ -52,18 +50,16 @@ export function validatePostView(v: unknown) { /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ export interface ViewerState { + $type?: 'app.bsky.feed.defs#viewerState' repost?: string like?: string threadMuted?: boolean replyDisabled?: boolean embeddingDisabled?: boolean pinned?: boolean - [k: string]: unknown } -export function isViewerState( - v: unknown, -): v is ViewerState & { $type: $Type<'app.bsky.feed.defs', 'viewerState'> } { +export function isViewerState(v: unknown): v is $Typed { return is$typed(v, id, 'viewerState') } @@ -75,17 +71,18 @@ export function validateViewerState(v: unknown) { } export interface FeedViewPost { + $type?: 'app.bsky.feed.defs#feedViewPost' post: PostView reply?: ReplyRef - reason?: ReasonRepost | ReasonPin | { $type: string; [k: string]: unknown } + reason?: + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> /** Context provided by feed generator that may be passed back alongside interactions. */ feedContext?: string - [k: string]: unknown } -export function isFeedViewPost( - v: unknown, -): v is FeedViewPost & { $type: $Type<'app.bsky.feed.defs', 'feedViewPost'> } { +export function isFeedViewPost(v: unknown): v is $Typed { return is$typed(v, id, 'feedViewPost') } @@ -97,23 +94,21 @@ export function validateFeedViewPost(v: unknown) { } export interface ReplyRef { + $type?: 'app.bsky.feed.defs#replyRef' root: - | PostView - | NotFoundPost - | BlockedPost - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> parent: - | PostView - | NotFoundPost - | BlockedPost - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic - [k: string]: unknown } -export function isReplyRef( - v: unknown, -): v is ReplyRef & { $type: $Type<'app.bsky.feed.defs', 'replyRef'> } { +export function isReplyRef(v: unknown): v is $Typed { return is$typed(v, id, 'replyRef') } @@ -122,14 +117,12 @@ export function validateReplyRef(v: unknown) { } export interface ReasonRepost { + $type?: 'app.bsky.feed.defs#reasonRepost' by: AppBskyActorDefs.ProfileViewBasic indexedAt: string - [k: string]: unknown } -export function isReasonRepost( - v: unknown, -): v is ReasonRepost & { $type: $Type<'app.bsky.feed.defs', 'reasonRepost'> } { +export function isReasonRepost(v: unknown): v is $Typed { return is$typed(v, id, 'reasonRepost') } @@ -141,12 +134,10 @@ export function validateReasonRepost(v: unknown) { } export interface ReasonPin { - [k: string]: unknown + $type?: 'app.bsky.feed.defs#reasonPin' } -export function isReasonPin( - v: unknown, -): v is ReasonPin & { $type: $Type<'app.bsky.feed.defs', 'reasonPin'> } { +export function isReasonPin(v: unknown): v is $Typed { return is$typed(v, id, 'reasonPin') } @@ -155,24 +146,22 @@ export function validateReasonPin(v: unknown) { } export interface ThreadViewPost { + $type?: 'app.bsky.feed.defs#threadViewPost' post: PostView parent?: - | ThreadViewPost - | NotFoundPost - | BlockedPost - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> replies?: ( - | ThreadViewPost - | NotFoundPost - | BlockedPost - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] - [k: string]: unknown } -export function isThreadViewPost(v: unknown): v is ThreadViewPost & { - $type: $Type<'app.bsky.feed.defs', 'threadViewPost'> -} { +export function isThreadViewPost(v: unknown): v is $Typed { return is$typed(v, id, 'threadViewPost') } @@ -184,14 +173,12 @@ export function validateThreadViewPost(v: unknown) { } export interface NotFoundPost { + $type?: 'app.bsky.feed.defs#notFoundPost' uri: string notFound: true - [k: string]: unknown } -export function isNotFoundPost( - v: unknown, -): v is NotFoundPost & { $type: $Type<'app.bsky.feed.defs', 'notFoundPost'> } { +export function isNotFoundPost(v: unknown): v is $Typed { return is$typed(v, id, 'notFoundPost') } @@ -203,15 +190,13 @@ export function validateNotFoundPost(v: unknown) { } export interface BlockedPost { + $type?: 'app.bsky.feed.defs#blockedPost' uri: string blocked: true author: BlockedAuthor - [k: string]: unknown } -export function isBlockedPost( - v: unknown, -): v is BlockedPost & { $type: $Type<'app.bsky.feed.defs', 'blockedPost'> } { +export function isBlockedPost(v: unknown): v is $Typed { return is$typed(v, id, 'blockedPost') } @@ -223,14 +208,12 @@ export function validateBlockedPost(v: unknown) { } export interface BlockedAuthor { + $type?: 'app.bsky.feed.defs#blockedAuthor' did: string viewer?: AppBskyActorDefs.ViewerState - [k: string]: unknown } -export function isBlockedAuthor(v: unknown): v is BlockedAuthor & { - $type: $Type<'app.bsky.feed.defs', 'blockedAuthor'> -} { +export function isBlockedAuthor(v: unknown): v is $Typed { return is$typed(v, id, 'blockedAuthor') } @@ -242,6 +225,7 @@ export function validateBlockedAuthor(v: unknown) { } export interface GeneratorView { + $type?: 'app.bsky.feed.defs#generatorView' uri: string cid: string did: string @@ -255,12 +239,9 @@ export interface GeneratorView { labels?: ComAtprotoLabelDefs.Label[] viewer?: GeneratorViewerState indexedAt: string - [k: string]: unknown } -export function isGeneratorView(v: unknown): v is GeneratorView & { - $type: $Type<'app.bsky.feed.defs', 'generatorView'> -} { +export function isGeneratorView(v: unknown): v is $Typed { return is$typed(v, id, 'generatorView') } @@ -272,15 +253,13 @@ export function validateGeneratorView(v: unknown) { } export interface GeneratorViewerState { + $type?: 'app.bsky.feed.defs#generatorViewerState' like?: string - [k: string]: unknown } export function isGeneratorViewerState( v: unknown, -): v is GeneratorViewerState & { - $type: $Type<'app.bsky.feed.defs', 'generatorViewerState'> -} { +): v is $Typed { return is$typed(v, id, 'generatorViewerState') } @@ -292,19 +271,17 @@ export function validateGeneratorViewerState(v: unknown) { } export interface SkeletonFeedPost { + $type?: 'app.bsky.feed.defs#skeletonFeedPost' post: string reason?: - | SkeletonReasonRepost - | SkeletonReasonPin - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> /** Context that will be passed through to client and may be passed to feed generator back alongside interactions. */ feedContext?: string - [k: string]: unknown } -export function isSkeletonFeedPost(v: unknown): v is SkeletonFeedPost & { - $type: $Type<'app.bsky.feed.defs', 'skeletonFeedPost'> -} { +export function isSkeletonFeedPost(v: unknown): v is $Typed { return is$typed(v, id, 'skeletonFeedPost') } @@ -316,15 +293,13 @@ export function validateSkeletonFeedPost(v: unknown) { } export interface SkeletonReasonRepost { + $type?: 'app.bsky.feed.defs#skeletonReasonRepost' repost: string - [k: string]: unknown } export function isSkeletonReasonRepost( v: unknown, -): v is SkeletonReasonRepost & { - $type: $Type<'app.bsky.feed.defs', 'skeletonReasonRepost'> -} { +): v is $Typed { return is$typed(v, id, 'skeletonReasonRepost') } @@ -336,12 +311,12 @@ export function validateSkeletonReasonRepost(v: unknown) { } export interface SkeletonReasonPin { - [k: string]: unknown + $type?: 'app.bsky.feed.defs#skeletonReasonPin' } -export function isSkeletonReasonPin(v: unknown): v is SkeletonReasonPin & { - $type: $Type<'app.bsky.feed.defs', 'skeletonReasonPin'> -} { +export function isSkeletonReasonPin( + v: unknown, +): v is $Typed { return is$typed(v, id, 'skeletonReasonPin') } @@ -353,16 +328,14 @@ export function validateSkeletonReasonPin(v: unknown) { } export interface ThreadgateView { + $type?: 'app.bsky.feed.defs#threadgateView' uri?: string cid?: string - record?: {} + record?: { [_ in string]: unknown } lists?: AppBskyGraphDefs.ListViewBasic[] - [k: string]: unknown } -export function isThreadgateView(v: unknown): v is ThreadgateView & { - $type: $Type<'app.bsky.feed.defs', 'threadgateView'> -} { +export function isThreadgateView(v: unknown): v is $Typed { return is$typed(v, id, 'threadgateView') } @@ -374,6 +347,7 @@ export function validateThreadgateView(v: unknown) { } export interface Interaction { + $type?: 'app.bsky.feed.defs#interaction' item?: string event?: | 'app.bsky.feed.defs#requestLess' @@ -391,12 +365,9 @@ export interface Interaction { | (string & {}) /** Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. */ feedContext?: string - [k: string]: unknown } -export function isInteraction( - v: unknown, -): v is Interaction & { $type: $Type<'app.bsky.feed.defs', 'interaction'> } { +export function isInteraction(v: unknown): v is $Typed { return is$typed(v, id, 'interaction') } diff --git a/packages/api/src/client/types/app/bsky/feed/describeFeedGenerator.ts b/packages/api/src/client/types/app/bsky/feed/describeFeedGenerator.ts index b58d7fcbe19..06d3aeb871b 100644 --- a/packages/api/src/client/types/app/bsky/feed/describeFeedGenerator.ts +++ b/packages/api/src/client/types/app/bsky/feed/describeFeedGenerator.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.feed.describeFeedGenerator' @@ -17,7 +17,6 @@ export interface OutputSchema { did: string feeds: Feed[] links?: Links - [k: string]: unknown } export interface CallOptions { @@ -36,13 +35,11 @@ export function toKnownErr(e: any) { } export interface Feed { + $type?: 'app.bsky.feed.describeFeedGenerator#feed' uri: string - [k: string]: unknown } -export function isFeed( - v: unknown, -): v is Feed & { $type: $Type<'app.bsky.feed.describeFeedGenerator', 'feed'> } { +export function isFeed(v: unknown): v is $Typed { return is$typed(v, id, 'feed') } @@ -51,14 +48,12 @@ export function validateFeed(v: unknown) { } export interface Links { + $type?: 'app.bsky.feed.describeFeedGenerator#links' privacyPolicy?: string termsOfService?: string - [k: string]: unknown } -export function isLinks(v: unknown): v is Links & { - $type: $Type<'app.bsky.feed.describeFeedGenerator', 'links'> -} { +export function isLinks(v: unknown): v is $Typed { return is$typed(v, id, 'links') } diff --git a/packages/api/src/client/types/app/bsky/feed/generator.ts b/packages/api/src/client/types/app/bsky/feed/generator.ts index a4e2dc830c8..5f1ab2fd5c4 100644 --- a/packages/api/src/client/types/app/bsky/feed/generator.ts +++ b/packages/api/src/client/types/app/bsky/feed/generator.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../richtext/facet' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' @@ -11,6 +11,7 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' export const id = 'app.bsky.feed.generator' export interface Record { + $type?: 'app.bsky.feed.generator' | 'app.bsky.feed.generator#main' did: string displayName: string description?: string @@ -19,15 +20,13 @@ export interface Record { /** Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions */ acceptsInteractions?: boolean labels?: - | ComAtprotoLabelDefs.SelfLabels - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed<{ [k: string]: unknown }> createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.feed.generator', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/feed/getActorFeeds.ts b/packages/api/src/client/types/app/bsky/feed/getActorFeeds.ts index bb3249ad85f..e7361c0ff7c 100644 --- a/packages/api/src/client/types/app/bsky/feed/getActorFeeds.ts +++ b/packages/api/src/client/types/app/bsky/feed/getActorFeeds.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feeds: AppBskyFeedDefs.GeneratorView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getActorLikes.ts b/packages/api/src/client/types/app/bsky/feed/getActorLikes.ts index 7e2b4295954..ceb2ccd81a1 100644 --- a/packages/api/src/client/types/app/bsky/feed/getActorLikes.ts +++ b/packages/api/src/client/types/app/bsky/feed/getActorLikes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feed: AppBskyFeedDefs.FeedViewPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getAuthorFeed.ts b/packages/api/src/client/types/app/bsky/feed/getAuthorFeed.ts index 3ae1cae26b6..767127b5581 100644 --- a/packages/api/src/client/types/app/bsky/feed/getAuthorFeed.ts +++ b/packages/api/src/client/types/app/bsky/feed/getAuthorFeed.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -29,7 +29,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feed: AppBskyFeedDefs.FeedViewPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getFeed.ts b/packages/api/src/client/types/app/bsky/feed/getFeed.ts index 6eaefb58e43..a090ce43a96 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeed.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeed.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feed: AppBskyFeedDefs.FeedViewPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getFeedGenerator.ts b/packages/api/src/client/types/app/bsky/feed/getFeedGenerator.ts index 4e9387d34e4..0f199627097 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeedGenerator.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeedGenerator.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -23,7 +23,6 @@ export interface OutputSchema { isOnline: boolean /** Indicates whether the feed generator service is compatible with the record declaration. */ isValid: boolean - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getFeedGenerators.ts b/packages/api/src/client/types/app/bsky/feed/getFeedGenerators.ts index 0aa00fe836d..bfbf9d7f400 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeedGenerators.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeedGenerators.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { feeds: AppBskyFeedDefs.GeneratorView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getFeedSkeleton.ts b/packages/api/src/client/types/app/bsky/feed/getFeedSkeleton.ts index 6cc5547ab69..369b5fb64ca 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeedSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeedSkeleton.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -22,7 +22,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feed: AppBskyFeedDefs.SkeletonFeedPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getLikes.ts b/packages/api/src/client/types/app/bsky/feed/getLikes.ts index 4222b94b2b6..564f09082fe 100644 --- a/packages/api/src/client/types/app/bsky/feed/getLikes.ts +++ b/packages/api/src/client/types/app/bsky/feed/getLikes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -26,7 +26,6 @@ export interface OutputSchema { cid?: string cursor?: string likes: Like[] - [k: string]: unknown } export interface CallOptions { @@ -45,15 +44,13 @@ export function toKnownErr(e: any) { } export interface Like { + $type?: 'app.bsky.feed.getLikes#like' indexedAt: string createdAt: string actor: AppBskyActorDefs.ProfileView - [k: string]: unknown } -export function isLike( - v: unknown, -): v is Like & { $type: $Type<'app.bsky.feed.getLikes', 'like'> } { +export function isLike(v: unknown): v is $Typed { return is$typed(v, id, 'like') } diff --git a/packages/api/src/client/types/app/bsky/feed/getListFeed.ts b/packages/api/src/client/types/app/bsky/feed/getListFeed.ts index 616abc6ba8d..5c4a1cb602c 100644 --- a/packages/api/src/client/types/app/bsky/feed/getListFeed.ts +++ b/packages/api/src/client/types/app/bsky/feed/getListFeed.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -22,7 +22,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feed: AppBskyFeedDefs.FeedViewPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getPostThread.ts b/packages/api/src/client/types/app/bsky/feed/getPostThread.ts index cbd94d6e3fb..aab658e0a91 100644 --- a/packages/api/src/client/types/app/bsky/feed/getPostThread.ts +++ b/packages/api/src/client/types/app/bsky/feed/getPostThread.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -23,12 +23,11 @@ export type InputSchema = undefined export interface OutputSchema { thread: - | AppBskyFeedDefs.ThreadViewPost - | AppBskyFeedDefs.NotFoundPost - | AppBskyFeedDefs.BlockedPost - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> threadgate?: AppBskyFeedDefs.ThreadgateView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getPosts.ts b/packages/api/src/client/types/app/bsky/feed/getPosts.ts index 62f3a899f0d..820dbb2f642 100644 --- a/packages/api/src/client/types/app/bsky/feed/getPosts.ts +++ b/packages/api/src/client/types/app/bsky/feed/getPosts.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -19,7 +19,6 @@ export type InputSchema = undefined export interface OutputSchema { posts: AppBskyFeedDefs.PostView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getQuotes.ts b/packages/api/src/client/types/app/bsky/feed/getQuotes.ts index 1ba21be65b3..f1f9b7131e8 100644 --- a/packages/api/src/client/types/app/bsky/feed/getQuotes.ts +++ b/packages/api/src/client/types/app/bsky/feed/getQuotes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -26,7 +26,6 @@ export interface OutputSchema { cid?: string cursor?: string posts: AppBskyFeedDefs.PostView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getRepostedBy.ts b/packages/api/src/client/types/app/bsky/feed/getRepostedBy.ts index 19a6823b9b2..afc5629f6e1 100644 --- a/packages/api/src/client/types/app/bsky/feed/getRepostedBy.ts +++ b/packages/api/src/client/types/app/bsky/feed/getRepostedBy.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -26,7 +26,6 @@ export interface OutputSchema { cid?: string cursor?: string repostedBy: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts b/packages/api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts index ff248a18d12..17147a070db 100644 --- a/packages/api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts +++ b/packages/api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feeds: AppBskyFeedDefs.GeneratorView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/getTimeline.ts b/packages/api/src/client/types/app/bsky/feed/getTimeline.ts index 6c7227eb1e5..44e6000e7a4 100644 --- a/packages/api/src/client/types/app/bsky/feed/getTimeline.ts +++ b/packages/api/src/client/types/app/bsky/feed/getTimeline.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -22,7 +22,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feed: AppBskyFeedDefs.FeedViewPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/like.ts b/packages/api/src/client/types/app/bsky/feed/like.ts index ca55513aeb3..ef2233091df 100644 --- a/packages/api/src/client/types/app/bsky/feed/like.ts +++ b/packages/api/src/client/types/app/bsky/feed/like.ts @@ -3,21 +3,20 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' export const id = 'app.bsky.feed.like' export interface Record { + $type?: 'app.bsky.feed.like' | 'app.bsky.feed.like#main' subject: ComAtprotoRepoStrongRef.Main createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.feed.like', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/feed/post.ts b/packages/api/src/client/types/app/bsky/feed/post.ts index 942e5e08c5b..ab3dffcf3e3 100644 --- a/packages/api/src/client/types/app/bsky/feed/post.ts +++ b/packages/api/src/client/types/app/bsky/feed/post.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../richtext/facet' import * as AppBskyEmbedImages from '../embed/images' @@ -17,6 +17,7 @@ import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' export const id = 'app.bsky.feed.post' export interface Record { + $type?: 'app.bsky.feed.post' | 'app.bsky.feed.post#main' /** The primary post content. May be an empty string, if there are embeds. */ text: string /** DEPRECATED: replaced by app.bsky.richtext.facet. */ @@ -25,17 +26,17 @@ export interface Record { facets?: AppBskyRichtextFacet.Main[] reply?: ReplyRef embed?: - | AppBskyEmbedImages.Main - | AppBskyEmbedVideo.Main - | AppBskyEmbedExternal.Main - | AppBskyEmbedRecord.Main - | AppBskyEmbedRecordWithMedia.Main - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> /** Indicates human language of post primary text content. */ langs?: string[] labels?: - | ComAtprotoLabelDefs.SelfLabels - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed<{ [k: string]: unknown }> /** Additional hashtags, in addition to any included in post text and facets. */ tags?: string[] /** Client-declared timestamp when this post was originally created. */ @@ -43,9 +44,7 @@ export interface Record { [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.feed.post', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } @@ -54,14 +53,12 @@ export function validateRecord(v: unknown) { } export interface ReplyRef { + $type?: 'app.bsky.feed.post#replyRef' root: ComAtprotoRepoStrongRef.Main parent: ComAtprotoRepoStrongRef.Main - [k: string]: unknown } -export function isReplyRef( - v: unknown, -): v is ReplyRef & { $type: $Type<'app.bsky.feed.post', 'replyRef'> } { +export function isReplyRef(v: unknown): v is $Typed { return is$typed(v, id, 'replyRef') } @@ -71,16 +68,14 @@ export function validateReplyRef(v: unknown) { /** Deprecated: use facets instead. */ export interface Entity { + $type?: 'app.bsky.feed.post#entity' index: TextSlice /** Expected values are 'mention' and 'link'. */ type: string value: string - [k: string]: unknown } -export function isEntity( - v: unknown, -): v is Entity & { $type: $Type<'app.bsky.feed.post', 'entity'> } { +export function isEntity(v: unknown): v is $Typed { return is$typed(v, id, 'entity') } @@ -90,14 +85,12 @@ export function validateEntity(v: unknown) { /** Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. */ export interface TextSlice { + $type?: 'app.bsky.feed.post#textSlice' start: number end: number - [k: string]: unknown } -export function isTextSlice( - v: unknown, -): v is TextSlice & { $type: $Type<'app.bsky.feed.post', 'textSlice'> } { +export function isTextSlice(v: unknown): v is $Typed { return is$typed(v, id, 'textSlice') } diff --git a/packages/api/src/client/types/app/bsky/feed/postgate.ts b/packages/api/src/client/types/app/bsky/feed/postgate.ts index 79bfef0dab4..8263e6f7166 100644 --- a/packages/api/src/client/types/app/bsky/feed/postgate.ts +++ b/packages/api/src/client/types/app/bsky/feed/postgate.ts @@ -3,24 +3,23 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.feed.postgate' export interface Record { + $type?: 'app.bsky.feed.postgate' | 'app.bsky.feed.postgate#main' createdAt: string /** Reference (AT-URI) to the post record. */ post: string /** List of AT-URIs embedding this post that the author has detached from. */ detachedEmbeddingUris?: string[] - embeddingRules?: (DisableRule | { $type: string; [k: string]: unknown })[] + embeddingRules?: ($Typed | $Typed<{ [k: string]: unknown }>)[] [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.feed.postgate', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } @@ -30,12 +29,10 @@ export function validateRecord(v: unknown) { /** Disables embedding of this post. */ export interface DisableRule { - [k: string]: unknown + $type?: 'app.bsky.feed.postgate#disableRule' } -export function isDisableRule(v: unknown): v is DisableRule & { - $type: $Type<'app.bsky.feed.postgate', 'disableRule'> -} { +export function isDisableRule(v: unknown): v is $Typed { return is$typed(v, id, 'disableRule') } diff --git a/packages/api/src/client/types/app/bsky/feed/repost.ts b/packages/api/src/client/types/app/bsky/feed/repost.ts index e56e6dce8c2..0b80900aef9 100644 --- a/packages/api/src/client/types/app/bsky/feed/repost.ts +++ b/packages/api/src/client/types/app/bsky/feed/repost.ts @@ -3,21 +3,20 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' export const id = 'app.bsky.feed.repost' export interface Record { + $type?: 'app.bsky.feed.repost' | 'app.bsky.feed.repost#main' subject: ComAtprotoRepoStrongRef.Main createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.feed.repost', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/feed/searchPosts.ts b/packages/api/src/client/types/app/bsky/feed/searchPosts.ts index 65dde56fbfc..6302d737a0f 100644 --- a/packages/api/src/client/types/app/bsky/feed/searchPosts.ts +++ b/packages/api/src/client/types/app/bsky/feed/searchPosts.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -43,7 +43,6 @@ export interface OutputSchema { /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number posts: AppBskyFeedDefs.PostView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/feed/sendInteractions.ts b/packages/api/src/client/types/app/bsky/feed/sendInteractions.ts index 8d4ac0599b7..73b5e9e1be4 100644 --- a/packages/api/src/client/types/app/bsky/feed/sendInteractions.ts +++ b/packages/api/src/client/types/app/bsky/feed/sendInteractions.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' @@ -14,12 +14,9 @@ export interface QueryParams {} export interface InputSchema { interactions: AppBskyFeedDefs.Interaction[] - [k: string]: unknown } -export interface OutputSchema { - [k: string]: unknown -} +export interface OutputSchema {} export interface CallOptions { signal?: AbortSignal diff --git a/packages/api/src/client/types/app/bsky/feed/threadgate.ts b/packages/api/src/client/types/app/bsky/feed/threadgate.ts index 4a7ed440792..d12df6bc45b 100644 --- a/packages/api/src/client/types/app/bsky/feed/threadgate.ts +++ b/packages/api/src/client/types/app/bsky/feed/threadgate.ts @@ -3,19 +3,20 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.feed.threadgate' export interface Record { + $type?: 'app.bsky.feed.threadgate' | 'app.bsky.feed.threadgate#main' /** Reference (AT-URI) to the post record. */ post: string allow?: ( - | MentionRule - | FollowingRule - | ListRule - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] createdAt: string /** List of hidden reply URIs. */ @@ -23,9 +24,7 @@ export interface Record { [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.feed.threadgate', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } @@ -35,12 +34,10 @@ export function validateRecord(v: unknown) { /** Allow replies from actors mentioned in your post. */ export interface MentionRule { - [k: string]: unknown + $type?: 'app.bsky.feed.threadgate#mentionRule' } -export function isMentionRule(v: unknown): v is MentionRule & { - $type: $Type<'app.bsky.feed.threadgate', 'mentionRule'> -} { +export function isMentionRule(v: unknown): v is $Typed { return is$typed(v, id, 'mentionRule') } @@ -53,12 +50,10 @@ export function validateMentionRule(v: unknown) { /** Allow replies from actors you follow. */ export interface FollowingRule { - [k: string]: unknown + $type?: 'app.bsky.feed.threadgate#followingRule' } -export function isFollowingRule(v: unknown): v is FollowingRule & { - $type: $Type<'app.bsky.feed.threadgate', 'followingRule'> -} { +export function isFollowingRule(v: unknown): v is $Typed { return is$typed(v, id, 'followingRule') } @@ -71,13 +66,11 @@ export function validateFollowingRule(v: unknown) { /** Allow replies from actors on a list. */ export interface ListRule { + $type?: 'app.bsky.feed.threadgate#listRule' list: string - [k: string]: unknown } -export function isListRule( - v: unknown, -): v is ListRule & { $type: $Type<'app.bsky.feed.threadgate', 'listRule'> } { +export function isListRule(v: unknown): v is $Typed { return is$typed(v, id, 'listRule') } diff --git a/packages/api/src/client/types/app/bsky/graph/block.ts b/packages/api/src/client/types/app/bsky/graph/block.ts index e1b7c39e72b..2781e8b8a61 100644 --- a/packages/api/src/client/types/app/bsky/graph/block.ts +++ b/packages/api/src/client/types/app/bsky/graph/block.ts @@ -3,21 +3,20 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.block' export interface Record { + $type?: 'app.bsky.graph.block' | 'app.bsky.graph.block#main' /** DID of the account to be blocked. */ subject: string createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.graph.block', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/graph/defs.ts b/packages/api/src/client/types/app/bsky/graph/defs.ts index cc5075df8e7..af3043fa2c5 100644 --- a/packages/api/src/client/types/app/bsky/graph/defs.ts +++ b/packages/api/src/client/types/app/bsky/graph/defs.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as AppBskyActorDefs from '../actor/defs' @@ -13,6 +13,7 @@ import * as AppBskyFeedDefs from '../feed/defs' export const id = 'app.bsky.graph.defs' export interface ListViewBasic { + $type?: 'app.bsky.graph.defs#listViewBasic' uri: string cid: string name: string @@ -22,12 +23,9 @@ export interface ListViewBasic { labels?: ComAtprotoLabelDefs.Label[] viewer?: ListViewerState indexedAt?: string - [k: string]: unknown } -export function isListViewBasic(v: unknown): v is ListViewBasic & { - $type: $Type<'app.bsky.graph.defs', 'listViewBasic'> -} { +export function isListViewBasic(v: unknown): v is $Typed { return is$typed(v, id, 'listViewBasic') } @@ -39,6 +37,7 @@ export function validateListViewBasic(v: unknown) { } export interface ListView { + $type?: 'app.bsky.graph.defs#listView' uri: string cid: string creator: AppBskyActorDefs.ProfileView @@ -51,12 +50,9 @@ export interface ListView { labels?: ComAtprotoLabelDefs.Label[] viewer?: ListViewerState indexedAt: string - [k: string]: unknown } -export function isListView( - v: unknown, -): v is ListView & { $type: $Type<'app.bsky.graph.defs', 'listView'> } { +export function isListView(v: unknown): v is $Typed { return is$typed(v, id, 'listView') } @@ -65,14 +61,12 @@ export function validateListView(v: unknown) { } export interface ListItemView { + $type?: 'app.bsky.graph.defs#listItemView' uri: string subject: AppBskyActorDefs.ProfileView - [k: string]: unknown } -export function isListItemView( - v: unknown, -): v is ListItemView & { $type: $Type<'app.bsky.graph.defs', 'listItemView'> } { +export function isListItemView(v: unknown): v is $Typed { return is$typed(v, id, 'listItemView') } @@ -84,9 +78,10 @@ export function validateListItemView(v: unknown) { } export interface StarterPackView { + $type?: 'app.bsky.graph.defs#starterPackView' uri: string cid: string - record: {} + record: { [_ in string]: unknown } creator: AppBskyActorDefs.ProfileViewBasic list?: ListViewBasic listItemsSample?: ListItemView[] @@ -95,12 +90,9 @@ export interface StarterPackView { joinedAllTimeCount?: number labels?: ComAtprotoLabelDefs.Label[] indexedAt: string - [k: string]: unknown } -export function isStarterPackView(v: unknown): v is StarterPackView & { - $type: $Type<'app.bsky.graph.defs', 'starterPackView'> -} { +export function isStarterPackView(v: unknown): v is $Typed { return is$typed(v, id, 'starterPackView') } @@ -112,23 +104,21 @@ export function validateStarterPackView(v: unknown) { } export interface StarterPackViewBasic { + $type?: 'app.bsky.graph.defs#starterPackViewBasic' uri: string cid: string - record: {} + record: { [_ in string]: unknown } creator: AppBskyActorDefs.ProfileViewBasic listItemCount?: number joinedWeekCount?: number joinedAllTimeCount?: number labels?: ComAtprotoLabelDefs.Label[] indexedAt: string - [k: string]: unknown } export function isStarterPackViewBasic( v: unknown, -): v is StarterPackViewBasic & { - $type: $Type<'app.bsky.graph.defs', 'starterPackViewBasic'> -} { +): v is $Typed { return is$typed(v, id, 'starterPackViewBasic') } @@ -153,14 +143,12 @@ export const CURATELIST = 'app.bsky.graph.defs#curatelist' export const REFERENCELIST = 'app.bsky.graph.defs#referencelist' export interface ListViewerState { + $type?: 'app.bsky.graph.defs#listViewerState' muted?: boolean blocked?: string - [k: string]: unknown } -export function isListViewerState(v: unknown): v is ListViewerState & { - $type: $Type<'app.bsky.graph.defs', 'listViewerState'> -} { +export function isListViewerState(v: unknown): v is $Typed { return is$typed(v, id, 'listViewerState') } @@ -173,14 +161,12 @@ export function validateListViewerState(v: unknown) { /** indicates that a handle or DID could not be resolved */ export interface NotFoundActor { + $type?: 'app.bsky.graph.defs#notFoundActor' actor: string notFound: true - [k: string]: unknown } -export function isNotFoundActor(v: unknown): v is NotFoundActor & { - $type: $Type<'app.bsky.graph.defs', 'notFoundActor'> -} { +export function isNotFoundActor(v: unknown): v is $Typed { return is$typed(v, id, 'notFoundActor') } @@ -193,17 +179,15 @@ export function validateNotFoundActor(v: unknown) { /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ export interface Relationship { + $type?: 'app.bsky.graph.defs#relationship' did: string /** if the actor follows this DID, this is the AT-URI of the follow record */ following?: string /** if the actor is followed by this DID, contains the AT-URI of the follow record */ followedBy?: string - [k: string]: unknown } -export function isRelationship( - v: unknown, -): v is Relationship & { $type: $Type<'app.bsky.graph.defs', 'relationship'> } { +export function isRelationship(v: unknown): v is $Typed { return is$typed(v, id, 'relationship') } diff --git a/packages/api/src/client/types/app/bsky/graph/follow.ts b/packages/api/src/client/types/app/bsky/graph/follow.ts index 245bce4e25c..f01f1a7d158 100644 --- a/packages/api/src/client/types/app/bsky/graph/follow.ts +++ b/packages/api/src/client/types/app/bsky/graph/follow.ts @@ -3,20 +3,19 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.follow' export interface Record { + $type?: 'app.bsky.graph.follow' | 'app.bsky.graph.follow#main' subject: string createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.graph.follow', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/graph/getActorStarterPacks.ts b/packages/api/src/client/types/app/bsky/graph/getActorStarterPacks.ts index 8ceb92954d9..4bbcefcd25a 100644 --- a/packages/api/src/client/types/app/bsky/graph/getActorStarterPacks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getActorStarterPacks.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string starterPacks: AppBskyGraphDefs.StarterPackViewBasic[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getBlocks.ts b/packages/api/src/client/types/app/bsky/graph/getBlocks.ts index c2328a7d4dd..673e04b38fb 100644 --- a/packages/api/src/client/types/app/bsky/graph/getBlocks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getBlocks.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string blocks: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getFollowers.ts b/packages/api/src/client/types/app/bsky/graph/getFollowers.ts index f2db7664e42..09e67017d2a 100644 --- a/packages/api/src/client/types/app/bsky/graph/getFollowers.ts +++ b/packages/api/src/client/types/app/bsky/graph/getFollowers.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -22,7 +22,6 @@ export interface OutputSchema { subject: AppBskyActorDefs.ProfileView cursor?: string followers: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getFollows.ts b/packages/api/src/client/types/app/bsky/graph/getFollows.ts index d22fd464617..30ac67a0de5 100644 --- a/packages/api/src/client/types/app/bsky/graph/getFollows.ts +++ b/packages/api/src/client/types/app/bsky/graph/getFollows.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -22,7 +22,6 @@ export interface OutputSchema { subject: AppBskyActorDefs.ProfileView cursor?: string follows: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getKnownFollowers.ts b/packages/api/src/client/types/app/bsky/graph/getKnownFollowers.ts index 85490e782a3..881bcf8fbd4 100644 --- a/packages/api/src/client/types/app/bsky/graph/getKnownFollowers.ts +++ b/packages/api/src/client/types/app/bsky/graph/getKnownFollowers.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -22,7 +22,6 @@ export interface OutputSchema { subject: AppBskyActorDefs.ProfileView cursor?: string followers: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getList.ts b/packages/api/src/client/types/app/bsky/graph/getList.ts index d19803b4abe..d1a0c3348c9 100644 --- a/packages/api/src/client/types/app/bsky/graph/getList.ts +++ b/packages/api/src/client/types/app/bsky/graph/getList.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -23,7 +23,6 @@ export interface OutputSchema { cursor?: string list: AppBskyGraphDefs.ListView items: AppBskyGraphDefs.ListItemView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getListBlocks.ts b/packages/api/src/client/types/app/bsky/graph/getListBlocks.ts index c9e40a872dc..1107b1de5ca 100644 --- a/packages/api/src/client/types/app/bsky/graph/getListBlocks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getListBlocks.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string lists: AppBskyGraphDefs.ListView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getListMutes.ts b/packages/api/src/client/types/app/bsky/graph/getListMutes.ts index 7f4855aa183..9ba5769c329 100644 --- a/packages/api/src/client/types/app/bsky/graph/getListMutes.ts +++ b/packages/api/src/client/types/app/bsky/graph/getListMutes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string lists: AppBskyGraphDefs.ListView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getLists.ts b/packages/api/src/client/types/app/bsky/graph/getLists.ts index b865cfec269..25195601848 100644 --- a/packages/api/src/client/types/app/bsky/graph/getLists.ts +++ b/packages/api/src/client/types/app/bsky/graph/getLists.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -22,7 +22,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string lists: AppBskyGraphDefs.ListView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getMutes.ts b/packages/api/src/client/types/app/bsky/graph/getMutes.ts index 747c8240986..127e55bc41d 100644 --- a/packages/api/src/client/types/app/bsky/graph/getMutes.ts +++ b/packages/api/src/client/types/app/bsky/graph/getMutes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string mutes: AppBskyActorDefs.ProfileView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getRelationships.ts b/packages/api/src/client/types/app/bsky/graph/getRelationships.ts index 10a24ec0a4b..ce53c7eb5d2 100644 --- a/packages/api/src/client/types/app/bsky/graph/getRelationships.ts +++ b/packages/api/src/client/types/app/bsky/graph/getRelationships.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -22,11 +22,10 @@ export type InputSchema = undefined export interface OutputSchema { actor?: string relationships: ( - | AppBskyGraphDefs.Relationship - | AppBskyGraphDefs.NotFoundActor - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getStarterPack.ts b/packages/api/src/client/types/app/bsky/graph/getStarterPack.ts index e5b46724ce5..35fd228fba4 100644 --- a/packages/api/src/client/types/app/bsky/graph/getStarterPack.ts +++ b/packages/api/src/client/types/app/bsky/graph/getStarterPack.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -19,7 +19,6 @@ export type InputSchema = undefined export interface OutputSchema { starterPack: AppBskyGraphDefs.StarterPackView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getStarterPacks.ts b/packages/api/src/client/types/app/bsky/graph/getStarterPacks.ts index 1a2d9edbfa0..a3187882799 100644 --- a/packages/api/src/client/types/app/bsky/graph/getStarterPacks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getStarterPacks.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { starterPacks: AppBskyGraphDefs.StarterPackViewBasic[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts b/packages/api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts index 4e2142cf2f8..d3c4d20c220 100644 --- a/packages/api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts +++ b/packages/api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' @@ -20,7 +20,6 @@ export interface OutputSchema { suggestions: AppBskyActorDefs.ProfileView[] /** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */ isFallback: boolean - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/list.ts b/packages/api/src/client/types/app/bsky/graph/list.ts index dad4e7b73f1..94e0ab9c6cf 100644 --- a/packages/api/src/client/types/app/bsky/graph/list.ts +++ b/packages/api/src/client/types/app/bsky/graph/list.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' import * as AppBskyRichtextFacet from '../richtext/facet' @@ -12,6 +12,7 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' export const id = 'app.bsky.graph.list' export interface Record { + $type?: 'app.bsky.graph.list' | 'app.bsky.graph.list#main' purpose: AppBskyGraphDefs.ListPurpose /** Display name for list; can not be empty. */ name: string @@ -19,15 +20,13 @@ export interface Record { descriptionFacets?: AppBskyRichtextFacet.Main[] avatar?: BlobRef labels?: - | ComAtprotoLabelDefs.SelfLabels - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed<{ [k: string]: unknown }> createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.graph.list', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/graph/listblock.ts b/packages/api/src/client/types/app/bsky/graph/listblock.ts index 07d1c2f4bd8..be1ac21816d 100644 --- a/packages/api/src/client/types/app/bsky/graph/listblock.ts +++ b/packages/api/src/client/types/app/bsky/graph/listblock.ts @@ -3,21 +3,20 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.listblock' export interface Record { + $type?: 'app.bsky.graph.listblock' | 'app.bsky.graph.listblock#main' /** Reference (AT-URI) to the mod list record. */ subject: string createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.graph.listblock', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/graph/listitem.ts b/packages/api/src/client/types/app/bsky/graph/listitem.ts index 49b50212d66..f905792136d 100644 --- a/packages/api/src/client/types/app/bsky/graph/listitem.ts +++ b/packages/api/src/client/types/app/bsky/graph/listitem.ts @@ -3,12 +3,13 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.listitem' export interface Record { + $type?: 'app.bsky.graph.listitem' | 'app.bsky.graph.listitem#main' /** The account which is included on the list. */ subject: string /** Reference (AT-URI) to the list record (app.bsky.graph.list). */ @@ -17,9 +18,7 @@ export interface Record { [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.graph.listitem', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/graph/muteActor.ts b/packages/api/src/client/types/app/bsky/graph/muteActor.ts index 8db52159b3e..301d6a107cf 100644 --- a/packages/api/src/client/types/app/bsky/graph/muteActor.ts +++ b/packages/api/src/client/types/app/bsky/graph/muteActor.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.muteActor' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { actor: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/muteActorList.ts b/packages/api/src/client/types/app/bsky/graph/muteActorList.ts index 210b57e7f51..cef94492ec3 100644 --- a/packages/api/src/client/types/app/bsky/graph/muteActorList.ts +++ b/packages/api/src/client/types/app/bsky/graph/muteActorList.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.muteActorList' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { list: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/muteThread.ts b/packages/api/src/client/types/app/bsky/graph/muteThread.ts index eb91bb8dffb..26a7c4facd0 100644 --- a/packages/api/src/client/types/app/bsky/graph/muteThread.ts +++ b/packages/api/src/client/types/app/bsky/graph/muteThread.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.muteThread' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { root: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/starterpack.ts b/packages/api/src/client/types/app/bsky/graph/starterpack.ts index 609c4050e98..3a198d2b9e3 100644 --- a/packages/api/src/client/types/app/bsky/graph/starterpack.ts +++ b/packages/api/src/client/types/app/bsky/graph/starterpack.ts @@ -3,13 +3,14 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../richtext/facet' export const id = 'app.bsky.graph.starterpack' export interface Record { + $type?: 'app.bsky.graph.starterpack' | 'app.bsky.graph.starterpack#main' /** Display name for starter pack; can not be empty. */ name: string description?: string @@ -21,9 +22,7 @@ export interface Record { [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.graph.starterpack', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } @@ -32,13 +31,11 @@ export function validateRecord(v: unknown) { } export interface FeedItem { + $type?: 'app.bsky.graph.starterpack#feedItem' uri: string - [k: string]: unknown } -export function isFeedItem( - v: unknown, -): v is FeedItem & { $type: $Type<'app.bsky.graph.starterpack', 'feedItem'> } { +export function isFeedItem(v: unknown): v is $Typed { return is$typed(v, id, 'feedItem') } diff --git a/packages/api/src/client/types/app/bsky/graph/unmuteActor.ts b/packages/api/src/client/types/app/bsky/graph/unmuteActor.ts index 4a5b3d7bf5b..7505ba97c2e 100644 --- a/packages/api/src/client/types/app/bsky/graph/unmuteActor.ts +++ b/packages/api/src/client/types/app/bsky/graph/unmuteActor.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.unmuteActor' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { actor: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/unmuteActorList.ts b/packages/api/src/client/types/app/bsky/graph/unmuteActorList.ts index 815b4864c63..ae9c01037e1 100644 --- a/packages/api/src/client/types/app/bsky/graph/unmuteActorList.ts +++ b/packages/api/src/client/types/app/bsky/graph/unmuteActorList.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.unmuteActorList' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { list: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/graph/unmuteThread.ts b/packages/api/src/client/types/app/bsky/graph/unmuteThread.ts index d5b7abd12a4..aaf6f06e323 100644 --- a/packages/api/src/client/types/app/bsky/graph/unmuteThread.ts +++ b/packages/api/src/client/types/app/bsky/graph/unmuteThread.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.graph.unmuteThread' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { root: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/labeler/defs.ts b/packages/api/src/client/types/app/bsky/labeler/defs.ts index a997438bf75..f5393d454f4 100644 --- a/packages/api/src/client/types/app/bsky/labeler/defs.ts +++ b/packages/api/src/client/types/app/bsky/labeler/defs.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' @@ -11,6 +11,7 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' export const id = 'app.bsky.labeler.defs' export interface LabelerView { + $type?: 'app.bsky.labeler.defs#labelerView' uri: string cid: string creator: AppBskyActorDefs.ProfileView @@ -18,12 +19,9 @@ export interface LabelerView { viewer?: LabelerViewerState indexedAt: string labels?: ComAtprotoLabelDefs.Label[] - [k: string]: unknown } -export function isLabelerView( - v: unknown, -): v is LabelerView & { $type: $Type<'app.bsky.labeler.defs', 'labelerView'> } { +export function isLabelerView(v: unknown): v is $Typed { return is$typed(v, id, 'labelerView') } @@ -35,6 +33,7 @@ export function validateLabelerView(v: unknown) { } export interface LabelerViewDetailed { + $type?: 'app.bsky.labeler.defs#labelerViewDetailed' uri: string cid: string creator: AppBskyActorDefs.ProfileView @@ -43,12 +42,11 @@ export interface LabelerViewDetailed { viewer?: LabelerViewerState indexedAt: string labels?: ComAtprotoLabelDefs.Label[] - [k: string]: unknown } -export function isLabelerViewDetailed(v: unknown): v is LabelerViewDetailed & { - $type: $Type<'app.bsky.labeler.defs', 'labelerViewDetailed'> -} { +export function isLabelerViewDetailed( + v: unknown, +): v is $Typed { return is$typed(v, id, 'labelerViewDetailed') } @@ -60,13 +58,13 @@ export function validateLabelerViewDetailed(v: unknown) { } export interface LabelerViewerState { + $type?: 'app.bsky.labeler.defs#labelerViewerState' like?: string - [k: string]: unknown } -export function isLabelerViewerState(v: unknown): v is LabelerViewerState & { - $type: $Type<'app.bsky.labeler.defs', 'labelerViewerState'> -} { +export function isLabelerViewerState( + v: unknown, +): v is $Typed { return is$typed(v, id, 'labelerViewerState') } @@ -78,16 +76,14 @@ export function validateLabelerViewerState(v: unknown) { } export interface LabelerPolicies { + $type?: 'app.bsky.labeler.defs#labelerPolicies' /** The label values which this labeler publishes. May include global or custom labels. */ labelValues: ComAtprotoLabelDefs.LabelValue[] /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[] - [k: string]: unknown } -export function isLabelerPolicies(v: unknown): v is LabelerPolicies & { - $type: $Type<'app.bsky.labeler.defs', 'labelerPolicies'> -} { +export function isLabelerPolicies(v: unknown): v is $Typed { return is$typed(v, id, 'labelerPolicies') } diff --git a/packages/api/src/client/types/app/bsky/labeler/getServices.ts b/packages/api/src/client/types/app/bsky/labeler/getServices.ts index 45a2bd60ae1..4982a40ffe8 100644 --- a/packages/api/src/client/types/app/bsky/labeler/getServices.ts +++ b/packages/api/src/client/types/app/bsky/labeler/getServices.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyLabelerDefs from './defs' @@ -19,11 +19,10 @@ export type InputSchema = undefined export interface OutputSchema { views: ( - | AppBskyLabelerDefs.LabelerView - | AppBskyLabelerDefs.LabelerViewDetailed - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/labeler/service.ts b/packages/api/src/client/types/app/bsky/labeler/service.ts index 14afb445cc6..43f9885a786 100644 --- a/packages/api/src/client/types/app/bsky/labeler/service.ts +++ b/packages/api/src/client/types/app/bsky/labeler/service.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyLabelerDefs from './defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' @@ -11,17 +11,16 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' export const id = 'app.bsky.labeler.service' export interface Record { + $type?: 'app.bsky.labeler.service' | 'app.bsky.labeler.service#main' policies: AppBskyLabelerDefs.LabelerPolicies labels?: - | ComAtprotoLabelDefs.SelfLabels - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed<{ [k: string]: unknown }> createdAt: string [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'app.bsky.labeler.service', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/app/bsky/notification/getUnreadCount.ts b/packages/api/src/client/types/app/bsky/notification/getUnreadCount.ts index 11bb1adf9e3..bbd1a9bb516 100644 --- a/packages/api/src/client/types/app/bsky/notification/getUnreadCount.ts +++ b/packages/api/src/client/types/app/bsky/notification/getUnreadCount.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.notification.getUnreadCount' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { count: number - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/notification/listNotifications.ts b/packages/api/src/client/types/app/bsky/notification/listNotifications.ts index db48e5277d1..e76256b4c2f 100644 --- a/packages/api/src/client/types/app/bsky/notification/listNotifications.ts +++ b/packages/api/src/client/types/app/bsky/notification/listNotifications.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' @@ -25,7 +25,6 @@ export interface OutputSchema { notifications: Notification[] priority?: boolean seenAt?: string - [k: string]: unknown } export interface CallOptions { @@ -44,6 +43,7 @@ export function toKnownErr(e: any) { } export interface Notification { + $type?: 'app.bsky.notification.listNotifications#notification' uri: string cid: string author: AppBskyActorDefs.ProfileView @@ -58,16 +58,13 @@ export interface Notification { | 'starterpack-joined' | (string & {}) reasonSubject?: string - record: {} + record: { [_ in string]: unknown } isRead: boolean indexedAt: string labels?: ComAtprotoLabelDefs.Label[] - [k: string]: unknown } -export function isNotification(v: unknown): v is Notification & { - $type: $Type<'app.bsky.notification.listNotifications', 'notification'> -} { +export function isNotification(v: unknown): v is $Typed { return is$typed(v, id, 'notification') } diff --git a/packages/api/src/client/types/app/bsky/notification/putPreferences.ts b/packages/api/src/client/types/app/bsky/notification/putPreferences.ts index 2499eba8fa3..c1a8bce611a 100644 --- a/packages/api/src/client/types/app/bsky/notification/putPreferences.ts +++ b/packages/api/src/client/types/app/bsky/notification/putPreferences.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.notification.putPreferences' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { priority: boolean - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/notification/registerPush.ts b/packages/api/src/client/types/app/bsky/notification/registerPush.ts index 06d8806165f..9e320e5ded2 100644 --- a/packages/api/src/client/types/app/bsky/notification/registerPush.ts +++ b/packages/api/src/client/types/app/bsky/notification/registerPush.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.notification.registerPush' @@ -16,7 +16,6 @@ export interface InputSchema { token: string platform: 'ios' | 'android' | 'web' | (string & {}) appId: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/notification/updateSeen.ts b/packages/api/src/client/types/app/bsky/notification/updateSeen.ts index 64aac3c7c90..6716f534ae6 100644 --- a/packages/api/src/client/types/app/bsky/notification/updateSeen.ts +++ b/packages/api/src/client/types/app/bsky/notification/updateSeen.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.notification.updateSeen' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { seenAt: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/richtext/facet.ts b/packages/api/src/client/types/app/bsky/richtext/facet.ts index f7a0ad8c949..245b681a318 100644 --- a/packages/api/src/client/types/app/bsky/richtext/facet.ts +++ b/packages/api/src/client/types/app/bsky/richtext/facet.ts @@ -3,21 +3,24 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.richtext.facet' /** Annotation of a sub-string within rich text. */ export interface Main { + $type?: 'app.bsky.richtext.facet' | 'app.bsky.richtext.facet#main' index: ByteSlice - features: (Mention | Link | Tag | { $type: string; [k: string]: unknown })[] - [k: string]: unknown + features: ( + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> + )[] } -export function isMain( - v: unknown, -): v is Main & { $type: $Type<'app.bsky.richtext.facet', 'main'> } { +export function isMain(v: unknown): v is $Typed
{ return is$typed(v, id, 'main') } @@ -27,13 +30,11 @@ export function validateMain(v: unknown) { /** Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID. */ export interface Mention { + $type?: 'app.bsky.richtext.facet#mention' did: string - [k: string]: unknown } -export function isMention( - v: unknown, -): v is Mention & { $type: $Type<'app.bsky.richtext.facet', 'mention'> } { +export function isMention(v: unknown): v is $Typed { return is$typed(v, id, 'mention') } @@ -43,13 +44,11 @@ export function validateMention(v: unknown) { /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ export interface Link { + $type?: 'app.bsky.richtext.facet#link' uri: string - [k: string]: unknown } -export function isLink( - v: unknown, -): v is Link & { $type: $Type<'app.bsky.richtext.facet', 'link'> } { +export function isLink(v: unknown): v is $Typed { return is$typed(v, id, 'link') } @@ -59,13 +58,11 @@ export function validateLink(v: unknown) { /** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ export interface Tag { + $type?: 'app.bsky.richtext.facet#tag' tag: string - [k: string]: unknown } -export function isTag( - v: unknown, -): v is Tag & { $type: $Type<'app.bsky.richtext.facet', 'tag'> } { +export function isTag(v: unknown): v is $Typed { return is$typed(v, id, 'tag') } @@ -75,14 +72,12 @@ export function validateTag(v: unknown) { /** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ export interface ByteSlice { + $type?: 'app.bsky.richtext.facet#byteSlice' byteStart: number byteEnd: number - [k: string]: unknown } -export function isByteSlice( - v: unknown, -): v is ByteSlice & { $type: $Type<'app.bsky.richtext.facet', 'byteSlice'> } { +export function isByteSlice(v: unknown): v is $Typed { return is$typed(v, id, 'byteSlice') } diff --git a/packages/api/src/client/types/app/bsky/unspecced/defs.ts b/packages/api/src/client/types/app/bsky/unspecced/defs.ts index f05aacd324a..45c56875022 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/defs.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/defs.ts @@ -3,19 +3,19 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.unspecced.defs' export interface SkeletonSearchPost { + $type?: 'app.bsky.unspecced.defs#skeletonSearchPost' uri: string - [k: string]: unknown } -export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost & { - $type: $Type<'app.bsky.unspecced.defs', 'skeletonSearchPost'> -} { +export function isSkeletonSearchPost( + v: unknown, +): v is $Typed { return is$typed(v, id, 'skeletonSearchPost') } @@ -27,13 +27,13 @@ export function validateSkeletonSearchPost(v: unknown) { } export interface SkeletonSearchActor { + $type?: 'app.bsky.unspecced.defs#skeletonSearchActor' did: string - [k: string]: unknown } -export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor & { - $type: $Type<'app.bsky.unspecced.defs', 'skeletonSearchActor'> -} { +export function isSkeletonSearchActor( + v: unknown, +): v is $Typed { return is$typed(v, id, 'skeletonSearchActor') } diff --git a/packages/api/src/client/types/app/bsky/unspecced/getConfig.ts b/packages/api/src/client/types/app/bsky/unspecced/getConfig.ts index fc15923bb97..688cf53a341 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getConfig.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getConfig.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.unspecced.getConfig' @@ -15,7 +15,6 @@ export type InputSchema = undefined export interface OutputSchema { checkEmailConfirmed?: boolean - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts b/packages/api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts index fd7dabd3ebe..3d59c676872 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from '../feed/defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string feeds: AppBskyFeedDefs.GeneratorView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts index 68e36e7497d..597a1777494 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyUnspeccedDefs from './defs' @@ -26,7 +26,6 @@ export interface OutputSchema { actors: AppBskyUnspeccedDefs.SkeletonSearchActor[] /** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */ relativeToDid?: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/unspecced/getTaggedSuggestions.ts b/packages/api/src/client/types/app/bsky/unspecced/getTaggedSuggestions.ts index 7a3651b192f..8baf9b80313 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getTaggedSuggestions.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getTaggedSuggestions.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.unspecced.getTaggedSuggestions' @@ -15,7 +15,6 @@ export type InputSchema = undefined export interface OutputSchema { suggestions: Suggestion[] - [k: string]: unknown } export interface CallOptions { @@ -34,15 +33,13 @@ export function toKnownErr(e: any) { } export interface Suggestion { + $type?: 'app.bsky.unspecced.getTaggedSuggestions#suggestion' tag: string subjectType: 'actor' | 'feed' | (string & {}) subject: string - [k: string]: unknown } -export function isSuggestion(v: unknown): v is Suggestion & { - $type: $Type<'app.bsky.unspecced.getTaggedSuggestions', 'suggestion'> -} { +export function isSuggestion(v: unknown): v is $Typed { return is$typed(v, id, 'suggestion') } diff --git a/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts index 6056d5971ef..1e3cdd67d8e 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyUnspeccedDefs from './defs' @@ -29,7 +29,6 @@ export interface OutputSchema { /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number actors: AppBskyUnspeccedDefs.SkeletonSearchActor[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts index 5ee5fe6ec78..517ee792e29 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyUnspeccedDefs from './defs' @@ -45,7 +45,6 @@ export interface OutputSchema { /** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */ hitsTotal?: number posts: AppBskyUnspeccedDefs.SkeletonSearchPost[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/video/defs.ts b/packages/api/src/client/types/app/bsky/video/defs.ts index 4a9754f8c3b..4ba1a402a80 100644 --- a/packages/api/src/client/types/app/bsky/video/defs.ts +++ b/packages/api/src/client/types/app/bsky/video/defs.ts @@ -3,12 +3,13 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.video.defs' export interface JobStatus { + $type?: 'app.bsky.video.defs#jobStatus' jobId: string did: string /** The state of the video processing job. All values not listed as a known value indicate that the job is in process. */ @@ -18,12 +19,9 @@ export interface JobStatus { blob?: BlobRef error?: string message?: string - [k: string]: unknown } -export function isJobStatus( - v: unknown, -): v is JobStatus & { $type: $Type<'app.bsky.video.defs', 'jobStatus'> } { +export function isJobStatus(v: unknown): v is $Typed { return is$typed(v, id, 'jobStatus') } diff --git a/packages/api/src/client/types/app/bsky/video/getJobStatus.ts b/packages/api/src/client/types/app/bsky/video/getJobStatus.ts index ebdf401bd86..d092c38f17f 100644 --- a/packages/api/src/client/types/app/bsky/video/getJobStatus.ts +++ b/packages/api/src/client/types/app/bsky/video/getJobStatus.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyVideoDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { jobStatus: AppBskyVideoDefs.JobStatus - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/video/getUploadLimits.ts b/packages/api/src/client/types/app/bsky/video/getUploadLimits.ts index 6b342c675f7..57b0cd78784 100644 --- a/packages/api/src/client/types/app/bsky/video/getUploadLimits.ts +++ b/packages/api/src/client/types/app/bsky/video/getUploadLimits.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'app.bsky.video.getUploadLimits' @@ -19,7 +19,6 @@ export interface OutputSchema { remainingDailyBytes?: number message?: string error?: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/app/bsky/video/uploadVideo.ts b/packages/api/src/client/types/app/bsky/video/uploadVideo.ts index fb502d54edd..37348c66cf6 100644 --- a/packages/api/src/client/types/app/bsky/video/uploadVideo.ts +++ b/packages/api/src/client/types/app/bsky/video/uploadVideo.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyVideoDefs from './defs' @@ -16,7 +16,6 @@ export type InputSchema = string | Uint8Array | Blob export interface OutputSchema { jobStatus: AppBskyVideoDefs.JobStatus - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/actor/declaration.ts b/packages/api/src/client/types/chat/bsky/actor/declaration.ts index 5a4ddc641bf..8f5b2c31eb9 100644 --- a/packages/api/src/client/types/chat/bsky/actor/declaration.ts +++ b/packages/api/src/client/types/chat/bsky/actor/declaration.ts @@ -3,19 +3,18 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'chat.bsky.actor.declaration' export interface Record { + $type?: 'chat.bsky.actor.declaration' | 'chat.bsky.actor.declaration#main' allowIncoming: 'all' | 'none' | 'following' | (string & {}) [k: string]: unknown } -export function isRecord( - v: unknown, -): v is Record & { $type: $Type<'chat.bsky.actor.declaration', 'main'> } { +export function isRecord(v: unknown): v is $Typed { return is$typed(v, id, 'main') } diff --git a/packages/api/src/client/types/chat/bsky/actor/defs.ts b/packages/api/src/client/types/chat/bsky/actor/defs.ts index c2e168966f2..b0fe166eb4f 100644 --- a/packages/api/src/client/types/chat/bsky/actor/defs.ts +++ b/packages/api/src/client/types/chat/bsky/actor/defs.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../../../app/bsky/actor/defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' @@ -11,6 +11,7 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' export const id = 'chat.bsky.actor.defs' export interface ProfileViewBasic { + $type?: 'chat.bsky.actor.defs#profileViewBasic' did: string handle: string displayName?: string @@ -20,12 +21,9 @@ export interface ProfileViewBasic { labels?: ComAtprotoLabelDefs.Label[] /** Set to true when the actor cannot actively participate in converations */ chatDisabled?: boolean - [k: string]: unknown } -export function isProfileViewBasic(v: unknown): v is ProfileViewBasic & { - $type: $Type<'chat.bsky.actor.defs', 'profileViewBasic'> -} { +export function isProfileViewBasic(v: unknown): v is $Typed { return is$typed(v, id, 'profileViewBasic') } diff --git a/packages/api/src/client/types/chat/bsky/actor/deleteAccount.ts b/packages/api/src/client/types/chat/bsky/actor/deleteAccount.ts index 32efca00eb4..b2d6338e9f0 100644 --- a/packages/api/src/client/types/chat/bsky/actor/deleteAccount.ts +++ b/packages/api/src/client/types/chat/bsky/actor/deleteAccount.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'chat.bsky.actor.deleteAccount' @@ -13,9 +13,7 @@ export interface QueryParams {} export type InputSchema = undefined -export interface OutputSchema { - [k: string]: unknown -} +export interface OutputSchema {} export interface CallOptions { signal?: AbortSignal diff --git a/packages/api/src/client/types/chat/bsky/actor/exportAccountData.ts b/packages/api/src/client/types/chat/bsky/actor/exportAccountData.ts index 519e0ac93d8..578b887615d 100644 --- a/packages/api/src/client/types/chat/bsky/actor/exportAccountData.ts +++ b/packages/api/src/client/types/chat/bsky/actor/exportAccountData.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'chat.bsky.actor.exportAccountData' diff --git a/packages/api/src/client/types/chat/bsky/convo/defs.ts b/packages/api/src/client/types/chat/bsky/convo/defs.ts index 576970a0b3a..d99cae985dc 100644 --- a/packages/api/src/client/types/chat/bsky/convo/defs.ts +++ b/packages/api/src/client/types/chat/bsky/convo/defs.ts @@ -3,7 +3,7 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../../../app/bsky/richtext/facet' import * as AppBskyEmbedRecord from '../../../app/bsky/embed/record' @@ -12,15 +12,13 @@ import * as ChatBskyActorDefs from '../actor/defs' export const id = 'chat.bsky.convo.defs' export interface MessageRef { + $type?: 'chat.bsky.convo.defs#messageRef' did: string convoId: string messageId: string - [k: string]: unknown } -export function isMessageRef( - v: unknown, -): v is MessageRef & { $type: $Type<'chat.bsky.convo.defs', 'messageRef'> } { +export function isMessageRef(v: unknown): v is $Typed { return is$typed(v, id, 'messageRef') } @@ -32,16 +30,14 @@ export function validateMessageRef(v: unknown) { } export interface MessageInput { + $type?: 'chat.bsky.convo.defs#messageInput' text: string /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[] - embed?: AppBskyEmbedRecord.Main | { $type: string; [k: string]: unknown } - [k: string]: unknown + embed?: $Typed | $Typed<{ [k: string]: unknown }> } -export function isMessageInput(v: unknown): v is MessageInput & { - $type: $Type<'chat.bsky.convo.defs', 'messageInput'> -} { +export function isMessageInput(v: unknown): v is $Typed { return is$typed(v, id, 'messageInput') } @@ -53,20 +49,18 @@ export function validateMessageInput(v: unknown) { } export interface MessageView { + $type?: 'chat.bsky.convo.defs#messageView' id: string rev: string text: string /** Annotations of text (mentions, URLs, hashtags, etc) */ facets?: AppBskyRichtextFacet.Main[] - embed?: AppBskyEmbedRecord.View | { $type: string; [k: string]: unknown } + embed?: $Typed | $Typed<{ [k: string]: unknown }> sender: MessageViewSender sentAt: string - [k: string]: unknown } -export function isMessageView( - v: unknown, -): v is MessageView & { $type: $Type<'chat.bsky.convo.defs', 'messageView'> } { +export function isMessageView(v: unknown): v is $Typed { return is$typed(v, id, 'messageView') } @@ -78,16 +72,16 @@ export function validateMessageView(v: unknown) { } export interface DeletedMessageView { + $type?: 'chat.bsky.convo.defs#deletedMessageView' id: string rev: string sender: MessageViewSender sentAt: string - [k: string]: unknown } -export function isDeletedMessageView(v: unknown): v is DeletedMessageView & { - $type: $Type<'chat.bsky.convo.defs', 'deletedMessageView'> -} { +export function isDeletedMessageView( + v: unknown, +): v is $Typed { return is$typed(v, id, 'deletedMessageView') } @@ -99,13 +93,13 @@ export function validateDeletedMessageView(v: unknown) { } export interface MessageViewSender { + $type?: 'chat.bsky.convo.defs#messageViewSender' did: string - [k: string]: unknown } -export function isMessageViewSender(v: unknown): v is MessageViewSender & { - $type: $Type<'chat.bsky.convo.defs', 'messageViewSender'> -} { +export function isMessageViewSender( + v: unknown, +): v is $Typed { return is$typed(v, id, 'messageViewSender') } @@ -117,22 +111,20 @@ export function validateMessageViewSender(v: unknown) { } export interface ConvoView { + $type?: 'chat.bsky.convo.defs#convoView' id: string rev: string members: ChatBskyActorDefs.ProfileViewBasic[] lastMessage?: - | MessageView - | DeletedMessageView - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> muted: boolean opened?: boolean unreadCount: number - [k: string]: unknown } -export function isConvoView( - v: unknown, -): v is ConvoView & { $type: $Type<'chat.bsky.convo.defs', 'convoView'> } { +export function isConvoView(v: unknown): v is $Typed { return is$typed(v, id, 'convoView') } @@ -141,14 +133,12 @@ export function validateConvoView(v: unknown) { } export interface LogBeginConvo { + $type?: 'chat.bsky.convo.defs#logBeginConvo' rev: string convoId: string - [k: string]: unknown } -export function isLogBeginConvo(v: unknown): v is LogBeginConvo & { - $type: $Type<'chat.bsky.convo.defs', 'logBeginConvo'> -} { +export function isLogBeginConvo(v: unknown): v is $Typed { return is$typed(v, id, 'logBeginConvo') } @@ -160,14 +150,12 @@ export function validateLogBeginConvo(v: unknown) { } export interface LogLeaveConvo { + $type?: 'chat.bsky.convo.defs#logLeaveConvo' rev: string convoId: string - [k: string]: unknown } -export function isLogLeaveConvo(v: unknown): v is LogLeaveConvo & { - $type: $Type<'chat.bsky.convo.defs', 'logLeaveConvo'> -} { +export function isLogLeaveConvo(v: unknown): v is $Typed { return is$typed(v, id, 'logLeaveConvo') } @@ -179,18 +167,16 @@ export function validateLogLeaveConvo(v: unknown) { } export interface LogCreateMessage { + $type?: 'chat.bsky.convo.defs#logCreateMessage' rev: string convoId: string message: - | MessageView - | DeletedMessageView - | { $type: string; [k: string]: unknown } - [k: string]: unknown + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> } -export function isLogCreateMessage(v: unknown): v is LogCreateMessage & { - $type: $Type<'chat.bsky.convo.defs', 'logCreateMessage'> -} { +export function isLogCreateMessage(v: unknown): v is $Typed { return is$typed(v, id, 'logCreateMessage') } @@ -202,18 +188,16 @@ export function validateLogCreateMessage(v: unknown) { } export interface LogDeleteMessage { + $type?: 'chat.bsky.convo.defs#logDeleteMessage' rev: string convoId: string message: - | MessageView - | DeletedMessageView - | { $type: string; [k: string]: unknown } - [k: string]: unknown + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> } -export function isLogDeleteMessage(v: unknown): v is LogDeleteMessage & { - $type: $Type<'chat.bsky.convo.defs', 'logDeleteMessage'> -} { +export function isLogDeleteMessage(v: unknown): v is $Typed { return is$typed(v, id, 'logDeleteMessage') } diff --git a/packages/api/src/client/types/chat/bsky/convo/deleteMessageForSelf.ts b/packages/api/src/client/types/chat/bsky/convo/deleteMessageForSelf.ts index b29dfc72c0f..63009fea6e9 100644 --- a/packages/api/src/client/types/chat/bsky/convo/deleteMessageForSelf.ts +++ b/packages/api/src/client/types/chat/bsky/convo/deleteMessageForSelf.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -15,7 +15,6 @@ export interface QueryParams {} export interface InputSchema { convoId: string messageId: string - [k: string]: unknown } export type OutputSchema = ChatBskyConvoDefs.DeletedMessageView diff --git a/packages/api/src/client/types/chat/bsky/convo/getConvo.ts b/packages/api/src/client/types/chat/bsky/convo/getConvo.ts index 8ba84933892..d55d411e3cb 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getConvo.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { convo: ChatBskyConvoDefs.ConvoView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/getConvoForMembers.ts b/packages/api/src/client/types/chat/bsky/convo/getConvoForMembers.ts index 91a220ed558..034b9812aaa 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getConvoForMembers.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getConvoForMembers.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { convo: ChatBskyConvoDefs.ConvoView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/getLog.ts b/packages/api/src/client/types/chat/bsky/convo/getLog.ts index a84763c3c72..210541c13bc 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getLog.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getLog.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -19,13 +19,12 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string logs: ( - | ChatBskyConvoDefs.LogBeginConvo - | ChatBskyConvoDefs.LogLeaveConvo - | ChatBskyConvoDefs.LogCreateMessage - | ChatBskyConvoDefs.LogDeleteMessage - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/getMessages.ts b/packages/api/src/client/types/chat/bsky/convo/getMessages.ts index 4cdf560dfe1..13f66aa1e72 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getMessages.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getMessages.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -21,11 +21,10 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string messages: ( - | ChatBskyConvoDefs.MessageView - | ChatBskyConvoDefs.DeletedMessageView - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/leaveConvo.ts b/packages/api/src/client/types/chat/bsky/convo/leaveConvo.ts index 2aa4a21690f..5408817ea5b 100644 --- a/packages/api/src/client/types/chat/bsky/convo/leaveConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/leaveConvo.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'chat.bsky.convo.leaveConvo' @@ -13,13 +13,11 @@ export interface QueryParams {} export interface InputSchema { convoId: string - [k: string]: unknown } export interface OutputSchema { convoId: string rev: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/listConvos.ts b/packages/api/src/client/types/chat/bsky/convo/listConvos.ts index 99313f78385..d3d05a84fc7 100644 --- a/packages/api/src/client/types/chat/bsky/convo/listConvos.ts +++ b/packages/api/src/client/types/chat/bsky/convo/listConvos.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -20,7 +20,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string convos: ChatBskyConvoDefs.ConvoView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/muteConvo.ts b/packages/api/src/client/types/chat/bsky/convo/muteConvo.ts index d7431dacfae..2e40480823a 100644 --- a/packages/api/src/client/types/chat/bsky/convo/muteConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/muteConvo.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -14,12 +14,10 @@ export interface QueryParams {} export interface InputSchema { convoId: string - [k: string]: unknown } export interface OutputSchema { convo: ChatBskyConvoDefs.ConvoView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/sendMessage.ts b/packages/api/src/client/types/chat/bsky/convo/sendMessage.ts index b61f147bc1c..8ccf0129084 100644 --- a/packages/api/src/client/types/chat/bsky/convo/sendMessage.ts +++ b/packages/api/src/client/types/chat/bsky/convo/sendMessage.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -15,7 +15,6 @@ export interface QueryParams {} export interface InputSchema { convoId: string message: ChatBskyConvoDefs.MessageInput - [k: string]: unknown } export type OutputSchema = ChatBskyConvoDefs.MessageView diff --git a/packages/api/src/client/types/chat/bsky/convo/sendMessageBatch.ts b/packages/api/src/client/types/chat/bsky/convo/sendMessageBatch.ts index dfbcdaf4848..0f014286286 100644 --- a/packages/api/src/client/types/chat/bsky/convo/sendMessageBatch.ts +++ b/packages/api/src/client/types/chat/bsky/convo/sendMessageBatch.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -14,12 +14,10 @@ export interface QueryParams {} export interface InputSchema { items: BatchItem[] - [k: string]: unknown } export interface OutputSchema { items: ChatBskyConvoDefs.MessageView[] - [k: string]: unknown } export interface CallOptions { @@ -40,14 +38,12 @@ export function toKnownErr(e: any) { } export interface BatchItem { + $type?: 'chat.bsky.convo.sendMessageBatch#batchItem' convoId: string message: ChatBskyConvoDefs.MessageInput - [k: string]: unknown } -export function isBatchItem(v: unknown): v is BatchItem & { - $type: $Type<'chat.bsky.convo.sendMessageBatch', 'batchItem'> -} { +export function isBatchItem(v: unknown): v is $Typed { return is$typed(v, id, 'batchItem') } diff --git a/packages/api/src/client/types/chat/bsky/convo/unmuteConvo.ts b/packages/api/src/client/types/chat/bsky/convo/unmuteConvo.ts index 67d67ad6af7..9a12ee0ce16 100644 --- a/packages/api/src/client/types/chat/bsky/convo/unmuteConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/unmuteConvo.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -14,12 +14,10 @@ export interface QueryParams {} export interface InputSchema { convoId: string - [k: string]: unknown } export interface OutputSchema { convo: ChatBskyConvoDefs.ConvoView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/convo/updateRead.ts b/packages/api/src/client/types/chat/bsky/convo/updateRead.ts index 61d278e2903..b96b7face11 100644 --- a/packages/api/src/client/types/chat/bsky/convo/updateRead.ts +++ b/packages/api/src/client/types/chat/bsky/convo/updateRead.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' @@ -15,12 +15,10 @@ export interface QueryParams {} export interface InputSchema { convoId: string messageId?: string - [k: string]: unknown } export interface OutputSchema { convo: ChatBskyConvoDefs.ConvoView - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/moderation/getActorMetadata.ts b/packages/api/src/client/types/chat/bsky/moderation/getActorMetadata.ts index 2bfa7a199cd..b6e248a14e3 100644 --- a/packages/api/src/client/types/chat/bsky/moderation/getActorMetadata.ts +++ b/packages/api/src/client/types/chat/bsky/moderation/getActorMetadata.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'chat.bsky.moderation.getActorMetadata' @@ -19,7 +19,6 @@ export interface OutputSchema { day: Metadata month: Metadata all: Metadata - [k: string]: unknown } export interface CallOptions { @@ -38,16 +37,14 @@ export function toKnownErr(e: any) { } export interface Metadata { + $type?: 'chat.bsky.moderation.getActorMetadata#metadata' messagesSent: number messagesReceived: number convos: number convosStarted: number - [k: string]: unknown } -export function isMetadata(v: unknown): v is Metadata & { - $type: $Type<'chat.bsky.moderation.getActorMetadata', 'metadata'> -} { +export function isMetadata(v: unknown): v is $Typed { return is$typed(v, id, 'metadata') } diff --git a/packages/api/src/client/types/chat/bsky/moderation/getMessageContext.ts b/packages/api/src/client/types/chat/bsky/moderation/getMessageContext.ts index 90e05a712be..96c298d7183 100644 --- a/packages/api/src/client/types/chat/bsky/moderation/getMessageContext.ts +++ b/packages/api/src/client/types/chat/bsky/moderation/getMessageContext.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from '../convo/defs' @@ -22,11 +22,10 @@ export type InputSchema = undefined export interface OutputSchema { messages: ( - | ChatBskyConvoDefs.MessageView - | ChatBskyConvoDefs.DeletedMessageView - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> )[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/chat/bsky/moderation/updateActorAccess.ts b/packages/api/src/client/types/chat/bsky/moderation/updateActorAccess.ts index 78b90a0a6a2..02beced3013 100644 --- a/packages/api/src/client/types/chat/bsky/moderation/updateActorAccess.ts +++ b/packages/api/src/client/types/chat/bsky/moderation/updateActorAccess.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'chat.bsky.moderation.updateActorAccess' @@ -15,7 +15,6 @@ export interface InputSchema { actor: string allowAccess: boolean ref?: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/defs.ts b/packages/api/src/client/types/com/atproto/admin/defs.ts index c0a8f8de23d..d1161e95a0b 100644 --- a/packages/api/src/client/types/com/atproto/admin/defs.ts +++ b/packages/api/src/client/types/com/atproto/admin/defs.ts @@ -3,21 +3,19 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoServerDefs from '../server/defs' export const id = 'com.atproto.admin.defs' export interface StatusAttr { + $type?: 'com.atproto.admin.defs#statusAttr' applied: boolean ref?: string - [k: string]: unknown } -export function isStatusAttr( - v: unknown, -): v is StatusAttr & { $type: $Type<'com.atproto.admin.defs', 'statusAttr'> } { +export function isStatusAttr(v: unknown): v is $Typed { return is$typed(v, id, 'statusAttr') } @@ -29,10 +27,11 @@ export function validateStatusAttr(v: unknown) { } export interface AccountView { + $type?: 'com.atproto.admin.defs#accountView' did: string handle: string email?: string - relatedRecords?: {}[] + relatedRecords?: { [_ in string]: unknown }[] indexedAt: string invitedBy?: ComAtprotoServerDefs.InviteCode invites?: ComAtprotoServerDefs.InviteCode[] @@ -41,12 +40,9 @@ export interface AccountView { inviteNote?: string deactivatedAt?: string threatSignatures?: ThreatSignature[] - [k: string]: unknown } -export function isAccountView(v: unknown): v is AccountView & { - $type: $Type<'com.atproto.admin.defs', 'accountView'> -} { +export function isAccountView(v: unknown): v is $Typed { return is$typed(v, id, 'accountView') } @@ -58,13 +54,11 @@ export function validateAccountView(v: unknown) { } export interface RepoRef { + $type?: 'com.atproto.admin.defs#repoRef' did: string - [k: string]: unknown } -export function isRepoRef( - v: unknown, -): v is RepoRef & { $type: $Type<'com.atproto.admin.defs', 'repoRef'> } { +export function isRepoRef(v: unknown): v is $Typed { return is$typed(v, id, 'repoRef') } @@ -73,15 +67,13 @@ export function validateRepoRef(v: unknown) { } export interface RepoBlobRef { + $type?: 'com.atproto.admin.defs#repoBlobRef' did: string cid: string recordUri?: string - [k: string]: unknown } -export function isRepoBlobRef(v: unknown): v is RepoBlobRef & { - $type: $Type<'com.atproto.admin.defs', 'repoBlobRef'> -} { +export function isRepoBlobRef(v: unknown): v is $Typed { return is$typed(v, id, 'repoBlobRef') } @@ -93,14 +85,12 @@ export function validateRepoBlobRef(v: unknown) { } export interface ThreatSignature { + $type?: 'com.atproto.admin.defs#threatSignature' property: string value: string - [k: string]: unknown } -export function isThreatSignature(v: unknown): v is ThreatSignature & { - $type: $Type<'com.atproto.admin.defs', 'threatSignature'> -} { +export function isThreatSignature(v: unknown): v is $Typed { return is$typed(v, id, 'threatSignature') } diff --git a/packages/api/src/client/types/com/atproto/admin/deleteAccount.ts b/packages/api/src/client/types/com/atproto/admin/deleteAccount.ts index 8b61c584a1d..fff9241b0d6 100644 --- a/packages/api/src/client/types/com/atproto/admin/deleteAccount.ts +++ b/packages/api/src/client/types/com/atproto/admin/deleteAccount.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.deleteAccount' @@ -13,7 +13,6 @@ export interface QueryParams {} export interface InputSchema { did: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/disableAccountInvites.ts b/packages/api/src/client/types/com/atproto/admin/disableAccountInvites.ts index ce4895cc809..9023bb0e59a 100644 --- a/packages/api/src/client/types/com/atproto/admin/disableAccountInvites.ts +++ b/packages/api/src/client/types/com/atproto/admin/disableAccountInvites.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.disableAccountInvites' @@ -15,7 +15,6 @@ export interface InputSchema { account: string /** Optional reason for disabled invites. */ note?: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/disableInviteCodes.ts b/packages/api/src/client/types/com/atproto/admin/disableInviteCodes.ts index f7b7a14aad9..224d4a2ec1f 100644 --- a/packages/api/src/client/types/com/atproto/admin/disableInviteCodes.ts +++ b/packages/api/src/client/types/com/atproto/admin/disableInviteCodes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.disableInviteCodes' @@ -14,7 +14,6 @@ export interface QueryParams {} export interface InputSchema { codes?: string[] accounts?: string[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/enableAccountInvites.ts b/packages/api/src/client/types/com/atproto/admin/enableAccountInvites.ts index 227d599345c..700ee3f80c9 100644 --- a/packages/api/src/client/types/com/atproto/admin/enableAccountInvites.ts +++ b/packages/api/src/client/types/com/atproto/admin/enableAccountInvites.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.enableAccountInvites' @@ -15,7 +15,6 @@ export interface InputSchema { account: string /** Optional reason for enabled invites. */ note?: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/getAccountInfo.ts b/packages/api/src/client/types/com/atproto/admin/getAccountInfo.ts index be2fa407624..b9e34f2f94a 100644 --- a/packages/api/src/client/types/com/atproto/admin/getAccountInfo.ts +++ b/packages/api/src/client/types/com/atproto/admin/getAccountInfo.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' diff --git a/packages/api/src/client/types/com/atproto/admin/getAccountInfos.ts b/packages/api/src/client/types/com/atproto/admin/getAccountInfos.ts index 1ec19395e0c..40c30e01ee7 100644 --- a/packages/api/src/client/types/com/atproto/admin/getAccountInfos.ts +++ b/packages/api/src/client/types/com/atproto/admin/getAccountInfos.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { infos: ComAtprotoAdminDefs.AccountView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/getInviteCodes.ts b/packages/api/src/client/types/com/atproto/admin/getInviteCodes.ts index 1f189e51851..5001cd187c0 100644 --- a/packages/api/src/client/types/com/atproto/admin/getInviteCodes.ts +++ b/packages/api/src/client/types/com/atproto/admin/getInviteCodes.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoServerDefs from '../server/defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string codes: ComAtprotoServerDefs.InviteCode[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/getSubjectStatus.ts b/packages/api/src/client/types/com/atproto/admin/getSubjectStatus.ts index 37bc36bb1b9..4c15e1ebecc 100644 --- a/packages/api/src/client/types/com/atproto/admin/getSubjectStatus.ts +++ b/packages/api/src/client/types/com/atproto/admin/getSubjectStatus.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' import * as ComAtprotoRepoStrongRef from '../repo/strongRef' @@ -21,13 +21,12 @@ export type InputSchema = undefined export interface OutputSchema { subject: - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - | ComAtprotoAdminDefs.RepoBlobRef - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> takedown?: ComAtprotoAdminDefs.StatusAttr deactivated?: ComAtprotoAdminDefs.StatusAttr - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/searchAccounts.ts b/packages/api/src/client/types/com/atproto/admin/searchAccounts.ts index be52b577255..e855d989a20 100644 --- a/packages/api/src/client/types/com/atproto/admin/searchAccounts.ts +++ b/packages/api/src/client/types/com/atproto/admin/searchAccounts.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' @@ -21,7 +21,6 @@ export type InputSchema = undefined export interface OutputSchema { cursor?: string accounts: ComAtprotoAdminDefs.AccountView[] - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/sendEmail.ts b/packages/api/src/client/types/com/atproto/admin/sendEmail.ts index 23e45543e21..592f5de9547 100644 --- a/packages/api/src/client/types/com/atproto/admin/sendEmail.ts +++ b/packages/api/src/client/types/com/atproto/admin/sendEmail.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.sendEmail' @@ -18,12 +18,10 @@ export interface InputSchema { senderDid: string /** Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers */ comment?: string - [k: string]: unknown } export interface OutputSchema { sent: boolean - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/updateAccountEmail.ts b/packages/api/src/client/types/com/atproto/admin/updateAccountEmail.ts index ef11ea517b5..f446c5a2728 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateAccountEmail.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateAccountEmail.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.updateAccountEmail' @@ -15,7 +15,6 @@ export interface InputSchema { /** The handle or DID of the repo. */ account: string email: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/updateAccountHandle.ts b/packages/api/src/client/types/com/atproto/admin/updateAccountHandle.ts index 60ff1fc7d35..33de5a2f524 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateAccountHandle.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateAccountHandle.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.updateAccountHandle' @@ -14,7 +14,6 @@ export interface QueryParams {} export interface InputSchema { did: string handle: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/updateAccountPassword.ts b/packages/api/src/client/types/com/atproto/admin/updateAccountPassword.ts index 20ba6c538df..23829b5cf1a 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateAccountPassword.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateAccountPassword.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.admin.updateAccountPassword' @@ -14,7 +14,6 @@ export interface QueryParams {} export interface InputSchema { did: string password: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/admin/updateSubjectStatus.ts b/packages/api/src/client/types/com/atproto/admin/updateSubjectStatus.ts index 02b6d56c980..75135c2fff0 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateSubjectStatus.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateSubjectStatus.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' import * as ComAtprotoRepoStrongRef from '../repo/strongRef' @@ -15,23 +15,21 @@ export interface QueryParams {} export interface InputSchema { subject: - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - | ComAtprotoAdminDefs.RepoBlobRef - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> takedown?: ComAtprotoAdminDefs.StatusAttr deactivated?: ComAtprotoAdminDefs.StatusAttr - [k: string]: unknown } export interface OutputSchema { subject: - | ComAtprotoAdminDefs.RepoRef - | ComAtprotoRepoStrongRef.Main - | ComAtprotoAdminDefs.RepoBlobRef - | { $type: string; [k: string]: unknown } + | $Typed + | $Typed + | $Typed + | $Typed<{ [k: string]: unknown }> takedown?: ComAtprotoAdminDefs.StatusAttr - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts b/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts index fb2f9666fd7..ad3e6dc18bc 100644 --- a/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts +++ b/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.identity.getRecommendedDidCredentials' @@ -17,9 +17,8 @@ export interface OutputSchema { /** Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs. */ rotationKeys?: string[] alsoKnownAs?: string[] - verificationMethods?: {} - services?: {} - [k: string]: unknown + verificationMethods?: { [_ in string]: unknown } + services?: { [_ in string]: unknown } } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts b/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts index 8ee81a5c88b..bf20e3d1372 100644 --- a/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts +++ b/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.identity.requestPlcOperationSignature' diff --git a/packages/api/src/client/types/com/atproto/identity/resolveHandle.ts b/packages/api/src/client/types/com/atproto/identity/resolveHandle.ts index 103c50f712c..869769bfea2 100644 --- a/packages/api/src/client/types/com/atproto/identity/resolveHandle.ts +++ b/packages/api/src/client/types/com/atproto/identity/resolveHandle.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.identity.resolveHandle' @@ -18,7 +18,6 @@ export type InputSchema = undefined export interface OutputSchema { did: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts b/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts index 713a13dd96e..16a58c91b71 100644 --- a/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts +++ b/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.identity.signPlcOperation' @@ -16,15 +16,13 @@ export interface InputSchema { token?: string rotationKeys?: string[] alsoKnownAs?: string[] - verificationMethods?: {} - services?: {} - [k: string]: unknown + verificationMethods?: { [_ in string]: unknown } + services?: { [_ in string]: unknown } } export interface OutputSchema { /** A signed DID PLC operation. */ - operation: {} - [k: string]: unknown + operation: { [_ in string]: unknown } } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts b/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts index ce27215afe7..977412e8061 100644 --- a/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts +++ b/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.identity.submitPlcOperation' @@ -12,8 +12,7 @@ export const id = 'com.atproto.identity.submitPlcOperation' export interface QueryParams {} export interface InputSchema { - operation: {} - [k: string]: unknown + operation: { [_ in string]: unknown } } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/identity/updateHandle.ts b/packages/api/src/client/types/com/atproto/identity/updateHandle.ts index 57aa5b52e8a..75d85fac3c1 100644 --- a/packages/api/src/client/types/com/atproto/identity/updateHandle.ts +++ b/packages/api/src/client/types/com/atproto/identity/updateHandle.ts @@ -4,7 +4,7 @@ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.identity.updateHandle' @@ -14,7 +14,6 @@ export interface QueryParams {} export interface InputSchema { /** The new handle. */ handle: string - [k: string]: unknown } export interface CallOptions { diff --git a/packages/api/src/client/types/com/atproto/label/defs.ts b/packages/api/src/client/types/com/atproto/label/defs.ts index 1668bb4bba5..8c751c5b16f 100644 --- a/packages/api/src/client/types/com/atproto/label/defs.ts +++ b/packages/api/src/client/types/com/atproto/label/defs.ts @@ -3,13 +3,14 @@ */ import { ValidationResult, BlobRef } from '@atproto/lexicon' import { CID } from 'multiformats/cid' -import { $Type, is$typed } from '../../../../util' +import { $Type, $Typed, is$typed, OmitKey } from '../../../../util' import { lexicons } from '../../../../lexicons' export const id = 'com.atproto.label.defs' /** Metadata tag on an atproto resource (eg, repo or record). */ export interface Label { + $type?: 'com.atproto.label.defs#label' /** The AT Protocol version of the label object. */ ver?: number /** DID of the actor who created this label. */ @@ -28,12 +29,9 @@ export interface Label { exp?: string /** Signature of dag-cbor encoded label. */ sig?: Uint8Array - [k: string]: unknown } -export function isLabel( - v: unknown, -): v is Label & { $type: $Type<'com.atproto.label.defs', 'label'> } { +export function isLabel(v: unknown): v is $Typed