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 c6392632de0..1efd63e75a3 100644 --- a/packages/api/src/client/types/app/bsky/actor/defs.ts +++ b/packages/api/src/client/types/app/bsky/actor/defs.ts @@ -2,13 +2,15 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as AppBskyGraphDefs from '../graph/defs' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' +export const id = 'app.bsky.actor.defs' + export interface ProfileViewBasic { did: string handle: string @@ -21,16 +23,17 @@ export interface ProfileViewBasic { [k: string]: unknown } -export function isProfileViewBasic(v: unknown): v is ProfileViewBasic { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#profileViewBasic' - ) +export function isProfileViewBasic( + v: unknown, +): v is ProfileViewBasic & { $type: 'app.bsky.actor.defs#profileViewBasic' } { + return is$typed(v, id, 'profileViewBasic') } -export function validateProfileViewBasic(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#profileViewBasic', v) +export function validateProfileViewBasic(v: unknown) { + return lexicons.validate( + `${id}#profileViewBasic`, + v, + ) as ValidationResult } export interface ProfileView { @@ -47,16 +50,17 @@ export interface ProfileView { [k: string]: unknown } -export function isProfileView(v: unknown): v is ProfileView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#profileView' - ) +export function isProfileView( + v: unknown, +): v is ProfileView & { $type: 'app.bsky.actor.defs#profileView' } { + return is$typed(v, id, 'profileView') } -export function validateProfileView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#profileView', v) +export function validateProfileView(v: unknown) { + return lexicons.validate( + `${id}#profileView`, + v, + ) as ValidationResult } export interface ProfileViewDetailed { @@ -79,16 +83,17 @@ export interface ProfileViewDetailed { [k: string]: unknown } -export function isProfileViewDetailed(v: unknown): v is ProfileViewDetailed { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#profileViewDetailed' - ) +export function isProfileViewDetailed(v: unknown): v is ProfileViewDetailed & { + $type: 'app.bsky.actor.defs#profileViewDetailed' +} { + return is$typed(v, id, 'profileViewDetailed') } -export function validateProfileViewDetailed(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#profileViewDetailed', v) +export function validateProfileViewDetailed(v: unknown) { + return lexicons.validate( + `${id}#profileViewDetailed`, + v, + ) as ValidationResult } export interface ProfileAssociated { @@ -100,16 +105,17 @@ export interface ProfileAssociated { [k: string]: unknown } -export function isProfileAssociated(v: unknown): v is ProfileAssociated { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#profileAssociated' - ) +export function isProfileAssociated( + v: unknown, +): v is ProfileAssociated & { $type: 'app.bsky.actor.defs#profileAssociated' } { + return is$typed(v, id, 'profileAssociated') } -export function validateProfileAssociated(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#profileAssociated', v) +export function validateProfileAssociated(v: unknown) { + return lexicons.validate( + `${id}#profileAssociated`, + v, + ) as ValidationResult } export interface ProfileAssociatedChat { @@ -119,16 +125,17 @@ export interface ProfileAssociatedChat { export function isProfileAssociatedChat( v: unknown, -): v is ProfileAssociatedChat { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#profileAssociatedChat' - ) +): v is ProfileAssociatedChat & { + $type: 'app.bsky.actor.defs#profileAssociatedChat' +} { + return is$typed(v, id, 'profileAssociatedChat') } -export function validateProfileAssociatedChat(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#profileAssociatedChat', v) +export function validateProfileAssociatedChat(v: unknown) { + return lexicons.validate( + `${id}#profileAssociatedChat`, + v, + ) as ValidationResult } /** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ @@ -144,16 +151,17 @@ export interface ViewerState { [k: string]: unknown } -export function isViewerState(v: unknown): v is ViewerState { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#viewerState' - ) +export function isViewerState( + v: unknown, +): v is ViewerState & { $type: 'app.bsky.actor.defs#viewerState' } { + return is$typed(v, id, 'viewerState') } -export function validateViewerState(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#viewerState', v) +export function validateViewerState(v: unknown) { + return lexicons.validate( + `${id}#viewerState`, + v, + ) as ValidationResult } /** The subject's followers whom you also follow */ @@ -163,16 +171,17 @@ export interface KnownFollowers { [k: string]: unknown } -export function isKnownFollowers(v: unknown): v is KnownFollowers { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#knownFollowers' - ) +export function isKnownFollowers( + v: unknown, +): v is KnownFollowers & { $type: 'app.bsky.actor.defs#knownFollowers' } { + return is$typed(v, id, 'knownFollowers') } -export function validateKnownFollowers(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#knownFollowers', v) +export function validateKnownFollowers(v: unknown) { + return lexicons.validate( + `${id}#knownFollowers`, + v, + ) as ValidationResult } export type Preferences = ( @@ -196,16 +205,17 @@ export interface AdultContentPref { [k: string]: unknown } -export function isAdultContentPref(v: unknown): v is AdultContentPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#adultContentPref' - ) +export function isAdultContentPref( + v: unknown, +): v is AdultContentPref & { $type: 'app.bsky.actor.defs#adultContentPref' } { + return is$typed(v, id, 'adultContentPref') } -export function validateAdultContentPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#adultContentPref', v) +export function validateAdultContentPref(v: unknown) { + return lexicons.validate( + `${id}#adultContentPref`, + v, + ) as ValidationResult } export interface ContentLabelPref { @@ -216,16 +226,17 @@ export interface ContentLabelPref { [k: string]: unknown } -export function isContentLabelPref(v: unknown): v is ContentLabelPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#contentLabelPref' - ) +export function isContentLabelPref( + v: unknown, +): v is ContentLabelPref & { $type: 'app.bsky.actor.defs#contentLabelPref' } { + return is$typed(v, id, 'contentLabelPref') } -export function validateContentLabelPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#contentLabelPref', v) +export function validateContentLabelPref(v: unknown) { + return lexicons.validate( + `${id}#contentLabelPref`, + v, + ) as ValidationResult } export interface SavedFeed { @@ -236,16 +247,14 @@ export interface SavedFeed { [k: string]: unknown } -export function isSavedFeed(v: unknown): v is SavedFeed { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#savedFeed' - ) +export function isSavedFeed( + v: unknown, +): v is SavedFeed & { $type: 'app.bsky.actor.defs#savedFeed' } { + return is$typed(v, id, 'savedFeed') } -export function validateSavedFeed(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#savedFeed', v) +export function validateSavedFeed(v: unknown) { + return lexicons.validate(`${id}#savedFeed`, v) as ValidationResult } export interface SavedFeedsPrefV2 { @@ -253,16 +262,17 @@ export interface SavedFeedsPrefV2 { [k: string]: unknown } -export function isSavedFeedsPrefV2(v: unknown): v is SavedFeedsPrefV2 { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#savedFeedsPrefV2' - ) +export function isSavedFeedsPrefV2( + v: unknown, +): v is SavedFeedsPrefV2 & { $type: 'app.bsky.actor.defs#savedFeedsPrefV2' } { + return is$typed(v, id, 'savedFeedsPrefV2') } -export function validateSavedFeedsPrefV2(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#savedFeedsPrefV2', v) +export function validateSavedFeedsPrefV2(v: unknown) { + return lexicons.validate( + `${id}#savedFeedsPrefV2`, + v, + ) as ValidationResult } export interface SavedFeedsPref { @@ -272,16 +282,17 @@ export interface SavedFeedsPref { [k: string]: unknown } -export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#savedFeedsPref' - ) +export function isSavedFeedsPref( + v: unknown, +): v is SavedFeedsPref & { $type: 'app.bsky.actor.defs#savedFeedsPref' } { + return is$typed(v, id, 'savedFeedsPref') } -export function validateSavedFeedsPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#savedFeedsPref', v) +export function validateSavedFeedsPref(v: unknown) { + return lexicons.validate( + `${id}#savedFeedsPref`, + v, + ) as ValidationResult } export interface PersonalDetailsPref { @@ -290,16 +301,17 @@ export interface PersonalDetailsPref { [k: string]: unknown } -export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#personalDetailsPref' - ) +export function isPersonalDetailsPref(v: unknown): v is PersonalDetailsPref & { + $type: 'app.bsky.actor.defs#personalDetailsPref' +} { + return is$typed(v, id, 'personalDetailsPref') } -export function validatePersonalDetailsPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#personalDetailsPref', v) +export function validatePersonalDetailsPref(v: unknown) { + return lexicons.validate( + `${id}#personalDetailsPref`, + v, + ) as ValidationResult } export interface FeedViewPref { @@ -318,16 +330,17 @@ export interface FeedViewPref { [k: string]: unknown } -export function isFeedViewPref(v: unknown): v is FeedViewPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#feedViewPref' - ) +export function isFeedViewPref( + v: unknown, +): v is FeedViewPref & { $type: 'app.bsky.actor.defs#feedViewPref' } { + return is$typed(v, id, 'feedViewPref') } -export function validateFeedViewPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#feedViewPref', v) +export function validateFeedViewPref(v: unknown) { + return lexicons.validate( + `${id}#feedViewPref`, + v, + ) as ValidationResult } export interface ThreadViewPref { @@ -338,16 +351,17 @@ export interface ThreadViewPref { [k: string]: unknown } -export function isThreadViewPref(v: unknown): v is ThreadViewPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#threadViewPref' - ) +export function isThreadViewPref( + v: unknown, +): v is ThreadViewPref & { $type: 'app.bsky.actor.defs#threadViewPref' } { + return is$typed(v, id, 'threadViewPref') } -export function validateThreadViewPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#threadViewPref', v) +export function validateThreadViewPref(v: unknown) { + return lexicons.validate( + `${id}#threadViewPref`, + v, + ) as ValidationResult } export interface InterestsPref { @@ -356,16 +370,17 @@ export interface InterestsPref { [k: string]: unknown } -export function isInterestsPref(v: unknown): v is InterestsPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#interestsPref' - ) +export function isInterestsPref( + v: unknown, +): v is InterestsPref & { $type: 'app.bsky.actor.defs#interestsPref' } { + return is$typed(v, id, 'interestsPref') } -export function validateInterestsPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#interestsPref', v) +export function validateInterestsPref(v: unknown) { + return lexicons.validate( + `${id}#interestsPref`, + v, + ) as ValidationResult } export type MutedWordTarget = 'content' | 'tag' | (string & {}) @@ -384,16 +399,14 @@ export interface MutedWord { [k: string]: unknown } -export function isMutedWord(v: unknown): v is MutedWord { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#mutedWord' - ) +export function isMutedWord( + v: unknown, +): v is MutedWord & { $type: 'app.bsky.actor.defs#mutedWord' } { + return is$typed(v, id, 'mutedWord') } -export function validateMutedWord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#mutedWord', v) +export function validateMutedWord(v: unknown) { + return lexicons.validate(`${id}#mutedWord`, v) as ValidationResult } export interface MutedWordsPref { @@ -402,16 +415,17 @@ export interface MutedWordsPref { [k: string]: unknown } -export function isMutedWordsPref(v: unknown): v is MutedWordsPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#mutedWordsPref' - ) +export function isMutedWordsPref( + v: unknown, +): v is MutedWordsPref & { $type: 'app.bsky.actor.defs#mutedWordsPref' } { + return is$typed(v, id, 'mutedWordsPref') } -export function validateMutedWordsPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#mutedWordsPref', v) +export function validateMutedWordsPref(v: unknown) { + return lexicons.validate( + `${id}#mutedWordsPref`, + v, + ) as ValidationResult } export interface HiddenPostsPref { @@ -420,16 +434,17 @@ export interface HiddenPostsPref { [k: string]: unknown } -export function isHiddenPostsPref(v: unknown): v is HiddenPostsPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#hiddenPostsPref' - ) +export function isHiddenPostsPref( + v: unknown, +): v is HiddenPostsPref & { $type: 'app.bsky.actor.defs#hiddenPostsPref' } { + return is$typed(v, id, 'hiddenPostsPref') } -export function validateHiddenPostsPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#hiddenPostsPref', v) +export function validateHiddenPostsPref(v: unknown) { + return lexicons.validate( + `${id}#hiddenPostsPref`, + v, + ) as ValidationResult } export interface LabelersPref { @@ -437,16 +452,17 @@ export interface LabelersPref { [k: string]: unknown } -export function isLabelersPref(v: unknown): v is LabelersPref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#labelersPref' - ) +export function isLabelersPref( + v: unknown, +): v is LabelersPref & { $type: 'app.bsky.actor.defs#labelersPref' } { + return is$typed(v, id, 'labelersPref') } -export function validateLabelersPref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#labelersPref', v) +export function validateLabelersPref(v: unknown) { + return lexicons.validate( + `${id}#labelersPref`, + v, + ) as ValidationResult } export interface LabelerPrefItem { @@ -454,16 +470,17 @@ export interface LabelerPrefItem { [k: string]: unknown } -export function isLabelerPrefItem(v: unknown): v is LabelerPrefItem { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#labelerPrefItem' - ) +export function isLabelerPrefItem( + v: unknown, +): v is LabelerPrefItem & { $type: 'app.bsky.actor.defs#labelerPrefItem' } { + return is$typed(v, id, 'labelerPrefItem') } -export function validateLabelerPrefItem(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#labelerPrefItem', v) +export function validateLabelerPrefItem(v: unknown) { + return lexicons.validate( + `${id}#labelerPrefItem`, + v, + ) as ValidationResult } /** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ @@ -476,16 +493,17 @@ export interface BskyAppStatePref { [k: string]: unknown } -export function isBskyAppStatePref(v: unknown): v is BskyAppStatePref { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#bskyAppStatePref' - ) +export function isBskyAppStatePref( + v: unknown, +): v is BskyAppStatePref & { $type: 'app.bsky.actor.defs#bskyAppStatePref' } { + return is$typed(v, id, 'bskyAppStatePref') } -export function validateBskyAppStatePref(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#bskyAppStatePref', v) +export function validateBskyAppStatePref(v: unknown) { + return lexicons.validate( + `${id}#bskyAppStatePref`, + v, + ) as ValidationResult } /** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ @@ -494,16 +512,19 @@ export interface BskyAppProgressGuide { [k: string]: unknown } -export function isBskyAppProgressGuide(v: unknown): v is BskyAppProgressGuide { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.actor.defs#bskyAppProgressGuide' - ) +export function isBskyAppProgressGuide( + v: unknown, +): v is BskyAppProgressGuide & { + $type: 'app.bsky.actor.defs#bskyAppProgressGuide' +} { + return is$typed(v, id, 'bskyAppProgressGuide') } -export function validateBskyAppProgressGuide(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#bskyAppProgressGuide', v) +export function validateBskyAppProgressGuide(v: unknown) { + return lexicons.validate( + `${id}#bskyAppProgressGuide`, + v, + ) as ValidationResult } /** A new user experiences (NUX) storage object */ @@ -517,12 +538,12 @@ export interface Nux { [k: string]: unknown } -export function isNux(v: unknown): v is Nux { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.actor.defs#nux' - ) +export function isNux( + v: unknown, +): v is Nux & { $type: 'app.bsky.actor.defs#nux' } { + return is$typed(v, id, 'nux') } -export function validateNux(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.defs#nux', v) +export function validateNux(v: unknown) { + return lexicons.validate(`${id}#nux`, v) as ValidationResult } 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 6cc35cc3c62..ac06a1d779a 100644 --- a/packages/api/src/client/types/app/bsky/actor/getPreferences.ts +++ b/packages/api/src/client/types/app/bsky/actor/getPreferences.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.getPreferences' + export interface QueryParams {} export type InputSchema = undefined 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 13618b6c2f7..32181c788e8 100644 --- a/packages/api/src/client/types/app/bsky/actor/getProfile.ts +++ b/packages/api/src/client/types/app/bsky/actor/getProfile.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.getProfile' + export interface QueryParams { /** Handle or DID of account to fetch profile of. */ actor: string 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 2207218ac69..4e1b44442ad 100644 --- a/packages/api/src/client/types/app/bsky/actor/getProfiles.ts +++ b/packages/api/src/client/types/app/bsky/actor/getProfiles.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.getProfiles' + export interface QueryParams { actors: string[] } 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 48553fd1b85..c0ecf0b6c2b 100644 --- a/packages/api/src/client/types/app/bsky/actor/getSuggestions.ts +++ b/packages/api/src/client/types/app/bsky/actor/getSuggestions.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.getSuggestions' + export interface QueryParams { limit?: number cursor?: string 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 c109e93f9ab..a1cb6db9742 100644 --- a/packages/api/src/client/types/app/bsky/actor/profile.ts +++ b/packages/api/src/client/types/app/bsky/actor/profile.ts @@ -2,12 +2,14 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' +export const id = 'app.bsky.actor.profile' + export interface Record { displayName?: string /** Free-form profile description text. */ @@ -25,15 +27,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.actor.profile#main' || - v.$type === 'app.bsky.actor.profile') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.actor.profile#main' | 'app.bsky.actor.profile' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.actor.profile#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 834b1bd247c..9169ef89e64 100644 --- a/packages/api/src/client/types/app/bsky/actor/putPreferences.ts +++ b/packages/api/src/client/types/app/bsky/actor/putPreferences.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.putPreferences' + export interface QueryParams {} export interface InputSchema { 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 bcbde2b7bfb..c4683332472 100644 --- a/packages/api/src/client/types/app/bsky/actor/searchActors.ts +++ b/packages/api/src/client/types/app/bsky/actor/searchActors.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.searchActors' + export interface QueryParams { /** DEPRECATED: use 'q' instead. */ term?: string 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 abed0289f27..26ab6cc2400 100644 --- a/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/api/src/client/types/app/bsky/actor/searchActorsTypeahead.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from './defs' +export const id = 'app.bsky.actor.searchActorsTypeahead' + export interface QueryParams { /** DEPRECATED: use 'q' instead. */ term?: string 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 b7b753d65f6..7cb8d07c63d 100644 --- a/packages/api/src/client/types/app/bsky/embed/defs.ts +++ b/packages/api/src/client/types/app/bsky/embed/defs.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } 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 { @@ -13,14 +15,15 @@ export interface AspectRatio { [k: string]: unknown } -export function isAspectRatio(v: unknown): v is AspectRatio { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.defs#aspectRatio' - ) +export function isAspectRatio( + v: unknown, +): v is AspectRatio & { $type: 'app.bsky.embed.defs#aspectRatio' } { + return is$typed(v, id, 'aspectRatio') } -export function validateAspectRatio(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.defs#aspectRatio', v) +export function validateAspectRatio(v: unknown) { + return lexicons.validate( + `${id}#aspectRatio`, + v, + ) as ValidationResult } 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 5832cbb3987..a7a53c24c01 100644 --- a/packages/api/src/client/types/app/bsky/embed/external.ts +++ b/packages/api/src/client/types/app/bsky/embed/external.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } 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 { @@ -12,17 +14,14 @@ export interface Main { [k: string]: unknown } -export function isMain(v: unknown): v is Main { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.embed.external#main' || - v.$type === 'app.bsky.embed.external') - ) +export function isMain(v: unknown): v is Main & { + $type: 'app.bsky.embed.external#main' | 'app.bsky.embed.external' +} { + return is$typed(v, id, 'main') } -export function validateMain(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.external#main', v) +export function validateMain(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult
} export interface External { @@ -33,16 +32,14 @@ export interface External { [k: string]: unknown } -export function isExternal(v: unknown): v is External { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.external#external' - ) +export function isExternal( + v: unknown, +): v is External & { $type: 'app.bsky.embed.external#external' } { + return is$typed(v, id, 'external') } -export function validateExternal(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.external#external', v) +export function validateExternal(v: unknown) { + return lexicons.validate(`${id}#external`, v) as ValidationResult } export interface View { @@ -50,16 +47,14 @@ export interface View { [k: string]: unknown } -export function isView(v: unknown): v is View { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.external#view' - ) +export function isView( + v: unknown, +): v is View & { $type: 'app.bsky.embed.external#view' } { + return is$typed(v, id, 'view') } -export function validateView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.external#view', v) +export function validateView(v: unknown) { + return lexicons.validate(`${id}#view`, v) as ValidationResult } export interface ViewExternal { @@ -70,14 +65,15 @@ export interface ViewExternal { [k: string]: unknown } -export function isViewExternal(v: unknown): v is ViewExternal { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.external#viewExternal' - ) +export function isViewExternal( + v: unknown, +): v is ViewExternal & { $type: 'app.bsky.embed.external#viewExternal' } { + return is$typed(v, id, 'viewExternal') } -export function validateViewExternal(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.external#viewExternal', v) +export function validateViewExternal(v: unknown) { + return lexicons.validate( + `${id}#viewExternal`, + v, + ) as ValidationResult } 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 886ad7c5c5b..16388024408 100644 --- a/packages/api/src/client/types/app/bsky/embed/images.ts +++ b/packages/api/src/client/types/app/bsky/embed/images.ts @@ -2,27 +2,26 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyEmbedDefs from './defs' +export const id = 'app.bsky.embed.images' + export interface Main { images: Image[] [k: string]: unknown } -export function isMain(v: unknown): v is Main { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.embed.images#main' || - v.$type === 'app.bsky.embed.images') - ) +export function isMain(v: unknown): v is Main & { + $type: 'app.bsky.embed.images#main' | 'app.bsky.embed.images' +} { + return is$typed(v, id, 'main') } -export function validateMain(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.images#main', v) +export function validateMain(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult
} export interface Image { @@ -33,14 +32,14 @@ export interface Image { [k: string]: unknown } -export function isImage(v: unknown): v is Image { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.images#image' - ) +export function isImage( + v: unknown, +): v is Image & { $type: 'app.bsky.embed.images#image' } { + return is$typed(v, id, 'image') } -export function validateImage(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.images#image', v) +export function validateImage(v: unknown) { + return lexicons.validate(`${id}#image`, v) as ValidationResult } export interface View { @@ -48,14 +47,14 @@ export interface View { [k: string]: unknown } -export function isView(v: unknown): v is View { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.images#view' - ) +export function isView( + v: unknown, +): v is View & { $type: 'app.bsky.embed.images#view' } { + return is$typed(v, id, 'view') } -export function validateView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.images#view', v) +export function validateView(v: unknown) { + return lexicons.validate(`${id}#view`, v) as ValidationResult } export interface ViewImage { @@ -69,14 +68,12 @@ export interface ViewImage { [k: string]: unknown } -export function isViewImage(v: unknown): v is ViewImage { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.images#viewImage' - ) +export function isViewImage( + v: unknown, +): v is ViewImage & { $type: 'app.bsky.embed.images#viewImage' } { + return is$typed(v, id, 'viewImage') } -export function validateViewImage(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.images#viewImage', v) +export function validateViewImage(v: unknown) { + return lexicons.validate(`${id}#viewImage`, v) as ValidationResult } 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 a3744c29246..464652c09c5 100644 --- a/packages/api/src/client/types/app/bsky/embed/record.ts +++ b/packages/api/src/client/types/app/bsky/embed/record.ts @@ -2,9 +2,9 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' import * as AppBskyFeedDefs from '../feed/defs' import * as AppBskyGraphDefs from '../graph/defs' @@ -16,22 +16,21 @@ import * as AppBskyEmbedVideo from './video' import * as AppBskyEmbedExternal from './external' import * as AppBskyEmbedRecordWithMedia from './recordWithMedia' +export const id = 'app.bsky.embed.record' + export interface Main { record: ComAtprotoRepoStrongRef.Main [k: string]: unknown } -export function isMain(v: unknown): v is Main { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.embed.record#main' || - v.$type === 'app.bsky.embed.record') - ) +export function isMain(v: unknown): v is Main & { + $type: 'app.bsky.embed.record#main' | 'app.bsky.embed.record' +} { + return is$typed(v, id, 'main') } -export function validateMain(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.record#main', v) +export function validateMain(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult
} export interface View { @@ -48,14 +47,14 @@ export interface View { [k: string]: unknown } -export function isView(v: unknown): v is View { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.record#view' - ) +export function isView( + v: unknown, +): v is View & { $type: 'app.bsky.embed.record#view' } { + return is$typed(v, id, 'view') } -export function validateView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.record#view', v) +export function validateView(v: unknown) { + return lexicons.validate(`${id}#view`, v) as ValidationResult } export interface ViewRecord { @@ -81,16 +80,17 @@ export interface ViewRecord { [k: string]: unknown } -export function isViewRecord(v: unknown): v is ViewRecord { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.record#viewRecord' - ) +export function isViewRecord( + v: unknown, +): v is ViewRecord & { $type: 'app.bsky.embed.record#viewRecord' } { + return is$typed(v, id, 'viewRecord') } -export function validateViewRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.record#viewRecord', v) +export function validateViewRecord(v: unknown) { + return lexicons.validate( + `${id}#viewRecord`, + v, + ) as ValidationResult } export interface ViewNotFound { @@ -99,16 +99,17 @@ export interface ViewNotFound { [k: string]: unknown } -export function isViewNotFound(v: unknown): v is ViewNotFound { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.record#viewNotFound' - ) +export function isViewNotFound( + v: unknown, +): v is ViewNotFound & { $type: 'app.bsky.embed.record#viewNotFound' } { + return is$typed(v, id, 'viewNotFound') } -export function validateViewNotFound(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.record#viewNotFound', v) +export function validateViewNotFound(v: unknown) { + return lexicons.validate( + `${id}#viewNotFound`, + v, + ) as ValidationResult } export interface ViewBlocked { @@ -118,16 +119,17 @@ export interface ViewBlocked { [k: string]: unknown } -export function isViewBlocked(v: unknown): v is ViewBlocked { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.record#viewBlocked' - ) +export function isViewBlocked( + v: unknown, +): v is ViewBlocked & { $type: 'app.bsky.embed.record#viewBlocked' } { + return is$typed(v, id, 'viewBlocked') } -export function validateViewBlocked(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.record#viewBlocked', v) +export function validateViewBlocked(v: unknown) { + return lexicons.validate( + `${id}#viewBlocked`, + v, + ) as ValidationResult } export interface ViewDetached { @@ -136,14 +138,15 @@ export interface ViewDetached { [k: string]: unknown } -export function isViewDetached(v: unknown): v is ViewDetached { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.record#viewDetached' - ) +export function isViewDetached( + v: unknown, +): v is ViewDetached & { $type: 'app.bsky.embed.record#viewDetached' } { + return is$typed(v, id, 'viewDetached') } -export function validateViewDetached(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.record#viewDetached', v) +export function validateViewDetached(v: unknown) { + return lexicons.validate( + `${id}#viewDetached`, + v, + ) as ValidationResult } 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 2b2b3ae6251..56265087d2f 100644 --- a/packages/api/src/client/types/app/bsky/embed/recordWithMedia.ts +++ b/packages/api/src/client/types/app/bsky/embed/recordWithMedia.ts @@ -2,14 +2,16 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyEmbedRecord from './record' import * as AppBskyEmbedImages from './images' import * as AppBskyEmbedVideo from './video' import * as AppBskyEmbedExternal from './external' +export const id = 'app.bsky.embed.recordWithMedia' + export interface Main { record: AppBskyEmbedRecord.Main media: @@ -20,17 +22,16 @@ export interface Main { [k: string]: unknown } -export function isMain(v: unknown): v is Main { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.embed.recordWithMedia#main' || - v.$type === 'app.bsky.embed.recordWithMedia') - ) +export function isMain(v: unknown): v is Main & { + $type: + | 'app.bsky.embed.recordWithMedia#main' + | 'app.bsky.embed.recordWithMedia' +} { + return is$typed(v, id, 'main') } -export function validateMain(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.recordWithMedia#main', v) +export function validateMain(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult
} export interface View { @@ -43,14 +44,12 @@ export interface View { [k: string]: unknown } -export function isView(v: unknown): v is View { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.recordWithMedia#view' - ) +export function isView( + v: unknown, +): v is View & { $type: 'app.bsky.embed.recordWithMedia#view' } { + return is$typed(v, id, 'view') } -export function validateView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.recordWithMedia#view', v) +export function validateView(v: unknown) { + return lexicons.validate(`${id}#view`, v) as ValidationResult } 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 2be451b85ed..3d549daec28 100644 --- a/packages/api/src/client/types/app/bsky/embed/video.ts +++ b/packages/api/src/client/types/app/bsky/embed/video.ts @@ -2,11 +2,13 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyEmbedDefs from './defs' +export const id = 'app.bsky.embed.video' + export interface Main { video: BlobRef captions?: Caption[] @@ -16,17 +18,14 @@ export interface Main { [k: string]: unknown } -export function isMain(v: unknown): v is Main { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.embed.video#main' || - v.$type === 'app.bsky.embed.video') - ) +export function isMain( + v: unknown, +): v is Main & { $type: 'app.bsky.embed.video#main' | 'app.bsky.embed.video' } { + return is$typed(v, id, 'main') } -export function validateMain(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.video#main', v) +export function validateMain(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult
} export interface Caption { @@ -35,16 +34,14 @@ export interface Caption { [k: string]: unknown } -export function isCaption(v: unknown): v is Caption { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.embed.video#caption' - ) +export function isCaption( + v: unknown, +): v is Caption & { $type: 'app.bsky.embed.video#caption' } { + return is$typed(v, id, 'caption') } -export function validateCaption(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.video#caption', v) +export function validateCaption(v: unknown) { + return lexicons.validate(`${id}#caption`, v) as ValidationResult } export interface View { @@ -56,12 +53,12 @@ export interface View { [k: string]: unknown } -export function isView(v: unknown): v is View { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.video#view' - ) +export function isView( + v: unknown, +): v is View & { $type: 'app.bsky.embed.video#view' } { + return is$typed(v, id, 'view') } -export function validateView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.embed.video#view', v) +export function validateView(v: unknown) { + return lexicons.validate(`${id}#view`, v) as ValidationResult } 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 bc50067c1da..26967f1f5a3 100644 --- a/packages/api/src/client/types/app/bsky/feed/defs.ts +++ b/packages/api/src/client/types/app/bsky/feed/defs.ts @@ -2,9 +2,9 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' import * as AppBskyEmbedImages from '../embed/images' import * as AppBskyEmbedVideo from '../embed/video' @@ -15,6 +15,8 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as AppBskyRichtextFacet from '../richtext/facet' import * as AppBskyGraphDefs from '../graph/defs' +export const id = 'app.bsky.feed.defs' + export interface PostView { uri: string cid: string @@ -38,14 +40,14 @@ export interface PostView { [k: string]: unknown } -export function isPostView(v: unknown): v is PostView { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.feed.defs#postView' - ) +export function isPostView( + v: unknown, +): v is PostView & { $type: 'app.bsky.feed.defs#postView' } { + return is$typed(v, id, 'postView') } -export function validatePostView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#postView', v) +export function validatePostView(v: unknown) { + return lexicons.validate(`${id}#postView`, v) as ValidationResult } /** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ @@ -59,16 +61,17 @@ export interface ViewerState { [k: string]: unknown } -export function isViewerState(v: unknown): v is ViewerState { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#viewerState' - ) +export function isViewerState( + v: unknown, +): v is ViewerState & { $type: 'app.bsky.feed.defs#viewerState' } { + return is$typed(v, id, 'viewerState') } -export function validateViewerState(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#viewerState', v) +export function validateViewerState(v: unknown) { + return lexicons.validate( + `${id}#viewerState`, + v, + ) as ValidationResult } export interface FeedViewPost { @@ -80,16 +83,17 @@ export interface FeedViewPost { [k: string]: unknown } -export function isFeedViewPost(v: unknown): v is FeedViewPost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#feedViewPost' - ) +export function isFeedViewPost( + v: unknown, +): v is FeedViewPost & { $type: 'app.bsky.feed.defs#feedViewPost' } { + return is$typed(v, id, 'feedViewPost') } -export function validateFeedViewPost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#feedViewPost', v) +export function validateFeedViewPost(v: unknown) { + return lexicons.validate( + `${id}#feedViewPost`, + v, + ) as ValidationResult } export interface ReplyRef { @@ -107,14 +111,14 @@ export interface ReplyRef { [k: string]: unknown } -export function isReplyRef(v: unknown): v is ReplyRef { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.feed.defs#replyRef' - ) +export function isReplyRef( + v: unknown, +): v is ReplyRef & { $type: 'app.bsky.feed.defs#replyRef' } { + return is$typed(v, id, 'replyRef') } -export function validateReplyRef(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#replyRef', v) +export function validateReplyRef(v: unknown) { + return lexicons.validate(`${id}#replyRef`, v) as ValidationResult } export interface ReasonRepost { @@ -123,32 +127,31 @@ export interface ReasonRepost { [k: string]: unknown } -export function isReasonRepost(v: unknown): v is ReasonRepost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#reasonRepost' - ) +export function isReasonRepost( + v: unknown, +): v is ReasonRepost & { $type: 'app.bsky.feed.defs#reasonRepost' } { + return is$typed(v, id, 'reasonRepost') } -export function validateReasonRepost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#reasonRepost', v) +export function validateReasonRepost(v: unknown) { + return lexicons.validate( + `${id}#reasonRepost`, + v, + ) as ValidationResult } export interface ReasonPin { [k: string]: unknown } -export function isReasonPin(v: unknown): v is ReasonPin { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#reasonPin' - ) +export function isReasonPin( + v: unknown, +): v is ReasonPin & { $type: 'app.bsky.feed.defs#reasonPin' } { + return is$typed(v, id, 'reasonPin') } -export function validateReasonPin(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#reasonPin', v) +export function validateReasonPin(v: unknown) { + return lexicons.validate(`${id}#reasonPin`, v) as ValidationResult } export interface ThreadViewPost { @@ -167,16 +170,17 @@ export interface ThreadViewPost { [k: string]: unknown } -export function isThreadViewPost(v: unknown): v is ThreadViewPost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#threadViewPost' - ) +export function isThreadViewPost( + v: unknown, +): v is ThreadViewPost & { $type: 'app.bsky.feed.defs#threadViewPost' } { + return is$typed(v, id, 'threadViewPost') } -export function validateThreadViewPost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#threadViewPost', v) +export function validateThreadViewPost(v: unknown) { + return lexicons.validate( + `${id}#threadViewPost`, + v, + ) as ValidationResult } export interface NotFoundPost { @@ -185,16 +189,17 @@ export interface NotFoundPost { [k: string]: unknown } -export function isNotFoundPost(v: unknown): v is NotFoundPost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#notFoundPost' - ) +export function isNotFoundPost( + v: unknown, +): v is NotFoundPost & { $type: 'app.bsky.feed.defs#notFoundPost' } { + return is$typed(v, id, 'notFoundPost') } -export function validateNotFoundPost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#notFoundPost', v) +export function validateNotFoundPost(v: unknown) { + return lexicons.validate( + `${id}#notFoundPost`, + v, + ) as ValidationResult } export interface BlockedPost { @@ -204,16 +209,17 @@ export interface BlockedPost { [k: string]: unknown } -export function isBlockedPost(v: unknown): v is BlockedPost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#blockedPost' - ) +export function isBlockedPost( + v: unknown, +): v is BlockedPost & { $type: 'app.bsky.feed.defs#blockedPost' } { + return is$typed(v, id, 'blockedPost') } -export function validateBlockedPost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#blockedPost', v) +export function validateBlockedPost(v: unknown) { + return lexicons.validate( + `${id}#blockedPost`, + v, + ) as ValidationResult } export interface BlockedAuthor { @@ -222,16 +228,17 @@ export interface BlockedAuthor { [k: string]: unknown } -export function isBlockedAuthor(v: unknown): v is BlockedAuthor { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#blockedAuthor' - ) +export function isBlockedAuthor( + v: unknown, +): v is BlockedAuthor & { $type: 'app.bsky.feed.defs#blockedAuthor' } { + return is$typed(v, id, 'blockedAuthor') } -export function validateBlockedAuthor(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#blockedAuthor', v) +export function validateBlockedAuthor(v: unknown) { + return lexicons.validate( + `${id}#blockedAuthor`, + v, + ) as ValidationResult } export interface GeneratorView { @@ -251,16 +258,17 @@ export interface GeneratorView { [k: string]: unknown } -export function isGeneratorView(v: unknown): v is GeneratorView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#generatorView' - ) +export function isGeneratorView( + v: unknown, +): v is GeneratorView & { $type: 'app.bsky.feed.defs#generatorView' } { + return is$typed(v, id, 'generatorView') } -export function validateGeneratorView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#generatorView', v) +export function validateGeneratorView(v: unknown) { + return lexicons.validate( + `${id}#generatorView`, + v, + ) as ValidationResult } export interface GeneratorViewerState { @@ -268,16 +276,19 @@ export interface GeneratorViewerState { [k: string]: unknown } -export function isGeneratorViewerState(v: unknown): v is GeneratorViewerState { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#generatorViewerState' - ) +export function isGeneratorViewerState( + v: unknown, +): v is GeneratorViewerState & { + $type: 'app.bsky.feed.defs#generatorViewerState' +} { + return is$typed(v, id, 'generatorViewerState') } -export function validateGeneratorViewerState(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#generatorViewerState', v) +export function validateGeneratorViewerState(v: unknown) { + return lexicons.validate( + `${id}#generatorViewerState`, + v, + ) as ValidationResult } export interface SkeletonFeedPost { @@ -291,16 +302,17 @@ export interface SkeletonFeedPost { [k: string]: unknown } -export function isSkeletonFeedPost(v: unknown): v is SkeletonFeedPost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#skeletonFeedPost' - ) +export function isSkeletonFeedPost( + v: unknown, +): v is SkeletonFeedPost & { $type: 'app.bsky.feed.defs#skeletonFeedPost' } { + return is$typed(v, id, 'skeletonFeedPost') } -export function validateSkeletonFeedPost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#skeletonFeedPost', v) +export function validateSkeletonFeedPost(v: unknown) { + return lexicons.validate( + `${id}#skeletonFeedPost`, + v, + ) as ValidationResult } export interface SkeletonReasonRepost { @@ -308,32 +320,36 @@ export interface SkeletonReasonRepost { [k: string]: unknown } -export function isSkeletonReasonRepost(v: unknown): v is SkeletonReasonRepost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#skeletonReasonRepost' - ) +export function isSkeletonReasonRepost( + v: unknown, +): v is SkeletonReasonRepost & { + $type: 'app.bsky.feed.defs#skeletonReasonRepost' +} { + return is$typed(v, id, 'skeletonReasonRepost') } -export function validateSkeletonReasonRepost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#skeletonReasonRepost', v) +export function validateSkeletonReasonRepost(v: unknown) { + return lexicons.validate( + `${id}#skeletonReasonRepost`, + v, + ) as ValidationResult } export interface SkeletonReasonPin { [k: string]: unknown } -export function isSkeletonReasonPin(v: unknown): v is SkeletonReasonPin { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#skeletonReasonPin' - ) +export function isSkeletonReasonPin( + v: unknown, +): v is SkeletonReasonPin & { $type: 'app.bsky.feed.defs#skeletonReasonPin' } { + return is$typed(v, id, 'skeletonReasonPin') } -export function validateSkeletonReasonPin(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#skeletonReasonPin', v) +export function validateSkeletonReasonPin(v: unknown) { + return lexicons.validate( + `${id}#skeletonReasonPin`, + v, + ) as ValidationResult } export interface ThreadgateView { @@ -344,16 +360,17 @@ export interface ThreadgateView { [k: string]: unknown } -export function isThreadgateView(v: unknown): v is ThreadgateView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#threadgateView' - ) +export function isThreadgateView( + v: unknown, +): v is ThreadgateView & { $type: 'app.bsky.feed.defs#threadgateView' } { + return is$typed(v, id, 'threadgateView') } -export function validateThreadgateView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#threadgateView', v) +export function validateThreadgateView(v: unknown) { + return lexicons.validate( + `${id}#threadgateView`, + v, + ) as ValidationResult } export interface Interaction { @@ -377,16 +394,17 @@ export interface Interaction { [k: string]: unknown } -export function isInteraction(v: unknown): v is Interaction { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.defs#interaction' - ) +export function isInteraction( + v: unknown, +): v is Interaction & { $type: 'app.bsky.feed.defs#interaction' } { + return is$typed(v, id, 'interaction') } -export function validateInteraction(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.defs#interaction', v) +export function validateInteraction(v: unknown) { + return lexicons.validate( + `${id}#interaction`, + v, + ) as ValidationResult } /** Request that less content like the given feed item be shown in the feed */ 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 b974f496144..aa3c0c113c4 100644 --- a/packages/api/src/client/types/app/bsky/feed/describeFeedGenerator.ts +++ b/packages/api/src/client/types/app/bsky/feed/describeFeedGenerator.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.feed.describeFeedGenerator' export interface QueryParams {} @@ -38,16 +40,14 @@ export interface Feed { [k: string]: unknown } -export function isFeed(v: unknown): v is Feed { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.describeFeedGenerator#feed' - ) +export function isFeed( + v: unknown, +): v is Feed & { $type: 'app.bsky.feed.describeFeedGenerator#feed' } { + return is$typed(v, id, 'feed') } -export function validateFeed(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.describeFeedGenerator#feed', v) +export function validateFeed(v: unknown) { + return lexicons.validate(`${id}#feed`, v) as ValidationResult } export interface Links { @@ -56,14 +56,12 @@ export interface Links { [k: string]: unknown } -export function isLinks(v: unknown): v is Links { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.describeFeedGenerator#links' - ) +export function isLinks( + v: unknown, +): v is Links & { $type: 'app.bsky.feed.describeFeedGenerator#links' } { + return is$typed(v, id, 'links') } -export function validateLinks(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.describeFeedGenerator#links', v) +export function validateLinks(v: unknown) { + return lexicons.validate(`${id}#links`, v) as ValidationResult } 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 b36796dd353..82f98bb14bb 100644 --- a/packages/api/src/client/types/app/bsky/feed/generator.ts +++ b/packages/api/src/client/types/app/bsky/feed/generator.ts @@ -2,12 +2,14 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../richtext/facet' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' +export const id = 'app.bsky.feed.generator' + export interface Record { did: string displayName: string @@ -23,15 +25,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.feed.generator#main' || - v.$type === 'app.bsky.feed.generator') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.feed.generator#main' | 'app.bsky.feed.generator' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.generator#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 e8a0cb94bd3..fecdf47e306 100644 --- a/packages/api/src/client/types/app/bsky/feed/getActorFeeds.ts +++ b/packages/api/src/client/types/app/bsky/feed/getActorFeeds.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getActorFeeds' + export interface QueryParams { actor: string limit?: number 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 1da239d96f3..560dc103622 100644 --- a/packages/api/src/client/types/app/bsky/feed/getActorLikes.ts +++ b/packages/api/src/client/types/app/bsky/feed/getActorLikes.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getActorLikes' + export interface QueryParams { actor: string limit?: number 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 77319f28d40..253092bfb5b 100644 --- a/packages/api/src/client/types/app/bsky/feed/getAuthorFeed.ts +++ b/packages/api/src/client/types/app/bsky/feed/getAuthorFeed.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getAuthorFeed' + export interface QueryParams { actor: string limit?: number 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 b61a1248e2a..d5cf360f15c 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeed.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeed.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getFeed' + export interface QueryParams { feed: string limit?: number 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 8d222f8d521..321a45ce8d5 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeedGenerator.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeedGenerator.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getFeedGenerator' + export interface QueryParams { /** AT-URI of the feed generator record. */ feed: string 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 1d99fd6608c..408c429cb28 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeedGenerators.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeedGenerators.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getFeedGenerators' + export interface QueryParams { feeds: string[] } 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 bf859cc1e87..147ecaa0e77 100644 --- a/packages/api/src/client/types/app/bsky/feed/getFeedSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/feed/getFeedSkeleton.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getFeedSkeleton' + export interface QueryParams { /** Reference to feed generator record describing the specific feed being requested. */ feed: string 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 35af1b3aae5..e7e04ff4956 100644 --- a/packages/api/src/client/types/app/bsky/feed/getLikes.ts +++ b/packages/api/src/client/types/app/bsky/feed/getLikes.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.feed.getLikes' + export interface QueryParams { /** AT-URI of the subject (eg, a post record). */ uri: string @@ -49,12 +51,12 @@ export interface Like { [k: string]: unknown } -export function isLike(v: unknown): v is Like { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.feed.getLikes#like' - ) +export function isLike( + v: unknown, +): v is Like & { $type: 'app.bsky.feed.getLikes#like' } { + return is$typed(v, id, 'like') } -export function validateLike(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.getLikes#like', v) +export function validateLike(v: unknown) { + return lexicons.validate(`${id}#like`, v) as ValidationResult } 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 4e47e597afd..ec3eb4ef5df 100644 --- a/packages/api/src/client/types/app/bsky/feed/getListFeed.ts +++ b/packages/api/src/client/types/app/bsky/feed/getListFeed.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getListFeed' + export interface QueryParams { /** Reference (AT-URI) to the list record. */ list: string 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 df012607df1..cc272ecd7ae 100644 --- a/packages/api/src/client/types/app/bsky/feed/getPostThread.ts +++ b/packages/api/src/client/types/app/bsky/feed/getPostThread.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getPostThread' + export interface QueryParams { /** Reference (AT-URI) to post record. */ uri: string 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 0ae8657de94..b35b9c1bbff 100644 --- a/packages/api/src/client/types/app/bsky/feed/getPosts.ts +++ b/packages/api/src/client/types/app/bsky/feed/getPosts.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getPosts' + export interface QueryParams { /** List of post AT-URIs to return hydrated views for. */ uris: string[] 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 aafc487cd43..cdb4eb0b5e1 100644 --- a/packages/api/src/client/types/app/bsky/feed/getQuotes.ts +++ b/packages/api/src/client/types/app/bsky/feed/getQuotes.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getQuotes' + export interface QueryParams { /** Reference (AT-URI) of post record */ uri: string 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 dfbac97453b..8236a7d980b 100644 --- a/packages/api/src/client/types/app/bsky/feed/getRepostedBy.ts +++ b/packages/api/src/client/types/app/bsky/feed/getRepostedBy.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.feed.getRepostedBy' + export interface QueryParams { /** Reference (AT-URI) of post record */ uri: string 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 2e9495d8c19..6a84c6501b8 100644 --- a/packages/api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts +++ b/packages/api/src/client/types/app/bsky/feed/getSuggestedFeeds.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getSuggestedFeeds' + export interface QueryParams { limit?: number cursor?: string 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 6c5280443a9..364b7cee7ab 100644 --- a/packages/api/src/client/types/app/bsky/feed/getTimeline.ts +++ b/packages/api/src/client/types/app/bsky/feed/getTimeline.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.getTimeline' + export interface QueryParams { /** Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. */ algorithm?: string 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 10237e45f0d..d63fd3e3674 100644 --- a/packages/api/src/client/types/app/bsky/feed/like.ts +++ b/packages/api/src/client/types/app/bsky/feed/like.ts @@ -2,25 +2,25 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' +export const id = 'app.bsky.feed.like' + export interface Record { subject: ComAtprotoRepoStrongRef.Main createdAt: string [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.feed.like#main' || v.$type === 'app.bsky.feed.like') - ) +export function isRecord( + v: unknown, +): v is Record & { $type: 'app.bsky.feed.like#main' | 'app.bsky.feed.like' } { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.like#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 e358409c0e0..a5bf1cf4f2c 100644 --- a/packages/api/src/client/types/app/bsky/feed/post.ts +++ b/packages/api/src/client/types/app/bsky/feed/post.ts @@ -2,9 +2,9 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../richtext/facet' import * as AppBskyEmbedImages from '../embed/images' import * as AppBskyEmbedVideo from '../embed/video' @@ -14,6 +14,8 @@ import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' +export const id = 'app.bsky.feed.post' + export interface Record { /** The primary post content. May be an empty string, if there are embeds. */ text: string @@ -41,16 +43,14 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.feed.post#main' || v.$type === 'app.bsky.feed.post') - ) +export function isRecord( + v: unknown, +): v is Record & { $type: 'app.bsky.feed.post#main' | 'app.bsky.feed.post' } { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.post#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } export interface ReplyRef { @@ -59,14 +59,14 @@ export interface ReplyRef { [k: string]: unknown } -export function isReplyRef(v: unknown): v is ReplyRef { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.feed.post#replyRef' - ) +export function isReplyRef( + v: unknown, +): v is ReplyRef & { $type: 'app.bsky.feed.post#replyRef' } { + return is$typed(v, id, 'replyRef') } -export function validateReplyRef(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.post#replyRef', v) +export function validateReplyRef(v: unknown) { + return lexicons.validate(`${id}#replyRef`, v) as ValidationResult } /** Deprecated: use facets instead. */ @@ -78,14 +78,14 @@ export interface Entity { [k: string]: unknown } -export function isEntity(v: unknown): v is Entity { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.feed.post#entity' - ) +export function isEntity( + v: unknown, +): v is Entity & { $type: 'app.bsky.feed.post#entity' } { + return is$typed(v, id, 'entity') } -export function validateEntity(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.post#entity', v) +export function validateEntity(v: unknown) { + return lexicons.validate(`${id}#entity`, v) as ValidationResult } /** Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings. */ @@ -95,14 +95,12 @@ export interface TextSlice { [k: string]: unknown } -export function isTextSlice(v: unknown): v is TextSlice { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.post#textSlice' - ) +export function isTextSlice( + v: unknown, +): v is TextSlice & { $type: 'app.bsky.feed.post#textSlice' } { + return is$typed(v, id, 'textSlice') } -export function validateTextSlice(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.post#textSlice', v) +export function validateTextSlice(v: unknown) { + return lexicons.validate(`${id}#textSlice`, v) as ValidationResult } 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 aad8496699a..5f9f88605f6 100644 --- a/packages/api/src/client/types/app/bsky/feed/postgate.ts +++ b/packages/api/src/client/types/app/bsky/feed/postgate.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.feed.postgate' export interface Record { createdAt: string @@ -16,17 +18,14 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.feed.postgate#main' || - v.$type === 'app.bsky.feed.postgate') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.feed.postgate#main' | 'app.bsky.feed.postgate' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.postgate#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } /** Disables embedding of this post. */ @@ -34,14 +33,15 @@ export interface DisableRule { [k: string]: unknown } -export function isDisableRule(v: unknown): v is DisableRule { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.postgate#disableRule' - ) +export function isDisableRule( + v: unknown, +): v is DisableRule & { $type: 'app.bsky.feed.postgate#disableRule' } { + return is$typed(v, id, 'disableRule') } -export function validateDisableRule(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.postgate#disableRule', v) +export function validateDisableRule(v: unknown) { + return lexicons.validate( + `${id}#disableRule`, + v, + ) as ValidationResult } 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 2e8f6e75548..17821768dd4 100644 --- a/packages/api/src/client/types/app/bsky/feed/repost.ts +++ b/packages/api/src/client/types/app/bsky/feed/repost.ts @@ -2,26 +2,25 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef' +export const id = 'app.bsky.feed.repost' + export interface Record { subject: ComAtprotoRepoStrongRef.Main createdAt: string [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.feed.repost#main' || - v.$type === 'app.bsky.feed.repost') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.feed.repost#main' | 'app.bsky.feed.repost' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.repost#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 1a2ec64dcd2..41542317fac 100644 --- a/packages/api/src/client/types/app/bsky/feed/searchPosts.ts +++ b/packages/api/src/client/types/app/bsky/feed/searchPosts.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.searchPosts' + export interface QueryParams { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string 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 4d43e26f3dd..35076e119de 100644 --- a/packages/api/src/client/types/app/bsky/feed/sendInteractions.ts +++ b/packages/api/src/client/types/app/bsky/feed/sendInteractions.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from './defs' +export const id = 'app.bsky.feed.sendInteractions' + export interface QueryParams {} export interface InputSchema { 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 558027fb8e9..b60c59ca0ae 100644 --- a/packages/api/src/client/types/app/bsky/feed/threadgate.ts +++ b/packages/api/src/client/types/app/bsky/feed/threadgate.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.feed.threadgate' export interface Record { /** Reference (AT-URI) to the post record. */ @@ -21,17 +23,14 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.feed.threadgate#main' || - v.$type === 'app.bsky.feed.threadgate') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.feed.threadgate#main' | 'app.bsky.feed.threadgate' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.threadgate#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } /** Allow replies from actors mentioned in your post. */ @@ -39,16 +38,17 @@ export interface MentionRule { [k: string]: unknown } -export function isMentionRule(v: unknown): v is MentionRule { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.threadgate#mentionRule' - ) +export function isMentionRule( + v: unknown, +): v is MentionRule & { $type: 'app.bsky.feed.threadgate#mentionRule' } { + return is$typed(v, id, 'mentionRule') } -export function validateMentionRule(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.threadgate#mentionRule', v) +export function validateMentionRule(v: unknown) { + return lexicons.validate( + `${id}#mentionRule`, + v, + ) as ValidationResult } /** Allow replies from actors you follow. */ @@ -56,16 +56,17 @@ export interface FollowingRule { [k: string]: unknown } -export function isFollowingRule(v: unknown): v is FollowingRule { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.threadgate#followingRule' - ) +export function isFollowingRule( + v: unknown, +): v is FollowingRule & { $type: 'app.bsky.feed.threadgate#followingRule' } { + return is$typed(v, id, 'followingRule') } -export function validateFollowingRule(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.threadgate#followingRule', v) +export function validateFollowingRule(v: unknown) { + return lexicons.validate( + `${id}#followingRule`, + v, + ) as ValidationResult } /** Allow replies from actors on a list. */ @@ -74,14 +75,12 @@ export interface ListRule { [k: string]: unknown } -export function isListRule(v: unknown): v is ListRule { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.feed.threadgate#listRule' - ) +export function isListRule( + v: unknown, +): v is ListRule & { $type: 'app.bsky.feed.threadgate#listRule' } { + return is$typed(v, id, 'listRule') } -export function validateListRule(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.feed.threadgate#listRule', v) +export function validateListRule(v: unknown) { + return lexicons.validate(`${id}#listRule`, v) as ValidationResult } 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 f2455fc08a2..7d15965ea4f 100644 --- a/packages/api/src/client/types/app/bsky/graph/block.ts +++ b/packages/api/src/client/types/app/bsky/graph/block.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.block' export interface Record { /** DID of the account to be blocked. */ @@ -13,15 +15,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.graph.block#main' || - v.$type === 'app.bsky.graph.block') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.graph.block#main' | 'app.bsky.graph.block' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.block#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 aa7e2c068b5..463c55e4608 100644 --- a/packages/api/src/client/types/app/bsky/graph/defs.ts +++ b/packages/api/src/client/types/app/bsky/graph/defs.ts @@ -2,14 +2,16 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' import * as AppBskyActorDefs from '../actor/defs' import * as AppBskyRichtextFacet from '../richtext/facet' import * as AppBskyFeedDefs from '../feed/defs' +export const id = 'app.bsky.graph.defs' + export interface ListViewBasic { uri: string cid: string @@ -23,16 +25,17 @@ export interface ListViewBasic { [k: string]: unknown } -export function isListViewBasic(v: unknown): v is ListViewBasic { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#listViewBasic' - ) +export function isListViewBasic( + v: unknown, +): v is ListViewBasic & { $type: 'app.bsky.graph.defs#listViewBasic' } { + return is$typed(v, id, 'listViewBasic') } -export function validateListViewBasic(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#listViewBasic', v) +export function validateListViewBasic(v: unknown) { + return lexicons.validate( + `${id}#listViewBasic`, + v, + ) as ValidationResult } export interface ListView { @@ -51,16 +54,14 @@ export interface ListView { [k: string]: unknown } -export function isListView(v: unknown): v is ListView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#listView' - ) +export function isListView( + v: unknown, +): v is ListView & { $type: 'app.bsky.graph.defs#listView' } { + return is$typed(v, id, 'listView') } -export function validateListView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#listView', v) +export function validateListView(v: unknown) { + return lexicons.validate(`${id}#listView`, v) as ValidationResult } export interface ListItemView { @@ -69,16 +70,17 @@ export interface ListItemView { [k: string]: unknown } -export function isListItemView(v: unknown): v is ListItemView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#listItemView' - ) +export function isListItemView( + v: unknown, +): v is ListItemView & { $type: 'app.bsky.graph.defs#listItemView' } { + return is$typed(v, id, 'listItemView') } -export function validateListItemView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#listItemView', v) +export function validateListItemView(v: unknown) { + return lexicons.validate( + `${id}#listItemView`, + v, + ) as ValidationResult } export interface StarterPackView { @@ -96,16 +98,17 @@ export interface StarterPackView { [k: string]: unknown } -export function isStarterPackView(v: unknown): v is StarterPackView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#starterPackView' - ) +export function isStarterPackView( + v: unknown, +): v is StarterPackView & { $type: 'app.bsky.graph.defs#starterPackView' } { + return is$typed(v, id, 'starterPackView') } -export function validateStarterPackView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#starterPackView', v) +export function validateStarterPackView(v: unknown) { + return lexicons.validate( + `${id}#starterPackView`, + v, + ) as ValidationResult } export interface StarterPackViewBasic { @@ -121,16 +124,19 @@ export interface StarterPackViewBasic { [k: string]: unknown } -export function isStarterPackViewBasic(v: unknown): v is StarterPackViewBasic { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#starterPackViewBasic' - ) +export function isStarterPackViewBasic( + v: unknown, +): v is StarterPackViewBasic & { + $type: 'app.bsky.graph.defs#starterPackViewBasic' +} { + return is$typed(v, id, 'starterPackViewBasic') } -export function validateStarterPackViewBasic(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#starterPackViewBasic', v) +export function validateStarterPackViewBasic(v: unknown) { + return lexicons.validate( + `${id}#starterPackViewBasic`, + v, + ) as ValidationResult } export type ListPurpose = @@ -152,16 +158,17 @@ export interface ListViewerState { [k: string]: unknown } -export function isListViewerState(v: unknown): v is ListViewerState { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#listViewerState' - ) +export function isListViewerState( + v: unknown, +): v is ListViewerState & { $type: 'app.bsky.graph.defs#listViewerState' } { + return is$typed(v, id, 'listViewerState') } -export function validateListViewerState(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#listViewerState', v) +export function validateListViewerState(v: unknown) { + return lexicons.validate( + `${id}#listViewerState`, + v, + ) as ValidationResult } /** indicates that a handle or DID could not be resolved */ @@ -171,16 +178,17 @@ export interface NotFoundActor { [k: string]: unknown } -export function isNotFoundActor(v: unknown): v is NotFoundActor { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#notFoundActor' - ) +export function isNotFoundActor( + v: unknown, +): v is NotFoundActor & { $type: 'app.bsky.graph.defs#notFoundActor' } { + return is$typed(v, id, 'notFoundActor') } -export function validateNotFoundActor(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#notFoundActor', v) +export function validateNotFoundActor(v: unknown) { + return lexicons.validate( + `${id}#notFoundActor`, + v, + ) as ValidationResult } /** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ @@ -193,14 +201,15 @@ export interface Relationship { [k: string]: unknown } -export function isRelationship(v: unknown): v is Relationship { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.defs#relationship' - ) +export function isRelationship( + v: unknown, +): v is Relationship & { $type: 'app.bsky.graph.defs#relationship' } { + return is$typed(v, id, 'relationship') } -export function validateRelationship(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.defs#relationship', v) +export function validateRelationship(v: unknown) { + return lexicons.validate( + `${id}#relationship`, + v, + ) as ValidationResult } 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 a68f434f3c8..98a2ce53cb1 100644 --- a/packages/api/src/client/types/app/bsky/graph/follow.ts +++ b/packages/api/src/client/types/app/bsky/graph/follow.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.follow' export interface Record { subject: string @@ -12,15 +14,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.graph.follow#main' || - v.$type === 'app.bsky.graph.follow') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.graph.follow#main' | 'app.bsky.graph.follow' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.follow#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 bb374e2318d..bbdc9d53b64 100644 --- a/packages/api/src/client/types/app/bsky/graph/getActorStarterPacks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getActorStarterPacks.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getActorStarterPacks' + export interface QueryParams { actor: string limit?: number 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 f0e4bd96bc8..e997218d8b8 100644 --- a/packages/api/src/client/types/app/bsky/graph/getBlocks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getBlocks.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.graph.getBlocks' + export interface QueryParams { limit?: number cursor?: string 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 f55649dc769..558a2a22056 100644 --- a/packages/api/src/client/types/app/bsky/graph/getFollowers.ts +++ b/packages/api/src/client/types/app/bsky/graph/getFollowers.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.graph.getFollowers' + export interface QueryParams { actor: string limit?: number 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 8570c4a14c0..99463dd8a9b 100644 --- a/packages/api/src/client/types/app/bsky/graph/getFollows.ts +++ b/packages/api/src/client/types/app/bsky/graph/getFollows.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.graph.getFollows' + export interface QueryParams { actor: string limit?: number 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 f55649dc769..c54201fa324 100644 --- a/packages/api/src/client/types/app/bsky/graph/getKnownFollowers.ts +++ b/packages/api/src/client/types/app/bsky/graph/getKnownFollowers.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.graph.getKnownFollowers' + export interface QueryParams { actor: string limit?: number 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 bebde2b49c3..1ec913c5fd5 100644 --- a/packages/api/src/client/types/app/bsky/graph/getList.ts +++ b/packages/api/src/client/types/app/bsky/graph/getList.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getList' + export interface QueryParams { /** Reference (AT-URI) of the list record to hydrate. */ list: string 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 d3c7ad5ed7b..d2d4bdb1f6b 100644 --- a/packages/api/src/client/types/app/bsky/graph/getListBlocks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getListBlocks.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getListBlocks' + export interface QueryParams { limit?: number cursor?: string 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 d3c7ad5ed7b..421f161837d 100644 --- a/packages/api/src/client/types/app/bsky/graph/getListMutes.ts +++ b/packages/api/src/client/types/app/bsky/graph/getListMutes.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getListMutes' + export interface QueryParams { limit?: number cursor?: string 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 89a4bfd58df..8059416e4c8 100644 --- a/packages/api/src/client/types/app/bsky/graph/getLists.ts +++ b/packages/api/src/client/types/app/bsky/graph/getLists.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getLists' + export interface QueryParams { /** The account (actor) to enumerate lists from. */ actor: string 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 0ee441cf9eb..4daf410a1c2 100644 --- a/packages/api/src/client/types/app/bsky/graph/getMutes.ts +++ b/packages/api/src/client/types/app/bsky/graph/getMutes.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.graph.getMutes' + export interface QueryParams { limit?: number cursor?: string 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 20194662b71..d5f27ed550c 100644 --- a/packages/api/src/client/types/app/bsky/graph/getRelationships.ts +++ b/packages/api/src/client/types/app/bsky/graph/getRelationships.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getRelationships' + export interface QueryParams { /** Primary account requesting relationships for. */ actor: string 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 7eafb2d228d..24d385c5df6 100644 --- a/packages/api/src/client/types/app/bsky/graph/getStarterPack.ts +++ b/packages/api/src/client/types/app/bsky/graph/getStarterPack.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getStarterPack' + export interface QueryParams { /** Reference (AT-URI) of the starter pack record. */ starterPack: string 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 50dbfdbaeda..8135073f592 100644 --- a/packages/api/src/client/types/app/bsky/graph/getStarterPacks.ts +++ b/packages/api/src/client/types/app/bsky/graph/getStarterPacks.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' +export const id = 'app.bsky.graph.getStarterPacks' + export interface QueryParams { uris: string[] } 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 4747afb19fc..1a94a235b13 100644 --- a/packages/api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts +++ b/packages/api/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' +export const id = 'app.bsky.graph.getSuggestedFollowsByActor' + export interface QueryParams { actor: string } 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 fec652ccb12..608dc1ed294 100644 --- a/packages/api/src/client/types/app/bsky/graph/list.ts +++ b/packages/api/src/client/types/app/bsky/graph/list.ts @@ -2,13 +2,15 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyGraphDefs from './defs' import * as AppBskyRichtextFacet from '../richtext/facet' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' +export const id = 'app.bsky.graph.list' + export interface Record { purpose: AppBskyGraphDefs.ListPurpose /** Display name for list; can not be empty. */ @@ -23,15 +25,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.graph.list#main' || - v.$type === 'app.bsky.graph.list') - ) +export function isRecord( + v: unknown, +): v is Record & { $type: 'app.bsky.graph.list#main' | 'app.bsky.graph.list' } { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.list#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 e0f02be268f..0d46facaa88 100644 --- a/packages/api/src/client/types/app/bsky/graph/listblock.ts +++ b/packages/api/src/client/types/app/bsky/graph/listblock.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.listblock' export interface Record { /** Reference (AT-URI) to the mod list record. */ @@ -13,15 +15,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.graph.listblock#main' || - v.$type === 'app.bsky.graph.listblock') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.graph.listblock#main' | 'app.bsky.graph.listblock' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.listblock#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 d4fb5631e84..7bf8cb188d3 100644 --- a/packages/api/src/client/types/app/bsky/graph/listitem.ts +++ b/packages/api/src/client/types/app/bsky/graph/listitem.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.listitem' export interface Record { /** The account which is included on the list. */ @@ -15,15 +17,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.graph.listitem#main' || - v.$type === 'app.bsky.graph.listitem') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.graph.listitem#main' | 'app.bsky.graph.listitem' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.listitem#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 c21c00b2069..bd4a32a2913 100644 --- a/packages/api/src/client/types/app/bsky/graph/muteActor.ts +++ b/packages/api/src/client/types/app/bsky/graph/muteActor.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.muteActor' export interface QueryParams {} 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 8a0e8586deb..0032a8de795 100644 --- a/packages/api/src/client/types/app/bsky/graph/muteActorList.ts +++ b/packages/api/src/client/types/app/bsky/graph/muteActorList.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.muteActorList' export interface QueryParams {} 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 275ba7a0f22..4aa1fead568 100644 --- a/packages/api/src/client/types/app/bsky/graph/muteThread.ts +++ b/packages/api/src/client/types/app/bsky/graph/muteThread.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.muteThread' export interface QueryParams {} 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 7cb0aa26c3f..9d00727da5a 100644 --- a/packages/api/src/client/types/app/bsky/graph/starterpack.ts +++ b/packages/api/src/client/types/app/bsky/graph/starterpack.ts @@ -2,11 +2,13 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../richtext/facet' +export const id = 'app.bsky.graph.starterpack' + export interface Record { /** Display name for starter pack; can not be empty. */ name: string @@ -19,17 +21,14 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.graph.starterpack#main' || - v.$type === 'app.bsky.graph.starterpack') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.graph.starterpack#main' | 'app.bsky.graph.starterpack' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.starterpack#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } export interface FeedItem { @@ -37,14 +36,12 @@ export interface FeedItem { [k: string]: unknown } -export function isFeedItem(v: unknown): v is FeedItem { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.graph.starterpack#feedItem' - ) +export function isFeedItem( + v: unknown, +): v is FeedItem & { $type: 'app.bsky.graph.starterpack#feedItem' } { + return is$typed(v, id, 'feedItem') } -export function validateFeedItem(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.graph.starterpack#feedItem', v) +export function validateFeedItem(v: unknown) { + return lexicons.validate(`${id}#feedItem`, v) as ValidationResult } 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 c21c00b2069..8c17b2fa744 100644 --- a/packages/api/src/client/types/app/bsky/graph/unmuteActor.ts +++ b/packages/api/src/client/types/app/bsky/graph/unmuteActor.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.unmuteActor' export interface QueryParams {} 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 8a0e8586deb..218dea9e60d 100644 --- a/packages/api/src/client/types/app/bsky/graph/unmuteActorList.ts +++ b/packages/api/src/client/types/app/bsky/graph/unmuteActorList.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.unmuteActorList' export interface QueryParams {} 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 275ba7a0f22..4358a9cffc9 100644 --- a/packages/api/src/client/types/app/bsky/graph/unmuteThread.ts +++ b/packages/api/src/client/types/app/bsky/graph/unmuteThread.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.graph.unmuteThread' export interface QueryParams {} 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 3d9b1d77f8a..40312d8e414 100644 --- a/packages/api/src/client/types/app/bsky/labeler/defs.ts +++ b/packages/api/src/client/types/app/bsky/labeler/defs.ts @@ -2,12 +2,14 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' +export const id = 'app.bsky.labeler.defs' + export interface LabelerView { uri: string cid: string @@ -19,16 +21,17 @@ export interface LabelerView { [k: string]: unknown } -export function isLabelerView(v: unknown): v is LabelerView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.labeler.defs#labelerView' - ) +export function isLabelerView( + v: unknown, +): v is LabelerView & { $type: 'app.bsky.labeler.defs#labelerView' } { + return is$typed(v, id, 'labelerView') } -export function validateLabelerView(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.labeler.defs#labelerView', v) +export function validateLabelerView(v: unknown) { + return lexicons.validate( + `${id}#labelerView`, + v, + ) as ValidationResult } export interface LabelerViewDetailed { @@ -43,16 +46,17 @@ export interface LabelerViewDetailed { [k: string]: unknown } -export function isLabelerViewDetailed(v: unknown): v is LabelerViewDetailed { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.labeler.defs#labelerViewDetailed' - ) +export function isLabelerViewDetailed(v: unknown): v is LabelerViewDetailed & { + $type: 'app.bsky.labeler.defs#labelerViewDetailed' +} { + return is$typed(v, id, 'labelerViewDetailed') } -export function validateLabelerViewDetailed(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.labeler.defs#labelerViewDetailed', v) +export function validateLabelerViewDetailed(v: unknown) { + return lexicons.validate( + `${id}#labelerViewDetailed`, + v, + ) as ValidationResult } export interface LabelerViewerState { @@ -60,16 +64,17 @@ export interface LabelerViewerState { [k: string]: unknown } -export function isLabelerViewerState(v: unknown): v is LabelerViewerState { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.labeler.defs#labelerViewerState' - ) +export function isLabelerViewerState(v: unknown): v is LabelerViewerState & { + $type: 'app.bsky.labeler.defs#labelerViewerState' +} { + return is$typed(v, id, 'labelerViewerState') } -export function validateLabelerViewerState(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.labeler.defs#labelerViewerState', v) +export function validateLabelerViewerState(v: unknown) { + return lexicons.validate( + `${id}#labelerViewerState`, + v, + ) as ValidationResult } export interface LabelerPolicies { @@ -80,14 +85,15 @@ export interface LabelerPolicies { [k: string]: unknown } -export function isLabelerPolicies(v: unknown): v is LabelerPolicies { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.labeler.defs#labelerPolicies' - ) +export function isLabelerPolicies( + v: unknown, +): v is LabelerPolicies & { $type: 'app.bsky.labeler.defs#labelerPolicies' } { + return is$typed(v, id, 'labelerPolicies') } -export function validateLabelerPolicies(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.labeler.defs#labelerPolicies', v) +export function validateLabelerPolicies(v: unknown) { + return lexicons.validate( + `${id}#labelerPolicies`, + v, + ) as ValidationResult } 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 688f847d508..aad78070747 100644 --- a/packages/api/src/client/types/app/bsky/labeler/getServices.ts +++ b/packages/api/src/client/types/app/bsky/labeler/getServices.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyLabelerDefs from './defs' +export const id = 'app.bsky.labeler.getServices' + export interface QueryParams { dids: string[] detailed?: boolean 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 818249468ec..5e27cce3522 100644 --- a/packages/api/src/client/types/app/bsky/labeler/service.ts +++ b/packages/api/src/client/types/app/bsky/labeler/service.ts @@ -2,12 +2,14 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyLabelerDefs from './defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' +export const id = 'app.bsky.labeler.service' + export interface Record { policies: AppBskyLabelerDefs.LabelerPolicies labels?: @@ -17,15 +19,12 @@ export interface Record { [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.labeler.service#main' || - v.$type === 'app.bsky.labeler.service') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'app.bsky.labeler.service#main' | 'app.bsky.labeler.service' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.labeler.service#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 00600ea54e7..18d84f74ea6 100644 --- a/packages/api/src/client/types/app/bsky/notification/getUnreadCount.ts +++ b/packages/api/src/client/types/app/bsky/notification/getUnreadCount.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.notification.getUnreadCount' export interface QueryParams { priority?: boolean 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 10a5b7148f2..219ad538c52 100644 --- a/packages/api/src/client/types/app/bsky/notification/listNotifications.ts +++ b/packages/api/src/client/types/app/bsky/notification/listNotifications.ts @@ -3,12 +3,14 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../actor/defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' +export const id = 'app.bsky.notification.listNotifications' + export interface QueryParams { limit?: number priority?: boolean @@ -63,17 +65,15 @@ export interface Notification { [k: string]: unknown } -export function isNotification(v: unknown): v is Notification { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.notification.listNotifications#notification' - ) +export function isNotification(v: unknown): v is Notification & { + $type: 'app.bsky.notification.listNotifications#notification' +} { + return is$typed(v, id, 'notification') } -export function validateNotification(v: unknown): ValidationResult { +export function validateNotification(v: unknown) { return lexicons.validate( - 'app.bsky.notification.listNotifications#notification', + `${id}#notification`, v, - ) + ) as ValidationResult } 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 bc79909f459..706151153ae 100644 --- a/packages/api/src/client/types/app/bsky/notification/putPreferences.ts +++ b/packages/api/src/client/types/app/bsky/notification/putPreferences.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.notification.putPreferences' export interface QueryParams {} 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 ddc9d438537..059a09d39d6 100644 --- a/packages/api/src/client/types/app/bsky/notification/registerPush.ts +++ b/packages/api/src/client/types/app/bsky/notification/registerPush.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.notification.registerPush' export interface QueryParams {} 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 7151e9b0cd4..098985bd976 100644 --- a/packages/api/src/client/types/app/bsky/notification/updateSeen.ts +++ b/packages/api/src/client/types/app/bsky/notification/updateSeen.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.notification.updateSeen' export interface QueryParams {} 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 836136b7dac..66887686674 100644 --- a/packages/api/src/client/types/app/bsky/richtext/facet.ts +++ b/packages/api/src/client/types/app/bsky/richtext/facet.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.richtext.facet' /** Annotation of a sub-string within rich text. */ export interface Main { @@ -13,17 +15,14 @@ export interface Main { [k: string]: unknown } -export function isMain(v: unknown): v is Main { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'app.bsky.richtext.facet#main' || - v.$type === 'app.bsky.richtext.facet') - ) +export function isMain(v: unknown): v is Main & { + $type: 'app.bsky.richtext.facet#main' | 'app.bsky.richtext.facet' +} { + return is$typed(v, id, 'main') } -export function validateMain(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.richtext.facet#main', v) +export function validateMain(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult
} /** Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID. */ @@ -32,16 +31,14 @@ export interface Mention { [k: string]: unknown } -export function isMention(v: unknown): v is Mention { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.richtext.facet#mention' - ) +export function isMention( + v: unknown, +): v is Mention & { $type: 'app.bsky.richtext.facet#mention' } { + return is$typed(v, id, 'mention') } -export function validateMention(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.richtext.facet#mention', v) +export function validateMention(v: unknown) { + return lexicons.validate(`${id}#mention`, v) as ValidationResult } /** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ @@ -50,16 +47,14 @@ export interface Link { [k: string]: unknown } -export function isLink(v: unknown): v is Link { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.richtext.facet#link' - ) +export function isLink( + v: unknown, +): v is Link & { $type: 'app.bsky.richtext.facet#link' } { + return is$typed(v, id, 'link') } -export function validateLink(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.richtext.facet#link', v) +export function validateLink(v: unknown) { + return lexicons.validate(`${id}#link`, v) as ValidationResult } /** 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'). */ @@ -68,14 +63,14 @@ export interface Tag { [k: string]: unknown } -export function isTag(v: unknown): v is Tag { - return ( - isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.richtext.facet#tag' - ) +export function isTag( + v: unknown, +): v is Tag & { $type: 'app.bsky.richtext.facet#tag' } { + return is$typed(v, id, 'tag') } -export function validateTag(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.richtext.facet#tag', v) +export function validateTag(v: unknown) { + return lexicons.validate(`${id}#tag`, v) as ValidationResult } /** 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. */ @@ -85,14 +80,12 @@ export interface ByteSlice { [k: string]: unknown } -export function isByteSlice(v: unknown): v is ByteSlice { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.richtext.facet#byteSlice' - ) +export function isByteSlice( + v: unknown, +): v is ByteSlice & { $type: 'app.bsky.richtext.facet#byteSlice' } { + return is$typed(v, id, 'byteSlice') } -export function validateByteSlice(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.richtext.facet#byteSlice', v) +export function validateByteSlice(v: unknown) { + return lexicons.validate(`${id}#byteSlice`, v) as ValidationResult } 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 ecee03578af..b39895c86a7 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/defs.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/defs.ts @@ -2,25 +2,28 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.unspecced.defs' export interface SkeletonSearchPost { uri: string [k: string]: unknown } -export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.unspecced.defs#skeletonSearchPost' - ) +export function isSkeletonSearchPost(v: unknown): v is SkeletonSearchPost & { + $type: 'app.bsky.unspecced.defs#skeletonSearchPost' +} { + return is$typed(v, id, 'skeletonSearchPost') } -export function validateSkeletonSearchPost(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchPost', v) +export function validateSkeletonSearchPost(v: unknown) { + return lexicons.validate( + `${id}#skeletonSearchPost`, + v, + ) as ValidationResult } export interface SkeletonSearchActor { @@ -28,14 +31,15 @@ export interface SkeletonSearchActor { [k: string]: unknown } -export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.unspecced.defs#skeletonSearchActor' - ) +export function isSkeletonSearchActor(v: unknown): v is SkeletonSearchActor & { + $type: 'app.bsky.unspecced.defs#skeletonSearchActor' +} { + return is$typed(v, id, 'skeletonSearchActor') } -export function validateSkeletonSearchActor(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.unspecced.defs#skeletonSearchActor', v) +export function validateSkeletonSearchActor(v: unknown) { + return lexicons.validate( + `${id}#skeletonSearchActor`, + v, + ) as ValidationResult } 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 d1ee6f7957d..3c0a9ceac7d 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getConfig.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getConfig.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.unspecced.getConfig' export interface QueryParams {} 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 780b4b6641c..34c29584972 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getPopularFeedGenerators.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyFeedDefs from '../feed/defs' +export const id = 'app.bsky.unspecced.getPopularFeedGenerators' + export interface QueryParams { limit?: number cursor?: string 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 6ed519ef212..582fdbd2f65 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyUnspeccedDefs from './defs' +export const id = 'app.bsky.unspecced.getSuggestionsSkeleton' + export interface QueryParams { /** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */ viewer?: string 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 0ee04b8e85d..30641bd9ec2 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/getTaggedSuggestions.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/getTaggedSuggestions.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.unspecced.getTaggedSuggestions' export interface QueryParams {} @@ -38,17 +40,15 @@ export interface Suggestion { [k: string]: unknown } -export function isSuggestion(v: unknown): v is Suggestion { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.unspecced.getTaggedSuggestions#suggestion' - ) +export function isSuggestion(v: unknown): v is Suggestion & { + $type: 'app.bsky.unspecced.getTaggedSuggestions#suggestion' +} { + return is$typed(v, id, 'suggestion') } -export function validateSuggestion(v: unknown): ValidationResult { +export function validateSuggestion(v: unknown) { return lexicons.validate( - 'app.bsky.unspecced.getTaggedSuggestions#suggestion', + `${id}#suggestion`, v, - ) + ) as ValidationResult } 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 d9fe6737d37..642fc237ddf 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyUnspeccedDefs from './defs' +export const id = 'app.bsky.unspecced.searchActorsSkeleton' + export interface QueryParams { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */ q: string 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 ea0135dde83..a95cd782e91 100644 --- a/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts +++ b/packages/api/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyUnspeccedDefs from './defs' +export const id = 'app.bsky.unspecced.searchPostsSkeleton' + export interface QueryParams { /** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */ q: string 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 a7ec84316b6..5c715bcd570 100644 --- a/packages/api/src/client/types/app/bsky/video/defs.ts +++ b/packages/api/src/client/types/app/bsky/video/defs.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.video.defs' export interface JobStatus { jobId: string @@ -19,14 +21,12 @@ export interface JobStatus { [k: string]: unknown } -export function isJobStatus(v: unknown): v is JobStatus { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'app.bsky.video.defs#jobStatus' - ) +export function isJobStatus( + v: unknown, +): v is JobStatus & { $type: 'app.bsky.video.defs#jobStatus' } { + return is$typed(v, id, 'jobStatus') } -export function validateJobStatus(v: unknown): ValidationResult { - return lexicons.validate('app.bsky.video.defs#jobStatus', v) +export function validateJobStatus(v: unknown) { + return lexicons.validate(`${id}#jobStatus`, v) as ValidationResult } 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 0e9638311c0..b9dd840f882 100644 --- a/packages/api/src/client/types/app/bsky/video/getJobStatus.ts +++ b/packages/api/src/client/types/app/bsky/video/getJobStatus.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyVideoDefs from './defs' +export const id = 'app.bsky.video.getJobStatus' + export interface QueryParams { jobId: string } 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 4a2f13617b3..8ed0694b833 100644 --- a/packages/api/src/client/types/app/bsky/video/getUploadLimits.ts +++ b/packages/api/src/client/types/app/bsky/video/getUploadLimits.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'app.bsky.video.getUploadLimits' export interface QueryParams {} 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 f51ba897bbe..da095e300be 100644 --- a/packages/api/src/client/types/app/bsky/video/uploadVideo.ts +++ b/packages/api/src/client/types/app/bsky/video/uploadVideo.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyVideoDefs from './defs' +export const id = 'app.bsky.video.uploadVideo' + export interface QueryParams {} export type InputSchema = string | Uint8Array | Blob 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 99b14f45608..22ced0f7739 100644 --- a/packages/api/src/client/types/chat/bsky/actor/declaration.ts +++ b/packages/api/src/client/types/chat/bsky/actor/declaration.ts @@ -2,24 +2,23 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'chat.bsky.actor.declaration' export interface Record { allowIncoming: 'all' | 'none' | 'following' | (string & {}) [k: string]: unknown } -export function isRecord(v: unknown): v is Record { - return ( - isObj(v) && - hasProp(v, '$type') && - (v.$type === 'chat.bsky.actor.declaration#main' || - v.$type === 'chat.bsky.actor.declaration') - ) +export function isRecord(v: unknown): v is Record & { + $type: 'chat.bsky.actor.declaration#main' | 'chat.bsky.actor.declaration' +} { + return is$typed(v, id, 'main') } -export function validateRecord(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.actor.declaration#main', v) +export function validateRecord(v: unknown) { + return lexicons.validate(`${id}#main`, v) as ValidationResult } 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 87aaac96218..a6c356eb248 100644 --- a/packages/api/src/client/types/chat/bsky/actor/defs.ts +++ b/packages/api/src/client/types/chat/bsky/actor/defs.ts @@ -2,12 +2,14 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyActorDefs from '../../../app/bsky/actor/defs' import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs' +export const id = 'chat.bsky.actor.defs' + export interface ProfileViewBasic { did: string handle: string @@ -21,14 +23,15 @@ export interface ProfileViewBasic { [k: string]: unknown } -export function isProfileViewBasic(v: unknown): v is ProfileViewBasic { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.actor.defs#profileViewBasic' - ) +export function isProfileViewBasic( + v: unknown, +): v is ProfileViewBasic & { $type: 'chat.bsky.actor.defs#profileViewBasic' } { + return is$typed(v, id, 'profileViewBasic') } -export function validateProfileViewBasic(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.actor.defs#profileViewBasic', v) +export function validateProfileViewBasic(v: unknown) { + return lexicons.validate( + `${id}#profileViewBasic`, + v, + ) as ValidationResult } 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 1a045c21c29..70427235641 100644 --- a/packages/api/src/client/types/chat/bsky/actor/deleteAccount.ts +++ b/packages/api/src/client/types/chat/bsky/actor/deleteAccount.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'chat.bsky.actor.deleteAccount' export interface QueryParams {} 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 0142436b05e..42fdbaf2ee7 100644 --- a/packages/api/src/client/types/chat/bsky/actor/exportAccountData.ts +++ b/packages/api/src/client/types/chat/bsky/actor/exportAccountData.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'chat.bsky.actor.exportAccountData' export interface QueryParams {} 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 4908b2dc46a..440d063e1a5 100644 --- a/packages/api/src/client/types/chat/bsky/convo/defs.ts +++ b/packages/api/src/client/types/chat/bsky/convo/defs.ts @@ -2,13 +2,15 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as AppBskyRichtextFacet from '../../../app/bsky/richtext/facet' import * as AppBskyEmbedRecord from '../../../app/bsky/embed/record' import * as ChatBskyActorDefs from '../actor/defs' +export const id = 'chat.bsky.convo.defs' + export interface MessageRef { did: string convoId: string @@ -16,16 +18,17 @@ export interface MessageRef { [k: string]: unknown } -export function isMessageRef(v: unknown): v is MessageRef { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#messageRef' - ) +export function isMessageRef( + v: unknown, +): v is MessageRef & { $type: 'chat.bsky.convo.defs#messageRef' } { + return is$typed(v, id, 'messageRef') } -export function validateMessageRef(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#messageRef', v) +export function validateMessageRef(v: unknown) { + return lexicons.validate( + `${id}#messageRef`, + v, + ) as ValidationResult } export interface MessageInput { @@ -36,16 +39,17 @@ export interface MessageInput { [k: string]: unknown } -export function isMessageInput(v: unknown): v is MessageInput { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#messageInput' - ) +export function isMessageInput( + v: unknown, +): v is MessageInput & { $type: 'chat.bsky.convo.defs#messageInput' } { + return is$typed(v, id, 'messageInput') } -export function validateMessageInput(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#messageInput', v) +export function validateMessageInput(v: unknown) { + return lexicons.validate( + `${id}#messageInput`, + v, + ) as ValidationResult } export interface MessageView { @@ -60,16 +64,17 @@ export interface MessageView { [k: string]: unknown } -export function isMessageView(v: unknown): v is MessageView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#messageView' - ) +export function isMessageView( + v: unknown, +): v is MessageView & { $type: 'chat.bsky.convo.defs#messageView' } { + return is$typed(v, id, 'messageView') } -export function validateMessageView(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#messageView', v) +export function validateMessageView(v: unknown) { + return lexicons.validate( + `${id}#messageView`, + v, + ) as ValidationResult } export interface DeletedMessageView { @@ -80,16 +85,17 @@ export interface DeletedMessageView { [k: string]: unknown } -export function isDeletedMessageView(v: unknown): v is DeletedMessageView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#deletedMessageView' - ) +export function isDeletedMessageView(v: unknown): v is DeletedMessageView & { + $type: 'chat.bsky.convo.defs#deletedMessageView' +} { + return is$typed(v, id, 'deletedMessageView') } -export function validateDeletedMessageView(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#deletedMessageView', v) +export function validateDeletedMessageView(v: unknown) { + return lexicons.validate( + `${id}#deletedMessageView`, + v, + ) as ValidationResult } export interface MessageViewSender { @@ -97,16 +103,17 @@ export interface MessageViewSender { [k: string]: unknown } -export function isMessageViewSender(v: unknown): v is MessageViewSender { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#messageViewSender' - ) +export function isMessageViewSender(v: unknown): v is MessageViewSender & { + $type: 'chat.bsky.convo.defs#messageViewSender' +} { + return is$typed(v, id, 'messageViewSender') } -export function validateMessageViewSender(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#messageViewSender', v) +export function validateMessageViewSender(v: unknown) { + return lexicons.validate( + `${id}#messageViewSender`, + v, + ) as ValidationResult } export interface ConvoView { @@ -123,16 +130,14 @@ export interface ConvoView { [k: string]: unknown } -export function isConvoView(v: unknown): v is ConvoView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#convoView' - ) +export function isConvoView( + v: unknown, +): v is ConvoView & { $type: 'chat.bsky.convo.defs#convoView' } { + return is$typed(v, id, 'convoView') } -export function validateConvoView(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#convoView', v) +export function validateConvoView(v: unknown) { + return lexicons.validate(`${id}#convoView`, v) as ValidationResult } export interface LogBeginConvo { @@ -141,16 +146,17 @@ export interface LogBeginConvo { [k: string]: unknown } -export function isLogBeginConvo(v: unknown): v is LogBeginConvo { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#logBeginConvo' - ) +export function isLogBeginConvo( + v: unknown, +): v is LogBeginConvo & { $type: 'chat.bsky.convo.defs#logBeginConvo' } { + return is$typed(v, id, 'logBeginConvo') } -export function validateLogBeginConvo(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#logBeginConvo', v) +export function validateLogBeginConvo(v: unknown) { + return lexicons.validate( + `${id}#logBeginConvo`, + v, + ) as ValidationResult } export interface LogLeaveConvo { @@ -159,16 +165,17 @@ export interface LogLeaveConvo { [k: string]: unknown } -export function isLogLeaveConvo(v: unknown): v is LogLeaveConvo { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#logLeaveConvo' - ) +export function isLogLeaveConvo( + v: unknown, +): v is LogLeaveConvo & { $type: 'chat.bsky.convo.defs#logLeaveConvo' } { + return is$typed(v, id, 'logLeaveConvo') } -export function validateLogLeaveConvo(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#logLeaveConvo', v) +export function validateLogLeaveConvo(v: unknown) { + return lexicons.validate( + `${id}#logLeaveConvo`, + v, + ) as ValidationResult } export interface LogCreateMessage { @@ -181,16 +188,17 @@ export interface LogCreateMessage { [k: string]: unknown } -export function isLogCreateMessage(v: unknown): v is LogCreateMessage { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#logCreateMessage' - ) +export function isLogCreateMessage( + v: unknown, +): v is LogCreateMessage & { $type: 'chat.bsky.convo.defs#logCreateMessage' } { + return is$typed(v, id, 'logCreateMessage') } -export function validateLogCreateMessage(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#logCreateMessage', v) +export function validateLogCreateMessage(v: unknown) { + return lexicons.validate( + `${id}#logCreateMessage`, + v, + ) as ValidationResult } export interface LogDeleteMessage { @@ -203,14 +211,15 @@ export interface LogDeleteMessage { [k: string]: unknown } -export function isLogDeleteMessage(v: unknown): v is LogDeleteMessage { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.defs#logDeleteMessage' - ) +export function isLogDeleteMessage( + v: unknown, +): v is LogDeleteMessage & { $type: 'chat.bsky.convo.defs#logDeleteMessage' } { + return is$typed(v, id, 'logDeleteMessage') } -export function validateLogDeleteMessage(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.defs#logDeleteMessage', v) +export function validateLogDeleteMessage(v: unknown) { + return lexicons.validate( + `${id}#logDeleteMessage`, + v, + ) as ValidationResult } 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 863d2208cb8..418d9c16df3 100644 --- a/packages/api/src/client/types/chat/bsky/convo/deleteMessageForSelf.ts +++ b/packages/api/src/client/types/chat/bsky/convo/deleteMessageForSelf.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.deleteMessageForSelf' + export interface QueryParams {} export interface InputSchema { 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 b3834234b5f..006e201593a 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getConvo.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.getConvo' + export interface QueryParams { convoId: string } 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 9db44887410..a2cfd16fb14 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getConvoForMembers.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getConvoForMembers.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.getConvoForMembers' + export interface QueryParams { members: string[] } 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 f1470fd89ba..75c28547557 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getLog.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getLog.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.getLog' + export interface QueryParams { cursor?: string } 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 eea7cba82e1..8949ee87790 100644 --- a/packages/api/src/client/types/chat/bsky/convo/getMessages.ts +++ b/packages/api/src/client/types/chat/bsky/convo/getMessages.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.getMessages' + export interface QueryParams { convoId: string limit?: number 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 4124db1855d..51f07f1f0d4 100644 --- a/packages/api/src/client/types/chat/bsky/convo/leaveConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/leaveConvo.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'chat.bsky.convo.leaveConvo' export interface QueryParams {} 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 3cd1ad68516..dce870168ea 100644 --- a/packages/api/src/client/types/chat/bsky/convo/listConvos.ts +++ b/packages/api/src/client/types/chat/bsky/convo/listConvos.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.listConvos' + export interface QueryParams { limit?: number cursor?: string 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 93ac8785db7..a9c109023f1 100644 --- a/packages/api/src/client/types/chat/bsky/convo/muteConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/muteConvo.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.muteConvo' + export interface QueryParams {} export interface InputSchema { 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 e260ba6eee0..f4475c218b0 100644 --- a/packages/api/src/client/types/chat/bsky/convo/sendMessage.ts +++ b/packages/api/src/client/types/chat/bsky/convo/sendMessage.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.sendMessage' + export interface QueryParams {} export interface InputSchema { 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 68ff2711df5..0fdf0870b1d 100644 --- a/packages/api/src/client/types/chat/bsky/convo/sendMessageBatch.ts +++ b/packages/api/src/client/types/chat/bsky/convo/sendMessageBatch.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.sendMessageBatch' + export interface QueryParams {} export interface InputSchema { @@ -43,14 +45,12 @@ export interface BatchItem { [k: string]: unknown } -export function isBatchItem(v: unknown): v is BatchItem { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.convo.sendMessageBatch#batchItem' - ) +export function isBatchItem( + v: unknown, +): v is BatchItem & { $type: 'chat.bsky.convo.sendMessageBatch#batchItem' } { + return is$typed(v, id, 'batchItem') } -export function validateBatchItem(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.convo.sendMessageBatch#batchItem', v) +export function validateBatchItem(v: unknown) { + return lexicons.validate(`${id}#batchItem`, v) as ValidationResult } 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 93ac8785db7..d797a5c9928 100644 --- a/packages/api/src/client/types/chat/bsky/convo/unmuteConvo.ts +++ b/packages/api/src/client/types/chat/bsky/convo/unmuteConvo.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.unmuteConvo' + export interface QueryParams {} export interface InputSchema { 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 b7a8041dbd7..b0dac3b7548 100644 --- a/packages/api/src/client/types/chat/bsky/convo/updateRead.ts +++ b/packages/api/src/client/types/chat/bsky/convo/updateRead.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from './defs' +export const id = 'chat.bsky.convo.updateRead' + export interface QueryParams {} export interface InputSchema { 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 6761c9939b5..0eac122abcd 100644 --- a/packages/api/src/client/types/chat/bsky/moderation/getActorMetadata.ts +++ b/packages/api/src/client/types/chat/bsky/moderation/getActorMetadata.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'chat.bsky.moderation.getActorMetadata' export interface QueryParams { actor: string @@ -43,14 +45,12 @@ export interface Metadata { [k: string]: unknown } -export function isMetadata(v: unknown): v is Metadata { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'chat.bsky.moderation.getActorMetadata#metadata' - ) +export function isMetadata( + v: unknown, +): v is Metadata & { $type: 'chat.bsky.moderation.getActorMetadata#metadata' } { + return is$typed(v, id, 'metadata') } -export function validateMetadata(v: unknown): ValidationResult { - return lexicons.validate('chat.bsky.moderation.getActorMetadata#metadata', v) +export function validateMetadata(v: unknown) { + return lexicons.validate(`${id}#metadata`, v) as ValidationResult } 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 2315bfd4ad8..af76a1a4674 100644 --- a/packages/api/src/client/types/chat/bsky/moderation/getMessageContext.ts +++ b/packages/api/src/client/types/chat/bsky/moderation/getMessageContext.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ChatBskyConvoDefs from '../convo/defs' +export const id = 'chat.bsky.moderation.getMessageContext' + export interface QueryParams { /** Conversation that the message is from. NOTE: this field will eventually be required. */ convoId?: string 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 d6f0205672e..13f698b928e 100644 --- a/packages/api/src/client/types/chat/bsky/moderation/updateActorAccess.ts +++ b/packages/api/src/client/types/chat/bsky/moderation/updateActorAccess.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'chat.bsky.moderation.updateActorAccess' export interface QueryParams {} 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 26510680347..c0309202b32 100644 --- a/packages/api/src/client/types/com/atproto/admin/defs.ts +++ b/packages/api/src/client/types/com/atproto/admin/defs.ts @@ -2,27 +2,30 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoServerDefs from '../server/defs' +export const id = 'com.atproto.admin.defs' + export interface StatusAttr { applied: boolean ref?: string [k: string]: unknown } -export function isStatusAttr(v: unknown): v is StatusAttr { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'com.atproto.admin.defs#statusAttr' - ) +export function isStatusAttr( + v: unknown, +): v is StatusAttr & { $type: 'com.atproto.admin.defs#statusAttr' } { + return is$typed(v, id, 'statusAttr') } -export function validateStatusAttr(v: unknown): ValidationResult { - return lexicons.validate('com.atproto.admin.defs#statusAttr', v) +export function validateStatusAttr(v: unknown) { + return lexicons.validate( + `${id}#statusAttr`, + v, + ) as ValidationResult } export interface AccountView { @@ -41,16 +44,17 @@ export interface AccountView { [k: string]: unknown } -export function isAccountView(v: unknown): v is AccountView { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'com.atproto.admin.defs#accountView' - ) +export function isAccountView( + v: unknown, +): v is AccountView & { $type: 'com.atproto.admin.defs#accountView' } { + return is$typed(v, id, 'accountView') } -export function validateAccountView(v: unknown): ValidationResult { - return lexicons.validate('com.atproto.admin.defs#accountView', v) +export function validateAccountView(v: unknown) { + return lexicons.validate( + `${id}#accountView`, + v, + ) as ValidationResult } export interface RepoRef { @@ -58,16 +62,14 @@ export interface RepoRef { [k: string]: unknown } -export function isRepoRef(v: unknown): v is RepoRef { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'com.atproto.admin.defs#repoRef' - ) +export function isRepoRef( + v: unknown, +): v is RepoRef & { $type: 'com.atproto.admin.defs#repoRef' } { + return is$typed(v, id, 'repoRef') } -export function validateRepoRef(v: unknown): ValidationResult { - return lexicons.validate('com.atproto.admin.defs#repoRef', v) +export function validateRepoRef(v: unknown) { + return lexicons.validate(`${id}#repoRef`, v) as ValidationResult } export interface RepoBlobRef { @@ -77,16 +79,17 @@ export interface RepoBlobRef { [k: string]: unknown } -export function isRepoBlobRef(v: unknown): v is RepoBlobRef { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'com.atproto.admin.defs#repoBlobRef' - ) +export function isRepoBlobRef( + v: unknown, +): v is RepoBlobRef & { $type: 'com.atproto.admin.defs#repoBlobRef' } { + return is$typed(v, id, 'repoBlobRef') } -export function validateRepoBlobRef(v: unknown): ValidationResult { - return lexicons.validate('com.atproto.admin.defs#repoBlobRef', v) +export function validateRepoBlobRef(v: unknown) { + return lexicons.validate( + `${id}#repoBlobRef`, + v, + ) as ValidationResult } export interface ThreatSignature { @@ -95,14 +98,15 @@ export interface ThreatSignature { [k: string]: unknown } -export function isThreatSignature(v: unknown): v is ThreatSignature { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'com.atproto.admin.defs#threatSignature' - ) +export function isThreatSignature( + v: unknown, +): v is ThreatSignature & { $type: 'com.atproto.admin.defs#threatSignature' } { + return is$typed(v, id, 'threatSignature') } -export function validateThreatSignature(v: unknown): ValidationResult { - return lexicons.validate('com.atproto.admin.defs#threatSignature', v) +export function validateThreatSignature(v: unknown) { + return lexicons.validate( + `${id}#threatSignature`, + v, + ) as ValidationResult } 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 72066a656b7..3df4da25b5c 100644 --- a/packages/api/src/client/types/com/atproto/admin/deleteAccount.ts +++ b/packages/api/src/client/types/com/atproto/admin/deleteAccount.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.deleteAccount' export interface QueryParams {} 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 8df420239de..58567eea4db 100644 --- a/packages/api/src/client/types/com/atproto/admin/disableAccountInvites.ts +++ b/packages/api/src/client/types/com/atproto/admin/disableAccountInvites.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.disableAccountInvites' export interface QueryParams {} 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 c264b65dbc2..72760656e42 100644 --- a/packages/api/src/client/types/com/atproto/admin/disableInviteCodes.ts +++ b/packages/api/src/client/types/com/atproto/admin/disableInviteCodes.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.disableInviteCodes' export interface QueryParams {} 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 094b3dfe0af..653276b81f8 100644 --- a/packages/api/src/client/types/com/atproto/admin/enableAccountInvites.ts +++ b/packages/api/src/client/types/com/atproto/admin/enableAccountInvites.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.enableAccountInvites' export interface QueryParams {} 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 645b9e613ff..791bb827d13 100644 --- a/packages/api/src/client/types/com/atproto/admin/getAccountInfo.ts +++ b/packages/api/src/client/types/com/atproto/admin/getAccountInfo.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' +export const id = 'com.atproto.admin.getAccountInfo' + export interface QueryParams { did: string } 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 9c1c273b9d9..e327d1918fc 100644 --- a/packages/api/src/client/types/com/atproto/admin/getAccountInfos.ts +++ b/packages/api/src/client/types/com/atproto/admin/getAccountInfos.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' +export const id = 'com.atproto.admin.getAccountInfos' + export interface QueryParams { dids: string[] } 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 faa4c8bed25..4ddd14c386b 100644 --- a/packages/api/src/client/types/com/atproto/admin/getInviteCodes.ts +++ b/packages/api/src/client/types/com/atproto/admin/getInviteCodes.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoServerDefs from '../server/defs' +export const id = 'com.atproto.admin.getInviteCodes' + export interface QueryParams { sort?: 'recent' | 'usage' | (string & {}) limit?: number 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 f11b514507d..591e393a961 100644 --- a/packages/api/src/client/types/com/atproto/admin/getSubjectStatus.ts +++ b/packages/api/src/client/types/com/atproto/admin/getSubjectStatus.ts @@ -3,12 +3,14 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' import * as ComAtprotoRepoStrongRef from '../repo/strongRef' +export const id = 'com.atproto.admin.getSubjectStatus' + export interface QueryParams { did?: string uri?: string 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 2d22806238c..b2a35381b30 100644 --- a/packages/api/src/client/types/com/atproto/admin/searchAccounts.ts +++ b/packages/api/src/client/types/com/atproto/admin/searchAccounts.ts @@ -3,11 +3,13 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' +export const id = 'com.atproto.admin.searchAccounts' + export interface QueryParams { email?: string cursor?: string 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 3f7c06d7070..a44681343b7 100644 --- a/packages/api/src/client/types/com/atproto/admin/sendEmail.ts +++ b/packages/api/src/client/types/com/atproto/admin/sendEmail.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.sendEmail' export interface QueryParams {} 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 d13878711a6..7f9e396e2d8 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateAccountEmail.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateAccountEmail.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.updateAccountEmail' export interface QueryParams {} 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 38fbcae1681..fa70b2e190e 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateAccountHandle.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateAccountHandle.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.updateAccountHandle' export interface QueryParams {} 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 412f0facca2..b8a21dfd8c8 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateAccountPassword.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateAccountPassword.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.admin.updateAccountPassword' export interface QueryParams {} 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 d890993cf3a..e7a9dc149f7 100644 --- a/packages/api/src/client/types/com/atproto/admin/updateSubjectStatus.ts +++ b/packages/api/src/client/types/com/atproto/admin/updateSubjectStatus.ts @@ -3,12 +3,14 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' import * as ComAtprotoAdminDefs from './defs' import * as ComAtprotoRepoStrongRef from '../repo/strongRef' +export const id = 'com.atproto.admin.updateSubjectStatus' + export interface QueryParams {} export interface InputSchema { 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 a5e4a0296de..6842ec74960 100644 --- a/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts +++ b/packages/api/src/client/types/com/atproto/identity/getRecommendedDidCredentials.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.identity.getRecommendedDidCredentials' export interface QueryParams {} 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 dcab71e2558..13b968886d1 100644 --- a/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts +++ b/packages/api/src/client/types/com/atproto/identity/requestPlcOperationSignature.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.identity.requestPlcOperationSignature' export interface QueryParams {} 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 32db72138f7..7a4eb18fb77 100644 --- a/packages/api/src/client/types/com/atproto/identity/resolveHandle.ts +++ b/packages/api/src/client/types/com/atproto/identity/resolveHandle.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.identity.resolveHandle' export interface QueryParams { /** The handle to resolve. */ 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 88c04c5993c..02857779924 100644 --- a/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts +++ b/packages/api/src/client/types/com/atproto/identity/signPlcOperation.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.identity.signPlcOperation' export interface QueryParams {} 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 74dea9f196d..e5013bd7498 100644 --- a/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts +++ b/packages/api/src/client/types/com/atproto/identity/submitPlcOperation.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.identity.submitPlcOperation' export interface QueryParams {} 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 c01d4887a4a..383873a5f9e 100644 --- a/packages/api/src/client/types/com/atproto/identity/updateHandle.ts +++ b/packages/api/src/client/types/com/atproto/identity/updateHandle.ts @@ -3,9 +3,11 @@ */ import { HeadersMap, XRPCError } from '@atproto/xrpc' import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } from '../../../../util' +import { lexicons } from '../../../../lexicons' + +export const id = 'com.atproto.identity.updateHandle' export interface QueryParams {} 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 131682e550c..53d6a9ae242 100644 --- a/packages/api/src/client/types/com/atproto/label/defs.ts +++ b/packages/api/src/client/types/com/atproto/label/defs.ts @@ -2,9 +2,11 @@ * GENERATED CODE - DO NOT MODIFY */ import { ValidationResult, BlobRef } from '@atproto/lexicon' -import { isObj, hasProp } from '../../../../util' -import { lexicons } from '../../../../lexicons' import { CID } from 'multiformats/cid' +import { is$typed } 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 { @@ -29,16 +31,14 @@ export interface Label { [k: string]: unknown } -export function isLabel(v: unknown): v is Label { - return ( - isObj(v) && - hasProp(v, '$type') && - v.$type === 'com.atproto.label.defs#label' - ) +export function isLabel( + v: unknown, +): v is Label & { $type: 'com.atproto.label.defs#label' } { + return is$typed(v, id, 'label') } -export function validateLabel(v: unknown): ValidationResult { - return lexicons.validate('com.atproto.label.defs#label', v) +export function validateLabel(v: unknown) { + return lexicons.validate(`${id}#label`, v) as ValidationResult