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

@hephaestus/core

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hephaestus/core - npm Package Compare versions

Comparing version 1.0.0-alpha.12 to 1.0.0-alpha.13

51

dist/index.d.ts

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

import { MaybeArray, ExtendedMap, KeysMatching, MaybePromise } from '@hephaestus/utils';
import { ConditionalKeys, Promisable, UnionToIntersection } from 'type-fest';
import { MaybeArray, ExtendedMap } from '@hephaestus/utils';

@@ -48,3 +49,3 @@ interface Loadable {

declare abstract class LoadableMap<A, T extends A & Loadable = A & Loadable> extends ExtendedMap<string, T> {
declare abstract class Anvil<A, T extends A & Loadable = A & Loadable> extends ExtendedMap<string, T> {
private readonly key;

@@ -56,5 +57,5 @@ protected toLoad: Array<T | string>;

protected abstract isValid(loadable: unknown): loadable is T;
constructor(key: KeysMatching<T, string>);
add(...loadables: Array<MaybeArray<T | string>>): this;
load(onLoad?: (loadable: T) => unknown): Promise<this>;
constructor(key: ConditionalKeys<T, string>);
forge(...loadables: Array<MaybeArray<T | string>>): this;
hammer(onLoad?: (loadable: T) => unknown): Promise<this>;
reload(onLoad?: (loadable: T) => unknown, onReload?: (loadable: T) => unknown): Promise<this>;

@@ -65,3 +66,10 @@ protected loadFiles(path: string): Promise<MaybeArray<T>>;

declare type CommandMiddlewareAction<Client, Interaction, Return = unknown> = (interaction: Interaction, client: Client) => MaybePromise<Return>;
declare abstract class Hephaestus {
abstract commands: CommandAnvil<Command<any, any>>;
abstract events: EventAnvil<Event>;
abstract permissions: PermissionAnvil<Permission<any, any>>;
abstract connect(): Promisable<void>;
}
declare type CommandMiddlewareAction<Client, Interaction, Return = unknown> = (interaction: Interaction, client: Client) => Promisable<Return>;
interface CommandMiddleware<Client, Interaction, Return = unknown> {

@@ -76,9 +84,7 @@ action: CommandMiddlewareAction<Client, Interaction, Return>;

}
declare abstract class PermissionMap<T extends Permission<any, any>> extends LoadableMap<T> {
declare abstract class PermissionAnvil<T extends Permission<any, any>> extends Anvil<T> {
protected isValid(loadable: unknown): loadable is T;
}
interface AutoCompleteOption<Client, Interaction, InteractionDataOptions> {
autocompleteAction: (interaction: Interaction, client: Client, data: InteractionDataOptions[]) => MaybePromise<void>;
}
declare type AutocompleteAction<Interaction, Option, H extends Hephaestus> = (interaction: Interaction, focusedOption: Option, hephaestus: H) => Promisable<void>;
interface Command<Client, Interaction> {

@@ -90,16 +96,17 @@ name: string;

}
interface ExecutableCommand<Client, Interaction, InteractionDataOptions> extends Command<Client, Interaction> {
action: (interaction: Interaction, client: Client, data: InteractionDataOptions[]) => MaybePromise<void>;
declare type CommandAction<Interaction, H extends Hephaestus> = (interaction: Interaction, hephaestus: H) => Promisable<void>;
declare type CommandActionWithOptions<Interaction, OptionsMap, H extends Hephaestus> = (interaction: Interaction, data: OptionsMap, hephaestus: H) => Promisable<void>;
interface BaseOption {
name: string;
required?: boolean;
}
declare abstract class CommandMap<T extends Command<any, any>> extends LoadableMap<T> {
declare type ConvertOptionsToArgs<T extends readonly BaseOption[]> = UnionToIntersection<{
[P in keyof T]: {
[_ in T[P]['name']]: T[P]['required'] extends true ? T[P] : T[P] | undefined;
};
}[number]>;
declare abstract class CommandAnvil<T extends Command<any, any>> extends Anvil<T> {
protected isValid(loadable: unknown): loadable is T;
}
declare abstract class Forge {
abstract commands: CommandMap<Command<any, any>>;
abstract events: EventMap<Event>;
abstract permissions: PermissionMap<Permission<any, any>>;
abstract connect(): MaybePromise<void>;
}
interface Event {

@@ -109,6 +116,6 @@ name: string;

}
declare abstract class EventMap<T extends Event> extends LoadableMap<T> {
declare abstract class EventAnvil<T extends Event> extends Anvil<T> {
protected isValid(loadable: unknown): loadable is T;
}
export { AutoCompleteOption, Command, CommandMap, CommandMiddleware, Event, EventMap, ExecutableCommand, FILE_REGEXP, Forge, Loadable, LoadableBadKey, LoadableMap, LoadableNotFoundError, LoadableTypeError, Permission, PermissionMap, fileLoader };
export { Anvil, AutocompleteAction, BaseOption, Command, CommandAction, CommandActionWithOptions, CommandAnvil, CommandMiddleware, ConvertOptionsToArgs, Event, EventAnvil, FILE_REGEXP, Hephaestus, Loadable, LoadableBadKey, LoadableNotFoundError, LoadableTypeError, Permission, PermissionAnvil, fileLoader };

@@ -26,11 +26,11 @@ "use strict";

__export(src_exports, {
CommandMap: () => CommandMap,
EventMap: () => EventMap,
Anvil: () => Anvil,
CommandAnvil: () => CommandAnvil,
EventAnvil: () => EventAnvil,
FILE_REGEXP: () => FILE_REGEXP,
Forge: () => Forge,
Hephaestus: () => Hephaestus,
LoadableBadKey: () => LoadableBadKey,
LoadableMap: () => LoadableMap,
LoadableNotFoundError: () => LoadableNotFoundError,
LoadableTypeError: () => LoadableTypeError,
PermissionMap: () => PermissionMap,
PermissionAnvil: () => PermissionAnvil,
fileLoader: () => file_loader_exports

@@ -130,3 +130,3 @@ });

var import_utils2 = require("@hephaestus/utils");
var LoadableMap = class extends import_utils2.ExtendedMap {
var Anvil = class extends import_utils2.ExtendedMap {
constructor(key) {

@@ -138,7 +138,7 @@ super();

}
add(...loadables) {
forge(...loadables) {
this.toLoad = this.toLoad.concat(loadables.reduce((ax, dx) => ax.concat(Array.isArray(dx) ? dx : [dx]), []));
return this;
}
async load(onLoad) {
async hammer(onLoad) {
var _a, _b;

@@ -222,3 +222,3 @@ const loadables = await this.resolveToLoad();

// src/modules/interaction/command.ts
var CommandMap = class extends LoadableMap {
var CommandAnvil = class extends Anvil {
isValid(loadable) {

@@ -249,3 +249,3 @@ if (loadable == null || typeof loadable !== "object") {

// src/modules/interaction/permission.ts
var PermissionMap = class extends LoadableMap {
var PermissionAnvil = class extends Anvil {
isValid(loadable) {

@@ -260,7 +260,7 @@ if (loadable == null || typeof loadable !== "object" || !("name" in loadable) || !("level" in loadable) || !("action" in loadable)) {

// src/modules/client.ts
var Forge = class {
var Hephaestus = class {
};
// src/modules/event.ts
var EventMap = class extends LoadableMap {
var EventAnvil = class extends Anvil {
isValid(loadable) {

@@ -275,12 +275,12 @@ if (loadable == null || typeof loadable !== "object" || !("name" in loadable) || !("handler" in loadable)) {

0 && (module.exports = {
CommandMap,
EventMap,
Anvil,
CommandAnvil,
EventAnvil,
FILE_REGEXP,
Forge,
Hephaestus,
LoadableBadKey,
LoadableMap,
LoadableNotFoundError,
LoadableTypeError,
PermissionMap,
PermissionAnvil,
fileLoader
});
{
"name": "@hephaestus/core",
"version": "1.0.0-alpha.12",
"version": "1.0.0-alpha.13",
"description": "> TODO: description",

@@ -38,5 +38,5 @@ "author": "Alex Taxiera <alex.taxiera@gmail.com>",

"dependencies": {
"@hephaestus/utils": "^1.0.0-alpha.7"
"@hephaestus/utils": "^1.0.0-alpha.8"
},
"gitHead": "4dd51c36847e0e164195a35d0ec3da38ee8589ad"
"gitHead": "23a2b18ba0978dd9b2af99ff9bdbb0d236cae662"
}

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