@prismatic-io/spectral 8.0.0-preview2 → 8.0.0-preview3
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,4 +1,4 @@
|
|
|
1
1
|
import { ComponentDefinition, IntegrationDefinition } from "../types";
|
|
2
|
-
import { Component as ServerComponent
|
|
2
|
+
import { Component as ServerComponent } from ".";
|
|
3
3
|
export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
|
|
4
|
-
export declare const convertIntegration: (definition: IntegrationDefinition) =>
|
|
4
|
+
export declare const convertIntegration: (definition: IntegrationDefinition) => ServerComponent;
|
|
@@ -87,10 +87,7 @@ const convertIntegration = (definition) => {
|
|
|
87
87
|
// actions, triggers, data sources, and connections that are created
|
|
88
88
|
// inline as part of the integration definition.
|
|
89
89
|
const referenceKey = (0, uuid_1.v4)();
|
|
90
|
-
return {
|
|
91
|
-
yaml: codeNativeIntegrationYaml(definition, referenceKey),
|
|
92
|
-
component: codeNativeIntegrationComponent(definition, referenceKey),
|
|
93
|
-
};
|
|
90
|
+
return Object.assign(Object.assign({}, codeNativeIntegrationComponent(definition, referenceKey)), { codeNativeIntegrationYAML: codeNativeIntegrationYaml(definition, referenceKey) });
|
|
94
91
|
};
|
|
95
92
|
exports.convertIntegration = convertIntegration;
|
|
96
93
|
const codeNativeIntegrationYaml = ({ name, description, category, documentation, configVars, endpointType, preprocessFlowName, externalCustomerIdField, externalCustomerUserIdField, flowNameField, flows, configPages, }, referenceKey) => {
|
|
@@ -221,7 +218,7 @@ const flowFunctionKey = (flowName, functionName) => {
|
|
|
221
218
|
};
|
|
222
219
|
/** Creates the structure necessary to import a Component as part of a
|
|
223
220
|
* Code Native integration. */
|
|
224
|
-
const codeNativeIntegrationComponent = ({
|
|
221
|
+
const codeNativeIntegrationComponent = ({ iconPath, description, flows = [], dataSources = {}, connections = [], }, referenceKey) => {
|
|
225
222
|
const convertedActions = flows.reduce((result, { name, action }) => {
|
|
226
223
|
const actionKey = flowFunctionKey(name, "action");
|
|
227
224
|
return Object.assign(Object.assign({}, result), { [actionKey]: convertAction(actionKey, Object.assign(Object.assign({}, action), { display: { label: "action", description: "" }, inputs: {} })) });
|
|
@@ -236,7 +233,7 @@ const codeNativeIntegrationComponent = ({ name, description, flows = [], dataSou
|
|
|
236
233
|
const convertedDataSources = Object.entries(dataSources).reduce((result, [dataSourceKey, dataSource]) => (Object.assign(Object.assign({}, result), { [dataSourceKey]: convertDataSource(dataSourceKey, Object.assign(Object.assign({}, dataSource), { inputs: {} })) })), {});
|
|
237
234
|
return {
|
|
238
235
|
key: referenceKey,
|
|
239
|
-
display: { label:
|
|
236
|
+
display: { label: referenceKey, iconPath, description: description || "" },
|
|
240
237
|
connections: connections.map(convertConnection),
|
|
241
238
|
actions: convertedActions,
|
|
242
239
|
triggers: convertedTriggers,
|
|
@@ -9,10 +9,6 @@ export { CustomerAttributes } from "../types";
|
|
|
9
9
|
export { UserAttributes } from "../types";
|
|
10
10
|
export { IntegrationAttributes } from "../types";
|
|
11
11
|
export { FlowAttributes } from "../types";
|
|
12
|
-
export interface Integration {
|
|
13
|
-
yaml: string;
|
|
14
|
-
component: Component;
|
|
15
|
-
}
|
|
16
12
|
export interface Component {
|
|
17
13
|
key: string;
|
|
18
14
|
public?: boolean;
|
|
@@ -25,6 +21,7 @@ export interface Component {
|
|
|
25
21
|
triggers: Record<string, Trigger>;
|
|
26
22
|
dataSources: Record<string, DataSource>;
|
|
27
23
|
connections: Connection[];
|
|
24
|
+
codeNativeIntegrationYAML?: string;
|
|
28
25
|
}
|
|
29
26
|
export interface Action {
|
|
30
27
|
key: string;
|
|
@@ -5,6 +5,8 @@ export declare type IntegrationDefinition = {
|
|
|
5
5
|
name: string;
|
|
6
6
|
/** Optional description for this Integration. */
|
|
7
7
|
description?: string;
|
|
8
|
+
/** Optional path to icon to use for this Integration. Path should be relative to the built Integration source. */
|
|
9
|
+
iconPath?: string;
|
|
8
10
|
/** Optional category for this Integration. */
|
|
9
11
|
category?: string;
|
|
10
12
|
/** Optional documentation for this Integration. */
|