@prismatic-io/spectral 5.0.0-rc.3 → 5.0.0-rc.4
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.
- package/dist/testing.js +4 -2
- package/dist/types/ActionDefinition.d.ts +2 -0
- package/dist/types/ActionLogger.d.ts +2 -0
- package/dist/types/ActionPerformFunction.d.ts +2 -0
- package/dist/types/ActionPerformReturn.d.ts +3 -1
- package/dist/types/TriggerDefinition.d.ts +2 -0
- package/dist/types/TriggerResult.d.ts +3 -1
- package/dist/types/server-types.d.ts +8 -2
- package/package.json +1 -1
package/dist/testing.js
CHANGED
|
@@ -28,6 +28,8 @@ exports.createConnection = createConnection;
|
|
|
28
28
|
* See https://prismatic.io/docs/custom-components/writing-custom-components/#verifying-correct-logging-in-action-tests for information on testing correct logging behavior in your custom component.
|
|
29
29
|
*/
|
|
30
30
|
const loggerMock = () => ({
|
|
31
|
+
metric: console.log,
|
|
32
|
+
trace: jest_mock_1.spyOn(console, "trace"),
|
|
31
33
|
debug: jest_mock_1.spyOn(console, "debug"),
|
|
32
34
|
info: jest_mock_1.spyOn(console, "info"),
|
|
33
35
|
log: jest_mock_1.spyOn(console, "log"),
|
|
@@ -43,7 +45,7 @@ exports.loggerMock = loggerMock;
|
|
|
43
45
|
*/
|
|
44
46
|
const invoke = (actionBase, params, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
47
|
const action = (actionBase.perform ? actionBase : Object.values(actionBase)[0]);
|
|
46
|
-
const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
|
|
48
|
+
const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, executionState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
|
|
47
49
|
const result = yield action.perform(realizedContext, params);
|
|
48
50
|
return {
|
|
49
51
|
result,
|
|
@@ -88,7 +90,7 @@ exports.defaultTriggerPayload = defaultTriggerPayload;
|
|
|
88
90
|
*/
|
|
89
91
|
const invokeTrigger = (triggerBase, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
92
|
const trigger = (triggerBase.perform ? triggerBase : Object.values(triggerBase)[0]);
|
|
91
|
-
const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
|
|
93
|
+
const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, executionState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
|
|
92
94
|
const realizedPayload = Object.assign(Object.assign({}, exports.defaultTriggerPayload()), payload);
|
|
93
95
|
const realizedParams = params || {};
|
|
94
96
|
const result = yield trigger.perform(realizedContext, realizedPayload, realizedParams);
|
|
@@ -12,6 +12,8 @@ export interface ActionDefinition<T extends Inputs, AllowsBranching extends bool
|
|
|
12
12
|
inputs: T;
|
|
13
13
|
/** Optional attribute that specifies whether an Action will terminate execution.*/
|
|
14
14
|
terminateExecution?: boolean;
|
|
15
|
+
/** Specifies whether an Action will break out of a loop. */
|
|
16
|
+
breakLoop?: boolean;
|
|
15
17
|
/** Determines whether an Action will allow Conditional Branching.*/
|
|
16
18
|
allowsBranching?: AllowsBranching;
|
|
17
19
|
/** Static Branch names associated with an Action. */
|
|
@@ -12,6 +12,8 @@ export declare type ActionLoggerFunction = (...args: unknown[]) => void;
|
|
|
12
12
|
* An object containing logger functions.
|
|
13
13
|
*/
|
|
14
14
|
export interface ActionLogger {
|
|
15
|
+
metric: ActionLoggerFunction;
|
|
16
|
+
trace: ActionLoggerFunction;
|
|
15
17
|
debug: ActionLoggerFunction;
|
|
16
18
|
info: ActionLoggerFunction;
|
|
17
19
|
log: ActionLoggerFunction;
|
|
@@ -7,6 +7,8 @@ export interface ActionContext {
|
|
|
7
7
|
logger: ActionLogger;
|
|
8
8
|
/** A key/value store that may be used to store small amounts of data that is persisted between Instance executions */
|
|
9
9
|
instanceState: Record<string, unknown>;
|
|
10
|
+
/** A key/value store that may be used to store small amounts of data for use later during the execution */
|
|
11
|
+
executionState: Record<string, unknown>;
|
|
10
12
|
/** A unique id that corresponds to the step on the Integration */
|
|
11
13
|
stepId: string;
|
|
12
14
|
/** A unique id that corresponds to the specific execution of the Integration */
|
|
@@ -7,7 +7,9 @@ export interface ActionPerformDataReturn<ReturnData> {
|
|
|
7
7
|
/** The HTTP Status code that will be used if this terminates a synchronous invocation */
|
|
8
8
|
statusCode?: number;
|
|
9
9
|
/** An optional object, the keys and values of which will be persisted in the instanceState and available for subsequent actions and executions */
|
|
10
|
-
|
|
10
|
+
instanceState?: Record<string, unknown>;
|
|
11
|
+
/** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
|
|
12
|
+
executionState?: Record<string, unknown>;
|
|
11
13
|
}
|
|
12
14
|
/** Used to represent a branching return of conventional data and does not require content type to be specified */
|
|
13
15
|
/** Used to represent a binary or serialized data branching return as content type must be specified */
|
|
@@ -19,6 +19,8 @@ export interface TriggerDefinition<T extends Inputs, AllowsBranching extends boo
|
|
|
19
19
|
synchronousResponseSupport: TriggerOptionChoice;
|
|
20
20
|
/** Optional attribute that specifies whether this Trigger will terminate execution. */
|
|
21
21
|
terminateExecution?: boolean;
|
|
22
|
+
/** Specifies whether an Action will break out of a loop. */
|
|
23
|
+
breakLoop?: boolean;
|
|
22
24
|
/** Determines whether this Trigger allows Conditional Branching. */
|
|
23
25
|
allowsBranching?: AllowsBranching;
|
|
24
26
|
/** Static Branch names associated with this Trigger. */
|
|
@@ -7,7 +7,9 @@ export interface TriggerBaseResult {
|
|
|
7
7
|
/** Optional HTTP response to the request that invoked the integration. */
|
|
8
8
|
response?: HttpResponse;
|
|
9
9
|
/** An optional object, the keys and values of which will be persisted in the instanceState and available for subsequent actions and executions */
|
|
10
|
-
|
|
10
|
+
instanceState?: Record<string, unknown>;
|
|
11
|
+
/** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
|
|
12
|
+
executionState?: Record<string, unknown>;
|
|
11
13
|
}
|
|
12
14
|
/** Represents the result of a Trigger action that uses branching. */
|
|
13
15
|
export interface TriggerBranchingResult extends TriggerBaseResult {
|
|
@@ -45,6 +45,8 @@ interface BaseAction {
|
|
|
45
45
|
inputs: InputField[];
|
|
46
46
|
/** Optional attribute that specifies whether an Action will terminate execution. */
|
|
47
47
|
terminateExecution?: boolean;
|
|
48
|
+
/** Specifies whether an Action will break out of a loop. */
|
|
49
|
+
breakLoop?: boolean;
|
|
48
50
|
/** Determines whether an Action will allow Conditional Branching. */
|
|
49
51
|
allowsBranching?: boolean;
|
|
50
52
|
/** Static Branch names associated with an Action. */
|
|
@@ -95,7 +97,9 @@ export interface ServerPerformDataStructureReturn {
|
|
|
95
97
|
/** The HTTP Status code that will be used if this terminates a synchronous invocation */
|
|
96
98
|
statusCode?: number;
|
|
97
99
|
/** An optional object, the keys and values of which will be persisted in the instanceState and available for subsequent actions and executions */
|
|
98
|
-
|
|
100
|
+
instanceState?: Record<string, unknown>;
|
|
101
|
+
/** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
|
|
102
|
+
executionState?: Record<string, unknown>;
|
|
99
103
|
}
|
|
100
104
|
/** Used to represent a binary or serialized data return as content type must be specified */
|
|
101
105
|
interface ServerPerformDataReturn {
|
|
@@ -106,7 +110,9 @@ interface ServerPerformDataReturn {
|
|
|
106
110
|
/** The HTTP Status code that will be used if this terminates a synchronous invocation */
|
|
107
111
|
statusCode?: number;
|
|
108
112
|
/** An optional object, the keys and values of which will be persisted in the instanceState and available for subsequent actions and executions */
|
|
109
|
-
|
|
113
|
+
instanceState?: Record<string, unknown>;
|
|
114
|
+
/** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
|
|
115
|
+
executionState?: Record<string, unknown>;
|
|
110
116
|
}
|
|
111
117
|
/** Used to represent a branching return of conventional data and does not require content type to be specified */
|
|
112
118
|
export interface ServerPerformBranchingDataStructureReturn extends ServerPerformDataStructureReturn {
|