@prismatic-io/spectral
Advanced tools
Comparing version 6.4.0 to 6.4.1
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition } from "./types"; | ||
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult } from "./types"; | ||
import { convertComponent } from "./serverTypes/convert"; | ||
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
export declare const action: <T extends Inputs>(definition: ActionDefinition<T>) => ActionDefinition<T>; | ||
export declare const action: <TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>>(definition: ActionDefinition<TInputs, TAllowsBranching, TReturn>) => ActionDefinition<TInputs, TAllowsBranching, TReturn>; | ||
/** | ||
@@ -38,3 +38,3 @@ * This function creates a trigger object that can be referenced | ||
*/ | ||
export declare const trigger: <T extends Inputs>(definition: TriggerDefinition<T>) => TriggerDefinition<T>; | ||
export declare const trigger: <TInputs extends Inputs, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching>>(definition: TriggerDefinition<TInputs, TAllowsBranching, TResult>) => TriggerDefinition<TInputs, TAllowsBranching, TResult>; | ||
/** | ||
@@ -41,0 +41,0 @@ * For information and examples on how to write inputs |
@@ -7,5 +7,5 @@ /** | ||
*/ | ||
import { TriggerPayload, TriggerResult, Connection, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn } from "./serverTypes"; | ||
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters } from "./types"; | ||
export declare const createConnection: <T extends Connection>({ key }: T, values: Record<string, unknown>) => ConnectionValue; | ||
import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn } from "./serverTypes"; | ||
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult } from "./types"; | ||
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>) => ConnectionValue; | ||
/** | ||
@@ -29,3 +29,3 @@ * Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected. | ||
*/ | ||
export declare const invoke: <T extends Inputs>({ perform }: ActionDefinition<T>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<import("./types").ActionPerformReturn<boolean | undefined, unknown>>>; | ||
export declare const invoke: <TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform }: ActionDefinition<TInputs, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<TReturn>>; | ||
export declare const defaultTriggerPayload: () => TriggerPayload; | ||
@@ -38,3 +38,3 @@ /** | ||
*/ | ||
export declare const invokeTrigger: <T extends Inputs>({ perform }: TriggerDefinition<T>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<T> | undefined) => Promise<InvokeReturn<import("./types").TriggerResult<boolean | undefined>>>; | ||
export declare const invokeTrigger: <TInputs extends Inputs, TAllowsBranching extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching>>({ perform }: TriggerDefinition<TInputs, TAllowsBranching, TResult>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs> | undefined) => Promise<InvokeReturn<TResult>>; | ||
export declare class ComponentTestHarness<TComponent extends Component> { | ||
@@ -50,6 +50,6 @@ component: TComponent; | ||
loggerMock: () => ActionLogger; | ||
invoke: <T extends Inputs>({ perform }: ActionDefinition<T>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<import("./types").ActionPerformReturn<boolean | undefined, unknown>>>; | ||
invokeTrigger: <T_1 extends Inputs>({ perform }: TriggerDefinition<T_1>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<T_1> | undefined) => Promise<InvokeReturn<import("./types").TriggerResult<boolean | undefined>>>; | ||
invoke: <TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform }: ActionDefinition<TInputs, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<TReturn>>; | ||
invokeTrigger: <TInputs_1 extends Inputs, TAllowsBranching_1 extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching_1>>({ perform }: TriggerDefinition<TInputs_1, TAllowsBranching_1, TResult>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs_1> | undefined) => Promise<InvokeReturn<TResult>>; | ||
createHarness: <TComponent extends Component>(component: TComponent) => ComponentTestHarness<TComponent>; | ||
}; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
import { ActionDisplayDefinition, ActionPerformFunction, Inputs } from "."; | ||
import { ActionDisplayDefinition, ActionPerformFunction, ActionPerformReturn, Inputs } from "."; | ||
/** | ||
@@ -6,7 +6,7 @@ * ActionDefinition is the type of the object that is passed in to `action` function to | ||
*/ | ||
export interface ActionDefinition<TInputs extends Inputs> { | ||
export interface ActionDefinition<TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> { | ||
/** Defines how the Action is displayed in the Prismatic interface. */ | ||
display: ActionDisplayDefinition; | ||
/** Function to perform when this Action is invoked. */ | ||
perform: ActionPerformFunction<this["inputs"], this["allowsBranching"]>; | ||
perform: ActionPerformFunction<TInputs, TAllowsBranching, TReturn>; | ||
/** InputFields to present in the Prismatic interface for configuration of this Action. */ | ||
@@ -19,3 +19,3 @@ inputs: TInputs; | ||
/** Determines whether an Action will allow Conditional Branching.*/ | ||
allowsBranching?: boolean; | ||
allowsBranching?: TAllowsBranching; | ||
/** Static Branch names associated with an Action. */ | ||
@@ -22,0 +22,0 @@ staticBranchNames?: string[]; |
import { Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger } from "."; | ||
/** Definition of the function to perform when an Action is invoked. */ | ||
export declare type ActionPerformFunction<TInputs extends Inputs, AllowsBranching extends boolean | undefined> = (context: ActionContext, params: ActionInputParameters<TInputs>) => Promise<ActionPerformReturn<AllowsBranching, unknown>>; | ||
export declare type ActionPerformFunction<TInputs extends Inputs, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext, params: ActionInputParameters<TInputs>) => Promise<TReturn>; | ||
/** Context provided to perform method containing helpers and contextual data */ | ||
@@ -5,0 +5,0 @@ export interface ActionContext { |
@@ -16,5 +16,5 @@ import { ActionDefinition, ConnectionDefinition, ComponentDisplayDefinition, TriggerDefinition } from "."; | ||
/** Specifies the supported Actions of this Component. */ | ||
actions?: Record<string, ActionDefinition<any>>; | ||
actions?: Record<string, ActionDefinition<any, boolean, any>>; | ||
/** Specifies the supported Triggers of this Component. */ | ||
triggers?: Record<string, TriggerDefinition<any>>; | ||
triggers?: Record<string, TriggerDefinition<any, boolean, any>>; | ||
/** Specifies the supported Connections of this Component. */ | ||
@@ -21,0 +21,0 @@ connections?: ConnectionDefinition[]; |
@@ -1,2 +0,2 @@ | ||
import { ActionDisplayDefinition, TriggerPerformFunction, Inputs } from "."; | ||
import { ActionDisplayDefinition, TriggerPerformFunction, Inputs, TriggerResult } from "."; | ||
declare const optionChoices: readonly ["invalid", "valid", "required"]; | ||
@@ -9,7 +9,7 @@ export declare type TriggerOptionChoice = typeof optionChoices[number]; | ||
*/ | ||
export interface TriggerDefinition<TInputs extends Inputs> { | ||
export interface TriggerDefinition<TInputs extends Inputs, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching>> { | ||
/** Defines how the Trigger is displayed in the Prismatic interface. */ | ||
display: ActionDisplayDefinition; | ||
/** Function to perform when this Trigger is invoked. */ | ||
perform: TriggerPerformFunction<this["inputs"], this["allowsBranching"]>; | ||
perform: TriggerPerformFunction<TInputs, TAllowsBranching, TResult>; | ||
/** InputFields to present in the Prismatic interface for configuration of this Trigger. */ | ||
@@ -26,3 +26,3 @@ inputs: TInputs; | ||
/** Determines whether this Trigger allows Conditional Branching. */ | ||
allowsBranching?: boolean; | ||
allowsBranching?: TAllowsBranching; | ||
/** Static Branch names associated with this Trigger. */ | ||
@@ -29,0 +29,0 @@ staticBranchNames?: string[]; |
import { Inputs, TriggerResult, ActionInputParameters, ActionContext, TriggerPayload } from "."; | ||
/** Definition of the function to perform when a Trigger is invoked. */ | ||
export declare type TriggerPerformFunction<T extends Inputs, AllowsBranching extends boolean | undefined> = (context: ActionContext, payload: TriggerPayload, params: ActionInputParameters<T>) => Promise<TriggerResult<AllowsBranching>>; | ||
export declare type TriggerPerformFunction<T extends Inputs, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching>> = (context: ActionContext, payload: TriggerPayload, params: ActionInputParameters<T>) => Promise<TResult>; |
{ | ||
"name": "@prismatic-io/spectral", | ||
"version": "6.4.0", | ||
"version": "6.4.1", | ||
"description": "Utility library for building Prismatic components", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
115721
2484