command-action
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,8 +0,10 @@ | ||
import { ActionMethod, Context, PropsType } from '../types'; | ||
import { ActionMethod, CommandActionConfig, Context, PropsType } from '../types'; | ||
declare class Command { | ||
private static command; | ||
provider: PropsType | null; | ||
config: CommandActionConfig; | ||
static instance(): Command; | ||
settings(config: Partial<CommandActionConfig>): this; | ||
runWithProvider<Props extends PropsType, Result extends Props = Props>(action: ActionMethod<Props, Result>, props: (Parameters<typeof action>)[0], provider: PropsType): Promise<Context<Result>>; | ||
} | ||
export default Command; |
@@ -15,2 +15,5 @@ "use strict"; | ||
this.provider = null; | ||
this.config = { | ||
defaultForceFailures: false | ||
}; | ||
} | ||
@@ -23,2 +26,6 @@ static instance() { | ||
} | ||
settings(config) { | ||
this.config = Object.assign(Object.assign({}, this.config), config); | ||
return this; | ||
} | ||
runWithProvider(action, props, provider) { | ||
@@ -25,0 +32,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { PropsType, ActionInstance } from '../types'; | ||
interface FailureMeta extends Record<string, any> { | ||
exstras?: Record<string, any>; | ||
extras?: Record<string, any>; | ||
type: string; | ||
message: string | string[]; | ||
message?: string | string[]; | ||
force: boolean; | ||
@@ -7,0 +7,0 @@ } |
@@ -23,2 +23,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const instance_1 = require("../instance"); | ||
const types_1 = require("../types"); | ||
@@ -52,3 +53,3 @@ const Errors_1 = require("../Errors"); | ||
fail(_a) { | ||
var { type = types_1.FailureType.Standard, message, force = false } = _a, rest = __rest(_a, ["type", "message", "force"]); | ||
var { type = types_1.FailureType.Standard, message, force = instance_1.Command.config.defaultForceFailures } = _a, rest = __rest(_a, ["type", "message", "force"]); | ||
this._failureMeta = { | ||
@@ -58,3 +59,3 @@ type, | ||
force, | ||
exstras: rest | ||
extras: rest | ||
}; | ||
@@ -61,0 +62,0 @@ if (force) { |
@@ -15,1 +15,4 @@ import { ContextClass } from './Context'; | ||
} | ||
export interface CommandActionConfig { | ||
defaultForceFailures: boolean; | ||
} |
{ | ||
"name": "command-action", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36239
974