New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atproto/api

Package Overview
Dependencies
Maintainers
4
Versions
195
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.7.4 to 0.8.0

9

CHANGELOG.md
# @atproto/api
## 0.8.0
### Minor Changes
- [#2010](https://github.com/bluesky-social/atproto/pull/2010) [`14067733`](https://github.com/bluesky-social/atproto/commit/140677335f76b99129c1f593d9e11d64624386c6) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Improve `resumeSession` event emission. It will no longer double emit when some
requests fail, and the `create-failed` event has been replaced by `expired`
where appropriate, and with a new event `network-error` where appropriate or an
unknown error occurs.
## 0.7.4

@@ -4,0 +13,0 @@

1

dist/client/index.d.ts

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

DefsReasonOther: string;
DefsReasonAppeal: string;
};

@@ -276,0 +277,0 @@ export declare const APP_BSKY_GRAPH: {

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

id: number;
event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | {
event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | ModEventResolveAppeal | {
$type: string;

@@ -82,3 +82,5 @@ [k: string]: unknown;

lastReportedAt?: string;
lastAppealedAt?: string;
takendown?: boolean;
appealed?: boolean;
suspendUntil?: string;

@@ -259,2 +261,8 @@ [k: string]: unknown;

export declare function validateModEventReverseTakedown(v: unknown): ValidationResult;
export interface ModEventResolveAppeal {
comment?: string;
[k: string]: unknown;
}
export declare function isModEventResolveAppeal(v: unknown): v is ModEventResolveAppeal;
export declare function validateModEventResolveAppeal(v: unknown): ValidationResult;
export interface ModEventComment {

@@ -309,2 +317,3 @@ comment: string;

subjectLine: string;
comment?: string;
[k: string]: unknown;

@@ -311,0 +320,0 @@ }

@@ -17,2 +17,3 @@ import { Headers } from '@atproto/xrpc';

takendown?: boolean;
appealed?: boolean;
limit?: number;

@@ -19,0 +20,0 @@ cursor?: string;

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

senderDid: string;
comment?: string;
[k: string]: unknown;

@@ -11,0 +12,0 @@ }

3

dist/client/types/com/atproto/moderation/defs.d.ts

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

export declare type ReasonType = 'com.atproto.moderation.defs#reasonSpam' | 'com.atproto.moderation.defs#reasonViolation' | 'com.atproto.moderation.defs#reasonMisleading' | 'com.atproto.moderation.defs#reasonSexual' | 'com.atproto.moderation.defs#reasonRude' | 'com.atproto.moderation.defs#reasonOther' | (string & {});
export declare type ReasonType = 'com.atproto.moderation.defs#reasonSpam' | 'com.atproto.moderation.defs#reasonViolation' | 'com.atproto.moderation.defs#reasonMisleading' | 'com.atproto.moderation.defs#reasonSexual' | 'com.atproto.moderation.defs#reasonRude' | 'com.atproto.moderation.defs#reasonOther' | 'com.atproto.moderation.defs#reasonAppeal' | (string & {});
export declare const REASONSPAM = "com.atproto.moderation.defs#reasonSpam";

@@ -8,1 +8,2 @@ export declare const REASONVIOLATION = "com.atproto.moderation.defs#reasonViolation";

export declare const REASONOTHER = "com.atproto.moderation.defs#reasonOther";
export declare const REASONAPPEAL = "com.atproto.moderation.defs#reasonAppeal";
import { LabelPreference } from './moderation/types';
export declare type AtpSessionEvent = 'create' | 'create-failed' | 'update' | 'expired';
export declare type AtpSessionEvent = 'create' | 'create-failed' | 'update' | 'expired' | 'network-error';
export interface AtpSessionData {

@@ -4,0 +4,0 @@ refreshJwt: string;

{
"name": "@atproto/api",
"version": "0.7.4",
"version": "0.8.0",
"license": "MIT",

@@ -31,3 +31,3 @@ "description": "Client library for atproto and Bluesky",

"@atproto/lex-cli": "^0.2.5",
"@atproto/dev-env": "^0.2.21"
"@atproto/dev-env": "^0.2.22"
},

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

import { ErrorResponseBody, errorResponseBody } from '@atproto/xrpc'
import { defaultFetchHandler } from '@atproto/xrpc'
import { defaultFetchHandler, XRPCError, ResponseType } from '@atproto/xrpc'
import { isValidDidDoc, getPdsEndpoint } from '@atproto/common-web'

@@ -162,4 +162,8 @@ import {

const res = await this.api.com.atproto.server.getSession()
if (!res.success || res.data.did !== this.session.did) {
throw new Error('Invalid session')
if (res.data.did !== this.session.did) {
throw new XRPCError(
ResponseType.InvalidRequest,
'Invalid session',
'InvalidDID',
)
}

@@ -170,12 +174,26 @@ this.session.email = res.data.email

this._updateApiEndpoint(res.data.didDoc)
this._persistSession?.('update', this.session)
return res
} catch (e) {
this.session = undefined
throw e
} finally {
if (this.session) {
this._persistSession?.('create', this.session)
if (e instanceof XRPCError) {
/*
* `ExpiredToken` and `InvalidToken` are handled in
* `this_refreshSession`, and emit an `expired` event there.
*
* Everything else is handled here.
*/
if (
[1, 408, 425, 429, 500, 502, 503, 504, 522, 524].includes(e.status)
) {
this._persistSession?.('network-error', undefined)
} else {
this._persistSession?.('expired', undefined)
}
} else {
this._persistSession?.('create-failed', undefined)
this._persistSession?.('network-error', undefined)
}
throw e
}

@@ -182,0 +200,0 @@ }

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

| ModEventMute
| ModEventResolveAppeal
| { $type: string; [k: string]: unknown }

@@ -151,3 +152,7 @@ subject:

lastReportedAt?: string
/** Timestamp referencing when the author of the subject appealed a moderation action */
lastAppealedAt?: string
takendown?: boolean
/** True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. */
appealed?: boolean
suspendUntil?: string

@@ -543,2 +548,23 @@ [k: string]: unknown

/** Resolve appeal on a subject */
export interface ModEventResolveAppeal {
/** Describe resolution. */
comment?: string
[k: string]: unknown
}
export function isModEventResolveAppeal(
v: unknown,
): v is ModEventResolveAppeal {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'com.atproto.admin.defs#modEventResolveAppeal'
)
}
export function validateModEventResolveAppeal(v: unknown): ValidationResult {
return lexicons.validate('com.atproto.admin.defs#modEventResolveAppeal', v)
}
/** Add a comment to a subject */

@@ -680,2 +706,4 @@ export interface ModEventComment {

subjectLine: string
/** Additional comment about the outgoing comm. */
comment?: string
[k: string]: unknown

@@ -682,0 +710,0 @@ }

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

takendown?: boolean
/** Get subjects in unresolved appealed status */
appealed?: boolean
limit?: number

@@ -36,0 +38,0 @@ cursor?: string

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

senderDid: string
/** Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers */
comment?: string
[k: string]: unknown

@@ -19,0 +21,0 @@ }

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

| 'com.atproto.moderation.defs#reasonOther'
| 'com.atproto.moderation.defs#reasonAppeal'
| (string & {})

@@ -31,1 +32,3 @@

export const REASONOTHER = 'com.atproto.moderation.defs#reasonOther'
/** Appeal: appeal a previously taken moderation action */
export const REASONAPPEAL = 'com.atproto.moderation.defs#reasonAppeal'

@@ -6,3 +6,8 @@ import { LabelPreference } from './moderation/types'

*/
export type AtpSessionEvent = 'create' | 'create-failed' | 'update' | 'expired'
export type AtpSessionEvent =
| 'create'
| 'create-failed'
| 'update'
| 'expired'
| 'network-error'

@@ -9,0 +14,0 @@ /**

@@ -162,3 +162,3 @@ import assert from 'assert'

expect(events[0]).toEqual('create')
expect(events[1]).toEqual('create')
expect(events[1]).toEqual('update')
expect(sessions.length).toEqual(2)

@@ -347,3 +347,3 @@ expect(sessions[0]?.accessJwt).toEqual(agent1.session?.accessJwt)

expect(events[0]).toEqual('create-failed')
expect(events[1]).toEqual('create-failed')
expect(events[1]).toEqual('network-error')
expect(sessions.length).toEqual(2)

@@ -350,0 +350,0 @@ expect(typeof sessions[0]).toEqual('undefined')

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 too big to display

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