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

@aomex/commander

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aomex/commander - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

10

CHANGELOG.md
# @aomex/commander
## 0.0.15
### Patch Changes
- [`1ee022f`](https://github.com/aomex/aomex/commit/1ee022fdc674997086be70f76afb3e293fc804d6) Thanks [@geekact](https://github.com/geekact)! - revert(router,commander): logics support
- Updated dependencies []:
- @aomex/core@0.0.13
- @aomex/console@0.0.13
## 0.0.14

@@ -4,0 +14,0 @@

16

dist/index.d.ts

@@ -6,15 +6,9 @@ import { ConsoleMiddlewareToken, ConsoleContext, ConsoleChain } from '@aomex/console';

type CollectArrayType<T> = T extends ConsoleMiddlewareToken<infer R> ? R : object;
interface BuilderOptions<Props extends object, T extends ConsoleMiddlewareToken[] | [], Logics extends Builder.LogicFunction> {
interface BuilderOptions<Props extends object, T extends ConsoleMiddlewareToken[] | []> {
showInHelp?: boolean;
docs?: Builder.Docs;
mount?: T;
logics?: Logics & ThisType<Logics & {
ctx: Builder.Context<Props, T>;
}>;
action: (ctx: Builder.Context<Props, T>, logic: Logics) => any;
action: (ctx: Builder.Context<Props, T>) => any;
}
declare namespace Builder {
interface LogicFunction {
[key: string]: (...args: any[]) => any;
}
type Context<Props extends object, T extends ConsoleMiddlewareToken[] | []> = Props & Union2Intersection<CollectArrayType<T[number]>> & ConsoleContext;

@@ -26,3 +20,3 @@ interface Docs {

}
declare class Builder<Props extends object = object, T extends ConsoleMiddlewareToken[] | [] = [], Logics extends Builder.LogicFunction = Builder.LogicFunction> {
declare class Builder<Props extends object = object, T extends ConsoleMiddlewareToken[] | [] = []> {
readonly chain: ConsoleChain;

@@ -32,3 +26,3 @@ readonly commands: string[];

readonly docs: Builder.Docs;
constructor(prefix: string, commands: string[], options: BuilderOptions<Props, T, Logics>);
constructor(prefix: string, commands: string[], options: BuilderOptions<Props, T>);
match(command: string): boolean;

@@ -50,3 +44,3 @@ }

constructor(options?: CommanderOptions<Props>);
create<T extends ConsoleMiddlewareToken<object>[] | [], Logics extends Builder.LogicFunction>(command: string | string[], options: BuilderOptions<Props, T, Logics>): void;
create<T extends ConsoleMiddlewareToken<object>[] | []>(command: string | string[], options: BuilderOptions<Props, T>): void;
protected toMiddleware(): Middleware;

@@ -53,0 +47,0 @@ }

@@ -25,14 +25,3 @@ // src/commanders.ts

middleware.console((ctx, _) => {
const logics = {};
if (options.logics) {
const logicContext = {};
Object.keys(options.logics).forEach((key) => {
logicContext[key] = logics[key] = options.logics[key].bind(
logicContext,
ctx
);
});
logicContext["ctx"] = ctx;
}
options.action(ctx, logics);
options.action(ctx);
})

@@ -39,0 +28,0 @@ );

{
"name": "@aomex/commander",
"version": "0.0.14",
"version": "0.0.15",
"description": "",

@@ -29,4 +29,4 @@ "type": "module",

"peerDependencies": {
"@aomex/console": "^0.0.12",
"@aomex/core": "^0.0.12"
"@aomex/console": "^0.0.13",
"@aomex/core": "^0.0.13"
},

@@ -37,6 +37,6 @@ "dependencies": {

"devDependencies": {
"@aomex/console": "^0.0.12",
"@aomex/core": "^0.0.12"
"@aomex/console": "^0.0.13",
"@aomex/core": "^0.0.13"
},
"scripts": {}
}

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