Socket
Socket
Sign inDemoInstall

@prismatic-io/spectral

Package Overview
Dependencies
Maintainers
2
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismatic-io/spectral - npm Package Compare versions

Comparing version 3.0.4 to 4.0.0

dist/types/ActionPerformReturn.d.ts

23

dist/index.d.ts

@@ -10,3 +10,3 @@ /**

*/
import { ActionDefinition, InputFieldDefinition, PerformReturn, Inputs } from "./types";
import { ActionDefinition, InputFieldDefinition, ActionPerformReturn, Inputs, TriggerDefinition, TriggerResult } from "./types";
import { Component } from "./types/server-types";

@@ -21,4 +21,5 @@ /**

*/
export declare const component: <T extends boolean>(definition: Omit<Component<T>, "actions"> & {
actions: Record<string, ActionDefinition<any, boolean, PerformReturn<boolean, any>>>;
export declare const component: <T extends boolean>(definition: Omit<Component<T>, "actions" | "triggers"> & {
actions?: Record<string, ActionDefinition<any, boolean, ActionPerformReturn<boolean, any>>> | undefined;
triggers?: Record<string, TriggerDefinition<any, boolean, TriggerResult<boolean>>> | undefined;
}) => Component<T>;

@@ -34,8 +35,18 @@ /**

*/
export declare const action: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends PerformReturn<AllowsBranching, unknown>>(definition: ActionDefinition<T, AllowsBranching, ReturnData>) => ActionDefinition<T, AllowsBranching, ReturnData>;
export declare const action: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>>(definition: ActionDefinition<T, AllowsBranching, ReturnData>) => ActionDefinition<T, AllowsBranching, ReturnData>;
/**
* This function creates a trigger object that can be referenced
* by a custom component. It helps ensure that the shape of the
* trigger object conforms to what the Prismatic API expects.
* For information on writing custom component triggers, see
* https://prismatic.io/docs/custom-components/writing-custom-components/#writing-triggers.
* @param definition A TriggerDefinition type object that includes UI display information, a function to perform when the trigger is invoked, and a an object containing inputs for the perform function.
* @returns This function validates the shape of the `definition` object provided, and returns the same trigger object.
*/
export declare const trigger: <T extends Inputs, AllowsBranching extends boolean, Result extends TriggerResult<AllowsBranching>>(definition: TriggerDefinition<T, AllowsBranching, Result>) => TriggerDefinition<T, AllowsBranching, Result>;
/**
* For information and examples on how to write inputs
* for custom component actions, see
* for custom component actions and triggers, see
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-inputs.
* @param definition An InputFieldDefinition object that describes the type of an input for a custom component action, and information on how it should be displayed in the Prismatic WebApp.
* @param definition An InputFieldDefinition object that describes the type of an input for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
* @returns This function validates the shape of the `definition` object provided, and returns the same input object.

@@ -42,0 +53,0 @@ */

@@ -21,3 +21,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.testing = exports.util = exports.input = exports.action = exports.component = void 0;
exports.testing = exports.util = exports.input = exports.trigger = exports.action = exports.component = void 0;
/**

@@ -38,2 +38,16 @@ * This is a helper function for component() to convert an

/**
* This is a helper function for component() to convert a
* trigger defined in TypeScript into an trigger object that
* Prismatic's API can process.
* @param triggerKey The unique identifier of a trigger.
* @param trigger The trigger definition, including its inputs, perform function, and app display information.
* @returns This function returns a trigger object that has the shape the Prismatic API expects.
*/
const convertTrigger = (triggerKey, trigger) => {
var _a;
const items = Object.entries((_a = trigger.inputs) !== null && _a !== void 0 ? _a : {});
const inputDefinitions = items.map(([key, value]) => (Object.assign({ key }, (typeof value === "object" ? value : {}))));
return Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: inputDefinitions, perform: trigger.perform, examplePayload: trigger.examplePayload || undefined });
};
/**
* This function creates a component object that can be

@@ -46,5 +60,8 @@ * imported into the Prismatic API. For information on using

*/
const component = (definition) => (Object.assign(Object.assign({ version: "placeholder" }, definition), { documentationUrl: definition.documentationUrl || null, actions: Object.fromEntries(Object.entries(definition.actions).map(([actionKey, action]) => [
const component = (definition) => (Object.assign(Object.assign({ version: "placeholder" }, definition), { documentationUrl: definition.documentationUrl || null, actions: Object.fromEntries(Object.entries(definition.actions || {}).map(([actionKey, action]) => [
actionKey,
convertAction(actionKey, action),
])), triggers: Object.fromEntries(Object.entries(definition.triggers || {}).map(([triggerKey, trigger]) => [
triggerKey,
convertTrigger(triggerKey, trigger),
])) }));

@@ -64,6 +81,17 @@ exports.component = component;

/**
* This function creates a trigger object that can be referenced
* by a custom component. It helps ensure that the shape of the
* trigger object conforms to what the Prismatic API expects.
* For information on writing custom component triggers, see
* https://prismatic.io/docs/custom-components/writing-custom-components/#writing-triggers.
* @param definition A TriggerDefinition type object that includes UI display information, a function to perform when the trigger is invoked, and a an object containing inputs for the perform function.
* @returns This function validates the shape of the `definition` object provided, and returns the same trigger object.
*/
const trigger = (definition) => definition;
exports.trigger = trigger;
/**
* For information and examples on how to write inputs
* for custom component actions, see
* for custom component actions and triggers, see
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-inputs.
* @param definition An InputFieldDefinition object that describes the type of an input for a custom component action, and information on how it should be displayed in the Prismatic WebApp.
* @param definition An InputFieldDefinition object that describes the type of an input for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
* @returns This function validates the shape of the `definition` object provided, and returns the same input object.

@@ -70,0 +98,0 @@ */

@@ -8,3 +8,3 @@ /**

/** */
import { ActionContext, ActionLogger, ActionDefinition, ActionInputParameters, Credential, BasicCredential, ApiKeyCredential, ApiKeySecretCredential, PrivateKeyCredential, OAuth2Credential, PerformReturn, AuthorizationMethod, Inputs } from "./types";
import { ActionContext, ActionLogger, ActionDefinition, ActionInputParameters, Credential, BasicCredential, ApiKeyCredential, ApiKeySecretCredential, PrivateKeyCredential, OAuth2Credential, ActionPerformReturn, AuthorizationMethod, Inputs, TriggerDefinition, TriggerResult, TriggerPayload } from "./types";
/**

@@ -47,9 +47,18 @@ * Get an array of available authorization methods that a custom component can use.

* Invokes specified ActionDefinition perform function using supplied params
* and optional context. Accepts a generic type matching PerformReturn as a convenience
* and optional context. Accepts a generic type matching ActionPerformReturn as a convenience
* to avoid extra casting within test methods. Returns an InvokeResult containing both the
* action result and a mock logger for asserting logging.
*/
export declare const invoke: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends PerformReturn<AllowsBranching, unknown>>(actionBase: ActionDefinition<T, AllowsBranching, ReturnData> | Record<string, ActionDefinition<T, AllowsBranching, ReturnData>>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<ReturnData>>;
export declare const invoke: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>>(actionBase: ActionDefinition<T, AllowsBranching, ReturnData> | Record<string, ActionDefinition<T, AllowsBranching, ReturnData>>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<ReturnData>>;
export declare const defaultTriggerPayload: () => TriggerPayload;
/**
* Invokes specified TriggerDefinition perform function using supplied params
* and optional context. Accepts a generic type matching TriggerResult as a convenience
* to avoid extra casting within test methods. Returns an InvokeResult containing both the
* trigger result and a mock logger for asserting logging.
*/
export declare const invokeTrigger: <T extends Inputs, AllowsBranching extends boolean, Result extends TriggerResult<AllowsBranching>>(triggerBase: TriggerDefinition<T, AllowsBranching, Result> | Record<string, TriggerDefinition<T, AllowsBranching, Result>>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<T> | undefined) => Promise<InvokeReturn<Result>>;
declare const _default: {
invoke: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends PerformReturn<AllowsBranching, unknown>>(actionBase: ActionDefinition<T, AllowsBranching, ReturnData> | Record<string, ActionDefinition<T, AllowsBranching, ReturnData>>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<ReturnData>>;
invoke: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>>(actionBase: ActionDefinition<T, AllowsBranching, ReturnData> | Record<string, ActionDefinition<T, AllowsBranching, ReturnData>>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<ReturnData>>;
invokeTrigger: <T_1 extends Inputs, AllowsBranching_1 extends boolean, Result extends TriggerResult<AllowsBranching_1>>(triggerBase: TriggerDefinition<T_1, AllowsBranching_1, Result> | Record<string, TriggerDefinition<T_1, AllowsBranching_1, Result>>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<T_1> | undefined) => Promise<InvokeReturn<Result>>;
loggerMock: () => ActionLogger;

@@ -56,0 +65,0 @@ getAuthorizationMethods: (except?: ("basic" | "api_key" | "api_key_secret" | "private_key" | "oauth2" | "oauth2_client_credentials")[] | undefined) => ("basic" | "api_key" | "api_key_secret" | "private_key" | "oauth2" | "oauth2_client_credentials")[];

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.invoke = exports.loggerMock = exports.credentials = exports.getAuthorizationMethods = void 0;
exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.loggerMock = exports.credentials = exports.getAuthorizationMethods = void 0;
/** */

@@ -110,3 +110,3 @@ const types_1 = require("./types");

* Invokes specified ActionDefinition perform function using supplied params
* and optional context. Accepts a generic type matching PerformReturn as a convenience
* and optional context. Accepts a generic type matching ActionPerformReturn as a convenience
* to avoid extra casting within test methods. Returns an InvokeResult containing both the

@@ -117,3 +117,3 @@ * action result and a mock logger for asserting logging.

const action = (actionBase.perform ? actionBase : Object.values(actionBase)[0]);
const realizedContext = Object.assign({ credential: undefined, logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId" }, context);
const realizedContext = Object.assign({ credential: undefined, logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
const result = yield action.perform(realizedContext, params);

@@ -126,4 +126,45 @@ return {

exports.invoke = invoke;
const defaultTriggerPayload = () => {
const payloadData = { foo: "bar" };
const contentType = "application/json";
return {
headers: {
"content-type": contentType,
},
queryParameters: {},
rawBody: {
data: payloadData,
contentType,
},
body: {
data: JSON.stringify(payloadData),
contentType,
},
webhookUrls: {
"Flow 1": "https://example.com",
},
};
};
exports.defaultTriggerPayload = defaultTriggerPayload;
/**
* Invokes specified TriggerDefinition perform function using supplied params
* and optional context. Accepts a generic type matching TriggerResult as a convenience
* to avoid extra casting within test methods. Returns an InvokeResult containing both the
* trigger result and a mock logger for asserting logging.
*/
const invokeTrigger = (triggerBase, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
const trigger = (triggerBase.perform ? triggerBase : Object.values(triggerBase)[0]);
const realizedContext = Object.assign({ credential: undefined, logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
const realizedPayload = Object.assign(Object.assign({}, exports.defaultTriggerPayload()), payload);
const realizedParams = params || {};
const result = yield trigger.perform(realizedContext, realizedPayload, realizedParams);
return {
result,
loggerMock: realizedContext.logger,
};
});
exports.invokeTrigger = invokeTrigger;
exports.default = {
invoke: exports.invoke,
invokeTrigger: exports.invokeTrigger,
loggerMock: exports.loggerMock,

@@ -130,0 +171,0 @@ getAuthorizationMethods: exports.getAuthorizationMethods,

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

import { PerformReturn, ActionDisplayDefinition, ActionPerformFunction, AuthorizationDefinition, Inputs } from ".";
import { ActionPerformReturn, ActionDisplayDefinition, ActionPerformFunction, AuthorizationDefinition, Inputs } from ".";
/**

@@ -6,3 +6,3 @@ * ActionDefinition is the type of the object that is passed in to `action` function to

*/
export interface ActionDefinition<T extends Inputs, AllowsBranching extends boolean, ReturnData extends PerformReturn<AllowsBranching, unknown>> {
export interface ActionDefinition<T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>> {
/** Defines how the Action is displayed in the Prismatic interface. */

@@ -9,0 +9,0 @@ display: ActionDisplayDefinition;

@@ -1,4 +0,4 @@

import { Credential, Inputs, PerformReturn, ActionInputParameters, ActionLogger } from ".";
import { Credential, Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger } from ".";
/** Definition of the function to perform when an Action is invoked. */
export declare type ActionPerformFunction<T extends Inputs, AllowsBranching extends boolean, ReturnData extends PerformReturn<AllowsBranching, unknown>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<ReturnData>;
export declare type ActionPerformFunction<T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<ReturnData>;
/** Context provided to perform method containing helpers and contextual data */

@@ -14,2 +14,4 @@ export interface ActionContext {

stepId: string;
/** A unique id that corresponds to the specific execution of the Integration */
executionId: string;
}

@@ -6,6 +6,58 @@ /**

/** @ignore */
declare enum BooleanOperator {
export declare enum BooleanOperator {
and = "and",
or = "or"
}
export declare const BooleanOperatorPhrase: string[];
export declare enum UnaryOperator {
isTrue = "isTrue",
isFalse = "isFalse",
doesNotExist = "doesNotExist",
exists = "exists"
}
export declare const UnaryOperatorPhrase: {
isTrue: string;
isFalse: string;
doesNotExist: string;
exists: string;
};
export declare enum BinaryOperator {
equal = "equal",
notEqual = "notEqual",
greaterThan = "greaterThan",
greaterThanOrEqual = "greaterThanOrEqual",
lessThan = "lessThan",
lessThanOrEqual = "lessThanOrEqual",
in = "in",
notIn = "notIn",
exactlyMatches = "exactlyMatches",
doesNotExactlyMatch = "doesNotExactlyMatch",
startsWith = "startsWith",
doesNotStartWith = "doesNotStartWith",
endsWith = "endsWith",
doesNotEndWith = "doesNotEndWith",
dateTimeAfter = "dateTimeAfter",
dateTimeBefore = "dateTimeBefore",
dateTimeSame = "dateTimeSame"
}
export declare const BinaryOperatorPhrase: {
equal: string;
notEqual: string;
greaterThan: string;
greaterThanOrEqual: string;
lessThan: string;
lessThanOrEqual: string;
in: string;
notIn: string;
exactlyMatches: string;
doesNotExactlyMatch: string;
startsWith: string;
doesNotStartWith: string;
endsWith: string;
doesNotEndWith: string;
dateTimeAfter: string;
dateTimeBefore: string;
dateTimeSame: string;
};
export declare type TermOperator = UnaryOperator | BinaryOperator;
export declare const TermOperatorPhrase: {

@@ -20,11 +72,22 @@ equal: string;

notIn: string;
exactlyMatches: string;
doesNotExactlyMatch: string;
startsWith: string;
doesNotStartWith: string;
endsWith: string;
doesNotEndWith: string;
dateTimeAfter: string;
dateTimeBefore: string;
dateTimeSame: string;
isTrue: string;
isFalse: string;
doesNotExist: string;
exists: string;
};
declare type TermOperator = keyof typeof TermOperatorPhrase;
declare type Term<T> = T;
declare type TermExpression<T> = [TermOperator, Term<T>, Term<T>];
declare type BooleanExpression<T> = [
export declare type Term = unknown;
export declare type TermExpression = [TermOperator, Term, Term?];
export declare type BooleanExpression = [
BooleanOperator.and | BooleanOperator.or,
...ConditionalExpression<T>[]
...ConditionalExpression[]
];
export declare type ConditionalExpression<T = unknown> = TermExpression<T> | BooleanExpression<T>;
export {};
export declare type ConditionalExpression = TermExpression | BooleanExpression;

@@ -7,3 +7,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TermOperatorPhrase = void 0;
exports.TermOperatorPhrase = exports.BinaryOperatorPhrase = exports.BinaryOperator = exports.UnaryOperatorPhrase = exports.UnaryOperator = exports.BooleanOperatorPhrase = exports.BooleanOperator = void 0;
/** @ignore */

@@ -14,12 +14,56 @@ var BooleanOperator;

BooleanOperator["or"] = "or";
})(BooleanOperator || (BooleanOperator = {}));
exports.TermOperatorPhrase = {
equal: "equals",
notEqual: "does not equal",
greaterThan: "is greater than",
greaterThanOrEqual: "is greater than or equal to",
lessThan: "is less than",
lessThanOrEqual: "is less than or equal to",
in: "contained in",
notIn: "not contained in",
})(BooleanOperator = exports.BooleanOperator || (exports.BooleanOperator = {}));
exports.BooleanOperatorPhrase = Object.keys(BooleanOperator);
var UnaryOperator;
(function (UnaryOperator) {
UnaryOperator["isTrue"] = "isTrue";
UnaryOperator["isFalse"] = "isFalse";
UnaryOperator["doesNotExist"] = "doesNotExist";
UnaryOperator["exists"] = "exists";
})(UnaryOperator = exports.UnaryOperator || (exports.UnaryOperator = {}));
exports.UnaryOperatorPhrase = {
[UnaryOperator.isTrue]: "is true",
[UnaryOperator.isFalse]: "is false",
[UnaryOperator.doesNotExist]: "does not exist",
[UnaryOperator.exists]: "exists",
};
var BinaryOperator;
(function (BinaryOperator) {
BinaryOperator["equal"] = "equal";
BinaryOperator["notEqual"] = "notEqual";
BinaryOperator["greaterThan"] = "greaterThan";
BinaryOperator["greaterThanOrEqual"] = "greaterThanOrEqual";
BinaryOperator["lessThan"] = "lessThan";
BinaryOperator["lessThanOrEqual"] = "lessThanOrEqual";
BinaryOperator["in"] = "in";
BinaryOperator["notIn"] = "notIn";
BinaryOperator["exactlyMatches"] = "exactlyMatches";
BinaryOperator["doesNotExactlyMatch"] = "doesNotExactlyMatch";
BinaryOperator["startsWith"] = "startsWith";
BinaryOperator["doesNotStartWith"] = "doesNotStartWith";
BinaryOperator["endsWith"] = "endsWith";
BinaryOperator["doesNotEndWith"] = "doesNotEndWith";
BinaryOperator["dateTimeAfter"] = "dateTimeAfter";
BinaryOperator["dateTimeBefore"] = "dateTimeBefore";
BinaryOperator["dateTimeSame"] = "dateTimeSame";
})(BinaryOperator = exports.BinaryOperator || (exports.BinaryOperator = {}));
exports.BinaryOperatorPhrase = {
[BinaryOperator.equal]: "equal",
[BinaryOperator.notEqual]: "does not equal",
[BinaryOperator.greaterThan]: "is greater than",
[BinaryOperator.greaterThanOrEqual]: "is greater than or equal to",
[BinaryOperator.lessThan]: "is less than",
[BinaryOperator.lessThanOrEqual]: "is less than or equal to",
[BinaryOperator.in]: "contained in",
[BinaryOperator.notIn]: "not contained in",
[BinaryOperator.exactlyMatches]: "exactly matches",
[BinaryOperator.doesNotExactlyMatch]: "does not exactly match",
[BinaryOperator.startsWith]: "starts with",
[BinaryOperator.doesNotStartWith]: "does not start with",
[BinaryOperator.endsWith]: "ends with",
[BinaryOperator.doesNotEndWith]: "does not end with",
[BinaryOperator.dateTimeAfter]: "is after (date/time)",
[BinaryOperator.dateTimeBefore]: "is before (date/time)",
[BinaryOperator.dateTimeSame]: "is the same (date/time)",
};
exports.TermOperatorPhrase = Object.assign(Object.assign({}, exports.UnaryOperatorPhrase), exports.BinaryOperatorPhrase);

@@ -9,3 +9,3 @@ /**

export * from "./Inputs";
export * from "./PerformReturn";
export * from "./ActionPerformReturn";
export * from "./DisplayDefinition";

@@ -17,1 +17,6 @@ export * from "./ActionInputParameters";

export * from "./conditional-logic";
export * from "./TriggerResult";
export * from "./TriggerPerformFunction";
export * from "./TriggerDefinition";
export * from "./HttpResponse";
export * from "./TriggerPayload";

@@ -21,3 +21,3 @@ "use strict";

__exportStar(require("./Inputs"), exports);
__exportStar(require("./PerformReturn"), exports);
__exportStar(require("./ActionPerformReturn"), exports);
__exportStar(require("./DisplayDefinition"), exports);

@@ -29,1 +29,6 @@ __exportStar(require("./ActionInputParameters"), exports);

__exportStar(require("./conditional-logic"), exports);
__exportStar(require("./TriggerResult"), exports);
__exportStar(require("./TriggerPerformFunction"), exports);
__exportStar(require("./TriggerDefinition"), exports);
__exportStar(require("./HttpResponse"), exports);
__exportStar(require("./TriggerPayload"), exports);

@@ -22,4 +22,4 @@ import { InputFieldType } from ".";

required?: boolean;
/** Dictates possible choices or a function to generate choices for the InputField. */
model?: InputFieldChoice[] | InputFieldModelFunction;
/** Dictates possible choices for the input. */
model?: InputFieldChoice[];
}

@@ -30,4 +30,2 @@ export interface CodeInputFieldDefinition extends DefaultInputFieldDefinition {

}
/** Definition of the function that returns an array of choices. */
export declare type InputFieldModelFunction = () => Promise<InputFieldChoice[]>;
/** Defines a single Choice option for a InputField. */

@@ -34,0 +32,0 @@ export interface InputFieldChoice {

@@ -12,3 +12,6 @@ /**

import { ActionDisplayDefinition, ComponentDisplayDefinition } from "./DisplayDefinition";
import { InputFieldChoice, InputFieldCollection, InputFieldModelFunction } from "./Inputs";
import { InputFieldChoice, InputFieldCollection } from "./Inputs";
import { TriggerOptionChoice } from "./TriggerDefinition";
import { TriggerPayload } from "./TriggerPayload";
import { TriggerBaseResult, TriggerBranchingResult } from "./TriggerResult";
/** Defines attributes of a Component. */

@@ -25,3 +28,5 @@ interface ComponentBase<T extends boolean> {

/** Specifies the supported Actions of this Component. */
actions: Record<string, Action>;
actions?: Record<string, Action>;
/** Specifies the supported Triggers of this Component. */
triggers?: Record<string, Trigger>;
}

@@ -35,4 +40,4 @@ export declare type Component<T extends boolean> = ComponentBase<T> & (T extends true ? {

});
/** Configuration of an Action. */
export interface Action {
/** Base properties of Actions and Triggers. */
interface BaseAction {
/** Key used for the Actions map and to uniquely identify this Component in your tenant. */

@@ -42,4 +47,2 @@ key: string;

display: ActionDisplayDefinition;
/** Function to perform when this Action is used and invoked. */
perform: ActionPerformFunction;
/** InputFields to present in the Prismatic interface for configuration of this Action. */

@@ -49,13 +52,31 @@ inputs: InputField[];

authorization?: AuthorizationDefinition;
/** Optional attribute that specifies whether an Action will terminate execution.*/
/** Optional attribute that specifies whether an Action will terminate execution. */
terminateExecution?: boolean;
/** Determines whether an Action will allow Conditional Branching.*/
/** Determines whether an Action will allow Conditional Branching. */
allowsBranching?: boolean;
/**Static Branch names associated with an Action. */
/** Static Branch names associated with an Action. */
staticBranchNames?: string[];
/**The Input associated with Dynamic Branching.*/
/** The Input associated with Dynamic Branching. */
dynamicBranchInput?: string;
/**An example of the payload outputted by an Action*/
}
/** Configuration of an Action. */
export interface Action extends BaseAction {
/** Function to perform when this Action is used and invoked. */
perform: ActionPerformFunction;
/** An example of the payload outputted by an Action. */
examplePayload?: ServerPerformDataStructureReturn | ServerPerformBranchingDataStructureReturn;
}
/** Configuration of a Trigger. */
export interface Trigger extends BaseAction {
/** Function to perform when this Trigger is used and invoked. */
perform: TriggerPerformFunction;
/** Specifies whether this Trigger supports executing the Integration on a recurring schedule. */
scheduleSupport: TriggerOptionChoice;
/** Specifies whether this Trigger supports synchronous responses to an Integration webhook request. */
synchronousResponseSupport: TriggerOptionChoice;
/** An example of the payload outputted by this Trigger. */
examplePayload?: TriggerBaseResult | TriggerBranchingResult;
/** Specifies if this Trigger appears in the list of 'common' Triggers. Only configurable by Prismatic. @default false */
isCommonTrigger?: boolean;
}
/** Collection of input parameters provided by the user or previous steps' outputs */

@@ -98,5 +119,8 @@ interface ActionInputParameters {

/** Required return type of all action perform functions */
declare type PerformReturn = ServerPerformDataStructureReturn | ServerPerformBranchingDataStructureReturn | ServerPerformDataReturn | ServerPerformBranchingDataReturn | void;
declare type ActionPerformReturn = ServerPerformDataStructureReturn | ServerPerformBranchingDataStructureReturn | ServerPerformDataReturn | ServerPerformBranchingDataReturn | void;
/** Definition of the function to perform when an Action is invoked. */
declare type ActionPerformFunction = (context: ActionContext, params: ActionInputParameters) => Promise<PerformReturn>;
declare type ActionPerformFunction = (context: ActionContext, params: ActionInputParameters) => Promise<ActionPerformReturn>;
declare type TriggerResult = TriggerBranchingResult | TriggerBaseResult | void;
/** Definition of the function to perform when a Trigger is invoked. */
declare type TriggerPerformFunction = (context: ActionContext, payload: TriggerPayload, params: ActionInputParameters) => Promise<TriggerResult>;
declare type InputField = DefaultInputField | CodeInputField;

@@ -123,4 +147,4 @@ /** Defines attributes of a InputField. */

required?: boolean;
/** Dictates possible choices or a function to generate choices for the InputField. */
model?: InputFieldChoice[] | InputFieldModelFunction;
/** Dictates possible choices for the input. */
model?: InputFieldChoice[];
}

@@ -127,0 +151,0 @@ interface CodeInputField extends DefaultInputField {

{
"name": "@prismatic-io/spectral",
"version": "3.0.4",
"version": "4.0.0",
"description": "Utility library for building Prismatic components",

@@ -5,0 +5,0 @@ "keywords": [

@@ -27,3 +27,3 @@ # @prismatic-io/spectral

- Provide better support with built-in [logging](https://prismatic.io/docs/logging) and [alerting](https://prismatic.io/docs/monitoring-and-alerting)
- Embed a white-labeled customer integration portal with an integration app store and customer self-service tools
- Embed a white-labeled customer integration portal with an [integration marketplace](https://prismatic.io/docs/integration-marketplace/) and customer self-service tools
- Mold the platform to your product, industry, and the way you build software

@@ -30,0 +30,0 @@

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