Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atproto/api

Package Overview
Dependencies
Maintainers
3
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atproto/api - npm Package Compare versions

Comparing version 0.2.10 to 0.2.11

dist/client/types/app/bsky/graph/block.d.ts

27

dist/client/index.d.ts

@@ -70,3 +70,5 @@ import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@atproto/xrpc';

import * as AppBskyFeedRepost from './types/app/bsky/feed/repost';
import * as AppBskyGraphBlock from './types/app/bsky/graph/block';
import * as AppBskyGraphFollow from './types/app/bsky/graph/follow';
import * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks';
import * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers';

@@ -162,3 +164,5 @@ import * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows';

export * as AppBskyFeedRepost from './types/app/bsky/feed/repost';
export * as AppBskyGraphBlock from './types/app/bsky/graph/block';
export * as AppBskyGraphFollow from './types/app/bsky/graph/follow';
export * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks';
export * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers';

@@ -426,4 +430,6 @@ export * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows';

_service: AtpServiceClient;
block: BlockRecord;
follow: FollowRecord;
constructor(service: AtpServiceClient);
getBlocks(params?: AppBskyGraphGetBlocks.QueryParams, opts?: AppBskyGraphGetBlocks.CallOptions): Promise<AppBskyGraphGetBlocks.Response>;
getFollowers(params?: AppBskyGraphGetFollowers.QueryParams, opts?: AppBskyGraphGetFollowers.CallOptions): Promise<AppBskyGraphGetFollowers.Response>;

@@ -435,2 +441,23 @@ getFollows(params?: AppBskyGraphGetFollows.QueryParams, opts?: AppBskyGraphGetFollows.CallOptions): Promise<AppBskyGraphGetFollows.Response>;

}
export declare class BlockRecord {
_service: AtpServiceClient;
constructor(service: AtpServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyGraphBlock.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyGraphBlock.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyGraphBlock.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class FollowRecord {

@@ -437,0 +464,0 @@ _service: AtpServiceClient;

2

dist/client/types/app/bsky/actor/defs.d.ts

@@ -46,2 +46,4 @@ import { ValidationResult } from '@atproto/lexicon';

muted?: boolean;
blockedBy?: boolean;
blocking?: string;
following?: string;

@@ -48,0 +50,0 @@ followedBy?: string;

@@ -15,3 +15,3 @@ import { ValidationResult } from '@atproto/lexicon';

export interface View {
record: ViewRecord | ViewNotFound | {
record: ViewRecord | ViewNotFound | ViewBlocked | {
$type: string;

@@ -45,1 +45,7 @@ [k: string]: unknown;

export declare function validateViewNotFound(v: unknown): ValidationResult;
export interface ViewBlocked {
uri: string;
[k: string]: unknown;
}
export declare function isViewBlocked(v: unknown): v is ViewBlocked;
export declare function validateViewBlocked(v: unknown): ValidationResult;

@@ -61,7 +61,7 @@ import { ValidationResult } from '@atproto/lexicon';

post: PostView;
parent?: ThreadViewPost | NotFoundPost | {
parent?: ThreadViewPost | NotFoundPost | BlockedPost | {
$type: string;
[k: string]: unknown;
};
replies?: (ThreadViewPost | NotFoundPost | {
replies?: (ThreadViewPost | NotFoundPost | BlockedPost | {
$type: string;

@@ -81,1 +81,8 @@ [k: string]: unknown;

export declare function validateNotFoundPost(v: unknown): ValidationResult;
export interface BlockedPost {
uri: string;
blocked: true;
[k: string]: unknown;
}
export declare function isBlockedPost(v: unknown): v is BlockedPost;
export declare function validateBlockedPost(v: unknown): ValidationResult;

@@ -1,2 +0,2 @@

import { Headers } from '@atproto/xrpc';
import { Headers, XRPCError } from '@atproto/xrpc';
import * as AppBskyFeedDefs from './defs';

@@ -22,2 +22,8 @@ export interface QueryParams {

}
export declare class BlockedActorError extends XRPCError {
constructor(src: XRPCError);
}
export declare class BlockedByActorError extends XRPCError {
constructor(src: XRPCError);
}
export declare function toKnownErr(e: any): any;

2

dist/client/types/app/bsky/feed/getPostThread.d.ts

@@ -9,3 +9,3 @@ import { Headers, XRPCError } from '@atproto/xrpc';

export interface OutputSchema {
thread: AppBskyFeedDefs.ThreadViewPost | AppBskyFeedDefs.NotFoundPost | {
thread: AppBskyFeedDefs.ThreadViewPost | AppBskyFeedDefs.NotFoundPost | AppBskyFeedDefs.BlockedPost | {
$type: string;

@@ -12,0 +12,0 @@ [k: string]: unknown;

{
"name": "@atproto/api",
"version": "0.2.10",
"version": "0.2.11",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -91,3 +91,5 @@ /**

import * as AppBskyFeedRepost from './types/app/bsky/feed/repost'
import * as AppBskyGraphBlock from './types/app/bsky/graph/block'
import * as AppBskyGraphFollow from './types/app/bsky/graph/follow'
import * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks'
import * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers'

@@ -185,3 +187,5 @@ import * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows'

export * as AppBskyFeedRepost from './types/app/bsky/feed/repost'
export * as AppBskyGraphBlock from './types/app/bsky/graph/block'
export * as AppBskyGraphFollow from './types/app/bsky/graph/follow'
export * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks'
export * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers'

@@ -1344,2 +1348,3 @@ export * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows'

_service: AtpServiceClient
block: BlockRecord
follow: FollowRecord

@@ -1349,5 +1354,17 @@

this._service = service
this.block = new BlockRecord(service)
this.follow = new FollowRecord(service)
}
getBlocks(
params?: AppBskyGraphGetBlocks.QueryParams,
opts?: AppBskyGraphGetBlocks.CallOptions,
): Promise<AppBskyGraphGetBlocks.Response> {
return this._service.xrpc
.call('app.bsky.graph.getBlocks', params, undefined, opts)
.catch((e) => {
throw AppBskyGraphGetBlocks.toKnownErr(e)
})
}
getFollowers(

@@ -1409,2 +1426,63 @@ params?: AppBskyGraphGetFollowers.QueryParams,

export class BlockRecord {
_service: AtpServiceClient
constructor(service: AtpServiceClient) {
this._service = service
}
async list(
params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
): Promise<{
cursor?: string
records: { uri: string; value: AppBskyGraphBlock.Record }[]
}> {
const res = await this._service.xrpc.call('com.atproto.repo.listRecords', {
collection: 'app.bsky.graph.block',
...params,
})
return res.data
}
async get(
params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
): Promise<{ uri: string; cid: string; value: AppBskyGraphBlock.Record }> {
const res = await this._service.xrpc.call('com.atproto.repo.getRecord', {
collection: 'app.bsky.graph.block',
...params,
})
return res.data
}
async create(
params: Omit<
ComAtprotoRepoCreateRecord.InputSchema,
'collection' | 'record'
>,
record: AppBskyGraphBlock.Record,
headers?: Record<string, string>,
): Promise<{ uri: string; cid: string }> {
record.$type = 'app.bsky.graph.block'
const res = await this._service.xrpc.call(
'com.atproto.repo.createRecord',
undefined,
{ collection: 'app.bsky.graph.block', ...params, record },
{ encoding: 'application/json', headers },
)
return res.data
}
async delete(
params: Omit<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
headers?: Record<string, string>,
): Promise<void> {
await this._service.xrpc.call(
'com.atproto.repo.deleteRecord',
undefined,
{ collection: 'app.bsky.graph.block', ...params },
{ headers },
)
}
}
export class FollowRecord {

@@ -1411,0 +1489,0 @@ _service: AtpServiceClient

@@ -86,2 +86,4 @@ /**

muted?: boolean
blockedBy?: boolean
blocking?: string
following?: string

@@ -88,0 +90,0 @@ followedBy?: string

@@ -34,3 +34,7 @@ /**

export interface View {
record: ViewRecord | ViewNotFound | { $type: string; [k: string]: unknown }
record:
| ViewRecord
| ViewNotFound
| ViewBlocked
| { $type: string; [k: string]: unknown }
[k: string]: unknown

@@ -94,1 +98,18 @@ }

}
export interface ViewBlocked {
uri: string
[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 validateViewBlocked(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.record#viewBlocked', v)
}

@@ -121,2 +121,3 @@ /**

| NotFoundPost
| BlockedPost
| { $type: string; [k: string]: unknown }

@@ -126,2 +127,3 @@ replies?: (

| NotFoundPost
| BlockedPost
| { $type: string; [k: string]: unknown }

@@ -161,1 +163,19 @@ )[]

}
export interface BlockedPost {
uri: string
blocked: true
[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 validateBlockedPost(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.feed.defs#blockedPost', v)
}

@@ -35,6 +35,20 @@ /**

export class BlockedActorError extends XRPCError {
constructor(src: XRPCError) {
super(src.status, src.error, src.message)
}
}
export class BlockedByActorError extends XRPCError {
constructor(src: XRPCError) {
super(src.status, src.error, src.message)
}
}
export function toKnownErr(e: any) {
if (e instanceof XRPCError) {
if (e.error === 'BlockedActor') return new BlockedActorError(e)
if (e.error === 'BlockedByActor') return new BlockedByActorError(e)
}
return e
}

@@ -22,2 +22,3 @@ /**

| AppBskyFeedDefs.NotFoundPost
| AppBskyFeedDefs.BlockedPost
| { $type: string; [k: string]: unknown }

@@ -24,0 +25,0 @@ [k: string]: unknown

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc