@prismatic-io/spectral 10.7.0 → 10.8.0
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/generators/componentManifest/templates/actions/action.ts.ejs +1 -1
- package/dist/serverTypes/convertComponent.js +16 -3
- package/dist/serverTypes/convertIntegration.js +2 -7
- package/dist/serverTypes/index.d.ts +9 -0
- package/dist/types/FlowSchemas.d.ts +3 -1
- package/dist/types/TriggerDefinition.d.ts +7 -0
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ export const <%= action.import %> = {
|
|
|
17
17
|
values: <%= action.typeInterface %>Values
|
|
18
18
|
): Promise<TReturn> => {
|
|
19
19
|
const context = requireContext();
|
|
20
|
-
return await context.components.<%= helpers.camelCase(action.componentKey) %>.<%= action.
|
|
20
|
+
return await context.components.<%= helpers.camelCase(action.componentKey) %>.<%= action.import %>({ ...values }) as TReturn;
|
|
21
21
|
},
|
|
22
22
|
inputs: {
|
|
23
23
|
<%- include('../partials/inputs.ejs', { inputs: action.inputs, helpers }) -%>
|
|
@@ -82,6 +82,7 @@ const convertAction = (actionKey, _a, hooks) => {
|
|
|
82
82
|
const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
83
83
|
var _a;
|
|
84
84
|
const { onInstanceDeploy, onInstanceDelete } = trigger;
|
|
85
|
+
const webhookLifecycleHandlers = "webhookLifecycleHandlers" in trigger ? trigger.webhookLifecycleHandlers : undefined;
|
|
85
86
|
const inputs = (_a = trigger.inputs) !== null && _a !== void 0 ? _a : {};
|
|
86
87
|
const isPollingTrigger = (0, PollingTriggerDefinition_1.isPollingTriggerDefinition)(trigger);
|
|
87
88
|
const triggerInputKeys = Object.keys(inputs);
|
|
@@ -119,11 +120,11 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
119
120
|
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
|
-
const result = Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: convertedTriggerInputs.concat(convertedActionInputs), perform: performToUse, scheduleSupport, synchronousResponseSupport: "synchronousResponseSupport" in trigger
|
|
123
|
+
const result = Object.assign(Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: convertedTriggerInputs.concat(convertedActionInputs), perform: performToUse, scheduleSupport, synchronousResponseSupport: "synchronousResponseSupport" in trigger
|
|
123
124
|
? trigger.synchronousResponseSupport
|
|
124
125
|
: scheduleSupport === "invalid"
|
|
125
126
|
? "valid"
|
|
126
|
-
: "invalid" });
|
|
127
|
+
: "invalid" }), (isPollingTrigger ? { isPollingTrigger: true } : {}));
|
|
127
128
|
if (onInstanceDeploy) {
|
|
128
129
|
result.onInstanceDeploy = (0, perform_1.createPerform)(onInstanceDeploy, {
|
|
129
130
|
inputCleaners: triggerInputCleaners,
|
|
@@ -138,7 +139,19 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
138
139
|
});
|
|
139
140
|
result.hasOnInstanceDelete = true;
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
+
if (webhookLifecycleHandlers) {
|
|
143
|
+
result.webhookCreate = (0, perform_1.createPerform)(webhookLifecycleHandlers.create, {
|
|
144
|
+
inputCleaners: triggerInputCleaners,
|
|
145
|
+
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
146
|
+
});
|
|
147
|
+
result.webhookDelete = (0, perform_1.createPerform)(webhookLifecycleHandlers.delete, {
|
|
148
|
+
inputCleaners: triggerInputCleaners,
|
|
149
|
+
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
150
|
+
});
|
|
151
|
+
result.hasWebhookCreateFunction = true;
|
|
152
|
+
result.hasWebhookDeleteFunction = true;
|
|
153
|
+
}
|
|
154
|
+
const { pollAction, triggerType, webhookLifecycleHandlers: _ } = result, resultTrigger = __rest(result, ["pollAction", "triggerType", "webhookLifecycleHandlers"]);
|
|
142
155
|
return resultTrigger;
|
|
143
156
|
};
|
|
144
157
|
exports.convertTrigger = convertTrigger;
|
|
@@ -287,13 +287,8 @@ const flowUsesWrapperTrigger = (flow) => {
|
|
|
287
287
|
};
|
|
288
288
|
const convertFlowSchemas = (flowKey, schemas) => {
|
|
289
289
|
return Object.entries(schemas).reduce((acc, [key, value]) => {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
type: "object",
|
|
293
|
-
$comment: value.$comment,
|
|
294
|
-
properties: value.properties,
|
|
295
|
-
$schema: value.$schema || types_1.DEFAULT_JSON_SCHEMA_VERSION,
|
|
296
|
-
};
|
|
290
|
+
var _a;
|
|
291
|
+
acc[key] = Object.assign({ title: value.title || `${flowKey}-${key}`, type: "object", $comment: value.$comment, properties: value.properties, $schema: value.$schema || types_1.DEFAULT_JSON_SCHEMA_VERSION }, (((_a = value.required) === null || _a === void 0 ? void 0 : _a.length) ? { required: value.required } : {}));
|
|
297
292
|
return acc;
|
|
298
293
|
}, {});
|
|
299
294
|
};
|
|
@@ -143,10 +143,19 @@ export interface Trigger {
|
|
|
143
143
|
hasOnInstanceDeploy?: boolean;
|
|
144
144
|
onInstanceDelete?: TriggerEventFunction;
|
|
145
145
|
hasOnInstanceDelete?: boolean;
|
|
146
|
+
webhookLifecycleHandlers?: {
|
|
147
|
+
create: TriggerEventFunction;
|
|
148
|
+
delete: TriggerEventFunction;
|
|
149
|
+
};
|
|
150
|
+
webhookCreate?: TriggerEventFunction;
|
|
151
|
+
hasWebhookCreateFunction?: boolean;
|
|
152
|
+
webhookDelete?: TriggerEventFunction;
|
|
153
|
+
hasWebhookDeleteFunction?: boolean;
|
|
146
154
|
scheduleSupport: TriggerOptionChoice;
|
|
147
155
|
synchronousResponseSupport: TriggerOptionChoice;
|
|
148
156
|
examplePayload?: unknown;
|
|
149
157
|
isCommonTrigger?: boolean;
|
|
158
|
+
isPollingTrigger?: boolean;
|
|
150
159
|
}
|
|
151
160
|
export interface DataSourceContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection> {
|
|
152
161
|
logger: ActionLogger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface FlowSchemaProperty {
|
|
2
2
|
description: string;
|
|
3
|
-
type
|
|
3
|
+
type?: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const DEFAULT_JSON_SCHEMA_VERSION = "https://json-schema.org/draft/2020-12/schema";
|
|
6
6
|
/** Flow definition schemas require fewer fields than the actual FlowSchema
|
|
@@ -10,6 +10,7 @@ export type FlowDefinitionFlowSchema = {
|
|
|
10
10
|
$comment?: string;
|
|
11
11
|
$schema?: string;
|
|
12
12
|
properties: Record<string, FlowSchemaProperty>;
|
|
13
|
+
required?: string[];
|
|
13
14
|
};
|
|
14
15
|
export interface FlowSchema {
|
|
15
16
|
title: string;
|
|
@@ -17,6 +18,7 @@ export interface FlowSchema {
|
|
|
17
18
|
$schema: string;
|
|
18
19
|
type: string;
|
|
19
20
|
properties: Record<string, FlowSchemaProperty>;
|
|
21
|
+
required?: string[];
|
|
20
22
|
}
|
|
21
23
|
export interface FlowSchemas {
|
|
22
24
|
[key: string]: {
|
|
@@ -26,6 +26,13 @@ export interface TriggerDefinition<TInputs extends Inputs = Inputs, TConfigVars
|
|
|
26
26
|
* https://prismatic.io/docs/custom-connectors/triggers/#instance-deploy-and-delete-events-for-triggers
|
|
27
27
|
*/
|
|
28
28
|
onInstanceDelete?: TriggerEventFunction<TInputs, TConfigVars>;
|
|
29
|
+
/** Optional webhook lifecycle handlers for create, read, and delete operations. */
|
|
30
|
+
webhookLifecycleHandlers?: {
|
|
31
|
+
/** Function to execute to configure a webhook. */
|
|
32
|
+
create: TriggerEventFunction<TInputs, TConfigVars>;
|
|
33
|
+
/** Function to execute for webhook teardown. */
|
|
34
|
+
delete: TriggerEventFunction<TInputs, TConfigVars>;
|
|
35
|
+
};
|
|
29
36
|
/**
|
|
30
37
|
* The inputs to present a low-code integration builder. Values of these inputs
|
|
31
38
|
* are passed to the `perform` function when the trigger is invoked.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/spectral",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.8.0",
|
|
4
4
|
"description": "Utility library for building Prismatic connectors and code-native integrations",
|
|
5
5
|
"keywords": ["prismatic"],
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": ["dist/"],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"axios": "1.
|
|
41
|
+
"axios": "1.12.2",
|
|
42
42
|
"axios-retry": "4.5.0",
|
|
43
43
|
"date-fns": "2.30.0",
|
|
44
44
|
"ejs": "^3.1.10",
|