@prismatic-io/spectral 8.1.5 → 8.1.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/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/serverTypes/convert.d.ts +2 -2
- package/dist/serverTypes/convert.js +3 -2
- package/dist/serverTypes/convertIntegration.js +14 -7
- package/dist/serverTypes/index.d.ts +2 -1
- package/dist/serverTypes/integration.d.ts +2 -2
- package/dist/types/ConnectionDefinition.d.ts +5 -8
- package/dist/types/DataSourceResult.d.ts +1 -0
- package/dist/types/Inputs.d.ts +3 -0
- package/dist/types/IntegrationDefinition.d.ts +25 -13
- package/dist/types/IntegrationDefinition.js +6 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* authors create inputs, actions, and components that can
|
|
4
4
|
* be processed by the Prismatic API.
|
|
5
5
|
*/
|
|
6
|
-
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, ConfigPages,
|
|
6
|
+
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, ConfigPages, OnPremConnectionDefinition, ScheduleConfigVar, ComponentSelector } from "./types";
|
|
7
7
|
import { convertComponent } from "./serverTypes/convert";
|
|
8
8
|
import { convertIntegration } from "./serverTypes/convertIntegration";
|
|
9
9
|
/**
|
|
@@ -128,10 +128,10 @@ export declare const connection: <T extends DefaultConnectionDefinition>(definit
|
|
|
128
128
|
/**
|
|
129
129
|
* For information on writing custom component connections using on-premise resources, see
|
|
130
130
|
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
|
|
131
|
-
* @param definition An
|
|
131
|
+
* @param definition An OnPremConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
|
|
132
132
|
* @returns This function validates the shape of the `definition` object provided and returns the same connection object.
|
|
133
133
|
*/
|
|
134
|
-
export declare const
|
|
134
|
+
export declare const onPremConnection: <T extends OnPremConnectionDefinition>(definition: T) => T;
|
|
135
135
|
/**
|
|
136
136
|
* For information on writing custom component connections, see
|
|
137
137
|
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.testing = exports.util = exports.oauth2Connection = exports.
|
|
25
|
+
exports.testing = exports.util = exports.oauth2Connection = exports.onPremConnection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.dataSourceConfigVar = exports.configVar = exports.reference = exports.configPage = exports.flow = exports.integration = void 0;
|
|
26
26
|
const convert_1 = require("./serverTypes/convert");
|
|
27
27
|
const convertIntegration_1 = require("./serverTypes/convertIntegration");
|
|
28
28
|
/**
|
|
@@ -153,11 +153,11 @@ exports.connection = connection;
|
|
|
153
153
|
/**
|
|
154
154
|
* For information on writing custom component connections using on-premise resources, see
|
|
155
155
|
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
|
|
156
|
-
* @param definition An
|
|
156
|
+
* @param definition An OnPremConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
|
|
157
157
|
* @returns This function validates the shape of the `definition` object provided and returns the same connection object.
|
|
158
158
|
*/
|
|
159
|
-
const
|
|
160
|
-
exports.
|
|
159
|
+
const onPremConnection = (definition) => definition;
|
|
160
|
+
exports.onPremConnection = onPremConnection;
|
|
161
161
|
/**
|
|
162
162
|
* For information on writing custom component connections, see
|
|
163
163
|
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputFieldDefinition, ComponentDefinition } from "../types";
|
|
1
|
+
import { InputFieldDefinition, ComponentDefinition, OnPremConnectionInput } from "../types";
|
|
2
2
|
import { Component as ServerComponent, Input as ServerInput } from ".";
|
|
3
|
-
export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition) => ServerInput;
|
|
3
|
+
export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition | OnPremConnectionInput) => ServerInput;
|
|
4
4
|
export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
|
|
@@ -14,13 +14,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.convertComponent = exports.convertInput = void 0;
|
|
15
15
|
const types_1 = require("../types");
|
|
16
16
|
const perform_1 = require("./perform");
|
|
17
|
+
const lodash_1 = require("lodash");
|
|
17
18
|
const convertInput = (key, _a) => {
|
|
18
19
|
var { default: defaultValue, type, label, collection } = _a, rest = __rest(_a, ["default", "type", "label", "collection"]);
|
|
19
20
|
const keyLabel = collection === "keyvaluelist" && typeof label === "object"
|
|
20
21
|
? label.key
|
|
21
22
|
: undefined;
|
|
22
|
-
return Object.assign(Object.assign({}, rest), { key,
|
|
23
|
-
type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel });
|
|
23
|
+
return Object.assign(Object.assign({}, (0, lodash_1.omit)(rest, ["onPremControlled"])), { key,
|
|
24
|
+
type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel, onPremiseControlled: ("onPremControlled" in rest && rest.onPremControlled) || undefined });
|
|
24
25
|
};
|
|
25
26
|
exports.convertInput = convertInput;
|
|
26
27
|
const convertAction = (actionKey, _a, hooks) => {
|
|
@@ -93,7 +93,15 @@ const convertComponentReference = ({ key, component: componentRef, values, }) =>
|
|
|
93
93
|
};
|
|
94
94
|
const inputs = Object.entries(values !== null && values !== void 0 ? values : {}).reduce((result, [key, value]) => {
|
|
95
95
|
if ("value" in value) {
|
|
96
|
-
|
|
96
|
+
const type = value.value instanceof Object ? "complex" : "value";
|
|
97
|
+
const valueExpr = value.value instanceof Object && !Array.isArray(value.value)
|
|
98
|
+
? Object.entries(value.value).map(([k, v]) => ({
|
|
99
|
+
name: { type: "value", value: k },
|
|
100
|
+
type: "value",
|
|
101
|
+
value: v,
|
|
102
|
+
}))
|
|
103
|
+
: value.value;
|
|
104
|
+
return Object.assign(Object.assign({}, result), { [key]: { type: type, value: valueExpr } });
|
|
97
105
|
}
|
|
98
106
|
if ("configVar" in value) {
|
|
99
107
|
return Object.assign(Object.assign({}, result), { [key]: { type: "configVar", value: value.configVar } });
|
|
@@ -185,12 +193,11 @@ const convertConfigVar = (key, configVar, referenceKey) => {
|
|
|
185
193
|
if (input.shown === false) {
|
|
186
194
|
return result;
|
|
187
195
|
}
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return Object.assign(Object.assign({}, result), { [key]: { type: "value", value } });
|
|
196
|
+
const defaultValue = input.collection ? [] : "";
|
|
197
|
+
return Object.assign(Object.assign({}, result), { [key]: {
|
|
198
|
+
type: input.collection ? "complex" : "value",
|
|
199
|
+
value: input.default || defaultValue,
|
|
200
|
+
} });
|
|
194
201
|
}, {}), meta });
|
|
195
202
|
}
|
|
196
203
|
if ((0, types_1.isConnectionReferenceConfigVar)(configVar)) {
|
|
@@ -174,7 +174,7 @@ export interface Connection {
|
|
|
174
174
|
iconPath?: string;
|
|
175
175
|
inputs: (Input & {
|
|
176
176
|
shown?: boolean;
|
|
177
|
-
|
|
177
|
+
onPremControlled?: boolean;
|
|
178
178
|
})[];
|
|
179
179
|
}
|
|
180
180
|
export interface ConnectionValue {
|
|
@@ -235,4 +235,5 @@ export interface Input {
|
|
|
235
235
|
required?: boolean;
|
|
236
236
|
model?: InputFieldChoice[];
|
|
237
237
|
language?: string;
|
|
238
|
+
onPremiseControlled?: boolean;
|
|
238
239
|
}
|
|
@@ -9,12 +9,12 @@ export interface ComponentReference {
|
|
|
9
9
|
template?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare type Input = {
|
|
12
|
-
name?: string;
|
|
12
|
+
name?: string | Input;
|
|
13
13
|
type: "value" | "reference" | "configVar" | "template";
|
|
14
14
|
value: string;
|
|
15
15
|
meta?: Record<string, unknown>;
|
|
16
16
|
} | {
|
|
17
|
-
name?: string;
|
|
17
|
+
name?: string | Input;
|
|
18
18
|
type: "complex";
|
|
19
19
|
value: string | Input;
|
|
20
20
|
meta?: Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectionInput } from ".";
|
|
1
|
+
import { ConnectionInput, OnPremConnectionInput } from ".";
|
|
2
2
|
export declare enum OAuth2Type {
|
|
3
3
|
ClientCredentials = "client_credentials",
|
|
4
4
|
AuthorizationCode = "authorization_code"
|
|
@@ -19,13 +19,10 @@ export interface DefaultConnectionDefinition extends BaseConnectionDefinition {
|
|
|
19
19
|
[key: string]: ConnectionInput;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
onPremiseControlled: true;
|
|
24
|
-
};
|
|
25
|
-
export interface OnPremiseConnectionDefinition extends BaseConnectionDefinition {
|
|
22
|
+
export interface OnPremConnectionDefinition extends BaseConnectionDefinition {
|
|
26
23
|
inputs: {
|
|
27
|
-
host:
|
|
28
|
-
port:
|
|
24
|
+
host: OnPremConnectionInput;
|
|
25
|
+
port: OnPremConnectionInput;
|
|
29
26
|
[key: string]: ConnectionInput;
|
|
30
27
|
};
|
|
31
28
|
}
|
|
@@ -53,5 +50,5 @@ interface OAuth2ClientCredentialConnectionDefinition extends BaseConnectionDefin
|
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
52
|
export declare type OAuth2ConnectionDefinition = OAuth2AuthorizationCodeConnectionDefinition | OAuth2ClientCredentialConnectionDefinition;
|
|
56
|
-
export declare type ConnectionDefinition = DefaultConnectionDefinition |
|
|
53
|
+
export declare type ConnectionDefinition = DefaultConnectionDefinition | OnPremConnectionDefinition | OAuth2ConnectionDefinition;
|
|
57
54
|
export {};
|
|
@@ -16,6 +16,7 @@ declare type DataSourceTypeMap = {
|
|
|
16
16
|
jsonForm: JSONForm;
|
|
17
17
|
};
|
|
18
18
|
export declare type DataSourceType = keyof DataSourceTypeMap;
|
|
19
|
+
export declare type CollectionDataSourceType = Exclude<DataSourceType, "objectSelection" | "objectFieldMap" | "jsonForm">;
|
|
19
20
|
export declare type DataSourceResultType = DataSourceTypeMap[DataSourceType];
|
|
20
21
|
/** Represents the result of a Data Source action. */
|
|
21
22
|
export declare type DataSourceResult<TDataSourceType extends DataSourceType> = {
|
package/dist/types/Inputs.d.ts
CHANGED
|
@@ -67,6 +67,9 @@ export declare type Inputs = Record<string, InputFieldDefinition>;
|
|
|
67
67
|
export declare type ConnectionInput = (StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField) & {
|
|
68
68
|
shown?: boolean;
|
|
69
69
|
};
|
|
70
|
+
export declare type OnPremConnectionInput = ConnectionInput & {
|
|
71
|
+
onPremControlled: true;
|
|
72
|
+
};
|
|
70
73
|
export declare type InputFieldDefinition = StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField | CodeInputField | ConditionalInputField | ConnectionInputField | ObjectSelectionInputField | ObjectFieldMapInputField | JSONFormInputField | DynamicObjectSelectionInputField | DynamicFieldSelectionInputField;
|
|
71
74
|
export declare type InputCleanFunction<TValue, TResult = TValue> = (value: TValue) => TResult;
|
|
72
75
|
interface BaseInputField {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule } from ".";
|
|
1
|
+
import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule, CollectionDataSourceType } from ".";
|
|
2
2
|
import { Prettify, UnionToIntersection, ValueOf } from "./utils";
|
|
3
3
|
export declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string;
|
|
4
4
|
export declare type ElementToRuntimeType<TElement extends ConfigPageElement<any>> = TElement extends ConnectionConfigVar<any> ? Connection : TElement extends DataSourceConfigVar<any> ? ToDataSourceRuntimeType<TElement["dataSourceType"]> : TElement extends ScheduleConfigVar ? Schedule : TElement extends StandardConfigVar ? string : never;
|
|
@@ -87,21 +87,27 @@ declare type BaseConfigVar = {
|
|
|
87
87
|
visibleToOrgDeployer?: boolean;
|
|
88
88
|
/** Optional value that specifies whether this Config Var is visible to a Customer deployer. @default true */
|
|
89
89
|
visibleToCustomerDeployer?: boolean;
|
|
90
|
+
/** Optional default value for the Config Var. */
|
|
91
|
+
defaultValue?: string;
|
|
92
|
+
/** Optional list of picklist values if the Config Var is a multi-choice selection value. */
|
|
93
|
+
pickList?: string[];
|
|
94
|
+
/** Optional value to specify the type of collection if the Config Var is multi-value. */
|
|
95
|
+
collectionType?: CollectionType;
|
|
90
96
|
};
|
|
91
97
|
/** Defines attributes of a standard Config Var. */
|
|
92
98
|
export declare type StandardConfigVar = BaseConfigVar & {
|
|
93
99
|
/** The data type of the Config Var. */
|
|
94
|
-
dataType: Exclude<ConfigVarDataType, "schedule">;
|
|
100
|
+
dataType: Exclude<ConfigVarDataType, "schedule" | "code">;
|
|
101
|
+
};
|
|
102
|
+
export declare type CodeConfigVar = BaseConfigVar & {
|
|
103
|
+
/** The data type of the Config Var. */
|
|
104
|
+
dataType: "code";
|
|
95
105
|
/** Optional default value for the Config Var. */
|
|
96
106
|
defaultValue?: string;
|
|
97
|
-
/** Optional list of picklist values if the Config Var is a multi-choice selection value. */
|
|
98
|
-
pickList?: string[];
|
|
99
107
|
/** Optional value to specify the type of language if the Config Var is a code value. */
|
|
100
108
|
codeLanguage?: CodeLanguageType;
|
|
101
|
-
/** Optional value to specify the type of collection if the Config Var is multi-value. */
|
|
102
|
-
collectionType?: CollectionType;
|
|
103
109
|
};
|
|
104
|
-
export declare type ScheduleConfigVar = BaseConfigVar & {
|
|
110
|
+
export declare type ScheduleConfigVar = Omit<BaseConfigVar, "collectionType"> & {
|
|
105
111
|
/** The data type of the Config Var. */
|
|
106
112
|
dataType: "schedule";
|
|
107
113
|
/** Optional default value for the Config Var. */
|
|
@@ -109,22 +115,28 @@ export declare type ScheduleConfigVar = BaseConfigVar & {
|
|
|
109
115
|
/** Optional timezone for the schedule. */
|
|
110
116
|
timeZone?: string;
|
|
111
117
|
};
|
|
112
|
-
declare type
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
declare type BaseDataSourceConfigVar = ({
|
|
119
|
+
dataSourceType: CollectionDataSourceType;
|
|
120
|
+
} & BaseConfigVar) | ({
|
|
121
|
+
dataSourceType: Exclude<DataSourceType, CollectionDataSourceType>;
|
|
122
|
+
} & Omit<BaseConfigVar, "collectionType">);
|
|
123
|
+
declare type DataSourceDefinitionConfigVar = BaseDataSourceConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, DataSourceType>, "display" | "inputs" | "examplePayload" | "dataSourceType" | "detailDataSource">;
|
|
124
|
+
declare type DataSourceReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseDataSourceConfigVar & {
|
|
115
125
|
dataSource: ToComponentReferences<"dataSource", TComponents, ConfigPages<TComponents>>;
|
|
116
126
|
};
|
|
117
127
|
/** Defines attributes of a data source Config Var. */
|
|
118
128
|
export declare type DataSourceConfigVar<TComponents extends ComponentSelector<any>> = DataSourceDefinitionConfigVar | DataSourceReferenceConfigVar<TComponents>;
|
|
119
|
-
declare type
|
|
120
|
-
declare type
|
|
129
|
+
declare type BaseConnectionConfigVar = Omit<BaseConfigVar, "collectionType">;
|
|
130
|
+
declare type ConnectionDefinitionConfigVar = BaseConnectionConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">;
|
|
131
|
+
declare type ConnectionReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseConnectionConfigVar & {
|
|
121
132
|
connection: ToComponentReferences<"connection", TComponents> & {
|
|
122
133
|
template?: string;
|
|
123
134
|
};
|
|
124
135
|
};
|
|
125
136
|
/** Defines attributes of a Config Var that represents a Connection. */
|
|
126
137
|
export declare type ConnectionConfigVar<TComponents extends ComponentSelector<any>> = ConnectionDefinitionConfigVar | ConnectionReferenceConfigVar<TComponents>;
|
|
127
|
-
export declare type ConfigVar<TComponents extends ComponentSelector<any>> = StandardConfigVar | ScheduleConfigVar | DataSourceConfigVar<TComponents> | ConnectionConfigVar<TComponents>;
|
|
138
|
+
export declare type ConfigVar<TComponents extends ComponentSelector<any>> = StandardConfigVar | CodeConfigVar | ScheduleConfigVar | DataSourceConfigVar<TComponents> | ConnectionConfigVar<TComponents>;
|
|
139
|
+
export declare const isCodeConfigVar: (cv: ConfigVar<any>) => cv is CodeConfigVar;
|
|
128
140
|
export declare const isScheduleConfigVar: (cv: ConfigVar<any>) => cv is ScheduleConfigVar;
|
|
129
141
|
export declare const isDataSourceDefinitionConfigVar: (cv: ConfigVar<any>) => cv is DataSourceDefinitionConfigVar;
|
|
130
142
|
export declare const isDataSourceReferenceConfigVar: <TComponents extends ComponentSelector<any>>(cv: ConfigVar<TComponents>) => cv is DataSourceReferenceConfigVar<TComponents>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isComponentReference = exports.isConnectionReferenceConfigVar = exports.isConnectionDefinitionConfigVar = exports.isDataSourceReferenceConfigVar = exports.isDataSourceDefinitionConfigVar = exports.isScheduleConfigVar = void 0;
|
|
3
|
+
exports.isComponentReference = exports.isConnectionReferenceConfigVar = exports.isConnectionDefinitionConfigVar = exports.isDataSourceReferenceConfigVar = exports.isDataSourceDefinitionConfigVar = exports.isScheduleConfigVar = exports.isCodeConfigVar = void 0;
|
|
4
|
+
const isCodeConfigVar = (cv) => "dataType" in cv && cv.dataType === "code";
|
|
5
|
+
exports.isCodeConfigVar = isCodeConfigVar;
|
|
4
6
|
const isScheduleConfigVar = (cv) => "dataType" in cv && cv.dataType === "schedule";
|
|
5
7
|
exports.isScheduleConfigVar = isScheduleConfigVar;
|
|
6
8
|
const isDataSourceDefinitionConfigVar = (cv) => "dataSourceType" in cv && "perform" in cv && typeof cv.perform === "function";
|
|
7
9
|
exports.isDataSourceDefinitionConfigVar = isDataSourceDefinitionConfigVar;
|
|
8
|
-
const isDataSourceReferenceConfigVar = (cv) => "
|
|
10
|
+
const isDataSourceReferenceConfigVar = (cv) => "dataSourceType" in cv &&
|
|
11
|
+
"dataSource" in cv &&
|
|
12
|
+
(0, exports.isComponentReference)(cv.dataSource);
|
|
9
13
|
exports.isDataSourceReferenceConfigVar = isDataSourceReferenceConfigVar;
|
|
10
14
|
const isConnectionDefinitionConfigVar = (cv) => "inputs" in cv;
|
|
11
15
|
exports.isConnectionDefinitionConfigVar = isConnectionDefinitionConfigVar;
|