@prismatic-io/spectral 7.8.0-preview2 → 7.8.0-preview4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Instance, Customer, DataSourceType, DataSourceResultType, User } from "../types";
2
+ import { Instance, Customer, DataSourceType, DataSourceResultType, User, TriggerEventFunctionReturn } from "../types";
3
3
  interface DisplayDefinition {
4
4
  label: string;
5
5
  description: string;
@@ -102,13 +102,7 @@ interface TriggerBranchingResult extends TriggerBaseResult {
102
102
  }
103
103
  export declare type TriggerResult = TriggerBranchingResult | TriggerBaseResult | undefined;
104
104
  export declare type TriggerPerformFunction = (context: ActionContext, payload: TriggerPayload, params: Record<string, unknown>) => Promise<TriggerResult>;
105
- export interface TriggerEventFunctionContext {
106
- logger: ActionLogger;
107
- customer: Customer;
108
- instance: Instance;
109
- user: User;
110
- }
111
- export declare type TriggerEventFunction = (context: TriggerEventFunctionContext, params: Record<string, unknown>) => Promise<void>;
105
+ export declare type TriggerEventFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<void | TriggerEventFunctionReturn>;
112
106
  export interface Trigger {
113
107
  key: string;
114
108
  display: DisplayDefinition & {
@@ -1,10 +1,13 @@
1
- import { Inputs, ActionInputParameters, ActionLogger, Customer, Instance, User } from ".";
2
- /** Context provided to the event function containing helpers and contextual data */
3
- export interface TriggerEventFunctionContext {
4
- logger: ActionLogger;
5
- customer: Customer;
6
- instance: Instance;
7
- user: User;
8
- }
1
+ import { Inputs, ActionContext, ActionInputParameters } from ".";
2
+ export declare type TriggerEventFunctionReturn = {
3
+ /** An optional object, the keys and values of which will be persisted in the flow-specific instanceState and available for subsequent actions and executions */
4
+ instanceState?: Record<string, unknown>;
5
+ /** An optional object, the keys and values of which will be persisted in the crossFlowState and available in any flow for subsequent actions and executions */
6
+ crossFlowState?: Record<string, unknown>;
7
+ /** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
8
+ executionState?: Record<string, unknown>;
9
+ /** An optional object, the keys and values of which will be persisted in the integrationState and available in any flow of an Instance for any version of an Integration for subsequent actions and executions */
10
+ integrationState?: Record<string, unknown>;
11
+ };
9
12
  /** Definition of the function to execute when a Trigger Event occurs. */
10
- export declare type TriggerEventFunction<TInputs extends Inputs> = (context: TriggerEventFunctionContext, params: ActionInputParameters<TInputs>) => Promise<void>;
13
+ export declare type TriggerEventFunction<TInputs extends Inputs> = (context: ActionContext, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "7.8.0-preview2",
3
+ "version": "7.8.0-preview4",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"