@prismatic-io/spectral 8.0.0-preview8 → 8.0.1

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.
Files changed (35) hide show
  1. package/dist/clients/http/index.d.ts +1 -1
  2. package/dist/index.d.ts +15 -16
  3. package/dist/index.js +11 -10
  4. package/dist/serverTypes/convert.d.ts +3 -3
  5. package/dist/serverTypes/convert.js +6 -270
  6. package/dist/serverTypes/convertIntegration.d.ts +3 -0
  7. package/dist/serverTypes/convertIntegration.js +242 -0
  8. package/dist/serverTypes/index.d.ts +10 -9
  9. package/dist/serverTypes/integration.d.ts +60 -0
  10. package/dist/serverTypes/integration.js +4 -0
  11. package/dist/testing.d.ts +20 -20
  12. package/dist/testing.js +67 -76
  13. package/dist/types/ActionDefinition.d.ts +3 -3
  14. package/dist/types/ActionInputParameters.d.ts +1 -14
  15. package/dist/types/ActionPerformFunction.d.ts +6 -6
  16. package/dist/types/ComponentDefinition.d.ts +3 -3
  17. package/dist/types/DataSourceDefinition.d.ts +3 -3
  18. package/dist/types/DataSourcePerformFunction.d.ts +3 -8
  19. package/dist/types/DataSourceResult.d.ts +1 -3
  20. package/dist/types/Inputs.d.ts +52 -42
  21. package/dist/types/IntegrationDefinition.d.ts +44 -118
  22. package/dist/types/IntegrationDefinition.js +5 -19
  23. package/dist/types/TriggerDefinition.d.ts +5 -5
  24. package/dist/types/TriggerEventFunction.d.ts +2 -2
  25. package/dist/types/TriggerPerformFunction.d.ts +2 -2
  26. package/dist/types/TriggerResult.d.ts +4 -4
  27. package/dist/types/utils.d.ts +5 -0
  28. package/dist/types/utils.js +2 -0
  29. package/package.json +5 -4
  30. package/dist/clients/soap/index.d.ts +0 -2
  31. package/dist/clients/soap/index.js +0 -18
  32. package/dist/clients/soap/types.d.ts +0 -71
  33. package/dist/clients/soap/types.js +0 -24
  34. package/dist/clients/soap/utils.d.ts +0 -12
  35. package/dist/clients/soap/utils.js +0 -191
package/dist/testing.js CHANGED
@@ -38,47 +38,47 @@ const loggerMock = () => ({
38
38
  error: (0, jest_mock_1.spyOn)(console, "error"),
39
39
  });
40
40
  exports.loggerMock = loggerMock;
41
- const baseActionContext = {
42
- logger: (0, exports.loggerMock)(),
43
- instanceState: {},
44
- crossFlowState: {},
45
- executionState: {},
46
- integrationState: {},
47
- stepId: "mockStepId",
48
- executionId: "mockExecutionId",
49
- webhookUrls: {
50
- "Flow 1": "https://example.com",
51
- },
52
- webhookApiKeys: {
53
- "Flow 1": ["example-123", "example-456"],
54
- },
55
- invokeUrl: "https://example.com",
56
- customer: {
57
- id: "customerId",
58
- name: "Customer 1",
59
- externalId: "1234",
60
- },
61
- instance: {
62
- id: "instanceId",
63
- name: "Instance 1",
64
- },
65
- user: {
66
- id: "userId",
67
- email: "user@example.com",
68
- name: "User 1",
69
- externalId: "1234",
70
- },
71
- integration: {
72
- id: "integrationId",
73
- name: "Integration 1",
74
- versionSequenceId: "1234",
75
- externalVersion: "1.0.0",
76
- },
77
- flow: {
78
- id: "flowId",
79
- name: "Flow 1",
80
- },
81
- startedAt: new Date().toISOString(),
41
+ const createActionContext = (context) => {
42
+ return Object.assign({ logger: (0, exports.loggerMock)(), instanceState: {}, crossFlowState: {}, executionState: {}, integrationState: {}, configVars: {}, stepId: "mockStepId", executionId: "mockExecutionId", webhookUrls: {
43
+ "Flow 1": "https://example.com",
44
+ }, webhookApiKeys: {
45
+ "Flow 1": ["example-123", "example-456"],
46
+ }, invokeUrl: "https://example.com", customer: {
47
+ id: "customerId",
48
+ name: "Customer 1",
49
+ externalId: "1234",
50
+ }, instance: {
51
+ id: "instanceId",
52
+ name: "Instance 1",
53
+ }, user: {
54
+ id: "userId",
55
+ email: "user@example.com",
56
+ name: "User 1",
57
+ externalId: "1234",
58
+ }, integration: {
59
+ id: "integrationId",
60
+ name: "Integration 1",
61
+ versionSequenceId: "1234",
62
+ externalVersion: "1.0.0",
63
+ }, flow: {
64
+ id: "flowId",
65
+ name: "Flow 1",
66
+ }, startedAt: new Date().toISOString() }, context);
67
+ };
68
+ const createDataSourceContext = (context) => {
69
+ return Object.assign({ logger: (0, exports.loggerMock)(), configVars: {}, customer: {
70
+ id: "customerId",
71
+ name: "Customer 1",
72
+ externalId: "1234",
73
+ }, instance: {
74
+ id: "instanceId",
75
+ name: "Instance 1",
76
+ }, user: {
77
+ id: "userId",
78
+ email: "example@email.com",
79
+ externalId: "1234",
80
+ name: "Example",
81
+ } }, context);
82
82
  };
83
83
  /**
84
84
  * Invokes specified ActionDefinition perform function using supplied params
@@ -86,8 +86,8 @@ const baseActionContext = {
86
86
  * to avoid extra casting within test methods. Returns an InvokeResult containing both the
87
87
  * action result and a mock logger for asserting logging.
88
88
  */
89
- const invoke = ({ perform }, params, context) => __awaiter(void 0, void 0, void 0, function* () {
90
- const realizedContext = Object.assign(Object.assign({}, baseActionContext), context);
89
+ const invoke = ({ perform, }, params, context) => __awaiter(void 0, void 0, void 0, function* () {
90
+ const realizedContext = createActionContext(context);
91
91
  const result = yield perform(realizedContext, params);
92
92
  return {
93
93
  result,
@@ -155,8 +155,8 @@ exports.defaultTriggerPayload = defaultTriggerPayload;
155
155
  * to avoid extra casting within test methods. Returns an InvokeResult containing both the
156
156
  * trigger result and a mock logger for asserting logging.
157
157
  */
158
- const invokeTrigger = ({ perform }, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
159
- const realizedContext = Object.assign(Object.assign({}, baseActionContext), context);
158
+ const invokeTrigger = ({ perform, }, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
159
+ const realizedContext = createActionContext(context);
160
160
  const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload);
161
161
  const realizedParams = params || {};
162
162
  const result = yield perform(realizedContext, realizedPayload, realizedParams);
@@ -166,46 +166,40 @@ const invokeTrigger = ({ perform }, context, payload, params) => __awaiter(void
166
166
  };
167
167
  });
168
168
  exports.invokeTrigger = invokeTrigger;
169
- const baseDataSourceContext = {
170
- logger: (0, exports.loggerMock)(),
171
- customer: {
172
- id: "customerId",
173
- name: "Customer 1",
174
- externalId: "1234",
175
- },
176
- instance: {
177
- id: "instanceId",
178
- name: "Instance 1",
179
- },
180
- user: {
181
- id: "userId",
182
- email: "example@email.com",
183
- externalId: "1234",
184
- name: "Example",
185
- },
186
- };
187
169
  /**
188
170
  * Invokes specified DataSourceDefinition perform function using supplied params.
189
171
  * Accepts a generic type matching DataSourceResult as a convenience to avoid extra
190
172
  * casting within test methods. Returns a DataSourceResult.
191
173
  */
192
174
  const invokeDataSource = ({ perform }, params, context) => __awaiter(void 0, void 0, void 0, function* () {
193
- const realizedContext = Object.assign(Object.assign({}, baseDataSourceContext), context);
175
+ const realizedContext = createDataSourceContext(context);
194
176
  const result = yield perform(realizedContext, params);
195
177
  return result;
196
178
  });
197
179
  exports.invokeDataSource = invokeDataSource;
180
+ const createConfigVars = (values) => {
181
+ return Object.entries(values).reduce((result, [key, value]) => {
182
+ // Connection
183
+ if (typeof value === "object" && "fields" in value) {
184
+ return Object.assign(Object.assign({}, result), { [key]: Object.assign(Object.assign({}, value), { key, configVarKey: "" }) });
185
+ }
186
+ return Object.assign(Object.assign({}, result), { [key]: value });
187
+ }, {});
188
+ };
198
189
  /**
199
190
  * Invokes specified Flow of a Code Native Integration using supplied params.
200
191
  * Runs the Trigger and then the Action function and returns the result of the Action.
201
192
  */
202
- const invokeFlow = (flow, context, payload) => __awaiter(void 0, void 0, void 0, function* () {
203
- const realizedContext = Object.assign(Object.assign({}, baseActionContext), context);
193
+ const invokeFlow = (flow, configVars, context, payload) => __awaiter(void 0, void 0, void 0, function* () {
194
+ const realizedConfigVars = createConfigVars(configVars);
195
+ const realizedContext = createActionContext(Object.assign(Object.assign({}, context), { configVars: realizedConfigVars }));
204
196
  const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload);
205
- const params = {};
197
+ const params = {
198
+ onTrigger: { results: null },
199
+ };
206
200
  if ("onTrigger" in flow) {
207
201
  const triggerResult = yield flow.onTrigger(realizedContext, realizedPayload, params);
208
- params.trigger = triggerResult;
202
+ params.onTrigger = { results: triggerResult === null || triggerResult === void 0 ? void 0 : triggerResult.payload };
209
203
  }
210
204
  const result = yield flow.onExecution(realizedContext, params);
211
205
  return {
@@ -218,9 +212,6 @@ class ComponentTestHarness {
218
212
  constructor(component) {
219
213
  this.component = component;
220
214
  }
221
- buildContext(baseContext, context) {
222
- return Object.assign(Object.assign({}, baseContext), context);
223
- }
224
215
  buildParams(inputs, params) {
225
216
  const defaults = inputs.reduce((result, { key, default: defaultValue }) => (Object.assign(Object.assign({}, result), { [key]: `${defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""}` })), {});
226
217
  return Object.assign(Object.assign({}, defaults), params);
@@ -236,7 +227,7 @@ class ComponentTestHarness {
236
227
  trigger(key, payload, params, context) {
237
228
  return __awaiter(this, void 0, void 0, function* () {
238
229
  const trigger = this.component.triggers[key];
239
- return trigger.perform(this.buildContext(baseActionContext, context), Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload), this.buildParams(trigger.inputs, params));
230
+ return trigger.perform(createActionContext(context), Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload), this.buildParams(trigger.inputs, params));
240
231
  });
241
232
  }
242
233
  triggerOnInstanceDeploy(key, params, context) {
@@ -245,7 +236,7 @@ class ComponentTestHarness {
245
236
  if (!trigger.onInstanceDeploy) {
246
237
  throw new Error("Trigger does not support onInstanceDeploy");
247
238
  }
248
- return trigger.onInstanceDeploy(this.buildContext(baseActionContext, context), this.buildParams(trigger.inputs, params));
239
+ return trigger.onInstanceDeploy(createActionContext(context), this.buildParams(trigger.inputs, params));
249
240
  });
250
241
  }
251
242
  triggerOnInstanceDelete(key, params, context) {
@@ -254,19 +245,19 @@ class ComponentTestHarness {
254
245
  if (!trigger.onInstanceDelete) {
255
246
  throw new Error("Trigger does not support onInstanceDelete");
256
247
  }
257
- return trigger.onInstanceDelete(this.buildContext(baseActionContext, context), this.buildParams(trigger.inputs, params));
248
+ return trigger.onInstanceDelete(createActionContext(context), this.buildParams(trigger.inputs, params));
258
249
  });
259
250
  }
260
251
  action(key, params, context) {
261
252
  return __awaiter(this, void 0, void 0, function* () {
262
253
  const action = this.component.actions[key];
263
- return action.perform(this.buildContext(baseActionContext, context), this.buildParams(action.inputs, params));
254
+ return action.perform(createActionContext(context), this.buildParams(action.inputs, params));
264
255
  });
265
256
  }
266
257
  dataSource(key, params, context) {
267
258
  return __awaiter(this, void 0, void 0, function* () {
268
259
  const dataSource = this.component.dataSources[key];
269
- return dataSource.perform(this.buildContext(baseDataSourceContext, context), this.buildParams(dataSource.inputs, params));
260
+ return dataSource.perform(createDataSourceContext(context), this.buildParams(dataSource.inputs, params));
270
261
  });
271
262
  }
272
263
  }
@@ -1,13 +1,13 @@
1
- import { ActionDisplayDefinition, ActionPerformFunction, ActionPerformReturn, Inputs } from ".";
1
+ import { ActionDisplayDefinition, ActionPerformFunction, ActionPerformReturn, ConfigVarResultCollection, Inputs } from ".";
2
2
  /**
3
3
  * ActionDefinition is the type of the object that is passed in to `action` function to
4
4
  * define a component action.
5
5
  */
6
- export interface ActionDefinition<TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> {
6
+ export interface ActionDefinition<TInputs extends Inputs = Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TAllowsBranching extends boolean = boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown> = ActionPerformReturn<TAllowsBranching, unknown>> {
7
7
  /** Defines how the Action is displayed in the Prismatic interface. */
8
8
  display: ActionDisplayDefinition;
9
9
  /** Function to perform when this Action is invoked. */
10
- perform: ActionPerformFunction<TInputs, TAllowsBranching, TReturn>;
10
+ perform: ActionPerformFunction<TInputs, TConfigVars, TAllowsBranching, TReturn>;
11
11
  /** InputFields to present in the Prismatic interface for configuration of this Action. */
12
12
  inputs: TInputs;
13
13
  /** Optional attribute that specifies whether an Action will terminate execution.*/
@@ -1,6 +1,6 @@
1
1
  import { Inputs } from ".";
2
2
  import { ConditionalExpression } from "./conditional-logic";
3
- import { InputFieldCollection, InputCleanFunction, Connection } from "./Inputs";
3
+ import { InputFieldCollection, InputCleanFunction, Connection, KeyValuePair } from "./Inputs";
4
4
  /**
5
5
  * Collection of input parameters.
6
6
  * Inputs can be static values, references to config variables, or
@@ -10,16 +10,3 @@ export declare type ActionInputParameters<TInputs extends Inputs> = {
10
10
  [Property in keyof TInputs]: TInputs[Property]["clean"] extends InputCleanFunction<any> ? ReturnType<TInputs[Property]["clean"]> : TInputs[Property]["type"] extends "connection" ? ExtractValue<Connection, TInputs[Property]["collection"]> : TInputs[Property]["type"] extends "conditional" ? ExtractValue<ConditionalExpression, TInputs[Property]["collection"]> : ExtractValue<TInputs[Property]["default"], TInputs[Property]["collection"]>;
11
11
  };
12
12
  export declare type ExtractValue<TType, TCollection extends InputFieldCollection | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TType>[] : TCollection extends "valuelist" ? TType[] : TType;
13
- /**
14
- * KeyValuePair input parameter type.
15
- * This allows users to input multiple keys / values as an input.
16
- * To see an example of how this can be used, see the `tagging` input
17
- * of the `putObject` action of the AWS S3 component:
18
- * https://github.com/prismatic-io/examples/blob/main/components/aws-s3/src/actions.ts
19
- */
20
- export interface KeyValuePair<V = unknown> {
21
- /** Key of the KeyValuePair */
22
- key: string;
23
- /** Value of the KeyValuePair */
24
- value: V;
25
- }
@@ -1,12 +1,10 @@
1
- import { Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger, InstanceAttributes, CustomerAttributes, UserAttributes, IntegrationAttributes, FlowAttributes } from ".";
1
+ import { Inputs, ConfigVarResultCollection, ActionPerformReturn, ActionInputParameters, ActionLogger, InstanceAttributes, CustomerAttributes, UserAttributes, IntegrationAttributes, FlowAttributes } from ".";
2
2
  /** Definition of the function to perform when an Action is invoked. */
3
- export declare type ActionPerformFunction<TInputs extends Inputs, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext, params: ActionInputParameters<TInputs>) => Promise<TReturn>;
3
+ export declare type ActionPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<TReturn>;
4
4
  /** Context provided to perform method containing helpers and contextual data */
5
- export interface ActionContext {
5
+ export declare type ActionContext<TConfigVars extends ConfigVarResultCollection> = {
6
6
  /** Logger for permanent logging; console calls are also captured */
7
7
  logger: ActionLogger;
8
- /** Code Components and Code Native Integration Actions will have access to all Config Vars, otherwise this will be undefined. */
9
- configVars?: Record<string, unknown>;
10
8
  /** A a flow-specific key/value store that may be used to store small amounts of data that is persisted between Instance executions */
11
9
  instanceState: Record<string, unknown>;
12
10
  /** A key/value store that is shared between flows on an Instance that may be used to store small amounts of data that is persisted between Instance executions */
@@ -15,6 +13,8 @@ export interface ActionContext {
15
13
  executionState: Record<string, unknown>;
16
14
  /** A key/value store that is shared between all flows of an Instance for any version of an Integration that may be used to store small amounts of data that is persisted between Instance executions */
17
15
  integrationState: Record<string, unknown>;
16
+ /** Key/value collection of config variables of the integration. */
17
+ configVars: TConfigVars;
18
18
  /** A unique id that corresponds to the step on the Integration */
19
19
  stepId: string;
20
20
  /** A unique id that corresponds to the specific execution of the Integration */
@@ -37,4 +37,4 @@ export interface ActionContext {
37
37
  flow: FlowAttributes;
38
38
  /** The time in UTC that execution started. */
39
39
  startedAt: string;
40
- }
40
+ };
@@ -13,11 +13,11 @@ export declare type ComponentDefinition<TPublic extends boolean, TKey extends st
13
13
  /** Defines how the Component is displayed in the Prismatic interface. */
14
14
  display: ComponentDisplayDefinition<TPublic>;
15
15
  /** Specifies the supported Actions of this Component. */
16
- actions?: Record<string, ActionDefinition<any, boolean, any>>;
16
+ actions?: Record<string, ActionDefinition<any, any, boolean, any>>;
17
17
  /** Specifies the supported Triggers of this Component. */
18
- triggers?: Record<string, TriggerDefinition<any, boolean, any>>;
18
+ triggers?: Record<string, TriggerDefinition<any, any, boolean, any>>;
19
19
  /** Specifies the supported Data Sources of this Component. */
20
- dataSources?: Record<string, DataSourceDefinition<any, any>>;
20
+ dataSources?: Record<string, DataSourceDefinition<any, any, any>>;
21
21
  /** Specifies the supported Connections of this Component. */
22
22
  connections?: ConnectionDefinition[];
23
23
  /** Hooks */
@@ -1,13 +1,13 @@
1
- import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceType } from ".";
1
+ import { ActionDisplayDefinition, DataSourcePerformFunction, Inputs, DataSourceType, ConfigVarResultCollection } from ".";
2
2
  /**
3
3
  * DataSourceDefinition is the type of the object that is passed in to `dataSource` function to
4
4
  * define a component Data Source.
5
5
  */
6
- export interface DataSourceDefinition<TInputs extends Inputs, TDataSourceType extends DataSourceType> {
6
+ export interface DataSourceDefinition<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType> {
7
7
  /** Defines how the Data Source is displayed in the Prismatic interface. */
8
8
  display: ActionDisplayDefinition;
9
9
  /** Function to perform when this Data Source is invoked; fetches data from the data source. */
10
- perform: DataSourcePerformFunction<TInputs, TDataSourceType>;
10
+ perform: DataSourcePerformFunction<TInputs, TConfigVars, TDataSourceType>;
11
11
  /** The type of data that this Data Source represents. */
12
12
  dataSourceType: TDataSourceType;
13
13
  /** InputFields to present in the Prismatic interface for configuration of this Data Source. */
@@ -1,10 +1,5 @@
1
- import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ActionLogger, CustomerAttributes, InstanceAttributes, UserAttributes } from ".";
1
+ import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ConfigVarResultCollection, ActionContext } from ".";
2
2
  /** Context provided to perform method containing helpers and contextual data */
3
- export interface DataSourceContext {
4
- logger: ActionLogger;
5
- customer: CustomerAttributes;
6
- instance: InstanceAttributes;
7
- user: UserAttributes;
8
- }
3
+ export declare type DataSourceContext<TConfigVars extends ConfigVarResultCollection> = Pick<ActionContext<TConfigVars>, "logger" | "customer" | "instance" | "user" | "configVars">;
9
4
  /** Definition of the function to perform when a Data Source is invoked. */
10
- export declare type DataSourcePerformFunction<TInputs extends Inputs, TDataSourceType extends DataSourceType> = (context: DataSourceContext, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>;
5
+ export declare type DataSourcePerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType> = (context: DataSourceContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>;
@@ -1,4 +1,4 @@
1
- import { ObjectSelection, ObjectFieldMap, JSONForm, Element, Connection } from "./Inputs";
1
+ import { ObjectSelection, ObjectFieldMap, JSONForm, Element } from "./Inputs";
2
2
  /** The type of field that is appropriate for rendering the data that is the result of the data source perform function. */
3
3
  declare type DataSourceTypeMap = {
4
4
  string: string;
@@ -9,10 +9,8 @@ declare type DataSourceTypeMap = {
9
9
  value: string;
10
10
  };
11
11
  code: string;
12
- credential: unknown;
13
12
  boolean: boolean;
14
13
  number: number;
15
- connection: Connection;
16
14
  objectSelection: ObjectSelection;
17
15
  objectFieldMap: ObjectFieldMap;
18
16
  jsonForm: JSONForm;
@@ -1,5 +1,18 @@
1
1
  import { ConditionalExpression } from "./conditional-logic";
2
2
  import { JsonSchema, UISchemaElement } from "@jsonforms/core";
3
+ /**
4
+ * KeyValuePair input parameter type.
5
+ * This allows users to input multiple keys / values as an input.
6
+ * To see an example of how this can be used, see the `tagging` input
7
+ * of the `putObject` action of the AWS S3 component:
8
+ * https://github.com/prismatic-io/examples/blob/main/components/aws-s3/src/actions.ts
9
+ */
10
+ export interface KeyValuePair<V = unknown> {
11
+ /** Key of the KeyValuePair */
12
+ key: string;
13
+ /** Value of the KeyValuePair */
14
+ value: V;
15
+ }
3
16
  export declare type Element = {
4
17
  key: string;
5
18
  label?: string;
@@ -66,81 +79,76 @@ interface BaseInputField {
66
79
  /** Indicate if this InputField is required. */
67
80
  required?: boolean;
68
81
  }
69
- export interface StringInputField extends BaseInputField {
70
- /** Data type the InputField will collect. */
71
- type: "string";
82
+ declare type CollectionOptions<T> = SingleValue<T> | ValueListCollection<T> | KeyValueListCollection<T>;
83
+ interface SingleValue<T> {
72
84
  /** Collection type of the InputField */
73
- collection?: InputFieldCollection;
85
+ collection?: undefined;
74
86
  /** Default value for this field. */
75
- default?: unknown;
87
+ default?: T;
88
+ }
89
+ interface ValueListCollection<T> {
90
+ /** Collection type of the InputField */
91
+ collection: "valuelist";
92
+ /** Default value for this field. */
93
+ default?: T[];
94
+ }
95
+ interface KeyValueListCollection<T> {
96
+ /** Collection type of the InputField */
97
+ collection: "keyvaluelist";
98
+ /** Default value for this field. */
99
+ default?: KeyValuePair<T>[];
100
+ }
101
+ export declare type StringInputField = BaseInputField & CollectionOptions<string> & {
102
+ /** Data type the InputField will collect. */
103
+ type: "string";
76
104
  /** Dictates possible choices for the input. */
77
105
  model?: InputFieldChoice[];
78
106
  /** Clean function */
79
- clean?: InputCleanFunction<this["default"]>;
80
- }
81
- export interface DataInputField extends BaseInputField {
107
+ clean?: InputCleanFunction<unknown>;
108
+ };
109
+ export declare type DataInputField = BaseInputField & CollectionOptions<string> & {
82
110
  /** Data type the InputField will collect. */
83
111
  type: "data";
84
- /** Collection type of the InputField */
85
- collection?: InputFieldCollection;
86
- /** Default value for this field. */
87
- default?: unknown;
88
112
  /** Dictates possible choices for the input. */
89
113
  model?: InputFieldChoice[];
90
114
  /** Clean function */
91
- clean?: InputCleanFunction<this["default"]>;
92
- }
93
- export interface TextInputField extends BaseInputField {
115
+ clean?: InputCleanFunction<unknown>;
116
+ };
117
+ export declare type TextInputField = BaseInputField & CollectionOptions<string> & {
94
118
  /** Data type the InputField will collect. */
95
119
  type: "text";
96
- /** Collection type of the InputField */
97
- collection?: InputFieldCollection;
98
- /** Default value for this field. */
99
- default?: unknown;
100
120
  /** Dictates possible choices for the input. */
101
121
  model?: InputFieldChoice[];
102
122
  /** Clean function */
103
- clean?: InputCleanFunction<this["default"]>;
104
- }
105
- export interface PasswordInputField extends BaseInputField {
123
+ clean?: InputCleanFunction<unknown>;
124
+ };
125
+ export declare type PasswordInputField = BaseInputField & CollectionOptions<string> & {
106
126
  /** Data type the InputField will collect. */
107
127
  type: "password";
108
- /** Collection type of the InputField */
109
- collection?: InputFieldCollection;
110
- /** Default value for this field. */
111
- default?: unknown;
112
128
  /** Dictates possible choices for the input. */
113
129
  model?: InputFieldChoice[];
114
130
  /** Clean function */
115
- clean?: InputCleanFunction<this["default"]>;
116
- }
117
- export interface BooleanInputField extends BaseInputField {
131
+ clean?: InputCleanFunction<unknown>;
132
+ };
133
+ export declare type BooleanInputField = BaseInputField & CollectionOptions<string> & {
118
134
  /** Data type the InputField will collect. */
119
135
  type: "boolean";
120
- /** Collection type of the InputField */
121
- collection?: InputFieldCollection;
122
- /** Default value for this field. */
123
- default?: unknown;
124
136
  /** Dictates possible choices for the input. */
125
137
  model?: InputFieldChoice[];
126
138
  /** Clean function */
127
- clean?: InputCleanFunction<this["default"]>;
128
- }
139
+ clean?: InputCleanFunction<unknown>;
140
+ };
129
141
  /** Defines attributes of a CodeInputField. */
130
- export interface CodeInputField extends BaseInputField {
142
+ export declare type CodeInputField = BaseInputField & CollectionOptions<string> & {
131
143
  /** Data type the InputField will collect. */
132
144
  type: "code";
133
- /** Collection type of the InputField */
134
- collection?: InputFieldCollection;
135
- /** Default value for this field. */
136
- default?: unknown;
137
145
  /** Code language for syntax highlighting. For no syntax highlighting, choose "plaintext" */
138
146
  language: "css" | "graphql" | "handlebars" | "hcl" | "html" | "javascript" | "json" | "liquid" | "markdown" | "mysql" | "pgsql" | "plaintext" | "sql" | "typescript" | "xml" | "yaml";
139
147
  /** Dictates possible choices for the input. */
140
148
  model?: InputFieldChoice[];
141
149
  /** Clean function */
142
- clean?: InputCleanFunction<this["default"]>;
143
- }
150
+ clean?: InputCleanFunction<unknown>;
151
+ };
144
152
  /** Defines attributes of a ConditionalInputField. */
145
153
  export interface ConditionalInputField extends BaseInputField {
146
154
  /** Data type the InputField will collect. */
@@ -239,4 +247,6 @@ export interface InputFieldChoice {
239
247
  }
240
248
  /** InputField collection enumeration */
241
249
  export declare type InputFieldCollection = "valuelist" | "keyvaluelist";
250
+ /** Config variable result collection */
251
+ export declare type ConfigVarResultCollection = Record<string, string | Connection | JSONForm | ObjectSelection | ObjectFieldMap>;
242
252
  export {};