@prismatic-io/spectral 7.7.0 → 7.8.0-preview2
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/clients/http/inputs.js +4 -4
- package/dist/serverTypes/convert.js +15 -2
- package/dist/serverTypes/index.d.ts +9 -0
- package/dist/types/TriggerDefinition.d.ts +5 -1
- package/dist/types/TriggerEventFunction.d.ts +10 -0
- package/dist/types/TriggerEventFunction.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +8 -8
|
@@ -88,7 +88,7 @@ exports.maxRetries = (0, __1.input)({
|
|
|
88
88
|
placeholder: "Max Retries",
|
|
89
89
|
type: "string",
|
|
90
90
|
required: false,
|
|
91
|
-
comments: "The maximum number of retries to attempt.",
|
|
91
|
+
comments: "The maximum number of retries to attempt. Specify 0 for no retries.",
|
|
92
92
|
default: "0",
|
|
93
93
|
clean: (value) => __1.util.types.toNumber(value),
|
|
94
94
|
});
|
|
@@ -97,7 +97,7 @@ exports.retryDelayMS = (0, __1.input)({
|
|
|
97
97
|
placeholder: "Retry Delay",
|
|
98
98
|
type: "string",
|
|
99
99
|
required: false,
|
|
100
|
-
comments: "The delay in milliseconds between retries.",
|
|
100
|
+
comments: "The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.",
|
|
101
101
|
default: "0",
|
|
102
102
|
clean: (value) => __1.util.types.toNumber(value, 0),
|
|
103
103
|
});
|
|
@@ -106,7 +106,7 @@ exports.useExponentialBackoff = (0, __1.input)({
|
|
|
106
106
|
type: "boolean",
|
|
107
107
|
default: "false",
|
|
108
108
|
required: false,
|
|
109
|
-
comments: "Specifies whether to use a pre-defined exponential backoff strategy for retries.",
|
|
109
|
+
comments: "Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.",
|
|
110
110
|
clean: (value) => __1.util.types.toBool(value),
|
|
111
111
|
});
|
|
112
112
|
exports.retryAllErrors = (0, __1.input)({
|
|
@@ -114,7 +114,7 @@ exports.retryAllErrors = (0, __1.input)({
|
|
|
114
114
|
type: "boolean",
|
|
115
115
|
default: "false",
|
|
116
116
|
required: false,
|
|
117
|
-
comments: "If true, retries on all erroneous responses regardless of type.",
|
|
117
|
+
comments: "If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.",
|
|
118
118
|
clean: (value) => __1.util.types.toBool(value),
|
|
119
119
|
});
|
|
120
120
|
exports.formData = (0, __1.input)({
|
|
@@ -32,13 +32,26 @@ const convertAction = (actionKey, _a, hooks) => {
|
|
|
32
32
|
}) });
|
|
33
33
|
};
|
|
34
34
|
const convertTrigger = (triggerKey, _a, hooks) => {
|
|
35
|
-
var { inputs = {}, perform } = _a, trigger = __rest(_a, ["inputs", "perform"]);
|
|
35
|
+
var { inputs = {}, perform, onInstanceDeploy, onInstanceDelete } = _a, trigger = __rest(_a, ["inputs", "perform", "onInstanceDeploy", "onInstanceDelete"]);
|
|
36
36
|
const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
|
|
37
37
|
const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
|
|
38
|
-
|
|
38
|
+
const result = Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {
|
|
39
39
|
inputCleaners,
|
|
40
40
|
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
41
41
|
}) });
|
|
42
|
+
if (onInstanceDeploy) {
|
|
43
|
+
result.onInstanceDeploy = (0, perform_1.createPerform)(onInstanceDeploy, {
|
|
44
|
+
inputCleaners,
|
|
45
|
+
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (onInstanceDelete) {
|
|
49
|
+
result.onInstanceDelete = (0, perform_1.createPerform)(onInstanceDelete, {
|
|
50
|
+
inputCleaners,
|
|
51
|
+
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
42
55
|
};
|
|
43
56
|
const convertDataSource = (dataSourceKey, _a, hooks) => {
|
|
44
57
|
var { inputs = {}, perform } = _a, dataSource = __rest(_a, ["inputs", "perform"]);
|
|
@@ -102,6 +102,13 @@ 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
112
|
export interface Trigger {
|
|
106
113
|
key: string;
|
|
107
114
|
display: DisplayDefinition & {
|
|
@@ -115,6 +122,8 @@ export interface Trigger {
|
|
|
115
122
|
staticBranchNames?: string[];
|
|
116
123
|
dynamicBranchInput?: string;
|
|
117
124
|
perform: TriggerPerformFunction;
|
|
125
|
+
onInstanceDeploy?: TriggerEventFunction;
|
|
126
|
+
onInstanceDelete?: TriggerEventFunction;
|
|
118
127
|
scheduleSupport: TriggerOptionChoice;
|
|
119
128
|
synchronousResponseSupport: TriggerOptionChoice;
|
|
120
129
|
examplePayload?: unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionDisplayDefinition, TriggerPerformFunction, Inputs, TriggerResult } from ".";
|
|
1
|
+
import { ActionDisplayDefinition, TriggerPerformFunction, TriggerEventFunction, Inputs, TriggerResult } from ".";
|
|
2
2
|
declare const optionChoices: readonly ["invalid", "valid", "required"];
|
|
3
3
|
export declare type TriggerOptionChoice = typeof optionChoices[number];
|
|
4
4
|
export declare const TriggerOptionChoices: TriggerOptionChoice[];
|
|
@@ -11,6 +11,10 @@ export interface TriggerDefinition<TInputs extends Inputs, TAllowsBranching exte
|
|
|
11
11
|
display: ActionDisplayDefinition;
|
|
12
12
|
/** Function to perform when this Trigger is invoked. */
|
|
13
13
|
perform: TriggerPerformFunction<TInputs, TAllowsBranching, TResult>;
|
|
14
|
+
/** Function to execute when an Instance of an Integration with a Flow that uses this Trigger is deployed. */
|
|
15
|
+
onInstanceDeploy?: TriggerEventFunction<TInputs>;
|
|
16
|
+
/** Function to execute when an Instance of an Integration with a Flow that uses this Trigger is deleted. */
|
|
17
|
+
onInstanceDelete?: TriggerEventFunction<TInputs>;
|
|
14
18
|
/** InputFields to present in the Prismatic interface for configuration of this Trigger. */
|
|
15
19
|
inputs: TInputs;
|
|
16
20
|
/** Specifies whether this Trigger supports executing the Integration on a recurring schedule. */
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
9
|
+
/** 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>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./ActionInputParameters";
|
|
|
13
13
|
export * from "./ActionLogger";
|
|
14
14
|
export * from "./ActionPerformFunction";
|
|
15
15
|
export * from "./conditional-logic";
|
|
16
|
+
export * from "./TriggerEventFunction";
|
|
16
17
|
export * from "./TriggerResult";
|
|
17
18
|
export * from "./TriggerPerformFunction";
|
|
18
19
|
export * from "./TriggerDefinition";
|
package/dist/types/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __exportStar(require("./ActionInputParameters"), exports);
|
|
|
42
42
|
__exportStar(require("./ActionLogger"), exports);
|
|
43
43
|
__exportStar(require("./ActionPerformFunction"), exports);
|
|
44
44
|
__exportStar(require("./conditional-logic"), exports);
|
|
45
|
+
__exportStar(require("./TriggerEventFunction"), exports);
|
|
45
46
|
__exportStar(require("./TriggerResult"), exports);
|
|
46
47
|
__exportStar(require("./TriggerPerformFunction"), exports);
|
|
47
48
|
__exportStar(require("./TriggerDefinition"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/spectral",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0-preview2",
|
|
4
4
|
"description": "Utility library for building Prismatic components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prismatic"
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"date-fns": "2.30.0",
|
|
44
44
|
"form-data": "4.0.0",
|
|
45
45
|
"jest-mock": "27.0.3",
|
|
46
|
+
"safe-stable-stringify": "2.3.1",
|
|
47
|
+
"serialize-error": "8.1.0",
|
|
46
48
|
"soap": "1.0.0",
|
|
47
|
-
"uuid": "8.3.2",
|
|
48
|
-
"valid-url": "1.0.9",
|
|
49
49
|
"url-join": "5.0.0",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"uuid": "8.3.2",
|
|
51
|
+
"valid-url": "1.0.9"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/jest": "27.4.1",
|
|
55
55
|
"@types/node": "14.14.35",
|
|
56
56
|
"@types/sax": "1.2.4",
|
|
57
|
-
"@types/uuid": "8.3.4",
|
|
58
57
|
"@types/url-join": "4.0.1",
|
|
58
|
+
"@types/uuid": "8.3.4",
|
|
59
59
|
"@types/valid-url": "1.0.3",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "5.18.0",
|
|
61
61
|
"@typescript-eslint/parser": "5.18.0",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"jest": "27.5.1",
|
|
68
68
|
"prettier": "2.6.2",
|
|
69
69
|
"ts-jest": "27.0.3",
|
|
70
|
+
"tsd": "0.20.0",
|
|
70
71
|
"typedoc": "0.17.7",
|
|
71
72
|
"typedoc-plugin-markdown": "2.4.2",
|
|
72
73
|
"typedoc-plugin-remove-references": "0.0.5",
|
|
73
|
-
"typescript": "4.6.3"
|
|
74
|
-
"tsd": "0.20.0"
|
|
74
|
+
"typescript": "4.6.3"
|
|
75
75
|
},
|
|
76
76
|
"tsd": {
|
|
77
77
|
"directory": "./src/types-tests"
|