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

@satorijs/core

Package Overview
Dependencies
Maintainers
1
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@satorijs/core - npm Package Compare versions

Comparing version 3.6.6 to 3.7.0

35

lib/index.d.ts

@@ -6,3 +6,3 @@ import * as cordis from 'cordis';

import { z } from 'cordis';
import { HTTP } from 'undios';
import { HTTP } from '@cordisjs/plugin-http';
export abstract class MessageEncoder<C extends Context = Context, B extends Bot<C> = Bot<C>> {

@@ -44,4 +44,2 @@ bot: B;

}
export interface Session extends Context.Associate<'session'> {
}
export class Session<C extends Context = Context> {

@@ -121,5 +119,4 @@ static counter: number;

export * from 'cordis';
export * as file from 'undios-file';
export * as Universal from '@satorijs/protocol';
declare module 'undios' {
declare module '@cordisjs/plugin-http' {
namespace HTTP {

@@ -175,7 +172,8 @@ const Config: z<Config>;

}
export interface Events<C extends Context = Context> extends cordis.Events<C> {
}
export interface Context {
[Context.events]: Events<this>;
[Context.session]: Session<this>;
satori: Satori<this>;
bots: Bot<this>[] & Dict<Bot<this>>;
component(name: string, component: Component<GetSession<this>>, options?: Component.Options): () => void;
}

@@ -185,20 +183,11 @@ export class Context extends cordis.Context {

static readonly Session: new (bot: Bot, event: Partial<Event>) => Session;
bots: Bot<this, any>[] & Dict<Bot<this, any>>;
constructor(config?: Context.Config);
component(name: string, component: Component<this[typeof Context.session]>, options?: Component.Options): () => void;
constructor(config?: any);
}
export namespace Context {
export interface Config {
request?: HTTP.Config;
}
export const Config: Config.Static;
namespace Config {
interface Static extends z<Config> {
}
}
export type Associate<P extends string, C extends Context = Context> = cordis.Context.Associate<P, C>;
export class Satori<C extends Context> extends cordis.Service<unknown, C> {
static [cordis.Service.provide]: string;
static [cordis.Service.immediate]: boolean;
constructor(ctx?: C);
bots: Bot<C, any>[] & Dict<Bot<C, any>>;
component(name: string, component: Component<C[typeof Context.session]>, options?: Component.Options): () => void;
}
export abstract class Service<T = any, C extends Context = Context> extends cordis.Service<T, C> {
[cordis.Service.setup](): void;
}
export abstract class Adapter<C extends Context = Context, B extends Bot<C> = Bot<C>> {

@@ -205,0 +194,0 @@ protected ctx: C;

{
"name": "@satorijs/core",
"description": "Core components of Satorijs",
"version": "3.6.6",
"version": "3.7.0",
"type": "module",

@@ -47,10 +47,9 @@ "main": "lib/index.cjs",

"dependencies": {
"@satorijs/element": "^3.1.6",
"@satorijs/protocol": "^1.3.0",
"cordis": "^3.13.4",
"@cordisjs/plugin-http": "^0.4.0",
"@satorijs/element": "^3.1.7",
"@satorijs/protocol": "^1.3.1",
"cordis": "^3.14.0",
"cosmokit": "^1.6.2",
"undios": "^0.3.2",
"undios-file": "^0.1.3",
"ws": "^8.16.0"
}
}

@@ -57,3 +57,10 @@ import { Awaitable, remove, Time } from 'cosmokit'

logger.debug('websocket client opening')
const socket = await this.prepare()
let socket: WebSocket
try {
socket = await this.prepare()
} catch (error) {
logger.warn(error)
return
}
// remove query args to protect privacy

@@ -60,0 +67,0 @@ const url = socket.url.replace(/\?.+/, '')

@@ -90,3 +90,3 @@ import { clone, Dict, pick, remove } from 'cosmokit'

this._status = value
if (this.ctx.bots.includes(this)) {
if (this.ctx.bots?.includes(this)) {
this.context.emit('bot-status-updated', this)

@@ -93,0 +93,0 @@ this.dispatchLoginEvent('login-updated')

@@ -6,4 +6,3 @@ import * as cordis from 'cordis'

import { z } from 'cordis'
import { HTTP } from 'undios'
import * as file from 'undios-file'
import { HTTP } from '@cordisjs/plugin-http'
import { Event, SendOptions } from '@satorijs/protocol'

@@ -21,3 +20,2 @@ import h from '@satorijs/element'

export * from 'cordis'
export * as file from 'undios-file'

@@ -31,3 +29,3 @@ export * as Universal from '@satorijs/protocol'

declare module 'undios' {
declare module '@cordisjs/plugin-http' {
namespace HTTP {

@@ -104,7 +102,8 @@ export const Config: z<Config>

export interface Events<C extends Context = Context> extends cordis.Events<C> {}
export interface Context {
[Context.events]: Events<this>
[Context.session]: Session<this>
satori: Satori<this>
bots: Bot<this>[] & Dict<Bot<this>>
component(name: string, component: Component<GetSession<this>>, options?: Component.Options): () => void
}

@@ -117,2 +116,20 @@

constructor(config?: any) {
super(config)
this.provide('http', undefined, true)
this.provide('satori', undefined, true)
this.plugin(HTTP, config.request)
this.plugin(Satori)
}
}
export class Satori<C extends Context> extends cordis.Service<unknown, C> {
static [cordis.Service.provide] = 'satori'
static [cordis.Service.immediate] = true
constructor(ctx?: C) {
super(ctx)
ctx.mixin('satori', ['bots', 'component'])
}
public bots = new Proxy([], {

@@ -134,12 +151,5 @@ get(target, prop) {

},
}) as Bot<this>[] & Dict<Bot<this>>
}) as Bot<C>[] & Dict<Bot<C>>
constructor(config: Context.Config = {}) {
super(config)
this.provide('http', undefined, true)
this.plugin(HTTP, config.request)
this.plugin(file)
}
component(name: string, component: Component<this[typeof Context.session]>, options: Component.Options = {}) {
component(name: string, component: Component<C[typeof Context.session]>, options: Component.Options = {}) {
const render: Component = async (attrs, children, session) => {

@@ -152,26 +162,4 @@ if (options.session && session.type === 'send') {

}
return this.set('component:' + name, render)
return this.ctx.set('component:' + name, render)
}
}
export namespace Context {
export interface Config {
request?: HTTP.Config
}
export const Config: Config.Static = z.intersect([
z.object({}),
])
namespace Config {
export interface Static extends z<Config> {}
}
export type Associate<P extends string, C extends Context = Context> = cordis.Context.Associate<P, C>
}
export abstract class Service<T = any, C extends Context = Context> extends cordis.Service<T, C> {
[cordis.Service.setup]() {
this.ctx = new Context() as C
}
}

@@ -30,4 +30,2 @@ import { defineProperty, isNullable } from 'cosmokit'

export interface Session extends Context.Associate<'session'> {}
export class Session<C extends Context = Context> {

@@ -34,0 +32,0 @@ static counter = 0

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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