@prismatic-io/spectral 10.3.5 → 10.3.7
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/index.js +3 -3
- package/dist/conditionalLogic/index.js +5 -4
- package/dist/generators/utils/createImport.js +5 -2
- package/dist/generators/utils/createTypeInterface.js +5 -2
- package/dist/serverTypes/convertComponent.d.ts +4 -2
- package/dist/serverTypes/convertComponent.js +11 -6
- package/dist/serverTypes/convertIntegration.js +19 -17
- package/dist/serverTypes/index.d.ts +1 -0
- package/dist/serverTypes/perform.d.ts +2 -3
- package/dist/serverTypes/perform.js +2 -2
- package/dist/testing.js +1 -1
- package/dist/types/ActionPerformFunction.d.ts +2 -0
- package/dist/types/TriggerDefinition.d.ts +1 -1
- package/dist/util.js +2 -2
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
};
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
exports.inputs = exports.buildRawRequestAction = exports.sendRawRequest = exports.handleErrors = exports.createClient = void 0;
|
|
50
|
-
const
|
|
50
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
51
51
|
const axios_1 = __importDefault(require("axios"));
|
|
52
52
|
const axios_retry_1 = __importStar(require("axios-retry"));
|
|
53
53
|
const form_data_1 = __importDefault(require("form-data"));
|
|
@@ -156,10 +156,10 @@ const handleErrors = (error) => {
|
|
|
156
156
|
};
|
|
157
157
|
exports.handleErrors = handleErrors;
|
|
158
158
|
const sendRawRequest = (baseUrl_1, values_1, ...args_1) => __awaiter(void 0, [baseUrl_1, values_1, ...args_1], void 0, function* (baseUrl, values, authorizationHeaders = {}) {
|
|
159
|
-
if (values.data && (!(0,
|
|
159
|
+
if (values.data && (!(0, isEmpty_1.default)(values.formData) || !(0, isEmpty_1.default)(values.fileData))) {
|
|
160
160
|
throw new Error("Cannot specify both Data and File/Form Data.");
|
|
161
161
|
}
|
|
162
|
-
const payload = !(0,
|
|
162
|
+
const payload = !(0, isEmpty_1.default)(values.formData) || !(0, isEmpty_1.default)(values.fileData)
|
|
163
163
|
? toFormData(values.formData, values.fileData, values.fileDataFileNames)
|
|
164
164
|
: values.data;
|
|
165
165
|
const client = (0, exports.createClient)({
|
|
@@ -20,7 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.evaluate = exports.parseDate = exports.contains = exports.parseValue = exports.validate = void 0;
|
|
21
21
|
const types_1 = require("./types");
|
|
22
22
|
const date_fns_1 = require("date-fns");
|
|
23
|
-
const
|
|
23
|
+
const isEqualWith_1 = __importDefault(require("lodash/isEqualWith"));
|
|
24
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
24
25
|
const util_1 = __importDefault(require("../util"));
|
|
25
26
|
const validate = (expression) => {
|
|
26
27
|
if (!Array.isArray(expression)) {
|
|
@@ -99,7 +100,7 @@ const parseDate = (value) => {
|
|
|
99
100
|
};
|
|
100
101
|
exports.parseDate = parseDate;
|
|
101
102
|
const isEqual = (left, right) => left == right ||
|
|
102
|
-
|
|
103
|
+
(0, isEqualWith_1.default)(left, right, (objectA, objectB) => {
|
|
103
104
|
if (typeof objectA === "object" || typeof objectB === "object") {
|
|
104
105
|
/**
|
|
105
106
|
* `undefined` will fall back to the default isEqual behavior.
|
|
@@ -226,9 +227,9 @@ const evaluate = (expression) => {
|
|
|
226
227
|
case types_1.BinaryOperator.notIn:
|
|
227
228
|
return !(0, exports.contains)(right, leftTerm);
|
|
228
229
|
case types_1.BinaryOperator.exactlyMatches:
|
|
229
|
-
return left === right ||
|
|
230
|
+
return left === right || (0, isEqual_1.default)(left, right);
|
|
230
231
|
case types_1.BinaryOperator.doesNotExactlyMatch:
|
|
231
|
-
return !(left === right ||
|
|
232
|
+
return !(left === right || (0, isEqual_1.default)(left, right));
|
|
232
233
|
case types_1.BinaryOperator.startsWith:
|
|
233
234
|
return `${right}`.startsWith(`${left}`);
|
|
234
235
|
case types_1.BinaryOperator.doesNotStartWith:
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.createImport = void 0;
|
|
4
|
-
const
|
|
5
|
-
const createImport = (key) => (0,
|
|
7
|
+
const camelCase_1 = __importDefault(require("lodash/camelCase"));
|
|
8
|
+
const createImport = (key) => (0, camelCase_1.default)(key);
|
|
6
9
|
exports.createImport = createImport;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.createTypeInterface = void 0;
|
|
4
|
-
const
|
|
7
|
+
const camelCase_1 = __importDefault(require("lodash/camelCase"));
|
|
5
8
|
const capitalizeFirstLetter_1 = require("./capitalizeFirstLetter");
|
|
6
|
-
const createTypeInterface = (key) => (0, capitalizeFirstLetter_1.capitalizeFirstLetter)((0,
|
|
9
|
+
const createTypeInterface = (key) => (0, capitalizeFirstLetter_1.capitalizeFirstLetter)((0, camelCase_1.default)(key));
|
|
7
10
|
exports.createTypeInterface = createTypeInterface;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { InputFieldDefinition, ComponentDefinition, ConnectionDefinition, OnPremConnectionInput } from "../types";
|
|
2
|
-
import { Component as ServerComponent, Connection as ServerConnection, Input as ServerInput } from ".";
|
|
1
|
+
import { InputFieldDefinition, ComponentDefinition, ConnectionDefinition, TriggerDefinition, ComponentHooks, ConfigVarResultCollection, OnPremConnectionInput, TriggerPayload } from "../types";
|
|
2
|
+
import { Component as ServerComponent, Connection as ServerConnection, Trigger as ServerTrigger, Input as ServerInput } from ".";
|
|
3
|
+
import { PollingTriggerDefinition } from "../types/PollingTriggerDefinition";
|
|
3
4
|
export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition | OnPremConnectionInput) => ServerInput;
|
|
5
|
+
export declare const convertTrigger: (triggerKey: string, trigger: TriggerDefinition<any> | PollingTriggerDefinition<any, ConfigVarResultCollection, TriggerPayload, boolean, any, any>, hooks?: ComponentHooks) => ServerTrigger;
|
|
4
6
|
export declare const convertConnection: ({ inputs, ...connection }: ConnectionDefinition) => ServerConnection;
|
|
5
7
|
export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
|
|
@@ -10,16 +10,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.convertComponent = exports.convertConnection = exports.convertInput = void 0;
|
|
17
|
+
exports.convertComponent = exports.convertConnection = exports.convertTrigger = exports.convertInput = void 0;
|
|
15
18
|
const types_1 = require("../types");
|
|
16
19
|
const perform_1 = require("./perform");
|
|
17
|
-
const
|
|
20
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
18
21
|
const PollingTriggerDefinition_1 = require("../types/PollingTriggerDefinition");
|
|
19
22
|
const convertInput = (key, _a) => {
|
|
20
23
|
var { default: defaultValue, type, label, collection } = _a, rest = __rest(_a, ["default", "type", "label", "collection"]);
|
|
21
24
|
const keyLabel = collection === "keyvaluelist" && typeof label === "object" ? label.key : undefined;
|
|
22
|
-
return Object.assign(Object.assign({}, (0,
|
|
25
|
+
return Object.assign(Object.assign({}, (0, omit_1.default)(rest, [
|
|
23
26
|
"onPremControlled",
|
|
24
27
|
"permissionAndVisibilityType",
|
|
25
28
|
"visibleToOrgDeployer",
|
|
@@ -38,7 +41,8 @@ const convertAction = (actionKey, _a, hooks) => {
|
|
|
38
41
|
}) });
|
|
39
42
|
};
|
|
40
43
|
const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
41
|
-
const {
|
|
44
|
+
const { onInstanceDeploy, onInstanceDelete } = trigger;
|
|
45
|
+
const inputs = trigger.inputs;
|
|
42
46
|
const isPollingTrigger = (0, PollingTriggerDefinition_1.isPollingTriggerDefinition)(trigger);
|
|
43
47
|
const triggerInputKeys = Object.keys(inputs);
|
|
44
48
|
const convertedTriggerInputs = Object.entries(inputs).map(([key, value]) => {
|
|
@@ -56,7 +60,7 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
56
60
|
if (action) {
|
|
57
61
|
convertedActionInputs = Object.entries(action.inputs).reduce((accum, [key, value]) => {
|
|
58
62
|
if (triggerInputKeys.includes(key)) {
|
|
59
|
-
throw new Error(`
|
|
63
|
+
throw new Error(`The pollingTrigger "${trigger.display.label}" was defined with an input with the key: ${key}. This key duplicates an input on the associated "${action.display.label}" action. Please assign the trigger input a different key.`);
|
|
60
64
|
}
|
|
61
65
|
accum.push((0, exports.convertInput)(key, value));
|
|
62
66
|
return accum;
|
|
@@ -97,6 +101,7 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
97
101
|
const { pollAction, triggerType } = result, resultTrigger = __rest(result, ["pollAction", "triggerType"]);
|
|
98
102
|
return resultTrigger;
|
|
99
103
|
};
|
|
104
|
+
exports.convertTrigger = convertTrigger;
|
|
100
105
|
const convertDataSource = (dataSourceKey, _a, hooks) => {
|
|
101
106
|
var { inputs = {}, perform } = _a, dataSource = __rest(_a, ["inputs", "perform"]);
|
|
102
107
|
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
|
|
@@ -117,7 +122,7 @@ exports.convertConnection = convertConnection;
|
|
|
117
122
|
const convertComponent = (_a) => {
|
|
118
123
|
var { connections = [], actions = {}, triggers = {}, dataSources = {}, hooks } = _a, definition = __rest(_a, ["connections", "actions", "triggers", "dataSources", "hooks"]);
|
|
119
124
|
const convertedActions = Object.entries(actions).reduce((result, [actionKey, action]) => (Object.assign(Object.assign({}, result), { [actionKey]: convertAction(actionKey, action, hooks) })), {});
|
|
120
|
-
const convertedTriggers = Object.entries(triggers).reduce((result, [triggerKey, trigger]) => (Object.assign(Object.assign({}, result), { [triggerKey]: convertTrigger(triggerKey, trigger, hooks) })), {});
|
|
125
|
+
const convertedTriggers = Object.entries(triggers).reduce((result, [triggerKey, trigger]) => (Object.assign(Object.assign({}, result), { [triggerKey]: (0, exports.convertTrigger)(triggerKey, trigger, hooks) })), {});
|
|
121
126
|
const convertedDataSources = Object.entries(dataSources).reduce((result, [dataSourceKey, dataSource]) => (Object.assign(Object.assign({}, result), { [dataSourceKey]: convertDataSource(dataSourceKey, dataSource, hooks) })), {});
|
|
122
127
|
return Object.assign(Object.assign({}, definition), { connections: connections.map(exports.convertConnection), actions: convertedActions, triggers: convertedTriggers, dataSources: convertedDataSources });
|
|
123
128
|
};
|
|
@@ -15,11 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.convertConfigVar = exports.convertFlow = exports.convertIntegration = void 0;
|
|
16
16
|
const yaml_1 = __importDefault(require("yaml"));
|
|
17
17
|
const uuid_1 = require("uuid");
|
|
18
|
-
const
|
|
18
|
+
const assign_1 = __importDefault(require("lodash/assign"));
|
|
19
|
+
const camelCase_1 = __importDefault(require("lodash/camelCase"));
|
|
20
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
19
21
|
const types_1 = require("../types");
|
|
20
22
|
const convertComponent_1 = require("./convertComponent");
|
|
21
23
|
const integration_1 = require("./integration");
|
|
22
|
-
const
|
|
24
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
23
25
|
const perform_1 = require("./perform");
|
|
24
26
|
const convertIntegration = (definition) => {
|
|
25
27
|
var _a, _b, _c;
|
|
@@ -195,8 +197,8 @@ const convertComponentReference = (componentReference, componentRegistry, refere
|
|
|
195
197
|
const formattedValue = type === "complex" || typeof valueExpr === "string"
|
|
196
198
|
? valueExpr
|
|
197
199
|
: JSON.stringify(valueExpr);
|
|
198
|
-
const meta = convertInputPermissionAndVisibility((0,
|
|
199
|
-
const { writeOnly } = (0,
|
|
200
|
+
const meta = convertInputPermissionAndVisibility((0, pick_1.default)(value, ["permissionAndVisibilityType", "visibleToOrgDeployer"]));
|
|
201
|
+
const { writeOnly } = (0, pick_1.default)(value, ["writeOnly"]);
|
|
200
202
|
if (writeOnly) {
|
|
201
203
|
meta.writeOnly = writeOnly;
|
|
202
204
|
}
|
|
@@ -337,7 +339,7 @@ const convertInputValue = (value, collectionType) => {
|
|
|
337
339
|
const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
|
|
338
340
|
var _a, _b, _c;
|
|
339
341
|
if ((0, types_1.isOrganizationActivatedConnectionConfigVar)(configVar)) {
|
|
340
|
-
const { stableKey } = (0,
|
|
342
|
+
const { stableKey } = (0, pick_1.default)(configVar, ["stableKey"]);
|
|
341
343
|
return {
|
|
342
344
|
key,
|
|
343
345
|
stableKey,
|
|
@@ -346,23 +348,23 @@ const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
|
|
|
346
348
|
useScopedConfigVar: stableKey,
|
|
347
349
|
};
|
|
348
350
|
}
|
|
349
|
-
const { orgOnly, meta } = convertConfigVarPermissionAndVisibility((0,
|
|
351
|
+
const { orgOnly, meta } = convertConfigVarPermissionAndVisibility((0, pick_1.default)(configVar, ["permissionAndVisibilityType", "visibleToOrgDeployer"]));
|
|
350
352
|
if ((0, types_1.isConnectionDefinitionConfigVar)(configVar)) {
|
|
351
|
-
const { stableKey, description } = (0,
|
|
353
|
+
const { stableKey, description } = (0, pick_1.default)(configVar, ["stableKey", "description"]);
|
|
352
354
|
return {
|
|
353
355
|
stableKey,
|
|
354
356
|
description,
|
|
355
357
|
key,
|
|
356
358
|
dataType: "connection",
|
|
357
359
|
connection: {
|
|
358
|
-
key: (0,
|
|
360
|
+
key: (0, camelCase_1.default)(key),
|
|
359
361
|
component: codeNativeIntegrationComponentReference(referenceKey),
|
|
360
362
|
},
|
|
361
363
|
inputs: Object.entries(configVar.inputs).reduce((result, [key, input]) => {
|
|
362
364
|
if (input.shown === false) {
|
|
363
365
|
return result;
|
|
364
366
|
}
|
|
365
|
-
const meta = convertInputPermissionAndVisibility((0,
|
|
367
|
+
const meta = convertInputPermissionAndVisibility((0, pick_1.default)(input, ["permissionAndVisibilityType", "visibleToOrgDeployer"]));
|
|
366
368
|
if (input.writeOnly) {
|
|
367
369
|
meta.writeOnly = input.writeOnly;
|
|
368
370
|
}
|
|
@@ -393,7 +395,7 @@ const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
|
|
|
393
395
|
}
|
|
394
396
|
if ((0, types_1.isConnectionReferenceConfigVar)(configVar)) {
|
|
395
397
|
const { ref, inputs } = convertComponentReference(configVar.connection, componentRegistry, "connections");
|
|
396
|
-
const { stableKey = "", description, connection: { template, onPremiseConnectionConfig }, } = (0,
|
|
398
|
+
const { stableKey = "", description, connection: { template, onPremiseConnectionConfig }, } = (0, pick_1.default)(configVar, ["stableKey", "description", "connection"]);
|
|
397
399
|
return {
|
|
398
400
|
stableKey,
|
|
399
401
|
description,
|
|
@@ -414,7 +416,7 @@ const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
|
|
|
414
416
|
? rawDefaultValue
|
|
415
417
|
: JSON.stringify(rawDefaultValue)
|
|
416
418
|
: undefined;
|
|
417
|
-
const result = (0,
|
|
419
|
+
const result = (0, assign_1.default)({ orgOnly, meta, key, defaultValue }, (0, pick_1.default)(configVar, [
|
|
418
420
|
"stableKey",
|
|
419
421
|
"description",
|
|
420
422
|
"dataType",
|
|
@@ -432,7 +434,7 @@ const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
|
|
|
432
434
|
if ((0, types_1.isDataSourceDefinitionConfigVar)(configVar)) {
|
|
433
435
|
result.dataType = configVar.dataSourceType;
|
|
434
436
|
result.dataSource = {
|
|
435
|
-
key: (0,
|
|
437
|
+
key: (0, camelCase_1.default)(key),
|
|
436
438
|
component: codeNativeIntegrationComponentReference(referenceKey),
|
|
437
439
|
};
|
|
438
440
|
}
|
|
@@ -509,7 +511,7 @@ const generateOnInstanceWrapperFn = (componentRef, onTrigger, eventName, customF
|
|
|
509
511
|
if (customFn) {
|
|
510
512
|
customResponse = (yield customFn(context, params)) || {};
|
|
511
513
|
}
|
|
512
|
-
return (0,
|
|
514
|
+
return (0, merge_1.default)(invokeResponse, customResponse);
|
|
513
515
|
})
|
|
514
516
|
: customFn;
|
|
515
517
|
return onInstanceFn;
|
|
@@ -611,8 +613,8 @@ const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [
|
|
|
611
613
|
if (!(0, types_1.isDataSourceDefinitionConfigVar)(configVar)) {
|
|
612
614
|
return result;
|
|
613
615
|
}
|
|
614
|
-
const camelKey = (0,
|
|
615
|
-
const dataSource = (0,
|
|
616
|
+
const camelKey = (0, camelCase_1.default)(key);
|
|
617
|
+
const dataSource = (0, pick_1.default)(configVar, ["perform", "dataSourceType"]);
|
|
616
618
|
return Object.assign(Object.assign({}, result), { [camelKey]: Object.assign(Object.assign({}, dataSource), { key: camelKey, display: {
|
|
617
619
|
label: key,
|
|
618
620
|
description: key,
|
|
@@ -624,12 +626,12 @@ const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [
|
|
|
624
626
|
return result;
|
|
625
627
|
}
|
|
626
628
|
const convertedInputs = Object.entries(configVar.inputs).map(([key, value]) => (0, convertComponent_1.convertInput)(key, value));
|
|
627
|
-
const connection = (0,
|
|
629
|
+
const connection = (0, pick_1.default)(configVar, ["oauth2Type", "oauth2PkceMethod"]);
|
|
628
630
|
const { avatarPath: avatarIconPath, oauth2ConnectionIconPath: iconPath } = (_a = configVar.icons) !== null && _a !== void 0 ? _a : {};
|
|
629
631
|
return [
|
|
630
632
|
...result,
|
|
631
633
|
Object.assign(Object.assign({}, connection), { iconPath,
|
|
632
|
-
avatarIconPath, inputs: convertedInputs, key: (0,
|
|
634
|
+
avatarIconPath, inputs: convertedInputs, key: (0, camelCase_1.default)(key), label: key }),
|
|
633
635
|
];
|
|
634
636
|
}, []);
|
|
635
637
|
return {
|
|
@@ -72,6 +72,7 @@ export type ActionContext<TConfigVars extends ConfigVarResultCollection = Config
|
|
|
72
72
|
startedAt: string;
|
|
73
73
|
invokeFlow: FlowInvoker<TFlows>;
|
|
74
74
|
executionFrame: ExecutionFrame;
|
|
75
|
+
globalDebug: boolean;
|
|
75
76
|
};
|
|
76
77
|
type TriggerOptionChoice = "invalid" | "valid" | "required";
|
|
77
78
|
export interface TriggerPayload {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ActionContext, ErrorHandler, FlowInvoker, Inputs, PollingTriggerPerformFunction } from "../types";
|
|
2
|
-
import { type PollingTriggerDefinition } from "../types/PollingTriggerDefinition";
|
|
1
|
+
import type { ActionContext, ConfigVarResultCollection, ErrorHandler, FlowInvoker, Inputs, PollingTriggerDefinition, PollingTriggerPerformFunction, TriggerPayload } from "../types";
|
|
3
2
|
export type PerformFn = (...args: any[]) => Promise<any>;
|
|
4
3
|
export type CleanFn = (...args: any[]) => any;
|
|
5
4
|
export type InputCleaners = Record<string, CleanFn | undefined>;
|
|
@@ -12,5 +11,5 @@ export declare const createInvokeFlow: <const TFlows extends Readonly<string[]>>
|
|
|
12
11
|
isCNI?: boolean;
|
|
13
12
|
}) => FlowInvoker<TFlows>;
|
|
14
13
|
export declare const createPerform: (performFn: PerformFn, { inputCleaners, errorHandler }: CreatePerformProps) => PerformFn;
|
|
15
|
-
export declare const createPollingPerform: (trigger: PollingTriggerDefinition, { inputCleaners, errorHandler }: CreatePerformProps) => PollingTriggerPerformFunction<Inputs, Inputs>;
|
|
14
|
+
export declare const createPollingPerform: (trigger: PollingTriggerDefinition<any, ConfigVarResultCollection, TriggerPayload, boolean, any, any>, { inputCleaners, errorHandler }: CreatePerformProps) => PollingTriggerPerformFunction<Inputs, Inputs>;
|
|
16
15
|
export {};
|
|
@@ -25,9 +25,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createPollingPerform = exports.createPerform = exports.createInvokeFlow = exports.cleanParams = void 0;
|
|
27
27
|
const axios_1 = __importDefault(require("axios"));
|
|
28
|
-
const
|
|
28
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
29
29
|
const cleanParams = (params, cleaners) => {
|
|
30
|
-
const keys = (0,
|
|
30
|
+
const keys = (0, uniq_1.default)([...Object.keys(params), ...Object.keys(cleaners)]);
|
|
31
31
|
return keys.reduce((result, key) => {
|
|
32
32
|
const value = params[key];
|
|
33
33
|
const cleanFn = cleaners[key];
|
package/dist/testing.js
CHANGED
|
@@ -113,7 +113,7 @@ const createActionContext = (context) => {
|
|
|
113
113
|
executionStartedAt: "",
|
|
114
114
|
stepName: "some-step",
|
|
115
115
|
loopPath: "",
|
|
116
|
-
} }, context);
|
|
116
|
+
}, globalDebug: false }, context);
|
|
117
117
|
};
|
|
118
118
|
const createDataSourceContext = (context) => {
|
|
119
119
|
return Object.assign({ logger: (0, exports.loggerMock)(), configVars: {}, customer: {
|
|
@@ -66,5 +66,7 @@ export type ActionContext<TConfigVars extends ConfigVarResultCollection = Config
|
|
|
66
66
|
invokeFlow: FlowInvoker<TFlows>;
|
|
67
67
|
/** Reference to the current execution and, when applicable, the current step. */
|
|
68
68
|
executionFrame: ExecutionFrame;
|
|
69
|
+
/** Denotes whether code should be executed in debug mode. */
|
|
70
|
+
globalDebug: boolean;
|
|
69
71
|
};
|
|
70
72
|
export {};
|
|
@@ -6,7 +6,7 @@ export declare const TriggerOptionChoices: TriggerOptionChoice[];
|
|
|
6
6
|
* TriggerDefinition is the type of the object that is passed in to `trigger` function to
|
|
7
7
|
* define a component trigger.
|
|
8
8
|
*/
|
|
9
|
-
export interface TriggerDefinition<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> {
|
|
9
|
+
export interface TriggerDefinition<TInputs extends Inputs = Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TriggerPayload> = TriggerResult<TAllowsBranching, TriggerPayload>> {
|
|
10
10
|
/** Defines how the Trigger is displayed in the Prismatic interface. */
|
|
11
11
|
display: ActionDisplayDefinition;
|
|
12
12
|
/** Function to perform when this Trigger is invoked. */
|
package/dist/util.js
CHANGED
|
@@ -14,7 +14,7 @@ const parseISO_1 = __importDefault(require("date-fns/parseISO"));
|
|
|
14
14
|
const isValid_1 = __importDefault(require("date-fns/isValid"));
|
|
15
15
|
const isDate_1 = __importDefault(require("date-fns/isDate"));
|
|
16
16
|
const fromUnixTime_1 = __importDefault(require("date-fns/fromUnixTime"));
|
|
17
|
-
const
|
|
17
|
+
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
18
18
|
const safe_stable_stringify_1 = require("safe-stable-stringify");
|
|
19
19
|
const valid_url_1 = require("valid-url");
|
|
20
20
|
const isObjectWithOneTruthyKey = (value, keys) => {
|
|
@@ -513,7 +513,7 @@ exports.toObject = toObject;
|
|
|
513
513
|
*/
|
|
514
514
|
const cleanObject = (obj, predicate) => {
|
|
515
515
|
const defaultPredicate = (v) => v === undefined || v === null || v === "";
|
|
516
|
-
return (0,
|
|
516
|
+
return (0, omitBy_1.default)(obj, predicate || defaultPredicate);
|
|
517
517
|
};
|
|
518
518
|
exports.default = {
|
|
519
519
|
types: {
|