Socket
Socket
Sign inDemoInstall

@prismatic-io/spectral

Package Overview
Dependencies
Maintainers
7
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 8.0.0 to 8.0.1

dist/serverTypes/convertIntegration.d.ts

24

dist/index.d.ts

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

*/
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVar, ConfigVarResultCollection, ConfigVarCollection, TriggerPayload } from "./types";
import { convertComponent, convertIntegration } from "./serverTypes/convert";
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, ConfigPages } from "./types";
import { convertComponent } from "./serverTypes/convert";
import { convertIntegration } from "./serverTypes/convertIntegration";
/**

@@ -17,3 +18,3 @@ * This function creates a Integration object that can be

*/
export declare const integration: <TConfigVar extends Record<string, ConfigVar> = Record<string, ConfigVar>>(definition: IntegrationDefinition<TConfigVar>) => ReturnType<typeof convertIntegration>;
export declare const integration: <TConfigPages extends ConfigPages = ConfigPages>(definition: IntegrationDefinition<TConfigPages>) => ReturnType<typeof convertIntegration>;
/**

@@ -25,3 +26,3 @@ * For information on writing Code Native Integrations, see

*/
export declare const flow: <TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload, T extends Flow<TConfigVars, TTriggerPayload> = Flow<TConfigVars, TTriggerPayload>>(definition: T) => T;
export declare const flow: <TConfigPages extends ConfigPages = ConfigPages, TTriggerPayload extends TriggerPayload = TriggerPayload, T extends Flow<TConfigPages, TTriggerPayload> = Flow<TConfigPages, TTriggerPayload>>(definition: T) => T;
/**

@@ -33,3 +34,3 @@ * For information on writing Code Native Integrations, see

*/
export declare const configPage: <T extends ConfigPage<ConfigVarCollection>>(definition: T) => T;
export declare const configPage: <T extends ConfigPage>(definition: T) => T;
/**

@@ -45,2 +46,9 @@ * For information on writing Code Native Integrations, see

* https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
* @param definition A Data Source Config Var type object.
* @returns This function returns a data source config var object that has the shape the Prismatic API expects.
*/
export declare const dataSourceConfigVar: <T extends DataSourceConfigVar>(definition: T) => T;
/**
* For information on writing Code Native Integrations, see
* https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
* @param definition A Connection Config Var type object.

@@ -88,3 +96,3 @@ * @returns This function returns a connection config var object that has the shape the Prismatic API expects.

*/
export declare const dataSource: <TInputs extends Inputs, TDataSourceType extends keyof {
export declare const dataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends keyof {
string: string;

@@ -98,10 +106,8 @@ date: string;

code: string;
credential: unknown;
boolean: boolean;
number: number;
connection: import("./types").Connection;
objectSelection: import("./types").ObjectSelection;
objectFieldMap: import("./types").ObjectFieldMap;
jsonForm: import("./types").JSONForm;
}>(definition: DataSourceDefinition<TInputs, TDataSourceType>) => DataSourceDefinition<TInputs, TDataSourceType>;
}>(definition: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>) => DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>;
/**

@@ -108,0 +114,0 @@ * For information and examples on how to write inputs

@@ -25,4 +25,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.configVar = exports.configPage = exports.flow = exports.integration = void 0;
exports.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.dataSourceConfigVar = exports.configVar = exports.configPage = exports.flow = exports.integration = void 0;
const convert_1 = require("./serverTypes/convert");
const convertIntegration_1 = require("./serverTypes/convertIntegration");
/**

@@ -36,3 +37,3 @@ * This function creates a Integration object that can be

*/
const integration = (definition) => (0, convert_1.convertIntegration)(definition);
const integration = (definition) => (0, convertIntegration_1.convertIntegration)(definition);
exports.integration = integration;

@@ -66,2 +67,10 @@ /**

* https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
* @param definition A Data Source Config Var type object.
* @returns This function returns a data source config var object that has the shape the Prismatic API expects.
*/
const dataSourceConfigVar = (definition) => definition;
exports.dataSourceConfigVar = dataSourceConfigVar;
/**
* For information on writing Code Native Integrations, see
* https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
* @param definition A Connection Config Var type object.

@@ -68,0 +77,0 @@ * @returns This function returns a connection config var object that has the shape the Prismatic API expects.

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

import { ComponentDefinition, IntegrationDefinition } from "../types";
import { Component as ServerComponent } from ".";
import { InputFieldDefinition, ComponentDefinition } from "../types";
import { Component as ServerComponent, Input as ServerInput } from ".";
export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition) => ServerInput;
export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
export declare const convertIntegration: (definition: IntegrationDefinition) => ServerComponent;

@@ -13,9 +13,4 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertIntegration = exports.convertComponent = void 0;
const yaml_1 = __importDefault(require("yaml"));
const uuid_1 = require("uuid");
exports.convertComponent = exports.convertInput = void 0;
const types_1 = require("../types");

@@ -31,5 +26,6 @@ const perform_1 = require("./perform");

};
exports.convertInput = convertInput;
const convertAction = (actionKey, _a, hooks) => {
var { inputs = {}, perform } = _a, action = __rest(_a, ["inputs", "perform"]);
const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});

@@ -43,3 +39,3 @@ return Object.assign(Object.assign({}, action), { key: actionKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {

var { inputs = {}, perform, onInstanceDeploy, onInstanceDelete } = _a, trigger = __rest(_a, ["inputs", "perform", "onInstanceDeploy", "onInstanceDelete"]);
const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});

@@ -68,3 +64,3 @@ const result = Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {

var { inputs = {}, perform } = _a, dataSource = __rest(_a, ["inputs", "perform"]);
const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});

@@ -78,3 +74,3 @@ return Object.assign(Object.assign({}, dataSource), { key: dataSourceKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {

var { inputs = {} } = _a, connection = __rest(_a, ["inputs"]);
const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
return Object.assign(Object.assign({}, connection), { inputs: convertedInputs });

@@ -90,245 +86,1 @@ };

exports.convertComponent = convertComponent;
const convertIntegration = (definition) => {
// Generate a unique reference key that will be used to reference the
// actions, triggers, data sources, and connections that are created
// inline as part of the integration definition.
const referenceKey = (0, uuid_1.v4)();
return Object.assign(Object.assign({}, codeNativeIntegrationComponent(definition, referenceKey)), { codeNativeIntegrationYAML: codeNativeIntegrationYaml(definition, referenceKey) });
};
exports.convertIntegration = convertIntegration;
const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, configVars, endpointType, triggerPreprocessFlowConfig, flows, configPages, }, referenceKey) => {
const DEFINITION_VERSION = 7;
// Find the preprocess flow config on the flow, if one exists.
const preprocessFlows = flows.filter((flow) => flow.preprocessFlowConfig);
// Do some validation of preprocess flow configs.
if (preprocessFlows.length > 1) {
throw new Error("Only one flow may define a Preprocess Flow Config.");
}
if (preprocessFlows.length && triggerPreprocessFlowConfig) {
throw new Error("Integration must not define both a Trigger Preprocess Flow Config and a Preprocess Flow.");
}
const hasPreprocessFlow = preprocessFlows.length > 0;
const preprocessFlowConfig = hasPreprocessFlow
? preprocessFlows[0].preprocessFlowConfig
: triggerPreprocessFlowConfig;
if ([types_1.EndpointType.InstanceSpecific, types_1.EndpointType.SharedInstance].includes(endpointType || types_1.EndpointType.FlowSpecific) &&
!preprocessFlowConfig) {
throw new Error("Integration with specified EndpointType must define either a Trigger Preprocess Flow Config or a Preprocess Flow.");
}
// Transform the IntegrationDefinition into the structure that is appropriate
// for generating YAML, which will then be used by the Prismatic API to import
// the integration as a Code Native Integration.
const result = {
definitionVersion: DEFINITION_VERSION,
isCodeNative: true,
name,
description,
category,
documentation,
version,
labels,
requiredConfigVars: Object.entries(configVars || {}).map(([key, configVar]) => convertConfigVar(Object.assign(Object.assign({}, configVar), { key }), referenceKey)),
endpointType,
preprocessFlowName: hasPreprocessFlow ? preprocessFlows[0].name : undefined,
externalCustomerIdField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.externalCustomerIdField),
externalCustomerUserIdField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.externalCustomerUserIdField),
flowNameField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.flowNameField),
flows: flows.map((flow) => convertFlow(flow, referenceKey)),
configPages,
};
return yaml_1.default.stringify(result);
};
/** Converts a Flow into the structure necessary for YAML generation. */
const convertFlow = (flow, referenceKey) => {
const result = Object.assign({}, flow);
delete result.onTrigger;
delete result.trigger;
delete result.onInstanceDeploy;
delete result.onInstanceDelete;
delete result.onExecution;
delete result.preprocessFlowConfig;
delete result.errorConfig;
const triggerStep = {
name: "On Trigger",
stableKey: `${flow.stableKey}-onTrigger`,
description: "The function that will be executed by the flow to return an HTTP response.",
isTrigger: true,
errorConfig: "errorConfig" in flow ? Object.assign({}, flow.errorConfig) : undefined,
action: {
key: flowFunctionKey(flow.name, "onTrigger"),
component: { key: referenceKey, version: "LATEST", isPublic: false },
},
};
if ("schedule" in flow && typeof flow.schedule === "object") {
triggerStep.schedule = {
type: "cronExpression" in flow.schedule
? types_1.SimpleInputValueType.Value
: types_1.SimpleInputValueType.ConfigVar,
value: "cronExpression" in flow.schedule
? flow.schedule.cronExpression
: flow.schedule.configVarKey,
meta: {
scheduleType: types_1.ScheduleType.Custom,
timeZone: flow.schedule.timeZone,
},
};
delete result.schedule;
}
const actionStep = {
action: {
key: flowFunctionKey(flow.name, "onExecution"),
component: { key: referenceKey, version: "LATEST", isPublic: false },
},
name: "On Execution",
stableKey: `${flow.stableKey}-onExecution`,
description: "The function that will be executed by the flow.",
errorConfig: "errorConfig" in flow ? Object.assign({}, flow.errorConfig) : undefined,
};
result.steps = [triggerStep, actionStep];
return result;
};
/** Converts a Config Var into the structure necessary for YAML generation. */
const convertConfigVar = (configVar, referenceKey) => {
// This is unfortunate but we need to strip out some fields that are not
// relevant to config vars.
const fields = [
"key",
"stableKey",
"description",
"orgOnly",
"inputs",
"defaultValue",
"dataType",
"pickList",
"scheduleType",
"timeZone",
"codeLanguage",
"collectionType",
"dataSource",
];
const result = Object.entries(configVar).reduce((result, [key, value]) => {
if (!fields.includes(key)) {
return result;
}
return Object.assign(Object.assign({}, result), { [key]: value });
}, { meta: {} });
// Handle some non-standard fields.
if ("visibleToOrgDeployer" in configVar) {
result.meta.visibleToOrgDeployer = configVar.visibleToOrgDeployer;
}
if ("visibleToCustomerDeployer" in configVar) {
result.meta.visibleToCustomerDeployer = configVar.visibleToCustomerDeployer;
}
// Handle connections.
if ("label" in configVar) {
result.dataType = "connection";
// This refers to a connection we are creating.
result.connection = {
key: configVar.key,
component: { key: referenceKey, version: "LATEST", isPublic: false },
};
result.description = configVar.label;
// Convert connection inputs to the inputs expected in the YAML.
// FIXME: This is just a placeholder for now.
// TODO: It seems like using the default value as the value is probably correct?
result.inputs = Object.entries(configVar.inputs).reduce((result, [key, input]) => {
var _a;
return Object.assign(Object.assign({}, result), { [key]: {
type: types_1.SimpleInputValueType.Value,
value: (_a = input.default) !== null && _a !== void 0 ? _a : "",
} });
}, {});
}
// Handle data source references.
if ("dataSource" in result) {
// This is a reference to a data source we are creating.
result.dataSource = {
key: result.dataSource,
component: { key: referenceKey, version: "LATEST", isPublic: false },
};
}
return result;
};
/** Maps the step name field to a fully qualified input. */
const fieldNameToReferenceInput = (stepName, fieldName) => {
if (!fieldName) {
return undefined;
}
return {
type: types_1.SimpleInputValueType.Reference,
value: `${stepName}.results.${fieldName}`,
};
};
/** Actions and Triggers will be scoped to their flow by combining the flow
* name and the function name. This is to ensure that the keys are unique
* on the resulting object, which will be turned into a Component. */
const flowFunctionKey = (flowName, functionName) => {
const flowKey = flowName
.replace(/[^0-9a-zA-Z]+/g, " ")
.trim()
.split(" ")
.map((w, i) => i === 0
? w.toLowerCase()
: w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
.join("");
return `${flowKey}_${functionName}`;
};
/** Creates the structure necessary to import a Component as part of a
* Code Native integration. */
const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [], dataSources = {}, configVars = {}, }, referenceKey) => {
const convertedActions = flows.reduce((result, { name, onExecution }) => {
const actionKey = flowFunctionKey(name, "onExecution");
return Object.assign(Object.assign({}, result), { [actionKey]: convertAction(actionKey, {
display: {
label: `${name} - onExecution`,
description: "The function that will be executed by the flow.",
},
perform: onExecution,
inputs: {},
}) });
}, {});
const convertedTriggers = flows.reduce((result, flow) => {
// Filter out TriggerReferences.
if ("trigger" in flow)
return result;
const { name, onTrigger, onInstanceDeploy, onInstanceDelete } = flow;
const triggerKey = flowFunctionKey(name, "onTrigger");
return Object.assign(Object.assign({}, result), { [triggerKey]: convertTrigger(triggerKey, {
display: {
label: `${name} - onTrigger`,
description: "The function that will be executed by the flow to return an HTTP response.",
},
perform: onTrigger,
onInstanceDeploy: onInstanceDeploy,
onInstanceDelete: onInstanceDelete,
inputs: {},
scheduleSupport: "valid",
synchronousResponseSupport: "valid",
}) });
}, {});
const convertedDataSources = Object.entries(dataSources).reduce((result, [dataSourceKey, dataSource]) => (Object.assign(Object.assign({}, result), { [dataSourceKey]: convertDataSource(dataSourceKey, Object.assign(Object.assign({}, dataSource), { inputs: {} })) })), {});
const convertedConnections = Object.entries(configVars).reduce((result, [key, configVar]) => {
if (!("label" in configVar)) {
return result;
}
// Remove a few fields that are not relevant to connections.
const {
/* eslint-disable @typescript-eslint/no-unused-vars */
orgOnly, visibleToOrgDeployer, visibleToCustomerDeployer, stableKey } = configVar,
/* eslint-enable @typescript-eslint/no-unused-vars */
connection = __rest(configVar, ["orgOnly", "visibleToOrgDeployer", "visibleToCustomerDeployer", "stableKey"]);
return [...result, convertConnection(Object.assign(Object.assign({}, connection), { key }))];
}, []);
return {
key: referenceKey,
display: {
label: referenceKey,
iconPath,
description: description || name,
},
connections: convertedConnections,
actions: convertedActions,
triggers: convertedTriggers,
dataSources: convertedDataSources,
};
};

@@ -51,3 +51,3 @@ /// <reference types="node" />

}
export declare type ActionContext<TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean = false> = {
export declare type ActionContext<TConfigVars extends ConfigVarResultCollection> = {
logger: ActionLogger;

@@ -58,2 +58,3 @@ instanceState: Record<string, unknown>;

integrationState: Record<string, unknown>;
configVars: TConfigVars;
stepId: string;

@@ -70,5 +71,3 @@ executionId: string;

startedAt: string;
} & (THasConfigVars extends true ? {
configVars: TConfigVars;
} : Record<string, never>);
};
declare type TriggerOptionChoice = "invalid" | "valid" | "required";

@@ -143,4 +142,5 @@ export interface TriggerPayload {

}
export interface DataSourceContext {
export interface DataSourceContext<TConfigVars extends ConfigVarResultCollection> {
logger: ActionLogger;
configVars: TConfigVars;
customer: CustomerAttributes;

@@ -157,3 +157,3 @@ instance: InstanceAttributes;

};
export declare type DataSourcePerformFunction = (context: DataSourceContext, params: Record<string, unknown>) => Promise<DataSourceResult>;
export declare type DataSourcePerformFunction = (context: DataSourceContext<any>, params: Record<string, unknown>) => Promise<DataSourceResult>;
export interface DataSource {

@@ -160,0 +160,0 @@ key: string;

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

import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn, DataSourceResult, DataSourceContext } from "./serverTypes";
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection, ConfigVarCollection, ConfigVarDefinitionsToResults } from "./types";
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection, ConfigPages } from "./types";
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>, tokenValues?: Record<string, unknown> | undefined) => ConnectionValue;

@@ -29,3 +29,3 @@ /**

*/
export declare const invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform, }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars, false>> | undefined) => Promise<InvokeReturn<TReturn>>;
export declare const invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform, }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars>> | undefined) => Promise<InvokeReturn<TReturn>>;
export declare const defaultTriggerPayload: () => TriggerPayload;

@@ -38,3 +38,3 @@ /**

*/
export declare const invokeTrigger: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching, TriggerPayload>>({ perform, }: TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>, context?: Partial<ActionContext<TConfigVars, false>> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs> | undefined) => Promise<InvokeReturn<TResult>>;
export declare const invokeTrigger: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching, TriggerPayload>>({ perform, }: TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>, context?: Partial<ActionContext<TConfigVars>> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs> | undefined) => Promise<InvokeReturn<TResult>>;
/**

@@ -45,3 +45,3 @@ * Invokes specified DataSourceDefinition perform function using supplied params.

*/
export declare const invokeDataSource: <TInputs extends Inputs, TDataSourceType extends keyof {
export declare const invokeDataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends keyof {
string: string;

@@ -55,10 +55,13 @@ date: string;

code: string;
credential: unknown;
boolean: boolean;
number: number;
connection: import("./types").Connection;
objectSelection: import("./types").ObjectSelection;
objectFieldMap: import("./types").ObjectFieldMap;
jsonForm: import("./types").JSONForm;
}>({ perform }: DataSourceDefinition<TInputs, TDataSourceType>, params: ActionInputParameters<TInputs>, context?: Partial<DataSourceContext> | undefined) => Promise<InvokeDataSourceResult<TDataSourceType>>;
}>({ perform }: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>, params: ActionInputParameters<TInputs>, context?: Partial<DataSourceContext<TConfigVars>> | undefined) => Promise<InvokeDataSourceResult<TDataSourceType>>;
declare type TestConnectionValue = Pick<ConnectionValue, "fields" | "context" | "token">;
declare type TestConfigVarValues = Record<string, string | TestConnectionValue>;
declare type ToTestValues<TConfigVars extends ConfigVarResultCollection> = {
[K in keyof TConfigVars]: TConfigVars[K] extends ConnectionDefinition ? TestConnectionValue : string;
};
/**

@@ -68,7 +71,6 @@ * Invokes specified Flow of a Code Native Integration using supplied params.

*/
export declare const invokeFlow: <TConfigVars extends ConfigVarCollection>(flow: Flow<TConfigVars, import("./types").TriggerPayload>, context?: Partial<ActionContext<ConfigVarDefinitionsToResults<TConfigVars>, true>> | undefined, payload?: TriggerPayload | undefined) => Promise<InvokeReturn<InvokeActionPerformReturn<false, unknown>>>;
export declare const invokeFlow: <TConfigPages extends ConfigPages, TConfigVars extends ConfigVarResultCollection = import("./types/utils").Prettify<{ [Key in keyof (TConfigPages extends ConfigPages ? import("./types/utils").UnionToIntersection<import("./types/utils").ValueOf<TConfigPages>["elements"]> : never)]: import("./types").ElementToRuntimeType<(TConfigPages extends ConfigPages ? import("./types/utils").UnionToIntersection<import("./types/utils").ValueOf<TConfigPages>["elements"]> : never)[Key]>; }>, TConfigVarValues extends TestConfigVarValues = ToTestValues<TConfigVars>>(flow: Flow<TConfigPages, import("./types").TriggerPayload>, configVars: TConfigVarValues, context?: Partial<ActionContext<TConfigVars>> | undefined, payload?: TriggerPayload | undefined) => Promise<InvokeReturn<InvokeActionPerformReturn<false, unknown>>>;
export declare class ComponentTestHarness<TComponent extends Component> {
component: TComponent;
constructor(component: TComponent);
private buildContext;
private buildParams;

@@ -80,3 +82,3 @@ connectionValue({ key }: ConnectionDefinition): ConnectionValue;

action<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<ActionPerformReturn>;
dataSource(key: string, params?: Record<string, unknown>, context?: Partial<DataSourceContext>): Promise<DataSourceResult>;
dataSource<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<DataSourceContext<TConfigVars>>): Promise<DataSourceResult>;
}

@@ -86,6 +88,6 @@ export declare const createHarness: <TComponent extends Component>(component: TComponent) => ComponentTestHarness<TComponent>;

loggerMock: () => ActionLogger;
invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform, }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars, false>> | undefined) => Promise<InvokeReturn<TReturn>>;
invokeTrigger: <TInputs_1 extends Inputs, TConfigVars_1 extends ConfigVarResultCollection, TAllowsBranching_1 extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching_1, TriggerPayload>>({ perform, }: TriggerDefinition<TInputs_1, TConfigVars_1, TAllowsBranching_1, TResult>, context?: Partial<ActionContext<TConfigVars_1, false>> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs_1> | undefined) => Promise<InvokeReturn<TResult>>;
invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform, }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars>> | undefined) => Promise<InvokeReturn<TReturn>>;
invokeTrigger: <TInputs_1 extends Inputs, TConfigVars_1 extends ConfigVarResultCollection, TAllowsBranching_1 extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching_1, TriggerPayload>>({ perform, }: TriggerDefinition<TInputs_1, TConfigVars_1, TAllowsBranching_1, TResult>, context?: Partial<ActionContext<TConfigVars_1>> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs_1> | undefined) => Promise<InvokeReturn<TResult>>;
createHarness: <TComponent extends Component>(component: TComponent) => ComponentTestHarness<TComponent>;
invokeDataSource: <TInputs_2 extends Inputs, TDataSourceType extends keyof {
invokeDataSource: <TInputs_2 extends Inputs, TConfigVars_2 extends ConfigVarResultCollection, TDataSourceType extends keyof {
string: string;

@@ -99,11 +101,9 @@ date: string;

code: string;
credential: unknown;
boolean: boolean;
number: number;
connection: import("./types").Connection;
objectSelection: import("./types").ObjectSelection;
objectFieldMap: import("./types").ObjectFieldMap;
jsonForm: import("./types").JSONForm;
}>({ perform }: DataSourceDefinition<TInputs_2, TDataSourceType>, params: ActionInputParameters<TInputs_2>, context?: Partial<DataSourceContext> | undefined) => Promise<InvokeDataSourceResult<TDataSourceType>>;
}>({ perform }: DataSourceDefinition<TInputs_2, TConfigVars_2, TDataSourceType>, params: ActionInputParameters<TInputs_2>, context?: Partial<DataSourceContext<TConfigVars_2>> | undefined) => Promise<InvokeDataSourceResult<TDataSourceType>>;
};
export default _default;

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

const createActionContext = (context) => {
return Object.assign({ logger: (0, exports.loggerMock)(), instanceState: {}, crossFlowState: {}, executionState: {}, integrationState: {}, stepId: "mockStepId", executionId: "mockExecutionId", webhookUrls: {
return Object.assign({ logger: (0, exports.loggerMock)(), instanceState: {}, crossFlowState: {}, executionState: {}, integrationState: {}, configVars: {}, stepId: "mockStepId", executionId: "mockExecutionId", webhookUrls: {
"Flow 1": "https://example.com",

@@ -69,2 +69,17 @@ }, webhookApiKeys: {

};
const createDataSourceContext = (context) => {
return Object.assign({ logger: (0, exports.loggerMock)(), configVars: {}, customer: {
id: "customerId",
name: "Customer 1",
externalId: "1234",
}, instance: {
id: "instanceId",
name: "Instance 1",
}, user: {
id: "userId",
email: "example@email.com",
externalId: "1234",
name: "Example",
} }, context);
};
/**

@@ -156,20 +171,2 @@ * Invokes specified ActionDefinition perform function using supplied params

exports.invokeTrigger = invokeTrigger;
const baseDataSourceContext = {
logger: (0, exports.loggerMock)(),
customer: {
id: "customerId",
name: "Customer 1",
externalId: "1234",
},
instance: {
id: "instanceId",
name: "Instance 1",
},
user: {
id: "userId",
email: "example@email.com",
externalId: "1234",
name: "Example",
},
};
/**

@@ -181,3 +178,3 @@ * Invokes specified DataSourceDefinition perform function using supplied params.

const invokeDataSource = ({ perform }, params, context) => __awaiter(void 0, void 0, void 0, function* () {
const realizedContext = Object.assign(Object.assign({}, baseDataSourceContext), context);
const realizedContext = createDataSourceContext(context);
const result = yield perform(realizedContext, params);

@@ -187,2 +184,11 @@ return result;

exports.invokeDataSource = invokeDataSource;
const createConfigVars = (values) => {
return Object.entries(values).reduce((result, [key, value]) => {
// Connection
if (typeof value === "object" && "fields" in value) {
return Object.assign(Object.assign({}, result), { [key]: Object.assign(Object.assign({}, value), { key, configVarKey: "" }) });
}
return Object.assign(Object.assign({}, result), { [key]: value });
}, {});
};
/**

@@ -192,4 +198,5 @@ * Invokes specified Flow of a Code Native Integration using supplied params.

*/
const invokeFlow = (flow, context, payload) => __awaiter(void 0, void 0, void 0, function* () {
const realizedContext = createActionContext(context);
const invokeFlow = (flow, configVars, context, payload) => __awaiter(void 0, void 0, void 0, function* () {
const realizedConfigVars = createConfigVars(configVars);
const realizedContext = createActionContext(Object.assign(Object.assign({}, context), { configVars: realizedConfigVars }));
const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload);

@@ -214,5 +221,2 @@ const params = {

}
buildContext(baseContext, context) {
return Object.assign(Object.assign({}, baseContext), context);
}
buildParams(inputs, params) {

@@ -263,3 +267,3 @@ const defaults = inputs.reduce((result, { key, default: defaultValue }) => (Object.assign(Object.assign({}, result), { [key]: `${defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""}` })), {});

const dataSource = this.component.dataSources[key];
return dataSource.perform(this.buildContext(baseDataSourceContext, context), this.buildParams(dataSource.inputs, params));
return dataSource.perform(createDataSourceContext(context), this.buildParams(dataSource.inputs, params));
});

@@ -266,0 +270,0 @@ }

@@ -10,3 +10,3 @@ import { ActionDisplayDefinition, ActionPerformFunction, ActionPerformReturn, ConfigVarResultCollection, Inputs } from ".";

/** Function to perform when this Action is invoked. */
perform: ActionPerformFunction<TInputs, TConfigVars, false, TAllowsBranching, TReturn>;
perform: ActionPerformFunction<TInputs, TConfigVars, TAllowsBranching, TReturn>;
/** InputFields to present in the Prismatic interface for configuration of this Action. */

@@ -13,0 +13,0 @@ inputs: TInputs;

import { Inputs, ConfigVarResultCollection, ActionPerformReturn, ActionInputParameters, ActionLogger, InstanceAttributes, CustomerAttributes, UserAttributes, IntegrationAttributes, FlowAttributes } from ".";
/** Definition of the function to perform when an Action is invoked. */
export declare type ActionPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext<TConfigVars, THasConfigVars>, params: ActionInputParameters<TInputs>) => Promise<TReturn>;
export declare type ActionPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<TReturn>;
/** Context provided to perform method containing helpers and contextual data */
export declare type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, THasConfigVars extends boolean = false> = {
export declare type ActionContext<TConfigVars extends ConfigVarResultCollection> = {
/** Logger for permanent logging; console calls are also captured */

@@ -16,2 +16,4 @@ logger: ActionLogger;

integrationState: Record<string, unknown>;
/** Key/value collection of config variables of the integration. */
configVars: TConfigVars;
/** A unique id that corresponds to the step on the Integration */

@@ -39,5 +41,2 @@ stepId: string;

startedAt: string;
} & (THasConfigVars extends true ? {
/** Key/value collection of config variables of the integration. */
configVars: TConfigVars;
} : Record<string, never>);
};

@@ -20,3 +20,3 @@ import { ActionDefinition, ConnectionDefinition, ComponentDisplayDefinition, TriggerDefinition, DataSourceDefinition } from ".";

/** Specifies the supported Data Sources of this Component. */
dataSources?: Record<string, DataSourceDefinition<any, any>>;
dataSources?: Record<string, DataSourceDefinition<any, any, any>>;
/** Specifies the supported Connections of this Component. */

@@ -23,0 +23,0 @@ connections?: ConnectionDefinition[];

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

import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceType } from ".";
import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceType, ConfigVarResultCollection } from ".";
/**

@@ -6,7 +6,7 @@ * DataSourceDefinition is the type of the object that is passed in to `dataSource` function to

*/
export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceType extends DataSourceType> {
export interface DataSourceDefinition<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType> {
/** Defines how the Data Source is displayed in the Prismatic interface. */
display: ActionDisplayDefinition;
/** Function to perform when this Data Source is invoked; fetches data from the data source. */
perform: DataSourcePerformFunction<TInputs, TDataSourceType>;
perform: DataSourcePerformFunction<TInputs, TConfigVars, TDataSourceType>;
/** The type of data that this Data Source represents. */

@@ -13,0 +13,0 @@ dataSourceType: TDataSourceType;

@@ -1,10 +0,5 @@

import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ActionLogger, CustomerAttributes, InstanceAttributes, UserAttributes } from ".";
import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ConfigVarResultCollection, ActionContext } from ".";
/** Context provided to perform method containing helpers and contextual data */
export interface DataSourceContext {
logger: ActionLogger;
customer: CustomerAttributes;
instance: InstanceAttributes;
user: UserAttributes;
}
export declare type DataSourceContext<TConfigVars extends ConfigVarResultCollection> = Pick<ActionContext<TConfigVars>, "logger" | "customer" | "instance" | "user" | "configVars">;
/** Definition of the function to perform when a Data Source is invoked. */
export declare type DataSourcePerformFunction<TInputs extends Inputs, TDataSourceType extends DataSourceType> = (context: DataSourceContext, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>;
export declare type DataSourcePerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType> = (context: DataSourceContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>;

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

import { ObjectSelection, ObjectFieldMap, JSONForm, Element, Connection } from "./Inputs";
import { ObjectSelection, ObjectFieldMap, JSONForm, Element } from "./Inputs";
/** The type of field that is appropriate for rendering the data that is the result of the data source perform function. */

@@ -12,6 +12,4 @@ declare type DataSourceTypeMap = {

code: string;
credential: unknown;
boolean: boolean;
number: number;
connection: Connection;
objectSelection: ObjectSelection;

@@ -18,0 +16,0 @@ objectFieldMap: ObjectFieldMap;

@@ -251,3 +251,3 @@ import { ConditionalExpression } from "./conditional-logic";

/** Config variable result collection */
export declare type ConfigVarResultCollection = Record<string, string | Connection | JSONForm | ObjectSelection>;
export declare type ConfigVarResultCollection = Record<string, string | Connection | JSONForm | ObjectSelection | ObjectFieldMap>;
export {};

@@ -1,8 +0,11 @@

import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, Connection as ConnectionResult, TriggerPayload } from ".";
export declare type ConfigVarCollection = Record<string, ConfigVar>;
export declare type ConfigVarDefinitionsToResults<TConfigVars extends ConfigVarCollection> = {
[Key in keyof TConfigVars]: TConfigVars[Key]["inputs"] extends Record<string, any> ? ConnectionResult : string;
};
import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection } from ".";
import { Prettify, UnionToIntersection, ValueOf } from "./utils";
declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string;
export declare type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConnectionConfigVar ? Connection : TElement extends DataSourceConfigVar ? ToDataSourceRuntimeType<TElement["dataSourceType"]> : TElement extends StandardConfigVar ? string : never;
declare type GetElements<TConfigPages extends ConfigPages> = TConfigPages extends ConfigPages ? UnionToIntersection<ValueOf<TConfigPages>["elements"]> : never;
export declare type ExtractConfigVars<TConfigPages extends ConfigPages, TElements extends ConfigPage["elements"] = GetElements<TConfigPages>> = Prettify<{
[Key in keyof TElements]: ElementToRuntimeType<TElements[Key]>;
}>;
/** Defines attributes of a Code-Native Integration. */
export declare type IntegrationDefinition<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
export declare type IntegrationDefinition<TConfigPages extends ConfigPages> = {
/** The unique name for this Integration. */

@@ -30,12 +33,8 @@ name: string;

/** Flows for this Integration. */
flows: Flow<TConfigVars>[];
/** Config Vars used on this Integration. */
configVars?: TConfigVars;
flows: Flow<TConfigPages>[];
/** Config Wizard Pages for this Integration. */
configPages?: ConfigPage<TConfigVars>[];
/** Specifies any Data Sources that are defined as part of this Integration. */
dataSources?: Record<string, CodeNativeDataSource>;
configPages?: TConfigPages;
};
/** Defines attributes of a Flow of a Code-Native Integration. */
export interface Flow<TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload> {
export interface Flow<TConfigPages extends ConfigPages, TTriggerPayload extends TriggerPayload = TriggerPayload> {
/** The unique name for this Flow. */

@@ -62,7 +61,7 @@ name: string;

/** Specifies the trigger function for this Flow, which returns a payload and optional HTTP response. */
onTrigger: TriggerPerformFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true, false, TriggerResult<false, TTriggerPayload>>;
onTrigger: TriggerPerformFunction<Inputs, ExtractConfigVars<TConfigPages>, false, TriggerResult<false, TTriggerPayload>>;
/** Specifies the function to execute when an Instance of this Integration is deployed. */
onInstanceDeploy?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
onInstanceDeploy?: TriggerEventFunction<Inputs, ExtractConfigVars<TConfigPages>>;
/** Specifies the function to execute when an Instance of an Integration is deleted. */
onInstanceDelete?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
onInstanceDelete?: TriggerEventFunction<Inputs, ExtractConfigVars<TConfigPages>>;
/** Specifies the main function for this Flow */

@@ -77,10 +76,6 @@ onExecution: ActionPerformFunction<{

};
}, ConfigVarDefinitionsToResults<TConfigVars>, true, false, ActionPerformReturn<false, unknown>>;
}, ExtractConfigVars<TConfigPages>, false, ActionPerformReturn<false, unknown>>;
}
/** Defines attributes of a Data Source that is defined as part of a Code Native Integration. */
export declare type CodeNativeDataSource = Pick<DataSourceDefinition<Inputs, DataSourceType>, "display" | "perform" | "dataSourceType" | "detailDataSource">;
/** Common attribute shared by all types of Config Vars. */
declare type BaseConfigVar = {
/** The unique key for this Config Var. */
key: string;
/** A unique, unchanging value that is used to maintain identity for the Config Var even if the key changes. */

@@ -92,4 +87,2 @@ stableKey: string;

orgOnly?: boolean;
/** Optional input values for this Config Var. */
inputs?: InputValues;
/** Optional value that specifies whether this Config Var is visible to an Organization deployer. @default true */

@@ -102,6 +95,6 @@ visibleToOrgDeployer?: boolean;

export declare type StandardConfigVar = BaseConfigVar & {
/** The data type of the Config Var. */
dataType: ConfigVarDataType;
/** Optional default value for the Config Var. */
defaultValue?: string;
/** The data type of the Config Var. */
dataType: ConfigVarDataType;
/** Optional list of picklist values if the Config Var is a multi-choice selection value. */

@@ -117,52 +110,19 @@ pickList?: string[];

collectionType?: CollectionType;
/** Optional value to specify the key of a Data Source defined in this CNI
* where the Config Var sources its values. */
dataSource?: string;
};
/** Defines attributes of a data source Config Var. */
export declare type DataSourceConfigVar = BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, DataSourceType>, "display" | "inputs" | "examplePayload">;
/** Defines attributes of a Config Var that represents a Connection. */
export declare type ConnectionConfigVar = Omit<BaseConfigVar, "description" | "inputs"> & ConnectionDefinition;
export declare type ConfigVar = StandardConfigVar | ConnectionConfigVar;
export declare type ConnectionConfigVar = BaseConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">;
export declare type ConfigVar = StandardConfigVar | DataSourceConfigVar | ConnectionConfigVar;
export declare const isDataSourceConfigVar: (cv: ConfigVar) => cv is DataSourceConfigVar;
export declare const isConnectionConfigVar: (cv: ConfigVar) => cv is ConnectionConfigVar;
export declare type ConfigPageElement = string | ConfigVar;
export declare type ConfigPages = Record<string, ConfigPage>;
/** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */
export declare type ConfigPage<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
/** The unique name for this Config Page. */
name: string;
export declare type ConfigPage = {
/** Elements included on this Config Page. */
elements: Record<string, ConfigPageElement>;
/** Specifies an optional tagline for this Config Page. */
tagline?: string;
/** Optional value that specifies whether this Config Page is configured as
* part of User Level Configuration. @default false */
userLevelConfigured?: boolean;
/** Elements included on this Config Page. */
elements: ConfigPageElement<TConfigVars>[];
};
/** Defines attributes of Inputs for Connections, Actions, Triggers,
* Data Sources, and Config Vars. */
export declare type InputValues = Record<string, InputValue>;
export declare type InputValue = SimpleInputValue | ComplexInputValue;
export declare type SimpleInputValue = {
name?: string;
type: SimpleInputValueType;
value: string;
meta?: Record<string, unknown>;
};
export declare type ComplexInputValue = {
name?: string;
type: "complex";
value: ComplexInputValueType;
meta?: Record<string, unknown>;
};
export declare type ComplexInputValueType = (string | InputValue | ComplexInputValueType)[];
/** Defines attributes of an Element that appears on a Config Wizard Page. */
export declare type ConfigPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = HTMLConfigPageElement | JSONFormConfigPageElement | ConfigVarPageElement<TConfigVars>;
declare type HTMLConfigPageElement = {
type: ConfigPageElementType.HTML;
value: string;
};
declare type JSONFormConfigPageElement = {
type: ConfigPageElementType.JSONForm;
value: string;
};
declare type ConfigVarPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
type: ConfigPageElementType.ConfigVar;
value: keyof TConfigVars;
};
/** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */

@@ -213,9 +173,2 @@ export declare type PreprocessFlowConfig = {

};
/** Choices of Simple Input Value Types that may be used by Simple Input Values. */
export declare enum SimpleInputValueType {
Value = "value",
Reference = "reference",
ConfigVar = "configVar",
Template = "template"
}
/** Choices of Endpoint Types that may be used by Instances of an Integration. */

@@ -234,8 +187,2 @@ export declare enum EndpointType {

}
/** Choices of Config Page Element Types that may be used for Elements on a Config Wizard Page. */
export declare enum ConfigPageElementType {
ConfigVar = "configVar",
HTML = "htmlElement",
JSONForm = "jsonForm"
}
/** Choices of Step Error Handlers that define the behavior when a step error occurs. */

@@ -265,6 +212,3 @@ export declare enum StepErrorHandlerType {

Boolean = "boolean",
Number = "number",
ObjectSelection = "objectSelection",
ObjectFieldMap = "objectFieldMap",
JSONForm = "jsonForm"
Number = "number"
}

@@ -271,0 +215,0 @@ /** Choices of programming languages that may be used for Config Var code values. */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CollectionType = exports.CodeLanguageType = exports.ConfigVarDataType = exports.ScheduleType = exports.StepErrorHandlerType = exports.ConfigPageElementType = exports.EndpointSecurityType = exports.EndpointType = exports.SimpleInputValueType = void 0;
/** Choices of Simple Input Value Types that may be used by Simple Input Values. */
var SimpleInputValueType;
(function (SimpleInputValueType) {
SimpleInputValueType["Value"] = "value";
SimpleInputValueType["Reference"] = "reference";
SimpleInputValueType["ConfigVar"] = "configVar";
SimpleInputValueType["Template"] = "template";
})(SimpleInputValueType = exports.SimpleInputValueType || (exports.SimpleInputValueType = {}));
exports.CollectionType = exports.CodeLanguageType = exports.ConfigVarDataType = exports.ScheduleType = exports.StepErrorHandlerType = exports.EndpointSecurityType = exports.EndpointType = exports.isConnectionConfigVar = exports.isDataSourceConfigVar = void 0;
const isDataSourceConfigVar = (cv) => "dataSourceType" in cv;
exports.isDataSourceConfigVar = isDataSourceConfigVar;
const isConnectionConfigVar = (cv) => "inputs" in cv;
exports.isConnectionConfigVar = isConnectionConfigVar;
/** Choices of Endpoint Types that may be used by Instances of an Integration. */

@@ -27,9 +23,2 @@ var EndpointType;

})(EndpointSecurityType = exports.EndpointSecurityType || (exports.EndpointSecurityType = {}));
/** Choices of Config Page Element Types that may be used for Elements on a Config Wizard Page. */
var ConfigPageElementType;
(function (ConfigPageElementType) {
ConfigPageElementType["ConfigVar"] = "configVar";
ConfigPageElementType["HTML"] = "htmlElement";
ConfigPageElementType["JSONForm"] = "jsonForm";
})(ConfigPageElementType = exports.ConfigPageElementType || (exports.ConfigPageElementType = {}));
/** Choices of Step Error Handlers that define the behavior when a step error occurs. */

@@ -63,5 +52,2 @@ var StepErrorHandlerType;

ConfigVarDataType["Number"] = "number";
ConfigVarDataType["ObjectSelection"] = "objectSelection";
ConfigVarDataType["ObjectFieldMap"] = "objectFieldMap";
ConfigVarDataType["JSONForm"] = "jsonForm";
})(ConfigVarDataType = exports.ConfigVarDataType || (exports.ConfigVarDataType = {}));

@@ -68,0 +54,0 @@ /** Choices of programming languages that may be used for Config Var code values. */

@@ -13,7 +13,7 @@ import { ActionDisplayDefinition, TriggerPerformFunction, TriggerEventFunction, Inputs, TriggerResult, ConfigVarResultCollection, TriggerPayload } from ".";

/** Function to perform when this Trigger is invoked. */
perform: TriggerPerformFunction<TInputs, TConfigVars, false, TAllowsBranching, TResult>;
perform: TriggerPerformFunction<TInputs, TConfigVars, TAllowsBranching, TResult>;
/** Function to execute when an Instance of an Integration with a Flow that uses this Trigger is deployed. */
onInstanceDeploy?: TriggerEventFunction<TInputs, TConfigVars, false>;
onInstanceDeploy?: TriggerEventFunction<TInputs, TConfigVars>;
/** Function to execute when an Instance of an Integration with a Flow that uses this Trigger is deleted. */
onInstanceDelete?: TriggerEventFunction<TInputs, TConfigVars, false>;
onInstanceDelete?: TriggerEventFunction<TInputs, TConfigVars>;
/** InputFields to present in the Prismatic interface for configuration of this Trigger. */

@@ -20,0 +20,0 @@ inputs: TInputs;

@@ -13,2 +13,2 @@ import { Inputs, ActionContext, ActionInputParameters, ConfigVarResultCollection } from ".";

/** Definition of the function to execute when a Trigger Event occurs. */
export declare type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean> = (context: ActionContext<TConfigVars, THasConfigVars>, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>;
export declare type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>;
import { Inputs, TriggerResult, ActionInputParameters, ActionContext, TriggerPayload, ConfigVarResultCollection } from ".";
/** Definition of the function to perform when a Trigger is invoked. */
export declare type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars, THasConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>;
export declare type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>;
{
"name": "@prismatic-io/spectral",
"version": "8.0.0",
"version": "8.0.1",
"description": "Utility library for building Prismatic components",

@@ -46,2 +46,3 @@ "keywords": [

"jest-mock": "27.0.3",
"lodash": "4.17.21",
"safe-stable-stringify": "2.3.1",

@@ -56,2 +57,3 @@ "serialize-error": "8.1.0",

"@types/jest": "27.4.1",
"@types/lodash": "4.14.202",
"@types/node": "14.14.35",

@@ -58,0 +60,0 @@ "@types/sax": "1.2.4",

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